Ignore:
Timestamp:
Jun 19, 2010, 12:41:06 PM (14 years ago)
Author:
Sam Habiel
Message:

Support for Routing Slip printing.
Version change from 1.1 to 1.2 in preparation for release.
Printing.cs: Addition of PrintRoutingSlip method.
CGView.cs: Handling of printing of routing slip if chosen in DCheckIn.cs
CGView.cs: New context option to re-print routing slip
DCheckIn.cs: toolTip1 to explain that routing slip will print on the default printer.

File:
1 edited

Legend:

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

    r789 r804  
    279279        /// <summary>
    280280        /// Print message on a page; typically that there are no appointments to be found.
     281        /// Or just a test message to verify that printing works.
    281282        /// </summary>
    282283        /// <param name="msg">The exact string to print.</param>
     
    287288                Brushes.Black, e.MarginBounds);
    288289        }
    289        
     290
     291        /// <summary>
     292        /// Print Routing Slip
     293        /// </summary>
     294        /// <param name="a">Appointment Data Structure</param>
     295        /// <param name="title">String to print for title</param>
     296        /// <param name="e">etc</param>
     297        public static void PrintRoutingSlip(CGAppointment a, string title, PrintPageEventArgs e)
     298        {
     299            Rectangle printArea = e.MarginBounds;
     300            Graphics g = e.Graphics;
     301            StringFormat sf = new StringFormat();
     302            sf.Alignment = StringAlignment.Center; //for title
     303            Font fTitle = new Font(FontFamily.GenericSerif, 24, FontStyle.Bold); //for title
     304            Font fBody = new Font(FontFamily.GenericSerif, 18);
     305            Font fBodyEm = new Font(FontFamily.GenericSerif, 18, FontStyle.Bold);
     306            g.DrawString(title, fTitle, Brushes.Black, printArea, sf); //title
     307
     308            // move down
     309            int titleHeight = (int)g.MeasureString(title, fTitle, printArea.Width).Height;
     310            printArea.Y += titleHeight;
     311            printArea.Height -= titleHeight;
     312
     313            // draw underline
     314            g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
     315            printArea.Y += 15;
     316            printArea.Height -= 15;
     317
     318            //construct what to print
     319            string toprint = "Patient: " + a.PatientName + "\t" + "ID: " + a.PatientID;
     320            toprint += "\n\n";
     321            toprint += "Appointment Time: " + a.StartTime.ToLongDateString() + " " + a.StartTime.ToLongTimeString();
     322            toprint += "\n\n";
     323            toprint += "Notes:\n" + a.Note;
     324
     325            //print
     326            g.DrawString(toprint, fBody, Brushes.Black, printArea);
     327
     328            // Print Date Printed
     329            //sf to move to bottom center
     330            StringFormat sf2 = new StringFormat();
     331            sf2.LineAlignment = StringAlignment.Far;
     332            sf2.Alignment = StringAlignment.Center;
     333
     334            //Print
     335            Font fFooter = new Font(FontFamily.GenericSerif, 8);
     336            g.DrawString("Printed: " + DateTime.Now, fFooter, Brushes.Black, printArea, sf2);
     337
     338        }
    290339    }
    291340}
Note: See TracChangeset for help on using the changeset viewer.