private void btnSendEmail_Click(object sender, EventArgs e)
        {
            try
            {
                int?     companyId = ddlCompany.SelectedValue.ToIntorNull();
                DateTime?fromDate  = dtpFromDate.Value.ToDate();
                DateTime?tillDate  = dtpTillDate.Value.ToDate();

                string error = string.Empty;

                if (companyId == null)
                {
                    error += "Required : Account";
                }

                if (fromDate == null)
                {
                    if (string.IsNullOrEmpty(error))
                    {
                        error += Environment.NewLine;
                    }

                    error += "Required : From Date";
                }

                if (tillDate == null)
                {
                    if (string.IsNullOrEmpty(error))
                    {
                        error += Environment.NewLine;
                    }

                    error += "Required : To Date";
                }

                if (!string.IsNullOrEmpty(error))
                {
                    ENUtils.ShowMessage(error);
                    return;
                }



                rptfrmCashAccStatement frm = new rptfrmCashAccStatement();

                frm.ReportType = this.reportType;
                frm.DataSource = GetDataSource(companyId, fromDate, tillDate);



                frm.DatePeriod = "For the Period : " + string.Format("{0:dd/MM/yyyy}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy}", tillDate);
                //   frm.StatementType = statementType;
                frm.GenerateReport();

                frm.SendEmail();
            }
            catch (Exception ex)
            {
            }
        }
        public override void Print()
        {
            try
            {
                int?     companyId = ddlCompany.SelectedValue.ToIntorNull();
                DateTime?fromDate  = dtpFromDate.Value.ToDate();
                DateTime?tillDate  = dtpTillDate.Value.ToDate();

                string error = string.Empty;

                if (companyId == null)
                {
                    error += "Required : Account";
                }

                if (fromDate == null)
                {
                    if (string.IsNullOrEmpty(error))
                    {
                        error += Environment.NewLine;
                    }

                    error += "Required : From Date";
                }

                if (tillDate == null)
                {
                    if (string.IsNullOrEmpty(error))
                    {
                        error += Environment.NewLine;
                    }

                    error += "Required : To Date";
                }

                if (!string.IsNullOrEmpty(error))
                {
                    ENUtils.ShowMessage(error);
                    return;
                }



                rptfrmCashAccStatement frm = new rptfrmCashAccStatement();

                frm.ReportType = this.reportType;
                frm.DataSource = GetDataSource(companyId, fromDate, tillDate);



                frm.DatePeriod = "For the Period : " + string.Format("{0:dd/MM/yyyy}", fromDate) + " to " + string.Format("{0:dd/MM/yyyy}", tillDate);
                //   frm.StatementType = statementType;
                frm.GenerateReport();

                DockWindow doc = UI.MainMenuForm.MainMenuFrm.GetDockByName("rptfrmCashAccStatement1");

                if (doc != null)
                {
                    doc.Close();
                }
                UI.MainMenuForm.MainMenuFrm.ShowForm(frm);
            }
            catch (Exception ex)
            {
            }
        }