refs #6574 feat: add order #2264
|
@ -155,27 +155,28 @@ BEGIN
|
|||
SET @currentLineFk := 0;
|
||||
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,
|
||||
SELECT DATE(@shipped:= t.shipped) shipped,
|
||||
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,
|
||||
OR (@shipped = util.VN_CURDATE() AND (t.isPicked OR a.`code` >= 'ON_PREPARATION')),
|
||||
t.lineFk,
|
||||
@currentLineFk) lastPreparedLineFk,
|
||||
isTicket,
|
||||
lineFk,
|
||||
isPicked,
|
||||
clientType,
|
||||
claimFk
|
||||
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
|
||||
|
@ -197,7 +198,8 @@ BEGIN
|
|||
0 lineFk,
|
||||
0 isPicked,
|
||||
0 clientType,
|
||||
0 claimFk
|
||||
0 claimFk,
|
||||
NULL `order`
|
||||
UNION ALL
|
||||
SELECT shipped,
|
||||
alertlevel,
|
||||
|
@ -213,7 +215,8 @@ BEGIN
|
|||
lineFk,
|
||||
isPicked,
|
||||
clientType,
|
||||
claimFk
|
||||
claimFk,
|
||||
`order`
|
||||
FROM tItemDiary
|
||||
WHERE shipped >= vDate;
|
||||
END IF;
|
||||
|
|
Loading…
Reference in New Issue