"use client"; import type { QueuedSale } from "@/lib/offlineQueue"; interface Props { sale: QueuedSale; businessName?: string | null; branchName?: string | null; cashierName: string; synced: boolean; } /** A printable sale receipt. Printing hides everything but `.print-receipt` (see globals.css). */ export default function Receipt({ sale, businessName, branchName, cashierName, synced }: Props) { const when = new Date(sale.clientSubmittedAt); const reference = sale.clientUuid.slice(0, 8).toUpperCase(); return (
{businessName ?? "Receipt"}
{branchName &&{branchName}
}{when.toLocaleDateString("en-KE")} {when.toLocaleTimeString("en-KE", { hour: "2-digit", minute: "2-digit" })}
Ref {reference}
| {l.quantity} x {l.label} @ KES {l.unitPrice.toLocaleString()} | {(l.quantity * l.unitPrice).toLocaleString()} |
Paid: Cash
{sale.customerName &&Customer: {sale.customerName}
}Served by: {cashierName}
{synced ? "Synced to head office" : "Saved on this phone - will sync automatically"}