docs(reports): weekly + custom compare + line-item allocation now implemented

shad0w 2026-06-24 05:54:40 +00:00
parent c6ade28a59
commit cb3f13f76d

@ -16,11 +16,11 @@ hierarchy.
The core of this mockup is now **implemented** under **Reports → Purchasing** in the live app, wired to real approved-PO spend (not the sample data below):
- **Cost Centres** (`/reports/cost-centres`) and **Accounting Codes** (`/reports/accounting-codes`), each with an index, drill-down, and detail view.
- Filters: **Granularity** (Monthly / Yearly), **Financial Year**, **Show** (Top 5 / Top 10 / Bottom 5 / All) — all URL-driven, so views are shareable/bookmarkable.
- Filters: **Granularity** (Weekly / Monthly / Yearly), **Financial Year**, **Show** (Top 5 / Top 10 / Bottom 5 / All) — all URL-driven, so views are shareable/bookmarkable.
- KPI tiles, multi-series comparison charts, single-series trend charts, Top-N breakdowns (re-pivotable by tier / cost-centre / sub-account), per-row trend sparklines, and **CSV export**.
- Gated by the `view_analytics` permission (Manager / SuperUser / Auditor / Admin). Cost centres are **vessels** (the PO cost centre); sites are not cost centres.
**Deferred** to a later pass: the synthetic **Weekly** granularity, the **“Add to graph”** custom multi-select comparison, and **line-item-level** account allocation (v1 attributes a POs whole amount to its PO-level accounting code).
**Now fully implemented**, including the pieces deferred in the first pass: the **Weekly** granularity (focuses one FY month, buckets by week-of-month, with a Month picker), the **“Add to graph”** custom multi-select comparison (tick rows → compare just the selected set, via a shareable `?sel=…&cmp=1` URL), and **line-item-level account allocation** (a multi-account PO is split proportionally across its line-item accounting codes, so the accounting-code report attributes it correctly).
Code: `App/lib/reports.ts` (aggregation core + unit tests), `App/app/(portal)/reports/**` (pages), `App/components/reports/**` (toolbar + charts), `App/app/api/reports/spend/` (CSV export).