diff --git a/PROMS/Volian.Controls.Library/DisplayReports.Designer.cs b/PROMS/Volian.Controls.Library/DisplayReports.Designer.cs new file mode 100644 index 00000000..1a5f3147 --- /dev/null +++ b/PROMS/Volian.Controls.Library/DisplayReports.Designer.cs @@ -0,0 +1,549 @@ +namespace Volian.Controls.Library +{ + partial class DisplayReports + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.tctrlReports = new DevComponents.DotNetBar.TabControl(); + this.tabControlPanel2 = new DevComponents.DotNetBar.TabControlPanel(); + this.panRORpts = new DevComponents.DotNetBar.PanelEx(); + this.cbxSummary = new DevComponents.DotNetBar.Controls.CheckBoxX(); + this.cbxROUsage = new DevComponents.DotNetBar.Controls.CheckBoxX(); + this.cbxComplete = new DevComponents.DotNetBar.Controls.CheckBoxX(); + this.labelX1 = new DevComponents.DotNetBar.LabelX(); + this.cmbxROUsageSort = new DevComponents.DotNetBar.Controls.ComboBoxEx(); + this.cbiRO = new DevComponents.Editors.ComboItem(); + this.cbiProc = new DevComponents.Editors.ComboItem(); + this.tabROReports = new DevComponents.DotNetBar.TabItem(this.components); + this.tabControlPanel1 = new DevComponents.DotNetBar.TabControlPanel(); + this.panelEx1 = new DevComponents.DotNetBar.PanelEx(); + this.cbxTransToProcs = new DevComponents.DotNetBar.Controls.CheckBoxX(); + this.cbxTransFromProcs = new DevComponents.DotNetBar.Controls.CheckBoxX(); + this.tabTransitionReports = new DevComponents.DotNetBar.TabItem(this.components); + this.advTreeRO = new DevComponents.AdvTree.AdvTree(); + this.elementStyle2 = new DevComponents.DotNetBar.ElementStyle(); + this.node2 = new DevComponents.AdvTree.Node(); + this.nodeConnector2 = new DevComponents.AdvTree.NodeConnector(); + this.xpSetToReport = new DevComponents.DotNetBar.ExpandablePanel(); + this.advTreeProcSets = new DevComponents.AdvTree.AdvTree(); + this.elementStyle1 = new DevComponents.DotNetBar.ElementStyle(); + this.node1 = new DevComponents.AdvTree.Node(); + this.nodeConnector1 = new DevComponents.AdvTree.NodeConnector(); + this.btnPrintReport = new DevComponents.DotNetBar.ButtonX(); + this.xpSelROs = new DevComponents.DotNetBar.ExpandablePanel(); + ((System.ComponentModel.ISupportInitialize)(this.tctrlReports)).BeginInit(); + this.tctrlReports.SuspendLayout(); + this.tabControlPanel2.SuspendLayout(); + this.panRORpts.SuspendLayout(); + this.tabControlPanel1.SuspendLayout(); + this.panelEx1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.advTreeRO)).BeginInit(); + this.xpSetToReport.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.advTreeProcSets)).BeginInit(); + this.xpSelROs.SuspendLayout(); + this.SuspendLayout(); + // + // tctrlReports + // + this.tctrlReports.CanReorderTabs = false; + this.tctrlReports.CloseButtonOnTabsAlwaysDisplayed = false; + this.tctrlReports.CloseButtonPosition = DevComponents.DotNetBar.eTabCloseButtonPosition.Right; + this.tctrlReports.Controls.Add(this.tabControlPanel2); + this.tctrlReports.Controls.Add(this.tabControlPanel1); + this.tctrlReports.Dock = System.Windows.Forms.DockStyle.Top; + this.tctrlReports.Location = new System.Drawing.Point(0, 0); + this.tctrlReports.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.tctrlReports.Name = "tctrlReports"; + this.tctrlReports.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.tctrlReports.SelectedTabFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold); + this.tctrlReports.SelectedTabIndex = 0; + this.tctrlReports.ShowFocusRectangle = false; + this.tctrlReports.Size = new System.Drawing.Size(348, 112); + this.tctrlReports.Style = DevComponents.DotNetBar.eTabStripStyle.Office2007Document; + this.tctrlReports.TabIndex = 0; + this.tctrlReports.TabLayoutType = DevComponents.DotNetBar.eTabLayoutType.FixedWithNavigationBox; + this.tctrlReports.Tabs.Add(this.tabTransitionReports); + this.tctrlReports.Tabs.Add(this.tabROReports); + this.tctrlReports.Text = "tabControl1"; + this.tctrlReports.ThemeAware = true; + // + // tabControlPanel2 + // + this.tabControlPanel2.Controls.Add(this.panRORpts); + this.tabControlPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabControlPanel2.Location = new System.Drawing.Point(0, 25); + this.tabControlPanel2.Margin = new System.Windows.Forms.Padding(4); + this.tabControlPanel2.Name = "tabControlPanel2"; + this.tabControlPanel2.Padding = new System.Windows.Forms.Padding(1); + this.tabControlPanel2.Size = new System.Drawing.Size(348, 87); + this.tabControlPanel2.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254))))); + this.tabControlPanel2.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227))))); + this.tabControlPanel2.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.tabControlPanel2.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(165)))), ((int)(((byte)(199))))); + this.tabControlPanel2.Style.BorderSide = ((DevComponents.DotNetBar.eBorderSide)(((DevComponents.DotNetBar.eBorderSide.Left | DevComponents.DotNetBar.eBorderSide.Right) + | DevComponents.DotNetBar.eBorderSide.Bottom))); + this.tabControlPanel2.Style.GradientAngle = 90; + this.tabControlPanel2.TabIndex = 2; + this.tabControlPanel2.TabItem = this.tabROReports; + // + // panRORpts + // + this.panRORpts.CanvasColor = System.Drawing.SystemColors.Control; + this.panRORpts.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; + this.panRORpts.Controls.Add(this.cbxSummary); + this.panRORpts.Controls.Add(this.cbxROUsage); + this.panRORpts.Controls.Add(this.cbxComplete); + this.panRORpts.Controls.Add(this.labelX1); + this.panRORpts.Controls.Add(this.cmbxROUsageSort); + this.panRORpts.Dock = System.Windows.Forms.DockStyle.Top; + this.panRORpts.Location = new System.Drawing.Point(1, 1); + this.panRORpts.Margin = new System.Windows.Forms.Padding(4); + this.panRORpts.Name = "panRORpts"; + this.panRORpts.Size = new System.Drawing.Size(346, 84); + this.panRORpts.Style.Alignment = System.Drawing.StringAlignment.Center; + this.panRORpts.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.panRORpts.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.panRORpts.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.panRORpts.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.panRORpts.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.panRORpts.Style.GradientAngle = 90; + this.panRORpts.TabIndex = 10; + this.panRORpts.ThemeAware = true; + // + // cbxSummary + // + this.cbxSummary.BackColor = System.Drawing.Color.Transparent; + // + // + // + this.cbxSummary.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.cbxSummary.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton; + this.cbxSummary.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.cbxSummary.Location = new System.Drawing.Point(190, 4); + this.cbxSummary.Margin = new System.Windows.Forms.Padding(4); + this.cbxSummary.Name = "cbxSummary"; + this.cbxSummary.Size = new System.Drawing.Size(99, 28); + this.cbxSummary.TabIndex = 1; + this.cbxSummary.Text = "Summary"; + this.cbxSummary.CheckedChanged += new System.EventHandler(this.cbxSummary_CheckedChanged); + // + // cbxROUsage + // + this.cbxROUsage.BackColor = System.Drawing.Color.Transparent; + // + // + // + this.cbxROUsage.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.cbxROUsage.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton; + this.cbxROUsage.Checked = true; + this.cbxROUsage.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbxROUsage.CheckValue = "Y"; + this.cbxROUsage.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.cbxROUsage.Location = new System.Drawing.Point(9, 4); + this.cbxROUsage.Margin = new System.Windows.Forms.Padding(4); + this.cbxROUsage.Name = "cbxROUsage"; + this.cbxROUsage.Size = new System.Drawing.Size(80, 28); + this.cbxROUsage.TabIndex = 2; + this.cbxROUsage.Text = "Usage"; + this.cbxROUsage.CheckedChanged += new System.EventHandler(this.cbxROUsage_CheckedChanged); + // + // cbxComplete + // + this.cbxComplete.BackColor = System.Drawing.Color.Transparent; + // + // + // + this.cbxComplete.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.cbxComplete.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton; + this.cbxComplete.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.cbxComplete.Location = new System.Drawing.Point(88, 4); + this.cbxComplete.Margin = new System.Windows.Forms.Padding(4); + this.cbxComplete.Name = "cbxComplete"; + this.cbxComplete.Size = new System.Drawing.Size(105, 28); + this.cbxComplete.TabIndex = 0; + this.cbxComplete.Text = "Complete"; + this.cbxComplete.CheckedChanged += new System.EventHandler(this.cbxComplete_CheckedChanged); + // + // labelX1 + // + // + // + // + this.labelX1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.labelX1.Location = new System.Drawing.Point(9, 39); + this.labelX1.Margin = new System.Windows.Forms.Padding(4); + this.labelX1.Name = "labelX1"; + this.labelX1.Size = new System.Drawing.Size(59, 28); + this.labelX1.TabIndex = 8; + this.labelX1.Text = "Sort By:"; + // + // cmbxROUsageSort + // + this.cmbxROUsageSort.DisplayMember = "Text"; + this.cmbxROUsageSort.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.cmbxROUsageSort.FormattingEnabled = true; + this.cmbxROUsageSort.ItemHeight = 14; + this.cmbxROUsageSort.Items.AddRange(new object[] { + this.cbiRO, + this.cbiProc}); + this.cmbxROUsageSort.Location = new System.Drawing.Point(76, 43); + this.cmbxROUsageSort.Margin = new System.Windows.Forms.Padding(4); + this.cmbxROUsageSort.Name = "cmbxROUsageSort"; + this.cmbxROUsageSort.Size = new System.Drawing.Size(201, 20); + this.cmbxROUsageSort.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.cmbxROUsageSort.TabIndex = 9; + this.cmbxROUsageSort.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + // + // cbiRO + // + this.cbiRO.Text = "Referenced Object"; + // + // cbiProc + // + this.cbiProc.Text = "Procedure"; + // + // tabROReports + // + this.tabROReports.AttachedControl = this.tabControlPanel2; + this.tabROReports.Name = "tabROReports"; + this.tabROReports.Text = "Referenced Objects"; + this.tabROReports.Click += new System.EventHandler(this.tabROReports_Click); + // + // tabControlPanel1 + // + this.tabControlPanel1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Windows7; + this.tabControlPanel1.Controls.Add(this.panelEx1); + this.tabControlPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabControlPanel1.Location = new System.Drawing.Point(0, 25); + this.tabControlPanel1.Margin = new System.Windows.Forms.Padding(4); + this.tabControlPanel1.Name = "tabControlPanel1"; + this.tabControlPanel1.Padding = new System.Windows.Forms.Padding(1); + this.tabControlPanel1.Size = new System.Drawing.Size(369, 87); + this.tabControlPanel1.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(253)))), ((int)(((byte)(254))))); + this.tabControlPanel1.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(157)))), ((int)(((byte)(188)))), ((int)(((byte)(227))))); + this.tabControlPanel1.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.tabControlPanel1.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(146)))), ((int)(((byte)(165)))), ((int)(((byte)(199))))); + this.tabControlPanel1.Style.BorderSide = ((DevComponents.DotNetBar.eBorderSide)(((DevComponents.DotNetBar.eBorderSide.Left | DevComponents.DotNetBar.eBorderSide.Right) + | DevComponents.DotNetBar.eBorderSide.Bottom))); + this.tabControlPanel1.Style.GradientAngle = 90; + this.tabControlPanel1.TabIndex = 1; + this.tabControlPanel1.TabItem = this.tabTransitionReports; + // + // panelEx1 + // + this.panelEx1.CanvasColor = System.Drawing.SystemColors.Control; + this.panelEx1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; + this.panelEx1.Controls.Add(this.cbxTransToProcs); + this.panelEx1.Controls.Add(this.cbxTransFromProcs); + this.panelEx1.Dock = System.Windows.Forms.DockStyle.Top; + this.panelEx1.Location = new System.Drawing.Point(1, 1); + this.panelEx1.Margin = new System.Windows.Forms.Padding(4); + this.panelEx1.Name = "panelEx1"; + this.panelEx1.Size = new System.Drawing.Size(367, 84); + this.panelEx1.Style.Alignment = System.Drawing.StringAlignment.Center; + this.panelEx1.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.panelEx1.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.panelEx1.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.panelEx1.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.panelEx1.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.panelEx1.Style.GradientAngle = 90; + this.panelEx1.TabIndex = 2; + this.panelEx1.ThemeAware = true; + // + // cbxTransToProcs + // + this.cbxTransToProcs.BackColor = System.Drawing.Color.Transparent; + // + // + // + this.cbxTransToProcs.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.cbxTransToProcs.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton; + this.cbxTransToProcs.Checked = true; + this.cbxTransToProcs.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbxTransToProcs.CheckValue = "Y"; + this.cbxTransToProcs.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.cbxTransToProcs.Location = new System.Drawing.Point(4, 4); + this.cbxTransToProcs.Margin = new System.Windows.Forms.Padding(4); + this.cbxTransToProcs.Name = "cbxTransToProcs"; + this.cbxTransToProcs.Size = new System.Drawing.Size(343, 28); + this.cbxTransToProcs.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.cbxTransToProcs.TabIndex = 0; + this.cbxTransToProcs.Text = "Transitions To Selected Procedure(s)"; + this.cbxTransToProcs.CheckedChanged += new System.EventHandler(this.cbxTransToProcs_CheckedChanged); + // + // cbxTransFromProcs + // + this.cbxTransFromProcs.BackColor = System.Drawing.Color.Transparent; + // + // + // + this.cbxTransFromProcs.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.cbxTransFromProcs.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton; + this.cbxTransFromProcs.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.cbxTransFromProcs.Location = new System.Drawing.Point(3, 39); + this.cbxTransFromProcs.Margin = new System.Windows.Forms.Padding(4); + this.cbxTransFromProcs.Name = "cbxTransFromProcs"; + this.cbxTransFromProcs.Size = new System.Drawing.Size(343, 28); + this.cbxTransFromProcs.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.cbxTransFromProcs.TabIndex = 1; + this.cbxTransFromProcs.Text = "Transitions From Selected Procedure(s)"; + this.cbxTransFromProcs.CheckedChanged += new System.EventHandler(this.cbxTransFromProcs_CheckedChanged); + // + // tabTransitionReports + // + this.tabTransitionReports.AttachedControl = this.tabControlPanel1; + this.tabTransitionReports.Name = "tabTransitionReports"; + this.tabTransitionReports.Text = "Transitions"; + this.tabTransitionReports.Click += new System.EventHandler(this.tabTransitionReports_Click); + // + // advTreeRO + // + this.advTreeRO.AccessibleRole = System.Windows.Forms.AccessibleRole.Outline; + this.advTreeRO.AllowDrop = true; + this.advTreeRO.BackColor = System.Drawing.SystemColors.Window; + // + // + // + this.advTreeRO.BackgroundStyle.Class = "TreeBorderKey"; + this.advTreeRO.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.advTreeRO.CellStyleSelected = this.elementStyle2; + this.advTreeRO.Dock = System.Windows.Forms.DockStyle.Fill; + this.advTreeRO.DragDropEnabled = false; + this.advTreeRO.DragDropNodeCopyEnabled = false; + this.advTreeRO.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; + this.advTreeRO.Location = new System.Drawing.Point(0, 32); + this.advTreeRO.Margin = new System.Windows.Forms.Padding(4); + this.advTreeRO.MultiSelect = true; + this.advTreeRO.MultiSelectRule = DevComponents.AdvTree.eMultiSelectRule.AnyNode; + this.advTreeRO.Name = "advTreeRO"; + this.advTreeRO.Nodes.AddRange(new DevComponents.AdvTree.Node[] { + this.node2}); + this.advTreeRO.NodesConnector = this.nodeConnector2; + this.advTreeRO.NodeStyle = this.elementStyle2; + this.advTreeRO.NodeStyleSelected = this.elementStyle2; + this.advTreeRO.PathSeparator = ";"; + this.advTreeRO.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.advTreeRO.Size = new System.Drawing.Size(348, 395); + this.advTreeRO.Styles.Add(this.elementStyle2); + this.advTreeRO.TabIndex = 11; + this.advTreeRO.Text = "advTree1"; + this.advTreeRO.AfterCheck += new DevComponents.AdvTree.AdvTreeCellEventHandler(this.advTreeRO_AfterCheck); + // + // elementStyle2 + // + this.elementStyle2.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.elementStyle2.Name = "elementStyle2"; + this.elementStyle2.TextColor = System.Drawing.SystemColors.ControlText; + // + // node2 + // + this.node2.Expanded = true; + this.node2.Name = "node2"; + this.node2.Text = "node2"; + // + // nodeConnector2 + // + this.nodeConnector2.LineColor = System.Drawing.SystemColors.ControlText; + // + // xpSetToReport + // + this.xpSetToReport.CanvasColor = System.Drawing.SystemColors.Control; + this.xpSetToReport.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; + this.xpSetToReport.Controls.Add(this.advTreeProcSets); + this.xpSetToReport.Dock = System.Windows.Forms.DockStyle.Top; + this.xpSetToReport.ExpandOnTitleClick = true; + this.xpSetToReport.Location = new System.Drawing.Point(0, 539); + this.xpSetToReport.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.xpSetToReport.Name = "xpSetToReport"; + this.xpSetToReport.Size = new System.Drawing.Size(348, 210); + this.xpSetToReport.Style.Alignment = System.Drawing.StringAlignment.Center; + this.xpSetToReport.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.xpSetToReport.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.xpSetToReport.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.xpSetToReport.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.xpSetToReport.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText; + this.xpSetToReport.Style.GradientAngle = 90; + this.xpSetToReport.TabIndex = 8; + this.xpSetToReport.TitleStyle.Alignment = System.Drawing.StringAlignment.Center; + this.xpSetToReport.TitleStyle.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.xpSetToReport.TitleStyle.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.xpSetToReport.TitleStyle.Border = DevComponents.DotNetBar.eBorderType.RaisedInner; + this.xpSetToReport.TitleStyle.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.xpSetToReport.TitleStyle.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.xpSetToReport.TitleStyle.GradientAngle = 90; + this.xpSetToReport.TitleText = "Select Procedures"; + // + // advTreeProcSets + // + this.advTreeProcSets.AccessibleRole = System.Windows.Forms.AccessibleRole.Outline; + this.advTreeProcSets.AllowDrop = true; + this.advTreeProcSets.BackColor = System.Drawing.SystemColors.Window; + // + // + // + this.advTreeProcSets.BackgroundStyle.Class = "TreeBorderKey"; + this.advTreeProcSets.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.advTreeProcSets.CellStyleSelected = this.elementStyle1; + this.advTreeProcSets.Dock = System.Windows.Forms.DockStyle.Fill; + this.advTreeProcSets.DragDropEnabled = false; + this.advTreeProcSets.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; + this.advTreeProcSets.Location = new System.Drawing.Point(0, 26); + this.advTreeProcSets.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.advTreeProcSets.MultiSelect = true; + this.advTreeProcSets.MultiSelectRule = DevComponents.AdvTree.eMultiSelectRule.AnyNode; + this.advTreeProcSets.Name = "advTreeProcSets"; + this.advTreeProcSets.Nodes.AddRange(new DevComponents.AdvTree.Node[] { + this.node1}); + this.advTreeProcSets.NodesConnector = this.nodeConnector1; + this.advTreeProcSets.NodeStyle = this.elementStyle1; + this.advTreeProcSets.NodeStyleSelected = this.elementStyle1; + this.advTreeProcSets.PathSeparator = ";"; + this.advTreeProcSets.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.advTreeProcSets.Size = new System.Drawing.Size(348, 184); + this.advTreeProcSets.Styles.Add(this.elementStyle1); + this.advTreeProcSets.TabIndex = 0; + this.advTreeProcSets.Text = "advTree1"; + this.advTreeProcSets.AfterNodeSelect += new DevComponents.AdvTree.AdvTreeNodeEventHandler(this.advTreeProcSets_AfterNodeSelect); + this.advTreeProcSets.AfterCheck += new DevComponents.AdvTree.AdvTreeCellEventHandler(this.advTreeProcSets_AfterCheck); + // + // elementStyle1 + // + this.elementStyle1.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.elementStyle1.Name = "elementStyle1"; + this.elementStyle1.TextColor = System.Drawing.SystemColors.ControlText; + // + // node1 + // + this.node1.Name = "node1"; + this.node1.Text = "node1"; + // + // nodeConnector1 + // + this.nodeConnector1.LineColor = System.Drawing.SystemColors.ControlText; + // + // btnPrintReport + // + this.btnPrintReport.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnPrintReport.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; + this.btnPrintReport.Dock = System.Windows.Forms.DockStyle.Top; + this.btnPrintReport.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnPrintReport.Location = new System.Drawing.Point(0, 749); + this.btnPrintReport.Margin = new System.Windows.Forms.Padding(4); + this.btnPrintReport.Name = "btnPrintReport"; + this.btnPrintReport.Size = new System.Drawing.Size(348, 43); + this.btnPrintReport.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnPrintReport.TabIndex = 9; + this.btnPrintReport.Text = "Create Report"; + this.btnPrintReport.Click += new System.EventHandler(this.btnPrintReport_Click); + // + // xpSelROs + // + this.xpSelROs.CanvasColor = System.Drawing.SystemColors.Control; + this.xpSelROs.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; + this.xpSelROs.Controls.Add(this.advTreeRO); + this.xpSelROs.Dock = System.Windows.Forms.DockStyle.Top; + this.xpSelROs.Location = new System.Drawing.Point(0, 112); + this.xpSelROs.Margin = new System.Windows.Forms.Padding(4); + this.xpSelROs.Name = "xpSelROs"; + this.xpSelROs.Size = new System.Drawing.Size(348, 427); + this.xpSelROs.Style.Alignment = System.Drawing.StringAlignment.Center; + this.xpSelROs.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.xpSelROs.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.xpSelROs.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.xpSelROs.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.xpSelROs.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText; + this.xpSelROs.Style.GradientAngle = 90; + this.xpSelROs.TabIndex = 10; + this.xpSelROs.TitleHeight = 32; + this.xpSelROs.TitleStyle.Alignment = System.Drawing.StringAlignment.Center; + this.xpSelROs.TitleStyle.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.xpSelROs.TitleStyle.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.xpSelROs.TitleStyle.Border = DevComponents.DotNetBar.eBorderType.RaisedInner; + this.xpSelROs.TitleStyle.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.xpSelROs.TitleStyle.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.xpSelROs.TitleStyle.GradientAngle = 90; + this.xpSelROs.TitleText = "Select Referenced Objects"; + // + // DisplayReports + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.btnPrintReport); + this.Controls.Add(this.xpSetToReport); + this.Controls.Add(this.xpSelROs); + this.Controls.Add(this.tctrlReports); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "DisplayReports"; + this.RightToLeft = System.Windows.Forms.RightToLeft.Yes; + this.Size = new System.Drawing.Size(348, 832); + this.Load += new System.EventHandler(this.DisplayReports_Load); + ((System.ComponentModel.ISupportInitialize)(this.tctrlReports)).EndInit(); + this.tctrlReports.ResumeLayout(false); + this.tabControlPanel2.ResumeLayout(false); + this.panRORpts.ResumeLayout(false); + this.tabControlPanel1.ResumeLayout(false); + this.panelEx1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.advTreeRO)).EndInit(); + this.xpSetToReport.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.advTreeProcSets)).EndInit(); + this.xpSelROs.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private DevComponents.DotNetBar.TabControl tctrlReports; + private DevComponents.DotNetBar.TabControlPanel tabControlPanel1; + private DevComponents.DotNetBar.TabItem tabTransitionReports; + private DevComponents.DotNetBar.TabControlPanel tabControlPanel2; + private DevComponents.DotNetBar.TabItem tabROReports; + private DevComponents.DotNetBar.ExpandablePanel xpSetToReport; + private DevComponents.AdvTree.AdvTree advTreeProcSets; + private DevComponents.DotNetBar.ElementStyle elementStyle1; + private DevComponents.AdvTree.Node node1; + private DevComponents.AdvTree.NodeConnector nodeConnector1; + private DevComponents.DotNetBar.ButtonX btnPrintReport; + private DevComponents.DotNetBar.Controls.CheckBoxX cbxROUsage; + private DevComponents.DotNetBar.Controls.CheckBoxX cbxSummary; + private DevComponents.DotNetBar.Controls.CheckBoxX cbxComplete; + private DevComponents.DotNetBar.Controls.CheckBoxX cbxTransFromProcs; + private DevComponents.DotNetBar.Controls.CheckBoxX cbxTransToProcs; + private DevComponents.DotNetBar.Controls.ComboBoxEx cmbxROUsageSort; + private DevComponents.Editors.ComboItem cbiProc; + private DevComponents.Editors.ComboItem cbiRO; + private DevComponents.DotNetBar.LabelX labelX1; + private DevComponents.DotNetBar.PanelEx panRORpts; + private DevComponents.AdvTree.AdvTree advTreeRO; + private DevComponents.AdvTree.Node node2; + private DevComponents.AdvTree.NodeConnector nodeConnector2; + private DevComponents.DotNetBar.ElementStyle elementStyle2; + private DevComponents.DotNetBar.ExpandablePanel xpSelROs; + private DevComponents.DotNetBar.PanelEx panelEx1; + } +} diff --git a/PROMS/Volian.Controls.Library/DisplayReports.cs b/PROMS/Volian.Controls.Library/DisplayReports.cs new file mode 100644 index 00000000..a9de2219 --- /dev/null +++ b/PROMS/Volian.Controls.Library/DisplayReports.cs @@ -0,0 +1,871 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Text; +using System.Windows.Forms; +using System.IO; +using VEPROMS.CSLA.Library; +using DevComponents.DotNetBar; +using DevComponents.AdvTree; +using System.Text.RegularExpressions; +using Volian.Base.Library; + + +namespace Volian.Controls.Library +{ + public partial class DisplayReports : UserControl + { + #region Events + public event DisplayReportsEvent PrintRequest; + private void OnPrintRequest(DisplayReportsEventArgs args) + { + if (PrintRequest != null) + PrintRequest(this, args); + } + #endregion + private List lstCheckedDocVersions = new List(); + //private List lstCheckedROs = new List(); + private List lstCheckedROs = new List(); + private List lstReportResults = new List(); + private List ROList = new List(); + private List lstROObj = new List(); + private int _MyRODbID; + private string DocVersionList + { + get + { + // append list of document versions to search + if (lstCheckedDocVersions.Count > 0) + { + string strRtnStr = ""; + // get list of doc versions to search + foreach (DocVersionInfo dvi in lstCheckedDocVersions) + { + strRtnStr += string.Format(",{0}", dvi.VersionID.ToString()); + } + return strRtnStr.Substring(1); + } + return ""; + } + } + private DocVersionInfo _MyDocVersion; + public DocVersionInfo Mydocversion + { + get { return _MyDocVersion; } + set + { + _MyDocVersion = value; + if (_MyDocVersion != null) + { + if (_MyDocVersion.DocVersionAssociationCount > 0) + { + // if the count variable is not consistent with the actual list count, + // do a refresh. There was a bug, B2012-040, that was not reproducable.. + // so this is an attempt to fix it. + if (_MyDocVersion.DocVersionAssociations.Count == 0) + { + _MyDocVersion.RefreshDocVersionAssociations(); + if (_MyDocVersion.DocVersionAssociations.Count == 0) return; + } + MyROFSTLookup = _MyDocVersion.DocVersionAssociations[0].MyROFst.ROFSTLookup; + _MyRODbID = _MyDocVersion.DocVersionAssociations[0].MyROFst.RODbID; + } + } + } + } + private ROFSTLookup _MyROFSTLookup; + public ROFSTLookup MyROFSTLookup + { + get { return _MyROFSTLookup; } + set + { + //if (!Visible) return; // don't reset anything if the form is invisible. + _MyROFSTLookup = value; // define the tree nodes based on this rofst + advTreeROFillIn(true); + //LoadROComboTree(); + } + } + + private ItemInfoList _ReportResult; + public ItemInfoList ReportResult + { + get { return _ReportResult; } + set + { + _ReportResult = value; + //if (value != null) // Don't select an item from the list when it is updated + // _ReportResult.ListChanged += new ListChangedEventHandler(_SearchResults_ListChanged); + //DisplayResults(); + } + } + + + private void GenerateROList() + { + string rtnStr = ""; + ROFSTLookup.rochild[] chld = null; + ROFSTLookup.rochild ch; + ROList.Clear(); + foreach (object rolkup in lstCheckedROs) + { + if (rolkup is ROFSTLookup.rodbi) + { + rtnStr = _MyRODbID.ToString() + ":" + string.Format("{0}", ((ROFSTLookup.rodbi)rolkup).dbiID.ToString("D4")); + } + else if (rolkup is ROFSTLookup.rochild) + { + ch = (ROFSTLookup.rochild)rolkup; + chld = ch.children; + rtnStr = _MyRODbID.ToString() + ":" + GetROChildren(rolkup); + } + //else if (rolkup is ROFSTLookup.rogrp) + // Console.WriteLine("RO Group"); + //else if (rolkup is ROFSTLookup.roHdr) + // Console.WriteLine("RO Header"); + ROList.Add(rtnStr); + } + } + + //private string GetROList(ROFSTLookup.rochild[] chld) + private string GetROChildren(object roObj) + { + ROFSTLookup.rochild chld = (ROFSTLookup.rochild)roObj; + string rtnstr = ""; + if (chld.children == null) // get a single ROID + { + //ROFSTLookup.rochild ro = (ROFSTLookup.rochild)roObj; + rtnstr += string.Format("{0}", chld.roid); + } + else + { // spin through the child list and get the ROIDs. + // if the child has children, then call this function recursivly + foreach (ROFSTLookup.rochild roc in chld.children) + { + if (roc.children != null) + rtnstr += GetROChildren(roc); + else + rtnstr += string.Format("{0},", roc.roid); + } + } + return rtnstr; + } + private string GetListOfROs(bool keepREDbID) + { + string rtnStr = ""; + string strRODbID = ""; + int cnt = 0; + foreach (string rostr in ROList) + { + int ndxOf = rostr.IndexOf(":"); + if (ndxOf > 0) + { + string tstr = rostr.Substring(0, ndxOf + 1); + if (tstr != strRODbID && keepREDbID) + { + strRODbID = tstr; + rtnStr += rostr; + } + else + rtnStr += rostr.Substring(ndxOf + 1); + } + else + rtnStr += rostr; + if (rtnStr.EndsWith(",")) rtnStr = rtnStr.Substring(0, rtnStr.Length - 1); + if (++cnt < ROList.Count) + rtnStr += ","; + } + return rtnStr; + } + public DisplayReports() + { + InitializeComponent(); + EnableOrDisablePrintButton(); + cmbxROUsageSort.SelectedIndex = 0; + tabTransitionReports.Visible = false; + cbxComplete.Enabled = false; + cbxSummary.Enabled = false; + } + + public void SelectReferencedObjectTab() + { + tabROReports.PerformClick(); + } + + private void EnableOrDisablePrintButton() + { + switch (tctrlReports.SelectedTabIndex) + { + case 0: // Transition Reports + btnPrintReport.Enabled = (lstCheckedDocVersions.Count > 0); + break; + case 1: // Referenced Objects Reports + if (cbxROUsage.Checked) + btnPrintReport.Enabled = (lstCheckedDocVersions.Count > 0 && lstCheckedROs.Count > 0); + else + btnPrintReport.Enabled = ((cbxComplete.Checked || cbxSummary.Checked) && lstCheckedROs.Count > 0); + break; + } + } + + private void tabTransitionReports_Click(object sender, EventArgs e) + { + xpSetToReport.Enabled = true; + xpSetToReport.Expanded = true; + xpSelROs.Expanded = false; + xpSelROs.Enabled = false; + EnableOrDisablePrintButton(); + } + + private void tabROReports_Click(object sender, EventArgs e) + { + xpSetToReport.Enabled = cbxROUsage.Checked; + xpSetToReport.Expanded = cbxROUsage.Checked; + cmbxROUsageSort.Enabled = cbxROUsage.Checked; + xpSelROs.Enabled = true; + xpSelROs.Expanded = true; + EnableOrDisablePrintButton(); + } + + private void cbxROUsage_CheckedChanged(object sender, EventArgs e) + { + xpSetToReport.Enabled = cbxROUsage.Checked; + xpSetToReport.Expanded = cbxROUsage.Checked; + cmbxROUsageSort.Enabled = cbxROUsage.Checked; + EnableOrDisablePrintButton(); + } + #region Procedure List + private DevComponents.AdvTree.Node NewAdvTreeNode(string nodetext, bool selectable, bool chxbxvisable) + { + DevComponents.AdvTree.Node newnode; + newnode = new DevComponents.AdvTree.Node(); + newnode.Text = nodetext; + newnode.Selectable = selectable; + newnode.CheckBoxAlignment = DevComponents.AdvTree.eCellPartAlignment.NearCenter; + newnode.CheckBoxStyle = eCheckBoxStyle.CheckBox; + newnode.CheckBoxThreeState = false; + newnode.CheckBoxVisible = chxbxvisable; + return newnode; + } + + + public void advTreeProcSetsFillIn(bool blSeachTabClicked) + { + DevComponents.AdvTree.Node topnode = null; + int cntnd = 0; + VETreeNode vtn = VETreeNode.GetFolder(1); + FolderInfo fi = vtn.VEObject as FolderInfo; + int fiCount = fi.ChildFolderCount; + advTreeProcSets.Nodes.Clear(); + lstCheckedDocVersions.Clear(); + topnode = new DevComponents.AdvTree.Node(); + topnode.Text = "Available Procedure Sets"; + topnode.Tag = fi; + advTreeProcSets.Nodes.Add(topnode); + //advTreeProcSets.AfterNodeInsert += new TreeNodeCollectionEventHandler(advTreeProcSets_AfterNodeInsert); + + + foreach (FolderInfo fic in fi.ChildFolders) + { + DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node(); + newnode.Text = fic.ToString(); + newnode.Tag = fic; + + //int tmp; + //if (topnode == null) + //{ + // newnode.Text = "Available Procedure Sets"; + // tmp = advTreeProcSets.Nodes.Add(newnode); + // topnode = newnode; + //} + //else + //{ + // newnode.Selectable = true; + // newnode.CheckBoxAlignment = DevComponents.AdvTree.eCellPartAlignment.NearCenter; + // newnode.CheckBoxStyle = eCheckBoxStyle.CheckBox; + // newnode.CheckBoxThreeState = false; + // newnode.CheckBoxVisible = true; + // tmp = topnode.Nodes.Add(newnode); + //} + cntnd++; + if (fic.ChildFolderCount > 0 || fic.FolderDocVersionCount > 0) // allow for '+' for tree expansion + { + DevComponents.AdvTree.Node tnt = new DevComponents.AdvTree.Node(); + tnt.Text = "VLN_DUMMY"; + newnode.Nodes.Add(tnt); + topnode.Nodes.Add(newnode); + } + } + + // if nothing was added to the tree, just put in the node above the docversions... + if (advTreeProcSets.Nodes.Count == 0) + { + cntnd++; + fi = Mydocversion.MyFolder; + topnode = new DevComponents.AdvTree.Node(); + topnode.Text = fi.ToString(); + advTreeProcSets.Nodes.Add(topnode); + topnode.Tag = fi; + } + + advTreeProcSets.BeforeExpand += new DevComponents.AdvTree.AdvTreeNodeCancelEventHandler(advTreeProcSets_BeforeExpand); + + // position to the procedure set in the tree if we have a procedure open + if (Mydocversion != null) + advTreeProcSetsPreSelect(); + else + advTreeProcSets.Nodes[0].SelectedCell = advTreeProcSets.Nodes[0].Cells[0]; // select the first node - fixes cosmetic problem + + //if (blSeachTabClicked) + // cbxTextSearchText.Focus(); // set initial focus to enter search text + } + void advTreeProcSets_BeforeExpand(object sender, DevComponents.AdvTree.AdvTreeNodeCancelEventArgs e) + { + DevComponents.AdvTree.Node par = e.Node; + // get first child's text, if it has one & if the text is VLN_DUMMY, load children + DevComponents.AdvTree.Node tn = null; + if (par.Nodes.Count > 0) tn = par.Nodes[0]; + if (tn.Text == "VLN_DUMMY") // expand this + { + par.Nodes.Clear(); + Object obj = par.Tag; + if (!(obj is FolderInfo)) return; // should always be folderinfo on expand + FolderInfo fi = (FolderInfo)obj; + if (fi.ChildFolderCount > 0) + { + foreach (FolderInfo fic in fi.ChildFolders) + { + DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node(); + newnode.Text = fic.ToString(); + newnode.Tag = fic; + par.Nodes.Add(newnode); + if (fic.HasChildren) // allow for '+' for tree expansion + { + DevComponents.AdvTree.Node tnt = new DevComponents.AdvTree.Node(); + tnt.Text = "VLN_DUMMY"; + newnode.Nodes.Add(tnt); + } + } + } + else if (fi.FolderDocVersionCount > 0) + { + foreach (DocVersionInfo dv in fi.FolderDocVersions) + { + //if ((VersionTypeEnum)dv.VersionType == VersionTypeEnum.WorkingDraft) + //{ + DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node(); + newnode.Text = dv.ToString(); + newnode.Tag = dv; + newnode.Selectable = true; + newnode.CheckBoxAlignment = DevComponents.AdvTree.eCellPartAlignment.NearCenter; + newnode.CheckBoxStyle = eCheckBoxStyle.CheckBox; + newnode.CheckBoxThreeState = false; + newnode.CheckBoxVisible = true; + par.Nodes.Add(newnode); + //} + } + } + } + } + private void advTreeProcSets_AfterCheck(object sender, DevComponents.AdvTree.AdvTreeCellEventArgs e) + { + DevComponents.AdvTree.Node n = advTreeProcSets.SelectedNode; + if (n.Checked) + { + n.Style = DevComponents.AdvTree.NodeStyles.Apple; + lstCheckedDocVersions.Add((DocVersionInfo)n.Tag); + if (lstCheckedDocVersions.Count == 1)//Mydocversion == null) + { + Mydocversion = (DocVersionInfo)n.Tag; + //advTreeStepTypesFillIn(); + } + } + else + { + n.Style = null; + lstCheckedDocVersions.Remove((DocVersionInfo)n.Tag); + if (lstCheckedDocVersions.Count == 1) + { + if (Mydocversion != lstCheckedDocVersions[0]) + { + Mydocversion = lstCheckedDocVersions[0]; + //advTreeStepTypesFillIn(); + } + } + else + { + if (lstCheckedDocVersions.Count == 0) + Mydocversion = null; + // do this if either none, or more than one procedure set selected + //advTreeStepTypes.Nodes.Clear(); + //lstCheckedStepTypes.Clear(); + //lstCheckedStepTypesStr.Clear(); + //Node newnode = new DevComponents.AdvTree.Node(); + //newnode.Text = "....select a procedure set for types to appear..."; + //advTreeStepTypes.Nodes.Add(newnode); + //buildStepTypePannelTitle(); + } + } + //// Enable the RO combo list only if at least one procedure set node + //// is selected + //cmboTreeROs.Enabled = (lstCheckedDocVersions.Count > 0); + //gpFindROs.Enabled = cmboTreeROs.Enabled; + + //SetupContextMenu(); + + //buildSetToSearchPanelTitle(); + EnableOrDisablePrintButton(); + } + private void advTreeProcSets_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e) + { + DevComponents.AdvTree.Node n = advTreeProcSets.SelectedNode; + //if (advTreeStepTypes.Nodes.Count == 1 && n.Checked) + //{ + // Mydocversion = (DocVersionInfo)n.Tag; + // advTreeStepTypesFillIn(); + //} + } + private void advTreeProcSetsPreSelect() + { + bool keeplooking = true; + //build a stack (bread crumb trail) of where is procedure set came from within the tree. + Stack crumbs = new Stack(); + //crumbs.Push(Mydocversion.Name); // ex: "working draft" + //crumbs.Push(Mydocversion.MyFolder.Name); // ex: "Emergency Procedures" + //crumbs.Push(Mydocversion.MyFolder.MyParent.Name); // ex: "STPNOC-South Texas" + //crumbs.Push(advTreeProcSets.Nodes[0].Text); //top node of my tree + + crumbs.Push(Mydocversion.Name); // ex: "working draft" + crumbs.Push(Mydocversion.MyFolder.Name); // ex: "Emergency Procedures" + FolderInfo fi = Mydocversion.MyFolder.MyParent; + while (fi != null) + { + if (fi.MyParent != null) + crumbs.Push(fi.Name); + fi = fi.MyParent; + } + crumbs.Push(advTreeProcSets.Nodes[0].Text); //top node of my tree + + // now walk the tree, looking for the node names we saved in the stack. + NodeCollection monkeys = advTreeProcSets.Nodes; + while (keeplooking) + { + Node climber = LookInTree(monkeys, crumbs.Pop()); + keeplooking = (climber != null && crumbs.Count > 0); + if (keeplooking) + monkeys = climber.Nodes; + if (!keeplooking && climber != null) + { + climber.Checked = true; + } + } + } + private Node LookInTree(NodeCollection monkeys, string bananna) + { + Node foundit = null; + foreach (Node chimp in monkeys) + { + if (chimp.Text.Equals(bananna)) + { + foundit = chimp; + // need to select the node (cell) for it to be checked + chimp.SelectedCell = chimp.Cells[0]; + if (chimp.Nodes.Count > 0) + chimp.Expand(); + break; + } + chimp.Collapse(); + } + return foundit; + } + #endregion + #region RO Tree + public void advTreeROFillIn(bool blSeachTabClicked) + { + DevComponents.AdvTree.Node topnode = null; + int cntnd = 0; + //VETreeNode vtn = VETreeNode.GetFolder(1); + //FolderInfo fi = vtn.VEObject as FolderInfo; + //int fiCount = fi.ChildFolderCount; + advTreeRO.Nodes.Clear(); + if (_MyROFSTLookup == null) return; + advTreeRO.BeforeExpand +=new AdvTreeNodeCancelEventHandler(advTreeRO_BeforeExpand); + advTreeRO.AfterExpand += new AdvTreeNodeEventHandler(advTreeRO_AfterExpandorCollapse); + advTreeRO.AfterCollapse += new AdvTreeNodeEventHandler(advTreeRO_AfterExpandorCollapse); + //lstCheckedDocVersions.Clear(); + topnode = new DevComponents.AdvTree.Node(); + topnode.Text = "All Referenced Objects"; + topnode.Tag = null;//fi; + topnode.CheckBoxVisible = true; + advTreeRO.Nodes.Add(topnode); + + for (int i = 0; i < _MyROFSTLookup.myHdr.myDbs.Length; i++) + { + DevComponents.AdvTree.Node tn = new DevComponents.AdvTree.Node(); + tn.Text = _MyROFSTLookup.myHdr.myDbs[i].dbiTitle; + tn.Tag = _MyROFSTLookup.myHdr.myDbs[i]; + tn.CheckBoxVisible = true; + topnode.Nodes.Add(tn); + //cmboTreeROs.Nodes.Add(tn); + AddDummyGroup(_MyROFSTLookup.myHdr.myDbs[i], tn); + } + + + //foreach (FolderInfo fic in fi.ChildFolders) + //{ + // DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node(); + // newnode.Text = fic.ToString(); + // newnode.Tag = fic; + + // cntnd++; + // if (fic.ChildFolderCount > 0 || fic.FolderDocVersionCount > 0) // allow for '+' for tree expansion + // { + // DevComponents.AdvTree.Node tnt = new DevComponents.AdvTree.Node(); + // tnt.Text = "VLN_DUMMY"; + // newnode.Nodes.Add(tnt); + // topnode.Nodes.Add(newnode); + // } + //} + + //// if nothing was added to the tree, just put in the node above the docversions... + //if (advTreeProcSets.Nodes.Count == 0) + //{ + // cntnd++; + // fi = Mydocversion.MyFolder; + // topnode = new DevComponents.AdvTree.Node(); + // topnode.Text = fi.ToString(); + // advTreeProcSets.Nodes.Add(topnode); + // topnode.Tag = fi; + //} + + //advTreeProcSets.BeforeExpand += new DevComponents.AdvTree.AdvTreeNodeCancelEventHandler(advTreeProcSets_BeforeExpand); + + //// position to the procedure set in the tree if we have a procedure open + //if (Mydocversion != null) + // advTreeProcSetsPreSelect(); + //else + // advTreeProcSets.Nodes[0].SelectedCell = advTreeProcSets.Nodes[0].Cells[0]; // select the first node - fixes cosmetic problem + + //if (blSeachTabClicked) + // cbxTextSearchText.Focus(); // set initial focus to enter search text + } + + private void AddDummyGroup(ROFSTLookup.rodbi rodbi, DevComponents.AdvTree.Node tn) + { + if (rodbi.children != null && rodbi.children.Length > 0) + { + DevComponents.AdvTree.Node tmp = new DevComponents.AdvTree.Node(); + tmp.Text = "VLN_DUMMY_FOR_TREE"; + tn.Nodes.Add(tmp); + } + } + private void advTreeRO_BeforeExpand(object sender, DevComponents.AdvTree.AdvTreeNodeCancelEventArgs e) + { + LoadChildren(e.Node); + } + + private void LoadChildren(DevComponents.AdvTree.Node tn) + { + object tag = tn.Tag; + if (tn.HasChildNodes && tn.Nodes[0].Text != "VLN_DUMMY_FOR_TREE") return; // already loaded. + if (tn.HasChildNodes && tn.Nodes[0].Text == "VLN_DUMMY_FOR_TREE") tn.Nodes[0].Remove(); + ROFSTLookup.rochild[] chld = null; + + if (tn.Tag is ROFSTLookup.rodbi) + { + ROFSTLookup.rodbi db = (ROFSTLookup.rodbi)tn.Tag; + chld = db.children; + } + else if (tn.Tag is ROFSTLookup.rochild) + { + ROFSTLookup.rochild ch = (ROFSTLookup.rochild)tn.Tag; + chld = ch.children; + } + else + { + Console.WriteLine("error - no type"); + return; + } + // if children, add dummy node + if (chld != null && chld.Length > 0) + { + //ProgressBar_Initialize(chld.Length, tn.Text); + for (int i = 0; i < chld.Length; i++) + { + //ProgressBar_SetValue(i); + DevComponents.AdvTree.Node tmp = null; + // if this is a group, i.e. type 0, add a dummy node + if (chld[i].type == 0 && chld[i].children == null) + //skip it. + // TODO: KBR how to handle this? + //Console.WriteLine("ro junk"); + continue; + else if (chld[i].value == null) + { + tmp = new DevComponents.AdvTree.Node(); + tmp.Text = chld[i].title; + tmp.Tag = chld[i]; + tmp.CheckBoxVisible = true; + tn.Nodes.Add(tmp); + DevComponents.AdvTree.Node sub = new DevComponents.AdvTree.Node(); + sub.Text = "VLN_DUMMY_FOR_TREE"; + tmp.Nodes.Add(sub); + } + else + { + tmp = new DevComponents.AdvTree.Node(); + tmp.Text = chld[i].title; + tmp.Tag = chld[i]; + tmp.CheckBoxVisible = true; + int index = FindIndex(tn.Nodes, tmp.Text); + tn.Nodes.Insert(index, tmp); + //tn.Nodes.Add(tmp); + } + } + } + //ProgressBar_Clear(); + } + void advTreeRO_AfterExpandorCollapse(object sender, AdvTreeNodeEventArgs e) + { + Node bottomNode = BottomTreeNode(advTreeRO.Nodes); + Node lastNode = advTreeRO.Nodes[advTreeRO.Nodes.Count - 1]; + int top = advTreeRO.Nodes[0].Bounds.Top; + int bottom = bottomNode.Bounds.Bottom + 5; + int hScrollBarHeight = advTreeRO.HScrollBar != null ? advTreeRO.HScrollBar.Height : 0; + bottom = bottomNode.Bounds.Bottom + 5; + advTreeRO.Size = new Size(advTreeRO.Size.Width, Math.Min(525, bottom - top + hScrollBarHeight)); + if (advTreeRO.VScrollBar != null && bottom < advTreeRO.Size.Height) + { + int yLookFor = (bottom - advTreeRO.Size.Height) + 2 * hScrollBarHeight; + Node topNode = FindTreeNodeAt(advTreeRO.Nodes, yLookFor); + if (topNode != null) + topNode.EnsureVisible(); + } + } + private Node FindTreeNodeAt(NodeCollection nodes, int y) + { + foreach (Node node in nodes) + { + if (node.Bounds.Top <= y && node.Bounds.Bottom >= y) + return node; + if (node.Bounds.Top > y) + { + if (node.PrevNode != null && node.PrevNode.Expanded) + return FindTreeNodeAt(node.PrevNode.Nodes, y); + return node; + } + } + return null; + } + private Node BottomTreeNode(NodeCollection nodes) + { + Node bottomNode = nodes[nodes.Count - 1]; // Return bottom node in collection + if (bottomNode.Expanded) // If expanded return bottom child + return BottomTreeNode(bottomNode.Nodes); + return bottomNode; + } + private int FindIndex(NodeCollection nodes, string value) + { + int index = 0; + foreach (Node node in nodes) + { + if (GreaterValue(node.Text, value)) return index; + index++; + } + return index; + } + private static Regex _RegExGetNumber = new Regex(@"^ *[+-]?[.,0-9]+(E[+-]?[0-9]+)?"); + private bool GreaterValue(string value1, string value2) + { + Match match1 = _RegExGetNumber.Match(value1); + Match match2 = _RegExGetNumber.Match(value2); + if (match1.Success && match2.Success) // Compare the numeric value + { + double dbl1 = double.Parse(match1.ToString()); + double dbl2 = double.Parse(match2.ToString()); + return dbl1 > dbl2; + } + return String.Compare(value1, value2, true) > 0; + } + + + #endregion + private void DisplayReports_Load(object sender, EventArgs e) + { + tabTransitionReports.PerformClick(); + } + + private void advTreeRO_AfterCheck(object sender, AdvTreeCellEventArgs e) + { + DevComponents.AdvTree.Node n = advTreeRO.SelectedNode; + //ROFSTLookup. rolkup = (ROFSTLookup)n.Tag; + if (n.Checked) + //lstCheckedROs.Add((ROFSTLookup)n.Tag); + //lstCheckedROs.Add(rolkup); + //lstROObj.Add(n.Tag); + lstCheckedROs.Add(n.Tag); + else + //lstCheckedROs.Remove((ROFSTLookup)n.Tag); + //lstCheckedROs.Remove(rolkup); + //lstROObj.Remove(n.Tag); + lstCheckedROs.Remove(n.Tag); + EnableOrDisablePrintButton(); + } + + private void cbxTransToProcs_CheckedChanged(object sender, EventArgs e) + { + EnableOrDisablePrintButton(); + } + + private void cbxTransFromProcs_CheckedChanged(object sender, EventArgs e) + { + EnableOrDisablePrintButton(); + } + + private void cbxComplete_CheckedChanged(object sender, EventArgs e) + { + EnableOrDisablePrintButton(); + } + + private void cbxSummary_CheckedChanged(object sender, EventArgs e) + { + EnableOrDisablePrintButton(); + } + private string BuildRODataFile(string ROList) + { + DocVersionInfo MyDVI = Mydocversion; + string roDataFile = "PRINT.TMP"; + + if (VlnSettings.ReleaseMode.Equals("DEMO")) + { + MessageBox.Show("Referenced Object Reports not available in the Demo version.", "PROMS Demo Version"); + return ""; + } + string roapp = Environment.GetEnvironmentVariable("roapp"); + if (roapp == null) + { + MessageBox.Show("Could not find path to Ro Editor, check 'roapp' environment variable"); + return ""; + } + if (MyDVI == null || MyDVI.DocVersionAssociationCount < 1) + { + MessageBox.Show("Could not find associated path for ro data."); + return ""; + } + string roloc = "\"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\" " + "\"" + ROList + "\""; + if (!Directory.Exists(MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath)) + { + MessageBox.Show(string.Format("RO Database directory does not exist: {0}", MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath)); + return ""; + } + string cmpRptExePath = roapp.Substring(0, roapp.LastIndexOf("\\")) + "\\CmpRpt.exe "; + try + { + System.Diagnostics.Process.Start(cmpRptExePath, roloc); + } + catch (Exception ex) + { + while (ex.InnerException != null) + ex = ex.InnerException; + string tmpmsg = ex.Message; + MessageBox.Show(tmpmsg, "RO Report Error: " + ex.GetType().Name); + } + roDataFile = MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\\" + roDataFile; + return roDataFile; + } + private void btnPrintReport_Click(object sender, EventArgs e) + { + Cursor curcur = Cursor; + Cursor = Cursors.WaitCursor; + if (cbxSummary.Checked) // RO Summary Report + { + } + else if (cbxComplete.Checked) // Complete RO Report + { + GenerateROList(); + string ROList = GetListOfROs(false);//don't include the RODbID in the RO list + string roDataFile = BuildRODataFile(ROList); + OnPrintRequest(new DisplayReportsEventArgs("RO Complete Report", "RO Report", roDataFile, cbxComplete.Checked)); + } + else if (cbxROUsage.Checked) + { + bool usageSortedByProcedure = (cmbxROUsageSort.SelectedIndex == 1); + GenerateROList(); + string SearchString = GetListOfROs(true);// Include the RODbID in the RO list + ItemInfoList SearchResults = ItemInfoList.GetListFromROReport(DocVersionList, "", SearchString, ""); + //OnPrintRequest(new DisplaySearchEventArgs(ReportTitle, TypesSelected, SearchString, lbSrchResults.DataSource as ICollection)); + if (!usageSortedByProcedure) // sort on ROs + { + Csla.SortedBindingList sortedResults = new Csla.SortedBindingList(SearchResults); + sortedResults.ApplySort("FoundROID", ListSortDirection.Ascending); + OnPrintRequest(new DisplayReportsEventArgs("RO Usage Report", "RO Usage", sortedResults, usageSortedByProcedure)); + } + else + OnPrintRequest(new DisplayReportsEventArgs("RO Usage Report", "RO Usage", SearchResults, usageSortedByProcedure)); + } + else if (cbxTransFromProcs.Checked) + { + } + else if (cbxTransToProcs.Checked) + { + } + Cursor = curcur; + } + + } + public class DisplayReportsEventArgs + { + private string _ReportTitle; + public string ReportTitle + { + get { return _ReportTitle; } + set { _ReportTitle = value; } + } + private string _TypesSelected; + public string TypesSelected + { + get { return _TypesSelected; } + set { _TypesSelected = value; } + } + private ICollection _MyItemInfoList; + public ICollection MyItemInfoList + { + get { return _MyItemInfoList; } + set { _MyItemInfoList = value; } + } + private bool _SortUsageByProcedure; + public bool SortUsageByProcedure + { + get { return _SortUsageByProcedure; } + set { _SortUsageByProcedure = value; } + } + private string _RODataFile = ""; + public string RODataFile + { + get { return _RODataFile; } + set { _RODataFile = value; } + } + private bool _CompleteROReport = true; + public bool CompleteROReport + { + get { return _CompleteROReport; } + set { _CompleteROReport = value; } + } + public DisplayReportsEventArgs(string reportTitle, string typesSelected, ICollection myItemInfoList, bool sortByProcedure) + { + _ReportTitle = reportTitle; + _TypesSelected = typesSelected; + _MyItemInfoList = myItemInfoList; + _SortUsageByProcedure = sortByProcedure; + } + public DisplayReportsEventArgs(string reportTitle, string typesSelected, string roDataFile, bool completeROReport) + { + _ReportTitle = reportTitle; + _TypesSelected = typesSelected; + _RODataFile = roDataFile; + _CompleteROReport = completeROReport; + } + } + public delegate void DisplayReportsEvent(object sender, DisplayReportsEventArgs args); +} diff --git a/PROMS/Volian.Controls.Library/DisplayReports.resx b/PROMS/Volian.Controls.Library/DisplayReports.resx new file mode 100644 index 00000000..19dc0dd8 --- /dev/null +++ b/PROMS/Volian.Controls.Library/DisplayReports.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs index 6496be96..a5141820 100644 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ b/PROMS/Volian.Controls.Library/DisplaySearch.cs @@ -846,7 +846,7 @@ namespace Volian.Controls.Library Cursor savcursor = Cursor; Application.DoEvents(); Cursor = Cursors.WaitCursor; - Console.WriteLine(string.Format("Checked = {0}", cbSorted.Checked)); + //Console.WriteLine(string.Format("Checked = {0}", cbSorted.Checked)); DisplayResults(); Cursor = savcursor; } diff --git a/PROMS/Volian.Print.Library/CompleteRORpt.cs b/PROMS/Volian.Print.Library/CompleteRORpt.cs new file mode 100644 index 00000000..49cfc394 --- /dev/null +++ b/PROMS/Volian.Print.Library/CompleteRORpt.cs @@ -0,0 +1,1275 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using iTextSharp.text.pdf; +using iTextSharp.text; +/*** + * Complete RO Report TO DO: + * - We are reading in the formation from the PRINT.TMP file. + * - Need to organize and put information on the page (continue message, page breaks, margings, etc.) + * - Need to process X/Y Plot language + * - Need to process tables (or leave table text as is) + * - Need to process graphic files + ***/ + +namespace Volian.Print.Library +{ + class CompleteROReport + { + Headers Hdrs; // Header stack object. + RODataFile RO_df = null; + int curheaderlen; + string RODataFileName; + iTextSharp.text.Document pdfReportDoc; + public CompleteROReport(iTextSharp.text.Document document, string dataFileName) + { + Hdrs = new Headers(); + RODataFileName = dataFileName; + pdfReportDoc = document; + } + + public void Run() + { + RO_df = new RODataFile(RODataFileName); + Console.WriteLine("Complete RO Report"); + PrintReport(); + } + + public void PrintReport() + { + bool StopPrinting = false; + bool UserTerminate = false; + Int16 iRecType = 0; + // Loop until either printing is aborted or end of file. + while (!StopPrinting && (iRecType = RO_df.ReadInteger16()) != -1) + { + Console.WriteLine("Record Type: {0}", iRecType); + switch (iRecType) + { + case 1: // Set Header + SetHeader(); + break; + case 2: // Push Header + PushHeader(); + break; + case 3: // Pop Header + PopHeader(); + break; + case 4: // RRO Begin + RROBegin(); + break; + case 5: // RRO End + RROEnd(); + break; + case 6: // Msg + Msg(); + break; + case 7: + KeyField(); + break; + case 100: // Text Field + case 101: // Plot Field + Text(); + break; + case 102: // Image Field + ImageFile(); + break; + case 103: // Multi Begin - Display data for setpoints + Multiple(); + break; + case 104: // Multi End + break; + case 0: // Do Nothing + case 255: + Console.WriteLine("Record Type: {0} No Operation", iRecType); + Console.WriteLine("----------------------------------------------"); + break; + default: // Problem + Console.WriteLine("Record Type: {0} Unrecognized record type", iRecType); + StopPrinting = true; ; + UserTerminate = true; + break; + }; + // if a key is pressed and the character is ESC, set stop printing + // flag. + //StopPrinting = CheckKeyboard(0); + } + Console.WriteLine("Record Type: {0}\n** Done **", iRecType); + return; + } + + public void Multiple() + { + Int16 typ, i, j, nw = 0; + string str, sep; + string buff = ""; + int[] width; + LastHeader(); + sep = ""; + // nw - number of fields + nw = RO_df.ReadInteger16(); + // allocate space for widths + width = new int[nw]; + // loop through and load field widths and names + for (i = 0; i < nw; i++) + { + // load width + width[i] = RO_df.ReadInteger16(); + // load name + str = RO_df.ReadText(); + // how wide is the header + int wtxt = str.Length; + buff += sep; + buff += str; + // if the width is wider than the header output spaces to pad + // to specified width + if (width[i] > wtxt) + { + int extra = width[i] - wtxt; + while (extra > 0) + { + buff += " "; + extra--; + } + // otherwise set the width to the width of the header + } + else + { + width[i] = wtxt; + } + // place a vertical bar between fields + sep = "|"; + } + sep = "\n"; + buff += "\n"; + // place horizonal bars between the header and the values + for (i = 0; i < nw; i++) + { + for (j = 0; j < width[i]; j++) + { + buff += "-"; + } + if (i < nw - 1) + buff += "|"; + } + i = 0; + // While not the end of multi + while ((typ = RO_df.ReadInteger16()) != 104) + { + if (typ == 0) + {// Next row + sep = "\n"; // set the separator (between rows) to a newline + i = 0; + } + else + {// more for this row + // get the data + str = RO_df.ReadText(); + // if first time output a newline otherwise output a vertical + // bar between values + buff += sep; + // output value + if (str != null) + buff += str; + // set the separator to a vertical bar + sep = "|"; + if (width[i] > 0) + { + int jj; + jj = width[i] - str.Length; + // pad the value to the specified width + while (jj > 0) + { + buff += " "; + jj--; + } + } + i++; + + } + } + // delete array of widths + //delete [] width; + // set the margin to zero + //margin = 0; + // output the table + PutText(buff); + // reset the margin to it's default value + //margin = 5; + Console.WriteLine("Multiple: {0} ", buff); + Console.WriteLine("----------------------------------------------"); + } + + public void SetHeader() + { + string pTmp; + + Console.WriteLine("Set Header"); + + // Get the number of header records + Int16 iNewCnt = RO_df.ReadInteger16(); + + Console.WriteLine("Num Header Records: {0}", iNewCnt); + + // Loop through the headers + int iLoop = 0; + for (; iLoop < Hdrs.HdrCnt; iLoop++) + { + if (iLoop >= iNewCnt) + // If the current header index is above the new number + // of headers, delete it. + Hdrs.strHdrs[iLoop] = null; + else + { + // Otherwise: + Int16 iTmpRpt; + + // Get the repeat count for the header + iTmpRpt = RO_df.ReadInteger16(); + Console.WriteLine("repeat count for header: {0}", iTmpRpt); + + // Get the text of the header + pTmp = RO_df.ReadText(); + Console.WriteLine("Header Text: {0}", pTmp); + if (!pTmp.Equals(Hdrs.strHdrs[iLoop])) + { + // if the old header does not equal the new header + // delete the old header and create a the one + Hdrs.strHdrs[iLoop] = pTmp; + Hdrs.repeatCount[iLoop] = iTmpRpt; + } + else + { + // Otherwise, delete the temperary header data. + pTmp = null; + } + } + } + // If there are any other headers left in the file, + // load those in as well. + for (; iLoop < iNewCnt; iLoop++) + { + int hdrRptCnt = (int)RO_df.ReadInteger16(); + if (Hdrs.repeatCount.Count - 1 < iLoop) + Hdrs.repeatCount.Add((int)hdrRptCnt); + else + Hdrs.repeatCount[iLoop] =hdrRptCnt; + pTmp = RO_df.ReadText(); + if (Hdrs.strHdrs.Count-1 < iLoop) + Hdrs.strHdrs.Add(pTmp); + else + Hdrs.strHdrs[iLoop] = pTmp; + Console.WriteLine("Value: {0}", Hdrs.repeatCount[iLoop]); + Console.WriteLine("Value Text: {0}", Hdrs.strHdrs[iLoop]); + Console.WriteLine("----------------------------------------------"); + } + // Set the new header count + Hdrs.HdrCnt = iNewCnt; + } + public void PushHeader() + { + //if (m_pPrinterOut->Row() > 55) + //// m_pPrinterOut->newpage(); + //pdfReportDoc.NewPage(); + string pTmp = RO_df.ReadText(); + curheaderlen = pTmp.Length; + //Hdrs.strHdrs[Hdrs.HdrCnt] = pTmp; + Hdrs.strHdrs.Add(pTmp); + //Hdrs.repeatCount[Hdrs.HdrCnt] = 2; + Hdrs.repeatCount.Add(2); + Hdrs.HdrCnt++; + + //m_pPrinterOut->PushedHeader(Hdrs.strHdrs[Hdrs.HdrCnt-1]); + + Console.WriteLine("Push Header"); + Console.WriteLine("Header Text: {0}", pTmp); + Console.WriteLine("----------------------------------------------"); + } + + public void PopHeader() + { + if (Hdrs.repeatCount[Hdrs.HdrCnt-1] == 2) + { + // if the last header was pushed on header list + // print eject the page if the page ran out, and + // print the header with "none". + //if (m_pPrinterOut->Row() > 55) + // m_pPrinterOut->NewPage(); + LastHeader(); + //m_pPrinterOut->PutLine(0, "none"); + //m_pPrinterOut->NewLine(1); + } + // Remove the header + Hdrs.HdrCnt--; + //Hdrs.strHdrs[Hdrs.HdrCnt] = null; + Hdrs.strHdrs.RemoveAt(Hdrs.HdrCnt); + Hdrs.repeatCount.RemoveAt(Hdrs.HdrCnt); + + Console.WriteLine("Pop Header"); + Console.WriteLine("----------------------------------------------"); + } + + public void RROBegin() + { + //m_pPrinterOut->NewPage(); + Console.WriteLine("RRO Begin"); + Console.WriteLine("----------------------------------------------"); + } + + public void RROEnd() + { + //m_pPrinterOut->PageEnd(); + // Remove any headers that are left over + Console.WriteLine("{0} headers cleaned up.", Hdrs.HdrCnt); + Console.WriteLine("RRO End"); + Console.WriteLine("----------------------------------------------"); + } + + public void Msg() + { + // Set a message to the printer on its own + string szStr = RO_df.ReadText(); + //m_pPrinterOut->NewLine(1); + //m_pPrinterOut->PutChr(szStr); + //m_pPrinterOut->NewLine(1); + + Console.WriteLine("Message"); + Console.WriteLine("Message Text: {0}", szStr); + Console.WriteLine("----------------------------------------------"); + } + + public void Text() + { + // Get the lenght of the text string and read it in + Int16 iValue = RO_df.ReadInteger16(); + string szStr = RO_df.ReadText(iValue); + string temp = szStr; + + if ((iValue + curheaderlen) > 72 || (szStr.IndexOf('\r') != -1)) + { + // If the lenght of the string plus the field title is greater + // than 72 characters or has a carriage return character in it + // then output the text on multiple lines + //if (m_pPrinterOut->Row() > 55) + // m_pPrinterOut->newpage(); + LastHeader(); + PutText(temp); + } + else + { + // Otherwise output the text on a single line + LastHeader(); + //m_pPrinterOut->SetNumberOfNewLines(0); + //m_pPrinterOut->putline(0, temp); + //if (m_pPrinterOut->Row() + 1 > 55) + // Hdrs.repeatCount[Hdrs.HdrCnt] = 1; + //else + // m_pPrinterOut->newline(1); + } + Console.WriteLine("Text"); + Console.WriteLine("Value: {0}", iValue); + Console.WriteLine("Text: {0}", szStr); + Console.WriteLine("----------------------------------------------"); + } + + public void KeyField() + { + string szStr = RO_df.ReadText(); + Console.WriteLine("Key Field"); + Console.WriteLine("Key Text: {0}", szStr); + Console.WriteLine("----------------------------------------------"); + } + +// Read in the image filename, height, and width + public void ImageFile() + { + string fn = RO_df.ReadText(); + Int16 ht = RO_df.ReadInteger16(); + Int16 wd = RO_df.ReadInteger16(); + //m_pPrinterOut->PrintImage(fn, wd, ht); + + Console.WriteLine("ImageFile"); + Console.WriteLine("Name: {0}", fn); + Console.WriteLine("Height: {0}", ht); + Console.WriteLine("Width: {0}", wd); + Console.WriteLine("----------------------------------------------"); + } + + // Output the string. If it is a graph, print the graph. + // ParseForGraph contains the code to print the text. + public void PutText(string szStr) + { + if (szStr == null || szStr.Equals("NONE")) + { + //m_pPrinterOut->putchr("NONE"); + //m_pPrinterOut->newline(2); + return; + } + //m_pPrinterOut->SetNumberOfNewLines(0); + string temp = szStr; + //m_pPrinterOut->newline(2); + // Include margin so the Display Data can print with a margin of zero + //m_pPrinterOut->ParseForGraph(temp, margin); + } + + // Output the last header that was push onto the header stack + // Printer::LastHeader contains the code to do this. + public void LastHeader() + { + //m_pPrinterOut->LastHeader(); + } + + }// end CompSumROReport + + + public class Headers + { + //public string[] strHdrs; + public List strHdrs; +// public int[] repeatCount; + public int HdrCnt; + public List repeatCount; + public Headers() + { + HdrCnt = 0; + strHdrs = new List(); + repeatCount = new List(); + } + } + + public class RODataFile + { + FileStream fs = null; + BinaryReader br = null; + public RODataFile(string fname) + { + fs = new FileStream(fname,FileMode.Open); + br = new BinaryReader(fs); + } +// Read an integer value from the data file + public Int16 ReadInteger16() + { + // Int16 i16RetValue; + // //if (br == null || br.PeekChar() == -1) // no file handle or end of file + // // return -1; + // i16RetValue = br.ReadInt16(); + //return i16RetValue; + return br.ReadInt16(); + } +// Read a text string from the data file and returns it. +// The calling program is responsible for free it +// with the "delete" operator. + + public string ReadText() + { + return ReadText(-1); + } + + public string ReadText(Int16 i16CharCount) + { + Int16 i16DataSize; + if (i16CharCount == -1) + i16DataSize = ReadInteger16(); + else + i16DataSize = i16CharCount; + + if (i16DataSize <= 0) + return null; + else + { + byte[] charbuff = new byte[i16DataSize + 1]; + charbuff = br.ReadBytes(i16DataSize); + return (Encoding.ASCII.GetString(charbuff, 0, i16DataSize)); + } + } + +// Search through the file to find the next record + public long NextRecord() + { + Int16 iType; + Int16 RECORD_START = 255; + // While not the next record and not end of file get the next meta item + while ((iType = ReadInteger16()) != RECORD_START && iType != -1) + { + NextItem(); + } + return fs.Seek(0, SeekOrigin.Current); + } +// Get the next meta item and discard the data + public long NextItem() + { + string pTmp; + Int16 iRecType = ReadInteger16(); + Int16 iNewCnt; + int iLoop; + switch (iRecType) + { + case 1: // Set Header + iNewCnt = ReadInteger16(); + for (iLoop = 0; iLoop < iNewCnt; iLoop++) + { + ReadInteger16(); + pTmp = ReadText(); + //delete pTmp; + } + break; + case 2: // Push Header + case 6: // Msg + case 7: // Key Field + case 100: // Text Field + case 101: // Plot Field + pTmp = ReadText(); + //delete pTmp; + break; + case 3: // Pop Header + case 4: // RRO Begin + case 5: // RRO End + case 103: // Multi Begin + case 104: // Multi End + case 0: // Do Nothing + // Do nothing + break; + case 102: // Image Field + pTmp = ReadText(); + //delete pTmp; + ReadInteger16(); + ReadInteger16(); + break; + } + return fs.Seek(0, SeekOrigin.Current);//ftell(GetFilePointer()); + } +// Get the block of data that is the record + public byte[] GetRecord(ref int size) + { + byte[] data; + // Get the current position + long lCurPos = fs.Seek(0, SeekOrigin.Current); //ftell(GetFilePointer()); + + // Go to the end of the record and get the file position + ReadInteger16(); + NextRecord(); + long lEndRecord = fs.Seek(0, SeekOrigin.Current); //ftell(GetFilePointer()); + + // Get the size of the record + size = (int)(lEndRecord - lCurPos); + + // Retrieve the record from the file + data = new byte[size +1]; + data = br.ReadBytes(size); + //fseek(GetFilePointer(),lCurPos,SEEK_SET); + //fread(data,*size,1,GetFilePointer()); + + return data; + } + } + +# region ReportTextOutputer + public class ReportTextOutputer + { + private int NumLinesForGraph, RowForGraph; + private int CurrentGraphicsMode, ShouldBeGraphicsMode; + private int xtralines; + private string LaserGraphicSpcChar = "'" + "\x07"; // degree and bullet + private iTextSharp.text.Document pdfReportDoc; + private int _page = 0; + private int _row = 0; + + public int Row + { + get { return _row; } + //set { _row = value; } + } + private int _nstring = 0; + private int _pitch = 1; + private bool _ItalicsFlag = false; + private bool _PrintTheExponent = true; /* set to false if we do not want exponents printed */ + private bool _boldFlag = false; + private bool _UnderLineFlag = false; + private bool _SubscriptFlag = false; + private bool _SuperScriptFlag = false; + private bool _CompSubscriptFlag = false; + private bool _CompSuperscriptFlag = false; + private int _nnl = 1; + private Header Hdrd = null; + + ReportTextOutputer(iTextSharp.text.Document pdfDoc, Header hdr) + { + pdfReportDoc = pdfDoc; + Hdrd = hdr; + } + + // Set the number of newlines to print when outputting text + public void SetNumberOfNewLines(int iNewLines) + { + _nnl = iNewLines; + } + // Parse for a graph. If no graph then print the text. + // Margin added for multifield print - Display Data for Setpoints + public void ParseForGraph(string szStr, int mrgn) + { + //string temp = szStr; + + //// Look for a graph. If one is found pop it onto the graph stack + // ::ParseForGraph(temp); + + //// Print any text or graphs + //NumLinesForGraph = 0; + //while (*temp) + // { + // RowForGraph = row; + // // Use margin to make function generic + // temp = putline(mrgn,temp); + // } + //newline(1); + + //// Reposition the cursor after the graph is printed + //if (NumLinesForGraph > row) + // newline((NumLinesForGraph-row)+2); + //if (xtralines > 0) newline(xtralines); + + } + // Start a new page + public void NewPage() + { + // newpage(); + pdfReportDoc.NewPage(); + } + // Start a new line + public void NewLine(int iNumberOfLines) + { + newline(iNumberOfLines); + } + // Output a line + public string PutLine(int iMargin, string szStr) + { + return putline(iMargin, szStr); + } + // Output a line in bold + public void Bolder(string szStr) + { + //if (!bold[1]) + // { + // putchr(szStr); + // return; + // } + //putchr(bold[1]); + //putchr(szStr); + //putchr(bold[0]); + } + // End a page + public void PageEnd() + { + pageend(); + } + // Output a date + public void PutDate(string szStr) + { + //putnchr((char *)(szStr+4),2); + //putnchr("/",1); + //putnchr((char *)(szStr+6),2); + //putnchr("/",1); + //putnchr((char *)(szStr+2),2); + } + + // Output a character to the printer + public void PutChr(string szStr) + { + putchr(szStr); + } + + // Set a pointer to the header stack to be used if headers need to + // be accessed + public void SetHeaderInfo(Headers pHdr) + { + //m_pHdrs = pHdr; + //// clear it out too. + //memset(m_pHdrs,0,sizeof(Headers)); + } + // Output a line to the printer + public string putline(int margin, string instr) + { + int loceol; + string str = "";// char[strlen(instr)+1]; + string rtnstr = ""; + str = instr; //strcpy(str,instr); + // Search for newline and zero terminate it + //col=margin; + loceol = str.IndexOf('\n'); //strchr(str,'\n'); + if (loceol > 0) // \n found + { + if (str[loceol + 1] == '\r') loceol++; + if (str[loceol - 1] == '\r') + { + str = str.Substring(0, loceol - 1); + } + else + str = str.Substring(0, loceol); + } + else + loceol = str.Length - 1; + if (str.Length > 67) // see if we need word wrap + { + int x = str.Length - 1; + while ((x > 0) && (str[x] != ' ')) x--; + if (x > 0) + str = str.Substring(0, x + 1); + else + str = str.Substring(0, 67); + rtnstr = instr.Substring(str.Length); + } + // format and output line + FixAndPutLine(str, margin); + + //if (UnderLineFlag) toggle_underline(); + + return (rtnstr); + } + + + // Send 'n' characters to the printer via put1c + public void putnchr(string str, int n) + { + //for (int x=0; x < n; x++) + // put1c(str[x],m_ifile); + } + + // Format and output a string + //private static string aprocname; + public void FixAndPutLine(string str, int margin) + { + //int i,ccol,tcol,JustDoIt; + + ////aprocname = "proc000"; //strcpy(aprocname,"proc000"); + ////dbname = aprocname; + ///*JustDoIt does sub/superscript anywhere if "##" or "~~" is used */ + + //MakeSureFlagsAreOff(); + //if(str != null && str != ""){ + // if(nnl){ + // newline(nnl); + // nnl=0; + // } + // // if not going to a new page, put out the margin. + // if (str[0] != '\f') + // for(i=0;i= '0') && (str[x] <= '9'))){ + // nstring = 1; + // check_super(str); + // } + // else if (str[x] == '~' || str[x] =='#'){ + // JustDoIt=0; + // if(str[x]==str[x+1]){ /* Using ## or ~~ will do super */ + // x++;//str++; /* or subscript regardless of */ + // JustDoIt=1; /* preceding character */ + // } + // if (char.IsLetterOrDigit(str,x-1) || ".)]".IndexOf(str[x-1]) !=-1 || JustDoIt) + // (str[x]=='~')?toggle_subscript() : toggle_SuperScript(); + // else + // putnchr(str,1); + // } + // else if (str[x] == '<' && str[x+1] == '_') // less than or equal + // { + // //LaserGraphics('\345'); + // LaserGraphics('\xE5'); + // x++; + // } + // else if (str[x] == '>' && str[x+1] == '_') // greater than or equal + // { + // //LaserGraphics('\344'); + // LaserGraphics('\xE4'); + // x++; + // } + // else if (str[x] == '+' && str[x+1] == '_') // plus minus + // { + // //LaserGraphics('\343'); + // LaserGraphics('\xE3'); + // x++; + // } + // else if(str[x] == '|'){ + // if (str[x+1] == '^' || str[x+1] == 'v') // up arrow or down arrow + // x++; + // LaserGraphics(*str); // ??? + // ccol++; + // } + // else if (str[x] == 0xF2) + // //LaserGraphics('\344'); /* greater equal */ + // LaserGraphics('\xE4'); /* greater equal */ + // else if (str[x] == 0xE4) + // //LaserGraphics('\372'); /* sigma */ + // LaserGraphics('\xFA'); /* sigma */ + // else if (str[x] == 0xE5) + // LaserGraphics(0xFD); /* sigma */ + // else if (str[x] == 0xF6) + // //LaserGraphics('\241'); /* division symbol */ + // LaserGraphics('\xA1'); /* division symbol */ + // else if (str[x] == 0xFB) + // //LaserGraphics('\243'); /* sqr root */ + // LaserGraphics('\xA3'); /* sqr root */ + // else if (str[x] == 0xE3) + // //LaserGraphics('\244'); /* pi */ + // LaserGraphics('\xA4'); /* pi */ + // else if ((str[x] == '^')||(str[x] == 0x7F)) + // LaserGraphics(0x7F); + // else if (str[x] == 0xF9) /* Note box char - only FPL format */ + // LaserGraphics(0xAD); + // else if (str[x] == '`') /* bullet */ + // LaserGraphics(0xB8); + // else if (str[x] == 0xE0) /* up arrow */ + // LaserGraphics(0x18); + // else if (str[x] == 0xE1) /* down arrow */ + // LaserGraphics(0x19); + // else if (str[x] == 0xAA) /* approx equal */ + // LaserGraphics(0xEF); + // else if (str[x] == 0xA6) /* border char */ + // LaserGraphics(0xB5); + // else if (str[x] == 0xA2) /* Distinguished zero */ + // LaserGraphics(0xED); + // else if(str[x] == MARKGRAPH){ + // int grln = PopAGraph(0); + // if (grln+row>59) newpage(); + // PrintGraphString(); + // RowForGraph+=grln+2; + // //RowForGraph+=PopAGraph()+2; + // flushbuf(); + // NumLinesForGraph=max(NumLinesForGraph,RowForGraph); + // put1c(0x20,m_iFile); + // if( fonts[PICA] ) putchr(fonts[PICA]); + // } + // else if (str[x] > 0x7F || LaserGraphicSpcChar.IndexOf(str[x]) != -1)//strchr(LaserGraphicSpcChar,str[x])) + // LaserGraphics(str[x]); + // //else if (str[x] == '\033'){ /*ESC */ + // else if (str[x] == '\x1B'){ /*ESC */ + // if((str[x+1]=='4') || (str[x+1]=='5')){ + // T_Italics(); + // x++; + // } + // else if (str[x+1]=='0'){ /* 16 lpi */ + // putchr(Lpi[LPI16]); + // x++; + // } + // else if (str[x+1]=='2'){ /* 12 lpi */ + // putchr(Lpi[LPI12]); + // x++; + // } + // else if (str[x+1]=='P'){ /* ESC P=Toggle Elite/Pica */ + // toggle_pitch(); + // x++; + // } + // else if (str[x+1]=='F'){ + // putchr(fonts[ELITE]); + // x++; + // } + // else if (str[x+1]=='\\' && str[x+2]=='#'){ + // putchr("#"); + // x++; + // } + // else if (str[x+1]=='#' || str[x+1]=='~'){ + // /* Compressed Super/subscripting tokens are the same as + // ** normal sub/superscripting except preceded by ESC */ + // x++; + // if (str[x]=='~') + // Toggle_CompSubscript(); + // else Toggle_CompSuperscript(); + // } + // else { + // putnchr(str[x],1); + // }; + // } + // else{ + // if(str[x] == ' ')nstring = 0; + // if(str[x] == '\f') + // newpage(); + // //else if(str[x] == '\017'){ /* Compress on with CTRL O */ + // else if(str[x] == '\x0F'){ /* Compress on with CTRL O */ + // putchr(CompressMode[1]); + // pitch=0; /* Compressed mode shuts elite off */ + // } + // //else if(str[x] == '\022') /* Compress off with CTRL R */ + // else if(str[x] == '\x12') /* Compress off with CTRL R */ + // putchr(CompressMode[0]); + // else{ + // putnchr(str[x],1); + // ccol++; + // } + // } + // x++; + // if(ccol >= tcol)tcol+=8; + // } + + // nnl=1; + // } + //else + // nnl++; + //put1c(-1,m_iFile); /* resets graphics mode if necessary */ + } + + // Turn off all of the flags for formating + public void MakeSureFlagsAreOff() + { + //if (UnderLineFlag) + // toggle_underline(); + //if (boldFlag) + // toggle_bold(); + //if (SubscriptFlag) + // toggle_subscript(); + //if (SuperScriptFlag) + // toggle_SuperScript(); + } + + // Write a character to the printer + public void put1c(int ch, int fp) + { + //if(CurrentGraphicsMode!=ShouldBeGraphicsMode){ + // if((CurrentGraphicsMode=ShouldBeGraphicsMode)!=0) + // putchr(LaserGraphicsOn); + // else + // putchr(LaserGraphicsOff); + // } + //if(ch!=-1) + // { + // char character = ch; + // write(fp, &character, 1); + // } + } + + public void doheaders(int i, int flag) + { + //int nSpaces; + //if(m_pHdrs->m_iRepeatCount[i]==2){ + // m_pHdrs->m_iRepeatCount[i]=0; + //} else { + // if( flag ) nSpaces = flag; + // else nSpaces = (i-1)*2; + // for(int j=0;jm_pHdrs[i]); + // if(m_pHdrs->m_iRepeatCount[i]==1){ + // if( !flag ) putchr(" (continued)"); + // } else { + // m_pHdrs->m_iRepeatCount[i]++; + // } + // newline(1); + //} + } + // Start a new page + public void newpage() + { + //string szPageNumber = ""; + //// Increment page number + //page++; + + //// End the page if not at the top + //if(row > 0) PageEnd(); + + //// Put out the font command for PICA on every page. + //if (fonts[PICA] != null) putchr(fonts[PICA]); + + //// Print 3 lines + //newline(3); + //// if( !StupidHP )newline(2); + //newline(2); + + //// Print main header with a page number + //putchr(topheader); + ////sprintf(szPageNumber," %d",page); + ////putchr(szPageNumber); + + //NewLine(1); + + //// Print all of the header in the header stack + //int i; + //if(m_pHdrs->m_iHdrCnt){ + // NewLine(1); + // doheaders(0,max(0,(int)(35-strlen(m_pHdrs->m_pHdrs[0])/2))); + // NewLine(1); + // for(i=1;im_iHdrCnt;i++){ + // doheaders(i); + // } + // newline(1); + //} + } + // End the page + public void pageend() + { + //// Send Carriage return/new line and form feed + //putchr("\r\n"); + //putchr("\014"); // form feed + + // Home the cursor + //row = 0; + //col = 0; + } + // Start a new line + public void newline(int n) + { + _row += n; + // col=0; + if (_row > 59) + { + newpage(); + return; + } + while (n-- > 0) putnchr("\r\n", 2); + // This spaces over for a left margin + putchr(" "); // make a 3/4 inch left margin (at 10 chars per inch) + } + + // Toggle Underline + public void toggle_underline() + { + //UnderLineFlag= !UnderLineFlag; + //putchr(underline[UnderLineFlag]); + } + + // Toggle Bold + public void toggle_bold() + { + //boldFlag = !boldFlag; + //putchr(bold[boldFlag]); + } + // Toggle Subscript + public void toggle_subscript() + { + //SubscriptFlag = !SubscriptFlag; + //if (SuperScriptFlag) SuperScriptFlag = 0; + //putchr(SubScript[SubscriptFlag]); + } + + // Toggle SuperScript + public void toggle_SuperScript() + { + //SuperScriptFlag = !SuperScriptFlag; + //if (SubscriptFlag) SubscriptFlag = 0; + //putchr(SuperScript[SuperScriptFlag]); + } + + public void Toggle_CompSubscript() + /* Toggle compressed mode subscript. Also reduce line spacing so that + ** when shrink printer command does its half line movement, it does not + ** cause subscripted text to print over the next line */ + { + //if (CompSubscriptFlag ^= 1) + // putchr(Lpi[LPI12]); + //if (CompSuperscriptFlag) CompSuperscriptFlag = 0; + //if (SuperScriptFlag) SuperScriptFlag = 0; + //putchr(shrink[1][CompSubscriptFlag]); + //if (!CompSubscriptFlag) + // putchr(Lpi[LPI6]); /* Set to 6 lines per inch - assumes default */ + } + public void Toggle_CompSuperscript() + /* Toggle compressed mode superscript. Also reduce line spacing so that + ** when shrink printer command does its half line movement, it does not + ** cause superscripted text to print over the next line */ + { + //if (CompSuperscriptFlag ^= 1) + // putchr(Lpi[LPI12]); + //if (CompSubscriptFlag) CompSubscriptFlag = 0; + //if (SubscriptFlag) SubscriptFlag = 0; + //putchr(shrink[0][CompSuperscriptFlag]); + //if (!CompSuperscriptFlag) + // putchr(Lpi[LPI6]); /* Set to 6 lines per inch - assumes default */ + //} + + } + public void check_super(string lstr) //char **lstr) + { + //if(!FortranFormatNumbers && IsAnENumber(*lstr) && PrintTheExponent) + //{ + // if(IsPowerOf10(*lstr)){ + // putnchr("10",2); + // while(**lstr!='E')(*lstr)++; + // } + // else{ + // while(**lstr != 'E'){ + // putnchr(*lstr,1); + // (*lstr)++; + // } + // putnchr("x10",3); + // } + // (*lstr)++; + // toggle_SuperScript(); + // while(isdigit(**lstr) || **lstr=='+' || **lstr=='-' || **lstr=='.'){ + // putnchr(*lstr,1); + // (*lstr)++; + // } + // toggle_SuperScript(); + // (*lstr)--; + // } + //else + //putnchr(*lstr,1); + } + public int IsAnENumber(string str) + { + //while(isdigit(*str))str++; + //if(*str++ != '.')return(0); + //while(isdigit(*str))str++; + //if(*str++ != 'E')return(0); + //if(*str=='+' || *str=='-')str++; + //while(isdigit(*str))str++; + //if(*str == '.')str++; + //while(isdigit(*str))str++; + //if(!isalpha(*str))return(1); + return (0); + } + + public int IsPowerOf10(string str) + { + //if(*str++!='1')return(0); + //if(*str++!='.')return(0); + //while(*str=='0')str++; + //if(*str!='E')return(0); + return (1); + } + public void toggle_pitch() + { + //pitch= !pitch; + //putchr(PrnPitch[pitch]); + } + public void LaserGraphics(char GraphicsChar) + { + /** Bug fix B2004-002 - let VFW handle the underlining + ** of special characters + int localtoggle; + if ((localtoggle = UnderLineFlag) != 0) toggle_underline(); + **/ + //ShouldBeGraphicsMode=1; + //put1c(GraphicsChar, m_iFile); + //ShouldBeGraphicsMode=0; + /** Bug fix B2004-002 + if (localtoggle){ + putnchr("\008",1); * backspace * + toggle_underline(); * resume underlining * + putnchr(" ",1); * send space * + } + **/ + } + public void putchr(string str) + { + //putnchr(str,strlen(str)); + } + + public void T_Italics() + { + //putchr(SetItalics[(ItalicsFlag^=1)]); + } + public void PrintImage(string fn, int x, int ht) + { + // char pth[MAXPATH]; + // if (row + ht > 59) newpage(); + // LastHeader(); + + // char *cmdstr, *buf; + // cmdstr = (char *) mallocq(81); + + // char bits[4]; + // // See if we are using the new (32-bit) RO Editor + // memset(bits,'\0',4); + // (void) GetPrivateProfileString("RoEditor","Bit","32", + // bits,sizeof(bits),ExeAdjust("~veproms.ini")); + // /* + // * Since we might be printing out of the APPROVED directory, + // * let the default graphic file extension be PCX. If the + // * graphic file cannot be found, then see if there is a TIF + // * version of the graphic file (converted for the 32-bit RO + // * Editor). Note that when we convert RO graphic files from + // * PCX to TIF, we only do the ones in the RO directory, not any + // * of the "approved" graphic files in the APPROVED directory. + // * So until VFW is running totally under .NET, we need check + // * for both PCX and TIF graphic files when printing. + // */ + + // int k=1; + // buf = (char *) mallocq(5); + // if (strcmp(bits,"32")== 0) + // { + // (void)GetPrivateProfileString("Graphics", "defaultext", "TIF", buf, 4, + // ExeAdjust("~veproms.ini")); + // } + // else + // { + // (void)GetPrivateProfileString("Graphics", "defaultext", "PCX", buf, 4, + // ExeAdjust("~veproms.ini")); + // } + // if (strchr(fn, '.') == NULL) { + // sprintf(pth,"%s%s.%s",GetGraphicsPath(),fn,buf); + // } else { + // sprintf(pth,"%s%s",GetGraphicsPath(),fn); + // } + // if(Exists(pth)){ + // sprintf(cmdstr,"\255I\"%s:.\\%d:%d\"",pth,k,ht*DeciPerRow); + // } else { + // /* + // * The graphic file was not found but we might be printing out + // * of the APPROVED directory. Set the graphic file extension + // * be PCX. + // * Note that when we convert RO graphic files from + // * PCX to TIF, we only do the ones in the RO directory, not any + // * of the "approved" graphic files in the APPROVED directory. + // * So until VFW is running totally under .NET, we need check + // * for both PCX and TIF graphic files when printing. + // */ + // if (InApproved() && (strcmp(bits,"32")== 0)) + // { + // // we are the Approved directory. + // // Graphics file does not exist, try the graphic file + // // name with a PCX extension + // char *tptr = strrchr(pth,'.'); + // if (tptr != NULL) + // strcpy(tptr,".PCX"); // see if a TIF version exists + // } + // if (Exists(pth)) { + // sprintf(cmdstr,"\255I\"%s:%s%d:%d\"",pth,k,ht*DeciPerRow); + // } + // else// Output message if file does not exist + // sprintf(cmdstr,"%s does not exist.",pth); + // } + // putchr(cmdstr); + // free(buf); + // free(cmdstr); + // row += ht; + //#ifdef OUTPUT_DEBUG_INFO + // cout << cmdline << endl; + //#endif + } + + // Print the last header in the header stack + public void LastHeader() + { + //string buf; + //if (m_pHdrs->m_iHdrCnt > 0) + // { + // // Advance a line on the printer + // NewLine(1); + + // // Copy colon to the header string and print it in bold + // strcpy(buf, m_pHdrs->m_pHdrs[m_pHdrs->m_iHdrCnt-1]); + // strcat(buf, ": "); + // Bolder(buf); + + // // Set repeat count to 1 for the header + // m_pHdrs->m_iRepeatCount[m_pHdrs->m_iHdrCnt-1] =1; + // } + } + public void PushedHeader(string szStr) + { + //UserTerminate = CheckKeyboard(szStr); + } + } +#endregion +} + diff --git a/PROMS/Volian.Print.Library/PDFReport.cs b/PROMS/Volian.Print.Library/PDFReport.cs index 4ecb91c0..24eca394 100644 --- a/PROMS/Volian.Print.Library/PDFReport.cs +++ b/PROMS/Volian.Print.Library/PDFReport.cs @@ -18,7 +18,9 @@ namespace Volian.Print.Library SearchResults = 0, LibraryDocUsage = 1, ReferencedObjectsUsage = 2, - TransitionUsage = 3 + TransitionUsage = 3, + ReferencedObjectSummary = 4, + ReferencedObjectComplete =5 } private ICollection _ResultList; @@ -66,7 +68,10 @@ namespace Volian.Print.Library } private int _ReportType = 0; private string _ByLine; + private bool _SortUsageByProcedure = false; + private string _RODataFile = ""; + // Search Results Report public PDFReport(string reportTitle, string typesSelected, ICollection resultList, string fileName) { _ResultList = resultList; @@ -77,6 +82,8 @@ namespace Volian.Print.Library _ByLine = "PROMS Search Results"; } + + // Library Document Report public PDFReport(string reportTitle, DocumentInfoList libDocList, string fileName) { _LibDocList = libDocList; @@ -85,6 +92,28 @@ namespace Volian.Print.Library _ReportType = (int)ReportType.LibraryDocUsage; _ByLine = "Generated By PROMS"; } + + // Transition and RO Usage + public PDFReport(string reportTitle, ICollection resultList, string fileName, bool sortUsageByProcedure) + { + _ResultList = resultList; + _FileName = fileName; + _ReportTitle = VEPROMS.CSLA.Library.ItemInfo.ConvertToDisplayText(reportTitle); + _ReportType = (int)ReportType.ReferencedObjectsUsage; + _ByLine = "Generated By PROMS"; + _SortUsageByProcedure = sortUsageByProcedure; + } + + // RO Coomplete and Summary Reports + public PDFReport(string reportTitle, string roDataFile, string outfile, bool completeReport) + { + _FileName = outfile; + _ReportTitle = reportTitle; + _ReportType = (completeReport) ? (int)ReportType.ReferencedObjectComplete : (int)ReportType.ReferencedObjectSummary; + _ByLine = (completeReport) ? "Complete RO Report" : "Summary RO Report"; + _RODataFile = roDataFile; + } + //public void Build2() //{ // iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER, 36, 36, 36, 36); @@ -207,7 +236,7 @@ namespace Volian.Print.Library { retval = NewPath[--n]; if (retval.Contains("\x11")) - retval = retval.Substring(0, retval.IndexOf("\x11")); + retval = retval.Substring(0, retval.IndexOf("\x11")); // this is the step number } for (int j = jstart; j < n; j++) { @@ -229,11 +258,62 @@ namespace Volian.Print.Library } return retval; } + + private void AddProcedureSectionGroup(PdfPTable datatable, string curProc, string lastProc, string curSect, string lastSect, Font f2, Color bgColor) + { + string headerText = ""; + if (curProc != lastProc) + headerText = curProc + "\r\n"; + if (curSect != lastSect) + headerText += " " + curSect; + if (headerText.Length > 0) + { + headerText = headerText.Replace(@"\u8209?", "-");// repace unicode with dash char + headerText = headerText.Replace(@"\u160?", " "); // replace Hard Space with normal Space + PdfPCell cell = new PdfPCell(new Phrase(headerText, f2)); + cell.Colspan = 2; + cell.BackgroundColor = bgColor; + cell.BorderWidthTop = 1; + datatable.AddCell(cell); + } + } + private string GetCurProcNum(string path) { string[] NewPath = path.Split("\x7".ToCharArray()); return NewPath[1]; } + //private string GetCurSectionNumTitle(string path) + //{ + // string[] NewPath = path.Split("\x7".ToCharArray()); + // int idx = 2; //start of section and subsection num and title + // int stpidx = NewPath.Length - 1; // last position is the step number + // string rtnstr = ""; + // while (idx < stpidx) + // { + // rtnstr += NewPath[idx++]; + // if (idx < stpidx) + // rtnstr += "\n "; + // } + // return rtnstr; // srting containing section and subsection number/titles + //} + private string GetCurSectionNumTitle(ItemInfo itm) + { + string rtnstr = ""; + rtnstr = itm.ActiveSection.DisplayNumber; + if (rtnstr.Length > 0) rtnstr += " "; + rtnstr += itm.ActiveSection.DisplayText; + return rtnstr; // srting containing section and subsection number/titles + } + //private string GetStepNumberFromSearchPath(string path) + //{ + // string[] NewPath = path.Split("\x7".ToCharArray()); + // int idx = NewPath.Length - 1; + // string retval = NewPath[idx]; + // if (retval.Contains("\x11")) + // retval = retval.Substring(0, retval.IndexOf("\x11")); // this is the step number + // return retval; + //} private int FindSpitLevel() { int level = 0; @@ -326,6 +406,15 @@ namespace Volian.Print.Library case (int)ReportType.LibraryDocUsage: BuildLibDocUsageReport(document); break; + case (int)ReportType.ReferencedObjectsUsage: + if (_SortUsageByProcedure) + BuildROUsageTableByProcedure(document); + else + BuildROUsageTableByRO(document); + break; + case (int)ReportType.ReferencedObjectComplete: + BuildCompleteROReport(document); + break; } } catch (Exception ex) @@ -681,7 +770,398 @@ namespace Volian.Print.Library } document.Add(datatable); } - private System.Collections.ArrayList ProcSetList; + private void AddROUsages(ItemInfo item, Dictionary> roUse) + { + //string lastROid = ""; + if (item.FoundROID != null && item.FoundROID != "") + { + string roid = item.FoundROID; + if (roUse.ContainsKey(roid)) + ((List)roUse[roid]).Add(item); + else + { + List itmIfoLst = new List(); + itmIfoLst.Add(item); + roUse.Add(roid, itmIfoLst); + } + } + } + private void PutROusageForProcedure(PdfPTable curTable, Dictionary> rosused, float[] headerwidths) + { + //if (rosused.Count == 0) return; // nothing to process + iTextSharp.text.Font f2 = pdf.GetFont("Arial Unicode MS", 10, 0, Color.BLACK); + foreach (string roKey in rosused.Keys) + { + PdfPTable rotable = new PdfPTable(headerwidths); + string rotitle = ""; + foreach (ItemInfo itm in rosused[roKey]) + { + if (rotitle == "") + { + //ROFSTLookup myrofstlookup = itm.MyDocVersion.DocVersionAssociations[0].MyROFst.ROFSTLookup; + //List roTitleList = myrofstlookup.GetROTitleAndGroupPath(roKey); + //for (int cnt = 0; cnt < roTitleList.Count; cnt++) + //{ + // if (cnt == roTitleList.Count - 1) + // //rotitle += string.Format("<{0}> {1} {2}", myrofstlookup.GetRoACID(roKey), myrofstlookup.GetTranslatedRoValue(roKey, true), roTitleList[cnt]); + // rotitle += roTitleList[cnt]; + // else + // rotitle += roTitleList[cnt] + "\n "; + //} + rotitle = GetROTitleAndGroup(roKey, itm); + PdfPCell ROTitleCell = new PdfPCell(new Phrase(rotitle, f2)); + ROTitleCell.Colspan = 2; + ROTitleCell.HorizontalAlignment = Element.ALIGN_LEFT; + ROTitleCell.BackgroundColor = new Color(0xDC, 0xE7, 0xC9); //new Color(0xD0, 0xF0, 0xD0);//ligt green //new Color(0xC8, 0xC8, 0x91);//(0xAF, 0xD8, 0xD8);//(0xF5, 0xE4, 0xA0); + //curTable.AddCell(ROTitleCell); // put RO value and description + rotable.AddCell(ROTitleCell); // put RO value and description + } + string stepnum = ""; + string sectitle = itm.ActiveSection.DisplayText; + if (itm.IsSection) + stepnum = itm.MyActiveSection.DisplayNumber; + else + stepnum = BuildStepTab(itm);//GetStepNumberFromSearchPath(itm.SearchPath);//stepnum.Substring(itm.SearchPath.LastIndexOf(sectitle) + sectitle.Length +1); +// stepnum = stepnum.Substring(stepnum.LastIndexOf("\a") + 1); + //AddCell(curTable, stepnum, f2, Color.WHITE); + //AddCell(curTable, itm.DisplayText, f2, Color.WHITE); + AddCell(rotable, stepnum, f2, Color.WHITE); + AddCell(rotable, itm.DisplayText, f2, Color.WHITE); + } + curTable.AddCell(rotable); + } + } + private static string BuildStepTab(ItemInfo item) + { + if (item == null) return ""; + string sret = ""; + switch (item.MyContent.Type / 10000) + { + case 0: //procedure + sret = ProcedureInfo.Get(item.ItemID).MyTab.CleanText; + break; + case 1: // section + sret = SectionInfo.Get(item.ItemID).MyTab.CleanText; + break; + case 2: // step + + ItemInfo pitem = item; + bool hasDelim = item.ActiveFormat.PlantFormat.FormatData.TransData.StepSubstepDelimeter != null; + List DelimList = null; + if (!hasDelim) + { + DelimList = new List(); + SeqTabFmtList seqtabs = item.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.SeqTabFmtList; + foreach (SeqTabFmt seqtab in seqtabs) + { + string delim = seqtab.PrintTabFormat.Replace("{seq}", ""); + DelimList.Add(delim.Trim()); + } + } + + while (!pitem.IsHigh) + { + StepInfo stpinfo = StepInfo.Get(pitem.ItemID); + string thisTab = stpinfo.MyTab.CleanText; //StepInfo.Get(pitem.ItemID).MyTab.CleanText; + string typeName = stpinfo.FormatStepData.StepEditData.TypeMenu.MenuItem;//stpinfo.FormatStepData.ToString(); + // remove delimiters of '.' and ')' in tab. + if (thisTab != null && !hasDelim) + { + // get list of delimiters to remove from the format: + foreach (string rmvDelim in DelimList) thisTab = thisTab.Replace(rmvDelim, ""); + } + if (thisTab != null) thisTab = thisTab.Trim(); + // if the tab is null or + // if the the tab is not a letter or number OR + // the tab is an AND or OR type and is the letter "o" + // then reset the tab an empty string so that the type name along with the count of that type + // (ex. "AND 2", "OR 3") + if (thisTab == null || (thisTab != "" && (!(char.IsLetterOrDigit(thisTab[0])) || ((pitem.IsAnd || pitem.IsOr) && thisTab.Contains("o"))))) + thisTab = ""; + if (pitem.IsRNOPart) + { + if (thisTab == "") + sret = " RNO" + sret; //"RNO." + sret; + else + { + thisTab = thisTab.Trim(" ".ToCharArray()); + sret = " RNO." + thisTab + sret; //"RNO." + thisTab + sret; + } + } + else if (pitem.IsCaution || pitem.IsNote) + { + // add the Caution or Note count to the tab (ex "Caution 1", "Note 2") + if (thisTab == "") + sret = ".{" + typeName + " " + pitem.Ordinal.ToString() + "}"; + else + { + thisTab = thisTab.Trim(" ".ToCharArray()); + sret = "." + thisTab + " " + pitem.Ordinal.ToString() + sret; + } + } + else + { + if (thisTab != "") + { + thisTab = thisTab.Trim(" ".ToCharArray()); + if (hasDelim && !thisTab.EndsWith(".") && !thisTab.EndsWith(")")) thisTab = thisTab + "."; + } + else + thisTab = "{" + typeName + " " + pitem.Ordinal.ToString() + "}"; + sret = "." + thisTab + sret; + } + pitem = pitem.ActiveParent as ItemInfo; + if (pitem == null) break; + } + // add hls tab if it's not already in the tab. + if (pitem.IsHigh) + { + StepInfo stpinfo = StepInfo.Get(pitem.ItemID); + + string hlsTab = stpinfo.MyTab.CleanTextNoSymbols; //StepInfo.Get(pitem.ItemID).MyTab.CleanTextNoSymbols; + //string thisTab = stpinfo.MyTab.CleanText; //StepInfo.Get(pitem.ItemID).MyTab.CleanText; + string typeName = stpinfo.FormatStepData.StepEditData.TypeMenu.MenuItem;//stpinfo.FormatStepData.GetPDDisplayName(); //.ToString(); + if (hlsTab == null || hlsTab == "") + hlsTab = "{" + typeName + " "+ pitem.Ordinal.ToString()+"}"; + else if (!sret.StartsWith(hlsTab.Trim(" ".ToCharArray()))) + { + if (!hasDelim) + foreach (string rmvDelim in DelimList) hlsTab = hlsTab.Replace(rmvDelim, ""); + hlsTab = hlsTab.Trim(" ".ToCharArray()); + if (hasDelim && !hlsTab.EndsWith(".") && !hlsTab.EndsWith(")")) hlsTab = hlsTab + "."; + } + sret = hlsTab + sret; + } + break; + } + sret = sret.Trim(" .)".ToCharArray()); + return sret; + } + + private void BuildROUsageTableByProcedure(iTextSharp.text.Document document) + { + Dictionary> roUse = new Dictionary>(); + float[] headerwidths = { 20, 80 }; + PdfPTable datatable = new PdfPTable(1); + PdfPTable colHeader = new PdfPTable(headerwidths); + //datatable.FooterRows = 1; + datatable.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; + datatable.LockedWidth = true; + iTextSharp.text.Font f1 = pdf.GetFont("Arial Unicode MS", 14, 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", 12, 0, Color.BLACK); + PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, f1)); + cell.HorizontalAlignment = Element.ALIGN_CENTER; + //cell.Colspan = 2; + cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0); // light blue + datatable.AddCell(cell); + + BuildSearchResultsProcSetList(); + datatable.HeaderRows = 2;//3 + (ProcSetList.Count == 1 ? 1 : 0); + int splitAt = FindSpitLevel(); // find the split level of the common path - for all procedure sets that use these library documents + + Color subHeaderColor = new Color(0xD0, 0xF0, 0xF0); // light blue //new Color(0xD0, 0xF0, 0xD0);//ligt green + datatable.DefaultCell.Padding = 4; + datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; + // This puts "Step" and "Text" column headers at the bottom of the page + AddCell(colHeader, "Step", f2, subHeaderColor); + AddCell(colHeader, "Text", f2, subHeaderColor); + datatable.AddCell(colHeader); + datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT; + //string lastPath = ""; + Color AnnoColor = new Color(0xFF, 0xFF, 0xC0); + Color TextColor = Color.WHITE; + Color SectColor = new Color(0xE0, 0xFF, 0xE0);//new Color(0xC0, 0xFF, 0xC0);//Color.LIGHT_GRAY; + PdfPTable subTable = new PdfPTable(headerwidths); + datatable.AddCell(subTable); + string lastProcNum = ""; + string lastSection = ""; + string lastDVPath = ""; + foreach (ItemInfo item in _ResultList) + { + // Check Doc Version path + if (lastDVPath != item.SearchDVPath) + { + subTable = new PdfPTable(headerwidths); + AddMainPathGroup(datatable, item.SearchDVPath, splitAt, f2, Color.LIGHT_GRAY, 0); + lastProcNum = ""; + lastSection = ""; + } + lastDVPath = item.SearchDVPath; + //check for different procedure number + string curProcNum = GetCurProcNum(item.SearchPath); + string curSection = GetCurSectionNumTitle(item); + if (lastProcNum != "" && (curProcNum != lastProcNum)) + { + if (roUse.Count > 0) + { + PutROusageForProcedure(datatable, roUse, headerwidths); + roUse.Clear(); + } + lastSection = ""; + } + if (lastSection != "" && (curSection != lastSection)) + { + if (roUse.Count > 0) + { + PutROusageForProcedure(datatable, roUse, headerwidths); + roUse.Clear(); + } + } + AddROUsages(item, roUse); // add the used ro to the list for this procedure + AddProcedureSectionGroup(datatable, curProcNum, lastProcNum, curSection, lastSection, f2, new Color(0xC0, 0xFF, 0xC0)); + lastProcNum = curProcNum; + lastSection = curSection; + } + PutROusageForProcedure(datatable, roUse, headerwidths); + document.Add(datatable); + } + + private void AddProcROUse(ItemInfo item, Dictionary> procRoUse) + { + string dictKey = GetCurProcNum(item.SearchPath) + " " + GetCurSectionNumTitle(item); + if (dictKey != null && dictKey != "") + { + if (procRoUse.ContainsKey(dictKey)) + ((List)procRoUse[dictKey]).Add(item); + else + { + List itmIfoLst = new List(); + itmIfoLst.Add(item); + procRoUse.Add(dictKey, itmIfoLst); + } + } + } + private void PutROusageForROID(PdfPTable curTable, Dictionary> procRoUse, float[] headerwidths) + { + //if (rosused.Count == 0) return; // nothing to process + iTextSharp.text.Font f2 = pdf.GetFont("Arial Unicode MS", 10, 0, Color.BLACK); + string lastProcKey = ""; + foreach (string procKey in procRoUse.Keys) + { + PdfPTable rotable = new PdfPTable(headerwidths); + foreach (ItemInfo itm in procRoUse[procKey]) + { + if (procKey != lastProcKey) + { + string procNumTitleSect = GetCurProcNum(itm.SearchPath) + "\r\n " + GetCurSectionNumTitle(itm); + procNumTitleSect = procNumTitleSect.Replace(@"\u8209?", "-"); // repace unicode with dash char + procNumTitleSect = procNumTitleSect.Replace(@"\u160?", " "); // replace Hard Space with normal Space + PdfPCell ProcTitleCell = new PdfPCell(new Phrase(procNumTitleSect, f2)); + ProcTitleCell.Colspan = 2; + ProcTitleCell.HorizontalAlignment = Element.ALIGN_LEFT; + ProcTitleCell.BackgroundColor = new Color(0xDC, 0xE7, 0xC9); //new Color(0xD0, 0xF0, 0xD0);//ligt green //new Color(0xC8, 0xC8, 0x91);//(0xAF, 0xD8, 0xD8);//(0xF5, 0xE4, 0xA0); + rotable.AddCell(ProcTitleCell); // put RO value and description + lastProcKey = procKey; + } + string stepnum = ""; + string sectitle = itm.ActiveSection.DisplayText; + if (itm.IsSection) + stepnum = itm.MyActiveSection.DisplayNumber; + else + stepnum = BuildStepTab(itm);//GetStepNumberFromSearchPath(itm.SearchPath);//stepnum.Substring(itm.SearchPath.LastIndexOf(sectitle) + sectitle.Length +1); + AddCell(rotable, stepnum, f2, Color.WHITE); + AddCell(rotable, itm.DisplayText, f2, Color.WHITE); + } + curTable.AddCell(rotable); + } + } + + private static string GetROTitleAndGroup(string roid, ItemInfo itm) + { + string rotitle = ""; + ROFSTLookup myrofstlookup = itm.MyDocVersion.DocVersionAssociations[0].MyROFst.ROFSTLookup; + List roTitleList = myrofstlookup.GetROTitleAndGroupPath(roid); + for (int cnt = 0; cnt < roTitleList.Count; cnt++) + { + if (cnt == roTitleList.Count - 1) + rotitle += roTitleList[cnt]; + else + rotitle += roTitleList[cnt] + "\n "; + } + return rotitle; + } + + private void AddROHeaderGroup(PdfPTable datatable, string curROID, ItemInfo itm, Font f2, Color bgColor) + { + string headerText = GetROTitleAndGroup(curROID, itm); + if (headerText.Length > 0) + { + PdfPCell cell = new PdfPCell(new Phrase(headerText, f2)); + cell.Colspan = 2; + cell.BackgroundColor = bgColor; + cell.BorderWidthTop = 1; + datatable.AddCell(cell); + } + } + + private void BuildROUsageTableByRO(iTextSharp.text.Document document) + { + Dictionary> procRoUse = new Dictionary>(); + float[] headerwidths = { 20, 80 }; + PdfPTable datatable = new PdfPTable(1); + PdfPTable colHeader = new PdfPTable(headerwidths); + //datatable.FooterRows = 1; + datatable.TotalWidth = document.PageSize.Width - document.LeftMargin - document.RightMargin; + datatable.LockedWidth = true; + iTextSharp.text.Font f1 = pdf.GetFont("Arial Unicode MS", 14, 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", 12, 0, Color.BLACK); + PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, f1)); + cell.HorizontalAlignment = Element.ALIGN_CENTER; + //cell.Colspan = 2; + cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0); // light blue + datatable.AddCell(cell); + + BuildSearchResultsProcSetList(); + datatable.HeaderRows = 2;//3 + (ProcSetList.Count == 1 ? 1 : 0); + int splitAt = FindSpitLevel(); // find the split level of the common path - for all procedure sets that use these library documents + + Color subHeaderColor = new Color(0xD0, 0xF0, 0xF0); // light blue //new Color(0xD0, 0xF0, 0xD0);//ligt green + datatable.DefaultCell.Padding = 4; + datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; + // This puts "Step" and "Text" column headers at the bottom of the page + AddCell(colHeader, "Step", f2, subHeaderColor); + AddCell(colHeader, "Text", f2, subHeaderColor); + datatable.AddCell(colHeader); + datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT; + string lastPath = ""; + Color AnnoColor = new Color(0xFF, 0xFF, 0xC0); + Color TextColor = Color.WHITE; + Color SectColor = new Color(0xE0, 0xFF, 0xE0);//new Color(0xC0, 0xFF, 0xC0);//Color.LIGHT_GRAY; + PdfPTable subTable = new PdfPTable(headerwidths); + datatable.AddCell(subTable); + string lastDVPath = ""; + string lastROID = ""; + foreach (ItemInfo item in _ResultList) + { + // Check Doc Version path + if (lastDVPath != item.SearchDVPath) + { + subTable = new PdfPTable(headerwidths); + AddMainPathGroup(datatable, item.SearchDVPath, splitAt, f2, Color.LIGHT_GRAY, 0); + } + lastDVPath = item.SearchDVPath; + + // Chec for different ROID + string curROID = item.FoundROID; + if (curROID != lastROID) + { + if (lastROID != "" && procRoUse.Count > 0) + { + PutROusageForROID(datatable, procRoUse, headerwidths); + procRoUse.Clear(); + } + AddROHeaderGroup(datatable, curROID, item, f2, new Color(0xC0, 0xFF, 0xC0)); + } + AddProcROUse(item, procRoUse); + lastROID = curROID; + } + PutROusageForROID(datatable, procRoUse, headerwidths); + document.Add(datatable); + } + + private System.Collections.ArrayList ProcSetList; private void BuildSearchResultsProcSetList() { ProcSetList = new System.Collections.ArrayList(); @@ -725,6 +1205,22 @@ namespace Volian.Print.Library } return rtnIFL; } + + private void BuildCompleteROReport(iTextSharp.text.Document document) + { + iTextSharp.text.Font f1 = pdf.GetFont("Arial Unicode MS", 14, 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", 12, 0, Color.BLACK); + + iTextSharp.text.Font fntBold = new Font(f3.BaseFont, f3.Size, Font.BOLD, Color.RED); + CompleteROReport compRORpt = new CompleteROReport(document, _RODataFile); + compRORpt.Run(); + + Phrase phrs = BuildPhrase2("Complete Referenced Objects Report", f1, fntBold); + Paragraph prgh = new Paragraph(phrs);//("Complete", fntBold); + //document.Add(prgh); + document.Add(phrs); + } } public class MyPageHelper : PdfPageEventHelper { diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 33be358b..d9c7d314 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -340,6 +340,20 @@ namespace Volian.Print.Library { if ((mySection.MyContent.Number.ToUpper() == "FOLDOUT") != doingFoldout) continue; + SectionConfig sc = mySection.MyConfig as SectionConfig; +#if AllButFirstPage + if (_MyHelper != null && mySection.IsStepSection && mySection.MyPrevious != null && mySection.MyPrevious.IsStepSection) + { + //SectionConfig.SectionPagination sPag = SectionConfig.SectionPagination.Separate; + //sPag = sc.Section_Pagination; + //if (sPag == SectionConfig.SectionPagination.Continuous) + if (sc.Section_Pagination == SectionConfig.SectionPagination.Continuous) + { + if (mySection.MyDocStyle.StructureStyle.Where == E_DocStyleUse.UseOnFirstPage) + mySection.DidFirstPageDocStyle = true; + } + } +#endif PrintOverride.CompressSuper = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSuper; PrintOverride.CompressSub = mySection.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.CompressHPSub; OnStatusChanged((mySection.DisplayNumber ?? "") == "" ? mySection.DisplayText : mySection.DisplayNumber, PromsPrinterStatusType.Progress, progress++); @@ -391,7 +405,7 @@ namespace Volian.Print.Library PdfReader readerWord = null; string myPdfFile = null; _MyHelper.FinalMessageSectionID = finalMessageSectionID; // set VlnSvgPageHelper with the finalMessageSectionID - SectionConfig sc = mySection.MyConfig as SectionConfig; + //SectionConfig sc = mySection.MyConfig as SectionConfig; if (mySection.IsAutoTOCSection) GenerateTOC(mySection, myProcedure, cb, _TextLayer); else @@ -662,7 +676,10 @@ namespace Volian.Print.Library private float _NoBreakYPageStart = 0; private void CreateStepPdf(SectionInfo section, PdfContentByte cb) { - //section.PageNumForDocStyle = 1; // first step of the section + //section.PageNumForDocStyle = 1; +#if AllButFirstPage + section.DidFirstPageDocStyle = false; // first step of the section +#endif iTextSharp.text.pdf.PdfWriter writer = cb.PdfWriter; ItemInfo myItemInfo = section as ItemInfo; // 792: 72 * 11 inches - TopRow - Top is high value diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index 0538afc5..1b29247f 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -420,6 +420,20 @@ namespace Volian.Print.Library } private Volian.Svg.Library.Svg BuildSvg(VEPROMS.CSLA.Library.SectionInfo mySection) { + // if mysection uses continuous pagination, and the previous section uses the same format, + // and the docstyle is set to use on first page only, + // then set section to use the Use On Rest of Pages + //SectionConfig.SectionPagination sPag = SectionConfig.SectionPagination.Separate; + //if (mySection.IsStepSection && mySection.MyPrevious != null && mySection.MyPrevious.IsStepSection) + //{ + // SectionConfig sc = mySection.MyConfig as SectionConfig; + // sPag = sc.Section_Pagination; + // if (sPag == SectionConfig.SectionPagination.Continuous) + // { + // if (MySection.MyDocStyle.StructureStyle.Where == E_DocStyleUse.UseOnFirstPage) + // MySection.DidFirstPageDocStyle = true; + // } + //} VEPROMS.CSLA.Library.FormatInfo activeFormat = mySection.ActiveFormat; VEPROMS.CSLA.Library.DocStyle docStyle = mySection.MyDocStyle; Volian.Svg.Library.Svg mySvg = null; @@ -443,6 +457,7 @@ namespace Volian.Print.Library SectionConfig sc = mySection.MyConfig as SectionConfig; sPag = sc.Section_Pagination; } + //if (sPag == SectionConfig.SectionPagination.Continuous && !mySection.DidFirstPageDocStyle) return null; if (sPag == SectionConfig.SectionPagination.Continuous) return null; return mySvg; } @@ -600,7 +615,10 @@ namespace Volian.Print.Library foreach (VEPROMS.CSLA.Library.PageItem pageItem in pageStyle.PageItems) { VE_Font useFontForCheckOffHeader = null; - if (sPag == SectionConfig.SectionPagination.Separate || ((sPag == SectionConfig.SectionPagination.Continuous || sPag ==0 )&& pageItem.Row < 0)) +#if AllButFirstPage + if (sPag == SectionConfig.SectionPagination.Separate || ((sPag == SectionConfig.SectionPagination.Continuous || sPag ==0 )&& ((pageItem.Row < 0) || section.DidFirstPageDocStyle))) +#endif + if (sPag == SectionConfig.SectionPagination.Separate || ((sPag == SectionConfig.SectionPagination.Continuous || sPag ==0 )&& (pageItem.Row < 0))) { //if (PrevRow > 0) //{ diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 8b4cc9fc..64691b1a 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -438,6 +438,10 @@ namespace Volian.Print.Library } public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin) { +#if AllButFirstPage + // 792: 72 * 11 inches - TopRow - Top is high value + float _PointsPerPage = 792; +#endif if (IsWordDocPara) { PdfReader tmp = null; @@ -454,6 +458,9 @@ namespace Volian.Print.Library DebugText.WriteLine("ToPdf1:{0},'{1}',{2},{3},{4},{5}", MyItemInfo.ItemID, MyItemInfo.ShortSearchPath, XOffset, yLocation, yPageStart, YTopMost); int paginate = Paginate(yLocation, yTopMargin, yBottomMargin); bool firstHighLevelStep = MyItemInfo.IsHigh && (MyItemInfo.MyPrevious == null); +#if AllButFirstPage + SectionInfo currentSectionInfo = MyItemInfo.ActiveSection as SectionInfo;//MyItemInfo as SectionInfo; +#endif switch (paginate) { case 0: // No page break @@ -466,7 +473,19 @@ namespace Volian.Print.Library break; case 1: // Break on High Level Step OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); +#if AllButFirstPage + + // need logic for AllButFirstPage + // recac yTopMargin, YBottomMargin, YTopMost??? + currentSectionInfo.DidFirstPageDocStyle = true; + //MyItemInfo.DidFirstPageDocStyle = true; + yTopMargin = _PointsPerPage - (float)currentSectionInfo.MyDocStyle.Layout.TopMargin; //(float)MyItemInfo.MyDocStyle.Layout.TopMargin; + yBottomMargin = Math.Max(0, yTopMargin - (float)currentSectionInfo.MyDocStyle.Layout.PageLength); //(float)MyItemInfo.MyDocStyle.Layout.PageLength); +#endif cb.PdfDocument.NewPage(); +#if AllButFirstPage + MyPageHelper.MySection = currentSectionInfo; +#endif DebugText.WriteLine("Paginate1"); if (MyItemInfo.IsSection) { @@ -476,7 +495,6 @@ namespace Volian.Print.Library // Only do foldout page if not done for section break, i.e. check the there's a previous step. if (MyItemInfo.MyPrevious != null && (MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0) PromsPrinter.DoFoldoutPage(cb, "HLS", MyPageHelper.TextLayer, MyPageHelper); - yPageStart = yTopMargin + YTopMost; DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart); MyPageHelper.YMultiplier = 1; @@ -513,11 +531,22 @@ namespace Volian.Print.Library } MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Bottom.Margin ?? 0, msg_yLocation, docstyle.Continue.Bottom.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font); } +#if AllButFirstPage + // need logic for AllButFirstPage + // recac yTopMargin, YBottomMargin, YTopMost??? + //currentSectionInfo.DidFirstPageDocStyle = true; + currentSectionInfo.DidFirstPageDocStyle = true; + //MyItemInfo.DidFirstPageDocStyle = true; + yTopMargin = _PointsPerPage - (float)currentSectionInfo.MyDocStyle.Layout.TopMargin; //(float)MyItemInfo.MyDocStyle.Layout.TopMargin; + yBottomMargin = Math.Max(0, yTopMargin - (float)currentSectionInfo.MyDocStyle.Layout.PageLength); //(float)MyItemInfo.MyDocStyle.Layout.PageLength); +#endif cb.PdfDocument.NewPage(); +#if AllButFirstPage + MyPageHelper.MySection = currentSectionInfo; +#endif DebugText.WriteLine("Paginate2"); if ((MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0) PromsPrinter.DoFoldoutPage(cb, "Break within Step", MyPageHelper.TextLayer, MyPageHelper); // temporary foldout - // If there is a box, adjust the yTopMost to include it. float yTopMost = YTopMost; //if (YVeryTop < yTopMost) Console.WriteLine("{0},{1},{2}", MyItemInfo.DBSequence, yTopMost, YVeryTop); @@ -539,7 +568,19 @@ namespace Volian.Print.Library if (!firstHighLevelStep) { OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); +#if AllButFirstPage + + // need logic for AllButFirstPage + // recac yTopMargin, YBottomMargin, YTopMost??? + currentSectionInfo.DidFirstPageDocStyle = true; + //MyItemInfo.DidFirstPageDocStyle = true; + yTopMargin = _PointsPerPage - (float)currentSectionInfo.MyDocStyle.Layout.TopMargin; //(float)MyItemInfo.MyDocStyle.Layout.TopMargin; + yBottomMargin = Math.Max(0, yTopMargin - (float)currentSectionInfo.MyDocStyle.Layout.PageLength); //(float)MyItemInfo.MyDocStyle.Layout.PageLength); +#endif cb.PdfDocument.NewPage(); // HLS (7 lpi) breakif (MyItemInfo.IsSection) +#if AllButFirstPage + MyPageHelper.MySection = currentSectionInfo; +#endif DebugText.WriteLine("Paginate3"); if (MyItemInfo.IsSection) { @@ -1866,6 +1907,9 @@ namespace Volian.Print.Library { // NOT SURE IF WE NEED TO TEST FOR THE NULLBOX FORMAT FLAG, MAYBE "bx == null" IS THE SAME THING //if (formatInfo.MyStepSectionLayoutData.NullBox) + if (widOvrd != 0) + Width = (float)widOvrd - tabWidth; + else Width = (float)formatInfo.MyStepSectionLayoutData.WidT - tabWidth; } else