2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`routeInfo`(vRouteFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
|
|
|
|
DECLARE vPackages INT;
|
|
|
|
DECLARE vM3 INT;
|
|
|
|
DECLARE vKg INT;
|
|
|
|
DECLARE vMatricula varchar(50);
|
|
|
|
|
|
|
|
SELECT sum(packages) as bultos
|
|
|
|
INTO vPackages
|
|
|
|
FROM vn.ticket t
|
|
|
|
WHERE routeFk = vRouteFk;
|
|
|
|
|
|
|
|
SELECT SUM(sv.physicalVolume), SUM(sv.physicalWeight)
|
|
|
|
INTO vM3, vKg
|
|
|
|
FROM vn.saleVolume sv
|
|
|
|
WHERE sv.routeFk = vRouteFk;
|
|
|
|
|
|
|
|
SELECT v.numberPlate as matricula
|
|
|
|
INTO vMatricula
|
|
|
|
FROM vn.route r
|
|
|
|
JOIN vn.vehicle v ON r.vehicleFk = v.id
|
|
|
|
WHERE r.id = vRouteFk;
|
|
|
|
|
|
|
|
SELECT vRouteFk as Ruta,
|
|
|
|
vPackages as Bultos,
|
|
|
|
vM3 as m3,
|
|
|
|
vKg as Kg,
|
|
|
|
vMatricula as Matricula;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|