Repository navigation
feat(reports): batch export daily invoices PDF - #1400
Conversation
… page and status codes
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
PR Summary by QodoExport daily invoices as a compiled PDF with a fiscal summary
AI Description
Diagram
High-Level Assessment
Files changed (33)
|
Code Review by Qodo
1.
|
Fixes #1397
Intent
Implement FloCafe issue #1397: batch export all issued daily bills/invoices (paid, partially_refunded, refunded) for a selected business date or range into a single compiled A4 PDF starting with a summary cover page that reconciles with the daily sales .xlsx export, fix the Windows 8.3 short-path file:// URL allowlist in renderHtmlToPdfBuffer, and address PR #1400 review feedback on refund scope reconciliation, locale formatting, active tax pack registration labels, single-page cover bounds, line item totals, numeric bill sequence ordering, and pre-hydration invoice count caps.
What Changed
GET /api/reports/daily-invoices/export(reports.daily-sales.export) andmain/services/daily-invoices-export.tsto compile paid, partially refunded, and refunded bills across 1-366 business days (capped at 5,000 invoices pre-hydration) into print-styled A4 HTML with a bounded fiscal summary cover page reconciled tobuildDailySalesExportDataset, active tax-pack registration labels, store regional formatting, refund scope reconciliation, numerically ordered invoice cards with line-item subtotals/totals, and a daily tax and prior-bill refund appendix.Invoices (PDF)action (exportInvoicesPdfacross all 24 locale catalogs) to the dashboard daily-sales export menu that exportsinvoices-YYYY-MM-DD.pdforinvoices-YYYY-MM-DD_to_YYYY-MM-DD.pdfviaexportReportAsPdf, and update API and regional-settings documentation.file://staging path checks (isAllowedPdfStagingRequestUrl) inmain/services/html-to-pdf.tssorenderHtmlToPdfBufferaccepts Windows 8.3 short-path tilde variants (~vs%7E) for the staged HTML file while blocking otherfile://targets, query/hash suffixes, and remote URLs.Risk Assessment
✅ Low: The compiled daily invoices export and Windows 8.3 short-path PDF staging URL allowlist fix are well-bounded, owner-gated, HTML-escaped, and reconcile directly with buildDailySalesExportDataset while addressing all PR #1400 review invariants.
Testing
Installed workspace dependencies, built the backend and static desktop frontend, ran
test:daily-invoices-export,test:reports-export,test:daily-sales-export,test:script-coverage, andi18n:check, fixed a flaky bracketed-bfrangePDF/ToUnicodeCMap parser intests/reports-export.test.tssurfaced during real ElectronprintToPDFruns, and drove 8 live scenarios end-to-end against an isolated FloCafe server + Playwright Chromium + real ElectronrenderHtmlToPdfBuffer, capturing 8 visual screenshots, 2 compiled A4 PDFs, 1 reconciling.xlsxworkbook, and a structured validation report with all checks passing.npm run test:daily-invoices-exportnpm run test:daily-invoices-exportnpm run test:reports-exportEvidence: Compiled single-day A4 PDF generated via real Electron printToPDF
Evidence: Compiled multi-day range A4 PDF generated via real Electron printToPDF
~/.no-mistakes/evidence/01M62XNJ4EGH5029F18KDE5HN5/daily-sales-2026-09-15.xlsx)Evidence: Structured live validation report across all 8 scenarios
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
npm run test:daily-invoices-exportnpm run test:daily-invoices-exportnpm run test:reports-exportnpm run test:daily-invoices-exportnpm run test:reports-exportnpm run test:daily-sales-exportnpm run test:script-coveragenpm run i18n:checknpm run build && npm run build:frontendLive Electron + Playwright Chromium end-to-end validation across single-day export, multi-day range export, POS sale -> compiled PDF, .xlsx reconciliation, refund scope reconciliation, active tax pack registration label + de-DE locale, browser print popup fallback, RBAC/query bounds, 5,001-bill pre-hydration cap, >15 MB PDF cap, and real Electron onBeforeRequest exfiltration canary + Windows 8.3 allowlist✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.