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

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

CGView:

  • Changed the parameters required for checkin.
  • Removed references to PCC+ and Stop Code processing, as they don't apply in VISTA.

CGDocument:

  • Changed RPC call parameters to check in an appointment (BSDX CHECKIN APPOINTMENT).
  • Date passed to BSDX Checkin Appointment is now an FM Date.
  • Both necessitated server side changes.

DCheckIn:

  • Removed processing for PCC+ and Stop Codes.

CGDocumentManager

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