window.printItemBarcode = function(sku, nameAr, nameEn, price) {
if (!sku) {
Swal.fire('Error', 'This item has no SKU/Barcode assigned.', 'error');
return;
}
document.getElementById('barcodeLabelName').innerHTML = '
${companyLogo ? `

` : ''}
${companyName}
${inv.outlet_name ? `
${inv.outlet_name}
` : ''}
${companyPhone ? `
Tel: ${companyPhone}
` : ''}
${companyVat ? `
VAT: ${companyVat}
` : ''}
TAX INVOICE / فاتورة ضريبية
Inv / رقم: INV-${inv.id.toString().padStart(5, '0')}
Date / التاريخ: ${inv.invoice_date}
Customer / العميل: ${inv.customer_name || 'Walk-in / عميل عابر'}
| ITEM / الصنف |
VAT / الضريبة |
TOTAL / الإجمالي |
${itemsHtml}
Subtotal (Excl. VAT) / المجموع الفرعي (دون الضريبة)
= __('currency') ?> ${(subtotal - totalVat).toFixed(3)}
VAT / الضريبة
= __('currency') ?> ${totalVat.toFixed(2)}
TOTAL (Incl. VAT) / الإجمالي (شامل الضريبة)
= __('currency') ?> ${subtotal.toFixed(3)}
PAID / المدفوع
= __('currency') ?> ${parseFloat(inv.paid_amount).toFixed(3)}
BALANCE / الرصيد
= __('currency') ?> ${(subtotal - inv.paid_amount).toFixed(3)}
Thank You for your business! / شكراً لتعاملكم معنا!
`;
const posModal = new bootstrap.Modal(document.getElementById('posReceiptModal'));
posModal.show();
};
function printPosReceipt() {
const content = document.getElementById('posReceiptContent').innerHTML;
const printArea = document.getElementById('posPrintArea');
printArea.innerHTML = `