2009-11-30 03:53:28 -05:00
|
|
|
using System;
|
|
|
|
using System.Windows.Forms;
|
|
|
|
using System.Data;
|
2010-05-21 21:03:45 -04:00
|
|
|
using System.Drawing.Printing;
|
|
|
|
using System.Drawing;
|
2009-11-30 03:53:28 -05:00
|
|
|
|
|
|
|
namespace IndianHealthService.ClinicalScheduling
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Summary description for DPatientLetter.
|
|
|
|
/// </summary>
|
2010-05-21 21:03:45 -04:00
|
|
|
public class DPatientLetter : System.Windows.Forms.PrintPreviewDialog
|
|
|
|
{
|
2009-11-30 03:53:28 -05:00
|
|
|
/// <summary>
|
|
|
|
/// Required designer variable.
|
|
|
|
/// </summary>
|
2010-05-21 21:03:45 -04:00
|
|
|
private System.ComponentModel.Container components = null;
|
|
|
|
private System.Drawing.Printing.PrintDocument printDocument1;
|
2009-11-30 03:53:28 -05:00
|
|
|
|
|
|
|
#region Fields
|
2010-05-21 21:03:45 -04:00
|
|
|
DateTime _dtBegin, _dtEnd; //global fields to use in passing to printing method
|
|
|
|
int _currentResourcePrinting = 0;
|
|
|
|
int _currentApptPrinting = 0;
|
|
|
|
dsPatientApptDisplay2 _ds;
|
2009-11-30 03:53:28 -05:00
|
|
|
#endregion Fields
|
|
|
|
|
|
|
|
public void InitializeFormClinicSchedule(CGDocumentManager docManager,
|
|
|
|
string sClinicList,
|
|
|
|
DateTime dtBegin,
|
|
|
|
DateTime dtEnd)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (sClinicList == "")
|
|
|
|
{
|
|
|
|
throw new Exception("At least one clinic must be selected.");
|
|
|
|
}
|
2010-05-21 21:03:45 -04:00
|
|
|
_dtBegin = dtBegin;
|
|
|
|
_dtEnd = dtEnd;
|
2009-11-30 03:53:28 -05:00
|
|
|
string sBegin = dtBegin.ToShortDateString();
|
|
|
|
string sEnd = dtEnd.ToShortDateString();
|
|
|
|
this.Text="Clinic Schedules";
|
|
|
|
|
|
|
|
string sSql = "BSDX CLINIC LETTERS^" + sClinicList + "^" + sBegin + "^" + sEnd;
|
2010-05-21 21:03:45 -04:00
|
|
|
string sSql2 = "BSDX RESOURCE LETTERS^" + sClinicList;
|
2009-11-30 03:53:28 -05:00
|
|
|
|
2010-05-21 21:03:45 -04:00
|
|
|
_ds = new dsPatientApptDisplay2();
|
|
|
|
_ds.BSDXResource.Merge(docManager.RPMSDataTable(sSql2, "Resources"));
|
|
|
|
_ds.PatientAppts.Merge(docManager.RPMSDataTable(sSql, "PatientAppts"));
|
|
|
|
}
|
2009-11-30 03:53:28 -05:00
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
throw ex;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void InitializeFormRebookLetters(CGDocumentManager docManager,
|
|
|
|
string sClinicList,
|
|
|
|
DataTable dtLetters)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (sClinicList == "")
|
|
|
|
{
|
|
|
|
throw new Exception("At least one clinic must be selected.");
|
|
|
|
}
|
|
|
|
|
|
|
|
System.Data.DataSet ds = new System.Data.DataSet();
|
|
|
|
ds.Tables.Add(dtLetters.Copy());
|
|
|
|
|
|
|
|
string sSql = "BSDX RESOURCE LETTERS^" + sClinicList;
|
|
|
|
DataTable dt = docManager.RPMSDataTable(sSql, "Resources");
|
2010-05-21 21:03:45 -04:00
|
|
|
ds.Tables.Add(dt.Copy());
|
2009-11-30 03:53:28 -05:00
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
throw ex;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void InitializeFormCancellationLetters(CGDocumentManager docManager,
|
|
|
|
string sClinicList,
|
|
|
|
DataTable dtLetters)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (sClinicList == "")
|
|
|
|
{
|
|
|
|
throw new Exception("At least one clinic must be selected.");
|
|
|
|
}
|
|
|
|
|
|
|
|
System.Data.DataSet ds = new System.Data.DataSet();
|
|
|
|
ds.Tables.Add(dtLetters.Copy());
|
|
|
|
|
|
|
|
string sSql = "BSDX RESOURCE LETTERS^" + sClinicList;
|
|
|
|
DataTable dt = docManager.RPMSDataTable(sSql, "Resources");
|
|
|
|
ds.Tables.Add(dt.Copy());
|
|
|
|
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
throw ex;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void InitializeFormClinicLetters(CGDocumentManager docManager,
|
|
|
|
string sClinicList,
|
|
|
|
DateTime dtBegin,
|
|
|
|
DateTime dtEnd)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (sClinicList == "")
|
|
|
|
{
|
|
|
|
throw new Exception("At least one clinic must be selected.");
|
|
|
|
}
|
|
|
|
|
|
|
|
string sBegin = dtBegin.ToShortDateString();
|
|
|
|
string sEnd = dtEnd.ToShortDateString();
|
|
|
|
|
|
|
|
string sSql = "BSDX CLINIC LETTERS^" + sClinicList + "^" + sBegin + "^" + sEnd;
|
|
|
|
|
|
|
|
System.Data.DataSet ds = new System.Data.DataSet();
|
|
|
|
DataTable dtAppt = docManager.RPMSDataTable(sSql, "PatientAppts");
|
|
|
|
ds.Tables.Add(dtAppt.Copy());
|
|
|
|
|
|
|
|
sSql = "BSDX RESOURCE LETTERS^" + sClinicList;
|
|
|
|
DataTable dt = docManager.RPMSDataTable(sSql, "Resources");
|
|
|
|
ds.Tables.Add(dt.Copy());
|
|
|
|
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
throw ex;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public DPatientLetter()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
// Required for Windows Form Designer support
|
|
|
|
//
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
//
|
|
|
|
// TODO: Add any constructor code after InitializeComponent call
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Clean up any resources being used.
|
|
|
|
/// </summary>
|
|
|
|
protected override void Dispose( bool disposing )
|
|
|
|
{
|
|
|
|
if( disposing )
|
|
|
|
{
|
|
|
|
if(components != null)
|
|
|
|
{
|
|
|
|
components.Dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
base.Dispose( disposing );
|
|
|
|
}
|
|
|
|
|
|
|
|
#region Windows Form Designer generated code
|
|
|
|
/// <summary>
|
|
|
|
/// Required method for Designer support - do not modify
|
|
|
|
/// the contents of this method with the code editor.
|
|
|
|
/// </summary>
|
|
|
|
private void InitializeComponent()
|
|
|
|
{
|
2010-05-21 21:03:45 -04:00
|
|
|
this.printDocument1 = new System.Drawing.Printing.PrintDocument();
|
|
|
|
this.SuspendLayout();
|
|
|
|
//
|
|
|
|
// printDocument1
|
|
|
|
//
|
|
|
|
this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
|
|
|
|
//
|
|
|
|
// DPatientLetter
|
|
|
|
//
|
|
|
|
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
|
|
|
this.ClientSize = new System.Drawing.Size(648, 398);
|
|
|
|
this.Document = this.printDocument1;
|
|
|
|
this.Name = "DPatientLetter";
|
|
|
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
|
|
|
this.Text = "Patient Letter";
|
|
|
|
this.ResumeLayout(false);
|
2009-11-30 03:53:28 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
#endregion
|
2010-05-21 21:03:45 -04:00
|
|
|
|
|
|
|
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
|
|
|
|
{
|
|
|
|
// _currentResourcePrinting starts with zero. There will be at least this one.
|
|
|
|
ClinicalScheduling.Printing.PrintAppointments(_ds, e, _dtBegin, _dtEnd,
|
|
|
|
_currentResourcePrinting, ref _currentApptPrinting);
|
|
|
|
|
|
|
|
//If the printing routine says it needs more pages to print the appointments,
|
|
|
|
//return here and have it print again.
|
|
|
|
if (e.HasMorePages == true) return;
|
|
|
|
|
|
|
|
// if there are more resouces to print, increment. Setting HasMorePages to true
|
|
|
|
// calls this routine again, so printing will happen with the incremented _currentResourcePrinting
|
|
|
|
if (_currentResourcePrinting < _ds.BSDXResource.Rows.Count - 1)
|
|
|
|
{
|
|
|
|
_currentResourcePrinting++;
|
|
|
|
e.HasMorePages = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2009-11-30 03:53:28 -05:00
|
|
|
}
|
|
|
|
}
|