Fix health scores: use correct invoices column name (amount, not amount_due)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-02 10:00:23 -05:00
parent 2ca277b6e6
commit d2d553eed6

View File

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