You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
3.1 KiB
118 lines
3.1 KiB
using System;
|
|
using System.Data;
|
|
using grproLib;
|
|
|
|
namespace InjectionPC
|
|
{
|
|
public class MyReport
|
|
{
|
|
// Token: 0x0600010A RID: 266 RVA: 0x000097A8 File Offset: 0x000079A8
|
|
public MyReport(string filename, DataTable _dtDataHead, DataTable _dtDataDetail,string printerName)
|
|
{
|
|
this.dtDataHead = _dtDataHead;
|
|
this.dtDataDetail = _dtDataDetail;
|
|
this.Report = new GridppReportClass();
|
|
this.Report.LoadFromFile(filename);
|
|
//this.Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(this, (UIntPtr)ldftn(Report_FetchRecord));
|
|
this.Report.FetchRecord += Report_FetchRecord;
|
|
this.Report.Printer.PrinterName = printerName;
|
|
this.FillParameters();
|
|
}
|
|
|
|
|
|
|
|
// Token: 0x0600010B RID: 267 RVA: 0x00009833 File Offset: 0x00007A33
|
|
public void Print()
|
|
{
|
|
this.Report.Print(true);
|
|
}
|
|
|
|
// Token: 0x0600010C RID: 268 RVA: 0x00009843 File Offset: 0x00007A43
|
|
public void PrintPreview()
|
|
{
|
|
this.Report.PrintPreview(true);
|
|
}
|
|
|
|
// Token: 0x0600010D RID: 269 RVA: 0x00009854 File Offset: 0x00007A54
|
|
public void Report_FetchRecord()
|
|
{
|
|
if (this.dtDataDetail != null)
|
|
{
|
|
this.FillRecordToReport(this.Report, this.dtDataDetail);
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600010E RID: 270 RVA: 0x00009884 File Offset: 0x00007A84
|
|
public void FillRecordToReport(IGridppReport _Report, DataTable dt)
|
|
{
|
|
MyReport.MatchFieldPairType[] array = new MyReport.MatchFieldPairType[Math.Min(_Report.DetailGrid.Recordset.Fields.Count, dt.Columns.Count)];
|
|
int num = 0;
|
|
for (int i = 0; i < dt.Columns.Count; i++)
|
|
{
|
|
foreach (object obj in _Report.DetailGrid.Recordset.Fields)
|
|
{
|
|
IGRField igrfield = (IGRField)obj;
|
|
if (string.Compare(igrfield.Name, dt.Columns[i].ColumnName, true) == 0)
|
|
{
|
|
array[num].grField = igrfield;
|
|
array[num].MatchColumnIndex = i;
|
|
num++;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
foreach (object obj2 in dt.Rows)
|
|
{
|
|
DataRow dataRow = (DataRow)obj2;
|
|
_Report.DetailGrid.Recordset.Append();
|
|
for (int i = 0; i < num; i++)
|
|
{
|
|
if (!dataRow.IsNull(array[i].MatchColumnIndex))
|
|
{
|
|
array[i].grField.Value = dataRow[array[i].MatchColumnIndex];
|
|
}
|
|
}
|
|
_Report.DetailGrid.Recordset.Post();
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600010F RID: 271 RVA: 0x00009A68 File Offset: 0x00007C68
|
|
public void FillParameters()
|
|
{
|
|
if (this.dtDataHead.Rows.Count != 0)
|
|
{
|
|
for (int i = 0; i < this.dtDataHead.Columns.Count; i++)
|
|
{
|
|
foreach (object obj in this.Report.Parameters)
|
|
{
|
|
IGRParameter igrparameter = (IGRParameter)obj;
|
|
if (string.Compare(igrparameter.Name, this.dtDataHead.Columns[i].ColumnName, true) == 0)
|
|
{
|
|
igrparameter.Value = this.dtDataHead.Rows[0][this.dtDataHead.Columns[i].ColumnName];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x04000078 RID: 120
|
|
public GridppReport Report = null;
|
|
|
|
// Token: 0x04000079 RID: 121
|
|
public DataTable dtDataHead = null;
|
|
|
|
// Token: 0x0400007A RID: 122
|
|
public DataTable dtDataDetail = null;
|
|
|
|
// Token: 0x02000033 RID: 51
|
|
private struct MatchFieldPairType
|
|
{
|
|
// Token: 0x0400007B RID: 123
|
|
public IGRField grField;
|
|
|
|
// Token: 0x0400007C RID: 124
|
|
public int MatchColumnIndex;
|
|
}
|
|
}
|
|
}
|
|
|