feat: refs #7893 Created waste_addSalesLauncher #2972

Merged
guillermo merged 3 commits from 7893-waste_addSales into dev 2024-09-18 05:40:18 +00:00
4 changed files with 28 additions and 4 deletions

View File

@ -1,8 +1,22 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`()
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`(
guillermo marked this conversation as resolved
Review

añadir en el pr tb los permisos para que solo Ricardo pueda

añadir en el pr tb los permisos para que solo Ricardo pueda
vDateFrom DATE,
vDateTo DATE
)
BEGIN
DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL WEEKDAY(util.VN_CURDATE()) DAY;
DECLARE vDateTo DATE DEFAULT vDateFrom + INTERVAL 6 DAY;
/**
guillermo marked this conversation as resolved Outdated

cal posar una descripcio perque hem canviat el funcionatment del proc

cal posar una descripcio perque hem canviat el funcionatment del proc
* Recalcula las mermas de un periodo.
*
* @param vDateFrom Fecha desde
* @param vDateTo Fecha hasta
*/
IF vDateFrom IS NULL THEN
SET vDateFrom = util.VN_CURDATE() - INTERVAL WEEKDAY(util.VN_CURDATE()) DAY;
END IF;
IF vDateTo IS NULL THEN
SET vDateTo = vDateFrom + INTERVAL 6 DAY;
END IF;
CALL cache.last_buy_refresh(FALSE);
@ -56,6 +70,6 @@ BEGIN
JOIN vn.buy b ON b.id = lb.buy_id
WHERE t.shipped BETWEEN vDateFrom AND vDateTo
AND w.isManaged
GROUP BY i.id;
GROUP BY YEAR(t.shipped), WEEK(t.shipped, 4), i.id;
END$$
DELIMITER ;

View File

@ -0,0 +1,6 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSalesLauncher`()
BEGIN
CALL waste_addSales(NULL, NULL);
END$$
DELIMITER ;

View File

@ -0,0 +1,3 @@
UPDATE bs.nightTask
SET `procedure` = 'waste_addSalesLauncher'
WHERE `procedure` = 'waste_addSales';

View File

@ -0,0 +1 @@
GRANT EXECUTE ON PROCEDURE bs.waste_addSales TO buyerBoss;