From 89dd2f72b0dd8c13fd21715be8c5496a2cfc9353 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 4 Apr 2013 13:54:53 +0000 Subject: [PATCH] =?UTF-8?q?B2013-078=20=E2=80=93=20Add=20code=20to=20autom?= =?UTF-8?q?atically=20separate=20the=20RevDate=20from=20the=20RevNumber=20?= =?UTF-8?q?and=20put=20the=20information=20in=20the=20proper=20config=20fi?= =?UTF-8?q?elds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DlgPrintProcedure.cs | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs index c5504613..246c93cb 100644 --- a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs +++ b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs @@ -48,7 +48,8 @@ namespace VEPROMS // Therefore we need to build a revison number string with a revdate appended to it but only // if either the DoRevDate or the RevDateWithForwardSlash is true. otherwise we should use // only the RevNumber. - if (txbRevDate.Text == "" || + if (RevDate == "" || + (RevNum.Contains("\\") || RevNum.Contains("/")) || (!MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash && !MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate)) return RevNum; @@ -282,6 +283,22 @@ namespace VEPROMS RevNum = pc.Print_Rev; RevDate = pc.Print_RevDate; //== null || pc.Print_RevDate=="" ? DateTime.Today : Convert.ToDateTime(pc.Print_RevDate); ReviewDate = pc.Print_ReviewDate; // == null ? DateTime.Today : Convert.ToDateTime(pc.Print_ReviewDate); + //Now check the format flags to determine if/how the Rev string should be parsed. + // This will covert the old way (16-bit) of setting a RevDate (appending it to the RevNumber) + // to the new way saving the RevNumber and RevDate in there own config fields + if ((_MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate && RevNum.Contains("/")) + || (_MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash && RevNum.Contains("\\"))) + { + int indx = RevNum.IndexOf(_MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash ? '\\' : '/'); + pc.Print_RevDate = RevDate = RevNum.Substring(indx + 1); + pc.Print_Rev = RevNum = RevNum.Substring(0, indx); + // save the RevNumber and RevDate to the procedure's config. + using (Item itm = Item.Get(MyProcedure.ItemID)) + { + itm.MyContent.Config = MyProcedure.MyConfig.ToString(); + itm.Save(); + } + } } else { @@ -309,12 +326,18 @@ namespace VEPROMS ppTxbxChangeBarUserMsgTwo.Text = _DocVersionConfig.Print_UserCBMess2; ppGpbxUserSpecTxt.Enabled = ppCmbxChgBarTxtType.SelectedIndex == (int)PrintChangeBarText.UserDef; bool hasReviewDate = _MyProcedure.ActiveFormat.PlantFormat.HasPageListToken("{REVIEWDATE}"); - bool usesRevDate = _MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate; + bool usesRevDate = _MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate || _MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash; if (_MyProcedure.Sections != null) { foreach (SectionInfo mysection in _MyProcedure.Sections) hasReviewDate |= mysection.ActiveFormat.PlantFormat.HasPageListToken("{REVIEWDATE}"); } + // Only the New HLP format and the MYA format use this + // South Texas does not use their new HLP format and MYA (Main Yankee) has dropped us (they closed) + // thus there is no supporting code to print a Review Date + // thus setting "hasReviewDate" to false so the Review Date entry box does not appear on the print dialog + // - jsj 4/3/2013 + hasReviewDate = false; // jsj 4/3/2013 lblReviewDate.Visible = txbReviewDate.Visible = !_AllProcedures && hasReviewDate; lblRevDate.Visible = txbRevDate.Visible = !_AllProcedures && usesRevDate; }