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

            rpt.Site = this.Site;
            return(rpt);
        }
Example #2
0
        private void attendanceReportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmReportOrderBy frm = new frmReportOrderBy("M");

            frm.ShowDialog();
            if (frm.orderby != "")
            {
                SqlConnection  conn = new SqlConnection(RayedoxVariables.connectionstring);
                SqlCommand     cmd;
                SqlDataAdapter da;
                DataSet1       ds        = new DataSet1();
                string         stingadd1 = "select * from view_attendance where 1=1" + frm.orderby;
                conn.Open();
                cmd = new SqlCommand(stingadd1, conn);
                da  = new SqlDataAdapter(cmd);
                da.Fill(ds.tblAttendance);
                cmd.Dispose();
                da.Dispose();



                rptMonthlyAttendanceReport rpt = new rptMonthlyAttendanceReport();
                rpt.SetDataSource(ds);


                crystalReportViewer1.ReportSource = rpt;
                crystalReportViewer1.RefreshReport();

                cmd.Dispose();
                da.Dispose();
                conn.Close();
                try
                {
                    try
                    {
                        rpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Text, "D:\\Rayedoxreport.txt" + ".txt");
                    }
                    catch
                    {
                        rpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Text, "E:\\Rayedoxreport.txt" + ".txt");
                    }
                }
                catch
                {
                    rpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Text, "F:\\Rayedoxreport.txt" + ".txt");
                }
            }
        }