Raporlar (/reports)

Business-day operations: KPIs for the active business day, start/close/reopen day, and export to Excel/PDF. Internal tab id: reports.

Who can open it

Barkasa and patron. Garson cannot. Reopen day is patron-oriented.

Purpose

  • Show business-day KPIs and aggregates (including account-transaction rollups where wired)
  • Start / close / reopen the restaurant business day
  • Warn before end of day (timer-driven UI)
  • Export reports (exceljs, jspdf, html2canvas-pro)

Key files

Area Paths
UI src/components/pos/EndOfDayTab.tsx and related end-of-day pieces
Hooks useBusinessDay.ts, useEndOfDayWarning.ts, report query hooks
Lib src/lib/reporting/endOfDay.ts, export-report.ts, day-bound helpers

Data & APIs

Call Role
/api/day-closures/ Open / close / reopen business day
/api/reports/business/ Business-day summary
Account transaction aggregates Supporting KPIs
Confirm dialogs Destructive/sensitive day actions

Floor behavior on Masalar depends on this state: closed day → gate overlay and blocked mutations.

State

  • React Query business day + summary (poll)
  • Local confirm / export menu state
  • Warning timer for approaching close

UX details

  • Export menu for Excel/PDF
  • Clear confirmations before close/reopen
  • Barkasa can operate day close flows needed for kasa; patron retains reopen authority

Development notes

  • Any new metric should be defined once in reporting helpers and shared with Checks where appropriate
  • Exports must handle empty days and long Turkish labels without layout breakage
  • Changing day-closure semantics requires coordinated Masalar gate testing
  • Keep FETCH_INTERVAL_MS unless export/close flows need a forced invalidate (prefer query invalidation after mutations)