Ignore:
Timestamp:
Jun 6, 2010, 8:59:53 PM (14 years ago)
Author:
Sam Habiel
Message:

Provided framework for Rebook letters; but they don't work.
Added the appointment dates to the printed letters.
Made more shortcuts on the main menu.
Changed version to 1.1, to be more congruous with the state of the software.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/Printing.cs

    r788 r789  
    148148            printArea.Y += 15;
    149149            printArea.Height -= 15;
    150            
     150
     151            // write appointment date
     152            string str = "Appointment Date: " + ptRow.ApptDate + "\n\n";
     153            g.DrawString(str, fBody, Brushes.Black, printArea);
     154
     155            // move down
     156            int strHeight = (int)g.MeasureString(str, fBody, printArea.Width).Height;
     157            printArea.Y += strHeight;
     158            printArea.Height -= strHeight;
     159
    151160            // write missive
    152161            g.DrawString(letter, fBody, Brushes.Black, printArea);
     
    165174
    166175        /// <summary>
    167         /// Print Letter to be given or mailed to the patient
    168         /// </summary>
    169         /// <param name="ptrow">Strongly typed PatientApptsRow to pass (just one ApptRow)</param>
     176        /// Cancellation Letter to be given or mailed to the patient
     177        /// </summary>
     178        /// <param name="ptRow">Strongly typed PatientApptsRow to pass (just one ApptRow)</param>
    170179        /// <param name="e">You know what that is</param>
    171180        /// <param name="letter">Contains letter string</param>
     
    190199            printArea.Y += 15;
    191200            printArea.Height -= 15;
     201
     202            // write appointment date
     203            string str = "Appointment Date: " + ptRow.OldApptDate + "\n\n";
     204            g.DrawString(str, fBody, Brushes.Black, printArea);
     205
     206            // move down
     207            int strHeight = (int)g.MeasureString(str, fBody, printArea.Width).Height;
     208            printArea.Y += strHeight;
     209            printArea.Height -= strHeight;
    192210
    193211            // write missive
     
    206224        }
    207225
     226        /// <summary>
     227        /// Print rebook letters. Prints old and new appointments dates then the missive.
     228        /// </summary>
     229        /// <param name="ptRow">Strongly typed appointment row</param>
     230        /// <param name="e">etc</param>
     231        /// <param name="letter">Text of the letter to print</param>
     232        /// <param name="title">Title to print at the top of the letter</param>
     233        public static void PrintRebookLetter(dsRebookAppts.PatientApptsRow ptRow, PrintPageEventArgs e, string letter, string title)
     234        {
     235            Rectangle printArea = e.MarginBounds;
     236            Graphics g = e.Graphics;
     237            StringFormat sf = new StringFormat();
     238            sf.Alignment = StringAlignment.Center; //for title
     239            Font fTitle = new Font(FontFamily.GenericSerif, 24, FontStyle.Bold); //for title
     240            Font fBody = new Font(FontFamily.GenericSerif, 12);
     241            g.DrawString(title, fTitle, Brushes.Black, printArea, sf); //title
     242
     243            // move down
     244            int titleHeight = (int)g.MeasureString(title, fTitle, printArea.Width).Height;
     245            printArea.Y += titleHeight;
     246            printArea.Height -= titleHeight;
     247
     248            // draw underline
     249            g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
     250            printArea.Y += 15;
     251            printArea.Height -= 15;
     252
     253            // write old and new appointment dates
     254            string str = "Old Appointment Date:\t\t" + ptRow.OldApptDate + "\n";
     255            str += "New Appointment Date:\t\t" + ptRow.NewApptDate + "\n\n";
     256            g.DrawString(str, fBody, Brushes.Black, printArea);
     257
     258            // move down
     259            int strHeight = (int)g.MeasureString(str, fBody, printArea.Width).Height;
     260            printArea.Y += strHeight;
     261            printArea.Height -= strHeight;
     262
     263            // write missive
     264            g.DrawString(letter, fBody, Brushes.Black, printArea);
     265
     266            //print Address in lower left corner for windowed envolopes
     267            printArea.Location = new Point(e.MarginBounds.X, (int)(e.PageBounds.Height * 0.66));
     268            printArea.Height = (int)(e.MarginBounds.Height * 0.20);
     269            sf.Alignment = StringAlignment.Near;
     270            sf.LineAlignment = StringAlignment.Center;
     271            StringBuilder address = new StringBuilder(100);
     272            address.AppendLine(ptRow.Name);
     273            address.AppendLine(ptRow.STREET);
     274            address.AppendLine(ptRow.CITY + ", " + ptRow.STATE + " " + ptRow.ZIP);
     275            g.DrawString(address.ToString(), fBody, Brushes.Black, printArea, sf);
     276
     277        }
     278
     279        /// <summary>
     280        /// Print message on a page; typically that there are no appointments to be found.
     281        /// </summary>
     282        /// <param name="msg">The exact string to print.</param>
     283        /// <param name="e">Print Page event args</param>
    208284        public static void PrintMessage(string msg, PrintPageEventArgs e)
    209285        {
Note: See TracChangeset for help on using the changeset viewer.