C2019-013 put sorted by information on the Search Results report
C2020-019 display the section number and Title for step sections on the Search Results report
This commit is contained in:
parent
0078020e60
commit
a89fad3eaf
@ -59,6 +59,12 @@ namespace Volian.Print.Library
|
|||||||
get { return _SearchString; }
|
get { return _SearchString; }
|
||||||
set { _SearchString = VEPROMS.CSLA.Library.ItemInfo.ConvertToDisplayText(value); }
|
set { _SearchString = VEPROMS.CSLA.Library.ItemInfo.ConvertToDisplayText(value); }
|
||||||
}
|
}
|
||||||
|
private string _SortedBy; // C2019-013 pass in sorting information
|
||||||
|
public string SortedBy
|
||||||
|
{
|
||||||
|
get { return _SortedBy; }
|
||||||
|
set { _SortedBy = value; }
|
||||||
|
}
|
||||||
private DocumentInfoList _LibDocList;
|
private DocumentInfoList _LibDocList;
|
||||||
public DocumentInfoList LibDocList
|
public DocumentInfoList LibDocList
|
||||||
{
|
{
|
||||||
@ -77,7 +83,7 @@ namespace Volian.Print.Library
|
|||||||
|
|
||||||
private string _PaperSize = "Letter"; // C2020-002 paper size is now set in the format files
|
private string _PaperSize = "Letter"; // C2020-002 paper size is now set in the format files
|
||||||
// Search Results Report
|
// Search Results Report
|
||||||
public PDFReport(string reportTitle, string typesSelected, ICollection<ItemInfo> resultList, string fileName, string paperSize)
|
public PDFReport(string reportTitle, string typesSelected, ICollection<ItemInfo> resultList, string fileName, string paperSize, string sortedBy)
|
||||||
{
|
{
|
||||||
_ResultList = resultList;
|
_ResultList = resultList;
|
||||||
_FileName = fileName;
|
_FileName = fileName;
|
||||||
@ -86,6 +92,7 @@ namespace Volian.Print.Library
|
|||||||
_ReportType = (int)ReportType.SearchResults;
|
_ReportType = (int)ReportType.SearchResults;
|
||||||
_ByLine = "PROMS Search Results";
|
_ByLine = "PROMS Search Results";
|
||||||
_PaperSize = paperSize;
|
_PaperSize = paperSize;
|
||||||
|
_SortedBy = sortedBy; // C2019--13 pass in sorted by information
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,9 +274,12 @@ namespace Volian.Print.Library
|
|||||||
private string GetCurSectionNumTitle(ItemInfo itm)
|
private string GetCurSectionNumTitle(ItemInfo itm)
|
||||||
{
|
{
|
||||||
string rtnstr = "";
|
string rtnstr = "";
|
||||||
rtnstr = itm.ActiveSection.DisplayNumber;
|
if (itm.ActiveSection != null)
|
||||||
if (rtnstr.Length > 0) rtnstr += " ";
|
{
|
||||||
rtnstr += itm.ActiveSection.DisplayText;
|
rtnstr = itm.ActiveSection.DisplayNumber;
|
||||||
|
if (rtnstr.Length > 0) rtnstr += " ";
|
||||||
|
rtnstr += itm.ActiveSection.DisplayText;
|
||||||
|
}
|
||||||
return rtnstr; // srting containing section and subsection number/titles
|
return rtnstr; // srting containing section and subsection number/titles
|
||||||
}
|
}
|
||||||
//private string GetStepNumberFromSearchPath(string path)
|
//private string GetStepNumberFromSearchPath(string path)
|
||||||
@ -505,19 +515,20 @@ namespace Volian.Print.Library
|
|||||||
iTextSharp.text.Font f3 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 12, 0, Color.BLACK);
|
iTextSharp.text.Font f3 = pdf.GetFont(Volian.Base.Library.vlnFont.ReportsFont, 12, 0, Color.BLACK);
|
||||||
PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, f1));
|
PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, f1));
|
||||||
cell.HorizontalAlignment = Element.ALIGN_CENTER;
|
cell.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||||
cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0);
|
cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0); // light cyan
|
||||||
datatable.AddCell(cell);
|
datatable.AddCell(cell);
|
||||||
cell = new PdfPCell(new Phrase(TypesSelected, f3));
|
// C2019-013 add sorted by information if sorting is used
|
||||||
|
cell = new PdfPCell(new Phrase(TypesSelected + ((SortedBy.Length >0)?string.Format("\n{0}",SortedBy):""), f3));
|
||||||
cell.HorizontalAlignment = Element.ALIGN_LEFT;
|
cell.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||||
cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0);
|
cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0); // light cyan
|
||||||
datatable.AddCell(cell);
|
datatable.AddCell(cell);
|
||||||
|
|
||||||
BuildSearchResultsProcSetList();
|
BuildSearchResultsProcSetList();
|
||||||
datatable.HeaderRows = 4 + (ProcSetList.Count == 1 ? 1 : 0);
|
datatable.HeaderRows = 4 + (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 - for all procedure sets that use these library documents
|
||||||
|
|
||||||
Color subHeaderColor = new Color(0xD0, 0xF0, 0xD0);
|
Color subHeaderColor = new Color(0xD0, 0xF0, 0xF0); // new Color(0xD0, 0xF0, 0xD0);
|
||||||
datatable.DefaultCell.Padding = 4;
|
datatable.DefaultCell.Padding = 0; // this removes a white space after the header was set to 4;
|
||||||
datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
|
datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||||
AddCell(colHeader, "Step", f2, subHeaderColor);
|
AddCell(colHeader, "Step", f2, subHeaderColor);
|
||||||
AddCell(colHeader, "Text", f2, subHeaderColor);
|
AddCell(colHeader, "Text", f2, subHeaderColor);
|
||||||
@ -527,12 +538,14 @@ namespace Volian.Print.Library
|
|||||||
//AddCell(datatable, "Text", f2, subHeaderColor);
|
//AddCell(datatable, "Text", f2, subHeaderColor);
|
||||||
datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
|
datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||||
string lastPath = "";
|
string lastPath = "";
|
||||||
Color AnnoColor = new Color(0xFF, 0xFF, 0xC0);
|
Color AnnoColor = new Color(0xFF, 0xFF, 0xC0); // yellow
|
||||||
Color TextColor = Color.WHITE;
|
Color TextColor = Color.WHITE;
|
||||||
Color SectColor = new Color(0xE0, 0xFF, 0xE0);//new Color(0xC0, 0xFF, 0xC0);//Color.LIGHT_GRAY;
|
Color WordSectColor = new Color(0xE8, 0xE8, 0xE8);// light grey
|
||||||
|
Color StepSectColor = new Color(0xE7, 0xFF, 0xE7); // lighter green
|
||||||
PdfPTable subTable = new PdfPTable(headerwidths);
|
PdfPTable subTable = new PdfPTable(headerwidths);
|
||||||
string lastProcNum = "";
|
string lastProcNum = "";
|
||||||
string lastDVPath = "";
|
string lastDVPath = "";
|
||||||
|
string lastSectNumAndTitle = "";
|
||||||
List<int> processedItems = new List<int>();
|
List<int> processedItems = new List<int>();
|
||||||
foreach (ItemInfo item in _ResultList)
|
foreach (ItemInfo item in _ResultList)
|
||||||
{
|
{
|
||||||
@ -543,29 +556,39 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
datatable.AddCell(subTable);
|
datatable.AddCell(subTable);
|
||||||
subTable = new PdfPTable(headerwidths);
|
subTable = new PdfPTable(headerwidths);
|
||||||
AddMainPathGroup(datatable, item.SearchDVPath, splitAt, f2, Color.LIGHT_GRAY, 0);
|
AddMainPathGroup(datatable, item.SearchDVPath, splitAt, f2, new Color(0xB0, 0xF0, 0xF0), 0);// little brighter cyan
|
||||||
datatable.AddCell(colHeader);
|
datatable.AddCell(colHeader);
|
||||||
lastProcNum = "";
|
lastProcNum = "";
|
||||||
|
lastSectNumAndTitle = ""; // C2020-019 reset we are processing a different procedure set
|
||||||
}
|
}
|
||||||
lastDVPath = item.SearchDVPath;
|
lastDVPath = item.SearchDVPath;
|
||||||
string curProcNum = GetCurProcNum(item.SearchPath);
|
string curProcNum = GetCurProcNum(item.SearchPath);
|
||||||
//if (lastProcNum != "" && curProcNum != lastProcNum)
|
if (subTable.Rows.Count > 0) // prevent first page from being blank
|
||||||
//{
|
{
|
||||||
datatable.AddCell(subTable);
|
datatable.AddCell(subTable);
|
||||||
subTable = new PdfPTable(headerwidths);
|
subTable = new PdfPTable(headerwidths);
|
||||||
//}
|
}
|
||||||
|
if (curProcNum != lastProcNum)
|
||||||
|
lastSectNumAndTitle = ""; // C2020-019 reset we are processing a different procedure
|
||||||
lastProcNum = curProcNum;
|
lastProcNum = curProcNum;
|
||||||
// B2020-006: When doing a section, don't remove the last item or the procedure title won't print (if section is only item found w/ search string)
|
// B2020-006: When doing a section, don't remove the last item or the procedure title won't print (if section is only item found w/ search string)
|
||||||
string stepPath = AddGroup(subTable, item.SearchPath ?? item.ShortPath, lastPath, f2, item.IsSection ? false : true, new Color(0xC0, 0xFF, 0xC0), true);
|
string stepPath = AddGroup(subTable, item.SearchPath ?? item.ShortPath, lastPath, f2, item.IsSection ? false : true, new Color(0xC0, 0xFF, 0xC0), true); // light green for procedure number and title
|
||||||
|
// C2020-019 add section number and title if is different from last item and it is not a Word Section (item will be a section if search item was found in a Word section)
|
||||||
|
string curSectNumTitle = GetCurSectionNumTitle(item);
|
||||||
|
if (curSectNumTitle != "" && curSectNumTitle != lastSectNumAndTitle && !item.IsSection)
|
||||||
|
{
|
||||||
|
AddColSpanCell(subTable, curSectNumTitle, f2, StepSectColor, 2, 0);
|
||||||
|
lastSectNumAndTitle = curSectNumTitle;
|
||||||
|
}
|
||||||
lastPath = item.SearchPath ?? item.ShortPath;
|
lastPath = item.SearchPath ?? item.ShortPath;
|
||||||
stepPath = BuildStepTab(item);
|
stepPath = BuildStepTab(item);
|
||||||
AddCell(subTable, stepPath, f2, (item.IsSection ? SectColor : TextColor));
|
AddCell(subTable, stepPath, f2, (item.IsSection ? WordSectColor : TextColor));
|
||||||
// This was for the old 16-bit style of table - jsj 7/7/2011
|
// This was for the old 16-bit style of table - jsj 7/7/2011
|
||||||
//if (item.DisplayText.Contains("|")) // Need a better way to determine if it is a table.
|
//if (item.DisplayText.Contains("|")) // Need a better way to determine if it is a table.
|
||||||
// AddCell(datatable, item.DisplayText, f3, TextColor);
|
// AddCell(datatable, item.DisplayText, f3, TextColor);
|
||||||
//else
|
//else
|
||||||
//AddCell(datatable, item.DisplayText, f2, (item.IsSection ? SectColor : TextColor));
|
//AddCell(datatable, item.DisplayText, f2, (item.IsSection ? SectColor : TextColor));
|
||||||
AddCell(subTable, item.DisplayText, f2, (item.IsSection ? SectColor : TextColor));
|
AddCell(subTable, item.DisplayText, f2, (item.IsSection ? WordSectColor : TextColor));
|
||||||
if (ShowAnnotations && item.ItemAnnotationCount > 0)
|
if (ShowAnnotations && item.ItemAnnotationCount > 0)
|
||||||
{
|
{
|
||||||
foreach (AnnotationInfo ai in item.ItemAnnotations)
|
foreach (AnnotationInfo ai in item.ItemAnnotations)
|
||||||
@ -579,6 +602,7 @@ namespace Volian.Print.Library
|
|||||||
datatable.AddCell(subTable);
|
datatable.AddCell(subTable);
|
||||||
document.Add(datatable);
|
document.Add(datatable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddCell(PdfPTable datatable, string str, iTextSharp.text.Font fnt, Color bgColor)
|
private void AddCell(PdfPTable datatable, string str, iTextSharp.text.Font fnt, Color bgColor)
|
||||||
{
|
{
|
||||||
iTextSharp.text.Font fntBold = new Font(fnt.BaseFont, fnt.Size, Font.BOLD, Color.RED);
|
iTextSharp.text.Font fntBold = new Font(fnt.BaseFont, fnt.Size, Font.BOLD, Color.RED);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user