hotfix item_getBalance #1563

Merged
alexandre merged 5 commits from hotfix-item_getBalance into master 2023-05-25 12:01:15 +00:00
1 changed files with 9 additions and 7 deletions
Showing only changes of commit 7e5fcc73ad - Show all commits

View File

@ -59970,7 +59970,7 @@ BEGIN
SELECT DATE(t.shipped),
NULL,
s.quantity,
al.id,
al3.id,
st.name,
t.nickname,
t.refFk,
@ -59988,11 +59988,13 @@ BEGIN
LEFT JOIN state st ON st.code = ts.code
JOIN client c ON c.id = t.clientFk
JOIN clientType ct ON ct.id = c.clientTypeFk
JOIN alertLevel al ON al.code =
JOIN alertLevel al ON al.code = 'DELIVERED'
JOIN alertLevel al2 ON al2.code = 'FREE'
JOIN alertLevel al3 ON al3.id =
CASE
WHEN t.shipped < util.VN_CURDATE() THEN 'DELIVERED'
WHEN t.shipped > util.dayEnd(util.VN_CURDATE()) THEN 'FREE'
ELSE IFNULL(ts.alertLevel, 0)
WHEN t.shipped < util.VN_CURDATE() THEN al.code
WHEN t.shipped > util.dayEnd(util.VN_CURDATE()) THEN al2.code
ELSE IFNULL(ts.alertLevel, al2.code)
END
LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED'
LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = stPrep.id