feat: tabs in the books (platform-v2 step 6.13c, KI-018; owner 2026-11-19: every movement recorded)
- a line on a customer's tab is sold, not paid: services/sales.py counts tabbed lines as sold (on_tab apart) - TabEntry / TabPayment record the business day and the shift of whoever did it (Alembic 0037, rows backfilled with their day); services/tab_books.py: per shift and per day, on tabs and tab money received (cash / card / other, who, in a shift or not) - shift: tab cash goes in the drawer (net_to_deliver, the counted difference, total_collected), tab card in the card total; items paid other ways (transfer, on the house) are recorded apart and no longer counted as drawer cash; 'activity': orders, items made / paid / put on a tab with values - day summary: per person put on tabs and tab money received, every tab payment with who took it, the part taken outside shifts (in no drawer); the day's money: paid, on tabs, sold, paid on tabs, money taken (it used to subtract tabs from paid sales) - Today: on tabs, paid on tabs; Staff -> Cash handover: paid on tabs; the shift dialog: made / paid / on a tab / paid on tabs - fix: a line put on a tab was charged without its price change (a discount) - tests: test_tab_books.py (the done-when), overview unit, e2e manager.mjs (the day records the tab payments; Today shows them) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -292,6 +292,12 @@ def business_day_summary(
|
||||
"shift_pay": None,
|
||||
# distinct tables served (not order count)
|
||||
"tables_served": 0,
|
||||
# 6.13c: lines this person put on customers' tabs, and tab money they received
|
||||
"on_tab_items": 0.0,
|
||||
"on_tab_value": 0.0,
|
||||
"tab_cash": 0.0,
|
||||
"tab_card": 0.0,
|
||||
"tab_other": 0.0,
|
||||
}
|
||||
return waiter_stats[uid]
|
||||
|
||||
@@ -331,6 +337,15 @@ def business_day_summary(
|
||||
else:
|
||||
e["other"] += val
|
||||
|
||||
# 6.13c: tabs: what went on them and the money received on them, per person and for the day
|
||||
from services import tab_books
|
||||
tabs_day = tab_books.for_day(db, day.id, {uid: (u.full_name or u.nickname or u.username) for uid, u in users_map.items()})
|
||||
for uid, x in tabs_day.pop("by_person").items():
|
||||
e = _waiter_entry(uid)
|
||||
e["on_tab_items"] = x["on_tab_items"]
|
||||
e["on_tab_value"] = x["on_tab_value"]
|
||||
e["tab_cash"], e["tab_card"], e["tab_other"] = x["received"]["cash"], x["received"]["card"], x["received"]["other"]
|
||||
|
||||
from routers.shifts import compute_shift_pay
|
||||
for shift in shifts:
|
||||
e = _waiter_entry(shift.waiter_id)
|
||||
@@ -494,7 +509,7 @@ def business_day_summary(
|
||||
expenses_paid_today = round(sum(e.paid_amount for e in expenses_today), 2)
|
||||
expenses_due = round(expenses_total - expenses_paid_today, 2)
|
||||
|
||||
# TABBED REVENUE (items moved to tabs — not yet collected)
|
||||
# Lines of today's orders on customers' tabs: sold, not paid (6.13c)
|
||||
tabbed_items = [i for i in all_items if i.status == "tabbed"]
|
||||
tabbed_revenue = round(sum(gross(i) for i in tabbed_items), 2)
|
||||
|
||||
@@ -545,6 +560,9 @@ def business_day_summary(
|
||||
"expenses_paid_today": expenses_paid_today,
|
||||
"expenses_due": expenses_due,
|
||||
"tabbed_revenue": tabbed_revenue,
|
||||
# 6.13c: put on tabs today (by anyone), tab money received today (by method; and the part
|
||||
# received by people with no shift: in no drawer), every tab payment with who received it
|
||||
"tabs": tabs_day,
|
||||
"net_estimate": net_estimate,
|
||||
"net_has_unknowns": net_has_unknowns,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user