35 lines
666 B
SQL
35 lines
666 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`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 ;
|