The Invoiced tab used to filter to the last 3 days only, which
meant an invoice or delivery note that fell off the window would
disappear from the operator's list even if they hadn't printed
it yet. The only way back was the per-row "Print" button on a row
that no longer existed in the tab.
Change the filter rule from "in last 3 days" to "in last 3 days OR
unprinted". A row surfaces if either:
- its date falls inside recentInvoiceRange, OR
- it has not been printed yet (printed !== true).
This means an invoice or DN stays on the operator's list until it's
printed, regardless of age. The list doubles as the "what's still
outstanding" view — print a row, it drops off the next reload.
Stock bookings are unchanged (still windowed to the last 3 days
only) — there's no print tracking on stock_purchases yet, so
"unprinted stock booking" is undefined.
Also broaden the bulk-print button from "Print Today's Unprinted"
to "Print All Unprinted" so the operator can clear the backlog
in one pass instead of having to print each row individually.
The button iterates every invoice + DN group whose items haven't
all been printed, regardless of date.
Section header + empty state text updated to reflect the new rule.
Files:
- src/app/(app)/invoicing/page.tsx — filter logic, button copy,
section header, empty state, bulk-print handler
- src/app/(app)/invoicing/page.test.tsx — updated existing tests
to match the new behaviour; renamed "bulk prints only today's
unprinted invoices" to "bulk prints every unprinted invoice,
regardless of date"