fix(pos): resolve duplicate const d declaration breaking receipt.html script
This commit is contained in:
parent
aed3f5c861
commit
ca6e9364a8
1 changed files with 3 additions and 3 deletions
|
|
@ -562,8 +562,8 @@ function buildEscPos(s){
|
|||
cmds.push('--------------------------------\n');
|
||||
const sub = s.sub != null ? s.sub : (s.total - (s.vat||0));
|
||||
const vat = s.vat != null ? s.vat : (s.total * 15/115);
|
||||
const d = s.discount || { kind: 'none', input: 0, amount: 0 };
|
||||
const hasDiscount = d.kind !== 'none' && Number(d.amount) > 0;
|
||||
const discount = s.discount || { kind: 'none', input: 0, amount: 0 };
|
||||
const hasDiscount = discount.kind !== 'none' && Number(discount.amount) > 0;
|
||||
if (hasDiscount) {
|
||||
const gross = Number(s.gross) || s.items.reduce((sum, it) => sum + (Number(it.selling_price)||0) * (Number(it.qty)||0), 0);
|
||||
const grossSub = gross / 1.15;
|
||||
|
|
@ -571,7 +571,7 @@ function buildEscPos(s){
|
|||
cmds.push(`Subtotal (gross)${' '.repeat(10)}R ${grossSub.toFixed(2)}\n`);
|
||||
cmds.push(`VAT 15% (gross)${' '.repeat(10)}R ${grossVat.toFixed(2)}\n`);
|
||||
cmds.push(`Total (gross)${' '.repeat(13)}R ${gross.toFixed(2)}\n`);
|
||||
cmds.push(`Discount${d.kind==='percent' ? ` (${d.input}%)` : ''}${' '.repeat(15)}- R ${d.amount.toFixed(2)}\n`);
|
||||
cmds.push(`Discount${discount.kind==='percent' ? ` (${discount.input}%)` : ''}${' '.repeat(15)}- R ${discount.amount.toFixed(2)}\n`);
|
||||
}
|
||||
cmds.push(`Subtotal${' '.repeat(22)}R ${sub.toFixed(2)}\n`);
|
||||
cmds.push(`VAT 15%${' '.repeat(22)}R ${vat.toFixed(2)}\n`);
|
||||
|
|
|
|||
Loading…
Reference in a new issue