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

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

Updated Source Code for i18n.
Changes in DPatientLetter.cs
Changes in CGSchedLib.cs

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