F2022-024 – logic to support printing of Time Critical Action Summary report

This commit is contained in:
2022-08-11 18:09:10 +00:00
parent 8f765e0294
commit 80581d7e4d
2 changed files with 100 additions and 5 deletions

View File

@@ -76,6 +76,15 @@ namespace VEPROMS
get { return _OnlyShowContinuousActionSummary; }
set { _OnlyShowContinuousActionSummary = value; }
}
// F2022-024 this flag is used when the Time Critical Action Sumamry is printed from the tree or ribbon button
// it will prevent the temporary PDF (generated with printing - needed to get page numbers) from being displayed
// and will delete that temporary PDF file
private bool _OnlyShowTimeCriticalActionSummary = false;
public bool OnlyShowTimeCriticalActionSummary
{
get { return _OnlyShowTimeCriticalActionSummary; }
set { _OnlyShowTimeCriticalActionSummary = value; }
}
private bool _DidAll = false;
public bool DidAll
{
@@ -192,6 +201,8 @@ namespace VEPROMS
tmrRun.Enabled = true;
if (MakeContinuousActionSummary)
Text = Text.Replace("PDF", "Continuous Action Summary");
else if (MakeTimeCriticalActionSummary)
Text = Text.Replace("PDF", "Time Critical Action Summary"); // F2022-024 Time Critical Action
}
private string _PdfFile;
@@ -216,6 +227,15 @@ namespace VEPROMS
set { _MakeContinuousActionSummary = value; }
}
// F2022-024 Time Critical Action Summary
private bool _MakeTimeCriticalActionSummary = false;
public bool MakeTimeCriticalActionSummary
{
get { return _MakeTimeCriticalActionSummary; }
set { _MakeTimeCriticalActionSummary = value; }
}
private void tmrRun_Tick(object sender, EventArgs e)
{
tmrRun.Enabled = false;
@@ -251,7 +271,7 @@ namespace VEPROMS
cachePartInfo = PartInfo.CacheList;
}
_PdfFile = MyPromsPrinter.Print(PDFPath, MakePlaceKeeper, MakeContinuousActionSummary);
_PdfFile = MyPromsPrinter.Print(PDFPath, MakePlaceKeeper, MakeContinuousActionSummary, MakeTimeCriticalActionSummary);
ProfileTimer.Pop(profileDepth);
@@ -332,7 +352,7 @@ namespace VEPROMS
{
try // B2019-106 Error Handling for PDF Open
{
if ((pdffile ?? "") != "" && !OnlyShowContinuousActionSummary)
if ((pdffile ?? "") != "" && !OnlyShowContinuousActionSummary && !OnlyShowTimeCriticalActionSummary) // F2022-024 Time Critical Action Summary
{
System.Diagnostics.Process sdp = System.Diagnostics.Process.Start(pdffile);
@@ -340,7 +360,7 @@ namespace VEPROMS
sdp.WaitForInputIdle();
}
if (OnlyShowContinuousActionSummary)
if (OnlyShowContinuousActionSummary || OnlyShowTimeCriticalActionSummary) // F2022-024 Time Critical Action Summary
System.IO.File.Delete(pdffile); // remove the temporary PDF file used to create the Continuous Action Summary
if (MyPromsPrinter.MyPlacekeeper != null)
@@ -370,6 +390,21 @@ namespace VEPROMS
MyPromsPrinter.MyContActSummary.Visible();
}
// F2022-024 this will display the generated Time Critical Action Summary in MS Word (starting a new instance of MS Word outside of PROMS)
if (MyPromsPrinter.MyTimeCriticalActSummary != null)
{
string instructions = "The Time Critical Action Summary will be opened in MS Word.\n\nYou can make modifications and copy it into a PROMS Word section.";
MessageBox.Show(instructions, "Time Critical Action Summary");
// The ContActSummaryDelay is a switch that can be added to the PROMS.exe shortcut
// ex: VEPROMS.EXE /ContActSummaryDelay=2.5 will delay it 2 1/2 seconds
float delay = Volian.Base.Library.VlnSettings.GetCommandFloat("TimeCritActSummaryDelay", 1.0f);
int mydelay = (int)(1000 * delay);
System.Threading.Thread.Sleep(mydelay);
MyPromsPrinter.MyTimeCriticalActSummary.Visible();
}
}
catch (Exception ex)
{