fix: refs #7404 negative quantity #3214

Merged
pablone merged 2 commits from 7404-fixNegativeQuantity into master 2024-11-19 06:16:10 +00:00
2 changed files with 6 additions and 3 deletions

View File

@ -80,7 +80,7 @@ proc: BEGIN
UPDATE stockBought s
JOIN tStockSold ts ON ts.workerFk = s.workerFk
SET s.bought = IF(s.bought < ts.sold, ROUND(s.bought - ts.sold, 1), 0)
SET s.bought = IF(s.bought < ABS(ts.sold), 0, ROUND(s.bought - ABS(ts.sold), 1))
WHERE s.dated = vDated;
DROP TEMPORARY TABLE tCurrentData, tmp.item, tmp.buyUltimate, tStockSold;

View File

@ -50,8 +50,11 @@ module.exports = Self => {
i.id itemFk,
i.name itemName,
ti.quantity,
ROUND((ac.conversionCoefficient * (ti.quantity / b.packing) * buy_getVolume(b.id))
/ (vc.trolleyM3 * 1000000),1) volume,
ROUND((ac.conversionCoefficient *
Review

si açò es hotfix ho pugem, pero fes-li test, que açò es prou crític.

si açò es hotfix ho pugem, pero fes-li test, que açò es prou crític.
Review

solo le he dado formato el sql y amplia el redondeo de 1 decimal a 2

solo le he dado formato el sql y amplia el redondeo de 1 decimal a 2
(ti.quantity / b.packing) *
buy_getVolume(b.id)
) / (vc.trolleyM3 * 1000000),
2) volume,
b.packagingFk packagingFk,
b.packing
FROM tmp.item ti