Stored Procedures [dbo].[BATErrorVerifyAccountingSystem]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@inAccountingSystemTypeCodevarchar(2)2
@inSessionIDvarchar(50)50
@inObjectNamevarchar(20)20
@inObjectIDint4
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
/**
*
*    This Stored Procedure validates the accounting system for each branch that would be used in the Transaction
*    Generation Process.  This SP passes off the work to the appropriate SP for the current accounting system.
*
*    NOTE: This sp requires that a temp table (#theBranchTable) exist to put the branch information into
*        #theBranchTable
*            BranchTableID int identity( 1, 1 ),
*            BranchPrimaryKey int,
*            BranchID varchar(5),
*            Series int  -- Either 2(GL), 3(AR), or 4(AP)
*  
*    Error Codes (these get logged via spBATRecordError):
*    ===========================================================================================================
*    @ERROR_UNSUPPORTED_ACCOUNTING_SYSTEM
*
*    Parameters:
*    @param @inAccountingSystemTypeCode The code for the accounting system.  See dbo.GetAccountingSystemType().
*    @param @inSessionID The unique session id for the current transaction processing.
*    @param @inObjectName The name of the object responsible for the calling of the stored proc
*    @param @inObjectID The primary key of the object
*/

CREATE PROCEDURE [dbo].[BATErrorVerifyAccountingSystem]
    @inAccountingSystemTypeCode varchar(2),
    @inSessionID varchar(50),
    @inObjectName varchar(20),
    @inObjectID int
as
set nocount on

declare @ERROR_UNSUPPORTED_ACCOUNTING_SYSTEM int = 780
declare @theAccountingSystemName varchar(64)

if( @inAccountingSystemTypeCode = 'XL' )
begin
    -- Nothing to verify for XLedger but we need a statement between begin/end.
    set @theAccountingSystemName = 'XLedger'
end
else if( @inAccountingSystemTypeCode = 'GP' )
begin
    exec BATErrorVerifyGreatPlains
        @inSessionID = @inSessionID,
        @inObjectName = @inObjectName,
        @inObjectID = @inObjectID
end
else
begin
    if( @inAccountingSystemTypeCode = 'QB' )
    begin
        -- Not currently supported.
        set @theAccountingSystemName = 'the QuickBooks'
    end
    else if( @inAccountingSystemTypeCode = 'NO' )
    begin
        -- None will never be supported.
        set @theAccountingSystemName = 'when there is no installed'
    end
    else
    begin
        -- Allow for some future accounting system type code
        set @theAccountingSystemName = @inAccountingSystemTypeCode
    end

    exec spBATRecordError
        @inSessionID = @inSessionID,
        @inSourceTable = null,
        @inSourceID = null,
        @inErrorCodeID = @ERROR_UNSUPPORTED_ACCOUNTING_SYSTEM,
        @inObjectTable = @inObjectName,
        @inObjectID = @inObjectID,
        @inParam1 = @theAccountingSystemName
end
GO
GRANT EXECUTE ON  [dbo].[BATErrorVerifyAccountingSystem] TO [MssExec]
GO
Uses