AAuditPro Suite· Finance manual

The numbers

5Doc types
tax_invoice · proforma · credit_note · debit_note · receipt

One invoices table; doc_type column drives behaviour.

7Quote states
M10

draft · sent · accepted · rejected · expired · revised · cancelled

8Invoice states
M11

draft · sent · partially_paid · paid · overdue · cancelled · written_off · converted

11m11.* permissions
RBAC

view · create · update · approve · send · cancel · write_off · etc.

9Email templates
M17 wired

quote.sent · invoice.sent · invoice.payment_reminder · payment.received · etc.

3Number sequences
Atomic

INV/{YYYY}/{NNNN} · PI/... · CN/... · DN/... · QU/... · RCT/...

3DECIMAL places
OMR baisa

All money columns DECIMAL(18,3). Math via bcmath scale 3, never floats.

88Smoke assertions
Tested

Full revenue-flow scenarios: 54 invoice + 23 CN/DN + 11 billing-policy. 100% pass.

The 12 chapters

  1. Lead → Quote → Invoice — the revenue path

    How M03 Leads · M10 Quotes · M07 Jobs · M11 Invoices · M11 Payments stitch together. Lineage stamps, conversion endpoints, the data trail.

  2. M10 Quotes — sent to accepted

    Create from lead or client. Line items with bcmath totals. PDF preview. Send via M17. State transitions. Auto-expire cron.

  3. M11 Invoices — draft to paid

    Auto-numbered. Auto-drafts on job completion. Edit lines. Approve. Send. Track balance.

  4. Doc types — tax / proforma / CN / DN

    One table, five behaviours. Number prefix + watermark + lineage stamps + conversion paths.

  5. State machine — validated transitions

    Per-doc-type state tables. Lifecycle stamp columns. Mandatory-reason for cancel + write-off. Overdue cron.

  6. Payments + allocations

    Multi-allocation per payment. Cross-invoice settlement. Bank/cash/transfer/cheque/card. RCT/{YYYY}/{NNNN} numbering. Branded receipt PDF.

  7. Advance balance handling

    How is_advance flag is computed. Post-hoc allocation form. Client-detail Billing card. Edge cases.

  8. Branded PDF templates (dompdf)

    Tax invoice (navy) · proforma (orange watermark) · receipt (green). Cache + bust strategy. dompdf-safe layout rules.

  9. Billing policies + auto-invoice

    Three firm-wide toggles. Per-engagement overrides. M11 ↔ M07 hooks at status=completed.

  10. AR aging + collections

    4-bucket aging (Current · 1-30 · 31-60 · 60+). Dunning automation. Overdue cron. Collection workflow.

  11. Outbound emails — 9 templates

    Branded HTML, tokenised. Lifecycle hooks. Idempotency. Dispatcher events. Email log + delivery tracking.

Three reference pages

The big-picture flow

Lead M03 · 7 stages Quote M10 · QU/2026/... Job M07 · JOB/2026/... Invoice M11 · INV/2026/... Payment M11 · RCT/2026/... PAID balance 0 Optional intermediates Proforma (PI) advance request Credit Note (CN) refund / cancel Debit Note (DN) scope-creep top-up
Read order

If you're new to the firm: PipelineInvoicesPaymentsBilling policies. That's the daily mechanics. The other chapters layer on doc types, advances, AR aging, emails.