zoukankan      html  css  js  c++  java
  • 锐浪报表多个子报表赋值

    源代码如下:有疑问这咨询QQ:1204409478

     下面的所有主报表和子报表全部都来自一个GRF报表文件,所以只加载一次。

    下面的代码演示是从数据库动态添加数据到各个子报表

    #region 小票打印
    GridppReport PReport = new GridppReport();//主报表
    GridppReport ReportMain = new GridppReport();//子报表
    GridppReport ReportGoods = new GridppReport();//子报表
    GridppReport ReportPay = new GridppReport();//子报表

    private void ResceiptPrint()
    {
    try
    {
    DirectoryInfo dir = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory);
    string callBackPath = dir.FullName + "\"; //自动升级完成后,要启动的exe的完整路径。
    //载入报表模板数据
    PReport.LoadFromFile(callBackPath + "\Grf\Pos\Reg.grf");

    PReport.ControlByName("SubReport1").AsSubReport.Report = ReportMain;
    PReport.ControlByName("SubReport2").AsSubReport.Report = ReportGoods;
    PReport.ControlByName("SubReport3").AsSubReport.Report = ReportPay;

    ReportMain.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(PReportMain);
    ReportGoods.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(SonReportGoods);
    ReportPay.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(SonReportPay);

    PReport.Print(false);
    }
    catch(Exception)
    {
    MessageBox.Show("小票打印异常!","提示");
    }

    }

    private void PReportMain()
    {
    ReportMain.DetailGrid.Recordset.ConnectionString = "Provider=SQLOLEDB.1;...";
    ReportMain.DetailGrid.Recordset.QuerySQL = "SELECT ...";
    }

    private void SonReportGoods()
    {
    ReportGoods.DetailGrid.Recordset.ConnectionString = "Provider=SQLOLEDB.1;...";
    ReportGoods.DetailGrid.Recordset.QuerySQL = @"SELECT ... ";
    }

    private void SonReportPay()
    {
    ReportPay.DetailGrid.Recordset.ConnectionString = "Provider=SQLOLEDB.1;...";
    ReportPay.DetailGrid.Recordset.QuerySQL = @"SELECT ... ";

    }
    #endregion

  • 相关阅读:
    Tribonacci UVA 12470 (简单的斐波拉契数列)(矩阵快速幂)
    P1091 合唱队形
    P1481 魔族密码 (LIS)
    xiaowuga poj3735—Training little cats(特殊操作转化为矩阵操作)
    P2665 [USACO08FEB]连线游戏Game of Lines
    1875 丢手绢 (模拟+打表)
    Recurrences UVA 10870 (斐波拉契的一般形式推广)
    Choosing number ZOJ 3690 (矩阵快速幂)
    根据屏幕文件生成RPG代码的思路
    基于配置文件的查询,xml文件sample
  • 原文地址:https://www.cnblogs.com/hefy/p/5052097.html
Copyright © 2011-2022 走看看