コード例 #1
0
 private void displayResult()
 {
     try
     {
         dgvChartOfAccounts.DataSource = null;
         if (txtSearch.Text != "")
         {
             dgvChartOfAccounts.DataSource = loChartOfAccount.getAllData("", txtSearch.Text, "");
         }
         else
         {
             dgvChartOfAccounts.DataSource = loChartOfAccount.getAllData("ViewAll", "", "");
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
 private string getSubsidiary(string pAccountId)
 {
     try
     {
         string _Subsidiary = "";
         foreach (DataRow _dr in loChartOfAccount.getAllData("", pAccountId, "").Rows)
         {
             _Subsidiary = _dr["Subsidiary"].ToString();
         }
         return(_Subsidiary);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #3
0
        private void btnProcess_Click(object sender, EventArgs e)
        {
            try
            {
                dgvDetail.Rows.Clear();
                dgvDetailPaymentReceipt.Rows.Clear();
                string _customerId = "";
                try
                {
                    _customerId = cboCustomer.SelectedValue.ToString();
                }
                catch
                {
                    MessageBoxUI _mb = new MessageBoxUI("You must select a Customer!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    return;
                }

                //insert debit account
                string[] lRecordDebitData = new string[11];
                lRecordDebitData[0] = "";                             //detail id
                lRecordDebitData[1] = GlobalVariables.CRDebitAccount; //coa id
                lRecordDebitData[2] = "";
                lRecordDebitData[3] = "";
                foreach (DataRow _dr in loChartOfAccount.getAllData("", GlobalVariables.CRDebitAccount, "").Rows)
                {
                    lRecordDebitData[2] = _dr["Code"].ToString();                                     //coa code
                    lRecordDebitData[3] = _dr["Account Title"].ToString();                            //coa title
                }
                lRecordDebitData[4]  = string.Format("{0:n}", decimal.Parse(txtPaymentReceipt.Text)); //debit
                lRecordDebitData[5]  = "0.00";                                                        //credit
                lRecordDebitData[6]  = "Bank";                                                        //subsidiary
                lRecordDebitData[7]  = "";                                                            //subsidiary id/code
                lRecordDebitData[8]  = "";                                                            //subsidiary description
                lRecordDebitData[9]  = "";                                                            //remarks
                lRecordDebitData[10] = "Add";
                addData(lRecordDebitData);

                //insert credit account
                string[] lRecordCreditData = new string[11];
                lRecordCreditData[0] = "";                              //detail id
                lRecordCreditData[1] = GlobalVariables.CRCreditAccount; //coa id
                lRecordCreditData[2] = "";
                lRecordCreditData[3] = "";
                foreach (DataRow _dr in loChartOfAccount.getAllData("", GlobalVariables.CRCreditAccount, "").Rows)
                {
                    lRecordCreditData[2] = _dr["Code"].ToString();                                     //coa code
                    lRecordCreditData[3] = _dr["Account Title"].ToString();                            //coa title
                }
                lRecordCreditData[4]  = "0.00";                                                        //debit
                lRecordCreditData[5]  = string.Format("{0:n}", decimal.Parse(txtPaymentReceipt.Text)); //credit
                lRecordCreditData[6]  = "Customer";                                                    //subsidiary
                lRecordCreditData[7]  = _customerId;                                                   //subsidiary id/code
                lRecordCreditData[8]  = cboCustomer.Text;                                              //subsidiary description
                lRecordCreditData[9]  = "";                                                            //remarks
                lRecordCreditData[10] = "Add";
                addData(lRecordCreditData);

                //insert payment receive
                decimal _paymentbalance = decimal.Parse(txtPaymentReceipt.Text);

                foreach (DataRow _dr in loSalesOrder.getCashReceiptSOByCustomer(_customerId, "").Rows)
                {
                    if (_paymentbalance != 0)
                    {
                        if (decimal.Parse(_dr["Running Balance"].ToString()) == _paymentbalance)
                        {
                            string[] lRecordPaymentData = new string[7];
                            lRecordPaymentData[0] = "";                                                                       //detail
                            lRecordPaymentData[1] = _dr["Id"].ToString();                                                     // sales order id
                            lRecordPaymentData[2] = string.Format("{0:n}", decimal.Parse(_dr["Running Balance"].ToString())); // amount due
                            lRecordPaymentData[3] = string.Format("{0:n}", decimal.Parse(_dr["Running Balance"].ToString())); // payment amount
                            lRecordPaymentData[4] = "0.00";                                                                   // balance
                            lRecordPaymentData[5] = "";                                                                       // remarks
                            lRecordPaymentData[6] = "Add";
                            addDataReceipt(lRecordPaymentData, true);

                            _paymentbalance = decimal.Parse(_dr["Running Balance"].ToString()) - _paymentbalance;
                        }
                        else if (decimal.Parse(_dr["Running Balance"].ToString()) > _paymentbalance)
                        {
                            string[] lRecordPaymentData = new string[7];
                            lRecordPaymentData[0] = "";                                                                                         //detail
                            lRecordPaymentData[1] = _dr["Id"].ToString();                                                                       // sales order id
                            lRecordPaymentData[2] = string.Format("{0:n}", decimal.Parse(_dr["Running Balance"].ToString()));                   // amount due
                            lRecordPaymentData[3] = string.Format("{0:n}", _paymentbalance);                                                    // payment amount
                            lRecordPaymentData[4] = string.Format("{0:n}", decimal.Parse(_dr["Running Balance"].ToString()) - _paymentbalance); // balance
                            lRecordPaymentData[5] = "";                                                                                         // remarks
                            lRecordPaymentData[6] = "Add";
                            addDataReceipt(lRecordPaymentData, true);

                            _paymentbalance = 0;
                        }
                        else if (decimal.Parse(_dr["Running Balance"].ToString()) < _paymentbalance)
                        {
                            string[] lRecordPaymentData = new string[7];
                            lRecordPaymentData[0] = "";                                                                       //detail
                            lRecordPaymentData[1] = _dr["Id"].ToString();                                                     // sales order id
                            lRecordPaymentData[2] = string.Format("{0:n}", decimal.Parse(_dr["Running Balance"].ToString())); // amount due
                            lRecordPaymentData[3] = string.Format("{0:n}", decimal.Parse(_dr["Running Balance"].ToString())); // payment amount
                            lRecordPaymentData[4] = string.Format("{0:n}", 0);                                                // balance
                            lRecordPaymentData[5] = "";                                                                       // remarks
                            lRecordPaymentData[6] = "Add";
                            addDataReceipt(lRecordPaymentData, true);

                            _paymentbalance = _paymentbalance - decimal.Parse(_dr["Running Balance"].ToString());
                        }
                    }
                }
                if (_paymentbalance > 0)
                {
                    MessageBoxUI _mb = new MessageBoxUI("OVER PAYMENT! " + string.Format("{0:n}", _paymentbalance), GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    return;
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnProcess_Click");
                em.ShowDialog();
                return;
            }
        }
コード例 #4
0
        private void SystemConfigurationUI_Load(object sender, EventArgs e)
        {
            try
            {
                cboCurrentLocation.DataSource    = loLocation.getAllData("ViewAll", "", "");
                cboCurrentLocation.DisplayMember = "Description";
                cboCurrentLocation.ValueMember   = "Id";
                cboCurrentLocation.SelectedIndex = 0;

                cboCurrentBranch.DataSource    = loBranch.getAllData("ViewAll", "", "");
                cboCurrentBranch.DisplayMember = "Description";
                cboCurrentBranch.ValueMember   = "Id";
                cboCurrentBranch.SelectedIndex = 0;

                cboSODebitAccount.DataSource    = loChartOfAccount.getAllData("ViewAll", "", "");
                cboSODebitAccount.DisplayMember = "Account Title";
                cboSODebitAccount.ValueMember   = "Id";
                cboSODebitAccount.SelectedIndex = -1;

                cboSOCreditAccount.DataSource    = loChartOfAccount.getAllData("ViewAll", "", "");
                cboSOCreditAccount.DisplayMember = "Account Title";
                cboSOCreditAccount.ValueMember   = "Id";
                cboSOCreditAccount.SelectedIndex = -1;

                cboPODebitAccount.DataSource    = loChartOfAccount.getAllData("ViewAll", "", "");
                cboPODebitAccount.DisplayMember = "Account Title";
                cboPODebitAccount.ValueMember   = "Id";
                cboPODebitAccount.SelectedIndex = -1;

                cboPOCreditAccount.DataSource    = loChartOfAccount.getAllData("ViewAll", "", "");
                cboPOCreditAccount.DisplayMember = "Account Title";
                cboPOCreditAccount.ValueMember   = "Id";
                cboPOCreditAccount.SelectedIndex = -1;

                cboCRDebitAccount.DataSource    = loChartOfAccount.getAllData("ViewAll", "", "");
                cboCRDebitAccount.DisplayMember = "Account Title";
                cboCRDebitAccount.ValueMember   = "Id";
                cboCRDebitAccount.SelectedIndex = -1;

                cboCRCreditAccount.DataSource    = loChartOfAccount.getAllData("ViewAll", "", "");
                cboCRCreditAccount.DisplayMember = "Account Title";
                cboCRCreditAccount.ValueMember   = "Id";
                cboCRCreditAccount.SelectedIndex = -1;

                cboCDDebitAccount.DataSource    = loChartOfAccount.getAllData("ViewAll", "", "");
                cboCDDebitAccount.DisplayMember = "Account Title";
                cboCDDebitAccount.ValueMember   = "Id";
                cboCDDebitAccount.SelectedIndex = -1;

                cboCDCreditAccount.DataSource    = loChartOfAccount.getAllData("ViewAll", "", "");
                cboCDCreditAccount.DisplayMember = "Account Title";
                cboCDCreditAccount.ValueMember   = "Id";
                cboCDCreditAccount.SelectedIndex = -1;

                cboCashierPeriodDebit.DataSource    = loChartOfAccount.getAllData("ViewAll", "", "");
                cboCashierPeriodDebit.DisplayMember = "Account Title";
                cboCashierPeriodDebit.ValueMember   = "Id";
                cboCashierPeriodDebit.SelectedIndex = -1;

                cboCashierPeriodCredit.DataSource    = loChartOfAccount.getAllData("ViewAll", "", "");
                cboCashierPeriodCredit.DisplayMember = "Account Title";
                cboCashierPeriodCredit.ValueMember   = "Id";
                cboCashierPeriodCredit.SelectedIndex = -1;
            }
            catch { }
            try
            {
                refresh();
                readSystemSettings();
            }
            catch
            { }
        }
コード例 #5
0
        private void getSubsidiary()
        {
            try
            {
                foreach (DataRow _dr in loChartOfAccount.getAllData("", cboChartOfAccount.SelectedValue.ToString(), "").Rows)
                {
                    if (_dr["Subsidiary"].ToString() != "")
                    {
                        lblSubsidiary.Text          = _dr["Subsidiary"].ToString();
                        cboSubsidiary.Enabled       = true;
                        btnLookupSubsidiary.Enabled = true;
                        if (lblSubsidiary.Text == "Bank")
                        {
                            cboSubsidiary.DataSource    = null;
                            cboSubsidiary.DataSource    = loBank.getAllData("ViewAll", "", "");
                            cboSubsidiary.ValueMember   = "Id";
                            cboSubsidiary.DisplayMember = "Description";
                            cboSubsidiary.SelectedIndex = -1;
                        }
                        else if (lblSubsidiary.Text == "Customer")
                        {
                            cboSubsidiary.DataSource    = null;
                            cboSubsidiary.DataSource    = loCustomer.getAllData("ViewAll", "", "");
                            cboSubsidiary.ValueMember   = "Id";
                            cboSubsidiary.DisplayMember = "Name";
                            cboSubsidiary.SelectedIndex = -1;
                        }
                        else if (lblSubsidiary.Text == "Supplier")
                        {
                            cboSubsidiary.DataSource    = null;
                            cboSubsidiary.DataSource    = loSupplier.getAllData("ViewAll", "", "");
                            cboSubsidiary.ValueMember   = "Id";
                            cboSubsidiary.DisplayMember = "Name";
                            cboSubsidiary.SelectedIndex = -1;
                        }
                        else if (lblSubsidiary.Text == "Sales Person")
                        {
                            cboSubsidiary.DataSource    = null;
                            cboSubsidiary.DataSource    = loSalesPerson.getSalesPersonNames();
                            cboSubsidiary.ValueMember   = "Id";
                            cboSubsidiary.DisplayMember = "Name";
                            cboSubsidiary.SelectedIndex = -1;
                        }
                        else if (lblSubsidiary.Text == "Equipment")
                        {
                            cboSubsidiary.DataSource    = null;
                            cboSubsidiary.DataSource    = loEquipment.getAllData("ViewAll", "", "");
                            cboSubsidiary.ValueMember   = "Id";
                            cboSubsidiary.DisplayMember = "Description";
                            cboSubsidiary.SelectedIndex = -1;
                        }
                        else if (lblSubsidiary.Text == "Building")
                        {
                            cboSubsidiary.DataSource    = null;
                            cboSubsidiary.DataSource    = loBuilding.getAllData("ViewAll", "", "");
                            cboSubsidiary.ValueMember   = "Id";
                            cboSubsidiary.DisplayMember = "Description";
                            cboSubsidiary.SelectedIndex = -1;
                        }
                    }
                    else
                    {
                        lblSubsidiary.Text          = "";
                        cboSubsidiary.Enabled       = false;
                        btnLookupSubsidiary.Enabled = false;
                        cboSubsidiary.DataSource    = null;
                    }
                }
            }
            catch { }

            /*
             * catch
             * {
             *  lblSubsidiary.Text = "";
             *  cboSubsidiary.Enabled = false;
             *  btnLookupSubsidiary.Enabled = false;
             *  cboSubsidiary.DataSource = null;
             * }
             */
        }
コード例 #6
0
        private void load()
        {
            try
            {
                decimal _totalEarnings      = 0;
                decimal _totalExpenses      = 0;
                decimal _overAllTotalDebit  = 0;
                decimal _overAllTotalCredit = 0;
                //income
                try
                {
                    dgvIncomeEntry.Rows.Clear();
                    decimal _totaldebit  = 0;
                    decimal _totalcredit = 0;
                    foreach (DataRow _drIncomeStatement in loJournalEntryDetail.getIncomeStatementForClosingEntry(int.Parse(txtFinancialYear.Text), GlobalVariables.IncomeClassificationCode).Rows)
                    {
                        decimal _total = decimal.Parse(_drIncomeStatement["Credit"].ToString()) - decimal.Parse(_drIncomeStatement["Debit"].ToString());
                        if (_total >= 0)
                        {
                            _totaldebit  += _total;
                            _totalcredit += 0;

                            int i = dgvIncomeEntry.Rows.Add();
                            dgvIncomeEntry.Rows[i].Cells["IncomeAccountId"].Value    = _drIncomeStatement["Account Id"].ToString();
                            dgvIncomeEntry.Rows[i].Cells["IncomeAccountCode"].Value  = _drIncomeStatement["Account Code"].ToString();
                            dgvIncomeEntry.Rows[i].Cells["IncomeAccountTitle"].Value = _drIncomeStatement["Account Title"].ToString();
                            dgvIncomeEntry.Rows[i].Cells["IncomeDebit"].Value        = string.Format("{0:n}", _total);
                            dgvIncomeEntry.Rows[i].Cells["IncomeCredit"].Value       = string.Format("{0:n}", 0);
                            _overAllTotalDebit  += _total;
                            _overAllTotalCredit += 0;
                        }
                        else
                        {
                            _totaldebit  += 0;
                            _totalcredit += (_total * -1);

                            int i = dgvIncomeEntry.Rows.Add();
                            dgvIncomeEntry.Rows[i].Cells["IncomeAccountId"].Value    = _drIncomeStatement["Account Id"].ToString();
                            dgvIncomeEntry.Rows[i].Cells["IncomeAccountCode"].Value  = _drIncomeStatement["Account Code"].ToString();
                            dgvIncomeEntry.Rows[i].Cells["IncomeAccountTitle"].Value = _drIncomeStatement["Account Title"].ToString();
                            dgvIncomeEntry.Rows[i].Cells["IncomeDebit"].Value        = string.Format("{0:n}", 0);
                            dgvIncomeEntry.Rows[i].Cells["IncomeCredit"].Value       = string.Format("{0:n}", _total * -1);
                            _overAllTotalDebit  += 0;
                            _overAllTotalCredit += (_total * -1);
                        }
                    }

                    int j = dgvIncomeEntry.Rows.Add();
                    foreach (DataRow _dr in loChartOfAccount.getAllData("", GlobalVariables.IncomeAndExpenseSummaryCode, "").Rows)
                    {
                        dgvIncomeEntry.Rows[j].Cells["IncomeAccountId"].Value    = _dr["Id"].ToString();
                        dgvIncomeEntry.Rows[j].Cells["IncomeAccountCode"].Value  = _dr["Code"].ToString();
                        dgvIncomeEntry.Rows[j].Cells["IncomeAccountTitle"].Value = _dr["Account Title"].ToString();
                        dgvIncomeEntry.Rows[j].Cells["IncomeDebit"].Value        = string.Format("{0:n}", _totalcredit);
                        dgvIncomeEntry.Rows[j].Cells["IncomeCredit"].Value       = string.Format("{0:n}", _totaldebit);
                        _overAllTotalDebit  += _totalcredit;
                        _overAllTotalCredit += _totaldebit;
                        _totalEarnings       = _totaldebit - _totalcredit;
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                //expenses
                try
                {
                    dgvExpenseEntry.Rows.Clear();
                    decimal _totaldebit  = 0;
                    decimal _totalcredit = 0;
                    foreach (DataRow _drIncomeStatement in loJournalEntryDetail.getIncomeStatementForClosingEntry(int.Parse(txtFinancialYear.Text), GlobalVariables.ExpensesClassificationCode).Rows)
                    {
                        decimal _total = decimal.Parse(_drIncomeStatement["Debit"].ToString()) - decimal.Parse(_drIncomeStatement["Credit"].ToString());
                        if (_total >= 0)
                        {
                            _totaldebit  += 0;
                            _totalcredit += _total;

                            int i = dgvExpenseEntry.Rows.Add();
                            dgvExpenseEntry.Rows[i].Cells["ExpenseAccountId"].Value    = _drIncomeStatement["Account Id"].ToString();
                            dgvExpenseEntry.Rows[i].Cells["ExpenseAccountCode"].Value  = _drIncomeStatement["Account Code"].ToString();
                            dgvExpenseEntry.Rows[i].Cells["ExpenseAccountTitle"].Value = _drIncomeStatement["Account Title"].ToString();
                            dgvExpenseEntry.Rows[i].Cells["ExpenseDebit"].Value        = string.Format("{0:n}", 0);
                            dgvExpenseEntry.Rows[i].Cells["ExpenseCredit"].Value       = string.Format("{0:n}", _total);
                            _overAllTotalDebit  += 0;
                            _overAllTotalCredit += _total;
                        }
                        else
                        {
                            _totaldebit  += (_total * -1);
                            _totalcredit += 0;

                            int i = dgvExpenseEntry.Rows.Add();
                            dgvExpenseEntry.Rows[i].Cells["ExpenseAccountId"].Value    = _drIncomeStatement["Account Id"].ToString();
                            dgvExpenseEntry.Rows[i].Cells["ExpenseAccountCode"].Value  = _drIncomeStatement["Account Code"].ToString();
                            dgvExpenseEntry.Rows[i].Cells["ExpenseAccountTitle"].Value = _drIncomeStatement["Account Title"].ToString();
                            dgvExpenseEntry.Rows[i].Cells["ExpenseDebit"].Value        = string.Format("{0:n}", (_total * -1));
                            dgvExpenseEntry.Rows[i].Cells["ExpenseCredit"].Value       = string.Format("{0:n}", 0);
                            _overAllTotalDebit  += (_total * -1);
                            _overAllTotalCredit += 0;
                        }
                    }

                    int j = dgvExpenseEntry.Rows.Add();
                    foreach (DataRow _dr in loChartOfAccount.getAllData("", GlobalVariables.IncomeAndExpenseSummaryCode, "").Rows)
                    {
                        dgvExpenseEntry.Rows[j].Cells["ExpenseAccountId"].Value    = _dr["Id"].ToString();
                        dgvExpenseEntry.Rows[j].Cells["ExpenseAccountCode"].Value  = _dr["Code"].ToString();
                        dgvExpenseEntry.Rows[j].Cells["ExpenseAccountTitle"].Value = _dr["Account Title"].ToString();
                        dgvExpenseEntry.Rows[j].Cells["ExpenseDebit"].Value        = string.Format("{0:n}", _totalcredit);
                        dgvExpenseEntry.Rows[j].Cells["ExpenseCredit"].Value       = string.Format("{0:n}", _totaldebit);
                        _overAllTotalDebit  += _totalcredit;
                        _overAllTotalCredit += _totaldebit;
                        _totalExpenses       = _totalcredit - _totaldebit;
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                // retained earnings
                if (_totalEarnings >= _totalExpenses)
                {
                    dgvRetainedEarningEntry.Rows.Clear();
                    int k = dgvRetainedEarningEntry.Rows.Add();
                    foreach (DataRow _dr in loChartOfAccount.getAllData("", GlobalVariables.RetainedEarningsCode, "").Rows)
                    {
                        dgvRetainedEarningEntry.Rows[k].Cells["REAccountId"].Value    = _dr["Id"].ToString();
                        dgvRetainedEarningEntry.Rows[k].Cells["REAccountCode"].Value  = _dr["Code"].ToString();
                        dgvRetainedEarningEntry.Rows[k].Cells["REAccountTitle"].Value = _dr["Account Title"].ToString();
                        dgvRetainedEarningEntry.Rows[k].Cells["REDebit"].Value        = string.Format("{0:n}", 0);
                        dgvRetainedEarningEntry.Rows[k].Cells["RECredit"].Value       = string.Format("{0:n}", _totalEarnings - _totalExpenses);
                        _overAllTotalDebit  += 0;
                        _overAllTotalCredit += _totalEarnings - _totalExpenses;
                    }

                    int l = dgvRetainedEarningEntry.Rows.Add();
                    foreach (DataRow _dr in loChartOfAccount.getAllData("", GlobalVariables.IncomeAndExpenseSummaryCode, "").Rows)
                    {
                        dgvRetainedEarningEntry.Rows[k].Cells["REAccountId"].Value    = _dr["Id"].ToString();
                        dgvRetainedEarningEntry.Rows[k].Cells["REAccountCode"].Value  = _dr["Code"].ToString();
                        dgvRetainedEarningEntry.Rows[k].Cells["REAccountTitle"].Value = _dr["Account Title"].ToString();
                        dgvRetainedEarningEntry.Rows[l].Cells["REDebit"].Value        = string.Format("{0:n}", _totalEarnings - _totalExpenses);
                        dgvRetainedEarningEntry.Rows[l].Cells["RECredit"].Value       = string.Format("{0:n}", 0);
                        _overAllTotalDebit  += _totalEarnings - _totalExpenses;
                        _overAllTotalCredit += 0;
                    }
                }
                else
                {
                    dgvRetainedEarningEntry.Rows.Clear();
                    int k = dgvRetainedEarningEntry.Rows.Add();
                    foreach (DataRow _dr in loChartOfAccount.getAllData("", GlobalVariables.RetainedEarningsCode, "").Rows)
                    {
                        dgvRetainedEarningEntry.Rows[k].Cells["REAccountId"].Value    = _dr["Id"].ToString();
                        dgvRetainedEarningEntry.Rows[k].Cells["REAccountCode"].Value  = _dr["Code"].ToString();
                        dgvRetainedEarningEntry.Rows[k].Cells["REAccountTitle"].Value = _dr["Account Title"].ToString();
                        dgvRetainedEarningEntry.Rows[k].Cells["REDebit"].Value        = string.Format("{0:n}", (_totalEarnings - _totalExpenses) * -1);
                        dgvRetainedEarningEntry.Rows[k].Cells["RECredit"].Value       = string.Format("{0:n}", 0);
                        _overAllTotalDebit  += (_totalEarnings - _totalExpenses) * -1;
                        _overAllTotalCredit += 0;
                    }

                    int l = dgvRetainedEarningEntry.Rows.Add();
                    foreach (DataRow _dr in loChartOfAccount.getAllData("", GlobalVariables.IncomeAndExpenseSummaryCode, "").Rows)
                    {
                        dgvRetainedEarningEntry.Rows[k].Cells["REAccountId"].Value    = _dr["Id"].ToString();
                        dgvRetainedEarningEntry.Rows[k].Cells["REAccountCode"].Value  = _dr["Code"].ToString();
                        dgvRetainedEarningEntry.Rows[k].Cells["REAccountTitle"].Value = _dr["Account Title"].ToString();
                        dgvRetainedEarningEntry.Rows[l].Cells["REDebit"].Value        = string.Format("{0:n}", 0);
                        dgvRetainedEarningEntry.Rows[l].Cells["RECredit"].Value       = string.Format("{0:n}", (_totalEarnings - _totalExpenses) * -1);
                        _overAllTotalDebit  += 0;
                        _overAllTotalCredit += (_totalEarnings - _totalExpenses) * -1;
                    }
                }

                txtTotalDebit.Text  = string.Format("{0:n}", _overAllTotalDebit);
                txtTotalCredit.Text = string.Format("{0:n}", _overAllTotalCredit);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }