This commit is contained in:
parent
44a92d52b4
commit
de1c6dd937
1013
PROMS/VEPROMS User Interface/DlgPrintProcedure.Designer.cs
generated
Normal file
1013
PROMS/VEPROMS User Interface/DlgPrintProcedure.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
336
PROMS/VEPROMS User Interface/DlgPrintProcedure.cs
Normal file
336
PROMS/VEPROMS User Interface/DlgPrintProcedure.cs
Normal file
@ -0,0 +1,336 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.IO;
|
||||||
|
using VEPROMS.CSLA.Library;
|
||||||
|
using Volian.Print.Library;
|
||||||
|
|
||||||
|
namespace VEPROMS
|
||||||
|
{
|
||||||
|
public partial class DlgPrintProcedure : DevComponents.DotNetBar.Office2007Form
|
||||||
|
{
|
||||||
|
private DocVersionConfig _DocVersionConfig;
|
||||||
|
private string _RevNum;
|
||||||
|
|
||||||
|
public string RevNum
|
||||||
|
{
|
||||||
|
get { return _RevNum; }
|
||||||
|
set { _RevNum = value; }
|
||||||
|
}
|
||||||
|
private string _ProcNum;
|
||||||
|
|
||||||
|
public string ProcNum
|
||||||
|
{
|
||||||
|
get { return _ProcNum; }
|
||||||
|
set { _ProcNum = value; }
|
||||||
|
}
|
||||||
|
private string _PDFPath;
|
||||||
|
|
||||||
|
public string PDFPath
|
||||||
|
{
|
||||||
|
get { return _PDFPath; }
|
||||||
|
set { _PDFPath = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private DateTime _RevDate = DateTime.Today;
|
||||||
|
|
||||||
|
public DateTime RevDate
|
||||||
|
{
|
||||||
|
get { return _RevDate; }
|
||||||
|
set { _RevDate = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private DateTime _ReviewDate = DateTime.Today;
|
||||||
|
|
||||||
|
public DateTime ReviewDate
|
||||||
|
{
|
||||||
|
get { return _ReviewDate; }
|
||||||
|
set { _ReviewDate = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public DlgPrintProcedure(ProcedureInfo pi)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_DocVersionConfig = (pi.ActiveParent as DocVersionInfo).DocVersionConfig; //docVersionConfig;
|
||||||
|
_ProcNum = pi.DisplayNumber;//procNum;
|
||||||
|
_RevNum = "0"; // need to get from procedure config?
|
||||||
|
_RevDate = DateTime.Today; // need to get from procedure config?
|
||||||
|
_ReviewDate = DateTime.Today; // need to get from procedure config?
|
||||||
|
_MyProcedure = pi;
|
||||||
|
|
||||||
|
GetDocVersionSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetDocVersionSettings()
|
||||||
|
{
|
||||||
|
_DocVersionConfig.SaveChangesToDocVersionConfig = false;
|
||||||
|
_DocVersionConfig.ParentLookup = false;
|
||||||
|
// PDF Location
|
||||||
|
_PDFPath = _DocVersionConfig.Print_PDFLocation;
|
||||||
|
txbPDFLocation.Text = _PDFPath;
|
||||||
|
// Overwrite PDF
|
||||||
|
cbxOverwritePDF2.Checked = _DocVersionConfig.Print_AlwaysOverwritePDF;
|
||||||
|
// Open PDF After Create
|
||||||
|
cbxOpenAfterCreate2.Checked = _DocVersionConfig.Print_AlwaysViewPDFAfterCreate;
|
||||||
|
// Changebars on/off
|
||||||
|
if (_DocVersionConfig.Print_ChangeBar == DocVersionConfig.PrintChangeBar.Without)
|
||||||
|
btnChgBarOff.PerformClick();
|
||||||
|
else
|
||||||
|
btnChgBarOn.PerformClick();
|
||||||
|
// Watermark on/off
|
||||||
|
if (_DocVersionConfig.Print_Watermark == DocVersionConfig.PrintWatermark.None)
|
||||||
|
btnWaterMarkOff.PerformClick();
|
||||||
|
else
|
||||||
|
btnWaterMarkOn.PerformClick();
|
||||||
|
// Auto Duplexing on/off
|
||||||
|
if (_DocVersionConfig.Print_DisableDuplex)
|
||||||
|
btnDuplxOff.PerformClick();
|
||||||
|
else
|
||||||
|
btnDuplxOn.PerformClick();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void DlgPrintProcedure_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
this.Text = "Create PDF for " + _ProcNum;
|
||||||
|
//dtRevDate.Value = _RevDate;
|
||||||
|
//dtReviewDate.Value = _ReviewDate;
|
||||||
|
//tbxRevNum.Text = _RevNum;
|
||||||
|
// get list of previous pdf files
|
||||||
|
// if no previous pdf file, then get path from frmVersionProperties
|
||||||
|
// dlgSelectFile.InitialDirectory = pdf path from frmVersionProperties
|
||||||
|
//cbxPDF.Text = string.Format(@"{0}\{1}.pdf", _PDFPath, _ProcNum);
|
||||||
|
// General 2 settings
|
||||||
|
txbPDFLocation.Text = _PDFPath;
|
||||||
|
tbxPDFName.Text = string.Format("{0}.pdf", _ProcNum);
|
||||||
|
txbRevNum.Text = _RevNum;
|
||||||
|
dtRevDate.Value = _RevDate;
|
||||||
|
dtReviewDate.Value = _ReviewDate;
|
||||||
|
// Advanced tab
|
||||||
|
//cbxPDFloc.Text = _PDFPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
//private void btnOpenFolder_Click(object sender, EventArgs e)
|
||||||
|
//{
|
||||||
|
// saveFileDialog1.InitialDirectory = _PDFPath;//@"C:\16bit\PromsDat\VEHLP";
|
||||||
|
// saveFileDialog1.FileName = string.Format(@"{0}\{1}.pdf", _PDFPath, _ProcNum);
|
||||||
|
// DialogResult drslt = saveFileDialog1.ShowDialog();
|
||||||
|
// if (drslt == DialogResult.OK)
|
||||||
|
// {
|
||||||
|
// cbxPDF.Text = saveFileDialog1.FileName; // contails full path
|
||||||
|
// UpdateDropDown();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//private void btnAutoDuplxOn_Click(object sender, EventArgs e)
|
||||||
|
//{
|
||||||
|
// if (!btnAutoDuplxOn.Checked)
|
||||||
|
// {
|
||||||
|
// btnAutoDuplxOn.Checked = true;
|
||||||
|
// btnAutoDuplxOff.Checked = false;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//private void btnAutoDuplxOff_Click(object sender, EventArgs e)
|
||||||
|
//{
|
||||||
|
// if (!btnAutoDuplxOff.Checked)
|
||||||
|
// {
|
||||||
|
// btnAutoDuplxOff.Checked = true;
|
||||||
|
// btnAutoDuplxOn.Checked = false;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
private void buttonX9_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DlgBrowseFolder.SelectedPath = _PDFPath;
|
||||||
|
DialogResult drslt = DlgBrowseFolder.ShowDialog();
|
||||||
|
if (drslt == DialogResult.OK)
|
||||||
|
{
|
||||||
|
//cbxPDFloc.Text = DlgBrowseFolder.SelectedPath;
|
||||||
|
txbPDFLocation.Text = DlgBrowseFolder.SelectedPath;
|
||||||
|
//lblCurPDFLoc.Text = cbxPDFloc.Text;
|
||||||
|
//UpdateDropDown2();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//private void UpdateDropDown2()
|
||||||
|
//{
|
||||||
|
// if (!cbxPDFloc.Text.Equals(string.Empty))
|
||||||
|
// {
|
||||||
|
// string tstr = cbxPDFloc.Text;
|
||||||
|
// // if its already exists in the list - remove it
|
||||||
|
// if (cbxPDFloc.Items.Contains(tstr))
|
||||||
|
// cbxPDFloc.Items.Remove(tstr);
|
||||||
|
// // Add the new criteria to the top of the list
|
||||||
|
// cbxPDFloc.Items.Insert(0, tstr);
|
||||||
|
// // set the text to the new criteria
|
||||||
|
// cbxPDFloc.Text = tstr;
|
||||||
|
// // If there are more than 10 remove the last one
|
||||||
|
// if (cbxPDFloc.Items.Count > 10)
|
||||||
|
// cbxPDFloc.Items.RemoveAt(10);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
private void btnAvChgBarOn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!btnChgBarOn.Checked)
|
||||||
|
{
|
||||||
|
btnChgBarOn.Checked = true;
|
||||||
|
btnChgBarOff.Checked = false;
|
||||||
|
tbChangeBars.Visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void btnAvChgBarOff_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!btnChgBarOff.Checked)
|
||||||
|
{
|
||||||
|
btnChgBarOff.Checked = true;
|
||||||
|
btnChgBarOn.Checked = false;
|
||||||
|
tbChangeBars.Visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnAdvDuplxOn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!btnDuplxOn.Checked)
|
||||||
|
{
|
||||||
|
btnDuplxOn.Checked = true;
|
||||||
|
btnDuplxOff.Checked = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnAdvDuplxOff_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!btnDuplxOff.Checked)
|
||||||
|
{
|
||||||
|
btnDuplxOff.Checked = true; ;
|
||||||
|
btnDuplxOn.Checked = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnAdvWaterMarkOn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!btnWaterMarkOn.Checked)
|
||||||
|
{
|
||||||
|
btnWaterMarkOn.Checked = true;
|
||||||
|
btnWaterMarkOff.Checked = false;
|
||||||
|
cbxWaterMark.Visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnAdvWaterMarkOff_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!btnWaterMarkOff.Checked)
|
||||||
|
{
|
||||||
|
btnWaterMarkOff.Checked = true;
|
||||||
|
btnWaterMarkOn.Checked = false;
|
||||||
|
cbxWaterMark.Visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void txbPDFLocation_Leave(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string curpdfloc = _PDFPath;
|
||||||
|
_PDFPath = txbPDFLocation.Text;
|
||||||
|
if (!Directory.Exists(_PDFPath))
|
||||||
|
{
|
||||||
|
string msg = string.Format("'{0}' does not exist. \n\nCreate it?", _PDFPath);
|
||||||
|
DialogResult dr= MessageBox.Show(msg, "Folder Not Found", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||||
|
if (dr == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(_PDFPath);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Error trying to create folder", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
_PDFPath = curpdfloc;
|
||||||
|
txbModPDFLoc.Text = _PDFPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DlgPrintProcedure_FormClosed(object sender, FormClosedEventArgs e)
|
||||||
|
{
|
||||||
|
_DocVersionConfig.SaveChangesToDocVersionConfig = true;
|
||||||
|
_DocVersionConfig.ParentLookup = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private ProcedureInfo _MyProcedure;
|
||||||
|
|
||||||
|
public ProcedureInfo MyProcedure
|
||||||
|
{
|
||||||
|
get { return _MyProcedure; }
|
||||||
|
set { _MyProcedure = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreatePDF()
|
||||||
|
{
|
||||||
|
Volian.Print.Library.Rtf2Pdf.PdfDebug = true;
|
||||||
|
//tbTimings.Text = "";
|
||||||
|
Cursor saveCursor = this.Cursor;
|
||||||
|
this.Cursor = Cursors.WaitCursor;
|
||||||
|
ProcedureConfig.PrintWatermark pw = MyProcedure.ProcedureConfig.Print_Watermark;
|
||||||
|
PromsPrinter pp = new PromsPrinter(MyProcedure, _RevNum, _RevDate.ToShortDateString(),pw.ToString(), true, @"C:\TEMP\16Bit");
|
||||||
|
//pp.StatusChanged += new PromsPrinterStatusEvent(pp_StatusChanged);
|
||||||
|
pp.StatusChanged += new PromsPrinterStatusEvent(pp_StatusChanged);
|
||||||
|
//_ElapsedTime = new Dictionary<PromsPrinterStatusType, TimeSpan>();
|
||||||
|
DateTime tStart = DateTime.Now;
|
||||||
|
string pdfFile = pp.Print(_PDFPath);
|
||||||
|
DateTime tEnd = DateTime.Now;
|
||||||
|
//_ElapsedTime.Add(PromsPrinterStatusType.Total, DateTime.Now - tStart);
|
||||||
|
MyStatus = pdfFile + " created.";
|
||||||
|
this.Cursor = saveCursor;
|
||||||
|
//ShowElapsedTime();
|
||||||
|
MyStatus = string.Format("{0} created in {1:0.} milliseconds", pdfFile, (TimeSpan.FromTicks(tEnd.Ticks - tStart.Ticks).TotalMilliseconds));
|
||||||
|
}
|
||||||
|
|
||||||
|
void pp_StatusChanged(object sender, PromsPrintStatusArgs args)
|
||||||
|
{
|
||||||
|
MyStatus = args.MyStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnCreatePDF_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
CreatePDF();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void txbRevNum_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
RevNum = txbRevNum.Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dtRevDate_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
RevDate = dtRevDate.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dtReviewDate_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ReviewDate = dtReviewDate.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string MyStatus
|
||||||
|
{
|
||||||
|
get { return lblStatus.Text;}
|
||||||
|
set { lblStatus.Text = value; Application.DoEvents(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
2053
PROMS/VEPROMS User Interface/DlgPrintProcedure.resx
Normal file
2053
PROMS/VEPROMS User Interface/DlgPrintProcedure.resx
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user