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); PdfPTable rotable = new PdfPTable(headerwidths);
foreach (ItemInfo itm in procRoUse[procKey]) foreach (ItemInfo itm in procRoUse[procKey])
{ {
bool didProcSetTitle = false;
// Check Doc Version path // Check Doc Version path
// where we are reporting on more than one procedure set // where we are reporting on more than one procedure set
// output the procedure set title within the RO value grouping on the report // output the procedure set title within the RO value grouping on the report
if (moreThanOneProcSet && lastDVPath != itm.SearchDVPath) if (moreThanOneProcSet && lastDVPath != itm.SearchDVPath)
{
AddMainPathGroup(curTable, itm.SearchDVPath, splitAt, f2, Color.LIGHT_GRAY, 0); AddMainPathGroup(curTable, itm.SearchDVPath, splitAt, f2, Color.LIGHT_GRAY, 0);
didProcSetTitle = true;
}
else
didProcSetTitle = false;
lastDVPath = itm.SearchDVPath; lastDVPath = itm.SearchDVPath;
if (procKey != lastProcKey) if (didProcSetTitle || procKey != lastProcKey)
{ {
if (sortedStepList.Count > 0) PutStepListForProcedure(rotable, sortedStepList); if (sortedStepList.Count > 0) PutStepListForProcedure(rotable, sortedStepList);
string procNumTitleSect = ""; string procNumTitleSect = "";
@ -1023,7 +1029,7 @@ namespace Volian.Print.Library
BuildSearchResultsProcSetList(); BuildSearchResultsProcSetList();
datatable.HeaderRows = 2;//3 + (ProcSetList.Count == 1 ? 1 : 0); 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 Color subHeaderColor = new Color(0xD0, 0xF0, 0xF0); // light blue //new Color(0xD0, 0xF0, 0xD0);//ligt green
datatable.DefaultCell.Padding = 4; datatable.DefaultCell.Padding = 4;
@ -1042,42 +1048,62 @@ namespace Volian.Print.Library
string lastROID = ""; string lastROID = "";
bool moreThanOneProcSet = false; bool moreThanOneProcSet = false;
bool printedSetTitle = false; bool printedSetTitle = false;
bool printedROHeader = false;
ItemInfo lastItem = null; 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) foreach (ItemInfo item in _ResultList)
{ {
bool differentProcSet = false;
bool differentRO = false;
// Check Doc Version path // Check Doc Version path
// if more than one procedure set is in the report data, then // 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 // 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 // otherwise, if we are reporting on only one procedure set, print the
// procedure set title at the top of the report (once). // procedure set title at the top of the report (once).
if (lastDVPath != "" && lastDVPath != item.SearchDVPath) if (lastDVPath != "" && lastDVPath != item.SearchDVPath)
{
moreThanOneProcSet = true; moreThanOneProcSet = true;
differentProcSet = true;
}
lastDVPath = item.SearchDVPath; lastDVPath = item.SearchDVPath;
// Check for different ROID // Check for different ROID
string curROID = item.FoundROID; 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) if (!moreThanOneProcSet && !printedSetTitle)
{ {
AddMainPathGroup(datatable, lastDVPath, splitAt, f2, Color.LIGHT_GRAY, 0); AddMainPathGroup(datatable, lastDVPath, splitAt, f2, Color.LIGHT_GRAY, 0);
printedSetTitle = true; 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); PutROusageForROID(datatable, procRoUse, headerwidths, splitAt, moreThanOneProcSet);
procRoUse.Clear(); procRoUse.Clear();
} differentProcSet = false;
//AddROHeaderGroup(datatable, curROID, item, f2, new Color(0xC0, 0xFF, 0xC0));
} }
if (differentRO)
printedROHeader = false;
AddProcROUse(item, procRoUse); AddProcROUse(item, procRoUse);
lastROID = curROID; lastROID = curROID;
lastItem = item; lastItem = item;
} }
if (!moreThanOneProcSet && !printedSetTitle) if (!moreThanOneProcSet && !printedSetTitle)
AddMainPathGroup(datatable, lastDVPath, splitAt, f2, Color.LIGHT_GRAY, 0); 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); PutROusageForROID(datatable, procRoUse, headerwidths, splitAt, moreThanOneProcSet);
document.Add(datatable); document.Add(datatable);
} }