2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travelVolume_get`(vFromDated DATE, vToDated DATE, vWarehouseFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
SELECT tr.landed Fecha,
|
|
|
|
a.name Agencia,
|
|
|
|
count(DISTINCT e.id) numEntradas,
|
|
|
|
FLOOR(sum(item_getVolume(b.itemFk, b.packagingFk) * b.stickers / 1000000 )) AS m3
|
|
|
|
FROM vn.travel tr
|
|
|
|
JOIN vn.agencyMode a ON a.id = tr.agencyModeFk
|
|
|
|
JOIN vn.entry e ON e.travelFk = tr.id
|
|
|
|
JOIN vn.buy b ON b.entryFk = e.id
|
|
|
|
WHERE tr.landed BETWEEN vFromDated AND vToDated
|
2024-11-11 13:19:11 +00:00
|
|
|
AND NOT tr.isRaid
|
2024-01-15 11:31:03 +00:00
|
|
|
AND tr.warehouseInFk = vWarehouseFk
|
|
|
|
GROUP BY tr.landed , a.name ;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|