2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`catalog_calcFromMyAddress`(vDelivery DATE, vAddress INT)
|
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Gets the available items list.
|
|
|
|
*
|
|
|
|
* @param vDelivery Delivery date
|
|
|
|
* @param vAddress Address id
|
|
|
|
* @return tmp.ticketCalculateItem
|
|
|
|
* @return tmp.ticketComponentPrice
|
|
|
|
* @return tmp.ticketComponent
|
|
|
|
* @return tmp.ticketLot
|
|
|
|
* @return tmp.zoneGetShipped
|
|
|
|
*/
|
|
|
|
DECLARE vAgencyMode INT;
|
|
|
|
|
|
|
|
SELECT a.agencyModeFk
|
|
|
|
INTO vAgencyMode
|
|
|
|
FROM myClient c
|
|
|
|
JOIN vn.address a ON a.clientFk = c.id
|
|
|
|
WHERE a.id = vAddress;
|
|
|
|
|
|
|
|
CALL vn.available_calc(vDelivery, vAddress, vAgencyMode);
|
|
|
|
|
|
|
|
DROP TEMPORARY TABLE IF EXISTS tmp.item;
|
|
|
|
CREATE TEMPORARY TABLE tmp.item
|
|
|
|
(INDEX (itemFk))
|
|
|
|
ENGINE = MEMORY
|
|
|
|
SELECT c.item_id itemFk
|
|
|
|
FROM `cache`.available c
|
|
|
|
JOIN tmp.availableCalc a ON a.calcFk = c.calc_id
|
|
|
|
WHERE c.available > 0
|
|
|
|
GROUP BY c.item_id;
|
|
|
|
|
2024-03-25 13:56:12 +00:00
|
|
|
CALL vn.catalog_calculate(vDelivery, vAddress, vAgencyMode, FALSE);
|
2024-01-15 11:31:03 +00:00
|
|
|
|
|
|
|
DROP TEMPORARY TABLE tmp.item;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|