private void CreateReportTemplate(ReportInfo info, DataTable printTable) { GridppReport Report = new GridppReport(); Report.InsertReportHeader(); Report.InsertDetailGrid(); foreach (DataColumn col in printTable.Columns) { GRFieldType grFieldType = ConvertToGRFieldType(col.DataType); Report.DetailGrid.Recordset.AddField(col.ColumnName, grFieldType); IGRColumn c = Report.DetailGrid.Columns.Add(); c.Name = col.ColumnName; c.TitleCell.Text = col.ColumnName; c.ContentCell.DataField = col.ColumnName; } if (info.ReportParameters != null) { for (int i = 0; i < info.ReportParameters.Length; i++) { if (Report.Parameters.IndexByName(info.ReportParameters[i].Text) < 0) { IGRParameter p = Report.Parameters.Add(); p.Name = info.ReportParameters[i].Text; p.DataType = GRParameterDataType.grptString; } } } Report.SaveToFile(info.TemplateFile); }
/// <summary> /// 生成打印报表 /// </summary> /// <param name="datatable">数据表</param> /// <param name="datetime">打印何时的报表</param> public void Print(DataTable datatable, DateTime datetime, string reporttype) { if (rb瓶签.Checked) { printTablepq = datatable.Copy(); reportpq = new GridppReport(); printTablepq.Columns.Add("OrderTypeZhCn", Type.GetType("System.String")); reportpq.LoadFromFile(Constant.ApplicationDirectory + "\\report\\住院护士执行单瓶签.grf"); op_orderexec.bqTreat(printTablepq); reportpq.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(reportpq_FetchRecord); reportpq.Title = HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.WorkName + "瓶签"; //新加 reportpq.PrintPreview(false); //新加 //reportpq.Print(false); } else { printTable = datatable.Copy(); report = new GridppReport(); report.LoadFromFile(Constant.ApplicationDirectory + "\\report\\住院护士执行单" + reporttype + ".grf"); //op_orderexec.ContentInGroup(printTable, 0); report.ParameterByName("HospitalName").AsString = HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.WorkName + reporttype; report.ParameterByName("DeptName").AsString = _currentDept.Name; report.ParameterByName("Date").AsString = datetime.Date.ToShortDateString(); report.ParameterByName("Printer").AsString = _currentUser.Name; report.ParameterByName("PrintDateTime").AsString = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime.ToString(); report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(report_FetchRecord); report.Title = HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.WorkName + reporttype; //报表标题 report.PrintPreview(false); //显示打印预览 //report.Print(false);//不显示预览直接打印 } }
private void ExportGridReport(GridppReport report, GRExportType exportType, string Title, string FileName) { DateTime StartTime = DateTime.Now; string msg = Pub.GetResText("", "MsgExportingData", ""); msg = string.Format(msg, Title); if (File.Exists(FileName)) { File.Delete(FileName); } if (report.DetailGrid != null) { if (report.ColumnByName("CheckBox") != null) { report.ColumnByName("CheckBox").Visible = false; } } bool ret = report.ExportDirect(exportType, FileName, true, false); if (report.DetailGrid != null) { if (report.ColumnByName("CheckBox") != null) { report.ColumnByName("CheckBox").Visible = true; } } if (!ret) { return; } msg = Pub.GetResText("", "MsgExportSuccess", ""); msg = string.Format(msg, Title); RefreshMsg(msg + Pub.GetDateDiffTimes(StartTime, DateTime.Now, true), true); Pub.MessageBoxShow(msg, MessageBoxIcon.Information); }
private void SetReport2() { Report2 = new GridppReport(); Report2.LoadFromFile(root + @"\MyCustomReport.grf"); Report2.Initialize += new _IGridppReportEvents_InitializeEventHandler(Report2Initialize); //必要,只执行一次 Report2.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(Report2FetchRecord); //必要,只执行一次 }
public frmPubDisplay(GridppReport report, string Title, int ReportStartIndex) { Report = report; title = Title; StartIndex = ReportStartIndex; InitializeComponent(); }
public PopupInventoryDetail(VW_BILL bill) { InitializeComponent(); _bill = bill; _report = ReportHelper.InitReport(_billType); _report.Initialize += () => _report_Initialize(_report, _inventorydetail, DetailTableName, IndexColumnName); }
private void FillRecordToReport(GridppReport report, IDataReader dr) { MatchFieldPairType[] MatchFieldPairs = new MatchFieldPairType[Math.Min(Report.DetailGrid.Recordset.Fields.Count, dr.FieldCount)]; int MatchFieldCount = 0; for (int i = 0; i < dr.FieldCount; ++i) { foreach (IGRField fld in Report.DetailGrid.Recordset.Fields) { if (String.Compare(fld.RunningDBField, dr.GetName(i), true) == 0) { MatchFieldPairs[MatchFieldCount].grField = fld; MatchFieldPairs[MatchFieldCount].MatchColumnIndex = i; ++MatchFieldCount; break; } } } while (dr.Read()) { Report.DetailGrid.Recordset.Append(); for (int i = 0; i < MatchFieldCount; ++i) { if (!dr.IsDBNull(MatchFieldPairs[i].MatchColumnIndex)) { MatchFieldPairs[i].grField.Value = dr.GetValue(MatchFieldPairs[i].MatchColumnIndex); } } Report.DetailGrid.Recordset.Post(); } }
public FrmMain(string _rptName, string _rptPath) { InitializeComponent(); this.rptName = _rptName; this.rptPath = _rptPath; //if (Report.LoadFromFile(rptPath + rptName + ".grf")) //{ // this.axGRDesigner1.Report = Report; //} //else //{ // MessageBox.Show("报表文件不存在!"); //} this.rptName = _rptName; this.rptPath = _rptPath; if (this.Report.LoadFromFile(this.rptPath)) { this.axGRDesigner1.Report = this.Report; } else { MessageBox.Show("报表文件不存在!"); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnTj_Click(object sender, EventArgs e) { this.myGridPP.Stop(); int Ghy = 0; Ghy = Convert.ToInt32(Convertor.IsNull(txtSFY.Tag, "0")); if (Ghy == 0) { MessageBox.Show("请先选择收费员进行后,再进行统计!"); txtSFY.Focus(); return; } //载入报表模板数据 // rptMain.LoadFromFile(@"report\mzgh_rjbb.grf"); rptMain.LoadFromFile(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"report\mzgh_rjbb.grf")); this.myGridPP.Report = rptMain; //子报表部件框的报表对象关联一个外部报表对象,以便响应报表事件 ReportXJ = rptMain.ControlByName("ReportXJ").AsSubReport.Report; ReportYHK = rptMain.ControlByName("ReportYHK").AsSubReport.Report; ReportQTZF = rptMain.ControlByName("ReportQTZF").AsSubReport.Report; this.rptMain.Initialize += Report_Initialize_Main; ReportXJ.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportXJFetchRecord); ReportYHK.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportYHKFetchRecord); ReportQTZF.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportQTZFFetchRecord); //this.myGridPP.Report = rptMain; //this.myGridPP.ResizeColumnToFitPage(); this.myGridPP.Start(); }
private void SetReport3() { Report3 = new GridppReport(); Report3.LoadFromFile(root + @"\MyCustomDiagram.grf"); Report3.Initialize += new _IGridppReportEvents_InitializeEventHandler(Report3Initialize); Report3.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(Report3FetchRecord); Report3.ProcessRecord += new _IGridppReportEvents_ProcessRecordEventHandler(Report3ProcessRecord); }
public FormPo() { InitializeComponent(); _taBilltype = GlobalBuffer.BillTypeList.Single(p => p.BillType == (int)_billType); _report = ReportHelper.InitReport(_billType); _report.Initialize += () => ReportHelper._report_Initialize(_report, _bill, DetailTableName, IndexColumnName); }
private void toolStripButton3_Click(object sender, EventArgs e) { Report = null; Report.InsertDetailGrid(); Report.DetailGrid.Recordset.ConnectionString = ConnStr; Report.DetailGrid.Recordset.QuerySQL = SqlStr; this.axGRDesigner1.Report = Report; }
/// <summary> /// 根据报表文件名获取报表 /// </summary> /// <param name="rptName"></param> public static GridppReport GetReport(string rptName) { GridppReport rpt = new GridppReport(); string path = GetReportPath(rptName); rpt.LoadFromFile(path); return(rpt); }
protected virtual void ConstructFun(string reportFilename) { report = new GridppReport(); report.Initialize += new _IGridppReportEvents_InitializeEventHandler(Report_Initialize); report.LoadFromFile(Constant.ApplicationDirectory + "\\" + reportFilename); report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(report_FetchRecord); }
protected void ConstructFun() { report = new GridppReport(); report.Initialize += new _IGridppReportEvents_InitializeEventHandler(Report_Initialize); report.LoadFromFile(Constant.ApplicationDirectory + "\\预交款余额情况表.grf"); report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(report_FetchRecord); }
public frmPubDesign(GridppReport report, string Title, string ReportFile, string ReportTableName, string ReportName) { Report = report; title = Title; reportFile = ReportFile; TableName = ReportTableName; reportName = ReportName; InitializeComponent(); }
public CtrlReport() { InitializeComponent(); //1.创建报表模型 _Report = new GridppReport(); _Report.Initialize += new _IGridppReportEvents_InitializeEventHandler( ReprotInitialize); }
/// <summary> /// 创建住院结算个人交款表模板 /// </summary> public static void CreateCostAccountBookTemplate() { try { GridppReport reportPrinter = new GridppReport(); if (!Directory.Exists(System.Windows.Forms.Application.StartupPath + "\\report")) { Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\\report"); } if (File.Exists(accountbookTemplatePath1)) { File.Delete(accountbookTemplatePath1); } if (!File.Exists(accountbookTemplatePath1)) { reportPrinter.InsertReportHeader(); DataTable dt = BaseDataFactory.GetData(baseDataType.住院发票项目); for (int i = 0; i < dt.Rows.Count; i++) { reportPrinter.AddParameter(dt.Rows[i]["name"].ToString(), GRParameterDataType.grptString); } System.Reflection.PropertyInfo[] propertyinfos = typeof(AbstractCostAccountRpt).GetProperties(); for (int i = 0; i < propertyinfos.Length; i++) { if (propertyinfos[i].PropertyType == typeof(String)) { reportPrinter.AddParameter(propertyinfos[i].Name, GRParameterDataType.grptString); } } DataTable dt1 = BaseDataFactory.GetData(baseDataType.病人类型); for (int i = 0; i < dt1.Rows.Count; i++) { reportPrinter.AddParameter(dt1.Rows[i]["name"] + "_记账_张数", GRParameterDataType.grptString); reportPrinter.AddParameter(dt1.Rows[i]["name"] + "_记账", GRParameterDataType.grptString); } reportPrinter.AddParameter("单位_记账_张数", GRParameterDataType.grptString); reportPrinter.AddParameter("单位_记账", GRParameterDataType.grptString); reportPrinter.AddParameter("合计_记账_张数", GRParameterDataType.grptString); reportPrinter.AddParameter("合计_记账", GRParameterDataType.grptString); reportPrinter.SaveToFile(accountbookTemplatePath1); } } catch { MessageBox.Show("创建住院个人结算交款表模板发生错误!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void toolStripButton1_Click(object sender, EventArgs e) { axGRDisplayViewer1.Stop(); BaseReportTitle reportTitle = (BaseReportTitle)treeView1.SelectedNode.Tag; tPrintTable = (DataTable)InvokeController("ExecReportResult", reportTitle.TitleId, GetReportParamsValue()); string Reportname = reportTitle.RptFileName.Trim() + ".grf"; if (!System.IO.File.Exists(EFWCoreLib.CoreFrame.Init.AppGlobal.AppRootPath + @"Report\" + Reportname)) { Report = new GridppReport(); Report.InsertReportHeader(); Report.InsertDetailGrid(); Report.InsertReportFooter(); Report.DetailGrid.IsCrossTab = true; IGRRecordset RecordSet = Report.DetailGrid.Recordset; foreach (DataColumn col in tPrintTable.Columns) { if (col.DataType == typeof(Int32)) { RecordSet.AddField(col.ColumnName, GRFieldType.grftInteger); } else if (col.DataType == typeof(Decimal) || col.DataType == typeof(Double)) { RecordSet.AddField(col.ColumnName, GRFieldType.grftFloat); } else { RecordSet.AddField(col.ColumnName, GRFieldType.grftString); } } Report.AddParameter("报表名称", GRParameterDataType.grptString); Report.AddParameter("打印时间", GRParameterDataType.grptString); Report.AddParameter("当前科室", GRParameterDataType.grptString); Report.AddParameter("当前人员", GRParameterDataType.grptString); Report.DetailGrid.IsCrossTab = false; Report.SaveToFile(EFWCoreLib.CoreFrame.Init.AppGlobal.AppRootPath + @"Report\" + Reportname); } Report = new GridppReport(); Report.LoadFromFile(EFWCoreLib.CoreFrame.Init.AppGlobal.AppRootPath + @"Report\" + Reportname); Report.ParameterByName("报表名称").AsString = reportTitle.Name; Report.ParameterByName("打印时间").AsString = System.DateTime.Now.ToString(); Report.ParameterByName("当前科室").AsString = ""; Report.ParameterByName("当前人员").AsString = ""; Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(reportPrinter_FetchRecord); axGRDisplayViewer1.Report = Report; axGRDisplayViewer1.Start(); }
//数据库连接字符串 //public static string DbConnectString = Trasen.DbAcc.InstanceBaseForm.BDatabase.ConnectionString; //此函数用来注册Grid++Report,你必须在你的应用程序启动时调用此函数 //用你自己的序列号代替"AAAAAAA","AAAAAAA"是一个无效的序列号 public static void RegisterGridppReport() { GridppReport TempGridppReport = new GridppReport(); bool Succeeded = TempGridppReport.Register("YJM672NKEJ64"); if (!Succeeded) { System.Windows.Forms.MessageBox.Show("Register Grid++Report Failed, Grid++Report will run in trial mode.", "Register" , System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); } }
public frmPubPreview(GridppReport report, string Title, string ReportFile, string ReportTableName, string ReportName, bool DesignReport) { Report = report; title = Title; reportFile = ReportFile; TableName = ReportTableName; reportName = ReportName; AllowDesignReport = DesignReport; InitializeComponent(); }
public FormReceive(string subBillType) { InitializeComponent(); if (!Enum.TryParse(subBillType, true, out _subBillType)) { MessageHelper.ShowError("单据子类型错误"); Close(); } _report = ReportHelper.InitReport(_billType); _report.Initialize += () => ReportHelper._report_Initialize(_report, _bill, DetailTableName, IndexColumnName); }
private void _report_Initialize(GridppReport report, TB_INVENTORY_DETAIL locBill, string detailTableName, string indexColumnName) { Console.WriteLine(report.Parameters.Count); report.ParameterByName("BillNum").AsString = locBill.BillNum; report.ParameterByName("LocCode").AsString = locBill.CheckLocCode; report.ParameterByName("BillTime").AsString = ((DateTime)locBill.CheckTime).ToString(GlobalVar.LongTimeString); report.ParameterByName("OperName").AsString = locBill.OperName; report.ParameterByName("CheckQty").AsString = locBill.CheckQty.ToString(); report.ConnectionString = EntitiesFactory.WmsConnectionString; report.DetailGrid.Recordset.ConnectionString = EntitiesFactory.WmsConnectionString; report.DetailGrid.Recordset.QuerySQL = $"select * from {detailTableName} where {indexColumnName} = '{locBill.BillNum}' and CheckLocCode='{_inventorydetail.CheckLocCode}'"; }
private void btPrint_Click(object sender, EventArgs e) { if (CheckInpatRegInfo()) { GridppReport report = new GridppReport(); report.LoadFromFile(Constant.ApplicationDirectory + "\\report\\门诊医生住院证.grf"); XmlOperate.PrintXmlText(XmlOperate.ComposeXmlText("ZyInpatRegContent", this), "ZyInpatRegContent", report); report.ParameterByName("编号").AsString = _zyInpatRegist.RegId.ToString(); report.PrintPreview(false); } }
//报表打印预览 private void button1_Click(object sender, EventArgs e) { GridppReport Report = new GridppReport(); //将参数传递到报表模板中 string str = "test"; Report.ParameterByName("参数名").Value = str; Report.LoadFromFile(@"C:\Users\Administrator\Desktop\test.grf"); //打印预览 Report.PrintPreview(true); }
public static void PrintXmlText(string xmlText, string rootName, GridppReport report) { try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xmlText); DeComposePrintXmlCellValue(xmlDoc.SelectSingleNode(rootName), report); } catch (Exception err) { MessageBox.Show(err.Message, "提示"); } }
public void loadreportfile(string reportfile) { GridppReport Report = new GridppReport(); if (Report.LoadFromFile(reportfile)) { this.axGRDesigner1.Report = Report; } else { MessageBoxEx.Show("此报表文件有误,无法进行设计!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void UpdateReportTemplate(ReportInfo info, DataTable printTable) { if (!this.checkBox1.Checked) { return; } GridppReport Report = new GridppReport(); bool bChanged = false; Report.LoadFromFile(ri.TemplateFile); if (ri.ReportParameters != null) { for (int i = 0; i < ri.ReportParameters.Length; i++) { if (Report.Parameters.IndexByName(ri.ReportParameters[i].Text) < 0) { IGRParameter p = Report.Parameters.Add(); p.Name = ri.ReportParameters[i].Text; p.DataType = GRParameterDataType.grptString; bChanged = true; } } } if (printTable != null) { if (Report.DetailGrid == null) { Report.InsertDetailGrid(); } foreach (DataColumn dtcol in printTable.Columns) { GRFieldType grFieldType = ConvertToGRFieldType(dtcol.DataType); if (Report.DetailGrid.Recordset.Fields.IndexByName(dtcol.ColumnName) < 0) { Report.DetailGrid.Recordset.AddField(dtcol.ColumnName, grFieldType); IGRColumn c = Report.DetailGrid.Columns.Add(); c.Name = dtcol.ColumnName; c.TitleCell.Text = dtcol.ColumnName; c.ContentCell.DataField = dtcol.ColumnName; bChanged = true; } } } if (bChanged) { Report.SaveToFile(ri.TemplateFile); } }
public GridReport(string reportfile, Dictionary <string, Object> para, DataTable datasource) { _datasource = datasource; Report = new GridppReport(); //载入报表模板 Report.LoadFromFile(reportfile); if (para != null) { GridReport.AddParamToReport(Report, para); } //连接报表事件 Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(ReportInitialize); Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecord); }
public NotOffSetForm(string Datasql) { InitializeComponent(); this.Datasql = Datasql; Report.LoadFromFile(GridReportUtility.GetReportTemplatePath() + "NotOffSetReport.grf"); //设置与数据源的连接串,因为在设计时指定的数据库路径是绝对路径。 Report.DetailGrid.Recordset.ConnectionString = GridReportUtility.GetDatabaseConnectionString(); Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(Report_Initialize); //设定查询显示器关联的报表 this.axGRDisplayViewer1.Report = Report; }
public NotOffSetForm(string Datasql) { InitializeComponent(); this.Datasql = Datasql; Report.LoadFromFile(GridReportUtility.GetReportTemplatePath() + "NotOffSetReport.grf"); //设置与数据源的连接串,因为在设计时指定的数据库路径是绝对路径。 Report.DetailGrid.Recordset.ConnectionString = GridReportUtility.GetDatabaseConnectionString(); Report.Initialize +=new _IGridppReportEvents_InitializeEventHandler(Report_Initialize); //设定查询显示器关联的报表 this.axGRDisplayViewer1.Report = Report; }
public UserReportForm() { InitializeComponent(); this.filePath = GridReportUtility.GetReportTemplatePath(); this.cons = GridReportUtility.GetDatabaseConnectionString(); //载入报表模板数据 Report.LoadFromFile(filePath + "用户报表.grf"); //设置与数据源的连接串,因为在设计时指定的数据库路径是绝对路径。 Report.DetailGrid.Recordset.ConnectionString = this.cons; //挂接报表事件 Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(Report_Initialize); //设定查询显示器关联的报表 this.axGRDisplayViewer1.Report = Report; }
public StockStatusReportForm() { InitializeComponent(); //Report.LoadFromFile(GridReportUtility.GetReportTemplatePath() + "日报总表.grf"); //设置与数据源的连接串,因为在设计时指定的数据库路径是绝对路径。 //Report.DetailGrid.Recordset.ConnectionString = GridReportUtility.GetDatabaseConnectionString(); Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(Report_Initialize); Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(Report_FetchRecord); //子报表关联 //SubReport.Initialize += new _IGridppReportEvents_InitializeEventHandler(SubReport_Initialize); //SubReport.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(SubReport_FetchRecord); //Report.ControlByName("SubReport01").AsSubReport.Report = SubReport; //设定查询显示器关联的报表 this.axGRDisplayViewer1.Report = Report; }
public ReceiptReportForm() { InitializeComponent(); Report.LoadFromFile(GridReportUtility.GetReportTemplatePath() + "JXMainbord.grf"); //设置与数据源的连接串,因为在设计时指定的数据库路径是绝对路径。 Report.DetailGrid.Recordset.ConnectionString = GridReportUtility.GetDatabaseConnectionString(); Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(Report_Initialize); //子报表关联 SubReport.LoadFromFile(GridReportUtility.GetReportTemplatePath() + "CRstoreChild.grf"); SubReport.DetailGrid.Recordset.ConnectionString = GridReportUtility.GetDatabaseConnectionString(); SubReport.Initialize += new _IGridppReportEvents_InitializeEventHandler(SubReport_Initialize); Report.ControlByName("SubReport1").AsSubReport.Report = SubReport; //设定查询显示器关联的报表 this.axGRDisplayViewer1.Report = Report; }
//生成Dt public void Produce_dt() { this.progressBar1.Value = 1; Update_Dts_In_Out(); this.progressBar1.Value = 2; //Update_Dts_Out(); Update_Dts_Stock(); this.progressBar1.Value = 5; this.progressBar1.Value = 6; //设置与数据源的连接串,因为在设计时指定的数据库路径是绝对路径 Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(Report_Initialize); Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(Report_FetchRecord); this.axGRDisplayViewer1.Report = Report; this.axGRDisplayViewer1.Start(); this.progressBar1.Value = 7; }
public void ShowReport() { if (TypeName == "YFSearch") { Report.LoadFromFile(GridReportUtility.GetReportTemplatePath() + "YFSearch.grf"); this.Text = "应付款查询"; } else { Report.LoadFromFile(GridReportUtility.GetReportTemplatePath() + "YSSearch.grf"); this.Text = "应收款查询"; } //ReportReprove(TypeName); //父报表 Report.DetailGrid.Recordset.ConnectionString = GridReportUtility.GetDatabaseConnectionString(); Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(Report_Initialize); Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(Report_FetchRecord); //设定查询显示器关联的报表 this.axGRDisplayViewer1.Report = Report; this.axGRDisplayViewer1.Start(); }
public void AttachReport(GridppReport Report) { //设定查询显示器关联的报表 axGRPrintViewer1.Report = Report; }
public void Produce_dt() { DataTable dt=new DataTable(); this.progressBar1.Maximum = 7; this.progressBar1.Value = 0; string TJwhere_ = ""; if (this.Tjwhere != "" && Tjwhere.IndexOf("T_Receipt_Main_Det") != -1) { TJwhere_ = Tjwhere.Replace(" T_Receipt_Main_Det", "T_Stock_status"); if (TJwhere_.IndexOf("T_Stock_status.MatName") != -1) TJwhere_ = TJwhere_.Replace("T_Stock_status.MatName", " t_matinf.matname"); if (TJwhere_.IndexOf("T_Stock_status.SourceStoreH") != -1) TJwhere_ = TJwhere_.Replace("T_Stock_status.SourceStoreH", "T_Stock_status.storeHouseid"); } string sql_ = "select T_Stock_status.storeHouseid," + "T_Stock_status.matid," + "T_matinf.matname," + "T_Stock_status.mattype," + "T_Stock_status.firstcount," + "T_Stock_status.firstmoney " + " from T_Stock_status,T_matinf " + " where T_Stock_status.matid=T_matinf.matid " // + " and T_Stock_status.balanceTime='201108'"; // + TJwhere_ + " and T_Stock_status.balanceTime='" + this.TjMaxBatime + "'"; dt = (new SqlDBConnect()).Get_Dt(sql_); string ck_, matid_, matname_, lx_; Double Nqc=0.0;//期初数量 Double Moneyqc=0.0;//期初金额 for (int m = 0; m < dt.Rows.Count; m++) { ck_ = dt.Rows[m]["storeHouseid"].ToString().Trim(); matid_ = dt.Rows[m]["matid"].ToString().Trim(); matname_ = dt.Rows[m]["matname"].ToString().Trim(); lx_ = dt.Rows[m]["mattype"].ToString().Trim(); if (dt.Rows[m]["firstcount"].ToString().Trim() == "") Nqc = 0; else Nqc = Convert.ToDouble(dt.Rows[m]["firstcount"].ToString().Trim()); if (dt.Rows[m]["firstmoney"].ToString().Trim() == "") Moneyqc = 0.0; else Moneyqc = Convert.ToDouble(dt.Rows[m]["firstmoney"].ToString().Trim()); dr = Dtb.NewRow(); dr["卡片编号"] = matid_; dr["卡片名称"] = matname_; dr["仓库"] = ck_; dr["类型"] = lx_; dr["期初数量"] = Nqc; dr["期初成本"] = Moneyqc; dr["收入数量"] = 0.0; dr["收入成本"] = 0.0; dr["发出数量"] = 0.0; dr["发出成本"] = 0.0; dr["结存数量"] = 0.0; dr["结存成本"] = 0.0; Dtb.Rows.Add(dr); } this.progressBar1.Value = 1; Update_Dts_In(this.TjPretime,"add");//所选时间区间前一天到月初的数据 this.progressBar1.Value = 2; Update_Dts_In(this.TjWhen, "edit");//所选时间区间内发生的数据 this.progressBar1.Value = 3; Update_Dts_Out(TjPretime, "add"); this.progressBar1.Value = 4; Update_Dts_Out(this.TjWhen, "edit"); this.progressBar1.Value = 5; double f1 = 0.0, f2 = 0.0, f3 = 0.0; for (int m = 0; m < Dtb.Rows.Count; m++) { dr = Dtb.Rows[m]; if (dr["期初数量"].ToString().Trim() == "") f1 = 0; else f1 = Convert.ToDouble(dr["期初数量"].ToString().Trim()); if (dr["收入数量"].ToString().Trim() == "") f2 = 0; else f2 = Convert.ToDouble(dr["收入数量"].ToString().Trim()); if (dr["发出数量"].ToString().Trim() == "") f3 = 0; else f3 = Convert.ToDouble(dr["发出数量"].ToString().Trim()); dr["结存数量"] = f1 + f2 - f3; if (dr["期初成本"].ToString().Trim() == "") f1 = 0; else f1 = Convert.ToDouble(dr["期初成本"].ToString().Trim()); if (dr["收入成本"].ToString().Trim() == "") f2 = 0; else f2 = Convert.ToDouble(dr["收入成本"].ToString().Trim()); if (dr["发出成本"].ToString().Trim() == "") f3 = 0; else f3 = Convert.ToDouble(dr["发出成本"].ToString().Trim()); dr["结存成本"] = f1 + f2 - f3; } this.progressBar1.Value = 6; for (int i = 0; i < this.Dtb.Rows.Count; i++) { //double firstNum = Convert.ToDouble(Dtb.Rows[i]["期初数量"].ToString().Trim()); //double inNum = Convert.ToDouble(Dtb.Rows[i]["收入数量"].ToString().Trim()); //double outNum = Convert.ToDouble(Dtb.Rows[i]["发出数量"].ToString().Trim()); //double sumNum = Convert.ToDouble(Dtb.Rows[i]["结存数量"].ToString().Trim()); //double sumMoney = Convert.ToDouble(Dtb.Rows[i]["结存成本"].ToString().Trim()); //string condition = this.TJnum; //if (Convert.ToBoolean(Microsoft.JScript.GlobalObject.eval(this.TJnum)) == true) //{ //} } //设置与数据源的连接串,因为在设计时指定的数据库路径是绝对路径。 this.newDT = Dtb.Copy(); Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(Report_Initialize); Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(Report_FetchRecord); this.axGRDisplayViewer1.Report = Report; this.axGRDisplayViewer1.Start(); this.progressBar1.Value = 7; }
/// <summary> /// 填充DataTable类型的数据源的数据到报表的明细网格的记录集的对应字段中 /// </summary> /// <param name="rpt"></param> /// <param name="dt"></param> private void FillRecordToReport(GridppReport rpt, DataTable dt) { MatchFieldPairType[] matchFieldPair = new MatchFieldPairType[System.Math.Min(report.DetailGrid.Recordset.Fields.Count, dt.Columns.Count)]; int matchFieldPairIndex = 0; for (int i = 0; i < dt.Columns.Count; i++) { foreach (IGRField fld in report.DetailGrid.Recordset.Fields) { if (string.Compare(fld.Name, dt.Columns[i].ColumnName, true) == 0) { matchFieldPair[matchFieldPairIndex].field = fld; matchFieldPair[matchFieldPairIndex].MatchColumnIndex = i; matchFieldPairIndex++; break; } } } foreach (DataRow dr in dt.Rows) { report.DetailGrid.Recordset.Append(); foreach (MatchFieldPairType fieldPair in matchFieldPair) { if(!dr.IsNull(fieldPair.MatchColumnIndex)) fieldPair.field.Value = dr[fieldPair.MatchColumnIndex]; } report.DetailGrid.Recordset.Post(); } }
/// <summary> /// 填充DataReader类型的数据源的数据到报表的明细网格的记录集的对应字段中 /// </summary> /// <param name="rpt"></param> /// <param name="dr"></param> private void FillRecordToReport(GridppReport rpt, IDataReader dr) { MatchFieldPairType[] matchFieldPair = new MatchFieldPairType[System.Math.Min(report.DetailGrid.Recordset.Fields.Count, dr.FieldCount)]; int matchFieldPairIndex = 0; for (int i = 0; i < dr.FieldCount; i++) { foreach (IGRField fld in report.DetailGrid.Recordset.Fields) { if (string.Compare(fld.Name, dr.GetName(i)) == 0) { matchFieldPair[matchFieldPairIndex].field = fld; matchFieldPair[matchFieldPairIndex].MatchColumnIndex = i; matchFieldPairIndex++; break; } } } while (dr.Read()) { report.DetailGrid.Recordset.Append(); foreach (MatchFieldPairType fieldPair in matchFieldPair) { if (!dr.IsDBNull(fieldPair.MatchColumnIndex)) { fieldPair.field.Value = dr.GetValue(fieldPair.MatchColumnIndex); } } report.DetailGrid.Recordset.Post(); } }
public bool SetReportFile(string reportName, string reportTitle) { string fileName = string.Format("{0}\\{1}.grf", locationReportFiles, reportName); try { if (File.Exists(fileName)) { report.LoadFromFile(fileName); report.Title = reportTitle; return true; } else { report = null; return false; } } catch (Exception ex) { MessageBox.Show(ex.Message + " 未能成功加载报表样式文件!"); report = null; return false; } }
//public const string GetDatabaseConnectionString() = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\..\..\..\Data\Northwind.mdb"; //此函数用来注册Grid++Report,使Grid++Report不会运行在试用版状态下,你必须在你的应用程序启动时调用此函数 //用你自己的序列号代替"BS530DTAS2","BS530DTAS2"是一个无效的序列号 public static void RegisterGridppReport() { GridppReport TempGridppReport = new GridppReport(); bool Succeeded = TempGridppReport.Register("BS530DTAS2"); if (!Succeeded) System.Windows.Forms.MessageBox.Show("Register Grid++Report Failed, Grid++Report will run in trial mode.", "Register", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); }
public void ShowReport() { switch (ReiceName) { case "JHDetail": Report.LoadFromFile(GridReportUtility.GetReportTemplatePath() + "JHDetail.grf"); this.Text = "进货单明细"; break; case "XSDetail": Report.LoadFromFile(GridReportUtility.GetReportTemplatePath() + "XSDetail.grf"); this.Text = "销售单明细"; break; case "WXBorrow": Report.LoadFromFile(GridReportUtility.GetReportTemplatePath() + "WXBorrowSearch.grf"); this.Text = "未销借用查询"; break; case "WXRent": Report.LoadFromFile(GridReportUtility.GetReportTemplatePath() + "WXRentSearch.grf"); this.Text = "未销租机查询"; break; case "YSSearch": Report.LoadFromFile(GridReportUtility.GetReportTemplatePath() + "YSSearch.grf"); this.Text = "应收核销查询"; break; case "YFSearch": Report.LoadFromFile(GridReportUtility.GetReportTemplatePath() + "YFSearch.grf"); this.Text = "应收核销查询"; break; case "ReceivableReport": Report.LoadFromFile(GridReportUtility.GetReportTemplatePath() + "ReceivableReport.grf"); this.Text = "应收核销查询"; break; case "YFKSearch": Report.LoadFromFile(GridReportUtility.GetReportTemplatePath() + "YFKSearch.grf"); this.Text = "预付款查询"; break; case "YSKSearch": Report.LoadFromFile(GridReportUtility.GetReportTemplatePath() + "YFKSearch.grf"); this.Text = "预付款查询"; break; case "PayableReport": Report.LoadFromFile(GridReportUtility.GetReportTemplatePath() + "PayableReport.grf"); this.Text = "应付核销查询"; break; default: return; } Report.DetailGrid.Recordset.ConnectionString = GridReportUtility.GetDatabaseConnectionString(); Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(Report_Initialize); //Report.ProcessRecord += new _IGridppReportEvents_ProcessRecordEventHandler(Report_ProcessRecord); //设定查询显示器关联的报表 this.axGRDisplayViewer1.Report = Report; this.axGRDisplayViewer1.Start(); //滚动条归零 this.progressBar1.Value = 0; }
public PreviewForm(GridppReport report) : this() { this.axGRPrintViewer1.Report = report; }