svn commit: r883699 - in /ofbiz/trunk: applications/order/data/ applications/order/script/org/ofbiz/order/olap/ applications/order/servicedef/ applications/order/webapp/ordermgr/WEB-INF/ applications/order/webapp/ordermgr/WEB-INF/actions/report/ applic...

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

svn commit: r883699 - in /ofbiz/trunk: applications/order/data/ applications/order/script/org/ofbiz/order/olap/ applications/order/servicedef/ applications/order/webapp/ordermgr/WEB-INF/ applications/order/webapp/ordermgr/WEB-INF/actions/report/ applic...

hansbak-2
Author: hansbak
Date: Tue Nov 24 14:07:47 2009
New Revision: 883699

URL: http://svn.apache.org/viewvc?rev=883699&view=rev
Log:
added the warehouse processing for the ordersales entities. Contribution by our Antwebsystems employee Tom

Added:
    ofbiz/trunk/applications/order/script/org/ofbiz/order/olap/
    ofbiz/trunk/applications/order/script/org/ofbiz/order/olap/FactServices.xml   (with props)
    ofbiz/trunk/applications/order/servicedef/secas_olap.xml   (with props)
    ofbiz/trunk/applications/order/servicedef/services_olap.xml   (with props)
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/report/
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/report/SalesReport.groovy   (with props)
Modified:
    ofbiz/trunk/applications/order/data/OrderPortletData.xml
    ofbiz/trunk/applications/order/servicedef/secas.xml
    ofbiz/trunk/applications/order/servicedef/services.xml
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
    ofbiz/trunk/applications/order/widget/ordermgr/ReportForms.xml
    ofbiz/trunk/applications/order/widget/ordermgr/ReportScreens.xml
    ofbiz/trunk/framework/bi/script/org/ofbiz/bi/DimensionServices.xml

Modified: ofbiz/trunk/applications/order/data/OrderPortletData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/data/OrderPortletData.xml?rev=883699&r1=883698&r2=883699&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/data/OrderPortletData.xml (original)
+++ ofbiz/trunk/applications/order/data/OrderPortletData.xml Tue Nov 24 14:07:47 2009
@@ -122,4 +122,12 @@
         screenLocation="component://order/widget/ordermgr/OrderViewScreens.xml"
         description="List Purchase Orders"/>
     <PortletPortletCategory portalPortletId="ListPurchaseOrders" portletCategoryId="ORDERMGR"/>
+
+    <PortalPortlet portalPortletId="SalesReport"
+        portletName="Sales Report"
+        screenName="SalesReport"
+        screenLocation="component://order/widget/ordermgr/ReportScreens.xml"
+        description=""/>
+    <PortletPortletCategory portalPortletId="SalesReport" portletCategoryId="REPORT"/>
+    <PortalPagePortlet portalPageId="OrderReportPage" portalPortletId="SalesReport" portletSeqId="00001" columnSeqId="00002" sequenceNum="5"/>
 </entity-engine-xml>

Added: ofbiz/trunk/applications/order/script/org/ofbiz/order/olap/FactServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/olap/FactServices.xml?rev=883699&view=auto
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/olap/FactServices.xml (added)
+++ ofbiz/trunk/applications/order/script/org/ofbiz/order/olap/FactServices.xml Tue Nov 24 14:07:47 2009
@@ -0,0 +1,246 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd">
+
+    <simple-method method-name="loadSalesOrderFact" short-description="">
+        <entity-one entity-name="OrderHeader" value-field="orderHeader"/>
+        <if-empty field="orderHeader">
+            <add-error><fail-message message="Order with id [${parameters.orderId}] doesn't exist."/></add-error>
+        </if-empty>
+        <check-errors/>
+        <if-compare field="orderHeader.orderTypeId" operator="equals" value="SALES_ORDER">
+            <set field="andConditions.orderItemTypeId" value="PRODUCT_ORDER_ITEM"/>
+            <get-related relation-name="OrderItem" value-field="orderHeader" list="orderItems" map="andConditions"/>
+            <iterate list="orderItems" entry="orderItem">
+                <clear-field field="inMap"/>
+                <set field="inMap.orderHeader" from-field="orderHeader"/>
+                <set field="inMap.orderItem" from-field="orderItem"/>
+                <set field="inMap.orderAdjustment" from-field="orderAdjustment"/>
+                <call-service service-name="loadSalesOrderItemFact" in-map-name="inMap"/>
+            </iterate>
+        </if-compare>
+    </simple-method>
+    
+    <simple-method method-name="loadSalesOrderItemFact" short-description="">
+        <set field="orderHeader" from-field="parameters.orderHeader"/>
+        <set field="orderItem" from-field="parameters.orderItem"/>
+        <set field="orderAdjustment" from-field="parameters.orderAdjustment"/>
+        <if-empty field="orderHeader">
+            <entity-one entity-name="OrderHeader" value-field="orderHeader"/>
+        </if-empty>
+        <if-empty field="orderItem">
+            <entity-one entity-name="OrderItem" value-field="orderItem"/>
+        </if-empty>
+        <if-empty field="orderAdjustment">
+            <entity-and entity-name="OrderAdjustment" list="orderAdjustments">
+                <field-map field-name="orderId" from-field="orderHeader.orderId"/>
+            </entity-and>
+        </if-empty>
+        <if-empty field="orderHeader">
+            <add-error><fail-message message="Order with id [${orderHeader.orderId}] doesn't exist."/></add-error>
+        </if-empty>
+        <if-empty field="orderItem">
+            <add-error><fail-message message="The Orders Item with id [${orderItem.orderItemSeqId}] doesn't exist."/></add-error>
+        </if-empty>
+        <check-errors/>
+
+        <if-compare field="orderHeader.orderTypeId" operator="equals" value="SALES_ORDER">
+            <entity-one entity-name="SalesOrderItemFact" value-field="fact" auto-field-map="false">
+                <field-map field-name="orderId" from-field="orderItem.orderId"/>
+                <field-map field-name="orderItemSeqId" from-field="orderItem.orderItemSeqId"/>
+            </entity-one>
+            <!-- key handling -->
+            <if-empty field="fact">
+                <make-value entity-name="SalesOrderItemFact" value-field="fact"/>
+                <set field="fact.orderId" from-field="orderHeader.orderId"/>
+                <set field="fact.orderItemSeqId" from-field="orderItem.orderItemSeqId"/>
+                <!-- conversion of the order date -->
+                <if-not-empty field="orderHeader.orderDate">
+                    <clear-field field="inMap"/>
+                    <set field="inMap.dimensionEntityName" value="DateDimension"/>
+                    <set field="inMap.naturalKeyFields.dateValue" from-field="orderHeader.orderDate" type="Date"/>
+                    <call-service service-name="getDimensionIdFromNaturalKey" in-map-name="inMap">
+                        <result-to-field result-name="dimensionId" field="fact.orderDateDimId"/>
+                    </call-service>
+                    <if-empty field="fact.orderDateDimId">
+                        <set field="fact.orderDateDimId" value="_NF_"/>
+                    </if-empty>
+                <else>
+                    <set field="fact.orderDateDimId" value="_NA_"/>
+                </else>
+                </if-not-empty>
+                <!-- conversion of the product id -->
+                <if-not-empty field="orderItem.productId">
+                    <clear-field field="inMap"/>
+                    <set field="inMap.dimensionEntityName" value="ProductDimension"/>
+                    <set field="inMap.naturalKeyFields.productId" from-field="orderItem.productId"/>
+                    <call-service service-name="getDimensionIdFromNaturalKey" in-map-name="inMap">
+                        <result-to-field result-name="dimensionId" field="fact.productDimId"/>
+                    </call-service>
+                    <if-empty field="fact.productDimId">
+                        <set field="fact.productDimId" value="_NF_"/>
+                    </if-empty>
+                <else>
+                    <set field="fact.productDimId" value="_NA_"/>
+                </else>
+                </if-not-empty>
+                <!-- conversion of the order currency -->
+                <if-not-empty field="orderHeader.currencyUom">
+                    <clear-field field="inMap"/>
+                    <set field="inMap.dimensionEntityName" value="CurrencyDimension"/>
+                    <set field="inMap.naturalKeyFields.currencyId" from-field="orderHeader.currencyUom"/>
+                    <call-service service-name="getDimensionIdFromNaturalKey" in-map-name="inMap">
+                        <result-to-field result-name="dimensionId" field="fact.origCurrencyDimId"/>
+                    </call-service>
+                    <if-empty field="fact.origCurrencyDimId">
+                        <set field="fact.origCurrencyDimId" value="_NF_"/>
+                    </if-empty>
+                <else>
+                    <set field="fact.origCurrencyDimId" value="_NA_"/>
+                </else>
+                </if-not-empty>
+                <!-- TODO -->
+                <set field="fact.billToCustomerDimId" value="_NA_"/>
+                <create-value value-field="fact"/>
+            </if-empty>
+            <!-- =============== -->
+            <!-- facts handling  -->
+            <!-- =============== -->
+            <set field="fact.quantity" from-field="orderItem.quantity" type="BigDecimal"/>
+            <set field="fact.extGrossAmount" value="0.0" type="BigDecimal"/>
+            <set field="fact.extDiscountAmount" value="0.0" type="BigDecimal"/>
+            <set field="fact.extNetAmount" value="0.0" type="BigDecimal"/>
+            <set field="fact.extShippingAmount" value="0.0" type="BigDecimal"/>
+            <set field="fact.extTaxAmount" value="0.0" type="BigDecimal"/>
+            
+            <set field="fact.GrossSales" value="0.0" type="BigDecimal"/>
+            <set field="fact.GrossMerchandizeSales" value="0.0" type="BigDecimal"/>
+            <set field="fact.GrossMerchandizeProfit" value="0.0" type="BigDecimal"/>
+            <set field="fact.GrossShippingProfit" value="0.0" type="BigDecimal"/>
+            <set field="fact.GrossProfit" value="0.0" type="BigDecimal"/>
+            <set field="fact.AverageMerchandizeProfit" value="0.0" type="BigDecimal"/>
+            <set field="fact.AverageGrossProfit" value="0.0" type="BigDecimal"/>
+            
+            <!-- gross -->
+            <calculate field="fact.extGrossAmount">
+                <calcop field="fact.quantity" operator="multiply">
+                    <calcop field="orderItem.unitPrice" operator="get"/>
+                </calcop>
+            </calculate>
+            
+            <!-- shipping -->
+            <iterate list="orderAdjustments" entry="shipping">
+                <if-compare field="shipping.orderAdjustmentTypeId" operator="equals" value="SHIPPING_CHARGES">
+                    <calculate field="fact.extShippingAmount">
+                        <calcop field="fact.extShippingAmount" operator="add">
+                            <calcop field="shipping.amount" operator="get"/>
+                        </calcop>
+                    </calculate>
+                </if-compare>
+            </iterate>
+            
+            <!-- taxes -->
+            <iterate list="orderAdjustments" entry="tax">
+                <if-compare field="tax.orderAdjustmentTypeId" operator="equals" value="SALES_TAX">
+                    <calculate field="fact.extTaxAmount">
+                        <calcop field="fact.extTaxAmount" operator="add">
+                            <calcop field="tax.amount" operator="get"/>
+                        </calcop>
+                    </calculate>
+                </if-compare>
+            </iterate>
+            
+            <!-- discounts -->
+            <iterate list="orderAdjustments" entry="discount">
+                <if-compare field="discount.orderAdjustmentTypeId" operator="equals" value="PROMOTION_ADJUSTMENT">
+                    <calculate field="fact.extDiscountAmount">
+                        <calcop field="fact.extDiscountAmount" operator="add">
+                            <calcop field="discount.amount" operator="negative"/>
+                        </calcop>
+                    </calculate>
+                </if-compare>
+            </iterate>
+
+            <!-- net -->
+            <calculate field="fact.extNetAmount">
+                <calcop field="fact.extGrossAmount" operator="subtract">
+                    <calcop field="fact.extDiscountAmount" operator="get"/>
+                </calcop>
+            </calculate>
+            
+            <!-- Gross Sales -->
+            <calculate field="fact.GrossSales">
+                <calcop field="fact.extGrossAmount" operator="add">
+                    <calcop field="fact.extShippingAmount" operator="get"/>
+                </calcop>
+            </calculate>
+            
+            <!-- Gross Merchandize Sales -->
+            <calculate field="fact.GrossMerchandizeSales">
+                <calcop field="fact.GrossMerchandizeSales" operator="add">
+                    <calcop field="fact.extGrossAmount" operator="get"/>
+                </calcop>
+            </calculate>
+            
+            <!-- Gross Merchandize Profit -->
+            <entity-and entity-name="ProductPrice" list="costs">
+                <field-map field-name="productId" from-field="orderItem.productId"/>
+            </entity-and>
+            <iterate list="costs" entry="cost">
+                <if-compare field="cost.productPriceTypeId" operator="equals" value="DEFAULT_PRICE">
+                    <log level="always" message="===================price : ${cost.price}"/>
+                    <calculate field="fact.GrossMerchandizeProfit">
+                        <calcop field="fact.GrossMerchandizeSales" operator="subtract">
+                            <calcop field="cost.price" operator="get"/>
+                        </calcop>
+                    </calculate>
+                </if-compare>
+            </iterate>
+            
+            <!-- Gross Shipping Profit -->
+            
+            <!-- Gross Profit -->
+            
+            <!-- Average Merchandize Profit -->
+            
+            <!-- Average Gross Profit -->
+            
+            <!-- TODO: prorate order header discounts and shipping charges -->
+            <!-- TODO: costs -->
+<!--            <set field="fact.extManFixedCost" value="0.0" type="BigDecimal"/>
+            <set field="fact.extManVarCost" value="0.0" type="BigDecimal"/>
+            <set field="fact.extStorageCost" value="0.0" type="BigDecimal"/>
+            <set field="fact.extDistributionCost" value="0.0" type="BigDecimal"/>
+
+            <calculate field="fact.contributionAmount">
+                <calcop field="fact.extNetAmount" operator="subtract">
+                    <calcop field="fact.extManFixedCost" operator="get"/>
+                    <calcop field="fact.extManVarCost" operator="get"/>
+                    <calcop field="fact.extStorageCost" operator="get"/>
+                    <calcop field="fact.extDistributionCost" operator="get"/>
+                </calcop>
+            </calculate>-->
+
+            <store-value value-field="fact"/>
+        </if-compare>
+    </simple-method>
+</simple-methods>

Propchange: ofbiz/trunk/applications/order/script/org/ofbiz/order/olap/FactServices.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/order/script/org/ofbiz/order/olap/FactServices.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/order/script/org/ofbiz/order/olap/FactServices.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: ofbiz/trunk/applications/order/servicedef/secas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/secas.xml?rev=883699&r1=883698&r2=883699&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/secas.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/secas.xml Tue Nov 24 14:07:47 2009
@@ -396,4 +396,12 @@
         <condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/>
         <action service="createReturnStatus" mode="sync"/>
     </eca>
+    
+    <!-- fact entities -->
+    <!-- Load data into the SalesOrderItemFact olap entity when a sales order is set to ready -->
+    <eca service="setOrderStatus" event="commit">
+        <condition field-name="statusId" operator="equals" value="ITEM_APPROVED"/>
+        <condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/>
+        <action service="loadSalesOrderFact" mode="sync" run-as-user="system"/>
+    </eca>
 </service-eca>
\ No newline at end of file

Added: ofbiz/trunk/applications/order/servicedef/secas_olap.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/secas_olap.xml?rev=883699&view=auto
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/secas_olap.xml (added)
+++ ofbiz/trunk/applications/order/servicedef/secas_olap.xml Tue Nov 24 14:07:47 2009
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<service-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/service-eca.xsd">
+
+    <!-- fact entities -->
+    <!-- Load data into the SalesOrderItemFact olap entity when a sales order is set to ready -->
+    <eca service="setOrderStatus" event="commit">
+        <condition field-name="statusId" operator="equals" value="ITEM_APPROVED"/>
+        <condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/>
+        <action service="loadSalesOrderFact" mode="sync" run-as-user="system"/>
+    </eca>
+
+</service-eca>

Propchange: ofbiz/trunk/applications/order/servicedef/secas_olap.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/order/servicedef/secas_olap.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/order/servicedef/secas_olap.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: ofbiz/trunk/applications/order/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=883699&r1=883698&r2=883699&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services.xml Tue Nov 24 14:07:47 2009
@@ -1043,4 +1043,24 @@
         <attribute name="ownerPartyId" type="String" mode="IN" optional="true"/>
         <attribute name="availabalityList" type="List" mode="OUT"/>
     </service>
+    
+    <!-- Order Facts -->
+    <service name="loadSalesOrderFact" auth="true" engine="simple"
+        location="component://order/script/org/ofbiz/order/olap/FactServices.xml" invoke="loadSalesOrderFact">
+        <description>Calls the loadSalesOrderItemFact service for all the order items.</description>
+        <attribute name="orderId" type="String" mode="IN" optional="false"/>
+    </service>
+    
+    <service name="loadSalesOrderItemFact" auth="true" engine="simple"
+        location="component://order/script/org/ofbiz/order/olap/FactServices.xml" invoke="loadSalesOrderItemFact">
+        <description>
+            Pulls information from the OrderItem* entities and stores them in the SalesOrderItem entity (olap entity).
+            One of orderId/orderItemSeqId or order/orderItem must be passed or an error is returned.
+        </description>
+        <attribute name="orderId" type="String" mode="IN" optional="true"/>
+        <attribute name="orderItemSeqId" type="String" mode="IN" optional="true"/>
+        <attribute name="orderHeader" type="org.ofbiz.entity.GenericValue" mode="IN" optional="true"/>
+        <attribute name="orderItem" type="org.ofbiz.entity.GenericValue" mode="IN" optional="true"/>
+        <attribute name="orderAdjustment " type="org.ofbiz.entity.GenericValue" mode="IN" optional="true"/>
+    </service>
 </services>
\ No newline at end of file

Added: ofbiz/trunk/applications/order/servicedef/services_olap.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_olap.xml?rev=883699&view=auto
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services_olap.xml (added)
+++ ofbiz/trunk/applications/order/servicedef/services_olap.xml Tue Nov 24 14:07:47 2009
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
+
+    <!-- Order Facts -->
+    <service name="loadSalesOrderItemFact" auth="true" engine="simple"
+        location="component://order/script/org/ofbiz/order/olap/FactServices.xml" invoke="loadSalesOrderItemFact">
+        <description>
+            Pulls information from the OrderItem* entities and stores them in the SalesOrderItem entity (olap entity).
+            One of orderId/orderItemSeqId or order/orderItem must be passed or an error is returned.
+        </description>
+        <attribute name="orderId" type="String" mode="IN" optional="true"/>
+        <attribute name="orderItemSeqId" type="String" mode="IN" optional="true"/>
+        <attribute name="orderHeader" type="org.ofbiz.entity.GenericValue" mode="IN" optional="true"/>
+        <attribute name="orderItem" type="org.ofbiz.entity.GenericValue" mode="IN" optional="true"/>
+    </service>
+    
+    <service name="loadSalesOrderFact" auth="true" engine="simple"
+        location="component://order/script/org/ofbiz/order/olap/FactServices.xml" invoke="loadSalesOrderFact">
+        <description>Calls the loadSalesOrderItemFact service for all the order items.</description>
+        <attribute name="orderId" type="String" mode="IN" optional="false"/>
+    </service>
+</services>

Propchange: ofbiz/trunk/applications/order/servicedef/services_olap.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/order/servicedef/services_olap.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/order/servicedef/services_olap.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/report/SalesReport.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/report/SalesReport.groovy?rev=883699&view=auto
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/report/SalesReport.groovy (added)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/report/SalesReport.groovy Tue Nov 24 14:07:47 2009
@@ -0,0 +1,12 @@
+import org.ofbiz.base.util.*;
+
+fromDateStr = parameters.fromDate;
+thruDateStr = parameters.thruDate;
+
+birtParameters = [:];
+birtParameters.fromDate = UtilDateTime.toTimestamp(fromDateStr);
+birtParameters.thruDate = UtilDateTime.toTimestamp(thruDateStr);
+
+request.setAttribute("birtParameters", birtParameters);
+
+return "success";
\ No newline at end of file

Propchange: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/report/SalesReport.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/report/SalesReport.groovy
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/report/SalesReport.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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?rev=883699&r1=883698&r2=883699&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Tue Nov 24 14:07:47 2009
@@ -30,6 +30,7 @@
     <handler name="service-multi" type="request" class="org.ofbiz.webapp.event.ServiceMultiEventHandler"/>
     <handler name="bsf" type="request" class="org.ofbiz.webapp.event.BsfEventHandler"/>
     <handler name="jsonjava" type="request" class="org.ofbiz.webapp.event.JSONJavaEventHandler"/>
+    <handler name="birt" type="view" class="org.ofbiz.webapp.view.BirtViewHandler"/>
     <!-- Events to run on every request before security (chains exempt) -->
     <!--
     <preprocessor>
@@ -1082,6 +1083,10 @@
     <request-map uri="PurchasesByOrganizationReport.pdf"><security https="true" auth="true"/>
         <response name="success" type="view" value="PurchasesByOrganizationReport"/>
     </request-map>
+    <request-map uri="SalesReport.pdf"><security https="true" auth="true"/>
+        <event type="groovy" path="component://order/webapp/ordermgr/WEB-INF/actions/report/" invoke="SalesReport.groovy"/>
+        <response name="success" type="view" value="SalesOrderReport"/>
+    </request-map>
 
      <!-- Requirement request mappings -->
     <request-map uri="FindRequirements">
@@ -1760,6 +1765,7 @@
     <view-map name="SalesByStoreReport" type="screenfop" page="component://order/widget/ordermgr/ReportScreens.xml#SalesByStoreReport" content-type="application/pdf" encoding="none"/>
     <view-map name="OpenOrderItemsReport" type="screen" page="component://order/widget/ordermgr/ReportScreens.xml#OpenOrderItemsReport"/>
     <view-map name="PurchasesByOrganizationReport" type="screenfop" page="component://order/widget/ordermgr/ReportScreens.xml#PurchasesByOrganizationReport" content-type="application/pdf" encoding="none"/>
+    <view-map name="SalesOrderReport" type="birt" page="component://birt/webapp/birt/report/SalesReport.rptdesign" content-type="application/pdf"/>
 
     <view-map name="FindRequirements" type="screen" page="component://order/widget/ordermgr/RequirementScreens.xml#FindRequirements"/>
     <view-map name="EditRequirement" type="screen" page="component://order/widget/ordermgr/RequirementScreens.xml#EditRequirement"/>

Modified: ofbiz/trunk/applications/order/widget/ordermgr/ReportForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/ReportForms.xml?rev=883699&r1=883698&r2=883699&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/widget/ordermgr/ReportForms.xml (original)
+++ ofbiz/trunk/applications/order/widget/ordermgr/ReportForms.xml Tue Nov 24 14:07:47 2009
@@ -195,4 +195,40 @@
         <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>
+    
+    <!--New From-->
+    <form name="SalesReport" type="single" target="SalesReport.pdf" title=""
+        header-row-style="header-row" default-table-style="basic-table">
+<!--        <field name="report">
+            <drop-down allow-empty="false">
+                <option key="BIC" description="BIC"/>
+                <option key="NBO" description="NBO"/>
+            </drop-down>
+        </field>-->
+<!--        <field name="productStoreId">
+            <drop-down allow-empty="false">
+                <option key="" description="- ${uiLabelMap.CommonSelectAny} -"/>
+                <entity-options entity-name="ProductStore" description="${storeName} [${productStoreId}]">
+                    <entity-order-by field-name="storeName"/>
+                </entity-options>
+            </drop-down>
+        </field>-->
+<!--        <field name="orderTypeId">
+            <drop-down allow-empty="false">
+                <option key="SALES_ORDER" description="${uiLabelMap.OrderSalesOrder}"/>
+                <option key="PURCHASE_ORDER" description="${uiLabelMap.OrderPurchaseOrder}"/>
+            </drop-down>
+        </field>-->
+<!--        <field name="orderStatusId">
+            <drop-down allow-empty="false">
+                <option key="" description="- ${uiLabelMap.CommonSelectAny} -"/>
+                <entity-options entity-name="StatusItem" description="${description}" key-field-name="statusId">
+                    <entity-constraint name="statusTypeId" operator="equals" value="ORDER_STATUS"/>
+                </entity-options>
+            </drop-down>
+        </field>-->
+        <field name="fromDate" title="${uiLabelMap.OrderReportFromDate}"><date-time type="timestamp"/></field>
+        <field name="thruDate" title="${uiLabelMap.OrderReportThruDate}"><date-time type="timestamp"/></field>
+        <field name="submitButton" title="${uiLabelMap.CommonRun}" widget-style="smallSubmit"><submit button-type="button"/></field>
+    </form>
 </forms>
\ No newline at end of file

Modified: ofbiz/trunk/applications/order/widget/ordermgr/ReportScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/ReportScreens.xml?rev=883699&r1=883698&r2=883699&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/widget/ordermgr/ReportScreens.xml (original)
+++ ofbiz/trunk/applications/order/widget/ordermgr/ReportScreens.xml Tue Nov 24 14:07:47 2009
@@ -96,6 +96,17 @@
             </widgets>
         </section>
     </screen>
+    
+    <!--New Screen-->
+    <screen name="SalesReport">
+        <section>
+            <widgets>
+                <screenlet title="Sales Report">
+                    <include-form name="SalesReport" location="component://order/widget/ordermgr/ReportForms.xml"/>
+                </screenlet>
+            </widgets>
+        </section>
+    </screen>
 
     <screen name="OrderPurchaseReportPayment">
         <section>
@@ -280,4 +291,22 @@
             </widgets>
         </section>
     </screen>
+    
+    <screen name="SalesOrderReport">
+        <section>
+  <!--          <actions>
+                <entity-condition entity-name="SalesOrderItemStarSchema" list="SalesReportList">
+                    <condition-list combine="and">
+                        <condition-expr field-name="orderDate" operator="greater-equals" from-field="parameters.fromOrderDate" ignore-if-null="true"/>
+                        <condition-expr field-name="orderDate" operator="less" from-field="parameters.thruOrderDate" ignore-if-null="true"/>
+                    </condition-list>
+                </entity-condition>
+                </actions>-->
+            <widgets>
+                <platform-specific>
+                    <xml><html-template location="component://birt/webapp/birt/report/SalesReport.rptdesign"/></xml>
+                </platform-specific>
+            </widgets>
+        </section>
+    </screen>
 </screens>

Modified: ofbiz/trunk/framework/bi/script/org/ofbiz/bi/DimensionServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/bi/script/org/ofbiz/bi/DimensionServices.xml?rev=883699&r1=883698&r2=883699&view=diff
==============================================================================
--- ofbiz/trunk/framework/bi/script/org/ofbiz/bi/DimensionServices.xml (original)
+++ ofbiz/trunk/framework/bi/script/org/ofbiz/bi/DimensionServices.xml Tue Nov 24 14:07:47 2009
@@ -46,8 +46,25 @@
         <iterate list="invoices" entry="invoice">
             <clear-field field="inMap"/>
             <set field="inMap.invoiceId" from-field="invoice.invoiceId"/>
+            <log level="always" message="===================inMap : ${inMap}"/>
             <call-service service-name="loadSalesInvoiceFact" in-map-name="inMap"/>
             <check-errors/>
         </iterate>
+        
+        <!-- loads the order items in the SalesOrderItemFact fact entity -->
+        <entity-condition entity-name="OrderHeader" list="orderHeaders">
+            <condition-list>
+                <condition-expr field-name="orderTypeId" value="SALES_ORDER"/>
+                <condition-expr field-name="orderDate" operator="greater-equals" from-field="parameters.fromDate"/>
+                <condition-expr field-name="orderDate" operator="less-equals" from-field="parameters.thruDate"/>
+            </condition-list>
+        </entity-condition>
+        <iterate list="orderHeaders" entry="orderHeader">
+            <clear-field field="inMap"/>
+            <set field="inMap.orderId" from-field="orderHeader.orderId"/>
+            <log level="always" message="===================inMap : ${inMap}"/>
+            <call-service service-name="loadSalesOrderFact" in-map-name="inMap"></call-service>
+            <check-errors/>
+        </iterate>
     </simple-method>
 </simple-methods>