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

            rpt.Site = this.Site;
            return(rpt);
        }
示例#2
0
        private void presentReportToolStripMenuItem_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 present='P' " + frm.orderby;
                conn.Open();
                cmd = new SqlCommand(stingadd1, conn);
                da  = new SqlDataAdapter(cmd);
                da.Fill(ds.tblAttendance);
                cmd.Dispose();
                da.Dispose();



                rptMonthlyPresentReport rpt = new rptMonthlyPresentReport();
                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");
                }
            }
        }