source: Scheduling/trunk/cs/bsdx0200GUISourceCode/Printing.cs@ 773

Last change on this file since 773 was 772, checked in by Sam Habiel, 14 years ago

Removal of Crystal Reports
Partial Rework of Clinic Patient List report
Other reports that used Crystal don't work yet.
Fixes for Strongly typed DataTables (change the RESOURCEID from uint to int) to support table merge from untyped table.
Support for command line arguments: /s= for server /p= for port /a= for access code /v= for verify code
Only the following combinations work: none; /s and /p; /s, /p, /a, /v

File size: 3.7 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Drawing.Printing;
6using System.Drawing;
7using System.Data;
8using System.Drawing.Drawing2D;
9
10namespace IndianHealthService.ClinicalScheduling
11{
12 /// <summary>
13 /// Class that encapsulates printing functions in Clinical Scheduling
14 /// </summary>
15 public static class Printing
16 {
17 /// <summary>
18 /// Print Appointments
19 /// </summary>
20 /// <param name="ds">Strongly Typed DataSet contains Resources and Appointments</param>
21 /// <param name="e">PrintPageEventArgs from PrintDocument Print handler</param>
22 /// <param name="beg">Begin Datetime to print appointments</param>
23 /// <param name="end">End Datetime to print appointments</param>
24 /// <remarks>beg and end have no effect on operation--they are there for documentation for user only</remarks>
25 public static void PrintAppointments(dsPatientApptDisplay2 ds, PrintPageEventArgs e, DateTime beg, DateTime end,
26 int resourceToPrint, ref int apptPrinted)
27 {
28 Graphics g = e.Graphics;
29 //g.PageUnit = GraphicsUnit.Millimeter;
30 //SizeF szVCB = g.VisibleClipBounds.Size;
31 //PointF[] ptszVCB = {new PointF(szVCB.Width,szVCB.Height)};
32 //g.TransformPoints(CoordinateSpace.Page, CoordinateSpace.Device, ptszVCB);
33 //Create Fonts
34 Font f8 = new Font(FontFamily.GenericSerif, 8);
35 Font f10 = new Font(FontFamily.GenericSerif, 10);
36 Font f14bold = new Font(FontFamily.GenericSerif, 14, FontStyle.Bold);
37
38 //Center Alignment for some stuff
39 StringFormat sf = new StringFormat();
40 sf.Alignment = StringAlignment.Center;
41
42 g.DrawString("Confidential Patient Information", f8, Brushes.Black, e.PageBounds, sf);
43
44 //Typical manipulable print area
45 Rectangle printArea = e.MarginBounds;
46
47 dsPatientApptDisplay2.BSDXResourceRow r = ds.BSDXResource[resourceToPrint];
48
49 string toprint;
50 if (beg == end) toprint = "Appointments for " + r.RESOURCE_NAME + " on " + beg.ToLongDateString();
51 else toprint = "Appointments for " + r.RESOURCE_NAME + " from " + beg.ToShortDateString() + " to "
52 + end.ToShortDateString();
53 g.DrawString(toprint, f14bold, Brushes.Black, printArea);
54
55 printArea.Y += (int)f14bold.GetHeight();
56 g.DrawLine(new Pen(Brushes.Black, 0), printArea.X, printArea.Y, printArea.X + printArea.Width, printArea.Y);
57 printArea.Y += 5;
58
59 System.Data.DataRow[] appts = r.GetChildRows(ds.Relations[0]); //only one relation
60
61 toprint = "";
62 StringFormat sf2 = new StringFormat();
63 sf2.SetTabStops(50, new float[] { 100, 200, 200 });
64
65 foreach (dsPatientApptDisplay2.PatientApptsRow a in appts)
66 {
67 toprint += a.ApptDate.ToString() + "\t" + a.Name +"(" + a.Sex + ")" + "\t" + "DOB: " + a.DOB.ToString("dd-MMM-yyyy") + "\t" + "ID: " + a.HRN;
68 toprint += "\n";
69 toprint += "Home Phone: " + a.HOMEPHONE + "\t" + "Address: " + a.STREET + ", " + a.CITY + ", " + a.STATE + " " + a.ZIP;
70 toprint += "\n";
71 toprint += "Note: " + a.NOTE;
72 toprint += "\n";
73 toprint += "Appointment made by " + a.APPT_MADE_BY + " on " + a.DATE_APPT_MADE;
74 toprint += "\n\n";
75 }
76 g.DrawString(toprint, f10, Brushes.Black, printArea, sf2);
77 }
78 }
79}
Note: See TracBrowser for help on using the repository browser.