svn commit: r1153842 - in /ofbiz/trunk/applications: accounting/webapp/accounting/WEB-INF/actions/fixedasset/ party/webapp/partymgr/WEB-INF/actions/party/ product/webapp/facility/WEB-INF/actions/inventory/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1153842 - in /ofbiz/trunk/applications: accounting/webapp/accounting/WEB-INF/actions/fixedasset/ party/webapp/partymgr/WEB-INF/actions/party/ product/webapp/facility/WEB-INF/actions/inventory/

bibryam
Author: bibryam
Date: Thu Aug  4 10:46:56 2011
New Revision: 1153842

URL: http://svn.apache.org/viewvc?rev=1153842&view=rev
Log:
Fixed inconsistent line endings

Modified:
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyGeoLocation.groovy
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.groovy
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy?rev=1153842&r1=1153841&r2=1153842&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy Thu Aug  4 10:46:56 2011
@@ -1,45 +1,45 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.ofbiz.base.util.*;
-import org.ofbiz.common.geo.*;
-import org.ofbiz.entity.*;
-
-uiLabelMap = UtilProperties.getResourceBundleMap("AccountingUiLabels", locale);
-
-if (fixedAsset) {
-    latestGeoPoint = GeoWorker.findLatestGeoPoint(delegator, "FixedAssetAndGeoPoint", "fixedAssetId", fixedAssetId, null, null);
-    if (latestGeoPoint) {
-        context.latestGeoPoint = latestGeoPoint;
-        
-        //List geoCenter = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "zoom", "13"));
-        
-        if (latestGeoPoint.containsKey("latitude") && latestGeoPoint.containsKey("longitude")) {
-            List geoPoints = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "fixedAssetId", fixedAssetId,
-                            "link", UtilMisc.toMap("url", "EditFixedAsset?fixedAssetId="+ fixedAssetId, "label", uiLabelMap.AccountingFixedAsset + " " + fixedAsset.fixedAssetName)));
-            
-            Map geoChart = UtilMisc.toMap("width", "500px", "height", "450px", "controlUI" , "small", "dataSourceId", latestGeoPoint.dataSourceId, "points", geoPoints);
-            context.geoChart = geoChart;
-        }
-        if (latestGeoPoint.elevationUomId) {
-            elevationUom = delegator.findOne("Uom", [uomId : latestGeoPoint.elevationUomId], false);
-            context.elevationUomAbbr = elevationUom.abbreviation;
-        }
-    }
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.ofbiz.base.util.*;
+import org.ofbiz.common.geo.*;
+import org.ofbiz.entity.*;
+
+uiLabelMap = UtilProperties.getResourceBundleMap("AccountingUiLabels", locale);
+
+if (fixedAsset) {
+    latestGeoPoint = GeoWorker.findLatestGeoPoint(delegator, "FixedAssetAndGeoPoint", "fixedAssetId", fixedAssetId, null, null);
+    if (latestGeoPoint) {
+        context.latestGeoPoint = latestGeoPoint;
+        
+        //List geoCenter = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "zoom", "13"));
+        
+        if (latestGeoPoint.containsKey("latitude") && latestGeoPoint.containsKey("longitude")) {
+            List geoPoints = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "fixedAssetId", fixedAssetId,
+                            "link", UtilMisc.toMap("url", "EditFixedAsset?fixedAssetId="+ fixedAssetId, "label", uiLabelMap.AccountingFixedAsset + " " + fixedAsset.fixedAssetName)));
+            
+            Map geoChart = UtilMisc.toMap("width", "500px", "height", "450px", "controlUI" , "small", "dataSourceId", latestGeoPoint.dataSourceId, "points", geoPoints);
+            context.geoChart = geoChart;
+        }
+        if (latestGeoPoint.elevationUomId) {
+            elevationUom = delegator.findOne("Uom", [uomId : latestGeoPoint.elevationUomId], false);
+            context.elevationUomAbbr = elevationUom.abbreviation;
+        }
+    }
 }

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyGeoLocation.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyGeoLocation.groovy?rev=1153842&r1=1153841&r2=1153842&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyGeoLocation.groovy (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyGeoLocation.groovy Thu Aug  4 10:46:56 2011
@@ -1,59 +1,59 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.ofbiz.common.geo.*;
-import org.ofbiz.base.util.*;
-
-uiLabelMap = UtilProperties.getResourceBundleMap("PartyUiLabels", locale);
-uiLabelMap.addBottomResourceBundle("CommonUiLabels");
-
-partyId = parameters.partyId ?: parameters.party_id;
-userLoginId = parameters.userlogin_id ?: parameters.userLoginId;
-
-if (!partyId && userLoginId) {
-    thisUserLogin = delegator.findByPrimaryKey("UserLogin", [userLoginId : userLoginId]);
-    if (thisUserLogin) {
-        partyId = thisUserLogin.partyId;
-    }
-}
-geoPointId = parameters.geoPointId;
-context.partyId = partyId;
-
-if (!geoPointId) {
-    latestGeoPoint = GeoWorker.findLatestGeoPoint(delegator, "PartyAndGeoPoint", "partyId", partyId, null, null);
-} else {
-    latestGeoPoint = delegator.findByPrimaryKey("GeoPoint", [geoPointId : geoPointId]);
-}
-if (latestGeoPoint) {
-    context.latestGeoPoint = latestGeoPoint;
-
-    List geoCenter = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "zoom", "13"));
-  
-    if (UtilValidate.isNotEmpty(latestGeoPoint) && latestGeoPoint.containsKey("latitude") && latestGeoPoint.containsKey("longitude")) {
-        List geoPoints = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "partyId", partyId,
-              "link", UtilMisc.toMap("url", "viewprofile?partyId="+ partyId, "label", uiLabelMap.PartyProfile + " " + uiLabelMap.CommonOf + " " + partyId)));
-
-        Map geoChart = UtilMisc.toMap("width", "500px", "height", "450px", "controlUI" , "small", "dataSourceId", latestGeoPoint.dataSourceId, "points", geoPoints);
-        context.geoChart = geoChart;
-    }
-    if (latestGeoPoint && latestGeoPoint.elevationUomId) {
-        elevationUom = delegator.findOne("Uom", [uomId : latestGeoPoint.elevationUomId], false);
-        context.elevationUomAbbr = elevationUom.abbreviation;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.ofbiz.common.geo.*;
+import org.ofbiz.base.util.*;
+
+uiLabelMap = UtilProperties.getResourceBundleMap("PartyUiLabels", locale);
+uiLabelMap.addBottomResourceBundle("CommonUiLabels");
+
+partyId = parameters.partyId ?: parameters.party_id;
+userLoginId = parameters.userlogin_id ?: parameters.userLoginId;
+
+if (!partyId && userLoginId) {
+    thisUserLogin = delegator.findByPrimaryKey("UserLogin", [userLoginId : userLoginId]);
+    if (thisUserLogin) {
+        partyId = thisUserLogin.partyId;
+    }
+}
+geoPointId = parameters.geoPointId;
+context.partyId = partyId;
+
+if (!geoPointId) {
+    latestGeoPoint = GeoWorker.findLatestGeoPoint(delegator, "PartyAndGeoPoint", "partyId", partyId, null, null);
+} else {
+    latestGeoPoint = delegator.findByPrimaryKey("GeoPoint", [geoPointId : geoPointId]);
+}
+if (latestGeoPoint) {
+    context.latestGeoPoint = latestGeoPoint;
+
+    List geoCenter = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "zoom", "13"));
+  
+    if (UtilValidate.isNotEmpty(latestGeoPoint) && latestGeoPoint.containsKey("latitude") && latestGeoPoint.containsKey("longitude")) {
+        List geoPoints = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "partyId", partyId,
+              "link", UtilMisc.toMap("url", "viewprofile?partyId="+ partyId, "label", uiLabelMap.PartyProfile + " " + uiLabelMap.CommonOf + " " + partyId)));
+
+        Map geoChart = UtilMisc.toMap("width", "500px", "height", "450px", "controlUI" , "small", "dataSourceId", latestGeoPoint.dataSourceId, "points", geoPoints);
+        context.geoChart = geoChart;
+    }
+    if (latestGeoPoint && latestGeoPoint.elevationUomId) {
+        elevationUom = delegator.findOne("Uom", [uomId : latestGeoPoint.elevationUomId], false);
+        context.elevationUomAbbr = elevationUom.abbreviation;
+    }
+}

Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.groovy?rev=1153842&r1=1153841&r2=1153842&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.groovy Thu Aug  4 10:46:56 2011
@@ -1,72 +1,72 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.ofbiz.service.ServiceUtil
-import org.ofbiz.entity.condition.*
-
-facilityId = parameters.facilityId;
-
-// fields to search by
-productId = parameters.productId ? parameters.productId.trim() : null;
-internalName = parameters.internalName ? parameters.internalName.trim() : null;
-
-// build conditions
-conditions = [EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId),
-              EntityCondition.makeCondition("inventoryItemTypeId", EntityOperator.EQUALS, "NON_SERIAL_INV_ITEM")
-             ];
-if (productId) {
-    conditions.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%"));
-}
-if (internalName) {
-    conditions.add(EntityCondition.makeCondition("internalName", EntityOperator.LIKE, internalName + "%"));
-}
-
-if (conditions.size() > 2) {
-    ecl = EntityCondition.makeCondition(conditions, EntityOperator.AND);
-    physicalInventory = delegator.findList("ProductInventoryItem", ecl, null, ['productId'], null, false);
-
-    // also need the overal product QOH and ATP for each product
-    atpMap = [:];
-    qohMap = [:];
-
-    // build a list of productIds
-    productIds = [] as Set;
-    physicalInventory.each { iter ->
-        productIds.add(iter.productId);
-    }
-
-    // for each product, call the inventory counting service
-    productIds.each { productId ->
-        result = dispatcher.runSync("getInventoryAvailableByFacility", [facilityId : facilityId, productId : productId]);
-        if (!ServiceUtil.isError(result)) {
-            atpMap.put(productId, result.availableToPromiseTotal);
-            qohMap.put(productId, result.quantityOnHandTotal);
-        }
-    }
-
-    // associate the quantities to each row and store the combined data as our list
-    physicalInventoryCombined = [];
-    physicalInventory.each { iter ->
-        row = iter.getAllFields();
-        row.productATP = atpMap.get(row.productId);
-        row.productQOH = qohMap.get(row.productId);
-        physicalInventoryCombined.add(row);
-    }
-    context.physicalInventory = physicalInventoryCombined;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.ofbiz.service.ServiceUtil
+import org.ofbiz.entity.condition.*
+
+facilityId = parameters.facilityId;
+
+// fields to search by
+productId = parameters.productId ? parameters.productId.trim() : null;
+internalName = parameters.internalName ? parameters.internalName.trim() : null;
+
+// build conditions
+conditions = [EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId),
+              EntityCondition.makeCondition("inventoryItemTypeId", EntityOperator.EQUALS, "NON_SERIAL_INV_ITEM")
+             ];
+if (productId) {
+    conditions.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%"));
+}
+if (internalName) {
+    conditions.add(EntityCondition.makeCondition("internalName", EntityOperator.LIKE, internalName + "%"));
+}
+
+if (conditions.size() > 2) {
+    ecl = EntityCondition.makeCondition(conditions, EntityOperator.AND);
+    physicalInventory = delegator.findList("ProductInventoryItem", ecl, null, ['productId'], null, false);
+
+    // also need the overal product QOH and ATP for each product
+    atpMap = [:];
+    qohMap = [:];
+
+    // build a list of productIds
+    productIds = [] as Set;
+    physicalInventory.each { iter ->
+        productIds.add(iter.productId);
+    }
+
+    // for each product, call the inventory counting service
+    productIds.each { productId ->
+        result = dispatcher.runSync("getInventoryAvailableByFacility", [facilityId : facilityId, productId : productId]);
+        if (!ServiceUtil.isError(result)) {
+            atpMap.put(productId, result.availableToPromiseTotal);
+            qohMap.put(productId, result.quantityOnHandTotal);
+        }
+    }
+
+    // associate the quantities to each row and store the combined data as our list
+    physicalInventoryCombined = [];
+    physicalInventory.each { iter ->
+        row = iter.getAllFields();
+        row.productATP = atpMap.get(row.productId);
+        row.productQOH = qohMap.get(row.productId);
+        physicalInventoryCombined.add(row);
+    }
+    context.physicalInventory = physicalInventoryCombined;
 }

Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy?rev=1153842&r1=1153841&r2=1153842&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy Thu Aug  4 10:46:56 2011
@@ -1,112 +1,112 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.ofbiz.entity.*
-import org.ofbiz.entity.condition.*
-import org.ofbiz.entity.transaction.*
-
-action = request.getParameter("action");
-
-inventoryItemTotals = [];
-qohGrandTotal = 0.0;
-atpGrandTotal = 0.0;
-costPriceGrandTotal = 0.0;
-retailPriceGrandTotal = 0.0;
-totalCostPriceGrandTotal = 0.0;
-totalRetailPriceGrandTotal = 0.0;
-boolean beganTransaction = false;
-if (action) {
-    conditions = [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "INV_DELIVERED")];
-    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) {
-            productId = inventoryItem.productId;
-            product = delegator.findOne("Product", [productId : productId], false);
-            productFacility = delegator.findOne("ProductFacility", [productId : productId, facilityId : facilityId], false);
-            if (productFacility) {
-                quantityOnHandTotal = inventoryItem.getDouble("quantityOnHandTotal");
-                availableToPromiseTotal = inventoryItem.getDouble("availableToPromiseTotal");
-                costPrice = inventoryItem.getDouble("unitCost");
-                retailPrice = 0.0;
-                productPrices = product.getRelated("ProductPrice");
-                if (productPrices) {
-                    productPrices.each { productPrice ->
-                        if (("DEFAULT_PRICE").equals(productPrice.productPriceTypeId)) {
-                            retailPrice = productPrice.getDouble("price");
-                        }
-                    }
-                }
-                if (costPrice && quantityOnHandTotal) {
-                    totalCostPrice = costPrice * quantityOnHandTotal;
-                    resultMap.totalCostPrice = totalCostPrice;
-                    totalCostPriceGrandTotal += totalCostPrice;
-                }
-                if (retailPrice && quantityOnHandTotal) {
-                    totalRetailPrice = retailPrice * quantityOnHandTotal;
-                    resultMap.totalRetailPrice = totalRetailPrice;
-                    totalRetailPriceGrandTotal += totalRetailPrice;
-                }
-                if (quantityOnHandTotal) {
-                    qohGrandTotal += quantityOnHandTotal;
-                }
-                if (availableToPromiseTotal) {
-                    atpGrandTotal += availableToPromiseTotal;
-                }
-                if (costPrice) {
-                    costPriceGrandTotal += costPrice;
-                }
-                if (retailPrice) {
-                    retailPriceGrandTotal += retailPrice;
-                }
-
-                resultMap = [productId : product.productId, quantityOnHand : quantityOnHandTotal, availableToPromise : availableToPromiseTotal,
-                             costPrice : costPrice, retailPrice : retailPrice];
-                inventoryItemTotals.add(resultMap);
-            }
-        }
-        invItemListItr.close();
-    } catch (GenericEntityException e) {
-        errMsg = "Failure in operation, rolling back transaction";
-        Debug.logError(e, errMsg, "findInventoryItemsByLabels");
-        try {
-            // only rollback the transaction if we started one...
-            TransactionUtil.rollback(beganTransaction, errMsg, e);
-        } catch (GenericEntityException e2) {
-            Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "findInventoryItemsByLabels");
-        }
-        // after rolling back, rethrow the exception
-        throw e;
-    } finally {
-        // only commit the transaction if we started one... this will throw an exception if it fails
-        TransactionUtil.commit(beganTransaction);
-    }
-
-}
-
-inventoryItemGrandTotals = [];
-inventoryItemGrandTotals.add([qohGrandTotal : qohGrandTotal, atpGrandTotal : atpGrandTotal,
-                              totalCostPriceGrandTotal : totalCostPriceGrandTotal, totalRetailPriceGrandTotal : totalRetailPriceGrandTotal]);
-
-context.inventoryItemTotals = inventoryItemTotals;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.ofbiz.entity.*
+import org.ofbiz.entity.condition.*
+import org.ofbiz.entity.transaction.*
+
+action = request.getParameter("action");
+
+inventoryItemTotals = [];
+qohGrandTotal = 0.0;
+atpGrandTotal = 0.0;
+costPriceGrandTotal = 0.0;
+retailPriceGrandTotal = 0.0;
+totalCostPriceGrandTotal = 0.0;
+totalRetailPriceGrandTotal = 0.0;
+boolean beganTransaction = false;
+if (action) {
+    conditions = [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "INV_DELIVERED")];
+    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) {
+            productId = inventoryItem.productId;
+            product = delegator.findOne("Product", [productId : productId], false);
+            productFacility = delegator.findOne("ProductFacility", [productId : productId, facilityId : facilityId], false);
+            if (productFacility) {
+                quantityOnHandTotal = inventoryItem.getDouble("quantityOnHandTotal");
+                availableToPromiseTotal = inventoryItem.getDouble("availableToPromiseTotal");
+                costPrice = inventoryItem.getDouble("unitCost");
+                retailPrice = 0.0;
+                productPrices = product.getRelated("ProductPrice");
+                if (productPrices) {
+                    productPrices.each { productPrice ->
+                        if (("DEFAULT_PRICE").equals(productPrice.productPriceTypeId)) {
+                            retailPrice = productPrice.getDouble("price");
+                        }
+                    }
+                }
+                if (costPrice && quantityOnHandTotal) {
+                    totalCostPrice = costPrice * quantityOnHandTotal;
+                    resultMap.totalCostPrice = totalCostPrice;
+                    totalCostPriceGrandTotal += totalCostPrice;
+                }
+                if (retailPrice && quantityOnHandTotal) {
+                    totalRetailPrice = retailPrice * quantityOnHandTotal;
+                    resultMap.totalRetailPrice = totalRetailPrice;
+                    totalRetailPriceGrandTotal += totalRetailPrice;
+                }
+                if (quantityOnHandTotal) {
+                    qohGrandTotal += quantityOnHandTotal;
+                }
+                if (availableToPromiseTotal) {
+                    atpGrandTotal += availableToPromiseTotal;
+                }
+                if (costPrice) {
+                    costPriceGrandTotal += costPrice;
+                }
+                if (retailPrice) {
+                    retailPriceGrandTotal += retailPrice;
+                }
+
+                resultMap = [productId : product.productId, quantityOnHand : quantityOnHandTotal, availableToPromise : availableToPromiseTotal,
+                             costPrice : costPrice, retailPrice : retailPrice];
+                inventoryItemTotals.add(resultMap);
+            }
+        }
+        invItemListItr.close();
+    } catch (GenericEntityException e) {
+        errMsg = "Failure in operation, rolling back transaction";
+        Debug.logError(e, errMsg, "findInventoryItemsByLabels");
+        try {
+            // only rollback the transaction if we started one...
+            TransactionUtil.rollback(beganTransaction, errMsg, e);
+        } catch (GenericEntityException e2) {
+            Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "findInventoryItemsByLabels");
+        }
+        // after rolling back, rethrow the exception
+        throw e;
+    } finally {
+        // only commit the transaction if we started one... this will throw an exception if it fails
+        TransactionUtil.commit(beganTransaction);
+    }
+
+}
+
+inventoryItemGrandTotals = [];
+inventoryItemGrandTotals.add([qohGrandTotal : qohGrandTotal, atpGrandTotal : atpGrandTotal,
+                              totalCostPriceGrandTotal : totalCostPriceGrandTotal, totalRetailPriceGrandTotal : totalRetailPriceGrandTotal]);
+
+context.inventoryItemTotals = inventoryItemTotals;
 context.inventoryItemGrandTotals = inventoryItemGrandTotals;