UFN_SELECTION_CONSTITUENT_RECURRINGDONORS

Returns all Recurring donor constituents.

Return

Return Type
table

Definition

Copy


        CREATE function dbo.UFN_SELECTION_CONSTITUENT_RECURRINGDONORS()
        returns @IDS table (ID uniqueidentifier)
        as 
        begin
                insert into @IDS (ID)
                select distinct CONSTITUENTID 
                from dbo.REVENUE with (nolock)
                inner join dbo.REVENUESCHEDULE on REVENUE.ID = REVENUESCHEDULE.ID
                where REVENUE.TRANSACTIONTYPECODE = 2        --Recurring Gift

                    and REVENUESCHEDULE.STATUSCODE  in (0,1,5)        --Active & Lapsed

                    and REVENUESCHEDULE.ISPENDING = 0          --Isn't pending

                    and REVENUE.AMOUNT > 0                          --Has Value???

                    and REVENUE.CONSTITUENTID is not null -- Altru allows revenue without donors

            return
        end