Add "No Audit Details Available" when entry has no supporting audit details when building Chronology report

Change text in Chronology report to support multi unit text
Added condition to determine when to process content audit info item in Summary report
Added required closing brace
Added condition to determine when to process annotation audit info item in Summary report
Changed how ROFSTLookup value was set to support multi unit
Changed how DocVersionInfo is obtained to support multi unit
Assigns ROFstInfo objects docVer property to support multi unit
This commit is contained in:
Rich 2012-12-04 23:12:19 +00:00
parent 50c04033ac
commit 80ca2a7109
3 changed files with 185 additions and 130 deletions

View File

@ -337,6 +337,17 @@ namespace Volian.Print.Library
//c.Border = borders;
t.AddCell(c);
}
else
{
h = new Phrase();
h.Font = f4;
c = new PdfPCell(h);
h.Add("No Audit Details Available");
c.Colspan = cols - 4;
c.HorizontalAlignment = Element.ALIGN_LEFT;
c.PaddingBottom = paddingBottom;
t.AddCell(c);
}
}
else
{
@ -347,7 +358,39 @@ namespace Volian.Print.Library
else if (cai.Text == oldText && cai.TypeName != oldTypeName)
h.Add(oldTypeName + " to " + cai.TypeName);
else
h.Add(ItemInfo.ConvertToDisplayText(cai.Text));
{
string txt = ItemInfo.ConvertToDisplayText(cai.Text);
if (MyProc.MyDocVersion.MultiUnitCount > 1)
{
System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
xd.LoadXml(cai.Config);
System.Xml.XmlNode nd = xd.SelectSingleNode("//MasterSlave");
if (nd == null)
txt += "\r\n\r\nApplicable to all units";
else
{
nd = nd.Attributes.GetNamedItem("Applicability");
if (nd.InnerText == "0")
txt += "\r\n\r\nApplicable to no units";
else
{
int k = MyProc.MyDocVersion.DocVersionConfig.SelectedSlave;
string[] myss = nd.InnerText.Split(",".ToCharArray());
string un = "\r\n\r\nApplicable to ";
string sep = string.Empty;
foreach (string ss in myss)
{
MyProc.MyDocVersion.DocVersionConfig.SelectedSlave = int.Parse(ss);
un += sep + MyProc.MyDocVersion.DocVersionConfig.Unit_Name;
sep = ",";
}
txt += un;
MyProc.MyDocVersion.DocVersionConfig.SelectedSlave = k;
}
}
}
h.Add(txt);
}
oldText = cai.Text;
oldTypeName = cai.TypeName;
c = new PdfPCell(h);
@ -949,73 +992,76 @@ namespace Volian.Print.Library
List<ContentAuditInfo> auditList = new List<ContentAuditInfo>();
foreach (ContentAuditInfo cai in AuditList)
{
if (cai.ContentID != contentID) //new content
if (MyProc.MyLookup == null || MyProc.MyLookup.ContainsKey(cai.ItemID))
{
if (firstCAI != null) //not first row
if (cai.ContentID != contentID) //new content
{
if (lastCAI == null)
if (firstCAI != null) //not first row
{
auditList.Add(firstCAI);
firstCAI = null;
}
else
{
if (lastCAI.DTS > firstCAI.DTS)
if (lastCAI == null)
{
if (firstCAI.ActionWhat == "Added" && lastCAI.ActionWhat != "Deleted")
auditList.Add(firstCAI);
firstCAI = null;
}
else
{
if (lastCAI.DTS > firstCAI.DTS)
{
if (firstCAI.DTS > MyProc.DTS)
lastCAI.ActionWhat = firstCAI.ActionWhat;
//this step was originally commented out, then jcb un commented it, but we saw a summary report that had 2 added rows
//for the same step which is highly undesirable, so we commented it out again 1/17/2012
//for example we added 2 steps, then make a change to 1st step added
//auditList.Add(firstCAI); //jcb uncommented
if (firstCAI.ActionWhat == "Added" && lastCAI.ActionWhat != "Deleted")
{
if (firstCAI.DTS > MyProc.DTS)
lastCAI.ActionWhat = firstCAI.ActionWhat;
//this step was originally commented out, then jcb un commented it, but we saw a summary report that had 2 added rows
//for the same step which is highly undesirable, so we commented it out again 1/17/2012
//for example we added 2 steps, then make a change to 1st step added
//auditList.Add(firstCAI); //jcb uncommented
auditList.Add(lastCAI);
firstCAI = null;
lastCAI = null;
}
else if (firstCAI.ActionWhat == lastCAI.ActionWhat)
{
auditList.Add(firstCAI);
auditList.Add(lastCAI);
firstCAI = null;
lastCAI = null;
}
else
{
firstCAI = null;
lastCAI = null;
}
}
else if (firstCAI.ActionWhat == "Added" && lastCAI.ActionWhat == "Deleted" && firstCAI.DTS == lastCAI.DTS)
{
//auditList.Add(lastCAI);
firstCAI = null;
lastCAI = null;
}
else if (firstCAI.ActionWhat == "Added" && lastCAI.ActionWhat == "Changed" && firstCAI.DTS > MyProc.DTS)
{
lastCAI.ActionWhat = firstCAI.ActionWhat;
auditList.Add(lastCAI);
firstCAI = null;
lastCAI = null;
}
else if (firstCAI.ActionWhat == lastCAI.ActionWhat)
{
auditList.Add(firstCAI);
auditList.Add(lastCAI);
firstCAI = null;
lastCAI = null;
}
else
{
firstCAI = null;
lastCAI = null;
}
//added by jcb
//else if (firstCAI.ActionWhat == "Added" && lastCAI.ActionWhat == "Changed" && firstCAI.DTS == lastCAI.DTS)
//{
// auditList.Add(firstCAI);
// auditList.Add(lastCAI);
// firstCAI = null;
// lastCAI = null;
//}
}
else if (firstCAI.ActionWhat == "Added" && lastCAI.ActionWhat == "Deleted" && firstCAI.DTS == lastCAI.DTS)
{
//auditList.Add(lastCAI);
firstCAI = null;
lastCAI = null;
}
else if (firstCAI.ActionWhat == "Added" && lastCAI.ActionWhat == "Changed" && firstCAI.DTS > MyProc.DTS)
{
lastCAI.ActionWhat = firstCAI.ActionWhat;
auditList.Add(lastCAI);
firstCAI = null;
lastCAI = null;
}
//added by jcb
//else if (firstCAI.ActionWhat == "Added" && lastCAI.ActionWhat == "Changed" && firstCAI.DTS == lastCAI.DTS)
//{
// auditList.Add(firstCAI);
// auditList.Add(lastCAI);
// firstCAI = null;
// lastCAI = null;
//}
}
firstCAI = cai;
lastCAI = null;
contentID = cai.ContentID;
}
firstCAI = cai;
lastCAI = null;
contentID = cai.ContentID;
else
lastCAI = cai;
}
else
lastCAI = cai;
}
if (lastCAI == null)
{
@ -1074,48 +1120,51 @@ namespace Volian.Print.Library
List<AnnotationAuditInfo> annotationList = new List<AnnotationAuditInfo>();
foreach (AnnotationAuditInfo aai in AnnotationList)
{
if (aai.AnnotationID != annotationID)
if (MyProc.MyLookup == null || MyProc.MyLookup.ContainsKey(aai.ItemID))
{
annotationID = aai.AnnotationID;
if (firstAAI != null)
if (aai.AnnotationID != annotationID)
{
if (lastAAI == null)
annotationID = aai.AnnotationID;
if (firstAAI != null)
{
annotationList.Add(firstAAI);
}
else if (lastAAI.ActionWhat == "Deleted" && firstAAI.DTS < MyProc.DTS)
{
annotationList.Add(lastAAI);
}
else if (lastAAI.ActionWhat == "Changed" && firstAAI.ActionWhat != "Added") // && lastAAI.SearchText != firstAAI.SearchText)
{
annotationList.Add(firstAAI);
annotationList.Add(lastAAI);
}
else if (lastAAI.ActionWhat == "Changed" && firstAAI.ActionWhat == "Added") // && lastAAI.SearchText != firstAAI.SearchText)
{
lastAAI.ActionWhat = firstAAI.ActionWhat;
annotationList.Add(lastAAI);
firstAAI = null;
if (lastAAI == null)
{
annotationList.Add(firstAAI);
}
else if (lastAAI.ActionWhat == "Deleted" && firstAAI.DTS < MyProc.DTS)
{
annotationList.Add(lastAAI);
}
else if (lastAAI.ActionWhat == "Changed" && firstAAI.ActionWhat != "Added") // && lastAAI.SearchText != firstAAI.SearchText)
{
annotationList.Add(firstAAI);
annotationList.Add(lastAAI);
}
else if (lastAAI.ActionWhat == "Changed" && firstAAI.ActionWhat == "Added") // && lastAAI.SearchText != firstAAI.SearchText)
{
lastAAI.ActionWhat = firstAAI.ActionWhat;
annotationList.Add(lastAAI);
firstAAI = null;
lastAAI = null;
}
else if (lastAAI.ActionWhat == "Restored" && firstAAI.ActionWhat == "Added") // && lastAAI.SearchText != firstAAI.SearchText)
{
lastAAI.ActionWhat = firstAAI.ActionWhat;
annotationList.Add(lastAAI);
firstAAI = null;
lastAAI = null;
}
else if (lastAAI == null && firstAAI.ActionWhat == "Added")
{
annotationList.Add(firstAAI);
}
lastAAI = null;
}
else if (lastAAI.ActionWhat == "Restored" && firstAAI.ActionWhat == "Added") // && lastAAI.SearchText != firstAAI.SearchText)
{
lastAAI.ActionWhat = firstAAI.ActionWhat;
annotationList.Add(lastAAI);
firstAAI = null;
lastAAI = null;
}
else if (lastAAI == null && firstAAI.ActionWhat == "Added")
{
annotationList.Add(firstAAI);
}
lastAAI = null;
firstAAI = aai;
}
firstAAI = aai;
else
lastAAI = aai;
}
else
lastAAI = aai;
}
if (firstAAI != null)
{

View File

@ -297,7 +297,11 @@ namespace Volian.Print.Library
{
// Dictionary<string, List<string>> ros = new Dictionary<string, List<string>>();
Dictionary<string, Dictionary<string, bool>> ros = new Dictionary<string, Dictionary<string, bool>>();
ROFSTLookup lu = MyItemInfoList[0].MyDocVersion.DocVersionAssociations[0].MyROFst.ROFSTLookup;
DocVersionInfo dvi = MyItemInfoList[0].MyDocVersion;
ROFstInfo rofst = dvi.DocVersionAssociations[0].MyROFst;
rofst.docVer = dvi;
// ROFSTLookup lu = MyItemInfoList[0].MyDocVersion.DocVersionAssociations[0].MyROFst.ROFSTLookup;
ROFSTLookup lu = rofst.ROFSTLookup;
if (types.ContainsKey(0))
{
foreach (ProcedureInfo pi in MyItemInfoList)

View File

@ -93,7 +93,7 @@ namespace Volian.Print.Library
if (childItemInfo.IsStep && childItemInfo.MyHLS.FormatStepData.UseSmartTemplate && para.ChildrenBelow.Count>0 && para.ChildrenBelow[0].YBottomMost > para.YBottomMost)
yoff = para.ChildrenBelow[0].YBottomMost;
else
yoff = para.YBottomMost;
yoff = para.YBottomMost;
if (childItemInfo.FormatStepData != null && childItemInfo.FormatStepData.BoxIt)
{
box.Height = yoff - box.YOffset - (1.1F * vlnPrintObject.SixLinesPerInch);
@ -145,7 +145,7 @@ namespace Volian.Print.Library
float yLocation = CalculateYOffset(yPageStart, yTopMargin);
if (MyItemInfo.HasChangeBar && MyPageHelper.ChangeBarDefinition.MyChangeBarType != PrintChangeBar.Without) MyPageHelper.AddChangeBar(DoChangeBar(cb, MyItemInfo, MyPageHelper, XOffset, yLocation, MyPageHelper.MaxRNO, MyItemInfo.ActiveFormat), cbMess);
float retval = yLocation;
if (MyItemInfo.IsFigure)
{
yLocation -= (SixLinesPerInch * MyPageHelper.YMultiplier);
@ -174,7 +174,7 @@ namespace Volian.Print.Library
if (MyItemInfo.MyContent.MyGrid != null)
retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation);
else
if (doprint) retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation);
if (doprint)retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation);
if (MyItemInfo.IsHigh)
{
MyPageHelper.PageBookmarks.Add(MyItemInfo, MyItemInfo.MyTab.CleanText + " " + MyItemInfo.DisplayText,
@ -215,7 +215,7 @@ namespace Volian.Print.Library
private void WCN_DrawBoxLines(PdfContentByte cb, ItemInfo ii, float yPageStart, float yTopMargin, float yBottomMargin, float yLocation)
{
if (!ii.IsStep || ii.IsCaution || ii.IsNote) return;
float lpi = MyPageHelper.YMultiplier == 1.0 ? SixLinesPerInch : _SevenLinesPerInch;
bool savedebug = Rtf2Pdf.PdfDebug;
Rtf2Pdf.PdfDebug = false;
@ -467,8 +467,8 @@ namespace Volian.Print.Library
// if this document style has another style that is for pages other than first, we need to
// reset the document style off of this section AND reset docstyle values used.
if ((MyItemInfo.MyActiveSection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnFirstPage) > 0)
{
float _PointsPerPage = 792;
{
float _PointsPerPage = 792;
ItemInfo ii = (ItemInfo)MyItemInfo.MyActiveSection;
int indx = (int)MyItemInfo.MyActiveSection.MyDocStyle.IndexOtherThanFirstPage;
foreach (DocStyle ds in ii.ActiveFormat.PlantFormat.DocStyles.DocStyleList)
@ -906,7 +906,7 @@ namespace Volian.Print.Library
}
MetaLevel = MetaLevel <= 2 ? 1 : MetaLevel - 1;
if (MetaLevel == 1)
offset += (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos;
offset += (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos;
else
{
xMetaAdj = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[0].ColSByLevel;
@ -949,13 +949,13 @@ namespace Volian.Print.Library
if(itemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format)
yoffLeft = ChildrenLeft.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
else
yoff = ChildrenAbove.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
yoff = ChildrenAbove.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
}
if (itemInfo.Notes != null && !(itemInfo.IsCaution || itemInfo.IsNote))
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format)
yoffLeft = Math.Max(yoffLeft, ChildrenLeft.Add(cb, itemInfo.Notes, xoff + 6 + (float)(itemInfo.ActiveFormat.MyStepSectionLayoutData.WidT), yoff, yoff, rnoLevel, maxRNO, formatInfo));
else
yoff = ChildrenAbove.Add(cb, itemInfo.Notes, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
yoff = ChildrenAbove.Add(cb, itemInfo.Notes, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
// If the format has that extra space should be put out before the step, then
// handle this by using the 'PartsAbove' structure. By using the parts above, the extra
// space above will be done regardless of where page breaks fall.
@ -1011,8 +1011,10 @@ namespace Volian.Print.Library
if (itemInfo.MyContent.Text != null)
{
ProcedureInfo proc = itemInfo.MyProcedure;
DocVersionInfo dvi = proc.ActiveParent as DocVersionInfo;
// DocVersionInfo dvi = proc.ActiveParent as DocVersionInfo;
DocVersionInfo dvi = proc.MyDocVersion;
ROFstInfo rofst = dvi.DocVersionAssociations[0].MyROFst;
rofst.docVer = dvi;
ROFSTLookup lookup = rofst.ROFSTLookup;
string linkInfoText = itemInfo.MyContent.Text.Replace(@"\v ", "");
Match m = Regex.Match(linkInfoText, @"(.*)[#]Link:([A-Za-z]*):(.*)");
@ -1022,35 +1024,35 @@ namespace Volian.Print.Library
}
else
{
string[] subs = m.Groups[3].Value.Split(" ".ToCharArray());
string roid = subs[1];
string val = lookup.GetRoValue(subs[1]);
if (val == null) val = lookup.GetRoValue(subs[1].Substring(0, 12));
if (val != null)
{
string[] vals = val.Split("\n".ToCharArray());
Width = Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) * MyItemInfo.FormatStepData.Font.CharsToTwips;
int lines = Int32.Parse(vals[2], System.Globalization.NumberStyles.AllowHexSpecifier);
Height = lines * SixLinesPerInch;
//yForCheckoff = yoff + Height - SixLinesPerInch;
if (dropCheckoff)
yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text
string[] subs = m.Groups[3].Value.Split(" ".ToCharArray());
string roid = subs[1];
string val = lookup.GetRoValue(subs[1]);
if (val == null) val = lookup.GetRoValue(subs[1].Substring(0, 12));
if (val != null)
{
string[] vals = val.Split("\n".ToCharArray());
Width = Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) * MyItemInfo.FormatStepData.Font.CharsToTwips;
int lines = Int32.Parse(vals[2], System.Globalization.NumberStyles.AllowHexSpecifier);
Height = lines * SixLinesPerInch;
//yForCheckoff = yoff + Height - SixLinesPerInch;
if (dropCheckoff)
yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text
yoff += (Height + (SixLinesPerInch)); // RHM 20120925 - Eliminate extra space after Figure
try
{
ROImageInfo roImage = ROImageInfo.GetByROFstID_FileName(rofst.ROFstID, vals[0]);
if (roImage != null)
ImageText = val;
else
erMsg = string.Format("Image {0} does not exist.", vals[0]);
}
catch (Exception ex)
{
erMsg = string.Format("Image {0} does not exist, error = {1}.", vals[0], ex.Message);
}
try
{
ROImageInfo roImage = ROImageInfo.GetByROFstID_FileName(rofst.ROFstID, vals[0]);
if (roImage != null)
ImageText = val;
else
erMsg = string.Format("Image {0} does not exist.", vals[0]);
}
catch (Exception ex)
{
erMsg = string.Format("Image {0} does not exist, error = {1}.", vals[0], ex.Message);
}
}
}
if (erMsg != null) Rtf = GetRtf(erMsg, itemInfo.ActiveFormat.PlantFormat.FormatData.Font);
CalculateXOffset(itemInfo, maxRNO, formatInfo);
@ -1157,7 +1159,7 @@ namespace Volian.Print.Library
if (fg.BorderStyle == C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.None && !fg.TopRowHasBorder())
yoffadj = -SixLinesPerInch;
}
bool rightLonger = yOffRight > yoff;
if(!aerTableOrFigure && itemInfo.RNOLevel == 0) // Centered Table
yoff = ChildrenBelow.Add(cb, itemInfo.Tables, XOffset, rightLonger?yOffRight:yoff + yoffadj, yOffRight + yoffadj, rnoLevel, maxRNO, formatInfo);
@ -1829,7 +1831,7 @@ namespace Volian.Print.Library
iilvl = iilvl.MyParent;
}
level = level <= 2 ? 1 : level - 1;
if (level == 1)
if (level==1)
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (level * (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos);
else
{
@ -2052,7 +2054,7 @@ namespace Volian.Print.Library
if(formatInfo.MyStepSectionLayoutData.Dev_Format)
Width = (float)formatInfo.MyStepSectionLayoutData.WidT + 1;
else
Width = (float)formatInfo.MyStepSectionLayoutData.WidT - 6 - mycolT;
Width = (float)formatInfo.MyStepSectionLayoutData.WidT - 6 - mycolT;
XOffset += mycolT; // adjust caution/note text position
if (PartsLeft != null)// adjust tab position
foreach(vlnPrintObject vpo in PartsLeft)