C2018-033 added a switch to turn on/off the date/time PDF prefix and suffix. It will be available only if a date/time prefix or suffix is set in the workingdraft property page. Logic also added to not use the date/time prefix or suffix if the user is generating Linked PDFs. B2018-137 added check for Placekeeper format flag when expanding the Additional Settings panel.
C2018-033 added a flag to turn off adding the date/time prefix and suffix when generating automatic baselines.
This commit is contained in:
@@ -49,6 +49,21 @@ namespace VEPROMS
|
||||
get { return _Automatic; }
|
||||
set { _Automatic = value; }
|
||||
}
|
||||
|
||||
// C2018-033 Used to turn off using the date/time PDF file prefix and suffix when doing batch file autmatic baseline print testing (frmVEPROMS.cs RunAutomatic())
|
||||
// This is needed so the the automatic baselines can compare results from different runs of PROMS
|
||||
private bool _AllowDateTimePrefixSuffix = true;
|
||||
public bool AllowDateTimePrefixSuffix
|
||||
{
|
||||
get { return _AllowDateTimePrefixSuffix; }
|
||||
set
|
||||
{
|
||||
_AllowDateTimePrefixSuffix = value;
|
||||
swtbtnPDFdtPrefixSuffix.Value = swtbtnPDFdtPrefixSuffix.Enabled = _AllowDateTimePrefixSuffix;
|
||||
}
|
||||
}
|
||||
private DateTime _PrefixSuffixDTS = DateTime.Now; // C2018-033 date/time used for the date/time PDF file prefix and suffix
|
||||
private bool _DateTimePrefixSuffixPrintingAllProcedures = true; // C2018-033 to control adding the Date/Time Prefix/Suffix to PFD name when printing All procedures
|
||||
private bool _IncludeWordSecTextInMetafile = true; // C2018-023 so that we can turn off including Word attachment text in metafile
|
||||
private void RunAutomatic()
|
||||
{
|
||||
@@ -61,13 +76,13 @@ namespace VEPROMS
|
||||
bool ranAuto = false;
|
||||
foreach (string parameter in parameters)
|
||||
{
|
||||
if (parameter.ToUpper() == "/NT")
|
||||
cbxDebugText.Checked = false;
|
||||
else if (parameter.ToUpper() == "/NP")
|
||||
cbxDebugPagination.Checked = false;
|
||||
else if (parameter.ToUpper() == "/NC")
|
||||
cbxDebug.Checked = false;
|
||||
else if (parameter.ToUpper() == "/NM")
|
||||
if (parameter.ToUpper() == "/NT")
|
||||
cbxDebugText.Checked = false;
|
||||
else if (parameter.ToUpper() == "/NP")
|
||||
cbxDebugPagination.Checked = false;
|
||||
else if (parameter.ToUpper() == "/NC")
|
||||
cbxDebug.Checked = false;
|
||||
else if (parameter.ToUpper() == "/NM")
|
||||
cbxMetaFile.Checked = false; // C2018-004 turn off create meta file for baseline compares
|
||||
else if (parameter.ToUpper() == "/NW")
|
||||
_IncludeWordSecTextInMetafile = false; // C2018-023 turn off putting Word attachment text in the meta file for baseline compares
|
||||
@@ -150,7 +165,8 @@ namespace VEPROMS
|
||||
Rtf2iTextSharp.DoingComparison = cbxDebug.Checked; // RHM20150506 Multiline ItemID TextBox
|
||||
// don't open all PDFs if doing All Procedures
|
||||
//cbxOpenAfterCreate2.Checked = dvi.DocVersionConfig.Print_AlwaysViewPDFAfterCreate;
|
||||
expPrnSetting.Expanded = swtbtnBlankPgsForDuplex.Value || swtbtnChgBar.Value || swtbtnGeneratePlacekeeper.Value || swtbtnPDFLinks.Value || swtbtnPROMSVersion.Value || swtbtnWaterMark.Value;
|
||||
// C2018-033 added the Prefix / Suffix switch to the expand Additional Settings check
|
||||
expPrnSetting.Expanded = swtbtnBlankPgsForDuplex.Value || swtbtnChgBar.Value || swtbtnGeneratePlacekeeper.Value || swtbtnPDFLinks.Value || swtbtnPROMSVersion.Value || swtbtnWaterMark.Value || swtbtnPDFdtPrefixSuffix.Value;
|
||||
}
|
||||
public DlgPrintProcedure(DocVersionInfo dvi)
|
||||
{
|
||||
@@ -166,7 +182,8 @@ namespace VEPROMS
|
||||
HandleDocVersionSettings();
|
||||
PrepForAllOrOne(false);
|
||||
// don't open all PDFs if doing All Procedures
|
||||
expPrnSetting.Expanded = swtbtnBlankPgsForDuplex.Value || swtbtnChgBar.Value || swtbtnGeneratePlacekeeper.Value || swtbtnPDFLinks.Value || swtbtnPROMSVersion.Value || swtbtnWaterMark.Value;
|
||||
// C2018-033 added the Prefix / Suffix switch to the expand Additional Settings check
|
||||
expPrnSetting.Expanded = swtbtnBlankPgsForDuplex.Value || swtbtnChgBar.Value || swtbtnGeneratePlacekeeper.Value || swtbtnPDFLinks.Value || swtbtnPROMSVersion.Value || swtbtnWaterMark.Value || swtbtnPDFdtPrefixSuffix.Value;
|
||||
}
|
||||
private void PrepForAllOrOne(bool oneProcedure)
|
||||
{
|
||||
@@ -210,7 +227,8 @@ namespace VEPROMS
|
||||
HandleDocVersionSettings();
|
||||
PrepForAllOrOne(true);
|
||||
cbxOpenAfterCreate2.Checked = pi.MyDocVersion.DocVersionConfig.Print_AlwaysViewPDFAfterCreate;
|
||||
expPrnSetting.Expanded = swtbtnBlankPgsForDuplex.Value || swtbtnChgBar.Value || swtbtnGeneratePlacekeeper.Value || swtbtnPDFLinks.Value || swtbtnPROMSVersion.Value || swtbtnWaterMark.Value;
|
||||
// C2018-033 added the Prefix / Suffix switch to the expand Additional Settings check
|
||||
expPrnSetting.Expanded = swtbtnBlankPgsForDuplex.Value || swtbtnChgBar.Value || swtbtnGeneratePlacekeeper.Value || swtbtnPDFLinks.Value || swtbtnPROMSVersion.Value || swtbtnWaterMark.Value || swtbtnPDFdtPrefixSuffix.Value;
|
||||
}
|
||||
public DlgPrintProcedure(ProcedureInfo pi, bool automatic) // RHM20150506 Multiline ItemID TextBox
|
||||
{
|
||||
@@ -226,7 +244,8 @@ namespace VEPROMS
|
||||
HandleDocVersionSettings();
|
||||
PrepForAllOrOne(true);
|
||||
cbxOpenAfterCreate2.Checked = pi.MyDocVersion.DocVersionConfig.Print_AlwaysViewPDFAfterCreate;
|
||||
expPrnSetting.Expanded = swtbtnBlankPgsForDuplex.Value || swtbtnChgBar.Value || swtbtnGeneratePlacekeeper.Value || swtbtnPDFLinks.Value || swtbtnPROMSVersion.Value || swtbtnWaterMark.Value;
|
||||
// C2018-033 added the Prefix / Suffix switch to the expand Additional Settings check
|
||||
expPrnSetting.Expanded = swtbtnBlankPgsForDuplex.Value || swtbtnChgBar.Value || swtbtnGeneratePlacekeeper.Value || swtbtnPDFLinks.Value || swtbtnPROMSVersion.Value || swtbtnWaterMark.Value || swtbtnPDFdtPrefixSuffix.Value;
|
||||
}
|
||||
/// <summary>
|
||||
/// RHM 20120925 Added so that the dialog would center over the PROMS window
|
||||
@@ -337,8 +356,6 @@ namespace VEPROMS
|
||||
private Timer _MyTimer;
|
||||
public void SetupForProcedure() // RHM20150506 Multiline ItemID TextBox
|
||||
{
|
||||
string PDFFilePrefix = _DocVersionConfig.Print_PDFFilePrefix;
|
||||
string PDFFileSuffix = _DocVersionConfig.Print_PDFFileSuffix;
|
||||
if(_DocVersionInfo == null)this.Text = "Create PDF for " + ProcNum;
|
||||
// get list of previous pdf files
|
||||
// if no previous pdf file, then get path from frmVersionProperties
|
||||
@@ -346,20 +363,7 @@ namespace VEPROMS
|
||||
//cbxPDF.Text = string.Format(@"{0}\{1}.pdf", _PDFPath, _ProcNum);
|
||||
// General 2 settings
|
||||
//txbPDFLocation.Text = _PDFPath;
|
||||
string PDFFileName = "";
|
||||
if (ProcNum == string.Empty)
|
||||
//txbPDFName.Text = this.UnitNumber + ".pdf";
|
||||
PDFFileName = this.UnitNumber;
|
||||
else
|
||||
//txbPDFName.Text = string.Format("{0}.pdf", _MyProcedure.PDFNumber);
|
||||
PDFFileName = string.Format("{0}", _MyProcedure.PDFNumber);
|
||||
//if (txbPDFName.Text.StartsWith("*"))
|
||||
// txbPDFName.Text = txbPDFName.Text.Replace("*", this.UnitNumber);
|
||||
if ((PDFFileName ?? "") == "") PDFFileName = "NoProcNumber";
|
||||
if (PDFFileName.StartsWith("*"))
|
||||
PDFFileName = PDFFileName.Replace("*", this.UnitNumber);
|
||||
if (PDFFileName.Contains("?")) PDFFileName = PDFFileName.Replace("?", "_"); // for wcn sys/BM-2xxA??, etc
|
||||
txbPDFName.Text = PDFFilePrefix + PDFFileName + PDFFileSuffix + ".pdf";
|
||||
BuildPDFFileName();
|
||||
ProcedureConfig pc = _MyProcedure.MyConfig as ProcedureConfig;
|
||||
if(SelectedSlave > 0) pc.SelectedSlave = SelectedSlave;
|
||||
if (pc != null)
|
||||
@@ -426,6 +430,52 @@ namespace VEPROMS
|
||||
lblRevDate.Visible = txbRevDate.Visible = !_AllProcedures && usesRevDate;
|
||||
}
|
||||
|
||||
// C2018-033 add the Prefix and/or Suffix to PDF file name if defined and wanted by the user
|
||||
// this piece of code was functionalized from SetupForProcedure()
|
||||
private void BuildPDFFileName()
|
||||
{
|
||||
if (MyProcedure == null) return;
|
||||
string PDFFilePrefix = _DocVersionConfig.Print_PDFFilePrefix;
|
||||
string PDFFileSuffix = _DocVersionConfig.Print_PDFFileSuffix;
|
||||
string PDFFileName = "";
|
||||
if (AllowDateTimePrefixSuffix && swtbtnPDFdtPrefixSuffix.Value)
|
||||
{
|
||||
PDFDTPrefix dtPre = _DocVersionConfig.Print_PDFdtFilePrefix;
|
||||
PDFDTSuffix dtSuf = _DocVersionConfig.Print_PDFdtFileSuffix;
|
||||
//DateTime dts = DateTime.Now;
|
||||
if (dtPre != PDFDTPrefix.None)
|
||||
PDFFilePrefix = (_PrefixSuffixDTS.ToString(dtPre.ToString())).Replace("__", " ").Replace("_", "-") + "_";
|
||||
if (dtSuf != PDFDTSuffix.None)
|
||||
PDFFileSuffix = "_" + (_PrefixSuffixDTS.ToString(dtSuf.ToString())).Replace("__", " ").Replace("_", "-");
|
||||
}
|
||||
if (ProcNum == string.Empty)
|
||||
//txbPDFName.Text = this.UnitNumber + ".pdf";
|
||||
PDFFileName = this.UnitNumber;
|
||||
else
|
||||
//txbPDFName.Text = string.Format("{0}.pdf", _MyProcedure.PDFNumber);
|
||||
PDFFileName = string.Format("{0}", _MyProcedure.PDFNumber);
|
||||
//if (txbPDFName.Text.StartsWith("*"))
|
||||
// txbPDFName.Text = txbPDFName.Text.Replace("*", this.UnitNumber);
|
||||
if ((PDFFileName ?? "") == "") PDFFileName = "NoProcNumber";
|
||||
if (PDFFileName.StartsWith("*"))
|
||||
PDFFileName = PDFFileName.Replace("*", this.UnitNumber);
|
||||
if (PDFFileName.Contains("?")) PDFFileName = PDFFileName.Replace("?", "_"); // for wcn sys/BM-2xxA??, etc
|
||||
txbPDFName.Text = PDFFilePrefix + PDFFileName + PDFFileSuffix + ".pdf";
|
||||
}
|
||||
|
||||
// C2018-033 Enable/disable the switch to control whether to add Prefix and/or Suffix to PDF file name
|
||||
private void SetupPrefixSuffixSwitch()
|
||||
{
|
||||
// note that MyProcedure must be set before calling this because BuildPDFFileName() will be called when the swbtnPDFPrefixSuffix is set
|
||||
string PDFFilePrefix = _DocVersionConfig.Print_PDFFilePrefix;
|
||||
string PDFFileSuffix = _DocVersionConfig.Print_PDFFileSuffix;
|
||||
PDFDTPrefix dtPre = _DocVersionConfig.Print_PDFdtFilePrefix;
|
||||
PDFDTSuffix dtSuf = _DocVersionConfig.Print_PDFdtFileSuffix;
|
||||
bool hasPrefixSuffix = _DateTimePrefixSuffixPrintingAllProcedures && (PDFFilePrefix.Length > 0 || PDFFileSuffix.Length > 0 || dtPre != PDFDTPrefix.None || dtSuf != PDFDTSuffix.None);
|
||||
swtbtnPDFdtPrefixSuffix.Value = hasPrefixSuffix; // this will call BuildPDFFileName() thus MyProcedure must be set
|
||||
swtbtnPDFdtPrefixSuffix.Enabled = hasPrefixSuffix;
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
@@ -502,6 +552,7 @@ namespace VEPROMS
|
||||
// if procedure has supplemental information, the automatially check the add blank pages for duplex printing
|
||||
if (_MyProcedure.ProcHasSupInfoData)
|
||||
swtbtnBlankPgsForDuplex.Value = true;
|
||||
SetupPrefixSuffixSwitch(); // C2018-033 Enable the switch to control whether to add Prefix and/or Suffix to PDF file name
|
||||
}
|
||||
}
|
||||
private int _SelectedSlave = 0;
|
||||
@@ -960,7 +1011,11 @@ namespace VEPROMS
|
||||
private void expPrnSetting_ExpandedChanged(object sender, DevComponents.DotNetBar.ExpandedChangeEventArgs e)
|
||||
{
|
||||
if (expPrnSetting.Expanded)
|
||||
{
|
||||
this.Size = new Size(this.Size.Width + (expPrnSetting.Size.Width - expPrnSetting.TitlePanel.Size.Height), this.Size.Height);
|
||||
// B2018-137 set the visability of Generate Placekeeper
|
||||
swtbtnGeneratePlacekeeper.Visible = lblGeneratePlacekeeper.Visible = ((MyProcedure.ActiveFormat.PlantFormat.FormatData.PurchaseOptions & E_PurchaseOptions.AutoPlacekeeper) == E_PurchaseOptions.AutoPlacekeeper);
|
||||
}
|
||||
//else
|
||||
// this.Size = new Size(this.Size.Width-(expPrnSetting.Size.Width-expPrnSetting.TitlePanel.Size.Height), this.Size.Height);
|
||||
//Refresh();
|
||||
@@ -976,6 +1031,21 @@ namespace VEPROMS
|
||||
|
||||
}
|
||||
|
||||
private void swtbtnPDFdtPrefixSuffix_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (swtbtnPDFdtPrefixSuffix.Value)
|
||||
swtbtnPDFLinks.Value = false;
|
||||
if (_AllProcedures) _DateTimePrefixSuffixPrintingAllProcedures = swtbtnPDFdtPrefixSuffix.Value; // C2018-033 add switch to use Prefix and Suffix on PDF file name
|
||||
BuildPDFFileName();
|
||||
}
|
||||
|
||||
private void swtbtnPDFLinks_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (swtbtnPDFLinks.Value)
|
||||
swtbtnPDFdtPrefixSuffix.Value = false;
|
||||
BuildPDFFileName();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user