---
name: evolution_invoicing_advanced_ar_register
description: "invoicesFiltered report rebuilt into a secure AR register (aging, multi-job breakdown)"
metadata: 
  node_type: memory
  type: project
  originSessionId: 8d031678-adb5-4ddd-80e4-591644511d22
  modified: 2026-07-20T02:03:24.313Z
---

`report&file=invoicesFiltered` ("Invoicing Report – Advanced") rebuilt 2026-07-20 from a
broken raw dump (live SQLi + shared report.csv) into an **AR register**.

- New secure JSON endpoint `reports/invoicesFilteredSave.php` (fully parameterised, sort
  whitelist); UI `reports/invoicesFiltered.inc` + companion `reports/invoicesFiltered.js`;
  old `reports/invoicesFiltered.php` now a 410 fail-safe stub.
- Conventions worth reusing: **outstanding = live `total − paid`** (not `invoices.balance`,
  which lags — see [[evolution_billing_dashboard_gotchas]]); **aging buckets count only
  committed, non-void invoices** by `duedate` (Current/1-30/31-60/61-90/90+), so they won't
  sum to the Outstanding card when drafts are shown (caption says so).
- Multi-job: shows per-invoice job count + expandable ex-GST split via
  `call=jobs` (ROUND(adjPrice*qty,2) grouped by `invoiceitems.jobid` — see
  [[evolution_invoiceitems_jobid_source_of_truth]]).
- **Branch filter convention (Shane's preferred pattern for ALL future reports):** render an
  in-filter branch `<select>` with an "All branches" option (default all), wired via AJAX —
  do NOT rely on the legacy `report.inc` header branch selector (it reloads the page + defaults
  to session branch). `report.inc`'s header selector is now wrapped in `#reportHeaderBranch`;
  hide it from the report with a one-line script. Most modern reports already do the in-filter
  select (arAged, finPL, invoicesByRep, …).
- Audit: `evolution/audits/INVOICES_ADVANCED_REPORT_AUDIT.md`. Docs: `docs/reporting/sales.php`
  + screenshot `docs/reporting/images/sales/invoicing-advanced.png`. Release note id 129
  (prod releasenotes, status=0). Follows the in-place Sales/Inventory report rebuild pattern
  ([[evolution_inventory_analytics_suite]], [[feature_release_docs_policy]]).
