The RO Usage Report was getting confused when the report was generated for more than one procedure set and the same RO was used in both sets in procedures of the same number.

This commit is contained in:
John Jenko 2015-05-05 19:55:08 +00:00
parent 5a27f169d5
commit 8aa4f92011

View File

@ -933,14 +933,20 @@ namespace Volian.Print.Library
PdfPTable rotable = new PdfPTable(headerwidths);
foreach (ItemInfo itm in procRoUse[procKey])
{
bool didProcSetTitle = false;
// 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);
didProcSetTitle = true;
}
else
didProcSetTitle = false;
lastDVPath = itm.SearchDVPath;
if (procKey != lastProcKey)
if (didProcSetTitle || procKey != lastProcKey)
{
if (sortedStepList.Count > 0) PutStepListForProcedure(rotable, sortedStepList);
string procNumTitleSect = "";
@ -1023,7 +1029,7 @@ namespace Volian.Print.Library
BuildSearchResultsProcSetList();
datatable.HeaderRows = 2;//3 + (ProcSetList.Count == 1 ? 1 : 0);
int splitAt = FindSpitLevel(); // find the split level of the common path - for all procedure sets that use these library documents
int splitAt = FindSpitLevel(); // find the split level of the common path
Color subHeaderColor = new Color(0xD0, 0xF0, 0xF0); // light blue //new Color(0xD0, 0xF0, 0xD0);//ligt green
datatable.DefaultCell.Padding = 4;
@ -1042,42 +1048,62 @@ namespace Volian.Print.Library
string lastROID = "";
bool moreThanOneProcSet = false;
bool printedSetTitle = false;
bool printedROHeader = false;
ItemInfo lastItem = null;
if (_ResultList.Count == 0)
{
PdfPCell cell2 = new PdfPCell(new Phrase("Selected RO is not used", f2));
cell2.Colspan = 0;
cell2.BorderWidthTop = 1;
datatable.AddCell(cell2);
document.Add(datatable);
return;
}
foreach (ItemInfo item in _ResultList)
{
bool differentProcSet = false;
bool differentRO = false;
// Check Doc Version path
// 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;
differentProcSet = true;
}
lastDVPath = item.SearchDVPath;
// Check for different ROID
string curROID = item.FoundROID;
if (lastROID == "" || curROID.Substring(0, 12) != lastROID.Substring(0, 12))
differentRO = lastROID != "" && curROID.Substring(0, 12) != lastROID.Substring(0, 12);
if (procRoUse.Count > 0 && (differentProcSet || differentRO))
{
if (lastROID != "" && procRoUse.Count > 0)
{
if (!moreThanOneProcSet && !printedSetTitle)
{
AddMainPathGroup(datatable, lastDVPath, splitAt, f2, Color.LIGHT_GRAY, 0);
printedSetTitle = true;
}
AddROHeaderGroup(datatable, curROID, item, f2, new Color(0xC0, 0xFF, 0xC0));
if (!printedROHeader)
{
AddROHeaderGroup(datatable, lastROID, lastItem, f2, new Color(0xC0, 0xFF, 0xC0));
printedROHeader = true;
}
PutROusageForROID(datatable, procRoUse, headerwidths, splitAt, moreThanOneProcSet);
procRoUse.Clear();
}
//AddROHeaderGroup(datatable, curROID, item, f2, new Color(0xC0, 0xFF, 0xC0));
differentProcSet = false;
}
if (differentRO)
printedROHeader = false;
AddProcROUse(item, procRoUse);
lastROID = curROID;
lastItem = item;
}
if (!moreThanOneProcSet && !printedSetTitle)
AddMainPathGroup(datatable, lastDVPath, splitAt, f2, Color.LIGHT_GRAY, 0);
AddROHeaderGroup(datatable, lastROID, lastItem, f2, new Color(0xC0, 0xFF, 0xC0));
if (!printedROHeader)
AddROHeaderGroup(datatable, lastROID, lastItem, f2, new Color(0xC0, 0xFF, 0xC0));
PutROusageForROID(datatable, procRoUse, headerwidths, splitAt, moreThanOneProcSet);
document.Add(datatable);
}