|
@@ -52,7 +52,7 @@ FROM (
|
|
SUM(sorder_qty) as sum_sorder_qty
|
|
SUM(sorder_qty) as sum_sorder_qty
|
|
FROM dbr_sorder as mx
|
|
FROM dbr_sorder as mx
|
|
INNER JOIN dbr_sorder_bd as mb ON mx.id = mb.sorder_id
|
|
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
|
|
GROUP BY seller_id, item_id
|
|
) as june_data ON mc.id = june_data.seller_id AND md.id = june_data.item_id
|
|
) as june_data ON mc.id = june_data.seller_id AND md.id = june_data.item_id
|
|
LEFT JOIN (
|
|
LEFT JOIN (
|
|
@@ -62,7 +62,7 @@ FROM (
|
|
SUM(CASE WHEN mx.status = 'C' THEN sorder_qty ELSE 0 END) AS sum_sorder_claim_qty
|
|
SUM(CASE WHEN mx.status = 'C' THEN sorder_qty ELSE 0 END) AS sum_sorder_claim_qty
|
|
FROM dbr_sorder as mx
|
|
FROM dbr_sorder as mx
|
|
INNER JOIN dbr_sorder_bd as mb ON mx.id = mb.sorder_id
|
|
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
|
|
GROUP BY seller_id, item_id
|
|
) as july_data ON mc.id = july_data.seller_id AND md.id = july_data.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'
|
|
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;
|
|
ORDER BY c1, c6 DESC;
|
|
END //
|
|
END //
|
|
|
|
|
|
-DELIMITER ;
|
|
|
|
|
|
+DELIMITER ;
|