+ {/* Store header */}
+
+
{company.name}
+ {location.name !== company.name && (
+
{location.name}
+ )}
+ {addr && (
+ <>
+ {addr.street &&
{addr.street}
}
+ {(addr.city || addr.state || addr.zip) && (
+
{[addr.city, addr.state].filter(Boolean).join(', ')} {addr.zip}
+ )}
+ >
+ )}
+ {phone &&
{phone}
}
+
+
+ {/* Transaction info */}
+
+
+ {txn.transactionNumber}
+ {txn.transactionType.replace('_', ' ')}
+
+
+ {date.toLocaleDateString()}
+ {date.toLocaleTimeString()}
+
+
+
+ {/* Line items */}
+
+ {txn.lineItems.map((item, i) => (
+
+
+ {item.description}
+ ${parseFloat(item.lineTotal).toFixed(2)}
+
+ {(item.qty > 1 || parseFloat(item.discountAmount ?? '0') > 0) && (
+
+ {item.qty > 1 && {item.qty} x ${parseFloat(item.unitPrice).toFixed(2)}}
+ {parseFloat(item.discountAmount ?? '0') > 0 && (
+ disc -${parseFloat(item.discountAmount!).toFixed(2)}
+ )}
+
+ )}
+
+ ))}
+
+
+ {/* Totals */}
+
+
+ Subtotal
+ ${subtotal.toFixed(2)}
+
+ {discountTotal > 0 && (
+
+ Discount
+ -${discountTotal.toFixed(2)}
+
+ )}
+
+ Tax
+ ${taxTotal.toFixed(2)}
+
+ {rounding !== 0 && (
+
+ Rounding
+ {rounding > 0 ? '+' : ''}{rounding.toFixed(2)}
+
+ )}
+
+ TOTAL
+ ${total.toFixed(2)}
+
+
+
+ {/* Payment */}
+
+
+ Payment
+ {txn.paymentMethod?.replace('_', ' ') ?? 'N/A'}
+
+ {tendered !== null && (
+
+ Tendered
+ ${tendered.toFixed(2)}
+
+ )}
+ {change !== null && change > 0 && (
+
+ Change
+ ${change.toFixed(2)}
+
+ )}
+
+
+ {/* Barcode */}
+
+
+
+
+ {/* Footer */}
+ {footerText && (
+
{footerText}
+ )}
+
+ )
+}
+
+export function printReceipt() {
+ window.print()
+}