33 lines
611 B
MySQL
33 lines
611 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTax_getFromDua`(vDuaFk INT)
|
||
|
BEGIN
|
||
|
|
||
|
DECLARE done BOOL DEFAULT FALSE;
|
||
|
DECLARE vInvoiceInFk INT;
|
||
|
|
||
|
DECLARE rs CURSOR FOR
|
||
|
SELECT invoiceInFk
|
||
|
FROM entry e
|
||
|
JOIN duaEntry de ON de.entryFk = e.id
|
||
|
WHERE de.duaFk = vDuaFk;
|
||
|
|
||
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||
|
|
||
|
OPEN rs;
|
||
|
|
||
|
FETCH rs INTO vInvoiceInFk;
|
||
|
|
||
|
WHILE NOT done DO
|
||
|
|
||
|
CALL invoiceInTax_getFromEntries(vInvoiceInFk);
|
||
|
CALL invoiceInDueDay_calculate(vInvoiceInFk);
|
||
|
|
||
|
FETCH rs INTO vInvoiceInFk;
|
||
|
|
||
|
END WHILE;
|
||
|
|
||
|
CLOSE rs;
|
||
|
|
||
|
END$$
|
||
|
DELIMITER ;
|