Author: sichen
Date: Fri Mar 16 15:03:01 2007 New Revision: 519155 URL: http://svn.apache.org/viewvc?view=rev&rev=519155 Log: Improve ship groups PDF to include shipped and open quantities, allow PDF to be generated for specified ship group. Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.properties ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl ofbiz/trunk/applications/order/webapp/ordermgr/order/shipGroups.fo.ftl Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.properties URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderUiLabels.properties?view=diff&rev=519155&r1=519154&r2=519155 ============================================================================== --- ofbiz/trunk/applications/order/config/OrderUiLabels.properties (original) +++ ofbiz/trunk/applications/order/config/OrderUiLabels.properties Fri Mar 16 15:03:01 2007 @@ -431,6 +431,7 @@ OrderQuantityInShipGroup=In Group OrderQuantityInShipGroupTotal=Total In Group OrderQuantityPurchase=Qty Purch +OrderQuantityShipped=Shipped OrderQuantitySold=Qty Sold OrderQuantityUom=Unity of measure OrderQuickAddOrderItem=Order Item Quick Add Modified: 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=diff&rev=519155&r1=519154&r2=519155 ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh Fri Mar 16 15:03:01 2007 @@ -26,11 +26,17 @@ orderId = parameters.get("orderId"); if (orderId == null) return; -shipGroups = delegator.findByAnd("OrderItemShipGroup", UtilMisc.toMap("orderId", orderId), UtilMisc.toList("shipGroupSeqId")); +shipGroupSeqId = parameters.get("shipGroupSeqId"); + +// if a particular ship group is requested, we will limit ourselves to it +findMap = UtilMisc.toMap("orderId", orderId); +if (shipGroupSeqId != null) findMap.put("shipGroupSeqId", shipGroupSeqId); + +shipGroups = delegator.findByAnd("OrderItemShipGroup", findMap, UtilMisc.toList("shipGroupSeqId")); context.put("shipGroups", shipGroups); // method to expand the marketing packages -FastList expandProductGroup(product, quantity) { +FastList expandProductGroup(product, quantityInGroup, quantityShipped, quantityOpen) { sublines = FastList.newInstance(); associations = product.getRelatedByAnd("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "MANUF_COMPONENT")); associations = EntityUtil.filterByDate( associations ); @@ -39,10 +45,11 @@ 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)); + // determine the quantities + quantityComposed = (association.getDouble("quantity") == null ? 0 : association.getDouble("quantity").doubleValue()); + line.put("quantityInGroup", quantityInGroup * quantityComposed); + line.put("quantityShipped", quantityShipped * quantityComposed); + line.put("quantityOpen", quantityOpen * quantityComposed); sublines.add(line); } @@ -51,7 +58,6 @@ groupData = FastMap.newInstance(); for (iter = shipGroups.iterator(); iter.hasNext(); ) { - groupQuantity = 0; shipGroup = iter.next(); data = FastMap.newInstance(); @@ -78,31 +84,41 @@ product = orderItem.getRelatedOne("Product"); line = FastMap.newInstance(); - quantity = orderItemAssoc.get("quantity").doubleValue(); + // the quantity in group + quantityInGroup = orderItemAssoc.get("quantity").doubleValue(); if (orderItemAssoc.get("cancelQuantity") != null) { - quantity -= orderItemAssoc.get("cancelQuantity").doubleValue(); + quantityInGroup -= orderItemAssoc.get("cancelQuantity").doubleValue(); + } + + // the quantity shipped + quantityShipped = 0.0; + List issuances = delegator.findByAnd("ItemIssuance", UtilMisc.toMap("orderId", orderItem.get("orderId"), "orderItemSeqId", orderItem.get("orderItemSeqId"), "shipGroupSeqId", orderItemAssoc.get("shipGroupSeqId"))); + for (iiter = issuances.iterator(); iiter.hasNext(); ) { + issuance = iiter.next(); + quantityShipped += issuance.get("quantity").doubleValue(); } - line.put("quantityInGroup", quantity); + // the quantity open (ordered - shipped) + quantityOpen = orderItem.get("quantity").doubleValue(); + if (orderItem.get("cancelQuantity") != null) { + quantityOpen -= orderItem.get("cancelQuantity").doubleValue(); + } + quantityOpen -= quantityShipped; + line.put("orderItem", orderItem); line.put("product", product); + line.put("quantityInGroup", quantityInGroup); + line.put("quantityShipped", quantityShipped); + line.put("quantityOpen", quantityOpen); if ("MARKETING_PKG_AUTO".equals(product.get("productTypeId"))) { - sublines = expandProductGroup(product, quantity); + sublines = expandProductGroup(product, quantityInGroup, quantityShipped, quantityOpen); line.put("expandedList", sublines); - for (siter = sublines.iterator(); siter.hasNext(); ) { - subline = siter.next(); - groupQuantity += subline.get("quantityInGroup").doubleValue(); - } - } else { - groupQuantity += quantity; } 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/order/ordershippinginfo.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl?view=diff&rev=519155&r1=519154&r2=519155 ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl Fri Mar 16 15:03:01 2007 @@ -24,7 +24,7 @@ <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 class="tabletext"><a href="<@ofbizUrl>shipGroups.pdf?orderId=${orderId}&shipGroupSeqId=${shipGroup.shipGroupSeqId}</@ofbizUrl>" class="buttontext">${uiLabelMap.OrderShipGroup} PDF</a></div> </div> <div class="boxhead"> ${uiLabelMap.OrderShipmentInformation} - ${shipGroup.shipGroupSeqId}</div> </div> Modified: 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=diff&rev=519155&r1=519154&r2=519155 ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/order/shipGroups.fo.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/order/shipGroups.fo.ftl Fri Mar 16 15:03:01 2007 @@ -102,9 +102,11 @@ <#assign lines = data.lines> <fo:table table-layout="fixed"> - <fo:table-column/> - <fo:table-column/> - <fo:table-column/> + <fo:table-column column-width="proportional-column-width(2)"/> + <fo:table-column column-width="proportional-column-width(3)"/> + <fo:table-column column-width="proportional-column-width(1)"/> + <fo:table-column column-width="proportional-column-width(1)"/> + <fo:table-column column-width="proportional-column-width(1)"/> <fo:table-header> <fo:table-row font-weight="bold"> @@ -117,6 +119,12 @@ <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-cell background-color="#D4D0C8" text-align="right" height="20pt" display-align="center" border-top-style="solid" border-bottom-style="solid"> + <fo:block>${uiLabelMap.OrderQuantityShipped}</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.ProductOpenQuantity}</fo:block> + </fo:table-cell> </fo:table-row> </fo:table-header> <fo:table-body> @@ -136,35 +144,38 @@ <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:block text-align="right">${line.quantityInGroup?default(0)}</fo:block> + </fo:table-cell> + <fo:table-cell background-color="${rowColor}"> + <fo:block text-align="right">${line.quantityShipped?default(0)}</fo:block> + </fo:table-cell> + <fo:table-cell background-color="${rowColor}"> + <fo:block text-align="right">${line.quantityOpen?default(0)}</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 background-color="${rowColor}" font-style="italic"> + <fo:block margin-left="20pt">${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 background-color="${rowColor}" font-style="italic"> + <fo:block margin-left="20pt">${expandedLine.product.internalName}</fo:block> </fo:table-cell> - <fo:table-cell background-color="${rowColor}"> + <fo:table-cell background-color="${rowColor}" font-style="italic"> <fo:block text-align="right">${expandedLine.quantityInGroup?default(0)}</fo:block> </fo:table-cell> + <fo:table-cell background-color="${rowColor}" font-style="italic"> + <fo:block text-align="right">${expandedLine.quantityShipped?default(0)}</fo:block> + </fo:table-cell> + <fo:table-cell background-color="${rowColor}" font-style="italic"> + <fo:block text-align="right">${expandedLine.quantityOpen?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> |
Free forum by Nabble | Edit this page |