Modified vefn_GetMyChronology to include datetime parameter
Modified getContentAuditsChronologyByItemID to include datetime parameter Modified vefn_ChronologyReport to include datetime parameter Modified getAnnotationAuditsChronologyByItemID to include datetime parameter Modified getContentAuditsSummaryByItemID to include datetime parameter
This commit is contained in:
parent
6046f905b1
commit
268df16b6e
@ -2355,7 +2355,7 @@ GO
|
|||||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
|
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
|
RETURNS @Chrono TABLE
|
||||||
(
|
(
|
||||||
[AuditID] bigint,
|
[AuditID] bigint,
|
||||||
@ -2403,7 +2403,7 @@ select distinct [AuditID],[ContentID],[Number],[Text],[Type],[FormatID],[Config]
|
|||||||
,(select dbo.vefn_GetStepTypeNameByItemIDandTypeID(t.itemid,r.type)) TypeName
|
,(select dbo.vefn_GetStepTypeNameByItemIDandTypeID(t.itemid,r.type)) TypeName
|
||||||
,*
|
,*
|
||||||
from vefn_tblchilditems (@ProcItemID,@ItemID,@IncludeDeletedChildren) t
|
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
|
on t.icontentid = r.contentid
|
||||||
-- where ActionDTS > procdts or dts > procdts
|
-- where ActionDTS > procdts or dts > procdts
|
||||||
) ah
|
) ah
|
||||||
@ -2439,13 +2439,14 @@ CREATE PROCEDURE [dbo].[getContentAuditsChronologyByItemID]
|
|||||||
(
|
(
|
||||||
@ProcedureItemID int,
|
@ProcedureItemID int,
|
||||||
@SelectedItemID int,
|
@SelectedItemID int,
|
||||||
@IncludeDeletedChildren int
|
@IncludeDeletedChildren int,
|
||||||
|
@DTS datetime
|
||||||
)
|
)
|
||||||
|
|
||||||
WITH EXECUTE AS OWNER
|
WITH EXECUTE AS OWNER
|
||||||
AS
|
AS
|
||||||
begin
|
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
|
-- select distinct [AuditID],[ContentID],[Number],[Text],[Type],[FormatID],[Config],[DTS],[UserID],[DeleteStatus],[ActionDTS],[ActionWhat],[ActionWhen],[Path],ItemID,TypeName,ordinalpath
|
||||||
-- from
|
-- from
|
||||||
-- (
|
-- (
|
||||||
@ -2498,7 +2499,7 @@ select * from vefn_chronologyreport(2) where type > 0 order by contentid,auditid
|
|||||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
|
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
|
returns @Report table
|
||||||
(
|
(
|
||||||
src int,
|
src int,
|
||||||
@ -2527,8 +2528,8 @@ declare @tmpTable table
|
|||||||
)
|
)
|
||||||
insert into @tmpTable select icontentid from vefn_tblchilditems(@ProcItemID,@ProcItemID,1)
|
insert into @tmpTable select icontentid from vefn_tblchilditems(@ProcItemID,@ProcItemID,1)
|
||||||
--added jcb 20111122
|
--added jcb 20111122
|
||||||
declare @dts datetime
|
--declare @dts datetime
|
||||||
set @dts = (select dts from items where itemid = @ProcItemID )
|
--set @dts = (select dts from items where itemid = @ProcItemID )
|
||||||
--set @dts = (SELECT .[dbo].[vefn_GetPreviousRevisionDTSByItemID] (@ProcItemID))
|
--set @dts = (SELECT .[dbo].[vefn_GetPreviousRevisionDTSByItemID] (@ProcItemID))
|
||||||
--end added jcb 20111122
|
--end added jcb 20111122
|
||||||
insert into @Report
|
insert into @Report
|
||||||
@ -2696,15 +2697,29 @@ getAnnotationAuditsChronologyByItemID 30,8505
|
|||||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
|
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
create procedure getAnnotationAuditsChronologyByItemID
|
create procedure [dbo].[getAnnotationAuditsChronologyByItemID]
|
||||||
(
|
(
|
||||||
@ProcItemID int,
|
@ProcItemID int,
|
||||||
@ItemID int
|
@ItemID int,
|
||||||
|
@DTS datetime
|
||||||
)
|
)
|
||||||
WITH EXECUTE AS OWNER
|
WITH EXECUTE AS OWNER
|
||||||
AS
|
AS
|
||||||
begin
|
begin
|
||||||
select
|
-- declare @dts datetime
|
||||||
|
-- set @dts = (select dts from items where itemid = @procitemid)
|
||||||
|
declare @tci table
|
||||||
|
(
|
||||||
|
ItemID int,
|
||||||
|
IContentID int,
|
||||||
|
IDeleteStatus int,
|
||||||
|
ProcDTS datetime,
|
||||||
|
Path nvarchar(max),
|
||||||
|
OrdinalPath nvarchar(max)
|
||||||
|
)
|
||||||
|
insert into @tci
|
||||||
|
select * from vefn_tblchilditems(@ProcItemID,@ItemID,0)
|
||||||
|
select
|
||||||
case
|
case
|
||||||
when lastauditid is null and dts > itemdts then 'Added'
|
when lastauditid is null and dts > itemdts then 'Added'
|
||||||
when deletestatus > 0 then 'Deleted'
|
when deletestatus > 0 then 'Deleted'
|
||||||
@ -2717,13 +2732,13 @@ begin
|
|||||||
when lastauditid = deletedauditid then ActionDTS
|
when lastauditid = deletedauditid then ActionDTS
|
||||||
else dts
|
else dts
|
||||||
end ActionWhen
|
end ActionWhen
|
||||||
,*
|
,*
|
||||||
from
|
from
|
||||||
(
|
(
|
||||||
select
|
select
|
||||||
cast(ident_current('annotationaudits') + 1 as bigint) auditid
|
cast(ident_current('annotationaudits') + 1 as bigint) auditid
|
||||||
-- (select max(auditid) + 1 from annotationaudits) auditid
|
-- (select max(auditid) + 1 from annotationaudits) auditid
|
||||||
-- 0 auditid
|
-- 0 auditid
|
||||||
,aa.annotationid
|
,aa.annotationid
|
||||||
,aa.itemid
|
,aa.itemid
|
||||||
,aa.typeid
|
,aa.typeid
|
||||||
@ -2738,11 +2753,13 @@ begin
|
|||||||
,(select min(dts) from tblitems where itemid = ii.itemid) ItemDTS
|
,(select min(dts) from tblitems where itemid = ii.itemid) ItemDTS
|
||||||
,(select max(auditid) from annotationaudits where annotationid = aa.annotationid and itemid = ii.itemid) LastAuditID
|
,(select max(auditid) from annotationaudits where annotationid = aa.annotationid and itemid = ii.itemid) LastAuditID
|
||||||
,(select max(auditid) from annotationaudits where annotationid = aa.annotationid and itemid = ii.itemid and deletestatus > 0 and aa.dts = dts) DeletedAuditID
|
,(select max(auditid) from annotationaudits where annotationid = aa.annotationid and itemid = ii.itemid and deletestatus > 0 and aa.dts = dts) DeletedAuditID
|
||||||
|
,tci.ordinalpath
|
||||||
from tblannotations aa
|
from tblannotations aa
|
||||||
inner join items ii on aa.itemid = ii.itemid
|
inner join items ii on aa.itemid = ii.itemid
|
||||||
|
join @tci tci on tci.itemid = ii.itemid
|
||||||
where aa.deletestatus = 0
|
where aa.deletestatus = 0
|
||||||
union
|
union
|
||||||
select
|
select
|
||||||
aa.auditid
|
aa.auditid
|
||||||
,aa.annotationid
|
,aa.annotationid
|
||||||
,aa.itemid
|
,aa.itemid
|
||||||
@ -2758,11 +2775,16 @@ begin
|
|||||||
,(select min(dts) from tblitems where itemid = ii.itemid) ItemDTS
|
,(select min(dts) from tblitems where itemid = ii.itemid) ItemDTS
|
||||||
,(select max(auditid) from annotationaudits where annotationid = aa.annotationid and itemid = ii.itemid and aa.auditid > auditid ) LastAuditID
|
,(select max(auditid) from annotationaudits where annotationid = aa.annotationid and itemid = ii.itemid and aa.auditid > auditid ) LastAuditID
|
||||||
,(select max(auditid) from annotationaudits where annotationid = aa.annotationid and itemid = ii.itemid and aa.auditid > auditid and deletestatus > 0 and aa.dts = dts) DeletedAuditID
|
,(select max(auditid) from annotationaudits where annotationid = aa.annotationid and itemid = ii.itemid and aa.auditid > auditid and deletestatus > 0 and aa.dts = dts) DeletedAuditID
|
||||||
|
,tci.ordinalpath
|
||||||
from annotationaudits aa
|
from annotationaudits aa
|
||||||
inner join items ii on aa.itemid = ii.itemid
|
inner join items ii on aa.itemid = ii.itemid
|
||||||
|
join @tci tci on tci.itemid = ii.itemid
|
||||||
) ah
|
) ah
|
||||||
where itemid in (select itemid from vefn_tblchilditems (@procitemid,@itemid,0))
|
where itemid in (select itemid from @tci)
|
||||||
order by annotationid,auditid--actionwhen
|
and dts > @dts
|
||||||
|
--(select dts from versions where versionid = (select max(versionid) from revisions rr inner join versions vv on rr.revisionid = vv.revisionid
|
||||||
|
--inner join stages ss on vv.stageid = ss.stageid where itemid = @procitemid and ss.isapproved = 1))
|
||||||
|
order by ordinalpath,annotationid,auditid--actionwhen
|
||||||
end
|
end
|
||||||
go
|
go
|
||||||
-- Display the status of Trigger alter
|
-- Display the status of Trigger alter
|
||||||
@ -2826,7 +2848,8 @@ create PROCEDURE [dbo].[getContentAuditsSummaryByItemID]
|
|||||||
(
|
(
|
||||||
@ProcedureItemID int,
|
@ProcedureItemID int,
|
||||||
@SelectedItemID int,
|
@SelectedItemID int,
|
||||||
@IncludeDeletedChildren int
|
@IncludeDeletedChildren int,
|
||||||
|
@DTS datetime
|
||||||
)
|
)
|
||||||
|
|
||||||
WITH EXECUTE AS OWNER
|
WITH EXECUTE AS OWNER
|
||||||
@ -2853,7 +2876,7 @@ TypeName nvarchar(max),
|
|||||||
ordinalpath nvarchar(max)
|
ordinalpath nvarchar(max)
|
||||||
)
|
)
|
||||||
insert into @Chrono
|
insert into @Chrono
|
||||||
select * from vefn_GetMyChronology(@ProcedureItemID,@SelectedItemID,@IncludeDeletedChildren)
|
select * from vefn_GetMyChronology(@ProcedureItemID,@SelectedItemID,@IncludeDeletedChildren,@DTS)
|
||||||
select * from @Chrono
|
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)
|
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
|
order by OrdinalPath, contentid,auditid
|
||||||
|
Loading…
x
Reference in New Issue
Block a user