Merge pull request 'fix: refs #7404 negative quantity' (!3214) from 7404-fixNegativeQuantity into master
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #3214 Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
commit
0d205eb6ce
|
@ -80,7 +80,7 @@ proc: BEGIN
|
||||||
|
|
||||||
UPDATE stockBought s
|
UPDATE stockBought s
|
||||||
JOIN tStockSold ts ON ts.workerFk = s.workerFk
|
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;
|
WHERE s.dated = vDated;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tCurrentData, tmp.item, tmp.buyUltimate, tStockSold;
|
DROP TEMPORARY TABLE tCurrentData, tmp.item, tmp.buyUltimate, tStockSold;
|
||||||
|
|
|
@ -50,8 +50,11 @@ module.exports = Self => {
|
||||||
i.id itemFk,
|
i.id itemFk,
|
||||||
i.name itemName,
|
i.name itemName,
|
||||||
ti.quantity,
|
ti.quantity,
|
||||||
ROUND((ac.conversionCoefficient * (ti.quantity / b.packing) * buy_getVolume(b.id))
|
ROUND((ac.conversionCoefficient *
|
||||||
/ (vc.trolleyM3 * 1000000),1) volume,
|
(ti.quantity / b.packing) *
|
||||||
|
buy_getVolume(b.id)
|
||||||
|
) / (vc.trolleyM3 * 1000000),
|
||||||
|
2) volume,
|
||||||
b.packagingFk packagingFk,
|
b.packagingFk packagingFk,
|
||||||
b.packing
|
b.packing
|
||||||
FROM tmp.item ti
|
FROM tmp.item ti
|
||||||
|
|
Loading…
Reference in New Issue