salix/db/routines/vn/procedures/entry_recalc.sql

35 lines
664 B
MySQL
Raw Normal View History

DELIMITER $$
2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_recalc`()
BEGIN
/**
* Comprueba que las ventas creadas entre un rango de fechas tienen componentes
*
* @param vCreatedFrom inicio del rango
* @param vCreatedTo fin del rango
*/
DECLARE v_done BOOL DEFAULT FALSE;
DECLARE vEntryFk INTEGER;
DECLARE vCur CURSOR FOR
SELECT id FROM tmp.recalcEntryCommision;
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET v_done = TRUE;
OPEN vCur;
l: LOOP
SET v_done = FALSE;
FETCH vCur INTO vEntryFk;
IF v_done THEN
LEAVE l;
END IF;
CALL buy_recalcPricesByEntry(vEntryFk);
END LOOP;
CLOSE vCur;
END$$
DELIMITER ;