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

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

DCheckIn.cs: Handling of providers for hospital locations (HL). If provider(s) assigned to HL linked to resource, they are brought over and if a default one is in VISTA, it's picked as the default in the combobox. If no default, combobox defaults to <None>. If resource not linked to HL, then all providers in system brought over, and combobox default is <None>.
CGDocumentManager.cs: Remove loading of ClinicSetupParameters file. File doesn't exist in VISTA.
DResource.cs: Remove handling of same file.

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