docs(docs): pack README for phase 6F (split bills and the settlement-line rule in sales.py, moves, price changes, the day loop, sign-in)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 14:14:47 +02:00
co-authored by Claude Opus 5.5
parent 096bd53dbd
commit f107deca8c
+6 -1
View File
@@ -40,8 +40,13 @@ The manager calls the API **same-origin, with relative paths**. The waiter app r
| `local_backend/services/cloud_sync.py` | Every call to the cloud (see the parent's `docs/reference/cloud-contract.md`) |
| `local_backend/roles.py`, `routers/deps.py` | Roles, permission checks, auth dependencies |
| `local_backend/services/fiscal/` | Fiscal devices behind one driver interface (D-27, step 3.3e): `base.py` (`prepare_receipt` / `prepare_credit_note` → send, `credit_notes` flag, `status`), `txt_file.py` (the dTEC100extra folder bridge, the only driver today; no credit notes yet), `__init__.py` (the venue's driver from `fiscal.type`, item building, background issue). **A new machine = a new driver module listed in `DRIVERS`**; never write to a device from a router |
| `local_backend/services/split_bills.py`, `models/order.py` (`SplitBill`) | Split by amount (6F.6): `split_bills` (amounts JSON, mode, parts, `undone_at`, `receipt_issued_at`), `order_items.split_bill_id`. Parts are locked (no cancel / move / combine / discount); undo only while nothing is paid; the fiscal receipt is the settled lines, issued once when the last part is paid, with each method's amount (`prepare_receipt(payments=)`) |
| `local_backend/services/moves.py`, `models/order.py` (`OrderMove`, `OrderMoveItem`, `OrderItem.split_from_id`) | Moves on the record (6F.4): `order_moves` / `order_move_items` written by transfer, move-items and merge; a line's path follows `split_from_id`; never deleted. `routers/orders.py` `cut_part()` is the one way to cut a line (quantity lowered, split) |
| `local_backend/services/price_changes.py` | Prices changed by hand (6F.3): the venue switch `orders.price_change`, the keys, the reason, and one `PriceEventLog` row `manual_price` per change (stage cart / sent / served, approver) |
| `local_backend/services/business_days.py`, `services/day_auto.py` | The one way to open / close the business day (the manager's buttons and the automatic loop, 6F.8). `day_auto` runs every minute from `main.py`'s lifespan: opening hours / a time / alert, closes only with no unclosed order (retry every 15 min), sticky alerts (`notifications.resolved_at`, `core.notifications.resolve`). Tests drive `tick(db, now=…)` with a fake clock |
| `local_backend/core/sessions.py` | Sessions and sign-in rules; 6F.7: `auth.single_session_waiter` `ask` (the default; `auth.session_elsewhere`, `replace: true`), only the `waiter` client counts; `terminal_requires_username` (venue + `devices.require_username`) |
| `local_backend/services/fees.py` | Delivery fee engine (phase 3S). **Byte-identical copy in `cloud-service/cloud_backend/services/fees.py`**: change both, and `tests/fixtures/fee_cases.json` in both; `tests/test_fees.py` fails if they differ |
| `local_backend/services/sales.py`, `services/csv_export.py` | **How every report counts sales** (6.12a, 6.13c): sold = active, paid and tabbed lines (a tab line is sold, not paid), each net of what was refunded of it, system lines (the delivery fee) apart as fees; `Totals.on_tab`. Every analytics endpoint, printed report and export uses it. Exports: UTF-8 mark, venue time with the zone in the header, `;` and decimal commas for a Greek venue |
| `local_backend/services/sales.py`, `services/csv_export.py` | **How every report counts sales** (6.12a, 6.13c): sold = active, paid and tabbed lines (a tab line is sold, not paid), each net of what was refunded of it, system lines (the delivery fee) apart as fees; `Totals.on_tab`. **Split bills (6F.6), the settlement-line rule:** the lines settled by a split have status `split` and **are the sale** (products, categories, costs, the waiter); the split's **part lines** (`split_part` system lines) are **the money** (shift cash / card, payment methods, tabs, the day's takings) and never a product. Anything that picks lines by status uses `split_bills.sold_filter()` / `counts_as_sale()`; money paths keep reading `paid` lines. A refunded part comes off the settled lines by its share (`_split_refunds`). Every analytics endpoint, printed report and export uses it. Exports: UTF-8 mark, venue time with the zone in the header, `;` and decimal commas for a Greek venue |
| `local_backend/services/tab_books.py` | **Tabs in the books** (6.13c, owner rule "every movement recorded"): a line put on a tab and a tab payment record the business day and the shift of whoever did it; `for_shift` / `for_day`. A shift's drawer adds the tab cash it received; money taken by someone with no shift is theirs, in the day, in no drawer |
| `local_backend/services/refunds.py` | Refunds: their own records (`models/refund.py`), never edits of the paid items; shift / day totals subtract them |
| `local_backend/services/system_products.py`, `services/online_check.py` | Lines the system adds itself (phase 3S): the delivery fee is an order line whose product has `system_key` and `lifecycle_status = "system"` (never on a menu or in the catalogue, never added by hand, added printed + served so the kitchen never sees it; paid, counted, receipted and refunded like any line). The site's own price check of a pulled online order (`orders.online_price_diff`): shown, never applied — the customer pays the cloud's prices |