Intranet · Sales & audit-log CSV download

Downloads sales data for a date range as CSV — both the sales themselves (date, concept, amount, tickets, store, Yardi code) and the change log (who changed what and when).

AreaIntranet
Routesintranet.sales · intranet.sales.index
Centre modulesintranet
Staff levelsroot · admin · manager · scmanager · sales
Modelsintranet-sale · intranet-sales-detail
UI labelintranet.sales.download.date-error
Coverage3 use cases · 1 happy · 3 failure

How it works

Date-range validation is done locally before any request (_validateDownloadCsvRange → validDownloadCsvDates) with three distinct messages, including one that caps the end date at today. The log columns (log.creator-email, log.created-at, log.concept, log.amount) make this the audit trail for sales figures. exportIntranetSalesDetailsCsv covers the detail rows.

Use cases

Why someone opens this (3)

  • Pulling a quarter of sales for the centre’s own reporting.
  • Producing an audit trail of who modified a disputed figure.
  • Reconciling declared sales against the Yardi export.

Path map

flowchart LR
    F(["Sales and audit-log CSV download"]):::feat
    F --> H1["Range exported"]:::ok
    F -.-> X1["Start after end"]:::bad
    F -.-> X2["End date in the future"]:::bad
    F -.-> X3["Dates missing"]:::bad
    classDef feat fill:#26688f,stroke:#26688f,color:#ffffff,font-weight:bold
    classDef ok fill:#e3f1ea,stroke:#0d6b42,color:#0d4a2e
    classDef bad fill:#f7e6e2,stroke:#9a2d1c,color:#6e1f13

Happy paths

Range exported

  1. User picks a start and end date within the allowed window.
  2. _validateDownloadCsvRange passes.
  3. downloadCSV builds the file with the sales or log columns and the browser downloads it.

Failure paths

QA checklist

Tick these off while regression-testing this feature. The boxes are plain Markdown, so progress is visible in git diffs.

  • ✅ Range exported
  • ⛔ Start after end
  • ⛔ End date in the future
  • ⛔ Dates missing

Implementation


Generated from doc/feature-inventory.json · id intranet-sales-export · commit 276788ca6