UFN_TAX_GETTOTAL

Returns the sum of all the tax items belonging to a specific tax.

Return

Return Type
decimal(7, 4)

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN

Definition

Copy


CREATE function dbo.UFN_TAX_GETTOTAL
(
    @ID uniqueidentifier
)
returns decimal(7,4)
as begin
    declare @SUM decimal(7,4) = 0;

    select @SUM = sum(PERCENTAGE)
    from dbo.TAXITEM
    inner join dbo.TAXENTITYCODE on TAXENTITYCODE.ID = TAXITEM.TAXENTITYCODEID
    where TAXID = @ID and TAXENTITYCODE.ACTIVE = 1;

    return @SUM
end