7837-testToMaster_2432 #2834
|
@ -1,6 +1,9 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`()
|
||||
BEGIN
|
||||
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
|
||||
|
@ -40,9 +43,8 @@ BEGIN
|
|||
JOIN vn.buy b ON b.id = lb.buy_id
|
||||
LEFT JOIN vn.saleComponent sc ON sc.saleFk = s.id
|
||||
LEFT JOIN vn.component c ON c.id = sc.componentFk
|
||||
WHERE w.isManaged
|
||||
AND YEAR(t.shipped) = YEAR(util.VN_CURDATE())
|
||||
AND WEEK(t.shipped, 4) = WEEK(util.VN_CURDATE(), 4)
|
||||
WHERE t.shipped BETWEEN vDateFrom AND vDateTo
|
||||
AND w.isManaged
|
||||
GROUP BY it.id, i.id;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
Loading…
Reference in New Issue