示例#1
0
        ///<summary>
        ///  Parameters:  none
        ///</summary>

        /* structure btl91 format:
         *  1 line of file information
         *  1 batches consisting of
         *    x payments consisting of
         *        4 payment transaction records
         *    y currency total records
         *  1 line of file closing information.
         */
        private void buildInfo(List <Erp.Internal.EI.Payment_Def.TmpElec> TmpElecRows)
        {
            string   CurGroupCurrencyCode     = string.Empty;
            DateTime?CurCheckDate             = null;
            string   BankCurrencySymbol       = string.Empty;
            string   VendorBankISOCountryCode = string.Empty;
            string   VendorISOCountryCode     = string.Empty;
            string   SAmount                = string.Empty;
            string   TAmount                = string.Empty;
            int      TotalRecords           = 0;
            string   PaymentNumber          = string.Empty;
            int      TotalOrders            = 0;
            string   Selfbanknumber         = string.Empty;
            string   Description_1          = string.Empty;
            int      TotalInvoice           = 0;
            string   TransferCost           = string.Empty;
            string   VendorBankSWIFTAddress = string.Empty;
            string   IsoCurrencySymbol      = string.Empty;
            string   v_CurrCode             = string.Empty;
            int      lineLevel              = 0;

            SFCommon.OutFileLine OutFileLineRow;
            SFCommon.OutFileLine OutFileLineRow2;

            #region >>===== ABL Source ================================>>
            //
            //FIND first Currency WHERE Currency.Company = cur-comp and
            //                              Currency.BaseCurr = true no-lock
            //
            #endregion == ABL Source =================================<<

            Currency = this.FindFirstCurrency(Session.CompanyID, true);
            if (Currency != null)
            {
                v_CurrCode = Currency.CurrencyCode;
            }
            else
            {
                v_CurrCode = "";
            }


            #region >>===== ABL Source ================================>>
            //
            //find first TmpElec no-lock no-error;
            //
            #endregion == ABL Source =================================<<

            var TmpElec = (from row in TmpElecRows select row).FirstOrDefault();
            if (TmpElec == null)
            {
                throw new BLException(GlobalStrings.InterErrorTmpElecHasNoRecords);
            }
            else
            {
                CurGroupCurrencyCode = TmpElec.GroupCurrCode;
                CurCheckDate         = TmpElec.ProcessDate;
            }


            #region >>===== ABL Source ================================>>
            //
            //FIND first Company WHERE Company.Company = CUR-COMP no-lock
            //
            #endregion == ABL Source =================================<<

            Company = this.FindFirstCompany(Session.CompanyID);
            if (Company == null)
            {
                throw new BLException(GlobalStrings.CompanyNotFound);
            }


            #region >>===== ABL Source ================================>>
            //
            //FIND first Country WHERE Country.Company = CUR-COMP and Country.CountryNum = Company.CountryNum no-lock
            //
            #endregion == ABL Source =================================<<

            Country = this.FindFirstCountry(Session.CompanyID, Company.CountryNum);
            if (Country == null)
            {
                throw new BLException(GlobalStrings.AValidCountryOfYourCompanyIsRequi);
            }


            #region >>===== ABL Source ================================>>
            //
            //FIND first BankAcct WHERE BankAcct.Company = Cur-comp and BankAcct.BankAcctID = TmpElec.FromBankAcctID no-lock
            //
            #endregion == ABL Source =================================<<

            BankAcct = this.FindFirstBankAcct(Session.CompanyID, TmpElec.FromBankAcctID);
            if (BankAcct == null)
            {
                throw new BLException(GlobalStrings.AValidFromBankAcctIsRequired);
            }

            //Selfbanknumber = Payment_Common.BankAccount(BankAcct.CheckingAccount);
//needs to be right justified, zero filled
            //Selfbanknumber = String.Format("{0:00000000000000000000}", Payment_Common.BankAccount(BankAcct.CheckingAccount));
            //Selfbanknumber = String.Format("{0:00000000000000000000}", Convert.ToInt32(Payment_Common.BankAccount(BankAcct.CheckingAccount)));
            Selfbanknumber = String.Format("{0:00000000000000000000}", Convert.ToDouble(Payment_Common.BankAccount(BankAcct.CheckingAccount)));


            BankCurrencySymbol = GetCurrencyID(BankAcct.CurrencyCode);
            IsoCurrencySymbol  = GetCurrencyID(CurGroupCurrencyCode);/* CurGroupCurrencyCode will be blank if more than one currency in the group 67341*/

            /* The line below is commented out per SCR # 64216 */
            /*if CurGroupCurrencyCode = v-CurrCode then IsoCurrencySymbol = "EUR":U.*/

            if (String.IsNullOrEmpty(Selfbanknumber))
            {
                throw new BLException(GlobalStrings.AValidYourBankAccountNumberIsRequi);
            }

            /* if the currency of the bankaccount is not Dutch Guilder or Euro then
             * the currency of the bankaccount must be equal to the currency of the payment */
            if ((!(BankCurrencySymbol.Compare("NLG") == 0 || BankCurrencySymbol.Compare("EUR") == 0 || BankCurrencySymbol.Compare("?") == 0)) && (IsoCurrencySymbol.Compare(BankCurrencySymbol) != 0))
            {
                throw new BLException(GlobalStrings.OnlyPaymeInTheCurreOfThisBankAccountAreAllowed);
            }
            SFCommon.ttOutFileLineRows = new List <SFCommon.OutFileLine>();
            SFCommon.ttOutFileLineRows.Clear();
            /* 11: file information */
            lineLevel    = 11;
            TotalRecords = 0;

//zzz fix the doc notes:

            /* This code adds information from the specified payment method into a document.
             * The document will have the structure like this:
             *
             *  1 line of payment method information
             *  1 line of file information
             *  1 batches consisting of
             *    x payments consisting of
             *        4 payment transaction records
             *    y currency total records
             *  1 line of file closing information.
             *
             * SCR 40680  - uncomment the string below if you want insert payment method information  */
            /*
             * create OutFileLine.
             * {ei/SoftFormat.i &TableName        = PayMethodProp
             *               &EFTHeadUID       = EFTHeadUID
             *               &LineOut          = OutFileLine.Line-out
             *               &LineLen          = lineLen
             *               &LineLevel        = lineLevel
             *               &LineLevelFormat  = lineLevelFormat
             *               &TotalRecords     = TotalRecords}
             */
            OutFileLineRow = new SFCommon.OutFileLine();
            SFCommon.ttOutFileLineRows.Add(OutFileLineRow);

            // FILE HEADER RECORD (1)
            string line_out = ((lineLen > 0) ? " ".PadRight(lineLen + " ".Length, ' ') : null);
            // field 1
            line_out = ErpUtilities.Overlay(line_out, 0, "1", 1);
            // field 2
            line_out = ErpUtilities.Overlay(line_out, 1, "01", 2);
            // field 3
            line_out = ErpUtilities.Overlay(line_out, 3, "0021000021", 10);
            // field 4
            line_out = ErpUtilities.Overlay(line_out, 13, "0000000000", 10);
            // field 5
            line_out = ErpUtilities.Overlay(line_out, 23, DateTime.Now.ToString("yyMMdd"), 6);
            // field 6
            line_out = ErpUtilities.Overlay(line_out, 29, DateTime.Now.ToString("HHmm"), 4);
            // field 7
            line_out = ErpUtilities.Overlay(line_out, 33, "A", 1);
            // field 8
            line_out = ErpUtilities.Overlay(line_out, 34, "094", 3);
            // field 9
            line_out = ErpUtilities.Overlay(line_out, 37, "10", 2);
            // field 10
            line_out = ErpUtilities.Overlay(line_out, 39, "1", 1);
            // field 11
            line_out = ErpUtilities.Overlay(line_out, 40, "JPMORGAN CHASE", 23);
            // field 12
            line_out = ErpUtilities.Overlay(line_out, 63, Company.Name, 23);
            // field 13
            line_out = ErpUtilities.Overlay(line_out, 86, "", 8);

            TotalRecords            = TotalRecords + 1;
            lineLevel               = lineLevel + 1;
            PaymentNumber           = "";
            TotalOrders             = 0;
            OutFileLineRow.Line_out = line_out;


            // BATCH HEADER RECORD (5)
            OutFileLineRow2 = new SFCommon.OutFileLine();
            SFCommon.ttOutFileLineRows.Add(OutFileLineRow2);


            string line_out2 = ((lineLen > 0) ? " ".PadRight(lineLen + " ".Length, ' ') : null);
            // field 1
            line_out2 = ErpUtilities.Overlay(line_out2, 0, "5", 1);

//need logic here
//	220 for credits
//	225 for debits
//	can't combine both
            // field 2
            line_out2 = ErpUtilities.Overlay(line_out2, 1, "???", 3);


            // field 3
            line_out2 = ErpUtilities.Overlay(line_out2, 4, "", 16);
            // field 4
            line_out2 = ErpUtilities.Overlay(line_out2, 20, Selfbanknumber, 20);
            // field 5
            line_out2 = ErpUtilities.Overlay(line_out2, 40, "0000000000", 10);
            // field 6
            line_out2 = ErpUtilities.Overlay(line_out2, 50, "CCD", 3);
            // field 7
            line_out2 = ErpUtilities.Overlay(line_out2, 53, "ACH PMT", 10);
            // field 8
            line_out2 = ErpUtilities.Overlay(line_out2, 63, DateTime.Now.ToString("MMM dd"), 6);
            // field 9
            line_out2 = ErpUtilities.Overlay(line_out2, 69, DateTime.Now.ToString("yyMMdd"), 6);
            // field 10
            line_out2 = ErpUtilities.Overlay(line_out2, 75, "", 3);
            // field 11
            line_out2 = ErpUtilities.Overlay(line_out2, 78, "1", 1);
            // field 12
            line_out2 = ErpUtilities.Overlay(line_out2, 79, "02100002", 8);

//zzzz
//batch number need to figure out:
//for each APTran where APTran.Company = Cur-Comp and APTran.HeadNum = TmpElec.HeadNum no-lock
//                             by APTran.Company
//                               by APTran.HeadNum
//                                 by APTranNo
//                                   by InvoiceNum:

            // field 13
            //line_out2 = ErpUtilities.Overlay(line_out2, 87, TmpElec.HeadNum.ToString(), 7);
//Selfbanknumber = String.Format("{0:00000}", Payment_Common.BankAccount(BankAcct.CheckingAccount));
//this is not the check number:
            //line_out2 = ErpUtilities.Overlay(line_out2, 87, String.Format("{0:0000000}", TmpElec.HeadNum), 7);
            // >> yields: 0000774
//note: CheckHed.CheckNum is currently 8 digits, field 13 is only 7
//		that is bad anyway because it's per payment, not ap batch

//not a line, just for testing:
            string x = GetPaymentBankBatchID(string.Empty);
            line_out2 = ErpUtilities.Overlay(line_out2, 87, x, 7);



            TotalRecords  = TotalRecords + 1;
            lineLevel     = lineLevel + 1;
            PaymentNumber = "";
            TotalOrders   = 0;
//zzzz
            OutFileLineRow2.Line_out = line_out2;



//zzz fix the doc notes:

            /* This code adds information from the specified payment method into a document.
             * The document will have the structure like this:
             *
             *  1 line of file information
             *  1 line of payment method information
             *  1 batches consisting of
             *    x payments consisting of
             *        4 payment transaction records
             *    y currency total records
             *  1 line of file closing information.
             *
             * SCR 40680  - uncomment the string below if you want insert payment method information  */
            /*
             * create OutFileLine.
             * {ei/SoftFormat.i &TableName        = PayMethodProp
             *               &EFTHeadUID       = EFTHeadUID
             *               &LineOut          = OutFileLine.Line-out
             *               &LineLen          = lineLen
             *               &LineLevel        = lineLevel
             *               &LineLevelFormat  = lineLevelFormat
             *               &TotalRecords     = TotalRecords}
             */

            #region >>===== ABL Source ================================>>
            //
            //for each TmpElec no-lock:
            //
            //
            //
            #endregion == ABL Source =================================<<

            foreach (var _TmpElec in TmpElecRows)
            {
                TmpElec                = _TmpElec;
                lineLevel              = 21;
                Description_1          = "";
                TotalInvoice           = 0;
                TotalOrders            = TotalOrders + 1;
                TransferCost           = "3";
                PaymentNumber          = Compatibility.Convert.ToString(TotalOrders, "9999");
                VendorBankSWIFTAddress = TmpElec.VendorBankSwiftNum;
                IsoCurrencySymbol      = GetCurrencyID(TmpElec.CurrencyCode);
                if (String.IsNullOrEmpty(TmpElec.VendorBankAcctNumber))
                {
                    throw new BLException(GlobalStrings.AValidSupplBankAccountNumberIsRequi);
                }


                #region >>===== ABL Source ================================>>
                //
                //FIND first Country WHERE Country.Company = CUR-COMP and Country.CountryNum = TmpElec.VendorCountryNum no-lock
                //
                #endregion == ABL Source =================================<<

                Country = this.FindFirstCountry2(Session.CompanyID, TmpElec.VendorCountryNum);
                if (Country == null)
                {
                    throw new BLException(GlobalStrings.AValidCountryOfTheSupplIsRequi);
                }
                if (String.IsNullOrEmpty(Country.ISOCode))
                {
                    throw new BLException(GlobalStrings.TheISOCountryCodeOfTheSupplIsRequi(TmpElec.VendorName));
                }
                VendorISOCountryCode = Country.ISOCode;


                #region >>===== ABL Source ================================>>
                //
                //FIND first Country WHERE Country.Company = CUR-COMP and Country.CountryNum = TmpElec.VendorBankCountryNum no-lock
                //
                #endregion == ABL Source =================================<<

                Country = this.FindFirstCountry3(Session.CompanyID, TmpElec.VendorBankCountryNum);
                if (Country == null)
                {
                    throw new BLException(GlobalStrings.AValidCountryOfTheBankOfTheSupplIsRequi);
                }
                if (String.IsNullOrEmpty(Country.ISOCode))
                {
                    throw new BLException(GlobalStrings.AValidCountryISOCodeOfTheBankOfTheSupplIsRequi);
                }
                VendorBankISOCountryCode = Country.ISOCode;

                /* fill the Description with invoice numbers,
                 * unless there are too many invoices */


                #region >>===== ABL Source ================================>>
                //
                //for each APTran where APTran.Company = Cur-Comp and APTran.HeadNum = TmpElec.HeadNum no-lock
                //                             by APTran.Company
                //                               by APTran.HeadNum
                //                                 by APTranNo
                //                                   by InvoiceNum:
                //
                //
                //
                //
                #endregion == ABL Source =================================<<

                //invoices:
                //this is a list of invoice numbers
                foreach (var APTran_iterator in (this.SelectAPTran(Session.CompanyID, TmpElec.HeadNum)))
                {
                    APTran = APTran_iterator;
                    if (!String.IsNullOrEmpty(APTran.InvoiceNum) && TotalInvoice < 35)
                    {
                        if (TotalInvoice == 0)
                        {
                            TotalInvoice  = TotalInvoice + 1;
                            Description_1 = GlobalStrings.Ref(APTran.InvoiceNum);
                        }
                        else if (Description_1.Length + APTran.InvoiceNum.Length <= 35)
                        {
                            TotalInvoice  = TotalInvoice + 1;
                            Description_1 = Description_1 + APTran.InvoiceNum + " ";
                        }
                        else
                        {
                            TotalInvoice  = 99;
                            Description_1 = "";
                            break;
                        }
                    }
                }

                SAmount = this.cnvAmount(IsoCurrencySymbol, Compatibility.Convert.ToString((TmpElec.DocCheckAmt * 100), "999999999999999"), 14);
                /* 21: batch payment record part 1 */
//zzz
                OutFileLineRow = new SFCommon.OutFileLine();
                SFCommon.ttOutFileLineRows.Add(OutFileLineRow);

                line_out = ((lineLen > 0) ? " ".PadRight(lineLen + " ".Length, ' ') : null);
                /*  1 */
                line_out = ErpUtilities.Overlay(line_out, 0, Compatibility.Convert.ToString(lineLevel), 2);
                /*  2 */
                line_out = ErpUtilities.Overlay(line_out, 2, PaymentNumber, 4);
                /*  3 */
                line_out = ErpUtilities.Overlay(line_out, 6, BankCurrencySymbol, 3);
                /*  4 */
                line_out = ErpUtilities.Overlay(line_out, 9, Selfbanknumber, 10);
                /*  5 */
                line_out = ErpUtilities.Overlay(line_out, 19, IsoCurrencySymbol, 3);
                /*  6 */
                line_out = ErpUtilities.Overlay(line_out, 22, SAmount, 15);
                //testing: line_out = ErpUtilities.Overlay(line_out, 22, "12345", 15);
                /*  7 */
                line_out = ErpUtilities.Overlay(line_out, 37, Compatibility.Convert.ToString(((DateTime)CurCheckDate).Year, "9999") + Compatibility.Convert.ToString(((DateTime)CurCheckDate).Month, "99") + Compatibility.Convert.ToString(((DateTime)CurCheckDate).Day, "99"), 8);
                /*  8 */
                line_out = ErpUtilities.Overlay(line_out, 45, "1", 1);         /* Standard for euro transfer */
                /*  9 */
                line_out = ErpUtilities.Overlay(line_out, 46, TransferCost, 1);
                /* 10 */
                line_out = ErpUtilities.Overlay(line_out, 47, "0", 1);         /* banktransfer */
                /* 11 */
                line_out = ErpUtilities.Overlay(line_out, 48, "0", 1);         /* Swift normal speed */
                /* 12 */
                line_out = ErpUtilities.Overlay(line_out, 49, " ", 1);         /* not allowed for euro transfer */
                /* 13 */
                line_out = ErpUtilities.Overlay(line_out, 50, " ", 1);         /* not allowed for euro transfer */
                /* 14 */
                line_out = ErpUtilities.Overlay(line_out, 51, "  ", 2);        /* not allowed for euro transfer */
                /* 15 */
                line_out = ErpUtilities.Overlay(line_out, 53, "  ", 2);        /* not allowed for euro transfer */
                /* 16 */
                line_out = ErpUtilities.Overlay(line_out, 55, "  ", 2);        /* not allowed for euro transfer */
                /* 17 */
                line_out = ErpUtilities.Overlay(line_out, 57, "  ", 2);        /* not allowed for euro transfer */
                /* 18 */
                line_out = ErpUtilities.Overlay(line_out, 59, "1", 1);
                /* 19 */
                /* not required */
                /* 20 */
                /* not required */
                /* 21 */
                /* not required */
                /* 22 */
                /* not required */
                /* 23 */
                /* not required */
                /* 24 */
                /* not required */
                TotalRecords            = TotalRecords + 1;
                lineLevel               = lineLevel + 1;
                OutFileLineRow.Line_out = line_out;
                OutFileLineRow.HeadNum  = TmpElec.HeadNum;
                /* 22: batch payment record part 2 */
                OutFileLineRow = new SFCommon.OutFileLine();
                SFCommon.ttOutFileLineRows.Add(OutFileLineRow);
                line_out = ((lineLen > 0) ? " ".PadRight(lineLen + " ".Length, ' ') : null);
                /*  1 */
                line_out = ErpUtilities.Overlay(line_out, 0, Compatibility.Convert.ToString(lineLevel), 2);
                /*  2 */
                line_out = ErpUtilities.Overlay(line_out, 2, PaymentNumber, 4);
                /*  3 */
                line_out = ErpUtilities.Overlay(line_out, 6, TmpElec.VendorBankAcctNumber, 34);
                /*  4 */
                line_out = ErpUtilities.Overlay(line_out, 40, ((TmpElec.VendorBankNameOnAccount.Trim().Length > 0) ? TmpElec.VendorBankNameOnAccount : TmpElec.VendorName), 35);
                /*  5 */
                line_out = ErpUtilities.Overlay(line_out, 75, TmpElec.VendorAddress1, 35);
                /*  6 */
                line_out = ErpUtilities.Overlay(line_out, 110, TmpElec.VendorCity, 35);
                /*  7 */
                line_out = ErpUtilities.Overlay(line_out, 145, VendorISOCountryCode, 2);
                /*  8 */
                line_out                = ErpUtilities.Overlay(line_out, 147, TmpElec.VendorCountry, 35);
                TotalRecords            = TotalRecords + 1;
                lineLevel               = lineLevel + 1;
                OutFileLineRow.Line_out = line_out;
                if ((VendorBankISOCountryCode.Compare("NL") == 0 || String.IsNullOrEmpty(VendorBankISOCountryCode)))
                {
                    if (String.IsNullOrEmpty(VendorBankSWIFTAddress))
                    {
                        throw new BLException(GlobalStrings.TheSWIFTAddressOfTheBankOfTheSupplIsRequi(TmpElec.VendorName));
                    }
                    if (String.IsNullOrEmpty(TmpElec.VendorBankName))
                    {
                        throw new BLException(GlobalStrings.TheNameOfTheBankOfTheSupplIsRequi(TmpElec.VendorName));
                    }
                    if (String.IsNullOrEmpty(TmpElec.VendorBankCity))
                    {
                        throw new BLException(GlobalStrings.TheCityOfTheBankOfSupplIsRequi(TmpElec.VendorName));
                    }
                }
                /* 23: batch payment record part 3 */
                OutFileLineRow = new SFCommon.OutFileLine();
                SFCommon.ttOutFileLineRows.Add(OutFileLineRow);
                line_out = ((lineLen > 0) ? " ".PadRight(lineLen + " ".Length, ' ') : null);
                /*  1 */
                line_out = ErpUtilities.Overlay(line_out, 0, Compatibility.Convert.ToString(lineLevel), 2);
                /*  2 */
                line_out = ErpUtilities.Overlay(line_out, 2, PaymentNumber, 4);
                /*  3 */
                line_out = ErpUtilities.Overlay(line_out, 6, VendorBankSWIFTAddress, 11);
                /*  4 */
                line_out = ErpUtilities.Overlay(line_out, 17, TmpElec.VendorBankName, 35);
                /*  5 */
                line_out = ErpUtilities.Overlay(line_out, 52, TmpElec.VendorBankAddress1, 35);
                /*  6 */
                line_out = ErpUtilities.Overlay(line_out, 87, TmpElec.VendorBankCity, 35);
                /*  7 */
                line_out = ErpUtilities.Overlay(line_out, 122, VendorBankISOCountryCode, 2);
                /*  8 */
                line_out                = ErpUtilities.Overlay(line_out, 124, TmpElec.VendorBankCountry, 35);
                TotalRecords            = TotalRecords + 1;
                lineLevel               = lineLevel + 1;
                OutFileLineRow.Line_out = line_out;
                /* 24: batch payment record part 4 */
                OutFileLineRow = new SFCommon.OutFileLine();
                SFCommon.ttOutFileLineRows.Add(OutFileLineRow);
                line_out = ((lineLen > 0) ? " ".PadRight(lineLen + " ".Length, ' ') : null);
                /*  1 */
                line_out = ErpUtilities.Overlay(line_out, 0, Compatibility.Convert.ToString(lineLevel), 2);
                /*  2 */
                line_out = ErpUtilities.Overlay(line_out, 2, PaymentNumber, 4);
                /*  3 */
                line_out = ErpUtilities.Overlay(line_out, 6, Description_1, 35);
                /*  4 */
                /* not allowed for euro transfer */
                /*  5 */
                /* not allowed for euro transfer */
                /*  6 */
                /* not allowed for euro transfer */
                TotalRecords            = TotalRecords + 1;
                lineLevel               = lineLevel + 1;
                OutFileLineRow.Line_out = line_out;

                #region >>===== ABL Source ================================>>
                //
                //find TmpCurrTotal where TmpCurrTotal.ISOCurrencyCode = IsoCurrencySymbol exclusive-lock no-error;
                //
                #endregion == ABL Source =================================<<

                ttTmpCurrTotal = (from TmpCurrTotal_Row in ttTmpCurrTotalRows
                                  where TmpCurrTotal_Row.ISOCurrencyCode.Compare(IsoCurrencySymbol) == 0
                                  select TmpCurrTotal_Row).FirstOrDefault();
                if (ttTmpCurrTotal == null)
                {
                    ttTmpCurrTotal = new TmpCurrTotal();
                    ttTmpCurrTotalRows.Add(ttTmpCurrTotal);
                    ttTmpCurrTotal.ISOCurrencyCode = IsoCurrencySymbol;
                    ttTmpCurrTotal.TotalAmount     = TmpElec.DocCheckAmt;
                    ttTmpCurrTotal.TotalPayments   = 1;
                }
                else
                {
                    ttTmpCurrTotal.TotalAmount   = ttTmpCurrTotal.TotalAmount + TmpElec.DocCheckAmt;
                    ttTmpCurrTotal.TotalPayments = ttTmpCurrTotal.TotalPayments + 1;
                }
            }/* for each TmpElec... */

            lineLevel = 31;

            #region >>===== ABL Source ================================>>
            //
            //for each TmpCurrTotal:
            //
            //
            //
            #endregion == ABL Source =================================<<

            foreach (var ttTmpCurrTotal in ttTmpCurrTotalRows)
            {
                TAmount = this.cnvAmount(ttTmpCurrTotal.ISOCurrencyCode, Compatibility.Convert.ToString((ttTmpCurrTotal.TotalAmount * 100), "999999999999999"), 14);
                /* 31: batch currency total record  */
                OutFileLineRow = new SFCommon.OutFileLine();
                SFCommon.ttOutFileLineRows.Add(OutFileLineRow);
                line_out = ((lineLen > 0) ? " ".PadRight(lineLen + " ".Length, ' ') : null);
                /*  1 */
                line_out = ErpUtilities.Overlay(line_out, 0, Compatibility.Convert.ToString(lineLevel), 2);
                /*  2 */
                line_out = ErpUtilities.Overlay(line_out, 2, ttTmpCurrTotal.ISOCurrencyCode, 3);
                /*  3 */
                line_out = ErpUtilities.Overlay(line_out, 5, TAmount, 15);
                /*  4 */
                line_out                = ErpUtilities.Overlay(line_out, 20, Compatibility.Convert.ToString(ttTmpCurrTotal.TotalPayments, "9999"), 4);
                TotalRecords            = TotalRecords + 1;
                lineLevel               = lineLevel + 1;
                OutFileLineRow.Line_out = line_out;
            }

            /* 41: Batch Closing record */
            lineLevel = 41;

            /* This code adds information from the specified payment method into a document.
             * The document will have the structure like this:
             *
             *  1 line of file information
             *  1 batches consisting of
             *    x payments consisting of
             *        4 payment transaction records
             *    y currency total records
             *  1 line of payment method information
             *  1 line of file closing information.
             *
             * SCR 40680  - uncomment the string below if you want insert payment method information  */
            /*
             * create OutFileLine.
             * {ei/SoftFormat.i &TableName        = PayMethodProp
             *               &EFTHeadUID       = EFTHeadUID
             *               &LineOut          = OutFileLine.Line-out
             *               &LineLen          = lineLen
             *               &LineLevel        = lineLevel
             *               &LineLevelFormat  = lineLevelFormat
             *               &TotalRecords     = TotalRecords}
             */
            OutFileLineRow = new SFCommon.OutFileLine();
            SFCommon.ttOutFileLineRows.Add(OutFileLineRow);
            line_out = ((lineLen > 0) ? " ".PadRight(lineLen + " ".Length, ' ') : null);
            /*  1 */
            line_out = ErpUtilities.Overlay(line_out, 0, Compatibility.Convert.ToString(lineLevel), 2);
            /*  2 */
            line_out = ErpUtilities.Overlay(line_out, 2, Compatibility.Convert.ToString(TotalRecords + 1, "999999"), 6);
            /*  3 */
            line_out = ErpUtilities.Overlay(line_out, 8, Compatibility.Convert.ToString(TotalOrders, "9999"), 4);
            OutFileLineRow.Line_out = line_out;
        }