You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2014/03/26 19:09:09 UTC
svn commit: r1581974 - in /ofbiz/branches/release13.07: ./
applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy
Author: jacopoc
Date: Wed Mar 26 18:09:08 2014
New Revision: 1581974
URL: http://svn.apache.org/r1581974
Log:
Applied fix from trunk for revision: 1581972
===
Misc fixes to get the right values for total cost and total retail value of inventory items; thanks to Igor Gallingani for the bug report in OFBIZ-4985.
Modified:
ofbiz/branches/release13.07/ (props changed)
ofbiz/branches/release13.07/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy
Propchange: ofbiz/branches/release13.07/
------------------------------------------------------------------------------
Merged /ofbiz/trunk:r1581972
Modified: ofbiz/branches/release13.07/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy?rev=1581974&r1=1581973&r2=1581974&view=diff
==============================================================================
--- ofbiz/branches/release13.07/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy (original)
+++ ofbiz/branches/release13.07/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy Wed Mar 26 18:09:08 2014
@@ -36,8 +36,6 @@ if (action) {
conditions.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, null));
conditionList = EntityCondition.makeCondition(conditions, EntityOperator.OR);
try {
- // create resultMap to stop issue with the first puts in the while loop
- resultMap = [:];
beganTransaction = TransactionUtil.begin();
invItemListItr = delegator.find("InventoryItem", conditionList, null, null, ['productId'], null);
while ((inventoryItem = invItemListItr.next()) != null) {
@@ -49,6 +47,8 @@ if (action) {
availableToPromiseTotal = inventoryItem.getDouble("availableToPromiseTotal");
costPrice = inventoryItem.getDouble("unitCost");
retailPrice = 0.0;
+ totalCostPrice = 0.0;
+ totalRetailPrice = 0.0;
productPrices = product.getRelated("ProductPrice", null, null, false);
if (productPrices) {
productPrices.each { productPrice ->
@@ -59,12 +59,10 @@ if (action) {
}
if (costPrice && quantityOnHandTotal) {
totalCostPrice = costPrice * quantityOnHandTotal;
- resultMap.totalCostPrice = totalCostPrice;
totalCostPriceGrandTotal += totalCostPrice;
}
if (retailPrice && quantityOnHandTotal) {
totalRetailPrice = retailPrice * quantityOnHandTotal;
- resultMap.totalRetailPrice = totalRetailPrice;
totalRetailPriceGrandTotal += totalRetailPrice;
}
if (quantityOnHandTotal) {
@@ -81,7 +79,7 @@ if (action) {
}
resultMap = [productId : product.productId, quantityOnHand : quantityOnHandTotal, availableToPromise : availableToPromiseTotal,
- costPrice : costPrice, retailPrice : retailPrice];
+ costPrice : costPrice, retailPrice : retailPrice, totalCostPrice : totalCostPrice, totalRetailPrice : totalRetailPrice];
inventoryItemTotals.add(resultMap);
}
}