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

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

Mostly commenting the code.

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