From 654d00dd67add6ab9d4a0738f6b6cfab22a096bb Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Thu, 26 Sep 2019 20:56:19 +0200 Subject: [PATCH] Again corrections for #384) --- migrations/0092.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migrations/0092.sql b/migrations/0092.sql index 6e76866b..84c39cab 100644 --- a/migrations/0092.sql +++ b/migrations/0092.sql @@ -32,7 +32,7 @@ UNION SELECT p.id, MAX(p.name) AS name, - SUM(sub_p.min_stock_amount) - IFNULL(SUM(s.amount), 0) AS amount_missing, + SUM(sub_p.min_stock_amount) - IFNULL(SUM(s.amount_aggregated), 0) AS amount_missing, CASE WHEN IFNULL(SUM(s.amount), 0) > 0 THEN 1 ELSE 0 END AS is_partly_in_stock FROM products_view p JOIN products_resolved pr @@ -44,7 +44,7 @@ LEFT JOIN stock_current s WHERE sub_p.min_stock_amount != 0 AND p.cumulate_min_stock_amount_of_sub_products = 1 GROUP BY p.id -HAVING IFNULL(SUM(s.amount), 0) < SUM(sub_p.min_stock_amount) +HAVING IFNULL(SUM(s.amount_aggregated), 0) < SUM(sub_p.min_stock_amount) UNION @@ -94,7 +94,7 @@ UNION SELECT p.id, MAX(p.name) AS name, - SUM(sub_p.min_stock_amount) - (IFNULL(SUM(s.amount), 0) - IFNULL(SUM(s.amount_opened), 0)) AS amount_missing, + SUM(sub_p.min_stock_amount) - (IFNULL(SUM(s.amount_aggregated), 0) - IFNULL(SUM(s.amount_opened), 0)) AS amount_missing, CASE WHEN IFNULL(SUM(s.amount), 0) > 0 THEN 1 ELSE 0 END AS is_partly_in_stock FROM products_view p JOIN products_resolved pr @@ -106,7 +106,7 @@ LEFT JOIN stock_current s WHERE sub_p.min_stock_amount != 0 AND p.cumulate_min_stock_amount_of_sub_products = 1 GROUP BY p.id -HAVING IFNULL(SUM(s.amount), 0) < SUM(sub_p.min_stock_amount) +HAVING IFNULL(SUM(s.amount_aggregated), 0) < SUM(sub_p.min_stock_amount) UNION