diff --git a/PROMS/Volian.Print.Library/PDFReport.cs b/PROMS/Volian.Print.Library/PDFReport.cs index ebd54e6c..fc768cde 100644 --- a/PROMS/Volian.Print.Library/PDFReport.cs +++ b/PROMS/Volian.Print.Library/PDFReport.cs @@ -920,18 +920,26 @@ namespace Volian.Print.Library } sortedStepList.Clear(); } - private void PutROusageForROID(PdfPTable curTable, SortedDictionary> procRoUse, float[] headerwidths) + private void PutROusageForROID(PdfPTable curTable, SortedDictionary> procRoUse, float[] headerwidths, int splitAt , bool moreThanOneProcSet) { SortedDictionary sortedStepList = new SortedDictionary(); iTextSharp.text.Font f2 = pdf.GetFont("Arial Unicode MS", 10, 0, Color.BLACK); string lastProcKey = ""; string lastProcNumTitle = ""; + string lastDVPath = ""; string curProcNumTitle = ""; foreach (string procKey in procRoUse.Keys) { PdfPTable rotable = new PdfPTable(headerwidths); foreach (ItemInfo itm in procRoUse[procKey]) { + // Check Doc Version path + // where we are reporting on more than one procedure set + // output the procedure set title within the RO value grouping on the report + if (moreThanOneProcSet && lastDVPath != itm.SearchDVPath) + AddMainPathGroup(curTable, itm.SearchDVPath, splitAt, f2, Color.LIGHT_GRAY, 0); + lastDVPath = itm.SearchDVPath; + if (procKey != lastProcKey) { if (sortedStepList.Count > 0) PutStepListForProcedure(rotable, sortedStepList); @@ -1032,14 +1040,18 @@ namespace Volian.Print.Library datatable.AddCell(subTable); string lastDVPath = ""; string lastROID = ""; + bool moreThanOneProcSet = false; + bool printedSetTitle = false; + ItemInfo lastItem = null; foreach (ItemInfo item in _ResultList) { // Check Doc Version path - if (lastDVPath != item.SearchDVPath) - { - subTable = new PdfPTable(headerwidths); - AddMainPathGroup(datatable, item.SearchDVPath, splitAt, f2, Color.LIGHT_GRAY, 0); - } + // if more than one procedure set is in the report data, then + // we will output the procedure set title inside the grouping of each RO + // otherwise, if we are reporting on only one procedure set, print the + // procedure set title at the top of the report (once). + if (lastDVPath != "" && lastDVPath != item.SearchDVPath) + moreThanOneProcSet = true; lastDVPath = item.SearchDVPath; // Check for different ROID @@ -1048,15 +1060,25 @@ namespace Volian.Print.Library { if (lastROID != "" && procRoUse.Count > 0) { - PutROusageForROID(datatable, procRoUse, headerwidths); + if (!moreThanOneProcSet && !printedSetTitle) + { + AddMainPathGroup(datatable, lastDVPath, splitAt, f2, Color.LIGHT_GRAY, 0); + printedSetTitle = true; + } + AddROHeaderGroup(datatable, curROID, item, f2, new Color(0xC0, 0xFF, 0xC0)); + PutROusageForROID(datatable, procRoUse, headerwidths, splitAt, moreThanOneProcSet); procRoUse.Clear(); } - AddROHeaderGroup(datatable, curROID, item, f2, new Color(0xC0, 0xFF, 0xC0)); + //AddROHeaderGroup(datatable, curROID, item, f2, new Color(0xC0, 0xFF, 0xC0)); } AddProcROUse(item, procRoUse); lastROID = curROID; + lastItem = item; } - PutROusageForROID(datatable, procRoUse, headerwidths); + if (!moreThanOneProcSet && !printedSetTitle) + AddMainPathGroup(datatable, lastDVPath, splitAt, f2, Color.LIGHT_GRAY, 0); + AddROHeaderGroup(datatable, lastROID, lastItem, f2, new Color(0xC0, 0xFF, 0xC0)); + PutROusageForROID(datatable, procRoUse, headerwidths, splitAt, moreThanOneProcSet); document.Add(datatable); }