From 6046f905b1371bbc1d298bbd218e90f512e1184b Mon Sep 17 00:00:00 2001 From: Rich Date: Mon, 8 Apr 2013 14:37:21 +0000 Subject: [PATCH] Modified getAnnotationAuditsChronologyByItemID to include datetime parameter Modified vefn_GetMyChronology to include datetime parameter Modified getContentAuditsChronologyByItemID to include datetime parameter Modified getContentAuditsSummaryByItemID to include datetime parameter Modified vefn_ChronologyReport to include datetime parameter --- PROMS/DataLoader/PROMStoAPPR.sql | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/PROMS/DataLoader/PROMStoAPPR.sql b/PROMS/DataLoader/PROMStoAPPR.sql index ab43c67f..34ce8a68 100644 --- a/PROMS/DataLoader/PROMStoAPPR.sql +++ b/PROMS/DataLoader/PROMStoAPPR.sql @@ -696,13 +696,14 @@ getAnnotationAuditsChronologyByItemID 30,8505 CREATE procedure [dbo].[getAnnotationAuditsChronologyByItemID] ( @ProcItemID int, - @ItemID int + @ItemID int, + @DTS datetime ) WITH EXECUTE AS OWNER AS begin - declare @dts datetime - set @dts = (select dts from items where itemid = @procitemid) +-- declare @dts datetime +-- set @dts = (select dts from items where itemid = @procitemid) declare @tci table ( ItemID int, @@ -1036,7 +1037,7 @@ GO Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE Copyright 2012 - Volian Enterprises, Inc. All rights reserved. *****************************************************************************/ -CREATE FUNCTION [dbo].[vefn_GetMyChronology](@ProcItemID int, @ItemID int, @IncludeDeletedChildren int) +CREATE FUNCTION [dbo].[vefn_GetMyChronology](@ProcItemID int, @ItemID int, @IncludeDeletedChildren int, @DTS datetime) RETURNS @Chrono TABLE ( [AuditID] bigint, @@ -1084,7 +1085,7 @@ select distinct [AuditID],[ContentID],[Number],[Text],[Type],[FormatID],[Config] ,(select dbo.vefn_GetStepTypeNameByItemIDandTypeID(t.itemid,r.type)) TypeName ,* from vefn_tblchilditems (@ProcItemID,@ItemID,@IncludeDeletedChildren) t - inner join vefn_chronologyreport(@ProcItemID) r + inner join vefn_chronologyreport(@ProcItemID,@DTS) r on t.icontentid = r.contentid -- where ActionDTS > procdts or dts > procdts ) ah @@ -1116,13 +1117,14 @@ CREATE PROCEDURE [dbo].[getContentAuditsChronologyByItemID] ( @ProcedureItemID int, @SelectedItemID int, - @IncludeDeletedChildren int + @IncludeDeletedChildren int, + @DTS datetime ) WITH EXECUTE AS OWNER AS begin - select * from vefn_GetMyChronology(@ProcedureItemID,@SelectedItemID,@IncludeDeletedChildren) + select * from vefn_GetMyChronology(@ProcedureItemID,@SelectedItemID,@IncludeDeletedChildren,@DTS) -- select distinct [AuditID],[ContentID],[Number],[Text],[Type],[FormatID],[Config],[DTS],[UserID],[DeleteStatus],[ActionDTS],[ActionWhat],[ActionWhen],[Path],ItemID,TypeName,ordinalpath -- from -- ( @@ -1179,7 +1181,8 @@ CREATE PROCEDURE [dbo].[getContentAuditsSummaryByItemID] ( @ProcedureItemID int, @SelectedItemID int, - @IncludeDeletedChildren int + @IncludeDeletedChildren int, + @DTS datetime ) WITH EXECUTE AS OWNER @@ -1206,7 +1209,7 @@ TypeName nvarchar(max), ordinalpath nvarchar(max) ) insert into @Chrono -select * from vefn_GetMyChronology(@ProcedureItemID,@SelectedItemID,@IncludeDeletedChildren) +select * from vefn_GetMyChronology(@ProcedureItemID,@SelectedItemID,@IncludeDeletedChildren,@DTS) select * from @Chrono where AuditID is null OR AuditID in (select min(auditID) from @Chrono group by contentid UNION select max(auditID) from @Chrono group by contentid) order by OrdinalPath, contentid,auditid @@ -2680,7 +2683,7 @@ select * from vefn_chronologyreport(2) where type > 0 order by contentid,auditid Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE Copyright 2012 - Volian Enterprises, Inc. All rights reserved. *****************************************************************************/ -CREATE function [dbo].[vefn_ChronologyReport](@ProcItemID int) +CREATE function [dbo].[vefn_ChronologyReport](@ProcItemID int, @DTS datetime) returns @Report table ( src int, @@ -2709,8 +2712,8 @@ declare @tmpTable table ) insert into @tmpTable select icontentid from vefn_tblchilditems(@ProcItemID,@ProcItemID,1) --added jcb 20111122 -declare @dts datetime -set @dts = (select dts from items where itemid = @ProcItemID ) +--declare @dts datetime +--set @dts = (select dts from items where itemid = @ProcItemID ) --set @dts = (SELECT .[dbo].[vefn_GetPreviousRevisionDTSByItemID] (@ProcItemID)) --end added jcb 20111122 insert into @Report