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

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

CGView: Refactor PositionGrid into CalendarGrid.

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