WFDASH-WEBAPP/src
Dave 7320bfdce6 feat(invoicing): split order_item_ids from items for non-invoiceable rows
Task 5 of the non-invoiceable-order-extras plan.

buildQbInvoicePayload now keeps order_item_ids built from ALL
rows (so n8n's 'Build PocketBase Invoice Update' node flips
excluded rows to invoiced alongside their siblings — the order
closes normally), and builds items from BILLABLE rows only (so
QuickBooks never learns about the excluded lines).

billableRows helper exported for sharing with the invoice UI
(Task 6) and the delivery-note route (Task 7) — three callers,
one definition of 'billable'.

Added exclude_from_invoice to RawInvoicingRow AND the
INVOICING_FIELDS projection. The projection is load-bearing:
omit it and PB returns undefined, every extra silently bills
the customer. Confirmed by inspection and by the failing
'mixed set' test if the projection drifts.

4 tests + 1 mutation-test prove the split:
- mixed: excluded ids in order_item_ids, absent from items
- all-billable: identical output to the no-flag case
- all-excluded: empty items, full order_item_ids
- billableRows helper unit tests
- mutation (items built from input.rows): mixed and all-excluded
  tests fail

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-30 17:26:46 +02:00
..
app feat(invoicing): split order_item_ids from items for non-invoiceable rows 2026-08-30 17:26:46 +02:00
components feat(orders): add shared quote-line context component 2026-08-30 12:20:39 +02:00
lib feat(orders): bypass margin gate for non-invoiceable extras 2026-08-30 17:21:28 +02:00
styles
middleware.ts feat(tv): add TV dashboard + refine workflows 2026-08-13 20:55:22 +02:00
test-setup.ts