机房收费系统中的Grid++Report报表设计器的应用
在进行账单查询功能的时候我应用了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报表设计器的应用的更多相关文章
- 如何在CRM系统中集成ActiveReports最终报表设计器
有时候,将ActiveReports设计器集成到业务系统中,为用户提供一些自定义的数据表,用户不需要了解如何底层的逻辑关系和后台代码,只需要选择几张关联的数据表,我们会根据用户的选择生成可供用户直接使 ...
- Java开发报表——Grid++Report 报表设计器
为了让数据显示的更加形象生动,报表在项目中差点儿是很常见的,可是大致能够分为两类: 一,图形:以图形的形式显示数据,比如柱状图,折线图,饼形图等等,这里有许多关于这方面的工具,比如JFreeChart ...
- UniGui中使用Grid++Report报表控件子报表获取数据的方法
Grid++Report是为优秀的报表控件,子报表是其重要功能之一,但Grid++Report提供的网页报表示范主要是以页面为主的,UniGui在Delphi中以快速编写web管理软件著称,但由于资料 ...
- 机房收费系统之vb报表的模板的制作(一)
机房收费系统有报表的功能,报表对于我们来说有点陌生.这不是会计的事吗?怎么机房收费系统也參合进来了,事实上我们学会了报表的步骤.理解了代码后.报表变得不是非常难,世上无难事,仅仅怕肯登攀 ...
- 机房收费系统——在VB中将MSHFlexGrid控件中的数据导出到Excel
机房收费系统中,好多查询的窗体都包含同一个功能:将数据库中查询到的数据显示在MSHFlexGrid控件中,然后再把MSHFlexGrid控件中的数据导出到Excel表格中. 虽然之前做过学生信息管理系 ...
- VB查询数据库之终极篇——机房收费系统总结(七)
机房收费系统总结系列到此就算是要结束了.在做机房收费系统之前,做了学生管理系统,可以说,对机房收费系统的帮助很大. 在机房收费系统中,数据库的查询,数据写入数据库,更改数据库内的信息等一些操作在学生信 ...
- 机房收费系统(VB.NET)——存储过程实战
最初接触存储过程是在耿建玲老师的视频里,当初仅仅是草草过了一遍.仅仅是有了个印象.知道了这个名词:大二时也有SqlServer数据库这门课,只是老师没讲,自己也没看:真正对存储过程的了解来自于自学考试 ...
- 机房收费系统个人重构关于SQLHelper
近期在敲机房,对于SQLHelper也是心里有些怵,由于原来没用过,可是看了一些博客和资料后发现,假设不用这个类,会大大添加代码量,并且,事实上它并不新,它是一个有多个关于数据库增删改查操作的语句函数 ...
- VB.NET<机房收费系统个人重构版>你都学会了什么(之五)
接着上篇我们说的配置文件,今天我们来说一下接口. 1.UML图 2.三层架构 3.Sqlhelper 4.配置文件 5.接口 6.设计模式 什么是接口呢?我们可以将接口理解为用于沟通的中介的抽象化.可 ...
随机推荐
- Sonar入门(五):使用 Sonar 进行代码质量管理
Sonar 概述 Sonar 是一个用于代码质量管理的开放平台.通过插件机制,Sonar 可以集成不同的测试工具,代码分析工具,以及持续集成工具. 与持续集成工具(例如 Hudson/Jenkins ...
- DB2查询当前时间与指定时间的时间差(相隔的秒数)
DB2查询当前时间与指定时间的时间差(相隔的秒数). 例子:“拍品表 auct_item”中有个“结束时间 end_date”的字段,求结束时间与当前时间的间隔秒数. select (DAYS(a. ...
- Network 20Q--Q2 How does Google sell ad spaces?
在使用Google搜索的时候会发现,搜索出来的页面除了在左边显示搜索结果以外,还会页面的右边推荐一些广告.那么Google是怎么从这些广告挣钱以及广告商可以通过Google广告获得什么利益呢? Goo ...
- Filter过滤器实现登录检查
主要利用filter过滤掉未经登录而直接跳转到非登录访问页面.代码而言的话并不难,只是有几点问题需要注意一下. 1.使用filter需要配置web.xml,如果是/*那么在拦截后的页面会连带jsp页面 ...
- Tomcat 原理篇
TOMCAT 原理篇一.Tomcat 组成(Tomcat 由以下组件组成) 1.server a) Server是一个Catalina Servlet容器: b) Server 可以包含一个或多个se ...
- Android--------- SD卡存储文件报错解决
##文件找不到 1.没有写write权限 2.没有判断文件夹是否存在,不存在则创建
- 查看Sql语句执行速度
原文链接:http://www.cnblogs.com/New-world/archive/2012/11/28/2793560.htmlMS_SQL模糊查询like和charindex的对比 lik ...
- C#调用进程
Process process = new Process(); process.StartInfo.FileName = "123.exe"; process.StartInfo ...
- hdu 5671 矩阵变换
Matrix Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Su ...
- HDU 4810 这道题 是属于什么类型?
统计每一位出现1的个数 求组合数 直接贴代码 #include <iostream> #include <cstdio> #include <cmath> #in ...