source: Scheduling/trunk/cs/bsdx0200GUISourceCode/DCheckIn.cs@ 1314

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

Updated Release exes.
CGDocument: Appointment Creation Code now reuses appt object passed in rather than creating a new one.
CGView:
ctxPrintScheduleT3 added. Print schedule in 3 days. For weekday after weekend.
Scaling of grid now restricted. You can't scale down from the original TimeScale, but you can scale up.
DCheckIn: Remove unused variables.
DResource: Remove unused variables.

File size: 20.1 KB
Line 
1using System;
2using System.Drawing;
3using System.Collections;
4using System.ComponentModel;
5using System.Windows.Forms;
6using System.Data;
7using System.Diagnostics;
8using IndianHealthService.BMXNet;
9using System.Collections.Generic;
10using System.Linq;
11
12namespace IndianHealthService.ClinicalScheduling
13{
14 /// <summary>
15 /// Summary description for DCheckIn.
16 /// </summary>
17 public class DCheckIn : System.Windows.Forms.Form
18 {
19 private IContainer components;
20
21 public DCheckIn()
22 {
23 //
24 // Required for Windows Form Designer support
25 //
26 InitializeComponent();
27
28
29 }
30
31
32 #region Fields
33 private System.Windows.Forms.Panel pnlPageBottom;
34 private System.Windows.Forms.Button cmdCancel;
35 private System.Windows.Forms.Button cmdOK;
36 private System.Windows.Forms.Panel pnlDescription;
37 private System.Windows.Forms.GroupBox grpDescriptionResourceGroup;
38 private System.Windows.Forms.Label lblDescriptionResourceGroup;
39 private System.Windows.Forms.Label label1;
40 private System.Windows.Forms.DateTimePicker dtpCheckIn;
41 private System.Windows.Forms.Label lblAlready;
42 private System.Windows.Forms.Label label3;
43 private System.Windows.Forms.Label lblPatientName;
44 private System.Windows.Forms.Label label2;
45 private System.Windows.Forms.ComboBox cboProvider;
46 private System.Windows.Forms.CheckBox chkRoutingSlip;
47
48 private string m_sPatientName;
49 private DateTime m_dCheckIn;
50 private string m_sProviderIEN;
51 private CGDocumentManager m_DocManager;
52 private DataSet m_dsGlobal;
53 private DataTable m_dtProvider;
54 public bool m_bPrintRouteSlip;
55 private List<Provider> _providers;
56 private ToolTip toolTip1;
57 private bool _myCodeIsFiringIstheCheckBoxChangedEvent; // To prevent the event from firing when I set the control from code
58
59 #endregion Fields
60
61 #region Properties
62
63 /// <summary>
64 /// Returns Provider chosen for Check-In
65 /// </summary>
66 public Provider Provider
67 {
68 get
69 {
70 if (cboProvider.SelectedIndex < 1) return null; // because first item is empty placeholder
71 else return this._providers[cboProvider.SelectedIndex];
72 }
73 }
74
75 /// <summary>
76 /// Returns 'true' if routing slip to be printed; otherwise 'false'
77 /// </summary>
78 public bool PrintRouteSlip
79 {
80 get
81 {
82 return m_bPrintRouteSlip;
83 }
84 }
85
86 /// <summary>
87 /// Appointment checkin time
88 /// </summary>
89 public DateTime CheckInTime
90 {
91 get
92 {
93 return m_dCheckIn;
94 }
95 set
96 {
97 m_dCheckIn = value;
98 }
99 }
100
101 #endregion Properties
102
103 #region Methods
104
105 /// <summary>
106 /// Fill memeber variables before showing dialog
107 /// </summary>
108 /// <param name="a">Appointment</param>
109 /// <param name="docManager">Document Manager</param>
110 public void InitializePage(CGAppointment a)
111 {
112 m_DocManager = CGDocumentManager.Current;
113 m_dsGlobal = m_DocManager.GlobalDataSet;
114
115 Int32? nHospLoc = (from resource in m_dsGlobal.Tables["Resources"].AsEnumerable()
116 where resource.Field<string>("RESOURCE_NAME") == a.Resource
117 select resource.Field<Int32?>("HOSPITAL_LOCATION_ID"))
118 .SingleOrDefault();
119
120 //smh - following logic replaced with above...
121 /*
122 DataView rv = new DataView(this.m_DocManager.GlobalDataSet.Tables["Resources"]);
123 rv.Sort = "RESOURCE_NAME ASC";
124 int nFind = rv.Find((string)a.Resource);
125 DataRowView drv = rv[nFind];
126
127 string sHospLoc = drv["HOSPITAL_LOCATION_ID"].ToString();
128 sHospLoc = (sHospLoc == "") ? "0" : sHospLoc;
129 int nHospLoc = 0;
130 try
131 {
132 nHospLoc = Convert.ToInt32(sHospLoc);
133 }
134 catch (Exception ex)
135 {
136 Debug.Write("CGView.AppointmentCheckIn Error: " + ex.Message);
137 }
138 */
139
140 //smh new code
141 //if the resource is linked to a valid hospital location, grab this locations providers
142 //from the provider multiple and put them in the combo box.
143 if (nHospLoc != null)
144 {
145 //RPC BSDX HOSP LOC PROVIDERS returns Table w/ Columns:
146 //HOSPITAL_LOCATION_ID^BMXIEN (ie Prov IEN)^NAME^DEFALUT
147 string sCommandText = "BSDX HOSP LOC PROVIDERS^" + nHospLoc;
148 m_dtProvider = m_DocManager.RPMSDataTable(sCommandText, "ClinicProviders");
149
150 _providers = (from providerRow in m_dtProvider.AsEnumerable()
151 orderby providerRow.Field<string>("NAME")
152 select new Provider
153 {
154 IEN = providerRow.Field<int>("BMXIEN"),
155 Name = providerRow.Field<string>("NAME"),
156 Default = providerRow.Field<string>("DEFAULT") == "YES" ? true : false
157 }).ToList();
158
159
160
161 //cboProvider.DisplayMember = "NAME";
162 //cboProvider.ValueMember = "BMXIEN";
163 _providers.Insert(0, new Provider { Name = "<None>", IEN = -1 });
164 cboProvider.DataSource = _providers;
165 cboProvider.SelectedIndex = _providers.FindIndex(prov => prov.Default);
166 // if no provider is default, set default to be <none> item.
167 if (cboProvider.SelectedIndex == -1) cboProvider.SelectedIndex = 0;
168 ////Add None to the top of the list
169 //DataRow drProv = m_dtProvider.NewRow();
170 //drProv.BeginEdit();
171 //drProv["HOSPITAL_LOCATION_ID"] = 0;
172 //drProv["NAME"] = "<None>";
173 //drProv["BMXIEN"] = 0;
174 //drProv.EndEdit();
175 //m_dtProvider.Rows.InsertAt(drProv, 0);
176 ////cboProvider.SelectedIndex = 0;
177
178 //Find default provider--search for Yes in Field DEFAULT
179 //DataRow[] nRow = m_dtProvider.Select("DEFAULT='YES'", "NAME ASC");
180 //if (nRow.Length > 0) nFind = m_dtProvider.Rows.IndexOf(nRow[0]);
181
182
183 }
184 //otherwise, just use the default provider table
185 else
186 {
187
188 _providers = (from providerRow in m_dsGlobal.Tables["Provider"].AsEnumerable()
189 orderby providerRow.Field<string>("NAME")
190 select new Provider
191 {
192 IEN = providerRow.Field<int>("BMXIEN"),
193 Name = providerRow.Field<string>("NAME"),
194 Default = false
195 }).ToList();
196
197
198 /*m_dtProvider = m_dsGlobal.Tables["Provider"];
199 m_dtProvider.DefaultView.Sort = "NAME ASC";*/
200 _providers.Insert(0, new Provider { Name = "<None>", IEN = -1 });
201 cboProvider.DataSource = _providers;
202 cboProvider.SelectedIndex = 0;
203 //cboProvider.DisplayMember = "NAME";
204 //cboProvider.ValueMember = "BMXIEN";
205
206 //Add None to the top of the list
207 //DataRow drProv = m_dtProvider.NewRow();
208 //drProv.BeginEdit();
209 //drProv["NAME"] = "<None>";
210 //drProv["BMXIEN"] = 0;
211 //drProv.EndEdit();
212 //m_dtProvider.Rows.InsertAt(drProv, 0);
213 //cboProvider.SelectedIndex = 0;
214 }
215
216
217
218 m_sPatientName = a.PatientName;
219 if (a.CheckInTime.Ticks != 0)
220 {
221 m_dCheckIn = a.CheckInTime;
222 dtpCheckIn.Enabled = false;
223 this.cboProvider.Enabled = false;
224 lblAlready.Visible = true;
225 }
226 else
227 {
228 m_dCheckIn = DateTime.Now;
229 }
230
231 _myCodeIsFiringIstheCheckBoxChangedEvent = true;
232 chkRoutingSlip.Checked = CGDocumentManager.Current.UserPreferences.PrintRoutingSlipAutomatically;
233 _myCodeIsFiringIstheCheckBoxChangedEvent = false;
234
235 UpdateDialogData(true);
236 }
237
238
239 /// <summary>
240 /// If b is true, moves member vars into control data
241 /// otherwise, moves control data into member vars
242 /// </summary>
243 /// <param name="b"></param>
244 private void UpdateDialogData(bool b)
245 {
246 if (b == true) //Move data to dialog controls from member variables
247 {
248 this.lblPatientName.Text = m_sPatientName;
249 this.dtpCheckIn.Value = m_dCheckIn;
250 }
251 else //Move data to member variables from dialog controls
252 {
253 m_dCheckIn = this.dtpCheckIn.Value;
254 m_sProviderIEN = this.cboProvider.SelectedValue.ToString();
255 m_bPrintRouteSlip = chkRoutingSlip.Checked;
256 }
257 }
258
259 /// <summary>
260 /// Clean up any resources being used.
261 /// </summary>
262 protected override void Dispose(bool disposing)
263 {
264 if (disposing)
265 {
266 if (components != null)
267 {
268 components.Dispose();
269 }
270 }
271 base.Dispose(disposing);
272 }
273 #endregion Methods
274
275 #region Windows Form Designer generated code
276 /// <summary>
277 /// Required method for Designer support - do not modify
278 /// the contents of this method with the code editor.
279 /// </summary>
280 private void InitializeComponent()
281 {
282 this.components = new System.ComponentModel.Container();
283 this.pnlPageBottom = new System.Windows.Forms.Panel();
284 this.cmdCancel = new System.Windows.Forms.Button();
285 this.cmdOK = new System.Windows.Forms.Button();
286 this.pnlDescription = new System.Windows.Forms.Panel();
287 this.grpDescriptionResourceGroup = new System.Windows.Forms.GroupBox();
288 this.lblDescriptionResourceGroup = new System.Windows.Forms.Label();
289 this.label1 = new System.Windows.Forms.Label();
290 this.dtpCheckIn = new System.Windows.Forms.DateTimePicker();
291 this.lblAlready = new System.Windows.Forms.Label();
292 this.label3 = new System.Windows.Forms.Label();
293 this.lblPatientName = new System.Windows.Forms.Label();
294 this.cboProvider = new System.Windows.Forms.ComboBox();
295 this.label2 = new System.Windows.Forms.Label();
296 this.chkRoutingSlip = new System.Windows.Forms.CheckBox();
297 this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
298 this.pnlPageBottom.SuspendLayout();
299 this.pnlDescription.SuspendLayout();
300 this.grpDescriptionResourceGroup.SuspendLayout();
301 this.SuspendLayout();
302 //
303 // pnlPageBottom
304 //
305 this.pnlPageBottom.Controls.Add(this.cmdCancel);
306 this.pnlPageBottom.Controls.Add(this.cmdOK);
307 this.pnlPageBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
308 this.pnlPageBottom.Location = new System.Drawing.Point(0, 203);
309 this.pnlPageBottom.Name = "pnlPageBottom";
310 this.pnlPageBottom.Size = new System.Drawing.Size(520, 40);
311 this.pnlPageBottom.TabIndex = 5;
312 //
313 // cmdCancel
314 //
315 this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
316 this.cmdCancel.Location = new System.Drawing.Point(440, 8);
317 this.cmdCancel.Name = "cmdCancel";
318 this.cmdCancel.Size = new System.Drawing.Size(56, 24);
319 this.cmdCancel.TabIndex = 2;
320 this.cmdCancel.Text = "Cancel";
321 //
322 // cmdOK
323 //
324 this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;
325 this.cmdOK.Location = new System.Drawing.Point(360, 8);
326 this.cmdOK.Name = "cmdOK";
327 this.cmdOK.Size = new System.Drawing.Size(64, 24);
328 this.cmdOK.TabIndex = 1;
329 this.cmdOK.Text = "OK";
330 this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
331 //
332 // pnlDescription
333 //
334 this.pnlDescription.Controls.Add(this.grpDescriptionResourceGroup);
335 this.pnlDescription.Dock = System.Windows.Forms.DockStyle.Bottom;
336 this.pnlDescription.Location = new System.Drawing.Point(0, 131);
337 this.pnlDescription.Name = "pnlDescription";
338 this.pnlDescription.Size = new System.Drawing.Size(520, 72);
339 this.pnlDescription.TabIndex = 6;
340 //
341 // grpDescriptionResourceGroup
342 //
343 this.grpDescriptionResourceGroup.Controls.Add(this.lblDescriptionResourceGroup);
344 this.grpDescriptionResourceGroup.Dock = System.Windows.Forms.DockStyle.Fill;
345 this.grpDescriptionResourceGroup.Location = new System.Drawing.Point(0, 0);
346 this.grpDescriptionResourceGroup.Name = "grpDescriptionResourceGroup";
347 this.grpDescriptionResourceGroup.Size = new System.Drawing.Size(520, 72);
348 this.grpDescriptionResourceGroup.TabIndex = 1;
349 this.grpDescriptionResourceGroup.TabStop = false;
350 this.grpDescriptionResourceGroup.Text = "Description";
351 //
352 // lblDescriptionResourceGroup
353 //
354 this.lblDescriptionResourceGroup.Dock = System.Windows.Forms.DockStyle.Fill;
355 this.lblDescriptionResourceGroup.Location = new System.Drawing.Point(3, 16);
356 this.lblDescriptionResourceGroup.Name = "lblDescriptionResourceGroup";
357 this.lblDescriptionResourceGroup.Size = new System.Drawing.Size(514, 53);
358 this.lblDescriptionResourceGroup.TabIndex = 0;
359 this.lblDescriptionResourceGroup.Text = "Use this panel to check in an appointment. A patient may only be checked-in once." +
360 "";
361 //
362 // label1
363 //
364 this.label1.Location = new System.Drawing.Point(16, 16);
365 this.label1.Name = "label1";
366 this.label1.Size = new System.Drawing.Size(80, 16);
367 this.label1.TabIndex = 7;
368 this.label1.Text = "Patient Name:";
369 //
370 // dtpCheckIn
371 //
372 this.dtpCheckIn.AllowDrop = true;
373 this.dtpCheckIn.CustomFormat = "MMMM dd yyyy H:mm";
374 this.dtpCheckIn.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
375 this.dtpCheckIn.Location = new System.Drawing.Point(96, 48);
376 this.dtpCheckIn.Name = "dtpCheckIn";
377 this.dtpCheckIn.ShowUpDown = true;
378 this.dtpCheckIn.Size = new System.Drawing.Size(176, 20);
379 this.dtpCheckIn.TabIndex = 9;
380 //
381 // lblAlready
382 //
383 this.lblAlready.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
384 this.lblAlready.ForeColor = System.Drawing.Color.Green;
385 this.lblAlready.Location = new System.Drawing.Point(288, 40);
386 this.lblAlready.Name = "lblAlready";
387 this.lblAlready.Size = new System.Drawing.Size(192, 32);
388 this.lblAlready.TabIndex = 10;
389 this.lblAlready.Text = "This Patient is already checked in.";
390 this.lblAlready.Visible = false;
391 //
392 // label3
393 //
394 this.label3.Location = new System.Drawing.Point(16, 48);
395 this.label3.Name = "label3";
396 this.label3.Size = new System.Drawing.Size(80, 16);
397 this.label3.TabIndex = 7;
398 this.label3.Text = "Check-in Time:";
399 //
400 // lblPatientName
401 //
402 this.lblPatientName.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
403 this.lblPatientName.Location = new System.Drawing.Point(96, 16);
404 this.lblPatientName.Name = "lblPatientName";
405 this.lblPatientName.Size = new System.Drawing.Size(256, 16);
406 this.lblPatientName.TabIndex = 11;
407 //
408 // cboProvider
409 //
410 this.cboProvider.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
411 this.cboProvider.Location = new System.Drawing.Point(96, 88);
412 this.cboProvider.Name = "cboProvider";
413 this.cboProvider.Size = new System.Drawing.Size(240, 21);
414 this.cboProvider.TabIndex = 12;
415 //
416 // label2
417 //
418 this.label2.Location = new System.Drawing.Point(16, 88);
419 this.label2.Name = "label2";
420 this.label2.Size = new System.Drawing.Size(80, 16);
421 this.label2.TabIndex = 7;
422 this.label2.Text = "Visit Provider:";
423 //
424 // chkRoutingSlip
425 //
426 this.chkRoutingSlip.Location = new System.Drawing.Point(380, 93);
427 this.chkRoutingSlip.Name = "chkRoutingSlip";
428 this.chkRoutingSlip.Size = new System.Drawing.Size(128, 16);
429 this.chkRoutingSlip.TabIndex = 14;
430 this.chkRoutingSlip.Text = "Print Routing Slip";
431 this.toolTip1.SetToolTip(this.chkRoutingSlip, "Prints routing slip to the Windows Default Printer");
432 this.chkRoutingSlip.CheckedChanged += new System.EventHandler(this.chkRoutingSlip_CheckedChanged);
433 //
434 // DCheckIn
435 //
436 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
437 this.ClientSize = new System.Drawing.Size(520, 243);
438 this.Controls.Add(this.chkRoutingSlip);
439 this.Controls.Add(this.cboProvider);
440 this.Controls.Add(this.lblPatientName);
441 this.Controls.Add(this.lblAlready);
442 this.Controls.Add(this.dtpCheckIn);
443 this.Controls.Add(this.label1);
444 this.Controls.Add(this.pnlDescription);
445 this.Controls.Add(this.pnlPageBottom);
446 this.Controls.Add(this.label3);
447 this.Controls.Add(this.label2);
448 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
449 this.Name = "DCheckIn";
450 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
451 this.Text = "Appointment Check In";
452 this.pnlPageBottom.ResumeLayout(false);
453 this.pnlDescription.ResumeLayout(false);
454 this.grpDescriptionResourceGroup.ResumeLayout(false);
455 this.ResumeLayout(false);
456
457 }
458 #endregion
459
460 #region Events
461
462 private void cmdOK_Click(object sender, System.EventArgs e)
463 {
464 this.UpdateDialogData(false);
465 }
466
467 /// <summary>
468 /// Save this in User Preferences Object.
469 /// </summary>
470 /// <param name="sender"></param>
471 /// <param name="e"></param>
472 private void chkRoutingSlip_CheckedChanged(object sender, EventArgs e)
473 {
474 if (_myCodeIsFiringIstheCheckBoxChangedEvent) return;
475
476 CGDocumentManager.Current.UserPreferences.PrintRoutingSlipAutomatically = chkRoutingSlip.Checked;
477 }
478
479 #endregion Events
480
481 }
482}
Note: See TracBrowser for help on using the repository browser.