<>思路
日、周结账最大的难度应带就是预备开始的动作,也就是所谓的报表工作,至于报表的建立,在这里我就不做详细解说,因为已经有很多英雄作出了贡献。尽管是在考试之前就弄好了,但如今再重新弄一遍,依旧收获满满。反而更加的理解了。说白了也就是
结账-日结账-周结账三者间的传递关系
<>代码
日结账单
rem:打印 Report.[Print] True rem:打印预览 Report.PrintPreview (True) rem:日结账单刷单
GRDisplayViewer1.Refresh rem:加载 txtsql = "select * from checkday_info where
date='" & Format(Date, "yyyy-MM-dd") & "'" Set Report = New
grproLibCtl.GridppReport '实例化模板 Report.LoadFromFile (App.Path & "\day报表.grf")
'加载模板 Report.DetailGrid.Recordset.ConnectionString = ConnectString '连接数据库
Report.DetailGrid.Recordset.QuerySQL = "select * from checkday_info" '显示报表中的内容
GRDisplayViewer1.Report = Report GRDisplayViewer1.Start
周结帐单
If DTP1.Value > DTP2.Value Then MsgBox "终止时间不能大于起始时间" Exit Sub End If daysql =
"select * from CheckDay_Info where date between'" & Format(DTP1.Value,
"yyyy-mm-dd") & "'" & "and'" & Format(DTP2.Value, "yyyy-mm-dd") & "'" Set
mrcday = ExecuteSQL(txtsql, msgtext) weeksql = "select * from checkweek_info"
Set mrcweek = ExecuteSQL(weeksql, msgtext) Do While Not mrcweek.EOF
mrcweek.Delete mrcweek.MoveNext Loop Do While Not mrcweek.EOF With mrcweek
.AddNew .Fields(0) = mrcday.Fields(0) .Fields(1) = mrcday.Fields(1) .Fields(2)
= mrcday.Fields(2) .Fields(3) = mrcday.Fields(3) .Fields(4) = mrcday.Fields(4)
.Fields(5) = mrcday.Fields(5) .Update mrcday.MoveNext End With Loop
GRDisplayViewer1.Refresh Report.DetailGrid.Recordset.QuerySQL = daysql
Report.ParameterByName("enddate").Value = Format(DTP2.Value, "yyyy/mm/dd")
'显示开始时间 Report.ParameterByName("BeginDate").Value = Format(DTP1.Value,
"yyyy/mm/dd") '显示结束时间
<>总结
多看帮助,少走弯路
热门工具 换一换