37 lines
859 B
SQL
37 lines
859 B
SQL
|
|
DROP procedure IF EXISTS `hedera`.`order_calcCatalog`;
|
|
DELIMITER $$
|
|
CREATE DEFINER=`root`@`%` 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.ticketCalculate(vDate, vAddress, vAgencyMode);
|
|
|
|
DROP TEMPORARY TABLE tmp.item;
|
|
END$$
|
|
DELIMITER ;
|