public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            crTaxStatement rpt = new crTaxStatement();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void btnReport_Click(object sender, EventArgs e)
        {
            custCode  = txtCustCode.Text;
            _fromDate = Convert.ToDateTime(dtFromDate.Value.ToShortDateString());
            _toDate   = Convert.ToDateTime(dtToDate.Value.ToShortDateString());
            DataSet                        TaxDataSet                      = new DataSet();
            DataTable                      TaxStatement                    = new DataTable();
            DataTable                      BonusRightIPOSatement           = new DataTable();
            TaxStatementBAL                TaxStatementBAL                 = new TaxStatementBAL();
            crTaxStatement                 crTaxStatement                  = new crTaxStatement();
            crTaxStatementBonusIPO         crTaxStatementBonusRightIPO_Rpt = new crTaxStatementBonusIPO();
            frmPaymentReceiptSummaryViewer ReportViewer                    = new frmPaymentReceiptSummaryViewer();

            TaxDataSet = TaxStatementBAL.GetData(custCode, _fromDate, _toDate);
            if (TaxDataSet.Tables.Count == 3)
            {
                TaxStatement          = TaxDataSet.Tables[0];
                BonusRightIPOSatement = TaxDataSet.Tables[1];
            }
            crTaxStatement.DataSourceConnections.Clear();
            crTaxStatement.SetDataSource(TaxStatement);
            crTaxStatement.Subreports["crTaxStatementBonusIPO.rpt"].DataSourceConnections.Clear();
            crTaxStatement.Subreports["crTaxStatementBonusIPO.rpt"].SetDataSource(BonusRightIPOSatement);
            GetCommonInfo();
            ((TextObject)crTaxStatement.ReportDefinition.Sections[1].ReportObjects["txtCompanyName"]).Text = _CommpanyName;
            ((TextObject)crTaxStatement.ReportDefinition.Sections[1].ReportObjects["txtBranchName"]).Text  = "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber;
            ((TextObject)crTaxStatement.ReportDefinition.Sections[2].ReportObjects["txtFromDate"]).Text    = dtFromDate.Value.ToString("dd/MM/yyyy");
            ((TextObject)crTaxStatement.ReportDefinition.Sections[2].ReportObjects["txtToDate"]).Text      = dtToDate.Value.ToString("dd/MM/yyyy");

            ReportViewer.crystalReportViewer1.DisplayGroupTree = false;
            ReportViewer.crystalReportViewer1.ReportSource     = crTaxStatement;

            ReportViewer.Show();
        }
        private void btnGrnerateReport_Click(object sender, EventArgs e)
        {
            if (rdbTaxCertificate.Checked == true)
            {
                if (txtCustCode.Text.Trim() != "")
                {
                    if (_reportNo == "1")
                    {
                        ShowCustTaxStatement();
                    }
                    else
                    {
                        ShowCustMoneyLedgerReport();
                    }
                }
                else
                {
                    MessageBox.Show("Select a customer first.", "Warning!");
                }
            }
            if (rdbTaxStatement.Checked == true)
            {
                custCode  = txtCustCode.Text;
                _fromDate = Convert.ToDateTime(dtFromDate.Value.ToShortDateString());
                _toDate   = Convert.ToDateTime(dtToDate.Value.ToShortDateString());
                DataSet                        TaxDataSet                      = new DataSet();
                DataTable                      TaxStatement                    = new DataTable();
                DataTable                      BonusRightIPOSatement           = new DataTable();
                DataTable                      TaxStatementSummary             = new DataTable();
                TaxStatementBAL                TaxStatementBAL                 = new TaxStatementBAL();
                crTaxStatement                 crTaxStatement                  = new crTaxStatement();
                crTaxStatementBonusIPO         crTaxStatementBonusRightIPO_Rpt = new crTaxStatementBonusIPO();
                crTaxStatementSummarySubReport crTaxStatementSummarySubReport  = new crTaxStatementSummarySubReport();
                frmPaymentReceiptSummaryViewer ReportViewer                    = new frmPaymentReceiptSummaryViewer();

                RecordLevelFilteringBAL obj = new RecordLevelFilteringBAL(ResourceName.Tax_TaxStatement);
                string T_Custcode           = obj.FilterCustCode(_custCode, ResourceName.Tax_TaxStatement);
                if (T_Custcode == "")
                {
                    MessageBox.Show("You are restricted");
                    return;
                }

                TaxDataSet = TaxStatementBAL.GetData(custCode, _fromDate, _toDate);

                if (TaxDataSet.Tables.Count > 3)
                {
                    TaxStatement          = TaxDataSet.Tables[0];
                    BonusRightIPOSatement = TaxDataSet.Tables[1];
                    TaxStatementSummary   = TaxDataSet.Tables[3];
                }

                crTaxStatement.DataSourceConnections.Clear();
                crTaxStatement.SetDataSource(TaxStatement);
                crTaxStatement.Subreports["crTaxStatementBonusIPO.rpt"].DataSourceConnections.Clear();
                crTaxStatement.Subreports["crTaxStatementBonusIPO.rpt"].SetDataSource(BonusRightIPOSatement);
                crTaxStatement.Subreports["crTaxStatementSummarySubReport.rpt"].DataSourceConnections.Clear();
                crTaxStatement.Subreports["crTaxStatementSummarySubReport.rpt"].SetDataSource(TaxStatementSummary);



                GetCommonInfo();
                ((TextObject)crTaxStatement.ReportDefinition.Sections[1].ReportObjects["txtCompanyName"]).Text = _CommpanyName;
                ((TextObject)crTaxStatement.ReportDefinition.Sections[1].ReportObjects["txtBranchName"]).Text  = "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber;
                ((TextObject)crTaxStatement.ReportDefinition.Sections[2].ReportObjects["txtFromDate"]).Text    = dtFromDate.Value.ToString("dd/MM/yyyy");
                ((TextObject)crTaxStatement.ReportDefinition.Sections[2].ReportObjects["txtToDate"]).Text      = dtToDate.Value.ToString("dd/MM/yyyy");
                ((TextObject)crTaxStatement.Subreports["crTaxStatementSummarySubReport.rpt"].ReportDefinition.Sections[2].ReportObjects["txtFromDate"]).Text = _fromDate.ToString("dd-MM-yyyy");
                ((TextObject)crTaxStatement.Subreports["crTaxStatementSummarySubReport.rpt"].ReportDefinition.Sections[2].ReportObjects["txtToDate"]).Text   = _toDate.ToString("dd-MM-yyyy");

                ReportViewer.crystalReportViewer1.DisplayGroupTree = false;
                ReportViewer.crystalReportViewer1.ReportSource     = crTaxStatement;

                ReportViewer.Show();
            }
        }