From 72f6e0c822de505bbd0be7478a16c417021a3be5 Mon Sep 17 00:00:00 2001 From: Shiro-Nek0 Date: Tue, 10 Mar 2026 22:25:09 -0300 Subject: [PATCH] receipt print fix --- templates/checkout.html | 61 +++++++++++++++++++++++++++++++----- templates/macros/navbar.html | 2 +- 2 files changed, 54 insertions(+), 9 deletions(-) diff --git a/templates/checkout.html b/templates/checkout.html index 69de979..7e5b321 100644 --- a/templates/checkout.html +++ b/templates/checkout.html @@ -16,6 +16,50 @@ -moz-appearance: textfield; appearance: textfield; } + + @media print { + body * { + visibility: hidden; + } + + #receipt-print-zone, #receipt-print-zone * { + visibility: visible; + } + + #receipt-print-zone { + position: absolute; + left: 0; + top: 0; + width: 58mm; + padding: 0; + margin: 0; + display: block !important; + font-family: 'Courier New', Courier, monospace; + font-size: 10px; + color: #000; + } + + .container-fluid, .main, body { + margin: 0 !important; + padding: 0 !important; + background: #fff !important; + } + } + + .receipt-table { + width: 100%; + border-collapse: collapse; + font-family: monospace; + font-size: 12px; + } + + .receipt-header { + text-align: center; + margin-bottom: 10px; + border-bottom: 1px dashed #000; + padding-bottom: 5px; + } + {% endblock %} @@ -734,20 +778,21 @@ cart.forEach(item => { const qtyStr = item.unit === 'kg' ? item.qty.toFixed(3) : item.qty; tbody.innerHTML += ` - - ${qtyStr} - ${item.name} - ${clp.format(item.subtotal)} - - `; + + ${qtyStr} + ${item.name} + ${clp.format(item.subtotal)} + + `; }); document.getElementById('receipt-ticket-id').innerText = saleId || "N/A"; document.getElementById('receipt-total-print').innerText = clp.format(total); document.getElementById('receipt-date').innerText = new Date().toLocaleString('es-CL'); - // No hacks, just print - window.print(); + setTimeout(() => { + window.print(); + }, 250); } function openCustomProductModal() { diff --git a/templates/macros/navbar.html b/templates/macros/navbar.html index 06c8ce3..55d8983 100644 --- a/templates/macros/navbar.html +++ b/templates/macros/navbar.html @@ -1,7 +1,7 @@