Commit graph

15 commits

Author SHA1 Message Date
1f5f1639c7 Weekly report status bar: show variance instead of cash total
Variance = banked total - reported total across all payment categories.
Green badge = balanced, red = short (▼), amber = over (▲).
Days with no cash up show no variance (nothing was counted).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-02 09:13:26 +00:00
460e0c3d77 Weekly report: proper Excel drag-select (no text highlight)
- Switch from onClick to onMouseDown + e.preventDefault() so the
  browser never starts its own text-selection on click or drag
- Add document-level mousemove/mouseup listeners for drag-to-select:
  hold mouse button and sweep across cells to highlight a range
- Shift+click still extends the rectangle from the anchor cell
- userSelect: none on tables prevents any residual text highlighting
- Stats bar (Count/Sum/Avg) now appears after mouseup so it reads the
  final selection, not mid-drag state

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-02 00:21:25 +00:00
f62aa6f347 Fix gross sales zero bug; add Excel stats bar
- Backend: sales_breakdown column matching was always failing because
  Newbook returns numeric gl_group_id but column settings use string codes
  like 'ACCOMMODATION'. Added normalised name-fuzzy fallback matching and
  a daily_gross_sales field that sums ALL earned revenue for the date,
  bypassing column config entirely.
- Frontend: dayGrossSales() now uses daily_gross_sales from backend first
- Add floating Excel-style status bar (bottom-right): when cells are
  selected it shows Count, Sum, and Average of the selected values;
  disappears when ✕ clicked or selection cleared

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-02 00:14:40 +00:00
e7af072851 Weekly report: rewrite to match original layout
- Reconciliation now has two side-by-side tables (BANKED left, REPORTED right)
  with dates on rows and payment categories on columns — matching original orientation
- BANKED table: green bg for manual cells (cash/PDQ), orange for auto (gateway/BACS),
  red/amber bg + ▼/▲ indicator when variance vs reported
- REPORTED table: orange background, Audit column showing daily gross sales
- Gross Sales sub-table below reconciliation
- Sales Breakdown: dates now on rows, GL categories on columns (was transposed)
  with Total Net / VAT / Gross Total / Audit columns
- Occupancy: dates on rows, metric columns, hover tooltips with category breakdown
- Copy/Paste Format section: spreadsheet-ready 2-row-per-date tables
- Excel-like cell selection: click to select, Shift+click for range,
  Ctrl+C copies selected cells as TSV to clipboard

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-02 00:06:23 +00:00
74d238576d Fix unused 'vs' parameter in occupancy total fn
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 23:52:10 +00:00
b53df5b6a5 Weekly report: full occupancy stats + VAT column in sales
Occupancy table now calculates from raw Newbook data:
- Rooms occupied (from per-category occupancy API)
- Occ % (rooms occupied / total rooms from sites_data)
- Guests (adults + children + infants from bookings_data)
- Net accommodation revenue (from earned_revenue, ACC GL group)
- Avg net per room, REVPAR
- GGR (average guest rate from tariffs_quoted)
- Avg lead time (arriving bookings only)

Sales breakdown now shows Net, VAT, Gross as separate total columns.
Debtors/Creditors adds Period Close row.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 22:40:12 +00:00
e4ab137025 Fix invalid date in history; expand weekly report
- History: slice session_date to YYYY-MM-DD before Date parse (postgres
  returns date columns as ISO timestamps in JSON)
- History: fix Edit/View navigate link passing full ISO string as date param
- Weekly report: add daily status row, reconciliation variance (banked vs
  Newbook reported), sales with gross+net, debtors/creditors lazy-loaded

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 22:29:50 +00:00
4caf307fd1 Auto-fetch Newbook on date load; add transaction breakdown checklist
- Newbook payments now fetched automatically when a date loads (in
  parallel with the cash up fetch), not just on button click
- Refresh button still available for manual re-fetch
- Transaction breakdown section below reconciliation table: three
  collapsible groups (Reception Manual, Reception Gateway, Restaurant/Bar)
  each showing individual transactions with click-to-tick checkboxes
  for tracking down discrepancies — local state, clears on refresh

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 22:15:42 +00:00
53c8938c2f Fix denomination total wrong when loaded from DB
PostgreSQL NUMERIC columns return as strings in node-postgres. denomTotal
was doing 0 + "40.00" + "30.00" → "040.0030.00", and parseFloat in
fmtGBP read only the first portion, giving a wrong total (£40.00 instead
of £78.80 etc).

Fix: coerce total_amount and value_entered to numbers in applyLoaded;
make denomTotal's reducer defensively use Number() so strings can't
silently break the sum again.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 22:06:03 +00:00
4ea5238e62 Fix cash summary quantity bug; add Safe Count as own nav item
- Cash summary: derive total_quantity from total_amount/denomination_value
  so value_entered rows are counted (previously SUM(quantity) returned
  NULL for those rows)
- Safe Count: moved safe_cash out of Float Management tabs into its own
  /safe/* route with a dedicated sidebar entry (Vault icon)
- FloatManagement now only shows Petty Cash and Change Tin tabs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 21:36:19 +00:00
e6188fb337 Add proper state machine flow to DailyCashUp
- On mount/date change: auto-fetch existing cash up
  - Draft found → auto-load into editing state
  - Finalised → auto-load into locked state (read-only + banner)
  - Not found → show 'Start Cash Up' prompt
- Removed manual 'Load Existing' / 'New' buttons
- Submitting final transitions immediately to locked state

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 21:30:22 +00:00
4cbe68ebf7 Vertical tab order in denomination grids
Tab now moves down the Qty column first (£50→£20→...→1p), then down
the Value Override column, for both takings and float grids.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 21:24:41 +00:00
f52054e5e2 Fix auth calls to use central auth routes
AuthGate was calling /cashup/api/auth/verify and /cashup/api/auth/login,
which hit the cashup backend (404). Should call /api/auth/* which NPM
routes to the central auth service, matching all other apps.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 21:13:04 +00:00
577e98e6b1 Fix TypeScript compile errors blocking Docker build
- Add vite-env.d.ts for import.meta.env type support
- Remove unused imports: ChevronRight, useCallback (x2), today
- Silence unused attachments state read (keep setter for future use)
- Fix FloatManagement changeTinTargets reducer: drop unused k, fix v type

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 20:11:01 +00:00
63a5a72fa3 Wire Newbook credentials to settings service 2026-07-01 19:33:16 +00:00