- Timestamp:
- May 21, 2010, 9:03:45 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/cs/bsdx0200GUISourceCode/DPatientLetter.cs
r614 r772 1 1 using System; 2 using System.Drawing;3 using System.Collections;4 using System.ComponentModel;5 2 using System.Windows.Forms; 6 3 using System.Data; 7 using CrystalDecisions.Windows; 8 using CrystalDecisions.Shared; 9 using CrystalDecisions.CrystalReports.Engine; 10 using IndianHealthService.BMXNet; 4 using System.Drawing.Printing; 5 using System.Drawing; 11 6 12 7 namespace IndianHealthService.ClinicalScheduling … … 15 10 /// Summary description for DPatientLetter. 16 11 /// </summary> 17 public class DPatientLetter : System.Windows.Forms.Form 18 { 19 private CrystalDecisions.Windows.Forms.CrystalReportViewer crViewer1; 12 public class DPatientLetter : System.Windows.Forms.PrintPreviewDialog 13 { 20 14 /// <summary> 21 15 /// Required designer variable. 22 16 /// </summary> 23 private System.ComponentModel.Container components = null; 17 private System.ComponentModel.Container components = null; 18 private System.Drawing.Printing.PrintDocument printDocument1; 24 19 25 20 #region Fields 26 27 private string m_sBodyText; 21 DateTime _dtBegin, _dtEnd; //global fields to use in passing to printing method 22 int _currentResourcePrinting = 0; 23 int _currentApptPrinting = 0; 24 dsPatientApptDisplay2 _ds; 28 25 #endregion Fields 29 30 #region Properties31 32 public string BodyText33 {34 get35 {36 return m_sBodyText;37 }38 set39 {40 m_sBodyText = value;41 }42 }43 44 #endregion Properties45 46 public void InitializeForm(CGDocumentManager docManager, int nPatientID)47 {48 try49 {50 crViewer1.DisplayGroupTree = true;51 52 ClinicalScheduling.crPatientLetter cr = new crPatientLetter();53 string sSql = "BSDX PATIENT APPT DISPLAY^" + nPatientID.ToString();54 System.Data.DataSet ds = new System.Data.DataSet();55 DataTable dtAppt = docManager.RPMSDataTable(sSql, "PatientAppts");56 ds.Tables.Add(dtAppt.Copy());57 58 System.Data.DataTable dt =59 docManager.GlobalDataSet.Tables["Resources"].Copy();60 ds.Tables.Add(dt);61 62 cr.Database.Tables["PatientAppts"].SetDataSource(ds.Tables["PatientAppts"]);63 cr.Database.Tables["BSDXResource"].SetDataSource(ds.Tables["Resources"]);64 65 crViewer1.SelectionFormula = "{PatientAppts.ApptDate} >= CurrentDate";66 this.crViewer1.ReportSource = cr;67 68 }69 catch (Exception ex)70 {71 throw ex;72 }73 }74 26 75 27 public void InitializeFormClinicSchedule(CGDocumentManager docManager, … … 84 36 throw new Exception("At least one clinic must be selected."); 85 37 } 38 _dtBegin = dtBegin; 39 _dtEnd = dtEnd; 86 40 string sBegin = dtBegin.ToShortDateString(); 87 41 string sEnd = dtEnd.ToShortDateString(); 88 crViewer1.DisplayGroupTree = true;89 42 this.Text="Clinic Schedules"; 90 43 91 ClinicalScheduling.crAppointmentList cr = new crAppointmentList();92 44 string sSql = "BSDX CLINIC LETTERS^" + sClinicList + "^" + sBegin + "^" + sEnd; 93 94 DataTable dtAppt = docManager.RPMSDataTable(sSql, "PatientAppts"); 95 cr.Database.Tables["PatientAppts"].SetDataSource(dtAppt);96 97 this.crViewer1.ReportSource = cr;98 45 string sSql2 = "BSDX RESOURCE LETTERS^" + sClinicList; 46 47 _ds = new dsPatientApptDisplay2(); 48 _ds.BSDXResource.Merge(docManager.RPMSDataTable(sSql2, "Resources")); 49 _ds.PatientAppts.Merge(docManager.RPMSDataTable(sSql, "PatientAppts")); 50 } 99 51 catch (Exception ex) 100 52 { … … 113 65 throw new Exception("At least one clinic must be selected."); 114 66 } 115 crViewer1.DisplayGroupTree = true; 116 117 ClinicalScheduling.crRebookLetter cr = new crRebookLetter(); 67 68 System.Data.DataSet ds = new System.Data.DataSet(); 69 ds.Tables.Add(dtLetters.Copy()); 70 71 string sSql = "BSDX RESOURCE LETTERS^" + sClinicList; 72 DataTable dt = docManager.RPMSDataTable(sSql, "Resources"); 73 ds.Tables.Add(dt.Copy()); 74 } 75 catch (Exception ex) 76 { 77 throw ex; 78 } 79 } 80 81 public void InitializeFormCancellationLetters(CGDocumentManager docManager, 82 string sClinicList, 83 DataTable dtLetters) 84 { 85 try 86 { 87 if (sClinicList == "") 88 { 89 throw new Exception("At least one clinic must be selected."); 90 } 118 91 119 92 System.Data.DataSet ds = new System.Data.DataSet(); … … 123 96 DataTable dt = docManager.RPMSDataTable(sSql, "Resources"); 124 97 ds.Tables.Add(dt.Copy()); 125 126 cr.Database.Tables["PatientAppts"].SetDataSource(ds.Tables["PatientAppts"]);127 cr.Database.Tables["BSDXResource"].SetDataSource(ds.Tables["Resources"]);128 129 this.crViewer1.ReportSource = cr;130 131 }132 catch (Exception ex)133 {134 throw ex;135 }136 }137 138 public void InitializeFormCancellationLetters(CGDocumentManager docManager,139 string sClinicList,140 DataTable dtLetters)141 {142 try143 {144 if (sClinicList == "")145 {146 throw new Exception("At least one clinic must be selected.");147 }148 crViewer1.DisplayGroupTree = true;149 150 ClinicalScheduling.crCancelLetter cr = new crCancelLetter();151 152 System.Data.DataSet ds = new System.Data.DataSet();153 ds.Tables.Add(dtLetters.Copy());154 155 string sSql = "BSDX RESOURCE LETTERS^" + sClinicList;156 DataTable dt = docManager.RPMSDataTable(sSql, "Resources");157 ds.Tables.Add(dt.Copy());158 159 cr.Database.Tables["PatientAppts"].SetDataSource(ds.Tables["PatientAppts"]);160 cr.Database.Tables["BSDXResource"].SetDataSource(ds.Tables["Resources"]);161 162 this.crViewer1.ReportSource = cr;163 98 164 99 } … … 183 118 string sBegin = dtBegin.ToShortDateString(); 184 119 string sEnd = dtEnd.ToShortDateString(); 185 crViewer1.DisplayGroupTree = true; 186 187 ClinicalScheduling.crPatientLetter cr = new crPatientLetter(); 120 188 121 string sSql = "BSDX CLINIC LETTERS^" + sClinicList + "^" + sBegin + "^" + sEnd; 189 122 … … 195 128 DataTable dt = docManager.RPMSDataTable(sSql, "Resources"); 196 129 ds.Tables.Add(dt.Copy()); 197 198 cr.Database.Tables["PatientAppts"].SetDataSource(ds.Tables["PatientAppts"]);199 cr.Database.Tables["BSDXResource"].SetDataSource(ds.Tables["Resources"]);200 201 this.crViewer1.ReportSource = cr;202 130 203 131 } … … 243 171 private void InitializeComponent() 244 172 { 245 this.crViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer(); 246 this.SuspendLayout(); 247 // 248 // crViewer1 249 // 250 this.crViewer1.ActiveViewIndex = -1; 251 this.crViewer1.Dock = System.Windows.Forms.DockStyle.Fill; 252 this.crViewer1.Location = new System.Drawing.Point(0, 0); 253 this.crViewer1.Name = "crViewer1"; 254 this.crViewer1.ReportSource = null; 255 this.crViewer1.Size = new System.Drawing.Size(648, 398); 256 this.crViewer1.TabIndex = 0; 257 // 258 // DPatientLetter 259 // 260 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); 261 this.ClientSize = new System.Drawing.Size(648, 398); 262 this.Controls.Add(this.crViewer1); 263 this.Name = "DPatientLetter"; 264 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 265 this.Text = "Patient Letter"; 266 this.ResumeLayout(false); 173 this.printDocument1 = new System.Drawing.Printing.PrintDocument(); 174 this.SuspendLayout(); 175 // 176 // printDocument1 177 // 178 this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage); 179 // 180 // DPatientLetter 181 // 182 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); 183 this.ClientSize = new System.Drawing.Size(648, 398); 184 this.Document = this.printDocument1; 185 this.Name = "DPatientLetter"; 186 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 187 this.Text = "Patient Letter"; 188 this.ResumeLayout(false); 267 189 268 190 } 269 191 #endregion 192 193 private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) 194 { 195 // _currentResourcePrinting starts with zero. There will be at least this one. 196 ClinicalScheduling.Printing.PrintAppointments(_ds, e, _dtBegin, _dtEnd, 197 _currentResourcePrinting, ref _currentApptPrinting); 198 199 //If the printing routine says it needs more pages to print the appointments, 200 //return here and have it print again. 201 if (e.HasMorePages == true) return; 202 203 // if there are more resouces to print, increment. Setting HasMorePages to true 204 // calls this routine again, so printing will happen with the incremented _currentResourcePrinting 205 if (_currentResourcePrinting < _ds.BSDXResource.Rows.Count - 1) 206 { 207 _currentResourcePrinting++; 208 e.HasMorePages = true; 209 } 210 211 } 270 212 } 271 213 }
Note:
See TracChangeset
for help on using the changeset viewer.