Skip to content

Sales Block Processing

Purpose

The purpose of this document is to outline how Client Processing manages updates from Deal Engine. The majority of this process is handled by the back end. This screen is mainly used for clearing errors, approving large revenue changes, and researching updates to Deals.

Data Processing and Rules

Steps

The below should be followed for any record with process_status_cd = 'U' (Unprocessed).

1. Validate Data (Layer 1)

The following rules must be validated before processing. If any of these rules fail, the row will be set to FAILED Status with detailed status set to Validation Failure - {Rule}.

  • Payment Gross Match: Sum of payment_term.gross_amt must equal sales_item.gross_amt. If not: Payment Gross does not match Sales Item.
  • Required Fields: The following fields must be populated. If not: Required fields missing.
    • Sales Item (sales_item):
      • sales_item_ref
      • sales_item_ver
      • deal_id
      • uta_entity_id
      • client_entity_id
      • buyer_entity_id
      • name
      • currency_cd
      • gross_amt
      • uta_commission_type
      • uta_commission_amt
      • revenue_start_dt
      • revenue_end_dt
      • rev_rec_style_cd
      • revenue_date_status_cd
      • sales_item_status_cd
    • Payment Term (payment_term):
      • payment_term_ref
      • payment_term_ver
      • name
      • payment_party_id
      • gross_amt
      • due_dt
      • due_date_status_cd
  • Non-Negative Amounts: The following fields must be greater than or equal to 0. If not: Amount cannot be less than zero.
    • sales_item.gross_amt
    • sales_item.uta_commission_amt
    • payment_term.gross_amt

2. Validate Consistency (Layer 2)

If this is the first time the sales_item_ref has been seen (no matching revenue_items record), skip this step. TODO - Define new Revenue and billing creation. If a matching revenue_items record exists, ensure immutable fields have not changed. If they have, set FAILED Status with detailed status set to Data Validation Failure - {Rule}.

  • Immutable Fields:
    • sales_item.sales_item_ref must match revenue_items.sales_item_ref
    • sales_item.deal_id must match revenue_items.deal_id
    • sales_item.uta_entity_id must match revenue_items.uta_entity_id
    • sales_item.client_entity_id must match revenue_items.client_id
    • sales_item.buyer_entity_id must match revenue_items.buyer_id
    • sales_item.currency_cd must match revenue_items.currency_cd

3. Validate Referential Data (Layer 3)

Verify if all of the referential data matches a valid record. If not, set FAILED Status with detailed status set to Reference Data not found - {Reference}.

  • sales_item.deal_id -> Valid Deal
  • sales_item.uta_commission_type -> Valid COMMISSION_TYPE_CD
  • sales_item.rev_rec_style_cd -> Valid REVENUE_ITEM_REC_STYLE_CD
  • sales_item.revenue_date_status_cd -> Valid REVENUE_ITEM_DATE_STATUS_CD
  • sales_item.sales_item_status_cd -> Valid REVENUE_ITEM_STATUS_CD
  • sales_item.currency_cd -> Valid CURRENCY_CD
  • sales_item.client_entity_id -> Valid Party
  • sales_item.buyer_entity_id -> Valid Party
  • payment_term.payment_party_id -> Valid Party
  • payment_term.due_date_status_cd -> Valid BILLING_ITEM_DATE_STATUS_CD

4. Process Revenue Update

If all validations pass, proceed with the revenue update.

  1. Fetch Data:

    • Retrieve the revenue_items record using sales_item.sales_item_ref.
    • Retrieve all payment_term records associated with the sales_item.
  2. Build Current State:

    • Construct a currentState object mapping sales_item fields to revenue_items fields and including the list of payment_terms.
    Sales Item FieldRevenue Item Field
    namerevenue_item_name
    gross_amtrevenue_item_gross_amt
    uta_commission_amtrevenue_item_commission_amt
    uta_commission_percrevenue_item_commission_perc
    revenue_start_dtrevenue_item_start_dt
    revenue_end_dtrevenue_item_end_dt
    rev_rec_style_cdrevenue_item_rec_style_cd
    sales_item_status_cdrevenue_item_status_cd
    revenue_date_status_cdrevenue_item_date_status_cd
  3. Call Revenue Service:

    • Invoke RevenueService.updateRevenueItem.
    • Reference: See src/ref/key-procedurdes.md for the detailed logic of updateRevenueItem.

UI

Client FrameworkClient Framework

Data Mappings

Sales Item to Revenue Item

Source: sales_item | Target: revenue_items

Sales Item FieldRevenue Item FieldComment
uta_entity_iduta_entity_id
agent_group_idagent_group_id
sales_item_refsales_item_ref
sales_item_status_cdrevenue_item_status_cdDefault 'U' if null
namerevenue_item_name
revenue_date_status_cdrevenue_item_date_status_cdDefault 'U' if null
deal_iddeal_id
client_entity_idclient_id
buyer_entity_idbuyer_id
project_idproject_id
department_iddepartment_id
currency_cdcurrency_cd
gross_amtrevenue_item_gross_amt
uta_commission_typerevenue_item_commission_flat_indTrue if 'FLAT', else False
uta_commission_percrevenue_item_commission_perc
uta_commission_amtrevenue_item_commission_amt
revenue_start_dtrevenue_item_start_dt
revenue_end_dtrevenue_item_end_dt
rev_rec_style_cdrevenue_item_rec_style_cd
(Constant)current_item_indSet to true

Sales Item to Revenue Schedules

Source: sales_item (Logic) | Target: revenue_item_schedules

Source ValueRevenue Schedule FieldComment
(Generated ID)revenue_item_idFrom created revenue_items record
uta_commission_amtrevenue_amtDistributed based on rev_rec_style_cd
revenue_start_dtrevenue_dtIterated monthly if rev_rec_style_cd = 'M'
(Constant)revenue_item_posting_status_cdSet to 'U'
(Constant)revenue_item_posting_dtSet to NULL

Payment Term to Billing Item

Source: payment_term | Target: billing_item

Payment Term FieldBilling Item FieldComment
(Generated ID)revenue_item_idFrom created revenue_items record
payment_term_refpayment_term_ref
due_dtbilling_item_due_dt
(Constant)billing_item_due_dt_status_cdSet to 'U'
due_dtbilling_item_aging_dtDefaults to due_dt (unless matched)
namebilling_item_name
(Constant)billing_item_status_cdSet to 'U'
payment_party_idcollection_party_idLogic applies if override exists
(Logic)collection_style_cd'BUYER' if party matches buyer, else 'CLIENT'
(Match/Default)deal_idFrom matched item or default
(Match/Default)uta_entity_idFrom matched item or default
(Match/Default)agent_group_idFrom matched item or default
(Match/Default)buyer_idFrom matched item or default
(Match/Default)client_idFrom matched item or default
(Match/Default)billing_item_project_idFrom matched item or default
(Match/Default)billing_item_currency_cdFrom matched item or default
(Match/Default)uta_departmentFrom matched item or default
(Constant)current_item_indSet to true
(Constant)open_item_indSet to true (updated later)

Payment Term to Billing Item Detail

Source: payment_term | Target: billing_item_detail

Payment Term FieldBilling Item Detail FieldComment
(Generated ID)billing_item_idFrom created billing_item record
(Constant)billing_item_detail_type_cd'REV' or 'PAY'
gross_amtbilling_item_detail_gross_amt
gross_amtbilling_item_detail_net_amtInitially same as gross
(Logic)billing_item_detail_percentcommissionPerc (REV) or 1-commissionPerc (PAY)
(Calculated)billing_item_detail_billing_amtnet_amt * percent
(Constant)billing_item_detail_tax_amtSet to 0.00
(Calculated)billing_item_detail_total_amtbilling_amt + tax_amt
(Constant)posting_status_cdSet to 'U'
(Constant)posting_dtSet to NULL

Confidential. For internal use only.