Logic to call the function to create the RO Summary Report
Added functions to for use in generating the RO Summary Report Enabled the RO Summary Report and added logic to support the gathering of information for the report Added logic to generate the RO Summary Report
This commit is contained in:
parent
eec2b3cbae
commit
174bac97f7
@ -725,11 +725,17 @@ namespace VEPROMS
|
|||||||
Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, args.MyItemInfoList, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\ROUsageReport.pdf", args.SortUsageByProcedure);
|
Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, args.MyItemInfoList, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\ROUsageReport.pdf", args.SortUsageByProcedure);
|
||||||
myReport.Build();
|
myReport.Build();
|
||||||
}
|
}
|
||||||
else if (args.TypesSelected == "RO Report")
|
else if (args.TypesSelected == "Complete RO Report")
|
||||||
{
|
{
|
||||||
Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, args.RODataFile, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\ROCompleteReport.pdf", args.CompleteROReport);
|
Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, args.RODataFile, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\CompleteROReport.pdf", args.CompleteROReport);
|
||||||
myReport.Build();
|
myReport.Build();
|
||||||
}
|
}
|
||||||
|
else if (args.TypesSelected == "RO Summary Report")
|
||||||
|
{
|
||||||
|
Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\ROSummaryReport.pdf", args.RofstLookup, args.ROListForReport);
|
||||||
|
myReport.Build();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,10 +146,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private int TableID;
|
private int TableID;
|
||||||
private Dictionary<string, rochild> dicRos;
|
private Dictionary<string, rochild> dicRos;
|
||||||
private Dictionary<int, rochild> dicRosIntIDs;
|
private Dictionary<int, rochild> dicRosIntIDs;
|
||||||
|
private Dictionary<string, string> dicRoDBs;
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
dicRos = null;
|
dicRos = null;
|
||||||
dicRosIntIDs = null;
|
dicRosIntIDs = null;
|
||||||
|
dicRoDBs = null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region AppSupport
|
#region AppSupport
|
||||||
@ -160,6 +162,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
dicRosIntIDs = null;
|
dicRosIntIDs = null;
|
||||||
if (dicRos != null)dicRos.Clear();
|
if (dicRos != null)dicRos.Clear();
|
||||||
dicRos = null;
|
dicRos = null;
|
||||||
|
if (dicRoDBs != null) dicRoDBs.Clear();
|
||||||
|
dicRoDBs = null;
|
||||||
}
|
}
|
||||||
private Dictionary<string, string> _dicROAPIDLookup;
|
private Dictionary<string, string> _dicROAPIDLookup;
|
||||||
public string GetAccPageID(string roid)
|
public string GetAccPageID(string roid)
|
||||||
@ -349,9 +353,39 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
return ""; // no accessory page ID found
|
return ""; // no accessory page ID found
|
||||||
}
|
}
|
||||||
|
// Get the the RO's Description
|
||||||
|
public string GetRoDescription(string ROID16)
|
||||||
|
{
|
||||||
|
string ROID = ROID16.Substring(0,12);
|
||||||
|
if (dicRos == null) ParseIntoDictionary(_ROFst!=null?_ROFst.ROLookup:_ROFstInfo.ROLookup);
|
||||||
|
// Use the ROID to get the value from the dictionary
|
||||||
|
if (dicRos.ContainsKey(ROID.ToUpper()))
|
||||||
|
{
|
||||||
|
rochild rochld = (rochild)dicRos[ROID.ToUpper()];
|
||||||
|
if (rochld.value != null && rochld.value != string.Empty)
|
||||||
|
return rochld.title;
|
||||||
|
if (rochld.children != null)
|
||||||
|
{
|
||||||
|
foreach (rochild child in rochld.children)
|
||||||
|
if (child.roid.ToUpper() == ROID16 || (child.roid.EndsWith("0041") && ROID16.EndsWith("0000")))
|
||||||
|
return child.title;
|
||||||
|
// if there isn't a specific match for multi-return values, default to the first child.
|
||||||
|
return rochld.children[0].title;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""; // no Title/Description found
|
||||||
|
}
|
||||||
|
//public string GetRoValueAccIDAndDescription(string ROID16)
|
||||||
|
//{
|
||||||
|
// string rtnstr = GetRoValue(ROID16);
|
||||||
|
// rtnstr += " " + GetRoACID(ROID16);
|
||||||
|
// rtnstr += " " + GetRoDescription(ROID16);
|
||||||
|
// return rtnstr;
|
||||||
|
//}
|
||||||
|
|
||||||
public rochild GetRoChild12(string ROID16)
|
public rochild GetRoChild12(string ROID16)
|
||||||
{
|
{
|
||||||
string ROID = ROID16.Substring(0, 12);
|
string ROID = (ROID16.Length < 12)?ROID16 : ROID16.Substring(0, 12);
|
||||||
if (dicRos == null) ParseIntoDictionary(_ROFst != null ? _ROFst.ROLookup : _ROFstInfo.ROLookup);
|
if (dicRos == null) ParseIntoDictionary(_ROFst != null ? _ROFst.ROLookup : _ROFstInfo.ROLookup);
|
||||||
// Use the ROID to get the value from the dictionary
|
// Use the ROID to get the value from the dictionary
|
||||||
if (dicRos.ContainsKey(ROID.ToUpper()))
|
if (dicRos.ContainsKey(ROID.ToUpper()))
|
||||||
@ -361,6 +395,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
rochild tmp = new rochild();
|
rochild tmp = new rochild();
|
||||||
tmp.ID = -1;
|
tmp.ID = -1;
|
||||||
|
if (ROID16.Length == 4)
|
||||||
|
tmp.title = dicRoDBs[ROID16];
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
public rochild GetRoChild(string ROID)
|
public rochild GetRoChild(string ROID)
|
||||||
@ -440,8 +476,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
List<string> titlePath = new List<string>();
|
List<string> titlePath = new List<string>();
|
||||||
rochild roc = GetRoChild12(ROID);
|
rochild roc = GetRoChild12(ROID);
|
||||||
//string tmp = roc.title.Replace(roc.appid, "").Replace(roc.value, "").Trim();
|
string tmp = roc.title;
|
||||||
string tmp = roc.title.Replace(roc.appid, string.Format("<{0}>",roc.appid)).Trim();
|
if (roc.appid != "")
|
||||||
|
if (roc.title.Contains(roc.appid))
|
||||||
|
tmp = roc.title.Replace(roc.appid, string.Format("<{0}>", roc.appid)).Trim();
|
||||||
|
else
|
||||||
|
tmp = string.Format("[{0}] {1}", roc.appid, roc.title);
|
||||||
titlePath.Add(tmp);
|
titlePath.Add(tmp);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -453,7 +493,26 @@ namespace VEPROMS.CSLA.Library
|
|||||||
titlePath.Reverse();
|
titlePath.Reverse();
|
||||||
return titlePath;
|
return titlePath;
|
||||||
}
|
}
|
||||||
|
public List<string> GetROTitleAndGroupPathForSummary(string ROID)
|
||||||
|
{
|
||||||
|
List<string> titlePath = new List<string>();
|
||||||
|
rochild roc = GetRoChild(ROID);
|
||||||
|
string tmp = roc.title.Replace(roc.appid, string.Format("<{0}>",roc.appid)).Trim();
|
||||||
|
titlePath.Add(tmp);
|
||||||
|
do
|
||||||
|
{
|
||||||
|
string parent = ROID.Substring(0, 4) + string.Format("{0:X8}", roc.ParentID);
|
||||||
|
roc = GetRoChild(parent);
|
||||||
|
if (roc.ID > 0)
|
||||||
|
titlePath.Add(roc.title);
|
||||||
|
} while (roc.ID > 0);
|
||||||
|
titlePath.Reverse();
|
||||||
|
return titlePath;
|
||||||
|
}
|
||||||
|
public DateTime GetRoFSTdts()
|
||||||
|
{
|
||||||
|
return MyDocVersionInfo.DocVersionAssociations[0].MyROFst.DTS;
|
||||||
|
}
|
||||||
// The following Method is not correct. It needs to have a RO database id as well as an id. Without that,
|
// The following Method is not correct. It needs to have a RO database id as well as an id. Without that,
|
||||||
// the first RO with a specific id will be found regardless of the RO Database id.
|
// the first RO with a specific id will be found regardless of the RO Database id.
|
||||||
//public rochild GetRoChildFromID(int id)
|
//public rochild GetRoChildFromID(int id)
|
||||||
@ -473,6 +532,42 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
return myHdr.myDbs;
|
return myHdr.myDbs;
|
||||||
}
|
}
|
||||||
|
public int GetRODatabaseTitleIndex(string roid)
|
||||||
|
{
|
||||||
|
rochild roc = GetRoChild12(roid);
|
||||||
|
int parentID = roc.ParentID;
|
||||||
|
return Convert.ToInt32("0x"+roid.Substring(0, 4),16);
|
||||||
|
}
|
||||||
|
public string GetRODatabaseTitle(string roid)
|
||||||
|
{
|
||||||
|
return GetRODatabaseTitle(GetRODatabaseTitleIndex(roid));
|
||||||
|
}
|
||||||
|
public string GetRODatabaseTitle(int idx)
|
||||||
|
{
|
||||||
|
string dbtitle ="RO Database Title Not Found";
|
||||||
|
for (int i = 0; i < myHdr.myDbs.Length; i++)
|
||||||
|
if (myHdr.myDbs[i].dbiID == idx)
|
||||||
|
{
|
||||||
|
dbtitle = myHdr.myDbs[i].dbiTitle;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return dbtitle;
|
||||||
|
}
|
||||||
|
public rodbi GetRODatabase(int idx)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < myHdr.myDbs.Length; i++)
|
||||||
|
if (myHdr.myDbs[i].dbiID == idx)
|
||||||
|
return myHdr.myDbs[i];
|
||||||
|
return myHdr.myDbs[0];
|
||||||
|
}
|
||||||
|
public rodbi GetRODatabase(string roid)
|
||||||
|
{
|
||||||
|
int idx = Convert.ToInt32("0x" + roid.Substring(0, 4), 16);
|
||||||
|
for (int i = 0; i < myHdr.myDbs.Length; i++)
|
||||||
|
if (myHdr.myDbs[i].dbiID == idx)
|
||||||
|
return myHdr.myDbs[i];
|
||||||
|
return myHdr.myDbs[0];
|
||||||
|
}
|
||||||
//public string GetDefaultROPrefix()
|
//public string GetDefaultROPrefix()
|
||||||
//{
|
//{
|
||||||
// if (docVer != null)
|
// if (docVer != null)
|
||||||
@ -745,6 +840,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
if (dicRos == null) dicRos = new Dictionary<string, rochild>();
|
if (dicRos == null) dicRos = new Dictionary<string, rochild>();
|
||||||
if (dicRosIntIDs == null) dicRosIntIDs = new Dictionary<int, rochild>();
|
if (dicRosIntIDs == null) dicRosIntIDs = new Dictionary<int, rochild>();
|
||||||
|
if (dicRoDBs == null) dicRoDBs = new Dictionary<string, string>();
|
||||||
|
|
||||||
myHdr.hSize = BitConverter.ToInt32(ab, 0);
|
myHdr.hSize = BitConverter.ToInt32(ab, 0);
|
||||||
myHdr.hYear = BitConverter.ToInt16(ab, 4);
|
myHdr.hYear = BitConverter.ToInt16(ab, 4);
|
||||||
@ -775,6 +871,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
myHdr.myDbs[i].dbiTitle = Encoding.Default.GetString(ab, iPtr, StringLength(ab, iPtr));
|
myHdr.myDbs[i].dbiTitle = Encoding.Default.GetString(ab, iPtr, StringLength(ab, iPtr));
|
||||||
iPtr = BitConverter.ToInt32(ab, offset + 26) + hdrOffset + 6;
|
iPtr = BitConverter.ToInt32(ab, offset + 26) + hdrOffset + 6;
|
||||||
myHdr.myDbs[i].dbiAP = Encoding.Default.GetString(ab, iPtr, StringLength(ab, iPtr));
|
myHdr.myDbs[i].dbiAP = Encoding.Default.GetString(ab, iPtr, StringLength(ab, iPtr));
|
||||||
|
dicRoDBs.Add(string.Format("{0:X4}",TableID), myHdr.myDbs[i].dbiTitle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -26,7 +26,6 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
private List<DocVersionInfo> lstCheckedDocVersions = new List<DocVersionInfo>();
|
private List<DocVersionInfo> lstCheckedDocVersions = new List<DocVersionInfo>();
|
||||||
//private List<ROFSTLookup> lstCheckedROs = new List<ROFSTLookup>();
|
|
||||||
private List<object> lstCheckedROs = new List<object>();
|
private List<object> lstCheckedROs = new List<object>();
|
||||||
private List<ItemInfoList> lstReportResults = new List<ItemInfoList>();
|
private List<ItemInfoList> lstReportResults = new List<ItemInfoList>();
|
||||||
private List<string> ROList = new List<string>();
|
private List<string> ROList = new List<string>();
|
||||||
@ -95,9 +94,6 @@ namespace Volian.Controls.Library
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_ReportResult = value;
|
_ReportResult = value;
|
||||||
//if (value != null) // Don't select an item from the list when it is updated
|
|
||||||
// _ReportResult.ListChanged += new ListChangedEventHandler(_SearchResults_ListChanged);
|
|
||||||
//DisplayResults();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,14 +107,12 @@ namespace Volian.Controls.Library
|
|||||||
foreach (object rolkup in lstCheckedROs)
|
foreach (object rolkup in lstCheckedROs)
|
||||||
{
|
{
|
||||||
if (rolkup is ROFSTLookup.rodbi)
|
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("D4"));
|
|
||||||
}
|
|
||||||
else if (rolkup is ROFSTLookup.rochild)
|
else if (rolkup is ROFSTLookup.rochild)
|
||||||
{
|
{
|
||||||
ch = (ROFSTLookup.rochild)rolkup;
|
ch = (ROFSTLookup.rochild)rolkup;
|
||||||
chld = ch.children;
|
chld = ch.children;
|
||||||
rtnStr = _MyRODbID.ToString() + ":" + GetROChildren(rolkup);
|
rtnStr = _MyRODbID.ToString() + ":" + GetROChildren(rolkup).TrimEnd(',');
|
||||||
}
|
}
|
||||||
//else if (rolkup is ROFSTLookup.rogrp)
|
//else if (rolkup is ROFSTLookup.rogrp)
|
||||||
// Console.WriteLine("RO Group");
|
// Console.WriteLine("RO Group");
|
||||||
@ -135,16 +129,20 @@ namespace Volian.Controls.Library
|
|||||||
string rtnstr = "";
|
string rtnstr = "";
|
||||||
if (chld.children == null) // get a single ROID
|
if (chld.children == null) // get a single ROID
|
||||||
{
|
{
|
||||||
//ROFSTLookup.rochild ro = (ROFSTLookup.rochild)roObj;
|
|
||||||
rtnstr += string.Format("{0}", chld.roid);
|
rtnstr += string.Format("{0}", chld.roid);
|
||||||
if (rtnstr.Length == 12) rtnstr += "0000"; // last four digits are used for multiple return values
|
if (rtnstr.Length == 12) rtnstr += "0000"; // last four digits are used for multiple return values
|
||||||
}
|
}
|
||||||
|
else if (!cbxROUsage.Checked && chld.children[0].ParentID == 0)
|
||||||
|
{
|
||||||
|
rtnstr += string.Format("{0},", chld.roid); // doing a RO Summary or RO Complete report - don't want children that are multiple return values
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ // spin through the child list and get the ROIDs.
|
{ // spin through the child list and get the ROIDs.
|
||||||
// if the child has children, then call this function recursivly
|
// if the child has children, then call this function recursivly
|
||||||
foreach (ROFSTLookup.rochild roc in chld.children)
|
foreach (ROFSTLookup.rochild roc in chld.children)
|
||||||
{
|
{
|
||||||
if (roc.children != null)
|
// 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))
|
||||||
rtnstr += GetROChildren(roc);
|
rtnstr += GetROChildren(roc);
|
||||||
else
|
else
|
||||||
rtnstr += string.Format("{0},", roc.roid);
|
rtnstr += string.Format("{0},", roc.roid);
|
||||||
@ -152,7 +150,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
return rtnstr;
|
return rtnstr;
|
||||||
}
|
}
|
||||||
private string GetListOfROs(bool keepREDbID)
|
private string GetListOfROs(bool keepRODbID)
|
||||||
{
|
{
|
||||||
string rtnStr = "";
|
string rtnStr = "";
|
||||||
string strRODbID = "";
|
string strRODbID = "";
|
||||||
@ -163,7 +161,7 @@ namespace Volian.Controls.Library
|
|||||||
if (ndxOf > 0)
|
if (ndxOf > 0)
|
||||||
{
|
{
|
||||||
string tstr = rostr.Substring(0, ndxOf + 1);
|
string tstr = rostr.Substring(0, ndxOf + 1);
|
||||||
if (tstr != strRODbID && keepREDbID)
|
if (tstr != strRODbID && keepRODbID)
|
||||||
{
|
{
|
||||||
strRODbID = tstr;
|
strRODbID = tstr;
|
||||||
rtnStr += rostr;
|
rtnStr += rostr;
|
||||||
@ -186,7 +184,7 @@ namespace Volian.Controls.Library
|
|||||||
cmbxROUsageSort.SelectedIndex = 0;
|
cmbxROUsageSort.SelectedIndex = 0;
|
||||||
tabTransitionReports.Visible = false;
|
tabTransitionReports.Visible = false;
|
||||||
cbxComplete.Enabled = false;
|
cbxComplete.Enabled = false;
|
||||||
cbxSummary.Enabled = false;
|
cbxSummary.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SelectReferencedObjectTab()
|
public void SelectReferencedObjectTab()
|
||||||
@ -234,6 +232,9 @@ namespace Volian.Controls.Library
|
|||||||
xpSetToReport.Enabled = cbxROUsage.Checked;
|
xpSetToReport.Enabled = cbxROUsage.Checked;
|
||||||
xpSetToReport.Expanded = cbxROUsage.Checked;
|
xpSetToReport.Expanded = cbxROUsage.Checked;
|
||||||
cmbxROUsageSort.Enabled = cbxROUsage.Checked;
|
cmbxROUsageSort.Enabled = cbxROUsage.Checked;
|
||||||
|
// reset the RO tree and clear anything that was selected
|
||||||
|
advTreeROFillIn(true);
|
||||||
|
lstCheckedROs.Clear();
|
||||||
EnableOrDisablePrintButton();
|
EnableOrDisablePrintButton();
|
||||||
}
|
}
|
||||||
#region Procedure List
|
#region Procedure List
|
||||||
@ -602,7 +603,7 @@ namespace Volian.Controls.Library
|
|||||||
// TODO: KBR how to handle this?
|
// TODO: KBR how to handle this?
|
||||||
//Console.WriteLine("ro junk");
|
//Console.WriteLine("ro junk");
|
||||||
continue;
|
continue;
|
||||||
else if (chld[i].value == null)
|
else if (chld[i].value == null && (cbxROUsage.Checked || chld[i].children[0].ParentID != 0))
|
||||||
{
|
{
|
||||||
tmp = new DevComponents.AdvTree.Node();
|
tmp = new DevComponents.AdvTree.Node();
|
||||||
tmp.Text = chld[i].title;
|
tmp.Text = chld[i].title;
|
||||||
@ -785,16 +786,15 @@ namespace Volian.Controls.Library
|
|||||||
Cursor = Cursors.WaitCursor;
|
Cursor = Cursors.WaitCursor;
|
||||||
if (cbxSummary.Checked) // RO Summary Report
|
if (cbxSummary.Checked) // RO Summary Report
|
||||||
{
|
{
|
||||||
//GenerateROList();
|
GenerateROList();
|
||||||
//ROFSTLookup rofstLookup = Mydocversion.DocVersionAssociations[0].MyROFst.ROFSTLookup;
|
OnPrintRequest(new DisplayReportsEventArgs("RO Summary Report", "RO Summary Report", MyROFSTLookup, ROList));
|
||||||
//OnPrintRequest(new DisplayReportsEventArgs("RO Summary Report", "RO Report", rofstLookup, ROList));
|
|
||||||
}
|
}
|
||||||
else if (cbxComplete.Checked) // Complete RO Report
|
else if (cbxComplete.Checked) // Complete RO Report
|
||||||
{
|
{
|
||||||
GenerateROList();
|
GenerateROList();
|
||||||
string ROList = GetListOfROs(false);//don't include the RODbID in the RO list
|
string ROList = GetListOfROs(false);//don't include the RODbID in the RO list
|
||||||
string roDataFile = BuildRODataFile(ROList);
|
string roDataFile = BuildRODataFile(ROList);
|
||||||
OnPrintRequest(new DisplayReportsEventArgs("RO Complete Report", "RO Report", roDataFile, cbxComplete.Checked));
|
OnPrintRequest(new DisplayReportsEventArgs("Complete RO Report", "Complete RO Report", roDataFile, cbxComplete.Checked));
|
||||||
}
|
}
|
||||||
else if (cbxROUsage.Checked)
|
else if (cbxROUsage.Checked)
|
||||||
{
|
{
|
||||||
@ -866,13 +866,19 @@ namespace Volian.Controls.Library
|
|||||||
get { return _rofstLookup; }
|
get { return _rofstLookup; }
|
||||||
set { _rofstLookup = value; }
|
set { _rofstLookup = value; }
|
||||||
}
|
}
|
||||||
|
private List<string> _ROListForReport;
|
||||||
|
|
||||||
|
public List<string> ROListForReport
|
||||||
|
{
|
||||||
|
get { return _ROListForReport; }
|
||||||
|
set { _ROListForReport = value; }
|
||||||
|
}
|
||||||
public DisplayReportsEventArgs(string reportTitle, string typesSelected, ICollection<ItemInfo> myItemInfoList,/*ROFSTLookup rolkup,*/ bool sortByProcedure)
|
public DisplayReportsEventArgs(string reportTitle, string typesSelected, ICollection<ItemInfo> myItemInfoList,/*ROFSTLookup rolkup,*/ bool sortByProcedure)
|
||||||
{
|
{
|
||||||
_ReportTitle = reportTitle;
|
_ReportTitle = reportTitle;
|
||||||
_TypesSelected = typesSelected;
|
_TypesSelected = typesSelected;
|
||||||
_MyItemInfoList = myItemInfoList;
|
_MyItemInfoList = myItemInfoList;
|
||||||
_SortUsageByProcedure = sortByProcedure;
|
_SortUsageByProcedure = sortByProcedure;
|
||||||
//_rofstLookup = rolkup;
|
|
||||||
}
|
}
|
||||||
public DisplayReportsEventArgs(string reportTitle, string typesSelected, string roDataFile, bool completeROReport)
|
public DisplayReportsEventArgs(string reportTitle, string typesSelected, string roDataFile, bool completeROReport)
|
||||||
{
|
{
|
||||||
@ -881,6 +887,13 @@ namespace Volian.Controls.Library
|
|||||||
_RODataFile = roDataFile;
|
_RODataFile = roDataFile;
|
||||||
_CompleteROReport = completeROReport;
|
_CompleteROReport = completeROReport;
|
||||||
}
|
}
|
||||||
|
public DisplayReportsEventArgs(string reportTitle, string typesSelected, ROFSTLookup rofstLookUp, List<string> roListForReport)
|
||||||
|
{
|
||||||
|
_ReportTitle = reportTitle;
|
||||||
|
_TypesSelected = typesSelected;
|
||||||
|
_rofstLookup = rofstLookUp;
|
||||||
|
_ROListForReport = roListForReport;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public delegate void DisplayReportsEvent(object sender, DisplayReportsEventArgs args);
|
public delegate void DisplayReportsEvent(object sender, DisplayReportsEventArgs args);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ namespace Volian.Print.Library
|
|||||||
ReferencedObjectsUsage = 2,
|
ReferencedObjectsUsage = 2,
|
||||||
TransitionUsage = 3,
|
TransitionUsage = 3,
|
||||||
ReferencedObjectSummary = 4,
|
ReferencedObjectSummary = 4,
|
||||||
ReferencedObjectComplete =5
|
ReferencedObjectComplete = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICollection<ItemInfo> _ResultList;
|
private ICollection<ItemInfo> _ResultList;
|
||||||
@ -70,6 +70,8 @@ namespace Volian.Print.Library
|
|||||||
private string _ByLine;
|
private string _ByLine;
|
||||||
private bool _SortUsageByProcedure = false;
|
private bool _SortUsageByProcedure = false;
|
||||||
private string _RODataFile = "";
|
private string _RODataFile = "";
|
||||||
|
private List<string> _ROList;
|
||||||
|
private ROFSTLookup _ROFSTLookup;
|
||||||
|
|
||||||
// Search Results Report
|
// Search Results Report
|
||||||
public PDFReport(string reportTitle, string typesSelected, ICollection<ItemInfo> resultList, string fileName)
|
public PDFReport(string reportTitle, string typesSelected, ICollection<ItemInfo> resultList, string fileName)
|
||||||
@ -82,7 +84,7 @@ namespace Volian.Print.Library
|
|||||||
_ByLine = "PROMS Search Results";
|
_ByLine = "PROMS Search Results";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Library Document Report
|
// Library Document Report
|
||||||
public PDFReport(string reportTitle, DocumentInfoList libDocList, string fileName)
|
public PDFReport(string reportTitle, DocumentInfoList libDocList, string fileName)
|
||||||
{
|
{
|
||||||
@ -104,16 +106,27 @@ namespace Volian.Print.Library
|
|||||||
_SortUsageByProcedure = sortUsageByProcedure;
|
_SortUsageByProcedure = sortUsageByProcedure;
|
||||||
}
|
}
|
||||||
|
|
||||||
// RO Coomplete and Summary Reports
|
// RO Complete Report
|
||||||
public PDFReport(string reportTitle, string roDataFile, string outfile, bool completeReport)
|
public PDFReport(string reportTitle, string roDataFile, string outfile, bool completeReport)
|
||||||
{
|
{
|
||||||
_FileName = outfile;
|
_FileName = outfile;
|
||||||
_ReportTitle = reportTitle;
|
_ReportTitle = reportTitle;
|
||||||
_ReportType = (completeReport) ? (int)ReportType.ReferencedObjectComplete : (int)ReportType.ReferencedObjectSummary;
|
_ReportType = (int)ReportType.ReferencedObjectComplete;
|
||||||
_ByLine = (completeReport) ? "Complete RO Report" : "Summary RO Report";
|
_ByLine = "Complete RO Report";
|
||||||
_RODataFile = roDataFile;
|
_RODataFile = roDataFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RO Summary Report
|
||||||
|
public PDFReport(string reportTitle, string outfile, ROFSTLookup fstlookup, List<string> roList)
|
||||||
|
{
|
||||||
|
_FileName = outfile;
|
||||||
|
_ReportTitle = reportTitle;
|
||||||
|
_ReportType = (int)ReportType.ReferencedObjectSummary;
|
||||||
|
_ByLine = "RO Summary Report";
|
||||||
|
_ROFSTLookup = fstlookup;
|
||||||
|
_ROList = roList;
|
||||||
|
}
|
||||||
|
|
||||||
//public void Build2()
|
//public void Build2()
|
||||||
//{
|
//{
|
||||||
// iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER, 36, 36, 36, 36);
|
// iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER, 36, 36, 36, 36);
|
||||||
@ -343,11 +356,12 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
lastPath = p;
|
lastPath = p;
|
||||||
if (ProcSetList.Count == 1)
|
if (ProcSetList.Count == 1)
|
||||||
level = NewPath.Length-1;
|
level = NewPath.Length - 1;
|
||||||
}
|
}
|
||||||
//if (level > 0) level--;
|
//if (level > 0) level--;
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddMainPathGroup(PdfPTable datatable, string dvPath, int splitLevel, Font f2, Color bgColor, int colSpan)
|
public void AddMainPathGroup(PdfPTable datatable, string dvPath, int splitLevel, Font f2, Color bgColor, int colSpan)
|
||||||
{
|
{
|
||||||
int level = 0;
|
int level = 0;
|
||||||
@ -418,6 +432,9 @@ namespace Volian.Print.Library
|
|||||||
case (int)ReportType.ReferencedObjectComplete:
|
case (int)ReportType.ReferencedObjectComplete:
|
||||||
BuildCompleteROReport(document);
|
BuildCompleteROReport(document);
|
||||||
break;
|
break;
|
||||||
|
case (int)ReportType.ReferencedObjectSummary:
|
||||||
|
BuildROSummaryReport(document);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -468,7 +485,7 @@ namespace Volian.Print.Library
|
|||||||
catch (System.IO.IOException exIO)
|
catch (System.IO.IOException exIO)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (exIO.Message.Contains("because it is being used by another process"))
|
if (exIO.Message.Contains("because it is being used by another process"))
|
||||||
suffix = string.Format("_{0}", ++i);// If this file is in use, increment the suffix and try again
|
suffix = string.Format("_{0}", ++i);// If this file is in use, increment the suffix and try again
|
||||||
else // If some other error, display a message and don't print the results
|
else // If some other error, display a message and don't print the results
|
||||||
{
|
{
|
||||||
@ -524,14 +541,14 @@ namespace Volian.Print.Library
|
|||||||
//cell.Colspan = 2;
|
//cell.Colspan = 2;
|
||||||
cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0);
|
cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0);
|
||||||
datatable.AddCell(cell);
|
datatable.AddCell(cell);
|
||||||
cell = new PdfPCell(new Phrase(TypesSelected,f3));
|
cell = new PdfPCell(new Phrase(TypesSelected, f3));
|
||||||
cell.HorizontalAlignment = Element.ALIGN_LEFT;
|
cell.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||||
//cell.Colspan = 2;
|
//cell.Colspan = 2;
|
||||||
cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0);
|
cell.BackgroundColor = new Color(0xD0, 0xF0, 0xF0);
|
||||||
datatable.AddCell(cell);
|
datatable.AddCell(cell);
|
||||||
|
|
||||||
BuildSearchResultsProcSetList();
|
BuildSearchResultsProcSetList();
|
||||||
datatable.HeaderRows = 3 + (ProcSetList.Count ==1 ? 1 : 0);
|
datatable.HeaderRows = 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
|
int splitAt = FindSpitLevel(); // find the split level of the common path - for all procedure sets that use these library documents
|
||||||
//AddMainPathGroup(datatable, ProcSetList[0].ToString(), splitAt, f2, Color.LIGHT_GRAY, 0);
|
//AddMainPathGroup(datatable, ProcSetList[0].ToString(), splitAt, f2, Color.LIGHT_GRAY, 0);
|
||||||
|
|
||||||
@ -589,9 +606,9 @@ namespace Volian.Print.Library
|
|||||||
//if (item.DisplayText.Contains("|")) // Need a better way to determine if it is a table.
|
//if (item.DisplayText.Contains("|")) // Need a better way to determine if it is a table.
|
||||||
// AddCell(datatable, item.DisplayText, f3, TextColor);
|
// AddCell(datatable, item.DisplayText, f3, TextColor);
|
||||||
//else
|
//else
|
||||||
//AddCell(datatable, item.DisplayText, f2, (item.IsSection ? SectColor : TextColor));
|
//AddCell(datatable, item.DisplayText, f2, (item.IsSection ? SectColor : TextColor));
|
||||||
AddCell(subTable, item.DisplayText, f2, (item.IsSection ? SectColor : TextColor));
|
AddCell(subTable, item.DisplayText, f2, (item.IsSection ? SectColor : TextColor));
|
||||||
if (item.ItemAnnotationCount > 0)
|
if (item.ItemAnnotationCount > 0)
|
||||||
{
|
{
|
||||||
foreach (AnnotationInfo ai in item.ItemAnnotations)
|
foreach (AnnotationInfo ai in item.ItemAnnotations)
|
||||||
{
|
{
|
||||||
@ -658,9 +675,9 @@ namespace Volian.Print.Library
|
|||||||
if (_RegexSearchString.StartsWith(".*?"))
|
if (_RegexSearchString.StartsWith(".*?"))
|
||||||
_RegexSearchString = "^" + _RegexSearchString;
|
_RegexSearchString = "^" + _RegexSearchString;
|
||||||
// If search string ends with a wildcard use the end of line token ($)
|
// If search string ends with a wildcard use the end of line token ($)
|
||||||
if(_RegexSearchString.EndsWith(".*?"))
|
if (_RegexSearchString.EndsWith(".*?"))
|
||||||
_RegexSearchString = _RegexSearchString+"$";
|
_RegexSearchString = _RegexSearchString + "$";
|
||||||
_RegexSearchString = _RegexSearchString.Replace("[", @"\[");
|
_RegexSearchString = _RegexSearchString.Replace("[", @"\[");
|
||||||
_RegexSearchString = _RegexSearchString.Replace("]", @"\]");
|
_RegexSearchString = _RegexSearchString.Replace("]", @"\]");
|
||||||
}
|
}
|
||||||
return _RegexSearchString;
|
return _RegexSearchString;
|
||||||
@ -774,7 +791,7 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
document.Add(datatable);
|
document.Add(datatable);
|
||||||
}
|
}
|
||||||
private void AddROUsages(ItemInfo item, Dictionary<string,List<ItemInfo>> roUse)
|
private void AddROUsages(ItemInfo item, Dictionary<string, List<ItemInfo>> roUse)
|
||||||
{
|
{
|
||||||
//string lastROid = "";
|
//string lastROid = "";
|
||||||
if (item.FoundROID != null && item.FoundROID != "")
|
if (item.FoundROID != null && item.FoundROID != "")
|
||||||
@ -826,7 +843,7 @@ namespace Volian.Print.Library
|
|||||||
stepnum = itm.MyActiveSection.DisplayNumber;
|
stepnum = itm.MyActiveSection.DisplayNumber;
|
||||||
else
|
else
|
||||||
stepnum = BuildStepTab(itm);//GetStepNumberFromSearchPath(itm.SearchPath);//stepnum.Substring(itm.SearchPath.LastIndexOf(sectitle) + sectitle.Length +1);
|
stepnum = BuildStepTab(itm);//GetStepNumberFromSearchPath(itm.SearchPath);//stepnum.Substring(itm.SearchPath.LastIndexOf(sectitle) + sectitle.Length +1);
|
||||||
// stepnum = stepnum.Substring(stepnum.LastIndexOf("\a") + 1);
|
// stepnum = stepnum.Substring(stepnum.LastIndexOf("\a") + 1);
|
||||||
//AddCell(curTable, stepnum, f2, Color.WHITE);
|
//AddCell(curTable, stepnum, f2, Color.WHITE);
|
||||||
//AddCell(curTable, itm.DisplayText, f2, Color.WHITE);
|
//AddCell(curTable, itm.DisplayText, f2, Color.WHITE);
|
||||||
AddCell(rotable, stepnum, f2, Color.WHITE);
|
AddCell(rotable, stepnum, f2, Color.WHITE);
|
||||||
@ -868,7 +885,7 @@ namespace Volian.Print.Library
|
|||||||
string stpdelms = item.ActiveFormat.PlantFormat.FormatData.TransData.StepSubstepDelimeter;
|
string stpdelms = item.ActiveFormat.PlantFormat.FormatData.TransData.StepSubstepDelimeter;
|
||||||
foreach (char c in stpdelms)
|
foreach (char c in stpdelms)
|
||||||
{
|
{
|
||||||
if (!DelimList.Contains(c.ToString()))
|
if (!DelimList.Contains(c.ToString()))
|
||||||
DelimList.Add(c.ToString());
|
DelimList.Add(c.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -910,7 +927,7 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
// add the Caution or Note count to the tab (ex "Caution 1", "Note 2")
|
// add the Caution or Note count to the tab (ex "Caution 1", "Note 2")
|
||||||
if (thisTab == "")
|
if (thisTab == "")
|
||||||
sret = "{" + typeName + " " + pitem.Ordinal.ToString() + "}";
|
sret = "{" + typeName + " " + pitem.Ordinal.ToString() + "}";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
thisTab = thisTab.Trim(" ".ToCharArray());
|
thisTab = thisTab.Trim(" ".ToCharArray());
|
||||||
@ -938,16 +955,16 @@ namespace Volian.Print.Library
|
|||||||
if (pitem.IsHigh)
|
if (pitem.IsHigh)
|
||||||
{
|
{
|
||||||
StepInfo stpinfo = StepInfo.Get(pitem.ItemID);
|
StepInfo stpinfo = StepInfo.Get(pitem.ItemID);
|
||||||
|
|
||||||
string hlsTab = stpinfo.MyTab.CleanTextNoSymbols; //StepInfo.Get(pitem.ItemID).MyTab.CleanTextNoSymbols;
|
string hlsTab = stpinfo.MyTab.CleanTextNoSymbols; //StepInfo.Get(pitem.ItemID).MyTab.CleanTextNoSymbols;
|
||||||
//string thisTab = stpinfo.MyTab.CleanText; //StepInfo.Get(pitem.ItemID).MyTab.CleanText;
|
//string thisTab = stpinfo.MyTab.CleanText; //StepInfo.Get(pitem.ItemID).MyTab.CleanText;
|
||||||
string typeName = stpinfo.FormatStepData.StepEditData.TypeMenu.MenuItem;//stpinfo.FormatStepData.GetPDDisplayName(); //.ToString();
|
string typeName = stpinfo.FormatStepData.StepEditData.TypeMenu.MenuItem;//stpinfo.FormatStepData.GetPDDisplayName(); //.ToString();
|
||||||
if (hlsTab == null || hlsTab == "")
|
if (hlsTab == null || hlsTab == "")
|
||||||
hlsTab = "{" + typeName + " "+ pitem.Ordinal.ToString()+"}.";
|
hlsTab = "{" + typeName + " " + pitem.Ordinal.ToString() + "}.";
|
||||||
else if (!sret.StartsWith(hlsTab.Trim(" ".ToCharArray())))
|
else if (!sret.StartsWith(hlsTab.Trim(" ".ToCharArray())))
|
||||||
{
|
{
|
||||||
//if (!hasDelim)
|
//if (!hasDelim)
|
||||||
foreach (string rmvDelim in DelimList) hlsTab = hlsTab.Replace(rmvDelim, "");
|
foreach (string rmvDelim in DelimList) hlsTab = hlsTab.Replace(rmvDelim, "");
|
||||||
hlsTab = hlsTab.Trim(" ".ToCharArray());
|
hlsTab = hlsTab.Trim(" ".ToCharArray());
|
||||||
//if (hasDelim && !hlsTab.EndsWith(".") && !hlsTab.EndsWith(")")) hlsTab = hlsTab + ".";
|
//if (hasDelim && !hlsTab.EndsWith(".") && !hlsTab.EndsWith(")")) hlsTab = hlsTab + ".";
|
||||||
if (!hlsTab.EndsWith(".") && !hlsTab.EndsWith(")")) hlsTab = hlsTab + ".";
|
if (!hlsTab.EndsWith(".") && !hlsTab.EndsWith(")")) hlsTab = hlsTab + ".";
|
||||||
@ -1124,10 +1141,11 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetROTitleAndGroup(string roid, ItemInfo itm)
|
//private static string GetROTitleAndGroup(string roid, ItemInfo itm)
|
||||||
|
private string GetROTitleAndGroup(string roid, ItemInfo itm)
|
||||||
{
|
{
|
||||||
string rotitle = "";
|
string rotitle = "";
|
||||||
ROFSTLookup myrofstlookup = itm.MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(itm.MyDocVersion);
|
ROFSTLookup myrofstlookup = (itm == null)? _ROFSTLookup : itm.MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(itm.MyDocVersion);
|
||||||
List<string> roTitleList = myrofstlookup.GetROTitleAndGroupPath(roid);
|
List<string> roTitleList = myrofstlookup.GetROTitleAndGroupPath(roid);
|
||||||
for (int cnt = 0; cnt < roTitleList.Count; cnt++)
|
for (int cnt = 0; cnt < roTitleList.Count; cnt++)
|
||||||
{
|
{
|
||||||
@ -1152,6 +1170,7 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void BuildROUsageTableByRO(iTextSharp.text.Document document)
|
private void BuildROUsageTableByRO(iTextSharp.text.Document document)
|
||||||
{
|
{
|
||||||
SortedDictionary<string, List<ItemInfo>> procRoUse = new SortedDictionary<string, List<ItemInfo>>();
|
SortedDictionary<string, List<ItemInfo>> procRoUse = new SortedDictionary<string, List<ItemInfo>>();
|
||||||
@ -1200,9 +1219,9 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
lastDVPath = item.SearchDVPath;
|
lastDVPath = item.SearchDVPath;
|
||||||
|
|
||||||
// Chec for different ROID
|
// Check for different ROID
|
||||||
string curROID = item.FoundROID;
|
string curROID = item.FoundROID;
|
||||||
if (lastROID == "" || curROID.Substring(0,12) != lastROID.Substring(0,12))
|
if (lastROID == "" || curROID.Substring(0, 12) != lastROID.Substring(0, 12))
|
||||||
{
|
{
|
||||||
if (lastROID != "" && procRoUse.Count > 0)
|
if (lastROID != "" && procRoUse.Count > 0)
|
||||||
{
|
{
|
||||||
@ -1233,7 +1252,7 @@ namespace Volian.Print.Library
|
|||||||
ProcSetList = new System.Collections.ArrayList();
|
ProcSetList = new System.Collections.ArrayList();
|
||||||
foreach (DocumentInfo di in _LibDocList)
|
foreach (DocumentInfo di in _LibDocList)
|
||||||
{
|
{
|
||||||
if (di.LibraryDocumentUsageList!= null && di.LibraryDocumentUsageList.Count > 0)
|
if (di.LibraryDocumentUsageList != null && di.LibraryDocumentUsageList.Count > 0)
|
||||||
foreach (ItemInfo item in di.LibraryDocumentUsageList)
|
foreach (ItemInfo item in di.LibraryDocumentUsageList)
|
||||||
{
|
{
|
||||||
if (!ProcSetList.Contains(item.SearchDVPath))
|
if (!ProcSetList.Contains(item.SearchDVPath))
|
||||||
@ -1278,6 +1297,139 @@ namespace Volian.Print.Library
|
|||||||
//document.Add(prgh);
|
//document.Add(prgh);
|
||||||
document.Add(phrs);
|
document.Add(phrs);
|
||||||
}
|
}
|
||||||
|
private string GetROTitleAndGroupsForSummary(List<string>roTitleList, List<string> prevROTitleList)
|
||||||
|
{
|
||||||
|
string rotitle = "";
|
||||||
|
string indent = "";
|
||||||
|
for (int icnt = 0; icnt < roTitleList.Count; icnt++)
|
||||||
|
{
|
||||||
|
indent += " ";
|
||||||
|
if (icnt == roTitleList.Count - 1)
|
||||||
|
{
|
||||||
|
rotitle += indent + roTitleList[icnt]; // this should be the ro description
|
||||||
|
break; //break out of for loop
|
||||||
|
}
|
||||||
|
if (prevROTitleList == null || (icnt < roTitleList.Count && icnt < prevROTitleList.Count && prevROTitleList[icnt] != roTitleList[icnt]))
|
||||||
|
{
|
||||||
|
if (rotitle == "" && prevROTitleList != null)
|
||||||
|
rotitle = "\n";
|
||||||
|
rotitle += indent + roTitleList[icnt] + "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rotitle;
|
||||||
|
}
|
||||||
|
private List<string> AddROHeaderGroupForSummary(PdfPTable datatable, string curROID,List<string> prevROTitleList, Font f2, Color bgColor)
|
||||||
|
{
|
||||||
|
List<string> roTitleList = _ROFSTLookup.GetROTitleAndGroupPath(curROID);
|
||||||
|
string headerText = GetROTitleAndGroupsForSummary(roTitleList, prevROTitleList);
|
||||||
|
if (headerText.Length > 0)
|
||||||
|
{
|
||||||
|
Paragraph pgh = new Paragraph(headerText, f2);
|
||||||
|
PdfPCell cell = new PdfPCell(pgh);
|
||||||
|
cell.FollowingIndent = 72;
|
||||||
|
cell.Colspan = 2;
|
||||||
|
cell.BorderColor = Color.WHITE;
|
||||||
|
cell.BackgroundColor = Color.WHITE;//bgColor;
|
||||||
|
cell.BorderWidthTop = 1;
|
||||||
|
datatable.AddCell(cell);
|
||||||
|
}
|
||||||
|
return roTitleList;
|
||||||
|
}
|
||||||
|
public void AddMainRODatabaseTitle(PdfPTable datatable, int dbTitleIndex, Font f2, Color bgColor)
|
||||||
|
{
|
||||||
|
string dbTitle = _ROFSTLookup.GetRODatabaseTitle(dbTitleIndex);
|
||||||
|
PdfPCell cell = new PdfPCell(new Phrase(dbTitle, f2));
|
||||||
|
cell.BorderColor = Color.WHITE;
|
||||||
|
cell.Colspan = 2;
|
||||||
|
cell.BackgroundColor = bgColor;
|
||||||
|
//cell.BorderWidthTop = 1;
|
||||||
|
datatable.AddCell(cell);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BuildROSummaryReport(iTextSharp.text.Document document)
|
||||||
|
{
|
||||||
|
float[] headerwidths = { 10, 20, 80 };
|
||||||
|
PdfPTable datatable = new PdfPTable(1);
|
||||||
|
PdfPTable colHeader = new PdfPTable(headerwidths);
|
||||||
|
PdfPTable databaseTitle = new PdfPTable(1);
|
||||||
|
//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, 1, Color.BLACK);
|
||||||
|
PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, f1));
|
||||||
|
cell.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||||
|
//cell.Colspan = 2;
|
||||||
|
cell.BackgroundColor = Color.WHITE;//new Color(0xD0, 0xF0, 0xF0); // light blue
|
||||||
|
cell.BorderColor = Color.WHITE;
|
||||||
|
datatable.AddCell(cell);
|
||||||
|
|
||||||
|
string roFSTDateTime = "RO.FST Created: " + _ROFSTLookup.GetRoFSTdts().ToLongDateString() + " @ " + _ROFSTLookup.GetRoFSTdts().ToShortTimeString() + "\n ";
|
||||||
|
cell = new PdfPCell(new Phrase(roFSTDateTime, f2));
|
||||||
|
cell.BorderColor = Color.WHITE;
|
||||||
|
datatable.AddCell(cell);
|
||||||
|
|
||||||
|
datatable.HeaderRows = 2;//3 + (ProcSetList.Count == 1 ? 1 : 0);
|
||||||
|
datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
|
||||||
|
string lastROID = "";
|
||||||
|
List<string> prevROTitleList = null;
|
||||||
|
int lastDBindex = -1;
|
||||||
|
foreach (string curROID in _ROList)
|
||||||
|
{
|
||||||
|
string[] tmp = curROID.TrimEnd(',').Split(':'); //curROID.Split(':');// this is the RO FST id number (for plants with multiple RO FSTs)
|
||||||
|
string rolst = (tmp.Length == 2)? tmp[1] : tmp[0];
|
||||||
|
string[] roIdslst = rolst.Split(',');
|
||||||
|
foreach (string cROID in roIdslst)
|
||||||
|
{
|
||||||
|
if (cROID == "") break;
|
||||||
|
if (cROID.Length == 4)
|
||||||
|
ProcessROdb(datatable, f2, f3, ref cell, ref lastROID, ref prevROTitleList, ref lastDBindex, cROID);
|
||||||
|
else
|
||||||
|
ProcessROID(datatable, f2, f3, ref cell, ref lastROID, ref prevROTitleList, ref lastDBindex, cROID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.Add(datatable);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessROdb(PdfPTable datatable, iTextSharp.text.Font f2, iTextSharp.text.Font f3, ref PdfPCell cell, ref string lastROID, ref List<string> prevROTitleList, ref int lastDBindex, string cROID)
|
||||||
|
{
|
||||||
|
ROFSTLookup.rodbi roDBI = _ROFSTLookup.GetRODatabase(cROID);
|
||||||
|
foreach (ROFSTLookup.rochild cld in roDBI.children)
|
||||||
|
ProcessROChild(datatable, f2, f3, ref cell, ref lastROID, ref prevROTitleList, ref lastDBindex, cld);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessROChild(PdfPTable datatable, iTextSharp.text.Font f2, iTextSharp.text.Font f3, ref PdfPCell cell, ref string lastROID, ref List<string> prevROTitleList, ref int lastDBindex,ROFSTLookup.rochild cld)
|
||||||
|
{
|
||||||
|
if (cld.children == null) // leaf node
|
||||||
|
ProcessROID(datatable, f2, f3, ref cell, ref lastROID, ref prevROTitleList, ref lastDBindex, cld.roid);
|
||||||
|
else if (cld.children[0].ParentID == 0) // multiple return value
|
||||||
|
ProcessROID(datatable, f2, f3, ref cell, ref lastROID, ref prevROTitleList, ref lastDBindex, cld.roid);
|
||||||
|
else
|
||||||
|
foreach (ROFSTLookup.rochild gcld in cld.children)
|
||||||
|
ProcessROChild(datatable, f2, f3, ref cell, ref lastROID, ref prevROTitleList, ref lastDBindex, gcld);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessROID(PdfPTable datatable, iTextSharp.text.Font f2, iTextSharp.text.Font f3, ref PdfPCell cell, ref string lastROID, ref List<string> prevROTitleList, ref int lastDBindex, string cROID)
|
||||||
|
{
|
||||||
|
int curDBindex = _ROFSTLookup.GetRODatabaseTitleIndex(cROID);// Convert.ToInt32(cROID.Substring(0, 4));
|
||||||
|
if (lastDBindex == -1 || curDBindex != lastDBindex)
|
||||||
|
{
|
||||||
|
if (prevROTitleList != null)
|
||||||
|
{
|
||||||
|
// add blank line to separate groups on the report
|
||||||
|
cell = new PdfPCell(new Phrase(" ", f2));
|
||||||
|
cell.BorderColor = Color.WHITE;
|
||||||
|
datatable.AddCell(cell);
|
||||||
|
}
|
||||||
|
AddMainRODatabaseTitle(datatable, curDBindex, f3, Color.WHITE);
|
||||||
|
lastDBindex = curDBindex;
|
||||||
|
}
|
||||||
|
if (lastROID == "" || cROID != lastROID)
|
||||||
|
prevROTitleList = AddROHeaderGroupForSummary(datatable, cROID, prevROTitleList, f2, new Color(0xC0, 0xFF, 0xC0));
|
||||||
|
lastROID = cROID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public class MyPageHelper : PdfPageEventHelper
|
public class MyPageHelper : PdfPageEventHelper
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user