diff --git a/PROMS/SQL/PROMS2010.SQL b/PROMS/SQL/PROMS2010.SQL index 24cccbd2..f7d46174 100644 --- a/PROMS/SQL/PROMS2010.SQL +++ b/PROMS/SQL/PROMS2010.SQL @@ -14,6 +14,10 @@ begin end print 'Adding procedures and functions to ' + db_name() GO +SET ANSI_NULLS ON +GO +SET QUOTED_IDENTIFIER ON +GO /****** Object: Table [dbo].[DeleteLog] Script Date: 03/29/2011 17:26:23 ******/ IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DeleteLog]') AND type in (N'U')) diff --git a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs index 80d87dee..3de1caa6 100644 --- a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs +++ b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs @@ -331,12 +331,15 @@ namespace VEPROMS // Determine change bar settings. First get from config & then see if override from dialog. // Also check that format allows override. ChangeBarDefinition cbd = DetermineChangeBarSettings(); + int n = _DocVersionInfo.Procedures.Count; + int i = 0; foreach (ProcedureInfo myProc in _DocVersionInfo.Procedures) { MyProcedure = myProc; if (myProc.Sections != null) { SetupForProcedure(); + this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n); frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNum, RevDate, pw.ToString(), cbxDebug.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text); frmStatus.CloseWhenDone = true; frmStatus.ShowDialog(); @@ -427,7 +430,16 @@ namespace VEPROMS private void btnCreatePDF_Click(object sender, EventArgs e) { if (_AllProcedures) + { + DateTime dtStart = DateTime.Now; CreatePDFs(); + if (VlnSettings.DebugMode) + { + MessageBox.Show(string.Format("{0} Minutes to Print All Procedures" + , TimeSpan.FromTicks(DateTime.Now.Ticks - dtStart.Ticks).TotalMinutes), + "Printing Duration", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } else CreatePDF(); } diff --git a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs index 705361ed..fbacc2e3 100644 --- a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs +++ b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs @@ -97,7 +97,10 @@ namespace VEPROMS.CSLA.Library style |= FontStyle.Underline; } // for now - check size to be 0 and set to 10 if so, error in fmtxml? - _WindowsFont = new Font(Family, Size==0?10:(float)Size, style); + if (Family == null) // Need to get inherited font + _WindowsFont = new Font("Arial", 10, FontStyle.Regular); + else + _WindowsFont = new Font(Family, Size == 0 ? 10 : (float)Size, style); } return _WindowsFont; } diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 8e88b3b4..4fa59b7c 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -202,7 +202,14 @@ namespace Volian.Print.Library private void CloseDocument(PdfContentByte cb, string fileName) { - cb.PdfDocument.Close(); + try + { + cb.PdfDocument.Close(); + } + catch (Exception ex) + { + Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message); + } OnStatusChanged("CloseDocument", PromsPrinterStatusType.CloseDocument); if (OpenPDF) System.Diagnostics.Process.Start(fileName); @@ -384,14 +391,17 @@ namespace Volian.Print.Library { // if there's and end message, add it to the appropriate location on the last page of // the word document: - float ylocation = cb.PdfDocument.PageSize.Height - ((float)mySection.MyDocStyle.Layout.TopMargin + locEndOfWordDoc * 72); // 72 - pts per inch. - iTextSharp.text.Font fnt = VolianPdf.GetFont(mySection.MyDocStyle.End.Font.WindowsFont); - fnt.Color=new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black)); - iTextSharp.text.Paragraph para = new Paragraph(mySection.MyDocStyle.End.Message, fnt); - float wtpm = (float)mySection.MyDocStyle.Layout.PageWidth - (float)mySection.MyDocStyle.Layout.LeftMargin; - float centerpos = (float)mySection.MyDocStyle.Layout.LeftMargin + (wtpm - (mySection.MyDocStyle.End.Message.Length * mySection.MyDocStyle.End.Font.CharsToTwips)) / 2; - float yBottomMargin = Math.Max(0, (float)mySection.MyDocStyle.Layout.TopMargin - (float)mySection.MyDocStyle.Layout.PageLength - 2 * vlnPrintObject.SixLinesPerInch); - Rtf2Pdf.TextAt(cb, para, centerpos, ylocation + 6, 100, 12, "", yBottomMargin); + if ((mySection.MyDocStyle.End.Message ?? "") != "") + { + float ylocation = cb.PdfDocument.PageSize.Height - ((float)mySection.MyDocStyle.Layout.TopMargin + locEndOfWordDoc * 72); // 72 - pts per inch. + iTextSharp.text.Font fnt = VolianPdf.GetFont(mySection.MyDocStyle.End.Font.WindowsFont); + fnt.Color = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black)); + iTextSharp.text.Paragraph para = new Paragraph(mySection.MyDocStyle.End.Message, fnt); + float wtpm = (float)mySection.MyDocStyle.Layout.PageWidth - (float)mySection.MyDocStyle.Layout.LeftMargin; + float centerpos = (float)mySection.MyDocStyle.Layout.LeftMargin + (wtpm - (mySection.MyDocStyle.End.Message.Length * mySection.MyDocStyle.End.Font.CharsToTwips)) / 2; + float yBottomMargin = Math.Max(0, (float)mySection.MyDocStyle.Layout.TopMargin - (float)mySection.MyDocStyle.Layout.PageLength - 2 * vlnPrintObject.SixLinesPerInch); + Rtf2Pdf.TextAt(cb, para, centerpos, ylocation + 6, 100, 12, "", yBottomMargin); + } } OnStatusChanged("Merge MSWord", PromsPrinterStatusType.MergeMSWord); } diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 15e4c959..502ba109 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -119,14 +119,12 @@ namespace Volian.Print.Library public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin) { if (Processed) return yPageStart; - + //float localYPageStart = yPageStart; Processed = true; if (_PartsAbove != null && _PartsAbove.Count > 0) yPageStart = PartsAbove.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); if (MyItemInfo.IsHigh && MyItemInfo.MyDocStyle.SpecialStepsFoldout) yPageStart -= SixLinesPerInch; float yLocation = CalculateYOffset(yPageStart, yTopMargin); - if (MyItemInfo.HasChangeBar && MyPageHelper.ChangeBarDefinition.MyChangeBarType != PrintChangeBar.Without) MyPageHelper.AddChangeBar(DoChangeBar(cb, MyItemInfo, MyPageHelper, XOffset, yLocation, MyPageHelper.MaxRNO, MyItemInfo.ActiveFormat), cbMess); - float retval = yLocation; if (MyItemInfo.IsFigure) { @@ -158,6 +156,7 @@ namespace Volian.Print.Library if (_PartsBelow != null && _PartsBelow.Count > 0) yPageStart = PartsBelow.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); if (_PartsContainer != null && _PartsContainer.Count > 0) yPageStart = PartsContainer.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin); + //if (localYPageStart != yPageStart) DebugText.WriteLine("ParToPdf-yPagestartDiff:{0},{1},{2}", MyItemInfo.ItemID, localYPageStart, yPageStart); return yPageStart; } @@ -350,11 +349,12 @@ namespace Volian.Print.Library float yTopMost = YTopMost; //if (YVeryTop < yTopMost) Console.WriteLine("{0},{1},{2}", MyItemInfo.DBSequence, yTopMost, YVeryTop); yTopMost = Math.Min(yTopMost,YVeryTop); - yPageStart = yTopMargin + yTopMost - 2 * SixLinesPerInch; + yPageStart = yTopMargin + yTopMost;// -2 * SixLinesPerInch; if (EmptyTopMostPart) yPageStart += SixLinesPerInch; myMsg = docstyle.Continue.Top.Message; if (myMsg != null && myMsg != "") { + yPageStart -= 2 * SixLinesPerInch;// Allow two lines for top continue message if (myMsg.IndexOf(@"%d") > -1) myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanText.Trim(" .".ToCharArray())); MyPageHelper.TopMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Top.Margin ?? 0, yTopMargin + 0.1F, MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font); @@ -700,7 +700,7 @@ namespace Volian.Print.Library if (breakOrNot == "Yes") { // DebugPagination.WriteLine("{0}", MyItemInfo.DBSequence); //,instance); - DebugPagination.WriteLine("'{0}',{1},'{2}','{3}',{4},{5},{6},{7},{8}", MyItemInfo.ShortPath, instance, message, breakOrNot, + DebugPagination.WriteLine("{0},'{1}',{2},'{3}','{4}',{5},{6},{7},{8},{9}",MyPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, MyItemInfo.ShortPath, instance, message, breakOrNot, MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize)); } // Console.WriteLine("{0},{1}", MyItemInfo.DBSequence, IsFirstSubStep(MyItemInfo)); //,instance); @@ -736,6 +736,10 @@ namespace Volian.Print.Library yTop = yTopNew; MyPageHelper.ParaBreaks.Add(paraBreak); ySpaceOnCurPage = yPageSize - 2 * SixLinesPerInch; // Allow for continue message and blank line. + //ySpaceOnCurPage = yPageSize; // Allow for continue message and blank line. + //DocStyle docstyle = MyItemInfo.MyDocStyle; + //string myMsg = docstyle.Continue.Bottom.Message; + //if ((myMsg ?? "") != "") ySpaceOnCurPage -= 2 * SixLinesPerInch; // Allow for continue message and blank line. yLowerLimit = ySpaceOnCurPage / 2; if(_Match16BitPagination)yLowerLimit -= 1.5F * SixLinesPerInch; // 276 for HLP yStart = 0; @@ -798,8 +802,9 @@ namespace Volian.Print.Library foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation { // The top of this step will fit onto page (-yLocation < yWithinMargins) - if (-yLocation < yUpperLimit) - //if (-yLocation < yWithinMargins && myList[stepLevel][yLocation].MyItemInfo.MyPrevious != null) + if (-yLocation <= yUpperLimit) // Fix for OFN-RJ-23 + //if (-yLocation < yUpperLimit) // Before + //if (-yLocation < yWithinMargins && myList[stepLevel][yLocation].MyItemInfo.MyPrevious != null) { //ItemInfo prev = myList[stepLevel][yLocation].MyItemInfo.MyPrevious; //if (myList[stepLevel][yLocation].MyItemInfo.ItemID == 5609) Console.WriteLine("aer"); @@ -892,11 +897,10 @@ namespace Volian.Print.Library if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab) yoff += SetHeader(this, cb, itemInfo, formatInfo); YOffset = yoff; - if (itemInfo.IsRNOPart) { // there may be other places that double space, but this supports it for RNOs (the DoubleRNOspace flag) - if (rnoLevel > maxRNO && itemInfo.FormatStepData.DoubleSpace) yoff = YOffset = yoff + SixLinesPerInch; + if (rnoLevel > 1 && itemInfo.FormatStepData.DoubleSpace) yoff = YOffset = yoff + SixLinesPerInch; } AddMacros(itemInfo, mytab); if (mytab != null)