CREATE VIEW [dbo].[V_PLANTA_DT827_PROGRAM] 
	AS
  SELECT 
    pr_dep.di063054 program_id,
    pr_dep.di063058 program_report_id,
    pr_dep.di063056 project_id,
    pr_dep.di063140 project_report_id,
    cum.MONTH,
    cum.YEAR,
    cum.costs_total,
    cum.effort_total,
    cum.REVENUES_TOTAL,
    cum.COSTS_CUMULATIVE,
    cum.COSTS_ACTUAL_CUMULATIVE,
    cum.COSTS_REMAIN_CUMULATIVE,
    cum.EFFORT_CUMULATIVE,
    cum.REVENUES_CUMULATIVE
  FROM dt883 pr_dep 
  right JOIN v_planta_cumu_dt827 cum
  ON pr_dep.di063056 = cum.project_id
  and pr_dep.di063140 = cum.report_id
WHERE pr_dep.di063042 = 1
AND pr_dep.di063140 IS NOT NULL;
GO
