Exemplo n.º 1
0
        private void SearchHeader_Load(object sender, EventArgs e)
        {
            if (GeneralFunctions.Ckecktag("18") != "M")
            {
                btn_Add.Visible = false;
            }
            sqlcon                 = new SqlConnection(GeneralFunctions.ConnectionString);
            adaptertbAccounts      = new SqlDataAdapter("Select * from GLAccounts WHERE AccountTypeName='Header'", sqlcon);
            adaptertbAccountTypes  = new SqlDataAdapter("Select * from GLAccountTypes", sqlcon);
            adaptertbGeneralSetup  = new SqlDataAdapter("Select * from GeneralSetup", sqlcon);
            cmdBuilderGeneralSetup = new SqlCommandBuilder(adaptertbGeneralSetup);
            adaptertbGeneralSetup.Fill(dbAccountingProjectDS.GeneralSetup);

            adaptertbAccounts.Fill(dbAccountingProjectDS.GLAccounts);
            adaptertbAccountTypes.Fill(dbAccountingProjectDS.GLAccountTypes);

            if (!GeneralFunctions.SubTypesloaded)
            {
                SqlConnection sqlcon10 = new SqlConnection(GeneralFunctions.ConnectionString);
                sqlcon10.Open();
                SqlCommand command10 = new SqlCommand("Select AccountSubType From  GeneralSetup", sqlcon10);
                SqlCommand command11 = new SqlCommand("Select FirstSub From GeneralSetup", sqlcon10);
                SqlCommand command12 = new SqlCommand("Select SecondSub From GeneralSetup", sqlcon10);
                SqlCommand command13 = new SqlCommand("Select ThirdSub From GeneralSetup", sqlcon10);
                SqlCommand command14 = new SqlCommand("Select FourthSub From GeneralSetup", sqlcon10);
                int        AccountSubTypeNumber;
                if (command10.ExecuteScalar() != DBNull.Value)
                {
                    AccountSubTypeNumber = Convert.ToInt32(command10.ExecuteScalar());
                    if (AccountSubTypeNumber == 2)
                    {
                        GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar()));
                        GeneralFunctions.SubTypesloaded = true;
                    }
                    if (AccountSubTypeNumber == 3)
                    {
                        GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar()), Convert.ToInt32(command13.ExecuteScalar()));
                        GeneralFunctions.SubTypesloaded = true;
                    }
                    if (AccountSubTypeNumber == 4)
                    {
                        GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar()), Convert.ToInt32(command13.ExecuteScalar()), Convert.ToInt32(command14.ExecuteScalar()));
                        GeneralFunctions.SubTypesloaded = true;
                    }
                }
            }
            foreach (DataRow dr in dbAccountingProjectDS.GeneralSetup.Rows)
            {
                AccountNumberFormat = dr["AccountNumberFormat"].ToString();
            }
            //txt_AccountNumber.Mask = AccountNumberFormat;// "###-####-##";
            cb_AccountType = GeneralFunctions.FillComboBox(dbAccountingProjectDS.GLAccountTypes, cb_AccountType, "AccountTypeName", "AccountTypeID");
            cb_AccountType.Items.Insert(0, "Any Type");
            cb_AccountType.Text    = "Header";
            cb_AccountType.Enabled = false;
            //foreach (DataRow dr in dbAccountingProjectDS.GeneralSetup.Rows)
            //{
            //    txt_AccountNumber1.Mask = dr["AccountNumberFormat"].ToString();
            //}
        }
Exemplo n.º 2
0
 private void FillComboBox(ComboBox cb)
 {
     if (dbAccountingProjectDS.GLCurrency.Rows.Count != 0)
     {
         foreach (DataRow dr in dbAccountingProjectDS.GLCurrency.Rows)
         {
             if (dr["Active"].ToString() == "True")
             {
                 cb.Items.Add(dr["CurrencyCode"].ToString());
             }
         }
     }
     if (GeneralFunctions.Ckecktag("15") == "M")
     {
         cb.Items.Add("<new>");
     }
     cb = GeneralFunctions.RemoveBaseCurrency(cb);
 }
Exemplo n.º 3
0
        private void ChartsOfAccounts_Load(object sender, EventArgs e)
        {
            SqlConnection newSqlConnection = new SqlConnection(GeneralFunctions.ConnectionString);

            newSqlConnection.Open();
            SqlCommand    newSqlCommand = new SqlCommand("Select CompanyName From Company", newSqlConnection);
            SqlDataReader newSqlRead    = newSqlCommand.ExecuteReader();

            if (newSqlRead.HasRows)
            {
                while (newSqlRead.Read())
                {
                    GeneralFunctions.CompanyName = newSqlRead.GetString(0);
                }
            }
            SqlConnection sqlconnect = new SqlConnection(GeneralFunctions.ConnectionString);

            sqlconnect.Open();
            SqlCommand    sqlcommand = new SqlCommand("Select AccountNumberFormat FROM GeneralSetup", sqlconnect);
            SqlDataReader sqlread    = sqlcommand.ExecuteReader();

            LENAccount = 0;
            if (sqlread.HasRows)
            {
                while (sqlread.Read())
                {
                    LENAccount = sqlread.GetString(0).Length;
                }
            }
            sqlread.Close();
            sqlconnect.Close();

            sqlcon                 = new SqlConnection(GeneralFunctions.ConnectionString);
            adaptertbAccounts      = new SqlDataAdapter("Select * from GLAccounts where AccountTypeName <> 'Header'", sqlcon);
            adaptertbAccountTypes  = new SqlDataAdapter("Select * from GLAccountTypes", sqlcon);
            adaptertbAccountsChart = new SqlDataAdapter("Select * from GLAccountsChart", sqlcon);
            adaptertbAccounts.Fill(dbAccountingProjectDS.GLAccounts);
            if (adaptertbAccountsChart != null)
            {
                adaptertbAccountsChart.Fill(dbAccountingProjectDS.GLAccountsChart);
            }
            adaptertbAccountTypes.Fill(dbAccountingProjectDS.GLAccountTypes);
            cmdBuilder = new SqlCommandBuilder(adaptertbAccountsChart);
            if (!GeneralFunctions.SubTypesloaded)
            {
                SqlConnection sqlcon10 = new SqlConnection(GeneralFunctions.ConnectionString);
                sqlcon10.Open();
                SqlCommand command10 = new SqlCommand("Select AccountSubType From  GeneralSetup", sqlcon10);
                SqlCommand command11 = new SqlCommand("Select FirstSub From GeneralSetup", sqlcon10);
                SqlCommand command12 = new SqlCommand("Select SecondSub From GeneralSetup", sqlcon10);
                SqlCommand command13 = new SqlCommand("Select ThirdSub From GeneralSetup", sqlcon10);
                SqlCommand command14 = new SqlCommand("Select FourthSub From GeneralSetup", sqlcon10);
                int        AccountSubTypeNumber;
                if (command10.ExecuteScalar() != DBNull.Value)
                {
                    AccountSubTypeNumber = Convert.ToInt32(command10.ExecuteScalar());
                    if (AccountSubTypeNumber == 2)
                    {
                        GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar()));
                        GeneralFunctions.SubTypesloaded = true;
                    }
                    if (AccountSubTypeNumber == 3)
                    {
                        GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar()), Convert.ToInt32(command13.ExecuteScalar()));
                        GeneralFunctions.SubTypesloaded = true;
                    }
                    if (AccountSubTypeNumber == 4)
                    {
                        GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar()), Convert.ToInt32(command13.ExecuteScalar()), Convert.ToInt32(command14.ExecuteScalar()));
                        GeneralFunctions.SubTypesloaded = true;
                    }
                }
            }
            cb_AccountTypeName = GeneralFunctions.FillComboBox(dbAccountingProjectDS.GLAccountTypes, cb_AccountTypeName, "AccountTypeName", "AccountTypeID");
            cb_AccountTypeName.Items.Insert(0, "Any Type");
            cb_AccountTypeName.Items.Remove("<new>");
            cb_AccountTypeName.Items.Remove("Header");
            cb_AccountTypeName.Text = "Any Type";
            LoadTreeView();
            //treeView1.ExpandAll();

            if (GeneralFunctions.languagechioce != "")
            {
                this.obj_options = new ClassOptions();
                this.obj_options.report_language = GeneralFunctions.languagechioce;
                this.update_language_interface();
            }

            if (GeneralFunctions.Ckecktag("47") == "M")
            {
                this.Menu1.Enabled = true;
            }
            else
            {
                this.Menu1.Enabled = false;
            }
            if (GeneralFunctions.Ckecktag("18") == "M")
            {
                this.btn_AddAccount.Enabled = true;
            }
            else
            {
                this.btn_AddAccount.Enabled = false;
            }
            //currcet();
        }
Exemplo n.º 4
0
        private void ApplyCreditsScreen_Load(object sender, EventArgs e)
        {
            string msg = GeneralFunctions.CheckLockTables("", "ApplyCreditsScreen", "", "Open");

            if (msg != "")
            {
                MessageBox.Show("ApplyCreditsScreen Open By " + msg, "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                btn_Save.Visible = false;
            }
            GeneralFunctions.LockTables("", "ApplyCreditsScreen", "", "Open");
            sqlcon                   = new SqlConnection(GeneralFunctions.ConnectionString);
            adaptertbAPCredits       = new SqlDataAdapter("Select * from APCredits", sqlcon);
            adaptertbBatch           = new SqlDataAdapter("Select * from Batch", sqlcon);
            adaptertbBatchInvoices   = new SqlDataAdapter("Select * from APTrans", sqlcon);
            adaptertbInvoiceAccounts = new SqlDataAdapter("Select * from APExpense", sqlcon);
            adaptertbCurrency        = new SqlDataAdapter("Select * from GLCurrency", sqlcon);

            cmdBuilder          = new SqlCommandBuilder(adaptertbBatchInvoices);
            cmdBuilderAPCredits = new SqlCommandBuilder(adaptertbAPCredits);

            adaptertbBatch.Fill(dbAccountingProjectDS.Batch);
            adaptertbAPCredits.Fill(dbAccountingProjectDS.APCredits);
            adaptertbBatchInvoices.Fill(dbAccountingProjectDS.APTrans);
            adaptertbInvoiceAccounts.Fill(dbAccountingProjectDS.APExpense);
            adaptertbCurrency.Fill(dbAccountingProjectDS.GLCurrency);
            adaptertbGeneralSetup = new SqlDataAdapter("Select * from GeneralSetup", sqlcon);
            adaptertbGeneralSetup.Fill(dbAccountingProjectDS.GeneralSetup);
            foreach (DataRow dr in dbAccountingProjectDS.GeneralSetup.Rows)
            {
                decmal = int.Parse(dr["DecimalPointsNumber"].ToString());
            }
            dtCredits = new DataTable();
            dtCredits.Columns.Add("InvoiceID", System.Type.GetType("System.Int32"));
            dtCredits.Columns.Add("BatchNo", System.Type.GetType("System.Int32"));
            dtCredits.Columns.Add("VendorCode", System.Type.GetType("System.String"));
            dtCredits.Columns.Add("VendorName", System.Type.GetType("System.String"));
            dtCredits.Columns.Add("InvoiceDate", System.Type.GetType("System.DateTime"));
            dtCredits.Columns.Add("Reference", System.Type.GetType("System.String"));
            dtCredits.Columns.Add("Amount", System.Type.GetType("System.Double"));
            dtCredits.Columns.Add("AmountPaid", System.Type.GetType("System.Double"));
            dtCredits.Columns.Add("Balance_To_Apply", System.Type.GetType("System.Double"));
            dtCredits.Columns.Add("Curr.", System.Type.GetType("System.String"));
            dgv_CreditTransaction.DataSource = dtCredits;
            dgv_CreditTransaction.Refresh();
            dgv_CreditTransaction.Columns["InvoiceID"].Visible         = false;
            dgv_CreditTransaction.Columns["BatchNo"].ReadOnly          = true;
            dgv_CreditTransaction.Columns["VendorCode"].ReadOnly       = true;
            dgv_CreditTransaction.Columns["VendorName"].ReadOnly       = true;
            dgv_CreditTransaction.Columns["InvoiceDate"].ReadOnly      = true;
            dgv_CreditTransaction.Columns["Reference"].ReadOnly        = true;
            dgv_CreditTransaction.Columns["Amount"].ReadOnly           = true;
            dgv_CreditTransaction.Columns["AmountPaid"].ReadOnly       = true;
            dgv_CreditTransaction.Columns["Balance_To_Apply"].ReadOnly = true;
            dgv_CreditTransaction.Columns["Curr."].ReadOnly            = true;
            dtInvoice = new DataTable();
            dtInvoice.Columns.Add("InvoiceID", System.Type.GetType("System.Int32"));
            dtInvoice.Columns.Add("Select", System.Type.GetType("System.Boolean"));
            dtInvoice.Columns.Add("VendorCode", System.Type.GetType("System.String"));
            dtInvoice.Columns.Add("InvoiceDate", System.Type.GetType("System.DateTime"));
            dtInvoice.Columns.Add("Reference", System.Type.GetType("System.String"));
            dtInvoice.Columns.Add("InvoiceAmount", System.Type.GetType("System.Double"));
            dtInvoice.Columns.Add("TaxValue", System.Type.GetType("System.Double"));
            dtInvoice.Columns.Add("AmountPaid", System.Type.GetType("System.Double"));
            dtInvoice.Columns.Add("Balance", System.Type.GetType("System.Double"));
            dtInvoice.Columns.Add("AmtApplied", System.Type.GetType("System.Double"));
            dtInvoice.Columns.Add("AppliedBalance", System.Type.GetType("System.Double"));
            dtInvoice.Columns.Add("Curr.", System.Type.GetType("System.String"));
            dgv_AccountCharges.DataSource = dtInvoice;
            dgv_AccountCharges.Refresh();
            dgv_AccountCharges.Columns["InvoiceID"].Visible       = false;
            dgv_AccountCharges.Columns["VendorCode"].ReadOnly     = true;
            dgv_AccountCharges.Columns["InvoiceDate"].ReadOnly    = true;
            dgv_AccountCharges.Columns["Reference"].ReadOnly      = true;
            dgv_AccountCharges.Columns["InvoiceAmount"].ReadOnly  = true;
            dgv_AccountCharges.Columns["TaxValue"].ReadOnly       = true;
            dgv_AccountCharges.Columns["AmountPaid"].ReadOnly     = true;
            dgv_AccountCharges.Columns["Balance"].ReadOnly        = true;
            dgv_AccountCharges.Columns["AppliedBalance"].ReadOnly = true;
            dgv_AccountCharges.Columns["Curr."].ReadOnly          = true;
            dgv_AccountCharges.Columns["AmtApplied"].DefaultCellStyle.BackColor = Color.LightGray;

            LoadTransactions();
            label_Mode.Text    = "Vendor Code";
            rd_Credits.Checked = true;

            cb_Currency = GeneralFunctions.FillComboBox(dbAccountingProjectDS.GLCurrency, cb_Currency, "CurrencyCode", "CurrencyNumber");
            if (GeneralFunctions.Ckecktag("15") != "M")
            {
                cb_Currency.Items.Remove("<new>");
            }
            cb_Currency = GeneralFunctions.RemoveBaseCurrency(cb_Currency);
        }
Exemplo n.º 5
0
        private void VendorSearch_Load(object sender, EventArgs e)
        {
            if (GeneralFunctions.Ckecktag("81") != "M")
            {
                btn_NewVendor.Visible = false;
            }
            sqlcon = new SqlConnection(GeneralFunctions.ConnectionString);
            if (ApplyCredits == "Credits")
            {
                if (NOSearch != "")
                {
                    adaptertbVendors = new SqlDataAdapter("Select * From APVendors Where VendorCode IN " + NOSearch, sqlcon);
                }

                else
                {
                    adaptertbVendors = new SqlDataAdapter("Select * from APVendors", sqlcon);
                }
            }
            else
            {
                adaptertbVendors = new SqlDataAdapter("Select * from APVendors", sqlcon);
            }
            adaptertbVendorCategory = new SqlDataAdapter("Select * from APVendorCategory", sqlcon);
            adaptertbVendors.Fill(dbAccountingProjectDS.APVendors);
            adaptertbVendorCategory.Fill(dbAccountingProjectDS.APVendorCategory);
            if (!GeneralFunctions.SubTypesloaded)
            {
                SqlConnection sqlcon10 = new SqlConnection(GeneralFunctions.ConnectionString);
                sqlcon10.Open();
                SqlCommand command10 = new SqlCommand("Select AccountSubType From  GeneralSetup", sqlcon10);
                SqlCommand command11 = new SqlCommand("Select FirstSub From GeneralSetup", sqlcon10);
                SqlCommand command12 = new SqlCommand("Select SecondSub From GeneralSetup", sqlcon10);
                SqlCommand command13 = new SqlCommand("Select ThirdSub From GeneralSetup", sqlcon10);
                SqlCommand command14 = new SqlCommand("Select FourthSub From GeneralSetup", sqlcon10);
                int        AccountSubTypeNumber;
                if (command10.ExecuteScalar() != DBNull.Value)
                {
                    AccountSubTypeNumber = Convert.ToInt32(command10.ExecuteScalar());
                    if (AccountSubTypeNumber == 2)
                    {
                        GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar()));
                        GeneralFunctions.SubTypesloaded = true;
                    }
                    if (AccountSubTypeNumber == 3)
                    {
                        GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar()), Convert.ToInt32(command13.ExecuteScalar()));
                        GeneralFunctions.SubTypesloaded = true;
                    }
                    if (AccountSubTypeNumber == 4)
                    {
                        GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar()), Convert.ToInt32(command13.ExecuteScalar()), Convert.ToInt32(command14.ExecuteScalar()));
                        GeneralFunctions.SubTypesloaded = true;
                    }
                }
            }
            cb_VendorCategory = GeneralFunctions.FillComboBox(dbAccountingProjectDS.APVendorCategory, cb_VendorCategory, "CategoryCode", "CategoryID");
            if (GeneralFunctions.Ckecktag("79") != "M")
            {
                cb_VendorCategory.Items.Remove("<new>");
            }
            cb_VendorCategory.Items.Insert(0, "Any Type");
        }
Exemplo n.º 6
0
        private void AccountSearch_Load(object sender, EventArgs e)
        {
            try
            {
                if (GeneralFunctions.Ckecktag("18") != "M")
                {
                    btn_Add.Visible = false;
                }

                sqlcon = new SqlConnection(GeneralFunctions.ConnectionString);
                //if (GeneralFunctions.Header == "")
                adaptertbAccounts = new SqlDataAdapter("Select * from GLAccounts where AccountTypeName <> '' " + filter, sqlcon);
                //else if (GeneralFunctions.Header == "AR")
                //    adaptertbAccounts = new SqlDataAdapter("Select * from GLAccounts where AccountTypeName <> 'Header' AND AccountTypeName <> 'Statictical'", sqlcon);
                //else if (GeneralFunctions.Header == "Yes")
                //    adaptertbAccounts = new SqlDataAdapter("Select * from GLAccounts where AccountTypeName <> 'Header'", sqlcon);
                adaptertbAccountTypes  = new SqlDataAdapter("Select * from GLAccountTypes where AccountTypeName <> '' " + filter, sqlcon);
                adaptertbGeneralSetup  = new SqlDataAdapter("Select * from GeneralSetup", sqlcon);
                cmdBuilderGeneralSetup = new SqlCommandBuilder(adaptertbGeneralSetup);
                adaptertbGeneralSetup.Fill(dbAccountingProjectDS.GeneralSetup);

                adaptertbAccounts.Fill(dbAccountingProjectDS.GLAccounts);
                adaptertbAccountTypes.Fill(dbAccountingProjectDS.GLAccountTypes);

                if (!GeneralFunctions.SubTypesloaded)
                {
                    SqlConnection sqlcon10 = new SqlConnection(GeneralFunctions.ConnectionString);
                    sqlcon10.Open();
                    SqlCommand command10 = new SqlCommand("Select AccountSubType From  GeneralSetup", sqlcon10);
                    SqlCommand command11 = new SqlCommand("Select FirstSub From GeneralSetup", sqlcon10);
                    SqlCommand command12 = new SqlCommand("Select SecondSub From GeneralSetup", sqlcon10);
                    SqlCommand command13 = new SqlCommand("Select ThirdSub From GeneralSetup", sqlcon10);
                    SqlCommand command14 = new SqlCommand("Select FourthSub From GeneralSetup", sqlcon10);
                    int        AccountSubTypeNumber;
                    if (command10.ExecuteScalar() != DBNull.Value)
                    {
                        AccountSubTypeNumber = Convert.ToInt32(command10.ExecuteScalar());
                        if (AccountSubTypeNumber == 2)
                        {
                            GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar()));
                            GeneralFunctions.SubTypesloaded = true;
                        }
                        if (AccountSubTypeNumber == 3)
                        {
                            GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar()), Convert.ToInt32(command13.ExecuteScalar()));
                            GeneralFunctions.SubTypesloaded = true;
                        }
                        if (AccountSubTypeNumber == 4)
                        {
                            GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar()), Convert.ToInt32(command13.ExecuteScalar()), Convert.ToInt32(command14.ExecuteScalar()));
                            GeneralFunctions.SubTypesloaded = true;
                        }
                    }
                }
                //foreach (DataRow dr in dbAccountingProjectDS.GeneralSetup.Rows)
                //{
                //    AccountNumberFormat = dr["AccountNumberFormat"].ToString();
                //}
                //txt_AccountNumber1.Mask = AccountNumberFormat;
                //txt_AccountNumber.Mask = AccountNumberFormat;// "###-####-##";
                cb_AccountType = GeneralFunctions.FillComboBox(dbAccountingProjectDS.GLAccountTypes, cb_AccountType, "AccountTypeName", "AccountTypeID");
                cb_AccountType.Items.Insert(0, "Any Type");
                //if (GeneralFunctions.Header == "Yes")
                //    cb_AccountType.Items.Remove("Header");
                //if (GeneralFunctions.Header == "AR")
                //{
                //    cb_AccountType.Items.Remove("Header");
                //    cb_AccountType.Items.Remove("Statictical");
                //}
                cb_AccountType.Items.Remove("<new>");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "General Ledger");
            }
        }
Exemplo n.º 7
0
        private void ApplyCreditsScreen_Load(object sender, EventArgs e)
        {
            string msg = GeneralFunctions.CheckLockTables("", "ARApplyCreditsScreen", "", "Open");

            if (msg != "")
            {
                MessageBox.Show("ARApplyCreditsScreen Open By " + msg, "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                btn_Save.Visible = false;
            }
            GeneralFunctions.LockTables("", "ARApplyCreditsScreen", "", "Open");
            sqlcon                   = new SqlConnection(GeneralFunctions.ConnectionString);
            adaptertbARCredits       = new SqlDataAdapter("Select * from ARCredits", sqlcon);
            adaptertbBatch           = new SqlDataAdapter("Select * from Batch", sqlcon);
            adaptertbBatchInvoices   = new SqlDataAdapter("Select * from ARtrans", sqlcon);
            adaptertbInvoiceAccounts = new SqlDataAdapter("Select * from APExpense", sqlcon);
            adaptertbCurrency        = new SqlDataAdapter("Select * from GLCurrency", sqlcon);

            cmdBuilder          = new SqlCommandBuilder(adaptertbBatchInvoices);
            cmdBuilderARCredits = new SqlCommandBuilder(adaptertbARCredits);

            adaptertbBatch.Fill(dbAccountingProjectDS.Batch);
            adaptertbARCredits.Fill(dbAccountingProjectDS.ARCredits);
            adaptertbBatchInvoices.Fill(dbAccountingProjectDS.ARtrans);
            adaptertbInvoiceAccounts.Fill(dbAccountingProjectDS.APExpense);
            adaptertbCurrency.Fill(dbAccountingProjectDS.GLCurrency);
            adaptertbGeneralSetup = new SqlDataAdapter("Select * from GeneralSetup", sqlcon);
            adaptertbGeneralSetup.Fill(dbAccountingProjectDS.GeneralSetup);
            foreach (DataRow dr in dbAccountingProjectDS.GeneralSetup.Rows)
            {
                decmal = int.Parse(dr["DecimalPointsNumber"].ToString());
            }
            DataRow[] drbatch   = dbAccountingProjectDS.Batch.Select("BatchSRC = 'ARP' AND BatchStat = 'P'");
            string    NOBatches = "";
            string    s         = "";

            if (drbatch.Length != 0)
            {
                foreach (DataRow r in drbatch)
                {
                    NOBatches = NOBatches + s + r["BatchNo"].ToString() + "'";
                    s         = ",'";
                }
                NOBatches = "('" + NOBatches + ")";
            }
            NOBatchesARP = NOBatches;
            drbatch      = dbAccountingProjectDS.Batch.Select("BatchSRC = 'AR' AND BatchStat = 'P'");
            NOBatches    = "";
            s            = "";
            if (drbatch.Length != 0)
            {
                foreach (DataRow r in drbatch)
                {
                    NOBatches = NOBatches + s + r["BatchNo"].ToString() + "'";
                    s         = ",'";
                }
                NOBatches = "('" + NOBatches + ")";
            }
            NOBatchesAR = NOBatches;
            drbatch     = dbAccountingProjectDS.Batch.Select("BatchSRC = 'AR' AND BatchStat = 'P'");
            NOBatches   = "";
            s           = "";
            if (drbatch.Length != 0)
            {
                foreach (DataRow r in drbatch)
                {
                    NOBatches = NOBatches + s + r["BatchNo"].ToString() + "'";
                    s         = ",'";
                }
                NOBatches = "('" + NOBatches + ")";
            }
            DataRow[] drtrancr;
            if (NOBatches == "")
            {
                drtrancr = dbAccountingProjectDS.ARtrans.Select("Paid = 'N' AND BatchNo IN (0) AND AmountLC < 0 ");
            }
            else
            {
                drtrancr = dbAccountingProjectDS.ARtrans.Select("Paid = 'N' AND BatchNo IN " + NOBatches + " AND AmountLC < 0 ");
            }
            NOBatches = "";
            s         = "";
            if (drtrancr.Length != 0)
            {
                foreach (DataRow r in drtrancr)
                {
                    NOBatches = NOBatches + s + r["TransNO"].ToString() + "'";
                    s         = ",'";
                }
                NOBatches = "('" + NOBatches + ")";
            }
            NOTranARCredit = NOBatches;
            dtCredits      = new DataTable();
            dtCredits.Columns.Add("InvoiceID", System.Type.GetType("System.Int32"));
            dtCredits.Columns.Add("BatchNo", System.Type.GetType("System.Int32"));
            dtCredits.Columns.Add("AccountCode", System.Type.GetType("System.String"));
            dtCredits.Columns.Add("AccountName", System.Type.GetType("System.String"));
            dtCredits.Columns.Add("InvoiceDate", System.Type.GetType("System.DateTime"));
            dtCredits.Columns.Add("Reference", System.Type.GetType("System.String"));
            dtCredits.Columns.Add("Amount", System.Type.GetType("System.Double"));
            dtCredits.Columns.Add("AmountPaid", System.Type.GetType("System.Double"));
            dtCredits.Columns.Add("Balance_To_Apply", System.Type.GetType("System.Double"));
            dtCredits.Columns.Add("Curr.", System.Type.GetType("System.String"));
            dgv_CreditTransaction.DataSource = dtCredits;
            dgv_CreditTransaction.Refresh();
            dgv_CreditTransaction.Columns["InvoiceID"].Visible         = false;
            dgv_CreditTransaction.Columns["BatchNo"].ReadOnly          = true;
            dgv_CreditTransaction.Columns["AccountCode"].ReadOnly      = true;
            dgv_CreditTransaction.Columns["AccountName"].ReadOnly      = true;
            dgv_CreditTransaction.Columns["InvoiceDate"].ReadOnly      = true;
            dgv_CreditTransaction.Columns["Reference"].ReadOnly        = true;
            dgv_CreditTransaction.Columns["Amount"].ReadOnly           = true;
            dgv_CreditTransaction.Columns["AmountPaid"].ReadOnly       = true;
            dgv_CreditTransaction.Columns["Balance_To_Apply"].ReadOnly = true;
            dgv_CreditTransaction.Columns["Curr."].ReadOnly            = true;

            dtInvoice = new DataTable();
            dtInvoice.Columns.Add("InvoiceID", System.Type.GetType("System.Int32"));
            dtInvoice.Columns.Add("Select", System.Type.GetType("System.Boolean"));
            dtInvoice.Columns.Add("AccountCode", System.Type.GetType("System.String"));
            dtInvoice.Columns.Add("InvoiceDate", System.Type.GetType("System.DateTime"));
            dtInvoice.Columns.Add("Reference", System.Type.GetType("System.String"));
            dtInvoice.Columns.Add("InvoiceAmount", System.Type.GetType("System.Double"));
            dtInvoice.Columns.Add("AmountPaid", System.Type.GetType("System.Double"));
            dtInvoice.Columns.Add("Balance", System.Type.GetType("System.Double"));
            dtInvoice.Columns.Add("AmtApplied", System.Type.GetType("System.Double"));
            dtInvoice.Columns.Add("AppliedBalance", System.Type.GetType("System.Double"));
            dtInvoice.Columns.Add("Curr.", System.Type.GetType("System.String"));
            dgv_AccountCharges.DataSource = dtInvoice;
            dgv_AccountCharges.Refresh();
            dgv_AccountCharges.Columns["InvoiceID"].Visible       = false;
            dgv_AccountCharges.Columns["AccountCode"].ReadOnly    = true;
            dgv_AccountCharges.Columns["InvoiceDate"].ReadOnly    = true;
            dgv_AccountCharges.Columns["Reference"].ReadOnly      = true;
            dgv_AccountCharges.Columns["InvoiceAmount"].ReadOnly  = true;
            dgv_AccountCharges.Columns["AmountPaid"].ReadOnly     = true;
            dgv_AccountCharges.Columns["Balance"].ReadOnly        = true;
            dgv_AccountCharges.Columns["AppliedBalance"].ReadOnly = true;
            dgv_AccountCharges.Columns["Curr."].ReadOnly          = true;
            dgv_AccountCharges.Columns["AmtApplied"].DefaultCellStyle.BackColor = Color.LightGray;

            LoadTransactions();
            label_Mode.Text    = "Account Code";
            rd_Credits.Checked = true;

            cb_Currency = GeneralFunctions.FillComboBox(dbAccountingProjectDS.GLCurrency, cb_Currency, "CurrencyCode", "CurrencyNumber");
            if (GeneralFunctions.Ckecktag("15") != "M")
            {
                cb_Currency.Items.Remove("<new>");
            }
            cb_Currency = GeneralFunctions.RemoveBaseCurrency(cb_Currency);
        }