Files
edr-platform/apps/edr-freight-api/src/modules
Nathnael ac325a6282 feat(reports): report charged vs actual volume in revenue categories
Four changes the business asked for on Charged and Actual Volumes:

- Split the Leg column into From and To, both sortable.
- Add 20ft and 40ft container counts beside TEU, off the marshalling
  record's container items.
- Classify cargo into the revenue vocabulary rather than the operational
  one, so a corridor's tonnage and its revenue read in the same buckets.
  Charge-only buckets (incidental, first/last mile, customs) cannot be
  emitted — no physical wagon is one.
- Carry the empty wagons as rows of their own, the way the marshalling
  document lists them. `allocationLedgerQb` gains `includeEmptyWagons`,
  which starts the ledger from the wagon instead of the allocation; the
  empty and total wagon counts become plain group aggregates, so a
  departure's wagons now add up down its rows instead of every row
  repeating the train's total. Vehicle-Km lands on the empty rows and
  sums across legs.

`LOADED_WAGONS_EXPR` gains a FILTER on the allocation being present — a
no-op for every allocation-grain report, and the fix at the one place
all of them route through. `SCHEDULE_EMPTY_WAGONS` had no callers left
and is deleted.

Verified: type-check clean, 50 report specs pass (incl. a new one
asserting the cargo expression only emits keys the revenue vocabulary
offers), and the report SQL EXPLAINs and runs against edr_dev — 60 empty
wagons over 4 rows, 53,539 Vehicle-Km, 20ft/40ft counts populating.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-25 13:05:18 +00:00
..
2026-08-24 12:24:23 +00:00
2026-08-21 09:25:21 +00:00
2026-08-24 12:24:23 +00:00
2026-08-12 07:12:04 +00:00
2026-08-20 10:29:58 +00:00
fix
2026-07-03 15:21:23 +00:00
2026-07-16 00:33:31 +00:00
2026-08-13 18:56:52 +00:00
2026-08-15 08:10:47 +00:00
2026-08-15 08:10:47 +00:00
2026-08-24 12:24:23 +00:00
2026-07-16 00:33:31 +00:00
2026-08-24 12:24:23 +00:00
2026-08-02 20:29:09 +00:00
2026-08-09 13:27:05 +00:00
2026-07-16 00:33:31 +00:00
2026-07-25 06:05:20 +00:00