Fix: Change 'amount' to 'price' to match database schema - Database uses 'price' column, not 'amount' - Update all queries in DailySummaryService, HourlySummaryService - Update RetribusiWriteService (SELECT, INSERT, UPDATE) - Update Validator to use 'price' field - Update check_database.php and TROUBLESHOOTING.md

This commit is contained in:
mwpn
2025-12-17 13:36:29 +07:00
parent 56403469ef
commit ca3b1bd0d7
8 changed files with 61 additions and 52 deletions

View File

@@ -92,22 +92,22 @@ try {
e.gate_code,
e.category,
COUNT(*) as total_count,
COALESCE(t.amount, 0) as tariff_amount
FROM entry_events e
INNER JOIN locations l ON e.location_code = l.code AND l.is_active = 1
INNER JOIN gates g ON e.location_code = g.location_code
AND e.gate_code = g.gate_code
AND g.is_active = 1
LEFT JOIN tariffs t ON e.location_code = t.location_code
AND e.gate_code = t.gate_code
AND e.category = t.category
WHERE DATE(e.event_time) = CURDATE()
GROUP BY
DATE(e.event_time),
e.location_code,
e.gate_code,
e.category,
COALESCE(t.amount, 0)
COALESCE(t.price, 0) as tariff_amount
FROM entry_events e
INNER JOIN locations l ON e.location_code = l.code AND l.is_active = 1
INNER JOIN gates g ON e.location_code = g.location_code
AND e.gate_code = g.gate_code
AND g.is_active = 1
LEFT JOIN tariffs t ON e.location_code = t.location_code
AND e.gate_code = t.gate_code
AND e.category = t.category
WHERE DATE(e.event_time) = CURDATE()
GROUP BY
DATE(e.event_time),
e.location_code,
e.gate_code,
e.category,
COALESCE(t.price, 0)
LIMIT 1
";