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 `),