diff --git a/PROMS/DataLoader/PROMSFixes.Sql b/PROMS/DataLoader/PROMSFixes.Sql index 254d8e70..542c0ebd 100644 --- a/PROMS/DataLoader/PROMSFixes.Sql +++ b/PROMS/DataLoader/PROMSFixes.Sql @@ -5420,6 +5420,7 @@ Union All join Items I on Z.PreviousID = I.ItemID ) insert into @Parents select ItemID, ContentID from Itemz where Relationship > 0 +OPTION (MAXRECURSION 10000) RETURN END GO diff --git a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs index 1e0046b7..0a4d1cce 100644 --- a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs +++ b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs @@ -164,7 +164,7 @@ namespace VEPROMS // set to a default PDF location if none was specified in the DocVersions property if (txbPDFLocation.Text == null || txbPDFLocation.Text.Length == 0 || !Directory.Exists(txbPDFLocation.Text)) txbPDFLocation.Text = VlnSettings.TemporaryFolder; - + SetCompareVisibility(); // if the default setting is 'SelectBeforePrinting', put up a message box to determine whether the user // wants change bars. If not, 'Change Bar' on the Setting tab is 'OFF' and no Change bar tab. // If yes, the Change bar tab is the selected tab. @@ -225,6 +225,16 @@ namespace VEPROMS btnDuplxOff.Visible = false; btnDuplxOn.Visible = false; } + SetCompareVisibility(); + + // default to using OriginalPageBreaks (16bit page breaks) if App.config is set + // to true: + cbxOrPgBrk.Visible = VlnSettings.OriginalPageBreak; + cbxOrPgBrk.Checked = false; + } + + private void SetCompareVisibility() + { // default to print Debug info if App.config is set to debug mode // This checkbox is now labeled as "Compare PDF" // If the PDF location has a Compare folder or we are in Debug Mode @@ -234,11 +244,6 @@ namespace VEPROMS cmpfldr += "Compare"; cbxDebug.Visible = Directory.Exists(cmpfldr) || VlnSettings.DebugMode; cbxDebug.Checked = VlnSettings.DebugMode; - - // default to using OriginalPageBreaks (16bit page breaks) if App.config is set - // to true: - cbxOrPgBrk.Visible = VlnSettings.OriginalPageBreak; - cbxOrPgBrk.Checked = false; } private void DlgPrintProcedure_Load(object sender, EventArgs e) diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index 1ee7a8ab..a4ce350e 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -312,16 +312,38 @@ namespace Volian.Print.Library if (myFirstPieceSize < ySpaceOnCurPage) yLowerLimit = Math.Max(myFirstPieceSize + yStart, yLowerLimit); //while ((YSize - yTop) >= ySpaceOnCurPage) // Pagination Fix Break1LineShort3b + DocStyle docstyle = MyItemInfo.MyDocStyle; + string myBottomMsg = docstyle.Continue.Bottom.Message; + float myBottomMsgSpace = ((myBottomMsg ?? "") != "") ? 2 * SixLinesPerInch : 0; + switch (docstyle.Continue.Bottom.Location) + { + case E_ContBottomLoc.BottomOfPage: // place continue message at bottom of page + myBottomMsgSpace = 0; + break; + } + string myTopMsg = docstyle.Continue.Top.Message; + float myTopMsgSpace = ((myTopMsg ?? "") != "") ? 2 * SixLinesPerInch : 0; while ((YSize - yTop) > ySpaceOnCurPage) { + ySpaceOnCurPage -= myBottomMsgSpace; vlnParagraph paraBreak = FindPageBreak(yStart, ySpaceOnCurPage, yLowerLimit, myList); - if (paraBreak == null) break; + if (paraBreak == null) + { + _MyLog.ErrorFormat("<<< ERROR >>> Cannot find a place to break\r\n==>'Cannot Find Place to Break',{0},'{1}','{2}'" + , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath); + break; + } // yTopNew is y Location of this page break. YTopMost is top of HLS, including any Cautions/Notes/Boxes/etc - float yTopNew = paraBreak.YTopMost - YTopMost; + //float yTopNew = paraBreak.YVeryTop - YTopMost; + //float yTopNew = paraBreak.YTopMost - YTopMost; + float yTopNew = Math.Min(paraBreak.YTopMost, paraBreak.YVeryTop) - YTopMost; RemoveProcessedParagraphs(myList, yTopNew - yTop); yTop = yTopNew; MyPageHelper.ParaBreaks.Add(paraBreak); - ySpaceOnCurPage = yPageSize - 2 * SixLinesPerInch; // Allow for continue message and blank line. + ySpaceOnCurPage = yPageSize - (myTopMsgSpace + SixLinesPerInch); // Allow for continue message and blank line. + //ySpaceOnCurPage = yPageSize - (myTopMsgSpace + SixLinesPerInch); // Allow for continue message and blank line. + //if (paraBreak.YTopMost != paraBreak.YVeryTop && MyPageHelper.TopMessage == null && MyPageHelper.BottomMessage == null) + // ySpaceOnCurPage = yPageSize; //ySpaceOnCurPage = yPageSize; // Allow for continue message and blank line. //DocStyle docstyle = MyItemInfo.MyDocStyle; //string myMsg = docstyle.Continue.Bottom.Message; @@ -341,6 +363,7 @@ namespace Volian.Print.Library /// private static vlnParagraph FindPageBreak(float yStart, float yUpperLimit, float yLowerLimit, StepLevelList myList) { + vlnParagraph minPara = null; foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest. { foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation @@ -349,6 +372,8 @@ namespace Volian.Print.Library // The top of this step will fit onto page (-yLocation < yWithinMargins) float wcnChkLstBorder = myPara.MyItemInfo.MyHLS.FormatStepData.UseSmartTemplate && (myPara.MyItemInfo.MyHLS.FormatStepData.Suffix ?? "") != "" ? 2*SixLinesPerInch : 0; + if (minPara == null || minPara.YTop > myPara.YTop) + minPara = myPara; if (wcnChkLstBorder -yLocation <= yUpperLimit) // Fix for OFN-RJ-23 //if (-yLocation < yUpperLimit) // Before //if (-yLocation < yWithinMargins && myList[stepLevel][yLocation].MyItemInfo.MyPrevious != null) @@ -373,7 +398,7 @@ namespace Volian.Print.Library } } } - return null; + return minPara; } //private void WalkStepLevel(float yTopMost) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 949f454e..a4e22e25 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -572,7 +572,10 @@ namespace Volian.Print.Library { get { - return string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' StepLevel={4} DBSequence={5}", DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType, MyItemInfo.FormatStepData==null?"NoStepData":MyItemInfo.FormatStepData.Type, MyItemInfo.StepLevel, MyItemInfo.DBSequence); + return string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' StepLevel={4} DBSequence={5} YTopMost={6} ", + DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType, + MyItemInfo.FormatStepData==null?"NoStepData":MyItemInfo.FormatStepData.Type, + MyItemInfo.StepLevel, MyItemInfo.DBSequence,YTopMost); } } private void ResetDocStyleAndValues(ref float yTopMargin, ref float yBottomMargin)