Files
xenia-pos-local/local_backend
bonamin 492096007b feat: Phase 2L — discount audit report
Backend:
- GET /api/reports/discounts: read-only audit of all OrderDiscount records
  Filters: ?from=&to= or ?business_day_id=, ?applied_by=
  Returns:
  - discounts[]: id, order_id, table_name, applied_by_name, applied_at, discount_type,
    discount_value, discount_amount (computed euro value), order_total_before,
    item_id (null = whole-order), reason
  - total_discount_value: sum of all euro discount amounts
  - order_count: unique orders that received a discount
  - by_waiter[]: grouped summary (waiter_name, count, total_value)
  discount_amount computation: fixed → discount_value directly;
    percent → computed from order or item total at query time

Frontend:
- DiscountsLog.jsx: read-only report under Reports → Λειτουργίες → Εκπτώσεις
  - Filter bar: range/workday toggle, date range, waiter filter
  - 3 stat cards: total discount value, orders with discounts, count of entries
  - By-waiter summary table (hidden when only one waiter)
  - Full audit table: date, order + table, waiter, type badge (% blue / € amber),
    order total before, euro amount discounted in amber, reason
  - Totals footer row
  - No create/edit/delete — pure audit log

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-08 03:43:19 +03:00
..