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

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