salix/db/routines/hedera/procedures/item_calcCatalog.sql

32 lines
836 B
MySQL
Raw Permalink Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`item_calcCatalog`(
vSelf INT,
vLanded DATE,
vAddressFk INT,
vAgencyModeFk INT)
BEGIN
/**
* Calculates available and price for a single item.
*
* @param vItemFk The item id
* @return List of available lots
*/
DROP TEMPORARY TABLE IF EXISTS tmp.item;
CREATE TEMPORARY TABLE tmp.item
ENGINE = MEMORY
SELECT vSelf itemFk;
2024-03-25 13:56:12 +00:00
CALL vn.catalog_calculate(vLanded, vAddressFk, vAgencyModeFk, FALSE);
SELECT l.warehouseFk, w.name warehouse,
p.`grouping`, p.price, p.rate, l.available
FROM tmp.ticketLot l
JOIN tmp.ticketComponentPrice p ON p.warehouseFk = l.warehouseFk
JOIN vn.warehouse w ON w.id = p.warehouseFk
ORDER BY warehouseFk, `grouping`;
2024-07-11 11:25:26 +00:00
CALL vn.ticketCalculatePurge();
DROP TEMPORARY TABLE tmp.item;
END$$
DELIMITER ;