AAuditPro Suite· Finance manual
Finance manual Payments

Payment row anatomy

1payment_number
Auto · RCT/{YYYY}/{NNNN}

Atomic counter. Issued on insert.

2client_id
Required

Whose payment. All allocations must be to this client's invoices.

3payment_date
Required

Bank-statement date or cash-received date.

4amount
DECIMAL(18,3)

Total received. bcmath scale 3.

5currency_code · fx_rate · omr_equivalent
Multi-currency

If non-OMR, FX captured + OMR-equivalent computed.

6payment_method
5 values

bank_transfer · cash · cheque · card · online (Mwasalat / NPCI).

7reference_number
Free text

Bank ref, cheque number, transaction ID. Searchable.

8received_to_account
Bank account picker

Which firm bank account received. Drives bank-rec downstream.

9is_advance
Computed flag

True if payment has zero allocations OR only proforma allocations OR partial tax with leftover. See chapter 7.

10notes
Internal

"Per email confirmation 12-Apr · advance for FY 2026 audit · client wants receipt before fieldwork."

Allocation table

payment_allocations is a many-to-many join: one payment row, N invoice rows, with each link carrying its own allocation amount.

FieldNotes
payment_idFK
invoice_idFK · must belong to same client as the payment
amount_allocatedDECIMAL(18,3) · cannot exceed (invoice.balance_due) and cannot make Σ allocations exceed payment.amount
allocated_at + byAudit fields

The 4 allocation patterns

Pattern 1 — full settlement

payment.amount = invoice.balance_due. One allocation row. Invoice flips sent → paid. paid_in_full_at stamped.

Pattern 2 — partial settlement

payment.amount < invoice.balance_due. One allocation row. Invoice flips sent → partially_paid. balance_due recomputes.

Pattern 3 — multi-invoice settlement

One transfer covers 3 invoices. Three allocation rows. Each invoice's balance recomputes independently. Useful when a client says "here's OMR 12,500 covering invoices 39, 40, 41".

Pattern 4 — pure advance

Payment row created with zero allocations (or only against a proforma). Marked is_advance=1. Sits as un-allocated credit until applied via post-hoc allocation form. See chapter 7.

Step-by-step — record + allocate a payment

  1. Open client → Billing card → Record Payment

    Or M11 → Payments → New. Client picker if not pre-filled.

  2. Header

    Date, amount, currency, method, reference, account. Auto-numbered.

  3. Allocations panel

    System lists all open invoices for the client (sent / partially_paid / overdue). For each, an "Allocate" input. As you type allocation amounts, the running unallocated balance shows below.

  4. Validate + save

    Σ allocations ≤ payment.amount. Each allocation ≤ invoice.balance_due. If unallocated remainder > 0, payment marked is_advance=1. Save commits.

  5. Side-effects

    Each allocated invoice's balance recomputes. Status auto-flips: partially_paid (if remaining balance > 0) or paid (if 0). M17 email queued to client (template payment.received) with receipt PDF attached.

  6. Receipt PDF

    Branded green PDF generated automatically. Cached at storage/payments/{id}/{number}.pdf. Cache busts on any allocation change.

Validation rules

Editing allocations

Allocations can be added later via the post-hoc form on the payment-show page. Useful for:

Each edit re-recomputes affected invoice balances. Audit-logged.

The receipt PDF

RECEIPT
RCT/2026/0042 · 12 Apr 2026
Amount Received
OMR 5,565.000
Five thousand five hundred sixty-five Omani Rials only
Received from:Al-Bahja Trading LLC
Method:Bank Transfer
Reference:NBO-TXN-20260412-78421
Allocated to:INV/2026/0042 — full settlement
For Al Musaaid Auditing Bureau · Authorised signatory + firm stamp
Try this

Record a payment of OMR 12,500 against a client with 3 open invoices (each OMR ~5,000). Allocate fully to invoice 1 + invoice 2, partial to invoice 3. Save. Watch invoice 1 + 2 flip to paid, invoice 3 to partially_paid, all live. Receipt PDF auto-generated covering all 3 allocations.

Watch out

Reference number matters for bank reconciliation. Type the actual bank reference (NBO transaction ID, cheque number) — not "received from John". When M12 Bank Reconciliation runs, it matches by reference. Sloppy refs = manual matching pain.

Tip — over-allocation handling

If a client overpays (e.g. OMR 12,600 received against OMR 12,500 of open invoices), allocate OMR 12,500 across the invoices and the OMR 100 stays as advance. Don't try to refund automatically — apply to next invoice or issue a CN if returning. The advance balance is visible on the client Billing card.