svn commit: r662394 - in /ofbiz/trunk/applications: accounting/src/org/ofbiz/accounting/invoice/ manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ order/src/org/ofbiz/order/order/ order/webapp/ordermgr/order/ product/script/org/ofbiz/shipm...

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

svn commit: r662394 - in /ofbiz/trunk/applications: accounting/src/org/ofbiz/accounting/invoice/ manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ order/src/org/ofbiz/order/order/ order/webapp/ordermgr/order/ product/script/org/ofbiz/shipm...

bibryam
Author: bibryam
Date: Mon Jun  2 04:16:40 2008
New Revision: 662394

URL: http://svn.apache.org/viewvc?rev=662394&view=rev
Log:
Take into account cancelled Order Item and Item Issuance quantities.

Modified:
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/WorkWithShipmentPlans.groovy
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
    ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl
    ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/AddItemsFromOrder.bsh
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPlan.bsh

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=662394&r1=662393&r2=662394&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Mon Jun  2 04:16:40 2008
@@ -408,6 +408,11 @@
                     BigDecimal billingQuantity = null;
                     if (itemIssuance != null) {
                         billingQuantity = itemIssuance.getBigDecimal("quantity");
+                        BigDecimal cancelQty = itemIssuance.getBigDecimal("cancelQuantity");
+                        if (cancelQty == null) {
+                            cancelQty = ZERO;
+                        }
+                        billingQuantity = billingQuantity.subtract(cancelQty).setScale(decimals, rounding);                        
                     } else if (shipmentReceipt != null) {
                         billingQuantity = shipmentReceipt.getBigDecimal("quantityAccepted");
                     } else {

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/WorkWithShipmentPlans.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/WorkWithShipmentPlans.groovy?rev=662394&r1=662393&r2=662394&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/WorkWithShipmentPlans.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/WorkWithShipmentPlans.groovy Mon Jun  2 04:16:40 2008
@@ -54,7 +54,12 @@
         //    oneRow.putAll(shipmentPlan.getRelatedOne("OrderItemInventoryRes"));
         orderItem = shipmentPlan.getRelatedOne("OrderItem");
         oneRow.put("productId", orderItem.getString("productId"));
-        oneRow.put("totOrderedQuantity", orderItem.getString("quantity"));
+        orderedQuantity = orderItem.getDouble("quantity");
+        canceledQuantity = orderItem.getDouble("cancelQuantity");
+        if (canceledQuantity != null) {
+            orderedQuantity = Double.valueOf(orderedQuantity.doubleValue() - canceledQuantity.doubleValue());
+        }
+        oneRow.put("totOrderedQuantity", orderedQuantity.intValue());
         // Total quantity issued
         issuedQuantity = 0.0;
         qtyIssuedInShipment = new HashMap();
@@ -64,12 +69,19 @@
             issuance = issuancesIt.next();
             if (issuance.get("quantity") != null) {
                 issuedQuantity += issuance.getDouble("quantity");
+                if (issuance.get("cancelQuantity") != null) {
+                    issuedQuantity -= issuance.getDouble("cancelQuantity");
+                }                
                 if (qtyIssuedInShipment.containsKey(issuance.getString("shipmentId"))) {
                     qtyInShipment = ((Double)qtyIssuedInShipment.get(issuance.getString("shipmentId"))).doubleValue();
                     qtyInShipment += issuance.getDouble("quantity");
                     qtyIssuedInShipment.put(issuance.getString("shipmentId"), qtyInShipment);
                 } else {
-                    qtyIssuedInShipment.put(issuance.getString("shipmentId"), issuance.getDouble("quantity"));
+                    qtyInShipment = issuance.getDouble("quantity");
+                    if (issuance.get("cancelQuantity") != null) {
+                        qtyInShipment -= issuance.getDouble("cancelQuantity");
+                    }                    
+                    qtyIssuedInShipment.put(issuance.getString("shipmentId"), qtyInShipment);
                 }
             }
         }

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=662394&r1=662393&r2=662394&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Mon Jun  2 04:16:40 2008
@@ -2026,9 +2026,14 @@
             while (i.hasNext()) {
                 GenericValue issue = (GenericValue) i.next();
                 BigDecimal issueQty = issue.getBigDecimal("quantity");
-                if (issueQty != null) {
-                    quantityShipped = quantityShipped.add(issueQty).setScale(scale, rounding);
+                BigDecimal cancelQty = issue.getBigDecimal("cancelQuantity");
+                if (cancelQty == null) {
+                    cancelQty = ZERO;
                 }
+                if (issueQty == null) {
+                    issueQty = ZERO;
+                }
+                quantityShipped = quantityShipped.add(issueQty.subtract(cancelQty)).setScale(scale, rounding);
             }
         }
         return quantityShipped.setScale(scale, rounding);

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl?rev=662394&r1=662393&r2=662394&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl Mon Jun  2 04:16:40 2008
@@ -500,7 +500,7 @@
                       </div>
                     </td>
                     <td align="center">
-                      <div>${itemIssuance.quantity?string.number}&nbsp;</div>
+                      <div>${itemIssuance.quantity?default(0) - itemIssuance.cancelQuantity?default(0)}&nbsp;</div>
                     </td>
                     <td colspan="4">&nbsp;</td>
                   </tr>
@@ -523,7 +523,7 @@
                       </div>
                     </td>
                     <td align="center">
-                      <div>${itemIssuance.quantity?string.number}&nbsp;</div>
+                      <div>${itemIssuance.quantity?default(0) - itemIssuance.cancelQuantity?default(0)}</div>
                     </td>
                     <td colspan="4">&nbsp;</td>
                   </tr>

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml?rev=662394&r1=662393&r2=662394&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml Mon Jun  2 04:16:40 2008
@@ -1878,6 +1878,7 @@
             <calculate field-name="issuedQuantity" type="Double">
                 <calcop field-name="issuedQuantity" operator="add">
                     <calcop field-name="itemIssuance.quantity" operator="get"/>
+                    <calcop field-name="itemIssuance.cancelQuantity" operator="negative"/>                    
                 </calcop>
             </calculate>
         </iterate>
@@ -1889,6 +1890,7 @@
         </calculate>
         <calculate field-name="remainingQuantity" type="Double">
             <calcop field-name="orderItem.quantity" operator="subtract">
+                <calcop field-name="orderItem.cancelQuantity" operator="get"/>
                 <calcop field-name="totPlannedOrIssuedQuantity" operator="get"/>
             </calcop>
         </calculate>

Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/AddItemsFromOrder.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/AddItemsFromOrder.bsh?rev=662394&r1=662393&r2=662394&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/AddItemsFromOrder.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/AddItemsFromOrder.bsh Mon Jun  2 04:16:40 2008
@@ -80,6 +80,9 @@
                 if (itemIssuance.get("quantity") != null) {
                     totalQuantityIssued += itemIssuance.getDouble("quantity");
                 }
+                if (itemIssuance.get("cancelQuantity") != null) {
+                    totalQuantityIssued -= itemIssuance.getDouble("cancelQuantity");
+                }                
             }
 
             if (isSalesOrder) {
@@ -164,8 +167,14 @@
             if (itemIssuance.get("quantity") != null) {
                 totalQuantityIssued += itemIssuance.getDouble("quantity");
             }
+            if (itemIssuance.get("cancelQuantity") != null) {
+                totalQuantityIssued -= itemIssuance.getDouble("cancelQuantity");
+            }
             if (itemIssuance.get("shipmentId") != null && itemIssuance.getString("shipmentId").equals(shipmentId)) {
                 totalQuantityIssuedInShipment += itemIssuance.getDouble("quantity");
+                if (itemIssuance.get("cancelQuantity") != null) {
+                    totalQuantityIssuedInShipment -= itemIssuance.getDouble("cancelQuantity");
+                }
             }
         }
 

Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPlan.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPlan.bsh?rev=662394&r1=662393&r2=662394&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPlan.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPlan.bsh Mon Jun  2 04:16:40 2008
@@ -76,7 +76,13 @@
         //    oneRow.putAll(shipmentPlan.getRelatedOne("OrderItemShipGrpInvRes"));
         orderItem = shipmentPlan.getRelatedOne("OrderItem");
         oneRow.put("productId", orderItem.getString("productId"));
-        oneRow.put("totOrderedQuantity", orderItem.getString("quantity"));
+        orderedQuantity = orderItem.getDouble("quantity");
+        canceledQuantity = orderItem.getDouble("cancelQuantity");
+        if (canceledQuantity != null) {
+            orderedQuantity = Double.valueOf(orderedQuantity.doubleValue() - canceledQuantity.doubleValue());
+        }
+        oneRow.put("totOrderedQuantity", orderedQuantity.intValue());
+        
         // Total quantity issued
         issuedQuantity = 0.0;
         qtyIssuedInShipment = new HashMap();
@@ -86,12 +92,22 @@
             issuance = issuancesIt.next();
             if (issuance.get("quantity") != null) {
                 issuedQuantity += issuance.getDouble("quantity");
+                if (issuance.get("cancelQuantity") != null) {
+                    issuedQuantity -= issuance.getDouble("cancelQuantity");
+                }
                 if (qtyIssuedInShipment.containsKey(issuance.getString("shipmentId"))) {
                     qtyInShipment = ((Double)qtyIssuedInShipment.get(issuance.getString("shipmentId"))).doubleValue();
                     qtyInShipment += issuance.getDouble("quantity");
+                    if (issuance.get("cancelQuantity") != null) {
+                        qtyInShipment -= issuance.getDouble("cancelQuantity");
+                    }                    
                     qtyIssuedInShipment.put(issuance.getString("shipmentId"), qtyInShipment);
                 } else {
-                    qtyIssuedInShipment.put(issuance.getString("shipmentId"), issuance.getDouble("quantity"));
+                    qtyInShipment = issuance.getDouble("quantity");
+                    if (issuance.get("cancelQuantity") != null) {
+                        qtyInShipment -= issuance.getDouble("cancelQuantity");
+                    }                    
+                    qtyIssuedInShipment.put(issuance.getString("shipmentId"), qtyInShipment);                  
                 }
             }
         }
@@ -204,7 +220,11 @@
         oneRow.put("orderItemSeqId", orderItem.getString("orderItemSeqId"));
         oneRow.put("productId", orderItem.getString("productId"));
         orderedQuantity = orderItem.getDouble("quantity");
-        oneRow.put("orderedQuantity", orderItem.getString("quantity"));
+        canceledQuantity = orderItem.getDouble("cancelQuantity");
+        if (canceledQuantity != null) {
+            orderedQuantity = Double.valueOf(orderedQuantity.doubleValue() - canceledQuantity.doubleValue());
+        }        
+        oneRow.put("orderedQuantity", orderedQuantity);
         // Total quantity issued
         issuedQuantity = 0.0;
         qtyIssuedInShipment = new HashMap();
@@ -214,12 +234,19 @@
             issuance = issuancesIt.next();
             if (issuance.get("quantity") != null) {
                 issuedQuantity += issuance.getDouble("quantity");
+                if (issuance.get("cancelQuantity") != null) {
+                    issuedQuantity -= issuance.getDouble("cancelQuantity");
+                }                
                 if (qtyIssuedInShipment.containsKey(issuance.getString("shipmentId"))) {
                     qtyInShipment = ((Double)qtyIssuedInShipment.get(issuance.getString("shipmentId"))).doubleValue();
                     qtyInShipment += issuance.getDouble("quantity");
                     qtyIssuedInShipment.put(issuance.getString("shipmentId"), qtyInShipment);
                 } else {
-                    qtyIssuedInShipment.put(issuance.getString("shipmentId"), issuance.getDouble("quantity"));
+                    qtyInShipment = issuance.getDouble("quantity");
+                    if (issuance.get("cancelQuantity") != null) {
+                        qtyInShipment -= issuance.getDouble("cancelQuantity");
+                    }                    
+                    qtyIssuedInShipment.put(issuance.getString("shipmentId"), qtyInShipment);                    
                 }
             }
         }