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

Last change on this file since 1066 was 1066, checked in by Sam Habiel, 13 years ago

CGView: dateTimePicker1 behavior changes:

  • No longer update schedule based on value change, as this is too too too chatty.
  • Update schedule based on:

-- Picking a date from the drop down
-- Leaving dateTimePicker1
-- Pressing the enter key

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