diff --git a/PROMS/Volian.Controls.Library/DisplayReports.Designer.cs b/PROMS/Volian.Controls.Library/DisplayReports.Designer.cs index 26215b3d..a96f7d1d 100644 --- a/PROMS/Volian.Controls.Library/DisplayReports.Designer.cs +++ b/PROMS/Volian.Controls.Library/DisplayReports.Designer.cs @@ -30,6 +30,11 @@ namespace Volian.Controls.Library { this.components = new System.ComponentModel.Container(); this.tctrlReports = new DevComponents.DotNetBar.TabControl(); + 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.tabControlPanel2 = new DevComponents.DotNetBar.TabControlPanel(); this.panRORpts = new DevComponents.DotNetBar.PanelEx(); this.cbxIncldMissingROs = new DevComponents.DotNetBar.Controls.CheckBoxX(); @@ -41,11 +46,6 @@ namespace Volian.Controls.Library 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(); @@ -58,12 +58,13 @@ namespace Volian.Controls.Library this.btnPrintReport = new DevComponents.DotNetBar.ButtonX(); this.xpSelROs = new DevComponents.DotNetBar.ExpandablePanel(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.cbxSortBySetpointID = new DevComponents.DotNetBar.Controls.CheckBoxX(); ((System.ComponentModel.ISupportInitialize)(this.tctrlReports)).BeginInit(); this.tctrlReports.SuspendLayout(); - this.tabControlPanel2.SuspendLayout(); - this.panRORpts.SuspendLayout(); this.tabControlPanel1.SuspendLayout(); this.panelEx1.SuspendLayout(); + this.tabControlPanel2.SuspendLayout(); + this.panRORpts.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.advTreeRO)).BeginInit(); this.xpSetToReport.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.advTreeProcSets)).BeginInit(); @@ -75,8 +76,8 @@ namespace Volian.Controls.Library this.tctrlReports.CanReorderTabs = false; this.tctrlReports.CloseButtonOnTabsAlwaysDisplayed = false; this.tctrlReports.CloseButtonPosition = DevComponents.DotNetBar.eTabCloseButtonPosition.Right; - this.tctrlReports.Controls.Add(this.tabControlPanel1); 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(2); @@ -94,6 +95,88 @@ namespace Volian.Controls.Library this.tctrlReports.Text = "tabControl1"; this.tctrlReports.ThemeAware = true; // + // tabControlPanel1 + // + this.tabControlPanel1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Windows7; + this.tabControlPanel1.Controls.Add(this.panelEx1); + this.tabControlPanel1.Location = new System.Drawing.Point(0, 22); + this.tabControlPanel1.Name = "tabControlPanel1"; + this.tabControlPanel1.Padding = new System.Windows.Forms.Padding(1); + this.tabControlPanel1.Size = new System.Drawing.Size(261, 82); + 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.Name = "panelEx1"; + this.panelEx1.Size = new System.Drawing.Size(259, 81); + 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(3, 3); + this.cbxTransToProcs.Name = "cbxTransToProcs"; + this.cbxTransToProcs.Size = new System.Drawing.Size(257, 23); + 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(2, 32); + this.cbxTransFromProcs.Name = "cbxTransFromProcs"; + this.cbxTransFromProcs.Size = new System.Drawing.Size(257, 23); + 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); + // // tabControlPanel2 // this.tabControlPanel2.Controls.Add(this.panRORpts); @@ -116,6 +199,7 @@ namespace Volian.Controls.Library // this.panRORpts.CanvasColor = System.Drawing.SystemColors.Control; this.panRORpts.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; + this.panRORpts.Controls.Add(this.cbxSortBySetpointID); this.panRORpts.Controls.Add(this.cbxIncldMissingROs); this.panRORpts.Controls.Add(this.cbxSummary); this.panRORpts.Controls.Add(this.cbxROUsage); @@ -142,7 +226,7 @@ namespace Volian.Controls.Library // // this.cbxIncldMissingROs.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbxIncldMissingROs.Location = new System.Drawing.Point(7, 61); + this.cbxIncldMissingROs.Location = new System.Drawing.Point(3, 68); this.cbxIncldMissingROs.Name = "cbxIncldMissingROs"; this.cbxIncldMissingROs.Size = new System.Drawing.Size(241, 23); this.cbxIncldMissingROs.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; @@ -243,88 +327,6 @@ namespace Volian.Controls.Library 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.Location = new System.Drawing.Point(0, 22); - this.tabControlPanel1.Name = "tabControlPanel1"; - this.tabControlPanel1.Padding = new System.Windows.Forms.Padding(1); - this.tabControlPanel1.Size = new System.Drawing.Size(261, 82); - 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.Name = "panelEx1"; - this.panelEx1.Size = new System.Drawing.Size(259, 81); - 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(3, 3); - this.cbxTransToProcs.Name = "cbxTransToProcs"; - this.cbxTransToProcs.Size = new System.Drawing.Size(257, 23); - 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(2, 32); - this.cbxTransFromProcs.Name = "cbxTransFromProcs"; - this.cbxTransFromProcs.Size = new System.Drawing.Size(257, 23); - 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; @@ -490,6 +492,20 @@ namespace Volian.Controls.Library this.xpSelROs.TitleStyle.GradientAngle = 90; this.xpSelROs.TitleText = "Select Referenced Objects"; // + // cbxSortBySetpointID + // + // + // + // + this.cbxSortBySetpointID.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.cbxSortBySetpointID.Location = new System.Drawing.Point(3, 39); + this.cbxSortBySetpointID.Name = "cbxSortBySetpointID"; + this.cbxSortBySetpointID.Size = new System.Drawing.Size(121, 23); + this.cbxSortBySetpointID.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.cbxSortBySetpointID.TabIndex = 11; + this.cbxSortBySetpointID.Text = "Sort By Sepoint ID"; + this.cbxSortBySetpointID.Visible = false; + // // DisplayReports // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -504,10 +520,10 @@ namespace Volian.Controls.Library this.Size = new System.Drawing.Size(261, 676); ((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); + this.tabControlPanel2.ResumeLayout(false); + this.panRORpts.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.advTreeRO)).EndInit(); this.xpSetToReport.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.advTreeProcSets)).EndInit(); @@ -547,5 +563,6 @@ namespace Volian.Controls.Library private DevComponents.DotNetBar.PanelEx panelEx1; private DevComponents.DotNetBar.Controls.CheckBoxX cbxIncldMissingROs; private System.Windows.Forms.ToolTip toolTip1; + private DevComponents.DotNetBar.Controls.CheckBoxX cbxSortBySetpointID; } } diff --git a/PROMS/Volian.Controls.Library/DisplayReports.cs b/PROMS/Volian.Controls.Library/DisplayReports.cs index b70c54af..e034d99f 100644 --- a/PROMS/Volian.Controls.Library/DisplayReports.cs +++ b/PROMS/Volian.Controls.Library/DisplayReports.cs @@ -97,6 +97,95 @@ namespace Volian.Controls.Library } } + private Dictionary AccIDROIDdic = new Dictionary(); + + private void GenerateAccIDSortedROList() + { + //Dictionary AccIDROIDdic = new Dictionary(); + List AccPgIDsList = new List(); + AccIDROIDdic.Clear(); + string rtnStr = ""; + ROFSTLookup.rochild[] chld = null; + ROFSTLookup.rochild ch; + ROList.Clear(); + foreach (object rolkup in lstCheckedROs) + { + if (rolkup == null) // All Referenced Objects selected, return list of RO databases + { + foreach (ROFSTLookup.rodbi rodbi in _MyROFSTLookup.GetRODatabaseList()) + { + rtnStr = _MyRODbID.ToString() + ":" + string.Format("{0}", rodbi.dbiID.ToString("X4")); + //ROList.Add(rtnStr); + foreach (ROFSTLookup.rochild roc in rodbi.children) + PutROChildrenInDictionary(_MyRODbID.ToString() + ":", roc); + } + continue; + } + else if (rolkup is ROFSTLookup.rodbi) + { + //rtnStr = _MyRODbID.ToString() + ":" + string.Format("{0}", ((ROFSTLookup.rodbi)rolkup).dbiID.ToString("X4")); + ROFSTLookup.rodbi rodbi = (ROFSTLookup.rodbi)rolkup; + foreach (ROFSTLookup.rochild roc in rodbi.children) + PutROChildrenInDictionary(_MyRODbID.ToString() + ":", roc); + } + else if (rolkup is ROFSTLookup.rochild) + { + ch = (ROFSTLookup.rochild)rolkup; + chld = ch.children; + //rtnStr = _MyRODbID.ToString() + ":" + GetROChildren(rolkup).TrimEnd(','); + PutROChildrenInDictionary(_MyRODbID.ToString() + ":", rolkup); + } + //else if (rolkup is ROFSTLookup.rogrp) + // Console.WriteLine("RO Group"); + //else if (rolkup is ROFSTLookup.roHdr) + // Console.WriteLine("RO Header"); + //ROList.Add(rtnStr); + } + foreach (string k in AccIDROIDdic.Keys) + AccPgIDsList.Add(k); + string[] AccPgIdListArray = AccPgIDsList.ToArray(); + Array.Sort(AccPgIdListArray, new AlphanumComparatorFast()); + foreach (string accid in AccPgIdListArray) + ROList.Add(AccIDROIDdic[accid]); + } + static int blankKeyCnt = 0; + private string GetNextBlankKey() + { + return string.Format(" _{0}", blankKeyCnt++); + } + private void PutROChildrenInDictionary(string rodbidPrefix, object roObj) + { + ROFSTLookup.rochild chld = (ROFSTLookup.rochild)roObj; + string rtnstr = rodbidPrefix;// ""; + string keystr = (chld.appid == "") ? GetNextBlankKey() : chld.appid; + if (chld.children == null) // get a single ROID + { + rtnstr = rodbidPrefix + string.Format("{0}", chld.roid); + if (rtnstr.Length == 12) rtnstr += "0000"; // last four digits are used for multiple return values + AccIDROIDdic.Add(keystr, rtnstr); + } + else if (!cbxROUsage.Checked && chld.children[0].ParentID == 0) + { + rtnstr = rodbidPrefix + string.Format("{0},", chld.roid); // doing a RO Summary or RO Complete report - don't want children that are multiple return values + AccIDROIDdic.Add(keystr, rtnstr); + } + 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) + { + // Don't get the children if we are doing a RO Summary or RO Complete report & children are the multiple return values + if (roc.children != null && (cbxROUsage.Checked || roc.children[0].ParentID != 0)) + PutROChildrenInDictionary(rodbidPrefix, roc); + else if (roc.appid != null && roc.appid != "") + { + rtnstr = rodbidPrefix + string.Format("{0}", roc.roid); + keystr = (roc.appid == "") ? GetNextBlankKey() : roc.appid; + AccIDROIDdic.Add(keystr, rtnstr); + } + } + } + } private void GenerateROList() { @@ -116,7 +205,7 @@ namespace Volian.Controls.Library continue; } else if (rolkup is ROFSTLookup.rodbi) - rtnStr = _MyRODbID.ToString() + ":" + string.Format("{0}", ((ROFSTLookup.rodbi)rolkup).dbiID.ToString("X4")); + rtnStr = _MyRODbID.ToString() + ":" + string.Format("{0}", ((ROFSTLookup.rodbi)rolkup).dbiID.ToString("X4")); else if (rolkup is ROFSTLookup.rochild) { ch = (ROFSTLookup.rochild)rolkup; @@ -200,6 +289,8 @@ namespace Volian.Controls.Library cbxIncldMissingROs.Text = "Include Empty RO Fields"; cbxIncldMissingROs.Checked = false;// !cbxSummary.Checked; cbxIncldMissingROs.Visible = cbxROUsage.Checked || cbxComplete.Checked; + cbxSortBySetpointID.Checked = false; + cbxSortBySetpointID.Visible = cbxComplete.Checked || cbxSummary.Checked; } public void SelectReferencedObjectTab() @@ -213,7 +304,7 @@ namespace Volian.Controls.Library { foreach (DevComponents.AdvTree.Node n in chldrn) { - if (n.Checked) + if (n.Checked) lstCheckedROs.Add(n.Tag); else AddSelectedROChildren(n.Nodes); @@ -252,6 +343,8 @@ namespace Volian.Controls.Library cbxIncldMissingROs.Text = "Include Empty RO Fields"; //cbxIncldMissingROs.Checked = cbxROUsage.Checked || cbxComplete.Checked; cbxIncldMissingROs.Visible = cbxROUsage.Checked || cbxComplete.Checked; + cbxSortBySetpointID.Visible = cbxComplete.Checked || cbxSummary.Checked; + labelX1.Visible = cmbxROUsageSort.Visible = !cbxSortBySetpointID.Visible; } private void tabTransitionReports_Click(object sender, EventArgs e) @@ -267,10 +360,12 @@ namespace Volian.Controls.Library { xpSetToReport.Enabled = cbxROUsage.Checked; xpSetToReport.Expanded = cbxROUsage.Checked; - cmbxROUsageSort.Enabled = cbxROUsage.Checked; + labelX1.Visible = cmbxROUsageSort.Visible = cbxROUsage.Checked; xpSelROs.Enabled = true; xpSelROs.Expanded = true; cbxIncldMissingROs.Checked = false;// !cbxSummary.Checked; + cbxSortBySetpointID.Checked = false; + cbxSortBySetpointID.Visible = !cbxROUsage.Checked; EnableOrDisablePrintButton(); } @@ -278,11 +373,13 @@ namespace Volian.Controls.Library { xpSetToReport.Enabled = cbxROUsage.Checked; xpSetToReport.Expanded = cbxROUsage.Checked; - cmbxROUsageSort.Enabled = cbxROUsage.Checked; + labelX1.Visible = cmbxROUsageSort.Visible = cbxROUsage.Checked; // reset the RO tree and clear anything that was selected advTreeROFillIn(true); lstCheckedROs.Clear(); cbxIncldMissingROs.Checked = false;// !cbxSummary.Checked; + cbxSortBySetpointID.Checked = false; + cbxSortBySetpointID.Visible = !cbxROUsage.Checked; EnableOrDisablePrintButton(); } #region Procedure List @@ -522,7 +619,7 @@ namespace Volian.Controls.Library DevComponents.AdvTree.Node topnode = null; advTreeRO.Nodes.Clear(); if (_MyROFSTLookup == null) return; - advTreeRO.BeforeExpand +=new AdvTreeNodeCancelEventHandler(advTreeRO_BeforeExpand); + advTreeRO.BeforeExpand += new AdvTreeNodeCancelEventHandler(advTreeRO_BeforeExpand); advTreeRO.AfterExpand += new AdvTreeNodeEventHandler(advTreeRO_AfterExpandorCollapse); advTreeRO.AfterCollapse += new AdvTreeNodeEventHandler(advTreeRO_AfterExpandorCollapse); topnode = new DevComponents.AdvTree.Node(); @@ -710,14 +807,14 @@ namespace Volian.Controls.Library { return DisplayRO.GreaterValue(value1, 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; + // 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; } @@ -777,6 +874,7 @@ namespace Volian.Controls.Library private void cbxComplete_CheckedChanged(object sender, EventArgs e) { cbxIncldMissingROs.Checked = false;// !cbxSummary.Checked; + cbxSortBySetpointID.Checked = false; EnableOrDisablePrintButton(); } @@ -803,7 +901,7 @@ namespace Volian.Controls.Library } if (MyDVI == null || MyDVI.DocVersionAssociationCount < 1) { - MessageBox.Show("Could not find associated path for ro data.","No RO Data", MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show("Could not find associated path for ro data.", "No RO Data", MessageBoxButtons.OK, MessageBoxIcon.Information); return ""; } //string roloc = "\"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\" " + "\"" + ROList + "\""; @@ -816,7 +914,6 @@ namespace Volian.Controls.Library roDataFile = MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\\" + roDataFile; try { - if (File.Exists(roDataFile)) File.Delete(roDataFile); Application.DoEvents(); string fname = VlnSettings.TemporaryFolder + "\\ROCompleteRprt.txt"; @@ -847,12 +944,18 @@ namespace Volian.Controls.Library Cursor = Cursors.WaitCursor; if (cbxSummary.Checked) // RO Summary Report { - GenerateROList(); + if (cbxSortBySetpointID.Checked) + GenerateAccIDSortedROList(); + else + GenerateROList(); OnPrintRequest(new DisplayReportsEventArgs("RO Summary Report", "RO Summary Report", MyROFSTLookup, ROList)); } else if (cbxComplete.Checked) // Complete RO Report { - GenerateROList(); + if (cbxSortBySetpointID.Checked) + GenerateAccIDSortedROList(); + else + GenerateROList(); string ROList = GetListOfROs(false);//don't include the RODbID in the RO list string roDataFile = BuildRODataFile(ROList); OnPrintRequest(new DisplayReportsEventArgs("Complete RO Report", "Complete RO Report", roDataFile, MyROFSTLookup, cbxComplete.Checked, this.Mydocversion.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, cbxIncldMissingROs.Checked)); @@ -867,10 +970,10 @@ namespace Volian.Controls.Library { Csla.SortedBindingList sortedResults = new Csla.SortedBindingList(SearchResults); sortedResults.ApplySort("FoundROID", ListSortDirection.Ascending); - OnPrintRequest(new DisplayReportsEventArgs("Referenced Objects Usage By RO", "RO Usage", sortedResults, usageSortedByProcedure,cbxIncldMissingROs.Checked)); + OnPrintRequest(new DisplayReportsEventArgs("Referenced Objects Usage By RO", "RO Usage", sortedResults, usageSortedByProcedure, cbxIncldMissingROs.Checked)); } else - OnPrintRequest(new DisplayReportsEventArgs("Referenced Objects Usage By Procedure", "RO Usage", SearchResults, usageSortedByProcedure,cbxIncldMissingROs.Checked)); + OnPrintRequest(new DisplayReportsEventArgs("Referenced Objects Usage By Procedure", "RO Usage", SearchResults, usageSortedByProcedure, cbxIncldMissingROs.Checked)); } else if (cbxTransFromProcs.Checked) { @@ -984,4 +1087,164 @@ namespace Volian.Controls.Library } } public delegate void DisplayReportsEvent(object sender, DisplayReportsEventArgs args); + public class AlphanumComparatorFast : IComparer + { + List GetList(string s1) + { + List SB1 = new List(); + string st1, st2, st3; + st1 = ""; + bool flag = char.IsDigit(s1[0]); + foreach (char c in s1) + { + if (flag != char.IsDigit(c) || !(char.IsDigit(c) || char.IsLetter(c)))// || c == '\'') + { + if (st1 != "") + SB1.Add(st1); + st1 = ""; + flag = char.IsDigit(c); + } + if (char.IsDigit(c)) + { + st1 += c; + } + if (char.IsLetter(c)) + { + st1 += c; + } + + + } + SB1.Add(st1); + return SB1; + } + + + + public int Compare(string x, string y) + { + string s1 = x;// as string; + if (s1 == null) + { + return 0; + } + string s2 = y;// as string; + if (s2 == null) + { + return 0; + } + if (s1 == s2) + { + return 0; + } + int len1 = s1.Length; + int len2 = s2.Length; + int marker1 = 0; + int marker2 = 0; + + // Walk through two the strings with two markers. + List str1 = GetList(s1); + List str2 = GetList(s2); + while (str1.Count != str2.Count) + { + if (str1.Count < str2.Count) + { + str1.Add(""); + } + else + { + str2.Add(""); + } + } + int x1 = 0; int res = 0; int x2 = 0; string y2 = ""; + bool status = false; + string y1 = ""; bool s1Status = false; bool s2Status = false; + //s1status ==false then string ele int; + //s2status ==false then string ele int; + int result = 0; + for (int i = 0; i < str1.Count && i < str2.Count; i++) + { + status = int.TryParse(str1[i].ToString(), out res); + if (res == 0) + { + y1 = str1[i].ToString(); + s1Status = false; + } + else + { + x1 = Convert.ToInt32(str1[i].ToString()); + s1Status = true; + } + + status = int.TryParse(str2[i].ToString(), out res); + if (res == 0) + { + y2 = str2[i].ToString(); + s2Status = false; + } + else + { + x2 = Convert.ToInt32(str2[i].ToString()); + s2Status = true; + } + //checking --the data comparision + if (!s2Status && !s1Status) //both are strings + { + result = str1[i].CompareTo(str2[i]); + } + else if (s2Status && s1Status) //both are intergers + { + if (x1 == x2) + { + if (str1[i].ToString().Length < str2[i].ToString().Length) + { + result = 1; + } + else if (str1[i].ToString().Length > str2[i].ToString().Length) + result = -1; + else + result = 0; + } + else + { + int st1ZeroCount = str1[i].ToString().Trim().Length - str1[i].ToString().TrimStart(new char[] { '0' }).Length; + int st2ZeroCount = str2[i].ToString().Trim().Length - str2[i].ToString().TrimStart(new char[] { '0' }).Length; + if (st1ZeroCount > st2ZeroCount) + result = -1; + else if (st1ZeroCount < st2ZeroCount) + result = 1; + else + result = x1.CompareTo(x2); + + } + } + else + { + result = str1[i].CompareTo(str2[i]); + } + if (result == 0) + { + continue; + } + else + break; + + } + return result; + } + + // sample usage + // List marks = new List(); + // marks.Add("M'00Z1"); + // marks.Add("M'0A27"); + // marks.Add("M'00Z0"); + // marks.Add("0000A27"); + // marks.Add("100Z0"); + + //string[] Markings = marks.ToArray(); + + // Array.Sort(Markings, new AlphanumComparatorFast()); + } + + } diff --git a/PROMS/Volian.Print.Library/CompleteRORpt.cs b/PROMS/Volian.Print.Library/CompleteRORpt.cs index 83e202a7..1ca98787 100644 --- a/PROMS/Volian.Print.Library/CompleteRORpt.cs +++ b/PROMS/Volian.Print.Library/CompleteRORpt.cs @@ -8,6 +8,7 @@ using iTextSharp.text.pdf; using iTextSharp.text; using VEPROMS.CSLA.Library; using Volian.Base.Library; +using VlnStatus; namespace Volian.Print.Library @@ -161,6 +162,7 @@ namespace Volian.Print.Library int idx = 0; Chunk chk; Phrase p = new Phrase(); + bool underlineChunk = false; instr = instr.Replace("`", "\u00B0"); //degree if (ConvertCaretToDelta) instr = instr.Replace("^", "\u0394"); // delta @@ -172,7 +174,30 @@ namespace Volian.Print.Library if (idx < m.Index) { int strlen = m.Index - idx; + int uidx = 0; + string strChk = instr.Substring(idx, strlen); + MatchCollection mc1 = Regex.Matches(strChk, "[_](.*?)"); // look ofr Underline on/off + foreach (Match m1 in mc1) + { + if (uidx < m1.Index) + { + string tstr = (instr.Substring(idx+uidx, m1.Index - uidx)); + if (tstr.EndsWith(" ")) + tstr = tstr.Substring(0, tstr.Length - 1) + "\xA0"; + chk = new Chunk(tstr, fnt); + if (underlineChunk) + chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); + chk.SetTextRise(0); + p.Add(chk); + uidx += (tstr.Length + 1); + idx += (tstr.Length + 1); + strlen -= (tstr.Length + 1); + underlineChunk = !underlineChunk; + } + } chk = new Chunk(instr.Substring(idx, strlen), fnt); + if (underlineChunk) + chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); chk.SetTextRise(0); p.Add(chk); } @@ -180,12 +205,16 @@ namespace Volian.Print.Library { case '#': chk = new Chunk(m.Value.Substring(1, m.Length-2), fnt); + if (underlineChunk) + chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); chk.SetTextRise(.25F * chk.Font.Size); p.Add(chk); idx = m.Index + m.Length; break; case '~': chk = new Chunk(m.Value.Substring(1, m.Length-2), fnt); + if (underlineChunk) + chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); chk.SetTextRise(-.25F * chk.Font.Size); p.Add(chk); idx = m.Index + m.Length; @@ -194,9 +223,36 @@ namespace Volian.Print.Library } if (idx < instr.Length - 1) { - chk = new Chunk(instr.Substring(idx), fnt); - chk.SetTextRise(0); - p.Add(chk); + int uidx = 0; + string strChk = (instr.Substring(idx)); + MatchCollection mc1 = Regex.Matches(strChk, "[_](.*?)"); // look for underline on/off + foreach (Match m1 in mc1) + { + if (uidx < m1.Index) + { + string tstr = (strChk.Substring(uidx, m1.Index - uidx)); + if (tstr.EndsWith(" ")) + tstr = tstr.Substring(0, tstr.Length - 1) + "\xA0"; + chk = new Chunk(tstr, fnt); + if (underlineChunk) + chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); + chk.SetTextRise(0); + p.Add(chk); + uidx += (tstr.Length+1); + underlineChunk = !underlineChunk; + } + } + if (uidx < strChk.Length - 1) + { + string tstr = strChk.Substring(uidx); + if (tstr.EndsWith(" ")) + tstr = tstr.Substring(0, tstr.Length - 1) + "\xA0"; + chk = new Chunk(tstr, fnt); + if (underlineChunk) + chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); + chk.SetTextRise(0); + p.Add(chk); + } } return p; @@ -212,6 +268,8 @@ namespace Volian.Print.Library { PdfPCell cell = new PdfPCell(ConvertDOSSuperAndSubScripts(str, fnt)); cell.BorderColor = Color.WHITE; + if (strlst.Length > 1) + cell.PaddingBottom = 6; datatable.AddCell(cell); } } @@ -298,10 +356,13 @@ namespace Volian.Print.Library bool StopPrinting = false; bool UserTerminate = false; Int16 iRecType = 0; + VlnStatusBar showStatBar = new VlnStatusBar("Complete RO Report"); try { if (RO_df.GetFileLength() > 0) { + showStatBar.BarMax = (int)RO_df.GetFileLength(); + showStatBar.StatMsg = "Creating Report"; // Loop until either printing is aborted or end of file. while (!StopPrinting && (iRecType = RO_df.ReadInteger16()) != -1) { @@ -352,6 +413,7 @@ namespace Volian.Print.Library _pdfReportDoc.Add(datatable); _pdfReportDoc.NewPage(); StartNewDataTable(); + showStatBar.BarValue = (int)RO_df.GetFilePointerPosition(); //Console.WriteLine("Record Type: {0} No Operation", iRecType); //Console.WriteLine("----------------------------------------------"); break; @@ -372,12 +434,15 @@ namespace Volian.Print.Library } //Console.WriteLine("Record Type: {0}\n** Done **", iRecType); _pdfReportDoc.Add(datatable); + showStatBar.Dispose(); + } catch (Exception e) { Console.WriteLine("Exception : {0}", e.Message); RO_df.close(); _pdfReportDoc.Add(datatable); + showStatBar.Dispose(); GenerateErrorMessage(e, "Error Processing Complete RO Report. ", null); } AddErrorBookmarks(); @@ -931,6 +996,10 @@ namespace Volian.Print.Library { return fs.Length; } + public long GetFilePointerPosition() + { + return fs.Position; + } // Read an integer value from the data file public Int16 ReadInteger16() {