Workflow

Sale Payments Workflow

How payment entries update sale status and customer balance, including reversals.

Audience: Cashiers, accountants, and reconciliation staff.

Related Collections

salePaymentssalescustomerscustomerBalance

Execution Steps

  1. Step 1

    Payment is validated

    System verifies the sale exists and auto-generates PAY-XXXX on create.

  2. Step 2

    Sale payment totals are recalculated

    All sale payments are summed and sale amountPaid/paymentStatus are updated.

  3. Step 3

    Customer balance decreases

    A payment ledger entry is added and customer current balance is reduced.

  4. Step 4

    Delete creates reversal

    Deleting payment recalculates sale status and adds payment_reversal in ledger.

Payment Status Rules

  • unpaid: amountPaid = 0
  • partial: amountPaid > 0 and below total
  • paid: amountPaid >= total

Important Note

  • Users can add payment only after sale document is saved first.
  • Backdated payment dates are supported.