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`.`ticketDown_PrintableSelection`(vSectorFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
|
|
|
|
UPDATE vn.ticketDown td
|
|
|
|
JOIN
|
|
|
|
(SELECT DISTINCT t.id
|
|
|
|
FROM vn.ticket t
|
|
|
|
JOIN vn.sale s ON s.ticketFk = t.id
|
|
|
|
JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id
|
|
|
|
JOIN vn.itemShelving ish ON ish.id = iss.itemShelvingFk
|
|
|
|
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
|
|
|
JOIN vn.parking p ON p.id = sh.parkingFk
|
|
|
|
WHERE p.sectorFk = vSectorFk
|
|
|
|
) sub ON sub.id = td.ticketFk
|
|
|
|
JOIN vn.ticketDown_SelectionType tdst ON tdst.description = 'FREE'
|
|
|
|
JOIN vn.ticketDown_SelectionType tdst2 ON tdst2.description = 'SELECTED'
|
|
|
|
SET td.selected = tdst2.id
|
|
|
|
WHERE td.selected = tdst.id;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|