Fixed issue 22747: Sales Quotations should not be considered in 'Orders
authorNaiara Garcia <naiara.garcia@openbravo.com>
Thu, 31 Jan 2013 12:22:19 +0100
changeset 19532 fb881e8712be
parent 19531 4d7f1c1ef0c6
child 19533 8e1a1a70be0d
Fixed issue 22747: Sales Quotations should not be considered in 'Orders
Awaiting invoice report, Sales Dimensional Report and Sales Order Report'
src/org/openbravo/erpCommon/ad_reports/OrderEdition_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportOrderNotInvoice_data.xsql
src/org/openbravo/erpCommon/ad_reports/ReportSalesDimensionalAnalyzeJR_data.xsql
--- a/src/org/openbravo/erpCommon/ad_reports/OrderEdition_data.xsql	Thu Jan 31 12:59:43 2013 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/OrderEdition_data.xsql	Thu Jan 31 12:22:19 2013 +0100
@@ -44,7 +44,7 @@
 	  C_ORDERLINE.AD_ORG_ID AS TRANSORGID 
       FROM C_ORDER left join C_PROJECT on C_ORDER.C_PROJECT_ID = C_PROJECT.C_PROJECT_ID
                    left join C_LOCATION on C_PROJECT.C_LOCATION_ID = C_LOCATION.C_LOCATION_ID, 
-      C_ORDERLINE, C_BPARTNER, M_PRODUCT, C_UOM
+      C_ORDERLINE, C_BPARTNER, M_PRODUCT, C_UOM, C_DOCTYPE
       WHERE C_ORDER.C_BPARTNER_ID = C_BPARTNER.C_BPARTNER_ID
       AND C_ORDER.C_ORDER_ID = C_ORDERLINE.C_ORDER_ID
       AND C_ORDERLINE.M_PRODUCT_ID = M_PRODUCT.M_PRODUCT_ID
@@ -53,6 +53,8 @@
       AND C_ORDER.AD_CLIENT_ID IN ('1')
       AND 1=1
       AND C_ORDER.ISSOTRX = 'Y'
+      AND C_DOCTYPE.C_DOCTYPE_ID = C_ORDER.C_DOCTYPETARGET_ID
+      AND (C_DOCTYPE.DOCSUBTYPESO IS NULL OR C_DOCTYPE.DOCSUBTYPESO <> 'OB')
       GROUP BY C_BPARTNER.NAME, C_ORDER.DOCUMENTNO, M_PRODUCT.NAME,C_ORDERLINE.PRICEACTUAL, C_UOM.NAME, C_ORDER.DATEORDERED,
       COALESCE(C_ORDERLINE.C_CURRENCY_ID, C_ORDER.C_CURRENCY_ID), TO_DATE(COALESCE(C_ORDER.DATEORDERED, NOW())),
 	  C_ORDERLINE.AD_CLIENT_ID, C_ORDERLINE.AD_ORG_ID
--- a/src/org/openbravo/erpCommon/ad_reports/ReportOrderNotInvoice_data.xsql	Thu Jan 31 12:59:43 2013 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportOrderNotInvoice_data.xsql	Thu Jan 31 12:22:19 2013 +0100
@@ -65,6 +65,7 @@
       AND C_ORDER.C_CURRENCY_ID = C_CURRENCY.C_CURRENCY_ID
       AND AD_REF_LIST.AD_REFERENCE_ID = '150'
       AND C_ORDER.PROCESSED = 'Y'
+      AND C_ORDER.DOCSTATUS NOT IN ('CJ', 'UE', 'CA')
       AND C_ORDER.ISSOTRX = 'Y'
       AND C_ORDERLINE.QTYORDERED<>C_ORDERLINE.QTYINVOICED 
       AND C_ORDER.AD_Client_ID IN ('1')
@@ -102,6 +103,7 @@
       AND C_ORDERTAX.C_TAX_ID = C_TAX.C_TAX_ID
       AND C.AD_ORG_ID = AD_ORG.AD_ORG_ID
       AND C.PROCESSED = 'Y'
+      AND C.DOCSTATUS NOT IN ('CJ', 'UE', 'CA')
       AND C.ISSOTRX = 'Y'
       AND EXISTS (SELECT 1 FROM C_ORDER C2, C_ORDERLINE CL
                  WHERE C2.c_order_id = C.c_order_id
--- a/src/org/openbravo/erpCommon/ad_reports/ReportSalesDimensionalAnalyzeJR_data.xsql	Thu Jan 31 12:59:43 2013 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportSalesDimensionalAnalyzeJR_data.xsql	Thu Jan 31 12:22:19 2013 +0100
@@ -62,6 +62,7 @@
       AND C_ORDER.AD_ORG_ID = AD_ORG.AD_ORG_ID
       AND C_ORDER.ISSOTRX = 'Y'
       AND C_ORDER.PROCESSED = 'Y'
+      AND C_ORDER.DOCSTATUS NOT IN ('CJ', 'UE', 'CA')
       AND 0=0 AND C_ORDER.AD_ORG_ID IN ('1')
       AND C_ORDER.AD_CLIENT_ID IN ('8')
       AND 1=1
@@ -85,6 +86,7 @@
       AND C_ORDER.AD_ORG_ID = AD_ORG.AD_ORG_ID
       AND C_ORDER.ISSOTRX = 'Y'
       AND C_ORDER.PROCESSED = 'Y'
+      AND C_ORDER.DOCSTATUS NOT IN ('CJ', 'UE', 'CA')
       AND 3=3 AND C_ORDER.AD_ORG_ID IN ('1')
       AND C_ORDER.AD_CLIENT_ID IN('16')
       AND 2=2) AA
@@ -160,6 +162,7 @@
       AND C_ORDER.AD_ORG_ID = AD_ORG.AD_ORG_ID
       AND C_ORDER.ISSOTRX = 'Y'
       AND C_ORDER.PROCESSED = 'Y'
+      AND C_ORDER.DOCSTATUS NOT IN ('CJ', 'UE', 'CA')
       AND 0=0 AND C_ORDER.AD_ORG_ID IN ('1')
       AND C_ORDER.AD_CLIENT_ID IN ('8')
       AND 1=1 AND ((2=2)OR (3=3))
@@ -217,6 +220,7 @@
       AND C_ORDER.AD_ORG_ID = AD_ORG.AD_ORG_ID
       AND C_ORDER.ISSOTRX = 'Y'
       AND C_ORDER.PROCESSED = 'Y'
+      AND C_ORDER.DOCSTATUS NOT IN ('CJ', 'UE', 'CA')
       AND 0=0 AND C_ORDER.AD_ORG_ID IN ('1')
       AND C_ORDER.AD_CLIENT_ID IN ('8')
       AND 1=1) AA
@@ -267,6 +271,7 @@
       AND C_ORDER.AD_ORG_ID = AD_ORG.AD_ORG_ID
       AND C_ORDER.ISSOTRX = 'Y'
       AND C_ORDER.PROCESSED = 'Y'
+      AND C_ORDER.DOCSTATUS NOT IN ('CJ', 'UE', 'CA')
       AND 0=0 AND C_ORDER.AD_ORG_ID IN ('1')
       AND C_ORDER.AD_CLIENT_ID IN ('8')
       AND 1=1 AND 2=2