You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Akash Jain <ak...@hotwaxmedia.com> on 2009/04/22 12:34:33 UTC

Re: svn commit: r767449 - in /ofbiz/trunk/applications: accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy product/webapp/facility/shipment/PackOrder.ftl

Thanks Vikas  :-)

Regards
--
Akash Jain

mor@apache.org wrote:
> Author: mor
> Date: Wed Apr 22 10:20:14 2009
> New Revision: 767449
>
> URL: http://svn.apache.org/viewvc?rev=767449&view=rev
> Log:
> No functional changes, only formatting changes. Applied OFBIZ-2329_Formatted patch, Part of OFBIZ-2329 (https://issues.apache.org/jira/browse/OFBIZ-2329)
> Thanks Akash Jain, this is indeed the right way to upload patches, one with diff and other with formatting changes.
>
>
> Modified:
>     ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
>     ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy
>     ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl
>
> 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=767449&r1=767448&r2=767449&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 Wed Apr 22 10:20:14 2009
> @@ -243,26 +243,26 @@
>  
>              // create the invoice record
>              if (UtilValidate.isEmpty(invoiceId)) {
> -            Map createInvoiceContext = FastMap.newInstance();
> -            createInvoiceContext.put("partyId", billToCustomerPartyId);
> -            createInvoiceContext.put("partyIdFrom", billFromVendorPartyId);
> -            createInvoiceContext.put("billingAccountId", billingAccountId);
> -            createInvoiceContext.put("invoiceDate", invoiceDate);
> -            createInvoiceContext.put("dueDate", dueDate);
> -            createInvoiceContext.put("invoiceTypeId", invoiceType);
> -            // start with INVOICE_IN_PROCESS, in the INVOICE_READY we can't change the invoice (or shouldn't be able to...)
> -            createInvoiceContext.put("statusId", "INVOICE_IN_PROCESS");
> -            createInvoiceContext.put("currencyUomId", orderHeader.getString("currencyUom"));
> -            createInvoiceContext.put("userLogin", userLogin);
> -
> -            // store the invoice first
> -            Map createInvoiceResult = dispatcher.runSync("createInvoice", createInvoiceContext);
> -            if (ServiceUtil.isError(createInvoiceResult)) {
> -                return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceFromOrder",locale), null, null, createInvoiceResult);
> -            }
> +                Map createInvoiceContext = FastMap.newInstance();
> +                createInvoiceContext.put("partyId", billToCustomerPartyId);
> +                createInvoiceContext.put("partyIdFrom", billFromVendorPartyId);
> +                createInvoiceContext.put("billingAccountId", billingAccountId);
> +                createInvoiceContext.put("invoiceDate", invoiceDate);
> +                createInvoiceContext.put("dueDate", dueDate);
> +                createInvoiceContext.put("invoiceTypeId", invoiceType);
> +                // start with INVOICE_IN_PROCESS, in the INVOICE_READY we can't change the invoice (or shouldn't be able to...)
> +                createInvoiceContext.put("statusId", "INVOICE_IN_PROCESS");
> +                createInvoiceContext.put("currencyUomId", orderHeader.getString("currencyUom"));
> +                createInvoiceContext.put("userLogin", userLogin);
>  
> -            // call service, not direct entity op: delegator.create(invoice);
> -            invoiceId = (String) createInvoiceResult.get("invoiceId");
> +                // store the invoice first
> +                Map createInvoiceResult = dispatcher.runSync("createInvoice", createInvoiceContext);
> +                if (ServiceUtil.isError(createInvoiceResult)) {
> +                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceFromOrder",locale), null, null, createInvoiceResult);
> +                }
> +
> +                // call service, not direct entity op: delegator.create(invoice);
> +                invoiceId = (String) createInvoiceResult.get("invoiceId");
>              }
>  
>              // order roles to invoice roles
> @@ -494,15 +494,15 @@
>                      }
>  
>                      if ("ItemIssuance".equals(currentValue.getEntityName())) {
> -                    List<GenericValue> shipmentItemBillings = delegator.findByAnd("ShipmentItemBilling", UtilMisc.toMap("shipmentId", currentValue.get("shipmentId")));
> -                    if (UtilValidate.isEmpty(shipmentItemBillings)) {
> +                        List<GenericValue> shipmentItemBillings = delegator.findByAnd("ShipmentItemBilling", UtilMisc.toMap("shipmentId", currentValue.get("shipmentId")));
> +                        if (UtilValidate.isEmpty(shipmentItemBillings)) {
>  
> -                        // create the ShipmentItemBilling record
> -                        GenericValue shipmentItemBilling = delegator.makeValue("ShipmentItemBilling", UtilMisc.toMap("invoiceId", invoiceId, "invoiceItemSeqId", invoiceItemSeqId));
> -                        shipmentItemBilling.put("shipmentId", currentValue.get("shipmentId"));
> -                        shipmentItemBilling.put("shipmentItemSeqId", currentValue.get("shipmentItemSeqId"));
> -                        shipmentItemBilling.create();
> -                    }
> +                            // create the ShipmentItemBilling record
> +                            GenericValue shipmentItemBilling = delegator.makeValue("ShipmentItemBilling", UtilMisc.toMap("invoiceId", invoiceId, "invoiceItemSeqId", invoiceItemSeqId));
> +                            shipmentItemBilling.put("shipmentId", currentValue.get("shipmentId"));
> +                            shipmentItemBilling.put("shipmentItemSeqId", currentValue.get("shipmentItemSeqId"));
> +                            shipmentItemBilling.create();
> +                        }
>                      }
>  
>                      String parentInvoiceItemSeqId = invoiceItemSeqId;
>
> Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy?rev=767449&r1=767448&r2=767449&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy (original)
> +++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy Wed Apr 22 10:20:14 2009
> @@ -138,27 +138,27 @@
>  
>          if ("ORDER_APPROVED".equals(orderHeader.statusId)) {
>              if (shipGroupSeqId) {
> -            if (shipment) {
> +                if (shipment) {
>  
> -                // Generate the shipment cost estimate for the ship group
> -                productStoreId = orh.getProductStoreId();
> -                shippableItemInfo = orh.getOrderItemAndShipGroupAssoc(shipGroupSeqId);
> -                shippableItems = delegator.findList("OrderItemAndShipGrpInvResAndItemSum", EntityCondition.makeCondition([orderId : orderId, shipGroupSeqId : shipGroupSeqId]), null, null, null, false);
> -                shippableTotal = new Double(orh.getShippableTotal(shipGroupSeqId).doubleValue());
> -                shippableWeight = new Double(orh.getShippableWeight(shipGroupSeqId).doubleValue());
> -                shippableQuantity = new Double(orh.getShippableQuantity(shipGroupSeqId).doubleValue());
> -                shipmentCostEstimate = packSession.getShipmentCostEstimate(orderItemShipGroup, productStoreId, shippableItemInfo, shippableTotal, shippableWeight, shippableQuantity);
> -                context.shipmentCostEstimateForShipGroup = shipmentCostEstimate;
> -                context.productStoreId = productStoreId;
> +                    // Generate the shipment cost estimate for the ship group
> +                    productStoreId = orh.getProductStoreId();
> +                    shippableItemInfo = orh.getOrderItemAndShipGroupAssoc(shipGroupSeqId);
> +                    shippableItems = delegator.findList("OrderItemAndShipGrpInvResAndItemSum", EntityCondition.makeCondition([orderId : orderId, shipGroupSeqId : shipGroupSeqId]), null, null, null, false);
> +                    shippableTotal = new Double(orh.getShippableTotal(shipGroupSeqId).doubleValue());
> +                    shippableWeight = new Double(orh.getShippableWeight(shipGroupSeqId).doubleValue());
> +                    shippableQuantity = new Double(orh.getShippableQuantity(shipGroupSeqId).doubleValue());
> +                    shipmentCostEstimate = packSession.getShipmentCostEstimate(orderItemShipGroup, productStoreId, shippableItemInfo, shippableTotal, shippableWeight, shippableQuantity);
> +                    context.shipmentCostEstimateForShipGroup = shipmentCostEstimate;
> +                    context.productStoreId = productStoreId;
>  
> -                if (!picklistBinId) {
> -                    packSession.addItemInfo(shippableItems);
> -                    //context.put("itemInfos", shippableItemInfo);
> +                    if (!picklistBinId) {
> +                        packSession.addItemInfo(shippableItems);
> +                        //context.put("itemInfos", shippableItemInfo);
> +                    }
> +                } else {
> +                    request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderNotVerifiedForPacking", [orderId : orderId], locale));
>                  }
>              } else {
> -                request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderNotVerifiedForPacking", [orderId : orderId], locale));
> -            }
> -            } else {
>                  request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale));
>              }
>          } else {
>
> 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?rev=767449&r1=767448&r2=767449&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl (original)
> +++ ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl Wed Apr 22 10:20:14 2009
> @@ -35,18 +35,18 @@
>          <div class="screenlet-body">
>              <#if shipmentId?has_content && invoiceIds?exists && invoiceIds?has_content>
>                  <div>
> -                ${uiLabelMap.CommonView} <a href="<@o...@ofbizUrl>" target="_blank" class="buttontext">${uiLabelMap.ProductPackingSlip}</a> ${uiLabelMap.CommonOr}
> -                ${uiLabelMap.CommonView} <a href="<@o...@ofbizUrl>" target="_blank" class="buttontext">${uiLabelMap.ProductBarcode}</a> ${uiLabelMap.CommonFor} ${uiLabelMap.ProductShipmentId} <a href="<@o...@ofbizUrl>" class="buttontext">${shipmentId}</a>
> +                    ${uiLabelMap.CommonView} <a href="<@o...@ofbizUrl>" target="_blank" class="buttontext">${uiLabelMap.ProductPackingSlip}</a> ${uiLabelMap.CommonOr}
> +                    ${uiLabelMap.CommonView} <a href="<@o...@ofbizUrl>" target="_blank" class="buttontext">${uiLabelMap.ProductBarcode}</a> ${uiLabelMap.CommonFor} ${uiLabelMap.ProductShipmentId} <a href="<@o...@ofbizUrl>" class="buttontext">${shipmentId}</a>
>                  </div>
>                  <div>
>                      <p>${uiLabelMap.AccountingInvoices}:</p>
>                      <ul>
> -                    <#list invoiceIds as invoiceId>
> -                      <li>
> -                        #<a href="/accounting/control/invoiceOverview?invoiceId=${invoiceId}&externalLoginKey=${externalLoginKey}" target="_blank" class="buttontext">${invoiceId}</a>
> -                        (<a href="/accounting/control/invoice.pdf?invoiceId=${invoiceId}&externalLoginKey=${externalLoginKey}" target="_blank" class="buttontext">PDF</a>)
> -                      </li>
> -                    </#list>
> +                        <#list invoiceIds as invoiceId>
> +                            <li>
> +                                #<a href="/accounting/control/invoiceOverview?invoiceId=${invoiceId}&externalLoginKey=${externalLoginKey}" target="_blank" class="buttontext">${invoiceId}</a>
> +                                (<a href="/accounting/control/invoice.pdf?invoiceId=${invoiceId}&externalLoginKey=${externalLoginKey}" target="_blank" class="buttontext">PDF</a>)
> +                            </li>
> +                        </#list>
>                      </ul>
>                  </div>
>              </#if>
> @@ -54,444 +54,440 @@
>  
>              <!-- select order form -->
>              <form name="selectOrderForm" method="post" action="<@o...@ofbizUrl>">
> -              <input type="hidden" name="facilityId" value="${facilityId?if_exists}">
> -              <table cellspacing="0" class="basic-table">
> -                <tr>
> -                  <td width="25%" align="right"><span class="label">${uiLabelMap.ProductOrderId}</span></td>
> -                  <td width="1">&nbsp;</td>
> -                  <td width="25%">
> -                    <input type="text" name="orderId" size="20" maxlength="20" value="${orderId?if_exists}"/>
> -                    /
> -                    <input type="text" name="shipGroupSeqId" size="6" maxlength="6" value="${shipGroupSeqId?default("00001")}"/>
> -                  </td>
> -                  <td><span class="label">${uiLabelMap.ProductHideGrid}</span>&nbsp;<input type="checkbox" name="hideGrid" value="Y" <#if (hideGrid == "Y")>checked=""</#if>></td>
> -                  <td>&nbsp;</td>
> -                </tr>
> -                <tr>
> -                  <td colspan="2">&nbsp;</td>
> -                  <td colspan="2">
> -                    <input type="image" src="<@o...@ofbizContentUrl>" onClick="javascript:document.selectOrderForm.submit();">
> -                    <a href="javascript:document.selectOrderForm.submit();" class="buttontext">${uiLabelMap.ProductPackOrder}</a>
> -                  </td>
> -                </tr>
> -              </table>
> +                <input type="hidden" name="facilityId" value="${facilityId?if_exists}">
> +                <table cellspacing="0" class="basic-table">
> +                    <tr>
> +                        <td width="25%" align="right"><span class="label">${uiLabelMap.ProductOrderId}</span></td>
> +                        <td width="1">&nbsp;</td>
> +                        <td width="25%">
> +                            <input type="text" name="orderId" size="20" maxlength="20" value="${orderId?if_exists}"/>
> +                            /
> +                            <input type="text" name="shipGroupSeqId" size="6" maxlength="6" value="${shipGroupSeqId?default("00001")}"/>
> +                        </td>
> +                        <td><span class="label">${uiLabelMap.ProductHideGrid}</span>&nbsp;<input type="checkbox" name="hideGrid" value="Y" <#if (hideGrid == "Y")>checked=""</#if>></td>
> +                        <td>&nbsp;</td>
> +                    </tr>
> +                    <tr>
> +                        <td colspan="2">&nbsp;</td>
> +                        <td colspan="2">
> +                            <input type="image" src="<@o...@ofbizContentUrl>" onClick="javascript:document.selectOrderForm.submit();">
> +                            <a href="javascript:document.selectOrderForm.submit();" class="buttontext">${uiLabelMap.ProductPackOrder}</a>
> +                        </td>
> +                    </tr>
> +                </table>
>              </form>
>              <br/>
>  
>              <!-- select picklist bin form -->
>              <form name="selectPicklistBinForm" method="post" action="<@o...@ofbizUrl>" style="margin: 0;">
> -              <input type="hidden" name="facilityId" value="${facilityId?if_exists}">
> -              <table cellspacing="0" class="basic-table">
> -                <tr>
> -                  <td width="25%" align='right'><span class="label">${uiLabelMap.FormFieldTitle_picklistBinId}</span></td>
> -                  <td width="1">&nbsp;</td>
> -                  <td width="25%">
> -                    <input type="text" name="picklistBinId" size="29" maxlength="60" value="${picklistBinId?if_exists}"/>
> -                  </td>
> -                  <td><span class="label">${uiLabelMap.ProductHideGrid}</span>&nbsp;<input type="checkbox" name="hideGrid" value="Y" <#if (hideGrid == "Y")>checked=""</#if>></td>
> -                  <td>&nbsp;</td>
> -                </tr>
> -                <tr>
> -                  <td colspan="2">&nbsp;</td>
> -                  <td colspan="1">
> -                    <input type="image" src="<@o...@ofbizContentUrl>" onClick="javascript:document.selectPicklistBinForm.submit();">
> -                    <a href="javascript:document.selectPicklistBinForm.submit();" class="buttontext">${uiLabelMap.ProductPackOrder}</a>
> -                  </td>
> -                </tr>
> -              </table>
> +                <input type="hidden" name="facilityId" value="${facilityId?if_exists}">
> +                <table cellspacing="0" class="basic-table">
> +                    <tr>
> +                        <td width="25%" align='right'><span class="label">${uiLabelMap.FormFieldTitle_picklistBinId}</span></td>
> +                        <td width="1">&nbsp;</td>
> +                        <td width="25%">
> +                            <input type="text" name="picklistBinId" size="29" maxlength="60" value="${picklistBinId?if_exists}"/>
> +                        </td>
> +                        <td><span class="label">${uiLabelMap.ProductHideGrid}</span>&nbsp;<input type="checkbox" name="hideGrid" value="Y" <#if (hideGrid == "Y")>checked=""</#if>></td>
> +                        <td>&nbsp;</td>
> +                    </tr>
> +                    <tr>
> +                        <td colspan="2">&nbsp;</td>
> +                        <td colspan="1">
> +                            <input type="image" src="<@o...@ofbizContentUrl>" onClick="javascript:document.selectPicklistBinForm.submit();">
> +                            <a href="javascript:document.selectPicklistBinForm.submit();" class="buttontext">${uiLabelMap.ProductPackOrder}</a>
> +                        </td>
> +                    </tr>
> +                </table>
>              </form>
>              <form name="clearPackForm" method="post" action="<@o...@ofbizUrl>">
> -              <input type="hidden" name="orderId" value="${orderId?if_exists}"/>
> -              <input type="hidden" name="shipGroupSeqId" value="${shipGroupSeqId?if_exists}"/>
> -              <input type="hidden" name="facilityId" value="${facilityId?if_exists}"/>
> +                <input type="hidden" name="orderId" value="${orderId?if_exists}"/>
> +                <input type="hidden" name="shipGroupSeqId" value="${shipGroupSeqId?if_exists}"/>
> +                <input type="hidden" name="facilityId" value="${facilityId?if_exists}"/>
>              </form>
>              <form name="incPkgSeq" method="post" action="<@o...@ofbizUrl>">
> -              <input type="hidden" name="orderId" value="${orderId?if_exists}"/>
> -              <input type="hidden" name="shipGroupSeqId" value="${shipGroupSeqId?if_exists}"/>
> -              <input type="hidden" name="facilityId" value="${facilityId?if_exists}"/>
> +                <input type="hidden" name="orderId" value="${orderId?if_exists}"/>
> +                <input type="hidden" name="shipGroupSeqId" value="${shipGroupSeqId?if_exists}"/>
> +                <input type="hidden" name="facilityId" value="${facilityId?if_exists}"/>
>              </form>
>          </div>
>      </div>
>  
>      <#if ((shipment?has_content) && (shipment.shipmentId)?exists)>
> -    <#if showInput != "N" && ((orderHeader?exists && orderHeader?has_content))>
> -    <div class="screenlet">
> -        <div class="screenlet-title-bar">
> -            <ul>
> -                <li class="h3">${uiLabelMap.ProductOrderId} #<a href="/ordermgr/control/orderview?orderId=${orderId}">${orderId}</a> / ${uiLabelMap.ProductOrderShipGroupId} #${shipGroupSeqId}</li>
> -            </ul>
> -            <br class="clear"/>
> -        </div>
> -        <div class="screenlet-body">
> -              <#if orderItemShipGroup?has_content>
> -                <#assign postalAddress = orderItemShipGroup.getRelatedOne("PostalAddress")>
> -                <#assign carrier = orderItemShipGroup.carrierPartyId?default("N/A")>
> -                <table cellpadding="4" cellspacing="4" class="basic-table">
> -                  <tr>
> -                    <td valign="top">
> -                      <span class="label">${uiLabelMap.ProductShipToAddress}</span>
> -                      <br/>
> -                      ${uiLabelMap.CommonTo}: ${postalAddress.toName?default("")}
> -                      <br/>
> -                      <#if postalAddress.attnName?has_content>
> -                          ${uiLabelMap.CommonAttn}: ${postalAddress.attnName}
> -                          <br/>
> -                      </#if>
> -                      ${postalAddress.address1}
> -                      <br/>
> -                      <#if postalAddress.address2?has_content>
> -                          ${postalAddress.address2}
> -                          <br/>
> -                      </#if>
> -                      ${postalAddress.city?if_exists}, ${postalAddress.stateProvinceGeoId?if_exists} ${postalAddress.postalCode?if_exists}
> -                      <br/>
> -                      ${postalAddress.countryGeoId}
> -                      <br/>
> -                    </td>
> -                    <td>&nbsp;</td>
> -                    <td valign="top">
> -                      <span class="label">${uiLabelMap.ProductCarrierShipmentMethod}</span>
> -                      <br/>
> -                      <#if carrier == "USPS">
> -                        <#assign color = "red">
> -                      <#elseif carrier == "UPS">
> -                        <#assign color = "green">
> -                      <#else>
> -                        <#assign color = "black">
> -                      </#if>
> -                      <#if carrier != "_NA_">
> -                        <font color="${color}">${carrier}</font>
> -                        &nbsp;
> -                      </#if>
> -                      ${orderItemShipGroup.shipmentMethodTypeId?default("??")}
> -                      <br/>
> -                      <span class="label">${uiLabelMap.ProductEstimatedShipCostForShipGroup}</span>
> -                      <br/>
> -                      <#if shipmentCostEstimateForShipGroup?exists>
> -                          <@ofbizCurrency amount=shipmentCostEstimateForShipGroup isoCode=orderReadHelper.getCurrency()?if_exists/>
> -                          <br/>
> -                      </#if>
> -                    </td>
> -                    <td>&nbsp;</td>
> -                    <td valign="top">
> -                      <span class="label">${uiLabelMap.OrderInstructions}</span>
> -                      <br/>
> -                      ${orderItemShipGroup.shippingInstructions?default("(${uiLabelMap.CommonNone})")}
> -                    </td>
> -                  </tr>
> -                </table>
> -              </#if>
> -
> -              <!-- manual per item form -->
> -              <#if showInput != "N">
> -                <hr/>
> -                <form name="singlePackForm" method="post" action="<@o...@ofbizUrl>">
> -                  <input type="hidden" name="packageSeq" value="${packingSession.getCurrentPackageSeq()}"/>
> -                  <input type="hidden" name="orderId" value="${orderId}"/>
> -                  <input type="hidden" name="shipGroupSeqId" value="${shipGroupSeqId}"/>
> -                  <input type="hidden" name="facilityId" value="${facilityId?if_exists}"/>
> -                  <input type="hidden" name="hideGrid" value="${hideGrid}"/>
> -                  <table cellpadding="2" cellspacing="0" class="basic-table">
> -                    <tr>
> -                      <td>
> -                        <div>
> -                            <span class="label">${uiLabelMap.ProductProductNumber}</span>
> -                            <input type="text" name="productId" size="20" maxlength="20" value=""/>
> -                            @
> -                            <input type="text" name="quantity" size="6" maxlength="6" value="1"/>
> -                            <a href="javascript:document.singlePackForm.submit();" class="buttontext">${uiLabelMap.ProductPackItem}</a>
> -                        </div>
> -                      </td>
> -                      <td>
> -                          <span class="label">${uiLabelMap.ProductCurrentPackageSequence}</span>
> -                          ${packingSession.getCurrentPackageSeq()}
> -                          <input type="button" value="${uiLabelMap.ProductNextPackage}" onclick="javascript:document.incPkgSeq.submit();">
> -                      </td>
> -                    </tr>
> -                  </table>
> -                </form>
> -              </#if>
> +        <#if showInput != "N" && ((orderHeader?exists && orderHeader?has_content))>
> +            <div class="screenlet">
> +                <div class="screenlet-title-bar">
> +                    <ul>
> +                        <li class="h3">${uiLabelMap.ProductOrderId} #<a href="/ordermgr/control/orderview?orderId=${orderId}">${orderId}</a> / ${uiLabelMap.ProductOrderShipGroupId} #${shipGroupSeqId}</li>
> +                    </ul>
> +                    <br class="clear"/>
> +                </div>
> +                <div class="screenlet-body">
> +                    <#if orderItemShipGroup?has_content>
> +                        <#assign postalAddress = orderItemShipGroup.getRelatedOne("PostalAddress")>
> +                        <#assign carrier = orderItemShipGroup.carrierPartyId?default("N/A")>
> +                        <table cellpadding="4" cellspacing="4" class="basic-table">
> +                            <tr>
> +                                <td valign="top">
> +                                    <span class="label">${uiLabelMap.ProductShipToAddress}</span>
> +                                    <br/>
> +                                    ${uiLabelMap.CommonTo}: ${postalAddress.toName?default("")}
> +                                    <br/>
> +                                    <#if postalAddress.attnName?has_content>
> +                                        ${uiLabelMap.CommonAttn}: ${postalAddress.attnName}
> +                                        <br/>
> +                                    </#if>
> +                                    ${postalAddress.address1}
> +                                    <br/>
> +                                    <#if postalAddress.address2?has_content>
> +                                        ${postalAddress.address2}
> +                                        <br/>
> +                                    </#if>
> +                                    ${postalAddress.city?if_exists}, ${postalAddress.stateProvinceGeoId?if_exists} ${postalAddress.postalCode?if_exists}
> +                                    <br/>
> +                                    ${postalAddress.countryGeoId}
> +                                    <br/>
> +                                </td>
> +                                <td>&nbsp;</td>
> +                                <td valign="top">
> +                                    <span class="label">${uiLabelMap.ProductCarrierShipmentMethod}</span>
> +                                    <br/>
> +                                    <#if carrier == "USPS">
> +                                        <#assign color = "red">
> +                                    <#elseif carrier == "UPS">
> +                                        <#assign color = "green">
> +                                    <#else>
> +                                        <#assign color = "black">
> +                                    </#if>
> +                                    <#if carrier != "_NA_">
> +                                        <font color="${color}">${carrier}</font>
> +                                        &nbsp;
> +                                    </#if>
> +                                    ${orderItemShipGroup.shipmentMethodTypeId?default("??")}
> +                                    <br/>
> +                                    <span class="label">${uiLabelMap.ProductEstimatedShipCostForShipGroup}</span>
> +                                    <br/>
> +                                    <#if shipmentCostEstimateForShipGroup?exists>
> +                                        <@ofbizCurrency amount=shipmentCostEstimateForShipGroup isoCode=orderReadHelper.getCurrency()?if_exists/>
> +                                        <br/>
> +                                    </#if>
> +                                </td>
> +                                <td>&nbsp;</td>
> +                                <td valign="top">
> +                                    <span class="label">${uiLabelMap.OrderInstructions}</span>
> +                                    <br/>
> +                                    ${orderItemShipGroup.shippingInstructions?default("(${uiLabelMap.CommonNone})")}
> +                                </td>
> +                            </tr>
> +                        </table>
> +                    </#if>
>  
> -              <!-- auto grid form -->
> -              <#assign itemInfos = packingSession.getItemInfos()?if_exists>
> -              <#if showInput != "N" && hideGrid != "Y" && itemInfos?has_content>
> -                <br/>
> -                <form name="multiPackForm" method="post" action="<@o...@ofbizUrl>">
> -                  <input type="hidden" name="facilityId" value="${facilityId?if_exists}">
> -                  <input type="hidden" name="orderId" value="${orderId?if_exists}">
> -                  <input type="hidden" name="shipGroupSeqId" value="${shipGroupSeqId?if_exists}">
> -                  <input type="hidden" name="originFacilityId" value="${facilityId?if_exists}">
> -                  <input type="hidden" name="hideGrid" value="${hideGrid}"/>
> +                    <!-- manual per item form -->
> +                    <#if showInput != "N">
> +                        <hr/>
> +                        <form name="singlePackForm" method="post" action="<@o...@ofbizUrl>">
> +                            <input type="hidden" name="packageSeq" value="${packingSession.getCurrentPackageSeq()}"/>
> +                            <input type="hidden" name="orderId" value="${orderId}"/>
> +                            <input type="hidden" name="shipGroupSeqId" value="${shipGroupSeqId}"/>
> +                            <input type="hidden" name="facilityId" value="${facilityId?if_exists}"/>
> +                            <input type="hidden" name="hideGrid" value="${hideGrid}"/>
> +                            <table cellpadding="2" cellspacing="0" class="basic-table">
> +                                <tr>
> +                                    <td>
> +                                        <div>
> +                                            <span class="label">${uiLabelMap.ProductProductNumber}</span>
> +                                            <input type="text" name="productId" size="20" maxlength="20" value=""/>
> +                                            @
> +                                            <input type="text" name="quantity" size="6" maxlength="6" value="1"/>
> +                                            <a href="javascript:document.singlePackForm.submit();" class="buttontext">${uiLabelMap.ProductPackItem}</a>
> +                                        </div>
> +                                    </td>
> +                                    <td>
> +                                        <span class="label">${uiLabelMap.ProductCurrentPackageSequence}</span>
> +                                        ${packingSession.getCurrentPackageSeq()}
> +                                        <input type="button" value="${uiLabelMap.ProductNextPackage}" onclick="javascript:document.incPkgSeq.submit();">
> +                                    </td>
> +                                </tr>
> +                            </table>
> +                        </form>
> +                    </#if>
>  
> -                  <table class="basic-table" cellspacing='0'>
> -                    <tr class="header-row">
> -                      <td>&nbsp;</td>
> -                      <td>${uiLabelMap.ProductItem} #</td>
> -                      <td>${uiLabelMap.ProductProductId}</td>
> -                      <td>${uiLabelMap.ProductInternalName}</td>
> -                      <td align="right">${uiLabelMap.ProductOrderedQuantity}</td>
> -                      <td align="right">${uiLabelMap.ProductQuantityShipped}</td>
> -                      <td align="right">${uiLabelMap.ProductPackedQty}</td>
> -                      <td>&nbsp;</td>
> -                      <td align="center">${uiLabelMap.ProductPackQty}</td>
> -                      <td align="center">${uiLabelMap.ProductPackedWeight}&nbsp;(${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultWeightUomId)?eval})</td>
> -                      <td align="center">${uiLabelMap.ProductPackage}</td>
> -                      <td align="right">&nbsp;<b>*</b>&nbsp;${uiLabelMap.ProductPackages}</td>
> -                    </tr>
> +                    <!-- auto grid form -->
> +                    <#assign itemInfos = packingSession.getItemInfos()?if_exists>
> +                    <#if showInput != "N" && hideGrid != "Y" && itemInfos?has_content>
> +                        <br/>
> +                        <form name="multiPackForm" method="post" action="<@o...@ofbizUrl>">
> +                            <input type="hidden" name="facilityId" value="${facilityId?if_exists}">
> +                            <input type="hidden" name="orderId" value="${orderId?if_exists}">
> +                            <input type="hidden" name="shipGroupSeqId" value="${shipGroupSeqId?if_exists}">
> +                            <input type="hidden" name="originFacilityId" value="${facilityId?if_exists}">
> +                            <input type="hidden" name="hideGrid" value="${hideGrid}"/>
> +                            <table class="basic-table" cellspacing='0'>
> +                                <tr class="header-row">
> +                                    <td>&nbsp;</td>
> +                                    <td>${uiLabelMap.ProductItem} #</td>
> +                                    <td>${uiLabelMap.ProductProductId}</td>
> +                                    <td>${uiLabelMap.ProductInternalName}</td>
> +                                    <td align="right">${uiLabelMap.ProductOrderedQuantity}</td>
> +                                    <td align="right">${uiLabelMap.ProductQuantityShipped}</td>
> +                                    <td align="right">${uiLabelMap.ProductPackedQty}</td>
> +                                    <td>&nbsp;</td>
> +                                    <td align="center">${uiLabelMap.ProductPackQty}</td>
> +                                    <td align="center">${uiLabelMap.ProductPackedWeight}&nbsp;(${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultWeightUomId)?eval})</td>
> +                                    <td align="center">${uiLabelMap.ProductPackage}</td>
> +                                    <td align="right">&nbsp;<b>*</b>&nbsp;${uiLabelMap.ProductPackages}</td>
> +                                </tr>
> +                                <#if (itemInfos?has_content)>
> +                                    <#assign rowKey = 1>
> +                                    <#list itemInfos as itemInfo>
> +                                    <#-- <#list itemInfos as orderItem>  -->
> +                                        <#assign orderItem = itemInfo.orderItem/>
> +                                        <#assign shippedQuantity = orderReadHelper.getItemShippedQuantity(orderItem)?if_exists>
> +                                        <#assign orderItemQuantity = itemInfo.quantity/>
> +                                        <#assign orderProduct = orderItem.getRelatedOne("Product")?if_exists/>
> +                                        <#assign product = Static["org.ofbiz.product.product.ProductWorker"].findProduct(delegator, itemInfo.productId)?if_exists/>
> +                                    <#--
> +                                        <#if orderItem.cancelQuantity?exists>
> +                                            <#assign orderItemQuantity = orderItem.quantity - orderItem.cancelQuantity>
> +                                        <#else>
> +                                            <#assign orderItemQuantity = orderItem.quantity>
> +                                        </#if>
> +                                    -->
> +                                        <#assign inputQty = orderItemQuantity - packingSession.getPackedQuantity(orderId, orderItem.orderItemSeqId, shipGroupSeqId, itemInfo.productId)>
> +                                        <tr>
> +                                            <td><input type="checkbox" name="sel_${rowKey}" value="Y" <#if (inputQty >0)>checked=""</#if>/></td>
> +                                            <td>${orderItem.orderItemSeqId}</td>
> +                                            <td>
> +                                                ${orderProduct.productId?default("N/A")}
> +                                                <#if orderProduct.productId != product.productId>
> +                                                    &nbsp;${product.productId?default("N/A")}
> +                                                </#if>
> +                                            </td>
> +                                            <td>
> +                                                <a href="/catalog/control/EditProduct?productId=${orderProduct.productId?if_exists}${externalKeyParam}" class="buttontext" target="_blank">${(orderProduct.internalName)?if_exists}</a>
> +                                                <#if orderProduct.productId != product.productId>
> +                                                    &nbsp;[<a href="/catalog/control/EditProduct?productId=${product.productId?if_exists}${externalKeyParam}" class="buttontext" target="_blank">${(product.internalName)?if_exists}</a>]
> +                                                </#if>
> +                                            </td>
> +                                            <td align="right">${orderItemQuantity}</td>
> +                                            <td align="right">${shippedQuantity?default(0)}</td>
> +                                            <td align="right">${packingSession.getPackedQuantity(orderId, orderItem.orderItemSeqId, shipGroupSeqId, itemInfo.productId)}</td>
> +                                            <td>&nbsp;</td>
> +                                            <td align="center">
> +                                                <input type="text" size="7" name="qty_${rowKey}" value="${inputQty}">
> +                                            </td>
> +                                            <td align="center">
> +                                                <input type="text" size="7" name="wgt_${rowKey}" value="">
> +                                            </td>
> +                                            <td align="center">
> +                                                <select name="pkg_${rowKey}">
> +                                                    <#if packingSession.getPackageSeqIds()?exists>
> +                                                        <#list packingSession.getPackageSeqIds() as packageSeqId>
> +                                                            <option value="${packageSeqId}">${uiLabelMap.ProductPackage} ${packageSeqId}</option>
> +                                                        </#list>
> +                                                        <#assign nextPackageSeqId = packingSession.getPackageSeqIds().size() + 1>
> +                                                        <option value="${nextPackageSeqId}">${uiLabelMap.ProductNextPackage}</option>
> +                                                    <#else>
> +                                                        <option value="1">${uiLabelMap.ProductPackage} 1</option>
> +                                                        <option value="2">${uiLabelMap.ProductPackage} 2</option>
> +                                                        <option value="3">${uiLabelMap.ProductPackage} 3</option>
> +                                                        <option value="4">${uiLabelMap.ProductPackage} 4</option>
> +                                                        <option value="5">${uiLabelMap.ProductPackage} 5</option>
> +                                                    </#if>
> +                                                </select>
> +                                            </td>
> +                                            <td align="right">
> +                                                <input type="text" size="7" name="numPackages_${rowKey}" value="1">
> +                                            </td>
> +                                            <input type="hidden" name="prd_${rowKey}" value="${itemInfo.productId?if_exists}"/>
> +                                            <input type="hidden" name="ite_${rowKey}" value="${orderItem.orderItemSeqId}"/>
> +                                        </tr>
> +                                        <#assign rowKey = rowKey + 1>
> +                                    </#list>
> +                                </#if>
> +                                <tr><td colspan="10">&nbsp;</td></tr>
> +                                <tr>
> +                                    <td colspan="12" align="right">
> +                                        <input type="submit" value="${uiLabelMap.ProductPackItem}">
> +                                        &nbsp;
> +                                        <input type="button" value="${uiLabelMap.CommonClear} (${uiLabelMap.CommonAll})" onclick="javascript:document.clearPackForm.submit();"/>
> +                                    </td>
> +                                </tr>
> +                            </table>
> +                        </form>
> +                        <br/>
> +                    </#if>
>  
> -                    <#if (itemInfos?has_content)>
> -                      <#assign rowKey = 1>
> -                      <#list itemInfos as itemInfo>
> -                      <#-- <#list itemInfos as orderItem>  -->
> -                        <#assign orderItem = itemInfo.orderItem/>
> -                        <#assign shippedQuantity = orderReadHelper.getItemShippedQuantity(orderItem)?if_exists>
> -                        <#assign orderItemQuantity = itemInfo.quantity/>
> -                        <#assign orderProduct = orderItem.getRelatedOne("Product")?if_exists/>
> -                        <#assign product = Static["org.ofbiz.product.product.ProductWorker"].findProduct(delegator, itemInfo.productId)?if_exists/>
> -                        <#--
> -                        <#if orderItem.cancelQuantity?exists>
> -                          <#assign orderItemQuantity = orderItem.quantity - orderItem.cancelQuantity>
> -                        <#else>
> -                          <#assign orderItemQuantity = orderItem.quantity>
> -                        </#if>
> -                        -->
> -                        <#assign inputQty = orderItemQuantity - packingSession.getPackedQuantity(orderId, orderItem.orderItemSeqId, shipGroupSeqId, itemInfo.productId)>
> -                        <tr>
> -                          <td><input type="checkbox" name="sel_${rowKey}" value="Y" <#if (inputQty >0)>checked=""</#if>/></td>
> -                          <td>${orderItem.orderItemSeqId}</td>
> -                          <td>
> -                              ${orderProduct.productId?default("N/A")}
> -                              <#if orderProduct.productId != product.productId>
> -                                  &nbsp;${product.productId?default("N/A")}
> -                              </#if>
> -                          </td>
> -                          <td>
> -                              <a href="/catalog/control/EditProduct?productId=${orderProduct.productId?if_exists}${externalKeyParam}" class="buttontext" target="_blank">${(orderProduct.internalName)?if_exists}</a>
> -                              <#if orderProduct.productId != product.productId>
> -                                  &nbsp;[<a href="/catalog/control/EditProduct?productId=${product.productId?if_exists}${externalKeyParam}" class="buttontext" target="_blank">${(product.internalName)?if_exists}</a>]
> -                              </#if>
> -                          </td>
> -                          <td align="right">${orderItemQuantity}</td>
> -                          <td align="right">${shippedQuantity?default(0)}</td>
> -                          <td align="right">${packingSession.getPackedQuantity(orderId, orderItem.orderItemSeqId, shipGroupSeqId, itemInfo.productId)}</td>
> -                          <td>&nbsp;</td>
> -                          <td align="center">
> -                            <input type="text" size="7" name="qty_${rowKey}" value="${inputQty}">
> -                          </td>
> -                          <td align="center">
> -                            <input type="text" size="7" name="wgt_${rowKey}" value="">
> -                          </td>
> -                          <td align="center">
> -                            <select name="pkg_${rowKey}">
> -                              <#if packingSession.getPackageSeqIds()?exists>
> -                                <#list packingSession.getPackageSeqIds() as packageSeqId>
> -                                  <option value="${packageSeqId}">${uiLabelMap.ProductPackage} ${packageSeqId}</option>
> -                                </#list>
> -                                <#assign nextPackageSeqId = packingSession.getPackageSeqIds().size() + 1>
> -                                <option value="${nextPackageSeqId}">${uiLabelMap.ProductNextPackage}</option>
> -                              <#else>
> -                                <option value="1">${uiLabelMap.ProductPackage} 1</option>
> -                                <option value="2">${uiLabelMap.ProductPackage} 2</option>
> -                                <option value="3">${uiLabelMap.ProductPackage} 3</option>
> -                                <option value="4">${uiLabelMap.ProductPackage} 4</option>
> -                                <option value="5">${uiLabelMap.ProductPackage} 5</option>
> -                              </#if>
> -                            </select>
> -                          </td>
> -                          <td align="right">
> -                            <input type="text" size="7" name="numPackages_${rowKey}" value="1">
> -                          </td>
> -                          <input type="hidden" name="prd_${rowKey}" value="${itemInfo.productId?if_exists}"/>
> -                          <input type="hidden" name="ite_${rowKey}" value="${orderItem.orderItemSeqId}"/>
> -                        </tr>
> -                        <#assign rowKey = rowKey + 1>
> -                      </#list>
> +                    <!-- complete form -->
> +                    <#if showInput != "N">
> +                        <form name="completePackForm" method="post" action="<@o...@ofbizUrl>">
> +                            <input type="hidden" name="orderId" value="${orderId?if_exists}"/>
> +                            <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="shipmentId" value="${(shipment.shipmentId)?default("")}"/>
> +                            <input type="hidden" name="invoiceId" value="${(invoice.invoiceId)?default("")}"/>
> +                            <input type="hidden" name="showInput" value="N"/>
> +                            <hr>
> +                            <table class="basic-table" cellpadding="2" cellspacing='0'>
> +                                <tr>
> +                                    <#assign packageSeqIds = packingSession.getPackageSeqIds()/>
> +                                    <#if packageSeqIds?has_content>
> +                                        <td>
> +                                            <span class="label">${uiLabelMap.ProductPackedWeight} (${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultWeightUomId)?eval}):</span>
> +                                            <br/>
> +                                            <#list packageSeqIds as packageSeqId>
> +                                                ${uiLabelMap.ProductPackage} ${packageSeqId}
> +                                                <input type="text" 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>
> +                                         </td>
> +                                    </#if>
> +                                    <td nowrap="nowrap">
> +                                        <span class="label">${uiLabelMap.ProductAdditionalShippingCharge}:</span>
> +                                        <br/>
> +                                        <input type="text" name="additionalShippingCharge" value="${packingSession.getAdditionalShippingCharge()?if_exists}" size="20"/>
> +                                        <#if packageSeqIds?has_content>
> +                                            <a href="javascript:document.completePackForm.action='<@o...@ofbizUrl>';document.completePackForm.submit();" class="buttontext">${uiLabelMap.ProductEstimateShipCost}</a>
> +                                            <br/>
> +                                        </#if>
> +                                    </td>
> +                                    <td>
> +                                        <span class="label">${uiLabelMap.ProductHandlingInstructions}:</span>
> +                                        <br/>
> +                                        <textarea name="handlingInstructions" rows="2" cols="30">${packingSession.getHandlingInstructions()?if_exists}</textarea>
> +                                    </td>
> +                                    <td align="right">
> +                                        <div>
> +                                            <#assign buttonName = "${uiLabelMap.ProductComplete}">
> +                                            <#if forceComplete?default("false") == "true">
> +                                                <#assign buttonName = "${uiLabelMap.ProductCompleteForce}">
> +                                            </#if>
> +                                            <input type="button" value="${buttonName}" onclick="javascript:document.completePackForm.submit();"/>
> +                                        </div>
> +                                     </td>
> +                                 </tr>
> +                             </table>
> +                            <br/>
> +                        </form>
>                      </#if>
> -                    <tr><td colspan="10">&nbsp;</td></tr>
> -                    <tr>
> -                      <td colspan="12" align="right">
> -                        <input type="submit" value="${uiLabelMap.ProductPackItem}">
> -                        &nbsp;
> -                        <input type="button" value="${uiLabelMap.CommonClear} (${uiLabelMap.CommonAll})" onclick="javascript:document.clearPackForm.submit();"/>
> -                      </td>
> -                    </tr>
> -                  </table>
> -                </form>
> -                <br/>
> -              </#if>
> +                </div>
> +            </div>
>  
> -              <!-- complete form -->
> -              <#if showInput != "N">
> -                <form name="completePackForm" method="post" action="<@o...@ofbizUrl>">
> -                  <input type="hidden" name="orderId" value="${orderId?if_exists}"/>
> -                  <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="shipmentId" value="${(shipment.shipmentId)?default("")}"/>
> -                  <input type="hidden" name="invoiceId" value="${(invoice.invoiceId)?default("")}"/>
> -                  <input type="hidden" name="showInput" value="N"/>
> -                  <hr>
> -                  <table class="basic-table" cellpadding="2" cellspacing='0'>
> -                    <tr>
> -                        <#assign packageSeqIds = packingSession.getPackageSeqIds()/>
> -                        <#if packageSeqIds?has_content>
> -                            <td>
> -                                <span class="label">${uiLabelMap.ProductPackedWeight} (${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultWeightUomId)?eval}):</span>
> +            <!-- display items in packages, per packed package and in order -->
> +            <#assign linesByPackageResultMap = packingSession.getPackingSessionLinesByPackage()?if_exists>
> +            <#assign packageMap = linesByPackageResultMap.get("packageMap")?if_exists>
> +            <#assign sortedKeys = linesByPackageResultMap.get("sortedKeys")?if_exists>
> +            <#if ((packageMap?has_content) && (sortedKeys?has_content))>
> +                <div class="screenlet">
> +                    <div class="screenlet-title-bar">
> +                        <ul>
> +                            <li class="h3">${uiLabelMap.ProductPackages} : ${sortedKeys.size()?if_exists}</li>
> +                        </ul>
> +                        <br class="clear"/>
> +                    </div>
> +                    <div class="screenlet-body">
> +                        <#list sortedKeys as key>
> +                            <#assign packedLines = packageMap.get(key)>
> +                            <#if packedLines?has_content>
>                                  <br/>
> -                                <#list packageSeqIds as packageSeqId>
> -                                    ${uiLabelMap.ProductPackage} ${packageSeqId}
> -                                    <input type="text" 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>
> -                            </td>
> -                        </#if>
> -                        <td nowrap="nowrap">
> -                            <span class="label">${uiLabelMap.ProductAdditionalShippingCharge}:</span>
> -                            <br/>
> -                            <input type="text" name="additionalShippingCharge" value="${packingSession.getAdditionalShippingCharge()?if_exists}" size="20"/>
> -                            <#if packageSeqIds?has_content>
> -                                <a href="javascript:document.completePackForm.action='<@o...@ofbizUrl>';document.completePackForm.submit();" class="buttontext">${uiLabelMap.ProductEstimateShipCost}</a>
> +                                <#assign packedLine = packedLines.get(0)?if_exists>
> +                                <span class="label" style="font-size:1.2em">${uiLabelMap.ProductPackage}&nbsp;${packedLine.getPackageSeq()?if_exists}</span>
>                                  <br/>
> +                                <table class="basic-table" cellspacing='0'>
> +                                    <tr class="header-row">
> +                                        <td>${uiLabelMap.ProductItem} #</td>
> +                                        <td>${uiLabelMap.ProductProductId}</td>
> +                                        <td>${uiLabelMap.ProductProductDescription}</td>
> +                                        <td>${uiLabelMap.ProductInventoryItem} #</td>
> +                                        <td align="right">${uiLabelMap.ProductPackedQty}</td>
> +                                        <td align="right">${uiLabelMap.ProductPackedWeight}&nbsp;(${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultWeightUomId)?eval})&nbsp;(${uiLabelMap.ProductPackage})</td>
> +                                        <td align="right">${uiLabelMap.ProductPackage} #</td>
> +                                        <td>&nbsp;</td>
> +                                    </tr>
> +                                    <#list packedLines as line>
> +                                        <#assign product = Static["org.ofbiz.product.product.ProductWorker"].findProduct(delegator, line.getProductId())/>
> +                                        <tr>
> +                                            <td>${line.getOrderItemSeqId()}</td>
> +                                            <td>${line.getProductId()?default("N/A")}</td>
> +                                            <td>
> +                                                <a href="/catalog/control/EditProduct?productId=${line.getProductId()?if_exists}${externalKeyParam}" class="buttontext" target="_blank">${product.internalName?if_exists?default("[N/A]")}</a>
> +                                            </td>
> +                                            <td>${line.getInventoryItemId()}</td>
> +                                            <td align="right">${line.getQuantity()}</td>
> +                                            <td align="right">${line.getWeight()} (${packingSession.getPackageWeight(line.getPackageSeq()?int)?if_exists})</td>
> +                                            <td align="right">${line.getPackageSeq()}</td>
> +                                            <td align="right"><a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonClear}</a></td>
> +                                        </tr>
> +                                    </#list>
> +                                </table>
>                              </#if>
> -                        </td>
> -                      <td>
> -                        <span class="label">${uiLabelMap.ProductHandlingInstructions}:</span>
> -                        <br/>
> -                        <textarea name="handlingInstructions" rows="2" cols="30">${packingSession.getHandlingInstructions()?if_exists}</textarea>
> -                      </td>
> -                      <td align="right">
> -                        <div>
> -                          <#assign buttonName = "${uiLabelMap.ProductComplete}">
> -                          <#if forceComplete?default("false") == "true">
> -                            <#assign buttonName = "${uiLabelMap.ProductCompleteForce}">
> -                          </#if>
> -                          <input type="button" value="${buttonName}" onclick="javascript:document.completePackForm.submit();"/>
> -                        </div>
> -                      </td>
> -                    </tr>
> -                  </table>
> -                  <br/>
> -                </form>
> -              </#if>
> -        </div>
> -    </div>
> +                        </#list>
> +                    </div>
> +                </div>
> +            </#if>
>  
> -    <!-- display items in packages, per packed package and in order -->
> -    <#assign linesByPackageResultMap = packingSession.getPackingSessionLinesByPackage()?if_exists>
> -    <#assign packageMap = linesByPackageResultMap.get("packageMap")?if_exists>
> -    <#assign sortedKeys = linesByPackageResultMap.get("sortedKeys")?if_exists>
> -    <#if ((packageMap?has_content) && (sortedKeys?has_content))>
> -      <div class="screenlet">
> -        <div class="screenlet-title-bar">
> -            <ul>
> -                <li class="h3">${uiLabelMap.ProductPackages} : ${sortedKeys.size()?if_exists}</li>
> -            </ul>
> -            <br class="clear"/>
> -        </div>
> -          <div class="screenlet-body">
> -            <#list sortedKeys as key>
> -              <#assign packedLines = packageMap.get(key)>
> -              <#if packedLines?has_content>
> -                <br/>
> -                <#assign packedLine = packedLines.get(0)?if_exists>
> -                <span class="label" style="font-size:1.2em">${uiLabelMap.ProductPackage}&nbsp;${packedLine.getPackageSeq()?if_exists}</span>
> -                <br/>
> -                <table class="basic-table" cellspacing='0'>
> -                  <tr class="header-row">
> -                    <td>${uiLabelMap.ProductItem} #</td>
> -                    <td>${uiLabelMap.ProductProductId}</td>
> -                    <td>${uiLabelMap.ProductProductDescription}</td>
> -                    <td>${uiLabelMap.ProductInventoryItem} #</td>
> -                    <td align="right">${uiLabelMap.ProductPackedQty}</td>
> -                    <td align="right">${uiLabelMap.ProductPackedWeight}&nbsp;(${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultWeightUomId)?eval})&nbsp;(${uiLabelMap.ProductPackage})</td>
> -                    <td align="right">${uiLabelMap.ProductPackage} #</td>
> -                    <td>&nbsp;</td>
> -                  </tr>
> -                  <#list packedLines as line>
> -                    <#assign product = Static["org.ofbiz.product.product.ProductWorker"].findProduct(delegator, line.getProductId())/>
> -                    <tr>
> -                      <td>${line.getOrderItemSeqId()}</td>
> -                      <td>${line.getProductId()?default("N/A")}</td>
> -                      <td>
> -                          <a href="/catalog/control/EditProduct?productId=${line.getProductId()?if_exists}${externalKeyParam}" class="buttontext" target="_blank">${product.internalName?if_exists?default("[N/A]")}</a>
> -                      </td>
> -                      <td>${line.getInventoryItemId()}</td>
> -                      <td align="right">${line.getQuantity()}</td>
> -                      <td align="right">${line.getWeight()} (${packingSession.getPackageWeight(line.getPackageSeq()?int)?if_exists})</td>
> -                      <td align="right">${line.getPackageSeq()}</td>
> -                      <td align="right"><a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonClear}</a></td>
> -                    </tr>
> -                  </#list>
> -                </table>
> -              </#if>
> -            </#list>
> -          </div>
> -      </div>
> +            <!-- packed items display -->
> +            <#assign packedLines = packingSession.getLines()?if_exists>
> +            <#if packedLines?has_content>
> +                <div class="screenlet">
> +                    <div class="screenlet-title-bar">
> +                        <ul>
> +                            <li class="h3">${uiLabelMap.ProductItems} (${uiLabelMap.ProductPackages}): ${packedLines.size()?if_exists}</li>
> +                        </ul>
> +                        <br class="clear"/>
> +                    </div>
> +                    <div class="screenlet-body">
> +                        <table class="basic-table" cellspacing='0'>
> +                            <tr class="header-row">
> +                                <td>${uiLabelMap.ProductItem} #</td>
> +                                <td>${uiLabelMap.ProductProductId}</td>
> +                                <td>${uiLabelMap.ProductProductDescription}</td>
> +                                <td>${uiLabelMap.ProductInventoryItem} #</td>
> +                                <td align="right">${uiLabelMap.ProductPackedQty}</td>
> +                                <td align="right">${uiLabelMap.ProductPackedWeight}&nbsp;(${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultWeightUomId)?eval})&nbsp;(${uiLabelMap.ProductPackage})</td>
> +                                <td align="right">${uiLabelMap.ProductPackage} #</td>
> +                                <td>&nbsp;</td>
> +                            </tr>
> +                            <#list packedLines as line>
> +                                <#assign product = Static["org.ofbiz.product.product.ProductWorker"].findProduct(delegator, line.getProductId())/>
> +                                <tr>
> +                                    <td>${line.getOrderItemSeqId()}</td>
> +                                    <td>${line.getProductId()?default("N/A")}</td>
> +                                    <td>
> +                                        <a href="/catalog/control/EditProduct?productId=${line.getProductId()?if_exists}${externalKeyParam}" class="buttontext" target="_blank">${product.internalName?if_exists?default("[N/A]")}</a>
> +                                    </td>
> +                                    <td>${line.getInventoryItemId()}</td>
> +                                    <td align="right">${line.getQuantity()}</td>
> +                                    <td align="right">${line.getWeight()} (${packingSession.getPackageWeight(line.getPackageSeq()?int)?if_exists})</td>
> +                                    <td align="right">${line.getPackageSeq()}</td>
> +                                    <td align="right"><a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonClear}</a></td>
> +                                </tr>
> +                            </#list>
> +                        </table>
> +                    </div>
> +                </div>
> +            </#if>
> +        </#if>
>      </#if>
>  
> -    <!-- packed items display -->
> -    <#assign packedLines = packingSession.getLines()?if_exists>
> -    <#if packedLines?has_content>
> -      <div class="screenlet">
> -          <div class="screenlet-title-bar">
> -              <ul>
> -                  <li class="h3">${uiLabelMap.ProductItems} (${uiLabelMap.ProductPackages}): ${packedLines.size()?if_exists}</li>
> -              </ul>
> -              <br class="clear"/>
> -          </div>
> -          <div class="screenlet-body">
> -            <table class="basic-table" cellspacing='0'>
> -              <tr class="header-row">
> -                  <td>${uiLabelMap.ProductItem} #</td>
> -                  <td>${uiLabelMap.ProductProductId}</td>
> -                  <td>${uiLabelMap.ProductProductDescription}</td>
> -                  <td>${uiLabelMap.ProductInventoryItem} #</td>
> -                  <td align="right">${uiLabelMap.ProductPackedQty}</td>
> -                  <td align="right">${uiLabelMap.ProductPackedWeight}&nbsp;(${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultWeightUomId)?eval})&nbsp;(${uiLabelMap.ProductPackage})</td>
> -                  <td align="right">${uiLabelMap.ProductPackage} #</td>
> -                  <td>&nbsp;</td>
> -              </tr>
> -              <#list packedLines as line>
> -                  <#assign product = Static["org.ofbiz.product.product.ProductWorker"].findProduct(delegator, line.getProductId())/>
> -                  <tr>
> -                      <td>${line.getOrderItemSeqId()}</td>
> -                      <td>${line.getProductId()?default("N/A")}</td>
> -                      <td>
> -                          <a href="/catalog/control/EditProduct?productId=${line.getProductId()?if_exists}${externalKeyParam}" class="buttontext" target="_blank">${product.internalName?if_exists?default("[N/A]")}</a>
> -                      </td>
> -                      <td>${line.getInventoryItemId()}</td>
> -                      <td align="right">${line.getQuantity()}</td>
> -                      <td align="right">${line.getWeight()} (${packingSession.getPackageWeight(line.getPackageSeq()?int)?if_exists})</td>
> -                      <td align="right">${line.getPackageSeq()}</td>
> -                      <td align="right"><a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonClear}</a></td>
> -                  </tr>
> -              </#list>
> -            </table>
> -          </div>
> -      </div>
> +    <#if orderId?has_content>
> +        <script language="javascript">
> +            document.singlePackForm.productId.focus();
> +        </script>
> +    <#else>
> +        <script language="javascript">
> +            document.selectOrderForm.orderId.focus();
> +        </script>
>      </#if>
> -  </#if>
> -
> -  <#if orderId?has_content>
> -    <script language="javascript">
> -      document.singlePackForm.productId.focus();
> -    </script>
> -  <#else>
> -    <script language="javascript">
> -      document.selectOrderForm.orderId.focus();
> -    </script>
> -  </#if>
> -  </div>
> -  </div>
> -  </#if>
>  <#else>
> -  <h3>${uiLabelMap.ProductFacilityViewPermissionError}</h3>
> +    <h3>${uiLabelMap.ProductFacilityViewPermissionError}</h3>
>  </#if>
> \ No newline at end of file
>
>
>
>