2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ticketTotalVolumeBoxes`(vTicketId INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
RETURNS decimal(10,1)
|
|
|
|
DETERMINISTIC
|
|
|
|
BEGIN
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Devuelve el volumen estimado del ticket sumado, en cajas
|
|
|
|
*
|
|
|
|
* vTicketId Numero de ticket
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
DECLARE vVolumeBoxM3 DOUBLE;
|
|
|
|
DECLARE vTicketTotalVolumeBoxes DECIMAL(10,1);
|
|
|
|
DECLARE vVnBoxId VARCHAR(10) DEFAULT '94';
|
|
|
|
|
|
|
|
SELECT volume / 1000000 INTO vVolumeBoxM3 FROM packaging WHERE id = vVnBoxId;
|
|
|
|
|
|
|
|
SET vTicketTotalVolumeBoxes = ticketTotalVolume(vTicketId) / vVolumeBoxM3;
|
|
|
|
|
|
|
|
RETURN vTicketTotalVolumeBoxes;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|