svn commit: r577449 - in /ofbiz/trunk/applications: order/webapp/ordermgr/WEB-INF/actions/reports/OpenOrderItemsReport.bsh order/widget/ordermgr/ReportForms.xml order/widget/ordermgr/ReportScreens.xml product/config/ProductUiLabels.properties

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

svn commit: r577449 - in /ofbiz/trunk/applications: order/webapp/ordermgr/WEB-INF/actions/reports/OpenOrderItemsReport.bsh order/widget/ordermgr/ReportForms.xml order/widget/ordermgr/ReportScreens.xml product/config/ProductUiLabels.properties

apatel-2
Author: apatel
Date: Wed Sep 19 14:23:50 2007
New Revision: 577449

URL: http://svn.apache.org/viewvc?rev=577449&view=rev
Log:
adding order from date and thru date in report form AND fields to show price value of the Open Order items Report.

Modified:
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/OpenOrderItemsReport.bsh
    ofbiz/trunk/applications/order/widget/ordermgr/ReportForms.xml
    ofbiz/trunk/applications/order/widget/ordermgr/ReportScreens.xml
    ofbiz/trunk/applications/product/config/ProductUiLabels.properties

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/OpenOrderItemsReport.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/OpenOrderItemsReport.bsh?rev=577449&r1=577448&r2=577449&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/OpenOrderItemsReport.bsh (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/OpenOrderItemsReport.bsh Wed Sep 19 14:23:50 2007
@@ -22,19 +22,30 @@
  * the OrderItemQuantityReportGroupByItem view.
  */
 
-import javolution.util.FastList;
-import javolution.util.FastMap;
 
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.entity.condition.*;
 import org.ofbiz.entity.util.*;
+import org.ofbiz.entity.*;
+import org.ofbiz.base.util.*;
 
 productStoreId = parameters.get("productStoreId");
 orderTypeId = parameters.get("orderTypeId");
 orderStatusId = parameters.get("orderStatusId");
+fromOrderDate = parameters.get("fromOrderDate");
+thruOrderDate = parameters.get("thruOrderDate");
+
 
 // search by orderTypeId is mandatory
 conditions = UtilMisc.toList(new EntityExpr("orderTypeId", EntityOperator.EQUALS, orderTypeId));
+
+if (!fromOrderDate.equals("")){
+    conditions.add(new EntityExpr("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromOrderDate));
+}
+if (!thruOrderDate.equals("")){
+    conditions.add(new EntityExpr("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, thruOrderDate));
+}
+
 if (productStoreId != null && productStoreId.length() > 0) {
     conditions.add(new EntityExpr("productStoreId", EntityOperator.EQUALS, productStoreId));
     // for generating a title (given product store)
@@ -69,6 +80,72 @@
 fieldsToSelect.add("itemDescription");
 findOptions = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true);
 listIt = delegator.findListIteratorByCondition("OrderItemQuantityReportGroupByItem", allConditions, null, fieldsToSelect, UtilMisc.toList("orderDate DESC"), findOptions);
-context.put("listIt", listIt);
+List orderItemList = new ArrayList();
+Double totalCostPrice = new Double(0.0);
+Double totalListPrice = new Double(0.0);
+Double totalMarkup = new Double(0.0);
+Double totalDiscount = new Double(0.0);
+Double totalRetailPrice = new Double(0.0);
+Double totalquantityOrdered = new Double(0.0);
+Double totalquantityOpen = new Double(0.0);
+
+while ((listValue = (GenericValue) listIt.next()) != null) {
+    orderId = listValue.get("orderId");
+    productId = listValue.get("productId");
+    orderDate = listValue.get("orderDate");
+    quantityOrdered = listValue.get("quantityOrdered");
+    quantityOpen = listValue.get("quantityOpen");
+    quantityIssued = listValue.get("quantityIssued");
+    itemDescription = listValue.get("itemDescription");
+    shipAfterDate = listValue.get("shipAfterDate");
+    shipBeforeDate = listValue.get("shipBeforeDate");    
+    fieldsToSelect = UtilMisc.toList("price","productPriceTypeId");
+    productIdCondExpr =  UtilMisc.toList(new EntityExpr("productId", EntityOperator.EQUALS, productId));    
+    prodPriceCond = new EntityConditionList(productIdCondExpr, EntityOperator.AND);    
+    productPrices = delegator.findByCondition("ProductPrice", prodPriceCond, fieldsToSelect, null);    
+    Double costPrice = new Double(0.0);
+    Double retailPrice = new Double(0.0);
+    Double listPrice = new Double(0.0);
+    
+    Iterator productPricesItr = productPrices.iterator();
+    while (productPricesItr.hasNext()) {
+        productPriceMap = productPricesItr.next();
+        if (productPriceMap.get("productPriceTypeId").equals("AVERAGE_COST")) {
+            costPrice = productPriceMap.get("price");
+        } else if (productPriceMap.get("productPriceTypeId").equals("DEFAULT_PRICE")) {
+            retailPrice = productPriceMap.get("price");
+        } else if (productPriceMap.get("productPriceTypeId").equals("LIST_PRICE")) {
+            listPrice = productPriceMap.get("price");
+        }      
+    }
+    
+    totalListPrice += listPrice;
+    totalRetailPrice += retailPrice;
+    totalCostPrice += costPrice;    
+    totalquantityOrdered += quantityOrdered;
+    totalquantityOpen += quantityOpen;    
+    orderItemMap = UtilMisc.toMap("orderDate", orderDate, "orderId", orderId, "productId", productId, "itemDescription", itemDescription, "quantityOrdered", quantityOrdered,"quantityIssued", quantityIssued);
+    orderItemMap.put("quantityOpen",quantityOpen);
+    orderItemMap.put("shipAfterDate",shipAfterDate);
+    orderItemMap.put("shipBeforeDate",shipBeforeDate);
+    orderItemMap.put("costPrice",costPrice);
+    orderItemMap.put("retailPrice",retailPrice);
+    orderItemMap.put("listPrice",listPrice);
+    orderItemMap.put("discount",(Double.toString(listPrice- retailPrice)));
+    orderItemMap.put("calculatedMarkup",(Double.toString(retailPrice- costPrice)));    
+    orderItemList.add(orderItemMap);    
+}
+
+listIt.close();
+List totalAmountList = new ArrayList();
+if (UtilValidate.isNotEmpty(orderItemList)) {
+    totalAmountMap = UtilMisc.toMap("totalCostPrice", totalCostPrice, "totalListPrice", totalListPrice, "totalRetailPrice", totalRetailPrice, "totalquantityOrdered", totalquantityOrdered, "quantityOrdered", quantityOrdered,"totalquantityOpen", totalquantityOpen);
+    totalAmountMap.put("totalDiscount",(totalListPrice - totalRetailPrice));
+    totalAmountMap.put("totalMarkup",(totalRetailPrice - totalCostPrice));
+    totalAmountList.add(totalAmountMap);
+}
+context.put("orderItemList", orderItemList);
+context.put("totalAmountList", totalAmountList);
+
 
 

Modified: ofbiz/trunk/applications/order/widget/ordermgr/ReportForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/ReportForms.xml?rev=577449&r1=577448&r2=577449&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/widget/ordermgr/ReportForms.xml (original)
+++ ofbiz/trunk/applications/order/widget/ordermgr/ReportForms.xml Wed Sep 19 14:23:50 2007
@@ -124,13 +124,14 @@
                 </entity-options>
             </drop-down>
         </field>
+        <field name="fromOrderDate" title="${uiLabelMap.CommonFromDate} (${uiLabelMap.OrderDate}&gt;=)"><date-time type="timestamp"/></field>
+        <field name="thruOrderDate" title="${uiLabelMap.CommonThruDate} (${uiLabelMap.OrderDate}&lt;)"><date-time type="timestamp"/></field>
         <field name="submitButton" title="${uiLabelMap.CommonRun}" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
 
     <!-- list open order items -->
-    <form name="OpenOrderItemsList" type="list" list-name="listIt"
-        default-title-style="tableheadtext" default-widget-style="tabletext" default-tooltip-style="tabletext"
-        paginate-target="OpenOrderItemsReport">
+    <form name="OpenOrderItemsList" type="list" list-name="orderItemList"
+        default-title-style="tableheadtext" default-widget-style="tabletext" paginate-target="OpenOrderItemsReport">
         <field name="orderDate" title="${uiLabelMap.OrderDate}"><display/></field>
         <field name="orderId" title="${uiLabelMap.OrderOrderId}" widget-style="buttontext">
             <hyperlink target="orderview?orderId=${orderId}" description="${orderId}"/>
@@ -143,8 +144,25 @@
         <field name="shipAfterDate" title="${uiLabelMap.OrderShipAfterDate}"><display/></field>
         <field name="shipBeforeDate" title="${uiLabelMap.OrderShipBeforeDate}"><display/></field>
         <field name="comments" title="${uiLabelMap.CommonComments}"><display/></field>
+        <field name="costPrice" title="${uiLabelMap.ProductCostPrice}"><display/></field>
+        <field name="listPrice" title="${uiLabelMap.ProductListPrice}"><display/></field>
+        <field name="retailPrice" title="${uiLabelMap.ProductRetailPrice}"><display/></field>
+        <field name="discount" title="${uiLabelMap.ProductDiscount}"><display/></field>
+        <field name="calculatedMarkup" title="${uiLabelMap.CalculatedMarkup}"><display/></field>
     </form>
-
+    
+    <form name="OpenOrderItemsTotal" type="list" list-name="totalAmountList" default-title-style="tableheadtext"
+         default-widget-style="tabletext">
+        <field name="" title="Total"><display/></field>
+        <field name="totalquantityOrdered"><display/></field>
+        <field name="totalquantityOpen"><display/></field>                
+        <field name="totalCostPrice"><display/></field>
+        <field name="totalListPrice"><display/></field>
+        <field name="totalRetailPrice"><display/></field>
+        <field name="totalDiscount"><display/></field>
+        <field name="totalMarkup"><display/></field>
+    </form>
+    
     <!-- form for generating a report of total product purchases (quantity and value) -->
     <form name="PurchasesByOrganizationReport" type="single" target="PurchasesByOrganizationReport.pdf" title=""
         default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext">
@@ -175,5 +193,4 @@
         <field name="thruOrderDate" title="${uiLabelMap.CommonThruDate}"><date-time type="timestamp"/></field>
         <field name="submitButton" title="${uiLabelMap.CommonRun}" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
-
 </forms>

Modified: ofbiz/trunk/applications/order/widget/ordermgr/ReportScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/ReportScreens.xml?rev=577449&r1=577448&r2=577449&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/widget/ordermgr/ReportScreens.xml (original)
+++ ofbiz/trunk/applications/order/widget/ordermgr/ReportScreens.xml Wed Sep 19 14:23:50 2007
@@ -220,6 +220,7 @@
                     <decorator-section name="body">
                         <label style="head2" text="${uiLabelMap.OrderReportOpenOrderItems} - ${productStore.storeName}"/>
                         <include-form name="OpenOrderItemsList" location="component://order/widget/ordermgr/ReportForms.xml"/>
+                        <include-form name="OpenOrderItemsTotal" location="component://order/widget/ordermgr/ReportForms.xml"/>
                     </decorator-section>
                 </decorator-screen>
             </widgets>
@@ -267,4 +268,5 @@
 
 
 </screens>
+
 

Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.properties?rev=577449&r1=577448&r2=577449&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/ProductUiLabels.properties (original)
+++ ofbiz/trunk/applications/product/config/ProductUiLabels.properties Wed Sep 19 14:23:50 2007
@@ -39,6 +39,7 @@
 AddSelectableFeature=Add Selectable Feature
 AnyFeatureType=- Any -
 ApplyToAll=Apply To All
+CalculatedMarkup=Calculated Markup
 CatalogCompanyName=OFBiz: Catalog Manager
 Categories=Categories
 CategoryUploadImage=Upload Category Image
@@ -431,6 +432,7 @@
 ProductContentPathPrefix=Content Path Prefix
 ProductContent_Id=Content [ID]
 ProductCopyProductCategoryMembersToAnotherCategory=Copy Product Category Members to Another Category
+ProductCostPrice=Cost Price
 ProductCosts=Costs
 ProductCouldNotFindFacilityWithId=Could Not Find Facility with ID
 ProductCouldNotFindProduct=Could Not Find Product with ID
@@ -500,6 +502,7 @@
 ProductDetailImage=Detail Image
 ProductDetailScreen=Detail Screen
 ProductDetailScreenMessage=for screens in other files use something like
+ProductDiscount=Discount
 ProductDL=DL
 ProductDropShipment=Drop Shipment
 ProductDuplicateProduct=Duplicate Product
@@ -1166,6 +1169,7 @@
 ProductReserved=Reserved
 ProductResetDate=Reset Date
 ProductResultOfImageUpload=Result of image Upload
+ProductRetailPrice=Retail Price
 ProductReturnCompletelyReceived=This return is completely received
 ProductReturnNumber=Return Number
 ProductReturnToEditProduct=Return to Edit Product
@@ -1374,6 +1378,9 @@
 ProductToPick=To Pick
 ProductToReceive=To Receive
 ProductTotalFeaturesApplied=total feature(s) applied
+ProductTotalCostPrice=Total Cost Price
+ProductTotalListPrice=Total List Price
+ProductTotalRetailPrice=Total Retail Price
 ProductTotIssuedQuantity=Tot Issued Quantity
 ProductTotOrderedQuantity=Tot Ordered Quantity
 ProductTotPlannedQuantity=Tot Planned Quantity