feat: refs #7564 Added proc
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Guillermo Bonet 2024-07-02 09:36:23 +02:00
parent 2a203926b9
commit 1e5fd8002c
1 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,24 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setVolume`(
vSelf INT
)
BEGIN
/**
* Update the volume ticket
*
* @param vSelf Ticket id
*/
DECLARE vVolume DECIMAL(10,6);
SELECT SUM(s.quantity * ic.cm3delivery / 1000000) INTO vVolume
FROM sale s
JOIN ticket t ON t.id = s.ticketFk
JOIN itemCost ic ON ic.itemFk = s.itemFk
AND ic.warehouseFk = t.warehouseFk
WHERE t.id = vSelf;
UPDATE ticket
SET volume = vVolume
WHERE id = vSelf;
END$$
DELIMITER ;