diff --git a/src/lib/billing-report-pdf.ts b/src/lib/billing-report-pdf.ts index 14cd027..1b16485 100644 --- a/src/lib/billing-report-pdf.ts +++ b/src/lib/billing-report-pdf.ts @@ -17,6 +17,8 @@ export interface ExpenseReportRow { case_label: string; user_name: string; description: string; + quantity: number; + unit_price: number; amount: number; billable: boolean; } @@ -93,20 +95,22 @@ export function generateExpenseReportPdf(opts: BaseOpts & { rows: ExpenseReportR const totalAmt = opts.rows.reduce((a, r) => a + (r.amount || 0), 0); autoTable(doc, { startY: 110, - head: [["Date", "Case", "User", "Description", "Billable", "Amount"]], + head: [["Date", "Case", "User", "Description", "Qty", "Unit", "Billable", "Amount"]], body: opts.rows.map((r) => [ fmtDate(r.expense_date), r.case_label, r.user_name, r.description, + String(r.quantity ?? 1), + fmtCurrency(r.unit_price ?? r.amount), r.billable ? "Yes" : "No", fmtCurrency(r.amount), ]), - foot: [["", "", "", "", "Total", fmtCurrency(totalAmt)]], + foot: [["", "", "", "", "", "", "Total", fmtCurrency(totalAmt)]], styles: { font: "times", fontSize: 9, cellPadding: 4 }, headStyles: { fillColor: [240, 240, 240], textColor: 20 }, footStyles: { fillColor: [240, 240, 240], textColor: 20, fontStyle: "bold" }, - columnStyles: { 5: { halign: "right" } }, + columnStyles: { 4: { halign: "right" }, 5: { halign: "right" }, 7: { halign: "right" } }, }); return doc; }