IDEMPIERE-190 Average Costing: make sure amt and qty argument for the setWeightedAverage method is of the same sight
This commit is contained in:
parent
f2f9da5add
commit
3ec5707657
|
@ -1453,6 +1453,11 @@ public class MCost extends X_M_Cost
|
||||||
*/
|
*/
|
||||||
public void setWeightedAverage (BigDecimal amt, BigDecimal qty)
|
public void setWeightedAverage (BigDecimal amt, BigDecimal qty)
|
||||||
{
|
{
|
||||||
|
//amount must follow the sign of qty
|
||||||
|
if (amt.signum() != 0 && amt.signum() != qty.signum())
|
||||||
|
{
|
||||||
|
amt = amt.multiply(new BigDecimal(-1.00d));
|
||||||
|
}
|
||||||
BigDecimal oldSum = getCurrentCostPrice().multiply(getCurrentQty());
|
BigDecimal oldSum = getCurrentCostPrice().multiply(getCurrentQty());
|
||||||
BigDecimal newSum = amt; // is total already
|
BigDecimal newSum = amt; // is total already
|
||||||
BigDecimal sumAmt = oldSum.add(newSum);
|
BigDecimal sumAmt = oldSum.add(newSum);
|
||||||
|
|
Loading…
Reference in New Issue