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:
@@ -1320,6 +1320,16 @@ try {
|
||||
r.check(`${fi} closed: it leaves the open tabs; payments card + cash`, settled?.status === 'closed' && settled.payments.map(x => x.payment_method).join(',') === 'card,cash', JSON.stringify(settled?.payments))
|
||||
await page.getByTestId('tabs-view-settled').click()
|
||||
r.check(`${fi} it is listed with the settled tabs`, await page.locator('[data-testid="tab-card"]', { hasText: 'Tab E2E' }).waitFor({ timeout: 8000 }).then(() => true).catch(() => false))
|
||||
// 6.13c: the tab line is sold, not paid; the tab money is recorded as received (the manager had no shift: in no drawer)
|
||||
const daySum = await api('GET', '/api/business-day/summary', { token: boss })
|
||||
const mine = (daySum.tabs?.payments ?? []).filter(x => x.tab_id === settled?.id)
|
||||
const outside = mine.filter(x => x.shift_id === null).reduce((n, x) => n + x.amount, 0)
|
||||
r.check(`${fi} the day records both tab payments with who took them (in their shift's drawer, or in none)`, mine.length === 2 && mine.every(x => x.received_by_name)
|
||||
&& Math.round(mine.reduce((n, x) => n + x.amount, 0) * 100) === Math.round(owes * 100) && daySum.tabs.received_outside_shifts.total >= outside - 0.005, JSON.stringify(daySum.tabs).slice(0, 300))
|
||||
await page.goto(`${APP}/reports/today`)
|
||||
r.check(`${fi} Today shows what is on tabs and what was paid on them`, await page.getByTestId('today-on-tab').waitFor({ timeout: 10_000 }).then(() => true).catch(() => false)
|
||||
&& await page.getByTestId('today-tab-received').count() === 1)
|
||||
await page.goto(`${APP}/financials/tabs`)
|
||||
await page.getByTestId('user-menu').click()
|
||||
await page.getByRole('menuitemradio', { name: 'Ελληνικά' }).click()
|
||||
await page.waitForFunction(() => document.querySelector('[data-testid="tabs-page"] h1')?.textContent === 'Καρτέλες', null, { timeout: 5000 }).catch(() => {})
|
||||
|
||||
Reference in New Issue
Block a user