From 3679bcbae2b6b9d9eaf0e38d1451482916791be6 Mon Sep 17 00:00:00 2001 From: Kathy Date: Fri, 1 Feb 2013 14:56:34 +0000 Subject: [PATCH] --- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 65 ++++++++++++++++--- 1 file changed, 56 insertions(+), 9 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 2bcd2483..1860cd87 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -2294,13 +2294,32 @@ namespace VEPROMS.CSLA.Library // If we have metasections AND... // If the seqtabs for this given level does not get a section number, use the seqtab rather than // the ident of the step: + bool useSubStepTabs = false; if (doMeta && IsHigh && !seqtabs[(localPrintLevel<0?0:localPrintLevel) % seqtabs.Count].TabToken.Contains("{numericWpar}")) useSubStepTabs = true; + + // Check to be sure the parent tab should be included... If this sequential is within a note + // or caution or equipment list, don't use parent tab AND always start the numbering as a numeric + if (doMeta && IsSequential && (InNote() || InCaution() || MyParent.IsEquipmentList)) + { + // if immediate parent is note, caution or equip, use numeric, otherwise use alpha. + localPrintLevel = 0; + int lv = 0; + ItemInfo ii = MyParent; + while (!ii.IsCaution && !ii.IsNote && !ii.IsEquipmentList) + { + lv++; + ii = ii.MyParent; + } + lv = lv % 2; + tbformat = (lv == 0) ? "{numeric}." : "{alpha}."; + } + if (useSubStepTabs || tbformat.IndexOf("{seq}") > -1) { int itmp = (localPrintLevel + PrintBias) % seqtabs.Count; - if (!tbformat.Contains("C0")) - tbformat = seqtabs[itmp].PrintTabFormat; // seqtab in 16bit, i.e. '. or )' etc. + if (!tbformat.Contains(@"{!C")) + tbformat = seqtabs[itmp].PrintTabFormat; // seqtab in 16bit, i.e. '. or )' etc. else tbformat = tbformat.Replace("{seq}", seqtabs[itmp].PrintTabFormat); string tbtoken = seqtabs[localPrintLevel % seqtabs.Count].TabToken; // seqstart in 16bit, number/letter @@ -2312,7 +2331,8 @@ namespace VEPROMS.CSLA.Library // -1 (the printlevel property calculates the value only if the current value == 0, // so that when the above code ran to reset the tab, it would crash because the // printlevel was not recalculated. - PrintLevel = 0; + PrintLevel = 0; + // If token includes 'Wpar', the parent tab prefix's the tab. if (localPrintLevel > 0 && (tbformat.IndexOf("{numericWpar}") > -1 || tbformat.IndexOf("{alphaWpar}") > -1 || tbformat.IndexOf("{ALPHAWpar}") > -1)) { @@ -2323,12 +2343,15 @@ namespace VEPROMS.CSLA.Library myparent = myparent.ActiveParent as ItemInfo; if (myparent.MyTab.CleanText.Trim() == "") { - if ((myparent.ActiveParent as ItemInfo).MyTab.CleanText.Trim() != "") + if ((myparent.ActiveParent as ItemInfo).MyTab.CleanText.Trim() != "") myparent = myparent.ActiveParent as ItemInfo; } } - parentTab = myparent.MyTab.CleanText.Trim(); - tbformat = parentTab + (parentTab.EndsWith(".") ? "" : ".") + tbformat.TrimStart(); + else if (myparent.IsSection || myparent.IsHigh || myparent.IsSequential) + { + parentTab = myparent.MyTab.CleanText.Trim(); + tbformat = parentTab + (parentTab.EndsWith(".") ? "" : ".") + tbformat.TrimStart(); + } } if (tbformat.IndexOf("#2#") > -1 || tbformat.IndexOf("#1#") > -1) { @@ -2362,12 +2385,12 @@ namespace VEPROMS.CSLA.Library tbformat = tbformat.Replace("{numeric}", trimTabStart ? ordinal.ToString() : ordinal.ToString().PadLeft(2)); tbformat = tbformat.Replace("{numericWpar}", ordinal.ToString()); tbformat = tbformat.Replace("{asterisk}", "*"); - if (tbformat.IndexOf("{!C0}") > -1) + int macroindx = tbformat.IndexOf("{!C"); + if (macroindx > -1) { - cltext = cltext == null ? tbformat.Replace("{!C0}", "") : cltext.Replace("{!C0}", ""); + cltext = cltext == null ? tbformat.Remove(macroindx, 5) : cltext.Remove(macroindx, 5); cltext = cltext + " "; } - // "{Null}" was introduced so that inheritance in format files could differentiate between an // empty string, and null. And also, so that if a tab was null but it's parent had text in the // tab, don't inherit the parent's tab, use a null. @@ -2415,6 +2438,30 @@ namespace VEPROMS.CSLA.Library _MyTab.CleanText = cltext != null ? cltext : tbformat; } + private bool InCaution() + { + // walk up until procedure level and if finding a caution type, return true, otherwise false. + ItemInfo ii = this.MyParent; + while (ii != null && !ii.IsProcedure) + { + if (ii.IsCaution) return true; + ii = ii.MyParent; + } + return false; + } + + private bool InNote() + { + // walk up until procedure level and if finding a note type, return true, otherwise false. + ItemInfo ii = this.MyParent; + while (ii != null && !ii.IsProcedure) + { + if (ii.IsNote) return true; + ii = ii.MyParent; + } + return false; + } + private string GetToken(string tbformat) { int stindx = tbformat.IndexOf("{");