Added RevDate and ReviewDate properties to DlgPrintProcedure class
Set visibility of RevDate label and textbox based on whether one or more procedures are being printed Set visibility of ReviewDate label and textbox based on whether one or more procedures are being printed Added UnitNumber and UnitIndex properties to DlgPrintProcedure class Set property DocVersionConfig to DocVersionConfig of procedure to be printed If ProcNum is blank use UnitNumber as pdf file name If ProcNum starts with *, replace * with UnitNumber Added required opening brace Set RevDate property to ProcedureConfig Print_RevDate property value Set ReviewDate property to ProcedureConfig Print_ReviewDate property value Added required opening brace Set RevDate property to current date if ProcedureConfig is null Set ReviewDate property to null if ProcedureConfig is null Set visibility of ReviewDate label and textbox based on AllProcedures property and hasReviewDate variable Added SelectedSlave property to DlgPrintProcedure class Set MultiUnitPdfLocation to empty string Control creating multiple pdfs for a selected unit Load item and children for procedure to be printed for selected unit Overlay PDF creation status form so that cancel button is covered Code to create PDFs when single unit site Call Application.DoEvents so that screen refreshes Added private method GetMultiUnitPDFPath to DlgPrintProcedure class If creating PDF for one procedure for selected unit, load item and children Removed no longer required closing brace Set MultiUnitPDFLocation Added event handler for cursor entering RevDate textbox Added event handler for cursor leaving RevDate textbox Added event handler for cursor leaving ReviewDate textbox Added event handler for cursor entering ReviewDate textbox Added event handler for selecting date from DateSelector calendar
This commit is contained in:
parent
35da7c4274
commit
70200025dd
@ -46,6 +46,16 @@ namespace VEPROMS
|
||||
get { return txbPDFLocation.Text; }
|
||||
set { txbPDFLocation.Text = value; }
|
||||
}
|
||||
public string RevDate
|
||||
{
|
||||
get { return txbRevDate.Text; }
|
||||
set { txbRevDate.Text = value; }
|
||||
}
|
||||
public string ReviewDate
|
||||
{
|
||||
get { return txbReviewDate.Text; }
|
||||
set { txbReviewDate.Text = value; }
|
||||
}
|
||||
public string PDFPathSetting
|
||||
{
|
||||
get { return txbPdfLocationS.Text; }
|
||||
@ -83,17 +93,31 @@ namespace VEPROMS
|
||||
{
|
||||
txbPDFName.Visible = lblPDFFileName.Visible = oneProcedure;
|
||||
txbRevNum.Visible = lblRevNum.Visible = oneProcedure;
|
||||
txbReviewDate.Visible = lblReviewDate.Visible = oneProcedure;
|
||||
txbRevDate.Visible = lblRevDate.Visible = oneProcedure;
|
||||
cbxOpenAfterCreate2.Visible = oneProcedure;
|
||||
cbxOpenAfterCreate2.Checked = false;
|
||||
cbxOverwritePDF2.Visible = oneProcedure;
|
||||
cbxOverwritePDF2.Checked = true;
|
||||
gpnlDebug.Visible = Volian.Base.Library.VlnSettings.DebugMode;
|
||||
}
|
||||
public DlgPrintProcedure(ProcedureInfo pi)
|
||||
private string _UnitNumber;
|
||||
public string UnitNumber
|
||||
{
|
||||
get { return _UnitNumber; }
|
||||
set { _UnitNumber = value; }
|
||||
}
|
||||
private int _UnitIndex;
|
||||
public int UnitIndex
|
||||
{
|
||||
get { return _UnitIndex; }
|
||||
set { _UnitIndex = value; }
|
||||
}
|
||||
public DlgPrintProcedure(ProcedureInfo pi)
|
||||
{
|
||||
InitializeComponent();
|
||||
_AllProcedures = false;
|
||||
_DocVersionConfig = (pi.ActiveParent as DocVersionInfo).DocVersionConfig;
|
||||
_DocVersionConfig = pi.MyDocVersion.DocVersionConfig;
|
||||
_MyProcedure = pi;
|
||||
btnCreatePDF.Text = "Create PDF";
|
||||
HandleDocVersionSettings();
|
||||
@ -222,12 +246,25 @@ namespace VEPROMS
|
||||
//cbxPDF.Text = string.Format(@"{0}\{1}.pdf", _PDFPath, _ProcNum);
|
||||
// General 2 settings
|
||||
//txbPDFLocation.Text = _PDFPath;
|
||||
txbPDFName.Text = string.Format("{0}.pdf", ProcNum.Replace('/', '_').Replace('\\', '_'));
|
||||
if (ProcNum == string.Empty)
|
||||
txbPDFName.Text = this.UnitNumber + ".pdf";
|
||||
else
|
||||
txbPDFName.Text = string.Format("{0}.pdf", ProcNum.Replace('/', '_').Replace('\\', '_'));
|
||||
if (txbPDFName.Text.StartsWith("*"))
|
||||
txbPDFName.Text = txbPDFName.Text.Replace("*", this.UnitNumber);
|
||||
ProcedureConfig pc = _MyProcedure.MyConfig as ProcedureConfig;
|
||||
if (pc != null)
|
||||
{
|
||||
RevNum = pc.Print_Rev;
|
||||
RevDate = pc.Print_RevDate; //== null || pc.Print_RevDate=="" ? DateTime.Today : Convert.ToDateTime(pc.Print_RevDate);
|
||||
ReviewDate = pc.Print_ReviewDate; // == null ? DateTime.Today : Convert.ToDateTime(pc.Print_ReviewDate);
|
||||
}
|
||||
else
|
||||
{
|
||||
RevNum = "0";
|
||||
RevDate = DateTime.Today.ToShortDateString();
|
||||
ReviewDate = null;
|
||||
}
|
||||
cbxWaterMark.DataSource = EnumDetail<PrintWatermark>.Details();
|
||||
cbxWaterMark.DisplayMember = "Description";
|
||||
cbxWaterMark.ValueMember = "EValue";
|
||||
@ -253,6 +290,7 @@ namespace VEPROMS
|
||||
foreach (SectionInfo mysection in _MyProcedure.Sections)
|
||||
hasReviewDate |= mysection.ActiveFormat.PlantFormat.HasPageListToken("{REVIEWDATE}");
|
||||
}
|
||||
lblReviewDate.Visible = txbReviewDate.Visible = !_AllProcedures && hasReviewDate;
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
@ -368,6 +406,18 @@ namespace VEPROMS
|
||||
get { return _MyProcedure; }
|
||||
set { _MyProcedure = value; }
|
||||
}
|
||||
private int _SelectedSlave = 0;
|
||||
public int SelectedSlave
|
||||
{
|
||||
get { return _SelectedSlave; }
|
||||
set
|
||||
{
|
||||
_SelectedSlave = value;
|
||||
lblMultiunitPdfLocation.Visible = cbxMultiunitPdfLocation.Visible = (value > -1);
|
||||
cbxMultiunitPdfLocation.SelectedIndex = 1;
|
||||
}
|
||||
}
|
||||
private string _MultiunitPdfLocation = string.Empty;
|
||||
private void CreatePDFs()
|
||||
{
|
||||
CreateDebugFiles();
|
||||
@ -388,15 +438,55 @@ namespace VEPROMS
|
||||
MyProcedure = myProc;
|
||||
if (myProc.Sections != null)
|
||||
{
|
||||
SetupForProcedure();
|
||||
pbPDFsStatus.TextVisible = true;
|
||||
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
pbPDFsStatus.Value = i;
|
||||
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
|
||||
using (ProcedureInfo pi = ProcedureInfo.GetItemAndChildren(myProc.ItemID))
|
||||
if (SelectedSlave > 0)
|
||||
{
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(pi, RevNum, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50));
|
||||
MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = SelectedSlave;
|
||||
SetupForProcedure();
|
||||
pbPDFsStatus.TextVisible = true;
|
||||
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
pbPDFsStatus.Value = i;
|
||||
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
|
||||
GetMultiunitPDFPath();
|
||||
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNum,pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left,Bottom-50));
|
||||
frmStatus.CloseWhenDone = true;
|
||||
Application.DoEvents();
|
||||
frmStatus.CancelStop = true;
|
||||
frmStatus.ShowDialog();
|
||||
if (frmStatus.CancelPrinting) break;
|
||||
}
|
||||
else if (SelectedSlave == 0)
|
||||
{
|
||||
for (int k = 1; k <= MyProcedure.MyDocVersion.MultiUnitCount; k++)
|
||||
{
|
||||
MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = k;
|
||||
SetupForProcedure();
|
||||
pbPDFsStatus.TextVisible = true;
|
||||
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
pbPDFsStatus.Value = i;
|
||||
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
|
||||
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNum, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left,Bottom-50));
|
||||
frmStatus.CloseWhenDone = true;
|
||||
Application.DoEvents();
|
||||
frmStatus.CancelStop = true;
|
||||
frmStatus.ShowDialog();
|
||||
if (frmStatus.CancelPrinting) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetupForProcedure();
|
||||
pbPDFsStatus.TextVisible = true;
|
||||
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
pbPDFsStatus.Value = i;
|
||||
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNum, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left,Bottom-50));
|
||||
frmStatus.CloseWhenDone = true;
|
||||
Application.DoEvents();
|
||||
frmStatus.CancelStop = true;
|
||||
frmStatus.ShowDialog();
|
||||
if (frmStatus.CancelPrinting) break;
|
||||
@ -407,6 +497,24 @@ namespace VEPROMS
|
||||
if(!Automatic)
|
||||
ShowDebugFiles();
|
||||
}
|
||||
|
||||
private string GetMultiunitPDFPath()
|
||||
{
|
||||
string newPDFPath = string.Empty;
|
||||
if (_MultiunitPdfLocation == "None")
|
||||
newPDFPath = PDFPath;
|
||||
if (_MultiunitPdfLocation == "Unit Name")
|
||||
newPDFPath = PDFPath + @"\" + MyProcedure.MyDocVersion.DocVersionConfig.Unit_Name;
|
||||
if (_MultiunitPdfLocation == "Unit Number")
|
||||
newPDFPath = PDFPath + @"\" + MyProcedure.MyDocVersion.DocVersionConfig.Unit_Number;
|
||||
if (_MultiunitPdfLocation == "Unit Text")
|
||||
newPDFPath = PDFPath + @"\" + MyProcedure.MyDocVersion.DocVersionConfig.Unit_Text;
|
||||
if (_MultiunitPdfLocation == "Unit ID")
|
||||
newPDFPath = PDFPath + @"\" + MyProcedure.MyDocVersion.DocVersionConfig.Unit_ID;
|
||||
if (!Directory.Exists(newPDFPath))
|
||||
Directory.CreateDirectory(newPDFPath);
|
||||
return newPDFPath;
|
||||
}
|
||||
private void CreateDebugFiles()
|
||||
{
|
||||
if (cbxDebugPagination.Checked)
|
||||
@ -431,12 +539,11 @@ namespace VEPROMS
|
||||
// Determine change bar settings. First get from config & then see if override from dialog.
|
||||
// Also check that format allows override.
|
||||
ChangeBarDefinition cbd = DetermineChangeBarSettings();
|
||||
if (MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave > 0)
|
||||
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
|
||||
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
|
||||
using (ProcedureInfo pi = ProcedureInfo.GetItemAndChildren(MyProcedure.ItemID))
|
||||
{
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(pi, RevNum, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50));
|
||||
frmStatus.ShowDialog();
|
||||
}
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNum, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50));
|
||||
frmStatus.ShowDialog();
|
||||
this.Close();
|
||||
ShowDebugFiles();
|
||||
}
|
||||
@ -496,6 +603,7 @@ namespace VEPROMS
|
||||
if (_AllProcedures)
|
||||
{
|
||||
DateTime dtStart = DateTime.Now;
|
||||
_MultiunitPdfLocation = cbxMultiunitPdfLocation.SelectedItem.ToString();
|
||||
CreatePDFs();
|
||||
if (VlnSettings.DebugMode)
|
||||
{
|
||||
@ -567,6 +675,62 @@ namespace VEPROMS
|
||||
if (_Initializing) return;
|
||||
ppGpbxUserSpecTxt.Enabled = ppCmbxChgBarTxtType.SelectedIndex == (int)PrintChangeBarText.UserDef;
|
||||
}
|
||||
private void txbRevDate_Enter(object sender, EventArgs e)
|
||||
{
|
||||
txbDate = txbRevDate;
|
||||
grpDateSelector.Text = "Select Revision Date";
|
||||
grpDateSelector.Visible = calDateSelector.Visible = true;
|
||||
|
||||
}
|
||||
|
||||
private void txbRevDate_Leave(object sender, EventArgs e)
|
||||
{
|
||||
if (_Initializing) return;
|
||||
txbDate = null;
|
||||
grpDateSelector.Visible = calDateSelector.Visible = false;
|
||||
// save the RevDate to the procedure's config.
|
||||
ProcedureConfig pc = MyProcedure.MyConfig as ProcedureConfig;
|
||||
if (pc == null) return;
|
||||
pc.Print_RevDate = txbRevDate.Text;
|
||||
using (Item itm = Item.Get(MyProcedure.ItemID))
|
||||
{
|
||||
itm.MyContent.Config = MyProcedure.MyConfig.ToString();
|
||||
itm.Save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void txbReviewDate_Leave(object sender, EventArgs e)
|
||||
{
|
||||
if (_Initializing) return;
|
||||
txbDate = null;
|
||||
grpDateSelector.Visible = calDateSelector.Visible = false;
|
||||
// save the ReviewDate to the procedure's config.
|
||||
ProcedureConfig pc = MyProcedure.MyConfig as ProcedureConfig;
|
||||
if (pc == null) return;
|
||||
pc.Print_ReviewDate = txbReviewDate.Text;
|
||||
using (Item itm = Item.Get(MyProcedure.ItemID))
|
||||
{
|
||||
itm.MyContent.Config = MyProcedure.MyConfig.ToString();
|
||||
itm.Save();
|
||||
// need to reset config to !dirty?
|
||||
}
|
||||
|
||||
}
|
||||
private void txbReviewDate_Enter(object sender, EventArgs e)
|
||||
{
|
||||
txbDate = txbReviewDate;
|
||||
grpDateSelector.Text = "Select Review Date";
|
||||
grpDateSelector.Visible = calDateSelector.Visible = true;
|
||||
}
|
||||
|
||||
private TextBox txbDate = null;
|
||||
private void calDateSelector_DateSelected(object sender, DateRangeEventArgs e)
|
||||
{
|
||||
if (txbDate != null)
|
||||
txbDate.Text = e.Start.ToShortDateString();
|
||||
}
|
||||
|
||||
private void txbRevNum_Leave(object sender, EventArgs e)
|
||||
{
|
||||
if (_Initializing) return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user