#7897 - masterTest_24_36 #2909

Merged
jsegarra merged 132 commits from 7897_masterTest_24_36 into master 2024-09-03 06:37:54 +00:00
1 changed files with 15 additions and 10 deletions
Showing only changes of commit a995d80b46 - Show all commits

View File

@ -14,22 +14,26 @@ BEGIN
DECLARE vTicketFk INT; DECLARE vTicketFk INT;
DECLARE cTickets CURSOR FOR DECLARE cTickets CURSOR FOR
SELECT DISTINCT t.id
FROM ticket t
LEFT JOIN tItemCalc tic ON tic.id = t.id
WHERE t.refFk IS NULL
AND ((vScope = 'client' AND t.clientFk = vId)
OR (vScope = 'address' AND t.addressFk = vId)
OR (vScope = 'item' AND tic.id)
);
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
CREATE OR REPLACE TEMPORARY TABLE tItemCalc
SELECT DISTINCT t.id SELECT DISTINCT t.id
FROM ticket t FROM ticket t
JOIN sale s ON s.ticketFk = t.id JOIN sale s ON s.ticketFk = t.id
JOIN itemTaxCountry itc ON itc.itemFk = s.itemFk JOIN itemTaxCountry itc ON itc.itemFk = s.itemFk
WHERE t.refFk IS NULL WHERE t.refFk IS NULL
AND ( AND (vScope = 'item' AND itc.itemFk = vId);
(vScope = 'client' AND t.clientFk = vId)
OR (vScope = 'address' AND t.addressFk = vId)
OR (vScope = 'item' AND itc.itemFk = vId)
);
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET vDone = TRUE;
OPEN cTickets; OPEN cTickets;
myLoop: LOOP myLoop: LOOP
SET vDone = FALSE; SET vDone = FALSE;
FETCH cTickets INTO vTicketFk; FETCH cTickets INTO vTicketFk;
@ -40,7 +44,8 @@ BEGIN
CALL ticket_recalc(vTicketFk, NULL); CALL ticket_recalc(vTicketFk, NULL);
END LOOP; END LOOP;
CLOSE cTickets; CLOSE cTickets;
DROP TEMPORARY TABLE tItemCalc;
END$$ END$$
DELIMITER ; DELIMITER ;