DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `hedera`.`order_calcCatalogFromItem`(vSelf INT, vItem INT)
BEGIN
/**
 * Gets the availability and prices for the given item
 * using the order parameters.
 *
 * @param vSelf The order id
 * @table tmp.item(itemFk)
 * @return tmp.ticketCalculateItem
 * @return tmp.ticketComponentPrice
 * @return tmp.ticketComponent
 * @return tmp.ticketLot
 * @return tmp.zoneGetShipped
 */
	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;

	CALL vn.catalog_calcFromItem(vDate, vAddress, vAgencyMode, vItem);
END$$
DELIMITER ;
