source: Scheduling/trunk/cs/bsdx0200GUISourceCode/UCPatientAppts.cs@ 753

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

Reworked DAppointPage. Removed dependence of DPatientApptDisplay on Crystal Reports. Added UserControl UCPatientAppts to encapsulate functionality of DPatientApptDisplay; right now it does not include printing. DAppointPage now uses UCPatientAppts to provide functionality of seeing patient's previous appointments. DPatientApptDisplay does not yet, but will soon.

Exe is not included.

File size: 2.4 KB
Line 
1using System;
2using System.ComponentModel;
3using System.Drawing;
4using System.Data;
5using System.Text;
6using System.Windows.Forms;
7using IndianHealthService.BMXNet;
8
9namespace IndianHealthService.ClinicalScheduling
10{
11 /// <summary>
12 /// User Control that shows patient's appointments and allows printing
13 /// </summary>
14 public partial class UCPatientAppts : UserControl
15 {
16 DataTable dtAppt;
17 DataView dvAppt;
18 /// <summary>
19 /// Ctor
20 /// </summary>
21 /// <param name="docManager">Document Manager from main context</param>
22 /// <param name="nPatientID">Patient IEN</param>
23 public UCPatientAppts(CGDocumentManager docManager, int nPatientID)
24 {
25 InitializeComponent();
26 try
27 {
28 string sSql = "BSDX PATIENT APPT DISPLAY^" + nPatientID.ToString();
29 dtAppt = docManager.RPMSDataTable(sSql, "PatientAppts");
30 }
31 catch (Exception ex) { MessageBox.Show(ex.Message); }
32
33 dvAppt = new DataView(dtAppt);
34 dvAppt.Sort = "ApptDate ASC";
35 SetPastFilter(false);
36 dgAppts.DataSource = dvAppt;
37
38 }
39 /// <summary>
40 /// Sets the filter for the DataView on whether to show past appointments or not
41 /// </summary>
42 /// <param name="ShowPastAppts">boolean - self explanatory</param>
43 void SetPastFilter(bool ShowPastAppts)
44 {
45 if (ShowPastAppts) dvAppt.RowFilter = "";
46 else dvAppt.RowFilter = "ApptDate > " + "#" + DateTime.Today.ToShortDateString() + "#"; ;
47 }
48
49 private void chkPastAppts_CheckedChanged(object sender, EventArgs e)
50 {
51 if (chkPastAppts.Checked) SetPastFilter(true);
52 else SetPastFilter(false);
53 }
54
55 private void PrintPtAppts_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
56 {
57 Graphics g = e.Graphics;
58 using (Font font = new Font("Lucida Console", 72))
59 {
60 g.DrawString("Hello,\nPrinter", font, Brushes.Black, e.MarginBounds);
61 }
62 }
63
64 private void btnPrint_Click(object sender, EventArgs e)
65 {
66 DialogResult res = printDialog1.ShowDialog();
67 if (res == DialogResult.OK) this.printDialog1.Document.Print();
68 }
69
70 }
71}
Note: See TracBrowser for help on using the repository browser.