机房收费系统(六)-结账

这里写图片描述
结账是机房三大难点之一,这个主要是考验逻辑思维,结账简单的说就是把一样的钱汇总一下,但是汇总的时候要想把每一部分的钱整明白,还是需要好好考虑考虑的。
结账就是数据表中操作员的那些未结账。然后管理员对操作员的工作情况进行查看。
在做的过程中,思路很重要,思路通了,整个代码也就基本上做出来了。
下面就来分析一下这个界面的功能。
1.通过选择不同的操作员,下面就呈现不同的操作员的工作记录。
2.购卡账单,显示购买卡学生的信息。
3.退卡账单显示退卡学生信息
4.充值卡显示充值学生信息。
5.结账界面,就是整个操作的汇总。
思路:
首先,从user_Info这张表调出与操作员用户名匹配的操作员真实姓名(username)来直接显示到 combo框中。
然后,通过select case语句来显示sstab中的tab的内容。(显示的内容为未结账)
最后,当点击汇总中的“结账”的时候把信息写入到checkday,checkweek这两张表中,这样做的目的是为了“日结账单”和“周结账单”能够调出结账的信息。
*部分代码展示:
1.把他的所有信息,未结账的显示出来
购卡

txtsql = "select * from student_Info where UserID='" & comLevel.Text & "' and Ischeck='未结账'"
    Set mrcSD = ExecuteSQL(txtsql, msgtext)
    MfgBugCard.Rows = mrcSD.RecordCount + 1

    With MfgBugCard
         .Rows = 1
        .CellAlignment = 4      '居中
        .TextMatrix(0, 0) = "学号"  'studentid
        .TextMatrix(0, 1) = "卡号"  'cardid
        .TextMatrix(0, 2) = "日期"  'date
        .TextMatrix(0, 3) = "时间"  'time
        .TextMatrix(0, 4) = "使用状态"
        .TextMatrix(0, 5) = "结账情况"
        While mrcSD.EOF = False
            .Rows = .Rows + 1
            .CellAlignment = 4
            .TextMatrix(.Rows - 1, 0) = Trim(mrcSD.Fields(1)) 'studentno
            .TextMatrix(.Rows - 1, 1) = Trim(mrcSD.Fields(0)) 'cardno
            .TextMatrix(.Rows - 1, 2) = Trim(mrcSD.Fields(12)) 'date
            .TextMatrix(.Rows - 1, 3) = Trim(mrcSD.Fields(13)) 'time
            .TextMatrix(.Rows - 1, 4) = Trim(mrcSD.Fields(10))
            .TextMatrix(.Rows - 1, 5) = Trim(mrcSD.Fields(11))
            mrcSD.MoveNext
        Wend
    End With

**2.把该操作员的所有未结账的充值信息汇总到表格
充值结账**

 txtsql = "select * from Recharge_Info where status='未结账' and UserID='" & comLevel.Text & "'"
    Set mrcRC = ExecuteSQL(txtsql, msgtext)
    RechargeCash = 0
    With MfgRecharge
         .Rows = 1
        .CellAlignment = 4      '居中
        .TextMatrix(0, 0) = "学号"  'studentid
        .TextMatrix(0, 1) = "卡号"  'cardid
        .TextMatrix(0, 2) = "充值金额"  'cash
        .TextMatrix(0, 3) = "日期"  'date
        .TextMatrix(0, 4) = "时间"
        .TextMatrix(0, 5) = "用户名"
        .TextMatrix(0, 6) = "状态"
        While Not mrcRC.EOF
            .Rows = .Rows + 1
            .TextMatrix(.Rows - 1, 0) = Trim(mrcRC.Fields(1)) 'studentno
            .TextMatrix(.Rows - 1, 1) = Trim(mrcRC.Fields(2)) 'cardno
            .TextMatrix(.Rows - 1, 2) = Trim(mrcRC.Fields(3)) 'rechargecash
            .TextMatrix(.Rows - 1, 3) = Trim(mrcRC.Fields(4)) 'date
            .TextMatrix(.Rows - 1, 4) = Trim(mrcRC.Fields(5)) 'time
            .TextMatrix(.Rows - 1, 5) = Trim(mrcRC.Fields(6))
            .TextMatrix(.Rows - 1, 6) = Trim(mrcRC.Fields(7))
            mrcRC.MoveNext
        Wend
    End With

3.**把所有信息汇总到表格
退卡**

 txtsql = "select * from CancelCard_Info where status='未结账'and UserID='" & comLevel.Text & "'"
    Set mrcCC = ExecuteSQL(txtsql, msgtext)
    CancelCash = 0
    With MfgCancelCard
        .Rows = 1
        .CellAlignment = 4      '居中
        .TextMatrix(0, 0) = "学号"  'studentid
        .TextMatrix(0, 1) = "卡号"  'cardid
        .TextMatrix(0, 2) = "日期"  'cash
        .TextMatrix(0, 3) = "时间"  'date
        .TextMatrix(0, 4) = "退卡金额"
        .TextMatrix(0, 5) = "结账情况"
        While Not mrcCC.EOF
            .Rows = .Rows + 1
            .CellAlignment = 4
            .TextMatrix(.Rows - 1, 0) = Trim(mrcCC.Fields(0))  'studentno
            .TextMatrix(.Rows - 1, 1) = Trim(mrcCC.Fields(1))   'cardno
            .TextMatrix(.Rows - 1, 2) = Trim(mrcCC.Fields(3))   'date
            .TextMatrix(.Rows - 1, 3) = Trim(mrcCC.Fields(4))   'time
            .TextMatrix(.Rows - 1, 4) = Trim(mrcCC.Fields(2))   'cancelcash
            .TextMatrix(.Rows - 1, 5) = Trim(mrcCC.Fields(6))   'cancelcash
            CancelCash = CancelCash + mrcCC.Fields(2)
            mrcCC.MoveNext
        Wend
    End With

4.临时用户

txtsql = "select * from student_Info where status='使用' and UserID='" & comLevel.Text & "'and type='临时用户'and Ischeck='未结账'"
    Set mrcTmp = ExecuteSQL(txtsql, msgtext)

    TmpCash = 0
    With MSHFlexGrid4
        .Rows = 1
        .CellAlignment = 4      '居中
        .TextMatrix(0, 0) = "学号"  'studentid
        .TextMatrix(0, 1) = "卡号"  'cardid
        .TextMatrix(0, 2) = "日期"  'date
        .TextMatrix(0, 3) = "时间"  'time
        .TextMatrix(0, 4) = "结账情况"  'time
        While mrcTmp.EOF = False
            .Rows = .Rows + 1
            .CellAlignment = 4
            .TextMatrix(.Rows - 1, 0) = Trim(mrcTmp.Fields(1))  'studentno
            .TextMatrix(.Rows - 1, 1) = Trim(mrcTmp.Fields(0))   'cardno
            .TextMatrix(.Rows - 1, 2) = Trim(mrcTmp.Fields(12))    'date
            .TextMatrix(.Rows - 1, 3) = Trim(mrcTmp.Fields(13))   'time
            .TextMatrix(.Rows - 1, 4) = Trim(mrcTmp.Fields(11))
            TmpCash = mrcTmp.Fields(7)
            mrcTmp.MoveNext
        Wend
    End With

猜你喜欢

转载自blog.csdn.net/qq_41306240/article/details/81744959