From d2d553eed6db16a151cd32fd692a80c5cbc17168 Mon Sep 17 00:00:00 2001 From: olsch01 Date: Mon, 2 Mar 2026 10:00:23 -0500 Subject: [PATCH] Fix health scores: use correct invoices column name (amount, not amount_due) Co-Authored-By: Claude Opus 4.6 --- backend/src/modules/health-scores/health-scores.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/modules/health-scores/health-scores.service.ts b/backend/src/modules/health-scores/health-scores.service.ts index 6ecbec9..efb84e9 100644 --- a/backend/src/modules/health-scores/health-scores.service.ts +++ b/backend/src/modules/health-scores/health-scores.service.ts @@ -281,7 +281,7 @@ export class HealthScoresService { `, [`${year}-01-01`]), // Delinquent receivables (invoices past due) qr.query(` - SELECT COUNT(*) as count, COALESCE(SUM(amount_due - amount_paid), 0) as total_overdue + SELECT COUNT(*) as count, COALESCE(SUM(amount - amount_paid), 0) as total_overdue FROM invoices WHERE status IN ('sent', 'overdue') AND due_date < CURRENT_DATE `),