Proc Subway EFTPosting Batch

Purpose
This stored procedure was created to post all the Cash Receipts,  create Eft Files,  and determine which reports to run for a given Bank Type / Balance ID combination

Method Signature
[dbo].[proc_Subway_EFTPosting_Batch]  (   @BankType                                     INTEGER,  @CountryRecID                               INTEGER,  @BalanceIDCombinationForPosting  VARCHAR(50),  @ServerName                                 VARCHAR(200),  @UserDepartmentID                        INTEGER,  @UserJobTitleID                              INTEGER )

Procudere Flow

 * 1) The procedure starts out assigning local variables
 * 2) A transaction is started
 * 3) Check to see if this procedure is already running.  If so exit out
 * 4) Set the running flag in the SubwayNet.dbo.ObjectGroup table
 * 5) Store all the records where the EftAmt > 0, SendEftInd = 1 and EftPostingDate is less than the current Week Ending Date or IS NULL for the given BankType / Balance IDs combination.
 * 6) Gather all the Cash Receipt General Ledger Account numbers for all the unique Country / Currency / Balance ID combinations from Step 5 where the Item Type and Account Type is Eft Posting
 * 7)  Create an Cash Receipt XML document
 * 8) Execute proc_Subway_CashReceiptBatchUnposted_Batch to save the data to the Cash Receipt Unposted tables
 * 9) Execute proc_Subway_CashReceiptBatchPosting_Batch to post the Cash Receipt
 * 10) Insert a record into the EFTPostingDates table to prevent double posting
 * 11) If the Bank is not International Bank run the Bank specific EFTCreateFile Stored Procedure to create a bank file
 * 12) *If the Bank is in Germany, add an extra parameter to this procedure call for Bank Type (GERI or GERR)
 * 13) Update the Posted Date in the EFTFile table for all the records that were just posted
 * 14) Clear the running flag in the SubwayNet.dbo.ObjectGroup table
 * 15) Commit the Transaction
 * 16) Return the Minimum and Maximum CashReceipt Batch Number in a recordset
 * 17) Return a list of reports to run associated to the current BankType / Balance IDs combination.

Tables

 * BalanceTypes
 * EFTBanktypeBalanceTypeCompatibility
 * EFTFile
 * EFTPostingDates
 * FranchiseAgreement
 * Common.dbo.Country
 * SubwayNet.dbo.ObjectGroup

Stored Procedures

 * proc_Subway_CashReceiptBatchPosting_Batch
 * proc_Subway_CashReceiptBatchUnposted_Batch

Functions

 * fnGetCompleteAccountNumByCurrencyIDCountryIDEntityTypeBalanceIDAccountTypeAndCashReceiptItemType
 * fnGetGeneralLedgerAccountIdByCurrencyIDCountryIDEntityTypeBalanceIdAccountTypeAndCashReceiptItemType
 * fnGetWeekEndingDateByBalanceType
 * fnSplitString