From 8f379f0b9bdacff95e426aa0b8e14e292f9746b2 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 3 Aug 2015 15:52:46 +0000 Subject: [PATCH] Fixed an Argument Exception error in the Chronology of Changes Report. Also cleaned up the output of the Chronology and Summary of changes reports. --- .../PDFChronologyReport.cs | 106 ++++++++++++++---- 1 file changed, 84 insertions(+), 22 deletions(-) diff --git a/PROMS/Volian.Print.Library/PDFChronologyReport.cs b/PROMS/Volian.Print.Library/PDFChronologyReport.cs index cf7ea7e6..c840d353 100644 --- a/PROMS/Volian.Print.Library/PDFChronologyReport.cs +++ b/PROMS/Volian.Print.Library/PDFChronologyReport.cs @@ -273,16 +273,25 @@ namespace Volian.Print.Library stepnum = NewPath[1]; string stepnum2 = Regex.Replace(stepnum, "([0-9])[.]([A-Za-z])", "$1 $2"); stepnum2 = stepnum2.Replace("RNO.", "RNO"); - h = new Phrase(); - h.Font = f3; - h.Add(string.Format("Step {0}", stepnum2)); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_RIGHT; - c.PaddingBottom = paddingBottom; - c.PaddingRight = 10; - //c.Border = borders; - t.AddCell(c); + // check to see if we have step number to output + // if not just put in a blank cell. + // this cleans up the report so that we don't have "Step" without anything after it. + // This was happening when we were reporting change information of a section number/title + if (stepnum2 != "") + { + h = new Phrase(); + h.Font = f3; + h.Add(string.Format("Step {0}", stepnum2)); + c = new PdfPCell(h); + c.Colspan = 1; + c.HorizontalAlignment = Element.ALIGN_RIGHT; + c.PaddingBottom = paddingBottom; + c.PaddingRight = 10; + //c.Border = borders; + t.AddCell(c); + } + else + t.AddCell(BlankCell(1)); } else t.AddCell(BlankCell(1)); @@ -415,6 +424,7 @@ namespace Volian.Print.Library } h.Add(txt); } + oldCAI = cai; oldText = cai.Text; oldTypeName = cai.TypeName; c = new PdfPCell(h); @@ -441,7 +451,8 @@ namespace Volian.Print.Library { //add annotation to minilist // processedAAI.Add(aai.AnnotationID, aai); - processedAAI.Add(aai, aai); + if (!processedAAI.ContainsKey(aai)) // bug fix, only add to the processed list if it is not already in the list + processedAAI.Add(aai, aai); //write row to table t.AddCell(BlankCell(1)); h = new Phrase(); @@ -1260,6 +1271,8 @@ namespace Volian.Print.Library } } } + if (caiFirst != null) //ciaFirst could end up being null at the end of the above foreach loop + auditList2.Add(caiFirst); int cols = 5; int borders = 0; int paddingBottom = 6; @@ -1383,16 +1396,25 @@ namespace Volian.Print.Library stepnum = NewPath[1]; string stepnum2 = Regex.Replace(stepnum, "([0-9])[.]([A-Za-z])", "$1 $2"); stepnum2 = stepnum2.Replace("RNO.", "RNO"); - h = new Phrase(); - h.Font = f3; - h.Add(string.Format("Step {0}", stepnum2)); - c = new PdfPCell(h); - c.Colspan = 1; - c.HorizontalAlignment = Element.ALIGN_RIGHT; - c.PaddingBottom = paddingBottom; - c.PaddingRight = 10; - //c.Border = borders; - t.AddCell(c); + // check to see if we have step number to output + // if not just put in a blank cell. + // this cleans up the report so that we don't have "Step" without anything after it. + // This was happening when we were reporting change information of a section number/title + if (stepnum2 != "") + { + h = new Phrase(); + h.Font = f3; + h.Add(string.Format("Step {0}", stepnum2)); + c = new PdfPCell(h); + c.Colspan = 1; + c.HorizontalAlignment = Element.ALIGN_RIGHT; + c.PaddingBottom = paddingBottom; + c.PaddingRight = 10; + //c.Border = borders; + t.AddCell(c); + } + else + t.AddCell(BlankCell(1)); } else { @@ -1478,7 +1500,47 @@ 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); + // Add Parent/Child information if applicable + // We were doing this for the Chronology report so I added the same logic here for the Summary report + if (MyProc.MyDocVersion.MultiUnitCount > 1) + { + System.Xml.XmlNode nd; + if (cai.Config == string.Empty) + nd = null; + else + { + System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); + xd.LoadXml(cai.Config); + 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; // h.Add(ItemInfo.ConvertToDisplayText(cai.Text) + " " + cai.TypeName);