1 | using System;
|
---|
2 | using System.ComponentModel;
|
---|
3 | using System.Drawing;
|
---|
4 | using System.Data;
|
---|
5 | using System.Text;
|
---|
6 | using System.Windows.Forms;
|
---|
7 | using IndianHealthService.BMXNet;
|
---|
8 |
|
---|
9 | namespace 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 | }
|
---|