salix/db/routines/vn/procedures/itemPlacementFromTicket.sql

25 lines
651 B
MySQL
Raw Normal View History

DELIMITER $$
2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemPlacementFromTicket`(vTicket INT)
BEGIN
/**
* Llama a itemPlacementUpdateVisible
* de los articulos de la tabla temporal tmp.itemPlacement(itemFk)
* @treturn tmp.itemPlacement
* @param vTicket Id del Ticket
*/
DROP TEMPORARY TABLE IF EXISTS tmp.itemPlacement;
CREATE TEMPORARY TABLE tmp.itemPlacement
(PRIMARY KEY (itemFk))
ENGINE = MEMORY
SELECT s.itemFk
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
WHERE t.id = vTicket;
CALL itemPlacementUpdateVisible();
DROP TEMPORARY TABLE tmp.itemPlacement;
END$$
DELIMITER ;