CGDocument: Minor Change: Add appointment ID to Appointment
CGDocumentManager: added parameter /culture to set Thread.CurrentThread.CurrentUICulture CGView: Minor changes in CheckInAppointment: Printing of Routing Slip now always happens. Routing slip now get parameter for patient order. Patient: i18n of UserFriendlyAge Printing: Extensive changes. Support for i18n; new routing slip and appt slip. i18n support only for appt slip.
This commit is contained in:
parent
dfe0dd8e09
commit
d21580e4ab
|
@ -1002,7 +1002,11 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
aCopy.AppointmentKey = nApptID;
|
||||
this.m_appointments.AddAppointment(aCopy);
|
||||
|
||||
|
||||
//TODO: Improve
|
||||
//Yucky hack for now... haven't investigated why we need to create a new CGAppointment beyond
|
||||
//the one that we pass.
|
||||
rApptInfo.AppointmentKey = nApptID;
|
||||
|
||||
//Have make appointment from CGView responsible for requesting an update for the avialability.
|
||||
//bool bRet = RefreshAvailabilitySchedule();
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Threading;
|
|||
using IndianHealthService.BMXNet;
|
||||
using Mono.Options;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Globalization;
|
||||
|
||||
namespace IndianHealthService.ClinicalScheduling
|
||||
{
|
||||
|
@ -32,6 +33,9 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
private int m_Port=0;
|
||||
private string m_Encoding=""; //Encoding is "" by default;
|
||||
|
||||
//Globalization Object (tied to command line parameter /culture)
|
||||
private string m_CultureName = "";
|
||||
|
||||
//Data Access Layer
|
||||
private DAL _dal = null;
|
||||
|
||||
|
@ -95,7 +99,7 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// More later...
|
||||
/// User Preferences Auto Property
|
||||
/// </summary>
|
||||
public UserPreferences UserPreferences { get; private set; }
|
||||
|
||||
|
@ -170,6 +174,7 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
/// /a or -a = Access Code
|
||||
/// /v or -v = Verify Code
|
||||
/// /e or -e = Encoding (name of encoding as known to windows, such as windows-1256)
|
||||
/// /culture or -culture = Culture Name for UI Culture if you wish to override the Windows Culture
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// Encoding decision is complex. This is the order of priority:
|
||||
|
@ -199,7 +204,8 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
{ "p=", p => _current.m_Port = int.Parse(p) },
|
||||
{ "a=", a => _current.m_AccessCode = a },
|
||||
{ "v=", v => _current.m_VerifyCode = v },
|
||||
{ "e=", e => _current.m_Encoding = e}
|
||||
{ "e=", e => _current.m_Encoding = e},
|
||||
{ "culture=", culture => _current.m_CultureName = culture }
|
||||
};
|
||||
|
||||
opset.Parse(args);
|
||||
|
@ -468,6 +474,10 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
//User Preferences Object
|
||||
_current.UserPreferences = new UserPreferences();
|
||||
|
||||
//User Interface Culture (m_CultureName is set from the command line flag /culture)
|
||||
try { Thread.CurrentThread.CurrentUICulture = new CultureInfo(m_CultureName); } // if "", invariant culture
|
||||
catch (CultureNotFoundException) { Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; }
|
||||
|
||||
//Create global dataset
|
||||
_current.m_dsGlobal = new DataSet("GlobalDataSet");
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ using System.Threading;
|
|||
using IndianHealthService.BMXNet;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Drawing.Printing;
|
||||
using System.Linq;
|
||||
|
||||
namespace IndianHealthService.ClinicalScheduling
|
||||
{
|
||||
|
@ -1953,18 +1954,18 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
}
|
||||
calendarGrid1.CGToolTip.Active = true;
|
||||
|
||||
if (bAlreadyCheckedIn == true)
|
||||
return;
|
||||
if (bAlreadyCheckedIn != true)
|
||||
{
|
||||
DateTime dtCheckIn = dlgCheckin.CheckInTime;
|
||||
|
||||
DateTime dtCheckIn = dlgCheckin.CheckInTime;
|
||||
//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;
|
||||
|
||||
//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);
|
||||
}
|
||||
|
||||
//Save to Database
|
||||
this.Document.CheckInAppointment(nApptID, dtCheckIn);
|
||||
|
||||
//Get Provider (XXXXXXXX: NOT SAVED TO THE DATABASE RIGHT NOW)
|
||||
a.Provider = dlgCheckin.Provider;
|
||||
|
||||
|
@ -2102,8 +2103,6 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
{
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
//Get Time and Resource from Selected Cell
|
||||
DateTime dStart = DateTime.Today;
|
||||
DateTime dEnd = DateTime.Today;
|
||||
|
@ -3216,8 +3215,22 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
|
||||
private void PrintRoutingSlip(CGAppointment appt)
|
||||
{
|
||||
//get this appointment's order
|
||||
//Today's appointments
|
||||
var todaysAppts = (from lkappts in this.Document.Appointments.AppointmentTable.Values.Cast<CGAppointment>()
|
||||
where lkappts.StartTime > appt.StartTime.Date && lkappts.StartTime < appt.StartTime.AddDays(1).Date
|
||||
orderby lkappts.StartTime
|
||||
select lkappts).ToList();
|
||||
|
||||
//Find the order of the appointment
|
||||
int apptOrder = todaysAppts.FindIndex(eachappt => eachappt.StartTime == appt.StartTime && eachappt.PatientID == appt.PatientID);
|
||||
|
||||
//Index is zero based, so add 1
|
||||
apptOrder++;
|
||||
|
||||
//Send that to the routing slip as a parameter
|
||||
PrintDocument pd = new PrintDocument() { DocumentName = "Routing Slip for Appt " + appt.AppointmentKey };
|
||||
pd.PrintPage += (object s, System.Drawing.Printing.PrintPageEventArgs e) => CGDocumentManager.Current.PrintingObject.PrintRoutingSlip(appt, "Routing Slip", e);
|
||||
pd.PrintPage += (object s, System.Drawing.Printing.PrintPageEventArgs e) => CGDocumentManager.Current.PrintingObject.PrintRoutingSlip(appt, apptOrder, e);
|
||||
pd.Print();
|
||||
}
|
||||
|
||||
|
|
|
@ -140,6 +140,16 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Provider.cs" />
|
||||
<Compile Include="strings.ar.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>strings.ar.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="strings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>strings.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserPreferences.cs" />
|
||||
<None Include="app.config" />
|
||||
<None Include="dsPatientApptDisplay2.xsc">
|
||||
|
@ -412,6 +422,14 @@
|
|||
<EmbeddedResource Include="LoadingSplash.resx">
|
||||
<DependentUpon>LoadingSplash.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="strings.ar.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>strings.ar.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="strings.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>strings.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UCPatientAppts.resx">
|
||||
<DependentUpon>UCPatientAppts.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<RemoteDebugMachine>
|
||||
</RemoteDebugMachine>
|
||||
<StartAction>Project</StartAction>
|
||||
<StartArguments>/s=172.16.16.108 /p=9250 /a=BASMA.ALDWAIRI /v=SELEN.123</StartArguments>
|
||||
<StartArguments>/s=172.16.16.108 /p=9250 /a=BASMA.ALDWAIRI /v=SELEN.123 /culture="ar-JO"</StartArguments>
|
||||
<StartPage>
|
||||
</StartPage>
|
||||
<StartProgram>C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\IEExec.exe</StartProgram>
|
||||
|
|
Binary file not shown.
|
@ -53,10 +53,10 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
get
|
||||
{
|
||||
if (Age.TotalDays / 365.24 > 5)
|
||||
return Math.Floor((Age.TotalDays / 365.24)).ToString() + " years";
|
||||
return Math.Floor((Age.TotalDays / 365.24)).ToString() + " " + strings.years;
|
||||
else
|
||||
return Math.Floor((Age.TotalDays / 365.24)).ToString() + " years & "
|
||||
+ Math.Floor(Age.TotalDays % 365.24 / 30).ToString() + " months";
|
||||
return Math.Floor((Age.TotalDays / 365.24)).ToString() + " " + strings.years + " " + strings.and + " "
|
||||
+ Math.Floor(Age.TotalDays % 365.24 / 30).ToString() + " " + strings.months;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ using System.Data;
|
|||
|
||||
namespace IndianHealthService.ClinicalScheduling
|
||||
{
|
||||
public class Printing
|
||||
public partial class Printing
|
||||
{
|
||||
/// <summary>
|
||||
/// Print Appointments
|
||||
|
@ -47,20 +47,42 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
|
||||
//Typical manipulable print area
|
||||
Rectangle printArea = e.MarginBounds;
|
||||
|
||||
Rectangle pageArea = e.PageBounds;
|
||||
Rectangle headerArea = new Rectangle()
|
||||
{
|
||||
X = e.MarginBounds.X,
|
||||
Y = e.PageBounds.Y,
|
||||
Height = e.MarginBounds.Y - e.PageBounds.Y,
|
||||
Width = e.MarginBounds.Width
|
||||
};
|
||||
Rectangle footerArea = new Rectangle()
|
||||
{
|
||||
X = e.MarginBounds.X,
|
||||
Y = e.MarginBounds.Height + headerArea.Height,
|
||||
Width = e.MarginBounds.Width,
|
||||
Height = pageArea.Height - (e.MarginBounds.Height + headerArea.Height)
|
||||
};
|
||||
|
||||
//print footer
|
||||
StringFormat sfFooter = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center };
|
||||
string s = strings.Printed + ": " + DateTime.Now.ToString();
|
||||
Font fFooter = new Font(FontFamily.GenericSerif, 7);
|
||||
g.DrawString(s, fFooter, Brushes.Black, footerArea, sfFooter);
|
||||
|
||||
//resource we want to print
|
||||
dsPatientApptDisplay2.BSDXResourceRow r = ds.BSDXResource[resourceToPrint];
|
||||
|
||||
//header
|
||||
string toprint;
|
||||
if (beg == end) toprint = "Appointments for " + r.RESOURCE_NAME + " on " + beg.ToLongDateString();
|
||||
if (beg.Date == end.Date) toprint = "Appointments for " + r.RESOURCE_NAME + " on " + beg.ToLongDateString();
|
||||
else toprint = "Appointments for " + r.RESOURCE_NAME + " from " + beg.ToShortDateString() + " to "
|
||||
+ end.ToShortDateString();
|
||||
g.DrawString(toprint, f14bold, Brushes.Black, printArea);
|
||||
|
||||
//Move print area down
|
||||
printArea.Height -= (int)f14bold.GetHeight();
|
||||
printArea.Y += (int)f14bold.GetHeight();
|
||||
int titleHeight = (int)g.MeasureString(toprint, f14bold, printArea.Size).Height;
|
||||
printArea.Height -= titleHeight;
|
||||
printArea.Y += titleHeight;
|
||||
|
||||
//Draw Line
|
||||
g.DrawLine(new Pen(Brushes.Black, 0), printArea.X, printArea.Y, printArea.X + printArea.Width, printArea.Y);
|
||||
|
@ -133,6 +155,14 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
Height = e.MarginBounds.Y - e.PageBounds.Y,
|
||||
Width = e.MarginBounds.Width
|
||||
};
|
||||
Rectangle footerArea = new Rectangle()
|
||||
{
|
||||
X = e.MarginBounds.X,
|
||||
Y = e.MarginBounds.Height + headerArea.Height,
|
||||
Width = e.MarginBounds.Width,
|
||||
Height = pageArea.Height - (e.MarginBounds.Height + headerArea.Height)
|
||||
};
|
||||
|
||||
|
||||
// A few fonts
|
||||
Font fTitle = new Font(FontFamily.GenericSerif, 24, FontStyle.Bold); //for title
|
||||
|
@ -153,7 +183,8 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
StringFormat sf = new StringFormat();
|
||||
sf.Alignment = StringAlignment.Center; //for title & header
|
||||
|
||||
string s = "Appointment Reminder Slip";
|
||||
//string s = "Appointment Reminder Slip";
|
||||
string s = strings.ApptRoutingSlip;
|
||||
g.DrawString(s, fTitle, Brushes.Black, printArea, sf); //title
|
||||
|
||||
// move down
|
||||
|
@ -174,25 +205,31 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
}
|
||||
|
||||
// group header
|
||||
g.DrawString("Patient Information", fGroupTitle, Brushes.Black, new Point(personalInfoRectangle.X, personalInfoRectangle.Y - 20));
|
||||
s = strings.PtInfo;
|
||||
StringFormat sf3 = new StringFormat(System.Threading.Thread.CurrentThread.CurrentUICulture.TextInfo.IsRightToLeft ? StringFormatFlags.DirectionRightToLeft : 0);
|
||||
g.DrawString(s, fGroupTitle, Brushes.Black, new Rectangle(personalInfoRectangle.X, personalInfoRectangle.Y - 20,personalInfoRectangle.Width, 20),sf3);
|
||||
|
||||
// inner rectangle for drawing strings:
|
||||
Rectangle personalInfoInnerRectangle = new Rectangle(personalInfoRectangle.X + 20, personalInfoRectangle.Y + 20, 280 - 40, 300 - 40);
|
||||
|
||||
// Strings to write
|
||||
StringBuilder sb = new StringBuilder(500);
|
||||
sb.AppendLine("Name:" + "\t" + appt.Patient.Name);
|
||||
sb.AppendLine(strings.Name + ":" + "\t" + appt.Patient.Name);
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("ID#:" + "\t" + appt.Patient.ID);
|
||||
sb.AppendLine(strings.ID + ":" + "\t" + appt.Patient.ID);
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("DOB:" + "\t" + appt.Patient.DOB.ToShortDateString());
|
||||
sb.AppendLine(strings.DOB + ":" + "\t" + appt.Patient.DOB.ToShortDateString());
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("Age:" + "\t" + appt.Patient.UserFriendlyAge);
|
||||
sb.AppendLine(strings.Age + ":" + "\t" + appt.Patient.UserFriendlyAge);
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("Sex:" + "\t" + appt.Patient.Sex.ToString());
|
||||
|
||||
s = appt.Patient.Sex == Sex.Male ? strings.Male : strings.Female;
|
||||
sb.AppendLine(strings.Sex + ":" + "\t" + s);
|
||||
|
||||
// Draw them
|
||||
g.DrawString(sb.ToString(), fBody, Brushes.Black, personalInfoInnerRectangle);
|
||||
sf3 = new StringFormat(System.Threading.Thread.CurrentThread.CurrentUICulture.TextInfo.IsRightToLeft ? StringFormatFlags.DirectionRightToLeft : 0);
|
||||
sf3.SetTabStops(0, new float[] {75} );
|
||||
sf3.SetDigitSubstitution(System.Threading.Thread.CurrentThread.CurrentUICulture.LCID, StringDigitSubstitute.Traditional);
|
||||
g.DrawString(sb.ToString(), fBody, Brushes.Black, personalInfoInnerRectangle, sf3);
|
||||
|
||||
// draw curved rectangle
|
||||
Rectangle apptInfoRectangle = new Rectangle(e.MarginBounds.X + e.MarginBounds.Width - 280, printArea.Y + 30, 280, 300);
|
||||
|
@ -201,24 +238,25 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
g.DrawPath(Pens.Black, path);
|
||||
}
|
||||
|
||||
s = strings.ApptInfo;
|
||||
// group header
|
||||
g.DrawString("Appointment Information", fGroupTitle, Brushes.Black, new Point(apptInfoRectangle.X, apptInfoRectangle.Y - 20));
|
||||
g.DrawString(s, fGroupTitle, Brushes.Black, new Rectangle(apptInfoRectangle.X, apptInfoRectangle.Y - 20,apptInfoRectangle.Width, 20), sf3);
|
||||
|
||||
// Strings to write
|
||||
sb = new StringBuilder();
|
||||
sb.AppendLine("Clinic: " + "\t" + appt.Resource);
|
||||
sb.AppendLine(strings.Clinic + ":" + "\t" + appt.Resource);
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("Date: " + "\t" + appt.StartTime.ToShortDateString());
|
||||
sb.AppendLine(strings.Date + ":" + "\t" + appt.StartTime.ToShortDateString());
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("Day: " + "\t" + appt.StartTime.DayOfWeek.ToString());
|
||||
sb.AppendLine(strings.Day + ":" + "\t" + appt.StartTime.ToString("dddd"));
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("Time: " + "\t" + appt.StartTime.ToShortTimeString());
|
||||
sb.AppendLine(strings.Time + ":" + "\t" + appt.StartTime.ToShortTimeString());
|
||||
|
||||
// Draw them
|
||||
Rectangle apptInfoInnerRectangle = new Rectangle(apptInfoRectangle.X + 20, apptInfoRectangle.Y + 20, 280 - 40, 300 - 40);
|
||||
|
||||
// Draw them
|
||||
g.DrawString(sb.ToString(), fBody, Brushes.Black, apptInfoInnerRectangle);
|
||||
g.DrawString(sb.ToString(), fBody, Brushes.Black, apptInfoInnerRectangle, sf3);
|
||||
|
||||
// Move Drawing Rectangle Down
|
||||
printArea.Y += 300 + 30 + 20;
|
||||
|
@ -230,7 +268,7 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
printArea.Height -= 5;
|
||||
|
||||
// Draw new Title
|
||||
s = "Clinic Instructions";
|
||||
s = strings.ClinicInstructions;
|
||||
g.DrawString(s, fTitle, Brushes.Black, printArea, sf); //title
|
||||
|
||||
// move down
|
||||
|
@ -250,9 +288,9 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
where resource.Field<string>("RESOURCE_NAME") == appt.Resource
|
||||
select resource.Field<string>("LETTER_TEXT")).SingleOrDefault<string>();
|
||||
|
||||
if (String.IsNullOrWhiteSpace(ltrTxt)) ltrTxt = "(no instructions provided)";
|
||||
if (String.IsNullOrWhiteSpace(ltrTxt)) ltrTxt = strings.NoInstructionsProvided;
|
||||
|
||||
g.DrawString(ltrTxt, fBody, Brushes.Black, printArea);
|
||||
g.DrawString(ltrTxt, fBody, Brushes.Black, printArea, sf3);
|
||||
|
||||
int ltrTxtHeight = (int)g.MeasureString(ltrTxt, fBody).Height;
|
||||
|
||||
|
@ -263,7 +301,7 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
printArea.Y += 5;
|
||||
printArea.Height -= 5;
|
||||
|
||||
s = "Notes";
|
||||
s = strings.Notes;
|
||||
g.DrawString(s, fTitle, Brushes.Black, printArea, sf); // Notes title
|
||||
|
||||
// move down
|
||||
|
@ -282,18 +320,8 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
g.DrawPath(Pens.Black, path);
|
||||
}
|
||||
|
||||
// Draw Footer
|
||||
// Get footer rectangle
|
||||
Rectangle footerArea = new Rectangle()
|
||||
{
|
||||
X = e.MarginBounds.X,
|
||||
Y = e.MarginBounds.Height + headerArea.Height,
|
||||
Width = e.MarginBounds.Width,
|
||||
Height = pageArea.Height - (e.MarginBounds.Height + headerArea.Height)
|
||||
};
|
||||
|
||||
//use sf0 to print the footer (center all the way)
|
||||
s = "Printed: " + DateTime.Now.ToString();
|
||||
s = strings.Printed + ": " + DateTime.Now.ToString();
|
||||
Font fFooter = new Font(FontFamily.GenericSerif, 7);
|
||||
g.DrawString(s, fFooter, Brushes.Black, footerArea, sf0);
|
||||
|
||||
|
@ -509,15 +537,49 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
/// <param name="a">Appointment Data Structure</param>
|
||||
/// <param name="title">String to print for title</param>
|
||||
/// <param name="e">etc</param>
|
||||
public virtual void PrintRoutingSlip(CGAppointment a, string title, PrintPageEventArgs e)
|
||||
public virtual void PrintRoutingSlip(CGAppointment appt, int apptOrder, PrintPageEventArgs e)
|
||||
{
|
||||
Rectangle printArea = e.MarginBounds;
|
||||
// Prep
|
||||
Graphics g = e.Graphics;
|
||||
StringFormat sf = new StringFormat();
|
||||
sf.Alignment = StringAlignment.Center; //for title
|
||||
Rectangle printArea = e.MarginBounds;
|
||||
Rectangle pageArea = e.PageBounds;
|
||||
Rectangle headerArea = new Rectangle()
|
||||
{
|
||||
X = e.MarginBounds.X,
|
||||
Y = e.PageBounds.Y,
|
||||
Height = e.MarginBounds.Y - e.PageBounds.Y,
|
||||
Width = e.MarginBounds.Width
|
||||
};
|
||||
Rectangle footerArea = new Rectangle()
|
||||
{
|
||||
X = e.MarginBounds.X,
|
||||
Y = e.MarginBounds.Height + headerArea.Height,
|
||||
Width = e.MarginBounds.Width,
|
||||
Height = pageArea.Height - (e.MarginBounds.Height + headerArea.Height)
|
||||
};
|
||||
|
||||
const int part1Height = 400;
|
||||
string s;
|
||||
|
||||
// A few fonts
|
||||
Font fTitle = new Font(FontFamily.GenericSerif, 24, FontStyle.Bold); //for title
|
||||
Font fBody = new Font(FontFamily.GenericSerif, 18);
|
||||
Font fBodyEm = new Font(FontFamily.GenericSerif, 18, FontStyle.Bold);
|
||||
Font fBody = new Font(FontFamily.GenericSerif, 12);
|
||||
Font fGroupTitle = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
|
||||
|
||||
StringFormat sf0 = new StringFormat()
|
||||
{
|
||||
Alignment = StringAlignment.Center,
|
||||
LineAlignment = StringAlignment.Center
|
||||
};
|
||||
|
||||
// Draw Header
|
||||
string division = CGDocumentManager.Current.ConnectInfo.DivisionName;
|
||||
g.DrawString(division, fBody, Brushes.Black, headerArea, sf0);
|
||||
|
||||
// Draw Title
|
||||
StringFormat sf = new StringFormat();
|
||||
sf.Alignment = StringAlignment.Center; //for title & header
|
||||
string title = "Routing Slip";
|
||||
g.DrawString(title, fTitle, Brushes.Black, printArea, sf); //title
|
||||
|
||||
// move down
|
||||
|
@ -527,32 +589,109 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
|
||||
// draw underline
|
||||
g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
|
||||
|
||||
// move down
|
||||
printArea.Y += 15;
|
||||
printArea.Height -= 15;
|
||||
|
||||
//construct what to print
|
||||
string toprint = "Patient: " + a.PatientName + "\t" + "ID: " + a.HealthRecordNumber;
|
||||
toprint += "\n\n";
|
||||
toprint += "Clinic: " + a.Resource;
|
||||
toprint += "\n\n";
|
||||
toprint += "Appointment Time: " + a.StartTime;
|
||||
toprint += "\n\n";
|
||||
toprint += "Notes:\n" + a.Note;
|
||||
// draw curved rectangle.
|
||||
Rectangle personalInfoRectangle = new Rectangle(e.MarginBounds.X, printArea.Y + 30, 280, part1Height);
|
||||
using (GraphicsPath path = GetRoundedRectPath(personalInfoRectangle, 10))
|
||||
{
|
||||
g.DrawPath(Pens.Black, path);
|
||||
}
|
||||
|
||||
//print
|
||||
g.DrawString(toprint, fBody, Brushes.Black, printArea);
|
||||
// group header
|
||||
g.DrawString("Patient Information", fGroupTitle, Brushes.Black, new Point(personalInfoRectangle.X, personalInfoRectangle.Y - 20));
|
||||
|
||||
// Print Date Printed
|
||||
//sf to move to bottom center
|
||||
StringFormat sf2 = new StringFormat();
|
||||
sf2.LineAlignment = StringAlignment.Far;
|
||||
sf2.Alignment = StringAlignment.Center;
|
||||
// inner rectangle for drawing strings:
|
||||
Rectangle personalInfoInnerRectangle = new Rectangle(personalInfoRectangle.X + 20, personalInfoRectangle.Y + 20, personalInfoRectangle.Width - 40, personalInfoRectangle.Height - 40);
|
||||
|
||||
// Strings to write
|
||||
StringBuilder sb = new StringBuilder(500);
|
||||
sb.AppendLine("Name:" + "\t" + appt.Patient.Name);
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("ID#:" + "\t" + appt.Patient.ID);
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("DOB:" + "\t" + appt.Patient.DOB.ToShortDateString());
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("Age:" + "\t" + appt.Patient.UserFriendlyAge);
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("Sex:" + "\t" + appt.Patient.Sex.ToString());
|
||||
|
||||
// Draw them
|
||||
g.DrawString(sb.ToString(), fBody, Brushes.Black, personalInfoInnerRectangle);
|
||||
|
||||
// draw curved rectangle
|
||||
Rectangle apptInfoRectangle = new Rectangle(e.MarginBounds.X + e.MarginBounds.Width - 280, printArea.Y + 30, 280, part1Height);
|
||||
using (GraphicsPath path = GetRoundedRectPath(apptInfoRectangle, 10))
|
||||
{
|
||||
g.DrawPath(Pens.Black, path);
|
||||
}
|
||||
|
||||
// group header
|
||||
g.DrawString("Appointment Information", fGroupTitle, Brushes.Black, new Point(apptInfoRectangle.X, apptInfoRectangle.Y - 20));
|
||||
|
||||
// Strings to write
|
||||
sb = new StringBuilder();
|
||||
sb.AppendLine("Clinic:");
|
||||
sb.AppendLine(appt.Resource);
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("Appointment Provider:");
|
||||
sb.AppendLine((appt.Provider == null) ? "(none)" : appt.Provider.ToString()); //Appt Provider or (none) if null
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("Patient Order:" + "\t" + apptOrder);
|
||||
sb.AppendLine("Date: " + "\t" + appt.StartTime.ToShortDateString() + " " + appt.StartTime.ToShortTimeString());
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("Appointment Note: ");
|
||||
sb.AppendLine(String.IsNullOrWhiteSpace(appt.Note)? "(none)" : appt.Note);
|
||||
|
||||
// Draw them
|
||||
Rectangle apptInfoInnerRectangle = new Rectangle(apptInfoRectangle.X + 20, apptInfoRectangle.Y + 20, apptInfoRectangle.Width - 40, apptInfoRectangle.Height - 40);
|
||||
|
||||
// Draw them
|
||||
g.DrawString(sb.ToString(), fBody, Brushes.Black, apptInfoInnerRectangle);
|
||||
|
||||
// Move Drawing Rectangle Down
|
||||
printArea.Y += apptInfoRectangle.Height + 30 + 20;
|
||||
printArea.Height -= apptInfoRectangle.Height + 30 + 20;
|
||||
|
||||
// Draw New Line
|
||||
using (Pen dashpen = new Pen(Color.Black))
|
||||
{
|
||||
dashpen.DashStyle = DashStyle.Dash;
|
||||
g.DrawLine(dashpen, printArea.Location, new Point(printArea.Right, printArea.Y));
|
||||
}
|
||||
|
||||
printArea.Y += 5;
|
||||
printArea.Height -= 5;
|
||||
|
||||
s = "Scratch Area";
|
||||
g.DrawString(s, fGroupTitle, Brushes.Black, printArea);
|
||||
|
||||
// move down
|
||||
printArea.Y += 300;
|
||||
printArea.Height -= 300;
|
||||
|
||||
//TODO: Put Next Appointment Area
|
||||
using (Pen dashpen = new Pen(Color.Black))
|
||||
{
|
||||
dashpen.DashStyle = DashStyle.Dot;
|
||||
g.DrawLine(dashpen, printArea.Location, new Point(printArea.Right, printArea.Y));
|
||||
}
|
||||
|
||||
printArea.Y += 5;
|
||||
printArea.Height -= 5;
|
||||
|
||||
s = "Next Appointment Instructions";
|
||||
g.DrawString(s, fGroupTitle, Brushes.Black, printArea);
|
||||
|
||||
// Draw Footer
|
||||
//use sf0 to print the footer (center all the way)
|
||||
s = "Printed: " + DateTime.Now.ToString();
|
||||
Font fFooter = new Font(FontFamily.GenericSerif, 7);
|
||||
g.DrawString(s, fFooter, Brushes.Black, footerArea, sf0);
|
||||
|
||||
g.Dispose();
|
||||
|
||||
//Print
|
||||
Font fFooter = new Font(FontFamily.GenericSerif, 8);
|
||||
g.DrawString("Printed: " + DateTime.Now, fFooter, Brushes.Black, printArea, sf2);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue