7806_devToTest_2332 #2801

Merged
alexm merged 126 commits from 7806_devToTest_2330 into test 2024-07-30 06:14:09 +00:00
1 changed files with 6 additions and 4 deletions
Showing only changes of commit 889982dd82 - Show all commits

View File

@ -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 ;