Changed how DoBeforeTransFlagSupport located replace words string in step text from first location to last location

Added and used new method IncludesParentToHLS to PDFReport to correct how step tab data is displayed in PDF report
This commit is contained in:
Rich 2013-07-25 03:38:16 +00:00
parent 2ef2f898b1
commit 98d8a174fb
2 changed files with 14 additions and 1 deletions

View File

@ -476,7 +476,8 @@ namespace Volian.Controls.Library
string findit = beforeTran.Substring(0, beforeTran.LastIndexOf(@"\v <START]\v0"));
if (findit != null && findit.Trim().ToUpper().EndsWith(repstr.ReplaceWord.ToUpper()))
{
int rindx = findit.Trim().ToUpper().IndexOf(repstr.ReplaceWord.ToUpper());
// int rindx = findit.Trim().ToUpper().IndexOf(repstr.ReplaceWord.ToUpper());
int rindx = findit.Trim().ToUpper().LastIndexOf(repstr.ReplaceWord.ToUpper());
// don't replace string because case of words may be match replace with string.
beforeTran = findit.Substring(0, rindx) + @"\b " + findit.Substring(rindx) + @"\b0" + beforeTran.Substring(indx);
return beforeTran;

View File

@ -877,6 +877,8 @@ namespace Volian.Print.Library
{
StepInfo stpinfo = StepInfo.Get(pitem.ItemID);
string thisTab = stpinfo.MyTab.CleanText; //StepInfo.Get(pitem.ItemID).MyTab.CleanText;
if (IncludesParentToHLS(stpinfo))
return thisTab;
string typeName = stpinfo.FormatStepData.StepEditData.TypeMenu.MenuItem;//stpinfo.FormatStepData.ToString();
// remove delimiters of '.' and ')' in tab.
//if (thisTab != null && !hasDelim)
@ -958,6 +960,16 @@ namespace Volian.Print.Library
return sret;
}
private static bool IncludesParentToHLS(StepInfo stpinfo)
{
if (stpinfo.IsHigh)
return true;
StepInfo parent = StepInfo.Get((stpinfo.ActiveParent as ItemInfo).ItemID);
if (stpinfo.MyTab.CleanText.StartsWith(parent.MyTab.CleanText.Trim()) && stpinfo.MyTab.CleanText.Length > parent.MyTab.CleanText.Length)
return IncludesParentToHLS(parent);
return false;
}
private void BuildROUsageTableByProcedure(iTextSharp.text.Document document)
{
Dictionary<string, List<ItemInfo>> roUse = new Dictionary<string, List<ItemInfo>>();