C2025-017 Added an option to print (generate) all of the current Approved versions of PDFs and place them in a user specified folder #607

Merged
mschill merged 1 commits from C2025-017_PrintAllApproved into Development 2025-09-04 15:44:02 -04:00
6 changed files with 527 additions and 11 deletions

View File

@@ -224,6 +224,12 @@
<Compile Include="dlgPickROFolder.designer.cs">
<DependentUpon>dlgPickROFolder.cs</DependentUpon>
</Compile>
<Compile Include="dlgPrintAllApprovedProcedures.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="dlgPrintAllApprovedProcedures.Designer.cs">
<DependentUpon>dlgPrintAllApprovedProcedures.cs</DependentUpon>
</Compile>
<Compile Include="DlgPrintProcedure.cs">
<SubType>Form</SubType>
</Compile>
@@ -359,6 +365,9 @@
<EmbeddedResource Include="dlgImpHowToHandleROs.resx">
<DependentUpon>dlgImpHowToHandleROs.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="dlgPrintAllApprovedProcedures.resx">
<DependentUpon>dlgPrintAllApprovedProcedures.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DlgPrintProcedure.resx">
<DependentUpon>DlgPrintProcedure.cs</DependentUpon>
<SubType>Designer</SubType>

View File

@@ -0,0 +1,136 @@

namespace VEPROMS
{
partial class dlgPrintAllApprovedProcedures
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(dlgPrintAllApprovedProcedures));
this.txbApprovedPDFsPath = new DevComponents.DotNetBar.Controls.TextBoxX();
this.labelX1 = new DevComponents.DotNetBar.LabelX();
this.ppBtnPDFLoc = new DevComponents.DotNetBar.ButtonX();
this.ApprovedPDFsFolderDlg = new System.Windows.Forms.FolderBrowserDialog();
this.btnPrntAllAprv = new DevComponents.DotNetBar.ButtonX();
this.btnCancel = new DevComponents.DotNetBar.ButtonX();
this.SuspendLayout();
//
// txbApprovedPDFsPath
//
//
//
//
this.txbApprovedPDFsPath.Border.Class = "TextBoxBorder";
this.txbApprovedPDFsPath.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.txbApprovedPDFsPath.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txbApprovedPDFsPath.Location = new System.Drawing.Point(11, 45);
this.txbApprovedPDFsPath.Name = "txbApprovedPDFsPath";
this.txbApprovedPDFsPath.PreventEnterBeep = true;
this.txbApprovedPDFsPath.Size = new System.Drawing.Size(611, 22);
this.txbApprovedPDFsPath.TabIndex = 0;
this.txbApprovedPDFsPath.WatermarkText = "Enter to Path of where to Place All Approved PDFs";
this.txbApprovedPDFsPath.TextChanged += new System.EventHandler(this.txbApprovedPDFsPath_TextChanged);
//
// labelX1
//
//
//
//
this.labelX1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.labelX1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelX1.Location = new System.Drawing.Point(12, 22);
this.labelX1.Name = "labelX1";
this.labelX1.Size = new System.Drawing.Size(360, 23);
this.labelX1.TabIndex = 1;
this.labelX1.Text = "Approved PDFs Location:";
//
// ppBtnPDFLoc
//
this.ppBtnPDFLoc.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.ppBtnPDFLoc.Image = ((System.Drawing.Image)(resources.GetObject("ppBtnPDFLoc.Image")));
this.ppBtnPDFLoc.Location = new System.Drawing.Point(627, 45);
this.ppBtnPDFLoc.Margin = new System.Windows.Forms.Padding(2);
this.ppBtnPDFLoc.Name = "ppBtnPDFLoc";
this.ppBtnPDFLoc.Size = new System.Drawing.Size(37, 22);
this.ppBtnPDFLoc.TabIndex = 32;
this.ppBtnPDFLoc.Click += new System.EventHandler(this.ppBtnPDFLoc_Click);
//
// btnPrntAllAprv
//
this.btnPrntAllAprv.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnPrntAllAprv.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnPrntAllAprv.Enabled = false;
this.btnPrntAllAprv.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnPrntAllAprv.Location = new System.Drawing.Point(397, 120);
this.btnPrntAllAprv.Name = "btnPrntAllAprv";
this.btnPrntAllAprv.Size = new System.Drawing.Size(132, 26);
this.btnPrntAllAprv.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnPrntAllAprv.TabIndex = 33;
this.btnPrntAllAprv.Text = "Print All Approved";
this.btnPrntAllAprv.Click += new System.EventHandler(this.btnPrntAllAprv_Click);
//
// btnCancel
//
this.btnCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnCancel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnCancel.Location = new System.Drawing.Point(564, 120);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(99, 26);
this.btnCancel.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnCancel.TabIndex = 34;
this.btnCancel.Text = "Close";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// dlgPrintAllApprovedProcedures
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(675, 161);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnPrntAllAprv);
this.Controls.Add(this.ppBtnPDFLoc);
this.Controls.Add(this.labelX1);
this.Controls.Add(this.txbApprovedPDFsPath);
this.Cursor = System.Windows.Forms.Cursors.Default;
this.DoubleBuffered = true;
this.Name = "dlgPrintAllApprovedProcedures";
this.ShowIcon = false;
this.Text = "Print All Approved Procedures";
this.ResumeLayout(false);
}
#endregion
private DevComponents.DotNetBar.Controls.TextBoxX txbApprovedPDFsPath;
private DevComponents.DotNetBar.LabelX labelX1;
private DevComponents.DotNetBar.ButtonX ppBtnPDFLoc;
private System.Windows.Forms.FolderBrowserDialog ApprovedPDFsFolderDlg;
private DevComponents.DotNetBar.ButtonX btnPrntAllAprv;
private DevComponents.DotNetBar.ButtonX btnCancel;
}
}

View File

@@ -0,0 +1,202 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using VEPROMS.CSLA.Library;
using JR.Utils.GUI.Forms;
namespace VEPROMS
{
public partial class dlgPrintAllApprovedProcedures : DevComponents.DotNetBar.Office2007Form
{
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private StringBuilder NotApproved;
private DocVersionInfo _DocVersionInfo = null;
private int unitId = 0;
public dlgPrintAllApprovedProcedures(DocVersionInfo dvi)
{
InitializeComponent();
_DocVersionInfo = dvi;
unitId = (_DocVersionInfo.DocVersionConfig.SelectedSlave < 0) ? 0 : _DocVersionInfo.DocVersionConfig.SelectedSlave; // set unitId to zero if not Parent/Child
NotApproved = new StringBuilder();
txbApprovedPDFsPath.Text = BuildInitialPDFPath(); // set to default approved PDF path
}
// create an approved PDFs path based on the user's Documents folder and the tree path to the working draft
private string BuildInitialPDFPath()
{
// start with the SearchDVPath which is the node path staring with the top of the PROMS Procedure tree (VEPROMS)
string rtnstr = _DocVersionInfo.ActiveParent.SearchDVPath;
// remove top tree node (VEPROMS) and put a " - " between each tree node name
rtnstr = rtnstr.Substring(rtnstr.IndexOf("\a") + 1).Replace("\a", " - ");
// add the user's path to the My Documments folder to the start of the path
rtnstr = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\" + rtnstr;
// check if we are printing Approved Child Procedures
// if SelectedSlave is > 0 then we are printing Approved Child Procedures and
// subtract one from the index (unitId) into the list of child names (UnitNames)
if (unitId > 0)
rtnstr += "\\" + _DocVersionInfo.UnitNames[unitId - 1]; // append Child name to path
return rtnstr;
}
private void ppBtnPDFLoc_Click(object sender, EventArgs e)
{
if (txbApprovedPDFsPath.Text.Length > 0)
ApprovedPDFsFolderDlg.SelectedPath = txbApprovedPDFsPath.Text;
DialogResult dr = ApprovedPDFsFolderDlg.ShowDialog();
if (dr == DialogResult.OK)
{
txbApprovedPDFsPath.Text = ApprovedPDFsFolderDlg.SelectedPath;
}
}
private bool FolderIsWritable(string dirPath)
{
try
{
using (FileStream fs = File.Create(Path.Combine(dirPath, Path.GetRandomFileName()), 1, FileOptions.DeleteOnClose))
{ }
return true;
}
catch
{
return false;
}
}
private void btnPrntAllAprv_Click(object sender, EventArgs e)
{
try
{
// Create folder if needed, clear the folder
if (!Directory.Exists(txbApprovedPDFsPath.Text))
Directory.CreateDirectory(txbApprovedPDFsPath.Text);
// check if the folder location is writable
if (!FolderIsWritable(txbApprovedPDFsPath.Text))
{
MessageBox.Show("Cannot Write to this folder.\n\nSelect a different location.", "Invalid Folder Access", MessageBoxButtons.OK, MessageBoxIcon.Error);
btnPrntAllAprv.Enabled = false;
}
else
{
int pdfCount = 0;
DeleteExistingPDFs(); // delete existing PDFs in the target folder
// Get the Child index for Parent/Child procedure - if not Parent/Child this will be zero
foreach (ProcedureInfo myProc in _DocVersionInfo.Procedures)
{
RevisionInfoList ril = RevisionInfoList.GetByItemID(myProc.ItemID);
if (ril.Count == 0)
{
NotApproved.AppendLine(string.Format("No approved Version for {0}", (myProc.PDFNumber.Length > 0) ? myProc.PDFNumber : myProc.DisplayText));
}
else
{
bool foundApproved = false;
foreach (RevisionInfo revinfo in ril)
{
// if not Parent/Child, "unitId" and "Applicability_index" will be zero
if (unitId == revinfo.MyConfig.Applicability_Index)
{
if (revinfo.LatestVersion.MyStage.IsApproved > 0)
{
foundApproved = true;
ItemInfo ii = ItemInfo.Get(revinfo.ItemID);
ii.MyDocVersion.DocVersionConfig.SelectedSlave = unitId;
ProcedureInfo prcInfo = ProcedureInfo.Get(ii.ItemID);
SaveApprovedPDFToFolder(revinfo, prcInfo.PDFNumber);// save PDF to folder
pdfCount++;
break; // got the latest Approved - jump out of foreach revision info loop
}
}
}
if (!foundApproved) NotApproved.AppendLine(string.Format("No approved Version for {0}", myProc.PDFNumber));
}
}
// if no Approved PDFs were save, display general message and exit
if (pdfCount == 0)
{
string msg = "There are no Approved Procedure PDFs in this procedure set.\n\n Approved Procedures PDFs are created when a procedure is approved using the PROMS Approval function.";
FlexibleMessageBox.Show(msg, "Print PDFs Completed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else // we saved some approved PDFs tell user how many were saved and list procedures that were not approved
{
string msg = string.Format("{0} PDFs were saved at\n\n{1}", pdfCount, txbApprovedPDFsPath.Text);
if (NotApproved.Length > 0)
{
msg += string.Format("\n\n--------------------------------------------\n\nPDFs for the Following were not Generated:\n\n{0}", NotApproved.ToString());
}
FlexibleMessageBox.Show(msg, "Print PDFs Completed", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
catch (Exception ex)
{
_MyLog.Error("Print All Approved PDFs", ex);// save error in PROMS error log
MessageBox.Show(ex.Message, ex.GetType().FullName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
this.Close(); // close dialog
}
private void SaveApprovedPDFToFolder(RevisionInfo revInfo,string PDFName)
{
byte[] buffer = revInfo.LatestVersion.PDF;
string PDFFilePath = string.Format("{0}\\{1}.PDF", txbApprovedPDFsPath.Text, PDFName);
try
{
FileStream fs = new FileStream(PDFFilePath, FileMode.Create);
fs.Write(buffer, 0, buffer.Length);
fs.Close();
}
catch (Exception ex)
{
string str = string.Format("Could not create {0}", PDFFilePath);
NotApproved.AppendLine(str); // save to list of procedure that were not approved
_MyLog.Info(str, ex);// save error in PROMS error log
}
}
private void DeleteExistingPDFs()
{
DirectoryInfo di = new DirectoryInfo(txbApprovedPDFsPath.Text);
FileInfo[] fis;
//DirectoryInfo[] diAry = di.GetDirectories(txbApprovedPDFsPath.Text);
//DirectoryInfo di_fmtgen;
// remove all of the PDF fils
//di_fmtgen = diAry[0];
try
{
fis = di.GetFiles("*.pdf");
foreach (FileInfo fi in fis)
{
if (fi.IsReadOnly) fi.IsReadOnly = false;
fi.Delete();
}
}
catch (Exception ex)
{
string str = string.Format("Cannot delete files in {0}", txbApprovedPDFsPath.Text);
MessageBox.Show(str, "Error deleting files", MessageBoxButtons.OK, MessageBoxIcon.Error);
_MyLog.Info(str, ex); // save error in PROMS error log
}
}
private void txbApprovedPDFsPath_TextChanged(object sender, EventArgs e)
{
btnPrntAllAprv.Enabled = txbApprovedPDFsPath.Text.Length > 0;
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

View File

@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="ppBtnPDFLoc.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAr2AAAK9gHCr3ADAAACc0lE
QVQ4T6WSWUjUURSH/w899GSRGoVgZIlYIAaGVA8hSouaUm6FkiaUWyWGYq7NuM7oLI46pWLOqNOoo5Wl
GFYIhSIRWi6UmJoFhaWYGiq5feFIg9tL9fDBvYf7+ziccwVA+B82FDYjs1DnKlbpuSktJ1ttIEmmTf4r
QUisGp8IedDy+VpCmWWaSk9chsYvOLYQoU6nDKjTKVlPU41Evl70h8ikojO+UXK8I/KMAvq7tcxO1Br5
Na5nflSDoVxOvS4jbX14GZ9IBd7hKjzDChBqKxTMjFetCS+OFDHfG0NVmZTK4iw0hWmU5KVyR5ZIgSSe
1TKhWpvLzHetKbw0UgT9idAbtikbBPdKJfz8WmIKN9flGnliyKFBL+FhZRYGTTr6EjHl6lvcVSVTrEhE
nZtglAmVJVlMfco3tj3UKqK+SsHikBiGM9byUQyDSdAXC++i6KrxJzrUq0LQqNOZHJDCZxmPquW0P5Wt
PFrd+ttg6PBloc2D2WcufKhw4OrFk5PRoV4HhVKViB/vxQy3pVCvl7E0KIKe8JVgVyh0nGeh3YvZlhNM
NR1jrO4Q4ghbLrhZ5BlnUKRIYaw7gfu6XDpfSqEvBnouQ2cQS6/OMvfiNNPNxxmvd+JbtT0dmdsJ9LDB
yc7MzihQ5yTS05LKA10ODKTCm2B47cdcqyfTz12YaHBm1ODAF+1+emXmiML24XjAqtG0hfzseGrLpfQ+
jqRDKZhol22hRbKVxrRt1CRboom34vaNPQS6711ydrR2NwmUGXEoRVfITggh6XrA8mS55O/GuVNHcD3q
wGEHW+xtrLDebcHOHWbsMjdb+w9WX/6F370P0Tty1Sp4AAAAAElFTkSuQmCC
</value>
</data>
<metadata name="ApprovedPDFsFolderDlg.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -534,6 +534,7 @@ namespace VEPROMS
tv.QPrintSection += new vlnTreeViewEvent(tv_QPrintSection);
tv.QPrintProcedure += new vlnTreeViewEvent(tv_QPrintProcedure);
tv.PrintAllProcedures += new vlnTreeViewEvent(tv_PrintAllProcedures);
tv.PrintAllApprovedProcedures += new vlnTreeViewEvent(tv_PrintAllApprovedProcedures);
tv.ApproveProcedure += new vlnTreeViewEvent(tv_ApproveProcedure);
tv.ApproveAllProcedures += new vlnTreeViewEvent(tv_ApproveAllProcedures);
tv.ApproveSomeProcedures += new vlnTreeViewEvent(tv_ApproveSomeProcedures);
@@ -1212,7 +1213,27 @@ namespace VEPROMS
dvi.DocVersionConfig.SelectedSlave = 0;
}
// C2025-017 print all approved procedure to a specified folder
void tv_PrintAllApprovedProcedures(object sender, vlnTreeEventArgs args)
{
using (DocVersionInfo dvi = (args.Node as VETreeNode).VEObject as DocVersionInfo)
{
if (dvi == null) return;
tc.SaveCurrentEditItem(); // save the current edit item if user happens to be editing a procedure
// add a diaglog to prompt for the path inwhich to put the approved pdfs
int currentChildSetting = dvi.DocVersionConfig.SelectedSlave;
dvi.DocVersionConfig.SelectedSlave = args.UnitIndex; // set to selected child - will be -1 for non Parent/Child
dlgPrintAllApprovedProcedures dlgPrnAllAprv = new dlgPrintAllApprovedProcedures(dvi);
dlgPrnAllAprv.ShowDialog(this);
dvi.DocVersionConfig.SelectedSlave = currentChildSetting; // set back to what it was
}
}
void tv_PrintProcedure(object sender, vlnTreeEventArgs args)
{
ProcedureInfo pi = (args.Node as VETreeNode).VEObject as ProcedureInfo;
@@ -2470,6 +2491,7 @@ namespace VEPROMS
int _ItemID = (int)TabState["ItemID"];
ItemInfo _Procedure = ItemInfo.Get(_ItemID);
// Open procedure in the editor.
if (_Procedure == null) continue; //skip and continue with foreach
OpenItem(_Procedure);
// SelectedStepTabPanel needs to be set so the print buttons on the ribbon will work.
SelectedStepTabPanel = tc.MyEditItem.MyStepPanel.MyStepTabPanel;

View File

@@ -563,6 +563,11 @@ namespace Volian.Controls.Library
{
if (PrintAllProcedures != null) PrintAllProcedures(sender, args);
}
public event vlnTreeViewEvent PrintAllApprovedProcedures; //C2025-017 print all approved procedures
private void OnPrintAllApprovedProcedures(object sender, vlnTreeEventArgs args)
{
if (PrintAllApprovedProcedures != null) PrintAllApprovedProcedures(sender, args);
}
public event vlnTreeViewEvent SelectDateToStartChangeBars;
private void OnSelectDateToStartChangeBars(object sender, vlnTreeEventArgs args)
{
@@ -784,6 +789,7 @@ namespace Volian.Controls.Library
MenuItem mip = new MenuItem("Print All Procedures for");
MenuItem mia = new MenuItem("Approve All Procedures for");
MenuItem mis = new MenuItem("Approve Some Procedures for");
MenuItem mir = new MenuItem("Print All Approved Procedures for"); // C2025-017 print all approved procedures
int k = 0;
foreach (string s in dvi.UnitNames)
{
@@ -794,6 +800,8 @@ namespace Volian.Controls.Library
ma.Tag = k;
MenuItem ms = mis.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
ms.Tag = k;
MenuItem mr = mir.MenuItems.Add(s, new EventHandler(miMultiUnit_Click)); // C2025-017 print all approved procedures
mr.Tag = k;
}
//MenuItem mmp = mip.MenuItems.Add("All Units", new EventHandler(miMultiUnit_Click));
//mmp.Tag = 0;
@@ -804,6 +812,7 @@ namespace Volian.Controls.Library
cm.MenuItems.Add(mip);
cm.MenuItems.Add(mia);
cm.MenuItems.Add(mis);
cm.MenuItems.Add(mir); // C2025-017 print all approved procedures
}
else
{
@@ -811,6 +820,7 @@ namespace Volian.Controls.Library
cm.MenuItems.Add("Print All Procedures", new EventHandler(mi_Click));
cm.MenuItems.Add("Approve All Procedures", new EventHandler(mi_Click));
cm.MenuItems.Add("Approve Some Procedures", new EventHandler(mi_Click));
cm.MenuItems.Add("Print All Approved Procedures", new EventHandler(mi_Click));
}
cm.MenuItems.Add("Report All Procedures Inconsistencies", new EventHandler(mi_Click));
}
@@ -2035,6 +2045,9 @@ namespace Volian.Controls.Library
case "Create Time Critical Action Summary":
OnCreateTimeCriticalActionSummary(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag));
break;
case "Print All Approved Procedures for": //C2025-017 print all approved procedures
OnPrintAllApprovedProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag));
break;
default:
if (mip.Text.StartsWith("Showing Change Bars Starting"))
OnSelectDateToStartChangeBars(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0));
@@ -2133,16 +2146,6 @@ namespace Volian.Controls.Library
OnPrintTransitionReport(this, new vlnTreeEventArgs(SelectedNode as VETreeNode));
return;
}
if (mi.Text == "Export Procedure Set" || mi.Text == "Export Procedure")
{
OnExportImportProcedureSets(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0));
@@ -2346,6 +2349,9 @@ namespace Volian.Controls.Library
//case "Check In Procedure Set":
// CheckInDocVersion(SelectedNode as VETreeNode);
// break;
case "Print All Approved Procedures": //C2025-017 print all approved procedures
OnPrintAllApprovedProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0));
break;
default:
if (mi.Text.StartsWith("Showing Change Bars Starting"))
OnSelectDateToStartChangeBars(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0));