Invoice Export & PDF Generation

Business perspective: Invoice Export & PDF Generation

1. Business Summary

Generates client invoice PDFs (and PO exports) using brand-specific templates with full tax/profit/currency calculations.

2. Business Value

Customer-facing billing artifacts.

3. Users / Stakeholders

Finance, AMs, clients.

4. Workflows

  • ExportInvoicesController aggregates jobs/tasks, runs EngineFunctions calculations, persists derived fields.
  • setGrace() and updateTasks() finalize task-level data prior to invoice freeze.
  • PDF generated using brand-specific templates.

5. Sub-Features

  • POs export (ExportInvoicesPOsController).
  • Verification stage handling.
  • Bulk task status updates (status_id=3 flow).

6. Business Rules

  • Update tasks before computing invoice totals.
  • Output formatting per brand template.

7. Data Entities

Job, Task, ClientInvoice, Brand, Currency, Tax.

8. Entry Points

  • export_invoices/*, export_invoices_pos/*.
  • Internal setGrace, updateTasks.

9. Inputs & Outputs

  • Inputs: invoice, jobs, currency rates.
  • Outputs: PDFs, persisted derived fields.

10. Integrations

  • TMS/file flow (out folder uploads).

11. Calculations / Logic

  • Tax/discount/extra fees/min price/currency.

12. Status Lifecycle

  • N/A.

13. Permissions

  • Finance.

14. Reports & KPIs

  • PDF render success, exception counts.

15. Risks & Observations

  • Brand-template fragmentation.
  • Silent failures if templates missing.

16. Source Code Evidence

  • app/Controller/ExportInvoicesController.php (~2,346 LOC).
  • app/Controller/ExportInvoicesPOsController.php.

← Deep dives index