CGAppointment: Added Provider as a Member of Class. (auto property)

CGDocument: No changes
CGDocumentManager: Added UserPreferences as a member of a Class (private and property)
CGView: Changes to support printing of Routing Slip
DAppointPage: Changes to support UserPreferences member for auto printing the routing slips
DCheckIn: Extensive changes in load code (now uses LINQ instead of ADO.net). Changes to support UserPreferences member for auto printing the routing slips.
Patient: Documentation for UserFriendlyAge.
Provider: New class to represent Provider
UserPreferences: New class to represent User preferences. Does not interact with DB right now.
This commit is contained in:
sam 2011-03-23 09:15:51 +00:00
parent 45490945a8
commit dfe0dd8e09
15 changed files with 235 additions and 130 deletions

View File

@ -3,8 +3,8 @@
using System; using System;
using System.Drawing; using System.Drawing;
/// <summary> /// <summary>
/// This class was regenerated from Calendargrid.dll using Reflector.exe /// Data Structuer to Represent an Appointment
/// by Sam Habiel for WorldVista. The original source code is lost. ///
/// </summary> /// </summary>
[Serializable] [Serializable]
public class CGAppointment public class CGAppointment
@ -304,6 +304,7 @@
} }
public Patient Patient { get; set; } public Patient Patient { get; set; }
public Provider Provider { get; set; }
} }
} }

View File

@ -1053,8 +1053,6 @@ namespace IndianHealthService.ClinicalScheduling
Debug.Assert(dtAppt.Rows.Count == 1); Debug.Assert(dtAppt.Rows.Count == 1);
DataRow r = dtAppt.Rows[0]; DataRow r = dtAppt.Rows[0];
string sErrorID = r["ERRORID"].ToString(); string sErrorID = r["ERRORID"].ToString();
} }
public string DeleteAppointment(int nApptID) public string DeleteAppointment(int nApptID)

View File

@ -93,6 +93,11 @@ namespace IndianHealthService.ClinicalScheduling
m_dsGlobal = value; m_dsGlobal = value;
} }
} }
/// <summary>
/// More later...
/// </summary>
public UserPreferences UserPreferences { get; private set; }
/// <summary> /// <summary>
/// Returns the single CGDocumentManager object /// Returns the single CGDocumentManager object
@ -460,6 +465,9 @@ namespace IndianHealthService.ClinicalScheduling
this.m_PrintingObject = Creator.PrintFactory(); this.m_PrintingObject = Creator.PrintFactory();
} }
//User Preferences Object
_current.UserPreferences = new UserPreferences();
//Create global dataset //Create global dataset
_current.m_dsGlobal = new DataSet("GlobalDataSet"); _current.m_dsGlobal = new DataSet("GlobalDataSet");

View File

@ -1263,14 +1263,8 @@ namespace IndianHealthService.ClinicalScheduling
if (apptID <= 0) return; if (apptID <= 0) return;
CGAppointment a = (CGAppointment) this.Appointments.AppointmentTable[apptID]; CGAppointment a = (CGAppointment) this.Appointments.AppointmentTable[apptID];
PrintDocument pd = new PrintDocument() { DocumentName = "Appointment Slip for Appt " + apptID }; //Autoinit for DocName PrintAppointmentSlip(a);
pd.PrintPage += (s, pe) => //son of a lambda
{
CGDocumentManager.Current.PrintingObject.PrintAppointmentSlip(a, pe);
};
pd.Print();
} }
//end new code //end new code
@ -1929,7 +1923,6 @@ namespace IndianHealthService.ClinicalScheduling
private void AppointmentCheckIn() private void AppointmentCheckIn()
{ {
int nApptID = this.calendarGrid1.SelectedAppointment; int nApptID = this.calendarGrid1.SelectedAppointment;
Debug.Assert(nApptID != 0); Debug.Assert(nApptID != 0);
@ -1949,35 +1942,9 @@ namespace IndianHealthService.ClinicalScheduling
MessageBox.Show(this, "It is too early to check in " + a.PatientName, "Windows Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); MessageBox.Show(this, "It is too early to check in " + a.PatientName, "Windows Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return; return;
} }
//Find the default provider for the resource & load into combo box
DataView rv = new DataView(this.m_DocManager.GlobalDataSet.Tables["Resources"]);
rv.Sort="RESOURCE_NAME ASC";
int nFind = rv.Find((string) a.Resource);
DataRowView drv = rv[nFind];
string sHospLoc = drv["HOSPITAL_LOCATION_ID"].ToString();
sHospLoc = (sHospLoc == "")?"0":sHospLoc;
int nHospLoc = 0;
try
{
nHospLoc = Convert.ToInt32(sHospLoc);
}
catch(Exception ex)
{
Debug.Write("CGView.AppointmentCheckIn Error: " + ex.Message);
}
string sProv = "";
if (nHospLoc > 0)
{
DataRow dr = drv.Row;
DataRow drHL = dr.GetParentRow(m_DocManager.GlobalDataSet.Relations["HospitalLocationResource"]);
sProv = drHL["DEFAULT_PROVIDER"].ToString();
}
DCheckIn dlgCheckin = new DCheckIn(); DCheckIn dlgCheckin = new DCheckIn();
dlgCheckin.InitializePage(a, this.m_DocManager, sProv, nHospLoc); dlgCheckin.InitializePage(a);
calendarGrid1.CGToolTip.Active = false; calendarGrid1.CGToolTip.Active = false;
if (dlgCheckin.ShowDialog(this) != DialogResult.OK) if (dlgCheckin.ShowDialog(this) != DialogResult.OK)
{ {
@ -1991,16 +1958,19 @@ namespace IndianHealthService.ClinicalScheduling
DateTime dtCheckIn = dlgCheckin.CheckInTime; DateTime dtCheckIn = dlgCheckin.CheckInTime;
//Save to Database //Tell appointment that it is checked in, for proper coloring;
//When you refresh from the DB, it will have this property.
a.CheckInTime = DateTime.Now;
//Save to Database
this.Document.CheckInAppointment(nApptID, dtCheckIn); this.Document.CheckInAppointment(nApptID, dtCheckIn);
//Tell appointment that it is checked in //Get Provider (XXXXXXXX: NOT SAVED TO THE DATABASE RIGHT NOW)
a.CheckInTime = DateTime.Now; a.Provider = dlgCheckin.Provider;
//smh new code // Print Routing Slip if user checks that box...
if (dlgCheckin.PrintRouteSlip) if (dlgCheckin.PrintRouteSlip)
// this.printRoutingSlip.Print(); this.PrintRoutingSlip(a);
// end new code
//redraw grid //redraw grid
this.calendarGrid1.Invalidate(); this.calendarGrid1.Invalidate();
@ -2217,12 +2187,10 @@ namespace IndianHealthService.ClinicalScheduling
//Call Document to add a new appointment. Document adds appointment to CGAppointments array. //Call Document to add a new appointment. Document adds appointment to CGAppointments array.
this.Document.CreateAppointment(appt); this.Document.CreateAppointment(appt);
//Experimental now.
if (dAppt.PrintAppointmentSlip) if (dAppt.PrintAppointmentSlip)
{ {
System.Drawing.Printing.PrintDocument pd = new System.Drawing.Printing.PrintDocument(); PrintAppointmentSlip(appt);
pd.PrintPage += (object s, System.Drawing.Printing.PrintPageEventArgs e) => CGDocumentManager.Current.PrintingObject.PrintAppointmentSlip(appt, e);
pd.Print();
} }
//Show the new set of appointments by calling UpdateArrays. Fetches Document's CGAppointments //Show the new set of appointments by calling UpdateArrays. Fetches Document's CGAppointments
@ -3246,11 +3214,18 @@ namespace IndianHealthService.ClinicalScheduling
} }
} }
private void printRoutingSlip_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) private void PrintRoutingSlip(CGAppointment appt)
{ {
int nApptID = this.calendarGrid1.SelectedAppointment; PrintDocument pd = new PrintDocument() { DocumentName = "Routing Slip for Appt " + appt.AppointmentKey };
CGAppointment a = (CGAppointment)this.Appointments.AppointmentTable[nApptID]; pd.PrintPage += (object s, System.Drawing.Printing.PrintPageEventArgs e) => CGDocumentManager.Current.PrintingObject.PrintRoutingSlip(appt, "Routing Slip", e);
CGDocumentManager.Current.PrintingObject.PrintRoutingSlip(a, "Routing Slip", e); pd.Print();
}
private void PrintAppointmentSlip(CGAppointment appt)
{
PrintDocument pd = new PrintDocument() { DocumentName = "Appointment Slip for Appt " + appt.AppointmentKey }; //Autoinit for DocName
pd.PrintPage += (object s, System.Drawing.Printing.PrintPageEventArgs e) => CGDocumentManager.Current.PrintingObject.PrintAppointmentSlip(appt, e);
pd.Print();
} }
@ -3310,6 +3285,9 @@ namespace IndianHealthService.ClinicalScheduling
#endregion events #endregion events
/// <summary>
/// Refresh grid if needed.
/// </summary>
void RequestRefreshGrid() void RequestRefreshGrid()
{ {
DateTime dDate = dateTimePicker1.Value.Date; DateTime dDate = dateTimePicker1.Value.Date;

View File

@ -139,6 +139,8 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Provider.cs" />
<Compile Include="UserPreferences.cs" />
<None Include="app.config" /> <None Include="app.config" />
<None Include="dsPatientApptDisplay2.xsc"> <None Include="dsPatientApptDisplay2.xsc">
<DependentUpon>dsPatientApptDisplay2.xsd</DependentUpon> <DependentUpon>dsPatientApptDisplay2.xsd</DependentUpon>
@ -200,7 +202,7 @@
<Compile Include="CGView.cs"> <Compile Include="CGView.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="CustomPrinting.cs" /> <Compile Include="Printing.cs" />
<Compile Include="DAccessBlock.cs"> <Compile Include="DAccessBlock.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>

View File

@ -36,7 +36,7 @@
<RemoteDebugMachine> <RemoteDebugMachine>
</RemoteDebugMachine> </RemoteDebugMachine>
<StartAction>Project</StartAction> <StartAction>Project</StartAction>
<StartArguments>/s=172.16.16.108 /p=9250 /a=s.habiel /v=catdog.66</StartArguments> <StartArguments>/s=172.16.16.108 /p=9250 /a=BASMA.ALDWAIRI /v=SELEN.123</StartArguments>
<StartPage> <StartPage>
</StartPage> </StartPage>
<StartProgram>C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\IEExec.exe</StartProgram> <StartProgram>C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\IEExec.exe</StartProgram>

View File

@ -93,6 +93,8 @@ namespace IndianHealthService.ClinicalScheduling
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txtSex = new System.Windows.Forms.TextBox();
this.label18 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label();
this.txtHRN = new System.Windows.Forms.TextBox(); this.txtHRN = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
@ -128,8 +130,6 @@ namespace IndianHealthService.ClinicalScheduling
this.patientApptsBindingSource = new System.Windows.Forms.BindingSource(this.components); this.patientApptsBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.dsPatientApptDisplay2BindingSource = new System.Windows.Forms.BindingSource(this.components); this.dsPatientApptDisplay2BindingSource = new System.Windows.Forms.BindingSource(this.components);
this.dsPatientApptDisplay2 = new IndianHealthService.ClinicalScheduling.dsPatientApptDisplay2(); this.dsPatientApptDisplay2 = new IndianHealthService.ClinicalScheduling.dsPatientApptDisplay2();
this.label18 = new System.Windows.Forms.Label();
this.txtSex = new System.Windows.Forms.TextBox();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabAppointment.SuspendLayout(); this.tabAppointment.SuspendLayout();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
@ -280,6 +280,24 @@ namespace IndianHealthService.ClinicalScheduling
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Patient ID"; this.groupBox1.Text = "Patient ID";
// //
// txtSex
//
this.txtSex.BackColor = System.Drawing.SystemColors.Control;
this.txtSex.Location = new System.Drawing.Point(273, 41);
this.txtSex.Name = "txtSex";
this.txtSex.ReadOnly = true;
this.txtSex.Size = new System.Drawing.Size(160, 20);
this.txtSex.TabIndex = 15;
//
// label18
//
this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(238, 44);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(29, 13);
this.label18.TabIndex = 14;
this.label18.Text = "Sex:";
//
// label14 // label14
// //
this.label14.Location = new System.Drawing.Point(50, 64); this.label14.Location = new System.Drawing.Point(50, 64);
@ -557,6 +575,7 @@ namespace IndianHealthService.ClinicalScheduling
this.chkPrint.TabIndex = 2; this.chkPrint.TabIndex = 2;
this.chkPrint.Text = "Print Appointment Letter"; this.chkPrint.Text = "Print Appointment Letter";
this.chkPrint.UseVisualStyleBackColor = true; this.chkPrint.UseVisualStyleBackColor = true;
this.chkPrint.CheckedChanged += new System.EventHandler(this.chkPrint_CheckedChanged);
// //
// cmdCancel // cmdCancel
// //
@ -592,24 +611,6 @@ namespace IndianHealthService.ClinicalScheduling
this.dsPatientApptDisplay2.DataSetName = "dsPatientApptDisplay2"; this.dsPatientApptDisplay2.DataSetName = "dsPatientApptDisplay2";
this.dsPatientApptDisplay2.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; this.dsPatientApptDisplay2.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
// //
// label18
//
this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(238, 44);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(29, 13);
this.label18.TabIndex = 14;
this.label18.Text = "Sex:";
//
// txtSex
//
this.txtSex.BackColor = System.Drawing.SystemColors.Control;
this.txtSex.Location = new System.Drawing.Point(273, 41);
this.txtSex.Name = "txtSex";
this.txtSex.ReadOnly = true;
this.txtSex.Size = new System.Drawing.Size(160, 20);
this.txtSex.TabIndex = 15;
//
// DAppointPage // DAppointPage
// //
this.AcceptButton = this.cmdOK; this.AcceptButton = this.cmdOK;
@ -716,6 +717,8 @@ namespace IndianHealthService.ClinicalScheduling
Control UC = new UCPatientAppts(m_DocManager, int.Parse(m_sPatientIEN)); Control UC = new UCPatientAppts(m_DocManager, int.Parse(m_sPatientIEN));
UC.Dock = DockStyle.Fill; UC.Dock = DockStyle.Fill;
groupBox4.Controls.Add(UC); groupBox4.Controls.Add(UC);
chkPrint.Checked = CGDocumentManager.Current.UserPreferences.PrintAppointmentSlipAutomacially;
} }
catch(Exception e) catch(Exception e)
{ {
@ -857,6 +860,17 @@ namespace IndianHealthService.ClinicalScheduling
} }
#endregion //Properties #endregion //Properties
/// <summary>
/// Save Print Slip preference in UserPreferences object. For now, it always starts false since
/// it isn't saved in the DB; but that will change in the future.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void chkPrint_CheckedChanged(object sender, EventArgs e)
{
CGDocumentManager.Current.UserPreferences.PrintAppointmentSlipAutomacially = chkPrint.Checked;
}
} //end Class } //end Class
} }

View File

@ -123,12 +123,6 @@
<metadata name="dsPatientApptDisplay2BindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="dsPatientApptDisplay2BindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>179, 17</value> <value>179, 17</value>
</metadata> </metadata>
<metadata name="dsPatientApptDisplay2BindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>179, 17</value>
</metadata>
<metadata name="dsPatientApptDisplay2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="dsPatientApptDisplay2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="dsPatientApptDisplay2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>

View File

@ -6,6 +6,8 @@ using System.Windows.Forms;
using System.Data; using System.Data;
using System.Diagnostics; using System.Diagnostics;
using IndianHealthService.BMXNet; using IndianHealthService.BMXNet;
using System.Collections.Generic;
using System.Linq;
namespace IndianHealthService.ClinicalScheduling namespace IndianHealthService.ClinicalScheduling
{ {
@ -22,10 +24,6 @@ namespace IndianHealthService.ClinicalScheduling
// Required for Windows Form Designer support // Required for Windows Form Designer support
// //
InitializeComponent(); InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
} }
@ -58,8 +56,8 @@ namespace IndianHealthService.ClinicalScheduling
private DataTable m_dtForm; private DataTable m_dtForm;
private DataView m_dvClinic; private DataView m_dvClinic;
private DataView m_dvForm; private DataView m_dvForm;
private bool m_bInit;
public bool m_bPrintRouteSlip; public bool m_bPrintRouteSlip;
private List<Provider> _providers;
private ToolTip toolTip1; private ToolTip toolTip1;
#endregion Fields #endregion Fields
@ -67,13 +65,14 @@ namespace IndianHealthService.ClinicalScheduling
#region Properties #region Properties
/// <summary> /// <summary>
/// Returns string representation of internal entry number of Provider in PROVIDER File /// Returns Provider chosen for Check-In
/// </summary> /// </summary>
public string ProviderIEN public Provider Provider
{ {
get get
{ {
return this.m_sProviderIEN; if (cboProvider.SelectedIndex < 1) return null; // because first item is empty placeholder
else return this._providers[cboProvider.SelectedIndex];
} }
} }
@ -112,66 +111,113 @@ namespace IndianHealthService.ClinicalScheduling
/// </summary> /// </summary>
/// <param name="a">Appointment</param> /// <param name="a">Appointment</param>
/// <param name="docManager">Document Manager</param> /// <param name="docManager">Document Manager</param>
/// <param name="sDefaultProvider">Default provider</param> public void InitializePage(CGAppointment a)
public void InitializePage(CGAppointment a, CGDocumentManager docManager,
string sDefaultProvider, int nHospLoc)
{ {
m_bInit = true; m_DocManager = CGDocumentManager.Current;
m_DocManager = docManager;
m_dsGlobal = m_DocManager.GlobalDataSet; m_dsGlobal = m_DocManager.GlobalDataSet;
int nFind = 0;
Int32? nHospLoc = (from resource in m_dsGlobal.Tables["Resources"].AsEnumerable()
where resource.Field<string>("RESOURCE_NAME") == a.Resource
select resource.Field<Int32?>("HOSPITAL_LOCATION_ID"))
.SingleOrDefault();
//smh - following logic replaced with above...
/*
DataView rv = new DataView(this.m_DocManager.GlobalDataSet.Tables["Resources"]);
rv.Sort = "RESOURCE_NAME ASC";
int nFind = rv.Find((string)a.Resource);
DataRowView drv = rv[nFind];
string sHospLoc = drv["HOSPITAL_LOCATION_ID"].ToString();
sHospLoc = (sHospLoc == "") ? "0" : sHospLoc;
int nHospLoc = 0;
try
{
nHospLoc = Convert.ToInt32(sHospLoc);
}
catch (Exception ex)
{
Debug.Write("CGView.AppointmentCheckIn Error: " + ex.Message);
}
*/
//smh new code //smh new code
//if the resource is linked to a valid hospital location, grab this locations providers //if the resource is linked to a valid hospital location, grab this locations providers
//from the provider multiple and put them in the combo box. //from the provider multiple and put them in the combo box.
if (nHospLoc != 0) if (nHospLoc != null)
{ {
//RPC BSDX HOSP LOC PROVIDERS returns Table w/ Columns: //RPC BSDX HOSP LOC PROVIDERS returns Table w/ Columns:
//HOSPITAL_LOCATION_ID^BMXIEN (ie Prov IEN)^NAME^DEFALUT //HOSPITAL_LOCATION_ID^BMXIEN (ie Prov IEN)^NAME^DEFALUT
string sCommandText = "BSDX HOSP LOC PROVIDERS^" + nHospLoc; string sCommandText = "BSDX HOSP LOC PROVIDERS^" + nHospLoc;
m_dtProvider = docManager.RPMSDataTable(sCommandText, "ClinicProviders"); m_dtProvider = m_DocManager.RPMSDataTable(sCommandText, "ClinicProviders");
m_dtProvider.DefaultView.Sort = "NAME ASC";
_providers = (from providerRow in m_dtProvider.AsEnumerable()
orderby providerRow.Field<string>("NAME")
select new Provider
{
IEN = providerRow.Field<int>("BMXIEN"),
Name = providerRow.Field<string>("NAME"),
Default = providerRow.Field<string>("DEFAULT") == "YES" ? true : false
}).ToList();
cboProvider.DataSource = m_dtProvider;
cboProvider.DisplayMember = "NAME";
cboProvider.ValueMember = "BMXIEN";
//Add None to the top of the list
DataRow drProv = m_dtProvider.NewRow(); //cboProvider.DisplayMember = "NAME";
drProv.BeginEdit(); //cboProvider.ValueMember = "BMXIEN";
drProv["HOSPITAL_LOCATION_ID"] = 0; _providers.Insert(0, new Provider { Name = "<None>", IEN = -1 });
drProv["NAME"] = "<None>"; cboProvider.DataSource = _providers;
drProv["BMXIEN"] = 0; cboProvider.SelectedIndex = _providers.FindIndex(prov => prov.Default);
drProv.EndEdit(); // if no provider is default, set default to be <none> item.
m_dtProvider.Rows.InsertAt(drProv, 0); if (cboProvider.SelectedIndex == -1) cboProvider.SelectedIndex = 0;
cboProvider.SelectedIndex = 0; ////Add None to the top of the list
//DataRow drProv = m_dtProvider.NewRow();
//drProv.BeginEdit();
//drProv["HOSPITAL_LOCATION_ID"] = 0;
//drProv["NAME"] = "<None>";
//drProv["BMXIEN"] = 0;
//drProv.EndEdit();
//m_dtProvider.Rows.InsertAt(drProv, 0);
////cboProvider.SelectedIndex = 0;
//Find default provider--search for Yes in Field DEFAULT //Find default provider--search for Yes in Field DEFAULT
DataRow[] nRow = m_dtProvider.Select("DEFAULT='YES'", "NAME ASC"); //DataRow[] nRow = m_dtProvider.Select("DEFAULT='YES'", "NAME ASC");
if (nRow.Length > 0) nFind = m_dtProvider.Rows.IndexOf(nRow[0]); //if (nRow.Length > 0) nFind = m_dtProvider.Rows.IndexOf(nRow[0]);
cboProvider.SelectedIndex = nFind;
} }
//otherwise, just use the default provider table //otherwise, just use the default provider table
else else
{ {
m_dtProvider = m_dsGlobal.Tables["Provider"];
m_dtProvider.DefaultView.Sort = "NAME ASC";
cboProvider.DataSource = m_dtProvider; _providers = (from providerRow in m_dsGlobal.Tables["Provider"].AsEnumerable()
cboProvider.DisplayMember = "NAME"; orderby providerRow.Field<string>("NAME")
cboProvider.ValueMember = "BMXIEN"; select new Provider
{
IEN = providerRow.Field<int>("BMXIEN"),
Name = providerRow.Field<string>("NAME"),
Default = false
}).ToList();
/*m_dtProvider = m_dsGlobal.Tables["Provider"];
m_dtProvider.DefaultView.Sort = "NAME ASC";*/
_providers.Insert(0, new Provider { Name = "<None>", IEN = -1 });
cboProvider.DataSource = _providers;
cboProvider.SelectedIndex = 0;
//cboProvider.DisplayMember = "NAME";
//cboProvider.ValueMember = "BMXIEN";
//Add None to the top of the list //Add None to the top of the list
DataRow drProv = m_dtProvider.NewRow(); //DataRow drProv = m_dtProvider.NewRow();
drProv.BeginEdit(); //drProv.BeginEdit();
drProv["NAME"] = "<None>"; //drProv["NAME"] = "<None>";
drProv["BMXIEN"] = 0; //drProv["BMXIEN"] = 0;
drProv.EndEdit(); //drProv.EndEdit();
m_dtProvider.Rows.InsertAt(drProv, 0); //m_dtProvider.Rows.InsertAt(drProv, 0);
cboProvider.SelectedIndex = 0; //cboProvider.SelectedIndex = 0;
} }
m_sPatientName = a.PatientName; m_sPatientName = a.PatientName;
if (a.CheckInTime.Ticks != 0) if (a.CheckInTime.Ticks != 0)
@ -186,8 +232,10 @@ namespace IndianHealthService.ClinicalScheduling
m_dCheckIn = DateTime.Now; m_dCheckIn = DateTime.Now;
} }
//Print Routing Slip based on user preferences.
chkRoutingSlip.Checked = CGDocumentManager.Current.UserPreferences.PrintRoutingSlipAutomatically;
UpdateDialogData(true); UpdateDialogData(true);
m_bInit = false;
} }
@ -362,6 +410,7 @@ namespace IndianHealthService.ClinicalScheduling
// //
// cboProvider // cboProvider
// //
this.cboProvider.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboProvider.Location = new System.Drawing.Point(96, 88); this.cboProvider.Location = new System.Drawing.Point(96, 88);
this.cboProvider.Name = "cboProvider"; this.cboProvider.Name = "cboProvider";
this.cboProvider.Size = new System.Drawing.Size(240, 21); this.cboProvider.Size = new System.Drawing.Size(240, 21);
@ -383,6 +432,7 @@ namespace IndianHealthService.ClinicalScheduling
this.chkRoutingSlip.TabIndex = 14; this.chkRoutingSlip.TabIndex = 14;
this.chkRoutingSlip.Text = "Print Routing Slip"; this.chkRoutingSlip.Text = "Print Routing Slip";
this.toolTip1.SetToolTip(this.chkRoutingSlip, "Prints routing slip to the Windows Default Printer"); this.toolTip1.SetToolTip(this.chkRoutingSlip, "Prints routing slip to the Windows Default Printer");
this.chkRoutingSlip.CheckedChanged += new System.EventHandler(this.chkRoutingSlip_CheckedChanged);
// //
// DCheckIn // DCheckIn
// //
@ -417,6 +467,17 @@ namespace IndianHealthService.ClinicalScheduling
this.UpdateDialogData(false); this.UpdateDialogData(false);
} }
/// <summary>
/// Save this in User Preferences Object.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void chkRoutingSlip_CheckedChanged(object sender, EventArgs e)
{
CGDocumentManager.Current.UserPreferences.PrintRoutingSlipAutomatically = chkRoutingSlip.Checked;
}
#endregion Events #endregion Events
} }
} }

View File

@ -112,12 +112,12 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
</root> </root>

View File

@ -43,6 +43,11 @@ namespace IndianHealthService.ClinicalScheduling
} }
} }
/// <summary>
/// Returns User Friendly Age. If Age < 5, then Years and Months
/// If Age > 5, then only Years.
/// Humans tend to round down their ages. So I follow the same rule here.
/// </summary>
public string UserFriendlyAge public string UserFriendlyAge
{ {
get get

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace IndianHealthService.ClinicalScheduling
{
/// <summary>
/// Provider puppet
/// </summary>
public class Provider
{
public int IEN { get; set; }
public string Name { get; set; }
public bool Default { get; set; }
public override string ToString()
{
return Name;
}
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace IndianHealthService.ClinicalScheduling
{
/// <summary>
/// Designed to keep user preferences. Very basic for now.
/// </summary>
public class UserPreferences
{
public UserPreferences()
{
PrintAppointmentSlipAutomacially = false;
PrintRoutingSlipAutomatically = false;
}
public bool PrintAppointmentSlipAutomacially { get; set; }
public bool PrintRoutingSlipAutomatically { get; set; }
}
}