fix: getSimilar daysInforward

This commit is contained in:
Javi Gallego 2024-10-01 12:19:51 +02:00
parent 36e1cfd51a
commit 6685ade299
1 changed files with 31 additions and 31 deletions

View File

@ -52,13 +52,13 @@ BEGIN
FROM vn.sale s
JOIN vn.ticket t ON t.id = s.ticketFk
LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id
WHERE t.shipped BETWEEN CURDATE() AND CURDATE() + INTERVAL vDaysInForward DAY
WHERE t.shipped >= CURDATE() + INTERVAL vDaysInForward DAY
AND iss.saleFk IS NULL
AND t.warehouseFk = vWarehouseFk
GROUP BY s.itemFk
)
SELECT i.id itemFk,
CAST(sd.quantity AS INT) advanceable,
LEAST(CAST(sd.quantity AS INT), sk.stock) advanceable,
i.longName,
i.subName,
i.tag5,