Continuous Action Summary logic

This commit is contained in:
2015-10-23 18:21:02 +00:00
parent 7adcafa29b
commit 8ad203006d
4 changed files with 60 additions and 50 deletions

View File

@@ -239,13 +239,13 @@ namespace Volian.Print.Library
get { return _BeforePageNumberPdf; }
set { _BeforePageNumberPdf = value; }
}
public string Print(string pdfFolder, bool makePlacekeeper)
public string Print(string pdfFolder, bool makePlacekeeper, bool makeContinuousActionSummary)
{
if (_MyItem is ProcedureInfo)
{
if (!(_MyItem.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier ||
_MyItem.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier))
return Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper);
return Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary);
else
{
// if the plant uses transition modifiers and/or page num in transition format,
@@ -253,12 +253,12 @@ namespace Volian.Print.Library
// 2nd pass fills in the page numbers in transitions.
DirectoryInfo di = new DirectoryInfo(pdfFolder + @"\PageNumberPass1");
if (!di.Exists) di.Create();
string retstr = Print(_MyItem as ProcedureInfo, pdfFolder + @"\PageNumberPass1", false);
string retstr = Print(_MyItem as ProcedureInfo, pdfFolder + @"\PageNumberPass1", false, false);
if (retstr == null) return null;
BeforePageNumberPdf = retstr;
ProcedureInfo.RefreshPageNumTransitions(_MyItem as ProcedureInfo);
_MyReaderHelper = new ReaderHelper(this);
retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper);
retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary);
if (TransPageNumProblems.Count > 0)
{
if (BatchPrint || ( MessageBox.Show("Page Number Transitions may be fixed if a second pass is performed. Do you want to perform a second pass?", "Page Number Transition Errors", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
@@ -273,7 +273,7 @@ namespace Volian.Print.Library
RefreshPageNumber(_MyItem);
ProcedureInfo.RefreshPageNumTransitions(_MyItem as ProcedureInfo);
_MyReaderHelper = new ReaderHelper(this);
retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper);
retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary);
}
}
return retstr;
@@ -518,7 +518,7 @@ namespace Volian.Print.Library
set { PromsPrinter._MyFoldoutReader = value; }
}
private static List<SectionInfo> _MyFoldoutSection = null;
private string Print(ProcedureInfo myProcedure, string pdfFolder, bool makePlacekeeper)
private string Print(ProcedureInfo myProcedure, string pdfFolder, bool makePlacekeeper, bool makeContinuousActionSummary)
{
int profileDepth = ProfileTimer.Push(">>>> PromsPrinter.Print");
if (_TransPageNumProblems == null) _TransPageNumProblems = new List<string>();
@@ -540,7 +540,7 @@ namespace Volian.Print.Library
// if floating foldouts, need a list of sections & foldoutreaders. Just do first for now.
_MyFoldoutSection.Add(mySection);
string foldoutPdf = PrintProcedureOrFoldout(myProcedure, mySection, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\Foldout" + cnt.ToString() + @".pdf", false);
string foldoutPdf = PrintProcedureOrFoldout(myProcedure, mySection, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\Foldout" + cnt.ToString() + @".pdf", false, false);
_MyFoldoutReader.Add(foldoutPdf != null ? new PdfReader(foldoutPdf) : null);
cnt++;
}
@@ -557,7 +557,7 @@ namespace Volian.Print.Library
return null;
}
}
string retval = PrintProcedureOrFoldout(myProcedure, null, outputFileName, makePlacekeeper);
string retval = PrintProcedureOrFoldout(myProcedure, null, outputFileName, makePlacekeeper, makeContinuousActionSummary);
ProfileTimer.Pop(profileDepth);
return retval;
}
@@ -592,7 +592,7 @@ namespace Volian.Print.Library
set { _AllowAllWatermarks = value; }
}
private PdfReader readerWord;
private string PrintProcedureOrFoldout(ProcedureInfo myProcedure, SectionInfo myFoldoutSection, string outputFileName, bool makePlacekeeper)
private string PrintProcedureOrFoldout(ProcedureInfo myProcedure, SectionInfo myFoldoutSection, string outputFileName, bool makePlacekeeper, bool makeContinuousActionSummary)
{
int profileDepth = ProfileTimer.Push(">>>> PrintProcedureOrFoldout");
Rtf2Pdf.TextAtCounter = 0;
@@ -837,6 +837,14 @@ namespace Volian.Print.Library
if (_MyHelper.MyPlacekeepers.Count > 0)
MyPlacekeeper = new Placekeeper(_MyHelper.MyPlacekeepers, pkFont);
}
// Generate the Continuous Action Summary
if (_MyHelper != null && makeContinuousActionSummary)
{
// Set the font for the Continue Action Summary
VE_Font pkFont = myProcedure.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.ContinuousActionSummaryData.Font; // uses font defined in the format or uses what is definced in BaseAll format
if (_MyHelper.MyContActSteps.Count > 0)
MyContActSummary = new ContinuousActionSummary(_MyHelper.MyContActSteps, pkFont);
}
_MyHelper = null;
ProfileTimer.Pop(profileDepth);
return outputFileName;
@@ -856,6 +864,15 @@ namespace Volian.Print.Library
get { return _MyPlacekeeper; }
set { _MyPlacekeeper = value; }
}
private ContinuousActionSummary _MyContActSummary = null;
public ContinuousActionSummary MyContActSummary
{
get { return _MyContActSummary; }
set { _MyContActSummary = value; }
}
public void CreateWordDocPdf(PdfContentByte cb, SectionInfo mySection)
{
if (mySection.PageNumber == -1) // If page num transition goes to a section, need the pagenumber of section.
@@ -1458,7 +1475,9 @@ namespace Volian.Print.Library
{
localYPageStart = myParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
if (myParagraph.MyPlaceKeeper != null)
_MyHelper.MyPlacekeepers.Add(myParagraph.MyPlaceKeeper);
_MyHelper.MyPlacekeepers.Add(myParagraph.MyPlaceKeeper); // add this step text to the PlaceKeeper (Calvert Cliffs)
if (myParagraph.MyContAct != null)
_MyHelper.MyContActSteps.Add(myParagraph.MyContAct); // add this step to the Continuous Action Summary
}
else if (!myItemInfo.MyDocStyle.OptionalSectionContent)
PrintTextMessage(cb, "No Section Content", _TextLayer);