svn commit: r814681 - /ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy

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

svn commit: r814681 - /ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy

jleroux@apache.org
Author: jleroux
Date: Mon Sep 14 15:09:00 2009
New Revision: 814681

URL: http://svn.apache.org/viewvc?rev=814681&view=rev
Log:
A patch from Arun Patidar "Inventory search results for "QOH minus Min Stock less than" & "ATP minus Min Stock less than" filter does not works properly." (https://issues.apache.org/jira/browse/OFBIZ-2939) - OFBIZ-2939
In Facility-> Inventory screen, Inventory search results for "QOH minus Min Stock less than" & "ATP minus Min Stock less than" filter does not works properly.

Modified:
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy

Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy?rev=814681&r1=814680&r2=814681&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy Mon Sep 14 15:09:00 2009
@@ -29,7 +29,7 @@
 import org.ofbiz.product.inventory.*
 
 action = request.getParameter("action");
-
+statusId = request.getParameter("statusId");
 searchParameterString = "";
 searchParameterString = "action=Y&facilityId=" + facilityId;
 
@@ -164,15 +164,39 @@
 
     prods.each { oneProd ->
         oneInventory = [:];
+        resultMap = [:];
         oneInventory.checkTime = checkTime;
         oneInventory.facilityId = facilityId;
         oneInventory.productId = oneProd.productId;
-        oneInventory.minimumStock = oneProd.minimumStock as String;
+        minimumStock = oneProd.minimumStock as String;
+        oneInventory.minimumStock = minimumStock;
         oneInventory.reorderQuantity = oneProd.reorderQuantity;
         oneInventory.daysToShip = oneProd.daysToShip;
-        rows.add(oneInventory);
-    }
 
+        resultMap = dispatcher.runSync("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.usageQuantity = resultMap.usageQuantity;
+            oneInventory.defultPrice = resultMap.defultPrice;
+            oneInventory.listPrice = resultMap.listPrice;
+            oneInventory.wholeSalePrice = resultMap.wholeSalePrice;
+            if (offsetQOHQty && offsetATPQty) {
+                if ((offsetQOHQty && resultMap.offsetQOHQtyAvailable < offsetQOH) && (offsetATPQty && resultMap.offsetATPQtyAvailable < offsetATP)) {
+                    rows.add(oneInventory);
+                }
+            }else if (offsetQOHQty || offsetATPQty) {
+                if ((offsetQOHQty && resultMap.offsetQOHQtyAvailable < offsetQOH) || (offsetATPQty && resultMap.offsetATPQtyAvailable < offsetATP)) {
+                    rows.add(oneInventory);
+                }
+            } else {
+                rows.add(oneInventory);
+            }
+        }
+    }
 }
 context.inventoryByProduct = rows;
-context.searchParameterString = searchParameterString;
\ No newline at end of file
+context.searchParameterString = searchParameterString;