refs #6574 feat: add order #2264
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue