changes to support approval process
fixes to change manager
This commit is contained in:
parent
e428553e06
commit
e9a77c98bf
@ -11,6 +11,21 @@ namespace Volian.Print.Library
|
||||
{
|
||||
public class PDFChronologyReport
|
||||
{
|
||||
private static Dictionary<int, string> _AnnotationLookup;
|
||||
public static Dictionary<int, string> AnnotationLookup
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_AnnotationLookup == null)
|
||||
{
|
||||
_AnnotationLookup = new Dictionary<int, string>();
|
||||
AnnotationTypeInfoList atil = AnnotationTypeInfoList.Get();
|
||||
foreach (AnnotationTypeInfo ati in atil)
|
||||
_AnnotationLookup.Add(ati.TypeID, ati.Name);
|
||||
}
|
||||
return _AnnotationLookup;
|
||||
}
|
||||
}
|
||||
private string _FileName;
|
||||
public string FileName
|
||||
{
|
||||
@ -71,6 +86,10 @@ namespace Volian.Print.Library
|
||||
}
|
||||
}
|
||||
public void BuildSummary()
|
||||
{
|
||||
BuildSummary(true);
|
||||
}
|
||||
public void BuildSummary(bool openReport)
|
||||
{
|
||||
bool hasData = false;
|
||||
iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER, 36, 36, 36, 36);
|
||||
@ -78,6 +97,7 @@ namespace Volian.Print.Library
|
||||
try
|
||||
{
|
||||
BuildSummaryReport(document);
|
||||
//BuildSummaryReport2(document);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -95,7 +115,8 @@ namespace Volian.Print.Library
|
||||
if (document.IsOpen())
|
||||
{
|
||||
document.Close();
|
||||
System.Diagnostics.Process.Start(_FileName);
|
||||
if(openReport)
|
||||
System.Diagnostics.Process.Start(_FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -159,6 +180,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
private void BuildChronologyReport(iTextSharp.text.Document doc)
|
||||
{
|
||||
int lastAnnotationID = 0;
|
||||
int cols = 5;
|
||||
int borders = 0;
|
||||
int paddingBottom = 6;
|
||||
@ -200,6 +222,8 @@ namespace Volian.Print.Library
|
||||
DateTime maxDTS = DateTime.MinValue;
|
||||
int lastID = 0;
|
||||
ContentAuditInfo oldCAI = null;
|
||||
string oldText = string.Empty;
|
||||
string oldTypeName = string.Empty;
|
||||
// Dictionary<long, AnnotationAuditInfo> processedAAI = new Dictionary<long, AnnotationAuditInfo>();
|
||||
Dictionary<AnnotationAuditInfo, AnnotationAuditInfo> processedAAI = new Dictionary<AnnotationAuditInfo, AnnotationAuditInfo>();
|
||||
foreach (ContentAuditInfo cai in AuditList)
|
||||
@ -208,6 +232,7 @@ namespace Volian.Print.Library
|
||||
string[] NewPath = SplitPath(cai.Path);
|
||||
if (NewPath[0] != section)
|
||||
{
|
||||
AddStepAnnotation(ref lastAnnotationID, cols, paddingBottom, t, f3, f4, ref h, ref c, oldCAI, processedAAI);
|
||||
section = NewPath[0];
|
||||
h = new Phrase();
|
||||
h.Font = f4;
|
||||
@ -223,59 +248,10 @@ namespace Volian.Print.Library
|
||||
//step
|
||||
if (NewPath[1] != stepnum)
|
||||
{
|
||||
//see if any annotations for old stepnum here and add them
|
||||
foreach (AnnotationAuditInfo aai in AnnotationList)
|
||||
{
|
||||
if (oldCAI != null && aai.IContentID == oldCAI.ContentID)
|
||||
{
|
||||
//add annotation to minilist
|
||||
// processedAAI.Add(aai.AnnotationID, aai);
|
||||
processedAAI.Add(aai, aai);
|
||||
//write row to table
|
||||
t.AddCell(BlankCell(1));
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h.Add("Annotation " + aai.ActionWhat);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = 1;
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
//c.Border = borders;
|
||||
t.AddCell(c);
|
||||
//who
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h.Add(aai.UserID);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = 1;
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
//c.Border = borders;
|
||||
t.AddCell(c);
|
||||
//when
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h.Add(aai.ActionWhen.ToString());
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = 1;
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
//c.Border = borders;
|
||||
t.AddCell(c);
|
||||
//new text
|
||||
h = new Phrase();
|
||||
h.Font = f4;
|
||||
//h.Add(cai.Text);
|
||||
h.Add(ItemInfo.ConvertToDisplayText(aai.SearchText));
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols - 4;
|
||||
c.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
//c.Border = borders;
|
||||
t.AddCell(c);
|
||||
}
|
||||
}
|
||||
AddStepAnnotation(ref lastAnnotationID, cols, paddingBottom, t, f3, f4, ref h, ref c, oldCAI, processedAAI);
|
||||
oldCAI = cai;
|
||||
oldText = cai.Text;
|
||||
oldTypeName = cai.TypeName;
|
||||
stepnum = NewPath[1];
|
||||
string stepnum2 = Regex.Replace(stepnum, "([0-9])[.]([A-Za-z])", "$1 $2");
|
||||
stepnum2 = stepnum2.Replace("RNO.", "RNO");
|
||||
@ -366,7 +342,14 @@ namespace Volian.Print.Library
|
||||
{
|
||||
h = new Phrase();
|
||||
h.Font = f4;
|
||||
h.Add(ItemInfo.ConvertToDisplayText(cai.Text));
|
||||
if (cai.Text != oldText && cai.TypeName != oldTypeName)
|
||||
h.Add(string.Format("[Type Change {0} to {1}] - {2}", oldTypeName, cai.TypeName, ItemInfo.ConvertToDisplayText(cai.Text)));// + " to " + cai.TypeName);
|
||||
else if (cai.Text == oldText && cai.TypeName != oldTypeName)
|
||||
h.Add(oldTypeName + " to " + cai.TypeName);
|
||||
else
|
||||
h.Add(ItemInfo.ConvertToDisplayText(cai.Text));
|
||||
oldText = cai.Text;
|
||||
oldTypeName = cai.TypeName;
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols - 4;
|
||||
c.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||
@ -396,7 +379,13 @@ namespace Volian.Print.Library
|
||||
t.AddCell(BlankCell(1));
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h.Add("Annotation " + aai.ActionWhat);
|
||||
if (aai.AnnotationID != lastAnnotationID)
|
||||
{
|
||||
lastAnnotationID = aai.AnnotationID;
|
||||
h.Add(AnnotationLookup[aai.TypeID] + " " + aai.ActionWhat);
|
||||
}
|
||||
else
|
||||
h.Add(aai.ActionWhat);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = 1;
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
@ -482,7 +471,13 @@ namespace Volian.Print.Library
|
||||
//what
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h.Add(aai.ActionWhat);
|
||||
if (aai.AnnotationID != lastAnnotationID)
|
||||
{
|
||||
lastAnnotationID = aai.AnnotationID;
|
||||
h.Add(AnnotationLookup[aai.TypeID] + " " + aai.ActionWhat);
|
||||
}
|
||||
else
|
||||
h.Add(aai.ActionWhat);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = 1;
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
@ -530,6 +525,70 @@ namespace Volian.Print.Library
|
||||
}
|
||||
doc.Add(t);
|
||||
}
|
||||
|
||||
private void AddStepAnnotation(ref int lastAnnotationID, int cols, int paddingBottom, PdfPTable t, iTextSharp.text.Font f3, iTextSharp.text.Font f4, ref Phrase h, ref PdfPCell c, ContentAuditInfo oldCAI, Dictionary<AnnotationAuditInfo, AnnotationAuditInfo> processedAAI)
|
||||
{
|
||||
//see if any annotations for old stepnum here and add them
|
||||
foreach (AnnotationAuditInfo aai in AnnotationList)
|
||||
{
|
||||
if (oldCAI != null && aai.IContentID == oldCAI.ContentID)
|
||||
{
|
||||
//add annotation to minilist
|
||||
// processedAAI.Add(aai.AnnotationID, aai);
|
||||
if(processedAAI.ContainsKey(aai))
|
||||
return;
|
||||
processedAAI.Add(aai, aai);
|
||||
//write row to table
|
||||
t.AddCell(BlankCell(1));
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
if (aai.AnnotationID != lastAnnotationID)
|
||||
{
|
||||
lastAnnotationID = aai.AnnotationID;
|
||||
h.Add(AnnotationLookup[aai.TypeID] + " " + aai.ActionWhat);
|
||||
}
|
||||
else
|
||||
h.Add(aai.ActionWhat);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = 1;
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
//c.Border = borders;
|
||||
t.AddCell(c);
|
||||
//who
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h.Add(aai.UserID);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = 1;
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
//c.Border = borders;
|
||||
t.AddCell(c);
|
||||
//when
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h.Add(aai.ActionWhen.ToString());
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = 1;
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
//c.Border = borders;
|
||||
t.AddCell(c);
|
||||
//new text
|
||||
h = new Phrase();
|
||||
h.Font = f4;
|
||||
//h.Add(cai.Text);
|
||||
h.Add(ItemInfo.ConvertToDisplayText(aai.SearchText));
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols - 4;
|
||||
c.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
//c.Border = borders;
|
||||
t.AddCell(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
private static string[] SplitPath(string path)
|
||||
{
|
||||
// Remove Procedure Number and Title
|
||||
@ -538,7 +597,6 @@ namespace Volian.Print.Library
|
||||
// Split Section frrom Steps
|
||||
return sectionAndStep.Split("\x7".ToCharArray());
|
||||
}
|
||||
|
||||
private string[] GetNewPath(ContentAuditInfoList AuditList, int contentID)
|
||||
{
|
||||
foreach (ContentAuditInfo cai in AuditList)
|
||||
@ -866,6 +924,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
private void BuildSummaryReport(iTextSharp.text.Document doc)
|
||||
{
|
||||
int lastAnnotationID = 0;
|
||||
string section = string.Empty;
|
||||
string stepnum = string.Empty;
|
||||
int contentID = 0;
|
||||
@ -892,11 +951,26 @@ namespace Volian.Print.Library
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -904,9 +978,25 @@ namespace Volian.Print.Library
|
||||
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;
|
||||
}
|
||||
else
|
||||
@ -926,64 +1016,100 @@ namespace Volian.Print.Library
|
||||
{
|
||||
if (firstCAI.DTS > MyProc.DTS)
|
||||
lastCAI.ActionWhat = firstCAI.ActionWhat;
|
||||
//auditList.Add(firstCAI);
|
||||
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)
|
||||
else if (firstCAI.ActionWhat == "Added")
|
||||
{
|
||||
//auditList.Add(lastCAI);
|
||||
firstCAI = null;
|
||||
lastCAI = null;
|
||||
if (lastCAI.ActionWhat == "Deleted" && firstCAI.DTS == lastCAI.DTS)
|
||||
{
|
||||
//auditList.Add(lastCAI);
|
||||
firstCAI = null;
|
||||
lastCAI = null;
|
||||
}
|
||||
else if (lastCAI.ActionWhat != "Deleted")
|
||||
{
|
||||
lastCAI.ActionWhat = firstCAI.ActionWhat;
|
||||
auditList.Add(lastCAI);
|
||||
lastCAI = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#region annotations commented out
|
||||
//AnnotationAuditInfo firstAAI = null;
|
||||
//AnnotationAuditInfo nextAAI = null;
|
||||
//AnnotationAuditInfo lastAAI = null;
|
||||
//int icontentID = 0;
|
||||
//List<AnnotationAuditInfo> annotationList = new List<AnnotationAuditInfo>();
|
||||
//foreach (AnnotationAuditInfo aai in AnnotationList)
|
||||
//{
|
||||
// if (aai.IContentID != icontentID)
|
||||
// {
|
||||
// icontentID = aai.IContentID;
|
||||
// if (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" && lastAAI.SearchText != firstAAI.SearchText)
|
||||
// {
|
||||
// annotationList.Add(firstAAI);
|
||||
// annotationList.Add(lastAAI);
|
||||
// }
|
||||
// else if (lastAAI.ActionWhat == "Changed" && firstAAI.ActionWhat == "Added" && lastAAI.SearchText == firstAAI.SearchText)
|
||||
// {
|
||||
// annotationList.Add(firstAAI);
|
||||
// }
|
||||
// else if (lastAAI == null && firstAAI.ActionWhat == "Added")
|
||||
// {
|
||||
// annotationList.Add(firstAAI);
|
||||
// }
|
||||
// lastAAI = null;
|
||||
// }
|
||||
// firstAAI = aai;
|
||||
// }
|
||||
// else
|
||||
// lastAAI = aai;
|
||||
//}
|
||||
//if (firstAAI != null)
|
||||
// annotationList.Add(firstAAI);
|
||||
//if (lastAAI != null)
|
||||
// annotationList.Add(lastAAI);
|
||||
AnnotationAuditInfo firstAAI = null;
|
||||
AnnotationAuditInfo nextAAI = null;
|
||||
AnnotationAuditInfo lastAAI = null;
|
||||
int annotationID = 0;
|
||||
List<AnnotationAuditInfo> annotationList = new List<AnnotationAuditInfo>();
|
||||
foreach (AnnotationAuditInfo aai in AnnotationList)
|
||||
{
|
||||
if (aai.AnnotationID != annotationID)
|
||||
{
|
||||
annotationID = aai.AnnotationID;
|
||||
if (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)
|
||||
{
|
||||
annotationList.Add(firstAAI);
|
||||
}
|
||||
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;
|
||||
}
|
||||
firstAAI = aai;
|
||||
}
|
||||
else
|
||||
lastAAI = aai;
|
||||
}
|
||||
if (firstAAI != null)
|
||||
annotationList.Add(firstAAI);
|
||||
if (lastAAI != null)
|
||||
annotationList.Add(lastAAI);
|
||||
#endregion
|
||||
int cols = 5;
|
||||
int borders = 0;
|
||||
@ -1022,6 +1148,8 @@ namespace Volian.Print.Library
|
||||
t.AddCell(c);
|
||||
t.AddCell(BlankCell(cols));
|
||||
ContentAuditInfo oldCAI = null;
|
||||
string oldText = string.Empty;
|
||||
string oldTypeName = string.Empty;
|
||||
// Dictionary<long, AnnotationAuditInfo> processedAAI = new Dictionary<long, AnnotationAuditInfo>();
|
||||
Dictionary<AnnotationAuditInfo, AnnotationAuditInfo> processedAAI = new Dictionary<AnnotationAuditInfo, AnnotationAuditInfo>();
|
||||
foreach (ContentAuditInfo cai in auditList)
|
||||
@ -1030,6 +1158,7 @@ namespace Volian.Print.Library
|
||||
string[] NewPath = SplitPath(cai.Path);
|
||||
if (NewPath[0] != section)
|
||||
{
|
||||
AddStepAnnotation(ref lastAnnotationID, cols, paddingBottom, t, f3, f4, ref h, ref c, oldCAI, processedAAI);
|
||||
section = NewPath[0];
|
||||
h = new Phrase();
|
||||
h.Font = f4;
|
||||
@ -1045,59 +1174,62 @@ namespace Volian.Print.Library
|
||||
//step
|
||||
if (NewPath[1] != stepnum)
|
||||
{
|
||||
//see if any annotations for old stepnum here and add them
|
||||
foreach (AnnotationAuditInfo aai in AnnotationList)
|
||||
{
|
||||
if (oldCAI != null && aai.IContentID == oldCAI.ContentID)
|
||||
{
|
||||
//add annotation to minilist
|
||||
// processedAAI.Add(aai.AnnotationID, aai);
|
||||
processedAAI.Add(aai, aai);
|
||||
//write row to table
|
||||
t.AddCell(BlankCell(1));
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h.Add("Annotation " + aai.ActionWhat);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = 1;
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
//c.Border = borders;
|
||||
t.AddCell(c);
|
||||
//who
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h.Add(aai.UserID);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = 1;
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
//c.Border = borders;
|
||||
t.AddCell(c);
|
||||
//when
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h.Add(aai.ActionWhen.ToString());
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = 1;
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
//c.Border = borders;
|
||||
t.AddCell(c);
|
||||
//new text
|
||||
h = new Phrase();
|
||||
h.Font = f4;
|
||||
//h.Add(cai.Text);
|
||||
h.Add(ItemInfo.ConvertToDisplayText(aai.SearchText));
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols - 4;
|
||||
c.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||
c.PaddingBottom = paddingBottom;
|
||||
//c.Border = borders;
|
||||
t.AddCell(c);
|
||||
}
|
||||
}
|
||||
AddStepAnnotation(ref lastAnnotationID, cols, paddingBottom, t, f3, f4, ref h, ref c, oldCAI, processedAAI);
|
||||
////see if any annotations for old stepnum here and add them
|
||||
//foreach (AnnotationAuditInfo aai in annotationList)
|
||||
//{
|
||||
// if (oldCAI != null && aai.IContentID == oldCAI.ContentID)
|
||||
// {
|
||||
// //add annotation to minilist
|
||||
// // processedAAI.Add(aai.AnnotationID, aai);
|
||||
// processedAAI.Add(aai, aai);
|
||||
// //write row to table
|
||||
// t.AddCell(BlankCell(1));
|
||||
// h = new Phrase();
|
||||
// h.Font = f3;
|
||||
// h.Add(AnnotationLookup[aai.TypeID] + " " + aai.ActionWhat);
|
||||
// c = new PdfPCell(h);
|
||||
// c.Colspan = 1;
|
||||
// c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
// c.PaddingBottom = paddingBottom;
|
||||
// //c.Border = borders;
|
||||
// t.AddCell(c);
|
||||
// //who
|
||||
// h = new Phrase();
|
||||
// h.Font = f3;
|
||||
// h.Add(aai.UserID);
|
||||
// c = new PdfPCell(h);
|
||||
// c.Colspan = 1;
|
||||
// c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
// c.PaddingBottom = paddingBottom;
|
||||
// //c.Border = borders;
|
||||
// t.AddCell(c);
|
||||
// //when
|
||||
// h = new Phrase();
|
||||
// h.Font = f3;
|
||||
// h.Add(aai.ActionWhen.ToString());
|
||||
// c = new PdfPCell(h);
|
||||
// c.Colspan = 1;
|
||||
// c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
// c.PaddingBottom = paddingBottom;
|
||||
// //c.Border = borders;
|
||||
// t.AddCell(c);
|
||||
// //new text
|
||||
// h = new Phrase();
|
||||
// h.Font = f4;
|
||||
// //h.Add(cai.Text);
|
||||
// h.Add(ItemInfo.ConvertToDisplayText(aai.SearchText));
|
||||
// c = new PdfPCell(h);
|
||||
// c.Colspan = cols - 4;
|
||||
// c.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||
// c.PaddingBottom = paddingBottom;
|
||||
// //c.Border = borders;
|
||||
// t.AddCell(c);
|
||||
// }
|
||||
//}
|
||||
oldCAI = cai;
|
||||
oldText = cai.Text;
|
||||
oldTypeName = cai.TypeName;
|
||||
firstCAI = cai;
|
||||
stepnum = NewPath[1];
|
||||
string stepnum2 = Regex.Replace(stepnum, "([0-9])[.]([A-Za-z])", "$1 $2");
|
||||
@ -1122,7 +1254,7 @@ namespace Volian.Print.Library
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
// h.Add(cai.ActionWhen > MyProc.DTS ? cai.ActionWhat : "Original");
|
||||
string actionWhat = (cai.ActionWhat == "Added" && cai.DTS <= MyProc.DTS) ? "Original" : cai.ActionWhat; //(cai.ActionWhat == "Added" && cai.DTS <= MyProc.DTS) ? "Original" : cai.ActionWhat != "Changed" ? cai.ActionWhat : cai.DTS <= maxDTS ? "Restored" : cai.DTS > MyProc.DTS ? cai.ActionWhat : "Original";
|
||||
string actionWhat = ((cai.ActionWhat == "Added" || cai.ActionWhat == "Changed") && cai.DTS <= MyProc.DTS) ? "Original" : cai.ActionWhat; //(cai.ActionWhat == "Added" && cai.DTS <= MyProc.DTS) ? "Original" : cai.ActionWhat != "Changed" ? cai.ActionWhat : cai.DTS <= maxDTS ? "Restored" : cai.DTS > MyProc.DTS ? cai.ActionWhat : "Original";
|
||||
if (actionWhat == "Deleted" || actionWhat == "Restored")
|
||||
h.Add(actionWhat + "\r\n" + cai.ActionWhen.ToString());
|
||||
else
|
||||
@ -1192,7 +1324,15 @@ namespace Volian.Print.Library
|
||||
{
|
||||
h = new Phrase();
|
||||
h.Font = f4;
|
||||
h.Add(ItemInfo.ConvertToDisplayText(cai.Text));
|
||||
if (cai.Text != oldText && cai.TypeName != oldTypeName)
|
||||
h.Add(string.Format("[Type Change {0} to {1}] - {2}", oldTypeName, cai.TypeName, ItemInfo.ConvertToDisplayText(cai.Text)));// + " to " + cai.TypeName);
|
||||
else if (cai.Text == oldText && cai.TypeName != oldTypeName)
|
||||
h.Add(oldTypeName + " to " + cai.TypeName);
|
||||
else
|
||||
h.Add(ItemInfo.ConvertToDisplayText(cai.Text));
|
||||
oldText = cai.Text;
|
||||
oldTypeName = cai.TypeName;
|
||||
// h.Add(ItemInfo.ConvertToDisplayText(cai.Text) + " " + cai.TypeName);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols - 4;
|
||||
c.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||
@ -1218,7 +1358,7 @@ namespace Volian.Print.Library
|
||||
//t.AddCell(c);
|
||||
}
|
||||
//see if any annotations for old stepnum here and add them
|
||||
foreach (AnnotationAuditInfo aai in AnnotationList)
|
||||
foreach (AnnotationAuditInfo aai in annotationList)
|
||||
{
|
||||
if (oldCAI != null && aai.IContentID == oldCAI.ContentID)
|
||||
{
|
||||
@ -1229,7 +1369,7 @@ namespace Volian.Print.Library
|
||||
t.AddCell(BlankCell(1));
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h.Add("Annotation " + aai.ActionWhat);
|
||||
h.Add(AnnotationLookup[aai.TypeID] + " " + aai.ActionWhat);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = 1;
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
@ -1282,7 +1422,7 @@ namespace Volian.Print.Library
|
||||
//t.AddCell(c);
|
||||
//t.AddCell(BlankCell(cols));
|
||||
stepnum = string.Empty;
|
||||
foreach (AnnotationAuditInfo aai in AnnotationList)
|
||||
foreach (AnnotationAuditInfo aai in annotationList)
|
||||
{
|
||||
// if (!processedAAI.ContainsKey(aai.AnnotationID))
|
||||
if (!processedAAI.ContainsKey(aai))
|
||||
@ -1326,7 +1466,8 @@ namespace Volian.Print.Library
|
||||
//what
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h.Add(aai.ActionWhat);
|
||||
|
||||
h.Add(AnnotationLookup[aai.TypeID] + " " + aai.ActionWhat);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = 1;
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
|
450
PROMS/Volian.Print.Library/PDFConsistencyCheckReport.cs
Normal file
450
PROMS/Volian.Print.Library/PDFConsistencyCheckReport.cs
Normal file
@ -0,0 +1,450 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using VEPROMS.CSLA.Library;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Volian.Print.Library
|
||||
{
|
||||
public class PDFConsistencyCheckReport
|
||||
{
|
||||
private DocVersionInfo _MyDocVersion;
|
||||
public DocVersionInfo MyDocVersion
|
||||
{
|
||||
get { return _MyDocVersion; }
|
||||
set { _MyDocVersion = value; }
|
||||
}
|
||||
private string _FileName;
|
||||
public string FileName
|
||||
{
|
||||
get { return _FileName; }
|
||||
set { _FileName = value; }
|
||||
}
|
||||
private ItemInfoList _MyItemInfoList;
|
||||
public ItemInfoList MyItemInfoList
|
||||
{
|
||||
get { return _MyItemInfoList; }
|
||||
set { _MyItemInfoList = value; }
|
||||
}
|
||||
public PDFConsistencyCheckReport(string fileName, ItemInfoList myItemInfoList)
|
||||
{
|
||||
_FileName = fileName;
|
||||
_MyItemInfoList = myItemInfoList;
|
||||
}
|
||||
public void BuildReport()
|
||||
{
|
||||
iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER, 36, 36, 36, 36);
|
||||
if (!CreateResultsPDF(document)) return;
|
||||
try
|
||||
{
|
||||
BuildConsistencyReport(document);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
StringBuilder msg = new StringBuilder();
|
||||
document.Add(new Paragraph("Error:"));
|
||||
while (ex != null)
|
||||
{
|
||||
document.Add(new Paragraph(ex.GetType().Name));
|
||||
document.Add(new Paragraph(ex.Message));
|
||||
ex = ex.InnerException;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (document.IsOpen())
|
||||
{
|
||||
document.Close();
|
||||
System.Diagnostics.Process.Start(_FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
private bool CreateResultsPDF(iTextSharp.text.Document document)
|
||||
{
|
||||
bool result = false;
|
||||
string suffix = "";
|
||||
int i = 0;
|
||||
// Try to open a file for creating the PDF.
|
||||
while (result == false)
|
||||
{
|
||||
string fileName = _FileName.ToLower().Replace(".pdf", suffix + ".pdf");
|
||||
try
|
||||
{
|
||||
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(fileName, FileMode.Create));
|
||||
document.SetMargins(36, 36, 36, 36);
|
||||
document.Open();
|
||||
_FileName = fileName;
|
||||
result = true;
|
||||
}
|
||||
catch (System.IO.IOException exIO)
|
||||
{
|
||||
|
||||
if (exIO.Message.Contains("because it is being used by another process"))
|
||||
suffix = string.Format("_{0}", ++i);// If this file is in use, increment the suffix and try again
|
||||
else // If some other error, display a message and don't print the results
|
||||
{
|
||||
ShowException(exIO);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowException(ex);
|
||||
return false; // Could not open the output file
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private static void ShowException(Exception ex)
|
||||
{
|
||||
Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message);
|
||||
StringBuilder msg = new StringBuilder();
|
||||
string sep = "";
|
||||
string indent = "";
|
||||
while (ex != null)
|
||||
{
|
||||
msg.Append(string.Format("{0}{1}{2}:\r\n{1}{3}", sep, indent, ex.GetType().Name, ex.Message));
|
||||
ex = ex.InnerException;
|
||||
sep = "\r\n";
|
||||
indent += " ";
|
||||
}
|
||||
System.Windows.Forms.MessageBox.Show(msg.ToString(), "Error during PDF creation for search:", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
|
||||
}
|
||||
private PdfPCell BlankCell(int colSpan)
|
||||
{
|
||||
PdfPCell c = new PdfPCell();
|
||||
c.Colspan = colSpan;
|
||||
c.Border = 0;
|
||||
return c;
|
||||
}
|
||||
private void BuildConsistencyReport(iTextSharp.text.Document doc)
|
||||
{
|
||||
iTextSharp.text.Font f1 = pdf.GetFont("Arial Unicode MS", 12, 1, Color.BLACK);
|
||||
iTextSharp.text.Font f2 = pdf.GetFont("Arial Unicode MS", 10, 0, Color.BLACK);
|
||||
iTextSharp.text.Font f3 = pdf.GetFont("Arial Unicode MS", 8, 0, Color.BLACK);
|
||||
iTextSharp.text.Font f4 = pdf.GetFont("Arial Unicode MS", 10, 2, Color.BLACK);
|
||||
int cols = 5;
|
||||
int borders = 0;
|
||||
int paddingBottom = 6;
|
||||
// float[] widths;
|
||||
PdfPTable t = CreatePdfPTable(cols);
|
||||
CreatePageHeader(t, f1, f4, cols, paddingBottom, "Approval Consistency Report", "Procedures currently selected to be approved");
|
||||
//more stuff
|
||||
foreach (ProcedureInfo pi in MyItemInfoList)
|
||||
{
|
||||
if (pi.IsSelected)
|
||||
{
|
||||
PdfPTable tt = new PdfPTable(cols);
|
||||
tt.KeepTogether = true;
|
||||
tt.AddCell(AddSubTableCell(pi.DisplayNumber, f2, cols, paddingBottom));
|
||||
tt.AddCell(AddSubTableCell(pi.MyDifferencesText, f3, cols, paddingBottom));
|
||||
PdfPCell c = new PdfPCell(tt);
|
||||
c.Colspan = cols;
|
||||
t.AddCell(c);
|
||||
}
|
||||
}
|
||||
t.AddCell(BlankCell(cols));
|
||||
doc.Add(t);
|
||||
//new page with new table
|
||||
doc.NewPage();
|
||||
t = CreatePdfPTable(cols);
|
||||
CreatePageHeader(t, f1, f4, cols, paddingBottom, "Approval Consistency Report", "Procedures that should be selected to be approved in order to maintain consistency");
|
||||
foreach (ProcedureInfo pi in MyItemInfoList)
|
||||
{
|
||||
if (!pi.IsSelected)
|
||||
{
|
||||
PdfPTable tt = new PdfPTable(cols);
|
||||
tt.KeepTogether = true;
|
||||
tt.AddCell(AddSubTableCell(pi.DisplayNumber, f2, cols, paddingBottom));
|
||||
tt.AddCell(AddSubTableCell(pi.MyDifferencesText, f3, cols, paddingBottom));
|
||||
PdfPCell c = new PdfPCell(tt);
|
||||
c.Colspan = cols;
|
||||
t.AddCell(c);
|
||||
}
|
||||
}
|
||||
doc.Add(t);
|
||||
}
|
||||
private PdfPCell AddSubTableCell(string text, iTextSharp.text.Font f, int cols, float pb)
|
||||
{
|
||||
Phrase h = new Phrase();
|
||||
h.Font = f;
|
||||
h.Add(text);
|
||||
PdfPCell c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
c.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||
c.PaddingBottom = pb;
|
||||
return c;
|
||||
}
|
||||
private void CreatePageHeader(PdfPTable t, iTextSharp.text.Font f1, iTextSharp.text.Font f2, int cols, float pb, string hdr1, string hdr2)
|
||||
{
|
||||
//report title
|
||||
Phrase h = new Phrase();
|
||||
h.Font = f1;
|
||||
h.Add(hdr1);
|
||||
PdfPCell c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
c.PaddingBottom = pb;
|
||||
//c.Border = borders;
|
||||
t.AddCell(c);
|
||||
h = new Phrase();
|
||||
h.Font = f2;
|
||||
h.Add(hdr2);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
c.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
c.PaddingBottom = pb;
|
||||
//c.Border = borders;
|
||||
t.AddCell(c);
|
||||
t.AddCell(BlankCell(cols));
|
||||
}
|
||||
private PdfPTable CreatePdfPTable(int cols)
|
||||
{
|
||||
PdfPTable t = new PdfPTable(cols);
|
||||
t.HeaderRows = 3;
|
||||
t.DefaultCell.Padding = 4;
|
||||
t.WidthPercentage = 100;
|
||||
float[] widths = new float[] { 1f, 1f, 1f, 1f, 4f };
|
||||
t.SetWidths(widths);
|
||||
//t.HorizontalAlignment = 0;
|
||||
return t;
|
||||
}
|
||||
public void BuildAllReport(DocVersionInfo dvi)
|
||||
{
|
||||
MyDocVersion = dvi;
|
||||
iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER, 36, 36, 36, 36);
|
||||
if (!CreateResultsPDF(document)) return;
|
||||
try
|
||||
{
|
||||
BuildAllInConsistenciesReport(document);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
StringBuilder msg = new StringBuilder();
|
||||
document.Add(new Paragraph("Error:"));
|
||||
while (ex != null)
|
||||
{
|
||||
document.Add(new Paragraph(ex.GetType().Name));
|
||||
document.Add(new Paragraph(ex.Message));
|
||||
ex = ex.InnerException;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (document.IsOpen())
|
||||
{
|
||||
document.Close();
|
||||
System.Diagnostics.Process.Start(_FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void BuildAllInConsistenciesReport(iTextSharp.text.Document doc)
|
||||
{
|
||||
iTextSharp.text.Font f1 = pdf.GetFont("Arial Unicode MS", 12, 1, Color.BLACK);
|
||||
iTextSharp.text.Font f2 = pdf.GetFont("Arial Unicode MS", 10, 0, Color.BLACK);
|
||||
iTextSharp.text.Font f3 = pdf.GetFont("Arial Unicode MS", 8, 0, Color.BLACK);
|
||||
iTextSharp.text.Font f4 = pdf.GetFont("Arial Unicode MS", 10, 2, Color.BLACK);
|
||||
int cols = 3;
|
||||
int borders = 0;
|
||||
int paddingBottom = 6;
|
||||
PdfPTable t = new PdfPTable(cols);
|
||||
t.HeaderRows = 1;
|
||||
t.WidthPercentage = 100;
|
||||
float[] widths = new float[] { 1f, 1f, 10f };
|
||||
t.SetWidths(widths);
|
||||
Phrase h = new Phrase();
|
||||
h.Font = f1;
|
||||
h.Add("Approved Procedures Inconsistencies Report");
|
||||
PdfPCell c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
c.HorizontalAlignment = 1;
|
||||
t.AddCell(c);
|
||||
Dictionary<int, string> types = new Dictionary<int, string>();
|
||||
foreach (ProcedureInfo pi in MyItemInfoList)
|
||||
{
|
||||
string type = pi.MyDifferences.ROConsistency.MyROChecks.Length > 0 ? "Reference Object Inconsistencies" : "";
|
||||
if (type != string.Empty && !types.ContainsKey(0))
|
||||
types.Add(0, type);
|
||||
type = pi.MyDifferences.TransitionConsistency.MyTransitionChecks.Length > 0 ? "Transition Inconsistencies" : "";
|
||||
if (type != string.Empty && !types.ContainsKey(1))
|
||||
types.Add(1, type);
|
||||
type = pi.MyDifferences.LibDocConsistency.MyLibDocChecks.Length > 0 ? "Library Document Inconsistencies" : "";
|
||||
if (type != string.Empty && !types.ContainsKey(2))
|
||||
types.Add(2, type);
|
||||
}
|
||||
// types.Clear();
|
||||
if (types.Count == 0)
|
||||
{
|
||||
h = new Phrase();
|
||||
h.Font = f2;
|
||||
h.Add("No Inconsistencies");
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
t.AddCell(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
Dictionary<string, List<string>> ros = new Dictionary<string, List<string>>();
|
||||
ROFSTLookup lu = MyItemInfoList[0].MyDocVersion.DocVersionAssociations[0].MyROFst.ROFSTLookup;
|
||||
if (types.ContainsKey(0))
|
||||
{
|
||||
foreach (ProcedureInfo pi in MyItemInfoList)
|
||||
{
|
||||
foreach (ROCheck roc in pi.MyDifferences.ROConsistency.MyROChecks)
|
||||
{
|
||||
ROFSTLookup.rochild rocc = lu.GetRoChild12(roc.ROID);
|
||||
if (rocc.type == 1)
|
||||
{
|
||||
string rotitle = string.Format("{0} - {1}", lu.GetROTitle(roc.ROID), lu.GetRoValue(roc.ROID).Replace('`','\xb0'));
|
||||
if (ros.ContainsKey(rotitle))
|
||||
{
|
||||
ros[rotitle].Add(string.Format("Procedure {0} has an ROValue of: {1}", pi.DisplayNumber, roc.ROValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
ros.Add(rotitle, new List<string>());
|
||||
ros[rotitle].Add(string.Format("Procedure {0} has an ROValue of: {1}", pi.DisplayNumber, roc.ROValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//jcb
|
||||
Dictionary<string, List<string>> trs = new Dictionary<string, List<string>>();
|
||||
if (types.ContainsKey(1))
|
||||
{
|
||||
foreach (ProcedureInfo pi in MyItemInfoList)
|
||||
{
|
||||
foreach (TransitionCheck trc in pi.MyDifferences.TransitionConsistency.MyTransitionChecks)
|
||||
{
|
||||
TransitionInfo ti = TransitionInfo.Get(trc.TransitionID);
|
||||
string trtitle = "From Procedure " + ti.MyContent.ContentItems[0].Path;
|
||||
if (trs.ContainsKey(trtitle))
|
||||
{
|
||||
trs[trtitle].Add(string.Format("According to {0} the destination is: {1}", pi.DisplayNumber, ItemInfo.ConvertToDisplayText(trc.TransitionValue)));
|
||||
}
|
||||
else
|
||||
{
|
||||
trs.Add(trtitle, new List<string>());
|
||||
trs[trtitle].Add(string.Format("According to {0} the destination is: {1}", pi.DisplayNumber, ItemInfo.ConvertToDisplayText(trc.TransitionValue)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//end jcb
|
||||
Dictionary<string, List<string>> lds = new Dictionary<string, List<string>>();
|
||||
if (types.ContainsKey(2))
|
||||
{
|
||||
foreach (ProcedureInfo pi in MyItemInfoList)
|
||||
{
|
||||
foreach (LibDocCheck ldc in pi.MyDifferences.LibDocConsistency.MyLibDocChecks)
|
||||
{
|
||||
DocumentInfo di = DocumentInfo.Get(ldc.DocID);
|
||||
string ldtitle = string.Format("{0} - {1}", di.DocumentTitle, di.DTS.ToString());
|
||||
if (lds.ContainsKey(ldtitle))
|
||||
{
|
||||
lds[ldtitle].Add(string.Format("Procedure {0} has a Document Date of: {1}", pi.DisplayNumber, ldc.DocDate.ToString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
lds.Add(ldtitle, new List<string>());
|
||||
lds[ldtitle].Add(string.Format("Procedure {0} has a Document Date of: {1}", pi.DisplayNumber, ldc.DocDate.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (types.ContainsKey(0))
|
||||
{
|
||||
h = new Phrase();
|
||||
h.Font = f2;
|
||||
h.Add(types[0]);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
t.AddCell(c);
|
||||
foreach (string rotitle in ros.Keys)
|
||||
{
|
||||
t.AddCell(BlankCell(1));
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h.Add(rotitle);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols - 1;
|
||||
t.AddCell(c);
|
||||
foreach (string s in ros[rotitle])
|
||||
{
|
||||
t.AddCell(BlankCell(2));
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h.Add(s);
|
||||
c = new PdfPCell(h);
|
||||
t.AddCell(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
//jcb
|
||||
if (types.ContainsKey(1))
|
||||
{
|
||||
h = new Phrase();
|
||||
h.Font = f2;
|
||||
h.Add(types[1]);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
t.AddCell(c);
|
||||
foreach (string trtitle in trs.Keys)
|
||||
{
|
||||
t.AddCell(BlankCell(1));
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h.Add(trtitle);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols - 1;
|
||||
t.AddCell(c);
|
||||
foreach (string s in trs[trtitle])
|
||||
{
|
||||
t.AddCell(BlankCell(2));
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h.Add(s);
|
||||
c = new PdfPCell(h);
|
||||
t.AddCell(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
//end jcb
|
||||
if (types.ContainsKey(2))
|
||||
{
|
||||
h = new Phrase();
|
||||
h.Font = f2;
|
||||
h.Add(types[2]);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols;
|
||||
t.AddCell(c);
|
||||
foreach (string ldtitle in lds.Keys)
|
||||
{
|
||||
t.AddCell(BlankCell(1));
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h.Add(ldtitle);
|
||||
c = new PdfPCell(h);
|
||||
c.Colspan = cols - 1;
|
||||
t.AddCell(c);
|
||||
foreach (string s in lds[ldtitle])
|
||||
{
|
||||
t.AddCell(BlankCell(2));
|
||||
h = new Phrase();
|
||||
h.Font = f3;
|
||||
h.Add(s);
|
||||
c = new PdfPCell(h);
|
||||
t.AddCell(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
doc.Add(t);
|
||||
}
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ using LBWordLibrary;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using Volian.Controls.Library;
|
||||
using Volian.Base.Library;
|
||||
|
||||
namespace Volian.Print.Library
|
||||
{
|
||||
@ -244,18 +245,19 @@ namespace Volian.Print.Library
|
||||
}
|
||||
return writer.DirectContent;
|
||||
}
|
||||
private string CreateFileName(string procNumber, string sectNumber, string sectTitle)
|
||||
{
|
||||
return FixFileName(procNumber + "_" + ((sectNumber ?? "") != "" ? sectNumber : sectTitle));
|
||||
}
|
||||
private string CreateFileName(string procNumber)
|
||||
{
|
||||
return FixFileName(procNumber);
|
||||
}
|
||||
private string FixFileName(string name)
|
||||
{
|
||||
return Regex.Replace(name, "[ .,/]", "_") + ".pdf";
|
||||
}
|
||||
//private string CreateFileName(string procNumber, string sectNumber, string sectTitle)
|
||||
//{
|
||||
// return FixFileName(procNumber + "_" + ((sectNumber ?? "") != "" ? sectNumber : sectTitle));
|
||||
//}
|
||||
//private string CreateFileName(string procNumber)
|
||||
//{
|
||||
// return FixFileName(procNumber);
|
||||
//}
|
||||
//private string FixFileName(string name)
|
||||
//{
|
||||
// return Regex.Replace(name, "[ .,/]", "_") + ".pdf";
|
||||
//}
|
||||
int _StepPageNumber = 0;
|
||||
private VlnSvgPageHelper _MyHelper = null;
|
||||
private static PdfReader _MyFoldoutReader = null;
|
||||
private static SectionInfo _MyFoldoutSection = null;
|
||||
@ -296,6 +298,12 @@ namespace Volian.Print.Library
|
||||
}
|
||||
return sectionID;
|
||||
}
|
||||
private bool _AllowAllWatermarks = false;
|
||||
public bool AllowAllWatermarks
|
||||
{
|
||||
get { return _AllowAllWatermarks; }
|
||||
set { _AllowAllWatermarks = value; }
|
||||
}
|
||||
private string PrintProcedureOrFoldout(ProcedureInfo myProcedure, bool doingFoldout, string outputFileName)
|
||||
{
|
||||
// The following line accounts for 16bit OverrideLeftMargin when the 'Absolute' attribute is used in the genmac.
|
||||
@ -324,6 +332,7 @@ namespace Volian.Print.Library
|
||||
if (_MyHelper == null)
|
||||
{
|
||||
cb.PdfWriter.PageEvent = _MyHelper = new VlnSvgPageHelper(mySection);
|
||||
_MyHelper.AllowAllWatermarks = AllowAllWatermarks;
|
||||
_MyHelper.MyPdfWriter = cb.PdfWriter;
|
||||
_MyHelper.CreatingFoldoutPage = doingFoldout;
|
||||
_MyHelper.MyPdfContentByte = cb;
|
||||
|
Loading…
x
Reference in New Issue
Block a user