其他分享
首页 > 其他分享> > 机房收费系统---------结账

机房收费系统---------结账

作者:互联网

结账是对这一段时间里支出的一个汇总,能清晰的知道自己今天赚了多少钱。
但这里的结账不是我们单纯的认为的那种收费结账,里面有很多个环节步骤,就比如说操作员和管理原之间的区别是什么:
操作员:相当于收银员的类型,钱并不是到他那里,而是个打工的。
管理员:真正的老板,钱最后汇总到的地方。
再就是我们需要对各个表里的东西有所了解:
1.售卡张数=购卡选项卡的记录总数
2.退卡张数=退卡选项卡的记录总数
3.充值金额=recharge表充值金额总数
4.临时收费金额=student表未结账的临时用户的金额总数
5.退卡金额=cancelcard表信息的金额总数
6.总售卡数=售卡张数-退卡张数
7.应收金额=充值金额-退卡金额、
接下来就是我的部分代码

Private Sub cmdOk_Click()
    '购卡
    txtSQL = "select*from student_info where userid='" & ComboUserID.Text & "'" & "and " & _
                "ischeck='" & "未结账" & "' and date='" & Date & "'"
    Set mrc_Stu_Sum = ExecuteSQL(txtSQL, MsgText)
    If mrc_Stu_Sum.EOF = False Then
        mrc_Stu_Sum.MoveFirst
    End If
        While Not mrc_Stu_Sum.EOF
                mrc_Stu_Sum.Fields(6) = "结账"
                mrc_Stu_Sum.Update
                mrc_Stu_Sum.MoveNext
        Wend
    '关闭数据库
    mrc_Stu_Sum.Close
    '充值
     AddMoney = 0
    txtSQL = "select*from recharge_info where userid='" & ComboUserID.Text & "'" & "and " & _
                "status='" & "未结账" & "' and date='" & Date & "'"
    Set mrc_RE = ExecuteSQL(txtSQL, MsgText)
    If mrc_RE.EOF = False Then
        mrc_RE.MoveFirst
    End If
        While Not mrc_RE.EOF
                AddMoney = AddMoney + Trim(mrc_RE.Fields(3))
                mrc_RE.Fields(2) = "结账"
                mrc_RE.Update
                mrc_RE.MoveNext
        Wend
    mrc_RE.Close
    '退卡
    BackCard = 0
    txtSQL = "select*from cancelcard_info where userid='" & ComboUserID.Text & "'" & "and " & 
                "status='" & "未结账" & "' and date='" & Date & "'"
    Set mrc_Stu_Off = ExecuteSQL(txtSQL, MsgText)
    If mrc_Stu_Off.EOF = False Then
        mrc_Stu_Off.MoveFirst
    End If
        While Not mrc_Stu_Off.EOF
                mrc_Stu_Off.Fields(1) = "结账"
                mrc_Stu_Off.Update
                mrc_Stu_Off.MoveNext
        Wend
    mrc_Stu_Off.Close
    '临时用户
    txtSQL = "select*from student_info where userid='" & ComboUserID.Text & "'" & "and " & _
                "ischeck='" & "未结账" & "'" & "and " & _
                "type='" & "临时用户" & "' and date='" & Date & "'"
    Set mrc_Stu_Tem = ExecuteSQL(txtSQL, MsgText)
    If mrc_Stu_Tem.EOF = False Then
        mrc_Stu_Tem.MoveFirst
    End If
        While Not mrc_Stu_Tem.EOF
            With FlexGridTem
                .Rows = .Rows + 1
                .CellAlignment = 4
                .ColAlignment = 4
                mrc_Stu_Tem.Fields(6) = "结账"
                mrc_Stu_Tem.MoveNext
            End With
        Wend
    mrc_Stu_Tem.Close
    '下机
    txtSQL = "select*from line_info  where userid='" & ComboUserID.Text & "'" & "and " & _
                "statu='" & "未结账" & "' and offdate='" & Date & "'"
    Set mrc_Line = ExecuteSQL(txtSQL, MsgText)
    If mrc_Line.EOF = False Then
        mrc_Line.MoveFirst
    End If
        While Not mrc_Line.EOF
                mrc_Line.Fields(11) = "结账"
                mrc_Line.MoveNext
        Wend
    mrc_Line.Close
    '调用过程,添加表名
    Call AddName
    '临时收费金额
    txtSQL = "select * from line_info where offdate='" & Format(Date, "yyyy-MM-dd") & "'" & _
                    "and userid='" & ComboUserID.Text & "' and offdate='" & Date & "'"
    Set mrc_Line = ExecuteSQL(txtSQL, MsgText)
    If mrc_Line.EOF Then
        TemMoney = 0
    Else
        While Not mrc_Line.EOF
            TemMoney = TemMoney + Val(Trim(mrc_Line.Fields(11)))
            mrc_Line.MoveNext
        Wend
    End If
End Sub

标签:EOF,txtSQL,Stu,机房,收费,Line,结账,mrc
来源: https://blog.csdn.net/mazhaochen/article/details/87945167