wngur6076 3 сар өмнө
parent
commit
f3abf579aa

+ 3 - 3
function-in-db/procedures/dash_board/shop_dash/zds_door_sales_cancel_month.sql

@@ -52,7 +52,7 @@ FROM (
     SUM(sorder_qty) as sum_sorder_qty
     FROM dbr_sorder as mx
     INNER JOIN dbr_sorder_bd as mb ON mx.id = mb.sorder_id
-    WHERE sorder_date >= previous_month_start_date and sorder_date <= previous_month_end_date
+    WHERE _where AND sorder_date >= previous_month_start_date and sorder_date <= previous_month_end_date
     GROUP BY seller_id, item_id
     ) as june_data ON mc.id = june_data.seller_id AND md.id = june_data.item_id
     LEFT JOIN (
@@ -62,7 +62,7 @@ FROM (
     SUM(CASE WHEN mx.status = 'C' THEN sorder_qty ELSE 0 END) AS sum_sorder_claim_qty
     FROM dbr_sorder as mx
     INNER JOIN dbr_sorder_bd as mb ON mx.id = mb.sorder_id
-    WHERE sorder_date >= start_date and sorder_date <= end_date
+    WHERE  _where AND  sorder_date >= start_date and sorder_date <= end_date
     GROUP BY seller_id, item_id
     ) as july_data ON mc.id = july_data.seller_id AND md.id = july_data.item_id
     WHERE me.cgroup_code = 'A-0001'
@@ -72,4 +72,4 @@ WHERE COALESCE(sum_sorder_qty_6, 0) > 0 OR COALESCE(sum_sorder_claim_qty_7, 0) >
 ORDER BY c1, c6 DESC;
 END //
 
-DELIMITER ;
+DELIMITER ;