• 机房收费系统之报表总结2


     

    在上一篇中已经说了如何构建报表模板,接下来就是用vb调用报表模板以此来实现报表的输出。下面是一些具体的过程:

     

    ’定义报表
    Dim Report As grproLibCtl.GridppReport
    
    Private Sub cmdPrint_Click()
    
    ‘打印报表
    
        Report.[Print] (True)
    
    End Sub
    
     
    
    Private Sub cmdPrintPreview_Click()
    
    ’打印预览
    
        Report.PrintPreview (True)
    
    End Sub
    
    Private Sub cmdRefresh_Click()
    
    ‘刷新报表
    
        txtSQL = "select * from daybill_Info where daydate='" & Format(Date, "yyyy-mm-dd") & "'"
    
        Report.DetailGrid.Recordset.QuerySQL = txtSQL
    
        GRDisplayViewer1.Refresh
    
    End Sub
    
    Private Sub Form_Load()
    
     '将日结账单以报表形式显示出来
    
        '建立查询语句
    
        txtSQL = "select * from daybill_Info where daydate='" & Format(Date, "yyyy-mm-dd") & "'"
    
        '创建报表对象
    
        Set Report = New grproLibCtl.GridppReport
    
        '载入报表模板文件
    
        Report.LoadFromFile (App.Path & "报表日结账单1.grf")
    
        '设置数据连接串
    
        Report.DetailGrid.Recordset.ConnectionString = ConnectionString()
    
        '载入查询语句
    
        Report.DetailGrid.Recordset.QuerySQL = txtSQL
    
        '显示报表中的内容
    
        GRDisplayViewer1.Report = Report
    
        GRDisplayViewer1.Start
    
    End Sub
    

    而在周结账单中只要引进参数即可:

    '设置报表参数

        Report.ParameterByName("datestart").AsString = Str(startTime.Value)

        Report.ParameterByName("dateend").AsString = endTime.Value

     

  • 相关阅读:
    用dockerFile和docker build命令 创建带两个数据卷的新镜像
    Docker 学习 3 镜像更多命令 docker commit 提交容器副本,使之成为一个新的镜像
    Docker学习笔记 2 更多的容器命令
    Docker的学习1 安装 与 基础篇
    SeekBar(拖动条)
    本周总结
    ProgressBar(进度条)
    Android对话框
    css语法
    css基础
  • 原文地址:https://www.cnblogs.com/keanuyaoo/p/3397853.html
Copyright © 2020-2023  润新知