feat: include table name and guest count in thermal receipt output
This commit is contained in:
parent
2858ef1cc4
commit
85ddc0ab44
@ -232,6 +232,8 @@ export class EscPosGenerator {
|
|||||||
if (o.orderName) cmds.push(...this.addLine(`Order: ${o.orderName}`));
|
if (o.orderName) cmds.push(...this.addLine(`Order: ${o.orderName}`));
|
||||||
if (o.date) cmds.push(...this.addLine(`Date: ${o.date}`));
|
if (o.date) cmds.push(...this.addLine(`Date: ${o.date}`));
|
||||||
if (o.cashier) cmds.push(...this.addLine(`Cashier: ${o.cashier}`));
|
if (o.cashier) cmds.push(...this.addLine(`Cashier: ${o.cashier}`));
|
||||||
|
// Table name — printed after cashier, matching pos_restaurant ReceiptHeader
|
||||||
|
if (o.tableName) cmds.push(...this.addLine(o.tableName, { bold: true, align: 'center' }));
|
||||||
if (o.customer) cmds.push(...this.addLine(`Customer: ${o.customer}`));
|
if (o.customer) cmds.push(...this.addLine(`Customer: ${o.customer}`));
|
||||||
cmds.push(...this.addLine(this.divider()));
|
cmds.push(...this.addLine(this.divider()));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -665,11 +665,24 @@ patch(PosPrinterService.prototype, {
|
|||||||
}
|
}
|
||||||
} catch (_) { dateStr = new Date().toLocaleString(); }
|
} catch (_) { dateStr = new Date().toLocaleString(); }
|
||||||
|
|
||||||
|
// Table name — from pos_restaurant.ReceiptHeader patch
|
||||||
|
// order.table_id or order.self_ordering_table_id → table.table_number
|
||||||
|
let tableName = '';
|
||||||
|
const table = order.table_id || order.self_ordering_table_id || null;
|
||||||
|
if (table) {
|
||||||
|
if (order.customer_count) {
|
||||||
|
tableName = `Table ${table.table_number}, Guests: ${order.customer_count}`;
|
||||||
|
} else {
|
||||||
|
tableName = `Table ${table.table_number}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const orderData = {
|
const orderData = {
|
||||||
orderName: order.pos_reference || order.name || '',
|
orderName: order.pos_reference || order.name || '',
|
||||||
date: dateStr || new Date().toLocaleString(),
|
date: dateStr || new Date().toLocaleString(),
|
||||||
cashier: (typeof order.getCashierName === 'function' ? order.getCashierName() : '') || '',
|
cashier: (typeof order.getCashierName === 'function' ? order.getCashierName() : '') || '',
|
||||||
customer: order.partner_id?.name || null
|
customer: order.partner_id?.name || null,
|
||||||
|
tableName,
|
||||||
};
|
};
|
||||||
|
|
||||||
// ── Order lines ────────────────────────────────────────────────────────
|
// ── Order lines ────────────────────────────────────────────────────────
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user