Commission moves through three life stages. accrual on the trigger event, reversal on void / refund / cancelled-or-missed session, and payout via payroll. This article walks each stage with the exact event triggers, the GL impact, and what each role does. Read this before tuning the commission policy or before writing your next claw-back rule.

Stage 1 — accrual#

What triggers it#

  • Invoice paid. An InvoicePaid event triggers the engine. Per-rule listeners write Commission rows for the seller + supervisor.
  • Session arrived / paid. A scheduled job walks sessions per branch per date and writes Commission rows for the call-agent + supervisor based on arrived and paid sessions, picking the high-rate (≥50% arrival) or low-rate variant per the agent's daily arrival rate.

Submitting a service report does NOT create a commission row by itself. The commission engine waits for the parent invoice to be paid (InvoicePaid event). For consultation commissions, a separate scheduled job processes per-branch per-date based on arrived + paid sessions — also independent of the service-report submit moment. See service report — what submit actually fires for the full event story.

Rate resolution (priority order)#

  1. Per-employee override. custom_commission_rate on the employment record.
  2. Per-product rate. The catalog item's own commission_rate.
  3. Policy default. default_service_commission_pct for services, default_product_commission_pct for retail products.
  4. Zero. If none resolves, no row is written.

Service vs product is auto-detected from the catalog item (does it carry linked services or is it a service-product?). You don't pick.

Status set on creation#

  • By default, new rows land at pending. HR approves them before pay run.
  • If the policy's Auto-approve below threshold is non-zero, rows at or below that amount approve themselves on creation. an InvoiceCommissionApproved event fires; this is what the GL listener subscribes to for the optional auto-post.

Optional GL auto-post at approval#

  • When the tenant has commission GL auto-post enabled (workspace accounting settings) AND the expense + payable accounts are mapped, the system posts Dr Commission Expense, Cr Commission Payable when the row flips to approved.
  • The expense lands in the period the commission was earned, matching revenue recognition.
  • When auto-post is off (or accounts aren't mapped), the expense lands later via the payroll posting.

Stage 2 — reversal on void / refund / session change#

What triggers reversal#

EventBehaviour
InvoiceVoidedPending + approved commissions on the invoice flip to reversed. Paid commissions follow the claw-back mode. Gated by reverse_on_invoice_void.
InvoiceDeletedSame as void. Gated by reverse_on_invoice_delete.
InvoiceRefunded (full)Full reversal. Gated by reverse_on_refund_full.
InvoiceRefunded (partial)Off by default. When on, pro-rata reversal scaled by the refund share. Above the policy's partial_refund_threshold_pct, it's treated as full.
SessionCancelledReverses linked consultation commissions. Gated by reverse_on_session_cancel.
SessionNoShowOff by default. Reverses linked consultation commissions when the session was missed. Gated by reverse_on_session_missed.

Each reversal stamps a short reason code on the row: invoice_void · invoice_deleted · refund_full · refund_partial · session_cancelled · session_missed · manual.

How rows are flipped#

  • Pending or approved. The row's status flips to reversed; reversed_at + reversed_reason are stamped.
  • Partial reversal. The original row's amount drops to the residual, and a new audit row is created with a negative amount and a reversal_of pointer back to the original.
  • Already paid. The behaviour depends on the policy's claw-back mode (next section).

Claw-back mode for already-paid rows#

The policy carries paid_commission_clawback_mode. Three options:

  • Adjustment (default). A new negative-amount Commission row is created with reversal_of pointing to the original. It approves itself so the next pay run nets the deduction against the staff member's next earning. No money moves outside payroll.
  • Block. The system logs a warning and does not mutate the paid row. Ops must resolve it manually — typically used for departed employees or contested cases.
  • Ignore. The row stays paid; nothing happens. Used as a goodwill exception.

GL impact of reversal#

  • If the original accrual was auto-posted, a reversing JE posts (Dr Commission Payable, Cr Commission Expense), netting the expense in the original period.
  • If accrual was not auto-posted, the reversal is row-only; the payroll posting for that period nets correctly without an offsetting JE.

Notifications#

  • When notify_staff_on_reversal is on (default), the affected seller and provider receive a notification naming the source invoice / session and the reason.
  • Otherwise the row appears in Accounting → Commissions → Reversed for self-review.

Stage 3 — payout via payroll#

The cycle#

  1. Finance reviews the applicable commission rows and pay-run cutoff; there is no separate commission-period freeze action in the ledger.
  2. Approved commissions become payable. The pay run includes one commission line per affected employee.
  3. Payroll posts the cash leg of the GL: Dr Commission Expense (if not already auto-posted at approval), Cr Bank or Salary Payable.
  4. Commission rows flip to paid once the run commits.

Pay run knobs (from the policy)#

  • Include pending in pay run. Off by default. When on, pending rows pay alongside approved ones.
  • Allow negative net pay run. Off by default. When off, residual claw-back carries to the next pay run instead of producing a negative line.

Contractor providers#

  • Contractors (non-employees) are paid via vendor payment, not via payroll. The system raises a vendor bill from their commission ledger; they're paid as a vendor.
  • Tax treatment differs. the accountant confirms each contractor's category at onboarding.

For each role#

Sales staff and providers#

  • Check your commission view during high-volume weeks. See approved, reversed, and paid buckets in Accounting → Commissions.
  • Disputes go to your manager. The approved status is the policy's calculation. it is correct by definition. If it's wrong, the rule is wrong.

HR managers#

  • Approve any pending rows (rare when auto-approve is on; mandatory otherwise).
  • Run the period-close ritual on schedule. Late closes back the whole pay run up.
  • Handle reversals on departed employees per HR policy. adjustment mode is silent; block mode needs follow-up.

Accountants#

  • Confirm the GL auto-post setting matches your matching policy. do you want expense at approval or at payroll only?
  • Reconcile the commission payable balance monthly. The balance is approved-not-yet-paid; it should match the next pay run's planned commission lines.
  • Watch reversal volume. A spike is the leading signal of a refund problem or a sloppy seller.

Owners#

  • Pick the claw-back mode. adjustment is the lowest-friction choice; block is for high-trust environments; ignore is for goodwill exceptions.
  • Decide whether to auto-post commission GL at approval. Cleaner accounting, less common in practice; many clinics post via payroll only.
  • Decide whether to auto-approve below a small amount. saves HR time on micro-rows.

Common mistakes#

  • Voiding a paid invoice without first refunding. Blocked at the invoice layer (the void rule). Paid commissions only reverse via the void or refund of the parent invoice.
  • Editing a Commission row directly. Not supported. The row is the engine's calculation; change the policy or rule if the rate is wrong, then re-trigger.
  • Forgetting to switch a contractor from payroll to vendor pay. The pay run looks correct, then the contractor wonders where their VAT-inclusive invoice went. Get the category right at onboarding.
  • Auto-post GL on AND duplicate post via payroll. Double-counts the expense. Pick one path per tenant.
  • Leaving the no-show reversal trigger on for a high-no-show clinic. Constant claw-back noise. Keep it off and pay agents for booked sessions; the arrival-rate rules already penalise consistently low attendance.

How commissions connect to the rest of the system#

  • Sales and invoices. source of accrual events.
  • Refunds, voids, deletes. source of reversal events.
  • Booking sessions. cancellation + no-show reversal triggers; arrival rate drives the high vs low variant.
  • Payroll. payout vehicle for employees.
  • Vendors + AP. payout vehicle for contractors.
  • Accounting. commission expense + payable lines.
  • HR + Business teams. employee compensation owns per-staff overrides; team membership decides supervisor.
  • Reports. per-rep accrued / paid / reversed; the manager's weekly view.
  • Notifications. reversal alerts when the policy enables them.