7837-testToMaster_2432 #2834
|
@ -1,7 +1,10 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`()
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`()
|
||||||
BEGIN
|
BEGIN
|
||||||
CALL cache.last_buy_refresh (FALSE);
|
DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL WEEKDAY(CURDATE()) DAY;
|
||||||
|
DECLARE vDateTo DATE DEFAULT vDateFrom + INTERVAL 6 DAY;
|
||||||
|
|
||||||
|
CALL cache.last_buy_refresh(FALSE);
|
||||||
|
|
||||||
REPLACE bs.waste
|
REPLACE bs.waste
|
||||||
SELECT YEAR(t.shipped),
|
SELECT YEAR(t.shipped),
|
||||||
|
@ -40,9 +43,8 @@ BEGIN
|
||||||
JOIN vn.buy b ON b.id = lb.buy_id
|
JOIN vn.buy b ON b.id = lb.buy_id
|
||||||
LEFT JOIN vn.saleComponent sc ON sc.saleFk = s.id
|
LEFT JOIN vn.saleComponent sc ON sc.saleFk = s.id
|
||||||
LEFT JOIN vn.component c ON c.id = sc.componentFk
|
LEFT JOIN vn.component c ON c.id = sc.componentFk
|
||||||
WHERE w.isManaged
|
WHERE t.shipped BETWEEN vDateFrom AND vDateTo
|
||||||
AND YEAR(t.shipped) = YEAR(util.VN_CURDATE())
|
AND w.isManaged
|
||||||
AND WEEK(t.shipped, 4) = WEEK(util.VN_CURDATE(), 4)
|
|
||||||
GROUP BY it.id, i.id;
|
GROUP BY it.id, i.id;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
Loading…
Reference in New Issue