| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -10,6 +10,7 @@ using System.IO;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				using System.Text.RegularExpressions;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				using JR.Utils.GUI.Forms;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				using Volian.Base.Library;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				using System.Linq;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				namespace Volian.Controls.Library
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -263,7 +264,7 @@ namespace Volian.Controls.Library
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										AnnotationTypeInfo ati = AnnotationTypeInfo.Get(aai.TypeID);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										// B2023-066: Crash when trying to access a deleted annotation type (added the ati==null check)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										tn = annotationDeleted.Nodes.Add(ati==null?"Deleted Annotation Type":ati.Name);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										tn = annotationDeleted.Nodes.Add(ati == null ? "Deleted Annotation Type" : ati.Name);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									TreeNode cn = tn.Nodes.Add(aai.ListString());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									cn.Tag = aai;
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -517,7 +518,7 @@ namespace Volian.Controls.Library
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									if (delC.Type >= 0 && delC.Type < 1000)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										int indx = delC.Config.IndexOf("DelProcReason");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										if (indx >= 0 && delC.Config.Length > indx+15)		// 15 accounts for 'DelProcReason = "'
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										if (indx >= 0 && delC.Config.Length > indx + 15)        // 15 accounts for 'DelProcReason = "'
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
											string reason = delC.Config.Substring(indx + 15);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
											if (reason != null && reason.Length > 0)
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -529,7 +530,7 @@ namespace Volian.Controls.Library
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								TreeNode tnn = deletedItems.Nodes.Add(iai.ToString()+"; Reason: " + strR);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								TreeNode tnn = deletedItems.Nodes.Add(iai.ToString() + "; Reason: " + strR);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								tnn.Tag = iai;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								#endregion
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -558,7 +559,7 @@ namespace Volian.Controls.Library
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							if (MyProcedureInfo == null)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								this.ParentForm.Cursor = Cursors.Default;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								btnViewSummaryReport.Enabled = btnViewChronologyReport.Enabled = lbChanges.Items.Count > 0;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								btnViewSummaryReport.Enabled = btnViewChronologyReport.Enabled = cbSumExcludeAnn.Enabled = DT_SumAsOf.Enabled = lbChanges.Items.Count > 0;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								return;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							ContentAuditInfoList cail2;
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -586,7 +587,7 @@ namespace Volian.Controls.Library
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								// B2020-156: When procedure title is changed, it does not print in Summary/Chronolgy of changes.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								//		Need to only check the date (not the date/time) for some procedures, the original item was listed 
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								//		in the list box and should not be because some MyRevDate's did not have time included.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								if (CompareDateOrDateTime(cai.DTS,MyRevDate) || cai.ActionWhen > MyRevDate)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								if (CompareDateOrDateTime(cai.DTS, MyRevDate) || cai.ActionWhen > MyRevDate)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									string itemTitle = FixPath(cai.Path);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									lbChanges.Items.Add(cai);
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -614,7 +615,7 @@ namespace Volian.Controls.Library
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							//Console.WriteLine("WalkProcedure fini:  {0} seconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalSeconds);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							this.ParentForm.Cursor = Cursors.Default;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							btnViewSummaryReport.Enabled = btnViewChronologyReport.Enabled = lbChanges.Items.Count > 0;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							btnViewSummaryReport.Enabled = btnViewChronologyReport.Enabled = cbSumExcludeAnn.Enabled = DT_SumAsOf.Enabled = lbChanges.Items.Count > 0;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							RefreshRequired = false;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							return;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -648,9 +649,73 @@ namespace Volian.Controls.Library
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							//_AnnotationList = AnnotationAuditInfoList.GetChronology(0, 0, MyProcedureInfo.ChangeBarDate);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							//added setting selected slave in order for reports to replace unit number,etc jcb 20101010
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							MyItemInfo.MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = ApplDisplayMode;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							//			OnSummaryPrintRequest(new DisplayHistoryReportEventArgs(Volian.Base.Library.VlnSettings.TemporaryFolder + @"\MySummary.pdf", MyItemInfo.MyProcedure, _SummaryAuditList, _AnnotationList));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							OnSummaryPrintRequest(new DisplayHistoryReportEventArgs(string.Format(@"{0}\{1} Summary of Changes.pdf", Volian.Base.Library.VlnSettings.TemporaryFolder, MyItemInfo.MyProcedure.PDFNumber), MyItemInfo.MyProcedure, _SummaryAuditList, _AnnotationList));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							//}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							var dhr = new DisplayHistoryReportEventArgs(string.Format(@"{0}\{1} Summary of Changes.pdf", Volian.Base.Library.VlnSettings.TemporaryFolder, MyItemInfo.MyProcedure.PDFNumber), MyItemInfo.MyProcedure, null, null);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							//C2024- 038 - Summary of Changes report generation enhancements
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							//check if need to modify
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							// _SummaryAuditList
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							if (DT_SumAsOf.Checked)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								dhr.AuditList = FilterSummaryByDate(_SummaryAuditList, DT_SumAsOf.Value);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							else
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								dhr.AuditList = _SummaryAuditList;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							//C2024- 038 - Summary of Changes report generation enhancements
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							// if Exclude Annotations Checked
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							// send an empty list instead of 
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							//_AnnotationList
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							if (cbSumExcludeAnn.Checked)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								dhr.AnnotationList = new AnnotationAuditInfoList(null);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							else if (DT_SumAsOf.Checked)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								dhr.AnnotationList = FilterSummaryByDate_Annotations(_AnnotationList, DT_SumAsOf.Value);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							else
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							{ dhr.AnnotationList = _AnnotationList; }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							OnSummaryPrintRequest(dhr);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						//C2024- 038 - Summary of Changes report generation enhancements
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						//modify _SummaryAuditList
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						//to limit to a specific date
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						private ContentAuditInfoList FilterSummaryByDate(ContentAuditInfoList summaryAuditList, DateTime value)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							List<ContentAuditInfo> slst = summaryAuditList.Clone().ToList();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							//Grab the first change to each item before the date and set that to the AsOf date
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							foreach (ContentAuditInfo firstbeforedate in slst.GroupBy(x => x.ItemID).Select(x => x.OrderByDescending(y => y.DTS).FirstOrDefault(d => d.DTS < value)))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								if (firstbeforedate != null && firstbeforedate.ActionWhat != "Deleted")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									firstbeforedate.ActionWhat = $"As Of: {value.ToShortDateString()}";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							//remove all items before the date we are checking against
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							//note that for deleted - sometimes the DTS is not correct and
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							//need to use the ActionWhen
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							slst.RemoveAll(x => x.DTS < value && !x.ActionWhat.StartsWith("As Of:") && (x.ActionWhat != "Deleted" || (x.ActionWhen < x.DTS ? x.DTS : x.ActionWhen) < value));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            //remove all items where first text matches the last text
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            //unless it was added after the date we are checking against
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            //or the last item is a deletion that occurred after 
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							//the date we are checking against
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            var itms = slst.Select(x => x.ItemID).Distinct().ToList();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								foreach (int itmID in itms)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									ContentAuditInfo first = slst.Where(i => i.ItemID == itmID).OrderBy(y => y.DTS).FirstOrDefault();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									ContentAuditInfo last = slst.Where(i => i.ItemID == itmID).OrderByDescending(y => y.DTS).FirstOrDefault();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									if (first != null && last != null && first.DTS < value && (last.ActionWhat != "Deleted" || (last.ActionWhen < last.DTS ? last.DTS : last.ActionWhen) < value) && ItemInfo.ConvertToDisplayText(first.Text) == ItemInfo.ConvertToDisplayText(last.Text))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										slst.RemoveAll(x => x.ItemID == itmID);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							return new ContentAuditInfoList(slst);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						//C2024- 038 - Summary of Changes report generation enhancements
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						//modify _SummaryAuditList
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						//to limit to a specific date
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						private AnnotationAuditInfoList FilterSummaryByDate_Annotations(AnnotationAuditInfoList annotationAuditList, DateTime value)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							return new AnnotationAuditInfoList(annotationAuditList.Where(x => x.DTS >= value).ToList());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						private void btnRefresh_Click(object sender, EventArgs e)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						{
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				 
 |