--------------------------------------------------------
--  DDL for View V_EVA_VGR
--------------------------------------------------------
CREATE OR REPLACE VIEW "V_EVA_VGR" (
  "M_PROJECT_ID", "M_REPORT_ID", "M_TASK", "M_RESS", "M_MONTH", "COSTS_ACTUAL_CUM", "BL_COSTS_PLANED_CUM", "PROGRESS", "EV_CUM", "SV_CUM", "CV_CUM", "SPI_CUM", "CPI_CUM") 
AS 
  SELECT
    PROJECTID M_PROJECT_ID,
    REPORTID M_REPORT_ID,
    TASK M_TASK,
    TRESOURCE M_RESS,
    TIMESLICE M_MONTH,
    CML_AC COSTS_ACTUAL_CUM,
    CML_PC_BL BL_COSTS_PLANED_CUM,
    PROGRESS,
    EV EV_CUM,
    SV SV_CUM,
    CV CV_CUM,
    SPI SPI_CUM,
    CPI CPI_CUM
  FROM DT827_CONDENSED INNER JOIN DT467 r ON TRESOURCE = r.DI001218
  WHERE DENSITYRATIO = 1 -- = VGR
    AND r.DI003414 <> '8' -- no proceeds
    AND EXISTS (SELECT 1 FROM DT823 s WHERE s.DI008413 = PROJECTID AND s.DI008416 = REPORTID AND s.DI041716 IS NOT NULL) -- status report has a corresponding baseline
;/
