source: Scheduling/branches/GUI1.2/CGView.cs@ 1675

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

Support for Routing Slip printing.
Version change from 1.1 to 1.2 in preparation for release.
Printing.cs: Addition of PrintRoutingSlip method.
CGView.cs: Handling of printing of routing slip if chosen in DCheckIn.cs
CGView.cs: New context option to re-print routing slip
DCheckIn.cs: toolTip1 to explain that routing slip will print on the default printer.

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