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

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

Fixing an ooopsie bug introduced when I was testing stuff.

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