UFN_DISCOUNT_ISCONSTITUENTRECOGNITION

Validates whether the constituent appears in any recognition program that is eligible for discount.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@CONSTITUENTID uniqueidentifier IN

Definition

Copy


      create function dbo.UFN_DISCOUNT_ISCONSTITUENTRECOGNITION
      (
        @CONSTITUENTID uniqueidentifier
      ) 
      returns bit
            with execute as caller
            as begin
        if exists(
          select CONSTITUENTID
          from dbo.CONSTITUENTRECOGNITION
          where CONSTITUENTRECOGNITION.CONSTITUENTID = @CONSTITUENTID
                  and (CONSTITUENTRECOGNITION.EXPIRATIONDATE >= getdate() or
                       dbo.UFN_RECOGNITIONPROGRAM_GETTYPECODE(CONSTITUENTRECOGNITION.RECOGNITIONPROGRAMID) = 1)
          ) 
          return 1;

         return 0;
      end