You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ar...@apache.org on 2016/11/02 19:09:18 UTC

svn commit: r1767764 [19/33] - in /ofbiz/trunk: applications/accounting/groovyScripts/admin/ applications/accounting/groovyScripts/ap/invoices/ applications/accounting/groovyScripts/ar/ applications/accounting/groovyScripts/chartofaccounts/ application...

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy Wed Nov  2 19:09:13 2016
@@ -28,77 +28,77 @@ import org.apache.ofbiz.entity.model.Mod
 import org.apache.ofbiz.entity.util.EntityFindOptions
 import org.apache.ofbiz.product.inventory.*
 
-action = request.getParameter("action");
-statusId = request.getParameter("statusId");
-searchParameterString = "";
-searchParameterString = "action=Y&facilityId=" + facilityId;
-
-offsetQOH = -1;
-offsetATP = -1;
-hasOffsetQOH = false;
-hasOffsetATP = false;
+action = request.getParameter("action")
+statusId = request.getParameter("statusId")
+searchParameterString = ""
+searchParameterString = "action=Y&facilityId=" + facilityId
+
+offsetQOH = -1
+offsetATP = -1
+hasOffsetQOH = false
+hasOffsetATP = false
 
-rows = [] as ArrayList;
-int listSize = 0; // The complete size of the list of result (for pagination)
+rows = [] as ArrayList
+int listSize = 0 // The complete size of the list of result (for pagination)
 
 if (action) {
     // ------------------------------
-    prodView = new DynamicViewEntity();
-    conditionMap = [facilityId : facilityId];
+    prodView = new DynamicViewEntity()
+    conditionMap = [facilityId : facilityId]
 
     if (offsetQOHQty) {
         try {
-            offsetQOH = Integer.parseInt(offsetQOHQty);
-            hasOffsetQOH = true;
-            searchParameterString = searchParameterString + "&offsetQOHQty=" + offsetQOH;
+            offsetQOH = Integer.parseInt(offsetQOHQty)
+            hasOffsetQOH = true
+            searchParameterString = searchParameterString + "&offsetQOHQty=" + offsetQOH
         } catch (NumberFormatException nfe) {
         }
     }
     if (offsetATPQty) {
         try {
-            offsetATP = Integer.parseInt(offsetATPQty);
-            hasOffsetATP = true;
-            searchParameterString = searchParameterString + "&offsetATPQty=" + offsetATP;
+            offsetATP = Integer.parseInt(offsetATPQty)
+            hasOffsetATP = true
+            searchParameterString = searchParameterString + "&offsetATPQty=" + offsetATP
         } catch (NumberFormatException nfe) {
         }
     }
 
-    prodView.addMemberEntity("PRFA", "ProductFacility");
-    prodView.addAliasAll("PRFA", null, null);
+    prodView.addMemberEntity("PRFA", "ProductFacility")
+    prodView.addAliasAll("PRFA", null, null)
 
-    prodView.addMemberEntity("PROD", "Product");
-    prodView.addViewLink("PROD", "PRFA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
-    prodView.addAlias("PROD", "internalName");
-    prodView.addAlias("PROD", "isVirtual");
-    prodView.addAlias("PROD", "salesDiscontinuationDate");
+    prodView.addMemberEntity("PROD", "Product")
+    prodView.addViewLink("PROD", "PRFA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"))
+    prodView.addAlias("PROD", "internalName")
+    prodView.addAlias("PROD", "isVirtual")
+    prodView.addAlias("PROD", "salesDiscontinuationDate")
     if (productTypeId) {
-        prodView.addAlias("PROD", "productTypeId");
-        conditionMap.productTypeId = productTypeId;
-        searchParameterString = searchParameterString + "&productTypeId=" + productTypeId;
+        prodView.addAlias("PROD", "productTypeId")
+        conditionMap.productTypeId = productTypeId
+        searchParameterString = searchParameterString + "&productTypeId=" + productTypeId
     }
     if (searchInProductCategoryId) {
-        prodView.addMemberEntity("PRCA", "ProductCategoryMember");
-        prodView.addViewLink("PRFA", "PRCA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
-        prodView.addAlias("PRCA", "productCategoryId");
-        conditionMap.productCategoryId = searchInProductCategoryId;
-        searchParameterString = searchParameterString + "&searchInProductCategoryId=" + searchInProductCategoryId;
+        prodView.addMemberEntity("PRCA", "ProductCategoryMember")
+        prodView.addViewLink("PRFA", "PRCA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"))
+        prodView.addAlias("PRCA", "productCategoryId")
+        conditionMap.productCategoryId = searchInProductCategoryId
+        searchParameterString = searchParameterString + "&searchInProductCategoryId=" + searchInProductCategoryId
     }
 
     if (productSupplierId) {
-        prodView.addMemberEntity("SPPR", "SupplierProduct");
-        prodView.addViewLink("PRFA", "SPPR", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
-        prodView.addAlias("SPPR", "partyId");
-        conditionMap.partyId = productSupplierId;
-        searchParameterString = searchParameterString + "&productSupplierId=" + productSupplierId;
+        prodView.addMemberEntity("SPPR", "SupplierProduct")
+        prodView.addViewLink("PRFA", "SPPR", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"))
+        prodView.addAlias("SPPR", "partyId")
+        conditionMap.partyId = productSupplierId
+        searchParameterString = searchParameterString + "&productSupplierId=" + productSupplierId
     }
 
     // set distinct on so we only get one row per product
-    searchCondition = EntityCondition.makeCondition(conditionMap, EntityOperator.AND);
+    searchCondition = EntityCondition.makeCondition(conditionMap, EntityOperator.AND)
     notVirtualCondition = EntityCondition.makeCondition(EntityCondition.makeCondition("isVirtual", EntityOperator.EQUALS, null),
                                                          EntityOperator.OR,
-                                                         EntityCondition.makeCondition("isVirtual", EntityOperator.NOT_EQUAL, "Y"));
+                                                         EntityCondition.makeCondition("isVirtual", EntityOperator.NOT_EQUAL, "Y"))
 
-    whereConditionsList = [searchCondition, notVirtualCondition];
+    whereConditionsList = [searchCondition, notVirtualCondition]
     // add the discontinuation date condition
     if (productsSoldThruTimestamp) {
         discontinuationDateCondition = EntityCondition.makeCondition(
@@ -106,104 +106,104 @@ if (action) {
                 EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.EQUALS, null),
                 EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.GREATER_THAN, productsSoldThruTimestamp)
                ],
-               EntityOperator.OR);
-        whereConditionsList.add(discontinuationDateCondition);
-        searchParameterString = searchParameterString + "&productsSoldThruTimestamp=" + productsSoldThruTimestamp;
+               EntityOperator.OR)
+        whereConditionsList.add(discontinuationDateCondition)
+        searchParameterString = searchParameterString + "&productsSoldThruTimestamp=" + productsSoldThruTimestamp
     }
 
     // add search on internal name
     if (internalName) {
-        whereConditionsList.add(EntityCondition.makeCondition("internalName", EntityOperator.LIKE, "%" + internalName + "%"));
-        searchParameterString = searchParameterString + "&internalName=" + internalName;
+        whereConditionsList.add(EntityCondition.makeCondition("internalName", EntityOperator.LIKE, "%" + internalName + "%"))
+        searchParameterString = searchParameterString + "&internalName=" + internalName
     }
 
     // add search on productId
     if (productId) {
-        whereConditionsList.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%"));
-        searchParameterString = searchParameterString + "&productId=" + productId;
+        whereConditionsList.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%"))
+        searchParameterString = searchParameterString + "&productId=" + productId
     }
-    whereCondition = EntityCondition.makeCondition(whereConditionsList, EntityOperator.AND);
+    whereCondition = EntityCondition.makeCondition(whereConditionsList, EntityOperator.AND)
 
-    beganTransaction = false;
+    beganTransaction = false
     // get the indexes for the partial list
-    lowIndex = ((viewIndex.intValue() * viewSize.intValue()) + 1);
-    highIndex = (viewIndex.intValue() + 1) * viewSize.intValue();
-    List prods = null;
+    lowIndex = ((viewIndex.intValue() * viewSize.intValue()) + 1)
+    highIndex = (viewIndex.intValue() + 1) * viewSize.intValue()
+    List prods = null
     try {
-        beganTransaction = TransactionUtil.begin();
-        prodsEli = from(prodView).where(whereCondition).orderBy("productId").cursorScrollInsensitive().distinct().queryIterator();
-        prods = prodsEli.getPartialList(lowIndex, highIndex);
-        listSize = prodsEli.getResultsSizeAfterPartialList();
-        prodsEli.close();
+        beganTransaction = TransactionUtil.begin()
+        prodsEli = from(prodView).where(whereCondition).orderBy("productId").cursorScrollInsensitive().distinct().queryIterator()
+        prods = prodsEli.getPartialList(lowIndex, highIndex)
+        listSize = prodsEli.getResultsSizeAfterPartialList()
+        prodsEli.close()
     } catch (GenericEntityException e) {
-        errMsg = "Failure in operation, rolling back transaction";
-        Debug.logError(e, errMsg, "ViewFacilityInventoryByProduct");
+        errMsg = "Failure in operation, rolling back transaction"
+        Debug.logError(e, errMsg, "ViewFacilityInventoryByProduct")
         try {
             // only rollback the transaction if we started one...
-            TransactionUtil.rollback(beganTransaction, errMsg, e);
+            TransactionUtil.rollback(beganTransaction, errMsg, e)
         } catch (GenericEntityException e2) {
-            Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "ViewFacilityInventoryByProduct");
+            Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "ViewFacilityInventoryByProduct")
         }
         // after rolling back, rethrow the exception
-        throw e;
+        throw e
     } finally {
         // only commit the transaction if we started one... this will throw an exception if it fails
-        TransactionUtil.commit(beganTransaction);
+        TransactionUtil.commit(beganTransaction)
     }
 
     // If the user has specified a number of months over which to sum usage quantities, define the correct timestamp
-    Timestamp checkTime = null;
-    monthsInPastLimitStr = request.getParameter("monthsInPastLimit");
+    Timestamp checkTime = null
+    monthsInPastLimitStr = request.getParameter("monthsInPastLimit")
     if (monthsInPastLimitStr) {
         try {
-            monthsInPastLimit = Integer.parseInt(monthsInPastLimitStr);
-            cal = UtilDateTime.toCalendar(null);
-            cal.add(Calendar.MONTH, 0 - monthsInPastLimit);
-            checkTime = UtilDateTime.toTimestamp(cal.getTime());
-            searchParameterString += "&monthsInPastLimit=" + monthsInPastLimitStr;
+            monthsInPastLimit = Integer.parseInt(monthsInPastLimitStr)
+            cal = UtilDateTime.toCalendar(null)
+            cal.add(Calendar.MONTH, 0 - monthsInPastLimit)
+            checkTime = UtilDateTime.toTimestamp(cal.getTime())
+            searchParameterString += "&monthsInPastLimit=" + monthsInPastLimitStr
         } catch (Exception e) {
             // Ignore
         }
     }
 
     prods.each { oneProd ->
-        oneInventory = [:];
-        resultMap = [:];
-        oneInventory.checkTime = checkTime;
-        oneInventory.facilityId = facilityId;
-        oneInventory.productId = oneProd.productId;
-        minimumStock = oneProd.minimumStock;
-        oneInventory.minimumStock = minimumStock;
-        oneInventory.reorderQuantity = oneProd.reorderQuantity;
-        oneInventory.daysToShip = oneProd.daysToShip;
+        oneInventory = [:]
+        resultMap = [:]
+        oneInventory.checkTime = checkTime
+        oneInventory.facilityId = facilityId
+        oneInventory.productId = oneProd.productId
+        minimumStock = oneProd.minimumStock
+        oneInventory.minimumStock = minimumStock
+        oneInventory.reorderQuantity = oneProd.reorderQuantity
+        oneInventory.daysToShip = oneProd.daysToShip
         
-        resultMap =runService('getProductInventoryAndFacilitySummary', [productId : oneProd.productId, minimumStock : minimumStock, facilityId : oneProd.facilityId, checkTime : checkTime, statusId : statusId]);
+        resultMap =runService('getProductInventoryAndFacilitySummary', [productId : oneProd.productId, minimumStock : minimumStock, facilityId : oneProd.facilityId, checkTime : checkTime, statusId : statusId])
         if (resultMap) {
-            oneInventory.totalAvailableToPromise = resultMap.totalAvailableToPromise;
-            oneInventory.totalQuantityOnHand = resultMap.totalQuantityOnHand;
-            oneInventory.quantityOnOrder = resultMap.quantityOnOrder;
-            oneInventory.offsetQOHQtyAvailable = resultMap.offsetQOHQtyAvailable;
-            oneInventory.offsetATPQtyAvailable = resultMap.offsetATPQtyAvailable;
-            oneInventory.quantityUom = resultMap.quantityUomId;
-            oneInventory.usageQuantity = resultMap.usageQuantity;
-            oneInventory.defaultPrice = resultMap.defaultPrice;
-            oneInventory.listPrice = resultMap.listPrice;
-            oneInventory.wholeSalePrice = resultMap.wholeSalePrice;
+            oneInventory.totalAvailableToPromise = resultMap.totalAvailableToPromise
+            oneInventory.totalQuantityOnHand = resultMap.totalQuantityOnHand
+            oneInventory.quantityOnOrder = resultMap.quantityOnOrder
+            oneInventory.offsetQOHQtyAvailable = resultMap.offsetQOHQtyAvailable
+            oneInventory.offsetATPQtyAvailable = resultMap.offsetATPQtyAvailable
+            oneInventory.quantityUom = resultMap.quantityUomId
+            oneInventory.usageQuantity = resultMap.usageQuantity
+            oneInventory.defaultPrice = resultMap.defaultPrice
+            oneInventory.listPrice = resultMap.listPrice
+            oneInventory.wholeSalePrice = resultMap.wholeSalePrice
             if (offsetQOHQty && offsetATPQty) {
                 if ((offsetQOHQty && resultMap.offsetQOHQtyAvailable < offsetQOH) && (offsetATPQty && resultMap.offsetATPQtyAvailable < offsetATP)) {
-                    rows.add(oneInventory);
+                    rows.add(oneInventory)
                 }
             }else if (offsetQOHQty || offsetATPQty) {
                 if ((offsetQOHQty && resultMap.offsetQOHQtyAvailable < offsetQOH) || (offsetATPQty && resultMap.offsetATPQtyAvailable < offsetATP)) {
-                    rows.add(oneInventory);
+                    rows.add(oneInventory)
                 }
             } else {
-                rows.add(oneInventory);
+                rows.add(oneInventory)
             }
         }
     }
 }
 
-context.overrideListSize = listSize;
-context.inventoryByProduct = rows;
-context.searchParameterString = searchParameterString;
+context.overrideListSize = listSize
+context.inventoryByProduct = rows
+context.searchParameterString = searchParameterString

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/inventory/FindFacilityPhysicalInventory.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/inventory/FindFacilityPhysicalInventory.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/inventory/FindFacilityPhysicalInventory.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/inventory/FindFacilityPhysicalInventory.groovy Wed Nov  2 19:09:13 2016
@@ -20,52 +20,52 @@
 import org.apache.ofbiz.service.ServiceUtil
 import org.apache.ofbiz.entity.condition.*
 
-facilityId = parameters.facilityId;
+facilityId = parameters.facilityId
 
 // fields to search by
-productId = parameters.productId ? parameters.productId.trim() : null;
-internalName = parameters.internalName ? parameters.internalName.trim() : null;
+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 + "%"));
+    conditions.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%"))
 }
 if (internalName) {
-    conditions.add(EntityCondition.makeCondition("internalName", EntityOperator.LIKE, internalName + "%"));
+    conditions.add(EntityCondition.makeCondition("internalName", EntityOperator.LIKE, internalName + "%"))
 }
 
 if (conditions.size() > 2) {
-    physicalInventory = from("ProductInventoryItem").where(conditions).orderBy("productId").queryList();
+    physicalInventory = from("ProductInventoryItem").where(conditions).orderBy("productId").queryList()
 
     // also need the overal product QOH and ATP for each product
-    atpMap = [:];
-    qohMap = [:];
+    atpMap = [:]
+    qohMap = [:]
 
     // build a list of productIds
-    productIds = [] as Set;
+    productIds = [] as Set
     physicalInventory.each { iter ->
-        productIds.add(iter.productId);
+        productIds.add(iter.productId)
     }
 
     // for each product, call the inventory counting service
     productIds.each { productId ->
-        result = runService('getInventoryAvailableByFacility', [facilityId : facilityId, productId : productId]);
+        result = runService('getInventoryAvailableByFacility', [facilityId : facilityId, productId : productId])
         if (!ServiceUtil.isError(result)) {
-            atpMap.put(productId, result.availableToPromiseTotal);
-            qohMap.put(productId, result.quantityOnHandTotal);
+            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 = [];
+    physicalInventoryCombined = []
     physicalInventory.each { iter ->
-        row = iter.getAllFields();
-        row.productATP = atpMap.get(row.productId);
-        row.productQOH = qohMap.get(row.productId);
-        physicalInventoryCombined.add(row);
+        row = iter.getAllFields()
+        row.productATP = atpMap.get(row.productId)
+        row.productQOH = qohMap.get(row.productId)
+        physicalInventoryCombined.add(row)
     }
-    context.physicalInventory = physicalInventoryCombined;
+    context.physicalInventory = physicalInventoryCombined
 }

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/inventory/InventoryAverageCosts.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/inventory/InventoryAverageCosts.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/inventory/InventoryAverageCosts.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/inventory/InventoryAverageCosts.groovy Wed Nov  2 19:09:13 2016
@@ -17,36 +17,36 @@
  * under the License.
  */
 
-import java.util.*;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityOperator;
-import org.apache.ofbiz.entity.util.EntityUtil;
-
-facilityId = context.get("facilityId");
-searchParameterString = "action=Y&facilityId=" + facilityId;
-
-EntityCondition whereConditions = EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId);
-inventoryItems = select("productId").from("InventoryItem").where("facilityId", facilityId).orderBy("productId").queryList();
-inventoryItemProducts = EntityUtil.getFieldListFromEntityList(inventoryItems, "productId", true);
+import java.util.*
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.base.util.UtilValidate
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
+import org.apache.ofbiz.entity.util.EntityUtil
+
+facilityId = context.get("facilityId")
+searchParameterString = "action=Y&facilityId=" + facilityId
+
+EntityCondition whereConditions = EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId)
+inventoryItems = select("productId").from("InventoryItem").where("facilityId", facilityId).orderBy("productId").queryList()
+inventoryItemProducts = EntityUtil.getFieldListFromEntityList(inventoryItems, "productId", true)
 
-inventoryAverageCosts = [];
+inventoryAverageCosts = []
 inventoryItemProducts.each { productId ->
-    productFacility = from("ProductFacility").where("productId", productId, "facilityId", facilityId).queryOne();
+    productFacility = from("ProductFacility").where("productId", productId, "facilityId", facilityId).queryOne()
     if (UtilValidate.isNotEmpty(productFacility)) {
-        result = runService('calculateProductAverageCost', UtilMisc.toMap("productId": productId, "facilityId": facilityId, "userLogin": userLogin));
-        totalQuantityOnHand = result.get("totalQuantityOnHand");
+        result = runService('calculateProductAverageCost', UtilMisc.toMap("productId": productId, "facilityId": facilityId, "userLogin": userLogin))
+        totalQuantityOnHand = result.get("totalQuantityOnHand")
 
-        totalInventoryCost = result.get("totalInventoryCost");
-        productAverageCost = result.get("productAverageCost");
-        currencyUomId = result.get("currencyUomId");
+        totalInventoryCost = result.get("totalInventoryCost")
+        productAverageCost = result.get("productAverageCost")
+        currencyUomId = result.get("currencyUomId")
         if (!totalQuantityOnHand.equals(BigDecimal.ZERO)) {
             inventoryAverageCosts.add(UtilMisc.toMap("productId", productId, "totalQuantityOnHand", totalQuantityOnHand,
-                    "productAverageCost", productAverageCost, "totalInventoryCost", totalInventoryCost, "currencyUomId", currencyUomId));
+                    "productAverageCost", productAverageCost, "totalInventoryCost", totalInventoryCost, "currencyUomId", currencyUomId))
         }
     }
 }
 
-context.searchParameterString = searchParameterString;
-context.inventoryAverageCosts = inventoryAverageCosts;
+context.searchParameterString = searchParameterString
+context.inventoryAverageCosts = inventoryAverageCosts

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/inventory/InventoryItemTotals.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/inventory/InventoryItemTotals.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/inventory/InventoryItemTotals.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/inventory/InventoryItemTotals.groovy Wed Nov  2 19:09:13 2016
@@ -21,92 +21,92 @@ import org.apache.ofbiz.entity.*
 import org.apache.ofbiz.entity.condition.*
 import org.apache.ofbiz.entity.transaction.*
 
-action = request.getParameter("action");
+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;
-searchParameterString = "action=Y&facilityId=" + facilityId;
+inventoryItemTotals = []
+qohGrandTotal = 0.0
+atpGrandTotal = 0.0
+costPriceGrandTotal = 0.0
+retailPriceGrandTotal = 0.0
+totalCostPriceGrandTotal = 0.0
+totalRetailPriceGrandTotal = 0.0
+boolean beganTransaction = false
+searchParameterString = "action=Y&facilityId=" + facilityId
 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);
+    conditions = [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "INV_DELIVERED")]
+    conditions.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, null))
+    conditionList = EntityCondition.makeCondition(conditions, EntityOperator.OR)
     try {
-        beganTransaction = TransactionUtil.begin();
-        invItemListItr = from("InventoryItem").where(conditionList).orderBy("productId").queryIterator();
+        beganTransaction = TransactionUtil.begin()
+        invItemListItr = from("InventoryItem").where(conditionList).orderBy("productId").queryIterator()
         while ((inventoryItem = invItemListItr.next()) != null) {
-            productId = inventoryItem.productId;
-            product = from("Product").where("productId", productId).queryOne();
-            productFacility = from("ProductFacility").where("productId", productId, "facilityId", facilityId).queryOne();
+            productId = inventoryItem.productId
+            product = from("Product").where("productId", productId).queryOne()
+            productFacility = from("ProductFacility").where("productId", productId, "facilityId", facilityId).queryOne()
             if (productFacility) {
-                quantityOnHandTotal = inventoryItem.getDouble("quantityOnHandTotal");
-                availableToPromiseTotal = inventoryItem.getDouble("availableToPromiseTotal");
-                costPrice = inventoryItem.getDouble("unitCost");
-                retailPrice = 0.0;
-                totalCostPrice = 0.0;
-                totalRetailPrice = 0.0;
-                productPrices = product.getRelated("ProductPrice", null, null, false);
+                quantityOnHandTotal = inventoryItem.getDouble("quantityOnHandTotal")
+                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 ->
                         if (("DEFAULT_PRICE").equals(productPrice.productPriceTypeId)) {
-                            retailPrice = productPrice.getDouble("price");
+                            retailPrice = productPrice.getDouble("price")
                         }
                     }
                 }
                 if (costPrice && quantityOnHandTotal) {
-                    totalCostPrice = costPrice * quantityOnHandTotal;
-                    totalCostPriceGrandTotal += totalCostPrice;
+                    totalCostPrice = costPrice * quantityOnHandTotal
+                    totalCostPriceGrandTotal += totalCostPrice
                 }
                 if (retailPrice && quantityOnHandTotal) {
-                    totalRetailPrice = retailPrice * quantityOnHandTotal;
-                    totalRetailPriceGrandTotal += totalRetailPrice;
+                    totalRetailPrice = retailPrice * quantityOnHandTotal
+                    totalRetailPriceGrandTotal += totalRetailPrice
                 }
                 if (quantityOnHandTotal) {
-                    qohGrandTotal += quantityOnHandTotal;
+                    qohGrandTotal += quantityOnHandTotal
                 }
                 if (availableToPromiseTotal) {
-                    atpGrandTotal += availableToPromiseTotal;
+                    atpGrandTotal += availableToPromiseTotal
                 }
                 if (costPrice) {
-                    costPriceGrandTotal += costPrice;
+                    costPriceGrandTotal += costPrice
                 }
                 if (retailPrice) {
-                    retailPriceGrandTotal += retailPrice;
+                    retailPriceGrandTotal += retailPrice
                 }
 
                 resultMap = [productId : product.productId, quantityOnHand : quantityOnHandTotal, availableToPromise : availableToPromiseTotal,
-                             costPrice : costPrice, retailPrice : retailPrice, totalCostPrice : totalCostPrice, totalRetailPrice : totalRetailPrice];
-                inventoryItemTotals.add(resultMap);
+                             costPrice : costPrice, retailPrice : retailPrice, totalCostPrice : totalCostPrice, totalRetailPrice : totalRetailPrice]
+                inventoryItemTotals.add(resultMap)
             }
         }
-        invItemListItr.close();
+        invItemListItr.close()
     } catch (GenericEntityException e) {
-        errMsg = "Failure in operation, rolling back transaction";
-        Debug.logError(e, errMsg, "findInventoryItemsByLabels");
+        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);
+            TransactionUtil.rollback(beganTransaction, errMsg, e)
         } catch (GenericEntityException e2) {
-            Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "findInventoryItemsByLabels");
+            Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "findInventoryItemsByLabels")
         }
         // after rolling back, rethrow the exception
-        throw e;
+        throw e
     } finally {
         // only commit the transaction if we started one... this will throw an exception if it fails
-        TransactionUtil.commit(beganTransaction);
+        TransactionUtil.commit(beganTransaction)
     }
 
 }
 
-inventoryItemGrandTotals = [];
+inventoryItemGrandTotals = []
 inventoryItemGrandTotals.add([qohGrandTotal : qohGrandTotal, atpGrandTotal : atpGrandTotal,
-                              totalCostPriceGrandTotal : totalCostPriceGrandTotal, totalRetailPriceGrandTotal : totalRetailPriceGrandTotal]);
+                              totalCostPriceGrandTotal : totalCostPriceGrandTotal, totalRetailPriceGrandTotal : totalRetailPriceGrandTotal])
 
-context.searchParameterString = searchParameterString;
-context.inventoryItemTotals = inventoryItemTotals;
-context.inventoryItemGrandTotals = inventoryItemGrandTotals;
+context.searchParameterString = searchParameterString
+context.inventoryItemTotals = inventoryItemTotals
+context.inventoryItemGrandTotals = inventoryItemGrandTotals

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/inventory/LookupInventoryItems.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/inventory/LookupInventoryItems.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/inventory/LookupInventoryItems.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/inventory/LookupInventoryItems.groovy Wed Nov  2 19:09:13 2016
@@ -16,35 +16,35 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityOperator;
-orderId = parameters.orderId;
-partyId = parameters.partyId;
-productId = parameters.productId;
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
+orderId = parameters.orderId
+partyId = parameters.partyId
+productId = parameters.productId
 
 if (orderId && productId) {
-    shipmentReceiptAndItems = from("ShipmentReceiptAndItem").where("orderId", orderId, "productId", productId).queryList();
-    context.inventoryItemsForPo = shipmentReceiptAndItems;
-    context.orderId = orderId;
+    shipmentReceiptAndItems = from("ShipmentReceiptAndItem").where("orderId", orderId, "productId", productId).queryList()
+    context.inventoryItemsForPo = shipmentReceiptAndItems
+    context.orderId = orderId
 }
 exprList = [EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId),
-		EntityCondition.makeCondition("availableToPromiseTotal", EntityOperator.GREATER_THAN, BigDecimal.ZERO)];
+		EntityCondition.makeCondition("availableToPromiseTotal", EntityOperator.GREATER_THAN, BigDecimal.ZERO)]
 if (partyId && productId) {
-    orderRoles = from("OrderRole").where("partyId", partyId, "roleTypeId", "BILL_FROM_VENDOR").queryList();
-    inventoryItemsForSupplier = [];
+    orderRoles = from("OrderRole").where("partyId", partyId, "roleTypeId", "BILL_FROM_VENDOR").queryList()
+    inventoryItemsForSupplier = []
     orderRoles.each { orderRole ->
         shipmentReceiptAndItems = from("ShipmentReceiptAndItem").where(EntityCondition.makeCondition(exprList, EntityOperator.AND),
-			EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderRole.orderId)).queryList();
-        inventoryItemsForSupplier.addAll(shipmentReceiptAndItems);
+			EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderRole.orderId)).queryList()
+        inventoryItemsForSupplier.addAll(shipmentReceiptAndItems)
     }
-    context.inventoryItemsForSupplier = inventoryItemsForSupplier;
-    context.partyId = partyId;
+    context.inventoryItemsForSupplier = inventoryItemsForSupplier
+    context.partyId = partyId
 }
 
 if (productId) {
-    inventoryItems = from("InventoryItem").where(EntityCondition.makeCondition(exprList, EntityOperator.AND)).queryList();
-    context.inventoryItemsForProduct = inventoryItems;
-    context.productId = productId;
-    product = from("Product").where("productId", productId).queryOne();
-    context.internalName = product.internalName;
+    inventoryItems = from("InventoryItem").where(EntityCondition.makeCondition(exprList, EntityOperator.AND)).queryList()
+    context.inventoryItemsForProduct = inventoryItems
+    context.productId = productId
+    product = from("Product").where("productId", productId).queryOne()
+    context.internalName = product.internalName
 }
\ No newline at end of file

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/inventory/PhysicalInventoryVariance.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/inventory/PhysicalInventoryVariance.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/inventory/PhysicalInventoryVariance.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/inventory/PhysicalInventoryVariance.groovy Wed Nov  2 19:09:13 2016
@@ -17,20 +17,20 @@
  * under the License.
  */
 
-import org.apache.ofbiz.entity.condition.EntityCondition;
+import org.apache.ofbiz.entity.condition.EntityCondition
 
 // get physicalInventoryAndVarianceDatas if this is a NON_SERIAL_INV_ITEM
 if (inventoryItem && "NON_SERIAL_INV_ITEM".equals(inventoryItem.inventoryItemTypeId)) {
-    physicalInventoryAndVariances = from("PhysicalInventoryAndVariance").where("inventoryItemId", inventoryItemId).orderBy("-physicalInventoryDate", "-physicalInventoryId").queryList();
-    physicalInventoryAndVarianceDatas = new ArrayList(physicalInventoryAndVariances.size());
+    physicalInventoryAndVariances = from("PhysicalInventoryAndVariance").where("inventoryItemId", inventoryItemId).orderBy("-physicalInventoryDate", "-physicalInventoryId").queryList()
+    physicalInventoryAndVarianceDatas = new ArrayList(physicalInventoryAndVariances.size())
     physicalInventoryAndVariances.each { physicalInventoryAndVariance ->
-        physicalInventoryAndVarianceData = [:];
-        physicalInventoryAndVarianceDatas.add(physicalInventoryAndVarianceData);
+        physicalInventoryAndVarianceData = [:]
+        physicalInventoryAndVarianceDatas.add(physicalInventoryAndVarianceData)
 
-        physicalInventoryAndVarianceData.physicalInventoryAndVariance = physicalInventoryAndVariance;
-        physicalInventoryAndVarianceData.varianceReason = physicalInventoryAndVariance.getRelatedOne("VarianceReason", true);
-        physicalInventoryAndVarianceData.person = physicalInventoryAndVariance.getRelatedOne("Person", false);
-        physicalInventoryAndVarianceData.partyGroup = physicalInventoryAndVariance.getRelatedOne("PartyGroup", false);
+        physicalInventoryAndVarianceData.physicalInventoryAndVariance = physicalInventoryAndVariance
+        physicalInventoryAndVarianceData.varianceReason = physicalInventoryAndVariance.getRelatedOne("VarianceReason", true)
+        physicalInventoryAndVarianceData.person = physicalInventoryAndVariance.getRelatedOne("Person", false)
+        physicalInventoryAndVarianceData.partyGroup = physicalInventoryAndVariance.getRelatedOne("PartyGroup", false)
     }
-    context.physicalInventoryAndVarianceDatas = physicalInventoryAndVarianceDatas;
+    context.physicalInventoryAndVarianceDatas = physicalInventoryAndVarianceDatas
 }

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/inventory/ReceiveInventory.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/inventory/ReceiveInventory.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/inventory/ReceiveInventory.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/inventory/ReceiveInventory.groovy Wed Nov  2 19:09:13 2016
@@ -17,219 +17,219 @@
  * under the License.
  */
 
-import org.apache.ofbiz.base.util.UtilMisc;
+import org.apache.ofbiz.base.util.UtilMisc
 import org.apache.ofbiz.entity.util.*
 import org.apache.ofbiz.entity.condition.*
 import org.apache.ofbiz.service.ServiceUtil
 
-facilityId = request.getParameter("facilityId");
-purchaseOrderId = request.getParameter("purchaseOrderId");
-productId = request.getParameter("productId");
-shipmentId = request.getParameter("shipmentId");
+facilityId = request.getParameter("facilityId")
+purchaseOrderId = request.getParameter("purchaseOrderId")
+productId = request.getParameter("productId")
+shipmentId = request.getParameter("shipmentId")
 
-partialReceive = parameters.partialReceive;
+partialReceive = parameters.partialReceive
 if (partialReceive) {
-    context.partialReceive = partialReceive;
+    context.partialReceive = partialReceive
 }
 
-facility = null;
+facility = null
 if (facilityId) {
-    facility = from("Facility").where("facilityId", facilityId).queryOne();
+    facility = from("Facility").where("facilityId", facilityId).queryOne()
 }
 
-ownerAcctgPref = null;
+ownerAcctgPref = null
 if (facility) {
-    owner = facility.getRelatedOne("OwnerParty", false);
+    owner = facility.getRelatedOne("OwnerParty", false)
     if (owner) {
-        result = runService('getPartyAccountingPreferences', [organizationPartyId : owner.partyId, userLogin : request.getAttribute("userLogin")]);
+        result = runService('getPartyAccountingPreferences', [organizationPartyId : owner.partyId, userLogin : request.getAttribute("userLogin")])
         if (!ServiceUtil.isError(result) && result.partyAccountingPreference) {
-            ownerAcctgPref = result.partyAccountingPreference;
+            ownerAcctgPref = result.partyAccountingPreference
         }
     }
 }
 
-purchaseOrder = null;
+purchaseOrder = null
 if (purchaseOrderId) {
-    purchaseOrder = from("OrderHeader").where("orderId", purchaseOrderId).queryOne();
+    purchaseOrder = from("OrderHeader").where("orderId", purchaseOrderId).queryOne()
     if (purchaseOrder && !"PURCHASE_ORDER".equals(purchaseOrder.orderTypeId)) {
-        purchaseOrder = null;
+        purchaseOrder = null
     }
 }
 
-product = null;
+product = null
 if (productId) {
-    product = from("Product").where("productId", productId).queryOne();
-    context.supplierPartyIds = EntityUtil.getFieldListFromEntityList(from("SupplierProduct").where("productId", productId).orderBy("partyId").filterByDate(nowTimestamp, "availableFromDate", "availableThruDate").queryList(), "partyId", true);
+    product = from("Product").where("productId", productId).queryOne()
+    context.supplierPartyIds = EntityUtil.getFieldListFromEntityList(from("SupplierProduct").where("productId", productId).orderBy("partyId").filterByDate(nowTimestamp, "availableFromDate", "availableThruDate").queryList(), "partyId", true)
 }
 
-shipments = null;
+shipments = null
 if (purchaseOrder && !shipmentId) {
-    orderShipments = from("OrderShipment").where("orderId", purchaseOrderId).queryList();
+    orderShipments = from("OrderShipment").where("orderId", purchaseOrderId).queryList()
     if (orderShipments) {
-        shipments = [] as TreeSet;
+        shipments = [] as TreeSet
         orderShipments.each { orderShipment ->
-            shipment = orderShipment.getRelatedOne("Shipment", false);
+            shipment = orderShipment.getRelatedOne("Shipment", false)
             if (!"PURCH_SHIP_RECEIVED".equals(shipment.statusId) &&
                 !"SHIPMENT_CANCELLED".equals(shipment.statusId) &&
                 (!shipment.destinationFacilityId || facilityId.equals(shipment.destinationFacilityId))) {
-                shipments.add(shipment);
+                shipments.add(shipment)
             }
         }
     }
     // This is here for backward compatibility: ItemIssuances are no more created for purchase shipments.
-    issuances = from("ItemIssuance").where("orderId", purchaseOrderId).queryList();
+    issuances = from("ItemIssuance").where("orderId", purchaseOrderId).queryList()
     if (issuances) {
-        shipments = [] as TreeSet;
+        shipments = [] as TreeSet
         issuances.each { issuance ->
-            shipment = issuance.getRelatedOne("Shipment", false);
+            shipment = issuance.getRelatedOne("Shipment", false)
             if (!"PURCH_SHIP_RECEIVED".equals(shipment.statusId) &&
                 !"SHIPMENT_CANCELLED".equals(shipment.statusId) &&
                 (!shipment.destinationFacilityId || facilityId.equals(shipment.destinationFacilityId))) {
-                shipments.add(shipment);
+                shipments.add(shipment)
             }
         }
     }
 }
 
-shipment = null;
+shipment = null
 if (shipmentId && !shipmentId.equals("_NA_")) {
-    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
 }
 
-shippedQuantities = [:];
-purchaseOrderItems = null;
+shippedQuantities = [:]
+purchaseOrderItems = null
 if (purchaseOrder) {
     if (product) {
-        purchaseOrderItems = purchaseOrder.getRelated("OrderItem", [productId : productId], null, false);
+        purchaseOrderItems = purchaseOrder.getRelated("OrderItem", [productId : productId], null, false)
     } else if (shipment) {
-        orderItems = purchaseOrder.getRelated("OrderItem", null, null, false);
-        exprs = [] as ArrayList;
-        orderShipments = shipment.getRelated("OrderShipment", [orderId : purchaseOrderId], null, false);
+        orderItems = purchaseOrder.getRelated("OrderItem", null, null, false)
+        exprs = [] as ArrayList
+        orderShipments = shipment.getRelated("OrderShipment", [orderId : purchaseOrderId], null, false)
         if (orderShipments) {
             orderShipments.each { orderShipment ->
-                exprs.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, orderShipment.orderItemSeqId));
-                double orderShipmentQty = orderShipment.getDouble("quantity").doubleValue();
+                exprs.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, orderShipment.orderItemSeqId))
+                double orderShipmentQty = orderShipment.getDouble("quantity").doubleValue()
                 if (shippedQuantities.containsKey(orderShipment.orderItemSeqId)) {
-                    orderShipmentQty += ((Double)shippedQuantities.get(orderShipment.orderItemSeqId)).doubleValue();
+                    orderShipmentQty += ((Double)shippedQuantities.get(orderShipment.orderItemSeqId)).doubleValue()
                 }
-                shippedQuantities.put(orderShipment.orderItemSeqId, orderShipmentQty);
+                shippedQuantities.put(orderShipment.orderItemSeqId, orderShipmentQty)
             }
         } else {
             // this is here for backward compatibility only: ItemIssuances are no more created for purchase shipments.
-            issuances = shipment.getRelated("ItemIssuance", [orderId : purchaseOrderId], null, false);
+            issuances = shipment.getRelated("ItemIssuance", [orderId : purchaseOrderId], null, false)
             issuances.each { issuance ->
-                exprs.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, issuance.orderItemSeqId));
-                double issuanceQty = issuance.getDouble("quantity").doubleValue();
+                exprs.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, issuance.orderItemSeqId))
+                double issuanceQty = issuance.getDouble("quantity").doubleValue()
                 if (shippedQuantities.containsKey(issuance.orderItemSeqId)) {
-                    issuanceQty += ((Double)shippedQuantities.get(issuance.orderItemSeqId)).doubleValue();
+                    issuanceQty += ((Double)shippedQuantities.get(issuance.orderItemSeqId)).doubleValue()
                 }
-                shippedQuantities.put(issuance.orderItemSeqId, issuanceQty);
+                shippedQuantities.put(issuance.orderItemSeqId, issuanceQty)
             }
         }
-        purchaseOrderItems = EntityUtil.filterByOr(orderItems, exprs);
+        purchaseOrderItems = EntityUtil.filterByOr(orderItems, exprs)
     } else {
-        purchaseOrderItems = purchaseOrder.getRelated("OrderItem", null, null, false);
+        purchaseOrderItems = purchaseOrder.getRelated("OrderItem", null, null, false)
     }
-    purchaseOrderItems = EntityUtil.filterByAnd(purchaseOrderItems, [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED")]);
+    purchaseOrderItems = EntityUtil.filterByAnd(purchaseOrderItems, [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED")])
 }
 // convert the unit prices to that of the facility owner's currency
-orderCurrencyUnitPriceMap = [:];
+orderCurrencyUnitPriceMap = [:]
 if (purchaseOrder && facility) {
     if (ownerAcctgPref) {
-        ownerCurrencyUomId = ownerAcctgPref.baseCurrencyUomId;
-        orderCurrencyUomId = purchaseOrder.currencyUom;
+        ownerCurrencyUomId = ownerAcctgPref.baseCurrencyUomId
+        orderCurrencyUomId = purchaseOrder.currencyUom
         if (!orderCurrencyUomId.equals(ownerCurrencyUomId)) {
             purchaseOrderItems.each { item ->
-            orderCurrencyUnitPriceMap.(item.orderItemSeqId) = item.unitPrice;
+            orderCurrencyUnitPriceMap.(item.orderItemSeqId) = item.unitPrice
                 serviceResults = runService('convertUom',
-                        [uomId : orderCurrencyUomId, uomIdTo : ownerCurrencyUomId, originalValue : item.unitPrice]);
+                        [uomId : orderCurrencyUomId, uomIdTo : ownerCurrencyUomId, originalValue : item.unitPrice])
                 if (ServiceUtil.isError(serviceResults)) {
-                    request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(serviceResults));
-                    return;
+                    request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(serviceResults))
+                    return
                 } else {
-                    convertedValue = serviceResults.convertedValue;
+                    convertedValue = serviceResults.convertedValue
                     if (convertedValue) {
-                        item.unitPrice = convertedValue;
+                        item.unitPrice = convertedValue
                     }
                 }
             }
         }
 
         // put the pref currency in the map for display and form use
-        context.currencyUomId = ownerCurrencyUomId;
-        context.orderCurrencyUomId = orderCurrencyUomId;
+        context.currencyUomId = ownerCurrencyUomId
+        context.orderCurrencyUomId = orderCurrencyUomId
     } else {
-        request.setAttribute("_ERROR_MESSAGE_", "Either no owner party was set for this facility, or no accounting preferences were set for this owner party.");
+        request.setAttribute("_ERROR_MESSAGE_", "Either no owner party was set for this facility, or no accounting preferences were set for this owner party.")
     }
 }
-context.orderCurrencyUnitPriceMap = orderCurrencyUnitPriceMap;
+context.orderCurrencyUnitPriceMap = orderCurrencyUnitPriceMap
 
-receivedQuantities = [:];
-salesOrderItems = [:];
+receivedQuantities = [:]
+salesOrderItems = [:]
 if (purchaseOrderItems) {
-    context.firstOrderItem = EntityUtil.getFirst(purchaseOrderItems);
-    context.purchaseOrderItemsSize = purchaseOrderItems.size();
+    context.firstOrderItem = EntityUtil.getFirst(purchaseOrderItems)
+    context.purchaseOrderItemsSize = purchaseOrderItems.size()
     purchaseOrderItems.each { thisItem ->
-        totalReceived = 0.0;
-        receipts = thisItem.getRelated("ShipmentReceipt", null, null, false);
+        totalReceived = 0.0
+        receipts = thisItem.getRelated("ShipmentReceipt", null, null, false)
         if (receipts) {
             receipts.each { rec ->
                 if (!shipment || (rec.shipmentId && rec.shipmentId.equals(shipment.shipmentId))) {
-                    accepted = rec.getDouble("quantityAccepted");
-                    rejected = rec.getDouble("quantityRejected");
+                    accepted = rec.getDouble("quantityAccepted")
+                    rejected = rec.getDouble("quantityRejected")
                     if (accepted) {
-                        totalReceived += accepted.doubleValue();
+                        totalReceived += accepted.doubleValue()
                     }
                     if (rejected) {
-                        totalReceived += rejected.doubleValue();
+                        totalReceived += rejected.doubleValue()
                     }
                 }
             }
         }
-        receivedQuantities.put(thisItem.orderItemSeqId, new Double(totalReceived));
+        receivedQuantities.put(thisItem.orderItemSeqId, new Double(totalReceived))
         //----------------------
-        salesOrderItemAssocs = from("OrderItemAssoc").where(orderItemAssocTypeId : 'PURCHASE_ORDER', toOrderId : thisItem.orderId, toOrderItemSeqId : thisItem.orderItemSeqId).queryList();
+        salesOrderItemAssocs = from("OrderItemAssoc").where(orderItemAssocTypeId : 'PURCHASE_ORDER', toOrderId : thisItem.orderId, toOrderItemSeqId : thisItem.orderItemSeqId).queryList()
         if (salesOrderItemAssocs) {
-            salesOrderItem = EntityUtil.getFirst(salesOrderItemAssocs);
-            salesOrderItems.put(thisItem.orderItemSeqId, salesOrderItem);
+            salesOrderItem = EntityUtil.getFirst(salesOrderItemAssocs)
+            salesOrderItems.put(thisItem.orderItemSeqId, salesOrderItem)
         }
     }
 }
 
-receivedItems = null;
+receivedItems = null
 if (purchaseOrder) {
-    receivedItems = from("ShipmentReceiptAndItem").where("orderId", purchaseOrderId, "facilityId", facilityId).queryList();
-    context.receivedItems = receivedItems;
+    receivedItems = from("ShipmentReceiptAndItem").where("orderId", purchaseOrderId, "facilityId", facilityId).queryList()
+    context.receivedItems = receivedItems
 }
 
-invalidProductId = null;
+invalidProductId = null
 if (productId && !product) {
-    invalidProductId = "No product found with product ID: [" + productId + "]";
-    context.invalidProductId = invalidProductId;
+    invalidProductId = "No product found with product ID: [" + productId + "]"
+    context.invalidProductId = invalidProductId
 }
 
 // reject reasons
-rejectReasons = from("RejectionReason").queryList();
+rejectReasons = from("RejectionReason").queryList()
 
 // inv item types
-inventoryItemTypes = from("InventoryItemType").queryList();
+inventoryItemTypes = from("InventoryItemType").queryList()
 
 // facilities
-facilities = from("Facility").queryList();
+facilities = from("Facility").queryList()
 
 // default per unit cost for both shipment or individual product
-standardCosts = [:];
+standardCosts = [:]
 if (ownerAcctgPref) {
 
     // get the unit cost of the products in a shipment
     if (purchaseOrderItems) {
         purchaseOrderItems.each { orderItem ->
-            productId = orderItem.productId;
+            productId = orderItem.productId
             if (productId) {
                 result = runService('getProductCost', [productId : productId, currencyUomId : ownerAcctgPref.baseCurrencyUomId,
-                                                               costComponentTypePrefix : 'EST_STD', userLogin : request.getAttribute("userLogin")]);
+                                                               costComponentTypePrefix : 'EST_STD', userLogin : request.getAttribute("userLogin")])
                 if (!ServiceUtil.isError(result)) {
-                    standardCosts.put(productId, result.productCost);
+                    standardCosts.put(productId, result.productCost)
                 }
             }
         }
@@ -238,24 +238,24 @@ if (ownerAcctgPref) {
     // get the unit cost of a single product
     if (productId) {
         result = runService('getProductCost', [productId : productId, currencyUomId : ownerAcctgPref.baseCurrencyUomId,
-                                                       costComponentTypePrefix : 'EST_STD', userLogin : request.getAttribute("userLogin")]);
+                                                       costComponentTypePrefix : 'EST_STD', userLogin : request.getAttribute("userLogin")])
         if (!ServiceUtil.isError(result)) {
-            standardCosts.put(productId, result.productCost);
+            standardCosts.put(productId, result.productCost)
         }
     }
 }
 
-context.facilityId = facilityId;
-context.facility = facility;
-context.purchaseOrder = purchaseOrder;
-context.product = product;
-context.shipments = shipments;
-context.shipment = shipment;
-context.shippedQuantities = shippedQuantities;
-context.purchaseOrderItems = purchaseOrderItems;
-context.receivedQuantities = receivedQuantities;
-context.salesOrderItems = salesOrderItems;
-context.rejectReasons = rejectReasons;
-context.inventoryItemTypes = inventoryItemTypes;
-context.facilities = facilities;
-context.standardCosts = standardCosts;
+context.facilityId = facilityId
+context.facility = facility
+context.purchaseOrder = purchaseOrder
+context.product = product
+context.shipments = shipments
+context.shipment = shipment
+context.shippedQuantities = shippedQuantities
+context.purchaseOrderItems = purchaseOrderItems
+context.receivedQuantities = receivedQuantities
+context.salesOrderItems = salesOrderItems
+context.rejectReasons = rejectReasons
+context.inventoryItemTypes = inventoryItemTypes
+context.facilities = facilities
+context.standardCosts = standardCosts

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/inventory/TransferInventoryItem.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/inventory/TransferInventoryItem.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/inventory/TransferInventoryItem.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/inventory/TransferInventoryItem.groovy Wed Nov  2 19:09:13 2016
@@ -20,80 +20,80 @@
 import org.apache.ofbiz.entity.condition.*
 import org.apache.ofbiz.entity.util.*
 
-facilityId = request.getParameter("facilityId");
+facilityId = request.getParameter("facilityId")
 
-inventoryTransferId = request.getParameter("inventoryTransferId");
-context.inventoryTransferId = inventoryTransferId;
+inventoryTransferId = request.getParameter("inventoryTransferId")
+context.inventoryTransferId = inventoryTransferId
 
-inventoryItemId = request.getParameter("inventoryItemId");
-inventoryTransfer = null;
+inventoryItemId = request.getParameter("inventoryItemId")
+inventoryTransfer = null
 
 if (inventoryTransferId) {
-    inventoryTransfer = from("InventoryTransfer").where("inventoryTransferId", inventoryTransferId).queryOne();
+    inventoryTransfer = from("InventoryTransfer").where("inventoryTransferId", inventoryTransferId).queryOne()
     if (inventoryTransfer) {
-        context.inventoryTransfer = inventoryTransfer;
+        context.inventoryTransfer = inventoryTransfer
         if (!facilityId) {
-            facilityId = inventoryTransfer.facilityId;
-            parameters.facilityId = facilityId;
+            facilityId = inventoryTransfer.facilityId
+            parameters.facilityId = facilityId
         }
         if (!inventoryItemId) {
-            inventoryItemId = inventoryTransfer.inventoryItemId;
+            inventoryItemId = inventoryTransfer.inventoryItemId
         }
     }
 }
 
-facility = from("Facility").where("facilityId", facilityId).queryOne();
-context.facilityId = facilityId;
-context.facility = facility;
-context.inventoryItemId = inventoryItemId;
+facility = from("Facility").where("facilityId", facilityId).queryOne()
+context.facilityId = facilityId
+context.facility = facility
+context.inventoryItemId = inventoryItemId
 
 if (facilityId) {
-    facility = from("Facility").where("facilityId", facilityId).queryOne();
+    facility = from("Facility").where("facilityId", facilityId).queryOne()
 }
 
-String illegalInventoryItem = null;
+String illegalInventoryItem = null
 if (inventoryItemId) {
-    inventoryItem = from("InventoryItem").where("inventoryItemId", inventoryItemId).queryOne();
+    inventoryItem = from("InventoryItem").where("inventoryItemId", inventoryItemId).queryOne()
     if (facilityId && inventoryItem && inventoryItem.facilityId && !inventoryItem.facilityId.equals(facilityId)) {
-        illegalInventoryItem = "Inventory item not found for this facility.";
-        inventoryItem = null;
+        illegalInventoryItem = "Inventory item not found for this facility."
+        inventoryItem = null
     }
     if (inventoryItem) {
-        context.inventoryItem = inventoryItem;
-        inventoryItemType = inventoryItem.getRelatedOne("InventoryItemType", false);
+        context.inventoryItem = inventoryItem
+        inventoryItemType = inventoryItem.getRelatedOne("InventoryItemType", false)
 
         if (inventoryItemType) {
-            context.inventoryItemType = inventoryItemType;
+            context.inventoryItemType = inventoryItemType
         }
         if (inventoryItem.statusId) {
-            inventoryStatus = inventoryItem.getRelatedOne("StatusItem", false);
+            inventoryStatus = inventoryItem.getRelatedOne("StatusItem", false)
             if (inventoryStatus) {
-                context.inventoryStatus = inventoryStatus;
+                context.inventoryStatus = inventoryStatus
             }
         }
     }
 }
 
 // facilities
-context.facilities = from("Facility").queryList();
+context.facilities = from("Facility").queryList()
 
 // status items
 if (inventoryTransfer && inventoryTransfer.statusId) {
-    statusChange = from("StatusValidChange").where("statusId", inventoryTransfer.statusId).queryList();
+    statusChange = from("StatusValidChange").where("statusId", inventoryTransfer.statusId).queryList()
     if (statusChange) {
-        statusItems = [] as ArrayList;
+        statusItems = [] as ArrayList
         statusChange.each { curStatusChange ->
-            curStatusItem = from("StatusItem").where("statusId", curStatusChange.statusIdTo).queryOne();
+            curStatusItem = from("StatusItem").where("statusId", curStatusChange.statusIdTo).queryOne()
             if (curStatusItem) {
-                statusItems.add(curStatusItem);
+                statusItems.add(curStatusItem)
             }
         }
-        statusItem = EntityUtil.orderBy(statusItems, ['sequenceId']);
-        context.statusItems = statusItems;
+        statusItem = EntityUtil.orderBy(statusItems, ['sequenceId'])
+        context.statusItems = statusItems
     }
 } else {
-    statusItems = from("StatusItem").where("statusTypeId", "INVENTORY_XFER_STTS").orderBy("sequenceId").queryList();
+    statusItems = from("StatusItem").where("statusTypeId", "INVENTORY_XFER_STTS").orderBy("sequenceId").queryList()
     if (statusItems) {
-        context.statusItems = statusItems;
+        context.statusItems = statusItems
     }
 }

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/returns/ReceiveReturn.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/returns/ReceiveReturn.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/returns/ReceiveReturn.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/returns/ReceiveReturn.groovy Wed Nov  2 19:09:13 2016
@@ -17,73 +17,73 @@
  * under the License.
  */
 
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.base.util.*
 
-facilityId = request.getParameter("facilityId");
-returnId = request.getParameter("returnId");
+facilityId = request.getParameter("facilityId")
+returnId = request.getParameter("returnId")
 
-facility = null;
+facility = null
 if (facilityId) {
-    facility = from("Facility").where("facilityId", facilityId).queryOne();
+    facility = from("Facility").where("facilityId", facilityId).queryOne()
 }
 
-returnHeader = null;
-returnItems = null;
+returnHeader = null
+returnItems = null
 if (returnId) {
-    returnHeader = from("ReturnHeader").where("returnId", returnId).queryOne();
+    returnHeader = from("ReturnHeader").where("returnId", returnId).queryOne()
     if (returnHeader) {
         if ("RETURN_ACCEPTED".equals(returnHeader.statusId)) {
-            returnItems = returnHeader.getRelated("ReturnItem", null, null, false);
+            returnItems = returnHeader.getRelated("ReturnItem", null, null, false)
         } else if ("RETURN_REQUESTED".equals(returnHeader.statusId)) {
-            uiLabelMap = UtilProperties.getResourceBundleMap("ProductErrorUiLabels", locale);
-            ProductReturnRequestedOK = uiLabelMap.ProductReturnRequestedOK;
-            request.setAttribute("_EVENT_MESSAGE_", ProductReturnRequestedOK + " (#" + returnId.toString() + ")" );
+            uiLabelMap = UtilProperties.getResourceBundleMap("ProductErrorUiLabels", locale)
+            ProductReturnRequestedOK = uiLabelMap.ProductReturnRequestedOK
+            request.setAttribute("_EVENT_MESSAGE_", ProductReturnRequestedOK + " (#" + returnId.toString() + ")" )
         }  else if ("RETURN_RECEIVED".equals(!returnHeader.statusId)) {
-            uiLabelMap = UtilProperties.getResourceBundleMap("ProductErrorUiLabels", locale);
-            ProductReturnNotYetAcceptedOrAlreadyReceived = uiLabelMap.ProductReturnNotYetAcceptedOrAlreadyReceived;
-            request.setAttribute("_ERROR_MESSAGE_", ProductReturnNotYetAcceptedOrAlreadyReceived + " (#" + returnId.toString() + ")" );
+            uiLabelMap = UtilProperties.getResourceBundleMap("ProductErrorUiLabels", locale)
+            ProductReturnNotYetAcceptedOrAlreadyReceived = uiLabelMap.ProductReturnNotYetAcceptedOrAlreadyReceived
+            request.setAttribute("_ERROR_MESSAGE_", ProductReturnNotYetAcceptedOrAlreadyReceived + " (#" + returnId.toString() + ")" )
         }
     }
 }
 
-receivedQuantities = [:];
+receivedQuantities = [:]
 if (returnItems) {
-    context.firstOrderItem = EntityUtil.getFirst(returnItems);
-    context.returnItemsSize = returnItems.size();
+    context.firstOrderItem = EntityUtil.getFirst(returnItems)
+    context.returnItemsSize = returnItems.size()
     returnItems.each { thisItem ->
-        totalReceived = 0.0;
-        receipts = thisItem.getRelated("ShipmentReceipt", null, null, false);
+        totalReceived = 0.0
+        receipts = thisItem.getRelated("ShipmentReceipt", null, null, false)
         if (receipts) {
             receipts.each { rec ->
-                accepted = rec.getDouble("quantityAccepted");
-                rejected = rec.getDouble("quantityRejected");
+                accepted = rec.getDouble("quantityAccepted")
+                rejected = rec.getDouble("quantityRejected")
                 if (accepted)
-                    totalReceived += accepted.doubleValue();
+                    totalReceived += accepted.doubleValue()
                 if (rejected)
-                    totalReceived += rejected.doubleValue();
+                    totalReceived += rejected.doubleValue()
             }
         }
-        receivedQuantities[thisItem.returnItemSeqId] = new Double(totalReceived);
+        receivedQuantities[thisItem.returnItemSeqId] = new Double(totalReceived)
     }
 }
 
 if (returnHeader) {
-    context.receivedItems = from("ShipmentReceiptAndItem").where("returnId", returnId).queryList();
+    context.receivedItems = from("ShipmentReceiptAndItem").where("returnId", returnId).queryList()
 }
 
 // facilities
-facilities = from("Facility").queryList();
+facilities = from("Facility").queryList()
 
 //all possible inventory item types
-inventoryItemTypes = from("InventoryItemType").orderBy("description").cache(true).queryList();
+inventoryItemTypes = from("InventoryItemType").orderBy("description").cache(true).queryList()
 
-context.facilityId = facilityId;
-context.facility = facility;
-context.returnHeader = returnHeader;
-context.returnItems = returnItems;
-context.receivedQuantities = receivedQuantities;
-context.facilities = facilities;
-context.inventoryItemTypes = inventoryItemTypes;
+context.facilityId = facilityId
+context.facility = facility
+context.returnHeader = returnHeader
+context.returnItems = returnItems
+context.receivedQuantities = receivedQuantities
+context.facilities = facilities
+context.inventoryItemTypes = inventoryItemTypes

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/shipment/AddItemsFromInventory.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/shipment/AddItemsFromInventory.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/shipment/AddItemsFromInventory.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/shipment/AddItemsFromInventory.groovy Wed Nov  2 19:09:13 2016
@@ -17,33 +17,33 @@
  * under the License.
  */
 
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityOperator;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityOperator
 
-shipmentId = parameters.shipmentId;
-items = [];
-shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
-partyId = shipment.partyIdTo;
-shipmentItems = shipment.getRelated("ShipmentItem", null, null, false);
+shipmentId = parameters.shipmentId
+items = []
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
+partyId = shipment.partyIdTo
+shipmentItems = shipment.getRelated("ShipmentItem", null, null, false)
 shipmentItems.each { shipmentItem ->
-    productId = shipmentItem.productId;
-    internalName = shipmentItem.getRelated("Product", null, null, false).internalName;
+    productId = shipmentItem.productId
+    internalName = shipmentItem.getRelated("Product", null, null, false).internalName
     EntityCondition cond = EntityCondition.makeCondition([EntityCondition.makeCondition("returnId", shipment.primaryReturnId),
-                                   EntityCondition.makeCondition("productId", productId)], EntityOperator.AND);
-    returnItem = from("ReturnItem").where("returnId", shipment.primaryReturnId, "productId", productId).cache(true).queryFirst();
-    returnQuantity = Double.valueOf(returnItem.returnQuantity);
+                                   EntityCondition.makeCondition("productId", productId)], EntityOperator.AND)
+    returnItem = from("ReturnItem").where("returnId", shipment.primaryReturnId, "productId", productId).cache(true).queryFirst()
+    returnQuantity = Double.valueOf(returnItem.returnQuantity)
 
-    shipmentItemQty = Double.valueOf(shipmentItem.quantity);
-    itemIssuances = shipmentItem.getRelated("ItemIssuance", [shipmentId : shipmentId, shipmentItemSeqId : shipmentItem.shipmentItemSeqId], ["inventoryItemId"], false);
-    totalQtyIssued = 0;
-    issuedItems = [];
+    shipmentItemQty = Double.valueOf(shipmentItem.quantity)
+    itemIssuances = shipmentItem.getRelated("ItemIssuance", [shipmentId : shipmentId, shipmentItemSeqId : shipmentItem.shipmentItemSeqId], ["inventoryItemId"], false)
+    totalQtyIssued = 0
+    issuedItems = []
     itemIssuances.each { itemIssuance ->
-        totalQtyIssued = totalQtyIssued + Double.valueOf(itemIssuance.quantity);
+        totalQtyIssued = totalQtyIssued + Double.valueOf(itemIssuance.quantity)
         issuedItems.add([inventoryItemId : itemIssuance.inventoryItemId,
-                         quantity : itemIssuance.quantity]);
+                         quantity : itemIssuance.quantity])
     }
-    qtyStillNeedToBeIssued = returnQuantity - totalQtyIssued;
+    qtyStillNeedToBeIssued = returnQuantity - totalQtyIssued
     items.add([shipmentId : shipmentId,
                shipmentItemSeqId : shipmentItem.shipmentItemSeqId,
                returnId : returnItem.returnId,
@@ -57,7 +57,7 @@ shipmentItems.each { shipmentItem ->
                totalQtyIssued : totalQtyIssued,
                issuedItems : issuedItems,
                qtyStillNeedToBeIssued : qtyStillNeedToBeIssued,
-               ]);
+               ])
 }
-context.shipmentId = shipmentId;
-context.items = items;
+context.shipmentId = shipmentId
+context.items = items

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/shipment/AddItemsFromOrder.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/shipment/AddItemsFromOrder.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/shipment/AddItemsFromOrder.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/shipment/AddItemsFromOrder.groovy Wed Nov  2 19:09:13 2016
@@ -19,195 +19,195 @@
 
 import org.apache.ofbiz.entity.*
 import org.apache.ofbiz.entity.util.*
-import org.apache.ofbiz.entity.condition.EntityCondition;
+import org.apache.ofbiz.entity.condition.EntityCondition
 
-shipmentId = request.getParameter("shipmentId");
-orderId = request.getParameter("orderId");
-shipGroupSeqId = request.getParameter("shipGroupSeqId");
-selectFromShipmentPlan = request.getParameter("selectFromShipmentPlan");
+shipmentId = request.getParameter("shipmentId")
+orderId = request.getParameter("orderId")
+shipGroupSeqId = request.getParameter("shipGroupSeqId")
+selectFromShipmentPlan = request.getParameter("selectFromShipmentPlan")
 
-shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
 
 if (shipment) {
-    context.originFacility = shipment.getRelatedOne("OriginFacility", false);
-    context.destinationFacility = shipment.getRelatedOne("DestinationFacility", false);
+    context.originFacility = shipment.getRelatedOne("OriginFacility", false)
+    context.destinationFacility = shipment.getRelatedOne("DestinationFacility", false)
 }
 
 if (!orderId && shipment && !selectFromShipmentPlan) {
-    orderId = shipment.primaryOrderId;
+    orderId = shipment.primaryOrderId
 }
 if (!shipGroupSeqId && shipment) {
-    shipGroupSeqId = shipment.primaryShipGroupSeqId;
+    shipGroupSeqId = shipment.primaryShipGroupSeqId
 }
 
 if (orderId && shipment) {
-    orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
-    context.orderHeader = orderHeader;
+    orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
+    context.orderHeader = orderHeader
 
     if (orderHeader) {
-        context.orderHeaderStatus = orderHeader.getRelatedOne("StatusItem", false);
-        context.orderType = orderHeader.getRelatedOne("OrderType", false);
+        context.orderHeaderStatus = orderHeader.getRelatedOne("StatusItem", false)
+        context.orderType = orderHeader.getRelatedOne("OrderType", false)
 
-        isSalesOrder = "SALES_ORDER".equals(orderHeader.orderTypeId);
-        context.isSalesOrder = isSalesOrder;
+        isSalesOrder = "SALES_ORDER".equals(orderHeader.orderTypeId)
+        context.isSalesOrder = isSalesOrder
 
-        orderItemShipGroup = null;
+        orderItemShipGroup = null
         if (shipGroupSeqId) {
-            orderItemShipGroup = from("OrderItemShipGroup").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryOne();
-            context.orderItemShipGroup = orderItemShipGroup;
+            orderItemShipGroup = from("OrderItemShipGroup").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryOne()
+            context.orderItemShipGroup = orderItemShipGroup
         }
 
-        oiasgaLimitMap = null;
+        oiasgaLimitMap = null
         if (orderItemShipGroup) {
-            oiasgaLimitMap = [shipGroupSeqId : shipGroupSeqId];
+            oiasgaLimitMap = [shipGroupSeqId : shipGroupSeqId]
         }
-        orderItems = orderHeader.getRelated("OrderItemAndShipGroupAssoc", oiasgaLimitMap, ['shipGroupSeqId', 'orderItemSeqId'], false);
-        orderItemDatas = [] as LinkedList;
+        orderItems = orderHeader.getRelated("OrderItemAndShipGroupAssoc", oiasgaLimitMap, ['shipGroupSeqId', 'orderItemSeqId'], false)
+        orderItemDatas = [] as LinkedList
         orderItems.each { orderItemAndShipGroupAssoc ->
-            orderItemData = [:];
-            product = orderItemAndShipGroupAssoc.getRelatedOne("Product", false);
+            orderItemData = [:]
+            product = orderItemAndShipGroupAssoc.getRelatedOne("Product", false)
 
-            itemIssuances = orderItemAndShipGroupAssoc.getRelated("ItemIssuance", null, null, false);
-            totalQuantityIssued = 0;
+            itemIssuances = orderItemAndShipGroupAssoc.getRelated("ItemIssuance", null, null, false)
+            totalQuantityIssued = 0
             itemIssuances.each { itemIssuance ->
                 if (itemIssuance.quantity) {
-                    totalQuantityIssued += itemIssuance.getDouble("quantity");
+                    totalQuantityIssued += itemIssuance.getDouble("quantity")
                 }
                 if (itemIssuance.cancelQuantity) {
-                    totalQuantityIssued -= itemIssuance.getDouble("cancelQuantity");
+                    totalQuantityIssued -= itemIssuance.getDouble("cancelQuantity")
                 }
             }
 
             if (isSalesOrder) {
-                oisgirLimitMap = null;
+                oisgirLimitMap = null
                 if (orderItemShipGroup) {
-                    oisgirLimitMap = [shipGroupSeqId : shipGroupSeqId];
+                    oisgirLimitMap = [shipGroupSeqId : shipGroupSeqId]
                 }
-                orderItemShipGrpInvResList = orderItemAndShipGroupAssoc.getRelated("OrderItemShipGrpInvRes", oisgirLimitMap, ['reservedDatetime'], false);
-                orderItemShipGrpInvResDatas = [] as LinkedList;
-                totalQuantityReserved = 0;
+                orderItemShipGrpInvResList = orderItemAndShipGroupAssoc.getRelated("OrderItemShipGrpInvRes", oisgirLimitMap, ['reservedDatetime'], false)
+                orderItemShipGrpInvResDatas = [] as LinkedList
+                totalQuantityReserved = 0
                 orderItemShipGrpInvResList.each { orderItemShipGrpInvRes ->
-                    inventoryItem = orderItemShipGrpInvRes.getRelatedOne("InventoryItem", false);
-                    orderItemShipGrpInvResData = [:];
-                    orderItemShipGrpInvResData.orderItemShipGrpInvRes = orderItemShipGrpInvRes;
-                    orderItemShipGrpInvResData.inventoryItem = inventoryItem;
-                    orderItemShipGrpInvResData.inventoryItemFacility = inventoryItem.getRelatedOne("Facility", false);
-                    orderItemShipGrpInvResDatas.add(orderItemShipGrpInvResData);
+                    inventoryItem = orderItemShipGrpInvRes.getRelatedOne("InventoryItem", false)
+                    orderItemShipGrpInvResData = [:]
+                    orderItemShipGrpInvResData.orderItemShipGrpInvRes = orderItemShipGrpInvRes
+                    orderItemShipGrpInvResData.inventoryItem = inventoryItem
+                    orderItemShipGrpInvResData.inventoryItemFacility = inventoryItem.getRelatedOne("Facility", false)
+                    orderItemShipGrpInvResDatas.add(orderItemShipGrpInvResData)
 
                     if (orderItemShipGrpInvRes.quantity) {
-                        totalQuantityReserved += orderItemShipGrpInvRes.getDouble("quantity");
+                        totalQuantityReserved += orderItemShipGrpInvRes.getDouble("quantity")
                     }
                 }
 
-                orderItemData.orderItemShipGrpInvResDatas = orderItemShipGrpInvResDatas;
-                orderItemData.totalQuantityReserved = totalQuantityReserved;
-                orderItemData.totalQuantityIssuedAndReserved = totalQuantityReserved + totalQuantityIssued;
+                orderItemData.orderItemShipGrpInvResDatas = orderItemShipGrpInvResDatas
+                orderItemData.totalQuantityReserved = totalQuantityReserved
+                orderItemData.totalQuantityIssuedAndReserved = totalQuantityReserved + totalQuantityIssued
             }
 
-            orderItemData.orderItemAndShipGroupAssoc = orderItemAndShipGroupAssoc;
-            orderItemData.product = product;
-            orderItemData.itemIssuances = itemIssuances;
-            orderItemData.totalQuantityIssued = totalQuantityIssued;
-            orderItemDatas.add(orderItemData);
+            orderItemData.orderItemAndShipGroupAssoc = orderItemAndShipGroupAssoc
+            orderItemData.product = product
+            orderItemData.itemIssuances = itemIssuances
+            orderItemData.totalQuantityIssued = totalQuantityIssued
+            orderItemDatas.add(orderItemData)
         }
-        context.orderItemDatas = orderItemDatas;
+        context.orderItemDatas = orderItemDatas
     }
 }
 if (shipment && selectFromShipmentPlan) {
-    shipmentPlans = from("OrderShipment").where("shipmentId", shipment.shipmentId).orderBy("orderId", "orderItemSeqId").queryList();
-    orderItemDatas = [] as LinkedList;
+    shipmentPlans = from("OrderShipment").where("shipmentId", shipment.shipmentId).orderBy("orderId", "orderItemSeqId").queryList()
+    orderItemDatas = [] as LinkedList
 
-    context.isSalesOrder = true;
+    context.isSalesOrder = true
     shipmentPlans.each { shipmentPlan ->
-        orderItemData = [:];
-        orderItem = shipmentPlan.getRelatedOne("OrderItem", false);
+        orderItemData = [:]
+        orderItem = shipmentPlan.getRelatedOne("OrderItem", false)
 
-        orderItemShipGroup = null;
+        orderItemShipGroup = null
         if (shipGroupSeqId) {
-            orderItemShipGroup = from("OrderItemShipGroup").where("orderId", orderItem.orderId, "shipGroupSeqId", shipGroupSeqId).queryOne();
-            context.orderItemShipGroup = orderItemShipGroup;
+            orderItemShipGroup = from("OrderItemShipGroup").where("orderId", orderItem.orderId, "shipGroupSeqId", shipGroupSeqId).queryOne()
+            context.orderItemShipGroup = orderItemShipGroup
         }
 
-        oiasgaLimitMap = null;
+        oiasgaLimitMap = null
         if (orderItemShipGroup) {
-            oiasgaLimitMap = [shipGroupSeqId : shipGroupSeqId];
+            oiasgaLimitMap = [shipGroupSeqId : shipGroupSeqId]
         }
 
-        orderItemShipGroupAssoc = null;
-        orderItemShipGroupAssocs = orderItem.getRelated("OrderItemShipGroupAssoc", oiasgaLimitMap, null, false);
+        orderItemShipGroupAssoc = null
+        orderItemShipGroupAssocs = orderItem.getRelated("OrderItemShipGroupAssoc", oiasgaLimitMap, null, false)
         if (orderItemShipGroupAssocs) {
-            orderItemShipGroupAssoc = EntityUtil.getFirst(orderItemShipGroupAssocs);
+            orderItemShipGroupAssoc = EntityUtil.getFirst(orderItemShipGroupAssocs)
         }
-        plannedQuantity = shipmentPlan.getDouble("quantity");
-        totalProposedQuantity = 0.0;
+        plannedQuantity = shipmentPlan.getDouble("quantity")
+        totalProposedQuantity = 0.0
 
-        product = orderItem.getRelatedOne("Product", false);
+        product = orderItem.getRelatedOne("Product", false)
 
-        itemIssuances = orderItem.getRelated("ItemIssuance", null, null, false);
-        totalQuantityIssued = 0;
-        totalQuantityIssuedInShipment = 0;
+        itemIssuances = orderItem.getRelated("ItemIssuance", null, null, false)
+        totalQuantityIssued = 0
+        totalQuantityIssuedInShipment = 0
         itemIssuances.each { itemIssuance ->
             if (itemIssuance.quantity) {
-                totalQuantityIssued += itemIssuance.getDouble("quantity");
+                totalQuantityIssued += itemIssuance.getDouble("quantity")
             }
             if (itemIssuance.cancelQuantity) {
-                totalQuantityIssued -= itemIssuance.getDouble("cancelQuantity");
+                totalQuantityIssued -= itemIssuance.getDouble("cancelQuantity")
             }
             if (itemIssuance.shipmentId && itemIssuance.shipmentId.equals(shipmentId)) {
-                totalQuantityIssuedInShipment += itemIssuance.getDouble("quantity");
+                totalQuantityIssuedInShipment += itemIssuance.getDouble("quantity")
                 if (itemIssuance.cancelQuantity) {
-                    totalQuantityIssuedInShipment -= itemIssuance.getDouble("cancelQuantity");
+                    totalQuantityIssuedInShipment -= itemIssuance.getDouble("cancelQuantity")
                 }
             }
         }
 
-        orderItemShipGrpInvResList = orderItem.getRelated("OrderItemShipGrpInvRes", null, ['reservedDatetime'], false);
-        orderItemShipGrpInvResDatas = [] as LinkedList;
-        totalQuantityReserved = 0;
+        orderItemShipGrpInvResList = orderItem.getRelated("OrderItemShipGrpInvRes", null, ['reservedDatetime'], false)
+        orderItemShipGrpInvResDatas = [] as LinkedList
+        totalQuantityReserved = 0
         orderItemShipGrpInvResList.each { orderItemShipGrpInvRes ->
-            inventoryItem = orderItemShipGrpInvRes.getRelatedOne("InventoryItem", false);
-            orderItemShipGrpInvResData = [:];
-            orderItemShipGrpInvResData.orderItemShipGrpInvRes = orderItemShipGrpInvRes;
-            orderItemShipGrpInvResData.inventoryItem = inventoryItem;
-            orderItemShipGrpInvResData.inventoryItemFacility = inventoryItem.getRelatedOne("Facility", false);
-            orderItemShipGrpInvResDatas.add(orderItemShipGrpInvResData);
-
-            reservedQuantity = 0.0;
-            quantityNotAvailable = 0.0;
-            proposedQuantity = 0.0;
+            inventoryItem = orderItemShipGrpInvRes.getRelatedOne("InventoryItem", false)
+            orderItemShipGrpInvResData = [:]
+            orderItemShipGrpInvResData.orderItemShipGrpInvRes = orderItemShipGrpInvRes
+            orderItemShipGrpInvResData.inventoryItem = inventoryItem
+            orderItemShipGrpInvResData.inventoryItemFacility = inventoryItem.getRelatedOne("Facility", false)
+            orderItemShipGrpInvResDatas.add(orderItemShipGrpInvResData)
+
+            reservedQuantity = 0.0
+            quantityNotAvailable = 0.0
+            proposedQuantity = 0.0
             if (orderItemShipGrpInvRes.quantity) {
-                reservedQuantity = orderItemShipGrpInvRes.getDouble("quantity");
-                totalQuantityReserved += reservedQuantity;
+                reservedQuantity = orderItemShipGrpInvRes.getDouble("quantity")
+                totalQuantityReserved += reservedQuantity
             }
             if (orderItemShipGrpInvRes.quantityNotAvailable) {
-                quantityNotAvailable = orderItemShipGrpInvRes.getDouble("quantityNotAvailable");
+                quantityNotAvailable = orderItemShipGrpInvRes.getDouble("quantityNotAvailable")
             }
-            proposedQuantity = reservedQuantity - quantityNotAvailable;
+            proposedQuantity = reservedQuantity - quantityNotAvailable
             if (plannedQuantity - totalProposedQuantity < proposedQuantity) {
-                proposedQuantity = plannedQuantity - totalProposedQuantity;
+                proposedQuantity = plannedQuantity - totalProposedQuantity
             }
             if (proposedQuantity < 0) {
-                proposedQuantity = 0.0;
+                proposedQuantity = 0.0
             }
-            totalProposedQuantity += proposedQuantity;
-            orderItemShipGrpInvResData.shipmentPlanQuantity = proposedQuantity;
+            totalProposedQuantity += proposedQuantity
+            orderItemShipGrpInvResData.shipmentPlanQuantity = proposedQuantity
         }
 
-        orderItemShipGroupAssocMap = new HashMap(orderItemShipGroupAssoc);
-        orderItemShipGroupAssocMap.quantity = orderItemShipGroupAssoc.getDouble("quantity");
-        orderItemData.orderItemAndShipGroupAssoc = orderItemShipGroupAssocMap;
-        orderItemData.orderItemShipGrpInvResDatas = orderItemShipGrpInvResDatas;
-        orderItemData.totalQuantityReserved = totalQuantityReserved;
-        orderItemData.totalQuantityIssuedAndReserved = totalQuantityReserved + totalQuantityIssued;
-        orderItemData.orderItem = orderItem;
-        orderItemData.product = product;
-        orderItemData.itemIssuances = itemIssuances;
-        orderItemData.totalQuantityIssued = totalQuantityIssued;
-        orderItemDatas.add(orderItemData);
+        orderItemShipGroupAssocMap = new HashMap(orderItemShipGroupAssoc)
+        orderItemShipGroupAssocMap.quantity = orderItemShipGroupAssoc.getDouble("quantity")
+        orderItemData.orderItemAndShipGroupAssoc = orderItemShipGroupAssocMap
+        orderItemData.orderItemShipGrpInvResDatas = orderItemShipGrpInvResDatas
+        orderItemData.totalQuantityReserved = totalQuantityReserved
+        orderItemData.totalQuantityIssuedAndReserved = totalQuantityReserved + totalQuantityIssued
+        orderItemData.orderItem = orderItem
+        orderItemData.product = product
+        orderItemData.itemIssuances = itemIssuances
+        orderItemData.totalQuantityIssued = totalQuantityIssued
+        orderItemDatas.add(orderItemData)
     }
-    context.orderItemDatas = orderItemDatas;
+    context.orderItemDatas = orderItemDatas
 }
-context.shipmentId = shipmentId;
-context.shipment = shipment;
-context.orderId = orderId;
-context.shipGroupSeqId = shipGroupSeqId;
+context.shipmentId = shipmentId
+context.shipment = shipment
+context.orderId = orderId
+context.shipGroupSeqId = shipGroupSeqId