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

Last change on this file since 1675 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
RevLine 
[614]1using System;
2using System.Drawing;
3using System.Collections;
4using System.ComponentModel;
5using System.Windows.Forms;
6using System.Data;
7using System.Diagnostics;
8using IndianHealthService.BMXNet;
[1111]9using System.Collections.Generic;
10using System.Linq;
[614]11
12namespace IndianHealthService.ClinicalScheduling
13{
[802]14 /// <summary>
15 /// Summary description for DCheckIn.
16 /// </summary>
17 public class DCheckIn : System.Windows.Forms.Form
18 {
[804]19 private IContainer components;
[614]20
[802]21 public DCheckIn()
22 {
23 //
24 // Required for Windows Form Designer support
25 //
26 InitializeComponent();
[1117]27
28
[802]29 }
[614]30
31
[802]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;
[614]47
[802]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;
[1111]55 private List<Provider> _providers;
[804]56 private ToolTip toolTip1;
[1117]57 private bool _myCodeIsFiringIstheCheckBoxChangedEvent; // To prevent the event from firing when I set the control from code
[1062]58
[802]59 #endregion Fields
[614]60
[802]61 #region Properties
[614]62
[802]63 /// <summary>
[1111]64 /// Returns Provider chosen for Check-In
[802]65 /// </summary>
[1111]66 public Provider Provider
[802]67 {
68 get
69 {
[1111]70 if (cboProvider.SelectedIndex < 1) return null; // because first item is empty placeholder
71 else return this._providers[cboProvider.SelectedIndex];
[802]72 }
73 }
[614]74
[802]75 /// <summary>
76 /// Returns 'true' if routing slip to be printed; otherwise 'false'
77 /// </summary>
[1062]78 public bool PrintRouteSlip
[802]79 {
80 get
81 {
[1062]82 return m_bPrintRouteSlip;
[802]83 }
84 }
[614]85
[802]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 }
[614]100
[802]101 #endregion Properties
[614]102
[802]103 #region Methods
[614]104
[802]105 /// <summary>
106 /// Fill memeber variables before showing dialog
107 /// </summary>
108 /// <param name="a">Appointment</param>
109 /// <param name="docManager">Document Manager</param>
[1111]110 public void InitializePage(CGAppointment a)
[802]111 {
[1111]112 m_DocManager = CGDocumentManager.Current;
[802]113 m_dsGlobal = m_DocManager.GlobalDataSet;
[614]114
[1111]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
[802]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.
[1111]143 if (nHospLoc != null)
[802]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;
[1111]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();
[614]158
159
160
[1111]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
[802]178 //Find default provider--search for Yes in Field DEFAULT
[1111]179 //DataRow[] nRow = m_dtProvider.Select("DEFAULT='YES'", "NAME ASC");
180 //if (nRow.Length > 0) nFind = m_dtProvider.Rows.IndexOf(nRow[0]);
181
[821]182
[802]183 }
[804]184 //otherwise, just use the default provider table
[802]185 else
186 {
[614]187
[1111]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();
[802]196
[1111]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
[802]206 //Add None to the top of the list
[1111]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;
[802]214 }
215
[1111]216
[802]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 }
[1062]230
[1117]231 _myCodeIsFiringIstheCheckBoxChangedEvent = true;
[1111]232 chkRoutingSlip.Checked = CGDocumentManager.Current.UserPreferences.PrintRoutingSlipAutomatically;
[1117]233 _myCodeIsFiringIstheCheckBoxChangedEvent = false;
[1111]234
[802]235 UpdateDialogData(true);
236 }
237
[614]238
[802]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 }
[614]258
[802]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
[614]274
[802]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 {
[804]282 this.components = new System.ComponentModel.Container();
[802]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();
[804]297 this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
[802]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;
[1062]308 this.pnlPageBottom.Location = new System.Drawing.Point(0, 203);
[802]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;
[1062]336 this.pnlDescription.Location = new System.Drawing.Point(0, 131);
[802]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;
[1062]359 this.lblDescriptionResourceGroup.Text = "Use this panel to check in an appointment. A patient may only be checked-in once." +
360 "";
[802]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 //
[804]383 this.lblAlready.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
[802]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;
[1062]398 this.label3.Text = "Check-in Time:";
[802]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 //
[1111]410 this.cboProvider.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
[802]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 //
[1062]426 this.chkRoutingSlip.Location = new System.Drawing.Point(380, 93);
[802]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";
[804]431 this.toolTip1.SetToolTip(this.chkRoutingSlip, "Prints routing slip to the Windows Default Printer");
[1111]432 this.chkRoutingSlip.CheckedChanged += new System.EventHandler(this.chkRoutingSlip_CheckedChanged);
[802]433 //
434 // DCheckIn
435 //
436 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
[1062]437 this.ClientSize = new System.Drawing.Size(520, 243);
[802]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);
[614]456
[802]457 }
458 #endregion
[614]459
[802]460 #region Events
[614]461
[802]462 private void cmdOK_Click(object sender, System.EventArgs e)
463 {
464 this.UpdateDialogData(false);
465 }
[614]466
[1111]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 {
[1117]474 if (_myCodeIsFiringIstheCheckBoxChangedEvent) return;
475
[1111]476 CGDocumentManager.Current.UserPreferences.PrintRoutingSlipAutomatically = chkRoutingSlip.Checked;
477 }
478
[802]479 #endregion Events
[1111]480
[802]481 }
[614]482}
Note: See TracBrowser for help on using the repository browser.