UFN_GIFTAIDREVENUESPLIT_GETREFUNDTAXCLAIMAMOUNT

Returns the original tax claim amount for a refunded application.

Return

Return Type
money

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN

Definition

Copy


            CREATE function dbo.UFN_GIFTAIDREVENUESPLIT_GETREFUNDTAXCLAIMAMOUNT
                (
                @ID uniqueidentifier
                )
                returns money
                with execute as caller
                as begin
                    declare @TAXCLAIMAMOUNT money = 0;

                    declare @MULTICURRENCYENABLED bit;
                    set @MULTICURRENCYENABLED = dbo.UFN_CONDITIONSETTING_EVALUATEEXISTSCONDITION('Multicurrency');            

                    select top 1 @TAXCLAIMAMOUNT = case @MULTICURRENCYENABLED
                                        when 1 then coalesce(ORIGINALTRANSACTIONTAXCLAIMAMOUNT, 0)
                                        else coalesce(ORIGINALTAXCLAIMAMOUNT, 0)
                                    end
                    from dbo.REVENUESPLITGIFTAIDREFUND
                    where REVENUESPLITID = @ID
                    order by DATEREFUNDED desc;

                    return @TAXCLAIMAMOUNT;
                end