35 lines
831 B
SQL
35 lines
831 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`order_calcCatalog`(vSelf INT)
|
|
BEGIN
|
|
/**
|
|
* Gets the availability and prices for order items.
|
|
*
|
|
* @param vSelf The order id
|
|
* @return tmp.ticketCalculateItem
|
|
* @return tmp.ticketComponentPrice
|
|
* @return tmp.ticketComponent
|
|
* @return tmp.ticketLot
|
|
*/
|
|
DECLARE vDate DATE;
|
|
DECLARE vAddress INT;
|
|
DECLARE vAgencyMode INT;
|
|
|
|
SELECT date_send, address_id, agency_id
|
|
INTO vDate, vAddress, vAgencyMode
|
|
FROM `order`
|
|
WHERE id = vSelf;
|
|
|
|
DROP TEMPORARY TABLE IF EXISTS tmp.item;
|
|
CREATE TEMPORARY TABLE tmp.item
|
|
(PRIMARY KEY (itemFk))
|
|
ENGINE = MEMORY
|
|
SELECT itemFk FROM orderRow
|
|
WHERE orderFk = vSelf
|
|
GROUP BY itemFk;
|
|
|
|
CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode, FALSE);
|
|
|
|
DROP TEMPORARY TABLE tmp.item;
|
|
END$$
|
|
DELIMITER ;
|