2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`sale_getProblemsByTicket`(IN vTicketFk INT, IN vIsTodayRelative TINYINT(1))
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Calcula los problemas de cada venta
|
|
|
|
* para un conjunto de tickets.
|
|
|
|
*
|
|
|
|
* @return Problems result
|
|
|
|
*/
|
|
|
|
DROP TEMPORARY TABLE IF EXISTS tmp.sale_getProblems;
|
|
|
|
CREATE TEMPORARY TABLE tmp.sale_getProblems
|
|
|
|
(INDEX (ticketFk))
|
|
|
|
ENGINE = MEMORY
|
|
|
|
SELECT t.id ticketFk, t.clientFk, t.warehouseFk, t.shipped
|
|
|
|
FROM ticket t
|
|
|
|
WHERE t.id = vTicketFk;
|
|
|
|
|
|
|
|
CALL sale_getProblems(vIsTodayRelative);
|
|
|
|
|
|
|
|
SELECT * FROM tmp.sale_problems;
|
|
|
|
|
|
|
|
DROP TEMPORARY TABLE
|
|
|
|
tmp.sale_getProblems,
|
|
|
|
tmp.sale_problems;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|