Beispiel #1
0
    public bool checkIfPaymentReceivedForBill(string bill_number, ref ArrayList print_id)
    {
        bool return_val = false;

        SQL  = "select print_id from check_detail where elt_account_number =";
        SQL += elt_account_number + " and bill_number="
               + bill_number;

        DataTable         dt    = new DataTable();
        SqlDataAdapter    ad    = new SqlDataAdapter(SQL, Con);
        CheckDetailRecord cDRec = new CheckDetailRecord();
        GeneralUtility    gUtil = new GeneralUtility();

        ad.Fill(dt);

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            try
            {
                print_id.Add(Int32.Parse(dt.Rows[i][""].ToString()));
                return_val = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        return(return_val);
    }
Beispiel #2
0
    public ArrayList getcheckDetailForInvoice(int invoice_no)
    {
        SQL = "select '../enter_bill.aspx?view=yes&bill_number='+convert( NVARCHAR(10),bill_number) as url,  print_id, tran_id, bill_number, due_date,  bill_amt, amt_due, amt_paid, memo, pmt_method, check_no, isnull(invoice_no,'0') as invoice_no from check_detail where elt_account_number = " + elt_account_number + " and invoice_no=" + invoice_no;
        DataTable         dt    = new DataTable();
        SqlDataAdapter    ad    = new SqlDataAdapter(SQL, Con);
        CheckDetailRecord cDRec = new CheckDetailRecord();
        GeneralUtility    gUtil = new GeneralUtility();
        ArrayList         list  = new ArrayList();

        try
        {
            gUtil.removeNull(ref dt);
            cDRec.amt_due     = Decimal.Parse(dt.Rows[0]["amt_due"].ToString());
            cDRec.amt_paid    = Decimal.Parse(dt.Rows[0]["amt_paid"].ToString());
            cDRec.bill_amt    = Decimal.Parse(dt.Rows[0]["bill_amt"].ToString());
            cDRec.bill_number = Int32.Parse((dt.Rows[0]["bill_number"].ToString()));
            cDRec.due_date    = DateTime.Parse(dt.Rows[0]["due_date"].ToString()).ToShortDateString();
            if (dt.Rows[0]["invoice_no"].ToString() == "")
            {
                dt.Rows[0]["invoice_no"] = "0";
            }
            cDRec.invoice_no = Int32.Parse(dt.Rows[0]["invoice_no"].ToString());
            cDRec.memo       = dt.Rows[0]["memo"].ToString();
            cDRec.pmt_method = dt.Rows[0]["pmt_method"].ToString();
            cDRec.print_id   = Int32.Parse((dt.Rows[0]["print_id"].ToString()));
            cDRec.tran_id    = Int32.Parse((dt.Rows[0]["tran_id"].ToString()));
            list.Add(cDRec);
        }
        catch (Exception ex)
        {
            throw ex;
        }
        return(list);
    }
Beispiel #3
0
    public bool checkExistCheckDetail(CheckDetailRecord cdRec, ref SqlCommand Cmd)
    {
        SQL  = "select tran_id from check_detail where elt_account_number =";
        SQL += elt_account_number + " and tran_id="
               + cdRec.tran_id + " and print_id="
               + cdRec.print_id;
        Cmd.CommandText = SQL;
        int rowCount = 0;

        try
        {
            rowCount = Cmd.ExecuteNonQuery();
        }
        catch (Exception ex)
        {
            throw ex;
        }
        if (rowCount == 1)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Beispiel #4
0
    public bool insertCheckDetailList(ArrayList chkList, int printID)
    {
        bool return_val = false;

        for (int i = 0; i < chkList.Count; i++)
        {
            try
            {
                CheckDetailRecord cdRec = (CheckDetailRecord)chkList[i];
                cdRec.replaceQuote();
                cdRec.print_id = printID;
                SQL            = "INSERT INTO [check_detail] ";
                SQL           += "( elt_account_number, ";
                SQL           += "amt_due,";
                SQL           += "amt_paid,";
                SQL           += "bill_amt,";
                SQL           += "bill_number,";
                SQL           += "due_date,";
                SQL           += "invoice_no,";
                SQL           += "memo,";
                SQL           += "pmt_method,";
                SQL           += "print_id,";
                SQL           += "tran_id)";
                SQL           += "VALUES";
                SQL           += "('" + elt_account_number;
                SQL           += "','" + cdRec.amt_due;
                SQL           += "','" + cdRec.amt_paid;
                SQL           += "','" + cdRec.bill_amt;
                SQL           += "','" + cdRec.bill_number;
                SQL           += "','" + cdRec.due_date;
                SQL           += "','" + cdRec.invoice_no;
                SQL           += "','" + cdRec.memo;
                SQL           += "','" + cdRec.pmt_method;
                SQL           += "','" + printID;
                SQL           += "','" + cdRec.tran_id;
                SQL           += "')";
                Cmd            = new SqlCommand(SQL, Con);
                Con.Open();
                Cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                Con.Close();
            }
            return_val = true;
        }
        return(return_val);
    }
Beispiel #5
0
    public DataTable getcheckDetailForPrintIdDt(int print_id)
    {
        SQL = "select '../enter_bill.aspx?view=yes&bill_number='+convert( NVARCHAR(10),bill_number) as url,   print_id, tran_id, bill_number, due_date,  bill_amt, amt_due, amt_paid, memo, pmt_method,  isnull(invoice_no,'0') as invoice_no from check_detail where elt_account_number = " + elt_account_number + " and print_id=" + print_id;
        DataTable         dt    = new DataTable();
        SqlDataAdapter    ad    = new SqlDataAdapter(SQL, Con);
        CheckDetailRecord cDRec = new CheckDetailRecord();
        GeneralUtility    gUtil = new GeneralUtility();

        ad.Fill(dt);
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            if (dt.Rows[0]["invoice_no"].ToString() == "")
            {
                dt.Rows[0]["invoice_no"] = "0";
            }
        }
        return(dt);
    }
Beispiel #6
0
        public X9_DepositItem(int seqNum, Image image = null, string imageLocation = "")
        {
            checkDetail            = new CheckDetailRecord();
            imageViewDataBack      = new ImageViewDataRecord();
            imageViewDataFront     = new ImageViewDataRecord();
            imageViewDetailBack    = new ImageViewDetailRecord();
            imageViewDetailFront   = new ImageViewDetailRecord();
            imageViewAnalysisBack  = new ImageViewAnalysisRecord();
            imageViewAnalysisFront = new ImageViewAnalysisRecord();
            records = new List <Record>();
            imageViewDataFront.ImageData = image;
            imageViewDataBack.ImageData  = image;
            checkImageLocation           = imageLocation;

            checkDetail = new CheckDetailRecord("044000037", "", "", "0", seqNum.ToString());
            //FRONT OF CHECK
            imageViewDetailFront = new ImageViewDetailRecord('0', DateTime.Now);
            imageViewDataFront   = new ImageViewDataRecord(seqNum.ToString(), image, imageLocation);
            //BACK OF CHECK
            imageViewDetailBack = new ImageViewDetailRecord('0', DateTime.Now);
            imageViewDataBack   = new ImageViewDataRecord(seqNum.ToString(), image, imageLocation);
            addRecords();
        }
Beispiel #7
0
    public bool enqueuePayment(CheckQueueRecord Check, string tran_type)
    {
        Check.replaceQuote();
        bool      return_val   = false;
        ArrayList AAJEntryList = Check.All_accounts_journal_entry_list;
        int       printID      = getNextPrintID();

        Check.print_id = printID;
        for (int i = 0; i < AAJEntryList.Count; i++)
        {
            this.aajMgr.checkInitial_Acct_Record((AllAccountsJournalRecord)AAJEntryList[i]);
        }

        Cmd            = new SqlCommand();
        Cmd.Connection = Con;
        Con.Open();
        SqlTransaction trans = Con.BeginTransaction();

        Cmd.Transaction = trans;

        try
        {
            //UPDATE LIST OF BILLS TO SET THE CHANGES MADE BY PAYMENT
            ArrayList bRecList = Check.BillList;
            for (int i = 0; i < bRecList.Count; i++)
            {
                BillRecord bRec = (BillRecord)bRecList[i];
                SQL             = "update [bill] set ";
                SQL            += "elt_account_number='" + elt_account_number + "'";
                SQL            += ",bill_number='" + bRec.Bill_number + "'";
                SQL            += ",bill_type='" + bRec.Bill_type + "'";
                SQL            += ",vendor_number='" + bRec.Vendor_number + "'";
                SQL            += ",vendor_name='" + bRec.Vendor_name + "'";
                SQL            += ",bill_date='" + bRec.Bill_date + "'";
                SQL            += ",bill_due_date='" + bRec.Bill_due_date + "'";
                SQL            += ",bill_amt='" + bRec.Bill_amt + "'";
                SQL            += ",bill_amt_paid='" + bRec.Bill_amt_paid + "'";
                SQL            += ",bill_amt_due='" + bRec.Bill_amt_due + "'";
                SQL            += ",ref_no='" + bRec.Bill_amt_paid + "'";
                SQL            += ",bill_expense_acct='" + bRec.Bill_expense_acct + "'";
                SQL            += ",bill_ap='" + bRec.Bill_ap + "'";
                SQL            += ",bill_status='" + bRec.Bill_status + "'";
                SQL            += ",print_id='" + printID + "'";
                SQL            += ",lock='" + bRec.Lock + "'";
                SQL            += ",pmt_method='" + bRec.Pmt_method + "'";
                SQL            += " WHERE elt_account_number = " + elt_account_number + " and bill_number=" + bRec.Bill_number;
                Cmd.CommandText = SQL;
                Cmd.ExecuteNonQuery();
            }
            //INSERT CHECK DETAIL LIST
            ArrayList chkList = Check.CheckDetailList;

            for (int i = 0; i < chkList.Count; i++)
            {
                CheckDetailRecord cdRec = (CheckDetailRecord)chkList[i];
                cdRec.replaceQuote();
                cdRec.print_id  = printID;
                SQL             = "INSERT INTO [check_detail] ";
                SQL            += "( elt_account_number, ";
                SQL            += "amt_due,";
                SQL            += "amt_paid,";
                SQL            += "bill_amt,";
                SQL            += "bill_number,";
                SQL            += "due_date,";
                SQL            += "invoice_no,";
                SQL            += "memo,";
                SQL            += "pmt_method,";
                SQL            += "print_id,";
                SQL            += "tran_id)";
                SQL            += "VALUES";
                SQL            += "('" + elt_account_number;
                SQL            += "','" + cdRec.amt_due;
                SQL            += "','" + cdRec.amt_paid;
                SQL            += "','" + cdRec.bill_amt;
                SQL            += "','" + cdRec.bill_number;
                SQL            += "','" + cdRec.due_date;
                SQL            += "','" + cdRec.invoice_no;
                SQL            += "','" + cdRec.memo;
                SQL            += "','" + cdRec.pmt_method;
                SQL            += "','" + printID;
                SQL            += "','" + cdRec.tran_id;
                SQL            += "')";
                Cmd.CommandText = SQL;
                Cmd.ExecuteNonQuery();
            }
            //INSERT AAJ ENTRIES

            int tran_seq_id = 0;

            SQL = "select max(tran_seq_num) from all_accounts_journal where elt_account_number = "
                  + elt_account_number;
            Cmd.CommandText = SQL;
            int current = 0;

            string id_str = Cmd.ExecuteScalar().ToString();
            if (id_str != "")
            {
                current = Int32.Parse(id_str);
            }
            else
            {
                current = 0;
            }

            tran_seq_id = current + 1;

            for (int i = 0; i < AAJEntryList.Count; i++)
            {
                ((AllAccountsJournalRecord)AAJEntryList[i]).replaceQuote();
                ((AllAccountsJournalRecord)AAJEntryList[i]).tran_num = printID;
                SQL             = "INSERT INTO [all_accounts_journal] ";
                SQL            += "( elt_account_number, ";
                SQL            += "tran_num,";
                SQL            += "gl_account_number,";
                SQL            += "gl_account_name,";
                SQL            += "tran_seq_num,";
                SQL            += "tran_type,";
                SQL            += "tran_date,";
                SQL            += "Customer_Number,";
                SQL            += "Customer_Name,";
                SQL            += "debit_amount,";
                SQL            += "credit_amount,";
                SQL            += "balance,";
                SQL            += "previous_balance,";
                SQL            += "gl_balance,";
                SQL            += "gl_previous_balance)";
                SQL            += "VALUES";
                SQL            += "('" + elt_account_number;
                SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).tran_num;
                SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).gl_account_number;
                SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).gl_account_name;
                SQL            += "','" + tran_seq_id++;
                SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).tran_type;
                SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).tran_date;
                SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).customer_number;
                SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).customer_name;
                SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).debit_amount;
                SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).credit_amount;
                SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).balance;
                SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).previous_balance;
                SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).gl_balance;
                SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).gl_previous_balance;
                SQL            += "')";
                Cmd.CommandText = SQL;
                Cmd.ExecuteNonQuery();
            }
            string check_type = "";
            if (tran_type == "BP-CHK")//ONLY AT BILL PAY
            {
                check_type = "C";
            }
            else
            {
                check_type = "BP";
            }

            SQL  = "INSERT INTO [check_queue] ";
            SQL += "(elt_account_number,";
            SQL += "ap,";
            SQL += "bank,";
            SQL += "bill_date,";
            SQL += "bill_due_date,";
            SQL += "check_amt,";
            SQL += "check_type,";
            SQL += "memo,";
            SQL += "pmt_method,";
            SQL += "print_check_as,";
            SQL += "print_date,";
            SQL += "print_id,";
            SQL += "print_status,";
            SQL += "vendor_info,";
            SQL += "vendor_name,";
            if (Check.check_no != 0)
            {
                SQL += "check_no,";
            }
            SQL += "vendor_number)";
            SQL += "VALUES";
            SQL += "('" + elt_account_number;
            SQL += "','" + Check.ap;
            SQL += "','" + Check.bank;
            SQL += "','" + Check.bill_date;
            SQL += "','" + Check.bill_due_date;
            SQL += "','" + Check.check_amt;
            SQL += "','" + check_type;
            SQL += "','" + Check.memo;
            SQL += "','" + Check.pmt_method;
            SQL += "','" + Check.print_check_as;
            SQL += "','" + Check.print_date;
            SQL += "','" + Check.print_id;
            SQL += "','" + Check.print_status;
            SQL += "','" + Check.vendor_info;
            SQL += "','" + Check.vendor_name;
            if (Check.check_no != 0)
            {
                SQL += "','" + Check.check_no;
            }
            SQL            += "','" + Check.vendor_number;
            SQL            += "')";
            Cmd.CommandText = SQL;
            Cmd.ExecuteNonQuery();
            trans.Commit();
            return_val = true;
        }
        catch (Exception ex)
        {
            trans.Rollback();
            throw ex;
        }
        finally
        {
            Con.Close();
        }
        if (Check.check_no != 0)
        {
            GLManager glmgr = new GLManager(elt_account_number);
            try
            {
                glmgr.updateNextCheckNumber(Check.bank, Check.check_no);
            }
            catch (Exception ex2)
            {
                throw ex2;
            }
        }
        return(return_val);
    }
Beispiel #8
0
    public bool updateCheck(CheckQueueRecord Check, string tran_type)
    {
        bool return_val = false;

        Check.replaceQuote();
        BillManager bMgr = new BillManager(elt_account_number);

        ArrayList AAJEntryList = Check.All_accounts_journal_entry_list;
        int       printID      = Check.print_id;


        BillRecord bRec = (BillRecord)Check.BillList[0];

        if (bMgr.updateBillRecord(ref bRec, "CHK"))
        {
            for (int i = 0; i < AAJEntryList.Count; i++)
            {
                if (((AllAccountsJournalRecord)AAJEntryList[i]).gl_account_number != -1 && ((AllAccountsJournalRecord)AAJEntryList[i]).gl_account_number != 0)
                {
                    this.aajMgr.checkInitial_Acct_Record((AllAccountsJournalRecord)AAJEntryList[i]);
                }
            }

            int tran_seq_id = this.aajMgr.getNextTranSeqNumber();


            Cmd            = new SqlCommand();
            Cmd.Connection = Con;
            Con.Open();
            SqlTransaction trans = Con.BeginTransaction();
            Cmd.Transaction = trans;

            try
            {
                //DELETE PREVIOUS CHECK_DETAIL LIST

                SQL             = "DELETE FROM check_detail where elt_account_number =" + elt_account_number + " and print_id=" + printID;
                Cmd.CommandText = SQL;
                Cmd.ExecuteNonQuery();

                //DELETE ALL_ACCOUNTS_JOURNAL ENTRY

                SQL             = "DELETE FROM all_accounts_journal where elt_account_number =" + elt_account_number + " and tran_num=" + printID + " and tran_type='" + tran_type + "'";
                Cmd.CommandText = SQL;
                Cmd.ExecuteNonQuery();

                //INSERT CHECK_DETAL LIST
                ArrayList chkList = Check.CheckDetailList;
                for (int i = 0; i < chkList.Count; i++)
                {
                    CheckDetailRecord cdRec = (CheckDetailRecord)chkList[i];
                    cdRec.replaceQuote();
                    cdRec.print_id = printID;
                    SQL            = "INSERT INTO [check_detail] ";
                    SQL           += "( elt_account_number, ";
                    SQL           += "amt_due,";
                    SQL           += "amt_paid,";
                    SQL           += "bill_amt,";
                    SQL           += "bill_number,";
                    SQL           += "due_date,";
                    SQL           += "invoice_no,";
                    SQL           += "memo,";
                    SQL           += "pmt_method,";
                    SQL           += "print_id,";
                    SQL           += "tran_id)";
                    SQL           += "VALUES";
                    SQL           += "('" + elt_account_number;
                    SQL           += "','" + cdRec.amt_due;
                    SQL           += "','" + cdRec.amt_paid;
                    SQL           += "','" + cdRec.bill_amt;
                    SQL           += "','" + cdRec.bill_number;
                    SQL           += "','" + cdRec.due_date;

                    SQL            += "','" + cdRec.invoice_no;
                    SQL            += "','" + cdRec.memo;
                    SQL            += "','" + cdRec.pmt_method;
                    SQL            += "','" + printID;
                    SQL            += "','" + cdRec.tran_id;
                    SQL            += "')";
                    Cmd.CommandText = SQL;
                    Cmd.ExecuteNonQuery();
                }
                //INSERT AAJ ENTRIES
                for (int i = 0; i < AAJEntryList.Count; i++)
                {
                    if (((AllAccountsJournalRecord)AAJEntryList[i]).gl_account_number != -1 && ((AllAccountsJournalRecord)AAJEntryList[i]).gl_account_number != 0)
                    {
                        ((AllAccountsJournalRecord)AAJEntryList[i]).replaceQuote();
                        ((AllAccountsJournalRecord)AAJEntryList[i]).tran_num = printID;
                        SQL             = "INSERT INTO [all_accounts_journal] ";
                        SQL            += "( elt_account_number, ";
                        SQL            += "tran_num,";
                        SQL            += "gl_account_number,";
                        SQL            += "gl_account_name,";
                        SQL            += "tran_seq_num,";
                        SQL            += "tran_type,";
                        SQL            += "tran_date,";
                        SQL            += "Customer_Number,";
                        SQL            += "Customer_Name,";
                        SQL            += "debit_amount,";
                        SQL            += "credit_amount,";
                        SQL            += "balance,";
                        SQL            += "previous_balance,";
                        SQL            += "gl_balance,";
                        SQL            += "gl_previous_balance)";
                        SQL            += "VALUES";
                        SQL            += "('" + elt_account_number;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).tran_num;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).gl_account_number;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).gl_account_name;
                        SQL            += "','" + tran_seq_id++;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).tran_type;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).tran_date;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).customer_number;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).customer_name;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).debit_amount;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).credit_amount;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).balance;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).previous_balance;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).gl_balance;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).gl_previous_balance;
                        SQL            += "')";
                        Cmd.CommandText = SQL;
                        Cmd.ExecuteNonQuery();
                    }
                }
                //UPDATE THE CHECK

                string check_type = "";
                if (tran_type == "CHK" || tran_type == "CSH" || tran_type == "CRC" || tran_type == "BTB")
                {
                    check_type = "C";
                }
                else
                {
                    check_type = "BP";
                }

                SQL  = "UPDATE [check_queue] ";
                SQL += "Set elt_account_number='" + elt_account_number + "',";
                SQL += "ap='" + Check.ap + "',";
                SQL += "bank='" + Check.bank + "',";
                SQL += "bill_date='" + Check.bill_date + "',";
                SQL += "bill_due_date='" + Check.bill_due_date + "',";
                SQL += "check_amt='" + Check.check_amt + "',";
                SQL += "check_type='" + check_type + "',";
                SQL += "memo='" + Check.memo + "',";
                SQL += "pmt_method='" + Check.pmt_method + "',";
                SQL += "print_check_as='" + Check.print_check_as + "',";
                SQL += "print_date='" + Check.print_date + "',";
                SQL += "print_id='" + Check.print_id + "',";
                SQL += "print_status='" + Check.print_status + "',";
                SQL += "vendor_info='" + Check.vendor_info + "',";
                SQL += "vendor_name='" + Check.vendor_name + "',";
                SQL += "vendor_number='" + Check.vendor_number + "'";
                SQL += "where elt_account_number =" + elt_account_number
                       + " and print_id=" + printID;

                Cmd.CommandText = SQL;
                Cmd.ExecuteNonQuery();
                trans.Commit();
                return_val = true;
            }
            catch (Exception ex)
            {
                trans.Rollback();
                throw ex;
            }
            finally
            {
                Con.Close();
            }
        }
        return(return_val);
    }
Beispiel #9
0
    public bool enqueueCheck(CheckQueueRecord Check, string tran_type)
    {
        bool return_val = false;

        Check.replaceQuote();
        BillManager bMgr = new BillManager(elt_account_number);

        ArrayList AAJEntryList = Check.All_accounts_journal_entry_list;
        int       printID      = getNextPrintID();

        Check.print_id = printID;

        BillRecord bRec = (BillRecord)Check.BillList[0];

        bRec.Print_id = printID;
        if (bMgr.insertBillRecord(ref bRec, "CHK"))
        {
            for (int i = 0; i < AAJEntryList.Count; i++)
            {
                if (((AllAccountsJournalRecord)AAJEntryList[i]).gl_account_number != -1 && ((AllAccountsJournalRecord)AAJEntryList[i]).gl_account_number != 0)
                {
                    this.aajMgr.checkInitial_Acct_Record((AllAccountsJournalRecord)AAJEntryList[i]);
                }
            }

            int tran_seq_id = this.aajMgr.getNextTranSeqNumber();

            //INSERT CHECK_DETAL LIST
            Cmd            = new SqlCommand();
            Cmd.Connection = Con;
            Con.Open();
            SqlTransaction trans = Con.BeginTransaction();
            Cmd.Transaction = trans;

            try
            {
                ArrayList chkList = Check.CheckDetailList;
                for (int i = 0; i < chkList.Count; i++)
                {
                    CheckDetailRecord cdRec = (CheckDetailRecord)chkList[i];
                    cdRec.replaceQuote();
                    cdRec.print_id = printID;
                    SQL            = "INSERT INTO [check_detail] ";
                    SQL           += "( elt_account_number, ";
                    SQL           += "amt_due,";
                    SQL           += "amt_paid,";
                    SQL           += "bill_amt,";
                    SQL           += "bill_number,";
                    SQL           += "due_date,";
                    SQL           += "invoice_no,";
                    SQL           += "memo,";
                    SQL           += "pmt_method,";
                    SQL           += "print_id,";
                    SQL           += "tran_id)";
                    SQL           += "VALUES";
                    SQL           += "('" + elt_account_number;
                    SQL           += "','" + cdRec.amt_due;
                    SQL           += "','" + cdRec.amt_paid;
                    SQL           += "','" + cdRec.bill_amt;
                    SQL           += "','" + cdRec.bill_number;
                    SQL           += "','" + cdRec.due_date;

                    SQL            += "','" + cdRec.invoice_no;
                    SQL            += "','" + cdRec.memo;
                    SQL            += "','" + cdRec.pmt_method;
                    SQL            += "','" + printID;
                    SQL            += "','" + cdRec.tran_id;
                    SQL            += "')";
                    Cmd.CommandText = SQL;
                    Cmd.ExecuteNonQuery();
                }
                //INSERT AAJ ENTRIES
                for (int i = 0; i < AAJEntryList.Count; i++)
                {
                    if (((AllAccountsJournalRecord)AAJEntryList[i]).gl_account_number != -1 && ((AllAccountsJournalRecord)AAJEntryList[i]).gl_account_number != 0)
                    {
                        ((AllAccountsJournalRecord)AAJEntryList[i]).replaceQuote();
                        ((AllAccountsJournalRecord)AAJEntryList[i]).tran_num = printID;
                        SQL             = "INSERT INTO [all_accounts_journal] ";
                        SQL            += "( elt_account_number, ";
                        SQL            += "tran_num,";
                        SQL            += "gl_account_number,";
                        SQL            += "gl_account_name,";
                        SQL            += "tran_seq_num,";
                        SQL            += "tran_type,";
                        SQL            += "tran_date,";
                        SQL            += "Customer_Number,";
                        SQL            += "Customer_Name,";
                        SQL            += "debit_amount,";
                        SQL            += "credit_amount,";
                        SQL            += "balance,";
                        SQL            += "previous_balance,";
                        SQL            += "gl_balance,";
                        SQL            += "gl_previous_balance)";
                        SQL            += "VALUES";
                        SQL            += "('" + elt_account_number;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).tran_num;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).gl_account_number;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).gl_account_name;
                        SQL            += "','" + tran_seq_id++;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).tran_type;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).tran_date;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).customer_number;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).customer_name;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).debit_amount;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).credit_amount;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).balance;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).previous_balance;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).gl_balance;
                        SQL            += "','" + ((AllAccountsJournalRecord)AAJEntryList[i]).gl_previous_balance;
                        SQL            += "')";
                        Cmd.CommandText = SQL;
                        Cmd.ExecuteNonQuery();
                    }
                }
                //INSERT A CHECK

                string check_type = "";
                if (tran_type == "CHK" || tran_type == "CSH" || tran_type == "CRC" || tran_type == "BTB")
                {
                    check_type = "C";
                }
                else
                {
                    check_type = "BP";
                }

                SQL  = "INSERT INTO [check_queue] ";
                SQL += "(elt_account_number,";
                SQL += "ap,";
                SQL += "bank,";
                SQL += "bill_date,";
                SQL += "bill_due_date,";
                SQL += "check_amt,";
                SQL += "check_type,";
                SQL += "memo,";
                SQL += "pmt_method,";
                SQL += "print_check_as,";
                SQL += "print_date,";
                SQL += "print_id,";
                SQL += "print_status,";
                SQL += "vendor_info,";
                SQL += "vendor_name,";
                if (Check.check_no != 0)
                {
                    SQL += "check_no,";
                }
                SQL += "vendor_number)";
                SQL += "VALUES";
                SQL += "('" + elt_account_number;
                SQL += "','" + Check.ap;
                SQL += "','" + Check.bank;
                SQL += "','" + Check.bill_date;
                SQL += "','" + Check.bill_due_date;
                SQL += "','" + Check.check_amt;
                SQL += "','" + check_type;
                SQL += "','" + Check.memo;
                SQL += "','" + Check.pmt_method;
                SQL += "','" + Check.print_check_as;
                SQL += "','" + Check.print_date;
                SQL += "','" + Check.print_id;
                SQL += "','" + Check.print_status;
                SQL += "','" + Check.vendor_info;
                SQL += "','" + Check.vendor_name;
                if (Check.check_no != 0)
                {
                    SQL += "','" + Check.check_no;
                }
                SQL            += "','" + Check.vendor_number;
                SQL            += "')";
                Cmd.CommandText = SQL;
                Cmd.ExecuteNonQuery();
                trans.Commit();
                return_val = true;
            }
            catch (Exception ex)
            {
                trans.Rollback();
                throw ex;
            }
            finally
            {
                Con.Close();
            }
        }
        if (Check.check_no != 0)
        {
            GLManager glmgr = new GLManager(elt_account_number);
            try
            {
                glmgr.updateNextCheckNumber(Check.bank, Check.check_no);
            }
            catch (Exception ex2)
            {
                throw ex2;
            }
        }
        return(return_val);
    }