spTransactions_GetUnprocessedCounts

Parameters

Parameter Parameter Type Mode Description
@ClientID int IN
@Signups int INOUT
@EventRegs int INOUT
@ProfileUpdates int INOUT
@Donations int INOUT
@PollResults int INOUT
@Memberships int INOUT
@CapWizTrans int INOUT
@FundRaiserTrans int INOUT
@CarePageTrans int INOUT

Definition

Copy

                CREATE PROCEDURE [dbo].[spTransactions_GetUnprocessedCounts](@ClientID int, @Signups int out ,@EventRegs int out,@ProfileUpdates int out, @Donations int out, @PollResults int out, @Memberships int out, @CapWizTrans int out, @FundRaiserTrans int out, @CarePageTrans int out)
                as
                select @Signups=count(*) from dbo.SignupTransactions where processed_date is null
                and ClientsID=@ClientID and IsDeleted=0

                select @ProfileUpdates=count(*) from dbo.ProfileUpdateTransactions pt 
                where processed_date is null and ClientsID=@ClientID  and IsDeleted=0 And Not BackOfficeID is null 
                --sterling filter out dupe updates from count so BBEC UI shows correct initial count
                and NOT EXISTS(
                    SELECT null from dbo.ProfileUpdateTransactions pt2 
                    where pt.BackOfficeID = pt2.BackOfficeID and pt2.ProfileUpdateTransactionsID > pt.ProfileUpdateTransactionsID)

                select @EventRegs=count(*) from fnTransactions_GetUnprocessedEventRegsForClient(@ClientID)

                select @Donations=count(*) from fnTransactions_GetUnprocessedGiftsForClient(@ClientID)

                select @PollResults=count(*) from dbo.SitePollResults spr
                inner join dbo.SitePollAnswers [spa] on [spr].SitePollAnswersID=[spa].ID
                inner join dbo.SitePolls [sp] on [spa].SitePollsID=[sp].ID
                inner join dbo.SiteContent [sc] on [sp].ID=[sc].ID
                inner join dbo.ClientSites [cs] on [sc].ClientSitesID=[cs].ID
                where spr.processed_date is null and sp.Closed=0 and sc.ExpireDate > getutcdate()
                and cs.ClientsID=@ClientID  

                Select @Memberships=count(*) from dbo.MembershipTransactions mt
                inner join dbo.ClientMemberships cm on mt.ClientMembershipsID=cm.ID
                inner join dbo.SiteContent [sc] on [cm].SiteContentID=[sc].ID
                inner join dbo.ClientSites [cs] on [sc].ClientSitesID=[cs].ID
                where mt.processed_date is null and mt.IsDeleted=0 and mt.Status = 1
                and cs.ClientsID=@ClientID 

                select @CapWizTrans=count(*) from dbo.CapWizTransactions where ProcessedDate is null
                and ClientsID=@ClientID and IsDeleted=0

                select @FundRaiserTrans=count(id) from dbo.fnTransactions_GetUnprocessedFundRaisers(@ClientID)

                select @CarePageTrans=count(*) from dbo.fnTransactions_GetUnprocessedCarePages(@ClientID)

                return 0