UFN_BANKACCOUNTDEPOSIT_GETDEPOSITAMOUNT

This function returns the deposit amount.

Return

Return Type
decimal(19, 4)

Parameters

Parameter Parameter Type Mode Description
@DEPOSITID uniqueidentifier IN

Definition

Copy


            CREATE function dbo.UFN_BANKACCOUNTDEPOSIT_GETDEPOSITAMOUNT
            (
                @DEPOSITID uniqueidentifier
            )
            returns decimal(19,4)
            with execute as caller
            as begin
                declare @DEPOSITAMOUNT decimal(19,4);

                select
                    @DEPOSITAMOUNT = coalesce(SUM(REVENUE.AMOUNT), 0)
                from
                    dbo.REVENUE
                    inner join dbo.BANKACCOUNTDEPOSITPAYMENT on
                    BANKACCOUNTDEPOSITPAYMENT.ID = REVENUE.ID
                    inner join dbo.BANKACCOUNTDEPOSIT on
                    dbo.BANKACCOUNTDEPOSIT.ID = BANKACCOUNTDEPOSITPAYMENT.DEPOSITID
                where
                    BANKACCOUNTDEPOSIT.ID = @DEPOSITID

                return @DEPOSITAMOUNT
            end