source: Scheduling/trunk/cs/bsdx0200GUISourceCode/DAppointPage.cs

Last change on this file was 1728, checked in by Faisal Sami, 9 years ago

ClinicalScheduling version 2.0.

File size: 61.4 KB
Line 
1using System;
2using System.Drawing;
3using System.Collections;
4using System.ComponentModel;
5using System.Windows.Forms;
6using System.Data;
7using System.Collections.Generic;
8//using System.Data.OleDb;
9using System.Diagnostics;
10using IndianHealthService.BMXNet;
11
12namespace IndianHealthService.ClinicalScheduling
13{
14 /// <summary>
15 /// Appointment Info Dialog
16 /// </summary>
17 public class DAppointPage : System.Windows.Forms.Form
18 {
19 private System.Windows.Forms.TabControl tabControl1;
20 private System.Windows.Forms.TabPage tabPatientInfo;
21 private System.Windows.Forms.TabPage tabAppointment;
22 private System.Windows.Forms.Panel panel1;
23 private System.Windows.Forms.Button cmdOK;
24 private System.Windows.Forms.Button cmdCancel;
25 private System.Windows.Forms.GroupBox groupBox2;
26 private System.Windows.Forms.TextBox txtCity;
27 private System.Windows.Forms.Label label8;
28 private System.Windows.Forms.Label label9;
29 private System.Windows.Forms.TextBox txtZip;
30 private System.Windows.Forms.Label label10;
31 private System.Windows.Forms.TextBox txtState;
32 private System.Windows.Forms.Label label11;
33 private System.Windows.Forms.TextBox txtStreet;
34 private System.Windows.Forms.Label label12;
35 private System.Windows.Forms.TextBox txtPhoneOffice;
36 private System.Windows.Forms.Label label13;
37 private System.Windows.Forms.TextBox txtPhoneHome;
38 private System.Windows.Forms.GroupBox groupBox1;
39 private System.Windows.Forms.Label label6;
40 private System.Windows.Forms.TextBox txtPID;
41 private System.Windows.Forms.Label label5;
42 private System.Windows.Forms.TextBox txtDOB;
43 private System.Windows.Forms.Label label2;
44 private System.Windows.Forms.TextBox txtPatientName;
45 private System.Windows.Forms.GroupBox groupBox3;
46 private System.Windows.Forms.Label lblClinic;
47 private System.Windows.Forms.Label label15;
48 private System.Windows.Forms.TextBox txtNote;
49 private System.Windows.Forms.Label label1;
50 private System.Windows.Forms.Label lblDuration;
51 private System.Windows.Forms.Label lblStartTime;
52 private System.Windows.Forms.Label label4;
53 private System.Windows.Forms.Label label3;
54 private System.Windows.Forms.Label label14;
55 private System.Windows.Forms.TextBox txtHRN;
56 private GroupBox groupBox4;
57 private BindingSource dsPatientApptDisplay2BindingSource;
58 private dsPatientApptDisplay2 dsPatientApptDisplay2;
59 private BindingSource patientApptsBindingSource;
60 private Label label17;
61 private TextBox txtEmail;
62 private Label label16;
63 private TextBox txtPhoneCell;
64 private Label label7;
65 private TextBox txtCountry;
66 private CheckBox chkPrint;
67 private Label label18;
68 private TextBox txtSex;
69 private TabPage tabCloneForward;
70 private GroupBox grpCloneForward;
71 private Button button1;
72 private ComboBox cboDuration;
73 private TextBox txtFUOther;
74 private Label label21;
75 private RadioButton rdbFU90;
76 private RadioButton rdbFU60;
77 private RadioButton rdbFU30;
78 private Label label19;
79 private DateTimePicker dtCloneAppointment;
80 private ComboBox cboSlots;
81 private Label label25;
82 private Label label24;
83 private Label txtClinic;
84 private TextBox textBox1;
85 private Label label20;
86 private Label label22;
87 private Label label23;
88 private IContainer components;
89
90 public DAppointPage()
91 {
92 InitializeComponent();
93 }
94
95 #region Windows Form Designer generated code
96 /// <summary>
97 /// Required method for Designer support - do not modify
98 /// the contents of this method with the code editor.
99 /// </summary>
100 private void InitializeComponent()
101 {
102 this.components = new System.ComponentModel.Container();
103 this.tabControl1 = new System.Windows.Forms.TabControl();
104 this.tabAppointment = new System.Windows.Forms.TabPage();
105 this.groupBox4 = new System.Windows.Forms.GroupBox();
106 this.groupBox3 = new System.Windows.Forms.GroupBox();
107 this.lblClinic = new System.Windows.Forms.Label();
108 this.label15 = new System.Windows.Forms.Label();
109 this.txtNote = new System.Windows.Forms.TextBox();
110 this.label1 = new System.Windows.Forms.Label();
111 this.lblDuration = new System.Windows.Forms.Label();
112 this.lblStartTime = new System.Windows.Forms.Label();
113 this.label4 = new System.Windows.Forms.Label();
114 this.label3 = new System.Windows.Forms.Label();
115 this.groupBox1 = new System.Windows.Forms.GroupBox();
116 this.txtSex = new System.Windows.Forms.TextBox();
117 this.label18 = new System.Windows.Forms.Label();
118 this.label14 = new System.Windows.Forms.Label();
119 this.txtHRN = new System.Windows.Forms.TextBox();
120 this.label6 = new System.Windows.Forms.Label();
121 this.txtPID = new System.Windows.Forms.TextBox();
122 this.label5 = new System.Windows.Forms.Label();
123 this.txtDOB = new System.Windows.Forms.TextBox();
124 this.label2 = new System.Windows.Forms.Label();
125 this.txtPatientName = new System.Windows.Forms.TextBox();
126 this.tabCloneForward = new System.Windows.Forms.TabPage();
127 this.grpCloneForward = new System.Windows.Forms.GroupBox();
128 this.button1 = new System.Windows.Forms.Button();
129 this.cboDuration = new System.Windows.Forms.ComboBox();
130 this.txtFUOther = new System.Windows.Forms.TextBox();
131 this.label21 = new System.Windows.Forms.Label();
132 this.rdbFU90 = new System.Windows.Forms.RadioButton();
133 this.rdbFU60 = new System.Windows.Forms.RadioButton();
134 this.rdbFU30 = new System.Windows.Forms.RadioButton();
135 this.label19 = new System.Windows.Forms.Label();
136 this.dtCloneAppointment = new System.Windows.Forms.DateTimePicker();
137 this.cboSlots = new System.Windows.Forms.ComboBox();
138 this.label25 = new System.Windows.Forms.Label();
139 this.label24 = new System.Windows.Forms.Label();
140 this.txtClinic = new System.Windows.Forms.Label();
141 this.textBox1 = new System.Windows.Forms.TextBox();
142 this.label20 = new System.Windows.Forms.Label();
143 this.label22 = new System.Windows.Forms.Label();
144 this.label23 = new System.Windows.Forms.Label();
145 this.tabPatientInfo = new System.Windows.Forms.TabPage();
146 this.groupBox2 = new System.Windows.Forms.GroupBox();
147 this.label17 = new System.Windows.Forms.Label();
148 this.txtEmail = new System.Windows.Forms.TextBox();
149 this.label16 = new System.Windows.Forms.Label();
150 this.txtPhoneCell = new System.Windows.Forms.TextBox();
151 this.label7 = new System.Windows.Forms.Label();
152 this.txtCountry = new System.Windows.Forms.TextBox();
153 this.label12 = new System.Windows.Forms.Label();
154 this.txtPhoneOffice = new System.Windows.Forms.TextBox();
155 this.label13 = new System.Windows.Forms.Label();
156 this.txtPhoneHome = new System.Windows.Forms.TextBox();
157 this.txtCity = new System.Windows.Forms.TextBox();
158 this.label8 = new System.Windows.Forms.Label();
159 this.label9 = new System.Windows.Forms.Label();
160 this.txtZip = new System.Windows.Forms.TextBox();
161 this.label10 = new System.Windows.Forms.Label();
162 this.txtState = new System.Windows.Forms.TextBox();
163 this.label11 = new System.Windows.Forms.Label();
164 this.txtStreet = new System.Windows.Forms.TextBox();
165 this.panel1 = new System.Windows.Forms.Panel();
166 this.chkPrint = new System.Windows.Forms.CheckBox();
167 this.cmdCancel = new System.Windows.Forms.Button();
168 this.cmdOK = new System.Windows.Forms.Button();
169 this.patientApptsBindingSource = new System.Windows.Forms.BindingSource(this.components);
170 this.dsPatientApptDisplay2BindingSource = new System.Windows.Forms.BindingSource(this.components);
171 this.dsPatientApptDisplay2 = new IndianHealthService.ClinicalScheduling.dsPatientApptDisplay2();
172 this.tabControl1.SuspendLayout();
173 this.tabAppointment.SuspendLayout();
174 this.groupBox3.SuspendLayout();
175 this.groupBox1.SuspendLayout();
176 this.tabCloneForward.SuspendLayout();
177 this.grpCloneForward.SuspendLayout();
178 this.tabPatientInfo.SuspendLayout();
179 this.groupBox2.SuspendLayout();
180 this.panel1.SuspendLayout();
181 ((System.ComponentModel.ISupportInitialize)(this.patientApptsBindingSource)).BeginInit();
182 ((System.ComponentModel.ISupportInitialize)(this.dsPatientApptDisplay2BindingSource)).BeginInit();
183 ((System.ComponentModel.ISupportInitialize)(this.dsPatientApptDisplay2)).BeginInit();
184 this.SuspendLayout();
185 //
186 // tabControl1
187 //
188 this.tabControl1.Controls.Add(this.tabAppointment);
189 this.tabControl1.Controls.Add(this.tabCloneForward);
190 this.tabControl1.Controls.Add(this.tabPatientInfo);
191 this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
192 this.tabControl1.Location = new System.Drawing.Point(0, 0);
193 this.tabControl1.Name = "tabControl1";
194 this.tabControl1.SelectedIndex = 0;
195 this.tabControl1.Size = new System.Drawing.Size(475, 524);
196 this.tabControl1.TabIndex = 0;
197 //
198 // tabAppointment
199 //
200 this.tabAppointment.Controls.Add(this.groupBox4);
201 this.tabAppointment.Controls.Add(this.groupBox3);
202 this.tabAppointment.Controls.Add(this.groupBox1);
203 this.tabAppointment.Location = new System.Drawing.Point(4, 22);
204 this.tabAppointment.Name = "tabAppointment";
205 this.tabAppointment.Size = new System.Drawing.Size(467, 498);
206 this.tabAppointment.TabIndex = 1;
207 this.tabAppointment.Text = "Appointment";
208 //
209 // groupBox4
210 //
211 this.groupBox4.Location = new System.Drawing.Point(8, 254);
212 this.groupBox4.Name = "groupBox4";
213 this.groupBox4.Size = new System.Drawing.Size(439, 204);
214 this.groupBox4.TabIndex = 14;
215 this.groupBox4.TabStop = false;
216 this.groupBox4.Text = "Other Appointments";
217 //
218 // groupBox3
219 //
220 this.groupBox3.Controls.Add(this.lblClinic);
221 this.groupBox3.Controls.Add(this.label15);
222 this.groupBox3.Controls.Add(this.txtNote);
223 this.groupBox3.Controls.Add(this.label1);
224 this.groupBox3.Controls.Add(this.lblDuration);
225 this.groupBox3.Controls.Add(this.lblStartTime);
226 this.groupBox3.Controls.Add(this.label4);
227 this.groupBox3.Controls.Add(this.label3);
228 this.groupBox3.Location = new System.Drawing.Point(8, 107);
229 this.groupBox3.Name = "groupBox3";
230 this.groupBox3.Size = new System.Drawing.Size(439, 141);
231 this.groupBox3.TabIndex = 13;
232 this.groupBox3.TabStop = false;
233 this.groupBox3.Text = "Appointment";
234 //
235 // lblClinic
236 //
237 this.lblClinic.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
238 this.lblClinic.Location = new System.Drawing.Point(200, 48);
239 this.lblClinic.Name = "lblClinic";
240 this.lblClinic.Size = new System.Drawing.Size(233, 16);
241 this.lblClinic.TabIndex = 19;
242 //
243 // label15
244 //
245 this.label15.Location = new System.Drawing.Point(152, 48);
246 this.label15.Name = "label15";
247 this.label15.Size = new System.Drawing.Size(40, 16);
248 this.label15.TabIndex = 18;
249 this.label15.Text = "Clinic:";
250 this.label15.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
251 //
252 // txtNote
253 //
254 this.txtNote.AcceptsReturn = true;
255 this.txtNote.Location = new System.Drawing.Point(80, 72);
256 this.txtNote.Multiline = true;
257 this.txtNote.Name = "txtNote";
258 this.txtNote.Size = new System.Drawing.Size(353, 60);
259 this.txtNote.TabIndex = 17;
260 //
261 // label1
262 //
263 this.label1.Location = new System.Drawing.Point(4, 80);
264 this.label1.Name = "label1";
265 this.label1.Size = new System.Drawing.Size(56, 16);
266 this.label1.TabIndex = 16;
267 this.label1.Text = "Notes:";
268 this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
269 //
270 // lblDuration
271 //
272 this.lblDuration.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
273 this.lblDuration.Location = new System.Drawing.Point(80, 48);
274 this.lblDuration.Name = "lblDuration";
275 this.lblDuration.Size = new System.Drawing.Size(56, 16);
276 this.lblDuration.TabIndex = 15;
277 //
278 // lblStartTime
279 //
280 this.lblStartTime.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
281 this.lblStartTime.Location = new System.Drawing.Point(80, 24);
282 this.lblStartTime.Name = "lblStartTime";
283 this.lblStartTime.Size = new System.Drawing.Size(353, 16);
284 this.lblStartTime.TabIndex = 14;
285 //
286 // label4
287 //
288 this.label4.Location = new System.Drawing.Point(16, 48);
289 this.label4.Name = "label4";
290 this.label4.Size = new System.Drawing.Size(56, 16);
291 this.label4.TabIndex = 13;
292 this.label4.Text = "Duration:";
293 this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
294 //
295 // label3
296 //
297 this.label3.Location = new System.Drawing.Point(8, 24);
298 this.label3.Name = "label3";
299 this.label3.Size = new System.Drawing.Size(64, 16);
300 this.label3.TabIndex = 12;
301 this.label3.Text = "Start Time:";
302 this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
303 //
304 // groupBox1
305 //
306 this.groupBox1.Controls.Add(this.txtSex);
307 this.groupBox1.Controls.Add(this.label18);
308 this.groupBox1.Controls.Add(this.label14);
309 this.groupBox1.Controls.Add(this.txtHRN);
310 this.groupBox1.Controls.Add(this.label6);
311 this.groupBox1.Controls.Add(this.txtPID);
312 this.groupBox1.Controls.Add(this.label5);
313 this.groupBox1.Controls.Add(this.txtDOB);
314 this.groupBox1.Controls.Add(this.label2);
315 this.groupBox1.Controls.Add(this.txtPatientName);
316 this.groupBox1.Location = new System.Drawing.Point(8, 8);
317 this.groupBox1.Name = "groupBox1";
318 this.groupBox1.Size = new System.Drawing.Size(439, 93);
319 this.groupBox1.TabIndex = 12;
320 this.groupBox1.TabStop = false;
321 this.groupBox1.Text = "Patient ID";
322 //
323 // txtSex
324 //
325 this.txtSex.BackColor = System.Drawing.SystemColors.Control;
326 this.txtSex.Location = new System.Drawing.Point(273, 41);
327 this.txtSex.Name = "txtSex";
328 this.txtSex.ReadOnly = true;
329 this.txtSex.Size = new System.Drawing.Size(160, 20);
330 this.txtSex.TabIndex = 15;
331 //
332 // label18
333 //
334 this.label18.AutoSize = true;
335 this.label18.Location = new System.Drawing.Point(238, 44);
336 this.label18.Name = "label18";
337 this.label18.Size = new System.Drawing.Size(28, 13);
338 this.label18.TabIndex = 14;
339 this.label18.Text = "Sex:";
340 //
341 // label14
342 //
343 this.label14.Location = new System.Drawing.Point(50, 64);
344 this.label14.Name = "label14";
345 this.label14.Size = new System.Drawing.Size(40, 16);
346 this.label14.TabIndex = 13;
347 this.label14.Text = "HRN:";
348 this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
349 //
350 // txtHRN
351 //
352 this.txtHRN.Location = new System.Drawing.Point(96, 64);
353 this.txtHRN.Name = "txtHRN";
354 this.txtHRN.ReadOnly = true;
355 this.txtHRN.Size = new System.Drawing.Size(120, 20);
356 this.txtHRN.TabIndex = 12;
357 //
358 // label6
359 //
360 this.label6.Location = new System.Drawing.Point(227, 65);
361 this.label6.Name = "label6";
362 this.label6.Size = new System.Drawing.Size(40, 16);
363 this.label6.TabIndex = 9;
364 this.label6.Text = "ID:";
365 this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
366 //
367 // txtPID
368 //
369 this.txtPID.Location = new System.Drawing.Point(272, 63);
370 this.txtPID.Name = "txtPID";
371 this.txtPID.ReadOnly = true;
372 this.txtPID.Size = new System.Drawing.Size(161, 20);
373 this.txtPID.TabIndex = 8;
374 //
375 // label5
376 //
377 this.label5.Location = new System.Drawing.Point(58, 41);
378 this.label5.Name = "label5";
379 this.label5.Size = new System.Drawing.Size(32, 16);
380 this.label5.TabIndex = 7;
381 this.label5.Text = "DOB:";
382 this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
383 //
384 // txtDOB
385 //
386 this.txtDOB.Location = new System.Drawing.Point(96, 40);
387 this.txtDOB.Name = "txtDOB";
388 this.txtDOB.ReadOnly = true;
389 this.txtDOB.Size = new System.Drawing.Size(120, 20);
390 this.txtDOB.TabIndex = 6;
391 //
392 // label2
393 //
394 this.label2.Location = new System.Drawing.Point(50, 16);
395 this.label2.Name = "label2";
396 this.label2.Size = new System.Drawing.Size(40, 16);
397 this.label2.TabIndex = 5;
398 this.label2.Text = "Name:";
399 this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
400 //
401 // txtPatientName
402 //
403 this.txtPatientName.Location = new System.Drawing.Point(96, 16);
404 this.txtPatientName.Name = "txtPatientName";
405 this.txtPatientName.ReadOnly = true;
406 this.txtPatientName.Size = new System.Drawing.Size(337, 20);
407 this.txtPatientName.TabIndex = 0;
408 //
409 // tabCloneForward
410 //
411 this.tabCloneForward.BackColor = System.Drawing.SystemColors.Control;
412 this.tabCloneForward.Controls.Add(this.grpCloneForward);
413 this.tabCloneForward.Location = new System.Drawing.Point(4, 22);
414 this.tabCloneForward.Name = "tabCloneForward";
415 this.tabCloneForward.Size = new System.Drawing.Size(467, 498);
416 this.tabCloneForward.TabIndex = 2;
417 this.tabCloneForward.Text = "Clone/Forward";
418 //
419 // grpCloneForward
420 //
421 this.grpCloneForward.Controls.Add(this.button1);
422 this.grpCloneForward.Controls.Add(this.cboDuration);
423 this.grpCloneForward.Controls.Add(this.txtFUOther);
424 this.grpCloneForward.Controls.Add(this.label21);
425 this.grpCloneForward.Controls.Add(this.rdbFU90);
426 this.grpCloneForward.Controls.Add(this.rdbFU60);
427 this.grpCloneForward.Controls.Add(this.rdbFU30);
428 this.grpCloneForward.Controls.Add(this.label19);
429 this.grpCloneForward.Controls.Add(this.dtCloneAppointment);
430 this.grpCloneForward.Controls.Add(this.cboSlots);
431 this.grpCloneForward.Controls.Add(this.label25);
432 this.grpCloneForward.Controls.Add(this.label24);
433 this.grpCloneForward.Controls.Add(this.txtClinic);
434 this.grpCloneForward.Controls.Add(this.textBox1);
435 this.grpCloneForward.Controls.Add(this.label20);
436 this.grpCloneForward.Controls.Add(this.label22);
437 this.grpCloneForward.Controls.Add(this.label23);
438 this.grpCloneForward.Location = new System.Drawing.Point(8, 13);
439 this.grpCloneForward.Name = "grpCloneForward";
440 this.grpCloneForward.Size = new System.Drawing.Size(439, 206);
441 this.grpCloneForward.TabIndex = 16;
442 this.grpCloneForward.TabStop = false;
443 this.grpCloneForward.Text = "Clone/Forward Appointment";
444 //
445 // button1
446 //
447 this.button1.Location = new System.Drawing.Point(357, 82);
448 this.button1.Name = "button1";
449 this.button1.Size = new System.Drawing.Size(51, 24);
450 this.button1.TabIndex = 37;
451 this.button1.Text = "Update";
452 this.button1.Click += new System.EventHandler(this.button1_Click);
453 //
454 // cboDuration
455 //
456 this.cboDuration.FormattingEnabled = true;
457 this.cboDuration.Location = new System.Drawing.Point(80, 51);
458 this.cboDuration.Name = "cboDuration";
459 this.cboDuration.Size = new System.Drawing.Size(66, 21);
460 this.cboDuration.TabIndex = 36;
461 this.cboDuration.SelectedIndexChanged += new System.EventHandler(this.cboDuration_SelectedIndexChanged);
462 //
463 // txtFUOther
464 //
465 this.txtFUOther.Location = new System.Drawing.Point(297, 84);
466 this.txtFUOther.Name = "txtFUOther";
467 this.txtFUOther.Size = new System.Drawing.Size(54, 20);
468 this.txtFUOther.TabIndex = 35;
469 this.txtFUOther.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtFUOther_KeyPress);
470 //
471 // label21
472 //
473 this.label21.AutoSize = true;
474 this.label21.Location = new System.Drawing.Point(255, 88);
475 this.label21.Name = "label21";
476 this.label21.Size = new System.Drawing.Size(36, 13);
477 this.label21.TabIndex = 34;
478 this.label21.Text = "Other:";
479 //
480 // rdbFU90
481 //
482 this.rdbFU90.AutoSize = true;
483 this.rdbFU90.Location = new System.Drawing.Point(203, 85);
484 this.rdbFU90.Name = "rdbFU90";
485 this.rdbFU90.Size = new System.Drawing.Size(37, 17);
486 this.rdbFU90.TabIndex = 33;
487 this.rdbFU90.TabStop = true;
488 this.rdbFU90.Text = "90";
489 this.rdbFU90.UseVisualStyleBackColor = true;
490 this.rdbFU90.CheckedChanged += new System.EventHandler(this.rdbFUCheckedChanged);
491 //
492 // rdbFU60
493 //
494 this.rdbFU60.AutoSize = true;
495 this.rdbFU60.Location = new System.Drawing.Point(160, 85);
496 this.rdbFU60.Name = "rdbFU60";
497 this.rdbFU60.Size = new System.Drawing.Size(37, 17);
498 this.rdbFU60.TabIndex = 32;
499 this.rdbFU60.TabStop = true;
500 this.rdbFU60.Text = "60";
501 this.rdbFU60.UseVisualStyleBackColor = true;
502 this.rdbFU60.CheckedChanged += new System.EventHandler(this.rdbFUCheckedChanged);
503 //
504 // rdbFU30
505 //
506 this.rdbFU30.AutoSize = true;
507 this.rdbFU30.Location = new System.Drawing.Point(117, 85);
508 this.rdbFU30.Name = "rdbFU30";
509 this.rdbFU30.Size = new System.Drawing.Size(37, 17);
510 this.rdbFU30.TabIndex = 31;
511 this.rdbFU30.TabStop = true;
512 this.rdbFU30.Text = "30";
513 this.rdbFU30.UseVisualStyleBackColor = true;
514 this.rdbFU30.CheckedChanged += new System.EventHandler(this.rdbFUCheckedChanged);
515 //
516 // label19
517 //
518 this.label19.Location = new System.Drawing.Point(4, 85);
519 this.label19.Name = "label19";
520 this.label19.Size = new System.Drawing.Size(103, 16);
521 this.label19.TabIndex = 30;
522 this.label19.Text = "Quick Follow up:";
523 this.label19.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
524 //
525 // dtCloneAppointment
526 //
527 this.dtCloneAppointment.Location = new System.Drawing.Point(80, 26);
528 this.dtCloneAppointment.Name = "dtCloneAppointment";
529 this.dtCloneAppointment.Size = new System.Drawing.Size(136, 20);
530 this.dtCloneAppointment.TabIndex = 29;
531 this.dtCloneAppointment.ValueChanged += new System.EventHandler(this.dtCloneAppointment_ValueChanged);
532 //
533 // cboSlots
534 //
535 this.cboSlots.FormattingEnabled = true;
536 this.cboSlots.Location = new System.Drawing.Point(303, 24);
537 this.cboSlots.Name = "cboSlots";
538 this.cboSlots.Size = new System.Drawing.Size(121, 21);
539 this.cboSlots.TabIndex = 28;
540 this.cboSlots.SelectedIndexChanged += new System.EventHandler(this.cboSlots_SelectedIndexChanged);
541 //
542 // label25
543 //
544 this.label25.AutoSize = true;
545 this.label25.Location = new System.Drawing.Point(238, 29);
546 this.label25.Name = "label25";
547 this.label25.Size = new System.Drawing.Size(59, 13);
548 this.label25.TabIndex = 27;
549 this.label25.Text = "Time Slots:";
550 //
551 // label24
552 //
553 this.label24.Location = new System.Drawing.Point(152, 53);
554 this.label24.Name = "label24";
555 this.label24.Size = new System.Drawing.Size(40, 16);
556 this.label24.TabIndex = 26;
557 this.label24.Text = "Clinic:";
558 this.label24.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
559 //
560 // txtClinic
561 //
562 this.txtClinic.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
563 this.txtClinic.Location = new System.Drawing.Point(200, 53);
564 this.txtClinic.Name = "txtClinic";
565 this.txtClinic.Size = new System.Drawing.Size(233, 16);
566 this.txtClinic.TabIndex = 25;
567 //
568 // textBox1
569 //
570 this.textBox1.AcceptsReturn = true;
571 this.textBox1.Location = new System.Drawing.Point(80, 123);
572 this.textBox1.Multiline = true;
573 this.textBox1.Name = "textBox1";
574 this.textBox1.Size = new System.Drawing.Size(353, 60);
575 this.textBox1.TabIndex = 24;
576 //
577 // label20
578 //
579 this.label20.Location = new System.Drawing.Point(4, 131);
580 this.label20.Name = "label20";
581 this.label20.Size = new System.Drawing.Size(56, 16);
582 this.label20.TabIndex = 23;
583 this.label20.Text = "Notes:";
584 this.label20.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
585 //
586 // label22
587 //
588 this.label22.Location = new System.Drawing.Point(16, 53);
589 this.label22.Name = "label22";
590 this.label22.Size = new System.Drawing.Size(56, 16);
591 this.label22.TabIndex = 21;
592 this.label22.Text = "Duration:";
593 this.label22.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
594 //
595 // label23
596 //
597 this.label23.Location = new System.Drawing.Point(8, 29);
598 this.label23.Name = "label23";
599 this.label23.Size = new System.Drawing.Size(64, 16);
600 this.label23.TabIndex = 20;
601 this.label23.Text = "Start Time:";
602 this.label23.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
603 //
604 // tabPatientInfo
605 //
606 this.tabPatientInfo.Controls.Add(this.groupBox2);
607 this.tabPatientInfo.Location = new System.Drawing.Point(4, 22);
608 this.tabPatientInfo.Name = "tabPatientInfo";
609 this.tabPatientInfo.Size = new System.Drawing.Size(467, 498);
610 this.tabPatientInfo.TabIndex = 0;
611 this.tabPatientInfo.Text = "Contact Information";
612 //
613 // groupBox2
614 //
615 this.groupBox2.Controls.Add(this.label17);
616 this.groupBox2.Controls.Add(this.txtEmail);
617 this.groupBox2.Controls.Add(this.label16);
618 this.groupBox2.Controls.Add(this.txtPhoneCell);
619 this.groupBox2.Controls.Add(this.label7);
620 this.groupBox2.Controls.Add(this.txtCountry);
621 this.groupBox2.Controls.Add(this.label12);
622 this.groupBox2.Controls.Add(this.txtPhoneOffice);
623 this.groupBox2.Controls.Add(this.label13);
624 this.groupBox2.Controls.Add(this.txtPhoneHome);
625 this.groupBox2.Controls.Add(this.txtCity);
626 this.groupBox2.Controls.Add(this.label8);
627 this.groupBox2.Controls.Add(this.label9);
628 this.groupBox2.Controls.Add(this.txtZip);
629 this.groupBox2.Controls.Add(this.label10);
630 this.groupBox2.Controls.Add(this.txtState);
631 this.groupBox2.Controls.Add(this.label11);
632 this.groupBox2.Controls.Add(this.txtStreet);
633 this.groupBox2.Location = new System.Drawing.Point(8, 16);
634 this.groupBox2.Name = "groupBox2";
635 this.groupBox2.Size = new System.Drawing.Size(444, 198);
636 this.groupBox2.TabIndex = 1;
637 this.groupBox2.TabStop = false;
638 this.groupBox2.Text = "Address";
639 //
640 // label17
641 //
642 this.label17.Location = new System.Drawing.Point(224, 94);
643 this.label17.Name = "label17";
644 this.label17.Size = new System.Drawing.Size(40, 16);
645 this.label17.TabIndex = 29;
646 this.label17.Text = "E-Mail:";
647 this.label17.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
648 //
649 // txtEmail
650 //
651 this.txtEmail.Location = new System.Drawing.Point(267, 94);
652 this.txtEmail.Name = "txtEmail";
653 this.txtEmail.ReadOnly = true;
654 this.txtEmail.Size = new System.Drawing.Size(166, 20);
655 this.txtEmail.TabIndex = 28;
656 //
657 // label16
658 //
659 this.label16.Location = new System.Drawing.Point(19, 142);
660 this.label16.Name = "label16";
661 this.label16.Size = new System.Drawing.Size(69, 16);
662 this.label16.TabIndex = 27;
663 this.label16.Text = "Cell/Mobile:";
664 this.label16.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
665 //
666 // txtPhoneCell
667 //
668 this.txtPhoneCell.Location = new System.Drawing.Point(91, 142);
669 this.txtPhoneCell.Name = "txtPhoneCell";
670 this.txtPhoneCell.ReadOnly = true;
671 this.txtPhoneCell.Size = new System.Drawing.Size(120, 20);
672 this.txtPhoneCell.TabIndex = 26;
673 //
674 // label7
675 //
676 this.label7.Location = new System.Drawing.Point(33, 94);
677 this.label7.Name = "label7";
678 this.label7.Size = new System.Drawing.Size(55, 16);
679 this.label7.TabIndex = 25;
680 this.label7.Text = "Country:";
681 this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
682 //
683 // txtCountry
684 //
685 this.txtCountry.Location = new System.Drawing.Point(91, 94);
686 this.txtCountry.Name = "txtCountry";
687 this.txtCountry.ReadOnly = true;
688 this.txtCountry.Size = new System.Drawing.Size(120, 20);
689 this.txtCountry.TabIndex = 24;
690 //
691 // label12
692 //
693 this.label12.Location = new System.Drawing.Point(2, 166);
694 this.label12.Name = "label12";
695 this.label12.Size = new System.Drawing.Size(86, 14);
696 this.label12.TabIndex = 23;
697 this.label12.Text = "Phone (Office):";
698 this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
699 //
700 // txtPhoneOffice
701 //
702 this.txtPhoneOffice.Location = new System.Drawing.Point(91, 166);
703 this.txtPhoneOffice.Name = "txtPhoneOffice";
704 this.txtPhoneOffice.ReadOnly = true;
705 this.txtPhoneOffice.Size = new System.Drawing.Size(120, 20);
706 this.txtPhoneOffice.TabIndex = 22;
707 //
708 // label13
709 //
710 this.label13.Location = new System.Drawing.Point(5, 118);
711 this.label13.Name = "label13";
712 this.label13.Size = new System.Drawing.Size(83, 16);
713 this.label13.TabIndex = 21;
714 this.label13.Text = "Phone (Home):";
715 this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
716 //
717 // txtPhoneHome
718 //
719 this.txtPhoneHome.Location = new System.Drawing.Point(91, 118);
720 this.txtPhoneHome.Name = "txtPhoneHome";
721 this.txtPhoneHome.ReadOnly = true;
722 this.txtPhoneHome.Size = new System.Drawing.Size(120, 20);
723 this.txtPhoneHome.TabIndex = 20;
724 //
725 // txtCity
726 //
727 this.txtCity.Location = new System.Drawing.Point(91, 46);
728 this.txtCity.Name = "txtCity";
729 this.txtCity.ReadOnly = true;
730 this.txtCity.Size = new System.Drawing.Size(342, 20);
731 this.txtCity.TabIndex = 18;
732 //
733 // label8
734 //
735 this.label8.Location = new System.Drawing.Point(52, 46);
736 this.label8.Name = "label8";
737 this.label8.Size = new System.Drawing.Size(36, 16);
738 this.label8.TabIndex = 19;
739 this.label8.Text = "City:";
740 this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
741 //
742 // label9
743 //
744 this.label9.Location = new System.Drawing.Point(224, 70);
745 this.label9.Name = "label9";
746 this.label9.Size = new System.Drawing.Size(40, 16);
747 this.label9.TabIndex = 17;
748 this.label9.Text = "Zip:";
749 this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
750 //
751 // txtZip
752 //
753 this.txtZip.Location = new System.Drawing.Point(267, 70);
754 this.txtZip.Name = "txtZip";
755 this.txtZip.ReadOnly = true;
756 this.txtZip.Size = new System.Drawing.Size(166, 20);
757 this.txtZip.TabIndex = 16;
758 //
759 // label10
760 //
761 this.label10.Location = new System.Drawing.Point(47, 70);
762 this.label10.Name = "label10";
763 this.label10.Size = new System.Drawing.Size(41, 16);
764 this.label10.TabIndex = 15;
765 this.label10.Text = "State:";
766 this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
767 //
768 // txtState
769 //
770 this.txtState.Location = new System.Drawing.Point(91, 70);
771 this.txtState.Name = "txtState";
772 this.txtState.ReadOnly = true;
773 this.txtState.Size = new System.Drawing.Size(120, 20);
774 this.txtState.TabIndex = 14;
775 //
776 // label11
777 //
778 this.label11.Location = new System.Drawing.Point(47, 22);
779 this.label11.Name = "label11";
780 this.label11.Size = new System.Drawing.Size(41, 16);
781 this.label11.TabIndex = 13;
782 this.label11.Text = "Street:";
783 this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
784 //
785 // txtStreet
786 //
787 this.txtStreet.Location = new System.Drawing.Point(91, 22);
788 this.txtStreet.Name = "txtStreet";
789 this.txtStreet.ReadOnly = true;
790 this.txtStreet.Size = new System.Drawing.Size(342, 20);
791 this.txtStreet.TabIndex = 12;
792 //
793 // panel1
794 //
795 this.panel1.Controls.Add(this.chkPrint);
796 this.panel1.Controls.Add(this.cmdCancel);
797 this.panel1.Controls.Add(this.cmdOK);
798 this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
799 this.panel1.Location = new System.Drawing.Point(0, 484);
800 this.panel1.Name = "panel1";
801 this.panel1.Size = new System.Drawing.Size(475, 40);
802 this.panel1.TabIndex = 1;
803 //
804 // chkPrint
805 //
806 this.chkPrint.AutoSize = true;
807 this.chkPrint.Location = new System.Drawing.Point(13, 14);
808 this.chkPrint.Name = "chkPrint";
809 this.chkPrint.Size = new System.Drawing.Size(139, 17);
810 this.chkPrint.TabIndex = 2;
811 this.chkPrint.Text = "Print Appointment Letter";
812 this.chkPrint.UseVisualStyleBackColor = true;
813 this.chkPrint.CheckedChanged += new System.EventHandler(this.chkPrint_CheckedChanged);
814 //
815 // cmdCancel
816 //
817 this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
818 this.cmdCancel.Location = new System.Drawing.Point(387, 8);
819 this.cmdCancel.Name = "cmdCancel";
820 this.cmdCancel.Size = new System.Drawing.Size(64, 24);
821 this.cmdCancel.TabIndex = 1;
822 this.cmdCancel.Text = "Cancel";
823 //
824 // cmdOK
825 //
826 this.cmdOK.Location = new System.Drawing.Point(317, 8);
827 this.cmdOK.Name = "cmdOK";
828 this.cmdOK.Size = new System.Drawing.Size(64, 24);
829 this.cmdOK.TabIndex = 0;
830 this.cmdOK.Text = "OK";
831 this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
832 //
833 // patientApptsBindingSource
834 //
835 this.patientApptsBindingSource.DataMember = "PatientAppts";
836 this.patientApptsBindingSource.DataSource = this.dsPatientApptDisplay2BindingSource;
837 //
838 // dsPatientApptDisplay2BindingSource
839 //
840 this.dsPatientApptDisplay2BindingSource.DataSource = this.dsPatientApptDisplay2;
841 this.dsPatientApptDisplay2BindingSource.Position = 0;
842 //
843 // dsPatientApptDisplay2
844 //
845 this.dsPatientApptDisplay2.DataSetName = "dsPatientApptDisplay2";
846 this.dsPatientApptDisplay2.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
847 //
848 // DAppointPage
849 //
850 this.AcceptButton = this.cmdOK;
851 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
852 this.CancelButton = this.cmdCancel;
853 this.ClientSize = new System.Drawing.Size(475, 524);
854 this.Controls.Add(this.panel1);
855 this.Controls.Add(this.tabControl1);
856 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
857 this.Name = "DAppointPage";
858 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
859 this.Text = "Patient Appointment";
860 this.Load += new System.EventHandler(this.DAppointPage_Load);
861 this.tabControl1.ResumeLayout(false);
862 this.tabAppointment.ResumeLayout(false);
863 this.groupBox3.ResumeLayout(false);
864 this.groupBox3.PerformLayout();
865 this.groupBox1.ResumeLayout(false);
866 this.groupBox1.PerformLayout();
867 this.tabCloneForward.ResumeLayout(false);
868 this.grpCloneForward.ResumeLayout(false);
869 this.grpCloneForward.PerformLayout();
870 this.tabPatientInfo.ResumeLayout(false);
871 this.groupBox2.ResumeLayout(false);
872 this.groupBox2.PerformLayout();
873 this.panel1.ResumeLayout(false);
874 this.panel1.PerformLayout();
875 ((System.ComponentModel.ISupportInitialize)(this.patientApptsBindingSource)).EndInit();
876 ((System.ComponentModel.ISupportInitialize)(this.dsPatientApptDisplay2BindingSource)).EndInit();
877 ((System.ComponentModel.ISupportInitialize)(this.dsPatientApptDisplay2)).EndInit();
878 this.ResumeLayout(false);
879
880 }
881 #endregion
882
883 #region Fields
884
885 private CGDocumentManager m_DocManager;
886
887 private ArrayList alResources;
888
889 private bool isCloning = false;
890
891 private DateTime originalAppointment;
892
893 private string m_sPatientName;
894 private Sex m_enumPatientSex;
895 private string m_sPatientHRN;
896 private string m_sPatientIEN;
897 private DateTime m_dPatientDOB;
898 private string m_sPatientPID;
899
900 private string m_sCity;
901 private string m_sPhoneHome;
902 private string m_sPhoneOffice;
903 private string m_sState;
904 private string m_sStreet;
905 private string m_sZip;
906
907 private string m_sNote;
908 private DateTime m_dStartTime;
909 private DateTime m_dEndTime;
910 private int m_nDuration;
911 private string m_sClinic;
912
913 private string m_sPhoneCell;
914 private string m_sEmail;
915 private string m_sCountry;
916 private int m_iAccessTypeID;
917 private bool _myCodeIsFiringIstheCheckBoxChangedEvent;
918
919 #endregion //fields
920
921 #region
922
923 private void SetDurations(DateTime apptDate)
924 {
925 DateTime m_dStart = apptDate; // move to 1200
926 DateTime m_dEnd = m_dStart.Date.AddHours(23).AddMinutes(59).AddSeconds(59); //move to 235959
927 string sSearchInfo = "1|both" + "|";
928 ArrayList m_alResources = alResources;
929 ArrayList m_alAccessTypes = new ArrayList();
930 DataTable m_availTable = CGSchedLib.CreateAvailabilitySchedule(m_DocManager, m_alResources, m_dStart, m_dEnd, m_alAccessTypes, ScheduleType.Resource, sSearchInfo);
931 if (m_availTable.Rows.Count > 0)
932 {
933 foreach (DataRow row in m_availTable.Rows)
934 {
935 double minPerSlot = (row.Field<DateTime>("END_TIME") - row.Field<DateTime>("START_TIME")).TotalMinutes / row.Field<int>("SLOTS");
936 int totalSlots = row.Field<int>("SLOTS");
937 double duration = 0;
938 for (int i = 0; i < totalSlots; i++)
939 {
940 duration = duration + minPerSlot;
941 cboDuration.Items.Add(duration);
942 }
943 }
944 }
945 else
946 {
947 CGView v = this.DocManager.GetViewByResource(m_alResources);
948 int scale = v.CGrid.TimeScale;
949 //cboDuration.Items.Clear();
950 cboDuration.Items.Add((double)scale);
951 //cboDuration.SelectedIndex = 0;
952 }
953 }
954
955 private void GetAppointmentSlots(DateTime apptDate)
956 {
957 DateTime m_dStart = apptDate; // move to 1200
958 DateTime m_dEnd = m_dStart.Date.AddHours(23).AddMinutes(59).AddSeconds(59); //move to 235959
959 string sSearchInfo = "1|both" + "|";
960 ArrayList m_alResources = alResources;
961 ArrayList m_alAccessTypes = new ArrayList();
962 DataTable m_availTable = CGSchedLib.CreateAvailabilitySchedule(m_DocManager, m_alResources, m_dStart, m_dEnd, m_alAccessTypes, ScheduleType.Resource, sSearchInfo);
963 DataTable m_apptTable = CGSchedLib.CreateAppointmentSchedule(m_DocManager, m_alResources, m_dStart, m_dEnd);
964 cboSlots.Items.Clear();
965 if (m_availTable.Rows.Count>0)
966 {
967 foreach (DataRow row in m_availTable.Rows)
968 {
969 string resource = row.Field<string>("RESOURCE");
970 DateTime start_time = row.Field<DateTime>("START_TIME");
971 DateTime end_time = row.Field<DateTime>("END_TIME");
972 double minPerSlot = (row.Field<DateTime>("END_TIME") - row.Field<DateTime>("START_TIME")).TotalMinutes / row.Field<int>("SLOTS");
973 double duration = minPerSlot;
974 if (cboDuration.SelectedIndex >= 0)
975 {
976 duration = (double)cboDuration.SelectedItem;
977 }
978 int totalSlots = row.Field<int>("SLOTS");
979 DateTime aStartTime = start_time;
980 DateTime aEndTime = start_time.AddMinutes(duration);
981 for (int i = 0; i < totalSlots; i++)
982 {
983 bool flag = true;
984 foreach (DataRow appt in m_apptTable.Rows)
985 {
986 if (resource == appt.Field<string>("RESOURCENAME"))
987 {
988 DateTime apptStartTime = appt.Field<DateTime>("START_TIME");
989 DateTime apptEndTime = appt.Field<DateTime>("END_TIME");
990 DateTimeRange dRange1 = new DateTimeRange();
991 dRange1.Start = aStartTime;
992 dRange1.End = aEndTime;
993 DateTimeRange dRange2 = new DateTimeRange();
994 dRange2.Start = apptStartTime;
995 dRange2.End = apptEndTime.AddSeconds(-1);
996 if (dRange1.Intersects(dRange2))
997 {
998 flag = false;
999 }
1000 /*if(aStartTime.Ticks >= apptStartTime.Ticks && aStartTime.Ticks <= apptEndTime.AddSeconds(-1).Ticks)
1001 {
1002 flag = false;
1003 }
1004 if (aEndTime.Ticks <= apptStartTime.Ticks && aEndTime.Ticks >= apptEndTime.AddSeconds(-1).Ticks)
1005 {
1006 flag = false;
1007 }*/
1008 }
1009 }
1010 if (flag)
1011 {
1012 AppointmentComboboxItem item = new AppointmentComboboxItem();
1013 item.Value = aStartTime;
1014 item.Text = aStartTime.TimeOfDay.ToString();
1015 cboSlots.Items.Add(item);
1016 }
1017 aStartTime = aStartTime.AddMinutes(minPerSlot);
1018 aEndTime = aStartTime.AddMinutes(duration);
1019 }
1020 }
1021 }
1022 else
1023 {
1024 CGView v= this.DocManager.GetViewByResource(m_alResources);
1025 int scale = v.CGrid.TimeScale;
1026 cboSlots.Items.Clear();
1027 DateTime dStartTime = apptDate.Date;
1028 while (dStartTime.Day == apptDate.Date.Day)
1029 {
1030 AppointmentComboboxItem item = new AppointmentComboboxItem();
1031 item.Value = dStartTime;
1032 item.Text = dStartTime.TimeOfDay.ToString();
1033 cboSlots.Items.Add(item);
1034 dStartTime = dStartTime.AddMinutes((double)scale);
1035 }
1036 }
1037 }
1038
1039 public void HideCloneForwardTab() {
1040 tabControl1.TabPages.Remove(tabCloneForward);
1041 }
1042
1043 public void SetCloneForwardable(ArrayList alResources, CGAppointment a) {
1044 originalAppointment = a.StartTime;
1045 //grpCloneForward.Visible = true;
1046 isCloning = true;
1047 //grpCloneForward.Top = groupBox4.Top;
1048 //groupBox4.Top = groupBox4.Top + grpCloneForward.Height + 10;
1049 txtNote.Enabled = false;
1050 //this.Height = this.Height + grpCloneForward.Height + 20;
1051 this.alResources = alResources;
1052 cboSlots.DropDownStyle = ComboBoxStyle.DropDownList;
1053 cboDuration.DropDownStyle = ComboBoxStyle.DropDownList;
1054 cboDuration.Items.Clear();
1055 GetAppointmentSlots(dtCloneAppointment.Value);
1056 SetDurations(dtCloneAppointment.Value);
1057 txtClinic.Text = alResources[0].ToString();
1058 m_sClinic = txtClinic.Text;
1059 if (cboSlots.Items.Count > 0)
1060 {
1061 bool flag = true;
1062 cboDuration.SelectedIndex = 0;
1063 foreach (AppointmentComboboxItem item in cboSlots.Items)
1064 {
1065 if (originalAppointment.TimeOfDay.ToString() == item.Text)
1066 {
1067 flag = false;
1068 cboSlots.SelectedIndex = cboSlots.Items.IndexOf(item);
1069 }
1070 }
1071 if (flag)
1072 {
1073 cboSlots.SelectedIndex = 0;
1074 }
1075 m_dStartTime = ((AppointmentComboboxItem)cboSlots.SelectedItem).Value;
1076 m_dEndTime = m_dStartTime.AddMinutes((double)cboDuration.SelectedItem);
1077 }
1078 tabControl1.SelectedIndex = tabControl1.TabPages.IndexOf(tabCloneForward);
1079 }
1080
1081 public void InitializePage(CGAppointment a)
1082 {
1083 InitializePage(a.PatientID.ToString(), a.StartTime, a.EndTime, "", a.Note, a.AccessTypeID);
1084 }
1085
1086 public void InitializePage(string sPatientIEN, DateTime dStart, DateTime dEnd, string sClinic, string sNote, int iAccessTypeID)
1087 {
1088 m_dStartTime = dStart;
1089 m_dEndTime = dEnd;
1090 m_nDuration = (int)(dEnd - dStart).TotalMinutes;
1091 m_iAccessTypeID = iAccessTypeID;
1092 m_sClinic = sClinic;
1093 m_sPatientIEN = sPatientIEN;
1094 m_sNote = sNote;
1095 try
1096 {
1097 string sSql;
1098 sSql = "BSDX GET BASIC REG INFO^" + m_sPatientIEN;
1099
1100 DataTable tb = m_DocManager.RPMSDataTable(sSql, "PatientRegInfo");
1101
1102 Debug.Assert(tb.Rows.Count == 1);
1103 DataRow r = tb.Rows[0];
1104 this.m_sPatientName = r["NAME"].ToString();
1105 this.m_enumPatientSex = r["SEX"].ToString() == "MALE" ? Sex.Male : Sex.Female;
1106 this.m_sPatientHRN = r["HRN"].ToString();
1107 this.m_sPatientIEN = r["IEN"].ToString();
1108 this.m_sPatientPID = r["PID"].ToString();
1109 this.m_dPatientDOB = (DateTime) r["DOB"];
1110 this.m_sStreet = r["STREET"].ToString();
1111 this.m_sCity = r["CITY"].ToString();
1112 this.m_sPhoneOffice = r["OFCPHONE"].ToString();
1113 this.m_sState = r["STATE"].ToString();
1114 this.m_sZip = r["ZIP"].ToString();
1115 this.m_sPhoneHome = r["HOMEPHONE"].ToString();
1116 this.m_sEmail = r["EMAIL ADDRESS"].ToString();
1117 this.m_sPhoneCell = r["PHONE NUMBER [CELLULAR]"].ToString();
1118 this.m_sCountry = r["COUNTRY"].ToString();
1119 this.UpdateDialogData(true);
1120 Control UC = new UCPatientAppts(m_DocManager, int.Parse(m_sPatientIEN));
1121 UC.Dock = DockStyle.Fill;
1122 groupBox4.Controls.Add(UC);
1123
1124 _myCodeIsFiringIstheCheckBoxChangedEvent = true;
1125 chkPrint.Checked = CGDocumentManager.Current.UserPreferences.PrintAppointmentSlipAutomacially;
1126 _myCodeIsFiringIstheCheckBoxChangedEvent = false;
1127 }
1128 catch(Exception e)
1129 {
1130 MessageBox.Show("DAppointPage::InitializePage -- Unable to retrieve patient information from VistA. " + e.Message);
1131 }
1132
1133 }
1134 /// <summary>
1135 /// Move data from member variables to controls (b == true)
1136 /// or from controls to member variables (b == false)
1137 /// </summary>
1138 /// <param name="b"></param>
1139 private void UpdateDialogData(bool b)
1140 {
1141 if (b == true) //move member vars into control data
1142 {
1143 lblClinic.Text = m_sClinic;
1144 lblDuration.Text = m_nDuration.ToString();
1145 lblStartTime.Text = m_dStartTime.ToShortDateString() + " " + m_dStartTime.ToShortTimeString();
1146
1147 txtCity.Text = this.m_sCity;
1148 txtDOB.Text = this.m_dPatientDOB.ToShortDateString();
1149 txtHRN.Text = this.m_sPatientHRN;
1150 txtNote.Text = this.m_sNote;
1151 txtPatientName.Text = m_sPatientName;
1152 txtSex.Text = m_enumPatientSex.ToString();
1153 txtPhoneHome.Text = this.m_sPhoneHome;
1154 txtPhoneOffice.Text = this.m_sPhoneOffice;
1155 txtPID.Text = this.m_sPatientPID;
1156 txtState.Text = this.m_sState;
1157 txtStreet.Text = this.m_sStreet;
1158 txtZip.Text = this.m_sZip;
1159 txtEmail.Text = this.m_sEmail;
1160 txtPhoneCell.Text = this.m_sPhoneCell;
1161 txtCountry.Text = this.m_sCountry;
1162
1163 }
1164 else //move control data into member vars
1165 {
1166 string sNote = txtNote.Text;
1167 sNote = sNote.Replace("^", " ");
1168 this.m_sNote = sNote;
1169 }
1170
1171 }
1172 private void cmdOK_Click(object sender, System.EventArgs e)
1173 {
1174 this.UpdateDialogData(false);
1175 if (isCloning)
1176 {
1177 if (cboSlots.Items.Count <=0)
1178 {
1179 MessageBox.Show("Please select the Appointment Slot before submitting the form");
1180 return;
1181 }
1182 }
1183 this.DialogResult = System.Windows.Forms.DialogResult.OK;
1184 }
1185
1186 /// <summary>
1187 /// Clean up any resources being used.
1188 /// </summary>
1189 protected override void Dispose( bool disposing )
1190 {
1191 if( disposing )
1192 {
1193 if(components != null)
1194 {
1195 components.Dispose();
1196 }
1197 }
1198 base.Dispose( disposing );
1199 }
1200
1201
1202 #endregion //Methods
1203
1204 #region Properties
1205
1206 public string Note
1207 {
1208 get
1209 {
1210 return m_sNote;
1211 }
1212 set
1213 {
1214 m_sNote = value;
1215 }
1216 }
1217
1218 public CGDocumentManager DocManager
1219 {
1220 get
1221 {
1222 return m_DocManager;
1223 }
1224 set
1225 {
1226 m_DocManager = value;
1227 }
1228 }
1229
1230 public bool PrintAppointmentSlip
1231 {
1232 get { return chkPrint.Checked; }
1233 }
1234
1235 public CGAppointment Appointment
1236 {
1237 get
1238 {
1239 Patient pt = new Patient
1240 {
1241 DFN = Int32.Parse(m_sPatientIEN),
1242 Name = m_sPatientName,
1243 Sex = m_enumPatientSex,
1244 DOB = m_dPatientDOB,
1245 ID = m_sPatientPID,
1246 HRN = m_sPatientHRN,
1247 Appointments = null, //for now
1248 Street = m_sStreet,
1249 City = m_sCity,
1250 State = m_sState,
1251 Zip = m_sZip,
1252 Country = m_sCountry,
1253 Email = m_sEmail,
1254 HomePhone = m_sPhoneHome,
1255 WorkPHone = m_sPhoneOffice,
1256 CellPhone = m_sPhoneCell
1257 };
1258
1259 CGAppointment appt = new CGAppointment()
1260 {
1261 PatientID = Convert.ToInt32(m_sPatientIEN),
1262 PatientName = m_sPatientName,
1263 StartTime = m_dStartTime,
1264 EndTime = m_dEndTime,
1265 Resource = m_sClinic,
1266 Note = m_sNote,
1267 HealthRecordNumber = m_sPatientHRN,
1268 AccessTypeID = m_iAccessTypeID,
1269 Patient = pt
1270 };
1271
1272 return appt;
1273 }
1274 }
1275 #endregion //Properties
1276
1277 /// <summary>
1278 /// Save Print Slip preference in UserPreferences object.
1279 /// </summary>
1280 /// <param name="sender"></param>
1281 /// <param name="e"></param>
1282 private void chkPrint_CheckedChanged(object sender, EventArgs e)
1283 {
1284 if (_myCodeIsFiringIstheCheckBoxChangedEvent) return;
1285
1286 CGDocumentManager.Current.UserPreferences.PrintAppointmentSlipAutomacially = chkPrint.Checked;
1287 }
1288
1289 private void DAppointPage_Load(object sender, EventArgs e)
1290 {
1291
1292 }
1293
1294 private void dtCloneAppointment_ValueChanged(object sender, EventArgs e)
1295 {
1296 cboDuration.Items.Clear();
1297 GetAppointmentSlots(dtCloneAppointment.Value);
1298 SetDurations(dtCloneAppointment.Value);
1299 txtClinic.Text = alResources[0].ToString();
1300 m_sClinic = txtClinic.Text;
1301 if (cboSlots.Items.Count > 0)
1302 {
1303 cboDuration.SelectedIndex = 0;
1304 cboSlots.SelectedIndex = cboSlots.FindStringExact(originalAppointment.TimeOfDay.ToString());
1305 m_dStartTime = ((AppointmentComboboxItem)cboSlots.SelectedItem).Value;
1306 m_dEndTime = m_dStartTime.AddMinutes((double)cboDuration.SelectedItem);
1307 }
1308 }
1309
1310 private void rdbFUCheckedChanged(object sender, EventArgs e)
1311 {
1312 if (((RadioButton)sender).Checked)
1313 {
1314 // This is the correct control.
1315 RadioButton rb = (RadioButton)sender;
1316 dtCloneAppointment.Value = originalAppointment.AddDays(Convert.ToDouble(rb.Text));
1317 AppointmentComboboxItem item = new AppointmentComboboxItem();
1318 item.Value = dtCloneAppointment.Value;
1319 item.Text = dtCloneAppointment.Value.TimeOfDay.ToString();
1320 if (cboSlots.Items.Count > 0)
1321 {
1322 cboSlots.SelectedIndex = cboSlots.FindStringExact(dtCloneAppointment.Value.TimeOfDay.ToString());
1323 }
1324 }
1325 }
1326
1327 private void cboDuration_SelectedIndexChanged(object sender, EventArgs e)
1328 {
1329 GetAppointmentSlots(dtCloneAppointment.Value);
1330 if (cboSlots.Items.Count >0)
1331 {
1332 cboSlots.SelectedIndex = 0;
1333 m_dStartTime = ((AppointmentComboboxItem)cboSlots.SelectedItem).Value;
1334 m_dEndTime = m_dStartTime.AddMinutes((double)cboDuration.SelectedItem);
1335 }
1336 }
1337
1338 private void txtFUOther_KeyPress(object sender, KeyPressEventArgs e)
1339 {
1340 if (!char.IsDigit(e.KeyChar))
1341 {
1342 e.Handled = true;
1343 }
1344 }
1345
1346 private void button1_Click(object sender, EventArgs e)
1347 {
1348 if (Convert.ToInt32(txtFUOther.Text)>0)
1349 {
1350 if (Convert.ToInt32(txtFUOther.Text) <= 365)
1351 {
1352 dtCloneAppointment.Value = originalAppointment.AddDays(Convert.ToInt32(txtFUOther.Text));
1353 AppointmentComboboxItem item = new AppointmentComboboxItem();
1354 item.Value = dtCloneAppointment.Value;
1355 item.Text = dtCloneAppointment.Value.TimeOfDay.ToString();
1356 if (cboSlots.Items.Count > 0)
1357 {
1358 cboSlots.SelectedIndex = cboSlots.FindStringExact(dtCloneAppointment.Value.TimeOfDay.ToString());
1359 }
1360 }
1361 else
1362 {
1363 MessageBox.Show("Please enter number less then 365.");
1364 }
1365 }
1366 else
1367 {
1368 MessageBox.Show("Please enter number of days before updating.");
1369 }
1370 }
1371
1372 private void cboSlots_SelectedIndexChanged(object sender, EventArgs e)
1373 {
1374 m_dStartTime = ((AppointmentComboboxItem)cboSlots.SelectedItem).Value;
1375 m_dEndTime = m_dStartTime.AddMinutes((double)cboDuration.SelectedItem);
1376 }
1377 } //end Class
1378
1379 public class AppointmentComboboxItem
1380 {
1381 public string Text { get; set; }
1382 public DateTime Value { get; set; }
1383
1384 public override string ToString()
1385 {
1386 return Text;
1387 }
1388 }
1389
1390 public class DateTimeRange
1391 {
1392 public DateTime Start { get; set; }
1393 public DateTime End { get; set; }
1394
1395 public bool Intersects(DateTimeRange test)
1396 {
1397
1398 if (this.Start == this.End || test.Start == test.End)
1399 return false; // No actual date range
1400
1401 if (this.Start == test.Start || this.End == test.End)
1402 return true; // If any set is the same time, then by default there must be some overlap.
1403
1404 if (this.Start < test.Start)
1405 {
1406 if (this.End > test.Start && this.End < test.End)
1407 return true; // Condition 1
1408
1409 if (this.End > test.End)
1410 return true; // Condition 3
1411 }
1412 else
1413 {
1414 if (test.End > this.Start && test.End < this.End)
1415 return true; // Condition 2
1416
1417 if (test.End > this.End)
1418 return true; // Condition 4
1419 }
1420
1421 return false;
1422 }
1423 }
1424}
Note: See TracBrowser for help on using the repository browser.