Fix problems with the views:
- Not oracle valid syntax - Set Alias for the Max(Name) column
This commit is contained in:
parent
8b1491b1e2
commit
80fdaf1930
|
@ -1,4 +1,3 @@
|
||||||
--DROP VIEW RV_M_Forecast;
|
|
||||||
CREATE OR REPLACE VIEW RV_M_Forecast AS
|
CREATE OR REPLACE VIEW RV_M_Forecast AS
|
||||||
SELECT
|
SELECT
|
||||||
f.AD_Client_ID ,
|
f.AD_Client_ID ,
|
||||||
|
@ -14,14 +13,14 @@ fl.SalesRep_ID,
|
||||||
p.C_UOM_ID,
|
p.C_UOM_ID,
|
||||||
fl.Qty,
|
fl.Qty,
|
||||||
fl.QtyCalculated,
|
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,
|
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,
|
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,
|
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 Total,
|
* fl.Qty AS TotalAmt,
|
||||||
p.M_Product_Category_ID,
|
p.M_Product_Category_ID,
|
||||||
p.Classification,
|
p.Classification,
|
||||||
p.Group1,
|
p.Group1,
|
||||||
|
@ -30,6 +29,3 @@ FROM M_Forecast f
|
||||||
INNER JOIN M_ForecastLine fl ON (f.M_Forecast_ID = fl.M_Forecast_ID)
|
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_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);
|
INNER JOIN M_PriceList pl ON (pl.M_PriceList_ID=f.M_PriceList_ID);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
--DROP VIEW RV_M_Forecast_Period;
|
|
||||||
CREATE OR REPLACE VIEW RV_M_Forecast_Period AS
|
CREATE OR REPLACE VIEW RV_M_Forecast_Period AS
|
||||||
SELECT AD_Client_ID ,
|
SELECT AD_Client_ID ,
|
||||||
AD_Org_ID,
|
AD_Org_ID,
|
||||||
M_Forecast_ID ,
|
M_Forecast_ID ,
|
||||||
MAX(Name) ,
|
MAX(Name) AS Name,
|
||||||
C_Calendar_ID ,
|
C_Calendar_ID ,
|
||||||
C_Year_ID ,
|
C_Year_ID ,
|
||||||
C_Period_ID,
|
C_Period_ID,
|
||||||
|
@ -11,6 +10,6 @@ M_Product_ID ,
|
||||||
C_UOM_ID,
|
C_UOM_ID,
|
||||||
SUM(Qty) AS Qty,
|
SUM(Qty) AS Qty,
|
||||||
SUM(QtyCalculated) AS QtyCalculated,
|
SUM(QtyCalculated) AS QtyCalculated,
|
||||||
SUM(TotalAmt) AS Total
|
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
|
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
|
||||||
;
|
;
|
|
@ -1,4 +1,3 @@
|
||||||
--DROP VIEW RV_M_Forecast;
|
|
||||||
CREATE OR REPLACE VIEW RV_M_Forecast AS
|
CREATE OR REPLACE VIEW RV_M_Forecast AS
|
||||||
SELECT
|
SELECT
|
||||||
f.AD_Client_ID ,
|
f.AD_Client_ID ,
|
||||||
|
@ -14,13 +13,13 @@ fl.SalesRep_ID,
|
||||||
p.C_UOM_ID,
|
p.C_UOM_ID,
|
||||||
fl.Qty,
|
fl.Qty,
|
||||||
fl.QtyCalculated,
|
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,
|
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,
|
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,
|
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,
|
* fl.Qty AS TotalAmt,
|
||||||
p.M_Product_Category_ID,
|
p.M_Product_Category_ID,
|
||||||
p.Classification,
|
p.Classification,
|
||||||
|
@ -30,6 +29,3 @@ FROM M_Forecast f
|
||||||
INNER JOIN M_ForecastLine fl ON (f.M_Forecast_ID = fl.M_Forecast_ID)
|
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_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);
|
INNER JOIN M_PriceList pl ON (pl.M_PriceList_ID=f.M_PriceList_ID);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
--DROP VIEW RV_M_Forecast_Period;
|
|
||||||
CREATE OR REPLACE VIEW RV_M_Forecast_Period AS
|
CREATE OR REPLACE VIEW RV_M_Forecast_Period AS
|
||||||
SELECT AD_Client_ID ,
|
SELECT AD_Client_ID ,
|
||||||
AD_Org_ID,
|
AD_Org_ID,
|
||||||
|
|
|
@ -2304,56 +2304,3 @@ UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=56278
|
||||||
-- Default comment for updating dictionary
|
-- 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
|
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
|
|
||||||
;
|
|
||||||
|
|
|
@ -273,9 +273,6 @@ DELETE FROM AD_Element_Trl WHERE AD_Element_ID=53654
|
||||||
DELETE FROM AD_Element 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
|
CREATE OR REPLACE VIEW RV_M_Forecast AS
|
||||||
SELECT
|
SELECT
|
||||||
f.AD_Client_ID ,
|
f.AD_Client_ID ,
|
||||||
|
@ -291,13 +288,13 @@ fl.SalesRep_ID,
|
||||||
p.C_UOM_ID,
|
p.C_UOM_ID,
|
||||||
fl.Qty,
|
fl.Qty,
|
||||||
fl.QtyCalculated,
|
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,
|
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,
|
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,
|
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,
|
* fl.Qty AS TotalAmt,
|
||||||
p.M_Product_Category_ID,
|
p.M_Product_Category_ID,
|
||||||
p.Classification,
|
p.Classification,
|
||||||
|
@ -312,7 +309,7 @@ CREATE OR REPLACE VIEW RV_M_Forecast_Period AS
|
||||||
SELECT AD_Client_ID ,
|
SELECT AD_Client_ID ,
|
||||||
AD_Org_ID,
|
AD_Org_ID,
|
||||||
M_Forecast_ID ,
|
M_Forecast_ID ,
|
||||||
MAX(Name) ,
|
MAX(Name) AS Name,
|
||||||
C_Calendar_ID ,
|
C_Calendar_ID ,
|
||||||
C_Year_ID ,
|
C_Year_ID ,
|
||||||
C_Period_ID,
|
C_Period_ID,
|
||||||
|
|
|
@ -2303,55 +2303,3 @@ UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=56278
|
||||||
-- Default comment for updating dictionary
|
-- 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
|
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
|
|
||||||
;
|
|
||||||
|
|
|
@ -270,8 +270,8 @@ DELETE FROM AD_Element_Trl WHERE AD_Element_ID=53654
|
||||||
DELETE FROM AD_Element 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_Period;
|
||||||
|
|
||||||
DROP VIEW RV_M_Forecast;
|
DROP VIEW RV_M_Forecast;
|
||||||
|
|
||||||
CREATE OR REPLACE VIEW RV_M_Forecast AS
|
CREATE OR REPLACE VIEW RV_M_Forecast AS
|
||||||
|
@ -289,13 +289,13 @@ fl.SalesRep_ID,
|
||||||
p.C_UOM_ID,
|
p.C_UOM_ID,
|
||||||
fl.Qty,
|
fl.Qty,
|
||||||
fl.QtyCalculated,
|
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,
|
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,
|
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,
|
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,
|
* fl.Qty AS TotalAmt,
|
||||||
p.M_Product_Category_ID,
|
p.M_Product_Category_ID,
|
||||||
p.Classification,
|
p.Classification,
|
||||||
|
@ -310,7 +310,7 @@ CREATE OR REPLACE VIEW RV_M_Forecast_Period AS
|
||||||
SELECT AD_Client_ID ,
|
SELECT AD_Client_ID ,
|
||||||
AD_Org_ID,
|
AD_Org_ID,
|
||||||
M_Forecast_ID ,
|
M_Forecast_ID ,
|
||||||
MAX(Name) ,
|
MAX(Name) AS Name,
|
||||||
C_Calendar_ID ,
|
C_Calendar_ID ,
|
||||||
C_Year_ID ,
|
C_Year_ID ,
|
||||||
C_Period_ID,
|
C_Period_ID,
|
||||||
|
|
Loading…
Reference in New Issue