Quote → Invoice → Payment — the revenue spine
M10 Quotes + M11 Invoices & Payments are the most-used modules in AuditPro after Jobs. Branded dompdf PDFs, OMR 3-decimal bcmath, advance-balance tracking, proforma → tax invoice conversion, credit + debit notes, 4-bucket AR aging, and 9 firm-vetted email templates wired to the lifecycle.
The numbers
One invoices table; doc_type column drives behaviour.
draft · sent · accepted · rejected · expired · revised · cancelled
draft · sent · partially_paid · paid · overdue · cancelled · written_off · converted
view · create · update · approve · send · cancel · write_off · etc.
quote.sent · invoice.sent · invoice.payment_reminder · payment.received · etc.
INV/{YYYY}/{NNNN} · PI/... · CN/... · DN/... · QU/... · RCT/...
All money columns DECIMAL(18,3). Math via bcmath scale 3, never floats.
Full revenue-flow scenarios: 54 invoice + 23 CN/DN + 11 billing-policy. 100% pass.
The 12 chapters
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.
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.
M11 Invoices — draft to paid
Auto-numbered. Auto-drafts on job completion. Edit lines. Approve. Send. Track balance.
Doc types — tax / proforma / CN / DN
One table, five behaviours. Number prefix + watermark + lineage stamps + conversion paths.
State machine — validated transitions
Per-doc-type state tables. Lifecycle stamp columns. Mandatory-reason for cancel + write-off. Overdue cron.
Payments + allocations
Multi-allocation per payment. Cross-invoice settlement. Bank/cash/transfer/cheque/card. RCT/{YYYY}/{NNNN} numbering. Branded receipt PDF.
Advance balance handling
How is_advance flag is computed. Post-hoc allocation form. Client-detail Billing card. Edge cases.
Branded PDF templates (dompdf)
Tax invoice (navy) · proforma (orange watermark) · receipt (green). Cache + bust strategy. dompdf-safe layout rules.
Billing policies + auto-invoice
Three firm-wide toggles. Per-engagement overrides. M11 ↔ M07 hooks at status=completed.
AR aging + collections
4-bucket aging (Current · 1-30 · 31-60 · 60+). Dunning automation. Overdue cron. Collection workflow.
Outbound emails — 9 templates
Branded HTML, tokenised. Lifecycle hooks. Idempotency. Dispatcher events. Email log + delivery tracking.
Three reference pages
The big-picture flow
If you're new to the firm: Pipeline → Invoices → Payments → Billing policies. That's the daily mechanics. The other chapters layer on doc types, advances, AR aging, emails.