Ignore:
Timestamp:
May 11, 2010, 1:24:18 AM (15 years ago)
Author:
Sam Habiel
Message:

Better printing in UCPatientAppts.

Location:
Scheduling/trunk/cs/bsdx0200GUISourceCode
Files:
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj

    r753 r755  
    414414      <SubType>Designer</SubType>
    415415    </EmbeddedResource>
    416     <EmbeddedResource Include="DPatientApptDisplay.resx">
    417       <DependentUpon>DPatientApptDisplay.cs</DependentUpon>
    418       <SubType>Designer</SubType>
    419     </EmbeddedResource>
    420416    <EmbeddedResource Include="DPatientLetter.resx">
    421417      <DependentUpon>DPatientLetter.cs</DependentUpon>
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/DPatientApptDisplay.cs

    r753 r755  
    1414        public class DPatientApptDisplay : System.Windows.Forms.Form
    1515        {
    16         private System.Windows.Forms.Panel panel1;
    17         private System.Windows.Forms.CheckBox chkIncludePast;
    18         private DataGridView dataGridView1;
    1916                /// <summary>
    2017                /// Required designer variable.
     
    2421                public void InitializeForm(CGDocumentManager docManager, int nPatientID)
    2522                {
    26                         try
    27                         {       
    28                                 string sSql = "BSDX PATIENT APPT DISPLAY^" + nPatientID.ToString();
    29                                 DataTable dtAppt = docManager.RPMSDataTable(sSql, "PatientAppts");
    30                                 dataGridView1.DataSource = dtAppt;
    31                         }
    32                         catch (Exception ex)
    33                         {
    34                                 MessageBox.Show(ex.Message);
    35                         }
    36                 }
     23            Control UC = new UCPatientAppts(docManager, nPatientID);
     24            UC.Dock = DockStyle.Fill;
     25            this.Controls.Add(UC);
     26        }
    3727
    3828                public DPatientApptDisplay()
     
    6151                /// the contents of this method with the code editor.
    6252                /// </summary>
     53
    6354                private void InitializeComponent()
    6455                {
    65             this.panel1 = new System.Windows.Forms.Panel();
    66             this.chkIncludePast = new System.Windows.Forms.CheckBox();
    67             this.dataGridView1 = new System.Windows.Forms.DataGridView();
    68             this.panel1.SuspendLayout();
    69             ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
    70             this.SuspendLayout();
    71             //
    72             // panel1
    73             //
    74             this.panel1.Controls.Add(this.chkIncludePast);
    75             this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
    76             this.panel1.Location = new System.Drawing.Point(0, 0);
    77             this.panel1.Name = "panel1";
    78             this.panel1.Size = new System.Drawing.Size(664, 32);
    79             this.panel1.TabIndex = 1;
    80             //
    81             // chkIncludePast
    82             //
    83             this.chkIncludePast.Location = new System.Drawing.Point(16, 8);
    84             this.chkIncludePast.Name = "chkIncludePast";
    85             this.chkIncludePast.Size = new System.Drawing.Size(184, 16);
    86             this.chkIncludePast.TabIndex = 0;
    87             this.chkIncludePast.Text = "Include Past Appointments";
    88             this.chkIncludePast.CheckedChanged += new System.EventHandler(this.chkIncludePast_CheckedChanged);
    89             //
    90             // dataGridView1
    91             //
    92             this.dataGridView1.AllowUserToAddRows = false;
    93             this.dataGridView1.AllowUserToDeleteRows = false;
    94             this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
    95             this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
    96             this.dataGridView1.Location = new System.Drawing.Point(0, 32);
    97             this.dataGridView1.Name = "dataGridView1";
    98             this.dataGridView1.ReadOnly = true;
    99             this.dataGridView1.Size = new System.Drawing.Size(664, 446);
    100             this.dataGridView1.TabIndex = 2;
    101             //
    10256            // DPatientApptDisplay
    10357            //
    10458            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    10559            this.ClientSize = new System.Drawing.Size(664, 478);
    106             this.Controls.Add(this.dataGridView1);
    107             this.Controls.Add(this.panel1);
    10860            this.Name = "DPatientApptDisplay";
    10961            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
    11062            this.Text = "Patient Appointments";
    111             this.panel1.ResumeLayout(false);
    112             ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
    11363            this.ResumeLayout(false);
    11464
    11565                }
    11666                #endregion
    117 
    118                 private void chkIncludePast_CheckedChanged(object sender, System.EventArgs e)
    119                 {
    120                         if (chkIncludePast.Checked == true)
    121                         {
    122                 //this.crViewer1.SelectionFormula = "TRUE"; //MJL 9/11/2007
    123                         }
    124                         else
    125                         {
    126                                 //crViewer1.SelectionFormula = "{PatientAppts.ApptDate} >= CurrentDate";
    127                         }
    128                         //crViewer1.RefreshReport();
    129                 }
    13067        }
    13168}
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/UCPatientAppts.Designer.cs

    r753 r755  
    4040            this.dsPatientApptDisplay2 = new IndianHealthService.ClinicalScheduling.dsPatientApptDisplay2();
    4141            this.panel1 = new System.Windows.Forms.Panel();
     42            this.btnPrint = new System.Windows.Forms.Button();
    4243            this.chkPastAppts = new System.Windows.Forms.CheckBox();
    43             this.btnPrint = new System.Windows.Forms.Button();
    4444            this.printDialog1 = new System.Windows.Forms.PrintDialog();
    4545            this.PrintPtAppts = new System.Drawing.Printing.PrintDocument();
     
    133133            this.panel1.TabIndex = 3;
    134134            //
     135            // btnPrint
     136            //
     137            this.btnPrint.Location = new System.Drawing.Point(3, 3);
     138            this.btnPrint.Name = "btnPrint";
     139            this.btnPrint.Size = new System.Drawing.Size(75, 23);
     140            this.btnPrint.TabIndex = 1;
     141            this.btnPrint.Text = "Print";
     142            this.btnPrint.UseVisualStyleBackColor = true;
     143            this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
     144            //
    135145            // chkPastAppts
    136146            //
     
    145155            this.chkPastAppts.CheckedChanged += new System.EventHandler(this.chkPastAppts_CheckedChanged);
    146156            //
    147             // btnPrint
    148             //
    149             this.btnPrint.Location = new System.Drawing.Point(3, 3);
    150             this.btnPrint.Name = "btnPrint";
    151             this.btnPrint.Size = new System.Drawing.Size(75, 23);
    152             this.btnPrint.TabIndex = 1;
    153             this.btnPrint.Text = "Print";
    154             this.btnPrint.UseVisualStyleBackColor = true;
    155             this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
    156             //
    157157            // printDialog1
    158158            //
     
    164164            this.PrintPtAppts.DocumentName = "Print Patient Appointments";
    165165            this.PrintPtAppts.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.PrintPtAppts_PrintPage);
     166            this.PrintPtAppts.QueryPageSettings += new System.Drawing.Printing.QueryPageSettingsEventHandler(this.PrintPtAppts_QueryPageSettings);
    166167            //
    167168            // UCPatientAppts
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/UCPatientAppts.cs

    r753 r755  
    1414    public partial class UCPatientAppts : UserControl
    1515    {
    16         DataTable dtAppt;
    17         DataView dvAppt;
     16        DataTable dtAppt; // Main table
     17        DataView dvAppt; // Manipulated view of table
     18        int rowToPrint; // Used in printing
    1819        /// <summary>
    19         /// Ctor
     20        /// Ctor - Creates control and populates data into datagridview
    2021        /// </summary>
    2122        /// <param name="docManager">Document Manager from main context</param>
     
    4445        {
    4546            if (ShowPastAppts) dvAppt.RowFilter = "";
    46             else dvAppt.RowFilter = "ApptDate > " + "#" + DateTime.Today.ToShortDateString() + "#"; ;
     47            else dvAppt.RowFilter = "ApptDate > " + "#" + DateTime.Today.ToShortDateString() + "#";
    4748        }
    4849
     
    5657        {
    5758            Graphics g = e.Graphics;
    58             using (Font font = new Font("Lucida Console", 72))
     59            Font Serif12Bold = new Font(FontFamily.GenericSerif, 12, FontStyle.Bold);
     60            Font Serif12 = new Font(FontFamily.GenericSerif, 12);
     61            Font Serif14 = new Font(FontFamily.GenericSerif, 14);
     62            Rectangle startDrawRectangle = e.MarginBounds;
     63            int widthPerColumn = e.MarginBounds.Width/dgAppts.Columns.Count;
     64            int Serif12Height = (int)Serif12.GetHeight();
     65           
     66            //Draw Header
     67            StringFormat sf1 = new StringFormat();
     68            sf1.Alignment = StringAlignment.Center;
     69            g.DrawString("Appointment Listing", Serif14, Brushes.Black, startDrawRectangle, sf1);
     70
     71            startDrawRectangle.Y += (int)Serif14.GetHeight();
     72
     73            g.DrawString("Confidential Patient Information", Serif12, Brushes.Black, startDrawRectangle, sf1);
     74           
     75            startDrawRectangle.Y += Serif12Height * 2;
     76
     77            //Patient Name + Sex + DOB
     78            string identifier = "Patient Name: " + dtAppt.Rows[0]["Name"] + "\tSex: " + dtAppt.Rows[0]["Sex"]
     79                + "\tDate of Birth: " + dtAppt.Rows[0]["DOB"];
     80            g.DrawString(identifier, Serif12, Brushes.Black, startDrawRectangle);
     81
     82            startDrawRectangle.Y += Serif12Height * 2;
     83
     84            foreach (DataGridViewColumn col in dgAppts.Columns)
    5985            {
    60                 g.DrawString("Hello,\nPrinter", font, Brushes.Black, e.MarginBounds);
     86                g.DrawString(col.HeaderText, Serif12Bold, Brushes.Black, startDrawRectangle);
     87                startDrawRectangle.X += widthPerColumn;
    6188            }
     89            startDrawRectangle.Y += Serif12Height;
     90
     91            // rowToPrint initialized in print button handler. Helps us keep track of which row we
     92            // are on, so that, just in case we need an extra page to print, we would know where
     93            // we left off. Royal we of course.
     94            for ( ; rowToPrint<dgAppts.Rows.Count; rowToPrint++)
     95            {
     96                // Post facto statement -- This is starting to look like Mumps...
     97                // Start drawing a new page if you hit the bottom margin...
     98                // Y incremented at the bottom of the for loop; but checked here
     99                // because I need for statement stuff to happen first
     100                if (startDrawRectangle.Y > e.MarginBounds.Bottom)
     101                {
     102                    e.HasMorePages = true;
     103                    break;
     104                }
     105
     106                startDrawRectangle.X = e.MarginBounds.X;
     107
     108                foreach (DataGridViewCell cell in dgAppts.Rows[rowToPrint].Cells)
     109                {
     110                    g.DrawString(cell.Value.ToString(), Serif12, Brushes.Black, startDrawRectangle);
     111                    startDrawRectangle.X += widthPerColumn;
     112                }
     113
     114                startDrawRectangle.Y += Serif12Height;
     115
     116            }             
    62117        }
    63118
    64119        private void btnPrint_Click(object sender, EventArgs e)
    65120        {
     121            rowToPrint = 0; //reset row to print
    66122            DialogResult res = printDialog1.ShowDialog();
    67123            if (res == DialogResult.OK) this.printDialog1.Document.Print();
    68124        }
    69125
     126        private void PrintPtAppts_QueryPageSettings(object sender, System.Drawing.Printing.QueryPageSettingsEventArgs e)
     127        {
     128            e.PageSettings.Landscape = true;
     129        }
     130
    70131    }
    71132}
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/UCPatientAppts.resx

    r753 r755  
    121121    <value>412, 17</value>
    122122  </metadata>
    123   <metadata name="patientApptsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    124     <value>412, 17</value>
    125   </metadata>
    126123  <metadata name="dsPatientApptDisplay2BindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    127124    <value>179, 17</value>
    128   </metadata>
    129   <metadata name="dsPatientApptDisplay2BindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    130     <value>179, 17</value>
    131   </metadata>
    132   <metadata name="dsPatientApptDisplay2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    133     <value>17, 17</value>
    134125  </metadata>
    135126  <metadata name="dsPatientApptDisplay2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/bin/Release/ClinicalScheduling.XML

    r753 r755  
    664664        <member name="M:IndianHealthService.ClinicalScheduling.UCPatientAppts.#ctor(IndianHealthService.ClinicalScheduling.CGDocumentManager,System.Int32)">
    665665            <summary>
    666             Ctor
     666            Ctor - Creates control and populates data into datagridview
    667667            </summary>
    668668            <param name="docManager">Document Manager from main context</param>
Note: See TracChangeset for help on using the changeset viewer.