机房收费系统之收取金额和退还金额查询

收取金额流程图
在这里插入图片描述
代码实现

Private Sub cmdexport_Click()
    Call ExportToExcel(MSFlexGrid1)
End Sub

Private Sub cmdinquery_Click()
    Dim txtsql, msgtext As String
    Dim mrc As Adodb.Recordset
    
    '判断起始日期是否小于终止日期
    If DTPicker1.Value < DTPicker2.Value Then
        '查询退卡表
        txtsql = "select * from recharge_info where datetime between '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' "
        Set mrc = ExecuteSQL(txtsql, msgtext)
        '判断是否有记录
        If mrc.EOF And mrc.BOF Then
            MsgBox "没有查询结果!", 0 + 48, 提示
            Exit Sub
        Else
            With MSFlexGrid1
                '设置表格行数和列数
                .Rows = 1
                .Cols = 6
                '设置表格第一行的标题
                .TextMatrix(0, 0) = "卡号"
                .TextMatrix(0, 1) = "充值金额"
                .TextMatrix(0, 2) = "充值日期"
                .TextMatrix(0, 3) = "充值教师"
                .TextMatrix(0, 4) = "结账状态"
                '将数据添加到表格中
                Do While mrc.EOF = False
                    .Rows = .Rows + 1
                    .TextMatrix(.Rows - 1, 0) = mrc.Fields(1)
                    .TextMatrix(.Rows - 1, 1) = mrc.Fields(2)
                    .TextMatrix(.Rows - 1, 2) = mrc.Fields(3)
                    .TextMatrix(.Rows - 1, 3) = mrc.Fields(4)
                    .TextMatrix(.Rows - 1, 4) = mrc.Fields(5)
                    mrc.MoveNext
                Loop
            End With
        End If
    Else
        MsgBox "起始日期不能大于终止日期!", 0 + 48, 提示
        Exit Sub
    End If
End Sub

退还金额流程图
在这里插入图片描述
代码实现

Private Sub cmdexport_Click()
    '导出到excel
    Call ExportToExcel(MSFlexGrid1)
End Sub

Private Sub cmdinquery_Click()
    Dim txtsql, msgtext As String
    Dim mrc As adodb.Recordset
    '判断起始日期是否小于终止日期
    If DTPicker1.Value < DTPicker2.Value Then
        MsgBox "起始日期不能大于终止日期!", 0 + 48, 提示
        Exit Sub
    End If

'判断是否有记录
txtsql = "select * from cancelcard_info where datetime between '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' "
Set mrc = ExecuteSQL(txtsql, msgtext)

If mrc.EOF And mrc.BOF Then
    MsgBox "没有查询结果", 0 + 48, 提示
    Exit Sub
Else
    '将查询结果显示在MSFlexgrid1中
    With MSFlexGrid1
        .Rows = 1
        .Cols = 6
        .TextMatrix(0, 0) = "卡号"
        .TextMatrix(0, 1) = "退还金额"
        .TextMatrix(0, 2) = "退还日期"
        .TextMatrix(0, 3) = "结账人员"
        .TextMatrix(0, 4) = "结账状态"
        
        Do While Not mrc.EOF
           .Rows = .Rows + 1
           .TextMatrix(.Rows - 1, 0) = mrc.Fields(0)
           .TextMatrix(.Rows - 1, 1) = mrc.Fields(1)
           .TextMatrix(.Rows - 1, 2) = mrc.Fields(2)
           .TextMatrix(.Rows - 1, 3) = mrc.Fields(3)
           .TextMatrix(.Rows - 1, 4) = mrc.Fields(4)
           mrc.MoveNext
        Loop
    End With
End If
End Sub
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 13
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值