refactor: refs #6501 Requested changes
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Guillermo Bonet 2024-02-13 11:14:35 +01:00
parent c4528a9eac
commit ed67b1168f
1 changed files with 10 additions and 4 deletions

View File

@ -1,9 +1,13 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_detailAmerica`()
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`continent_getTravelDetail`(
vSelf INT
)
BEGIN
/**
* Devuelve los detalles de los vuelos que tienen
* un almacén de salida en Ecuador o Colombia.
* un almacén de salida de un continente.
*
* @param vSelf Id de continente
*/
DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL 12 WEEK;
SELECT IFNULL(CONCAT(" ", entryFk), travelFk) travelAndEntry,
@ -44,10 +48,11 @@ BEGIN
LEFT JOIN itemType it ON it.id = i.typeFk
JOIN warehouse wIn ON wIn.id = tr.warehouseInFk
JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk
JOIN country co ON co.id = wOut.countryFk
JOIN agencyMode am ON am.id = tr.agencyModeFk
JOIN volumeConfig vc
WHERE tr.landed >= vDateFrom
AND (wOut.code = "col" OR wOut.code = "ecu")
AND co.continentFk = vSelf
GROUP BY tr.id
UNION ALL
SELECT e.travelFk,
@ -86,9 +91,10 @@ BEGIN
LEFT JOIN supplier s2 ON s2.id = tr.cargoSupplierFk
JOIN warehouse wIn ON wIn.id = tr.warehouseInFk
JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk
JOIN country co ON co.id = wOut.countryFk
JOIN volumeConfig vc
WHERE tr.landed >= vDateFrom
AND (wOut.code = "col" OR wOut.code = "ecu")
AND co.continentFk = vSelf
GROUP BY e.id
) sub
ORDER BY landed ASC,