diff --git a/PROMS/Volian.Print.Library/PDFReport.cs b/PROMS/Volian.Print.Library/PDFReport.cs index 8a6744f8..c5c96d3c 100644 --- a/PROMS/Volian.Print.Library/PDFReport.cs +++ b/PROMS/Volian.Print.Library/PDFReport.cs @@ -6,7 +6,6 @@ using iTextSharp.text.pdf; using iTextSharp.text; using System.IO; using System.Text.RegularExpressions; -//using Volian.Generic; namespace Volian.Print.Library { @@ -72,6 +71,7 @@ namespace Volian.Print.Library private string _RODataFile = ""; private List _ROList; private ROFSTLookup _ROFSTLookup; + private bool _IncludeMissingROs = false; // Search Results Report public PDFReport(string reportTitle, string typesSelected, ICollection resultList, string fileName) @@ -96,7 +96,7 @@ namespace Volian.Print.Library } // Transition and RO Usage - public PDFReport(string reportTitle, ICollection resultList, string fileName, bool sortUsageByProcedure) + public PDFReport(string reportTitle, ICollection resultList, string fileName, bool sortUsageByProcedure, bool includeMissingROs) { _ResultList = resultList; _FileName = fileName; @@ -104,6 +104,7 @@ namespace Volian.Print.Library _ReportType = (int)ReportType.ReferencedObjectsUsage; _ByLine = "Generated By PROMS"; _SortUsageByProcedure = sortUsageByProcedure; + _IncludeMissingROs = includeMissingROs; } // RO Complete Report @@ -830,12 +831,18 @@ namespace Volian.Print.Library // rotitle += roTitleList[cnt] + "\n "; //} rotitle = GetROTitleAndGroup(roKey, itm); - PdfPCell ROTitleCell = new PdfPCell(new Phrase(rotitle, f2)); - ROTitleCell.Colspan = 2; - ROTitleCell.HorizontalAlignment = Element.ALIGN_LEFT; - ROTitleCell.BackgroundColor = new Color(0xDC, 0xE7, 0xC9); //new Color(0xD0, 0xF0, 0xD0);//ligt green //new Color(0xC8, 0xC8, 0x91);//(0xAF, 0xD8, 0xD8);//(0xF5, 0xE4, 0xA0); - //curTable.AddCell(ROTitleCell); // put RO value and description - rotable.AddCell(ROTitleCell); // put RO value and description + if (rotitle != null && rotitle != "") + { + PdfPCell ROTitleCell = new PdfPCell(new Phrase(rotitle, f2)); + ROTitleCell.Colspan = 2; + ROTitleCell.HorizontalAlignment = Element.ALIGN_LEFT; + if (rotitle.StartsWith("Missing RO")) + ROTitleCell.BackgroundColor = Color.PINK; + else + ROTitleCell.BackgroundColor = new Color(0xDC, 0xE7, 0xC9); //new Color(0xD0, 0xF0, 0xD0);//ligt green //new Color(0xC8, 0xC8, 0x91);//(0xAF, 0xD8, 0xD8);//(0xF5, 0xE4, 0xA0); + //curTable.AddCell(ROTitleCell); // put RO value and description + rotable.AddCell(ROTitleCell); // put RO value and description + } } string stepnum = ""; string sectitle = itm.ActiveSection.DisplayText; @@ -1082,20 +1089,20 @@ namespace Volian.Print.Library } } - private void PutStepListForProcedure(PdfPTable rotable, SortedDictionary sortedStepList) + private void PutStepListForProcedure(PdfPTable rotable, SortedDictionary sortedStepList) { iTextSharp.text.Font f2 = pdf.GetFont("Arial Unicode MS", 10, 0, Color.BLACK); - foreach (string stepnum in sortedStepList.Keys) + foreach (ItemInfo itm in sortedStepList.Values) { + string stepnum = (itm.IsSection)? itm.MyActiveSection.DisplayNumber:stepnum = BuildStepTab(itm); AddCell(rotable, stepnum, f2, Color.WHITE); - AddCell(rotable, sortedStepList[stepnum], f2, Color.WHITE); + AddCell(rotable, itm.DisplayText, f2, Color.WHITE); } sortedStepList.Clear(); } private void PutROusageForROID(PdfPTable curTable, SortedDictionary> procRoUse, float[] headerwidths) { - SortedDictionary sortedStepList = new SortedDictionary(); - //if (rosused.Count == 0) return; // nothing to process + SortedDictionary sortedStepList = new SortedDictionary(); iTextSharp.text.Font f2 = pdf.GetFont("Arial Unicode MS", 10, 0, Color.BLACK); string lastProcKey = ""; string lastProcNumTitle = ""; @@ -1108,7 +1115,6 @@ namespace Volian.Print.Library if (procKey != lastProcKey) { if (sortedStepList.Count > 0) PutStepListForProcedure(rotable, sortedStepList); - //string procNumTitleSect = GetCurProcNum(itm.SearchPath) + "\r\n " + GetCurSectionNumTitle(itm); string procNumTitleSect = ""; curProcNumTitle = GetCurProcNum(itm.SearchPath); if (lastProcNumTitle == "" || lastProcNumTitle != curProcNumTitle) @@ -1126,15 +1132,10 @@ namespace Volian.Print.Library rotable.AddCell(ProcTitleCell); // put RO value and description lastProcKey = procKey; } - string stepnum = ""; - string sectitle = itm.ActiveSection.DisplayText; - if (itm.IsSection) - stepnum = itm.MyActiveSection.DisplayNumber; - else - stepnum = BuildStepTab(itm);//GetStepNumberFromSearchPath(itm.SearchPath);//stepnum.Substring(itm.SearchPath.LastIndexOf(sectitle) + sectitle.Length +1); - sortedStepList.Add(stepnum, itm.DisplayText); - //AddCell(rotable, stepnum, f2, Color.WHITE); - //AddCell(rotable, itm.DisplayText, f2, Color.WHITE); + string stepnum = (itm.IsSection)?itm.MyActiveSection.DisplayNumber:BuildStepTab(itm); + string itemkey = stepnum + " " + itm.ItemID.ToString(); // add ItemId to stepnum, sometimes we have idential stepnum text for different steps (ex: blank section numbers) + if (!sortedStepList.ContainsKey(itemkey)) + sortedStepList.Add(itemkey, itm); } if (sortedStepList.Count > 0) PutStepListForProcedure(rotable, sortedStepList); curTable.AddCell(rotable); @@ -1146,25 +1147,29 @@ namespace Volian.Print.Library { string rotitle = ""; ROFSTLookup myrofstlookup = (itm == null)? _ROFSTLookup : itm.MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(itm.MyDocVersion); - List roTitleList = myrofstlookup.GetROTitleAndGroupPath(roid); - for (int cnt = 0; cnt < roTitleList.Count; cnt++) - { - if (cnt == roTitleList.Count - 1) - rotitle += roTitleList[cnt]; - else - rotitle += roTitleList[cnt] + "\n "; - } + List roTitleList = myrofstlookup.GetROTitleAndGroupPath(roid,_IncludeMissingROs); + if (roTitleList != null && roTitleList.Count > 0) + for (int cnt = 0; cnt < roTitleList.Count; cnt++) + { + if (cnt == roTitleList.Count - 1) + rotitle += roTitleList[cnt]; + else + rotitle += roTitleList[cnt] + "\n "; + } return rotitle; } private void AddROHeaderGroup(PdfPTable datatable, string curROID, ItemInfo itm, Font f2, Color bgColor) { string headerText = GetROTitleAndGroup(curROID, itm); - if (headerText.Length > 0) + if (headerText != null && headerText.Length > 0) { PdfPCell cell = new PdfPCell(new Phrase(headerText, f2)); cell.Colspan = 2; - cell.BackgroundColor = bgColor; + if (headerText.StartsWith("Missing RO")) + cell.BackgroundColor = Color.PINK; + else + cell.BackgroundColor = bgColor; cell.BorderWidthTop = 1; datatable.AddCell(cell); } @@ -1201,7 +1206,6 @@ namespace Volian.Print.Library AddCell(colHeader, "Text", f2, subHeaderColor); datatable.AddCell(colHeader); datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT; - string lastPath = ""; Color AnnoColor = new Color(0xFF, 0xFF, 0xC0); Color TextColor = Color.WHITE; Color SectColor = new Color(0xE0, 0xFF, 0xE0);//new Color(0xC0, 0xFF, 0xC0);//Color.LIGHT_GRAY; @@ -1320,7 +1324,7 @@ namespace Volian.Print.Library } private List AddROHeaderGroupForSummary(PdfPTable datatable, string curROID,List prevROTitleList, Font f2, Color bgColor) { - List roTitleList = _ROFSTLookup.GetROTitleAndGroupPath(curROID); + List roTitleList = _ROFSTLookup.GetROTitleAndGroupPath(curROID,_IncludeMissingROs); string headerText = GetROTitleAndGroupsForSummary(roTitleList, prevROTitleList); if (headerText.Length > 0) { @@ -1366,7 +1370,7 @@ namespace Volian.Print.Library cell.BorderColor = Color.WHITE; datatable.AddCell(cell); - string roFSTDateTime = "RO.FST Created: " + _ROFSTLookup.GetRoFSTdts().ToLongDateString() + " @ " + _ROFSTLookup.GetRoFSTdts().ToShortTimeString() + "\n "; + string roFSTDateTime = "RO.FST Last Created: " + _ROFSTLookup.GetRoFSTdts().ToLongDateString() + " @ " + _ROFSTLookup.GetRoFSTdts().ToShortTimeString() + "\n "; cell = new PdfPCell(new Phrase(roFSTDateTime, f2)); cell.BorderColor = Color.WHITE; datatable.AddCell(cell);