diff --git a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs index 6b4b1c81..d27b1844 100644 --- a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs +++ b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs @@ -149,6 +149,7 @@ namespace VEPROMS get { return cbxGenerateConActSum.Checked; } set { cbxGenerateConActSum.Checked = value; } } + private bool _CreateButtonClicked = false; // B2020-062 control the toggle of date/time prefix/suffix on pdf file name public DlgPrintProcedure(DocVersionInfo dvi, bool automatic) { _Automatic = automatic; @@ -469,10 +470,20 @@ namespace VEPROMS string PDFFilePrefix = _DocVersionConfig.Print_PDFFilePrefix; string PDFFileSuffix = _DocVersionConfig.Print_PDFFileSuffix; string PDFFileName = ""; + PDFDTPrefix dtPre = _DocVersionConfig.Print_PDFdtFilePrefix; + PDFDTSuffix dtSuf = _DocVersionConfig.Print_PDFdtFileSuffix; + if (dtPre != PDFDTPrefix.None) PDFFilePrefix = ""; // incase user entered prefix text but then selected a date/time (in working draft properties) + if (dtSuf != PDFDTSuffix.None) PDFFileSuffix = ""; // incase user entered suffix text but then selected a date/time (in working draft properties) + // B2020-062 control the toggle of date/time prefix/suffix on pdf file name + // disable the date/time Prefix/Suffix switch if no date/time was selected + // This switch is does not affect the use of it if the user typed in text for prefix/suffix + if (!AllowDateTimePrefixSuffix || (dtPre == PDFDTPrefix.None && dtSuf == PDFDTSuffix.None)) + { + swtbtnPDFdtPrefixSuffix.Value = false; + swtbtnPDFdtPrefixSuffix.Enabled = false; + } 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("_", "-") + "_"; @@ -497,6 +508,7 @@ namespace VEPROMS // C2018-033 Enable/disable the switch to control whether to add Prefix and/or Suffix to PDF file name private void SetupPrefixSuffixSwitch() { + if (_CreateButtonClicked) return; // B2020-062 control the toggle of date/time prefix/suffix on pdf file name // 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; @@ -947,7 +959,9 @@ namespace VEPROMS if (cbxMultiunitPdfLocation.SelectedItem != null) _MultiunitPdfLocation = cbxMultiunitPdfLocation.SelectedItem.ToString(); this.Cursor = Cursors.WaitCursor; + _CreateButtonClicked = true; // B2020-062 control the toggle of date/time prefix/suffix on pdf file name CreatePDF(); + _CreateButtonClicked = false; this.Cursor = Cursors.Default; } }