USP_DATALIST_CONSTITUENTGROUP_REVENUEHISTORY_2

This list returns a filtered list of revenue associated with a constituent group and its members.

Parameters

Parameter Parameter Type Mode Description
@GROUPID uniqueidentifier IN Input parameter indicating the context ID for the data list.
@GROUPBY tinyint IN Group by
@TRANSACTIONTYPEOPTIONCODE smallint IN Type
@REVENUETYPEOPTIONCODE smallint IN Revenue type
@DATERANGECODE smallint IN Date range
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.
@SITEFILTERMODE tinyint IN Sites
@SITESSELECTED xml IN
@SECURITYFEATUREID uniqueidentifier IN Input parameter indicating the ID of the feature to use for site security checking.
@SECURITYFEATURETYPE tinyint IN Input parameter indicating the type of the feature to use for site security checking.
@REVENUEFILTERID uniqueidentifier IN Revenue
@CURRENCYCODE tinyint IN Currency

Definition

Copy


CREATE procedure dbo.USP_DATALIST_CONSTITUENTGROUP_REVENUEHISTORY_2
(
    @GROUPID uniqueidentifier,    
    @GROUPBY tinyint = 0,  -- 0=Commitment, 1=Transaction

    @TRANSACTIONTYPEOPTIONCODE smallint = -1,  -- -1=All, otherwise revenue.transactiontypecode

    @REVENUETYPEOPTIONCODE smallint = -1,  -- -1=All, otherwise revenuesplit.revenuetypecode

    @DATERANGECODE smallint = 4,
    @CURRENTAPPUSERID uniqueidentifier = null,
    @SITEFILTERMODE tinyint = 0,
    @SITESSELECTED xml = null,
    @SECURITYFEATUREID uniqueidentifier = null,
    @SECURITYFEATURETYPE tinyint = null,
    @REVENUEFILTERID uniqueidentifier = null,
    @CURRENCYCODE tinyint = 2
)
as
    set nocount on;

    -- households always include member giving, other types get looked up

    declare @GROUPINCLUDESMEMBERREVENUE bit;

    select 
    @GROUPINCLUDESMEMBERREVENUE = 
      case
        when GD.GROUPTYPECODE = 0 then 1
        when GD.GROUPTYPECODE = 1 then GT.INCLUDEMEMBERGIVING
      end
    from dbo.GROUPDATA GD
    left join dbo.GROUPTYPE GT on GD.GROUPTYPEID = GT.ID
    where GD.ID=@GROUPID;

    exec dbo.USP_DATALIST_CONSTITUENT_REVENUEHISTORY_2
        @GROUPID,
        @GROUPBY,
        @TRANSACTIONTYPEOPTIONCODE,
        @REVENUETYPEOPTIONCODE,
        @DATERANGECODE,
        @CURRENTAPPUSERID,
        @SITEFILTERMODE,
        @SITESSELECTED,
        @SECURITYFEATUREID,
        @SECURITYFEATURETYPE,
        @GROUPINCLUDESMEMBERREVENUE,
        @REVENUEFILTERID