feat: the staff, cancellations/discounts, technical, prep zones and expenses reports on v2; reports all on v2 (platform-v2 step 6.12c)

- Reports -> Staff (src/pages/reports/staff): shifts (pay, collected, to hand
  over, the counted difference, cancellations; a shift opens the overview's
  shift dialog; the owner deletes one), cash handover (starting cash, cash,
  card, refunds, to hand over, counted), sales by person (orders, units,
  cancellations, hours, sales net of refunds, per hour, share; ranked) - the
  v1 activity and leaderboard views merged into it
- Reports -> Cancellations and discounts (src/pages/reports/misc), with totals
  per person; Technical (printing: tickets, failed, printed first time, per
  printer, every ticket with its error, the receipt-printer summary; logs for
  the owner) - v1 printer history + printer health merged
- Prep zones report (per zone: items, value, products, orders; per-zone Excel
  downloads built in the browser with the server's Excel rules; print a zone)
  and Expenses report (period, status, category; split by category or
  supplier; payments) - its categories now match what Finance saves (the v1
  report listed categories that never existed)
- kit: csvText() / download(); PrintDialog modes for the printer summary
- v1 report kit (reports/shared) and every v1 report view deleted;
  src/pages/reports is v2 (all but LogsPanel strict)
- tests: reports.test.mjs (+1), e2e manager.mjs (every report opens, a shift's
  details, the ranking)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 09:19:49 +02:00
co-authored by Claude Opus 5.5
parent 7767bdb728
commit 6bdf0bdd79
35 changed files with 919 additions and 4230 deletions
+8 -1
View File
@@ -2,7 +2,7 @@
import { test } from 'node:test'
import assert from 'node:assert/strict'
import {
addDays, dayChoices, defaultPeriod, hourSeries, margin, orderTotals, periodParams, periodSlug, printBody, quickRange, rangeProblem, ratio, sortRows,
addDays, csvText, dayChoices, defaultPeriod, hourSeries, margin, orderTotals, periodParams, periodSlug, printBody, quickRange, rangeProblem, ratio, sortRows,
} from '../src/pages/reports/kit/reportLogic.js'
test('periods: the default, quick ranges, the parameters sent (venue time), file names', () => {
@@ -43,3 +43,10 @@ test('a receipt-printer report gets the same period', () => {
assert.deepEqual(printBody({ mode: 'day', dayId: '7' }), { business_day_id: 7, from_dt: null, to_dt: null })
assert.deepEqual(printBody({ mode: 'range', from: '2026-11-01', to: '2026-11-02' }), { business_day_id: null, from_dt: '2026-11-01T00:00:00', to_dt: '2026-11-02T23:59:59' })
})
test('a CSV built in the browser follows the Excel rules', () => {
const en = csvText(['Product', 'Value'], [['Freddo, iced', 3.5], ['Tea', 2]])
assert.equal(en.charCodeAt(0), 0xFEFF)
assert.deepEqual(en.slice(1).split('\r\n'), ['Product,Value', '"Freddo, iced",3.50', 'Tea,2'])
assert.deepEqual(csvText(['Π', 'Τιμή'], [['Φρέντο', 3.5]], 'el').slice(1).split('\r\n'), ['Π;Τιμή', 'Φρέντο;3,50'])
})