fix: rutasAnalyzeHotFix #2119
|
@ -1,7 +1,7 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`rutasAnalyze`(
|
||||
vdatedFrom INT,
|
||||
vdatedTo INT
|
||||
vDatedFrom INT,
|
||||
robert marked this conversation as resolved
Outdated
|
||||
vDatedTo INT
|
||||
robert marked this conversation as resolved
Outdated
jgallego
commented
DATE DATE
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
|
@ -9,7 +9,7 @@ BEGIN
|
|||
* y lo almacena en la tabla bi.rutasBoard
|
||||
*/
|
||||
DELETE FROM rutasBoard
|
||||
WHERE Fecha BETWEEN vdatedFrom AND vdatedTo;
|
||||
WHERE Fecha BETWEEN vDatedFrom AND vDatedTo;
|
||||
|
||||
DELETE rb.*
|
||||
robert marked this conversation as resolved
Outdated
carlosap
commented
DELETE rb no es necesario .* DELETE rb no es necesario .*
carlosap
commented
Este delete sobra Este delete sobra
|
||||
FROM rutasBoard rb
|
||||
|
@ -17,7 +17,7 @@ BEGIN
|
|||
JOIN vn.ticket t ON t.routeFk = r.id
|
||||
LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
|
||||
JOIN vn.expeditionBoxVol ebv ON ebv.code = 'transportBox'
|
||||
WHERE r.created BETWEEN vdatedFrom AND vdatedTo
|
||||
WHERE r.created BETWEEN vDatedFrom AND vDatedTo
|
||||
AND z.isVolumetric;
|
||||
|
||||
-- Rellenamos la tabla con los datos de las rutas VOLUMETRICAS, especialmente con los bultos "virtuales"
|
||||
|
@ -35,7 +35,7 @@ BEGIN
|
|||
LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
|
||||
JOIN vn.saleVolume sv ON sv.ticketFk = t.id
|
||||
JOIN vn.expeditionBoxVol ebv ON ebv.code = 'transportBox'
|
||||
WHERE r.created BETWEEN vdatedFrom AND vdatedTo
|
||||
WHERE r.created BETWEEN vDatedFrom AND vDatedTo
|
||||
AND z.isVolumetric
|
||||
GROUP BY r.id;
|
||||
|
||||
|
@ -52,7 +52,7 @@ BEGIN
|
|||
FROM vn.route r
|
||||
JOIN vn.ticket t ON t.routeFk = r.id
|
||||
LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
|
||||
WHERE r.created BETWEEN vdatedFrom AND vdatedTo
|
||||
WHERE r.created BETWEEN vDatedFrom AND vDatedTo
|
||||
AND NOT z.isVolumetric
|
||||
GROUP BY r.id
|
||||
ON DUPLICATE KEY UPDATE Bultos = Bultos + VALUES(Bultos);
|
||||
|
@ -69,7 +69,7 @@ BEGIN
|
|||
JOIN vn.component c ON c.id = sc.componentFk
|
||||
JOIN vn.componentType ct ON ct.id = c.typeFk
|
||||
WHERE ct.code = 'FREIGHT'
|
||||
AND r.created BETWEEN vdatedFrom AND vdatedTo
|
||||
AND r.created BETWEEN vDatedFrom AND vDatedTo
|
||||
GROUP BY r.id
|
||||
) sub ON sub.routeFk = r.Id_Ruta
|
||||
SET r.practico = IFNULL(sub.totalPractice / r.Bultos, 0);
|
||||
|
@ -86,7 +86,7 @@ BEGIN
|
|||
JOIN vn.address ad ON ad.id = t.addressFk
|
||||
JOIN vn.client c ON c.id = ad.clientFk
|
||||
LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
|
||||
WHERE r.created BETWEEN vdatedFrom AND vdatedTo
|
||||
WHERE r.created BETWEEN vDatedFrom AND vDatedTo
|
||||
AND NOT z.isVolumetric
|
||||
GROUP BY t.routeFk
|
||||
) sub ON r.Id_Ruta = sub.routeFk
|
||||
|
@ -102,7 +102,7 @@ BEGIN
|
|||
JOIN vn.saleVolume sf ON sf.ticketFk = t.id
|
||||
JOIN vn.client c ON c.id = t.clientFk
|
||||
JOIN vn.`zone` z ON z.id = t.zoneFk
|
||||
WHERE r.created BETWEEN vdatedFrom AND vdatedTo
|
||||
WHERE r.created BETWEEN vDatedFrom AND vDatedTo
|
||||
AND z.isVolumetric
|
||||
GROUP BY t.routeFk
|
||||
) sub ON r.Id_Ruta = sub.routeFk
|
||||
|
@ -117,7 +117,7 @@ BEGIN
|
|||
JOIN vn.route r ON r.id = t.routeFk
|
||||
JOIN vn.greuge g ON g.ticketFk = t.id
|
||||
JOIN vn.greugeType gt ON gt.id = g.greugeTypeFk
|
||||
WHERE r.created BETWEEN vdatedFrom AND vdatedTo
|
||||
WHERE r.created BETWEEN vDatedFrom AND vDatedTo
|
||||
AND gt.code = 'freightDifference'
|
||||
GROUP BY t.routeFk
|
||||
) sub ON r.Id_Ruta = sub.routeFk
|
||||
|
|
Loading…
Reference in New Issue
camelcase
DATE