USE $(DATA_BASE_NAME);
GO

DROP VIEW [dm].[vwDartRequestEventDetailsReport]
GO

/****** Object:  View [dm].[vwDartRequestEventDetailsReport]    Script Date: 2/24/2016 1:58:21 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

create view [dm].[vwDartRequestEventDetailsReport]
as
select Req.TrackingNumber, ra.ReviewType, ra.StartDate, ra.EndDate, RevisionCount, CurrentStatus, TotalReviewerBusinessDays, TotalRequestorBusinessDays, dbo.udf_GetBusinessDays(ra.StartDate, Coalesce(ra.EndDate,getdate())) totalBusinessDays
from hib.Request Req 
       inner join dm.ReviewAggregate ra on req.ID = ra.RequestID

GO

