--------------------------------------------------------
--  DDL for View V_PLANTA_CUMU_DT827
--------------------------------------------------------
CREATE VIEW [dbo].[V_PLANTA_CUMU_DT827] (
  [PROJECT_ID], [REPORT_ID], [MONTH], [YEAR], [COSTS_TOTAL], [EFFORT_TOTAL], [REVENUES_TOTAL], 
  [COSTS_CUMULATIVE], [COSTS_ACTUAL_CUMULATIVE], [COSTS_REMAIN_CUMULATIVE], [EFFORT_CUMULATIVE], [REVENUES_CUMULATIVE])
AS 
  SELECT 
    PROJECTID,
    REPORTID,
    TIMESLICE [MONTH],
    DATEADD(yy, DATEDIFF(yy,0,TIMESLICE),0) [YEAR],
    TC COSTS_TOTAL,
    AE+RE EFFORT_TOTAL,
    AR+RR REVENUES_TOTAL,
    CML_TC COSTS_CUMULATIVE,
    CML_AC COSTS_ACTUAL_CUMULATIVE,
    CML_RC COSTS_REMAIN_CUMULATIVE,
    CML_AE+CML_RE EFFORT_CUMULATIVE,
    CML_AR+CML_RR REVENUES_CUMULATIVE
  FROM DT827_CONDENSED
  WHERE DENSITYRATIO = 3 -- = PR (project level)
;