B2019-051: Summary of changes not resetting properly after new Approval revision
This commit is contained in:
		@@ -1005,11 +1005,39 @@ namespace VEPROMS
 | 
			
		||||
		}
 | 
			
		||||
		public bool Approve(Point location)
 | 
			
		||||
		{
 | 
			
		||||
			// The following is a description of the tables used to defined the various revisions of the procedure set.
 | 
			
		||||
			//	Revision:
 | 
			
		||||
			//		ItemId: procedure id. This represents the revision of this procedure
 | 
			
		||||
			//		TypeId (no longer used) 
 | 
			
		||||
			//		Revision number (on approval dialog) 
 | 
			
		||||
			//		Revision Date (on approval dialog)
 | 
			
		||||
			//		Config: History_StartDate - beginning for changebars, Applicability_Index - which slave
 | 
			
		||||
			//		DTS:
 | 
			
		||||
			//	Version: 
 | 
			
		||||
			//		RevisionId: to relate this to the 'Revision' table
 | 
			
		||||
			//		StageId: to relate to 'Stage' table. 
 | 
			
		||||
			//		Pdf:   Procedure Pdf
 | 
			
		||||
			//		SummaryPdf: summary of changes pdf
 | 
			
		||||
			//		ApprovedXML: the export of the procedure, so that it can be imported (the contents of this field is just written to the file system as an export file)
 | 
			
		||||
			//			this field is only filled in for approvals that use a stage that 'is approved'
 | 
			
		||||
			//	Stage:
 | 
			
		||||
			//		Name:  stage name, displays in approval dialog.  Prints as a watermark for those stages that are workflow (not approved)
 | 
			
		||||
			//			Examples are 'Initial Draft', 'Issued', where 'Initial Draft' is not approved and 'Issued' is approved
 | 
			
		||||
			//		IsApproved: whether this stage is an approval stage
 | 
			
		||||
			//	Item/Content (Procedure):
 | 
			
		||||
			//		DTS (Item): Note that only place item's dts is used is in approval & for changes bars
 | 
			
		||||
			//		Config (Content): 
 | 
			
		||||
			//			Print_ChangeBarDate
 | 
			
		||||
			//				set 1) if no revision record a menu item on treeview from procedure allows setting of this
 | 
			
		||||
			//						2) set during approval process when stage 'isapproved'
 | 
			
		||||
			//				if this is not set, code uses pi.dts, i.e. the procedure (item) record's dts
 | 
			
		||||
			//			Rev & RevDate - the most current rev from revision table 
 | 
			
		||||
			ViewPDF = ViewPDF && MyProcedures.Count == 1;
 | 
			
		||||
			StringBuilder sb = new StringBuilder();
 | 
			
		||||
			StageInfo nsi = StageInfo.GetJustStage(RevStage);
 | 
			
		||||
			foreach (ApprovalProcedure ap in MyProcedures) //spin thru looking for updating current revision
 | 
			
		||||
			{
 | 
			
		||||
				// ric: current revision info record, not new one being created.
 | 
			
		||||
				RevisionInfo ric = ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave > 0 ? RevisionInfo.GetCurrentByItemIDandUnitID(ap.ProcInfo.ItemID,ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave) : RevisionInfo.GetCurrentByItemID(ap.ProcInfo.ItemID);
 | 
			
		||||
				if (ric != null)
 | 
			
		||||
				{
 | 
			
		||||
@@ -1042,28 +1070,36 @@ namespace VEPROMS
 | 
			
		||||
				if (!TryToDelete(pdfPath)) break;
 | 
			
		||||
				RevisionInfo ric = pi.MyDocVersion.DocVersionConfig.SelectedSlave > 0 ? RevisionInfo.GetCurrentByItemIDandUnitID(pi.ItemID, pi.MyDocVersion.DocVersionConfig.SelectedSlave) : RevisionInfo.GetCurrentByItemID(pi.ItemID);
 | 
			
		||||
//				RevisionInfo rip = RevisionInfo.GetPreviousByItemID(pi.ItemID);
 | 
			
		||||
				DateTime myDTS = pi.DTS;
 | 
			
		||||
				DateTime myDTS = pi.DTS;			// pi.DTS is date of last approval 
 | 
			
		||||
				string cbDTS = (pi.MyConfig as ProcedureConfig).Print_ChangeBarDate;
 | 
			
		||||
				// pi.DTS was the field that was used to store the approval date before master/slave code was added. Use ChangeBarDate if it is set - this is set either manually if no approval date (from treeview menu) or 
 | 
			
		||||
				//   when approval was last done
 | 
			
		||||
				if ((cbDTS ?? "") != "")
 | 
			
		||||
					myDTS = DateTime.Parse(cbDTS);
 | 
			
		||||
				if (ric != null && ap.RevNumber == ric.RevisionNumber && ric.LatestVersion.MyStage.IsApproved == 1)
 | 
			
		||||
 | 
			
		||||
				// If for the approved revision that I have...  
 | 
			
		||||
				if (ric != null && ric.LatestVersion.MyStage.IsApproved == 1)
 | 
			
		||||
				{
 | 
			
		||||
					myDTS = ric.MyConfig.History_StartDate;
 | 
			
		||||
					//UpdateProcedureDTS(pi, myDTS);
 | 
			
		||||
				}
 | 
			
		||||
				if (ric != null && ap.RevNumber != ric.RevisionNumber && ric.LatestVersion.MyStage.IsApproved == 1)
 | 
			
		||||
				{
 | 
			
		||||
					myDTS = ric.DTS;
 | 
			
		||||
//					myDTS = DateTime.Parse(pi.ProcedureConfig.Print_RevDate);
 | 
			
		||||
					// I am repeating the same approval, i.e. rev numbers are the same, use the revision's start date
 | 
			
		||||
					if (ap.RevNumber == ric.RevisionNumber)
 | 
			
		||||
					{
 | 
			
		||||
						myDTS = ric.MyConfig.History_StartDate;
 | 
			
		||||
						//UpdateProcedureDTS(pi, myDTS);
 | 
			
		||||
					}
 | 
			
		||||
					// New approval, i.e. not same revision number, use the date from the latest approved version
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						myDTS = ric.LatestVersion.DTS;   // B2019-051: Extra info in Change Summary. Use the last 'approved' (ric.LatestVersion.MyStage.IsApproved==1)
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				Revision revision = null;
 | 
			
		||||
				if (ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave > 0)
 | 
			
		||||
				{
 | 
			
		||||
					revision = Revision.GetByItemIDAndRevisionNumberAndUnitID(pi.ItemID, ap.RevNumber, ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave);
 | 
			
		||||
					if (revision == null)
 | 
			
		||||
					if (revision == null)		// no revision yet, need to set the StartDate & which slave
 | 
			
		||||
					{
 | 
			
		||||
						RevisionConfig cfg = new RevisionConfig();
 | 
			
		||||
						cfg.History_StartDate = myDTS;	// pi.DTS;
 | 
			
		||||
						cfg.History_StartDate = myDTS;	// if there is a slave, date found from above code
 | 
			
		||||
						cfg.Applicability_Index = ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave;
 | 
			
		||||
						//cfg.Save();
 | 
			
		||||
						revision = Revision.MakeRevision(pi.ItemID, RevType, ap.RevNumber, ap.RevDate, RevNote, cfg.ToString(), DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
 | 
			
		||||
@@ -1084,10 +1120,10 @@ namespace VEPROMS
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					revision = Revision.GetByItemIDAndRevisionNumber(pi.ItemID, ap.RevNumber);
 | 
			
		||||
					if (revision == null)
 | 
			
		||||
					if (revision == null)   // no revision yet, need to set the StartDate.  If there is a revision, it uses the revision date as the startdate
 | 
			
		||||
					{
 | 
			
		||||
						RevisionConfig cfg = new RevisionConfig();
 | 
			
		||||
						cfg.History_StartDate = pi.DTS;
 | 
			
		||||
						cfg.History_StartDate = pi.DTS;		// todo: this should probably be myDTS, found during fix of B2019-051.
 | 
			
		||||
						//cfg.Save();
 | 
			
		||||
						revision = Revision.MakeRevision(pi.ItemID, RevType, ap.RevNumber, ap.RevDate, RevNote, cfg.ToString(), DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
 | 
			
		||||
						//					revision.MyConfig.History_StartDate = pi.DTS;
 | 
			
		||||
 
 | 
			
		||||
@@ -1067,7 +1067,8 @@ namespace Volian.Print.Library
 | 
			
		||||
										// 12/4/2015 - D.C. Cook, If a new procedure is added, every new section and step was appearing in the list twice.  
 | 
			
		||||
										// First when added, then with the final text.  It should only appear once with the action "Added" and with the latest
 | 
			
		||||
										// Date Time and User as well as the latest text.
 | 
			
		||||
										//auditList1.Add(firstCAI); //jcb uncommented
 | 
			
		||||
										// B2019-051: Missing information in Change Summary report:
 | 
			
		||||
										if (!(firstCAI.ActionWhat == "Added" && lastCAI.ActionWhat == "Added")) auditList1.Add(firstCAI);
 | 
			
		||||
										auditList1.Add(lastCAI);
 | 
			
		||||
										firstCAI = null;
 | 
			
		||||
										lastCAI = null;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user