机房收费系统之结账
来源:互联网 发布:2017网络机顶盒哪个好 编辑:程序博客网 时间:2024/06/05 08:44
机房结账的时候首先得明白几个点
应收金额是收的哪几部分的金额
临时收费金额收的是哪的金额(临时用户可不可以退卡)
想明白了那就开始吧
代码实现:
Dim txtSQL As StringDim MsgText As StringPrivate Sub Command1_Click()Dim mrc1 As ADODB.RecordsettxtSQL = "select * from student_info where userid='" & comboUserId.Text & "'"Set mrc1 = ExecuteSQL(txtSQL, MsgText) Do While Not mrc1.EOF mrc1!ischeck = "结账" mrc1.Update mrc1.MoveNext Loopmrc1.ClosetxtSQL = "select * from recharge_info where userid='" & comboUserId.Text & "'"Set mrc2 = ExecuteSQL(txtSQL, MsgText) Do While Not mrc2.EOF mrc2!Status = "结账" mrc2.Update mrc2.MoveNext Loopmrc2.CloseMsgBox "结账成功!", vbOKOnly + vbInformation, "提示"End SubPrivate Sub Form_Load()Dim mrc As ADODB.RecordsettxtSQL = "select * from user_info "Set mrc = ExecuteSQL(txtSQL, MsgText)Do While mrc.EOF = False comboUserId.AddItem mrc!UserId mrc.MoveNextLoopEnd SubPrivate Sub SSTab1_Click(PreviousTab As Integer)Text3.Text = "0"Text5.Text = "0"Text4.Text = "0"Select Case SSTab1.Tab Case 0 MSHFlexGrid2.Visible = True Dim mrc2 As ADODB.Recordset txtSQL = "select * from student_info where userid='" & comboUserId.Text & "'" Set mrc2 = ExecuteSQL(txtSQL, MsgText) If mrc2.EOF Then MsgBox "没有记录", vbOKOnly + vbExclamation, "提示" Else With MSHFlexGrid2 .Rows = 2 .CellAlignment = 4 .TextMatrix(1, 0) = "学号" .TextMatrix(1, 1) = "卡号" .TextMatrix(1, 2) = "日期" .TextMatrix(1, 3) = "时间" Do While Not mrc2.EOF .Rows = .Rows + 1 .CellAlignment = 4 .TextMatrix(.Rows - 1, 0) = mrc2.Fields(1) .TextMatrix(.Rows - 1, 1) = mrc2.Fields(0) .TextMatrix(.Rows - 1, 2) = mrc2!Date .TextMatrix(.Rows - 1, 3) = mrc2!Time mrc2.MoveNext Loop End With End If mrc2.Close Case 1 MSHFlexGrid1.Visible = True Dim mrc3 As ADODB.Recordset txtSQL = "select *from recharge_info where userid='" & comboUserId.Text & "'" Set mrc3 = ExecuteSQL(txtSQL, MsgText) If mrc3.EOF Then MsgBox "没有记录!", vbOKOnly + vbExclamation, "提示" Else With MSHFlexGrid1 .Rows = 2 .CellAlignment = 4 .TextMatrix(1, 0) = "学号" .TextMatrix(1, 1) = "卡号" .TextMatrix(1, 2) = "充值金额" .TextMatrix(1, 3) = "日期" .TextMatrix(1, 4) = "时间" Do While Not mrc3.EOF .Rows = .Rows + 1 .CellAlignment = 4 .TextMatrix(.Rows - 1, 0) = mrc3.Fields(1) .TextMatrix(.Rows - 1, 1) = mrc3.Fields(2) .TextMatrix(.Rows - 1, 2) = mrc3!addmoney .TextMatrix(.Rows - 1, 3) = mrc3!Date .TextMatrix(.Rows - 1, 4) = mrc3!Time mrc3.MoveNext Loop End With End If mrc3.Close Case 2 MSHFlexGrid3.Visible = True Dim mrc4 As ADODB.Recordset txtSQL = "select *from cancelcard_info where userid='" & comboUserId.Text & "'" Set mrc4 = ExecuteSQL(txtSQL, MsgText) If mrc4.EOF Then MsgBox "没有记录!", vbOKOnly + vbExclamation, "提示" Else With MSHFlexGrid3 .Rows = 2 .CellAlignment = 4 .TextMatrix(1, 0) = "学号" .TextMatrix(1, 1) = "卡号" .TextMatrix(1, 2) = "日期" .TextMatrix(1, 3) = "时间" .TextMatrix(1, 4) = "退卡金额" Do While Not mrc4.EOF .Rows = .Rows + 1 .CellAlignment = 4 .TextMatrix(.Rows - 1, 0) = mrc4.Fields(0) .TextMatrix(.Rows - 1, 1) = mrc4.Fields(1) .TextMatrix(.Rows - 1, 2) = mrc4!Date .TextMatrix(.Rows - 1, 3) = mrc4!Time .TextMatrix(.Rows - 1, 4) = mrc4!cancelcash mrc4.MoveNext Loop End With End If mrc4.Close Case 3 MSHFlexGrid4.Visible = True Dim mrc5 As ADODB.Recordset txtSQL = "select *from student_info where userid='" & comboUserId.Text & "'" Set mrc5 = ExecuteSQL(txtSQL, MsgText) If mrc5.EOF Then MsgBox "没有记录!", vbOKOnly + vbInformation, "提示" Else With MSHFlexGrid4 .Rows = 2 .CellAlignment = 4 .TextMatrix(1, 0) = "学号" .TextMatrix(1, 1) = "卡号" .TextMatrix(1, 2) = "日期" .TextMatrix(1, 3) = "时间" Do While Not mrc5.EOF .Rows = .Rows + 1 .CellAlignment = 4 .TextMatrix(.Rows - 1, 0) = mrc5.Fields(1) .TextMatrix(.Rows - 1, 1) = mrc5.Fields(0) .TextMatrix(.Rows - 1, 2) = mrc5!Date .TextMatrix(.Rows - 1, 3) = mrc5!Time mrc5.MoveNext Loop End With End If mrc5.Close Case 4 Frame1.Visible = True Dim mrc6 As ADODB.Recordset '售卡张数 txtSQL = "select * from student_info where userid='" & comboUserId.Text & "'" & " and ischeck='" & "未结账" & "'" & " and status='" & "使用" & "'" Set mrc6 = ExecuteSQL(txtSQL, MsgText) Text1.Text = mrc6.RecordCount mrc6.Close '退卡张数 txtSQL = "select * from cancelcard_info where userid='" & comboUserId.Text & "'" & " and status='" & "未结账" & "'" Set mrc7 = ExecuteSQL(txtSQL, MsgText) Text2.Text = mrc7.RecordCount mrc7.Close '充值金额 txtSQL = "select sum(addmoney) from recharge_info where userid='" & comboUserId.Text & "'" & " and status='" & "未结账" & "'" Set mrc8 = ExecuteSQL(txtSQL, MsgText) Do While Not mrc8.Fields(0) = Null Text3.Text = mrc8.Fields(0) Loop mrc8.Close '临时收费金额 txtSQL = txtSQL & "select sum(cash) from student_info where userid='" & comboUserId & "'" & " and status='" & "未结账" & "'" & " and type='" & "临时用户" & "'" Set mrc9 = ExecuteSQL(txtSQL, MsgText) Do While Not mrc9.Fields(0) = Null Text4.Text = mrc9.Fields(0) Loop mrc9.Close '退卡金额 txtSQL = "select sum(cancelcash) from cancelcard_info where userid='" & comboUserId.Text & "'" & " and status='" & "未结账" & "'" Set mrc10 = ExecuteSQL(txtSQL, MsgText) Do While Not mrc10.Fields(0) = Null Text5.Text = mrc10.Fields(0) Loop mrc10.Close '总售卡数 txtSQL = "select * from student_info where userid='" & comboUserId.Text & "'" & " and ischeck='" & "未结账" & "'" Set mrc11 = ExecuteSQL(txtSQL, MsgText) Text6.Text = mrc11.RecordCount mrc11.Close End Select '应收金额 Text7.Text = Val(Text3.Text) - Val(Text5.Text)End SubPrivate Sub txtUserName_Click()Dim mrc1 As ADODB.RecordsetIf comboUserId <> "" ThentxtSQL = "select * from user_info where userID = '" & comboUserId.Text & "'"Set mrc1 = ExecuteSQL(txtSQL, MsgText)txtUserName.Text = mrc1!UserNamemrc1.CloseEnd IfEnd Sub
可能完善的不是很好,有问题可以一块探讨!
阅读全文
0 0
- 机房收费系统之结账
- 机房收费系统之结账
- 机房收费系统之结账
- 机房收费系统 之结账
- 机房收费系统之结账
- 机房收费系统之结账
- 机房收费系统之结账
- 机房收费系统之结账
- 【机房收费系统】之结账
- 【机房收费系统】 之 结账
- 机房收费系统之结账
- 机房收费系统之结账
- 机房收费系统之结账
- 机房收费系统之结账
- 机房收费系统之结账
- 机房收费系统 之 结账
- 机房收费系统之结账
- 机房收费系统之结账
- spark-shell启动报错:Yarn application has already ended! It might have been killed or unable to launch ap
- 利用栈实现算术表达式的求值
- Caffe中HDF5Data例子
- Springmvc静态资源配置
- hdu 6228 Tree
- 机房收费系统之结账
- 已知满二叉树的先序遍历,求其后序遍历
- matlab——深度学习NN
- centos6.5安装solr集群版
- Longest Ordered Subsequence POJ
- 5分钟学会 CSS Grid 布局
- java代码连接oracle的DBUtil代码
- hadoop 集群系列 一:Linux 安装JDK
- ubuntu 系统添加开机自启动