|
@@ -1,11 +1,12 @@
|
|
|
drop procedure if exists zds_door_sales_cancel_month;
|
|
|
|
|
|
DELIMITER //
|
|
|
-CREATE PROCEDURE zds_door_sales_cancel_month( _listToken varchar(21), _sdate varchar(8), _edate varchar(8),
|
|
|
-_s1 varchar(32), _e1 varchar(32), _s2 varchar(32), _e2 varchar(32),
|
|
|
-_s3 varchar(32), _e3 varchar(32), _s4 varchar(32), _e4 varchar(32),
|
|
|
-_having varchar(386), _orderby varchar(64),
|
|
|
-_branch int, _storage int, _member_company_id int, _lt_filter int)
|
|
|
+CREATE PROCEDURE zds_door_sales_cancel_month( _listToken varchar(21), _sdate varchar(8), _edate varchar(8),
|
|
|
+ _s1 varchar(32), _e1 varchar(32), _s2 varchar(32), _e2 varchar(32),
|
|
|
+ _s3 varchar(32), _e3 varchar(32), _s4 varchar(32), _e4 varchar(32),
|
|
|
+ _where varchar(386), _having varchar(386), _orderby varchar(64),
|
|
|
+ _branch int, _storage int)
|
|
|
+SQL SECURITY INVOKER
|
|
|
BEGIN
|
|
|
DECLARE start_date varchar(8);
|
|
|
DECLARE end_date varchar(8);
|
|
@@ -52,7 +53,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 mx.seller_id = _member_company_id and sorder_date >= previous_month_start_date and sorder_date <= previous_month_end_date
|
|
|
+ WHERE true and seller_id = 88 and sorder_date between '20240801' and '20240831'
|
|
|
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 +63,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 mx.seller_id = _member_company_id and sorder_date >= start_date and sorder_date <= end_date
|
|
|
+ WHERE true and seller_id = 88 and sorder_date between '20240801' and '20240831'
|
|
|
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'
|