source: Scheduling/trunk/cs/bsdx0200GUISourceCode/DPatientLetter.cs@ 732

Last change on this file since 732 was 614, checked in by Sam Habiel, 15 years ago

Initial committ of scheduling package

File size: 7.1 KB
RevLine 
[614]1using System;
2using System.Drawing;
3using System.Collections;
4using System.ComponentModel;
5using System.Windows.Forms;
6using System.Data;
7using CrystalDecisions.Windows;
8using CrystalDecisions.Shared;
9using CrystalDecisions.CrystalReports.Engine;
10using IndianHealthService.BMXNet;
11
12namespace IndianHealthService.ClinicalScheduling
13{
14 /// <summary>
15 /// Summary description for DPatientLetter.
16 /// </summary>
17 public class DPatientLetter : System.Windows.Forms.Form
18 {
19 private CrystalDecisions.Windows.Forms.CrystalReportViewer crViewer1;
20 /// <summary>
21 /// Required designer variable.
22 /// </summary>
23 private System.ComponentModel.Container components = null;
24
25 #region Fields
26
27 private string m_sBodyText;
28 #endregion Fields
29
30 #region Properties
31
32 public string BodyText
33 {
34 get
35 {
36 return m_sBodyText;
37 }
38 set
39 {
40 m_sBodyText = value;
41 }
42 }
43
44 #endregion Properties
45
46 public void InitializeForm(CGDocumentManager docManager, int nPatientID)
47 {
48 try
49 {
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
75 public void InitializeFormClinicSchedule(CGDocumentManager docManager,
76 string sClinicList,
77 DateTime dtBegin,
78 DateTime dtEnd)
79 {
80 try
81 {
82 if (sClinicList == "")
83 {
84 throw new Exception("At least one clinic must be selected.");
85 }
86 string sBegin = dtBegin.ToShortDateString();
87 string sEnd = dtEnd.ToShortDateString();
88 crViewer1.DisplayGroupTree = true;
89 this.Text="Clinic Schedules";
90
91 ClinicalScheduling.crAppointmentList cr = new crAppointmentList();
92 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 }
99 catch (Exception ex)
100 {
101 throw ex;
102 }
103 }
104
105 public void InitializeFormRebookLetters(CGDocumentManager docManager,
106 string sClinicList,
107 DataTable dtLetters)
108 {
109 try
110 {
111 if (sClinicList == "")
112 {
113 throw new Exception("At least one clinic must be selected.");
114 }
115 crViewer1.DisplayGroupTree = true;
116
117 ClinicalScheduling.crRebookLetter cr = new crRebookLetter();
118
119 System.Data.DataSet ds = new System.Data.DataSet();
120 ds.Tables.Add(dtLetters.Copy());
121
122 string sSql = "BSDX RESOURCE LETTERS^" + sClinicList;
123 DataTable dt = docManager.RPMSDataTable(sSql, "Resources");
124 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 try
143 {
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
164 }
165 catch (Exception ex)
166 {
167 throw ex;
168 }
169 }
170
171 public void InitializeFormClinicLetters(CGDocumentManager docManager,
172 string sClinicList,
173 DateTime dtBegin,
174 DateTime dtEnd)
175 {
176 try
177 {
178 if (sClinicList == "")
179 {
180 throw new Exception("At least one clinic must be selected.");
181 }
182
183 string sBegin = dtBegin.ToShortDateString();
184 string sEnd = dtEnd.ToShortDateString();
185 crViewer1.DisplayGroupTree = true;
186
187 ClinicalScheduling.crPatientLetter cr = new crPatientLetter();
188 string sSql = "BSDX CLINIC LETTERS^" + sClinicList + "^" + sBegin + "^" + sEnd;
189
190 System.Data.DataSet ds = new System.Data.DataSet();
191 DataTable dtAppt = docManager.RPMSDataTable(sSql, "PatientAppts");
192 ds.Tables.Add(dtAppt.Copy());
193
194 sSql = "BSDX RESOURCE LETTERS^" + sClinicList;
195 DataTable dt = docManager.RPMSDataTable(sSql, "Resources");
196 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
203 }
204 catch (Exception ex)
205 {
206 throw ex;
207 }
208 }
209
210
211 public DPatientLetter()
212 {
213 //
214 // Required for Windows Form Designer support
215 //
216 InitializeComponent();
217
218 //
219 // TODO: Add any constructor code after InitializeComponent call
220 //
221 }
222
223 /// <summary>
224 /// Clean up any resources being used.
225 /// </summary>
226 protected override void Dispose( bool disposing )
227 {
228 if( disposing )
229 {
230 if(components != null)
231 {
232 components.Dispose();
233 }
234 }
235 base.Dispose( disposing );
236 }
237
238 #region Windows Form Designer generated code
239 /// <summary>
240 /// Required method for Designer support - do not modify
241 /// the contents of this method with the code editor.
242 /// </summary>
243 private void InitializeComponent()
244 {
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);
267
268 }
269 #endregion
270 }
271}
Note: See TracBrowser for help on using the repository browser.