Merge pull request 'refs #6574 feat: add order' (!2264) from 6574_itemGetBalance into dev
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-dev This commit looks good Details

Reviewed-on: #2264
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
Sergio De la torre 2024-04-24 13:55:05 +00:00
commit b8fdd7d726
1 changed files with 24 additions and 21 deletions

View File

@ -155,27 +155,28 @@ BEGIN
SET @currentLineFk := 0; SET @currentLineFk := 0;
SET @shipped := ''; SET @shipped := '';
SELECT DATE(@shipped:= shipped) shipped, SELECT DATE(@shipped:= t.shipped) shipped,
alertLevel, t.alertLevel,
stateName, t.stateName,
origin, t.origin,
reference, t.reference,
clientFk, t.clientFk,
name, t.name,
`in` invalue, t.`in` invalue,
`out`, t.`out`,
@a := @a + IFNULL(`in`, 0) - IFNULL(`out`, 0) balance, @a := @a + IFNULL(t.`in`, 0) - IFNULL(t.`out`, 0) balance,
@currentLineFk := IF (@shipped < util.VN_CURDATE() @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')),
lineFk, t.lineFk,
@currentLineFk) lastPreparedLineFk, @currentLineFk) lastPreparedLineFk,
isTicket, t.isTicket,
lineFk, t.lineFk,
isPicked, t.isPicked,
clientType, t.clientType,
claimFk t.claimFk,
FROM tItemDiary t.`order`
LEFT JOIN alertLevel a ON a.id = tItemDiary.alertLevel; FROM tItemDiary t
LEFT JOIN alertLevel a ON a.id = t.alertLevel;
ELSE ELSE
SELECT SUM(`in`) - SUM(`out`) INTO @a SELECT SUM(`in`) - SUM(`out`) INTO @a
@ -197,7 +198,8 @@ BEGIN
0 lineFk, 0 lineFk,
0 isPicked, 0 isPicked,
0 clientType, 0 clientType,
0 claimFk 0 claimFk,
NULL `order`
UNION ALL UNION ALL
SELECT shipped, SELECT shipped,
alertlevel, alertlevel,
@ -213,7 +215,8 @@ BEGIN
lineFk, lineFk,
isPicked, isPicked,
clientType, clientType,
claimFk claimFk,
`order`
FROM tItemDiary FROM tItemDiary
WHERE shipped >= vDate; WHERE shipped >= vDate;
END IF; END IF;