Better printing in UCPatientAppts.
This commit is contained in:
parent
6ebbda93db
commit
67492a320c
|
@ -413,10 +413,6 @@
|
|||
<DependentUpon>DNoShow.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="DPatientApptDisplay.resx">
|
||||
<DependentUpon>DPatientApptDisplay.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="DPatientLetter.resx">
|
||||
<DependentUpon>DPatientLetter.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
|
|
Binary file not shown.
|
@ -13,9 +13,6 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
/// </summary>
|
||||
public class DPatientApptDisplay : System.Windows.Forms.Form
|
||||
{
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.CheckBox chkIncludePast;
|
||||
private DataGridView dataGridView1;
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
|
@ -23,16 +20,9 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
|
||||
public void InitializeForm(CGDocumentManager docManager, int nPatientID)
|
||||
{
|
||||
try
|
||||
{
|
||||
string sSql = "BSDX PATIENT APPT DISPLAY^" + nPatientID.ToString();
|
||||
DataTable dtAppt = docManager.RPMSDataTable(sSql, "PatientAppts");
|
||||
dataGridView1.DataSource = dtAppt;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
Control UC = new UCPatientAppts(docManager, nPatientID);
|
||||
UC.Dock = DockStyle.Fill;
|
||||
this.Controls.Add(UC);
|
||||
}
|
||||
|
||||
public DPatientApptDisplay()
|
||||
|
@ -60,72 +50,19 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.chkIncludePast = new System.Windows.Forms.CheckBox();
|
||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
this.panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.chkIncludePast);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(664, 32);
|
||||
this.panel1.TabIndex = 1;
|
||||
//
|
||||
// chkIncludePast
|
||||
//
|
||||
this.chkIncludePast.Location = new System.Drawing.Point(16, 8);
|
||||
this.chkIncludePast.Name = "chkIncludePast";
|
||||
this.chkIncludePast.Size = new System.Drawing.Size(184, 16);
|
||||
this.chkIncludePast.TabIndex = 0;
|
||||
this.chkIncludePast.Text = "Include Past Appointments";
|
||||
this.chkIncludePast.CheckedChanged += new System.EventHandler(this.chkIncludePast_CheckedChanged);
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
this.dataGridView1.AllowUserToAddRows = false;
|
||||
this.dataGridView1.AllowUserToDeleteRows = false;
|
||||
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.dataGridView1.Location = new System.Drawing.Point(0, 32);
|
||||
this.dataGridView1.Name = "dataGridView1";
|
||||
this.dataGridView1.ReadOnly = true;
|
||||
this.dataGridView1.Size = new System.Drawing.Size(664, 446);
|
||||
this.dataGridView1.TabIndex = 2;
|
||||
//
|
||||
// DPatientApptDisplay
|
||||
//
|
||||
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
||||
this.ClientSize = new System.Drawing.Size(664, 478);
|
||||
this.Controls.Add(this.dataGridView1);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Name = "DPatientApptDisplay";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Patient Appointments";
|
||||
this.panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void chkIncludePast_CheckedChanged(object sender, System.EventArgs e)
|
||||
{
|
||||
if (chkIncludePast.Checked == true)
|
||||
{
|
||||
//this.crViewer1.SelectionFormula = "TRUE"; //MJL 9/11/2007
|
||||
}
|
||||
else
|
||||
{
|
||||
//crViewer1.SelectionFormula = "{PatientAppts.ApptDate} >= CurrentDate";
|
||||
}
|
||||
//crViewer1.RefreshReport();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,120 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
|
@ -39,8 +39,8 @@
|
|||
this.dsPatientApptDisplay2BindingSource = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.dsPatientApptDisplay2 = new IndianHealthService.ClinicalScheduling.dsPatientApptDisplay2();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.chkPastAppts = new System.Windows.Forms.CheckBox();
|
||||
this.btnPrint = new System.Windows.Forms.Button();
|
||||
this.chkPastAppts = new System.Windows.Forms.CheckBox();
|
||||
this.printDialog1 = new System.Windows.Forms.PrintDialog();
|
||||
this.PrintPtAppts = new System.Drawing.Printing.PrintDocument();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgAppts)).BeginInit();
|
||||
|
@ -132,6 +132,16 @@
|
|||
this.panel1.Size = new System.Drawing.Size(544, 32);
|
||||
this.panel1.TabIndex = 3;
|
||||
//
|
||||
// btnPrint
|
||||
//
|
||||
this.btnPrint.Location = new System.Drawing.Point(3, 3);
|
||||
this.btnPrint.Name = "btnPrint";
|
||||
this.btnPrint.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnPrint.TabIndex = 1;
|
||||
this.btnPrint.Text = "Print";
|
||||
this.btnPrint.UseVisualStyleBackColor = true;
|
||||
this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
|
||||
//
|
||||
// chkPastAppts
|
||||
//
|
||||
this.chkPastAppts.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||
|
@ -144,16 +154,6 @@
|
|||
this.chkPastAppts.UseVisualStyleBackColor = true;
|
||||
this.chkPastAppts.CheckedChanged += new System.EventHandler(this.chkPastAppts_CheckedChanged);
|
||||
//
|
||||
// btnPrint
|
||||
//
|
||||
this.btnPrint.Location = new System.Drawing.Point(3, 3);
|
||||
this.btnPrint.Name = "btnPrint";
|
||||
this.btnPrint.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnPrint.TabIndex = 1;
|
||||
this.btnPrint.Text = "Print";
|
||||
this.btnPrint.UseVisualStyleBackColor = true;
|
||||
this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
|
||||
//
|
||||
// printDialog1
|
||||
//
|
||||
this.printDialog1.Document = this.PrintPtAppts;
|
||||
|
@ -163,6 +163,7 @@
|
|||
//
|
||||
this.PrintPtAppts.DocumentName = "Print Patient Appointments";
|
||||
this.PrintPtAppts.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.PrintPtAppts_PrintPage);
|
||||
this.PrintPtAppts.QueryPageSettings += new System.Drawing.Printing.QueryPageSettingsEventHandler(this.PrintPtAppts_QueryPageSettings);
|
||||
//
|
||||
// UCPatientAppts
|
||||
//
|
||||
|
|
|
@ -13,10 +13,11 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
/// </summary>
|
||||
public partial class UCPatientAppts : UserControl
|
||||
{
|
||||
DataTable dtAppt;
|
||||
DataView dvAppt;
|
||||
DataTable dtAppt; // Main table
|
||||
DataView dvAppt; // Manipulated view of table
|
||||
int rowToPrint; // Used in printing
|
||||
/// <summary>
|
||||
/// Ctor
|
||||
/// Ctor - Creates control and populates data into datagridview
|
||||
/// </summary>
|
||||
/// <param name="docManager">Document Manager from main context</param>
|
||||
/// <param name="nPatientID">Patient IEN</param>
|
||||
|
@ -43,7 +44,7 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
void SetPastFilter(bool ShowPastAppts)
|
||||
{
|
||||
if (ShowPastAppts) dvAppt.RowFilter = "";
|
||||
else dvAppt.RowFilter = "ApptDate > " + "#" + DateTime.Today.ToShortDateString() + "#"; ;
|
||||
else dvAppt.RowFilter = "ApptDate > " + "#" + DateTime.Today.ToShortDateString() + "#";
|
||||
}
|
||||
|
||||
private void chkPastAppts_CheckedChanged(object sender, EventArgs e)
|
||||
|
@ -55,17 +56,77 @@ namespace IndianHealthService.ClinicalScheduling
|
|||
private void PrintPtAppts_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
|
||||
{
|
||||
Graphics g = e.Graphics;
|
||||
using (Font font = new Font("Lucida Console", 72))
|
||||
Font Serif12Bold = new Font(FontFamily.GenericSerif, 12, FontStyle.Bold);
|
||||
Font Serif12 = new Font(FontFamily.GenericSerif, 12);
|
||||
Font Serif14 = new Font(FontFamily.GenericSerif, 14);
|
||||
Rectangle startDrawRectangle = e.MarginBounds;
|
||||
int widthPerColumn = e.MarginBounds.Width/dgAppts.Columns.Count;
|
||||
int Serif12Height = (int)Serif12.GetHeight();
|
||||
|
||||
//Draw Header
|
||||
StringFormat sf1 = new StringFormat();
|
||||
sf1.Alignment = StringAlignment.Center;
|
||||
g.DrawString("Appointment Listing", Serif14, Brushes.Black, startDrawRectangle, sf1);
|
||||
|
||||
startDrawRectangle.Y += (int)Serif14.GetHeight();
|
||||
|
||||
g.DrawString("Confidential Patient Information", Serif12, Brushes.Black, startDrawRectangle, sf1);
|
||||
|
||||
startDrawRectangle.Y += Serif12Height * 2;
|
||||
|
||||
//Patient Name + Sex + DOB
|
||||
string identifier = "Patient Name: " + dtAppt.Rows[0]["Name"] + "\tSex: " + dtAppt.Rows[0]["Sex"]
|
||||
+ "\tDate of Birth: " + dtAppt.Rows[0]["DOB"];
|
||||
g.DrawString(identifier, Serif12, Brushes.Black, startDrawRectangle);
|
||||
|
||||
startDrawRectangle.Y += Serif12Height * 2;
|
||||
|
||||
foreach (DataGridViewColumn col in dgAppts.Columns)
|
||||
{
|
||||
g.DrawString("Hello,\nPrinter", font, Brushes.Black, e.MarginBounds);
|
||||
g.DrawString(col.HeaderText, Serif12Bold, Brushes.Black, startDrawRectangle);
|
||||
startDrawRectangle.X += widthPerColumn;
|
||||
}
|
||||
startDrawRectangle.Y += Serif12Height;
|
||||
|
||||
// rowToPrint initialized in print button handler. Helps us keep track of which row we
|
||||
// are on, so that, just in case we need an extra page to print, we would know where
|
||||
// we left off. Royal we of course.
|
||||
for ( ; rowToPrint<dgAppts.Rows.Count; rowToPrint++)
|
||||
{
|
||||
// Post facto statement -- This is starting to look like Mumps...
|
||||
// Start drawing a new page if you hit the bottom margin...
|
||||
// Y incremented at the bottom of the for loop; but checked here
|
||||
// because I need for statement stuff to happen first
|
||||
if (startDrawRectangle.Y > e.MarginBounds.Bottom)
|
||||
{
|
||||
e.HasMorePages = true;
|
||||
break;
|
||||
}
|
||||
|
||||
startDrawRectangle.X = e.MarginBounds.X;
|
||||
|
||||
foreach (DataGridViewCell cell in dgAppts.Rows[rowToPrint].Cells)
|
||||
{
|
||||
g.DrawString(cell.Value.ToString(), Serif12, Brushes.Black, startDrawRectangle);
|
||||
startDrawRectangle.X += widthPerColumn;
|
||||
}
|
||||
|
||||
startDrawRectangle.Y += Serif12Height;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
rowToPrint = 0; //reset row to print
|
||||
DialogResult res = printDialog1.ShowDialog();
|
||||
if (res == DialogResult.OK) this.printDialog1.Document.Print();
|
||||
}
|
||||
|
||||
private void PrintPtAppts_QueryPageSettings(object sender, System.Drawing.Printing.QueryPageSettingsEventArgs e)
|
||||
{
|
||||
e.PageSettings.Landscape = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,18 +120,9 @@
|
|||
<metadata name="patientApptsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>412, 17</value>
|
||||
</metadata>
|
||||
<metadata name="patientApptsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>412, 17</value>
|
||||
</metadata>
|
||||
<metadata name="dsPatientApptDisplay2BindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>179, 17</value>
|
||||
</metadata>
|
||||
<metadata name="dsPatientApptDisplay2BindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>179, 17</value>
|
||||
</metadata>
|
||||
<metadata name="dsPatientApptDisplay2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="dsPatientApptDisplay2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
|
|
|
@ -663,7 +663,7 @@
|
|||
</member>
|
||||
<member name="M:IndianHealthService.ClinicalScheduling.UCPatientAppts.#ctor(IndianHealthService.ClinicalScheduling.CGDocumentManager,System.Int32)">
|
||||
<summary>
|
||||
Ctor
|
||||
Ctor - Creates control and populates data into datagridview
|
||||
</summary>
|
||||
<param name="docManager">Document Manager from main context</param>
|
||||
<param name="nPatientID">Patient IEN</param>
|
||||
|
|
Loading…
Reference in New Issue