diff --git a/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj b/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj index 9287458..4670afd 100644 --- a/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj +++ b/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj @@ -413,10 +413,6 @@ DNoShow.cs Designer - - DPatientApptDisplay.cs - Designer - DPatientLetter.cs Designer diff --git a/cs/bsdx0200GUISourceCode/ClinicalScheduling.suo b/cs/bsdx0200GUISourceCode/ClinicalScheduling.suo index b169463..ecf7abf 100644 Binary files a/cs/bsdx0200GUISourceCode/ClinicalScheduling.suo and b/cs/bsdx0200GUISourceCode/ClinicalScheduling.suo differ diff --git a/cs/bsdx0200GUISourceCode/DPatientApptDisplay.cs b/cs/bsdx0200GUISourceCode/DPatientApptDisplay.cs index c47673b..41219f1 100644 --- a/cs/bsdx0200GUISourceCode/DPatientApptDisplay.cs +++ b/cs/bsdx0200GUISourceCode/DPatientApptDisplay.cs @@ -13,9 +13,6 @@ namespace IndianHealthService.ClinicalScheduling /// public class DPatientApptDisplay : System.Windows.Forms.Form { - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.CheckBox chkIncludePast; - private DataGridView dataGridView1; /// /// Required designer variable. /// @@ -23,17 +20,10 @@ 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. /// + 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(); - } } } diff --git a/cs/bsdx0200GUISourceCode/DPatientApptDisplay.resx b/cs/bsdx0200GUISourceCode/DPatientApptDisplay.resx deleted file mode 100644 index ff31a6d..0000000 --- a/cs/bsdx0200GUISourceCode/DPatientApptDisplay.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/cs/bsdx0200GUISourceCode/UCPatientAppts.Designer.cs b/cs/bsdx0200GUISourceCode/UCPatientAppts.Designer.cs index 0407562..c904012 100644 --- a/cs/bsdx0200GUISourceCode/UCPatientAppts.Designer.cs +++ b/cs/bsdx0200GUISourceCode/UCPatientAppts.Designer.cs @@ -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 // diff --git a/cs/bsdx0200GUISourceCode/UCPatientAppts.cs b/cs/bsdx0200GUISourceCode/UCPatientAppts.cs index 17d2923..a099d3b 100644 --- a/cs/bsdx0200GUISourceCode/UCPatientAppts.cs +++ b/cs/bsdx0200GUISourceCode/UCPatientAppts.cs @@ -13,10 +13,11 @@ namespace IndianHealthService.ClinicalScheduling /// public partial class UCPatientAppts : UserControl { - DataTable dtAppt; - DataView dvAppt; + DataTable dtAppt; // Main table + DataView dvAppt; // Manipulated view of table + int rowToPrint; // Used in printing /// - /// Ctor + /// Ctor - Creates control and populates data into datagridview /// /// Document Manager from main context /// Patient IEN @@ -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 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; + } + } } diff --git a/cs/bsdx0200GUISourceCode/UCPatientAppts.resx b/cs/bsdx0200GUISourceCode/UCPatientAppts.resx index a3f0225..9523c4f 100644 --- a/cs/bsdx0200GUISourceCode/UCPatientAppts.resx +++ b/cs/bsdx0200GUISourceCode/UCPatientAppts.resx @@ -120,18 +120,9 @@ 412, 17 - - 412, 17 - 179, 17 - - 179, 17 - - - 17, 17 - 17, 17 diff --git a/cs/bsdx0200GUISourceCode/bin/Release/ClinicalScheduling.XML b/cs/bsdx0200GUISourceCode/bin/Release/ClinicalScheduling.XML index 9b8df03..114d60d 100644 --- a/cs/bsdx0200GUISourceCode/bin/Release/ClinicalScheduling.XML +++ b/cs/bsdx0200GUISourceCode/bin/Release/ClinicalScheduling.XML @@ -663,7 +663,7 @@ - Ctor + Ctor - Creates control and populates data into datagridview Document Manager from main context Patient IEN