You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by si...@apache.org on 2007/02/23 01:26:44 UTC

svn commit: r510730 - in /ofbiz/trunk/applications/product: config/ servicedef/ src/org/ofbiz/shipment/packing/ webapp/facility/WEB-INF/ webapp/facility/WEB-INF/actions/shipment/ webapp/facility/shipment/

Author: sichen
Date: Thu Feb 22 16:26:42 2007
New Revision: 510730

URL: http://svn.apache.org/viewvc?view=rev&rev=510730
Log:
OFBIZ-734
- Hiding per-line weight entry in favour of per-package weight entry
- Storing package weights and weightUomId in the PackingSession, plus supporting methods
- Populating ShipmentPackage.weight, ShipmentPackage.weightUomId, ShipmentRouteSegment.billingWeight and  ShipmentRouteSegment.billingWeightUomId when packing session is completed
- Introducing calcPackSessionAdditionalShippingCharge service to total package weights and call the PackingSession.getShipmentCostEstimate method

Modified:
    ofbiz/trunk/applications/product/config/ProductUiLabels.properties
    ofbiz/trunk/applications/product/servicedef/services_shipment.xml
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.bsh
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml
    ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl

Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.properties?view=diff&rev=510730&r1=510729&r2=510730
==============================================================================
--- ofbiz/trunk/applications/product/config/ProductUiLabels.properties (original)
+++ ofbiz/trunk/applications/product/config/ProductUiLabels.properties Thu Feb 22 16:26:42 2007
@@ -516,6 +516,7 @@
 ProductEstimatedCosts=Estimated Standard Costs
 ProductEstimatedDates=Estimated Dates
 ProductEstimatedReadyDate=Estimated Ready Date
+ProductEstimateShipCost=Estimate Ship Cost
 ProductEstimatedShipCost=Estimated Ship Cost
 ProductEstimatedShipCostPackages=Estimated Ship Cost for Packages
 ProductEstimatedShipCostForShipGroup=Estimated Ship Cost for Ship Group
@@ -906,7 +907,7 @@
 ProductPackageQty=Package Qty
 ProductPackages=Packages
 ProductPackedQty=Packed Qty
-ProductPackedWeight=Packed Wt
+ProductPackedWeight=Packed Weight
 ProductPackOrder=Pack Order
 ProductPacking=Packing
 ProductPackingSlip=Packing Slip

Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?view=diff&rev=510730&r1=510729&r2=510730
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Thu Feb 22 16:26:42 2007
@@ -401,6 +401,20 @@
         <attribute name="nextPackageSeq" type="Integer" mode="OUT" optional="false"/>
     </service>
 
+    <service name="calcPackSessionAdditionalShippingCharge" engine="java"
+            location="org.ofbiz.shipment.packing.PackingServices" invoke="calcPackSessionAdditionalShippingCharge" auth="true">
+        <description>Totals package weights and calls the calcShipmentCostEstimate via the PackingSession</description>
+        <attribute name="packingSession" type="org.ofbiz.shipment.packing.PackingSession" mode="IN" optional="false"/>
+        <attribute name="packageWeights" type="Map" string-map-prefix="packageWeight_" mode="IN" optional="true"/>
+        <attribute name="weightUomId" type="String" mode="IN" optional="true"/>
+        <attribute name="shippingContactMechId" type="String" mode="IN" optional="false"/>
+        <attribute name="shipmentMethodTypeId" type="String" mode="IN" optional="false"/>
+        <attribute name="carrierPartyId" type="String" mode="IN" optional="false"/>
+        <attribute name="carrierRoleTypeId" type="String" mode="IN" optional="false"/>
+        <attribute name="productStoreId" type="String" mode="IN" optional="false"/>
+        <attribute name="additionalShippingCharge" type="Double" mode="OUT" optional="false"/>
+    </service>
+
     <service name="clearPackAll" engine="java"
             location="org.ofbiz.shipment.packing.PackingServices" invoke="clearPackAll" auth="true">
         <description>Clear the current packing session</description>
@@ -431,6 +445,8 @@
         <attribute name="pickerPartyId" type="String" mode="IN" optional="true"/>
         <attribute name="additionalShippingCharge" type="Double" mode="IN" optional="true"/>
         <attribute name="forceComplete" type="Boolean" mode="IN" optional="true"/>
+        <attribute name="packageWeights" type="Map" string-map-prefix="packageWeight_" mode="IN" optional="true"/>
+        <attribute name="weightUomId" type="String" mode="IN" optional="true"/>
         <attribute name="shipmentId" type="String" mode="OUT" optional="false"/>
     </service>
 

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java?view=diff&rev=510730&r1=510729&r2=510730
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java Thu Feb 22 16:26:42 2007
@@ -24,6 +24,7 @@
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.ServiceUtil;
 
@@ -208,6 +209,26 @@
         return ServiceUtil.returnSuccess();
     }
 
+    public static Map calcPackSessionAdditionalShippingCharge(DispatchContext dctx, Map context) {
+        PackingSession session = (PackingSession) context.get("packingSession");
+        Map packageWeights = (Map) context.get("packageWeights");
+        String weightUomId = (String) context.get("weightUomId");
+        String shippingContactMechId = (String) context.get("shippingContactMechId");
+        String shipmentMethodTypeId = (String) context.get("shipmentMethodTypeId");
+        String carrierPartyId = (String) context.get("carrierPartyId");
+        String carrierRoleTypeId = (String) context.get("carrierRoleTypeId");
+        String productStoreId = (String) context.get("productStoreId");
+        
+        double shippableWeight = setSessionPackageWeights(session, packageWeights);
+        Double estimatedShipCost = session.getShipmentCostEstimate(shippingContactMechId, shipmentMethodTypeId, carrierPartyId, carrierRoleTypeId, productStoreId, null, null, new Double(shippableWeight), null);
+        session.setAdditionalShippingCharge(estimatedShipCost);
+        session.setWeightUomId(weightUomId);
+
+        Map result = ServiceUtil.returnSuccess();
+        result.put("additionalShippingCharge", estimatedShipCost);
+        return result;
+    }
+
 
     public static Map completePack(DispatchContext dctx, Map context) {
         PackingSession session = (PackingSession) context.get("packingSession");
@@ -216,9 +237,13 @@
         String instructions = (String) context.get("handlingInstructions");
         String pickerPartyId = (String) context.get("pickerPartyId");
         Double additionalShippingCharge = (Double) context.get("additionalShippingCharge");
+        Map packageWeights = (Map) context.get("packageWeights");
+        String weightUomId = (String) context.get("weightUomId");
         session.setHandlingInstructions(instructions);
         session.setPickerPartyId(pickerPartyId);
         session.setAdditionalShippingCharge(additionalShippingCharge);
+        session.setWeightUomId(weightUomId);
+        setSessionPackageWeights(session, packageWeights);
 
         Boolean force = (Boolean) context.get("forceComplete");
         if (force == null) {
@@ -242,5 +267,24 @@
         
         resp.put("shipmentId", shipmentId);
         return resp;
+    }
+
+    private static double setSessionPackageWeights(PackingSession session, Map packageWeights) {
+        double shippableWeight = 0;
+        if (! UtilValidate.isEmpty(packageWeights)) {
+            Iterator pwit = packageWeights.keySet().iterator();
+            while (pwit.hasNext()) {
+                String packageSeqId = (String) pwit.next();
+                String packageWeightStr = (String) packageWeights.get(packageSeqId);
+                if (UtilValidate.isNotEmpty(packageWeightStr)) {
+                    double packageWeight = UtilMisc.toDouble(packageWeights.get(packageSeqId));
+                    session.setPackageWeight(Integer.parseInt(packageSeqId), new Double(packageWeight));
+                    shippableWeight += packageWeight;
+                } else {
+                    session.setPackageWeight(Integer.parseInt(packageSeqId), null);
+                }
+            }
+        }
+        return shippableWeight;
     }
 }

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?view=diff&rev=510730&r1=510729&r2=510730
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java Thu Feb 22 16:26:42 2007
@@ -18,12 +18,7 @@
  *******************************************************************************/
 package org.ofbiz.shipment.packing;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.math.BigDecimal;
+import java.util.*;
 
 import javolution.util.FastMap;
 import javolution.util.FastList;
@@ -43,7 +38,6 @@
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.service.ServiceUtil;
 import org.ofbiz.product.product.ProductWorker;
-// import org.ofbiz.order.order.OrderReadHelper; at this pont the order is not yet compiled see other change at line 842 to make this source compile
 
 public class PackingSession implements java.io.Serializable {
 
@@ -59,7 +53,9 @@
     protected String facilityId = null;
     protected String shipmentId = null;
     protected String instructions = null;
-    protected Double additionalShippingCharge;
+    protected String weightUomId = null;
+    protected Double additionalShippingCharge = null;
+    protected Map packageWeights = null;
     protected List packEvents = null;
     protected List packLines = null;
     protected int packageSeq = -1;
@@ -83,6 +79,7 @@
         this.packLines = new ArrayList();
         this.packEvents = new ArrayList();
         this.packageSeq = 1;
+        this.packageWeights = new HashMap();
     }
 
     public PackingSession(LocalDispatcher dispatcher, GenericValue userLogin, String facilityId) {
@@ -219,6 +216,9 @@
                 break;
         }
 
+        // Add the line weight to the package weight
+        if (weight > 0) this.addToPackageWeight(packageSeqId, new Double(weight));
+        
         // update the package sequence
         if (packageSeqId > packageSeq) {
             this.packageSeq = packageSeqId;
@@ -554,6 +554,8 @@
         this.primaryOrderId = null;
         this.primaryShipGrp = null;
         this.additionalShippingCharge = null;
+        if (this.packageWeights != null) this.packageWeights.clear();
+        this.weightUomId = null;
         this.packageSeq = 1;
         this.status = 1;
         this.runEvents(PackingEvent.EVENT_CODE_CLEAR);
@@ -580,6 +582,8 @@
         this.issueItemsToShipment();
         // assign items to packages
         this.applyItemsToPackages();
+        // update ShipmentRouteSegments with total weight and weightUomId
+        this.updateShipmentRouteSegments();
         // set the shipment to packed
         this.setShipmentToPacked();
         // set role on picklist
@@ -715,6 +719,8 @@
             pkgCtx.put("shipmentId", shipmentId);
             pkgCtx.put("shipmentPackageSeqId", shipmentPackageSeqId);
             //pkgCtx.put("shipmentBoxTypeId", "");
+            pkgCtx.put("weight", getPackageWeight(i+1));
+            pkgCtx.put("weightUomId", getWeightUomId());
             pkgCtx.put("userLogin", userLogin);
             Map newPkgResp = this.getDispatcher().runSync("createShipmentPackage", pkgCtx);
 
@@ -733,6 +739,21 @@
         }
     }
 
+    protected void updateShipmentRouteSegments() throws GeneralException {
+        Double shipmentWeight = new Double(getTotalWeight());
+        if (shipmentWeight.doubleValue() <= 0) return;
+        List shipmentRouteSegments = getDelegator().findByAnd("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", this.getShipmentId()));
+        if (! UtilValidate.isEmpty(shipmentRouteSegments)) {
+            Iterator srit = shipmentRouteSegments.iterator();
+            while (srit.hasNext()) {
+                GenericValue shipmentRouteSegment = (GenericValue) srit.next();
+                shipmentRouteSegment.set("billingWeight", shipmentWeight);
+                shipmentRouteSegment.set("billingWeightUomId", getWeightUomId());
+            }
+            getDelegator().storeAll(shipmentRouteSegments);
+        }
+    }
+ 
     protected void setShipmentToPacked() throws GeneralException {
         Map packedCtx = UtilMisc.toMap("shipmentId", shipmentId, "statusId", "SHIPMENT_PACKED", "userLogin", userLogin);
         Map packedResp = this.getDispatcher().runSync("updateShipment", packedCtx);
@@ -775,14 +796,12 @@
         this.additionalShippingCharge = additionalShippingCharge;
     }
     
-    public double getTotalWeight(int packageSeq) {
+    public double getTotalWeight() {
         double total = 0.0;
-        List lines = this.getLines();
-        Iterator i = lines.iterator();
-        while (i.hasNext()) {
-            PackingSessionLine line = (PackingSessionLine) i.next();
-            if (packageSeq == -1 || packageSeq == line.getPackageSeq()) {
-                total += line.getWeight();
+        for (int i = 0; i < packageSeq; i++) {
+            Double packageWeight = getPackageWeight(i);
+            if (! UtilValidate.isEmpty(packageWeight)) {
+                total += packageWeight.doubleValue();
             }
         }
         return total;
@@ -824,7 +843,7 @@
             serviceContext.put("shippableItemInfo", shippableItemInfo);
 
             if (UtilValidate.isEmpty(shippableWeight)) {
-                shippableWeight = new Double(getTotalWeight(-1));
+                shippableWeight = new Double(getTotalWeight());
             }
             serviceContext.put("shippableWeight", shippableWeight);
 
@@ -835,21 +854,14 @@
 
             if (UtilValidate.isEmpty(shippableTotal)) {
                 shippableTotal = new Double(0);
-                Iterator lit = getLines().iterator();
-                while (lit.hasNext()) {
-                    PackingSessionLine line = (PackingSessionLine) lit.next();
-                    GenericValue orderItem = getDelegator().findByPrimaryKey("OrderItem", UtilMisc.toMap("orderId", line.getOrderId(), "orderItemSeqId", line.getOrderItemSeqId()));
-//                    BigDecimal orderItemTotal = OrderReadHelper.getOrderItemSubTotalBd(orderItem, null, false, false);
-//                    shippableTotal = new Double(shippableTotal.doubleValue() + orderItemTotal.doubleValue());                    
-                }
             }
             serviceContext.put("shippableTotal", shippableTotal);
     
             serviceResult = getDispatcher().runSync("calcShipmentCostEstimate", serviceContext);
         } catch( GenericEntityException e ) {
-            e.printStackTrace();
+            Debug.logError(e, module);
         } catch( GenericServiceException e ) {
-            e.printStackTrace();
+            Debug.logError(e, module);
         }
         
         if (! UtilValidate.isEmpty(serviceResult.get("shippingEstimateAmount"))) {
@@ -860,4 +872,45 @@
         
     }
    
+    public String getWeightUomId() {
+        return weightUomId;
+    }
+
+    public void setWeightUomId(String weightUomId) {
+        this.weightUomId = weightUomId;
+    }
+    
+    public List getPackageSeqIds() {
+        Set packageSeqIds = new TreeSet();
+        if (! UtilValidate.isEmpty(this.getLines())) {
+            Iterator lit = this.getLines().iterator();
+            while (lit.hasNext()) {
+                PackingSessionLine line = (PackingSessionLine) lit.next();
+                packageSeqIds.add(new Integer(line.getPackageSeq()));
+            }
+        }
+        return new ArrayList(packageSeqIds);
+    }
+    
+    public void setPackageWeight(int packageSeqId, Double packageWeight) {
+        packageWeights.put(new Integer(packageSeqId), packageWeight);
+    }
+    
+    public Double getPackageWeight(int packageSeqId) {
+        if (this.packageWeights == null) return null;
+        Double packageWeight = null;
+        Object p = packageWeights.get(new Integer(packageSeqId));
+        if (p != null) {
+            packageWeight = (Double) p;
+        }
+        return packageWeight;
+    }
+    
+    public void addToPackageWeight(int packageSeqId, Double weight) {
+        if (UtilValidate.isEmpty(weight)) return;
+        Double packageWeight = getPackageWeight(packageSeqId);
+        Double newPackageWeight = UtilValidate.isEmpty(packageWeight) ? weight : new Double(weight.doubleValue() + packageWeight.doubleValue());
+        setPackageWeight(packageSeqId, newPackageWeight);
+    }
+    
 }

Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.bsh?view=diff&rev=510730&r1=510729&r2=510730
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.bsh Thu Feb 22 16:26:42 2007
@@ -100,6 +100,7 @@
                 shippableQuantity = new Double(orh.getShippableQuantityBd(shipGroupSeqId).doubleValue());
                 shipmentCostEstimate = packSession.getShipmentCostEstimate(orderItemShipGroup, productStoreId, shippableItemInfo, shippableTotal, shippableWeight, shippableQuantity);                
                 context.put("shipmentCostEstimateForShipGroup", shipmentCostEstimate);
+                context.put("productStoreId", productStoreId);
 
                 context.put("itemInfos", shippableItemInfo);
             } else {

Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml?view=diff&rev=510730&r1=510729&r2=510730
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml Thu Feb 22 16:26:42 2007
@@ -632,6 +632,12 @@
         <response name="success" type="view" value="PackOrder"/>
         <response name="error" type="view" value="PackOrder"/>
     </request-map>
+    <request-map uri="calcPackSessionAdditionalShippingCharge">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="calcPackSessionAdditionalShippingCharge"/>
+        <response name="success" type="view" value="PackOrder"/>
+        <response name="error" type="view" value="PackOrder"/>
+    </request-map>
     <request-map uri="CompletePack">
         <security https="true" auth="true"/>
         <event type="service" invoke="completePack"/>

Modified: ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl?view=diff&rev=510730&r1=510729&r2=510730
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl (original)
+++ ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl Thu Feb 22 16:26:42 2007
@@ -204,11 +204,11 @@
               <td align="right"><div class="tableheadtext">${uiLabelMap.ProductPackedQty}</td>
               <td>&nbsp;</td>
               <td align="center"><div class="tableheadtext">${uiLabelMap.ProductPackQty}</td>
-              <td align="center"><div class="tableheadtext">${uiLabelMap.ProductPackedWeight}&nbsp;(${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultWeightUomId)?eval})</td>
+              <#--td align="center"><div class="tableheadtext">${uiLabelMap.ProductPackedWeight}&nbsp;(${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultWeightUomId)?eval})</td-->
               <td align="center"><div class="tableheadtext">${uiLabelMap.ProductPackage}</td>
             </tr>
             <tr>
-              <td colspan="11">
+              <td colspan="10">
                 <hr class="sepbar"/>
               </td>
             </tr>
@@ -233,9 +233,9 @@
                 <td align="center">
                   <input type="text" class="inputBox" size="7" name="qty_${orderItem.orderItemSeqId}" value="${inputQty}">
                 </td>
-                <td align="center">
+                <#--td align="center">
                   <input type="text" class="inputBox" size="7" name="wgt_${orderItem.orderItemSeqId}" value="">
-                </td>
+                </td-->
                 <td align="center">
                   <select name="pkg_${orderItem.orderItemSeqId}">
                     <option value="1">${uiLabelMap.ProductPackage} 1</option>
@@ -248,9 +248,9 @@
                 <input type="hidden" name="prd_${orderItem.orderItemSeqId}" value="${orderItem.productId?if_exists}">
               </tr>
             </#list>
-            <tr><td colspan="11">&nbsp;</td></tr>
+            <tr><td colspan="10">&nbsp;</td></tr>
             <tr>
-              <td colspan="11" align="right">
+              <td colspan="10" align="right">
                 <input type="submit" value="${uiLabelMap.ProductPackItem}">
                 &nbsp;
                 <input type="button" value="${uiLabelMap.CommonClear}" onclick="javascript:document.clearPackForm.submit();"/>
@@ -268,31 +268,48 @@
           <input type="hidden" name="shipGroupSeqId" value="${shipGroupSeqId?if_exists}"/>
           <input type="hidden" name="facilityId" value="${facilityId?if_exists}"/>
           <input type="hidden" name="forceComplete" value="${forceComplete?default('false')}"/>
+          <input type="hidden" name="weightUomId" value="${defaultWeightUomId}"/>
           <input type="hidden" name="showInput" value="N"/>
           <hr class="sepbar">
           <div>&nbsp;</div>
           <table border='0' cellpadding='2' cellspacing='0' width="100%">
             <tr>
-              <td width="40">
+                <#assign packageSeqIds = packingSession.getPackageSeqIds()/>
+                <#if packageSeqIds?has_content>
+                    <td>
+                        <div class="tableheadtext">${uiLabelMap.ProductPackedWeight} (${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultWeightUomId)?eval}):</div>
+                        <div>
+                            <#list packageSeqIds as packageSeqId>
+                                ${uiLabelMap.ProductPackage} ${packageSeqId}  <input type="text" class="inputBox" size="7" name="packageWeight_${packageSeqId}" value="${packingSession.getPackageWeight(packageSeqId?int)?if_exists}"><br/>
+                            </#list>
+                            <#if orderItemShipGroup?has_content>
+                                <input type="hidden" name="shippingContactMechId" value="${orderItemShipGroup.contactMechId?if_exists}"/>
+                                <input type="hidden" name="shipmentMethodTypeId" value="${orderItemShipGroup.shipmentMethodTypeId?if_exists}"/>
+                                <input type="hidden" name="carrierPartyId" value="${orderItemShipGroup.carrierPartyId?if_exists}"/>
+                                <input type="hidden" name="carrierRoleTypeId" value="${orderItemShipGroup.carrierRoleTypeId?if_exists}"/>
+                                <input type="hidden" name="productStoreId" value="${productStoreId?if_exists}"/>
+                            </#if>
+                        </div>
+                    </td>
+                </#if>
+                <td nowrap="nowrap">
+                    <div class="tableheadtext">${uiLabelMap.ProductAdditionalShippingCharge}:</div>
+                    <div>
+                        <input type="text" class="inputBox" name="additionalShippingCharge" value="${packingSession.getAdditionalShippingCharge()?if_exists}" size="20"/>
+                    </div>
+                    <#if packageSeqIds?has_content>
+                        <div>
+                            <a href="javascript:document.completePackForm.action='<@o...@ofbizUrl>';document.completePackForm.submit();" class="buttontext">${uiLabelMap.ProductEstimateShipCost}</a>
+                        </div>
+                        <div>&nbsp;</div>
+                    </#if>
+                </td>
+              <td>
                 <div class="tableheadtext">${uiLabelMap.ProductHandlingInstructions}:</div>
                 <div>
                   <textarea name="handlingInstructions" class="inputBox" rows="2" cols="30">${packingSession.getHandlingInstructions()?if_exists}</textarea>
                 </div>
               </td>
-              <td width="40" nowrap="nowrap" >
-                <div class="tableheadtext">${uiLabelMap.ProductAdditionalShippingCharge}:</div>
-                <div>
-                  <input type="text" class="inputBox" name="additionalShippingCharge" value="${packingSession.getAdditionalShippingCharge()?if_exists}" size="20"/>
-                  <br/>
-                  <#if packingSession.getLines()?exists && packingSession.getLines()?has_content>
-                    <#assign packedShipmentCostEstimate = packingSession.getShipmentCostEstimate(orderItemShipGroup, orderReadHelper.getProductStoreId())/>
-                    ${uiLabelMap.ProductEstimatedShipCostPackages}:
-                    <#if packedShipmentCostEstimate?exists>
-                        <@ofbizCurrency amount=packedShipmentCostEstimate isoCode=orderReadHelper.getCurrency()?if_exists/>
-                    </#if>
-                  </#if>
-                </div>
-              </td>
               <td align="right">
                 <div>
                   <#assign buttonName = "${uiLabelMap.ProductComplete}">
@@ -320,12 +337,12 @@
             <td><div class="tableheadtext">${uiLabelMap.ProductDescription}</td>
             <td><div class="tableheadtext">${uiLabelMap.ProductInventoryItem} #</td>
             <td align="right"><div class="tableheadtext">${uiLabelMap.ProductPackedQty}</td>
-            <td align="right"><div class="tableheadtext">${uiLabelMap.ProductPackedWeight}&nbsp;(${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultWeightUomId)?eval})</td>
+            <#--td align="right"><div class="tableheadtext">${uiLabelMap.ProductPackedWeight}&nbsp;(${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultWeightUomId)?eval})</td-->
             <td align="right"><div class="tableheadtext">${uiLabelMap.ProductPackage} #</td>
             <td>&nbsp;</td>
           </tr>
           <tr>
-            <td colspan="8">
+            <td colspan="7">
               <hr class="sepbar"/>
             </td>
           </tr>
@@ -337,7 +354,7 @@
               <td><div class="tabletext">${(orderItem.itemDescription)?default("[N/A]")}</td>
               <td><div class="tabletext">${line.getInventoryItemId()}</td>
               <td align="right"><div class="tabletext">${line.getQuantity()}</td>
-              <td align="right"><div class="tabletext">${line.getWeight()}</td>
+              <#--td align="right"><div class="tabletext">${line.getWeight()}</td-->
               <td align="right"><div class="tabletext">${line.getPackageSeq()}</td>
               <td align="right"><a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonClear}</a></td>
             </tr>