diff --git a/src/routes/invoices.$invoiceId.tsx b/src/routes/invoices.$invoiceId.tsx
index 535eaae..2048dcc 100644
--- a/src/routes/invoices.$invoiceId.tsx
+++ b/src/routes/invoices.$invoiceId.tsx
@@ -114,6 +114,19 @@ function InvoiceDetail() {
return Array.from(map.values());
}, [items]);
+ // Billable fees vs billable expenses subtotals (non-billable items have amount 0 and are excluded).
+ const { feesSubtotal, expensesSubtotal } = useMemo(() => {
+ let fees = 0;
+ let exp = 0;
+ for (const it of items) {
+ const amt = Number(it.amount) || 0;
+ if (amt === 0) continue;
+ if (it.kind === "expense") exp += amt;
+ else fees += amt;
+ }
+ return { feesSubtotal: fees, expensesSubtotal: exp };
+ }, [items]);
+
if (loading) return Loading…