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; 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`; DROP TEMPORARY TABLE tmp.ticketCalculateItem, tmp.ticketComponentPrice, tmp.ticketComponent, tmp.ticketLot, tmp.zoneGetShipped, tmp.item; END$$ DELIMITER ;