diff --git a/db/ddlutils/oracle/views/RV_M_FORECAST.sql b/db/ddlutils/oracle/views/RV_M_FORECAST.sql index 1a798c2f3e..8e6584ece2 100644 --- a/db/ddlutils/oracle/views/RV_M_FORECAST.sql +++ b/db/ddlutils/oracle/views/RV_M_FORECAST.sql @@ -1,35 +1,31 @@ ---DROP VIEW RV_M_Forecast; CREATE OR REPLACE VIEW RV_M_Forecast AS -SELECT -f.AD_Client_ID , -fl.AD_Org_ID, -f.M_Forecast_ID , -f.Name , -f.C_Calendar_ID , -f.C_Year_ID , -fl.C_Period_ID, +SELECT +f.AD_Client_ID , +fl.AD_Org_ID, +f.M_Forecast_ID , +f.Name , +f.C_Calendar_ID , +f.C_Year_ID , +fl.C_Period_ID, fl.DatePromised, fl.M_Product_ID , -fl.SalesRep_ID, -p.C_UOM_ID, +fl.SalesRep_ID, +p.C_UOM_ID, fl.Qty, fl.QtyCalculated, - (SELECT pp.PriceList FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - AS PriceList, - (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - AS PriceStd, - (SELECT pp.PriceLimit FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - AS PriceLimit, - (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - * fl.Qty AS Total, -p.M_Product_Category_ID, -p.Classification, -p.Group1, -p.Group2 -FROM M_Forecast f -INNER JOIN M_ForecastLine fl ON (f.M_Forecast_ID = fl.M_Forecast_ID) -INNER JOIN M_Product p ON (p.M_Product_ID=fl.M_Product_ID) -INNER JOIN M_PriceList pl ON (pl.M_PriceList_ID=f.M_PriceList_ID); - - - + (SELECT pp.PriceList FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID) WHERE pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID) + AS PriceList, + (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID) WHERE pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID) + AS PriceStd, + (SELECT pp.PriceLimit FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID) WHERE pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID) + AS PriceLimit, + (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID) WHERE pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID) + * fl.Qty AS TotalAmt, + p.M_Product_Category_ID, + p.Classification, + p.Group1, + p.Group2 + FROM M_Forecast f + INNER JOIN M_ForecastLine fl ON (f.M_Forecast_ID = fl.M_Forecast_ID) + INNER JOIN M_Product p ON (p.M_Product_ID=fl.M_Product_ID) + INNER JOIN M_PriceList pl ON (pl.M_PriceList_ID=f.M_PriceList_ID); diff --git a/db/ddlutils/oracle/views/RV_M_FORECAST_PERIOD.sql b/db/ddlutils/oracle/views/RV_M_FORECAST_PERIOD.sql index 1d0d9b7505..d70357aa0a 100644 --- a/db/ddlutils/oracle/views/RV_M_FORECAST_PERIOD.sql +++ b/db/ddlutils/oracle/views/RV_M_FORECAST_PERIOD.sql @@ -1,16 +1,15 @@ ---DROP VIEW RV_M_Forecast_Period; CREATE OR REPLACE VIEW RV_M_Forecast_Period AS -SELECT AD_Client_ID , -AD_Org_ID, -M_Forecast_ID , -MAX(Name) , -C_Calendar_ID , -C_Year_ID , -C_Period_ID, -M_Product_ID , -C_UOM_ID, +SELECT AD_Client_ID , +AD_Org_ID, +M_Forecast_ID , +MAX(Name) AS Name, +C_Calendar_ID , +C_Year_ID , +C_Period_ID, +M_Product_ID , +C_UOM_ID, SUM(Qty) AS Qty, SUM(QtyCalculated) AS QtyCalculated, -SUM(TotalAmt) AS Total -FROM RV_M_Forecast f GROUP BY AD_Client_ID , AD_Org_ID , M_Forecast_ID , M_Product_ID , C_UOM_ID, C_Calendar_ID , C_Year_ID , C_Period_ID -; \ No newline at end of file +SUM(TotalAmt) AS TotalAmt +FROM RV_M_Forecast f GROUP BY AD_Client_ID , AD_Org_ID , M_Forecast_ID , M_Product_ID , C_UOM_ID, C_Calendar_ID , C_Year_ID , C_Period_ID +; diff --git a/db/ddlutils/postgresql/views/RV_M_FORECAST.sql b/db/ddlutils/postgresql/views/RV_M_FORECAST.sql index c3032e1682..8a63f94900 100644 --- a/db/ddlutils/postgresql/views/RV_M_FORECAST.sql +++ b/db/ddlutils/postgresql/views/RV_M_FORECAST.sql @@ -1,35 +1,31 @@ ---DROP VIEW RV_M_Forecast; CREATE OR REPLACE VIEW RV_M_Forecast AS -SELECT -f.AD_Client_ID , -fl.AD_Org_ID, -f.M_Forecast_ID , -f.Name , -f.C_Calendar_ID , -f.C_Year_ID , -fl.C_Period_ID, +SELECT +f.AD_Client_ID , +fl.AD_Org_ID, +f.M_Forecast_ID , +f.Name , +f.C_Calendar_ID , +f.C_Year_ID , +fl.C_Period_ID, fl.DatePromised, fl.M_Product_ID , -fl.SalesRep_ID, -p.C_UOM_ID, +fl.SalesRep_ID, +p.C_UOM_ID, fl.Qty, fl.QtyCalculated, - (SELECT pp.PriceList FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - AS PriceList, - (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - AS PriceStd, - (SELECT pp.PriceLimit FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - AS PriceLimit, - (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - * fl.Qty AS TotalAmt, -p.M_Product_Category_ID, -p.Classification, -p.Group1, -p.Group2 -FROM M_Forecast f -INNER JOIN M_ForecastLine fl ON (f.M_Forecast_ID = fl.M_Forecast_ID) -INNER JOIN M_Product p ON (p.M_Product_ID=fl.M_Product_ID) -INNER JOIN M_PriceList pl ON (pl.M_PriceList_ID=f.M_PriceList_ID); - - - + (SELECT pp.PriceList FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID) WHERE pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID) + AS PriceList, + (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID) WHERE pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID) + AS PriceStd, + (SELECT pp.PriceLimit FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID) WHERE pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID) + AS PriceLimit, + (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID) WHERE pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID) + * fl.Qty AS TotalAmt, + p.M_Product_Category_ID, + p.Classification, + p.Group1, + p.Group2 + FROM M_Forecast f + INNER JOIN M_ForecastLine fl ON (f.M_Forecast_ID = fl.M_Forecast_ID) + INNER JOIN M_Product p ON (p.M_Product_ID=fl.M_Product_ID) + INNER JOIN M_PriceList pl ON (pl.M_PriceList_ID=f.M_PriceList_ID); diff --git a/db/ddlutils/postgresql/views/RV_M_FORECAST_PERIOD.sql b/db/ddlutils/postgresql/views/RV_M_FORECAST_PERIOD.sql index bf627a0ac1..d70357aa0a 100644 --- a/db/ddlutils/postgresql/views/RV_M_FORECAST_PERIOD.sql +++ b/db/ddlutils/postgresql/views/RV_M_FORECAST_PERIOD.sql @@ -1,16 +1,15 @@ ---DROP VIEW RV_M_Forecast_Period; CREATE OR REPLACE VIEW RV_M_Forecast_Period AS -SELECT AD_Client_ID , -AD_Org_ID, -M_Forecast_ID , -MAX(Name) AS Name, -C_Calendar_ID , -C_Year_ID , -C_Period_ID, -M_Product_ID , -C_UOM_ID, +SELECT AD_Client_ID , +AD_Org_ID, +M_Forecast_ID , +MAX(Name) AS Name, +C_Calendar_ID , +C_Year_ID , +C_Period_ID, +M_Product_ID , +C_UOM_ID, SUM(Qty) AS Qty, SUM(QtyCalculated) AS QtyCalculated, SUM(TotalAmt) AS TotalAmt -FROM RV_M_Forecast f GROUP BY AD_Client_ID , AD_Org_ID , M_Forecast_ID , M_Product_ID , C_UOM_ID, C_Calendar_ID , C_Year_ID , C_Period_ID -; \ No newline at end of file +FROM RV_M_Forecast f GROUP BY AD_Client_ID , AD_Org_ID , M_Forecast_ID , M_Product_ID , C_UOM_ID, C_Calendar_ID , C_Year_ID , C_Period_ID +; diff --git a/migration/352a-trunk/296_FR2002744_ForecastReport.sql b/migration/352a-trunk/296_FR2002744_ForecastReport.sql index 04baab45e8..7f07bdd8fa 100644 --- a/migration/352a-trunk/296_FR2002744_ForecastReport.sql +++ b/migration/352a-trunk/296_FR2002744_ForecastReport.sql @@ -2304,56 +2304,3 @@ UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=56278 -- Default comment for updating dictionary UPDATE AD_Field SET IsSameLine='Y',Updated=TO_DATE('2008-06-25 23:02:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=56278 ; - - ---DROP VIEW RV_M_Forecast; -CREATE OR REPLACE VIEW RV_M_Forecast AS -SELECT -f.AD_Client_ID , -fl.AD_Org_ID, -f.M_Forecast_ID , -f.Name , -f.C_Calendar_ID , -f.C_Year_ID , -fl.C_Period_ID, -fl.DatePromised, -fl.M_Product_ID , -fl.SalesRep_ID, -p.C_UOM_ID, -fl.Qty, -fl.QtyCalculated, - (SELECT pp.PriceList FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - AS PriceList, - (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - AS PriceStd, - (SELECT pp.PriceLimit FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - AS PriceLimit, - (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - * fl.Qty AS Total, -p.M_Product_Category_ID, -p.Classification, -p.Group1, -p.Group2 -FROM M_Forecast f -INNER JOIN M_ForecastLine fl ON (f.M_Forecast_ID = fl.M_Forecast_ID) -INNER JOIN M_Product p ON (p.M_Product_ID=fl.M_Product_ID) -INNER JOIN M_PriceList pl ON (pl.M_PriceList_ID=f.M_PriceList_ID); - ---DROP VIEW RV_M_Forecast_Period; -CREATE OR REPLACE VIEW RV_M_Forecast_Period AS -SELECT AD_Client_ID , -AD_Org_ID, -M_Forecast_ID , -MAX(Name) , -C_Calendar_ID , -C_Year_ID , -C_Period_ID, -M_Product_ID , -M_Product_Category_ID, -C_UOM_ID, -SalesRep_ID, -SUM(Qty) AS Qty, -SUM(QtyCalculated) AS QtyCalculated, -SUM(Total) AS Total -FROM RV_M_Forecast f GROUP BY AD_Client_ID , AD_Org_ID , M_Forecast_ID , M_Product_ID , M_Product_Category_ID, C_UOM_ID,SalesRep_ID, C_Calendar_ID , C_Year_ID , C_Period_ID -; diff --git a/migration/352a-trunk/297_FR2002744_ForecastFix.sql b/migration/352a-trunk/297_FR2002744_ForecastFix.sql index 75e303ac53..495741b7c2 100644 --- a/migration/352a-trunk/297_FR2002744_ForecastFix.sql +++ b/migration/352a-trunk/297_FR2002744_ForecastFix.sql @@ -273,46 +273,43 @@ DELETE FROM AD_Element_Trl WHERE AD_Element_ID=53654 DELETE FROM AD_Element WHERE AD_Element_ID=53654 ; -DROP VIEW RV_M_Forecast_Period; -DROP VIEW RV_M_Forecast; - CREATE OR REPLACE VIEW RV_M_Forecast AS -SELECT -f.AD_Client_ID , -fl.AD_Org_ID, -f.M_Forecast_ID , -f.Name , -f.C_Calendar_ID , -f.C_Year_ID , -fl.C_Period_ID, +SELECT +f.AD_Client_ID , +fl.AD_Org_ID, +f.M_Forecast_ID , +f.Name , +f.C_Calendar_ID , +f.C_Year_ID , +fl.C_Period_ID, fl.DatePromised, fl.M_Product_ID , -fl.SalesRep_ID, -p.C_UOM_ID, +fl.SalesRep_ID, +p.C_UOM_ID, fl.Qty, fl.QtyCalculated, - (SELECT pp.PriceList FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - AS PriceList, - (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - AS PriceStd, - (SELECT pp.PriceLimit FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - AS PriceLimit, - (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - * fl.Qty AS TotalAmt, -p.M_Product_Category_ID, -p.Classification, -p.Group1, -p.Group2 -FROM M_Forecast f -INNER JOIN M_ForecastLine fl ON (f.M_Forecast_ID = fl.M_Forecast_ID) -INNER JOIN M_Product p ON (p.M_Product_ID=fl.M_Product_ID) -INNER JOIN M_PriceList pl ON (pl.M_PriceList_ID=f.M_PriceList_ID); + (SELECT pp.PriceList FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID) WHERE pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID) + AS PriceList, + (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID) WHERE pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID) + AS PriceStd, + (SELECT pp.PriceLimit FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID) WHERE pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID) + AS PriceLimit, + (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID) WHERE pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID) + * fl.Qty AS TotalAmt, + p.M_Product_Category_ID, + p.Classification, + p.Group1, + p.Group2 + FROM M_Forecast f + INNER JOIN M_ForecastLine fl ON (f.M_Forecast_ID = fl.M_Forecast_ID) + INNER JOIN M_Product p ON (p.M_Product_ID=fl.M_Product_ID) + INNER JOIN M_PriceList pl ON (pl.M_PriceList_ID=f.M_PriceList_ID); CREATE OR REPLACE VIEW RV_M_Forecast_Period AS SELECT AD_Client_ID , AD_Org_ID, M_Forecast_ID , -MAX(Name) , +MAX(Name) AS Name, C_Calendar_ID , C_Year_ID , C_Period_ID, diff --git a/migration/352a-trunk/postgresql/296_FR2002744_ForecastReport.sql b/migration/352a-trunk/postgresql/296_FR2002744_ForecastReport.sql index ba795a6a2b..ca55a9b1c4 100644 --- a/migration/352a-trunk/postgresql/296_FR2002744_ForecastReport.sql +++ b/migration/352a-trunk/postgresql/296_FR2002744_ForecastReport.sql @@ -2303,55 +2303,3 @@ UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=56278 -- Default comment for updating dictionary UPDATE AD_Field SET IsSameLine='Y',Updated=TO_TIMESTAMP('2008-06-25 23:02:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=56278 ; - ---DROP VIEW RV_M_Forecast; -CREATE OR REPLACE VIEW RV_M_Forecast AS -SELECT -f.AD_Client_ID , -fl.AD_Org_ID, -f.M_Forecast_ID , -f.Name , -f.C_Calendar_ID , -f.C_Year_ID , -fl.C_Period_ID, -fl.DatePromised, -fl.M_Product_ID , -fl.SalesRep_ID, -p.C_UOM_ID, -fl.Qty, -fl.QtyCalculated, - (SELECT pp.PriceList FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - AS PriceList, - (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - AS PriceStd, - (SELECT pp.PriceLimit FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - AS PriceLimit, - (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) - * fl.Qty AS Total, -p.M_Product_Category_ID, -p.Classification, -p.Group1, -p.Group2 -FROM M_Forecast f -INNER JOIN M_ForecastLine fl ON (f.M_Forecast_ID = fl.M_Forecast_ID) -INNER JOIN M_Product p ON (p.M_Product_ID=fl.M_Product_ID) -INNER JOIN M_PriceList pl ON (pl.M_PriceList_ID=f.M_PriceList_ID); - ---DROP VIEW RV_M_Forecast_Period; -CREATE OR REPLACE VIEW RV_M_Forecast_Period AS -SELECT AD_Client_ID , -AD_Org_ID, -M_Forecast_ID , -MAX(Name) , -C_Calendar_ID , -C_Year_ID , -C_Period_ID, -M_Product_ID , -M_Product_Category_ID, -C_UOM_ID, -SalesRep_ID, -SUM(Qty) AS Qty, -SUM(QtyCalculated) AS QtyCalculated, -SUM(Total) AS Total -FROM RV_M_Forecast f GROUP BY AD_Client_ID , AD_Org_ID , M_Forecast_ID , M_Product_ID , M_Product_Category_ID, C_UOM_ID,SalesRep_ID, C_Calendar_ID , C_Year_ID , C_Period_ID -; diff --git a/migration/352a-trunk/postgresql/297_FR2002744_ForecastFix.sql b/migration/352a-trunk/postgresql/297_FR2002744_ForecastFix.sql index d4271164cf..851e8a6f52 100644 --- a/migration/352a-trunk/postgresql/297_FR2002744_ForecastFix.sql +++ b/migration/352a-trunk/postgresql/297_FR2002744_ForecastFix.sql @@ -270,8 +270,8 @@ DELETE FROM AD_Element_Trl WHERE AD_Element_ID=53654 DELETE FROM AD_Element WHERE AD_Element_ID=53654 ; - DROP VIEW RV_M_Forecast_Period; + DROP VIEW RV_M_Forecast; CREATE OR REPLACE VIEW RV_M_Forecast AS @@ -289,13 +289,13 @@ fl.SalesRep_ID, p.C_UOM_ID, fl.Qty, fl.QtyCalculated, - (SELECT pp.PriceList FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) + (SELECT pp.PriceList FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID) WHERE pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID) AS PriceList, - (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) + (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID) WHERE pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID) AS PriceStd, - (SELECT pp.PriceLimit FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) + (SELECT pp.PriceLimit FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID) WHERE pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID) AS PriceLimit, - (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)) + (SELECT pp.PriceStd FROM M_PriceList_Version plv INNER JOIN M_ProductPrice pp ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID) WHERE pp.M_Product_ID=fl.M_Product_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID) * fl.Qty AS TotalAmt, p.M_Product_Category_ID, p.Classification, @@ -310,7 +310,7 @@ CREATE OR REPLACE VIEW RV_M_Forecast_Period AS SELECT AD_Client_ID , AD_Org_ID, M_Forecast_ID , -MAX(Name) , +MAX(Name) AS Name, C_Calendar_ID , C_Year_ID , C_Period_ID,