projects
/
xtuple
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fe3f9eb
)
Issue #23658:ensure itemsite_value is 0 when qtyonhand is 0
author
garyhgohoos
<gary@xtuple.com>
Fri, 6 Jun 2014 15:49:48 +0000
(11:49 -0400)
committer
garyhgohoos
<gary@xtuple.com>
Fri, 6 Jun 2014 15:49:48 +0000
(11:49 -0400)
foundation-database/public/functions/postinvtrans.sql
patch
|
blob
|
history
diff --git
a/foundation-database/public/functions/postinvtrans.sql
b/foundation-database/public/functions/postinvtrans.sql
index
6625169
..
9afe786
100644
(file)
--- a/
foundation-database/public/functions/postinvtrans.sql
+++ b/
foundation-database/public/functions/postinvtrans.sql
@@
-125,7
+125,11
@@
BEGIN
_invhistid, itemsite_id, pTransType, _timestamp,
pQty, itemsite_qtyonhand,
(itemsite_qtyonhand + (_sense * pQty)),
_invhistid, itemsite_id, pTransType, _timestamp,
pQty, itemsite_qtyonhand,
(itemsite_qtyonhand + (_sense * pQty)),
- itemsite_costmethod, itemsite_value, itemsite_value + (_r.cost * _sense * pQty),
+ itemsite_costmethod, itemsite_value,
+ -- sanity check to ensure that value = 0 when qtyonhand = 0
+ CASE WHEN ((itemsite_qtyonhand + (_sense * pQty)) + itemsite_nnqoh) = 0.0 THEN 0.0
+ ELSE itemsite_value + (_r.cost * _sense * pQty)
+ END,
pOrderType, pOrderNumber, pDocNumber, pComments,
uom_name, _r.cost, _xferwhsid, FALSE, pItemlocSeries
FROM itemsite, item, uom
pOrderType, pOrderNumber, pDocNumber, pComments,
uom_name, _r.cost, _xferwhsid, FALSE, pItemlocSeries
FROM itemsite, item, uom