diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index ad205f8a..1bcf4106 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -200,6 +200,7 @@ namespace Volian.Print.Library //} public override void OnEndPage(PdfWriter writer, iTextSharp.text.Document document) { + InitialsPrinted = false; MyPromsPrinter.OnStatusChanged(string.Format("Page {0}", CurrentPageNumber+1)); bool onBlankPage = OnBlankPage; if (OnBlankPage) @@ -886,6 +887,8 @@ namespace Volian.Print.Library mySvg.LeftMargin = (float)docStyle.Layout.LeftMargin; mySvg.TopMargin = 9.6F; VEPROMS.CSLA.Library.PageStyle pageStyle = docStyle.pagestyle; + HasInitials = false; + PIInitials = null; AddPageListItems(mySvg, pageStyle, mySection, forceLoad); mySvg.ProcessText += new SvgProcessTextEvent(mySvg_ProcessText); // if this section had a previous section and this is continuous, don't generate the svg for @@ -1693,11 +1696,24 @@ namespace Volian.Print.Library // For Calvert: if this section has checkoffs turned on, put out this pagelist item: // Get SectionInfos to access specific section config items... //SectionInfo si = SectionInfo.Get(MySection.ItemID); - SectionInfo si = MySection.GetSectionInfo(); - SectionConfig sectCfg = si.MyConfig as SectionConfig; - int sc = sectCfg.Section_CheckoffListSelection; - if (sc < 2 && !si.HasStepCheckOffs) plstr = plstr.Replace(token, ""); - else plstr = plstr.Replace(token, "INITIALS"); + //SectionInfo si = MySection.GetSectionInfo(); + //SectionConfig sectCfg = si.MyConfig as SectionConfig; + //int sc = sectCfg.Section_CheckoffListSelection; + if (!MySection.HasInitials) + { + plstr = plstr.Replace(token, ""); + //PIInitials = pageItem; + } + else + { + if (pageItem.Row == -MySection.MyDocStyle.Layout.TopMargin) + { + plstr = plstr.Replace(token, ""); + PIInitials = pageItem; + } + else + plstr = plstr.Replace(token, "INITIALS"); + } break; case "{REVUNIT}": // copied from 16bit's pagelist.cs for BGE: @@ -1860,7 +1876,42 @@ namespace Volian.Print.Library } return plstr; } - + private PageItem _PIInitials = null; + public PageItem PIInitials + { + get { return _PIInitials; } + set + { + if (_PIInitials != null && value == null) + _LastPIInitials = _PIInitials; + _PIInitials = value; + } + } + private PageItem _LastPIInitials = null; + public PageItem LastPIInitials + { + get { return _LastPIInitials; } + set { _LastPIInitials = value; } + } + private bool _HasInitials = false; + public bool HasInitials + { + get { return _HasInitials; } + set { _HasInitials = value; } + } + private bool _InitialsPrinted = false; + public bool InitialsPrinted + { + get { return _InitialsPrinted; } + set { _InitialsPrinted = value; } + } + public bool PrintInitials(PdfContentByte cb,float yLocation, float leftMargin) + { + if (InitialsPrinted) return false; + InitialsPrinted = true; + vlnParagraph.TextAt(cb,this, PIInitials ?? LastPIInitials, yLocation, leftMargin); + return true; + } private void DoSpecialSectNumTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match, string plstr) { // first add anything up to the "@@" to the svgGroup: diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 8642195e..c0d8fb41 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -818,8 +818,52 @@ namespace Volian.Print.Library { // pagination logic needs to be fixed. ForcePagination(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation, ref retval); } + else + { + if (MyItemInfo.IsStepSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && (MyItemInfo.ActiveSection as SectionInfo).HasInitials) + { + if (MyPageHelper.PrintInitials(cb,yLocation,(float) MyItemInfo.MyDocStyle.Layout.LeftMargin)) + { + //if(yLocation != yTopMargin) + // Console.WriteLine("'{0}',{1},'{2}',{3},{4},{5},{6}", MyItemInfo.MyProcedure.DisplayNumber, MyItemInfo.ItemID + // , MyItemInfo.DisplayNumber, yLocation,yTopMargin,MyItemInfo.HasCautionOrNote,MyPageHelper.CurrentPageNumber+1); + } + } + } return retval; } + public static void TextAt(PdfContentByte cb,VlnSvgPageHelper myPageHelper,PageItem pi,float yloc, float leftMargin) + { + System.Drawing.Color sysColor = PrintOverride.OverrideSvgColor(System.Drawing.Color.Black); + cb.SaveState(); + if (myPageHelper.PageListLayer != null) cb.BeginLayer(myPageHelper.PageListLayer); + ColumnText ct = new ColumnText(cb); + iTextSharp.text.Font font; + int fontStyle = 0; + bool underline = false; + if (pi == null) + { + _MyLog.WarnFormat("Error in Initials"); + ct.SetSimpleColumn(450 + leftMargin, yloc + 6.9F, 550 + leftMargin, yloc - 50); + font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 10F); + } + else + { + ct.SetSimpleColumn((float)pi.Col + leftMargin, yloc + 6.9F, (float)pi.Col + 100 + leftMargin, yloc - 50); + fontStyle = (pi.Font.WindowsFont.Bold ? iTextSharp.text.Font.BOLD : 0) + (pi.Font.WindowsFont.Italic ? iTextSharp.text.Font.ITALIC : 0); + font = FontFactory.GetFont(pi.Font.Family, BaseFont.IDENTITY_H, BaseFont.EMBEDDED,(float) pi.Font.Size,fontStyle); + underline = pi.Font.WindowsFont.Underline; + } + Chunk chk = new Chunk("INITIALS", font); + if(underline) + chk.SetUnderline(new iTextSharp.text.Color(sysColor), 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size + Phrase ph = new Phrase(chk); + ct.AddElement(ph); + cb.SetColorFill(new iTextSharp.text.Color(sysColor)); + ct.Go(); + if (myPageHelper.PageListLayer != null) cb.EndLayer(); + cb.RestoreState(); + } private bool _PrintHeader = false; public bool PrintHeader { @@ -4270,9 +4314,7 @@ namespace Volian.Print.Library // For Calvert STP/OP: see if this section has checkoffs by looking in the section config: //SectionInfo si= SectionInfo.Get(itemInfo.ActiveSection.ItemID); SectionInfo si = itemInfo.ActiveSection.GetSectionInfo(); - SectionConfig sectCfg = si.MyConfig as SectionConfig; - int sc = sectCfg.Section_CheckoffListSelection; - ChkOff = (sc >= 2) || si.HasStepCheckOffs; + ChkOff = si.HasInitials; } if (ChkOff) {