Skip to main content

Developer Guide: Advanced Table Management, Multi-Client Transactions & Excel Import

lynx-anchor ​
lynx-anchor ​
lynx-anchor ​

This technical guide documents the architecture for Multi-Client Sub-Orders per Table, Waiter/Captain Table Assignment, and Excel Table Bulk Import.


Table of Contents​

  1. Architecture & Multi-Client Session Model
  2. Multi-Client Separate Billing Subsystem
  3. Table Waiter Assignment Engine
  4. Bulk Excel Table Import Pipeline
  5. Database Schemas & API Specifications

1. Architecture & Multi-Client Session Model​

When a physical table is occupied by multiple independent guests who want separate checks (e.g. colleagues at Table 4 splitting into Guest A, Guest B, and Guest C), the system treats the physical table as a container holding distinct sub-sessions:

flowchart TD
subgraph Physical Container ["Physical Table (Table 4 - Seating 6)"]
T[Table Record: id=4, area_id=1, assigned_waiter_id=12]
end

subgraph Active Sub-Sessions ["Multi-Client Transactions"]
S1["Client 1 / Seat A (KOT-101, Bill-1) - Total: ₹450"]
S2["Client 2 / Seat B (KOT-102, Bill-2) - Total: ₹720"]
S3["Client 3 / Seat C (KOT-103, Bill-3) - Total: ₹310"]
end

T --> S1
T --> S2
T --> S3

S1 --> P1[Settle Bill 1 - Cash]
S2 --> P2[Settle Bill 2 - UPI QR]
S3 --> P3[Settle Bill 3 - Credit Card]

2. Multi-Client Separate Billing Subsystem​

Sub-Session Identifier:​

In sales_headers and kot_headers, multi-client orders are partitioned using:

  • table_id: Physical table reference.
  • sub_order_no / seat_no: Integer identifier (1, 2, 3, ...).
  • client_label: Optional tag (e.g., "Guest A", "Order #2", "Seat 3").

Kitchen KOT Aggregation:​

The kitchen KOT shows both physical table and client sub-order tag:

=================================
KITCHEN ORDER TICKET (KOT) #1042
TABLE: 04 [Client 2 / Seat B]
WAITER: Rahul Sharma
---------------------------------
1x Butter Naan
1x Chicken Tikka Masala (Extra Spicy)
=================================

3. Table Waiter Assignment Engine​

Tables can be allocated to specific waiters or captains for shift responsibility, commission tracking, and filtered floor views.

Database Column in restaurant_tables:​

ALTER TABLE restaurant_tables
ADD COLUMN IF NOT EXISTS assigned_user_id INTEGER REFERENCES users(id) ON DELETE SET NULL;

Controller Implementation (table.controller.ts):​

exports.assignTable = async (req: any, res: any) => {
const { table_id, assigned_user_id } = req.body;
const db = req.propertyDb;

await db.models.restaurant_tables.update(
{ assigned_user_id: assigned_user_id || null },
{ where: { id: table_id, outlet_id: req.user.outlet_id } }
);

res.json({ success: true, message: 'Table assigned successfully' });
};

4. Bulk Excel Table Import Pipeline​

The table setup screen allows importing dozens of tables across multiple floor areas in a single .xlsx upload.

Excel Column Specification:​

Column HeaderRequiredExampleDescription
Table NameYesTable 12Display identifier on the floor grid
Area / ZoneYesAC Dining HallTarget area (auto-created if not exists)
CapacityNo4Number of chairs / seats (default 4)
ShapeNoSQUAREGeometry (SQUARE, ROUND, RECTANGLE)
Assigned WaiterNowaiter_rahulUsername of assigned server

Ingestion Logic:​

  1. Validates file header signatures (exceljs / xlsx package).
  2. Auto-resolves or creates dining_areas matching the Area / Zone text.
  3. Inserts tables with duplicate name collision avoidance per outlet.

5. Database Schemas & API Specifications​

MethodEndpointDescription
GET/api/restaurant/tablesList all tables with assigned waiters and live sub-sessions
POST/api/restaurant/tables/assignAssign table to specific waiter / captain
POST/api/restaurant/tables/import-excelUpload .xlsx file for bulk floor table ingestion
POST/api/restaurant/tables/split-sessionCreate new independent sub-order transaction on occupied table
POST/api/restaurant/tables/settle-sub-billSettle specific sub-client bill while leaving remaining seats active