using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing;
using System.Data;
using FastReport;
using FastReport.Data;
using FastReport.Dialog;
using FastReport.Barcode;
using FastReport.Table;
using FastReport.Utils;
using FastReport.Matrix;
namespace FastReport
{
public class ReportScript
{
private void tb_PptLot_BeforePrint(object sender, EventArgs e)
{
DataSourceBase rowdata = Report.GetDataSource("planMain");
rowdata.Init();
Cell2.Text = rowdata.Report.GetColumnValue("planMain.recipematerialname").ToString();
Cell7.Text = rowdata.Report.GetColumnValue("planMain.equipcode").ToString();
Cell17.Text = String.Format("{0:yyyy-MM-dd HH:mm:ss}",Convert.ToDateTime(rowdata.Report.GetColumnValue("planMain.realstarttime").ToString()));
Cell4.Text = rowdata.Report.GetColumnValue("planMain.itemname").ToString();
Cell9.Text = rowdata.Report.GetColumnValue("planMain.shiftclassname").ToString();
Cell19.Text = String.Format("{0:yyyy-MM-dd HH:mm:ss}",Convert.ToDateTime(rowdata.Report.GetColumnValue("planMain.realendtime").ToString()));
Cell26.Text = rowdata.Report.GetColumnValue("planMain.realnum").ToString();
Cell27.Text = rowdata.Report.GetColumnValue("planMain.PlanNum").ToString();
}
private void Table1_BeforePrint(object sender, EventArgs e)
{
DataSourceBase rowData = Report.GetDataSource("planAvgAndSumMain");
rowData.Init();
Cell46.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgDoneAllRtime")).ToString();
Cell47.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgDoneRtime")).ToString();
Cell48.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgBwbTime")).ToString();
Cell63.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgPolydistime")).ToString();
Cell61.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgCBdistime")).ToString();
Cell59.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgPjTemp")).ToString();
Cell57.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgPjPower")).ToString();
Cell49.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgLotEnergy")).ToString();
Cell65.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumDoneAllRtime")).ToString();
Cell66.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumDoneRtime")).ToString();
Cell67.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumBwbTime")).ToString();
Cell68.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumPolyDistime")).ToString();
Cell69.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumCBDistime")).ToString();
Cell70.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumPjTemp")).ToString();
Cell71.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumPjPower")).ToString();
Cell72.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumLotEnergy")).ToString();
}
private void Table2_ManualBuild(object sender, EventArgs e)
{
DataSourceBase rowData = Report.GetDataSource("MaterialDetailInfo");
rowData.Init();
int count = 0;
int temp = 53;
// now enumerate the data source and print the table body
while (rowData.HasMoreRows)
{
if(count < 22 )
{
if(count % 21 == 0)
{
Table2.PrintRow(0);
Table2.PrintColumns();
}
}
if(count > 45 )
{
if(count % temp == 0)
{
Table2.PrintRow(0);
Table2.PrintColumns();
temp = temp + 32;
}
}
Cell153.Text = rowData.Report.GetColumnValue("MaterialDetailInfo.StartDatetime").ToString().Substring(0,8);
Cell93.Text = rowData.Report.GetColumnValue("MaterialDetailInfo.serialid").ToString();
Cell94.Text = rowData.Report.GetColumnValue("MaterialDetailInfo.doneallrtime").ToString();
Cell95.Text = rowData.Report.GetColumnValue("MaterialDetailInfo.donertime").ToString();
Cell96.Text = Convert.ToDouble(rowData.Report.GetColumnValue("MaterialDetailInfo.bwbtime")).ToString();
Cell112.Text = Convert.ToDouble(rowData.Report.GetColumnValue("MaterialDetailInfo.PolyDisTime")).ToString();
Cell107.Text = Convert.ToDouble(rowData.Report.GetColumnValue("MaterialDetailInfo.CBDisTime")).ToString();
Cell102.Text = Convert.ToDouble(rowData.Report.GetColumnValue("MaterialDetailInfo.OilDisTime")).ToString();
Cell127.Text = Convert.ToDouble(rowData.Report.GetColumnValue("MaterialDetailInfo.PjTemp")).ToString();
Cell122.Text = Convert.ToDouble(rowData.Report.GetColumnValue("MaterialDetailInfo.pjpower")).ToString();
Cell117.Text = Convert.ToDouble(rowData.Report.GetColumnValue("MaterialDetailInfo.PjEner")).ToString();
Table2.PrintRow(1);
Table2.PrintColumns();
rowData.Next();
count ++;
}
// print the last table row - it is a footer
Table2.PrintRow(2);
Table2.PrintColumns();
}
}
}
|