public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { Visit_Report rpt = new Visit_Report(); rpt.Site = this.Site; return(rpt); }
async void visit_Report() { DataClasses1DataContext db = new DataClasses1DataContext(Properties.Settings.Default.MyConString); DataTable dt = new ds_report1.sp_visitReportDataTable(); Visit_Report rpt = new Visit_Report(); await Task.Run(() => { var list = db.sp_visitReport(this.Tag.ToString()).ToList(); foreach (var i in list) { DateTime TimeIn = DateTime.Parse(i.trans_date); dt.Rows.Add(i.papin, i.PatientName, i.gender, i.pxtype, TimeIn.ToShortDateString() + " " + TimeIn.ToShortTimeString(), i.diagnosis); } this.Invoke(new Action(() => { rpt.SetDataSource(dt); })); TextObject txt_printRange = (TextObject)rpt.ReportDefinition.ReportObjects["txt_printRange"]; txt_printRange.Text = "Date Range From " + Convert.ToDateTime(this.Tag.ToString()).ToShortDateString() + " - " + Convert.ToDateTime(this.Tag.ToString()).ToShortDateString(); }); this.visit_reportViewer.ReportSource = rpt; RemoveTab(visit_reportViewer); }