From 957b0c71ca8922f5493574c854c518e85f9bff55 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Mon, 8 Apr 2024 10:06:33 +0200 Subject: [PATCH 1/3] refs #6574 feat: add order --- db/routines/vn/procedures/item_getBalance.sql | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/db/routines/vn/procedures/item_getBalance.sql b/db/routines/vn/procedures/item_getBalance.sql index 95596d3bc..d84605176 100644 --- a/db/routines/vn/procedures/item_getBalance.sql +++ b/db/routines/vn/procedures/item_getBalance.sql @@ -173,7 +173,8 @@ BEGIN lineFk, isPicked, clientType, - claimFk + claimFk, + `order` FROM tItemDiary LEFT JOIN alertLevel a ON a.id = tItemDiary.alertLevel; @@ -197,7 +198,8 @@ BEGIN 0 lineFk, 0 isPicked, 0 clientType, - 0 claimFk + 0 claimFk, + `order` UNION ALL SELECT shipped, alertlevel, @@ -213,7 +215,8 @@ BEGIN lineFk, isPicked, clientType, - claimFk + claimFk, + `order` FROM tItemDiary WHERE shipped >= vDate; END IF; From 42b033dde295fbba1e8196be4e3f218f864293b1 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Mon, 8 Apr 2024 11:35:10 +0200 Subject: [PATCH 2/3] refs #6574 feat: add order --- db/routines/vn/procedures/item_getBalance.sql | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/db/routines/vn/procedures/item_getBalance.sql b/db/routines/vn/procedures/item_getBalance.sql index d84605176..e7a3641e0 100644 --- a/db/routines/vn/procedures/item_getBalance.sql +++ b/db/routines/vn/procedures/item_getBalance.sql @@ -156,27 +156,27 @@ BEGIN SET @shipped := ''; SELECT DATE(@shipped:= shipped) shipped, - alertLevel, - stateName, - origin, - reference, - clientFk, - name, - `in` invalue, - `out`, - @a := @a + IFNULL(`in`, 0) - IFNULL(`out`, 0) balance, + t.alertLevel, + t.stateName, + t.origin, + t.reference, + t.clientFk, + t.name, + t.`in` invalue, + t.`out`, + @a := @a + IFNULL(t.`in`, 0) - IFNULL(t.`out`, 0) balance, @currentLineFk := IF (@shipped < util.VN_CURDATE() OR (@shipped = util.VN_CURDATE() AND (isPicked OR a.`code` >= 'ON_PREPARATION')), - lineFk, + t.lineFk, @currentLineFk) lastPreparedLineFk, - isTicket, - lineFk, - isPicked, - clientType, - claimFk, - `order` - FROM tItemDiary - LEFT JOIN alertLevel a ON a.id = tItemDiary.alertLevel; + t.isTicket, + t.lineFk, + t.isPicked, + t.clientType, + t.claimFk, + t.`order` + FROM tItemDiary t + LEFT JOIN alertLevel a ON a.id = t.alertLevel; ELSE SELECT SUM(`in`) - SUM(`out`) INTO @a @@ -199,7 +199,7 @@ BEGIN 0 isPicked, 0 clientType, 0 claimFk, - `order` + NULL `order` UNION ALL SELECT shipped, alertlevel, From 2f7f2374224f58d3c1e87b1f256abf63c749ea7f Mon Sep 17 00:00:00 2001 From: sergiodt Date: Mon, 8 Apr 2024 13:28:38 +0200 Subject: [PATCH 3/3] refs #6574 feat: add order --- db/routines/vn/procedures/item_getBalance.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/procedures/item_getBalance.sql b/db/routines/vn/procedures/item_getBalance.sql index e7a3641e0..11af7e570 100644 --- a/db/routines/vn/procedures/item_getBalance.sql +++ b/db/routines/vn/procedures/item_getBalance.sql @@ -155,7 +155,7 @@ BEGIN SET @currentLineFk := 0; SET @shipped := ''; - SELECT DATE(@shipped:= shipped) shipped, + SELECT DATE(@shipped:= t.shipped) shipped, t.alertLevel, t.stateName, t.origin, @@ -166,7 +166,7 @@ BEGIN t.`out`, @a := @a + IFNULL(t.`in`, 0) - IFNULL(t.`out`, 0) balance, @currentLineFk := IF (@shipped < util.VN_CURDATE() - OR (@shipped = util.VN_CURDATE() AND (isPicked OR a.`code` >= 'ON_PREPARATION')), + OR (@shipped = util.VN_CURDATE() AND (t.isPicked OR a.`code` >= 'ON_PREPARATION')), t.lineFk, @currentLineFk) lastPreparedLineFk, t.isTicket,