UFN_PLEDGEPAYMENT_INSTALLMENTSBALANCE

Validates that pledge payments balance to the pledge installments.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@PLEDGEID uniqueidentifier IN

Definition

Copy


            create function dbo.UFN_PLEDGEPAYMENT_INSTALLMENTSBALANCE
            (
                @PLEDGEID uniqueidentifier
            )
            returns bit
            with execute as caller
            as 
            begin
                declare @r as int;

                select @r = count(*)
                from INSTALLMENTSPLIT
                where INSTALLMENTSPLIT.PLEDGEID = @PLEDGEID and dbo.UFN_INSTALLMENT_GETINSTALLMENTSPLITBALANCE(INSTALLMENTSPLIT.ID) < 0

                if @r = 0 -- no overpayments exist

                    return 1

                return 0
            end