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:
@@ -281,7 +281,7 @@ export class HealthScoresService {
|
|||||||
`, [`${year}-01-01`]),
|
`, [`${year}-01-01`]),
|
||||||
// Delinquent receivables (invoices past due)
|
// Delinquent receivables (invoices past due)
|
||||||
qr.query(`
|
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
|
FROM invoices
|
||||||
WHERE status IN ('sent', 'overdue') AND due_date < CURRENT_DATE
|
WHERE status IN ('sent', 'overdue') AND due_date < CURRENT_DATE
|
||||||
`),
|
`),
|
||||||
|
|||||||
Reference in New Issue
Block a user