details:   https://code.openbravo.com/erp/devel/pi/rev/7084255c151e
changeset: 25488:7084255c151e
user:      Unai Martirena <unai.martirena <at> openbravo.com>
date:      Thu Dec 04 12:12:34 2014 +0100
summary:   Related to Issue 28113: Revert a change on issue 28115.

In this cases the net unit price is the cost of the transaction

details:   https://code.openbravo.com/erp/devel/pi/rev/bc6fcc83e7dc
changeset: 25489:bc6fcc83e7dc
user:      Unai Martirena <unai.martirena <at> openbravo.com>
date:      Thu Dec 04 12:20:59 2014 +0100
summary:   Fixes issue 28192: Net Unit Price now is properly calculated.

In order to calculate the Net Unit Price, the adjustments of the transaction 
are used, but it was not being used the signMultiplier of the transaction, and 
needs to be used.

diffstat:

 src/org/openbravo/costing/AverageCostAdjustment.java |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r cc0f6b428be8 -r bc6fcc83e7dc 
src/org/openbravo/costing/AverageCostAdjustment.java
--- a/src/org/openbravo/costing/AverageCostAdjustment.java      Thu Dec 04 
11:37:10 2014 +0100
+++ b/src/org/openbravo/costing/AverageCostAdjustment.java      Thu Dec 04 
12:20:59 2014 +0100
@@ -173,7 +173,7 @@
         }
         newCosting.setQuantity(basetrx.getMovementQuantity());
         newCosting.setTotalMovementQuantity(currentStock);
-        newCosting.setPrice(trxPrice);
+        newCosting.setPrice(cost);
         newCosting.setCostType("AVA");
         newCosting.setManual(Boolean.FALSE);
         newCosting.setPermanent(Boolean.TRUE);
@@ -192,7 +192,7 @@
             curCosting.setOriginalCost(curCosting.getCost());
           }
           curCosting.setCost(cost);
-          curCosting.setPrice(trxPrice);
+          curCosting.setPrice(cost);
           curCosting.setPermanent(Boolean.TRUE);
           OBDal.getInstance().flush();
           OBDal.getInstance().save(curCosting);
@@ -281,7 +281,7 @@
           log.debug("New average cost: {}", cost.toPlainString());
           Costing curCosting = trx.getMaterialMgmtCostingList().get(0);
           BigDecimal trxPrice = 
curCosting.getPrice().multiply(trx.getMovementQuantity().abs())
-              .add(trxAdjAmt)
+              .add(trxAdjAmt.multiply(trxSignMultiplier))
               .divide(trx.getMovementQuantity().abs(), costCurPrecission, 
RoundingMode.HALF_UP);
 
           if (checkNegativeStockCorrection && 
currentStock.compareTo(trx.getMovementQuantity()) < 0
@@ -355,7 +355,7 @@
                   RoundingMode.HALF_UP);
             }
             BigDecimal trxPrice = 
curCosting.getPrice().multiply(trx.getMovementQuantity().abs())
-                .add(trxAdjAmt)
+                .add(trxAdjAmt.multiply(trxSignMultiplier))
                 .divide(trx.getMovementQuantity().abs(), costCurPrecission, 
RoundingMode.HALF_UP);
             if (curCosting.getCost().compareTo(cost) != 0) {
               curCosting.setPermanent(Boolean.FALSE);

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to