This commit is contained in:
parent
b28ef09f3d
commit
889982dd82
|
@ -1,7 +1,10 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`()
|
||||
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
|
||||
SELECT YEAR(t.shipped),
|
||||
|
@ -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