# TODO Use this file to track pending work items for the project. ## Task Template ### [ ] Task Title - Why: - Scope: - Acceptance criteria: - Priority: High | Medium | Low - Status: Backlog | In Progress | Blocked | Done - Notes: ## Backlog ### [ ] Persist P/L cost snapshots per job - Why: Preserve historical cost context even if source rates/data change later. - Scope: Save computed P/L components against each job when P/L is opened/refreshed. - Acceptance criteria: Reopening old jobs shows the same stored cost breakdown unless explicitly recomputed. - Priority: High - Status: Backlog - Notes: Include revenue, PO, plant, labour, driving, gross profit, margin, and calc timestamp. ### [ ] Add P/L audit trail for cost basis used - Why: Make historical calculations explainable and auditable. - Scope: Record which rate row/date and source records were used per calculation. - Acceptance criteria: Each stored snapshot includes rate effective date(s) and source counts/refs. - Priority: Medium - Status: Backlog - Notes: ### [ ] Add "Cost basis" details in P/L modal - Why: Improve transparency for users reviewing cost outputs. - Scope: Show rate effective date and source summary in the modal. - Acceptance criteria: Modal displays rate basis and data-source counts without leaving the page. - Priority: Medium - Status: Backlog - Notes: ### [ ] Validate vehicle rate date ranges - Why: Prevent ambiguous or missing rate lookups. - Scope: Add validation to block overlaps/gaps where they break cost resolution. - Acceptance criteria: Rate form rejects invalid ranges and keeps chronology consistent. - Priority: High - Status: Backlog - Notes: ### [ ] Add nightly P/L data quality checks - Why: Catch missing BC refs/journeys/durations early. - Scope: Report jobs with missing inputs that affect labour/driving costs. - Acceptance criteria: Daily report lists affected jobs and failure reasons. - Priority: Medium - Status: Backlog - Notes: ### [ ] Cache BC job lookups for P/L calculations - Why: Reduce modal load time and external API dependency pressure. - Scope: Cache BC job detail responses used by labour/driving calculations. - Acceptance criteria: Repeat P/L opens reuse cached BC payloads within a defined window. - Priority: Medium - Status: Backlog - Notes: ### [ ] Add automated tests for cost split logic - Why: Prevent regressions in daily split and multi-ref scenarios. - Scope: Create test cases for multi-job day, multi-ref job, and date boundary behavior. - Acceptance criteria: Tests fail on incorrect split-by-ref behavior and pass on split-by-job. - Priority: High - Status: Backlog - Notes: ### [ ] Confirm and document rounding policy - Why: Ensure totals remain predictable and consistent for users. - Scope: Define rounding at component vs total level and apply consistently. - Acceptance criteria: Policy documented and reflected in modal/API outputs. - Priority: Medium - Status: Backlog - Notes: