USP_DATAFORMTEMPLATE_EDIT_VOIDCHECK

The save procedure used by the edit dataform template "Bank Account Disbursement Transaction Void Form".

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN The input ID parameter indicating the ID of the record being edited.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the procedure.
@REVERSALPOSTDATETYPECODE tinyint IN Reversal post date
@REVERSALPOSTDATE datetime IN
@VOIDDATE datetime IN
@VOIDDATETYPECODE tinyint IN Void date
@CONSTITUENTID uniqueidentifier IN
@AMOUNT money IN
@DESCRIPTION nvarchar(100) IN
@TRANSACTIONS xml IN

Definition

Copy

CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_VOIDCHECK (
    @ID uniqueidentifier,
    @CHANGEAGENTID uniqueidentifier = null,
    @REVERSALPOSTDATETYPECODE tinyint,
    @REVERSALPOSTDATE datetime,
    @VOIDDATE datetime,
    @VOIDDATETYPECODE tinyint,
    @CONSTITUENTID uniqueidentifier,
    @AMOUNT money,
    @DESCRIPTION nvarchar(100),
    @TRANSACTIONS xml
)
as

    set nocount on;

    if @CHANGEAGENTID is null  
        exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output

    declare @CURRENTDATE datetime
    set @CURRENTDATE = getdate()

    declare @BANKACCOUNTTRANSACTIONIDS as udt_genericid;

    begin try
        if exists(select * from dbo.BANKACCOUNTTRANSACTION BAT where BAT.ID = @ID and BAT.STATUSCODE != 4)
        begin
            -- handle voiding the bank account transaction
            -- put the ID in to the generic ID table
            insert into @BANKACCOUNTTRANSACTIONIDS(ID) values(@ID);

            -- pass the generic ID table and other parameters into the sproc
            exec dbo. USP_BANKACCOUNTDISBURSEMENTS_VOID
                @BANKACCOUNTTRANSACTIONIDS
                ,@REVERSALPOSTDATE
                ,@REVERSALPOSTDATETYPECODE
                ,@VOIDDATE
                ,@VOIDDATETYPECODE
                ,@CHANGEAGENTID

            -- handle deleting the transactions
            exec dbo.USP_BANKACCOUNTDISBURSEMENTS_TRANSACTIONS_DELETE @TRANSACTIONS, @ID, @CHANGEAGENTID
        end

    end try
    begin catch
        exec dbo.USP_RAISE_ERROR
        return 1
    end catch

return 0;