Add daily stock lot sellout forecast

This commit is contained in:
gitea_admin committed 2026-09-06 08:55:10 +02:00
1 parent 9a1192ae81
commit 1639960ab6
9 files changed
+440 -3

No files matched your search

+8 -2
View File
@@ -72,7 +72,10 @@ function get_lager_product_overview(PDO $pdo): array
p.name,
p.sku,
p.uom,
COALESCE(SUM(v.qty_net), 0) AS available_qty
COALESCE(SUM(v.qty_net), 0) AS available_qty,
sl.expiry_date,
sl.sellout_date,
sl.sellout_forecast_status
FROM product p
LEFT JOIN stock_lot sl
ON sl.product_id = p.id
@@ -80,7 +83,7 @@ function get_lager_product_overview(PDO $pdo): array
LEFT JOIN v_stock_lot_balance v
ON v.stock_lot_id = sl.id
WHERE p.status = 'active'
GROUP BY p.id, p.name, p.sku, p.uom
GROUP BY p.id, p.name, p.sku, p.uom, sl.expiry_date, sl.sellout_date, sl.sellout_forecast_status
ORDER BY p.name ASC, p.id ASC"
);
@@ -91,6 +94,9 @@ function get_lager_product_overview(PDO $pdo): array
'sku' => (string) $row['sku'],
'uom' => (string) $row['uom'],
'available_qty' => (float) $row['available_qty'],
'expiry_date' => $row['expiry_date'],
'sellout_date' => $row['sellout_date'],
'sellout_forecast_status' => (string) ($row['sellout_forecast_status'] ?? 'no_demand'),
],
$stmt->fetchAll()
);