fix: expired section hides items with quantity=0
Query was missing AND i.quantity > 0, so thrown-away items (qty=0) with a past expiry_date kept appearing in the expired list. Also cleaned up the orphan row for Aglio in the DB.
This commit is contained in:
+1
-1
@@ -1892,7 +1892,7 @@ function getStats(PDO $db): void {
|
||||
SELECT i.*, p.name, p.brand, p.category, p.unit, p.default_quantity, p.package_unit,
|
||||
COALESCE(i.vacuum_sealed, 0) as vacuum_sealed
|
||||
FROM inventory i JOIN products p ON i.product_id = p.id
|
||||
WHERE i.expiry_date IS NOT NULL AND i.expiry_date < date('now')
|
||||
WHERE i.expiry_date IS NOT NULL AND i.expiry_date < date('now') AND i.quantity > 0
|
||||
ORDER BY i.expiry_date ASC
|
||||
")->fetchAll();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user