svn commit: r1055774 [1/5] - in /ofbiz/trunk: applications/accounting/data/ applications/order/ applications/order/entitydef/ applications/order/script/org/ofbiz/order/olap/ applications/order/script/org/ofbiz/order/reports/ applications/order/serviced...

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

svn commit: r1055774 [1/5] - in /ofbiz/trunk: applications/accounting/data/ applications/order/ applications/order/entitydef/ applications/order/script/org/ofbiz/order/olap/ applications/order/script/org/ofbiz/order/reports/ applications/order/serviced...

hansbak-2
Author: hansbak
Date: Thu Jan  6 07:37:45 2011
New Revision: 1055774

URL: http://svn.apache.org/viewvc?rev=1055774&view=rev
Log:
add a popular categories section to the ecommerce frontpage which is generated from the data warehouse of real orders. Also adjusted the sales reports from the data warehouse by week/month/year. Demo data included is for display only

Added:
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/CheckReportBy.groovy
    ofbiz/trunk/applications/order/webapp/ordermgr/reports/SalesReportMonth.rptdesign
    ofbiz/trunk/applications/order/webapp/ordermgr/reports/SalesReportWeek.rptdesign
    ofbiz/trunk/specialpurpose/ecommerce/data/DemoPopularCategoriesData.xml
    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/BestSellingCategory.groovy
    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ShowBestSellingCategory.ftl
Modified:
    ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml
    ofbiz/trunk/applications/order/entitydef/entitymodel_olap.xml
    ofbiz/trunk/applications/order/ofbiz-component.xml
    ofbiz/trunk/applications/order/script/org/ofbiz/order/olap/FactServices.xml
    ofbiz/trunk/applications/order/script/org/ofbiz/order/reports/SalesReportEvent.xml
    ofbiz/trunk/applications/order/servicedef/services_olap.xml
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/SalesReport.groovy
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
    ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl
    ofbiz/trunk/applications/order/webapp/ordermgr/reports/SalesReport.rptdesign
    ofbiz/trunk/applications/order/widget/ordermgr/ReportForms.xml
    ofbiz/trunk/applications/product/data/ProductTypeData.xml
    ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
    ofbiz/trunk/applications/product/servicedef/services.xml
    ofbiz/trunk/framework/birt/src/org/ofbiz/birt/BirtWorker.java
    ofbiz/trunk/specialpurpose/ecommerce/ofbiz-component.xml
    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/main.ftl
    ofbiz/trunk/specialpurpose/ecommerce/widget/CatalogScreens.xml

Modified: ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml?rev=1055774&r1=1055773&r2=1055774&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml (original)
+++ ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml Thu Jan  6 07:37:45 2011
@@ -407,6 +407,7 @@ under the License.
     <!-- to convert demo invoice -->
     <UomConversionDated uomId="USD" uomIdTo="EUR" fromDate="2001-01-01 00:00:00.0" conversionFactor="0.7"/>
     <UomConversionDated uomId="EUR" uomIdTo="USD" fromDate="2001-01-01 00:00:00.0" conversionFactor="1.5"/>
+    <UomConversionDated uomId="USD" uomIdTo="USD" fromDate="2001-01-01 00:00:00.0" conversionFactor="1"/>
 
     <!-- Gl Reconciliation -->
     <GlReconciliation glReconciliationId="9000" glReconciliationName="demoGlReconciliation" glAccountId="111100" statusId="GLREC_RECONCILED" organizationPartyId="Company" reconciledBalance="75000.00" reconciledDate="2009-08-08 20:03:14.000"/>

Modified: ofbiz/trunk/applications/order/entitydef/entitymodel_olap.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/entitydef/entitymodel_olap.xml?rev=1055774&r1=1055773&r2=1055774&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/entitydef/entitymodel_olap.xml (original)
+++ ofbiz/trunk/applications/order/entitydef/entitymodel_olap.xml Thu Jan  6 07:37:45 2011
@@ -38,14 +38,14 @@ under the License.
         <field name="origCurrencyDimId" type="id-ne"></field>
         <field name="billToCustomerDimId" type="id-ne"></field> <!-- TODO: implement the dimension -->
         
-        <field name="productStoreId" type="id-ne"></field>      
+        <field name="productCategoryId" type="id-ne"></field>
+        <field name="productStoreId" type="id-ne"></field>
         <field name="salesChannelEnumId" type="id-ne"></field>
-        <field name="saleChannel" type="description"></field>
-        <field name="orderStatus" type="description"></field>
-        <field name="visitId" type="id-ne"></field>
-        <field name="initialReferrer" type="url"></field>
-        <field name="productPromoCode" type="id"></field>
-        <field name="categoryName" type="id"></field>
+        <field name="statusId" type="id-ne"></field>
+        
+        <field name="brand" type="name"></field>
+        <field name="pod" type="name"></field>
+        <field name="account" type="name"></field>
         
         <field name="quantity" type="fixed-point">
             <description>Quantity order. From OrderItem.quantity</description>
@@ -70,103 +70,27 @@ under the License.
             <description>Extended tax amount.</description>
         </field>
         
-        <field name="GrossSales" type="currency-precise">
-            <description>Gross Sales: extGrossAmount less extShippingAmount.</description>
-        </field>
-        <field name="GrossMerchandizeSales" type="currency-precise">
-            <description>Gross Merchandize Sales: extGrossAmount.</description>
-        </field>
-        <field name="GrossMerchandizeProfit" type="currency-precise">
-            <description>Gross Merchandize Profit: GrossMerchandizeSales less default price.</description>
-        </field>
-        <field name="GrossShippingProfit" type="currency-precise">
-            <description>Gross Shipping Profit</description>
-        </field>
-        <field name="GrossProfit" type="currency-precise">
-            <description>Gross Profit: GrossMerchandizeProfit less GrossShippingProfit.</description>
-        </field>
-        
-        <field name="eBay" type="currency-precise">
-            <description>eBay Fee: current ebay fee is captured manually by employee and updated into sharepoint list.</description>
-        </field>
-        <field name="RRC" type="currency-precise">
-            <description>RRC: the total amount of our RRC (refund, replace and cancellation).</description>
-        </field>
-        <field name="OtherFree" type="currency-precise">
-            <description>Others: other fee which calculation is just a percentage of GrossSales.</description>
-        </field>
-        
-        <field name="NBO" type="currency-precise">
-            <description>NBO: NBO which calculation is GrossProfit minus all the fees (eBay,RRC and Others).</description>
-        </field>
-        
-        <field name="CountDate" type="currency-precise">
-            <description>CountDate: Count of date.</description>
-        </field>
-<!--        <field name="AverageMerchandizeProfit" type="currency-precise">
-            <description>Average Merchandize Profit</description>
-        </field>
-        <field name="AverageGrossProfit" type="currency-precise">
-            <description>Average Gross Profit</description>
-        </field>-->
-
-        <!--<field name="extGrossAmount" type="currency-precise">
-            <description>Extended gross amount: quantity invoiced multiplied by the list unit price.</description>
-        </field>
-        <field name="extDiscountAmount" type="currency-precise">
-            <description>Extended discount amount.</description>
-        </field>
-        <field name="extNetAmount" type="currency-precise">
-            <description>Extended net amount: gross amount less discounts.</description>
-        </field>
-        <field name="extShippingAmount" type="currency-precise">
-        <description>Extended shipping amount.</description>
-        </field>
-        <field name="extTaxAmount" type="currency-precise">
-            <description>Extended tax amount.</description>
-        </field>
-        <field name="extManFixedCost" type="currency-precise">
-            <description>Extended manufacturing fixed cost.</description>
-        </field>
-        <field name="extManVarCost" type="currency-precise">
-            <description>Extended manufacturing variable cost.</description>
-        </field>
-        <field name="extStorageCost" type="currency-precise">
-            <description>Extended storage cost.</description>
-        </field>
-        <field name="extDistributionCost" type="currency-precise">
-            <description>Extended distribution cost.</description>
-        </field>
-        <field name="contributionAmount" type="currency-precise">
-            <description>Extended net amount less all the costs.</description>
-        </field>-->
-        <!--
-        TODO: implement multi-currency fields
-        <field name="extGrossAmountOrig" type="currency-precise">
-            <description>Extended gross amount in the original currency: quantity invoiced multiplied by the list unit price.</description>
-        </field>
-        <field name="extDiscountAmountOrig" type="currency-precise">
-            <description>Extended discount amount in the original currency.</description>
+        <field name="GS" type="currency-precise">
+            <description>Gross Sales: Gross Amount plus Shipping Amount.</description>
         </field>
-        <field name="extNetAmountOrig" type="currency-precise">
-            <description>Extended net amount in the original currency: gross amount less discounts.</description>
+        <field name="GMS" type="currency-precise">
+            <description>Gross Merchandize Sales: Gross Amount.</description>
         </field>
-        <field name="extManFixedCostOrig" type="currency-precise">
-            <description>Extended manufacturing fixed cost in the original currency.</description>
+        <field name="GMP" type="currency-precise">
+            <description>Gross Merchandize Profit: Gross Merchandize Sales less Gross Cost.</description>
         </field>
-        <field name="extManVarCostOrig" type="currency-precise">
-            <description>Extended manufacturing variable cost in the original currency.</description>
+        <field name="GSS" type="currency-precise">
+            <description>Gross Shipping Sales: Shipping Amount</description>
         </field>
-        <field name="extStorageCostOrig" type="currency-precise">
-            <description>Extended storage cost in the original currency.</description>
+        <field name="GSC" type="currency-precise">
+            <description>Gross Shipping Cost</description>
         </field>
-        <field name="extDistributionCostOrig" type="currency-precise">
-            <description>Extended distribution cost in the original currency.</description>
+        <field name="GSP" type="currency-precise">
+            <description>Gross Shipping Profit: Gross Shipping Sales less Gross Shipping Cost.</description>
         </field>
-        <field name="contributionAmountOrig" type="currency-precise">
-            <description>Extended net amount less all the costs in the original currency.</description>
+        <field name="GP" type="currency-precise">
+            <description>Gross Profit: Gross Merchandize Profit less Gross Shipping Profit.</description>
         </field>
-        -->
 
         <prim-key field="orderId"/>
         <prim-key field="orderItemSeqId"/>
@@ -210,28 +134,26 @@ under the License.
             <exclude field="productDimId"/>
             <exclude field="origCurrencyDimId"/>
             <exclude field="billToCustomerDimId"/>
+            <exclude field="productCategoryId"/>
             <exclude field="productStoreId"/>
             <exclude field="salesChannelEnumId"/>
-            <exclude field="saleChannel"/>
-            <exclude field="orderStatus"/>
-            <exclude field="visitId"/>
-            <exclude field="initialReferrer"/>
-            <exclude field="productPromoCode"/>
-            <exclude field="categoryName"/>
+            <exclude field="statusId"/>
+            <exclude field="brand"/>
+            <exclude field="pod"/>
+            <exclude field="account"/>
         </alias-all>
         <alias entity-alias="SOIF" name="orderId" group-by="true">
             <description>Order id</description>
         </alias>
 
         <alias entity-alias="SOIF" name="orderItemSeqId" group-by="true"/>
+        <alias entity-alias="SOIF" name="productCategoryId" group-by="true"/>
         <alias entity-alias="SOIF" name="productStoreId" group-by="true"/>
         <alias entity-alias="SOIF" name="salesChannelEnumId" group-by="true"/>
-        <alias entity-alias="SOIF" name="saleChannel" group-by="true"/>
-        <alias entity-alias="SOIF" name="orderStatus" group-by="true"/>
-        <alias entity-alias="SOIF" name="visitId" group-by="true"/>
-        <alias entity-alias="SOIF" name="initialReferrer" group-by="true"/>
-        <alias entity-alias="SOIF" name="productPromoCode" group-by="true"/>
-        <alias entity-alias="SOIF" name="categoryName" group-by="true"/>
+        <alias entity-alias="SOIF" name="statusId" group-by="true"/>
+        <alias entity-alias="SOIF" name="brand" group-by="true"/>
+        <alias entity-alias="SOIF" name="pod" group-by="true"/>
+        <alias entity-alias="SOIF" name="account" group-by="true"/>
 
         <view-link entity-alias="SOIF" rel-entity-alias="ODD">
             <key-map field-name="orderDateDimId" rel-field-name="dimensionId"/>

Modified: ofbiz/trunk/applications/order/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/ofbiz-component.xml?rev=1055774&r1=1055773&r2=1055774&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/ofbiz-component.xml (original)
+++ ofbiz/trunk/applications/order/ofbiz-component.xml Thu Jan  6 07:37:45 2011
@@ -38,7 +38,6 @@ under the License.
     <entity-resource type="data" reader-name="seed" loader="main" location="data/OrderHelpData.xml"/>
     <entity-resource type="data" reader-name="demo" loader="main" location="data/OrderDemoUser.xml"/>
     <entity-resource type="data" reader-name="demo" loader="main" location="data/OrderDemoData.xml"/>
-    <entity-resource type="data" reader-name="demo" loader="main" location="data/SalesOrderDemoData.xml"/>
 
     <service-resource type="model" loader="main" location="servicedef/services.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services_cart.xml"/>
@@ -49,6 +48,7 @@ under the License.
     <service-resource type="model" loader="main" location="servicedef/services_return.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services_upgrade.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services_checkout.xml"/>
+    <service-resource type="model" loader="main" location="servicedef/services_olap.xml"/>
     <service-resource type="eca" loader="main" location="servicedef/secas.xml"/>
 
     <test-suite loader="main" location="testdef/OrderTest.xml"/>

Modified: 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=1055774&r1=1055773&r2=1055774&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/olap/FactServices.xml (original)
+++ ofbiz/trunk/applications/order/script/org/ofbiz/order/olap/FactServices.xml Thu Jan  6 07:37:45 2011
@@ -30,15 +30,27 @@ under the License.
         </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 field="orderHeader.statusId" operator="equals" value="ORDER_APPROVED">
+                <entity-condition entity-name="OrderItem" list="orderItems">
+                    <condition-list combine="and">
+                        <condition-expr field-name="orderId" operator="equals" from-field="orderHeader.orderId"/>
+                        <!--<condition-expr field-name="productId" operator="not-like" value="M00%"/>-->
+                        <condition-expr field-name="orderItemTypeId" operator="equals" value="PRODUCT_ORDER_ITEM"/>
+                        <!--<condition-expr field-name="statusId" operator="equals" value="ITEM_APPROVED"/>-->
+                    </condition-list>
+                </entity-condition>
+                
+                <!--<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>
         </if-compare>
     </simple-method>
     
@@ -69,7 +81,7 @@ under the License.
         </if-empty>
         <check-errors/>
 
-        <if-compare field="orderHeader.orderTypeId" operator="equals" value="SALES_ORDER">
+        <if-compare field="orderHeader.statusId" operator="equals" value="ORDER_APPROVED">
             <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"/>
@@ -79,12 +91,45 @@ under the License.
                 <make-value entity-name="SalesOrderItemFact" value-field="fact"/>
                 <set field="fact.orderId" from-field="orderHeader.orderId"/>
                 <set field="fact.orderItemSeqId" from-field="orderItem.orderItemSeqId"/>
+                <set field="fact.productStoreId" from-field="orderHeader.productStoreId"/>
                 <set field="fact.salesChannelEnumId" from-field="orderHeader.salesChannelEnumId"/>
+                <set field="fact.statusId" from-field="orderItem.statusId"/>
+                
+                <!-- account -->
+                <if-not-empty field="orderHeader.productStoreId">
+                    <entity-one entity-name="ProductStore" value-field="account">
+                        <field-map field-name="productStoreId" from-field="orderHeader.productStoreId"/>
+                    </entity-one>
+                    <set field="fact.account" from-field="account.storeName"/>
+                </if-not-empty>
+                
+                <!-- pod -->
+                <if-compare field="orderHeader.currencyUom" operator="equals" value="EUR">
+                    <set field="fact.pod" value="Latin"/>
+                <else>
+                    <set field="fact.pod" value="English"/>
+                </else>
+                </if-compare>
+                
+                <!-- brand -->
+                <if-not-empty field="orderHeader.salesChannelEnumId">
+                    <entity-one entity-name="Enumeration" value-field="brand">
+                        <field-map field-name="enumId" from-field="orderHeader.salesChannelEnumId"/>
+                    </entity-one>
+                    <set field="fact.brand" from-field="brand.description"/>
+                </if-not-empty>
+                
                 <!-- conversion of the order date -->
-                <if-not-empty field="orderHeader.orderDate">
+                <entity-and entity-name="OrderStatus" list="orderStatusList">
+                    <field-map field-name="orderId" from-field="orderHeader.orderId"/>
+                    <field-map field-name="orderItemSeqId" from-field="orderItem.orderItemSeqId"/>
+                    <field-map field-name="statusId" value="ITEM_APPROVED"/>
+                </entity-and>
+                <first-from-list entry="orderStatus" list="orderStatusList"/>
+                <if-not-empty field="orderStatus.statusDatetime">
                     <clear-field field="inMap"/>
                     <set field="inMap.dimensionEntityName" value="DateDimension"/>
-                    <set field="inMap.naturalKeyFields.dateValue" from-field="orderHeader.orderDate" type="Date"/>
+                    <set field="inMap.naturalKeyFields.dateValue" from-field="orderStatus.statusDatetime" type="Date"/>
                     <call-service service-name="getDimensionIdFromNaturalKey" in-map-name="inMap">
                         <result-to-field result-name="dimensionId" field="fact.orderDateDimId"/>
                     </call-service>
@@ -95,6 +140,7 @@ under the License.
                     <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"/>
@@ -110,6 +156,7 @@ under the License.
                     <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"/>
@@ -125,6 +172,17 @@ under the License.
                     <set field="fact.origCurrencyDimId" value="_NA_"/>
                 </else>
                 </if-not-empty>
+                
+                <!-- productCategoryId -->
+                <entity-and entity-name="ProductCategoryMember" list="productCategoryMembers">
+                    <field-map field-name="productId" from-field="orderItem.productId"/>
+                    <field-map field-name="thruDate" from-field="nullField"/>
+                </entity-and>
+                <if-not-empty field="productCategoryMembers">
+                    <first-from-list list="productCategoryMembers" entry="productCategoryMember"/>
+                    <set field="fact.productCategoryId" from-field="productCategoryMember.productCategoryId"/>
+                </if-not-empty>
+                
                 <!-- TODO -->
                 <set field="fact.billToCustomerDimId" value="_NA_"/>
               
@@ -134,42 +192,75 @@ under the License.
             <!-- 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"/>-->
-            
-            <!-- amount -->
-            <calculate field="fact.extGrossAmount">
-                <calcop field="fact.quantity" operator="multiply">
-                    <calcop field="orderItem.unitPrice" operator="get"/>
-                </calcop>
-            </calculate>
+            <set field="fact.extGrossAmount" value="0" type="BigDecimal"/>
+            <set field="fact.extDiscountAmount" value="0" type="BigDecimal"/>
+            <set field="fact.extNetAmount" value="0" type="BigDecimal"/>
+            <set field="fact.extShippingAmount" value="0" type="BigDecimal"/>
+            <set field="fact.extTaxAmount" value="0" type="BigDecimal"/>
+            
+            <set field="fact.GS" value="0" type="BigDecimal"/>
+            <set field="fact.GMS" value="0" type="BigDecimal"/>
+            <set field="fact.GMP" value="0" type="BigDecimal"/>
+            <set field="fact.GSS" value="0" type="BigDecimal"/>
+            <set field="fact.GSC" value="0" type="BigDecimal"/>
+            <set field="fact.GSP" value="0" type="BigDecimal"/>
+            <set field="fact.GP" value="0" type="BigDecimal"/>
+            
+            <!-- extGrossAmount -->
+            <entity-condition entity-name="UomConversionDated" list="UomConversionDatedList">
+                <condition-list combine="and">
+                    <condition-expr field-name="uomId" operator="equals" from-field="orderHeader.currencyUom"/>
+                    <condition-expr field-name="uomIdTo" operator="equals" value="USD"/>
+                    <condition-expr field-name="thruDate" operator="equals" from-field="nullField"/>
+                </condition-list>
+            </entity-condition>
+            <if-not-empty field="UomConversionDatedList">
+                <first-from-list entry="UomConversion" list="UomConversionDatedList"/>
+                <calculate field="unitPrice">
+                    <calcop field="orderItem.unitPrice" operator="multiply">
+                        <calcop field="UomConversion.conversionFactor" operator="get"/>
+                    </calcop>
+                </calculate>
+                
+                <calculate field="fact.extGrossAmount">
+                    <calcop field="fact.quantity" operator="multiply">
+                        <calcop field="unitPrice" operator="get"/>
+                    </calcop>
+                </calculate>
+            </if-not-empty>
             
-            <!-- cost -->
-            <entity-and entity-name="SupplierProduct" list="costs">
-                <field-map field-name="productId" from-field="orderItem.productId"/>
-            </entity-and>
-            <iterate list="costs" entry="cost">
-                <if-compare field="cost.minimumOrderQuantity" operator="equals" value="0">
-                    <calculate field="fact.extGrossCost">
-                        <calcop field="fact.quantity" operator="multiply">
-                            <calcop field="cost.lastPrice" operator="get"/>
-                        </calcop>
-                    </calculate>
-                </if-compare>
-            </iterate>
+            <!-- extGrossCost -->
+            <entity-condition entity-name="UomConversionDated" list="UomConversionDatedList">
+                <condition-list combine="and">
+                    <condition-expr field-name="uomId" operator="equals" from-field="orderHeader.currencyUom"/>
+                    <condition-expr field-name="uomIdTo" operator="equals" value="USD"/>
+                    <condition-expr field-name="thruDate" operator="equals" from-field="nullField"/>
+                </condition-list>
+            </entity-condition>
+            <if-not-empty field="UomConversionDatedList">
+                <first-from-list entry="UomConversion" list="UomConversionDatedList"/>
+                
+                <entity-and entity-name="SupplierProduct" list="costs">
+                    <field-map field-name="productId" from-field="orderItem.productId"/>
+                </entity-and>
+                <iterate list="costs" entry="cost">
+                    <if-compare field="cost.minimumOrderQuantity" operator="equals" value="0">
+                        <calculate field="costPrice">
+                            <calcop field="cost.lastPrice" operator="multiply">
+                                <calcop field="UomConversion.conversionFactor" operator="get"/>
+                            </calcop>
+                        </calculate>
+                    
+                        <calculate field="fact.extGrossCost">
+                            <calcop field="fact.quantity" operator="multiply">
+                                <calcop field="costPrice" operator="get"/>
+                            </calcop>
+                        </calculate>
+                    </if-compare>
+                </iterate>
+            </if-not-empty>
             
-            <!-- shipping -->
+            <!-- extShippingAmount -->
             <iterate list="orderAdjustments" entry="shipping">
                 <if-compare field="shipping.orderAdjustmentTypeId" operator="equals" value="SHIPPING_CHARGES">
                     <calculate field="fact.extShippingAmount">
@@ -180,7 +271,7 @@ under the License.
                 </if-compare>
             </iterate>
             
-            <!-- taxes -->
+            <!-- extTaxAmount -->
             <iterate list="orderAdjustments" entry="tax">
                 <if-compare field="tax.orderAdjustmentTypeId" operator="equals" value="SALES_TAX">
                     <calculate field="fact.extTaxAmount">
@@ -191,7 +282,7 @@ under the License.
                 </if-compare>
             </iterate>
             
-            <!-- discounts -->
+            <!-- extDiscountAmount -->
             <iterate list="orderAdjustments" entry="discount">
                 <if-compare field="discount.orderAdjustmentTypeId" operator="equals" value="PROMOTION_ADJUSTMENT">
                     <calculate field="fact.extDiscountAmount">
@@ -213,145 +304,161 @@ under the License.
                 </if-compare>
             </iterate>
 
-            <!-- net -->
+            <!-- extNetAmount -->
             <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>
+            <!-- GS -->
+            <set field="countGS" value="0"/>
+            <entity-and entity-name="SalesOrderItemFact" list="checkGSList">
+                <field-map field-name="orderId" from-field="orderHeader.orderId"/>
+            </entity-and>
+            <iterate entry="checkGS" list="checkGSList">
+                <if-not-empty field="checkGS.GS">
+                    <if-compare field="checkGS.GS" operator="not-equals" value="0">
+                        <set field="countGS" value="1"/>
+                    </if-compare>
+                </if-not-empty>
+            </iterate>
+            <if-compare field="countGS" operator="equals" value="0">
+                <entity-condition entity-name="UomConversionDated" list="UomConversionDatedList">
+                    <condition-list combine="and">
+                        <condition-expr field-name="uomId" operator="equals" from-field="orderHeader.currencyUom"/>
+                        <condition-expr field-name="uomIdTo" operator="equals" value="USD"/>
+                        <condition-expr field-name="thruDate" operator="equals" from-field="nullField"/>
+                    </condition-list>
+                </entity-condition>
+                <if-not-empty field="UomConversionDatedList">
+                    <first-from-list entry="UomConversion" list="UomConversionDatedList"/>
+                    <calculate field="fact.GS">
+                        <calcop field="orderHeader.grandTotal" operator="multiply">
+                            <calcop field="UomConversion.conversionFactor" operator="get"/>
+                        </calcop>
+                    </calculate>
+                </if-not-empty>
+            </if-compare>
             
-            <!-- Gross Merchandize Sales -->
-            <calculate field="fact.GrossMerchandizeSales">
-                <calcop field="fact.GrossMerchandizeSales" operator="add">
+            <!-- GMS -->
+            <calculate field="fact.GMS">
+                <calcop field="fact.GMS" operator="add">
                     <calcop field="fact.extGrossAmount" operator="get"/>
                 </calcop>
             </calculate>
             
-            <!-- Gross Merchandize Profit -->
-            <calculate field="fact.GrossMerchandizeProfit">
-                <calcop field="fact.GrossMerchandizeSales" operator="subtract">
+            <!-- GMP -->
+            <calculate field="fact.GMP">
+                <calcop field="fact.GMS" operator="subtract">
                     <calcop field="fact.extGrossCost" operator="get"/>
                 </calcop>
             </calculate>
             
-            <!-- Product Store -->
-            <if-not-empty field="orderHeader.productStoreId">
-                <set field="fact.productStoreId" from-field="orderHeader.productStoreId"/>
-            </if-not-empty>
-            
-            <!-- Sale Channel -->
-            <if-not-empty field="orderHeader.salesChannelEnumId">
-                <entity-one entity-name="Enumeration" value-field="enumeration">
-                    <field-map field-name="enumId" from-field="orderHeader.salesChannelEnumId"/>
-                </entity-one>
-                <if-not-empty field="enumeration">
-                    <set field="fact.saleChannel" from-field="enumeration.description"/>
+            <!-- GSP -->
+            <set field="countGSP" value="0"/>
+            <entity-and entity-name="SalesOrderItemFact" list="checkGSPList">
+                <field-map field-name="orderId" from-field="orderHeader.orderId"/>
+            </entity-and>
+            <iterate entry="checkGSP" list="checkGSPList">
+                <if-not-empty field="checkGSP.GSP">
+                    <if-compare field="checkGSP.GSP" operator="not-equals" value="0">
+                        <set field="countGSP" value="1"/>
+                    </if-compare>
                 </if-not-empty>
-            </if-not-empty>
-
-            <!-- Order status -->
-            <if-not-empty field="orderHeader.statusId">
-                <entity-one entity-name="StatusItem" value-field="statusItem">
-                <field-map field-name="statusId" from-field="orderHeader.statusId"/>
-                </entity-one>
-                <if-not-empty field="statusItem">
-                <set field="fact.orderStatus" from-field="statusItem.description"/>
+            </iterate>
+            <if-compare field="countGSP" operator="equals" value="0">
+                <entity-and list="orderItemList" entity-name="OrderItem">
+                    <field-map field-name="orderId" from-field="orderHeader.orderId"/>
+                </entity-and>
+                
+                <entity-condition entity-name="UomConversionDated" list="UomConversionDatedList">
+                    <condition-list combine="and">
+                        <condition-expr field-name="uomId" operator="equals" from-field="orderHeader.currencyUom"/>
+                        <condition-expr field-name="uomIdTo" operator="equals" value="USD"/>
+                        <condition-expr field-name="thruDate" operator="equals" from-field="nullField"/>
+                    </condition-list>
+                </entity-condition>
+                <if-not-empty field="UomConversionDatedList">
+                    <first-from-list entry="UomConversion" list="UomConversionDatedList"/>
+                    <calculate field="GSS">
+                        <calcop field="fact.extShippingAmount" operator="multiply">
+                            <calcop field="UomConversion.conversionFactor" operator="get"/>
+                        </calcop>
+                    </calculate>
                 </if-not-empty>
-            </if-not-empty>
-            
-            <!-- Order visit and referrer -->
-            <if-not-empty field="orderHeader.visitId">
-                <entity-one entity-name="Visit" value-field="visit">
-                <field-map field-name="visitId" from-field="orderHeader.visitId"/>
-                </entity-one>
-                <if-not-empty field="visit">
-                    <set field="fact.visitId" from-field="visit.visitId"/>
-                    <set field="fact.initialReferrer" from-field="visit.initialReferrer"/>
+                <set field="fact.GSS" from-field="GSS"/>
+                
+                <!--<entity-condition entity-name="UomConversionDated" list="UomConversionDatedList">
+                    <condition-list combine="and">
+                        <condition-expr field-name="uomId" operator="equals" value="orderHeader.currencyUom"/>
+                        <condition-expr field-name="uomIdTo" operator="equals" value="USD"/>
+                        <condition-expr field-name="thruDate" operator="equals" from-field="nullField"/>
+                    </condition-list>
+                </entity-condition>
+                <if-not-empty field="UomConversionDatedList">
+                    <first-from-list entry="UomConversion" list="UomConversionDatedList"/>
+                    <calculate field="GSC">
+                        <calcop field="GSC" operator="multiply">
+                            <calcop field="UomConversion.conversionFactor" operator="get"/>
+                        </calcop>
+                    </calculate>
                 </if-not-empty>
-            </if-not-empty>
-            
-            <!-- Gross Shipping Profit -->
-            
-            <!-- Gross Profit -->
-            <calculate field="fact.GrossProfit">
-                <calcop field="fact.GrossMerchandizeProfit" operator="subtract">
-                    <calcop field="fact.GrossShippingProfit" operator="get"/>
-                </calcop>
-            </calculate>
-            
-            <!-- 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>-->
-            
-            <!-- eBay -->
-            <set field="fact.eBay" value="7" type="BigDecimal"/>
+                <set field="fact.GSC" from-field="GSC"/>-->
                 
-            <!-- RRC -->
-            <set field="fact.RRC" value="2" type="BigDecimal"/>
-            
-            <!-- Others -->
-            <set field="fact.OtherFree" value="5" type="BigDecimal"/>
-            
-            <!-- Others -->
-            <calculate field="fees">
-                <calcop operator="add">
-                    <calcop operator="get" field="fact.eBay"/>
-                    <calcop operator="get" field="fact.RRC"/>
-                    <calcop operator="get" field="fact.OtherFree"/>
+                <calculate field="fact.GSP">
+                    <calcop field="GSS" operator="subtract">
+                        <calcop field="GSC" operator="get"/>
+                    </calcop>
+                </calculate>
+            </if-compare>
+            
+            <!-- GP -->
+            <calculate field="fact.GP">
+                <calcop field="fact.GMP" operator="add">
+                    <calcop field="fact.GSP" operator="get"/>
                 </calcop>
             </calculate>
             
-            <!-- NBO -->
-            <calculate field="NBO" type="BigDecimal">
-                <calcop operator="subtract">
-                    <calcop operator="get" field="fact.GrossProfit"></calcop>
-                    <calcop operator="get" field="fees"></calcop>
-                </calcop>
-            </calculate>
-            <set field="fact.NBO" from-field="NBO"/>
-            
-            <!-- CountDate -->
-            <set field="fact.CountDate" value="1" type="BigDecimal"/>
-            
-            <!-- Category -->
-            <if-not-empty field="orderItem.productId">
-                <clear-field field="defaultTopCategoryId"/>
-                <entity-one entity-name="Product" value-field="product">
-                    <field-map field-name="productId" from-field="orderItem.productId"/>
-                </entity-one>
-                <set field="defaultTopCategoryId.topCategory" from-field="product.primaryProductCategoryId"/>
-                <call-service service-name="getAllCategories" in-map-name="defaultTopCategoryId">
-                    <result-to-field result-name="categories" field="categories"/>
-                </call-service>
-                <first-from-list entry="category" list="categories"/>
-                <set field="fact.categoryName" from-field="category.categoryName"/>
-            </if-not-empty>
-
             <store-value value-field="fact"/>
         </if-compare>
     </simple-method>
-  
-</simple-methods>
+    
+    <simple-method method-name="importSalesOrderData" short-description="Import Sales Order Data">
+        <now-date-to-env field="nowDate"/>
+        <set field="yesterday" value="${groovy:
+            import java.text.SimpleDateFormat;
+            def sdf = new SimpleDateFormat(&quot;yyyy-MM-dd 07:00:00.000&quot;);
+            def yesterday = sdf.format(nowDate-1);
+            return yesterday;
+        }" type="Timestamp"/>
+        <set field="today" value="${groovy:
+            import java.text.SimpleDateFormat;
+            def sdf = new SimpleDateFormat(&quot;yyyy-MM-dd 07:00:00.000&quot;);
+            def today = sdf.format(nowDate);
+            return today;
+        }" type="Timestamp"/>
+        <log level="always" message="===== yesterday:${yesterday}"></log>
+        <log level="always" message="===== today:${today}"></log>
+        
+        <set-service-fields service-name="loadDateDimension" map="parameters" to-map="inMap"/>
+        <set field="inMap.fromDate" from-field="yesterday"/>
+        <set field="inMap.thruDate" from-field="today"/>
+        <call-service service-name="loadDateDimension" in-map-name="inMap"/>
+        <check-errors/>
+        
+        <entity-condition list="orderStatusList" entity-name="OrderStatus">
+            <condition-list combine="and">
+                <condition-expr field-name="statusId" value="ORDER_APPROVED"/>
+                <condition-expr field-name="statusDatetime" operator="greater-equals" from-field="yesterday"/>
+                <condition-expr field-name="statusDatetime" operator="less" from-field="today"/>
+            </condition-list>
+        </entity-condition>
+        <iterate list="orderStatusList" entry="orderHeader">
+            <clear-field field="inMap"/>
+            <set field="inMap.orderId" from-field="orderHeader.orderId"/>
+            <call-service service-name="loadSalesOrderFact" in-map-name="inMap"></call-service>
+            <check-errors/>
+        </iterate>
+    </simple-method>
+</simple-methods>
\ No newline at end of file

Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/reports/SalesReportEvent.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/reports/SalesReportEvent.xml?rev=1055774&r1=1055773&r2=1055774&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/reports/SalesReportEvent.xml (original)
+++ ofbiz/trunk/applications/order/script/org/ofbiz/order/reports/SalesReportEvent.xml Thu Jan  6 07:37:45 2011
@@ -22,26 +22,50 @@
     xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd">
 
     <simple-method method-name="getOrder" short-description="Get Orders" login-required="false">
-        <if-not-empty field="fromDate">
-            <entity-condition entity-name="SalesOrderItemStarSchema" list="starschemas">
-                <condition-list combine="and">
-                    <condition-expr field-name="orderDateYearMonthDay" operator="greater-equals" from-field="fromDate"/>
-                    <condition-expr field-name="orderDateYearMonthDay" operator="less" from-field="thruDate"/>
-                    <condition-list combine="or">
-                        <condition-expr field-name="productStoreId" operator="equals" value="B2CStore"/>
-                        <condition-expr field-name="productStoreId" operator="equals" value="B2BStore"/>
+        <if-compare operator="equals" value="day" field="reportBy">
+            <if-not-empty field="thruDate">
+                <entity-condition entity-name="SalesOrderItemStarSchema" list="starschemas">
+                    <condition-list combine="and">
+                        <condition-expr field-name="orderDateYearMonthDay" operator="greater-equals" from-field="fromDate"/>
+                        <condition-expr field-name="orderDateYearMonthDay" operator="less-equals" from-field="thruDate"/>
                     </condition-list>
-                </condition-list>
-            </entity-condition>
-        </if-not-empty>
-        <if-empty field="fromDate">
-            <entity-condition list="starschemas" entity-name="SalesOrderItemStarSchema">
-                <condition-list combine="or">
-                    <condition-expr field-name="productStoreId" operator="equals" value="B2CStore"/>
-                    <condition-expr field-name="productStoreId" operator="equals" value="B2BStore"/>
-                </condition-list>
-            </entity-condition>
-        </if-empty>
+                </entity-condition>
+            </if-not-empty>
+        </if-compare>
+        
+        <if-compare operator="equals" value="week" field="reportBy">
+            <calculate field="fromWeek">
+                <calcop field="thruWeek" operator="subtract">
+                    <number value="3"/>
+                </calcop>
+            </calculate>
+            <if-not-empty field="thruWeek">
+                <entity-condition entity-name="SalesOrderItemStarSchema" list="starschemas">
+                    <condition-list combine="and">
+                        <condition-expr field-name="orderDateYearName" operator="equals" from-field="thisYear"/>
+                        <condition-expr field-name="orderDateWeekOfYear" operator="greater-equals" from-field="fromWeek"/>
+                        <condition-expr field-name="orderDateWeekOfYear" operator="less-equals" from-field="thruWeek"/>
+                    </condition-list>
+                </entity-condition>
+            </if-not-empty>
+        </if-compare>
+        
+        <if-compare operator="equals" value="month" field="reportBy">
+            <calculate field="fromMonth">
+                <calcop field="thruMonth" operator="subtract">
+                    <number value="3"/>
+                </calcop>
+            </calculate>
+            <if-not-empty field="fromMonth">
+                <entity-condition entity-name="SalesOrderItemStarSchema" list="starschemas">
+                    <condition-list combine="and">
+                        <condition-expr field-name="orderDateYearName" operator="equals" from-field="thisYear"/>
+                        <condition-expr field-name="orderDateMonthOfYear" operator="greater-equals" from-field="fromMonth"/>
+                        <condition-expr field-name="orderDateMonthOfYear" operator="less-equals" from-field="thruMonth"/>
+                    </condition-list>
+                </entity-condition>
+            </if-not-empty>
+        </if-compare>
     </simple-method>
     
 </simple-methods>

Modified: ofbiz/trunk/applications/order/servicedef/services_olap.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_olap.xml?rev=1055774&r1=1055773&r2=1055774&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services_olap.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services_olap.xml Thu Jan  6 07:37:45 2011
@@ -40,4 +40,9 @@ under the License.
         <attribute name="orderId" type="String" mode="IN" optional="false"/>
     </service>
     
+    <service name="importSalesOrderData" auth="true" engine="simple"
+        location="component://order/script/org/ofbiz/order/olap/FactServices.xml" invoke="importSalesOrderData">
+        <description>Import Sales Order Data.</description>
+    </service>
+    
 </services>

Added: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/CheckReportBy.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/CheckReportBy.groovy?rev=1055774&view=auto
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/CheckReportBy.groovy (added)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/CheckReportBy.groovy Thu Jan  6 07:37:45 2011
@@ -0,0 +1,39 @@
+/*
+ * 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 javax.servlet.http.HttpServletRequest;
+import org.ofbiz.base.util.UtilValidate;
+
+reportBy = parameters.reportBy;
+
+if (UtilValidate.isEmpty(parameters.fromDate)) {
+    request.setAttribute("_ERROR_MESSAGE_", "Please select From Date.");
+    return "error";
+}
+
+if (reportBy == "day") {
+    return "day";
+} else if (reportBy == "week") {
+    return "week";
+} else if (reportBy == "month") {
+    return "month";
+} else {
+    request.setAttribute("_ERROR_MESSAGE_", "Please select Report By.");
+    return "error";
+}

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/SalesReport.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/SalesReport.groovy?rev=1055774&r1=1055773&r2=1055774&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/SalesReport.groovy (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/SalesReport.groovy Thu Jan  6 07:37:45 2011
@@ -18,14 +18,23 @@
  */
 import org.ofbiz.base.util.*;
 import java.sql.*;
+import java.util.Calendar;
 
 fromDateStr = parameters.fromDate;
-thruDateStr = parameters.thruDate;
+cal = Calendar.getInstance();
+cal.setTime(Date.valueOf(fromDateStr));
+int week = cal.get(Calendar.WEEK_OF_YEAR);
+int month = cal.get(Calendar.MONTH) + 1;
+int year = cal.get(Calendar.YEAR);
 
 birtParameters = [:];
 try {
-    birtParameters.fromDate = Date.valueOf(fromDateStr);
-    birtParameters.thruDate = Date.valueOf(thruDateStr);
+    birtParameters.reportBy = parameters.reportBy;
+    birtParameters.fromDate = (Date.valueOf(fromDateStr))-3;
+    birtParameters.thruDate = Date.valueOf(fromDateStr);
+    birtParameters.thruWeek = week;
+    birtParameters.thruMonth = month;
+    birtParameters.thisYear = year;
 } catch (e) {
     Debug.logError(e, "");
 }

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=1055774&r1=1055773&r2=1055774&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Thu Jan  6 07:37:45 2011
@@ -1080,10 +1080,29 @@ under the License.
         <response name="success" type="view" value="PurchasesByOrganizationReport"/>
     </request-map>
     
+    <request-map uri="checkReportBy">
+        <security https="true" auth="true"/>
+        <event type="groovy" path="component://order/webapp/ordermgr/WEB-INF/actions/reports/" invoke="CheckReportBy.groovy"/>
+        <response name="day" type="request" value="SalesReport.pdf"/>
+        <response name="week" type="request" value="SalesReportWeek.pdf"/>
+        <response name="month" type="request" value="SalesReportMonth.pdf"/>
+        <response name="error" type="request-redirect" value="OrderPurchaseReportOptions">
+            <redirect-parameter name="fromDate"/>
+            <redirect-parameter name="reportBy" from="parameters.reportDate"/>
+        </response>
+    </request-map>
     <request-map uri="SalesReport.pdf"><security https="true" auth="true"/>
         <event type="groovy" path="component://order/webapp/ordermgr/WEB-INF/actions/reports/" invoke="SalesReport.groovy"/>
         <response name="success" type="view" value="SalesOrderReport"/>
     </request-map>
+    <request-map uri="SalesReportWeek.pdf"><security https="true" auth="true"/>
+        <event type="groovy" path="component://order/webapp/ordermgr/WEB-INF/actions/reports/" invoke="SalesReport.groovy"/>
+        <response name="success" type="view" value="SalesOrderReportWeek"/>
+    </request-map>
+    <request-map uri="SalesReportMonth.pdf"><security https="true" auth="true"/>
+        <event type="groovy" path="component://order/webapp/ordermgr/WEB-INF/actions/reports/" invoke="SalesReport.groovy"/>
+        <response name="success" type="view" value="SalesOrderReportMonth"/>
+    </request-map>
     <request-map uri="NetBeforeOverheadReport.pdf"><security https="true" auth="true"/>
         <event type="groovy" path="component://order/webapp/ordermgr/WEB-INF/actions/reports/" invoke="NetBeforeOverheadReport.groovy"/>
         <response name="success" type="view" value="NetBeforeOverheadOrderReport"/>
@@ -1825,6 +1844,8 @@ under the License.
     <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://order/webapp/ordermgr/reports/SalesReport.rptdesign" content-type="application/pdf"/>
+    <view-map name="SalesOrderReportWeek" type="birt" page="component://order/webapp/ordermgr/reports/SalesReportWeek.rptdesign" content-type="application/pdf"/>
+    <view-map name="SalesOrderReportMonth" type="birt" page="component://order/webapp/ordermgr/reports/SalesReportMonth.rptdesign" content-type="application/pdf"/>
     <view-map name="NetBeforeOverheadOrderReport" type="birt" page="component://order/webapp/ordermgr/reports/NetBeforeOverheadReport.rptdesign" content-type="application/pdf"/>
     <view-map name="ProductDemandOrderReport" type="birt" page="component://order/webapp/ordermgr/reports/ProductDemandReport.rptdesign" content-type="application/pdf"/>
     <view-map name="OrderByReferrerReport" type="birt" page="component://order/webapp/ordermgr/reports/OrderByReferrer.rptdesign" content-type="application/pdf"/>

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl?rev=1055774&r1=1055773&r2=1055774&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl Thu Jan  6 07:37:45 2011
@@ -130,13 +130,16 @@ ${virtualJavaScript?if_exists}
             </#if>
             </form>
             
-              <#if prodCatMem?exists && prodCatMem.quantity?exists && 0.00 < prodCatMem.quantity?double>222
-                <form method="post" action="<@ofbizUrl>additem</@ofbizUrl>" name="the${requestAttributes.formNamePrefix?if_exists}${requestAttributes.listIndex?if_exists}defaultform" style="margin: 0;">
-                  <input type="hidden" name="add_product_id" value="${prodCatMem.productId?if_exists}"/>
-                  <input type="hidden" name="quantity" value="${prodCatMem.quantity?if_exists}"/>
-                  <input type="hidden" name="clearSearch" value="N"/>
-                  <a href="javascript:document.the${requestAttributes.formNamePrefix?if_exists}${requestAttributes.listIndex?if_exists}defaultform.submit()" class="buttontext">${uiLabelMap.CommonAddDefault}(${prodCatMem.quantity?string.number}) ${uiLabelMap.OrderToCart}</a>
-                </form>
+              <#if prodCatMem?exists && prodCatMem.quantity?exists && 0.00 < prodCatMem.quantity?double>
+                <#assign productCategory = delegator.findByPrimaryKey("ProductCategory", Static["org.ofbiz.base.util.UtilMisc"].toMap("productCategoryId", prodCatMem.productCategoryId))/>
+                <#if productCategory.productCategoryTypeId != "BEST_SELL_CATEGORY">
+                <form method="post" action="<@ofbizUrl>additem</@ofbizUrl>" name="the${requestAttributes.formNamePrefix?if_exists}${requestAttributes.listIndex?if_exists}defaultform" style="margin: 0;">
+                  <input type="hidden" name="add_product_id" value="${prodCatMem.productId?if_exists}"/>
+                  <input type="hidden" name="quantity" value="${prodCatMem.quantity?if_exists}"/>
+                  <input type="hidden" name="clearSearch" value="N"/>
+                  <a href="javascript:document.the${requestAttributes.formNamePrefix?if_exists}${requestAttributes.listIndex?if_exists}defaultform.submit()" class="buttontext">${uiLabelMap.CommonAddDefault}(${prodCatMem.quantity?string.number}) ${uiLabelMap.OrderToCart}</a>
+                </form>
+                </#if>
               </#if>
           </#if>
         </div>