From 67492a320cea11e218cf6f79234f66ffbcc2c828 Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 11 May 2010 05:24:18 +0000 Subject: [PATCH] Better printing in UCPatientAppts. --- .../ClinicalScheduling.csproj | 4 - .../ClinicalScheduling.suo | Bin 75264 -> 79360 bytes .../DPatientApptDisplay.cs | 73 +---------- .../DPatientApptDisplay.resx | 120 ------------------ .../UCPatientAppts.Designer.cs | 23 ++-- cs/bsdx0200GUISourceCode/UCPatientAppts.cs | 73 ++++++++++- cs/bsdx0200GUISourceCode/UCPatientAppts.resx | 9 -- .../bin/Release/ClinicalScheduling.XML | 2 +- 8 files changed, 85 insertions(+), 219 deletions(-) delete mode 100644 cs/bsdx0200GUISourceCode/DPatientApptDisplay.resx 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 b16946318a9c7eb741ec9f74d5ff849cf30b5fbc..ecf7abf8f87a4c4691b0729daa1d21c0b545f581 100644 GIT binary patch delta 2714 zcma)83v5&86~4#0zD;6d9Fyi%Cpa(j3W*&|7^r}gPzY;6oF;?uN^SBeP&WzSKoVfN z(5`Ab)`Gtjhn8)WN?qGcYT!y?TUjxbrGx|$)<{LDKsR;LDzOqYYZ{XlcJ7VCj8tj6 z)~ECO&-stfIsbpJJS@t0#J)xy<>Kx@E~Ufwqayr9H!OAwf`C`z+Tsr|bBqxb{ieRa zv7Djt%M{15+^lqoDLN^i`S}FfXLg*G%v7jck7sd%d2 zly4d97cr7>AoYSI%wu*&^v|Smk`MUFoRlMJ9=$3i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}VmLhT?MA=aZ1+^g=0C(Bbsq zWTX}!I$bE4TefKRx{B5vy`AGOMTh2MJAPAAgQ>jC(NZ0DjHHW#P%Q{J|6WL3!|Pgu z@7U=}G;DMPvf6o5ziya=Vmd=Q+}^qYyXt>{E7hB^`4zhwe%QANH8qWBKWsynS3+mY zDBO?khTl60<?s@P z+*%y?#$G7ObweUsAou)}jG;;gxriKCvF6Vhukb;B{svO3o;zuw8T_u=z`919eo?}W zs!a7tb(apMS6{{C&mA03Ms-a$e6_pi60%0$TOG~qv?2&`VOq2j$tATH(4r3d);Qhi(eHG7*?Ek&^Ajh(X_|lUo z>PU8cadjsQE2Fr~~Yri@w5lr#9KYj{X|&)Zng`X{(= zW41HxOb4@rd6Ma5o?@P6zRi4x*~#o;zRT=p_Ap({UdG3CGd)Z%<7fJqXP9T1erAA# z3}KK5`3ZFldnQz7p?8C3Jg@Ka*s^Nawel; zwt;-G_jPdgW~zVm=MzRs5|Gf}J^G9e-2~ki;D+X>3$Y)MC(|3IQpFSH1Ig+8H2fHJRyrd*VAZ*zrlWDEVv zO>f@QaEY{qrc0@kf<^hX-6n|Vw2~T$?AHmgYZb=!eO*u4IiFsm|LYgxpfmroLNNFM z9eL;=2Yilso;k#5xu)?Vj}J3PV!D^OA7(~k^2^*GXHKXcS5DChpFLzRAUok&mEERQ z^cJob9a_cUc7H{OXH`y+63G^PEtfi}<3#gPB!5))w)bZo#2A=*9IZFfVf&>~RX$b- zJ#7VnM~dJXli*3RiUyAM3CJ~#V|JU~%%9 zZwkZvSq=%PoXn2CRLXi7_D~#({6GlCMW-RE+A)m3rbkl;tUnT1wxu 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