Fixes issue 19771: Wrong conversion rate used in the Sales Dimensional Report.
authorJavier Etxarri <javier.echarri@openbravo.com>
Wed, 15 Feb 2012 18:02:22 +0100
changeset 15507 a7e9e2f864a2
parent 15506 9b82d811c2b2
child 15514 0d2a19dc7dea
Fixes issue 19771: Wrong conversion rate used in the Sales Dimensional Report.
Now, the date ordered of the header will be considered to calculate the conversion
src/org/openbravo/erpCommon/ad_reports/ReportPurchaseDimensionalAnalysesJR_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportSalesDimensionalAnalyzeJR_data.xsql
--- a/src/org/openbravo/erpCommon/ad_reports/ReportPurchaseDimensionalAnalysesJR_data.xsql	Tue Feb 14 13:44:39 2012 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportPurchaseDimensionalAnalysesJR_data.xsql	Wed Feb 15 18:02:22 2012 +0100
@@ -46,7 +46,7 @@
       C_ORDERLINE.LINENETAMT, C_ORDERLINE.QTYORDERED, 
       0 AS LINENETREF, 0 AS QTYORDEREDREF, C_UOM.UOMSYMBOL,
       COALESCE(C_ORDERLINE.C_CURRENCY_ID, C_ORDER.C_CURRENCY_ID) AS TRCURRENCYID,  
-      COALESCE(TO_DATE(C_ORDERLINE.DATEORDERED), TO_DATE(C_ORDER.DATEORDERED), TO_DATE(NOW())) AS TRDATE,      
+      TO_DATE(COALESCE(C_ORDER.DATEORDERED, NOW())) AS TRDATE,
 	  C_ORDERLINE.AD_CLIENT_ID AS TRCLIENTID,      
 	  C_ORDERLINE.AD_ORG_ID AS TRORGID
       FROM M_PRODUCT left join M_PRODUCT_CATEGORY on M_PRODUCT.M_PRODUCT_CATEGORY_ID = M_PRODUCT_CATEGORY.M_PRODUCT_CATEGORY_ID 
@@ -65,7 +65,7 @@
       0 AS LINENETAMT, 0 AS QTYORDERED, 
       C_ORDERLINE.LINENETAMT AS LINENETREF, C_ORDERLINE.QTYORDERED AS QTYORDEREDREF, C_UOM.UOMSYMBOL,
       COALESCE(C_ORDERLINE.C_CURRENCY_ID, C_ORDER.C_CURRENCY_ID) AS TRCURRENCYID,    
-      COALESCE(TO_DATE(C_ORDERLINE.DATEORDERED), TO_DATE(C_ORDER.DATEORDERED), TO_DATE(NOW())) AS TRDATE,      
+      TO_DATE(COALESCE(C_ORDER.DATEORDERED, NOW())) AS TRDATE,
 	  C_ORDERLINE.AD_CLIENT_ID AS TRCLIENTID,      
 	  C_ORDERLINE.AD_ORG_ID AS TRORGID
       FROM M_PRODUCT left join M_PRODUCT_CATEGORY on M_PRODUCT.M_PRODUCT_CATEGORY_ID = M_PRODUCT_CATEGORY.M_PRODUCT_CATEGORY_ID 
@@ -140,7 +140,7 @@
       C_ORDERLINE.LINENETAMT, C_ORDERLINE.QTYORDERED, 
       0 AS LINENETREF, 0 AS QTYORDEREDREF, C_UOM.UOMSYMBOL,
       COALESCE(C_ORDERLINE.C_CURRENCY_ID, C_ORDER.C_CURRENCY_ID) AS TRCURRENCYID,  
-	  COALESCE(TO_DATE(C_ORDERLINE.DATEORDERED), TO_DATE(C_ORDER.DATEORDERED), TO_DATE(NOW())) AS TRDATE,      
+	  TO_DATE(COALESCE(C_ORDER.DATEORDERED,NOW())) AS TRDATE,
 	  C_ORDERLINE.AD_CLIENT_ID AS TRCLIENTID,      
 	  C_ORDERLINE.AD_ORG_ID AS TRORGID
       FROM M_PRODUCT left join M_PRODUCT_CATEGORY on M_PRODUCT.M_PRODUCT_CATEGORY_ID = M_PRODUCT_CATEGORY.M_PRODUCT_CATEGORY_ID
--- a/src/org/openbravo/erpCommon/ad_reports/ReportSalesDimensionalAnalyzeJR_data.xsql	Tue Feb 14 13:44:39 2012 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportSalesDimensionalAnalyzeJR_data.xsql	Wed Feb 15 18:02:22 2012 +0100
@@ -46,7 +46,7 @@
       C_ORDERLINE.LINENETAMT, C_ORDERLINE.QTYORDERED, C_ORDERLINE.QTYORDERED*M_PRODUCT.WEIGHT AS WEIGHT, 
       0 AS LINENETREF, 0 AS QTYORDEREDREF, 0 AS WEIGHTREF, C_UOM.UOMSYMBOL,
       COALESCE(C_ORDERLINE.C_CURRENCY_ID, C_ORDER.C_CURRENCY_ID) AS TRCURRENCYID,      
-	  TO_DATE(COALESCE(C_ORDERLINE.DATEORDERED, C_ORDER.DATEORDERED, NOW())) AS TRDATE,      
+	  TO_DATE(COALESCE(C_ORDER.DATEORDERED, NOW())) AS TRDATE,
       C_ORDERLINE.AD_CLIENT_ID AS TRCLIENTID,      
       C_ORDERLINE.AD_ORG_ID AS TRORGID
       FROM C_ORDER left join AD_USER on C_ORDER.SALESREP_ID = AD_USER.AD_USER_ID,
@@ -69,7 +69,7 @@
       0 AS LINENETAMT, 0 AS QTYORDERED, 0 AS WEIGHT, 
       C_ORDERLINE.LINENETAMT AS LINENETREF, C_ORDERLINE.QTYORDERED AS QTYORDEREDREF, C_ORDERLINE.QTYORDERED*M_PRODUCT.WEIGHT AS WEIGHTREF, C_UOM.UOMSYMBOL,
       COALESCE(C_ORDERLINE.C_CURRENCY_ID, C_ORDER.C_CURRENCY_ID) AS TRCURRENCYID,      
-	  TO_DATE(COALESCE(C_ORDERLINE.DATEORDERED, C_ORDER.DATEORDERED, NOW())) AS TRDATE,      
+	  TO_DATE(COALESCE(C_ORDER.DATEORDERED, NOW())) AS TRDATE,
       C_ORDERLINE.AD_CLIENT_ID AS TRCLIENTID,      
       C_ORDERLINE.AD_ORG_ID AS TRORGID
       FROM C_ORDER left join AD_USER on C_ORDER.SALESREP_ID = AD_USER.AD_USER_Id, 
@@ -201,7 +201,7 @@
       C_ORDERLINE.LINENETAMT, C_ORDERLINE.QTYORDERED, C_ORDERLINE.QTYORDERED*M_PRODUCT.WEIGHT AS WEIGHT, 
       0 AS LINENETREF, 0 AS QTYORDEREDREF, 0 AS WEIGHTREF, C_UOM.UOMSYMBOL,
       COALESCE(C_ORDERLINE.C_CURRENCY_ID, C_ORDER.C_CURRENCY_ID) AS TRCURRENCYID,      
-	  TO_DATE(COALESCE(C_ORDERLINE.DATEORDERED, C_ORDER.DATEORDERED, NOW())) AS TRDATE,      
+	  TO_DATE(COALESCE(C_ORDER.DATEORDERED, NOW())) AS TRDATE,
 	  C_ORDERLINE.AD_CLIENT_ID AS TRCLIENTID,      
 	  C_ORDERLINE.AD_ORG_ID AS TRORGID 
       FROM C_ORDER left join AD_USER on C_ORDER.SALESREP_ID = AD_USER.AD_USER_ID,