Ignore:
Timestamp:
Mar 24, 2011, 9:26:14 AM (13 years ago)
Author:
Sam Habiel
Message:

CGDocument: Minor Change: Add appointment ID to Appointment
CGDocumentManager: added parameter /culture to set Thread.CurrentThread.CurrentUICulture
CGView: Minor changes in CheckInAppointment: Printing of Routing Slip now always happens.

Routing slip now get parameter for patient order.

Patient: i18n of UserFriendlyAge
Printing: Extensive changes. Support for i18n; new routing slip and appt slip. i18n support only for appt slip.

File:
1 edited

Legend:

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

    r1110 r1112  
    99namespace IndianHealthService.ClinicalScheduling
    1010{
    11     public class Printing
     11    public partial class Printing
    1212    {
    1313        /// <summary>
     
    4848            //Typical manipulable print area
    4949            Rectangle printArea = e.MarginBounds;
    50            
     50            Rectangle pageArea = e.PageBounds;
     51            Rectangle headerArea = new Rectangle()
     52            {
     53                X = e.MarginBounds.X,
     54                Y = e.PageBounds.Y,
     55                Height = e.MarginBounds.Y - e.PageBounds.Y,
     56                Width = e.MarginBounds.Width
     57            };
     58            Rectangle footerArea = new Rectangle()
     59            {
     60                X = e.MarginBounds.X,
     61                Y = e.MarginBounds.Height + headerArea.Height,
     62                Width = e.MarginBounds.Width,
     63                Height = pageArea.Height - (e.MarginBounds.Height + headerArea.Height)
     64            };
     65
     66            //print footer
     67            StringFormat sfFooter = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center };
     68            string s = strings.Printed + ": " + DateTime.Now.ToString();
     69            Font fFooter = new Font(FontFamily.GenericSerif, 7);
     70            g.DrawString(s, fFooter, Brushes.Black, footerArea, sfFooter);
     71
    5172            //resource we want to print
    5273            dsPatientApptDisplay2.BSDXResourceRow r = ds.BSDXResource[resourceToPrint];
     
    5475            //header
    5576            string toprint;
    56             if (beg == end) toprint = "Appointments for " + r.RESOURCE_NAME + " on " + beg.ToLongDateString();
     77            if (beg.Date == end.Date) toprint = "Appointments for " + r.RESOURCE_NAME + " on " + beg.ToLongDateString();
    5778            else toprint = "Appointments for " + r.RESOURCE_NAME + " from " + beg.ToShortDateString() + " to "
    5879                + end.ToShortDateString();
     
    6081           
    6182            //Move print area down
    62             printArea.Height -= (int)f14bold.GetHeight();
    63             printArea.Y += (int)f14bold.GetHeight();
     83            int titleHeight = (int)g.MeasureString(toprint, f14bold, printArea.Size).Height;
     84            printArea.Height -= titleHeight;
     85            printArea.Y += titleHeight;
    6486
    6587            //Draw Line
     
    134156                Width = e.MarginBounds.Width
    135157            };
    136 
    137             // A few fonts
    138             Font fTitle = new Font(FontFamily.GenericSerif, 24, FontStyle.Bold); //for title
    139             Font fBody = new Font(FontFamily.GenericSerif, 12);
    140             Font fGroupTitle = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
    141 
    142             StringFormat sf0 = new StringFormat()
    143             {
    144                  Alignment = StringAlignment.Center,
    145                  LineAlignment = StringAlignment.Center
    146             };
    147            
    148             // Draw Header
    149             string division = CGDocumentManager.Current.ConnectInfo.DivisionName;
    150             g.DrawString(division, fBody, Brushes.Black, headerArea, sf0);
    151            
    152             // Draw Title
    153             StringFormat sf = new StringFormat();
    154             sf.Alignment = StringAlignment.Center; //for title & header
    155 
    156             string s = "Appointment Reminder Slip";
    157             g.DrawString(s, fTitle, Brushes.Black, printArea, sf); //title
    158 
    159             // move down
    160             int titleHeight = (int)g.MeasureString(s, fTitle, printArea.Width).Height;
    161             printArea.Y += titleHeight;
    162             printArea.Height -= titleHeight;
    163 
    164             // draw underline
    165             g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
    166             printArea.Y += 15;
    167             printArea.Height -= 15;
    168 
    169             // draw curved rectangle.
    170             Rectangle personalInfoRectangle = new Rectangle(e.MarginBounds.X, printArea.Y + 30, 280, 300);
    171             using (GraphicsPath path = GetRoundedRectPath(personalInfoRectangle, 10))
    172             {
    173                 g.DrawPath(Pens.Black, path);
    174             }
    175 
    176             // group header
    177             g.DrawString("Patient Information", fGroupTitle, Brushes.Black, new Point(personalInfoRectangle.X, personalInfoRectangle.Y - 20));
    178            
    179             // inner rectangle for drawing strings:
    180             Rectangle personalInfoInnerRectangle = new Rectangle(personalInfoRectangle.X + 20, personalInfoRectangle.Y + 20, 280 - 40, 300 - 40);
    181            
    182             // Strings to write
    183             StringBuilder sb = new StringBuilder(500);
    184             sb.AppendLine("Name:" + "\t" + appt.Patient.Name);
    185             sb.AppendLine();
    186             sb.AppendLine("ID#:" + "\t" + appt.Patient.ID);
    187             sb.AppendLine();
    188             sb.AppendLine("DOB:" + "\t" + appt.Patient.DOB.ToShortDateString());
    189             sb.AppendLine();
    190             sb.AppendLine("Age:" + "\t" + appt.Patient.UserFriendlyAge);
    191             sb.AppendLine();
    192             sb.AppendLine("Sex:" + "\t" + appt.Patient.Sex.ToString());
    193            
    194             // Draw them
    195             g.DrawString(sb.ToString(), fBody, Brushes.Black, personalInfoInnerRectangle);
    196 
    197             // draw curved rectangle
    198             Rectangle apptInfoRectangle = new Rectangle(e.MarginBounds.X + e.MarginBounds.Width - 280, printArea.Y + 30, 280, 300);
    199             using (GraphicsPath path = GetRoundedRectPath(apptInfoRectangle, 10))
    200             {
    201                 g.DrawPath(Pens.Black, path);
    202             }
    203 
    204             // group header
    205             g.DrawString("Appointment Information", fGroupTitle, Brushes.Black, new Point(apptInfoRectangle.X, apptInfoRectangle.Y - 20));
    206 
    207             // Strings to write
    208             sb = new StringBuilder();
    209             sb.AppendLine("Clinic: " + "\t" + appt.Resource);
    210             sb.AppendLine();
    211             sb.AppendLine("Date: " + "\t" + appt.StartTime.ToShortDateString());
    212             sb.AppendLine();
    213             sb.AppendLine("Day: " + "\t" + appt.StartTime.DayOfWeek.ToString());
    214             sb.AppendLine();
    215             sb.AppendLine("Time: " + "\t" + appt.StartTime.ToShortTimeString());
    216 
    217             // Draw them
    218             Rectangle apptInfoInnerRectangle = new Rectangle(apptInfoRectangle.X + 20, apptInfoRectangle.Y + 20, 280 - 40, 300 - 40);
    219 
    220             // Draw them
    221             g.DrawString(sb.ToString(), fBody, Brushes.Black, apptInfoInnerRectangle);
    222 
    223             // Move Drawing Rectangle Down
    224             printArea.Y += 300 + 30 + 20;
    225             printArea.Height -= 300 + 30 + 20;
    226 
    227             // Draw New Line
    228             g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
    229             printArea.Y += 5;
    230             printArea.Height -= 5;
    231 
    232             // Draw new Title
    233             s = "Clinic Instructions";
    234             g.DrawString(s, fTitle, Brushes.Black, printArea, sf); //title
    235 
    236             // move down
    237             titleHeight = (int)g.MeasureString(s, fTitle, printArea.Width).Height;
    238             printArea.Y += titleHeight;
    239             printArea.Height -= titleHeight;
    240 
    241             // Draw New Line
    242             g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
    243             printArea.Y += 15;
    244             printArea.Height -= 15;
    245 
    246             // Get Resource Clinic Appointment Letter Text
    247             DataTable resources = CGDocumentManager.Current.GlobalDataSet.Tables["Resources"];
    248 
    249             string ltrTxt = (from resource in resources.AsEnumerable()
    250                              where resource.Field<string>("RESOURCE_NAME") == appt.Resource
    251                              select resource.Field<string>("LETTER_TEXT")).SingleOrDefault<string>();
    252 
    253             if (String.IsNullOrWhiteSpace(ltrTxt)) ltrTxt = "(no instructions provided)";
    254 
    255             g.DrawString(ltrTxt, fBody, Brushes.Black, printArea);
    256 
    257             int ltrTxtHeight = (int)g.MeasureString(ltrTxt, fBody).Height;
    258 
    259             printArea.Y += ltrTxtHeight + 15;
    260             printArea.Height -= ltrTxtHeight + 15;
    261 
    262             g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
    263             printArea.Y += 5;
    264             printArea.Height -= 5;
    265 
    266             s = "Notes";
    267             g.DrawString(s, fTitle, Brushes.Black, printArea, sf); // Notes title
    268            
    269             // move down
    270             titleHeight = (int)g.MeasureString(s, fTitle, printArea.Width).Height;
    271             printArea.Y += titleHeight;
    272             printArea.Height -= titleHeight;
    273 
    274             // Draw New Line
    275             g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
    276             printArea.Y += 15;
    277             printArea.Height -= 15;
    278 
    279             // Draw Notes Area
    280             using (GraphicsPath path = GetRoundedRectPath(printArea, 15))
    281             {
    282                 g.DrawPath(Pens.Black, path);
    283             }
    284 
    285             // Draw Footer
    286             // Get footer rectangle
    287158            Rectangle footerArea = new Rectangle()
    288159            {
     
    293164            };
    294165
     166
     167            // A few fonts
     168            Font fTitle = new Font(FontFamily.GenericSerif, 24, FontStyle.Bold); //for title
     169            Font fBody = new Font(FontFamily.GenericSerif, 12);
     170            Font fGroupTitle = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
     171
     172            StringFormat sf0 = new StringFormat()
     173            {
     174                 Alignment = StringAlignment.Center,
     175                 LineAlignment = StringAlignment.Center
     176            };
     177           
     178            // Draw Header
     179            string division = CGDocumentManager.Current.ConnectInfo.DivisionName;
     180            g.DrawString(division, fBody, Brushes.Black, headerArea, sf0);
     181           
     182            // Draw Title
     183            StringFormat sf = new StringFormat();
     184            sf.Alignment = StringAlignment.Center; //for title & header
     185
     186            //string s = "Appointment Reminder Slip";
     187            string s = strings.ApptRoutingSlip;
     188            g.DrawString(s, fTitle, Brushes.Black, printArea, sf); //title
     189
     190            // move down
     191            int titleHeight = (int)g.MeasureString(s, fTitle, printArea.Width).Height;
     192            printArea.Y += titleHeight;
     193            printArea.Height -= titleHeight;
     194
     195            // draw underline
     196            g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
     197            printArea.Y += 15;
     198            printArea.Height -= 15;
     199
     200            // draw curved rectangle.
     201            Rectangle personalInfoRectangle = new Rectangle(e.MarginBounds.X, printArea.Y + 30, 280, 300);
     202            using (GraphicsPath path = GetRoundedRectPath(personalInfoRectangle, 10))
     203            {
     204                g.DrawPath(Pens.Black, path);
     205            }
     206
     207            // group header
     208            s = strings.PtInfo;
     209            StringFormat sf3 = new StringFormat(System.Threading.Thread.CurrentThread.CurrentUICulture.TextInfo.IsRightToLeft ? StringFormatFlags.DirectionRightToLeft : 0);
     210            g.DrawString(s, fGroupTitle, Brushes.Black, new Rectangle(personalInfoRectangle.X, personalInfoRectangle.Y - 20,personalInfoRectangle.Width, 20),sf3);
     211           
     212            // inner rectangle for drawing strings:
     213            Rectangle personalInfoInnerRectangle = new Rectangle(personalInfoRectangle.X + 20, personalInfoRectangle.Y + 20, 280 - 40, 300 - 40);
     214           
     215            // Strings to write
     216            StringBuilder sb = new StringBuilder(500);
     217            sb.AppendLine(strings.Name + ":" + "\t" + appt.Patient.Name);
     218            sb.AppendLine();
     219            sb.AppendLine(strings.ID + ":" + "\t" + appt.Patient.ID);
     220            sb.AppendLine();
     221            sb.AppendLine(strings.DOB + ":" + "\t" + appt.Patient.DOB.ToShortDateString());
     222            sb.AppendLine();
     223            sb.AppendLine(strings.Age + ":" + "\t" + appt.Patient.UserFriendlyAge);
     224            sb.AppendLine();
     225            s = appt.Patient.Sex == Sex.Male ? strings.Male : strings.Female;
     226            sb.AppendLine(strings.Sex + ":" + "\t" + s);
     227
     228            // Draw them
     229            sf3 = new StringFormat(System.Threading.Thread.CurrentThread.CurrentUICulture.TextInfo.IsRightToLeft ? StringFormatFlags.DirectionRightToLeft : 0);
     230            sf3.SetTabStops(0, new float[] {75} );
     231            sf3.SetDigitSubstitution(System.Threading.Thread.CurrentThread.CurrentUICulture.LCID, StringDigitSubstitute.Traditional);
     232            g.DrawString(sb.ToString(), fBody, Brushes.Black, personalInfoInnerRectangle, sf3);
     233
     234            // draw curved rectangle
     235            Rectangle apptInfoRectangle = new Rectangle(e.MarginBounds.X + e.MarginBounds.Width - 280, printArea.Y + 30, 280, 300);
     236            using (GraphicsPath path = GetRoundedRectPath(apptInfoRectangle, 10))
     237            {
     238                g.DrawPath(Pens.Black, path);
     239            }
     240
     241            s = strings.ApptInfo;
     242            // group header
     243            g.DrawString(s, fGroupTitle, Brushes.Black, new Rectangle(apptInfoRectangle.X, apptInfoRectangle.Y - 20,apptInfoRectangle.Width, 20), sf3);
     244
     245            // Strings to write
     246            sb = new StringBuilder();
     247            sb.AppendLine(strings.Clinic + ":" + "\t" + appt.Resource);
     248            sb.AppendLine();
     249            sb.AppendLine(strings.Date + ":" + "\t" + appt.StartTime.ToShortDateString());
     250            sb.AppendLine();
     251            sb.AppendLine(strings.Day + ":" + "\t" + appt.StartTime.ToString("dddd"));
     252            sb.AppendLine();
     253            sb.AppendLine(strings.Time + ":" + "\t" + appt.StartTime.ToShortTimeString());
     254
     255            // Draw them
     256            Rectangle apptInfoInnerRectangle = new Rectangle(apptInfoRectangle.X + 20, apptInfoRectangle.Y + 20, 280 - 40, 300 - 40);
     257
     258            // Draw them
     259            g.DrawString(sb.ToString(), fBody, Brushes.Black, apptInfoInnerRectangle, sf3);
     260
     261            // Move Drawing Rectangle Down
     262            printArea.Y += 300 + 30 + 20;
     263            printArea.Height -= 300 + 30 + 20;
     264
     265            // Draw New Line
     266            g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
     267            printArea.Y += 5;
     268            printArea.Height -= 5;
     269
     270            // Draw new Title
     271            s = strings.ClinicInstructions;
     272            g.DrawString(s, fTitle, Brushes.Black, printArea, sf); //title
     273
     274            // move down
     275            titleHeight = (int)g.MeasureString(s, fTitle, printArea.Width).Height;
     276            printArea.Y += titleHeight;
     277            printArea.Height -= titleHeight;
     278
     279            // Draw New Line
     280            g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
     281            printArea.Y += 15;
     282            printArea.Height -= 15;
     283
     284            // Get Resource Clinic Appointment Letter Text
     285            DataTable resources = CGDocumentManager.Current.GlobalDataSet.Tables["Resources"];
     286
     287            string ltrTxt = (from resource in resources.AsEnumerable()
     288                             where resource.Field<string>("RESOURCE_NAME") == appt.Resource
     289                             select resource.Field<string>("LETTER_TEXT")).SingleOrDefault<string>();
     290
     291            if (String.IsNullOrWhiteSpace(ltrTxt)) ltrTxt = strings.NoInstructionsProvided;
     292
     293            g.DrawString(ltrTxt, fBody, Brushes.Black, printArea, sf3);
     294
     295            int ltrTxtHeight = (int)g.MeasureString(ltrTxt, fBody).Height;
     296
     297            printArea.Y += ltrTxtHeight + 15;
     298            printArea.Height -= ltrTxtHeight + 15;
     299
     300            g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
     301            printArea.Y += 5;
     302            printArea.Height -= 5;
     303
     304            s = strings.Notes;
     305            g.DrawString(s, fTitle, Brushes.Black, printArea, sf); // Notes title
     306           
     307            // move down
     308            titleHeight = (int)g.MeasureString(s, fTitle, printArea.Width).Height;
     309            printArea.Y += titleHeight;
     310            printArea.Height -= titleHeight;
     311
     312            // Draw New Line
     313            g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
     314            printArea.Y += 15;
     315            printArea.Height -= 15;
     316
     317            // Draw Notes Area
     318            using (GraphicsPath path = GetRoundedRectPath(printArea, 15))
     319            {
     320                g.DrawPath(Pens.Black, path);
     321            }
     322
    295323            //use sf0 to print the footer (center all the way)
    296             s = "Printed: " + DateTime.Now.ToString();
     324            s = strings.Printed + ": " + DateTime.Now.ToString();
    297325            Font fFooter = new Font(FontFamily.GenericSerif, 7);
    298326            g.DrawString(s, fFooter, Brushes.Black, footerArea, sf0);
     
    510538        /// <param name="title">String to print for title</param>
    511539        /// <param name="e">etc</param>
    512         public virtual void PrintRoutingSlip(CGAppointment a, string title, PrintPageEventArgs e)
     540        public virtual void PrintRoutingSlip(CGAppointment appt, int apptOrder, PrintPageEventArgs e)
    513541        {
     542            // Prep
     543            Graphics g = e.Graphics;
    514544            Rectangle printArea = e.MarginBounds;
    515             Graphics g = e.Graphics;
     545            Rectangle pageArea = e.PageBounds;
     546            Rectangle headerArea = new Rectangle()
     547            {
     548                X = e.MarginBounds.X,
     549                Y = e.PageBounds.Y,
     550                Height = e.MarginBounds.Y - e.PageBounds.Y,
     551                Width = e.MarginBounds.Width
     552            };
     553            Rectangle footerArea = new Rectangle()
     554            {
     555                X = e.MarginBounds.X,
     556                Y = e.MarginBounds.Height + headerArea.Height,
     557                Width = e.MarginBounds.Width,
     558                Height = pageArea.Height - (e.MarginBounds.Height + headerArea.Height)
     559            };
     560
     561            const int part1Height = 400;
     562            string s;
     563
     564            // A few fonts
     565            Font fTitle = new Font(FontFamily.GenericSerif, 24, FontStyle.Bold); //for title
     566            Font fBody = new Font(FontFamily.GenericSerif, 12);
     567            Font fGroupTitle = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
     568
     569            StringFormat sf0 = new StringFormat()
     570            {
     571                Alignment = StringAlignment.Center,
     572                LineAlignment = StringAlignment.Center
     573            };
     574
     575            // Draw Header
     576            string division = CGDocumentManager.Current.ConnectInfo.DivisionName;
     577            g.DrawString(division, fBody, Brushes.Black, headerArea, sf0);
     578
     579            // Draw Title
    516580            StringFormat sf = new StringFormat();
    517             sf.Alignment = StringAlignment.Center; //for title
    518             Font fTitle = new Font(FontFamily.GenericSerif, 24, FontStyle.Bold); //for title
    519             Font fBody = new Font(FontFamily.GenericSerif, 18);
    520             Font fBodyEm = new Font(FontFamily.GenericSerif, 18, FontStyle.Bold);
     581            sf.Alignment = StringAlignment.Center; //for title & header
     582            string title = "Routing Slip";
    521583            g.DrawString(title, fTitle, Brushes.Black, printArea, sf); //title
    522584
     
    528590            // draw underline
    529591            g.DrawLine(Pens.Black, printArea.Location, new Point(printArea.Right, printArea.Y));
    530 
    531             // move down
    532592            printArea.Y += 15;
    533593            printArea.Height -= 15;
    534594
    535             //construct what to print
    536             string toprint = "Patient: " + a.PatientName + "\t" + "ID: " + a.HealthRecordNumber;
    537             toprint += "\n\n";
    538             toprint += "Clinic: " + a.Resource;
    539             toprint += "\n\n";
    540             toprint += "Appointment Time: " + a.StartTime;
    541             toprint += "\n\n";
    542             toprint += "Notes:\n" + a.Note;
    543 
    544             //print
    545             g.DrawString(toprint, fBody, Brushes.Black, printArea);
    546 
    547             // Print Date Printed
    548             //sf to move to bottom center
    549             StringFormat sf2 = new StringFormat();
    550             sf2.LineAlignment = StringAlignment.Far;
    551             sf2.Alignment = StringAlignment.Center;
    552 
    553             //Print
    554             Font fFooter = new Font(FontFamily.GenericSerif, 8);
    555             g.DrawString("Printed: " + DateTime.Now, fFooter, Brushes.Black, printArea, sf2);
     595            // draw curved rectangle.
     596            Rectangle personalInfoRectangle = new Rectangle(e.MarginBounds.X, printArea.Y + 30, 280, part1Height);
     597            using (GraphicsPath path = GetRoundedRectPath(personalInfoRectangle, 10))
     598            {
     599                g.DrawPath(Pens.Black, path);
     600            }
     601
     602            // group header
     603            g.DrawString("Patient Information", fGroupTitle, Brushes.Black, new Point(personalInfoRectangle.X, personalInfoRectangle.Y - 20));
     604
     605            // inner rectangle for drawing strings:
     606            Rectangle personalInfoInnerRectangle = new Rectangle(personalInfoRectangle.X + 20, personalInfoRectangle.Y + 20, personalInfoRectangle.Width - 40, personalInfoRectangle.Height - 40);
     607
     608            // Strings to write
     609            StringBuilder sb = new StringBuilder(500);
     610            sb.AppendLine("Name:" + "\t" + appt.Patient.Name);
     611            sb.AppendLine();
     612            sb.AppendLine("ID#:" + "\t" + appt.Patient.ID);
     613            sb.AppendLine();
     614            sb.AppendLine("DOB:" + "\t" + appt.Patient.DOB.ToShortDateString());
     615            sb.AppendLine();
     616            sb.AppendLine("Age:" + "\t" + appt.Patient.UserFriendlyAge);
     617            sb.AppendLine();
     618            sb.AppendLine("Sex:" + "\t" + appt.Patient.Sex.ToString());
     619
     620            // Draw them
     621            g.DrawString(sb.ToString(), fBody, Brushes.Black, personalInfoInnerRectangle);
     622
     623            // draw curved rectangle
     624            Rectangle apptInfoRectangle = new Rectangle(e.MarginBounds.X + e.MarginBounds.Width - 280, printArea.Y + 30, 280, part1Height);
     625            using (GraphicsPath path = GetRoundedRectPath(apptInfoRectangle, 10))
     626            {
     627                g.DrawPath(Pens.Black, path);
     628            }
     629
     630            // group header
     631            g.DrawString("Appointment Information", fGroupTitle, Brushes.Black, new Point(apptInfoRectangle.X, apptInfoRectangle.Y - 20));
     632
     633            // Strings to write
     634            sb = new StringBuilder();
     635            sb.AppendLine("Clinic:");
     636            sb.AppendLine(appt.Resource);
     637            sb.AppendLine();
     638            sb.AppendLine("Appointment Provider:");
     639            sb.AppendLine((appt.Provider == null) ? "(none)" : appt.Provider.ToString());  //Appt Provider or (none) if null
     640            sb.AppendLine();
     641            sb.AppendLine("Patient Order:" + "\t" + apptOrder);
     642            sb.AppendLine("Date: " + "\t" + appt.StartTime.ToShortDateString() + " " + appt.StartTime.ToShortTimeString());
     643            sb.AppendLine();
     644            sb.AppendLine("Appointment Note: ");
     645            sb.AppendLine(String.IsNullOrWhiteSpace(appt.Note)? "(none)" : appt.Note);
     646
     647            // Draw them
     648            Rectangle apptInfoInnerRectangle = new Rectangle(apptInfoRectangle.X + 20, apptInfoRectangle.Y + 20, apptInfoRectangle.Width - 40, apptInfoRectangle.Height - 40);
     649
     650            // Draw them
     651            g.DrawString(sb.ToString(), fBody, Brushes.Black, apptInfoInnerRectangle);
     652
     653            // Move Drawing Rectangle Down
     654            printArea.Y += apptInfoRectangle.Height + 30 + 20;
     655            printArea.Height -= apptInfoRectangle.Height + 30 + 20;
     656
     657            // Draw New Line
     658            using (Pen dashpen = new Pen(Color.Black))
     659            {
     660                dashpen.DashStyle = DashStyle.Dash;
     661                g.DrawLine(dashpen, printArea.Location, new Point(printArea.Right, printArea.Y));
     662            }
     663
     664            printArea.Y += 5;
     665            printArea.Height -= 5;
     666
     667            s = "Scratch Area";
     668            g.DrawString(s, fGroupTitle, Brushes.Black, printArea);
     669
     670            // move down
     671            printArea.Y += 300;
     672            printArea.Height -= 300;
     673
     674            //TODO: Put Next Appointment Area
     675            using (Pen dashpen = new Pen(Color.Black))
     676            {
     677                dashpen.DashStyle = DashStyle.Dot;
     678                g.DrawLine(dashpen, printArea.Location, new Point(printArea.Right, printArea.Y));
     679            }
     680
     681            printArea.Y += 5;
     682            printArea.Height -= 5;
     683
     684            s = "Next Appointment Instructions";
     685            g.DrawString(s, fGroupTitle, Brushes.Black, printArea);
     686
     687            // Draw Footer
     688            //use sf0 to print the footer (center all the way)
     689            s = "Printed: " + DateTime.Now.ToString();
     690            Font fFooter = new Font(FontFamily.GenericSerif, 7);
     691            g.DrawString(s, fFooter, Brushes.Black, footerArea, sf0);
     692
     693            g.Dispose();
     694
    556695        }
    557696
Note: See TracChangeset for help on using the changeset viewer.