机房收费系统——日账单

关于报表的学习请看上一篇博客:

点击此处: 账单---Grid++Report报表设计器

 

日账单:

Private Sub Form_Load()
      Dim txtsql As String
      Dim noda As String
      noda = Now
      
      
      txtsql = "select * from checkday_info where date='" & Format(Date, "yyyy-mm-dd") & "'"
      Set report = New grproLibCtl.GridppReport '实例化模板
      
      '加载模板
      report.LoadFromFile (App.Path & "\日报表.grf")
      '连接数据源
      report.DetailGrid.Recordset.ConnectionString = ConnectString()
      '通过select查询创建记录集,只查询
      report.DetailGrid.Recordset.QuerySQL = txtsql
      
      '显示当前的日期
      report.ParameterByName("Parameter12").AsString = noda

      '显示编号
      report.ParameterByName("Parameter9").AsString = Username
      
      GRDisplayViewer1.report = report     '将数据赋给GRD的report
      GRDisplayViewer1.Start   '在报表中显示
      
End Sub

日账单刷新:

 

Private Sub cmdRefur_Click()
      '账单刷新
      GRDisplayViewer1.Refresh
      
End Sub

 账单打印:

Private Sub cmdReport_Click()

'打印,因为报表对象的print方法名与vb的内部定义有冲突所以要用中括号
       report.[Print] (True)
End Sub

账单浏览

Private Sub cmdLook_Click()
      report.PrintPreview (True)      '打印预览

End Sub

 

你可能感兴趣的:(机房收费系统——日账单)