2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` FUNCTION `vn`.`ticket_getWeight`(vTicketFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
RETURNS decimal(10,3)
|
|
|
|
NOT DETERMINISTIC
|
|
|
|
READS SQL DATA
|
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Devuelve el peso total del ticket
|
|
|
|
*
|
|
|
|
* @return Total peso
|
|
|
|
*/
|
|
|
|
|
|
|
|
DECLARE vWeight DECIMAL(10,3);
|
|
|
|
|
|
|
|
SELECT sum(weight) INTO vWeight
|
|
|
|
FROM saleVolume
|
|
|
|
WHERE ticketFk = vTicketFk;
|
|
|
|
|
|
|
|
RETURN vWeight;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|