← Technical notes
Confidential / NDA4 diagrams

Flexible Financial Settlement Engine for Enterprise CRM

Lead Developer & Technical BA (acting) — mid-project discovery, schema redesign, and a batch-based payout model aligned with real commission accounting.

TL;DR

Architecture notes: finance shopping cart model, consolidated payment vouchers, and enterprise CRM commission flow (NDA).

live trace · System Flowfrom the original diagram
No Yes No Yes Yes Cron Job Start Fetch Completed Cases CALCULATION ENGINELoop per Agent CALCULATION ENGINE◆ Is WHT Enabled forAgent? CALCULATION ENGINE◆ YTD + current meetspolicy threshold? CALCULATION ENGINETax = 0 CALCULATION ENGINEWithholding = commission* policy rate Insert Commission RecordStatus: NEW FINANCE SHOPPING CARTAgent: Views MyCommission FINANCE SHOPPING CARTAgent Submits FINANCE SHOPPING CARTAdmin Approves FINANCE SHOPPING CARTFinance Pool FINANCE SHOPPING CART◆ Finance Selects Items FINANCE SHOPPING CARTLOCK Records, SetBatch_ID FINANCE SHOPPING CARTDraft Batch FINANCE SHOPPING CARTGenerate PV
  1. 01
    Cron Job Start→ Fetch Completed Cases
  2. 02
    Fetch Completed Cases→ Loop per Agent
  3. 03
    Calculation EngineLoop per Agent→ Is WHT Enabled for Agent?
  4. 04
    Calculation Engine◆ Is WHT Enabled for Agent?→ Tax = 0 [No]→ YTD + current meets policy threshold? [Yes]
  5. 05
    Calculation Engine◆ YTD + current meets policy threshold?→ Tax = 0 [No]→ Withholding = commission * policy rate [Yes]
  6. 06
    Calculation EngineTax = 0→ Insert Commission Record Status: NEW
  7. 07
    Calculation EngineWithholding = commission * policy rate→ Insert Commission Record Status: NEW
  8. 08
    Insert Commission Record Status: NEW→ Agent: Views My Commission
  9. 09
    Finance Shopping CartAgent: Views My Commission→ Agent Submits
  10. 10
    Finance Shopping CartAgent Submits→ Admin Approves
  11. 11
    Finance Shopping CartAdmin Approves→ Finance Pool
  12. 12
    Finance Shopping CartFinance Pool→ Finance Selects Items
  13. 13
    Finance Shopping Cart◆ Finance Selects Items→ LOCK Records, Set Batch_ID [Yes]
  14. 14
    Finance Shopping CartLOCK Records, Set Batch_ID→ Draft Batch
  15. 15
    Finance Shopping CartDraft Batch→ Generate PV
  16. 16
    Finance Shopping CartGenerate PV
Challenge

Rigid deal ↔ payout assumptions

Joined an ongoing enterprise CRM build mid-flight. Discovery surfaced a critical architectural mismatch: the system assumed a fixed one-to-one link between deals and payouts. In practice, the client needed partial line items (base, bonus, incentives) across hierarchical partners and timelines — consolidated into single payment vouchers per agent.

Solution

Finance "shopping cart" batching

Designed a model where finance selects specific commission rows from multiple deals, locks them into a draft batch, and generates one consolidated payment voucher (PV) per agent. Led alignment across UI/UX and engineering on schema, locking rules, and commission lifecycle states.

02

Impact

Reduced the risk of a disruptive post-launch financial refactor by matching how payouts are actually prepared in accounting — granular inputs, explicit locks, and clear voucher outputs — before go-live.

03

Technical architecture

Four views of the same design: data shape, end-to-end flow, cross-system sequence, and commission record states including the finance selection "lock".

All diagrams

Other views

Tap a table to see what it links to.

AGENTint id PKstring nameboolean is_wht_enableddecimal ytd_earnings
SALE_CASEint id PKstring property_detailsstring statusdecimal total_price
COMMISSION_RECORDint id PKint agent_id FKint case_id FKstring typedecimal gross_amountdecimal wht_amountstring statusint active_batch_id FKint final_pv_id FK
PAYMENT_BATCHint id PKstring batch_namestring created_by_userstring statusdatetime created_at
PAYMENT_VOUCHERint id PKstring pv_numberint agent_id FKint source_batch_id FKdate pv_datedecimal total_payoutdecimal total_wht_deducted
  • AGENT closes SALE_CASE 1 → many
  • AGENT earns COMMISSION_RECORD 1 → many
  • SALE_CASE generates COMMISSION_RECORD 1 → many
  • PAYMENT_BATCH contains COMMISSION_RECORD 1 → many
  • PAYMENT_VOUCHER covers COMMISSION_RECORD 1 → many

← Technical notes on the home page