
[dbo].[AdvanceBATBuildGLNumber_XLedger]
CREATE procedure [dbo].[AdvanceBATBuildGLNumber_XLedger]
@inSessionID varchar(50),
@inSource varchar(50),
@inSourceID int,
@inBranchID int,
@inDivisionID int,
@outGLNumber varchar(66) output,
@outAccountingAccountId int output,
@outErrorCode int output
as
set nocount on
set @outErrorCode = 0
set @outAccountingAccountId = null
set @outGLNumber = null
declare @ERROR_EXPENSE_ACCOUNT_NOT_SET_UP int = 7020
select @outAccountingAccountId = ExpenseAccountingAccountFid
from AdvanceSetup
if( @outAccountingAccountId is null )
begin
exec @outErrorCode = spBATRecordError
@inSessionID,
@inSource,
@inSourceID,
@ERROR_EXPENSE_ACCOUNT_NOT_SET_UP,
null,
null
end
else
begin
select @outGLNumber = AccountingAccount.Code
from AccountingAccount
where AccountingAccountId = @outAccountingAccountId
end
GO
GRANT EXECUTE ON [dbo].[AdvanceBATBuildGLNumber_XLedger] TO [MssExec]
GO