2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` FUNCTION `vn`.`itemsInSector_get`(vTicketFk INT, vSectorFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
RETURNS int(11)
|
|
|
|
NOT DETERMINISTIC
|
|
|
|
READS SQL DATA
|
|
|
|
BEGIN
|
|
|
|
|
|
|
|
DECLARE vItemCount INT;
|
|
|
|
|
|
|
|
SELECT count(*) INTO vItemCount
|
|
|
|
FROM vn.sale s
|
|
|
|
JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk
|
|
|
|
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
|
|
|
JOIN vn.parking p ON p.id = sh.parkingFk
|
|
|
|
WHERE s.ticketFk = vTicketFk
|
|
|
|
AND p.sectorFk = vSectorFk;
|
|
|
|
|
|
|
|
RETURN vItemCount;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|