在进行账单查询功能的时候我应用了Grid++Report报表设计器,下面我就为大家介绍一下,还望大家多多指点。

首先,在Grid++Report报表设计器中进行报表界面的设置。在属性编辑窗口中这里对报表头、标题行、内容行进行设置,具体的操作不在赘述,我设计的报表界面如下所示。

其次,在机房收费系统项目中的UI层中添加应用,在COM中选择Grid++Report Designer 5.6Type Library和Grid++Report Engine Plugin 5.6Type Library。

再次,在代码编辑器中加入Grid++Report类型库名字空间引用,即为Imports grproLib。

最后在代码编辑器中进行编辑,来应用报表设计器进行账单查询:

'加入Grid++Report类型库名字空间引用
Imports grproLib
''' <summary>
''' 查询账单
''' </summary>
''' <remarks></remarks>
Public Class frmQueryItemsBill
'定义Grid++Report报表主对象
Private Report As New GridppReport
Dim NameField As grproLib.IGRField
'上次消费余额
Dim PriorperiodCashField As IGRField
'本期充值金额
Dim CurrentCreditField As IGRField
'本期消费金额
Dim CurrentConsumptionField As IGRField
'本期退卡金额
Dim CurrentAmountrefundedField As IGRField
'本期总金额
Dim CurrentCashField As IGRField
'结账时间
Dim DateField As IGRField ''' <summary>
''' 加载账单
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub frmQueryItemsBill_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'载入报表模板数据
Report.LoadFromFile(GetReportTemplatePath() + "Bill.grf")
'连接报表事件
AddHandler Report.Initialize, AddressOf ReportInitialize
AddHandler Report.FetchRecord, AddressOf ReportFetchRecord
'设定查询显示器关联的报表
AxGRDisplayViewer1.Report = Report DateTimePicker1.Value = New DateTime(Year(Now), Month(Now), 1)
DateTimePicker2.Value = New DateTime(Year(Now), Month(Now), 1)
PriorperiodCashField = Report.FieldByName("PriorperiodCash")
CurrentCreditField = Report.FieldByName("CurrentCredit")
CurrentConsumptionField = Report.FieldByName("CurrentConsumption")
CurrentAmountrefundedField = Report.FieldByName("CurrentAmountrefunded")
CurrentCashField = Report.FieldByName("CurrentCash")
DateField = Report.FieldByName("Date") AxGRDisplayViewer1.Start()
End Sub ''' <summary>
''' 刷新
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub btnFreshen_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFreshen.Click
If CStr(DateTimePicker1.Value) > CStr(DateTimePicker2.Value) Then
MsgBox("对不起起始时间应该小于结束时间")
Exit Sub
End If
AxGRDisplayViewer1.Stop()
AxGRDisplayViewer1.Start()
End Sub ''' <summary>
''' 打印预览
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub btnPreview_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPreview.Click
Report.PrintPreview(True)
End Sub ''' <summary>
''' 打印
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub btnPrinter_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPrinter.Click
Report.Print(True)
End Sub ''' <summary>
''' 报表初始化
''' </summary>
''' <remarks></remarks>
Private Sub ReportInitialize()
Report.ControlByName("SubTitle").AsStaticBox.Text = _
"从" + CStr(DateTimePicker1.Value) + "至" + CStr(DateTimePicker2.Value)
End Sub Public Function GetReportTemplatePath() As String
Dim FileName As String = Application.StartupPath.ToLower()
Dim Index As Integer = FileName.LastIndexOf("bin")
FileName = FileName.Substring(0, Index)
GetReportTemplatePath = FileName End Function ''' <summary>
''' 添加报表记录
''' </summary>
''' <remarks></remarks>
Private Sub ReportFetchRecord()
'定义开始结账实体
Dim entityBeginAccount As New Entity.AccountInfoEntity
'定义结束结账实体
Dim entityEndAccount As New Entity.AccountInfoEntity
'定义B层结账
Dim bllAccount As New BLL.AccountBLL
'定义数据表
Dim dt As DataTable
'定义返回的数据行
Dim intRows As Integer entityBeginAccount.BookDate = DateTimePicker1.Value
entityEndAccount.BookDate = DateTimePicker2.Value
dt = bllAccount.InquiryAccount(entityBeginAccount, entityEndAccount) '添加账单记录
intRows = dt.Rows.Count
For intRows = 0 To (intRows - 1)
Report.DetailGrid.Recordset.Append()
PriorperiodCashField.AsInteger = dt.Rows(intRows).Item("PriorAmount")
CurrentCreditField.AsInteger = dt.Rows(intRows).Item("RechargeAmount")
CurrentConsumptionField.AsInteger = dt.Rows(intRows).Item("ConsumeAmount")
CurrentAmountrefundedField.AsInteger = dt.Rows(intRows).Item("RemoveCardAmount")
CurrentCashField.AsInteger = dt.Rows(intRows).Item("TotalAmount")
DateField.AsString = dt.Rows(intRows).Item("BookDate")
Report.DetailGrid.Recordset.Post()
Next End Sub

因为B层和D层的代码不涉及Grid++report的应用我就不为大家展示。账单查询界面如下图所示:

这是我用的添加查询记录的方法。开始我本来是想将DataTable中的数据以单元格的形式循环遍历到到Grid++report中,但是未能实现,望有高手多多指教。

机房收费系统中的Grid++Report报表设计器的应用的更多相关文章

  1. 如何在CRM系统中集成ActiveReports最终报表设计器

    有时候,将ActiveReports设计器集成到业务系统中,为用户提供一些自定义的数据表,用户不需要了解如何底层的逻辑关系和后台代码,只需要选择几张关联的数据表,我们会根据用户的选择生成可供用户直接使 ...

  2. Java开发报表——Grid++Report 报表设计器

    为了让数据显示的更加形象生动,报表在项目中差点儿是很常见的,可是大致能够分为两类: 一,图形:以图形的形式显示数据,比如柱状图,折线图,饼形图等等,这里有许多关于这方面的工具,比如JFreeChart ...

  3. UniGui中使用Grid++Report报表控件子报表获取数据的方法

    Grid++Report是为优秀的报表控件,子报表是其重要功能之一,但Grid++Report提供的网页报表示范主要是以页面为主的,UniGui在Delphi中以快速编写web管理软件著称,但由于资料 ...

  4. 机房收费系统之vb报表的模板的制作(一)

           机房收费系统有报表的功能,报表对于我们来说有点陌生.这不是会计的事吗?怎么机房收费系统也參合进来了,事实上我们学会了报表的步骤.理解了代码后.报表变得不是非常难,世上无难事,仅仅怕肯登攀 ...

  5. 机房收费系统——在VB中将MSHFlexGrid控件中的数据导出到Excel

    机房收费系统中,好多查询的窗体都包含同一个功能:将数据库中查询到的数据显示在MSHFlexGrid控件中,然后再把MSHFlexGrid控件中的数据导出到Excel表格中. 虽然之前做过学生信息管理系 ...

  6. VB查询数据库之终极篇——机房收费系统总结(七)

    机房收费系统总结系列到此就算是要结束了.在做机房收费系统之前,做了学生管理系统,可以说,对机房收费系统的帮助很大. 在机房收费系统中,数据库的查询,数据写入数据库,更改数据库内的信息等一些操作在学生信 ...

  7. 机房收费系统(VB.NET)——存储过程实战

    最初接触存储过程是在耿建玲老师的视频里,当初仅仅是草草过了一遍.仅仅是有了个印象.知道了这个名词:大二时也有SqlServer数据库这门课,只是老师没讲,自己也没看:真正对存储过程的了解来自于自学考试 ...

  8. 机房收费系统个人重构关于SQLHelper

    近期在敲机房,对于SQLHelper也是心里有些怵,由于原来没用过,可是看了一些博客和资料后发现,假设不用这个类,会大大添加代码量,并且,事实上它并不新,它是一个有多个关于数据库增删改查操作的语句函数 ...

  9. VB.NET<机房收费系统个人重构版>你都学会了什么(之五)

    接着上篇我们说的配置文件,今天我们来说一下接口. 1.UML图 2.三层架构 3.Sqlhelper 4.配置文件 5.接口 6.设计模式 什么是接口呢?我们可以将接口理解为用于沟通的中介的抽象化.可 ...

随机推荐

  1. Dynamics CRM 开发模板使用手册(插件开发)

    CRM开发手册 本手册介绍在Visual Studio 2015 + Dynamics CRM Developer Extensions模板开发环境下,插件和JS脚本的开发.部署与调试过程. 手册中提 ...

  2. Word文档分割总结

    Word文档分割总结 方法: 1. word创建子文件实现文件分割 2. VBA实现 3. 网上分割合并的插件软件 一. word创建子文件实现文件分割 打开需要分割的文件 >> 视图 & ...

  3. html5图片标签与属性

    标记:  标 记  说 明 <lmg> 图像 <Map> 图像映射 <Area> 图像映射中定义区域 <lmg>标记属性:  属 性  说 明 Src ...

  4. css布局详解(二)——标准流布局(Nomal flow)

    css标准流布局(Nomal flow) 一.正常流 这是指西方语言中文本从左向右,从上向下显示,这也是我们熟悉的传统的HTML文档中的文本布局.注意,在非西方的语言中,流方向可能不同.大多数元素都在 ...

  5. 可用与禁用 E:enabled { sRules }

    <!DOCTYPE html><html lang="zh-cmn-Hans"><head><meta charset="utf ...

  6. Silverlight 设置颜色

    透明色:00ff00ff //设置柱状图的颜色                ColorSet cs = new ColorSet();                cs.Id = "co ...

  7. log4net 使用步骤

    1.安装log4net 官网首页:http://logging.apache.org/log4net/ 下载地址:http://logging.apache.org/log4net/download_ ...

  8. UVA 10790 How Many Points of Intersection?

      How Many Points of Intersection?  We have two rows. There are a dots on the top row and b dots on ...

  9. FCKeditor插件开发实例:uploadify多文件上传插件

    FCKeditor是一个专门使用在网页上属于开放源代码的所见即所得文字编辑器.它志于轻量化,不需要太复杂的安装步骤即可使用.它可和PHP.JavaScript.ASP.ASP.NET.ColdFusi ...

  10. 页面每次加载时重新获取css文件

    <script> (function(){ var version=''; var xmlhttp; // code for IE7+, Firefox, Chrome, Opera, S ...