docs(pdf): move VAT bullet to Layout block + tidy effective-qty comment

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
SJCoetz 2026-08-06 12:08:14 +02:00
parent 7a6e32cadb
commit 07900075a4

View file

@ -50,6 +50,13 @@ export interface PurchaseOrderDocumentProps {
* Right: PO No / Date / Order Ref
* - items table with accent-coloured header (Description / Qty / Unit Cost / Line Total)
* - right-aligned totals (rule above Total)
* - **VAT (15%) included** — subtotal + VAT (15%) + rule +
* VAT-inclusive Total, same shape as the quote's totals
* block so the two PDFs feel like siblings. The printed
* `Total` is `subtotal × 1.15` — the figure the office uses
* for budget / VAT-return reconciliation. The stored
* `purchase_orders.total_amount` stays VAT-ex (no PB schema
* change).
*
* Intentionally stripped from this document (vs. the quote PDF):
* - **No banking details** — supplier invoices via the normal
@ -60,13 +67,6 @@ export interface PurchaseOrderDocumentProps {
* The customer's identity stays internal.
* - **No footer text** — keeps the document visually quiet and
* prevents accidental leakage of branch-specific marketing copy.
* - **VAT (15%) added to subtotal** — prints the supplier-quoted
* subtotal, then VAT (15%), then a VAT-inclusive Total. Same
* shape as the quote's totals block so the two documents feel
* like siblings. The VAT-inclusive Total is the figure the
* office uses for budget / VAT-return reconciliation; the stored
* `purchase_orders.total_amount` stays VAT-ex (no PB schema
* change).
*
* Description column uses `po_description` (supplier-facing copy),
* NOT `description` (internal/operator copy). Falling back to
@ -91,11 +91,11 @@ export function PurchaseOrderDocument({
(letterhead.display_name?.toUpperCase().includes("CNL") ? "CNL" : "ISHERWOOD")
);
// Subtotal = sum of (qty × cost) per line, using the
// `order_qty ?? quantity` supplier-facing fallback. Logic lives
// in `poSubtotal()` (src/lib/pdf/format.ts) so it's independently
// testable. This keeps the printed line totals summing exactly to the
// Subtotal.
// Subtotal = sum of effective-qty × cost per line. The "effective
// qty" fallback logic (order_qty || quantity, so a literal 0
// falls through) lives in `poSubtotal()` (src/lib/pdf/format.ts)
// so it's independently testable. The printed line totals sum
// exactly to this Subtotal.
const subtotal = poSubtotal(items);
// 15% VAT on top of the supplier-quoted subtotal — same helper the
// quote PDF uses, so both documents compute VAT identically. Total