Stored Procedures [dbo].[BcGetTransactionsForBatchHeader]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@batchIdint4
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
CREATE procedure [dbo].[BcGetTransactionsForBatchHeader]
    @batchId int
as
begin
    set nocount on


    select
        BcTransactionBatchItemId = BcTransactionBatchItem.BcTransactionBatchItemId,
        Amount = AcctTransactions.TransactionAmount,
        ItemDescription = isnull( AcctTransactions.ItemDescription, 'MSS GL Item' ),
        TransactionType = AcctTransactions.TransactionType,
        PostingDate = AcctTransactions.JournalDate, -- BCTD: Need to check with Joe E. on if this is this or document date or some other date.
        ProjectCode = BcTransactionBatchItem.ProjectCode,
        ProjectDimensionValueBcId = BcTransactionBatchItem.ProjectDimensionValueBcId,
        CustomerBcId  = BcTransactionBatchItem.CustomerBcId,
        CustomerNumber  = AccountingCustomer.CustomerNumber,
        NominalAccountBcId = BcTransactionBatchItem.NominalAccountBcId,
        NominalAccountNumber = NominalAccountingAccount.Code,
        OpposingAccountBcId = BcTransactionBatchItem.OpposingAccountBcId,
        OpposingAccountNumber = OpposingAccountingAccount.Code,
        NominalBranchDimensionValueBcId = BcTransactionBatchItem.NominalBranchDimensionValueBcId,
        NominalDivisionDimensionValueBcId = BcTransactionBatchItem.NominalDivisionDimensionValueBcId,
        MoveTypeDimensionValueBcId = BcTransactionBatchItem.MoveTypeDimensionValueBcId,
        OpposingBranchDimensionValueBcId = BcTransactionBatchItem.OpposingBranchDimensionValueBcId,
        OpposingDivisionDimensionValueBcId = BcTransactionBatchItem.OpposingDivisionDimensionValueBcId,
        ArDriverSalesDimensionValueBcId = BcTransactionBatchItem.ArDriverSalesDimensionValueBcId,
        RevenueDriverSalesDimensionValueBcId = BcTransactionBatchItem.RevenueDriverSalesDimensionValueBcId,
        VendorBcId = BcTransactionBatchItem.VendorBcId,
        VendorNumber = AccountingVendor.VendorNumber,
        Ten99 = AcctTransactions.[1099Flag]
    from BcTransactionBatchItem
    inner join AcctTransactions on BcTransactionBatchItem.AcctTransactionFid = AcctTransactions.ATPriKey
    inner join BcAccount NominalBcAccount on BcTransactionBatchItem.NominalAccountBcId = NominalBcAccount.BcId
    inner join AccountingAccount NominalAccountingAccount on NominalBcAccount.AccountingAccountFid = NominalAccountingAccount.AccountingAccountId
    inner join BcAccount OpposingBcAccount on BcTransactionBatchItem.OpposingAccountBcId = OpposingBcAccount.BcId
    inner join AccountingAccount OpposingAccountingAccount on OpposingBcAccount.AccountingAccountFid = OpposingAccountingAccount.AccountingAccountId
    left outer join BcVendor on BcTransactionBatchItem.VendorBcId = BcVendor.BcId
    left outer join AccountingVendor on BcVendor.AccountingVendorFid = AccountingVendor.AccountingVendorId
    left outer join BcCustomer on BcTransactionBatchItem.CustomerBcId = BcCustomer.BcId
    left outer join AccountingCustomer on BcCustomer.AccountingCustomerFid = AccountingCustomer.AccountingCustomerId


    where BcTransactionBatchItem.BcTransactionBatchFid = @batchId

end
GO
GRANT EXECUTE ON  [dbo].[BcGetTransactionsForBatchHeader] TO [MssExec]
GO
Uses