fnTransactions_GetUnprocessedFundRaisers
Return
Return Type |
---|
table |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ClientsID | int | IN |
Definition
Copy
CREATE function [dbo].[fnTransactions_GetUnprocessedFundRaisers](@ClientsID int)
returns @results table(id integer) as
begin
declare @FundRaiserID integer
declare c1 cursor local fast_forward for
select fr.[ID] from dbo.FundRaisers fr
inner join dbo.SiteContent sc on fr.SiteContentID=sc.[ID]
inner join dbo.ClientSites cs on sc.ClientSitesID = cs.ID
where cs.ClientsID=@ClientsID and fr.IsCarePageManager=0
open c1
fetch next from c1 into @FundRaiserID
while @@FETCH_STATUS=0
begin
if (select count(*) from dbo.fnFundRaiserAll(@FundRaiserID) fra
where fra.Dirty=1 and (fra.IsTeam=1 or dbo.fnGetRaisersEdgeRecordIDFromLinkedUserID(fra.ClientUsersID) > 0)) > 0
begin
insert into @results values (@FundRaiserID)
end
fetch next from c1 into @FundRaiserID
end
close c1
deallocate c1
return
end