2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`invoiceOutBookingRange`()
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
|
|
|
|
/* Reasentar facturas
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
DECLARE vInvoice INT;
|
|
|
|
DECLARE vContador INT DEFAULT 0;
|
|
|
|
|
|
|
|
DECLARE done BOOL DEFAULT FALSE;
|
|
|
|
|
|
|
|
DECLARE rs CURSOR FOR
|
|
|
|
SELECT io.id
|
|
|
|
FROM invoiceOut io
|
|
|
|
WHERE RIGHT(ref,7) BETWEEN 1724215 AND 1724224
|
|
|
|
AND serial = 'T';
|
|
|
|
|
|
|
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
|
|
|
|
|
|
|
OPEN rs;
|
|
|
|
|
|
|
|
FETCH rs INTO vInvoice;
|
|
|
|
|
|
|
|
WHILE NOT done DO
|
|
|
|
|
|
|
|
CALL invoiceOutBooking(vInvoice);
|
|
|
|
|
|
|
|
FETCH rs INTO vInvoice ;
|
|
|
|
|
|
|
|
SET vContador = vContador + 1;
|
|
|
|
|
|
|
|
IF vContador MOD 50 = 0 THEN
|
|
|
|
|
|
|
|
SELECT CONCAT(vContador, ' de momento') AS FACTURAS_ASENTADAS;
|
|
|
|
|
|
|
|
END IF;
|
|
|
|
|
|
|
|
END WHILE;
|
|
|
|
|
|
|
|
CLOSE rs;
|
|
|
|
|
|
|
|
SELECT CONCAT(vContador, ' total') AS FACTURAS_ASENTADAS;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|