svn commit: r519117 - in /ofbiz/trunk/applications/order: config/ webapp/ordermgr/WEB-INF/ webapp/ordermgr/WEB-INF/actions/order/ webapp/ordermgr/order/ widget/ordermgr/

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

svn commit: r519117 - in /ofbiz/trunk/applications/order: config/ webapp/ordermgr/WEB-INF/ webapp/ordermgr/WEB-INF/actions/order/ webapp/ordermgr/order/ widget/ordermgr/

sichen
Author: sichen
Date: Fri Mar 16 12:58:24 2007
New Revision: 519117

URL: http://svn.apache.org/viewvc?view=rev&rev=519117
Log:
Added PDF for ship groups.  It displays the contents of each ship group on a page by page basis.

Added:
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh
    ofbiz/trunk/applications/order/webapp/ordermgr/order/shipGroups.fo.ftl
Modified:
    ofbiz/trunk/applications/order/config/OrderUiLabels.properties
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
    ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl
    ofbiz/trunk/applications/order/widget/ordermgr/OrderPrintForms.xml

Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderUiLabels.properties?view=diff&rev=519117&r1=519116&r2=519117
==============================================================================
--- ofbiz/trunk/applications/order/config/OrderUiLabels.properties (original)
+++ ofbiz/trunk/applications/order/config/OrderUiLabels.properties Fri Mar 16 12:58:24 2007
@@ -428,6 +428,8 @@
 OrderQty=Qty
 OrderQuantity=Quantity
 OrderQuantityCancelled=Qty Cncld
+OrderQuantityInShipGroup=In Group
+OrderQuantityInShipGroupTotal=Total In Group
 OrderQuantityPurchase=Qty Purch
 OrderQuantitySold=Qty Sold
 OrderQuantityUom=Unity of measure

Added: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh?view=auto&rev=519117
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh (added)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh Fri Mar 16 12:58:24 2007
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javolution.util.FastMap;
+import javolution.util.FastList;
+
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.entity.util.EntityUtil;
+
+orderId = parameters.get("orderId");
+if (orderId == null) return;
+
+shipGroups = delegator.findByAnd("OrderItemShipGroup", UtilMisc.toMap("orderId", orderId), UtilMisc.toList("shipGroupSeqId"));
+context.put("shipGroups", shipGroups);
+
+// method to expand the marketing packages
+FastList expandProductGroup(product, quantity) {
+    sublines = FastList.newInstance();
+    associations = product.getRelatedByAnd("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "MANUF_COMPONENT"));
+    associations = EntityUtil.filterByDate( associations );
+    for (iter = associations.iterator(); iter.hasNext(); ) {
+        association = iter.next();
+        line = FastMap.newInstance();
+        line.put("product", association.getRelatedOne("AssocProduct"));
+
+        // determine the quantity
+        quantityComposed = association.getDouble("quantity");
+        quantityInGroup = quantity * (quantityComposed == null ? 0 : quantityComposed.doubleValue());
+        line.put("quantityInGroup", new Double(quantityInGroup));
+
+        sublines.add(line);
+    }
+    return sublines;
+}
+
+groupData = FastMap.newInstance();
+for (iter = shipGroups.iterator(); iter.hasNext(); ) {
+    groupQuantity = 0;
+    shipGroup = iter.next();
+    data = FastMap.newInstance();
+
+    address = shipGroup.getRelatedOne("PostalAddress");
+    data.put("address", address);
+
+    phoneNumber = shipGroup.getRelatedOne("TelecomTelecomNumber");
+    data.put("phoneNumber", phoneNumber);
+
+    carrierShipmentMethod = shipGroup.getRelatedOne("CarrierShipmentMethod");
+    if (carrierShipmentMethod != null) {
+        data.put("carrierShipmentMethod", carrierShipmentMethod);
+        data.put("shipmentMethodType", carrierShipmentMethod.getRelatedOneCache("ShipmentMethodType"));
+    }
+
+    // the lines in a page, each line being a row of data to display
+    lines = FastList.newInstance();
+
+    orderItemAssocs = shipGroup.getRelated("OrderItemShipGroupAssoc", UtilMisc.toList("orderItemSeqId"));
+    for (oiter = orderItemAssocs.iterator(); oiter.hasNext(); ) {
+        orderItemAssoc = oiter.next();
+        orderItem = orderItemAssoc.getRelatedOne("OrderItem");
+        product = orderItem.getRelatedOne("Product");
+        line = FastMap.newInstance();
+
+        line.put("quantityInGroup", orderItemAssoc.get("quantity"));
+        line.put("orderItem", orderItem);
+        line.put("product", product);
+
+        if ("MARKETING_PKG_AUTO".equals(product.get("productTypeId"))) {
+            sublines = expandProductGroup(product, orderItemAssoc.get("quantity").doubleValue());
+            line.put("expandedList", sublines);
+            for (siter = sublines.iterator(); iter.hasNext(); ) {
+                subline = iter.next();
+                groupQuantity += subline.get("quantityInGroup").doubleValue();
+            }
+        } else {
+            groupQuantity += orderItemAssoc.get("quantity").doubleValue();
+        }
+
+        lines.add(line);
+    }
+    data.put("lines", lines);
+    data.put("groupQuantity", new Double(groupQuantity));
+
+    groupData.put(shipGroup.get("shipGroupSeqId"), data);
+}
+context.put("groupData", groupData);

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml?view=diff&rev=519117&r1=519116&r2=519117
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Fri Mar 16 12:58:24 2007
@@ -1437,6 +1437,7 @@
     <!-- PDFs -->
     <request-map uri="order.pdf"><security https="true" auth="true"/><response name="success" type="view" value="OrderPDF"/></request-map>
     <request-map uri="return.pdf"><security https="true" auth="true"/><response name="success" type="view" value="ReturnPDF"/></request-map>
+    <request-map uri="shipGroups.pdf"><security https="true" auth="true"/><response name="success" type="view" value="ShipGroupsPDF"/></request-map>
 
     <!--
         These are just examples of reports developed using JasperReport and not really
@@ -1616,6 +1617,7 @@
     <!-- PDFs  -->
     <view-map name="OrderPDF" type="screenfop" page="component://order/widget/ordermgr/OrderPrintForms.xml#OrderPDF" content-type="application/pdf" encoding="none"/>
     <view-map name="ReturnPDF" type="screenfop" page="component://order/widget/ordermgr/OrderPrintForms.xml#ReturnPDF" content-type="application/pdf" encoding="none"/>
+    <view-map name="ShipGroupsPDF" type="screenfop" page="component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF" content-type="application/pdf" encoding="none"/>
 
     <view-map name="SendConfirmationMail" type="screen" page="component://order/widget/ordermgr/OrderViewScreens.xml#SendOrderConfirmation"/>
 

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl?view=diff&rev=519117&r1=519116&r2=519117
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl Fri Mar 16 12:58:24 2007
@@ -23,6 +23,9 @@
   <#assign shipGroupAddress = shipGroup.getRelatedOne("PostalAddress")?if_exists>
   <div class="screenlet">
     <div class="screenlet-header">
+       <div class="boxlink">
+         <div class="tabletext"><a href="<@ofbizUrl>shipGroups.pdf?orderId=${orderId}</@ofbizUrl>" class="buttontext">Ship Groups PDF</a></div>
+       </div>
        <div class="boxhead">&nbsp;${uiLabelMap.OrderShipmentInformation} - ${shipGroup.shipGroupSeqId}</div>
     </div>
     <div class="screenlet-body">

Added: ofbiz/trunk/applications/order/webapp/ordermgr/order/shipGroups.fo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/shipGroups.fo.ftl?view=auto&rev=519117
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/shipGroups.fo.ftl (added)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/shipGroups.fo.ftl Fri Mar 16 12:58:24 2007
@@ -0,0 +1,175 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<#escape x as x?xml>
+
+<#list shipGroups as shipGroup>
+  <#assign data = groupData.get(shipGroup.shipGroupSeqId)>
+
+  <#-- print the order ID, ship group, and their bar codes -->
+
+  <fo:table table-layout="fixed" space-after.optimum="10pt">
+    <fo:table-column/>
+    <fo:table-column/>
+    <fo:table-body>
+      <fo:table-row>
+        <fo:table-cell>
+          <fo:block font-size="14pt">${uiLabelMap.OrderOrder} #${shipGroup.orderId}</fo:block>
+        </fo:table-cell>
+        <fo:table-cell>
+          <fo:block text-align="right">
+            <fo:instream-foreign-object>
+              <barcode:barcode xmlns:barcode="http://barcode4j.krysalis.org/ns" message="${shipGroup.orderId}">
+                <barcode:code39><barcode:height>8mm</barcode:height></barcode:code39>
+              </barcode:barcode>
+            </fo:instream-foreign-object>
+          </fo:block>
+        </fo:table-cell>
+      </fo:table-row>
+      <fo:table-row>
+        <fo:table-cell>
+          <fo:block font-size="14pt">${uiLabelMap.OrderShipGroup} #${shipGroup.shipGroupSeqId}</fo:block>
+        </fo:table-cell>
+        <fo:table-cell>
+          <fo:block text-align="right">
+            <fo:instream-foreign-object>
+              <barcode:barcode xmlns:barcode="http://barcode4j.krysalis.org/ns" message="${shipGroup.shipGroupSeqId}">
+                <barcode:code39><barcode:height>8mm</barcode:height></barcode:code39>
+              </barcode:barcode>
+            </fo:instream-foreign-object>
+          </fo:block>
+        </fo:table-cell>
+      </fo:table-row>
+    </fo:table-body>
+  </fo:table>
+
+  <#-- print the address, carrier, and shipment dates -->
+
+  <fo:table table-layout="fixed" space-after.optimum="10pt">
+    <fo:table-column column-width="proportional-column-width(2)"/>
+    <fo:table-column column-width="proportional-column-width(1)"/>
+    <fo:table-column column-width="proportional-column-width(1)"/>
+    <fo:table-body>
+      <fo:table-row>
+        <fo:table-cell number-rows-spanned="4">
+          <#assign address = data.address>
+          <fo:block>${uiLabelMap.CommonTo}: ${address.toName?if_exists}</fo:block>
+          <#if address.attnName?has_content>
+          <fo:block>${uiLabelMap.CommonAttn}: ${address.attnName?if_exists}</fo:block>
+          </#if>
+          <fo:block>${address.address1?if_exists}</fo:block>
+          <fo:block>${address.address2?if_exists}</fo:block>
+          <fo:block>
+            ${address.city?if_exists}<#if address.stateProvinceGeoId?has_content>, ${address.stateProvinceGeoId}</#if>
+            ${address.postalCode?if_exists} ${address.countryGeoId?if_exists}
+          </fo:block>
+
+          <#if data.phoneNumber?exists>
+            <fo:block>(${data.phoneNumber.areaCode}) ${data.phoneNumber.contactNumber}</fo:block>
+          </#if>
+        </fo:table-cell>
+      </fo:table-row>
+      <fo:table-row>
+        <fo:table-cell><fo:block font-weight="bold">${uiLabelMap.ProductShipmentMethod}</fo:block></fo:table-cell>
+        <fo:table-cell><fo:block>${data.carrierShipmentMethod.partyId} ${data.shipmentMethodType.description}</fo:block></fo:table-cell>
+      </fo:table-row>
+      <fo:table-row>
+        <fo:table-cell><fo:block font-weight="bold">${uiLabelMap.OrderShipBeforeDate}</fo:block></fo:table-cell>
+        <fo:table-cell><fo:block>${shipGroup.shipByDate?default("N/A")}</fo:block></fo:table-cell>
+      </fo:table-row>
+      <fo:table-row>
+        <fo:table-cell><fo:block font-weight="bold">${uiLabelMap.OrderShipAfterDate}</fo:block></fo:table-cell>
+        <fo:table-cell><fo:block>${shipGroup.shipAfterDate?default("N/A")}</fo:block></fo:table-cell>
+      </fo:table-row>
+    </fo:table-body>
+  </fo:table>
+
+  <#assign lines = data.lines>
+  <fo:table table-layout="fixed">
+    <fo:table-column/>
+    <fo:table-column/>
+    <fo:table-column/>
+
+    <fo:table-header>
+      <fo:table-row font-weight="bold">
+        <fo:table-cell background-color="#D4D0C8" height="20pt" display-align="center" border-top-style="solid" border-bottom-style="solid">
+          <fo:block>${uiLabelMap.ProductProduct}</fo:block>
+        </fo:table-cell>
+        <fo:table-cell background-color="#D4D0C8" height="20pt" display-align="center" border-top-style="solid" border-bottom-style="solid">
+          <fo:block>${uiLabelMap.CommonDescription}</fo:block>
+        </fo:table-cell>
+        <fo:table-cell background-color="#D4D0C8" text-align="right" height="20pt" display-align="center" border-top-style="solid" border-bottom-style="solid">
+          <fo:block>${uiLabelMap.OrderQuantityInShipGroup}</fo:block>
+        </fo:table-cell>
+      </fo:table-row>        
+    </fo:table-header>
+    <fo:table-body>
+
+      <#list lines as line>
+        <#if ((line_index % 2) == 0)>
+          <#assign rowColor = "white">
+        <#else>
+          <#assign rowColor = "#CCCCCC">
+        </#if>
+
+      <fo:table-row>
+        <fo:table-cell background-color="${rowColor}">
+          <fo:block>${line.product.productId}</fo:block>
+        </fo:table-cell>
+        <fo:table-cell background-color="${rowColor}">
+          <fo:block>${line.orderItem.itemDescription?if_exists}</fo:block>
+        </fo:table-cell>
+        <fo:table-cell background-color="${rowColor}">
+          <fo:block text-align="right"><#if !line.expandedList?exists>${line.quantityInGroup?default(0)}</#if></fo:block>
+        </fo:table-cell>
+      </fo:table-row>
+
+      <#list line.expandedList?if_exists as expandedLine>
+      <fo:table-row>
+        <fo:table-cell background-color="${rowColor}">
+          <fo:block margin-left="30pt">${expandedLine.product.productId}</fo:block>
+        </fo:table-cell>
+        <fo:table-cell background-color="${rowColor}">
+          <fo:block>Component of ${line.orderItem.itemDescription}</fo:block>
+        </fo:table-cell>
+        <fo:table-cell background-color="${rowColor}">
+          <fo:block text-align="right">${expandedLine.quantityInGroup?default(0)}</fo:block>
+        </fo:table-cell>
+      </fo:table-row>
+      </#list>
+
+      </#list>
+
+      <fo:table-row><fo:table-cell number-columns-spanned="3" border-top-style="solid" height="10pt"><fo:block/></fo:table-cell></fo:table-row>
+      <fo:table-row>
+        <fo:table-cell number-columns-spanned="2">
+          <fo:block font-weight="bold" text-align="right">${uiLabelMap.OrderQuantityInShipGroupTotal}</fo:block>
+        </fo:table-cell>
+        <fo:table-cell>
+          <fo:block font-weight="bold" text-align="right">${data.groupQuantity}</fo:block>
+        </fo:table-cell>
+      </fo:table-row>
+
+  </fo:table-body>
+</fo:table>
+
+  <#if shipGroup_has_next><fo:block break-before="page"/></#if>
+</#list>
+
+</#escape>

Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderPrintForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderPrintForms.xml?view=diff&rev=519117&r1=519116&r2=519117
==============================================================================
--- ofbiz/trunk/applications/order/widget/ordermgr/OrderPrintForms.xml (original)
+++ ofbiz/trunk/applications/order/widget/ordermgr/OrderPrintForms.xml Fri Mar 16 12:58:24 2007
@@ -138,4 +138,36 @@
             </widgets>
         </section>
     </screen>
+    <screen name="ShipGroupsPDF">
+        <section>
+            <actions>
+                <set field="title" value="Ship Groups"/>
+                <property-map resource="OrderUiLabels" map-name="uiLabelMap" global="true"/>
+                <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
+                <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="FoReportDecorator" location="component://common/widget/CommonScreens.xml">
+                    <!-- at the top left of every page we put the logo and company information -->
+                    <decorator-section name="topLeft">
+                        <section>
+                            <widgets>
+                                <include-screen name="CompanyLogo" location="component://order/widget/ordermgr/OrderPrintForms.xml"/>
+                            </widgets>
+                        </section>
+                    </decorator-section>
+                    <decorator-section name="body">
+                        <section>
+                            <widgets>
+                                <platform-specific>
+                                    <html><html-template location="component://order/webapp/ordermgr/order/shipGroups.fo.ftl"/></html>
+                                </platform-specific>
+                            </widgets>
+                        </section>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+
 </screens>