机房收费系统调错总结(一)
来源:互联网 发布:mysql strict mode 编辑:程序博客网 时间:2024/05/21 18:33
上次师傅验收提出了很多问题,也让我进一步理解了机房收费系统里面的逻辑关系,以及设计一个软件如何更好的使它人性化,更好的服务用户,这才是软件设计者应该时刻谨记的----服务用户。
问题一:结账
结账窗体和注册窗体、充值窗体、退卡窗体是紧密联系在一起的。
结账中的操作员应该是登陆者,而登陆者是由注册窗体中的UserId所赋值的(这里我一开始把userid赋值错了,导致不能出现该操作者的所有信息),该操作者所注册的卡号,充值的卡号,以及所退的卡号,都会一一在结账窗体中呈现。
这里所呈现在各个MSFlexGrid的内容都被封装在一个函数中:
Private Sub viewdate() '根据已经选择好的人员信息来修改SSTab里面的汇总信息 Dim txtSQL As String Dim MsgText As String Dim Smsgtext As String Dim mrcSD As ADODB.Recordset Dim mrcRC As ADODB.Recordset Dim mrcCC As ADODB.Recordset Dim mrclin As ADODB.Recordset Dim mrcS As ADODB.Recordset Dim RechargeCash As Variant '用于存储 充值的 所有金额 Dim cancelCash As Variant '用于存储 退钱的 所有金额 Dim linshiCash As Variant '用户存储 临时收费的所有金额 '把操作员的所有信息,未结账的显示出来 学生表 txtSQL = "select studentno,cardno,cash,date,time from student_Info where ischeck='未结账' and userid='" & cboUser.Text & "'" Set mrcSD = ExecuteSQL(txtSQL, MsgText) MfgBugCard.Rows = mrcSD.RecordCount + 1 With MfgBugCard .Row = 0 While mrcSD.EOF = False .Row = .Row + 1 .TextMatrix(.Row, 0) = " " & mrcSD.Fields(0) .TextMatrix(.Row, 1) = " " & mrcSD.Fields(1) .TextMatrix(.Row, 2) = " " & mrcSD.Fields(2) .TextMatrix(.Row, 3) = " " & mrcSD.Fields(3) .TextMatrix(.Row, 4) = " " & mrcSD.Fields(4) mrcSD.MoveNext Wend End With '把该操作员的所有未结账的充值信息汇总到表格,一个注册信息对应一个充值信息 txtSQL = "select studentno,cardno,addmoney,date,time from recharge_Info where status='未结账' and userid='" & cboUser.Text & "'" Set mrcRC = ExecuteSQL(txtSQL, MsgText) MfgRecharge.Rows = mrcRC.RecordCount + 1 With MfgRecharge .Row = 0 While mrcRC.EOF = False .Row = .Row + 1 .TextMatrix(.Row, 0) = " " & mrcRC.Fields(0) .TextMatrix(.Row, 1) = " " & mrcRC.Fields(1) .TextMatrix(.Row, 2) = " " & mrcRC.Fields(2) .TextMatrix(.Row, 3) = " " & mrcRC.Fields(3) .TextMatrix(.Row, 4) = " " & mrcRC.Fields(4) RechargeCash = RechargeCash + mrcRC.Fields(2) mrcRC.MoveNext Wend End With '把操作员所有的退卡信息汇总到表格 txtSQL = "select studentno,cardno,cancelcash,date,time from cancelcard_Info where status='未结账' and userid='" & cboUser.Text & "'" Set mrcCC = ExecuteSQL(txtSQL, MsgText) With MfgCancelCard .Row = 0 While mrcCC.EOF = False .Rows = .Rows + 1 .TextMatrix(.Row, 0) = " " & mrcCC.Fields(0) .TextMatrix(.Row, 1) = " " & mrcCC.Fields(1) .TextMatrix(.Row, 2) = " " & mrcCC.Fields(2) .TextMatrix(.Row, 3) = " " & mrcCC.Fields(3) .TextMatrix(.Row, 4) = " " & mrcCC.Fields(4) cancelCash = cancelCash + mrcCC.Fields(2) mrcCC.MoveNext Wend End With '把操作员的临时用户信息汇总到表格 txtSQL = "select studentno,cardno,date,time,cash from student_Info where type='临时用户' and userid='" & cboUser.Text & "'and ischeck='未结账'" Set mrcS = ExecuteSQL(txtSQL, MsgText) If mrcS.EOF Then linshiCash = 0 Else txtSQL = "select * from line_Info where cardno='" & Trim(mrcS.Fields(0)) & "'" Set mrclin = ExecuteSQL(txtSQL, MsgText) MSFlexGrid4.Rows = mrcS.RecordCount + 1 With MSFlexGrid4 While mrcS.EOF = False .Rows = .Rows + 1 .TextMatrix(.Rows - 1, 0) = Trim(mrcS.Fields(0)) .TextMatrix(.Rows - 1, 1) = Trim(mrcS.Fields(1)) .TextMatrix(.Rows - 1, 2) = Trim(mrcS.Fields(2)) .TextMatrix(.Rows - 1, 3) = Trim(mrcS.Fields(3)) .TextMatrix(.Rows - 1, 4) = Trim(mrcS.Fields(4)) linshiCash = linshiCash + Val(Trim(mrclin.Fields(11))) mrclin.MoveNext mrcS.MoveNext Wend End With End If '然后,把操作员的所有统计信息汇总到汇总列表 txtSalecard = mrcSD.RecordCount txtTuikaShu = mrcCC.RecordCount txtreChargeCash = Val(RechargeCash) txtTuikaCash = Val(cancelCash) txtAllSalecard = Val(txtSalecard.Text) - Val(txtTuikaShu.Text) txtReciveCash = Val(txtreChargeCash.Text) - Val(txtTuikaCash.Text) txtLinshiCash.Text = Val(linshiCash) mrcSD.Close mrcRC.Close mrcCC.Close End Sub
然后当点击操作员时调用这个函数,出现相应的信息。
问题二:收取金额查询窗体
(1)充值教师为登陆者
(2)把本卡号注册的金额也要放进来
思路:收取金额查询中的金额是从充值表中获得的,所以现在把注册的金额添加进充值表中即可。
number = Trim(mrcc.Fields(1)) '获得学号 LastCash = Val(Trim(CStr(mrcc.Fields(7)))) '获得注册金额 If mrcc.EOF = False Then Sum = Val(txtRegisterMoney.Text) + Val(mrcc.Fields(7))(3)点击查询时总是循环出现结果
思路:当查询没有数据时先清空MSFlexGrid部件,令其行数为0,当有结果时行数设为1,若出现多条记录,则行数不断加1。
If mrc.EOF Then MsgBox "没有数据!", vbOKOnly + vbExclamation, "提示" MSFlexGrid1.Clear MSFlexGrid1.Rows = 0 Exit Sub Else With MSFlexGrid1 .Rows = 1 .CellAlignment = 4 .ColWidth(0) = 2000 .ColWidth(2) = 2000 .ColWidth(3) = 2000 .TextMatrix(0, 0) = "卡号" .TextMatrix(0, 1) = "充值金额"' .TextMatrix(0, 2) = "本卡注册金额" .TextMatrix(0, 2) = "充值日期" .TextMatrix(0, 3) = "充值时间" .TextMatrix(0, 4) = "充值教师" .TextMatrix(0, 5) = "结账状态" Do While Not mrc.EOF .Rows = .Rows + 1 .CellAlignment = 4 .TextMatrix(.Rows - 1, 0) = Trim(mrc.Fields(2)) .TextMatrix(.Rows - 1, 1) = Trim(mrc.Fields(3))' .TextMatrix(.Rows - 1, 2) = Trim(mrc1.Fields(7)) .TextMatrix(.Rows - 1, 2) = Trim(mrc.Fields(4)) .TextMatrix(.Rows - 1, 3) = Trim(mrc.Fields(5)) .TextMatrix(.Rows - 1, 4) = Trim(mrc.Fields(6)) .TextMatrix(.Rows - 1, 5) = Trim(mrc.Fields(7)) mrc.MoveNext Loop End With End If mrc.Close
0 0
- 机房收费系统调错总结(一)
- 机房收费系统(一)整体总结
- 机房收费系统问题总结(一)
- 机房收费系统之总结(一)
- 机房收费系统总结篇(一)
- 机房收费系统总结(一)
- 机房收费系统总结一
- 机房收费系统调错总结(二)
- 机房收费系统(一)
- 机房收费系统(一)
- 机房收费系统(一)
- 机房收费系统(总结)
- 机房收费系统总结(一)——事务
- 机房收费系统中常见问题总结(一)
- 机房收费系统(一)——优化总结
- 【机房收费系统】——问题总结(一)
- 机房收费系统(一)——上下机、总结
- 机房收费系统之总结一(思想)
- 大型网站的架构设计详解1
- 沈向洋谈做研究的那些事儿
- vsftpd安装配置[ubuntu下亲测可用]
- C中进程管理函数
- 多态
- 机房收费系统调错总结(一)
- ml笔记01
- zip版tomcat(6,7)不能注册成windows服务或者注册后不能启动的问题解决
- unable to open input file:helloworld.asm
- Mac环境下JAVA开发环境搭建
- css2
- 第十五周项目1—程序填空
- Activity 生命周期
- LeetCode-342.Power of Four