Improve ship groups PDF to include shipped and open quantities, allow PDF to be generated for specified ship group.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@519155 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Si Chen
2007-03-16 22:03:01 +00:00
parent b939a784fd
commit 7cb12065a6
4 changed files with 67 additions and 39 deletions
@@ -431,6 +431,7 @@ OrderQuantityCancelled=Qty Cncld
OrderQuantityInShipGroup=In Group
OrderQuantityInShipGroupTotal=Total In Group
OrderQuantityPurchase=Qty Purch
OrderQuantityShipped=Shipped
OrderQuantitySold=Qty Sold
OrderQuantityUom=Unity of measure
OrderQuickAddOrderItem=Order Item Quick Add
@@ -26,11 +26,17 @@ 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"));
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 @@ FastList expandProductGroup(product, quantity) {
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 @@ FastList expandProductGroup(product, quantity) {
groupData = FastMap.newInstance();
for (iter = shipGroups.iterator(); iter.hasNext(); ) {
groupQuantity = 0;
shipGroup = iter.next();
data = FastMap.newInstance();
@@ -78,31 +84,41 @@ for (iter = shipGroups.iterator(); iter.hasNext(); ) {
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();
}
line.put("quantityInGroup", quantity);
// 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();
}
// 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);
@@ -24,7 +24,7 @@ under the License.
<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">&nbsp;${uiLabelMap.OrderShipmentInformation} - ${shipGroup.shipGroupSeqId}</div>
</div>
@@ -102,9 +102,11 @@ under the License.
<#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 @@ under the License.
<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,36 +144,39 @@ under the License.
<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>