diff --git a/src/lib/pdf/format.test.ts b/src/lib/pdf/format.test.ts index e54126c..cd667b1 100644 --- a/src/lib/pdf/format.test.ts +++ b/src/lib/pdf/format.test.ts @@ -110,8 +110,6 @@ describe("effectiveQuoteDate", () => { }); }); - - describe("effectiveValidityDays", () => { it("uses quote.validity_days when set to a number", () => { expect(effectiveValidityDays({ validity_days: 60 })).toBe(60); diff --git a/src/lib/pdf/format.ts b/src/lib/pdf/format.ts index 150783a..75ae708 100644 --- a/src/lib/pdf/format.ts +++ b/src/lib/pdf/format.ts @@ -40,7 +40,9 @@ export function quoteSubtotal(items: { quantity: number; selling_price: number } } /** - * Sum of (order_qty ?? quantity) * cost_price across PO items. Differs + * Sum of effective-qty × cost_price across PO items, where + * `effective-qty` is `order_qty` when set (non-zero) and falls back to + * `quantity` otherwise. Differs from `quoteSubtotal()` in two ways: * from `quoteSubtotal()` in two ways: * 1. Multiplies by `cost_price` (the supplier-facing price), not * `selling_price` (the customer-facing price).