From ed67b1168f71f457c0210a5c13b5fa8a5b3267a6 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 13 Feb 2024 11:14:35 +0100 Subject: [PATCH] refactor: refs #6501 Requested changes --- ...ilAmerica.sql => continent_getTravelDetail.sql} | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) rename db/routines/vn/procedures/{travel_detailAmerica.sql => continent_getTravelDetail.sql} (87%) diff --git a/db/routines/vn/procedures/travel_detailAmerica.sql b/db/routines/vn/procedures/continent_getTravelDetail.sql similarity index 87% rename from db/routines/vn/procedures/travel_detailAmerica.sql rename to db/routines/vn/procedures/continent_getTravelDetail.sql index ecd24cd5c..8049f9e65 100644 --- a/db/routines/vn/procedures/travel_detailAmerica.sql +++ b/db/routines/vn/procedures/continent_getTravelDetail.sql @@ -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,