Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-19 20:08:42 +00:00
co-authored by renee-png
parent 1fa7daeb24
commit 76862e7a64
+13
View File
@@ -130,6 +130,19 @@ function InvoiceDetail() {
const isDraft = invoice.status === "draft";
const balance = Number(invoice.total) - Number(invoice.amount_paid);
// 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]);
const setStatus = async (status: string) => {
if (status === "void") {
if (!confirm("Void this invoice? Totals will be zeroed out and time/expenses will be unbilled.")) return;