Changeset 1131 for Scheduling/trunk/cs/bsdx0200GUISourceCode/Printing.cs
- Timestamp:
- Apr 4, 2011, 6:11:50 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/cs/bsdx0200GUISourceCode/Printing.cs
r1126 r1131 136 136 apptPrinting++; 137 137 } 138 139 140 g.Dispose(); 138 141 } 139 142 … … 164 167 }; 165 168 169 string s; 166 170 167 171 // A few fonts … … 170 174 Font fGroupTitle = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold); 171 175 172 StringFormat sf 0= new StringFormat()176 StringFormat sfCenterCenter = new StringFormat() 173 177 { 174 178 Alignment = StringAlignment.Center, … … 178 182 // Draw Header 179 183 string division = CGDocumentManager.Current.ConnectInfo.DivisionName; 180 g.DrawString(division, fBody, Brushes.Black, headerArea, sf0); 181 184 g.DrawString(division, fBody, Brushes.Black, headerArea, sfCenterCenter); 185 186 const int watermarkLength = 75; 187 188 // Move down for optional form paper 189 printArea.Y += watermarkLength; 190 printArea.Height -= watermarkLength; 191 182 192 // Draw Title 183 StringFormat sf = new StringFormat();184 sf .Alignment = StringAlignment.Center; //for title & header193 StringFormat sfCenter = new StringFormat(); 194 sfCenter.Alignment = StringAlignment.Center; //for title & header 185 195 186 196 //string s = "Appointment Reminder Slip"; 187 s tring s= strings.ApptReminderSlip;188 g.DrawString(s, fTitle, Brushes.Black, printArea, sf ); //title197 s = strings.ApptReminderSlip; 198 g.DrawString(s, fTitle, Brushes.Black, printArea, sfCenter); //title 189 199 190 200 // move down … … 270 280 // Draw new Title 271 281 s = strings.ClinicInstructions; 272 g.DrawString(s, fTitle, Brushes.Black, printArea, sf ); //title282 g.DrawString(s, fTitle, Brushes.Black, printArea, sfCenter); //title 273 283 274 284 // move down … … 303 313 304 314 s = strings.Notes; 305 g.DrawString(s, fTitle, Brushes.Black, printArea, sf ); // Notes title315 g.DrawString(s, fTitle, Brushes.Black, printArea, sfCenter); // Notes title 306 316 307 317 // move down … … 324 334 s = strings.Printed + ": " + DateTime.Now.ToString(); 325 335 Font fFooter = new Font(FontFamily.GenericSerif, 7); 326 g.DrawString(s, fFooter, Brushes.Black, footerArea, sf0); 327 336 g.DrawString(s, fFooter, Brushes.Black, footerArea, sfCenterCenter); 337 338 g.Dispose(); 328 339 } 329 340 … … 404 415 address.AppendLine(ptRow.CITY + ", " + ptRow.STATE + " " + ptRow.ZIP); 405 416 g.DrawString(address.ToString(), fBody, Brushes.Black, printArea, sf); 417 418 g.Dispose(); 406 419 } 407 420 … … 460 473 address.AppendLine(ptRow.CITY + ", " + ptRow.STATE + " " + ptRow.ZIP); 461 474 g.DrawString(address.ToString(), fBody, Brushes.Black, printArea, sf); 475 476 g.Dispose(); 462 477 } 463 478 … … 518 533 g.DrawString(address.ToString(), fBody, Brushes.Black, printArea, sf); 519 534 535 g.Dispose(); 520 536 } 521 537 … … 530 546 e.Graphics.DrawString(msg, new Font(FontFamily.GenericSerif, 14), 531 547 Brushes.Black, e.MarginBounds); 548 e.Graphics.Dispose(); 532 549 } 533 550 … … 577 594 g.DrawString(division, fBody, Brushes.Black, headerArea, sf0); 578 595 596 const int watermarkLength = 75; 597 598 // Move down for optional form paper 599 printArea.Y += watermarkLength; 600 printArea.Height -= watermarkLength; 601 579 602 // Draw Title 580 603 StringFormat sf = new StringFormat(); 581 604 sf.Alignment = StringAlignment.Center; //for title & header 582 string title = "Routing Slip";605 string title = strings.RoutingSlip; 583 606 g.DrawString(title, fTitle, Brushes.Black, printArea, sf); //title 584 607 … … 601 624 602 625 // group header 603 g.DrawString("Patient Information", fGroupTitle, Brushes.Black, new Point(personalInfoRectangle.X, personalInfoRectangle.Y - 20)); 626 s = strings.PtInfo; 627 StringFormat sf3 = new StringFormat(System.Threading.Thread.CurrentThread.CurrentUICulture.TextInfo.IsRightToLeft ? StringFormatFlags.DirectionRightToLeft : 0); 628 g.DrawString(s, fGroupTitle, Brushes.Black, new Rectangle(personalInfoRectangle.X, personalInfoRectangle.Y - 20, personalInfoRectangle.Width, 20), sf3); 629 630 StringFormat sf4 = new StringFormat(System.Threading.Thread.CurrentThread.CurrentUICulture.TextInfo.IsRightToLeft ? StringFormatFlags.DirectionRightToLeft : 0); 631 sf4.SetTabStops(0, new float[] { 75 }); 632 sf4.SetDigitSubstitution(System.Threading.Thread.CurrentThread.CurrentUICulture.LCID, StringDigitSubstitute.Traditional); 604 633 605 634 // inner rectangle for drawing strings: … … 608 637 // Strings to write 609 638 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);639 sb.AppendLine(strings.Name + ":" + "\t" + appt.Patient.Name); 640 sb.AppendLine(); 641 sb.AppendLine(strings.ID + ":" + "\t" + appt.Patient.ID); 642 sb.AppendLine(); 643 sb.AppendLine(strings.DOB + ":" + "\t" + appt.Patient.DOB.ToShortDateString()); 644 sb.AppendLine(); 645 sb.AppendLine(strings.Age + ":" + "\t" + appt.Patient.UserFriendlyAge); 617 646 //sb.AppendLine(); 618 647 //sb.AppendLine("Sex:" + "\t" + appt.Patient.Sex.ToString()); 619 648 620 649 // Draw them 621 g.DrawString(sb.ToString(), fBody, Brushes.Black, personalInfoInnerRectangle );650 g.DrawString(sb.ToString(), fBody, Brushes.Black, personalInfoInnerRectangle, sf4); 622 651 623 652 // draw curved rectangle … … 629 658 630 659 // group header 631 g.DrawString("Appointment Information", fGroupTitle, Brushes.Black, new Point(apptInfoRectangle.X, apptInfoRectangle.Y - 20)); 660 s = strings.ApptInfo; 661 g.DrawString(s, fGroupTitle, Brushes.Black, new Rectangle(apptInfoRectangle.X, apptInfoRectangle.Y - 20, apptInfoRectangle.Width, 20), sf3); 632 662 633 663 // Strings to write 634 664 sb = new StringBuilder(); 635 sb.AppendLine( "Clinic:");665 sb.AppendLine(strings.Clinic + ":"); 636 666 sb.AppendLine(appt.Resource); 637 667 sb.AppendLine(); 638 sb.AppendLine( "Appointment Provider:");639 sb.AppendLine((appt.Provider == null) ? "(none)": appt.Provider.ToString()); //Appt Provider or (none) if null640 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);668 sb.AppendLine(strings.AppointmentProvider + ":"); 669 sb.AppendLine((appt.Provider == null) ? strings.none : appt.Provider.ToString()); //Appt Provider or (none) if null 670 sb.AppendLine(); 671 sb.AppendLine(strings.PatientOrder + ":" + "\t" + apptOrder); 672 sb.AppendLine(strings.Date + ":" + "\t" + appt.StartTime.ToShortDateString() + " " + appt.StartTime.ToShortTimeString()); 673 sb.AppendLine(); 674 sb.AppendLine(strings.AppointmentNote + ":"); 675 sb.AppendLine(String.IsNullOrWhiteSpace(appt.Note)? strings.none : appt.Note); 646 676 647 677 // Draw them … … 649 679 650 680 // Draw them 651 g.DrawString(sb.ToString(), fBody, Brushes.Black, apptInfoInnerRectangle );681 g.DrawString(sb.ToString(), fBody, Brushes.Black, apptInfoInnerRectangle, sf4); 652 682 653 683 // Move Drawing Rectangle Down … … 665 695 printArea.Height -= 5; 666 696 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 697 s = strings.ScratchArea; 698 g.DrawString(s, fGroupTitle, Brushes.Black, printArea, sf3); 699 700 // move down 701 printArea.Y += 240; 702 printArea.Height -= 240; 703 675 704 using (Pen dashpen = new Pen(Color.Black)) 676 705 { … … 682 711 printArea.Height -= 5; 683 712 684 s = "Next Appointment Instructions";685 g.DrawString(s, fGroupTitle, Brushes.Black, printArea );713 s = strings.NextAppointmentInstructions; 714 g.DrawString(s, fGroupTitle, Brushes.Black, printArea, sf3); 686 715 687 716 // Draw Footer 688 717 //use sf0 to print the footer (center all the way) 689 s = "Printed: " + DateTime.Now.ToString();718 s = strings.Printed + ": " + DateTime.Now.ToString(); 690 719 Font fFooter = new Font(FontFamily.GenericSerif, 7); 691 720 g.DrawString(s, fFooter, Brushes.Black, footerArea, sf0);
Note:
See TracChangeset
for help on using the changeset viewer.