source: Scheduling/trunk/cs/bsdx0200GUISourceCode/CGView.cs@ 614

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

Initial committ of scheduling package

File size: 106.4 KB
Line 
1using System;
2using System.Drawing;
3using System.Collections;
4using System.ComponentModel;
5using System.Windows.Forms;
6using System.Diagnostics;
7using System.Data;
8using System.Net;
9using System.Net.Sockets;
10using System.Threading;
11using System.IO;
12using IndianHealthService.BMXNet;
13using System.Reflection;
14
15
16namespace IndianHealthService.ClinicalScheduling
17{
18 /// <summary>
19 /// Summary description for CGView.
20 /// </summary>
21 public class CGView : System.Windows.Forms.Form
22 {
23 private System.Windows.Forms.MainMenu mainMenu1;
24 private System.Windows.Forms.MenuItem mnuFile;
25 private System.Windows.Forms.MenuItem mnuTest;
26 private System.Windows.Forms.MenuItem mnuAppointment;
27 private System.Windows.Forms.MenuItem mnuNewAppointment;
28 private System.Windows.Forms.MenuItem mnu1Day;
29 private System.Windows.Forms.MenuItem mnu7Day;
30 private System.Windows.Forms.MenuItem menuItem4;
31 private System.Windows.Forms.MenuItem mnu5Day;
32 private System.Windows.Forms.MenuItem mnu10Minute;
33 private System.Windows.Forms.MenuItem mnu20Minute;
34 private System.Windows.Forms.MenuItem mnu30Minute;
35 private System.Windows.Forms.MenuItem mnuTimeScale;
36 private System.Windows.Forms.MenuItem mnu15Minute;
37 private System.Windows.Forms.MenuItem mnuOpenSchedule;
38 private System.Windows.Forms.MenuItem menuItem1;
39 private System.Windows.Forms.TreeView tvSchedules;
40 private System.Windows.Forms.MenuItem mnuViewScheduleTree;
41 private System.Windows.Forms.MenuItem mnuDeleteAppointment;
42 private System.Windows.Forms.MenuItem mnuTest1;
43 private System.Windows.Forms.Splitter splitter1;
44 private System.Windows.Forms.Splitter splitter2;
45 private System.Windows.Forms.StatusBar statusBar1;
46 private System.Windows.Forms.DateTimePicker dateTimePicker1;
47 private System.Windows.Forms.MenuItem mnuViewRightPanel;
48 private System.Windows.Forms.Panel panelRight;
49 private System.Windows.Forms.Panel panelTop;
50 private System.Windows.Forms.Panel panelCenter;
51 private System.Windows.Forms.Panel panelBottom;
52 private System.Windows.Forms.Label lblResource;
53 private System.Windows.Forms.ContextMenu contextMenu1;
54 private System.Windows.Forms.MenuItem ctxOpenSchedule;
55 private System.Windows.Forms.MenuItem ctxEditAvailability;
56 private System.Windows.Forms.MenuItem ctxProperties;
57 private System.Windows.Forms.MenuItem mnuSchedulingManagment;
58 private System.Windows.Forms.MenuItem ctxFindAppt;
59 private System.Windows.Forms.MenuItem mnuFindAppt;
60 internal System.Windows.Forms.MenuItem mnuRPMSServer;
61 internal System.Windows.Forms.MenuItem mnuRPMSLogin;
62 private System.Windows.Forms.MenuItem mnuCheckIn;
63 private System.Windows.Forms.MenuItem menuItem3;
64 private System.Windows.Forms.MenuItem mnuHelpAbout;
65 private System.Windows.Forms.MenuItem mnuCalendar;
66 private System.Windows.Forms.MenuItem mnuHelp;
67 private System.Windows.Forms.MenuItem mnuClose;
68 private System.Windows.Forms.MenuItem mnuViewPatientAppts;
69 private IndianHealthService.ClinicalScheduling.CalendarGrid calendarGrid1;
70 private System.Windows.Forms.MenuItem mnuCopyAppointment;
71 private System.Windows.Forms.Panel panelClip;
72 private System.Windows.Forms.ListBox lstClip;
73 private System.Windows.Forms.Label label1;
74 private System.Windows.Forms.ContextMenu ctxApptClipMenu;
75 private System.Windows.Forms.MenuItem mnuRemoveClipItem;
76 private System.Windows.Forms.MenuItem mnuClearClipItems;
77 private System.Windows.Forms.MenuItem mnuEditAppointment;
78 private System.Windows.Forms.ContextMenu ctxCalendarGrid;
79 private System.Windows.Forms.MenuItem ctxCalGridAdd;
80 private System.Windows.Forms.MenuItem ctxCalGridEdit;
81 private System.Windows.Forms.MenuItem ctxCalGridDelete;
82 private System.Windows.Forms.MenuItem ctxCalGridCheckIn;
83 private System.Windows.Forms.MenuItem menuItem6;
84 private System.Windows.Forms.MenuItem menuItem7;
85 private System.Windows.Forms.MenuItem mnuPrintClinicLetters;
86 private System.Windows.Forms.MenuItem mnuPrintPatientLetter;
87 private System.Windows.Forms.MenuItem mnuPrintClinicSchedules;
88 private System.Windows.Forms.MenuItem ctxCalGridNoShow;
89 private System.Windows.Forms.MenuItem ctxCalGridNoShowUndo;
90 private System.Windows.Forms.MenuItem mnuNoShow;
91 private System.Windows.Forms.MenuItem mnuNoShowUndo;
92 private System.Windows.Forms.MenuItem mnuPrintRebookLetters;
93 private System.Windows.Forms.MenuItem mnuPrintCancellationLetters;
94 private System.Windows.Forms.MenuItem mnuWalkIn;
95 private System.Windows.Forms.MenuItem menuItem5;
96 private System.Windows.Forms.MenuItem menuItem8;
97 private System.Windows.Forms.MenuItem ctxCalGridWalkin;
98 private System.Windows.Forms.MenuItem menuItem2;
99 private System.Windows.Forms.MenuItem menuItem9;
100 private System.Windows.Forms.MenuItem mnuOpenMultipleSchedules;
101 private System.Windows.Forms.MenuItem mnuDisplayWalkIns;
102 private System.Windows.Forms.MenuItem mnuRPMSDivision;
103 private MenuItem ctxCalGridEHR;
104 private IContainer components;
105
106 #region Initialization
107 public CGView()
108 {
109 //
110 // Required for Windows Form Designer support
111 //
112 InitializeComponent();
113
114 m_nSlots = 0;
115 m_alSelectedTreeResourceArray = new ArrayList();
116 m_ClipList = new CGAppointments();
117
118 }
119
120 public void InitializeDocView(string sText)
121 {
122 this.Text = this.DocManager.ConnectInfo.UserName;
123 if (sText != null)
124 this.Text += " - " + sText;
125 if (DocManager.ConnectInfo.DivisionName != null)
126 this.Text += " - " + DocManager.ConnectInfo.DivisionName;
127 }
128
129 public void InitializeDocView(CGDocument doc,
130 CGDocumentManager docMgr,
131 DateTime dStartDate,
132 CGAppointments cgAppts,
133 string sText)
134 {
135 System.IntPtr pHandle = this.Handle;
136 this.DocManager = docMgr;
137 this.StartDate = dStartDate;
138 this.Document = doc;
139 this.Appointments = cgAppts;
140 this.Text = this.DocManager.ConnectInfo.UserName;
141 if (sText != null)
142 this.Text += " - " + sText;
143 if (DocManager.ConnectInfo.DivisionName != null)
144 this.Text += " - " + DocManager.ConnectInfo.DivisionName;
145
146 this.m_ConnectInfo = m_DocManager.ConnectInfo;
147 m_bmxDelegate = new BMXNetConnectInfo.BMXNetEventDelegate(BMXNetEventHandler);
148 m_ConnectInfo.BMXNetEvent += m_bmxDelegate;
149 }
150
151 private BMXNetConnectInfo.BMXNetEventDelegate m_bmxDelegate;
152 delegate void OnUpdateScheduleDelegate();
153
154 private void BMXNetEventHandler(Object obj, BMXNet.BMXNetEventArgs e)
155 {
156 try
157 {
158 if (e.BMXEvent == "BMXNet AutoFire")
159 {
160 Debug.Write("CGView caught AutoFire event.\n");
161 if (this == null)
162 return;
163 OnUpdateScheduleDelegate ousd = new OnUpdateScheduleDelegate(OnUpdateSchedule);
164 this.BeginInvoke(ousd);
165 return;
166 }
167
168 if (e.BMXEvent != "BSDX SCHEDULE")
169 {
170 return;
171 }
172 string sResourceName;
173 for (int j=0; j < m_Document.m_sResourcesArray.Count; j++)
174 {
175 sResourceName = m_Document.m_sResourcesArray[j].ToString();
176 if (e.BMXParam == sResourceName)
177 {
178 OnUpdateScheduleDelegate ousd = new OnUpdateScheduleDelegate(OnUpdateSchedule);
179 if (this == null)
180 return;
181 this.BeginInvoke(ousd);
182 Debug.Write("CGView caught BSDX SCHEDULE event.\n");
183 break;
184 }
185 }
186 }
187 catch (Exception ex)
188 {
189 Debug.Write(ex.Message);
190 }
191 }
192
193 #endregion initialization
194
195 #region Windows Form Designer generated code
196 /// <summary>
197 /// Required method for Designer support - do not modify
198 /// the contents of this method with the code editor.
199 /// </summary>
200 private void InitializeComponent()
201 {
202 this.components = new System.ComponentModel.Container();
203 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CGView));
204 this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
205 this.mnuFile = new System.Windows.Forms.MenuItem();
206 this.mnuOpenSchedule = new System.Windows.Forms.MenuItem();
207 this.mnuOpenMultipleSchedules = new System.Windows.Forms.MenuItem();
208 this.menuItem1 = new System.Windows.Forms.MenuItem();
209 this.mnuRPMSServer = new System.Windows.Forms.MenuItem();
210 this.mnuRPMSLogin = new System.Windows.Forms.MenuItem();
211 this.mnuRPMSDivision = new System.Windows.Forms.MenuItem();
212 this.menuItem3 = new System.Windows.Forms.MenuItem();
213 this.mnuSchedulingManagment = new System.Windows.Forms.MenuItem();
214 this.menuItem6 = new System.Windows.Forms.MenuItem();
215 this.mnuPrintClinicSchedules = new System.Windows.Forms.MenuItem();
216 this.mnuPrintClinicLetters = new System.Windows.Forms.MenuItem();
217 this.mnuPrintRebookLetters = new System.Windows.Forms.MenuItem();
218 this.mnuPrintCancellationLetters = new System.Windows.Forms.MenuItem();
219 this.mnuPrintPatientLetter = new System.Windows.Forms.MenuItem();
220 this.menuItem7 = new System.Windows.Forms.MenuItem();
221 this.mnuClose = new System.Windows.Forms.MenuItem();
222 this.mnuAppointment = new System.Windows.Forms.MenuItem();
223 this.mnuNewAppointment = new System.Windows.Forms.MenuItem();
224 this.mnuEditAppointment = new System.Windows.Forms.MenuItem();
225 this.mnuDeleteAppointment = new System.Windows.Forms.MenuItem();
226 this.menuItem5 = new System.Windows.Forms.MenuItem();
227 this.mnuNoShow = new System.Windows.Forms.MenuItem();
228 this.mnuNoShowUndo = new System.Windows.Forms.MenuItem();
229 this.menuItem8 = new System.Windows.Forms.MenuItem();
230 this.mnuCopyAppointment = new System.Windows.Forms.MenuItem();
231 this.mnuWalkIn = new System.Windows.Forms.MenuItem();
232 this.mnuFindAppt = new System.Windows.Forms.MenuItem();
233 this.mnuCheckIn = new System.Windows.Forms.MenuItem();
234 this.mnuViewPatientAppts = new System.Windows.Forms.MenuItem();
235 this.mnuCalendar = new System.Windows.Forms.MenuItem();
236 this.mnuDisplayWalkIns = new System.Windows.Forms.MenuItem();
237 this.mnu1Day = new System.Windows.Forms.MenuItem();
238 this.mnu5Day = new System.Windows.Forms.MenuItem();
239 this.mnu7Day = new System.Windows.Forms.MenuItem();
240 this.menuItem4 = new System.Windows.Forms.MenuItem();
241 this.mnuTimeScale = new System.Windows.Forms.MenuItem();
242 this.mnu10Minute = new System.Windows.Forms.MenuItem();
243 this.mnu15Minute = new System.Windows.Forms.MenuItem();
244 this.mnu20Minute = new System.Windows.Forms.MenuItem();
245 this.mnu30Minute = new System.Windows.Forms.MenuItem();
246 this.mnuViewScheduleTree = new System.Windows.Forms.MenuItem();
247 this.mnuViewRightPanel = new System.Windows.Forms.MenuItem();
248 this.mnuHelp = new System.Windows.Forms.MenuItem();
249 this.mnuHelpAbout = new System.Windows.Forms.MenuItem();
250 this.mnuTest = new System.Windows.Forms.MenuItem();
251 this.mnuTest1 = new System.Windows.Forms.MenuItem();
252 this.tvSchedules = new System.Windows.Forms.TreeView();
253 this.contextMenu1 = new System.Windows.Forms.ContextMenu();
254 this.ctxOpenSchedule = new System.Windows.Forms.MenuItem();
255 this.ctxEditAvailability = new System.Windows.Forms.MenuItem();
256 this.ctxProperties = new System.Windows.Forms.MenuItem();
257 this.ctxFindAppt = new System.Windows.Forms.MenuItem();
258 this.panelRight = new System.Windows.Forms.Panel();
259 this.panelClip = new System.Windows.Forms.Panel();
260 this.lstClip = new System.Windows.Forms.ListBox();
261 this.ctxApptClipMenu = new System.Windows.Forms.ContextMenu();
262 this.mnuRemoveClipItem = new System.Windows.Forms.MenuItem();
263 this.mnuClearClipItems = new System.Windows.Forms.MenuItem();
264 this.label1 = new System.Windows.Forms.Label();
265 this.panelTop = new System.Windows.Forms.Panel();
266 this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
267 this.lblResource = new System.Windows.Forms.Label();
268 this.panelCenter = new System.Windows.Forms.Panel();
269 this.calendarGrid1 = new IndianHealthService.ClinicalScheduling.CalendarGrid();
270 this.ctxCalendarGrid = new System.Windows.Forms.ContextMenu();
271 this.ctxCalGridAdd = new System.Windows.Forms.MenuItem();
272 this.ctxCalGridEdit = new System.Windows.Forms.MenuItem();
273 this.ctxCalGridDelete = new System.Windows.Forms.MenuItem();
274 this.ctxCalGridCheckIn = new System.Windows.Forms.MenuItem();
275 this.ctxCalGridEHR = new System.Windows.Forms.MenuItem();
276 this.menuItem2 = new System.Windows.Forms.MenuItem();
277 this.ctxCalGridNoShow = new System.Windows.Forms.MenuItem();
278 this.ctxCalGridNoShowUndo = new System.Windows.Forms.MenuItem();
279 this.menuItem9 = new System.Windows.Forms.MenuItem();
280 this.ctxCalGridWalkin = new System.Windows.Forms.MenuItem();
281 this.panelBottom = new System.Windows.Forms.Panel();
282 this.statusBar1 = new System.Windows.Forms.StatusBar();
283 this.splitter1 = new System.Windows.Forms.Splitter();
284 this.splitter2 = new System.Windows.Forms.Splitter();
285 this.panelRight.SuspendLayout();
286 this.panelClip.SuspendLayout();
287 this.panelTop.SuspendLayout();
288 this.panelCenter.SuspendLayout();
289 this.panelBottom.SuspendLayout();
290 this.SuspendLayout();
291 //
292 // mainMenu1
293 //
294 this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
295 this.mnuFile,
296 this.mnuAppointment,
297 this.mnuCalendar,
298 this.mnuHelp,
299 this.mnuTest});
300 //
301 // mnuFile
302 //
303 this.mnuFile.Index = 0;
304 this.mnuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
305 this.mnuOpenSchedule,
306 this.mnuOpenMultipleSchedules,
307 this.menuItem1,
308 this.mnuRPMSServer,
309 this.mnuRPMSLogin,
310 this.mnuRPMSDivision,
311 this.menuItem3,
312 this.mnuSchedulingManagment,
313 this.menuItem6,
314 this.mnuPrintClinicSchedules,
315 this.mnuPrintClinicLetters,
316 this.mnuPrintRebookLetters,
317 this.mnuPrintCancellationLetters,
318 this.mnuPrintPatientLetter,
319 this.menuItem7,
320 this.mnuClose});
321 this.mnuFile.Text = "&File";
322 this.mnuFile.Popup += new System.EventHandler(this.mnuFile_Popup);
323 //
324 // mnuOpenSchedule
325 //
326 this.mnuOpenSchedule.Enabled = false;
327 this.mnuOpenSchedule.Index = 0;
328 this.mnuOpenSchedule.Text = "&Open Schedule";
329 this.mnuOpenSchedule.Visible = false;
330 this.mnuOpenSchedule.Click += new System.EventHandler(this.mnuOpenSchedule_Click);
331 //
332 // mnuOpenMultipleSchedules
333 //
334 this.mnuOpenMultipleSchedules.Index = 1;
335 this.mnuOpenMultipleSchedules.Text = "Open M&ultiple Schedules";
336 this.mnuOpenMultipleSchedules.Click += new System.EventHandler(this.mnuOpenMultipleSchedules_Click);
337 //
338 // menuItem1
339 //
340 this.menuItem1.Index = 2;
341 this.menuItem1.Text = "-";
342 //
343 // mnuRPMSServer
344 //
345 this.mnuRPMSServer.Index = 3;
346 this.mnuRPMSServer.Text = "Change RPMS &Server";
347 this.mnuRPMSServer.Click += new System.EventHandler(this.mnuRPMSServer_Click);
348 //
349 // mnuRPMSLogin
350 //
351 this.mnuRPMSLogin.Index = 4;
352 this.mnuRPMSLogin.Text = "Change RPMS &Login";
353 this.mnuRPMSLogin.Click += new System.EventHandler(this.mnuRPMSLogin_Click);
354 //
355 // mnuRPMSDivision
356 //
357 this.mnuRPMSDivision.Index = 5;
358 this.mnuRPMSDivision.Text = "Change RPMS &Division";
359 this.mnuRPMSDivision.Click += new System.EventHandler(this.mnuRPMSDivision_Click);
360 //
361 // menuItem3
362 //
363 this.menuItem3.Index = 6;
364 this.menuItem3.Text = "-";
365 //
366 // mnuSchedulingManagment
367 //
368 this.mnuSchedulingManagment.Index = 7;
369 this.mnuSchedulingManagment.Text = "Scheduling &Management";
370 this.mnuSchedulingManagment.Click += new System.EventHandler(this.mnuSchedulingManagment_Click);
371 //
372 // menuItem6
373 //
374 this.menuItem6.Index = 8;
375 this.menuItem6.Text = "-";
376 //
377 // mnuPrintClinicSchedules
378 //
379 this.mnuPrintClinicSchedules.Index = 9;
380 this.mnuPrintClinicSchedules.Text = "&Print Clinic Schedules";
381 this.mnuPrintClinicSchedules.Click += new System.EventHandler(this.mnuPrintClinicSchedules_Click);
382 //
383 // mnuPrintClinicLetters
384 //
385 this.mnuPrintClinicLetters.Index = 10;
386 this.mnuPrintClinicLetters.Text = "Print Rem&inder Letters";
387 this.mnuPrintClinicLetters.Click += new System.EventHandler(this.mnuPrintClinicLetters_Click);
388 //
389 // mnuPrintRebookLetters
390 //
391 this.mnuPrintRebookLetters.Index = 11;
392 this.mnuPrintRebookLetters.Text = "Print &Rebook Letters";
393 this.mnuPrintRebookLetters.Click += new System.EventHandler(this.mnuPrintRebookLetters_Click);
394 //
395 // mnuPrintCancellationLetters
396 //
397 this.mnuPrintCancellationLetters.Index = 12;
398 this.mnuPrintCancellationLetters.Text = "Print C&ancellation Letters";
399 this.mnuPrintCancellationLetters.Click += new System.EventHandler(this.mnuPrintCancellationLetters_Click);
400 //
401 // mnuPrintPatientLetter
402 //
403 this.mnuPrintPatientLetter.Index = 13;
404 this.mnuPrintPatientLetter.Text = "Print Patient Le&tter";
405 this.mnuPrintPatientLetter.Click += new System.EventHandler(this.mnuPrintPatientLetter_Click);
406 //
407 // menuItem7
408 //
409 this.menuItem7.Index = 14;
410 this.menuItem7.Text = "-";
411 //
412 // mnuClose
413 //
414 this.mnuClose.Index = 15;
415 this.mnuClose.Text = "&Close Schedule";
416 this.mnuClose.Click += new System.EventHandler(this.mnuClose_Click);
417 //
418 // mnuAppointment
419 //
420 this.mnuAppointment.Index = 1;
421 this.mnuAppointment.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
422 this.mnuNewAppointment,
423 this.mnuEditAppointment,
424 this.mnuDeleteAppointment,
425 this.menuItem5,
426 this.mnuNoShow,
427 this.mnuNoShowUndo,
428 this.menuItem8,
429 this.mnuCopyAppointment,
430 this.mnuWalkIn,
431 this.mnuFindAppt,
432 this.mnuCheckIn,
433 this.mnuViewPatientAppts});
434 this.mnuAppointment.Text = "&Appointment";
435 this.mnuAppointment.Popup += new System.EventHandler(this.mnuAppointment_Popup);
436 //
437 // mnuNewAppointment
438 //
439 this.mnuNewAppointment.Index = 0;
440 this.mnuNewAppointment.Text = "&New Appointment";
441 this.mnuNewAppointment.Click += new System.EventHandler(this.mnuNewAppointment_Click);
442 //
443 // mnuEditAppointment
444 //
445 this.mnuEditAppointment.Index = 1;
446 this.mnuEditAppointment.Text = "&Edit Appointment";
447 this.mnuEditAppointment.Click += new System.EventHandler(this.mnuEditAppointment_Click);
448 //
449 // mnuDeleteAppointment
450 //
451 this.mnuDeleteAppointment.Index = 2;
452 this.mnuDeleteAppointment.Text = "Cance&l Appointment";
453 this.mnuDeleteAppointment.Click += new System.EventHandler(this.mnuDeleteAppointment_Click);
454 //
455 // menuItem5
456 //
457 this.menuItem5.Index = 3;
458 this.menuItem5.Text = "-";
459 //
460 // mnuNoShow
461 //
462 this.mnuNoShow.Index = 4;
463 this.mnuNoShow.Text = "Mark as No Sho&w";
464 this.mnuNoShow.Click += new System.EventHandler(this.mnuNoShow_Click);
465 //
466 // mnuNoShowUndo
467 //
468 this.mnuNoShowUndo.Index = 5;
469 this.mnuNoShowUndo.Text = "&Undo No Show";
470 this.mnuNoShowUndo.Click += new System.EventHandler(this.mnuNoShowUndo_Click);
471 //
472 // menuItem8
473 //
474 this.menuItem8.Index = 6;
475 this.menuItem8.Text = "-";
476 //
477 // mnuCopyAppointment
478 //
479 this.mnuCopyAppointment.Index = 7;
480 this.mnuCopyAppointment.Text = "&Copy Appointment to Clipboard";
481 this.mnuCopyAppointment.Click += new System.EventHandler(this.mnuCopyAppointment_Click);
482 //
483 // mnuWalkIn
484 //
485 this.mnuWalkIn.Index = 8;
486 this.mnuWalkIn.Text = "Create Wal&k-In Appointment";
487 this.mnuWalkIn.Click += new System.EventHandler(this.mnuWalkIn_Click);
488 //
489 // mnuFindAppt
490 //
491 this.mnuFindAppt.Index = 9;
492 this.mnuFindAppt.Text = "&Find Available Appointment";
493 this.mnuFindAppt.Click += new System.EventHandler(this.mnuFindAppt_Click);
494 //
495 // mnuCheckIn
496 //
497 this.mnuCheckIn.Index = 10;
498 this.mnuCheckIn.Text = "Check &In Patient";
499 this.mnuCheckIn.Click += new System.EventHandler(this.mnuCheckIn_Click);
500 //
501 // mnuViewPatientAppts
502 //
503 this.mnuViewPatientAppts.Index = 11;
504 this.mnuViewPatientAppts.Text = "&View Patient Appointments";
505 this.mnuViewPatientAppts.Click += new System.EventHandler(this.mnuViewPatientAppts_Click);
506 //
507 // mnuCalendar
508 //
509 this.mnuCalendar.Index = 2;
510 this.mnuCalendar.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
511 this.mnuDisplayWalkIns,
512 this.mnu1Day,
513 this.mnu5Day,
514 this.mnu7Day,
515 this.menuItem4,
516 this.mnuTimeScale,
517 this.mnuViewScheduleTree,
518 this.mnuViewRightPanel});
519 this.mnuCalendar.Text = "&View";
520 //
521 // mnuDisplayWalkIns
522 //
523 this.mnuDisplayWalkIns.Checked = true;
524 this.mnuDisplayWalkIns.Index = 0;
525 this.mnuDisplayWalkIns.Text = "&Display Walk-Ins";
526 this.mnuDisplayWalkIns.Click += new System.EventHandler(this.mnuDisplayWalkIns_Click);
527 //
528 // mnu1Day
529 //
530 this.mnu1Day.Index = 1;
531 this.mnu1Day.Text = "&1-Day View";
532 this.mnu1Day.Click += new System.EventHandler(this.mnu1Day_Click);
533 //
534 // mnu5Day
535 //
536 this.mnu5Day.Index = 2;
537 this.mnu5Day.Text = "&5-Day View";
538 this.mnu5Day.Click += new System.EventHandler(this.mnu5Day_Click);
539 //
540 // mnu7Day
541 //
542 this.mnu7Day.Index = 3;
543 this.mnu7Day.Text = "&7-Day View";
544 this.mnu7Day.Click += new System.EventHandler(this.mnu7Day_Click);
545 //
546 // menuItem4
547 //
548 this.menuItem4.Index = 4;
549 this.menuItem4.Text = "-";
550 //
551 // mnuTimeScale
552 //
553 this.mnuTimeScale.Index = 5;
554 this.mnuTimeScale.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
555 this.mnu10Minute,
556 this.mnu15Minute,
557 this.mnu20Minute,
558 this.mnu30Minute});
559 this.mnuTimeScale.Text = "&Time Scale";
560 //
561 // mnu10Minute
562 //
563 this.mnu10Minute.Index = 0;
564 this.mnu10Minute.Text = "&10-Minute";
565 this.mnu10Minute.Click += new System.EventHandler(this.mnu10Minute_Click);
566 //
567 // mnu15Minute
568 //
569 this.mnu15Minute.Index = 1;
570 this.mnu15Minute.Text = "1&5-Minute";
571 this.mnu15Minute.Click += new System.EventHandler(this.mnu15Minute_Click);
572 //
573 // mnu20Minute
574 //
575 this.mnu20Minute.Index = 2;
576 this.mnu20Minute.Text = "&20-Minute";
577 this.mnu20Minute.Click += new System.EventHandler(this.mnu20Minute_Click);
578 //
579 // mnu30Minute
580 //
581 this.mnu30Minute.Index = 3;
582 this.mnu30Minute.Text = "&30-Minute";
583 this.mnu30Minute.Click += new System.EventHandler(this.mnu30Minute_Click);
584 //
585 // mnuViewScheduleTree
586 //
587 this.mnuViewScheduleTree.Index = 6;
588 this.mnuViewScheduleTree.Text = "&Schedule Tree";
589 this.mnuViewScheduleTree.Click += new System.EventHandler(this.mnuViewScheduleTree_Click);
590 //
591 // mnuViewRightPanel
592 //
593 this.mnuViewRightPanel.Index = 7;
594 this.mnuViewRightPanel.Text = "&Appointment Clipboard";
595 this.mnuViewRightPanel.Click += new System.EventHandler(this.mnuViewRightPanel_Click);
596 //
597 // mnuHelp
598 //
599 this.mnuHelp.Index = 3;
600 this.mnuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
601 this.mnuHelpAbout});
602 this.mnuHelp.Text = "&Help";
603 //
604 // mnuHelpAbout
605 //
606 this.mnuHelpAbout.Index = 0;
607 this.mnuHelpAbout.Text = "&About";
608 this.mnuHelpAbout.Click += new System.EventHandler(this.mnuHelpAbout_Click);
609 //
610 // mnuTest
611 //
612 this.mnuTest.Enabled = false;
613 this.mnuTest.Index = 4;
614 this.mnuTest.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
615 this.mnuTest1});
616 this.mnuTest.Text = "&Test";
617 this.mnuTest.Visible = false;
618 //
619 // mnuTest1
620 //
621 this.mnuTest1.Index = 0;
622 this.mnuTest1.Text = "Test1";
623 this.mnuTest1.Click += new System.EventHandler(this.mnuTest1_Click);
624 //
625 // tvSchedules
626 //
627 this.tvSchedules.BackColor = System.Drawing.SystemColors.ControlLight;
628 this.tvSchedules.ContextMenu = this.contextMenu1;
629 this.tvSchedules.Dock = System.Windows.Forms.DockStyle.Left;
630 this.tvSchedules.HotTracking = true;
631 this.tvSchedules.Location = new System.Drawing.Point(0, 0);
632 this.tvSchedules.Name = "tvSchedules";
633 this.tvSchedules.Size = new System.Drawing.Size(128, 473);
634 this.tvSchedules.Sorted = true;
635 this.tvSchedules.TabIndex = 1;
636 this.tvSchedules.DoubleClick += new System.EventHandler(this.tvSchedules_DoubleClick);
637 this.tvSchedules.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvSchedules_AfterSelect);
638 this.tvSchedules.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.tvSchedules_BeforeSelect);
639 this.tvSchedules.Click += new System.EventHandler(this.tvSchedules_Click);
640 //
641 // contextMenu1
642 //
643 this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
644 this.ctxOpenSchedule,
645 this.ctxEditAvailability,
646 this.ctxProperties,
647 this.ctxFindAppt});
648 this.contextMenu1.Popup += new System.EventHandler(this.contextMenu1_Popup);
649 //
650 // ctxOpenSchedule
651 //
652 this.ctxOpenSchedule.DefaultItem = true;
653 this.ctxOpenSchedule.Index = 0;
654 this.ctxOpenSchedule.Text = "&Open Schedule";
655 this.ctxOpenSchedule.Click += new System.EventHandler(this.ctxOpenSchedule_Click);
656 //
657 // ctxEditAvailability
658 //
659 this.ctxEditAvailability.Index = 1;
660 this.ctxEditAvailability.Text = "&Edit Resource Availability";
661 this.ctxEditAvailability.Click += new System.EventHandler(this.ctxEditAvailability_Click);
662 //
663 // ctxProperties
664 //
665 this.ctxProperties.Index = 2;
666 this.ctxProperties.Text = "&Properties";
667 this.ctxProperties.Click += new System.EventHandler(this.ctxProperties_Click);
668 //
669 // ctxFindAppt
670 //
671 this.ctxFindAppt.Index = 3;
672 this.ctxFindAppt.Text = "Find Available Appointment";
673 this.ctxFindAppt.Click += new System.EventHandler(this.ctxFindAppt_Click);
674 //
675 // panelRight
676 //
677 this.panelRight.Controls.Add(this.panelClip);
678 this.panelRight.Dock = System.Windows.Forms.DockStyle.Right;
679 this.panelRight.Location = new System.Drawing.Point(676, 0);
680 this.panelRight.Name = "panelRight";
681 this.panelRight.Size = new System.Drawing.Size(128, 473);
682 this.panelRight.TabIndex = 3;
683 this.panelRight.Visible = false;
684 //
685 // panelClip
686 //
687 this.panelClip.Controls.Add(this.lstClip);
688 this.panelClip.Controls.Add(this.label1);
689 this.panelClip.Dock = System.Windows.Forms.DockStyle.Top;
690 this.panelClip.Location = new System.Drawing.Point(0, 0);
691 this.panelClip.Name = "panelClip";
692 this.panelClip.Size = new System.Drawing.Size(128, 448);
693 this.panelClip.TabIndex = 0;
694 //
695 // lstClip
696 //
697 this.lstClip.AllowDrop = true;
698 this.lstClip.ContextMenu = this.ctxApptClipMenu;
699 this.lstClip.DisplayMember = "PatientName";
700 this.lstClip.Dock = System.Windows.Forms.DockStyle.Fill;
701 this.lstClip.Location = new System.Drawing.Point(0, 32);
702 this.lstClip.Name = "lstClip";
703 this.lstClip.Size = new System.Drawing.Size(128, 407);
704 this.lstClip.TabIndex = 0;
705 this.lstClip.SelectedIndexChanged += new System.EventHandler(this.lstClip_SelectedIndexChanged);
706 this.lstClip.DragDrop += new System.Windows.Forms.DragEventHandler(this.lstClip_DragDrop);
707 this.lstClip.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lstClip_MouseMove);
708 this.lstClip.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lstClip_MouseDown);
709 this.lstClip.DragEnter += new System.Windows.Forms.DragEventHandler(this.lstClip_DragEnter);
710 //
711 // ctxApptClipMenu
712 //
713 this.ctxApptClipMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
714 this.mnuRemoveClipItem,
715 this.mnuClearClipItems});
716 this.ctxApptClipMenu.Popup += new System.EventHandler(this.ctxApptClipMenu_Popup);
717 //
718 // mnuRemoveClipItem
719 //
720 this.mnuRemoveClipItem.Index = 0;
721 this.mnuRemoveClipItem.Text = "Remove Item";
722 this.mnuRemoveClipItem.Click += new System.EventHandler(this.mnuRemoveClipItem_Click);
723 //
724 // mnuClearClipItems
725 //
726 this.mnuClearClipItems.Index = 1;
727 this.mnuClearClipItems.Text = "Clear All";
728 this.mnuClearClipItems.Click += new System.EventHandler(this.mnuClearClipItems_Click);
729 //
730 // label1
731 //
732 this.label1.Dock = System.Windows.Forms.DockStyle.Top;
733 this.label1.Location = new System.Drawing.Point(0, 0);
734 this.label1.Name = "label1";
735 this.label1.Size = new System.Drawing.Size(128, 32);
736 this.label1.TabIndex = 1;
737 this.label1.Text = "Appointment Clipboard";
738 this.label1.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
739 //
740 // panelTop
741 //
742 this.panelTop.Controls.Add(this.dateTimePicker1);
743 this.panelTop.Controls.Add(this.lblResource);
744 this.panelTop.Dock = System.Windows.Forms.DockStyle.Top;
745 this.panelTop.Location = new System.Drawing.Point(128, 0);
746 this.panelTop.Name = "panelTop";
747 this.panelTop.Size = new System.Drawing.Size(548, 24);
748 this.panelTop.TabIndex = 6;
749 //
750 // dateTimePicker1
751 //
752 this.dateTimePicker1.Dock = System.Windows.Forms.DockStyle.Right;
753 this.dateTimePicker1.DropDownAlign = System.Windows.Forms.LeftRightAlignment.Right;
754 this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Short;
755 this.dateTimePicker1.Location = new System.Drawing.Point(420, 0);
756 this.dateTimePicker1.Name = "dateTimePicker1";
757 this.dateTimePicker1.Size = new System.Drawing.Size(128, 20);
758 this.dateTimePicker1.TabIndex = 1;
759 this.dateTimePicker1.ValueChanged += new System.EventHandler(this.dateTimePicker1_ValueChanged);
760 //
761 // lblResource
762 //
763 this.lblResource.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
764 this.lblResource.ForeColor = System.Drawing.SystemColors.Highlight;
765 this.lblResource.Location = new System.Drawing.Point(8, 5);
766 this.lblResource.Name = "lblResource";
767 this.lblResource.Size = new System.Drawing.Size(456, 19);
768 this.lblResource.TabIndex = 2;
769 this.lblResource.Text = "lblResource";
770 //
771 // panelCenter
772 //
773 this.panelCenter.Controls.Add(this.calendarGrid1);
774 this.panelCenter.Dock = System.Windows.Forms.DockStyle.Fill;
775 this.panelCenter.Location = new System.Drawing.Point(136, 24);
776 this.panelCenter.Name = "panelCenter";
777 this.panelCenter.Size = new System.Drawing.Size(537, 425);
778 this.panelCenter.TabIndex = 7;
779 //
780 // calendarGrid1
781 //
782 this.calendarGrid1.AllowDrop = true;
783 this.calendarGrid1.Appointments = null;
784 this.calendarGrid1.ApptDragSource = null;
785 this.calendarGrid1.AutoScroll = true;
786 this.calendarGrid1.AutoScrollMinSize = new System.Drawing.Size(600, 1898);
787 this.calendarGrid1.AvailabilityArray = null;
788 this.calendarGrid1.BackColor = System.Drawing.SystemColors.Window;
789 this.calendarGrid1.Columns = 5;
790 this.calendarGrid1.ContextMenu = this.ctxCalendarGrid;
791 this.calendarGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
792 this.calendarGrid1.DrawWalkIns = true;
793 this.calendarGrid1.GridBackColor = null;
794 this.calendarGrid1.GridEnter = false;
795 this.calendarGrid1.Location = new System.Drawing.Point(0, 0);
796 this.calendarGrid1.Name = "calendarGrid1";
797 this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources")));
798 this.calendarGrid1.SelectedAppointment = 0;
799 this.calendarGrid1.Size = new System.Drawing.Size(537, 425);
800 this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0);
801 this.calendarGrid1.TabIndex = 0;
802 this.calendarGrid1.TimeScale = 20;
803 this.calendarGrid1.DoubleClick += new System.EventHandler(this.calendarGrid1_DoubleClick);
804 this.calendarGrid1.CGSelectionChanged += new IndianHealthService.ClinicalScheduling.CGSelectionChangedHandler(this.calendarGrid1_CGSelectionChanged);
805 this.calendarGrid1.CGAppointmentChanged += new IndianHealthService.ClinicalScheduling.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentChanged);
806 this.calendarGrid1.CGAppointmentAdded += new IndianHealthService.ClinicalScheduling.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentAdded);
807 //
808 // ctxCalendarGrid
809 //
810 this.ctxCalendarGrid.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
811 this.ctxCalGridAdd,
812 this.ctxCalGridEdit,
813 this.ctxCalGridDelete,
814 this.ctxCalGridCheckIn,
815 this.ctxCalGridEHR,
816 this.menuItem2,
817 this.ctxCalGridNoShow,
818 this.ctxCalGridNoShowUndo,
819 this.menuItem9,
820 this.ctxCalGridWalkin});
821 this.ctxCalendarGrid.Popup += new System.EventHandler(this.ctxCalendarGrid_Popup);
822 //
823 // ctxCalGridAdd
824 //
825 this.ctxCalGridAdd.Index = 0;
826 this.ctxCalGridAdd.Text = "Add Appointment";
827 this.ctxCalGridAdd.Click += new System.EventHandler(this.ctxCalGridAdd_Click);
828 //
829 // ctxCalGridEdit
830 //
831 this.ctxCalGridEdit.Index = 1;
832 this.ctxCalGridEdit.Text = "Edit Appointment";
833 this.ctxCalGridEdit.Click += new System.EventHandler(this.ctxCalGridEdit_Click);
834 //
835 // ctxCalGridDelete
836 //
837 this.ctxCalGridDelete.Index = 2;
838 this.ctxCalGridDelete.Text = "Cancel Appointment";
839 this.ctxCalGridDelete.Click += new System.EventHandler(this.ctxCalGridDelete_Click);
840 //
841 // ctxCalGridCheckIn
842 //
843 this.ctxCalGridCheckIn.Index = 3;
844 this.ctxCalGridCheckIn.Text = "Check In Patient";
845 this.ctxCalGridCheckIn.Click += new System.EventHandler(this.ctxCalGridCheckIn_Click);
846 //
847 // ctxCalGridEHR
848 //
849 this.ctxCalGridEHR.Index = 4;
850 this.ctxCalGridEHR.Text = "View Patient in EHR";
851 this.ctxCalGridEHR.Click += new System.EventHandler(this.ctxCalGridEHR_Click);
852 //
853 // menuItem2
854 //
855 this.menuItem2.Index = 5;
856 this.menuItem2.Text = "-";
857 //
858 // ctxCalGridNoShow
859 //
860 this.ctxCalGridNoShow.Index = 6;
861 this.ctxCalGridNoShow.Text = "Mark as No Show";
862 this.ctxCalGridNoShow.Click += new System.EventHandler(this.ctxCalGridNoShow_Click);
863 //
864 // ctxCalGridNoShowUndo
865 //
866 this.ctxCalGridNoShowUndo.Index = 7;
867 this.ctxCalGridNoShowUndo.Text = "Undo NoShow";
868 this.ctxCalGridNoShowUndo.Click += new System.EventHandler(this.ctxCalGridNoShowUndo_Click);
869 //
870 // menuItem9
871 //
872 this.menuItem9.Index = 8;
873 this.menuItem9.Text = "-";
874 //
875 // ctxCalGridWalkin
876 //
877 this.ctxCalGridWalkin.Index = 9;
878 this.ctxCalGridWalkin.Text = "Create Wal&k-In Appointment";
879 this.ctxCalGridWalkin.Click += new System.EventHandler(this.ctxCalGridWalkin_Click);
880 //
881 // panelBottom
882 //
883 this.panelBottom.Controls.Add(this.statusBar1);
884 this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
885 this.panelBottom.Location = new System.Drawing.Point(136, 449);
886 this.panelBottom.Name = "panelBottom";
887 this.panelBottom.Size = new System.Drawing.Size(537, 24);
888 this.panelBottom.TabIndex = 8;
889 //
890 // statusBar1
891 //
892 this.statusBar1.Dock = System.Windows.Forms.DockStyle.Fill;
893 this.statusBar1.Location = new System.Drawing.Point(0, 0);
894 this.statusBar1.Name = "statusBar1";
895 this.statusBar1.Size = new System.Drawing.Size(537, 24);
896 this.statusBar1.SizingGrip = false;
897 this.statusBar1.TabIndex = 0;
898 //
899 // splitter1
900 //
901 this.splitter1.Location = new System.Drawing.Point(128, 24);
902 this.splitter1.Name = "splitter1";
903 this.splitter1.Size = new System.Drawing.Size(8, 449);
904 this.splitter1.TabIndex = 9;
905 this.splitter1.TabStop = false;
906 //
907 // splitter2
908 //
909 this.splitter2.Dock = System.Windows.Forms.DockStyle.Right;
910 this.splitter2.Location = new System.Drawing.Point(673, 24);
911 this.splitter2.Name = "splitter2";
912 this.splitter2.Size = new System.Drawing.Size(3, 449);
913 this.splitter2.TabIndex = 10;
914 this.splitter2.TabStop = false;
915 //
916 // CGView
917 //
918 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
919 this.ClientSize = new System.Drawing.Size(804, 473);
920 this.Controls.Add(this.panelCenter);
921 this.Controls.Add(this.panelBottom);
922 this.Controls.Add(this.splitter2);
923 this.Controls.Add(this.splitter1);
924 this.Controls.Add(this.panelTop);
925 this.Controls.Add(this.panelRight);
926 this.Controls.Add(this.tvSchedules);
927 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
928 this.Menu = this.mainMenu1;
929 this.Name = "CGView";
930 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
931 this.Text = "CGView";
932 this.CursorChanged += new System.EventHandler(this.CGView_CursorChanged);
933 this.Load += new System.EventHandler(this.CGView_Load);
934 this.Activated += new System.EventHandler(this.CGView_Activated);
935 this.Closing += new System.ComponentModel.CancelEventHandler(this.CGView_Closing);
936 this.panelRight.ResumeLayout(false);
937 this.panelClip.ResumeLayout(false);
938 this.panelTop.ResumeLayout(false);
939 this.panelCenter.ResumeLayout(false);
940 this.panelBottom.ResumeLayout(false);
941 this.ResumeLayout(false);
942
943 }
944 #endregion
945
946 #region Fields
947
948 private CGDocument m_Document;
949 private CGDocumentManager m_DocManager;
950 private int m_nSlots;
951 bool bSchedulesClicked = false;
952 private ArrayList m_alSelectedTreeResourceArray = new ArrayList();
953 private string m_sDocName;
954 private CGAppointments m_ClipList;
955 private bool m_bDragDropStart = false;
956 private Hashtable m_htOverbook;
957 private Hashtable m_htModifySchedule;
958 private Hashtable m_htChangeAppts;
959 private BMXNetConnectInfo m_ConnectInfo = null;
960 public BMXNetConnectInfo.BMXNetEventDelegate BMXNetEvent;
961
962 #endregion Fields
963
964 #region Properties
965
966 /// <summary>
967 /// Access the CalendarGrid associated with this view
968 /// </summary>
969 public CalendarGrid CGrid
970 {
971 get
972 {
973 return this.calendarGrid1;
974 }
975 }
976
977 /// <summary>
978 /// Accesses the document associated with this view
979 /// </summary>
980 public CGDocument Document
981 {
982 get
983 {
984 return this.m_Document;
985 }
986 set
987 {
988 this.m_Document = value;
989 }
990 }
991
992 public CGDocumentManager DocManager
993 {
994 get
995 {
996 return m_DocManager;
997 }
998 set
999 {
1000 m_DocManager = value;
1001 }
1002 }
1003
1004 public DateTime StartDate
1005 {
1006 get
1007 {
1008 return this.calendarGrid1.StartDate;
1009 }
1010 set
1011 {
1012 this.calendarGrid1.StartDate = value;
1013 }
1014 }
1015
1016 public CGAppointments Appointments
1017 {
1018 get
1019 {
1020 return this.calendarGrid1.Appointments;
1021 }
1022 set
1023 {
1024 this.calendarGrid1.Appointments = value;
1025 }
1026 }
1027
1028
1029 #endregion
1030
1031 #region AppointmentMenu Handlers
1032
1033 private void mnuAppointment_Popup(object sender, System.EventArgs e)
1034 {
1035 bool bEnabled = (this.Document.Resources.Count > 0)? true : false ;
1036 this.mnuFindAppt.Enabled = bEnabled;
1037
1038 //Toggle availability of make, edit, checkin and delete appointments
1039 //based on whether a range is selected.
1040
1041 mnuNewAppointment.Enabled = AddAppointmentEnabled();
1042 this.mnuWalkIn.Enabled = mnuNewAppointment.Enabled;
1043 bool bEditAppointments = this.EditAppointmentEnabled();
1044
1045 mnuDeleteAppointment.Enabled = bEditAppointments;
1046 mnuCheckIn.Enabled = bEditAppointments;
1047 mnuEditAppointment.Enabled = bEditAppointments;
1048 mnuNoShow.Enabled = bEditAppointments;
1049 mnuNoShowUndo.Enabled = bEditAppointments;
1050 }
1051
1052 private void mnuCheckIn_Click(object sender, System.EventArgs e)
1053 {
1054 AppointmentCheckIn();
1055 }
1056
1057 private void mnuCopyAppointment_Click(object sender, System.EventArgs e)
1058 {
1059 //For each appointment in the grid's selected list,
1060 //add to the clip list
1061 //and add to m_ClipList
1062 try
1063 {
1064 foreach (CGAppointment a in this.calendarGrid1.SelectedAppointments.AppointmentTable.Values)
1065 {
1066 if (m_ClipList.AppointmentTable.Contains((int) a.AppointmentKey))
1067 {
1068 return;
1069 }
1070 m_ClipList.AddAppointment(a);
1071 lstClip.Items.Add(a.PatientName);
1072 }
1073 }
1074 catch (Exception ex)
1075 {
1076 string s = ex.Message;
1077 Debug.Write(s);
1078 return;
1079 }
1080 }
1081
1082 private void mnuDeleteAppointment_Click(object sender, System.EventArgs e)
1083 {
1084 AppointmentDelete();
1085 }
1086
1087 private void mnuEditAppointment_Click(object sender, System.EventArgs e)
1088 {
1089 AppointmentEdit();
1090 }
1091
1092 private void mnuNewAppointment_Click(object sender, System.EventArgs e)
1093 {
1094 AppointmentAddNew();
1095 }
1096
1097 private void mnuNoShow_Click(object sender, System.EventArgs e)
1098 {
1099 AppointmentNoShow(true);
1100 }
1101
1102 private void mnuNoShowUndo_Click(object sender, System.EventArgs e)
1103 {
1104 AppointmentNoShow(false);
1105 }
1106
1107 #endregion AppointmentMenu Handlers
1108
1109 #region ContextMenu1 Handlers
1110
1111 private void contextMenu1_Popup(object sender, System.EventArgs e)
1112 {
1113 //Enable/disable OpenSchedule and Find Appointment options
1114 bool bEnabled = (m_alSelectedTreeResourceArray.Count > 0)? true : false ;
1115 this.ctxOpenSchedule.Enabled = bEnabled;
1116 this.ctxFindAppt.Enabled = bEnabled;
1117
1118 //properties not supported now
1119 this.ctxProperties.Enabled = false;
1120 this.ctxProperties.Visible = false;
1121
1122 //Enable/disable Availability menu option
1123 if (m_alSelectedTreeResourceArray.Count != 1)
1124 {
1125 this.ctxEditAvailability.Enabled = false;
1126 return;
1127 }
1128
1129 if (this.DocManager.ScheduleManager == true)
1130 {
1131 ctxEditAvailability.Enabled = true;
1132 return;
1133 }
1134
1135 string sResource = (string) m_alSelectedTreeResourceArray[0];
1136 DataTable dt = this.DocManager.GlobalDataSet.Tables["ResourceUser"];
1137 DataView dv = new DataView(dt, "", "RESOURCENAME ASC", DataViewRowState.OriginalRows);
1138 string sDuz = this.DocManager.ConnectInfo.DUZ;
1139 bool bModSchedule = false;
1140 DataRowView[] drvA = dv.FindRows(sResource);
1141 if (drvA.Length == 0)
1142 {
1143 this.ctxEditAvailability.Enabled = false;
1144 }
1145 else
1146 {
1147 string sModSchedule = "NO";
1148 foreach (DataRowView drv in drvA)
1149 {
1150 if (drv["USERID"].ToString() == sDuz)
1151 {
1152 sModSchedule = drv["MODIFY_SCHEDULE"].ToString();
1153 break;
1154 }
1155 }
1156
1157 bModSchedule = (sModSchedule == "YES")?true:false;
1158 this.ctxEditAvailability.Enabled = bModSchedule;
1159 }
1160 }
1161
1162 private void ctxEditAvailability_Click(object sender, System.EventArgs e)
1163 {
1164 this.EditScheduleAvailability();
1165 }
1166
1167 private void ctxOpenSchedule_Click(object sender, System.EventArgs e)
1168 {
1169 OpenSelectedSchedule(m_alSelectedTreeResourceArray, DateTime.Today);
1170 }
1171
1172 private void ctxProperties_Click(object sender, System.EventArgs e)
1173 {
1174 //TODO: Implement Properties dialog
1175 MessageBox.Show("TODO: Implement Properties dialog");
1176 }
1177
1178 private void ctxFindAppt_Click(object sender, System.EventArgs e)
1179 {
1180 FindAvailableAppointment(m_alSelectedTreeResourceArray);
1181 }
1182
1183 #endregion ContextMenu1 Handlers
1184
1185 #region ctxApptClipMenu Handlers
1186
1187 private void mnuClearClipItems_Click(object sender, System.EventArgs e)
1188 {
1189 this.m_ClipList.ClearAllAppointments();
1190 lstClip.Items.Clear();
1191 }
1192
1193 private void mnuRemoveClipItem_Click(object sender, System.EventArgs e)
1194 {
1195 int i = lstClip.SelectedIndex;
1196 CGAppointment a = (CGAppointment) lstClip.SelectedItem;
1197 int nKey = a.AppointmentKey;
1198 if (i > -1)
1199 {
1200 m_ClipList.RemoveAppointment(nKey);
1201 lstClip.Items.RemoveAt(i);
1202 }
1203 }
1204
1205 private void ctxApptClipMenu_Popup(object sender, System.EventArgs e)
1206 {
1207 mnuClearClipItems.Enabled = (m_ClipList.AppointmentTable.Count > 0);
1208 mnuRemoveClipItem.Enabled = (lstClip.SelectedIndex > -1);
1209 }
1210
1211 #endregion ctxApptClipMenu Handlers
1212
1213 #region ctxCalGridMenu Handlers
1214
1215 private void ctxCalendarGrid_Popup(object sender, System.EventArgs e)
1216 {
1217 //Toggle availability of make, edit, checkin and delete appointments
1218 //based on whether appropriate element is selected.
1219 ctxCalGridAdd.Enabled = AddAppointmentEnabled();
1220 bool bEditAppointments = (EditAppointmentEnabled() && (calendarGrid1.SelectedAppointment > 0)) ;
1221 ctxCalGridDelete.Enabled = bEditAppointments;
1222 ctxCalGridEdit.Enabled = bEditAppointments;
1223 ctxCalGridCheckIn.Enabled = bEditAppointments;
1224 ctxCalGridNoShow.Enabled = bEditAppointments;
1225 ctxCalGridNoShowUndo.Enabled = bEditAppointments;
1226 ctxCalGridWalkin.Enabled = ctxCalGridAdd.Enabled;
1227 this.ctxCalGridEHR.Enabled = bEditAppointments;
1228 }
1229
1230 private void ctxCalGridAdd_Click(object sender, System.EventArgs e)
1231 {
1232 AppointmentAddNew();
1233 }
1234
1235 private void calendarGrid1_DoubleClick(object sender, System.EventArgs e)
1236 {
1237 if (calendarGrid1.SelectedAppointment > 0)
1238 AppointmentEdit();
1239 }
1240
1241 private void ctxCalGridEdit_Click(object sender, System.EventArgs e)
1242 {
1243 AppointmentEdit();
1244 }
1245
1246 private void ctxCalGridDelete_Click(object sender, System.EventArgs e)
1247 {
1248 AppointmentDelete();
1249 }
1250
1251 private void ctxCalGridCheckIn_Click(object sender, System.EventArgs e)
1252 {
1253 AppointmentCheckIn();
1254 }
1255
1256 private void ctxCalGridNoShow_Click(object sender, System.EventArgs e)
1257 {
1258 AppointmentNoShow(true);
1259 }
1260
1261 private void ctxCalGridNoShowUndo_Click(object sender, System.EventArgs e)
1262 {
1263 AppointmentNoShow(false);
1264 }
1265
1266 private void ctxCalGridEHR_Click(object sender, EventArgs e)
1267 {
1268 AppointmentEHRPatient();
1269 }
1270
1271 #endregion ctxCalGridMenu Handlers
1272
1273 #region Methods
1274
1275 private bool EditAppointmentEnabled()
1276 {
1277 try
1278 {
1279 //Call here if there is a selected appointment in the grid
1280 if (calendarGrid1.SelectedAppointment < 1)
1281 return false;
1282 CGAppointment appt = (CGAppointment)this.Appointments.AppointmentTable[calendarGrid1.SelectedAppointment];
1283 string sResource = appt.Resource;
1284 return EditAppointmentEnabled(sResource);
1285
1286 }
1287 catch (Exception ex)
1288 {
1289 string sMsg = ex.Message;
1290 return false;
1291 }
1292 }
1293
1294 private bool EditAppointmentEnabled(string sResource)
1295 {
1296
1297 bool bManager = this.DocManager.ScheduleManager;
1298 if (bManager == true)
1299 {
1300 return (true);
1301 }
1302 else
1303 {
1304 bool bModAppts;
1305 bModAppts = (bool)this.m_htChangeAppts[sResource];
1306 return bModAppts;
1307 }
1308 }
1309
1310 private bool AddAppointmentEnabled()
1311 {
1312 if (this.calendarGrid1.SelectedRange.Cells.CellCount < 1)
1313 return false;
1314
1315 bool bManager = this.DocManager.ScheduleManager;
1316 if (bManager == true)
1317 {
1318 return (true);
1319 }
1320 else
1321 {
1322 DateTime dStart = DateTime.Today;
1323 DateTime dEnd = DateTime.Today;
1324 string sResource = "";
1325 bool bRet = this.calendarGrid1.GetSelectedTime(out dStart, out dEnd, out sResource);
1326 if (bRet == false)
1327 {
1328 return false;
1329 }
1330 bool bSlotsAvailable;
1331 bool bOverbook;
1332 bool bModSchedule;
1333 bool bModAppts;
1334 bOverbook = (bool)this.m_htOverbook[sResource];
1335 bModSchedule = (bool)this.m_htModifySchedule[sResource];
1336 bModAppts = (bool)this.m_htChangeAppts[sResource];
1337 if (bModAppts == false)
1338 return false;
1339
1340 bSlotsAvailable = (this.m_nSlots > 0);
1341 return ((bSlotsAvailable) || (bModSchedule) || (bOverbook));
1342 }
1343 }
1344
1345 /// <summary>
1346 /// Clean up any resources being used.
1347 /// </summary>
1348 protected override void Dispose( bool disposing )
1349 {
1350 if( disposing )
1351 {
1352 if(components != null)
1353 {
1354 components.Dispose();
1355 }
1356 }
1357 base.Dispose( disposing );
1358 }
1359
1360 void UpdateStatusBar(DateTime dStart, DateTime dEnd, string sAccessType, string sAvailabilityMessage)
1361 {
1362 string sMsg = dStart.ToShortTimeString() + " to " + dEnd.ToShortTimeString();
1363 if (m_nSlots > 0)
1364 {
1365 sMsg = sMsg + ": " + m_nSlots.ToString() + " slot";
1366 sMsg = sMsg + ((m_nSlots > 1)?"s " : " ");
1367 sMsg = sMsg + "available";
1368 if (sAccessType != "")
1369 {
1370 sMsg = sMsg + " for " + sAccessType;
1371 }
1372 sMsg = sMsg + ".";
1373 if (sAvailabilityMessage != "")
1374 {
1375 sMsg = sMsg + " Note: " + sAvailabilityMessage;
1376 }
1377 }
1378 else
1379 {
1380 sMsg += ": No appointment slots available.";
1381 }
1382
1383 this.statusBar1.Text = sMsg;
1384 }
1385
1386 private void EditScheduleAvailability()
1387 {
1388 CGAVDocument doc = new CGAVDocument();
1389 try
1390 {
1391 //If resource already open, then navigate to its window
1392 CGAVView v =this.DocManager.GetAVViewByResource(m_alSelectedTreeResourceArray);
1393
1394 if (v != null)
1395 {
1396 v.Activate();
1397 }
1398 else
1399 {
1400 //If not already open, get a lock and open it
1401 doc.DocManager = this.DocManager;
1402 for (int j=0; j < m_alSelectedTreeResourceArray.Count; j++)
1403 {
1404 doc.AddResource((string) m_alSelectedTreeResourceArray[j]);
1405 }
1406 doc.DocName = this.m_sDocName;
1407
1408 //Get preferred time scale from resource info
1409
1410 DataTable dt = this.DocManager.GlobalDataSet.Tables["Resources"];
1411 DataView dv = new DataView(dt, "", "RESOURCE_NAME ASC", DataViewRowState.OriginalRows);
1412 int nScale = 60;
1413 int nTest=0;
1414 string sResource;
1415 int nDataRow;
1416 DataRowView drv;
1417 string sResourceID="";
1418 for (int j=0; j < m_alSelectedTreeResourceArray.Count; j++)
1419 {
1420 sResource = (string) m_alSelectedTreeResourceArray[j];
1421 nDataRow = dv.Find(sResource);
1422 Debug.Assert(nDataRow != -1);
1423 drv = dv[nDataRow];
1424 if (drv["TIMESCALE"].ToString() == "")
1425 {
1426 nTest = 15; //15 minute default
1427 }
1428 else
1429 {
1430 nTest = (int) drv["TIMESCALE"];
1431 }
1432 nScale = (nTest < nScale)?nTest : nScale ;
1433 sResourceID = drv["RESOURCEID"].ToString();
1434 }
1435
1436 doc.ResourceID = Convert.ToInt32(sResourceID);
1437
1438 bool bLock = DocManager.ConnectInfo.bmxNetLib.Lock("^BSDXRES(" + sResourceID + ")", "+");
1439 if (bLock == false)
1440 {
1441 throw new BMXNetException("Another user is currently editing availability for this resource. Try later.");
1442 }
1443
1444 doc.OnOpenDocument();
1445 v =this.DocManager.GetAVViewByResource(m_alSelectedTreeResourceArray);
1446 CalendarGrid cg = v.CGrid;
1447
1448 cg.TimeScale = nScale;
1449
1450 //Position grid to 0700
1451 PositionGrid(cg, 7);
1452 }
1453 }
1454 catch (Exception ex)
1455 {
1456 MessageBox.Show("Unable to edit availability for " + m_sDocName + " schedule. " + ex.Message, "IHS Clinical Scheduling");
1457 this.m_DocManager.CloseAllViews(doc);
1458 return;
1459 }
1460 }
1461
1462 private void OpenSelectedSchedule(ArrayList sSelectedTreeResourceArray, DateTime dDate)
1463 {
1464 //If resource already open, then navigate to its window
1465 CGDocument doc;
1466 CGView v =this.DocManager.GetViewByResource(sSelectedTreeResourceArray);
1467 if (v != null)
1468 {
1469 v.Activate();
1470 v.dateTimePicker1.Value = dDate;
1471 }
1472 else
1473 {
1474 //If not already open, open it
1475 //If current document has a resource, then open a new window
1476 //with the selected resource.
1477 //Otherwise just use the current document.
1478 if (this.Document.m_sResourcesArray.Count > 0)
1479 {
1480 doc = new CGDocument();
1481 doc.DocManager = this.DocManager;
1482 }
1483 else
1484 {
1485 doc = this.Document;
1486 }
1487 for (int j=0; j < sSelectedTreeResourceArray.Count; j++)
1488 {
1489 doc.AddResource((string) sSelectedTreeResourceArray[j]);
1490 }
1491 doc.DocName = this.m_sDocName;
1492 try
1493 {
1494 doc.OnOpenDocument();
1495 }
1496 catch (Exception ex)
1497 {
1498 MessageBox.Show("Unable to open " + m_sDocName + " schedule. " + ex.Message, "IHS Clinical Scheduling");
1499 this.m_DocManager.CloseAllViews(doc);
1500 return;
1501 }
1502 v =this.DocManager.GetViewByResource(sSelectedTreeResourceArray);
1503 v.dateTimePicker1.Value = dDate;
1504
1505 //Get preferred time scale from resource info
1506 //If more than one resource, get smallest time scale
1507 CalendarGrid cg = v.CGrid;
1508 DataTable dt = this.DocManager.GlobalDataSet.Tables["Resources"];
1509 DataView dv = new DataView(dt, "", "RESOURCE_NAME ASC", DataViewRowState.OriginalRows);
1510 int nScale = 60;
1511 int nTest=0;
1512 string sResource;
1513 int nDataRow;
1514 DataRowView drv;
1515 for (int j=0; j < sSelectedTreeResourceArray.Count; j++)
1516 {
1517 sResource = (string) sSelectedTreeResourceArray[j];
1518 nDataRow = dv.Find(sResource);
1519 Debug.Assert(nDataRow != -1);
1520 drv = dv[nDataRow];
1521 if (drv["TIMESCALE"].ToString() == "")
1522 {
1523 nTest = 15; //15 minute default
1524 }
1525 else
1526 {
1527 nTest = (int) drv["TIMESCALE"];
1528 }
1529 nScale = (nTest < nScale)?nTest : nScale ;
1530 }
1531
1532 cg.TimeScale = nScale;
1533
1534 PositionGrid(cg, 7);
1535
1536 //Get the OverBook and ModifySchedule permissions from ResourceUser table
1537 //and populate the hashtables
1538 string sOverbook;
1539 string sModSchedule;
1540 string sModAppts;
1541 bool bOverbook;
1542 bool bModSchedule;
1543 bool bModAppts;
1544 v.m_htOverbook = new Hashtable(sSelectedTreeResourceArray.Count);
1545 v.m_htModifySchedule = new Hashtable(sSelectedTreeResourceArray.Count);
1546 v.m_htChangeAppts = new Hashtable(sSelectedTreeResourceArray.Count);
1547 dt = this.DocManager.GlobalDataSet.Tables["ResourceUser"];
1548 dv = new DataView(dt, "", "RESOURCENAME ASC", DataViewRowState.OriginalRows);
1549 dv.RowFilter = "USERNAME = '" + this.DocManager.ConnectInfo.UserName + "'";
1550 for (int j=0; j < dv.Count; j++)
1551 {
1552 drv = dv[j];
1553 sResource = drv["RESOURCENAME"].ToString();
1554 sOverbook = drv["OVERBOOK"].ToString();
1555 bOverbook = (sOverbook == "YES")?true:false;
1556 sModSchedule = drv["MODIFY_SCHEDULE"].ToString();
1557 bModSchedule = (sModSchedule == "YES")?true:false;
1558 sModAppts = drv["MODIFY_APPOINTMENTS"].ToString();
1559 bModAppts = (sModAppts == "YES")?true:false;
1560 v.m_htOverbook[sResource] = bOverbook;
1561 v.m_htModifySchedule[sResource] = bModSchedule;
1562 v.m_htChangeAppts[sResource] = bModAppts;
1563 }
1564
1565 //For programmers and scheduling managers, set all permissions for all resources
1566 if (this.DocManager.ScheduleManager == true)
1567 {
1568 dt = this.DocManager.GlobalDataSet.Tables["Resources"];
1569 foreach (DataRow dr in dt.Rows)
1570 {
1571 sResource = dr["RESOURCE_NAME"].ToString();
1572 v.m_htOverbook[sResource] = true;
1573 v.m_htModifySchedule[sResource] = true;
1574 v.m_htChangeAppts[sResource] = true;
1575 }
1576 }
1577
1578 v.calendarGrid1.SetOverlapTable();
1579 v.calendarGrid1.Refresh();
1580 }
1581 }
1582
1583 private void PositionGrid(CalendarGrid cg, int nHour)
1584 {
1585 //Position grid to nHour
1586 int nRow = 0, nCol = 0;
1587 DateTime dStart = DateTime.Today;
1588 dStart = dStart.AddHours(nHour);
1589 cg.GetCellFromTime(dStart, ref nRow, ref nCol, false, "");
1590 int nHeight = cg.CellHeight + 10;
1591 nHeight *= nRow;
1592 cg.AutoScrollPosition = new Point(50, nHeight);
1593 cg.Invalidate();
1594 }
1595
1596 private void LoadTree()
1597 {
1598 //Navigate from ResourceGroup table to Resources table
1599 DataRow[] arrRows;
1600 DataRelation dr = DocManager.GlobalDataSet.Relations["GroupResource"];
1601 string sGroup;
1602 string sResource;
1603 int nIndex = 0;
1604 foreach (DataRow r in DocManager.GlobalDataSet.Tables["ResourceGroup"].Rows)
1605 {
1606 sGroup = r["RESOURCE_GROUP"].ToString();
1607 TreeNode deptNode = new TreeNode(sGroup);
1608 nIndex = this.tvSchedules.Nodes.Add(deptNode);
1609 tvSchedules.Nodes[nIndex].Tag = "Dept";
1610 arrRows = r.GetChildRows(dr);
1611 for (int i=0; i< arrRows.Length; i++)
1612 {
1613 sResource = arrRows[i]["RESOURCE_NAME"].ToString();
1614 TreeNode resNode = new TreeNode(sResource);
1615 int nResIndex = deptNode.Nodes.Add(resNode);
1616 deptNode.Nodes[nResIndex].Tag = "Resource";
1617 }
1618 }
1619 }
1620
1621 public void CreateNewSchedule()
1622 {
1623 //Create a new document and open it
1624 CGDocument doc = new CGDocument();
1625 doc.DocManager = this.DocManager;
1626 try
1627 {
1628 doc.OnOpenDocument();
1629 }
1630 catch (Exception ex)
1631 {
1632 MessageBox.Show("Unable to open " + m_sDocName + " schedule. " + ex.Message, "IHS Clinical Scheduling");
1633 this.m_DocManager.CloseAllViews(doc);
1634 return;
1635 }
1636 }
1637
1638 private void AppointmentEHRPatient()
1639 {
1640 try
1641 {
1642 int nApptID = this.calendarGrid1.SelectedAppointment;
1643 Debug.Assert(nApptID != 0);
1644
1645 CGAppointment a = (CGAppointment)this.Appointments.AppointmentTable[nApptID];
1646
1647 string sDFN = a.PatientID.ToString();
1648 if (sDFN == "")
1649 return;
1650
1651 string sWID = Environment.MachineName;
1652 string sCmd = "BSDX EHR PATIENT^" + sWID + "^" + sDFN;
1653 DataTable dtAppt = this.DocManager.RPMSDataTable(sCmd, "EHR Patient");
1654
1655 }
1656 catch (Exception ex)
1657 {
1658 Debug.Write("CGView.AppointmentEHRPatient Failed: " + ex.Message);
1659 }
1660 }
1661
1662 private void AppointmentEdit()
1663 {
1664 try
1665 {
1666 int nApptID = this.calendarGrid1.SelectedAppointment;
1667 Debug.Assert(nApptID != 0);
1668
1669 CGAppointment a = (CGAppointment) this.Appointments.AppointmentTable[nApptID];
1670
1671 DAppointPage dAppt = new DAppointPage();
1672 dAppt.DocManager = this.m_DocManager;
1673 dAppt.InitializePage(a);
1674
1675 calendarGrid1.CGToolTip.Active = false;
1676
1677 if (dAppt.ShowDialog(this) == DialogResult.Cancel)
1678 {
1679 calendarGrid1.CGToolTip.Active = true;
1680 return;
1681 }
1682 calendarGrid1.CGToolTip.Active = true;
1683
1684 string sNote = dAppt.Note;
1685
1686 //Call Document to edit appointment
1687 this.Document.EditAppointment(a, sNote);
1688
1689 }
1690 catch (Exception ex)
1691 {
1692 Debug.Write("CGView.AppointmentEdit Failed: " + ex.Message);
1693 }
1694 }
1695
1696 /// <summary>
1697 /// Marks all selected appointments as No Show
1698 /// </summary>
1699 /// <param name="nApptID"></param>
1700 /// <returns></returns>
1701 private void AppointmentNoShow(bool bNoShow)
1702 {
1703
1704 //bNoShow indicates whether to mark or un-mark as noshow
1705 bool bMarked = false; //Indicates at least one attempt to mark as noshow succeeded
1706 bool bRebook = false; //Stores user's response to auto-rebook dialog question
1707 CGAppointments alRebookList = new CGAppointments();
1708 DNoShow dlg = new DNoShow();;
1709 if (bNoShow == true)
1710 {
1711 if (dlg.ShowDialog(this) == DialogResult.Cancel)
1712 {
1713 return;
1714 }
1715 }
1716
1717 bRebook = dlg.AutoRebook;
1718
1719 foreach (CGAppointment a in this.calendarGrid1.SelectedAppointments.AppointmentTable.Values)
1720 {
1721 int nApptID = a.AppointmentKey;
1722 Debug.Assert(nApptID != 0);
1723 try
1724 {
1725 if ((bNoShow == true)
1726 &&
1727 (a.StartTime.Date > DateTime.Today.Date)
1728 &&
1729 (MessageBox.Show(this, "The appointment for " + a.PatientName + " is in the future. Are you sure you want to No-Show?", "IHS Windows Scheduling", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK))
1730 {
1731 }
1732 else
1733 {
1734 string sError = Document.AppointmentNoShow(nApptID, bNoShow);
1735 if (sError != "1")
1736 throw new Exception(sError);
1737
1738 bMarked = true;
1739 }
1740 }
1741 catch (Exception ex)
1742 {
1743 MessageBox.Show("Unable to mark appointment No Show: " + ex.Message, "IHS Clinical Scheduling");
1744 }
1745 if (bRebook == true)
1746 {
1747 try
1748 {
1749 CGAppointment aRebook;
1750 int nMinimumdays = dlg.RebookStartDays;
1751 int nMaximumdays = dlg.RebookMaxDays;
1752 int nAccessType = dlg.RebookAccessType;
1753 //-1 means use current type
1754
1755 if (nAccessType == -1)
1756 {
1757 //Get access type from grid
1758 int nRow = 0;
1759 int nCol = 0;
1760 CGCell cgCell = new CGCell();
1761 this.calendarGrid1.GetCellFromTime(a.StartTime, ref nRow, ref nCol, true , a.Resource);
1762 cgCell.CellColumn = nCol;
1763 cgCell.CellRow = nRow;
1764 this.calendarGrid1.GetTypeFromCell(cgCell, out nAccessType);
1765 a.AccessTypeID = nAccessType;
1766 }
1767 string sResult = Document.AutoRebook(a, nAccessType, nMinimumdays, nMaximumdays, out aRebook);
1768 if (sResult == "1")
1769 {
1770 //Add appointment to list of rebooked appointments
1771 alRebookList.AddAppointment(a);
1772 }
1773 else
1774 {
1775 MessageBox.Show("Unable to rebook this patient: " + a.PatientName);
1776 }
1777
1778 }
1779 catch (Exception ex)
1780 {
1781 MessageBox.Show("Unable to rebook: " + ex.Message);
1782 }
1783 }
1784 }
1785
1786 if (bMarked == true)
1787 {
1788 //Notify other scheduling users that this schedule has changed
1789 try
1790 {
1791 this.Document.RefreshDocument();
1792 RaiseRPMSEvent("BSDX SCHEDULE" , m_Document.DocName);
1793 }
1794 catch (Exception ex)
1795 {
1796 Debug.Write(ex.Message);
1797 }
1798 this.calendarGrid1.Invalidate();
1799
1800 AutoRebookFromList(alRebookList);
1801 }
1802 }
1803
1804 private void AutoRebookFromList(CGAppointments alRebookList)
1805 {
1806 //Print AutoRebook letters.
1807 if (alRebookList.AppointmentCount > 0)
1808 {
1809 //build |-delimited list of ApptIDs to pass to BSDX REBOOK LIST
1810 string sApptIDList = "";
1811
1812 System.Collections.ArrayList a = new ArrayList();
1813
1814 foreach (CGAppointment appt in alRebookList.AppointmentTable.Values)
1815 {
1816 string sApptID = appt.AppointmentKey.ToString() + "|";
1817 sApptIDList += sApptID;
1818 if (a.Contains(appt.Resource) == false)
1819 a.Add(appt.Resource);
1820 }
1821 //Call rebook letters RPC to get datatable
1822 string sClinicList = "";
1823 foreach (string sRes in a)
1824 {
1825 sClinicList = sClinicList + sRes + "|";
1826 }
1827 string sSql = "BSDX REBOOK LIST^" + sApptIDList;
1828 DataTable dtLetters = m_DocManager.RPMSDataTable(sSql, "PatientAppts");
1829 DPatientLetter dpl = new DPatientLetter();
1830
1831 dpl.InitializeFormRebookLetters(this.DocManager, sClinicList, dtLetters);
1832 dpl.ShowDialog(this);
1833 }
1834 }
1835
1836 /// <summary>
1837 /// Delete appointment ApptID
1838 /// </summary>
1839 /// <param name="nApptID"></param>
1840 /// <returns></returns>
1841 private string AppointmentDeleteOne(int nApptID)
1842 {
1843 return Document.DeleteAppointment(nApptID);
1844 }
1845
1846 /// <summary>
1847 /// Delete all selected appointments
1848 /// </summary>
1849 private void AppointmentDelete()
1850 {
1851 calendarGrid1.CGToolTip.Active = false;
1852 CGAppointments alRebookList = new CGAppointments();
1853
1854 DCancelAppt dCancel = new DCancelAppt();
1855 dCancel.InitializePage(this.m_DocManager);
1856 if (dCancel.ShowDialog(this) != DialogResult.OK)
1857 {
1858 calendarGrid1.CGToolTip.Active = true;
1859 return;
1860 }
1861
1862 bool bClinic = dCancel.ClinicCancelled;
1863 int nReason = dCancel.CancelReason;
1864 string sRemarks = dCancel.CancelRemarks;
1865 bool bRebook = dCancel.AutoRebook;
1866 int nRebookStart = dCancel.RebookStartDays;
1867 int nRebookMax = dCancel.RebookMaxDays;
1868 int nRebookAccessType = dCancel.RebookAccessType;
1869
1870 calendarGrid1.CGToolTip.Active = true;
1871
1872 bool bDeleted = false;
1873 foreach (CGAppointment a in this.calendarGrid1.SelectedAppointments.AppointmentTable.Values)
1874 {
1875 int nApptID = a.AppointmentKey;
1876 Debug.Assert(nApptID != 0);
1877 try
1878 {
1879 string sError = Document.DeleteAppointment(nApptID,bClinic, nReason, sRemarks);
1880 if (sError != "")
1881 throw new Exception(sError);
1882
1883 bDeleted = true;
1884 if (bRebook == true)
1885 {
1886 try
1887 {
1888 //TODO: Parameterize or dialogize the minum and maximum rebook days
1889 CGAppointment aRebook;
1890 int nMinimumdays = nRebookStart;
1891 int nMaximumdays = nRebookMax;
1892 string sResult = Document.AutoRebook(a, nRebookAccessType, nMinimumdays, nMaximumdays, out aRebook);
1893 if (sResult == "1")
1894 {
1895 //Add appointment to list of rebooked appointments
1896 alRebookList.AddAppointment(a);
1897 }
1898
1899 }
1900 catch (Exception ex)
1901 {
1902 MessageBox.Show("Unable to rebook: " + ex.Message);
1903 }
1904 }
1905 }
1906 catch (Exception ex)
1907 {
1908 MessageBox.Show("Unable to delete appointment. " + ex.Message, "IHS Clinical Scheduling");
1909 }
1910
1911 }
1912 if (bDeleted == true)
1913 {
1914 try
1915 {
1916 RaiseRPMSEvent("BSDX SCHEDULE" , m_Document.DocName);
1917 }
1918 catch (Exception ex)
1919 {
1920 Debug.Write(ex.Message);
1921 }
1922 this.calendarGrid1.Invalidate();
1923 if (bRebook == true)
1924 {
1925 AutoRebookFromList(alRebookList);
1926 }
1927 }
1928
1929 }
1930
1931 private void AppointmentCheckIn()
1932 {
1933 bool bDeleted = false;
1934 int nApptID = this.calendarGrid1.SelectedAppointment;
1935 Debug.Assert(nApptID != 0);
1936
1937 CGAppointment a = (CGAppointment) this.Appointments.AppointmentTable[nApptID];
1938
1939 try
1940 {
1941
1942 bool bAlreadyCheckedIn = false;
1943 if (a.CheckInTime.Ticks > 0)
1944 bAlreadyCheckedIn = true;
1945
1946 if ((bAlreadyCheckedIn == false)
1947 &&
1948 (a.StartTime.Date > DateTime.Today.Date))
1949 {
1950 MessageBox.Show(this, "It is too early to check in " + a.PatientName, "IHS Windows Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
1951 return;
1952 }
1953 //Find the default provider for the resource & load into combo box
1954 DataView rv = new DataView(this.m_DocManager.GlobalDataSet.Tables["Resources"]);
1955 rv.Sort="RESOURCE_NAME ASC";
1956 int nFind = rv.Find((string) a.Resource);
1957 DataRowView drv = rv[nFind];
1958
1959 string sHospLoc = drv["HOSPITAL_LOCATION_ID"].ToString();
1960 sHospLoc = (sHospLoc == "")?"0":sHospLoc;
1961 int nHospLoc = 0;
1962 try
1963 {
1964 nHospLoc = Convert.ToInt32(sHospLoc);
1965 }
1966 catch(Exception ex)
1967 {
1968 Debug.Write("CGView.AppointmentCheckIn Error: " + ex.Message);
1969 }
1970
1971
1972 string sProv = "";
1973 string sProvReqd = "NO";
1974 string sPCC = "NO";
1975 string sMultCodes = "NO";
1976 string sStopCode = "";
1977 bool bProvReqd = false;
1978 bool bPCC = false;
1979 bool bMultCodes = false;
1980 if (nHospLoc > 0)
1981 {
1982 DataRow dr = drv.Row;
1983 DataRow drHL = dr.GetParentRow(m_DocManager.GlobalDataSet.Relations["HospitalLocationResource"]);
1984 sProv = drHL["DEFAULT_PROVIDER"].ToString();
1985 sStopCode = drHL["STOP_CODE_NUMBER"].ToString();
1986
1987 DataRow[] draCS = drHL.GetChildRows(m_DocManager.GlobalDataSet.Relations["HospitalLocationClinic"]);
1988 if (draCS.GetLength(0) > 0)
1989 {
1990 DataRow drCS = draCS[0];
1991 sProvReqd = drCS["VISIT_PROVIDER_REQUIRED"].ToString();
1992 sPCC = drCS["GENERATE_PCCPLUS_FORMS?"].ToString();
1993 sMultCodes = drCS["MULTIPLE_CLINIC_CODES_USED?"].ToString();
1994 }
1995 bProvReqd = (sProvReqd == "YES")?true:false;
1996 bPCC = (sPCC == "YES")?true:false;
1997 bMultCodes = (sMultCodes == "YES")?true:false;
1998 }
1999
2000 DCheckIn dlgCheckin = new DCheckIn();
2001 dlgCheckin.InitializePage(a, this.m_DocManager, sProv, bProvReqd, bPCC, bMultCodes, sStopCode);
2002 calendarGrid1.CGToolTip.Active = false;
2003 if (dlgCheckin.ShowDialog(this) != DialogResult.OK)
2004 {
2005 calendarGrid1.CGToolTip.Active = true;
2006 return;
2007 }
2008 calendarGrid1.CGToolTip.Active = true;
2009
2010 if (bAlreadyCheckedIn == true)
2011 return;
2012
2013 DateTime dtCheckIn = dlgCheckin.CheckInTime;
2014
2015 /*
2016 * Need to pass Provider, ClinicStop, PrintRouteSlip,
2017 * PCC Clinic, PCC Form, Print OutGuide
2018 */
2019
2020 this.Document.CheckInAppointment(nApptID, dtCheckIn,
2021 dlgCheckin.ClinicStopIEN,
2022 dlgCheckin.ProviderIEN,
2023 dlgCheckin.PrintRouteSlip,
2024 dlgCheckin.PCCClinicIEN,
2025 dlgCheckin.PCCFormIEN,
2026 dlgCheckin.PCCOutGuide
2027 );
2028 this.calendarGrid1.Invalidate();
2029 }
2030 catch (Exception ex)
2031 {
2032 MessageBox.Show("Error checking in patient: " + ex.Message, "IHS Clinical Scheduling");
2033 }
2034
2035 if (bDeleted == true)
2036 {
2037 try
2038 {
2039 RaiseRPMSEvent("BSDX SCHEDULE" , m_Document.DocName);
2040 }
2041 catch (Exception ex)
2042 {
2043 Debug.Write(ex.Message);
2044 }
2045 this.calendarGrid1.Invalidate();
2046 }
2047 }
2048
2049 private void AppointmentAddWalkin()
2050 {
2051 try
2052 {
2053 CGAppointment appt = new CGAppointment();
2054
2055 //Get Time and Resource from Selected Cell
2056 DateTime dStart = DateTime.Today;
2057 DateTime dEnd = DateTime.Today;
2058 string sResource = "";
2059 bool bRet = this.calendarGrid1.GetSelectedTime(out dStart, out dEnd, out sResource);
2060 if (bRet == false)
2061 return;
2062
2063 TimeSpan tsDuration = dEnd - dStart;
2064 int nDuration = (int) tsDuration.TotalMinutes;
2065 Debug.Assert(nDuration > 0);
2066
2067 /*
2068 * 8-10-05 Added check to prevent walkin from being created
2069 * on a date later than today.
2070 */
2071
2072 if (dStart.Date > DateTime.Today.Date)
2073 {
2074 MessageBox.Show(this, "You cannot create a walk-in appointment for a date in the future.\n Select today's date and try again.", "IHS Windows Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
2075 return;
2076 }
2077
2078 /*
2079 * 8-10-05 Added overbook prompt for walkin
2080 */
2081 this.Document.RefreshDocument();
2082 string sAccessType = "";
2083 string sAvailabilityMessage = "";
2084 m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, out sAccessType, out sAvailabilityMessage);
2085
2086 if (m_nSlots < 1)
2087 {
2088 DialogResult dr = MessageBox.Show(this, "There are no slots available at the selected time. Do you want to overbook this appointment?", "IHS Clinical Scheduling",MessageBoxButtons.YesNo);
2089 if (dr != DialogResult.Yes)
2090 {
2091 return;
2092 }
2093 }
2094
2095 //Display a dialog to collect Patient Name
2096 DPatientLookup dPat = new DPatientLookup();
2097 dPat.DocManager = m_DocManager;
2098
2099 int nAccessTypeID = 0;
2100 bRet = calendarGrid1.GetSelectedType(out nAccessTypeID);
2101
2102 if (dPat.ShowDialog(this) == DialogResult.Cancel)
2103 {
2104 return;
2105 }
2106
2107 appt.PatientID = Convert.ToInt32(dPat.PatientIEN);
2108 appt.PatientName = dPat.PatientName;
2109 appt.StartTime = dStart;
2110 appt.EndTime = dEnd;
2111 appt.Resource = sResource;
2112 appt.HealthRecordNumber = dPat.HealthRecordNumber;
2113
2114 /*
2115 * 8-10-05 Copied overbook prompt for walkin
2116 * to this position in order to check just prior
2117 * to calling CreateAppointment
2118 */
2119 this.Document.RefreshDocument();
2120 m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, out sAccessType, out sAvailabilityMessage);
2121
2122 if (m_nSlots < 1)
2123 {
2124 DialogResult dr = MessageBox.Show(this, "There are no slots available at the selected time. Do you want to overbook this appointment?", "IHS Clinical Scheduling",MessageBoxButtons.YesNo);
2125 if (dr != DialogResult.Yes)
2126 {
2127 return;
2128 }
2129 }
2130
2131 //Call Document to add a walkin appointment
2132 int nApptID = this.Document.CreateAppointment(appt, true);
2133
2134 //Now check them in.
2135 calendarGrid1.SelectedAppointment = nApptID;
2136
2137 AppointmentCheckIn();
2138
2139 try
2140 {
2141 RaiseRPMSEvent("BSDX SCHEDULE" , m_Document.DocName);
2142 }
2143 catch (Exception ex)
2144 {
2145 Debug.Write(ex.Message);
2146 }
2147
2148 }
2149 catch (Exception ex)
2150 {
2151 MessageBox.Show("Unable to add walk-in appointment " + ex.Message, "IHS Clinical Scheduling");
2152 return;
2153
2154 }
2155 }
2156
2157 private void AppointmentAddNew()
2158 {
2159 try
2160 {
2161 CGAppointment appt = new CGAppointment();
2162
2163 //Get Time and Resource from Selected Cell
2164 DateTime dStart = DateTime.Today;
2165 DateTime dEnd = DateTime.Today;
2166 string sResource = "";
2167 bool bRet = this.calendarGrid1.GetSelectedTime(out dStart, out dEnd, out sResource);
2168 if (bRet == false)
2169 return;
2170
2171 //Test dStart for Holiday
2172 DataView dvHoliday = new DataView(this.DocManager.GlobalDataSet.Tables["HOLIDAY"]);
2173 dvHoliday.Sort="DATE ASC";
2174 int nFind = dvHoliday.Find(dStart.Date);
2175 if (nFind > -1)
2176 {
2177 string sHoliday = "";
2178 DataRowView drv = dvHoliday[nFind];
2179 sHoliday = drv["NAME"].ToString();
2180 if (MessageBox.Show(this, dStart.ToShortDateString() + " is a holiday (" + sHoliday + "). Are you sure you want to make this appointment?","IHS Clinical Scheduling", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
2181 return;
2182 }
2183
2184 TimeSpan tsDuration = dEnd - dStart;
2185 int nDuration = (int) tsDuration.TotalMinutes;
2186 Debug.Assert(nDuration > 0);
2187
2188 /*
2189 * 7-19-05 Added overbook prompt
2190 * 8-10-05 Copied code block prior to patient selection
2191 */
2192 this.Document.RefreshDocument();
2193 string sAccessType = "";
2194 string sAvailabilityMessage = "";
2195 m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, out sAccessType, out sAvailabilityMessage);
2196
2197 if (m_nSlots < 1)
2198 {
2199 DialogResult dr = MessageBox.Show(this, "There are no slots available at the selected time. Do you want to overbook this appointment?", "IHS Clinical Scheduling",MessageBoxButtons.YesNo);
2200 if (dr != DialogResult.Yes)
2201 {
2202 return;
2203 }
2204 }
2205
2206 //Display a dialog to collect Patient Name
2207 DPatientLookup dPat = new DPatientLookup();
2208 dPat.DocManager = m_DocManager;
2209
2210 int nAccessTypeID = 0;
2211 bRet = calendarGrid1.GetSelectedType(out nAccessTypeID);
2212
2213 if (dPat.ShowDialog(this) == DialogResult.Cancel)
2214 {
2215 return;
2216 }
2217
2218 //Call the appointment dialog to collect the appointment info
2219 Debug.Assert(dPat.PatientIEN != "");
2220 DAppointPage dAppt = new DAppointPage();
2221 dAppt.DocManager = this.m_DocManager;
2222 string sNote = "";
2223 dAppt.InitializePage(dPat.PatientIEN, dStart, nDuration, sResource, sNote);
2224
2225 if (dAppt.ShowDialog(this) == DialogResult.Cancel)
2226 {
2227 return;
2228 }
2229
2230 appt.PatientID = Convert.ToInt32(dPat.PatientIEN);
2231 appt.PatientName = dPat.PatientName;
2232 appt.StartTime = dStart;
2233 appt.EndTime = dEnd;
2234 appt.Resource = sResource;
2235 appt.Note = dAppt.Note;
2236 appt.HealthRecordNumber = dPat.HealthRecordNumber;
2237 appt.AccessTypeID = nAccessTypeID;
2238
2239 /*
2240 * 7-19-05 Added overbook prompt
2241 * 8-10-05 Copied code block prior to patient selection
2242 */
2243 this.Document.RefreshDocument();
2244 m_nSlots = m_Document.SlotsAvailable(dStart, dEnd, sResource, out sAccessType, out sAvailabilityMessage);
2245
2246 if (m_nSlots < 1)
2247 {
2248 DialogResult dr = MessageBox.Show(this, "There are no slots available at the selected time. Do you want to overbook this appointment?", "IHS Clinical Scheduling",MessageBoxButtons.YesNo);
2249 if (dr != DialogResult.Yes)
2250 {
2251 return;
2252 }
2253 }
2254
2255 //Call Document to add a new appointment
2256 this.Document.CreateAppointment(appt);
2257 }
2258 catch (Exception ex)
2259 {
2260 MessageBox.Show("Unable to add new appointment " + ex.Message, "IHS Clinical Scheduling");
2261 return;
2262
2263 }
2264 try
2265 {
2266 RaiseRPMSEvent("BSDX SCHEDULE" , m_Document.DocName);
2267 this.calendarGrid1.Invalidate();
2268 }
2269 catch (Exception ex)
2270 {
2271 Debug.Write(ex.Message);
2272 }
2273 }
2274
2275 public void OnUpdateSchedule()
2276 {
2277 try
2278 {
2279 this.Cursor = Cursors.WaitCursor;
2280 m_Document.RefreshDocument();
2281 }
2282 catch (Exception ex)
2283 {
2284 MessageBox.Show("Unable to refresh document " + ex.Message, "IHS Clinical Scheduling");
2285 }
2286 finally
2287 {
2288 this.Cursor = Cursors.Default;
2289 }
2290 }
2291
2292 public void UpdateArrays()
2293 {
2294 Debug.Assert(this.InvokeRequired == false,"CGView.UpdateArrays InvokeRequired");
2295 try
2296 {
2297 this.calendarGrid1.AvailabilityArray = this.m_Document.AvailabilityArray;
2298 this.calendarGrid1.Resources = this.m_Document.Resources;
2299 this.calendarGrid1.OnUpdateArrays();
2300 this.lblResource.Text = this.m_Document.DocName;
2301 this.calendarGrid1.Invalidate();
2302 }
2303 catch (Exception ex)
2304 {
2305 MessageBox.Show("Unable to update arrays " + ex.Message, "IHS Clinical Scheduling");
2306 }
2307 }
2308
2309 public void RaiseRPMSEvent(string sEvent, string sParams)
2310 {
2311 try
2312 {
2313 //Signal RPMS to raise an event
2314 m_ConnectInfo.RaiseEvent(sEvent, sParams, true);
2315 }
2316 catch (Exception ex)
2317 {
2318 Debug.Write(ex.Message);
2319 }
2320 }
2321
2322 private void SchedulingManagement()
2323 {
2324 try
2325 {
2326 bool bLock = DocManager.ConnectInfo.Lock("^BSDXMGR", "+", "");
2327 if (bLock == false)
2328 {
2329 throw new Exception("Another user is currently in Scheduling Management. Try later.");
2330 }
2331
2332 DManagement dMgm = new DManagement();
2333 dMgm.InitializeDialog(this.m_DocManager);
2334
2335 if (dMgm.ShowDialog(this) == DialogResult.Cancel)
2336 {
2337 }
2338
2339 m_DocManager.GlobalDataSet.Tables["ResourceUser"].Clear();
2340 m_DocManager.LoadResourceUserTable(false);
2341 bLock = DocManager.ConnectInfo.bmxNetLib.Lock("^BSDXMGR", "-");
2342 }
2343 catch (ApplicationException aex)
2344 {
2345 string sMsg = aex.Message;
2346 MessageBox.Show("Unable to acquire transmit lock. Try later.");
2347 }
2348 catch (Exception ex)
2349 {
2350 MessageBox.Show("Scheduling Management Error: " + ex.Message, "IHS Clinical Scheduling");
2351 }
2352 }
2353
2354 public void UpdateTree()
2355 {
2356 this.tvSchedules.Nodes.Clear();
2357 this.LoadTree();
2358 }
2359
2360 public void ViewPatientAppointments()
2361 {
2362 try
2363 {
2364 //Display a dialog to collect Patient Name
2365 DPatientLookup dPat = new DPatientLookup();
2366 dPat.DocManager = m_DocManager;
2367 if (dPat.ShowDialog(this) == DialogResult.Cancel)
2368 {
2369 return;
2370 }
2371
2372 Debug.Assert(dPat.PatientIEN != "");
2373 int nPatientID = Convert.ToInt32(dPat.PatientIEN);
2374 ViewPatientAppointments(nPatientID);
2375 }
2376 catch (Exception ex)
2377 {
2378 MessageBox.Show(this, ex.Message, "IHS Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
2379 }
2380 }
2381
2382 public void ViewPatientAppointments(int PatientID)
2383 {
2384 DPatientApptDisplay dPa = new DPatientApptDisplay();
2385
2386 dPa.InitializeForm(this.DocManager, PatientID);
2387
2388
2389 if (dPa.ShowDialog(this) != DialogResult.Cancel)
2390 {
2391
2392 }
2393
2394 }
2395
2396 private void FindAvailableAppointment(ArrayList alResourceArray)
2397 {
2398 DApptSearch dSearch = new DApptSearch();
2399 dSearch.InitializePage(alResourceArray, this.m_DocManager);
2400 if (dSearch.ShowDialog(this) == DialogResult.Cancel)
2401 return;
2402
2403 string sResource = dSearch.SelectedResource;
2404 ArrayList alResource = new ArrayList();
2405 alResource.Add(sResource);
2406 DateTime sDate = dSearch.SelectedDate;
2407 m_sDocName = sResource;
2408 OpenSelectedSchedule(alResource, sDate);
2409
2410 }
2411
2412 private void PrintPatientLetter()
2413 {
2414 //Prompt for patient and
2415 //Print letter for individual patient
2416 try
2417 {
2418 //Display a dialog to collect Patient Name
2419 DPatientLookup dPat = new DPatientLookup();
2420 dPat.DocManager = m_DocManager;
2421 if (dPat.ShowDialog(this) == DialogResult.Cancel)
2422 {
2423 return;
2424 }
2425
2426 Debug.Assert(dPat.PatientIEN != "");
2427 int nPatientID = Convert.ToInt32(dPat.PatientIEN);
2428 PrintPatientLetter(nPatientID);
2429
2430 }
2431 catch (Exception ex)
2432 {
2433 MessageBox.Show(this, ex.Message, "IHS Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
2434 }
2435 }
2436
2437 private void PrintPatientLetter(int PatientID)
2438 {
2439 //Print letter for individual patient
2440 try
2441 {
2442 DPatientLetter dPa = new DPatientLetter();
2443 dPa.InitializeForm(DocManager, PatientID);
2444
2445 if (dPa.ShowDialog(this) != DialogResult.Cancel)
2446 {
2447 return;
2448 }
2449 }
2450 catch (Exception ex)
2451 {
2452 throw ex;
2453 }
2454 }
2455
2456 #endregion Methods
2457
2458 #region Events
2459
2460 private void CGView_Load(object sender, System.EventArgs e)
2461 {
2462 Debug.Assert (this.Document != null);
2463
2464 //Register the view
2465 CGDocumentManager.Current.RegisterDocumentView(this.Document, this);
2466 this.mnu5Day.Click += new System.EventHandler(this.dateTimePicker1_ValueChanged); // MJL 1/17/2007
2467 this.mnu7Day.Click += new System.EventHandler(this.dateTimePicker1_ValueChanged);
2468
2469 //Load the Group-Resource treeview
2470 LoadTree();
2471
2472 this.SetDesktopLocation(this.DesktopLocation.X + 10, this.DesktopLocation.Y + 10);
2473 }
2474
2475 private void mnuOpenSchedule_Click(object sender, System.EventArgs e)
2476 {
2477 CreateNewSchedule();
2478 }
2479
2480 private void mnu1Day_Click(object sender, System.EventArgs e)
2481 {
2482 DateTime dtPicker = dateTimePicker1.Value;
2483 DateTime DayOnly = new DateTime(dtPicker.Year, dtPicker.Month, dtPicker.Day);
2484 this.calendarGrid1.StartDate = DayOnly;
2485 this.calendarGrid1.Columns = 1;
2486 }
2487
2488 private void mnu5Day_Click(object sender, System.EventArgs e)
2489 {
2490 if (this.calendarGrid1.Columns == 1)
2491 {
2492 this.StartDate = this.Document.StartDate;
2493 }
2494
2495 this.calendarGrid1.Columns = 5;
2496 this.Document.m_nColumnCount = 5; // MJL 1/17/2007
2497 //this.Document.UpdateAllViews();
2498 }
2499
2500 private void mnu7Day_Click(object sender, System.EventArgs e)
2501 {
2502 this.calendarGrid1.Columns = 7;
2503 this.Document.m_nColumnCount = 7; // MJL 1/17/2007
2504 }
2505
2506 private void mnu10Minute_Click(object sender, System.EventArgs e)
2507 {
2508 CalendarGrid cg = this.calendarGrid1;
2509 cg.TimeScale = 10;
2510 PositionGrid(cg, 7);
2511 }
2512
2513 private void mnu15Minute_Click(object sender, System.EventArgs e)
2514 {
2515 CalendarGrid cg = this.calendarGrid1;
2516 cg.TimeScale = 15;
2517 PositionGrid(cg, 7);
2518 }
2519
2520 private void mnu20Minute_Click(object sender, System.EventArgs e)
2521 {
2522 CalendarGrid cg = this.calendarGrid1;
2523 cg.TimeScale = 20;
2524 PositionGrid(cg, 7);
2525 }
2526
2527 private void mnu30Minute_Click(object sender, System.EventArgs e)
2528 {
2529 CalendarGrid cg = this.calendarGrid1;
2530 cg.TimeScale = 30;
2531 PositionGrid(cg, 7);
2532 }
2533
2534 private void mnuViewScheduleTree_Click(object sender, System.EventArgs e)
2535 {
2536 this.mnuViewScheduleTree.Checked = this.tvSchedules.Visible;
2537 this.tvSchedules.Visible = !(this.tvSchedules.Visible);
2538 this.mnuViewScheduleTree.Checked = !(this.mnuViewScheduleTree.Checked);
2539 }
2540
2541 private void tvSchedules_Click(object sender, System.EventArgs e)
2542 {
2543 bSchedulesClicked = true;
2544 }
2545
2546 private void tvSchedules_DoubleClick(object sender, System.EventArgs e)
2547 {
2548 if (m_alSelectedTreeResourceArray == null)
2549 return;
2550 if (m_alSelectedTreeResourceArray.Count < 1)
2551 {
2552 if (this.tvSchedules.SelectedNode.Text != "")
2553 {
2554 SetResourceArrayFromGroup(tvSchedules.SelectedNode.Text);
2555 }
2556 else
2557 {
2558 return;
2559 }
2560 }
2561 OpenSelectedSchedule(m_alSelectedTreeResourceArray, DateTime.Today);
2562 }
2563
2564 //20041109 Added
2565 private void SetResourceArrayFromGroup(string sGroup)
2566 {
2567 //Navigate from ResourceGroup table to Resources table
2568 DataRow[] arrRows;
2569 DataRelation dr = DocManager.GlobalDataSet.Relations["GroupResource"];
2570 DataRow r = DocManager.GlobalDataSet.Tables["ResourceGroup"].Rows.Find(sGroup);
2571 arrRows = r.GetChildRows(dr);
2572 for (int i=0; i< arrRows.Length; i++)
2573 {
2574 string sResource = arrRows[i]["RESOURCE_NAME"].ToString();
2575 m_alSelectedTreeResourceArray.Add(sResource);
2576 }
2577 m_sDocName = sGroup;
2578 }
2579
2580 public void SyncTree()
2581 {
2582
2583 }
2584
2585 private void tvSchedules_BeforeSelect(object sender, System.Windows.Forms.TreeViewCancelEventArgs e)
2586 {
2587
2588 }
2589
2590 private void tvSchedules_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
2591 {
2592 if (bSchedulesClicked == false)
2593 return;
2594 bSchedulesClicked = false;
2595
2596 m_alSelectedTreeResourceArray = new ArrayList();
2597 string sResource = e.Node.FullPath;
2598 string[] ss = sResource.Split((char) 92);
2599 int l = ss.GetUpperBound(0);
2600
2601 if (l == 0) //a resource group was checked, so get all underying resources
2602 {
2603 SetResourceArrayFromGroup(ss[0]);
2604 }
2605 else
2606 {
2607 sResource = ss[l];
2608 m_alSelectedTreeResourceArray.Add(ss[1]);
2609 }
2610
2611 m_sDocName = ss[l];
2612 return;
2613
2614 }
2615
2616 private void mnuTest1_Click(object sender, System.EventArgs e)
2617 {
2618 ReaderWriterLock m_rwl = this.DocManager.ConnectInfo.bmxNetLib.BMXRWL;
2619 try
2620 {
2621 m_rwl.AcquireWriterLock(50);
2622 Debug.Write("\nTest Button 1 Acquired first lock\n");
2623 m_rwl.AcquireWriterLock(50);
2624 Debug.Write("Test Button 1 Acquired second lock\n");
2625 this.DocManager.ViewRefresh();
2626 Thread.Sleep(5000);
2627 try
2628 {
2629 }
2630 catch
2631 {
2632 }
2633 finally
2634 {
2635 m_rwl.ReleaseWriterLock();
2636 Debug.Write ("Test Button 1 released first lock.\n");
2637 m_rwl.ReleaseWriterLock();
2638 Debug.Write ("Test Button 1 released second lock.\n");
2639 }
2640
2641 return;
2642 }
2643 catch (Exception ex)
2644 {
2645 Debug.Write("Test Button 1 exception: " + ex.Message + "\n");
2646 }
2647 }
2648
2649 private void CGView_Closing(object sender, System.ComponentModel.CancelEventArgs e)
2650 {
2651 try
2652 {
2653 m_ConnectInfo.BMXNetEvent -= m_bmxDelegate;
2654 this.calendarGrid1.CloseGrid();
2655 }
2656 catch (Exception ex)
2657 {
2658 Debug.Write("CGView_Closing exception: " + ex.Message + "\n");
2659 }
2660 }
2661
2662 private void mnuViewRightPanel_Click(object sender, System.EventArgs e)
2663 {
2664 this.mnuViewRightPanel.Checked = this.panelRight.Visible;
2665 this.panelRight.Visible = !(this.panelRight.Visible);
2666 this.mnuViewRightPanel.Checked = !(this.mnuViewRightPanel.Checked);
2667 }
2668
2669 private void dateTimePicker1_ValueChanged(object sender, System.EventArgs e)
2670 {
2671 DateTime dDate = dateTimePicker1.Value;
2672 dDate = dDate.Date;
2673 this.Document.SelectedDate = dDate;
2674 if (this.Document.Resources.Count == 1)
2675 {
2676 if (this.calendarGrid1.Columns > 1)
2677 {
2678 this.StartDate = this.Document.StartDate;
2679 }
2680 else
2681 {
2682 this.StartDate = this.Document.SelectedDate;
2683 }
2684 }
2685 else
2686 {
2687 this.StartDate = this.Document.SelectedDate;
2688 }
2689 this.Document.UpdateAllViews();
2690 this.calendarGrid1.Invalidate();
2691 }
2692
2693 private void calendarGrid1_CGSelectionChanged(object sender, IndianHealthService.ClinicalScheduling.CGSelectionChangedArgs e)
2694 {
2695 string sAccessType = "";
2696 string sAvailabilityMessage = "";
2697 m_nSlots = m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage);
2698 UpdateStatusBar(e.StartTime, e.EndTime, sAccessType, sAvailabilityMessage);
2699 }
2700
2701 private void calendarGrid1_CGAppointmentChanged(object sender, IndianHealthService.ClinicalScheduling.CGAppointmentChangedArgs e)
2702 {
2703 try
2704 {
2705 if (e.Appointment.CheckInTime.Ticks > 0)
2706 {
2707 MessageBox.Show("You cannot change the appointment time because the patient has already checked in.", "IHS Clinical Scheduling", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
2708 return;
2709 }
2710
2711 if (EditAppointmentEnabled(e.Resource) == false)
2712 return;
2713 if (EditAppointmentEnabled(e.Appointment.Resource) == false)
2714 return;
2715
2716 if (MessageBox.Show("Are you sure you want to move this appointment?", "IHS Clinical Scheduling", MessageBoxButtons.YesNo) != DialogResult.Yes)
2717 return;
2718
2719 //20040909 Cherokee Replaced this block with following
2720 string sAccessType = "";
2721 string sAvailabilityMessage = "";
2722 // if (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) < 1)
2723 // {
2724 // MessageBox.Show("There are no appointment slots available for the selected time.");
2725 // return;
2726 // }
2727 bool bOverbook =false;
2728 if (m_htOverbook.Count > 0)
2729 {
2730 bOverbook = (bool) this.m_htOverbook[e.Resource.ToString()];
2731 }
2732 bool bModSchedule =false;
2733 if (m_htModifySchedule.Count > 0)
2734 {
2735 bModSchedule = (bool) this.m_htModifySchedule[e.Resource.ToString()];
2736 }
2737 bool bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) > 0);
2738 if (!((bSlotsAvailable) || (bModSchedule) || (bOverbook) ))
2739 {
2740 MessageBox.Show("There are no appointment slots available for the selected time.");
2741 return;
2742 }
2743
2744 /*
2745 * 7-19-05 Added overbook prompt
2746 */
2747 if (bSlotsAvailable == false)
2748 {
2749 DialogResult dr = MessageBox.Show(this, "There are no slots available at the selected time. Do you want to overbook this appointment?", "IHS Clinical Scheduling",MessageBoxButtons.YesNo);
2750 if (dr != DialogResult.Yes)
2751 {
2752 return;
2753 }
2754 }
2755
2756 e.Appointment.StartTime = e.StartTime;
2757 e.Appointment.EndTime = e.EndTime;
2758 e.Appointment.Resource = e.Resource;
2759 e.Appointment.AccessTypeID = e.AccessTypeID;
2760 m_Document.CreateAppointment(e.Appointment);
2761
2762 string sError = AppointmentDeleteOne(e.Appointment.AppointmentKey);
2763 if (sError != "")
2764 {
2765 MessageBox.Show(sError);
2766 return;
2767 }
2768
2769 }
2770 catch (Exception ex)
2771 {
2772 MessageBox.Show("Unable to change appointment " + ex.Message, "IHS Clinical Scheduling");
2773 this.m_DocManager.UpdateViews();
2774 return;
2775 }
2776 finally
2777 {
2778
2779 }
2780 try
2781 {
2782 RaiseRPMSEvent("BSDX SCHEDULE" , e.Resource);
2783 if (e.Resource != e.OldResource)
2784 RaiseRPMSEvent("BSDX SCHEDULE", e.OldResource);
2785 this.m_DocManager.UpdateViews(e.Resource, e.OldResource);
2786 }
2787 catch (Exception ex)
2788 {
2789 Debug.Write(ex.Message);
2790 }
2791 }
2792
2793 private void mnuSchedulingManagment_Click(object sender, System.EventArgs e)
2794 {
2795 SchedulingManagement();
2796 }
2797
2798 private void mnuFile_Popup(object sender, System.EventArgs e)
2799 {
2800 this.mnuSchedulingManagment.Enabled = DocManager.ScheduleManager;
2801 }
2802
2803 private void mnuFindAppt_Click(object sender, System.EventArgs e)
2804 {
2805 FindAvailableAppointment(this.Document.Resources);
2806 }
2807
2808 private void mnuRPMSServer_Click(object sender, System.EventArgs e)
2809 {
2810 //Handled by DocumentManager class
2811 }
2812
2813 private void mnuRPMSLogin_Click(object sender, System.EventArgs e)
2814 {
2815 //Handled by DocumentManager class
2816 }
2817
2818 private void CGView_Activated(object sender, System.EventArgs e)
2819 {
2820 calendarGrid1.GridEnter = true;
2821 }
2822
2823 private void mnuHelpAbout_Click(object sender, System.EventArgs e)
2824 {
2825 MessageBox.Show("IHS Clinical Scheduling Version " + Application.ProductVersion, "IHS Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Information);
2826 }
2827
2828 private void ImplementMsg()
2829 {
2830 MessageBox.Show("IHS Clinical Scheduling", "TODO: Implement this function");
2831 }
2832
2833 private void mnuClose_Click(object sender, System.EventArgs e)
2834 {
2835 DialogResult dr = MessageBox.Show("Are you sure you want to close this schedule?", Application.ProductName, MessageBoxButtons.OKCancel);
2836 if (dr != DialogResult.OK)
2837 return;
2838
2839 this.Close();
2840 }
2841
2842 private void mnuViewPatientAppts_Click(object sender, System.EventArgs e)
2843 {
2844 ViewPatientAppointments();
2845 }
2846
2847 private void lstClip_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
2848 {
2849 bool b = e.Data.GetDataPresent(typeof(CGAppointment));
2850 if (b == true)
2851 {
2852 e.Effect = DragDropEffects.Move;
2853 }
2854 else
2855 {
2856 e.Effect = DragDropEffects.None;
2857 }
2858
2859 }
2860
2861 private void lstClip_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
2862 {
2863 try
2864 {
2865 CGAppointment a = (CGAppointment) e.Data.GetData(typeof(CGAppointment));
2866 if (m_ClipList.AppointmentTable.Contains((int) a.AppointmentKey))
2867 {
2868 return;
2869 }
2870 m_ClipList.AddAppointment(a);
2871 lstClip.Items.Add(a);
2872 }
2873 catch(Exception ex)
2874 {
2875 Debug.Write(ex.Message);
2876 }
2877
2878 }
2879
2880 private void lstClip_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
2881 {
2882 m_bDragDropStart = false;
2883 }
2884
2885 private void lstClip_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
2886 {
2887 try
2888 {
2889 if ((m_bDragDropStart == false)&&(lstClip.SelectedIndex > -1))
2890 {
2891 CGAppointment a = (CGAppointment) lstClip.Items[lstClip.SelectedIndex];
2892 this.calendarGrid1.ApptDragSource = "list";
2893 DragDropEffects effect = DoDragDrop(a, DragDropEffects.Move);
2894 m_bDragDropStart = true;
2895 }
2896 }
2897 catch (Exception ex)
2898 {
2899 Debug.Write(ex.Message);
2900 }
2901 }
2902
2903 private void calendarGrid1_CGAppointmentAdded(object sender, IndianHealthService.ClinicalScheduling.CGAppointmentChangedArgs e)
2904 {
2905 try
2906 {
2907 string sAccessType = "";
2908 string sAvailabilityMessage = "";
2909 bool bSlotsAvailable;
2910 bool bOverbook;
2911 bool bModSchedule;
2912 bool bModAppts;
2913
2914 if (this.EditAppointmentEnabled(e.Appointment.Resource) == false)
2915 return;
2916
2917 bModAppts = (bool) this.m_htChangeAppts[e.Resource.ToString()];
2918 if (bModAppts == false)
2919 return;
2920
2921 bOverbook = (bool) this.m_htOverbook[e.Resource.ToString()];
2922 bModSchedule = (bool) this.m_htModifySchedule[e.Resource.ToString()];
2923 bSlotsAvailable = (m_Document.SlotsAvailable(e.StartTime, e.EndTime, e.Resource, out sAccessType, out sAvailabilityMessage) > 0);
2924
2925 if (!((bSlotsAvailable) || (bModSchedule) || (bOverbook) ))
2926 {
2927 MessageBox.Show("There are no appointment slots available for the selected time.");
2928 return;
2929 }
2930
2931 /*
2932 * 7-19-05 Added overbook prompt
2933 */
2934 if (bSlotsAvailable == false)
2935 {
2936 DialogResult dr = MessageBox.Show(this, "There are no slots available at the selected time. Do you want to overbook this appointment?", "IHS Clinical Scheduling",MessageBoxButtons.YesNo);
2937 if (dr != DialogResult.Yes)
2938 {
2939 return;
2940 }
2941 }
2942
2943 e.Appointment.StartTime = e.StartTime;
2944 e.Appointment.EndTime = e.EndTime;
2945 e.Appointment.Resource = e.Resource;
2946 e.Appointment.AccessTypeID = e.AccessTypeID;
2947 m_Document.CreateAppointment(e.Appointment);
2948 }
2949 catch (Exception ex)
2950 {
2951 MessageBox.Show("Unable to add new appointment " + ex.Message, "IHS Clinical Scheduling");
2952 return;
2953 }
2954 try
2955 {
2956 RaiseRPMSEvent("BSDX SCHEDULE" , e.Resource);
2957 if (e.Resource != e.OldResource)
2958 RaiseRPMSEvent("BSDX SCHEDULE", e.OldResource);
2959 this.m_DocManager.UpdateViews(e.Resource, e.OldResource);
2960 }
2961 catch (Exception ex)
2962 {
2963 Debug.Write(ex.Message);
2964 }
2965 }
2966
2967 private void lstClip_SelectedIndexChanged(object sender, System.EventArgs e)
2968 {
2969
2970 }
2971
2972 private void mnuPrintClinicSchedules_Click(object sender, System.EventArgs e)
2973 {
2974 try
2975 {
2976 DSelectLetterClinics ds = new DSelectLetterClinics();
2977 ds.InitializePage(this.m_DocManager.GlobalDataSet, "Print Clinic Schedules");
2978 ds.SetupForReports();
2979 if (ds.ShowDialog(this) != DialogResult.OK)
2980 return;
2981
2982 //get the resource names and call the letter printer
2983
2984 string sClinics = ds.SelectedClinics;
2985 DateTime dtBegin = ds.BeginDate;
2986 DateTime dtEnd = ds.EndDate;
2987
2988 DPatientLetter dpl = new DPatientLetter();
2989 dpl.InitializeFormClinicSchedule(this.DocManager, sClinics, dtBegin, dtEnd);
2990 dpl.ShowDialog(this);
2991
2992 }
2993 catch(Exception ex)
2994 {
2995 MessageBox.Show(this, ex.Message, "IHS Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
2996 }
2997 }
2998
2999 private void mnuPrintClinicLetters_Click(object sender, System.EventArgs e)
3000 {
3001 try
3002 {
3003 DSelectLetterClinics ds = new DSelectLetterClinics();
3004 ds.InitializePage(this.m_DocManager.GlobalDataSet, "Print Reminder Letters");
3005 if (ds.ShowDialog(this) != DialogResult.OK)
3006 return;
3007
3008 //get the resource names and call the letter printer
3009
3010 string sClinics = ds.SelectedClinics;
3011 DateTime dtBegin = ds.BeginDate;
3012 DateTime dtEnd = ds.EndDate;
3013
3014 DPatientLetter dpl = new DPatientLetter();
3015 dpl.InitializeFormClinicLetters(this.DocManager, sClinics, dtBegin, dtEnd);
3016 dpl.ShowDialog(this);
3017
3018 }
3019 catch(Exception ex)
3020 {
3021 MessageBox.Show(this, ex.Message, "IHS Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
3022 }
3023
3024 }
3025
3026 private void mnuPrintRebookLetters_Click(object sender, System.EventArgs e)
3027 {
3028 try
3029 {
3030 DSelectLetterClinics ds = new DSelectLetterClinics();
3031 ds.InitializePage(this.m_DocManager.GlobalDataSet, "Print Clinic Rebook Letters");
3032 if (ds.ShowDialog(this) != DialogResult.OK)
3033 return;
3034
3035 //get the resource names and call the letter printer
3036
3037 string sClinics = ds.SelectedClinics;
3038 DateTime dtBegin = ds.BeginDate;
3039 DateTime dtEnd = ds.EndDate;
3040 string sBegin = dtBegin.ToString("M/d/yyyy@HH:mm");
3041 string sEnd = dtEnd.ToString("M/d/yyyy@HH:mm");
3042
3043 DPatientLetter dpl = new DPatientLetter();
3044
3045 //Call RPC to get list of appt ids that have been rebooked for these clinics on these dates
3046 string sSql = "BSDX REBOOK CLINIC LIST^" + sClinics + "^" + sBegin + "^" + sEnd;
3047 DataTable dtLetters = DocManager.RPMSDataTable(sSql, "PatientAppts");
3048
3049 dpl.InitializeFormRebookLetters(this.DocManager, sClinics, dtLetters);
3050 dpl.ShowDialog(this);
3051
3052 }
3053 catch(Exception ex)
3054 {
3055 MessageBox.Show(this, ex.Message, "IHS Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
3056 }
3057 }
3058
3059 private void mnuPrintPatientLetter_Click(object sender, System.EventArgs e)
3060 {
3061 PrintPatientLetter();
3062 }
3063
3064 private void mnuRPMSDivision_Click(object sender, System.EventArgs e)
3065 {
3066 this.DocManager.ChangeDivision(this);
3067 }
3068
3069 private void CGView_CursorChanged(object sender, System.EventArgs e)
3070 {
3071
3072 }
3073
3074 private void mnuDisplayWalkIns_Click(object sender, System.EventArgs e)
3075 {
3076 calendarGrid1.DrawWalkIns = !(calendarGrid1.DrawWalkIns);
3077 mnuDisplayWalkIns.Checked = calendarGrid1.DrawWalkIns;
3078 calendarGrid1.SetOverlapTable();
3079 calendarGrid1.Refresh();
3080 }
3081
3082 private void mnuOpenMultipleSchedules_Click(object sender, System.EventArgs e)
3083 {
3084
3085 try
3086 {
3087 DSelectSchedules ds = new DSelectSchedules();
3088 ds.InitializePage(this.m_DocManager.GlobalDataSet, "Open Multiple Schedules");
3089 if (ds.ShowDialog(this) != DialogResult.OK)
3090 return;
3091
3092 //get the resource names and open schedules
3093
3094 ArrayList sResources = ds.SelectedClinics;
3095 if (ds.SingleWindow == true)
3096 {
3097 m_sDocName = (ds.GroupWindowName == "")?"Multiple Selected Schedules":ds.GroupWindowName;
3098 OpenSelectedSchedule( sResources, DateTime.Today);
3099 }
3100 else
3101 {
3102 foreach (string sResource in sResources)
3103 {
3104 ArrayList alSingle = new ArrayList(1);
3105 alSingle.Add(sResource);
3106 m_sDocName = sResource;
3107 OpenSelectedSchedule( alSingle, DateTime.Today);
3108 }
3109 }
3110 return;
3111
3112 }
3113 catch(Exception ex)
3114 {
3115 MessageBox.Show(this, ex.Message, "IHS Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
3116 }
3117
3118 }
3119
3120 private void ctxCalGridWalkin_Click(object sender, System.EventArgs e)
3121 {
3122 AppointmentAddWalkin();
3123 }
3124
3125 private void mnuWalkIn_Click(object sender, System.EventArgs e)
3126 {
3127 AppointmentAddWalkin();
3128 }
3129
3130 private void mnuPrintCancellationLetters_Click(object sender, System.EventArgs e)
3131 {
3132 try
3133 {
3134 DSelectLetterClinics ds = new DSelectLetterClinics();
3135 ds.InitializePage(this.m_DocManager.GlobalDataSet, "Print Clinic Cancellation Letters");
3136 if (ds.ShowDialog(this) != DialogResult.OK)
3137 return;
3138
3139 //get the resource names and call the letter printer
3140
3141 string sClinics = ds.SelectedClinics;
3142 DateTime dtBegin = ds.BeginDate;
3143 DateTime dtEnd = ds.EndDate;
3144 string sBegin = dtBegin.ToString("M/d/yyyy@HH:mm");
3145 string sEnd = dtEnd.ToString("M/d/yyyy@HH:mm");
3146
3147 DPatientLetter dpl = new DPatientLetter();
3148
3149 //Call RPC to get list of appt ids that have been cancelled for these clinics on these dates
3150 string sSql = "BSDX CANCEL CLINIC LIST^" + sClinics + "^" + sBegin + "^" + sEnd;
3151 DataTable dtLetters = DocManager.RPMSDataTable(sSql, "PatientAppts");
3152
3153 dpl.InitializeFormCancellationLetters(this.DocManager, sClinics, dtLetters);
3154 dpl.ShowDialog(this);
3155
3156 }
3157 catch(Exception ex)
3158 {
3159 MessageBox.Show(this, ex.Message, "IHS Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
3160 }
3161 }
3162
3163 #endregion events
3164
3165
3166
3167
3168 }//End class
3169}
Note: See TracBrowser for help on using the repository browser.