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