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:
@@ -56,7 +56,11 @@ test('money per hour covers the usual hours and any hour with money', () => {
|
||||
|
||||
test('a shift\'s money, counts and its lines seen from the waiter', () => {
|
||||
assert.deepEqual(shiftMoney({ starting_cash: 20, cash_sales: 30, card_sales: 10 }),
|
||||
{ cash: 30, card: 10, start: 20, total: 40, expected: 50, cashPct: 75, cardPct: 25 })
|
||||
{ cash: 30, card: 10, other: 0, tabCash: 0, tabCard: 0, tabOther: 0, tab: 0, refunded: 0, start: 20, total: 40, expected: 50, cashPct: 75, cardPct: 25 })
|
||||
// 6.13c: tab cash is in the drawer, tab card isn't; "other" (on the house) in no drawer; the backend's figure wins
|
||||
const m = shiftMoney({ starting_cash: 10, cash_sales: 8, other_sales: 4, tab_cash: 5, tab_card: 3, cash_refunds: 2 })
|
||||
assert.deepEqual([m.expected, m.tab, m.total], [21, 8, 20])
|
||||
assert.equal(shiftMoney({ starting_cash: 10, cash_sales: 8, net_to_deliver: 17 }).expected, 17)
|
||||
assert.equal(shiftMoney({}).cardPct, 0)
|
||||
const summary = { orders: [
|
||||
{ table_id: 1, items: [{ status: 'paid', quantity: 2 }, { status: 'cancelled', quantity: 5 }] },
|
||||
|
||||
Reference in New Issue
Block a user