update structure
This commit is contained in:
parent
675c6be73e
commit
755e0c1360
|
@ -1,38 +0,0 @@
|
|||
USE `vn`;
|
||||
DROP procedure IF EXISTS `ticketGetVisibleAvailable`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetVisibleAvailable`(
|
||||
vTicket INT)
|
||||
BEGIN
|
||||
DECLARE vVisibleCalc INT;
|
||||
DECLARE vAvailableCalc INT;
|
||||
DECLARE vShipped DATE;
|
||||
DECLARE vWarehouse TINYINT;
|
||||
DECLARE vAlertLevel INT;
|
||||
|
||||
SELECT t.warehouseFk, t.shipped, ts.alertLevel INTO vWarehouse, vShipped, vAlertLevel
|
||||
FROM ticket t
|
||||
LEFT JOIN ticketState ts ON ts.ticketFk = vTicket
|
||||
WHERE t.id = vTicket;
|
||||
|
||||
IF vAlertLevel IS NULL OR vAlertLevel = 0 THEN
|
||||
IF vShipped >= CURDATE() THEN
|
||||
CALL cache.available_refresh(vAvailableCalc, FALSE, vWarehouse, vShipped);
|
||||
END IF;
|
||||
IF vShipped = CURDATE() THEN
|
||||
CALL cache.visible_refresh(vVisibleCalc, FALSE, vWarehouse);
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
SELECT s.id, s.itemFk, s.quantity, s.concept, s.price, s.reserved, s.discount, v.visible, av.available
|
||||
FROM sale s
|
||||
LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCalc
|
||||
LEFT JOIN cache.available av ON av.item_id = s.itemFk AND av.calc_id = vAvailableCalc
|
||||
WHERE s.ticketFk = vTicket;
|
||||
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
USE `vn`;
|
||||
DROP procedure IF EXISTS `ticketGetVisibleAvailable`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetVisibleAvailable`(
|
||||
vTicket INT)
|
||||
BEGIN
|
||||
|
@ -28,4 +33,6 @@ BEGIN
|
|||
LEFT JOIN item it ON it.id = s.itemFk
|
||||
WHERE s.ticketFk = vTicket;
|
||||
|
||||
END
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
Loading…
Reference in New Issue