source: Scheduling/trunk/cs/bsdx0200GUISourceCode/DSelectLetterClinics.cs@ 781

Last change on this file since 781 was 772, checked in by Sam Habiel, 14 years ago

Removal of Crystal Reports
Partial Rework of Clinic Patient List report
Other reports that used Crystal don't work yet.
Fixes for Strongly typed DataTables (change the RESOURCEID from uint to int) to support table merge from untyped table.
Support for command line arguments: /s= for server /p= for port /a= for access code /v= for verify code
Only the following combinations work: none; /s and /p; /s, /p, /a, /v

File size: 12.2 KB
RevLine 
[614]1using System;
2using System.Drawing;
3using System.Collections;
4using System.ComponentModel;
5using System.Windows.Forms;
6using System.Data;
7
8namespace IndianHealthService.ClinicalScheduling
9{
10 /// <summary>
[772]11 /// Use this dialog to select resources and dates (begin and end) for their examination.
12 /// <example>
13 /// DSelectLetterClinics ds = new DSelectLetterClinics();
14 /// ds.InitializePage(this.m_DocManager.GlobalDataSet, "Print Clinic Cancellation Letters");
15 /// ds.ShowDialog(this)
16 ///
17 /// //get the resource names and call the letter printer
18 /// string sClinics = ds.SelectedClinics;
19 /// DateTime dtBegin = ds.BeginDate;
20 /// DateTime dtEnd = ds.EndDate;
21 /// </example>
[614]22 /// </summary>
[772]23 ///
[614]24 public class DSelectLetterClinics : System.Windows.Forms.Form
25 {
26 private System.Windows.Forms.Button cmdCancel;
27 private System.Windows.Forms.Button cmdOK;
28 private System.Windows.Forms.Panel pnlOkCancel;
29 private System.Windows.Forms.Panel pnlDescription;
30 private System.Windows.Forms.GroupBox grpDescription;
31 private System.Windows.Forms.Label lblDescription;
32 private System.Windows.Forms.CheckedListBox lstResource;
33 private System.Windows.Forms.ComboBox cboResourceGroup;
34 private System.Windows.Forms.Label label1;
35 private System.Windows.Forms.Label label2;
36 private System.Windows.Forms.Label label4;
37 private System.Windows.Forms.Label label5;
38 private System.Windows.Forms.DateTimePicker dtBegin;
39 private System.Windows.Forms.DateTimePicker dtEnd;
40 private System.Windows.Forms.Label lblRange;
41 private System.Windows.Forms.CheckBox chkSelectAll;
42 private System.ComponentModel.Container components = null;
43
[772]44 /// <summary>
45 /// Ctor; also sets default enter and cancel buttons
46 /// </summary>
47 public DSelectLetterClinics()
[614]48 {
49 InitializeComponent();
[772]50 this.AcceptButton = cmdOK;
51 this.CancelButton = cmdCancel;
[614]52 }
53
54 /// <summary>
55 /// Clean up any resources being used.
56 /// </summary>
57 protected override void Dispose( bool disposing )
58 {
59 if( disposing )
60 {
61 if(components != null)
62 {
63 components.Dispose();
64 }
65 }
66 base.Dispose( disposing );
67 }
68
69 #region Windows Form Designer generated code
70 /// <summary>
71 /// Required method for Designer support - do not modify
72 /// the contents of this method with the code editor.
73 /// </summary>
74 private void InitializeComponent()
75 {
76 this.pnlOkCancel = new System.Windows.Forms.Panel();
77 this.cmdCancel = new System.Windows.Forms.Button();
78 this.cmdOK = new System.Windows.Forms.Button();
79 this.pnlDescription = new System.Windows.Forms.Panel();
80 this.grpDescription = new System.Windows.Forms.GroupBox();
81 this.lblDescription = new System.Windows.Forms.Label();
82 this.lstResource = new System.Windows.Forms.CheckedListBox();
83 this.cboResourceGroup = new System.Windows.Forms.ComboBox();
84 this.label1 = new System.Windows.Forms.Label();
85 this.label2 = new System.Windows.Forms.Label();
86 this.dtBegin = new System.Windows.Forms.DateTimePicker();
87 this.dtEnd = new System.Windows.Forms.DateTimePicker();
88 this.lblRange = new System.Windows.Forms.Label();
89 this.label4 = new System.Windows.Forms.Label();
90 this.label5 = new System.Windows.Forms.Label();
91 this.chkSelectAll = new System.Windows.Forms.CheckBox();
92 this.pnlOkCancel.SuspendLayout();
93 this.pnlDescription.SuspendLayout();
94 this.grpDescription.SuspendLayout();
95 this.SuspendLayout();
96 //
97 // pnlOkCancel
98 //
99 this.pnlOkCancel.Controls.Add(this.cmdCancel);
100 this.pnlOkCancel.Controls.Add(this.cmdOK);
101 this.pnlOkCancel.Dock = System.Windows.Forms.DockStyle.Bottom;
102 this.pnlOkCancel.Location = new System.Drawing.Point(0, 430);
103 this.pnlOkCancel.Name = "pnlOkCancel";
104 this.pnlOkCancel.Size = new System.Drawing.Size(512, 40);
105 this.pnlOkCancel.TabIndex = 4;
106 //
107 // cmdCancel
108 //
109 this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
110 this.cmdCancel.Location = new System.Drawing.Point(416, 8);
111 this.cmdCancel.Name = "cmdCancel";
112 this.cmdCancel.Size = new System.Drawing.Size(64, 24);
113 this.cmdCancel.TabIndex = 1;
114 this.cmdCancel.Text = "Cancel";
115 //
116 // cmdOK
117 //
118 this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;
119 this.cmdOK.Location = new System.Drawing.Point(336, 8);
120 this.cmdOK.Name = "cmdOK";
121 this.cmdOK.Size = new System.Drawing.Size(64, 24);
122 this.cmdOK.TabIndex = 0;
123 this.cmdOK.Text = "OK";
124 //
125 // pnlDescription
126 //
127 this.pnlDescription.Controls.Add(this.grpDescription);
128 this.pnlDescription.Dock = System.Windows.Forms.DockStyle.Bottom;
129 this.pnlDescription.Location = new System.Drawing.Point(0, 350);
130 this.pnlDescription.Name = "pnlDescription";
131 this.pnlDescription.Size = new System.Drawing.Size(512, 80);
132 this.pnlDescription.TabIndex = 47;
133 //
134 // grpDescription
135 //
136 this.grpDescription.Controls.Add(this.lblDescription);
137 this.grpDescription.Dock = System.Windows.Forms.DockStyle.Fill;
138 this.grpDescription.Location = new System.Drawing.Point(0, 0);
139 this.grpDescription.Name = "grpDescription";
140 this.grpDescription.Size = new System.Drawing.Size(512, 80);
141 this.grpDescription.TabIndex = 0;
142 this.grpDescription.TabStop = false;
143 this.grpDescription.Text = "Description";
144 //
145 // lblDescription
146 //
147 this.lblDescription.Dock = System.Windows.Forms.DockStyle.Fill;
148 this.lblDescription.Location = new System.Drawing.Point(3, 16);
149 this.lblDescription.Name = "lblDescription";
150 this.lblDescription.Size = new System.Drawing.Size(506, 61);
151 this.lblDescription.TabIndex = 1;
152 this.lblDescription.Text = "Use this panel to select resources and to specify the time period for patient rem" +
153 "inder letters. Check each resource (clinic) for which to print letters. Letter" +
154 "s will be printed for appointments between the beginning and ending dates, inclu" +
155 "sive.";
156 //
157 // lstResource
158 //
159 this.lstResource.HorizontalScrollbar = true;
160 this.lstResource.Location = new System.Drawing.Point(24, 96);
161 this.lstResource.MultiColumn = true;
162 this.lstResource.Name = "lstResource";
163 this.lstResource.Size = new System.Drawing.Size(448, 124);
164 this.lstResource.TabIndex = 48;
165 //
166 // cboResourceGroup
167 //
168 this.cboResourceGroup.Location = new System.Drawing.Point(24, 40);
169 this.cboResourceGroup.Name = "cboResourceGroup";
170 this.cboResourceGroup.Size = new System.Drawing.Size(448, 21);
171 this.cboResourceGroup.TabIndex = 49;
172 this.cboResourceGroup.SelectedIndexChanged += new System.EventHandler(this.cboResourceGroup_SelectedIndexChanged);
173 //
174 // label1
175 //
176 this.label1.Location = new System.Drawing.Point(24, 16);
177 this.label1.Name = "label1";
178 this.label1.Size = new System.Drawing.Size(208, 16);
179 this.label1.TabIndex = 50;
180 this.label1.Text = "Resource Group:";
181 //
182 // label2
183 //
184 this.label2.Location = new System.Drawing.Point(24, 72);
185 this.label2.Name = "label2";
186 this.label2.Size = new System.Drawing.Size(72, 16);
187 this.label2.TabIndex = 51;
188 this.label2.Text = "Resource:";
189 //
190 // dtBegin
191 //
192 this.dtBegin.Location = new System.Drawing.Point(24, 312);
193 this.dtBegin.Name = "dtBegin";
194 this.dtBegin.TabIndex = 52;
195 //
196 // dtEnd
197 //
198 this.dtEnd.Location = new System.Drawing.Point(280, 312);
199 this.dtEnd.Name = "dtEnd";
200 this.dtEnd.Size = new System.Drawing.Size(192, 20);
201 this.dtEnd.TabIndex = 52;
202 //
203 // lblRange
204 //
205 this.lblRange.Location = new System.Drawing.Point(24, 272);
206 this.lblRange.Name = "lblRange";
207 this.lblRange.Size = new System.Drawing.Size(192, 16);
208 this.lblRange.TabIndex = 53;
209 this.lblRange.Text = "Date range for appointment letters:";
210 //
211 // label4
212 //
213 this.label4.Location = new System.Drawing.Point(24, 296);
214 this.label4.Name = "label4";
215 this.label4.Size = new System.Drawing.Size(152, 16);
216 this.label4.TabIndex = 54;
217 this.label4.Text = "Beginning Date:";
218 //
219 // label5
220 //
221 this.label5.Location = new System.Drawing.Point(280, 296);
222 this.label5.Name = "label5";
223 this.label5.Size = new System.Drawing.Size(152, 16);
224 this.label5.TabIndex = 54;
225 this.label5.Text = "Ending Date:";
226 //
227 // chkSelectAll
228 //
229 this.chkSelectAll.Location = new System.Drawing.Point(32, 232);
230 this.chkSelectAll.Name = "chkSelectAll";
231 this.chkSelectAll.Size = new System.Drawing.Size(168, 24);
232 this.chkSelectAll.TabIndex = 55;
233 this.chkSelectAll.Text = "Select All Resources";
234 this.chkSelectAll.CheckedChanged += new System.EventHandler(this.chkSelectAll_CheckedChanged);
235 //
236 // DSelectLetterClinics
237 //
238 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
239 this.ClientSize = new System.Drawing.Size(512, 470);
240 this.Controls.Add(this.chkSelectAll);
241 this.Controls.Add(this.label4);
242 this.Controls.Add(this.lblRange);
243 this.Controls.Add(this.dtBegin);
244 this.Controls.Add(this.label2);
245 this.Controls.Add(this.label1);
246 this.Controls.Add(this.cboResourceGroup);
247 this.Controls.Add(this.lstResource);
248 this.Controls.Add(this.pnlDescription);
249 this.Controls.Add(this.pnlOkCancel);
250 this.Controls.Add(this.dtEnd);
251 this.Controls.Add(this.label5);
252 this.Name = "DSelectLetterClinics";
253 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
254 this.Text = "Print Apppointment Letters";
255 this.pnlOkCancel.ResumeLayout(false);
256 this.pnlDescription.ResumeLayout(false);
257 this.grpDescription.ResumeLayout(false);
258 this.ResumeLayout(false);
259
260 }
261 #endregion
262
263 #region Methods
264
265 public void SetupForReports()
266 {
267 lblRange.Text = "Date Range for Appointment List:";
268 lblDescription.Text = "Use this panel to select resources and to specify the time period for appointment lists. Check each resource (clinic) for which to print lists. Lists will be printed for appointments between the beginning and ending dates, inclusive.";
269 this.Text = "Print Clinic Schedules";
270 }
271
272 public void InitializePage(DataSet dsGlobal, string sWindowText)
273 {
274 try
275 {
276 m_bInitialized = false;
277 this.Text = sWindowText;
278 m_dtResources = dsGlobal.Tables["GroupResources"];
279 m_dvResources = new DataView(m_dtResources);
280 m_dvResources.Sort = "RESOURCE_NAME ASC";
281 lstResource.DataSource = m_dvResources;
282 lstResource.DisplayMember = "RESOURCE_NAME";
283 lstResource.ValueMember = "RESOURCEID";
284
285 m_dtGroups = dsGlobal.Tables["ResourceGroup"];
286 m_dvGroups = new DataView(m_dtGroups);
287 m_dvGroups.Sort = "RESOURCE_GROUP ASC";
288 cboResourceGroup.DataSource = m_dvGroups;
289 cboResourceGroup.DisplayMember = "RESOURCE_GROUP";
290 cboResourceGroup.ValueMember = "RESOURCE_GROUPID";
291
292 m_dvResources.RowFilter = "RESOURCE_GROUPID = " + cboResourceGroup.SelectedValue;
293 m_bInitialized = true;
294 return;
295 }
296 catch(Exception ex)
297 {
298 throw ex;
299 }
300
301 }
302
303 private void cboResourceGroup_SelectedIndexChanged(object sender, System.EventArgs e)
304 {
305 if (m_bInitialized == true)
306 m_dvResources.RowFilter = "RESOURCE_GROUPID = " + cboResourceGroup.SelectedValue;
307 chkSelectAll.Checked = false;
308 }
309
310 private void chkSelectAll_CheckedChanged(object sender, System.EventArgs e)
311 {
312 for(int i=0; i < lstResource.Items.Count; i++)
313 {
314 lstResource.SetItemChecked(i, chkSelectAll.Checked);
315 }
316 }
317
318 #endregion Methods
319
320 #region Fields
321 private DataTable m_dtGroups;
322 private DataView m_dvGroups;
323 private DataTable m_dtResources;
324 private DataView m_dvResources;
325 private bool m_bInitialized;
326
327 #endregion Fields
328
329 #region Properties
330
331 /// <summary>
332 /// Returns the |-delimited string of selected resource id's
333 /// </summary>
334 public string SelectedClinics
335 {
336 get
337 {
338 string sRet = "";
339 foreach(DataRowView s in this.lstResource.CheckedItems)
340 {
341 sRet = sRet + s["RESOURCEID"].ToString() + "|";
342 }
343 return sRet;
344 }
345 }
346
347 public DateTime BeginDate
348 {
349 get
350 {
351 return dtBegin.Value;
352 }
353 }
354
355 public DateTime EndDate
356 {
357 get
358 {
359 return dtEnd.Value;
360 }
361 }
362 #endregion Properties
363
364
365 }
366}
Note: See TracBrowser for help on using the repository browser.