在进行账单查询功能的时候我应用了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. Git实现从本地加入项目到远程仓库

    Git是如今最流行的版本号控制系统之中的一个了,今天也试试了.成功了上传了远程仓库,接下来看看我是怎么做的. 1.首先,要有git的账号.点击查看怎么注冊? 2.注冊成功之后.登陆GitHub.然后, ...

  2. Linux的启动流程

    1.首先是bios加电自检.初始化,这个过程会检测相关硬件(cpu.内存.硬盘等),然后会读取硬盘中的MBR:2.加载内核,读取/boot里边的配置文件:3.启动初始化进程,开始运行/sbin/ini ...

  3. arraylist与List<>

    arraylist 不用规定 类型 list<>用规定类型 推荐list 这个编译检查类型  出错率低 代码质量高

  4. Jquery常用方法(转)

    原文:http://www.cnblogs.com/Chenfengtao/archive/2012/01/12/2320490.html jQuery是目前使用最广泛的javascript函数库.据 ...

  5. poj2785 简单二分

    4 Values whose Sum is 0 Time Limit: 15000MS   Memory Limit: 228000K Total Submissions: 19243   Accep ...

  6. .Net 插入数据MySql数据库,中文乱码解决问题

    1, 修改mysql根目录下配置文件my.ini,在[client]节点下添加default-character-set=utf8 ,在[mysqld]节点下添加character_set_serve ...

  7. Oracle11g R2学习系列 之二基本概念和环境介绍

    昨天安装好了之后,发现用Chrome打开OEM发现是英文的,搞得我好奇怪:安装时明明自动显示的是中文的,为何会是英文的呢.后来想想会不会是Oracle用的是浏览器的语言呢,果断打开Chrome的设置, ...

  8. Python一路走来 Python算法

    冒泡排序: 1,2位置左右比较.大的排右边,继续比较2,3 ...... list=[5,7,2,8,12,1] #print(len(list)) for j in range(len(list)) ...

  9. python之6-4装饰器.md

    装饰器看的说实话真心郁闷,群里一伙计说了好一会,听得一愣一愣的,查了点资料,又自己试了下,算是明白了一些,记录记录=.=更郁闷的是,博客园的markdown标记支持怎么和为知的不匹配,这转过来的文章很 ...

  10. Android广播机制(转)

    1.Android广播机制概述 Android广播分为两个方面:广播发送者和广播接收者,通常情况下,BroadcastReceiver指的就是广播接收者(广播接收器).广播作为Android组件间的通 ...