C2022-004 Logic to print a Unit Designator Watermark
C2022-004 added Unit Designator Watermark option C2022-004 added format xml structure for Unit Designator Watermark and a flag to use it on Approval PDFs
This commit is contained in:
@@ -462,8 +462,16 @@ namespace VEPROMS
|
||||
cbxWaterMark.DataSource = EnumDetail<PrintDlgWatermarkList>.Details();
|
||||
cbxWaterMark.ValueMember = "EValue";
|
||||
PrintWatermark pw = _DocVersionConfig.Print_Watermark; // MyProcedure.ProcedureConfig.Print_Watermark;
|
||||
if (!pw.ToString().ToUpper().Equals("NONE")) //B2019-044 check setting from folder level
|
||||
cbxWaterMark.Text = pw.ToString(); // position print dialog list to setting from folder level
|
||||
string pwstr = pw.ToString().ToUpper();
|
||||
if (!pwstr.Equals("NONE")) //B2019-044 check setting from folder level
|
||||
{
|
||||
if (pwstr.Equals("INFORMATIONONLY"))
|
||||
cbxWaterMark.Text = "Information Only";
|
||||
else if (pwstr.Equals("UNITDESIGNATOR"))// C2022-004 unit designator option
|
||||
cbxWaterMark.Text = "Unit Designator";
|
||||
else
|
||||
cbxWaterMark.Text = pw.ToString(); // position print dialog list to setting from folder level
|
||||
}
|
||||
else
|
||||
swtbtnWaterMark.Value = false; // set to None at folder level so set Watermark switch to the off position
|
||||
|
||||
@@ -695,7 +703,8 @@ namespace VEPROMS
|
||||
// If file exists, determine if overwrite checkbox allows overwrite, if not prompt.
|
||||
Volian.Print.Library.Rtf2Pdf.PdfDebug = cbxDebug.Checked;
|
||||
// B2019-128: The combo box list did not include the 'None' option so the selected value was not the correct watermark (had to add 1 to the selected index)
|
||||
string waterMarkText = (swtbtnWaterMark.Value) ? cbxWaterMark.Text : "None"; // C2021-019
|
||||
string waterMarkText = (swtbtnWaterMark.Value) ? cbxWaterMark.Text : "None"; // C2021-019
|
||||
string watermarkColor = "Blue"; // this is the default watermark color
|
||||
// Determine change bar settings. First get from config & then see if override from dialog.
|
||||
// Also check that format allows override.
|
||||
ChangeBarDefinition cbd = DetermineChangeBarSettings();
|
||||
@@ -709,6 +718,7 @@ namespace VEPROMS
|
||||
{
|
||||
string locpdfname = null; // get pdf file name for later merge code
|
||||
MyProcedure = myProc;
|
||||
frmPDFStatusForm.SetUnitWatermark(MyProcedure, ref waterMarkText, ref watermarkColor); //C2022-004 Unit Designator watermark
|
||||
// C2021-019: Override Watermark Text, 'waterMarkText' will have whatever watermark text should be printed
|
||||
ProcedureConfig procConfig = MyProcedure.MyConfig as ProcedureConfig;
|
||||
string waterMarkTextOverride = "";
|
||||
@@ -746,7 +756,7 @@ namespace VEPROMS
|
||||
// B2021-102 put in the using for better memory management
|
||||
using (frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked, cbxOrPgBrk.Checked,
|
||||
cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, myPDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50),
|
||||
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd))//;//C2018-009 print PROMS version
|
||||
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd, watermarkColor))//;//C2018-009 print PROMS version
|
||||
{
|
||||
frmStatus.CloseWhenDone = true;
|
||||
Application.DoEvents();
|
||||
@@ -783,7 +793,7 @@ namespace VEPROMS
|
||||
// B2021-102 put in the using for better memory management
|
||||
using (frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked, cbxOrPgBrk.Checked,
|
||||
cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, GetMultiunitPDFPath(), cbd, txbPDFName.Text, new Point(Left, Bottom - 50),
|
||||
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd)) // ;//C2018-009 print PROMS version
|
||||
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd, watermarkColor)) // ;//C2018-009 print PROMS version
|
||||
{
|
||||
frmStatus.CloseWhenDone = true;
|
||||
Application.DoEvents();
|
||||
@@ -819,7 +829,7 @@ namespace VEPROMS
|
||||
// B2016-249 Output Procedure to folder associated with Parent Child
|
||||
using (frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked,
|
||||
cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, GetMultiunitPDFPath(), cbd, txbPDFName.Text,
|
||||
new Point(Left, Bottom - 50), swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd)) // ;//C2018-009 print PROMS version
|
||||
new Point(Left, Bottom - 50), swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd, watermarkColor)) // ;//C2018-009 print PROMS version
|
||||
{
|
||||
frmStatus.CloseWhenDone = true;
|
||||
Application.DoEvents();
|
||||
@@ -843,7 +853,6 @@ namespace VEPROMS
|
||||
VEPROMS.CSLA.Library.Database.ShowDBTracking("DBTracking.txt");
|
||||
}
|
||||
}
|
||||
|
||||
private void AddToMergeList(ProcedureInfo myProc, string locpdfname)
|
||||
{
|
||||
// if doing a merge and this procedure should be included, add it to _MergedPdf:
|
||||
@@ -940,6 +949,8 @@ namespace VEPROMS
|
||||
// B2019-044 don't print the watermark if the watermark switch on the print dialog is turned off
|
||||
cbxWaterMark.Visible = true;
|
||||
string waterMarkText = (swtbtnWaterMark.Value) ? cbxWaterMark.Text : "None" ; // B2018-124 use text of watermark form drop down list instead of enum value
|
||||
string watermarkColor = "Blue"; // this is the default watermark color
|
||||
frmPDFStatusForm.SetUnitWatermark(MyProcedure, ref waterMarkText, ref watermarkColor); //C2022-004 Unit Designator Watermark
|
||||
ProcedureConfig procConfig = MyProcedure.MyConfig as ProcedureConfig;
|
||||
string waterMarkTextOverride = "";
|
||||
if (procConfig != null) waterMarkTextOverride = procConfig.GetValue("PSI", "WATERMARKOVERRIDE"); // C2021-019: override watermark text
|
||||
@@ -964,7 +975,7 @@ namespace VEPROMS
|
||||
// B2018-124 use text of watermark form drop down list instead of enum value
|
||||
using (frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked, cbxOrPgBrk.Checked,
|
||||
cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, GetMultiunitPDFPath(), cbd, txbPDFName.Text, new Point(Left, Bottom - 50),
|
||||
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, false, tbBlankPage.Text, _MergedPfd))//; //C2018-009 print PROMS version
|
||||
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, false, tbBlankPage.Text, _MergedPfd, watermarkColor))//; //C2018-009 print PROMS version
|
||||
{
|
||||
frmStatus.MakePlaceKeeper = swtbtnGeneratePlacekeeper.Value;
|
||||
frmStatus.MakeContinuousActionSummary = cbxGenerateConActSum.Checked;
|
||||
|
@@ -82,7 +82,7 @@ namespace VEPROMS
|
||||
get { return _DidAll; }
|
||||
set { _DidAll = value; }
|
||||
}
|
||||
public frmPDFStatusForm(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd, string pdfFile, Point newLocation, bool insertBlankPages, bool allOrAuto, string prefix, bool saveLinks, int removeTrailingHardReturnsAndManualPageBreaks, bool showPROMSVer, bool didAll, string blankPageText, MergedPdf mergedPdf)
|
||||
public frmPDFStatusForm(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd, string pdfFile, Point newLocation, bool insertBlankPages, bool allOrAuto, string prefix, bool saveLinks, int removeTrailingHardReturnsAndManualPageBreaks, bool showPROMSVer, bool didAll, string blankPageText, MergedPdf mergedPdf, string watermarkColor)
|
||||
{
|
||||
// B2021-088 moved this if/else from CreatePDF() so that the Approval logic will have access to this logic
|
||||
ProcedureInfo MyProcedure = myItem as ProcedureInfo;
|
||||
@@ -103,13 +103,44 @@ namespace VEPROMS
|
||||
// if the version number of PROMS is 1.0, then we are running a Demo version.
|
||||
// When running a Demo version, force a "Sample" watermark when printing.
|
||||
// B2020-022 append a ".pdf" extension if the file name does on have one.
|
||||
MyPromsPrinter = new PromsPrinter(myItem, rev, (VlnSettings.ReleaseMode.Equals("DEMO")) ? "Sample" : watermark, debugOutput, origPgBrk, pdfPath + @"\Compare", false, overWrite, cbd, (pdfFile.ToUpper().EndsWith(".PDF"))?pdfFile:pdfFile+".pdf", insertBlankPages, allOrAuto,Prefix,saveLinks,removeTrailingHardReturnsAndManualPageBreaks, blankPageText, DidAll, mergedPdf);
|
||||
MyPromsPrinter = new PromsPrinter(myItem, rev, (VlnSettings.ReleaseMode.Equals("DEMO")) ? "Sample" : watermark, debugOutput, origPgBrk, pdfPath + @"\Compare", false, overWrite, cbd, (pdfFile.ToUpper().EndsWith(".PDF"))?pdfFile:pdfFile+".pdf", insertBlankPages, allOrAuto,Prefix,saveLinks,removeTrailingHardReturnsAndManualPageBreaks, blankPageText, DidAll, mergedPdf, watermarkColor);
|
||||
MyPromsPrinter.PromsVersion = (showPROMSVer) ? AboutVEPROMS.PROMSVersion : ""; //C2018-009 print PROMS version
|
||||
PDFPath = pdfPath;
|
||||
this.Text = "Creating PDF of " + myItem.DisplayNumber;
|
||||
_NewLocation = newLocation;
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
public static void SetUnitWatermark(ProcedureInfo procInfo, ref string waterMarkText, ref string watermarkColor)
|
||||
{
|
||||
// C2022-004 BNPP Unit Specific Watermark
|
||||
// Check if the user selected the "Unit Designator" watermark.
|
||||
// If the procedure number starts with any of the ProcNumPrefix values (set in the format file) then
|
||||
// set the Watermark Override text and color variables with the values from the format
|
||||
if (waterMarkText.ToUpper().Equals("UNIT DESIGNATOR") && procInfo.ActiveFormat.PlantFormat.FormatData.UnitWatermarkList != null)
|
||||
{
|
||||
foreach (UnitWatermark uw in procInfo.ActiveFormat.PlantFormat.FormatData.UnitWatermarkList)
|
||||
{
|
||||
if (procInfo.DisplayNumber.StartsWith(uw.ProcNumPrefix) || uw.ProcNumPrefix.ToUpper() == "DEFAULT")
|
||||
{
|
||||
waterMarkText = uw.WMText;
|
||||
watermarkColor = uw.WMColor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Check if the watermark is the defined Parent/Child applicability token (field)
|
||||
// if procedure does not use parent/child, then make the watermark text blank (empty string)
|
||||
if (waterMarkText.ToUpper() == "[U-TEXT]")
|
||||
{
|
||||
string utxt = (procInfo.MyDocVersion.MultiUnitCount > 1) ? procInfo.MyDocVersion.DocVersionConfig.Unit_Text : "";
|
||||
waterMarkText = (utxt == null) ? "" : utxt;
|
||||
}
|
||||
else if (waterMarkText.ToUpper() == "[U-NUMBER]")
|
||||
{
|
||||
string uNum = (procInfo.MyDocVersion.MultiUnitCount > 1) ? procInfo.MyDocVersion.DocVersionConfig.Unit_Number : "";
|
||||
waterMarkText = (uNum == null) ? "" : uNum;
|
||||
}
|
||||
}
|
||||
}
|
||||
// used when the approved function creates an export file with unlinked ROs and Transitons. Word sections that have RO tokens are saved with the RO Vaules in DocReplace
|
||||
// DocReplace is passed on to the Export functions.
|
||||
private Dictionary<int, byte[]> _DocReplace;
|
||||
|
Reference in New Issue
Block a user