public void PrintData() { if (sql != null) { TotalFee = totalFeeLbl.Text; sql.HastaİslemleriPrintData(); DataTable dt = new DataTable(); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Surname", typeof(string)); dt.Columns.Add("Polyclinic", typeof(string)); dt.Columns.Add("QueueNumber", typeof(string)); dt.Columns.Add("Hour", typeof(string)); dt.Columns.Add("ProcessTodo", typeof(string)); dt.Columns.Add("DrCode", typeof(string)); dt.Columns.Add("Unit", typeof(string)); dt.Columns.Add("UnitFee", typeof(string)); dt.Columns.Add("TotalFee", typeof(string)); dt.Columns.Add("DoctorName", typeof(string)); dt.Columns.Add("DispatchDate", typeof(string)); dt.Rows.Add(PatientName, PatientSurname, Polyclinic, QueueNumber, Hour, ProcessToDo, DoctorCode, Unit, UnitFee, TotalFee, DoctorName, DispatchDate.ToShortDateString()); PrintReport pReport = new PrintReport(); pReport.Database.Tables["PrintTable"].SetDataSource(dt); CrystalReport creport = new CrystalReport(); creport.crystalReportViewer1.ReportSource = pReport; creport.Show(); } }
private void printBtn_Click(object sender, EventArgs e) { if (dataGridView1.Rows.Count == 1 || dataGridView1.Rows.Count == 0) { MessageBox.Show("Yazdırılacak bir şey bulunamadı!"); } else { reportform1 form1printdata = new reportform1(); form1printdata.SetDataSource(sql.Form1loadData()); CrystalReport creport = new CrystalReport(); creport.crystalReportViewer1.ReportSource = form1printdata; creport.Show(); } }