/// <summary>
 /// Function to fill the report in grid
 /// </summary>
 public void AccountGroupGridFill()
 {
     decimal decBalanceTotal = 0;
     DateTime dtmFromDate = DateTime.Now;
     DateTime dtmToDate = DateTime.Now;
     AccountGroupBll bllAccountGroup = new AccountGroupBll();
     List<DataTable> ListObj = new List<DataTable>();
     try
     {
         if (txtFromDate.Text != string.Empty)
         {
             dtmFromDate = Convert.ToDateTime(txtFromDate.Text);
         }
         if (txtToDate.Text != string.Empty)
         {
             dtmToDate = Convert.ToDateTime(txtToDate.Text);
         }
         ListObj = bllAccountGroup.AccountGroupReportFill(dtmFromDate, dtmToDate);
         for (int i = 0; i < ListObj[0].Rows.Count; i++)
         {
             if (Convert.ToDecimal(ListObj[0].Rows[i]["accountGroupId"].ToString()) == 6)
             {
                 FinancialStatementBll bllFinancialStatement = new FinancialStatementBll();
                 CalculationMethod();
                 decimal dcOpeninggStock = bllFinancialStatement.StockValueGetOnDate(PublicVariables._dtFromDate, calculationMethod, true, true);
                 dcOpeninggStock = Math.Round(dcOpeninggStock, PublicVariables._inNoOfDecimalPlaces);
                 decimal decOpBalance = Convert.ToDecimal(ListObj[0].Rows[i]["OpBalance"].ToString()) + dcOpeninggStock;
                 decimal decClosing = Convert.ToDecimal(ListObj[0].Rows[i]["balance1"].ToString()) + dcOpeninggStock;
                 if (decOpBalance >= 0)
                 {
                     ListObj[0].Rows[i]["OpeningBalance"] = decOpBalance.ToString() + "Dr";
                 }
                 else
                 {
                     ListObj[0].Rows[i]["OpeningBalance"] = decOpBalance.ToString() + "Cr";
                 }
                 if (decClosing >= 0)
                 {
                     ListObj[0].Rows[i]["balance"] = decClosing.ToString() + "Dr";
                 }
                 else
                 {
                     ListObj[0].Rows[i]["balance"] = decClosing.ToString() + "Cr";
                 }
                 ListObj[0].Rows[i]["balance1"] = decClosing.ToString();
             }
         }
         dgvAccountGroupReport.DataSource = ListObj[0];
         if (dgvAccountGroupReport.RowCount > 0)
         {
             for (int i = 0; i < dgvAccountGroupReport.RowCount; i++)
             {
                 decBalanceTotal = decBalanceTotal + Convert.ToDecimal(dgvAccountGroupReport.Rows[i].Cells["dgvtxtBalance1"].Value.ToString());
             }
         }
         if (decBalanceTotal < 0)
         {
             decBalanceTotal = -1 * decBalanceTotal;
             lblBalanceTotal.Text = decBalanceTotal.ToString() + "Cr";
         }
         else
         {
             lblBalanceTotal.Text = decBalanceTotal.ToString() + "Dr"; ;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AGR:4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Function to print report
        /// </summary>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        public void Print(DateTime fromDate, DateTime toDate)
        {
            try
            {
                FinancialStatementBll bllFinancialStatement = new FinancialStatementBll();
                AccountGroupBll bllAccountGroup = new AccountGroupBll();
                DataSet dsAccountGroup = new DataSet();
                List<DataTable> ListObj = bllAccountGroup.AccountGroupReportFill(fromDate, toDate);
                string strSum = lblBalanceTotal.Text;
                DataTable dtblSum = new DataTable();
                dtblSum.Columns.Add("Sum", typeof(string));
                DataRow dr = dtblSum.NewRow();
                dr[0] = strSum;
                dtblSum.Rows.InsertAt(dr, 0);

                List<DataTable> listCompany = bllFinancialStatement.FundFlowReportPrintCompany(1);
                dsAccountGroup.Tables.Add(ListObj[0]);
                dsAccountGroup.Tables.Add(listCompany[0]);
                dsAccountGroup.Tables.Add(dtblSum);
                frmReport frmReport = new frmReport();
                frmReport.MdiParent = formMDI.MDIObj;
                frmReport.AccountGroup(dsAccountGroup);
            }
            catch (Exception ex)
            {
                MessageBox.Show("AGR:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }