示例#1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rptBusstopInfo rpt = new rptBusstopInfo();

            rpt.Site = this.Site;
            return(rpt);
        }
 private void btnReport_Click(object sender, EventArgs e)
 {
     if (dataGridView1.RowCount > 0)
     {
         DataSet ds = Connection.GetDataSet("SELECT schoolname, schooladdress, schoolcity, schoolphone, affiliate_by, principal, registrationno, logoimage   From   tbl_school");
         ds.Tables.Add(Connection.GetDataTableFromDataGridView(dataGridView1));
         if (rdoBusStopDetail.Checked)
         {
             ds.WriteXmlSchema(@"" + Connection.GetAccessPathId() + @"Barcodes\a\StopDetail.xsd");
             rptBusstopInfo r = new rptBusstopInfo();
             r.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
             r.PrintOptions.PaperSize        = CrystalDecisions.Shared.PaperSize.PaperA4;
             r.SetDataSource(ds);
             ShowAllReports f = new ShowAllReports();
             f.Text = "Report";
             f.crystalReportViewer1.ReportSource = r;
             r.SetParameterValue("ReportTitle", "Bus Stop Details");
             f.Show();
         }
         else if (rdoClassWise.Checked)
         {
             ds.WriteXmlSchema(@"" + Connection.GetAccessPathId() + @"Barcodes\a\ListOfStudentByBus.xsd");
             rptBusstopClasswiseInfo r = new rptBusstopClasswiseInfo();
             r.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
             r.PrintOptions.PaperSize        = CrystalDecisions.Shared.PaperSize.PaperLetter;
             r.SetDataSource(ds);
             txtSearch.Text = "Search By Stop";
             ShowAllReports f = new ShowAllReports();
             f.Text = "Report";
             f.crystalReportViewer1.ReportSource = r;
             if (chkClassWise.Checked && !chkSection.Checked)
             {
                 r.SetParameterValue("ReportTitle", "Bus Stop Details For Class-" + cmbClass.Text);
             }
             else if (chkClassWise.Checked && chkSection.Checked)
             {
                 r.SetParameterValue("ReportTitle", "Bus Stop Details For Class-" + cmbClass.Text + "-" + cmbSection.Text);
             }
             else
             {
                 r.SetParameterValue("ReportTitle", "Student Stop Details ");
             }
             f.Show();
         }
     }
 }