svn commit: r430250 - /incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java

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

svn commit: r430250 - /incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java

jacopoc
Author: jacopoc
Date: Wed Aug  9 22:14:32 2006
New Revision: 430250

URL: http://svn.apache.org/viewvc?rev=430250&view=rev
Log:
Fixed bad bug in the cost component ratio used to calculate a unit cost for the inventory items generated decomposing a mkt pkg.

Modified:
    incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java

Modified: incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java?rev=430250&r1=430249&r2=430250&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java (original)
+++ incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Wed Aug  9 22:14:32 2006
@@ -2360,14 +2360,19 @@
                                  "userLogin", userLogin);
             resultService = dispatcher.runSync("getProductCost", serviceContext);
             Double packageCost = (Double)resultService.get("productCost");
-            if (packageCost == null || packageCost.doubleValue() == 0) {
-                packageCost = new Double(1.0);
-            }
             Double inventoryItemCost = (Double)inventoryItem.getDouble("unitCost");
-            if (inventoryItemCost == null) {
-                inventoryItemCost = new Double(1.0);
+            Double costCoefficient = null;
+            if (packageCost == null || packageCost.doubleValue() == 0 || inventoryItemCost == null) {
+                // if the actual cost of the item (marketing package) that we are decomposing is not available, or
+                // if the standard cost of the marketing package is not available then
+                // the cost coefficient ratio is set to 1.0:
+                // this means that the unit costs of the inventory items of the components
+                // will be equal to the components' standard costs
+                costCoefficient = new Double(1.0);
+            } else {
+                costCoefficient = new Double(inventoryItemCost.doubleValue() / packageCost.doubleValue());
             }
-            Double costCoefficient = new Double(inventoryItemCost.doubleValue() / packageCost.doubleValue());
+            
             // the components are retrieved
             serviceContext.clear();
             serviceContext = UtilMisc.toMap("productId", inventoryItem.getString("productId"),