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

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

Several fixes:

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