production scheduler fix

This commit is contained in:
2025-04-02 15:24:40 +00:00
parent a879b73ea6
commit 8095cfe88a
11 changed files with 398 additions and 419 deletions

View File

@@ -214,9 +214,9 @@ class EcmStockState extends SugarBean {
$GLOBALS['db']->query(
"UPDATE ecmproducts as p
INNER JOIN (
SELECT round(sum(quantity*price)/sum(quantity),2) as avg_price, product_id FROM ecmstockstates GROUP BY product_id
SELECT round(sum(quantity*price)/sum(quantity),2) as avg_price, product_id, SUM(quantity) as stock_state FROM ecmstockstates GROUP BY product_id
) s ON p.id=s.product_id
SET p.ems_price = s.avg_price
SET p.ems_price = s.avg_price, p.ems_qty_in_stock = s.stock_state
WHERE p.id='$product_id'"
);
}