第一次机房收费系统之管理员结账

2024-03-27 02:08

本文主要是介绍第一次机房收费系统之管理员结账,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

操作流程:

点击操作员用户名的combox控件,会出现所有操作员用户以上用户ID,选中ID下面显示操作员姓名,显示购卡,充值等界面的记录,最后计算出各个售卡退卡张数以及金额。进行结账。

使用的数据库表:

user_info(存放用户信息)
student_info(存放学生信息)
recharge_info(存放充值记录信息)
cancelcard_info(存放退卡信息)
checkday_info(日结账单)

计算公式:

充值金额=此用户为学生注册的金额+此用户为学生充值的金额
收费金额=固定用户的消费金额+临时用户的消费金额
退卡金额=此用户操作的为学生退卡的金额
总售卡数=售卡数—退卡数
应收金额=充值金额+消费金额—退卡金额

具体代码:

显示的操作:

Private Sub comboControlUID_Click()'对User_info表操作Dim mrcuser As ADODB.Recordset '用于存放记录集Dim userSQL As String '用于存放SQL语句Dim userMsgText As String '用于存放返回信息userSQL = "select * from user_info where userID='" & Trim(comboControlUID.Text) & "'"Set mrcuser = ExecuteSQL(userSQL, userMsgText)If mrcuser.EOF = True Thenmrcuser.CloseExit SubElsetxtUserName.Text = mrcuser.Fields(3)End IfCall ShowData1 '购卡Call ShowData2 '充值Call ShowData3 '退卡Call ShowData4 '临时用户Call All '汇总
End SubPrivate Sub ShowData1()'对Student_info表操作Dim mrcstudent As ADODB.Recordset '用于存放记录集Dim studentSQL As String '用于存放SQL语句Dim studentMsgText As String '用于存放返回信息studentSQL = "select * from student_info where UserID='" & Trim(comboControlUID.Text) & "' and Ischeck='未结账'"Set mrcstudent = ExecuteSQL(studentSQL, studentMsgText)If mrcstudent.EOF = True Thenmrcstudent.CloseMSHFlexGrid1.ClearWith MSHFlexGrid1.Rows = 1.CellAlignment = 4.TextMatrix(0, 0) = "学号".TextMatrix(0, 1) = "卡号".TextMatrix(0, 2) = "日期".TextMatrix(0, 3) = "时间"End WithExit SubElseWith MSHFlexGrid1.Rows = 1Do While mrcstudent.EOF = False.Rows = .Rows + 1.CellAlignment = 4.TextMatrix(.Rows - 1, 0) = Trim(mrcstudent.Fields(1)).TextMatrix(.Rows - 1, 1) = Trim(mrcstudent.Fields(0)).TextMatrix(.Rows - 1, 2) = Trim(mrcstudent.Fields(12)).TextMatrix(.Rows - 1, 3) = Trim(mrcstudent.Fields(13))mrcstudent.MoveNextLoopmrcstudent.CloseEnd WithEnd If
End Sub
Private Sub ShowData2()'对recharge_info表操作Dim mrcrecharge As ADODB.Recordset '用于存放记录集Dim rechargeSQL As String '用于存放SQL语句Dim rechargeMsgText As String '用于存放返回信息rechargeSQL = "select * from recharge_info where UserID ='" & Trim(comboControlUID.Text) & "' and status='未结账'"Set mrcrecharge = ExecuteSQL(rechargeSQL, rechargeMsgText)If mrcrecharge.EOF = True Thenmrcrecharge.CloseMSHFlexGrid2.ClearWith MSHFlexGrid2.Rows = 1.CellAlignment = 4.TextMatrix(0, 0) = "学号".TextMatrix(0, 1) = "卡号".TextMatrix(0, 2) = "充值金额".TextMatrix(0, 3) = "日期".TextMatrix(0, 4) = "时间"End WithExit SubElseWith MSHFlexGrid2.Rows = 1Do While mrcrecharge.EOF = False.Rows = .Rows + 1.CellAlignment = 4.TextMatrix(.Rows - 1, 0) = Trim(mrcrecharge.Fields(1)).TextMatrix(.Rows - 1, 1) = Trim(mrcrecharge.Fields(2)).TextMatrix(.Rows - 1, 2) = Trim(mrcrecharge.Fields(3)).TextMatrix(.Rows - 1, 3) = Trim(mrcrecharge.Fields(4)).TextMatrix(.Rows - 1, 4) = Trim(mrcrecharge.Fields(5))mrcrecharge.MoveNextLoopmrcrecharge.CloseEnd WithEnd If
End SubPrivate Sub ShowData3()'对cancelcard_info表操作Dim mrccancelcard As ADODB.Recordset '用于存放记录集Dim cancelcardSQL As String '用于存放SQL语句Dim cancelcardMsgText As String '用于存放返回信息cancelcardSQL = "select * from cancelcard_info where UserID='" & Trim(comboControlUID.Text) & "' and status='未结账'"Set mrccancelcard = ExecuteSQL(cancelcardSQL, cancelcardMsgText)If mrccancelcard.EOF = True Thenmrccancelcard.CloseMSHFlexGrid3.ClearWith MSHFlexGrid3.Rows = 1.CellAlignment = 4.TextMatrix(0, 0) = "学号".TextMatrix(0, 1) = "卡号".TextMatrix(0, 2) = "日期".TextMatrix(0, 3) = "时间".TextMatrix(0, 4) = "退卡金额"End WithExit SubElseWith MSHFlexGrid3.Rows = 1Do While mrccancelcard.EOF = False.Rows = .Rows + 1.CellAlignment = 4.TextMatrix(.Rows - 1, 0) = Trim(mrccancelcard.Fields(1)).TextMatrix(.Rows - 1, 1) = Trim(mrccancelcard.Fields(2)).TextMatrix(.Rows - 1, 2) = Trim(mrccancelcard.Fields(3)).TextMatrix(.Rows - 1, 3) = Trim(mrccancelcard.Fields(4)).TextMatrix(.Rows - 1, 4) = Trim(mrccancelcard.Fields(2))mrccancelcard.MoveNextLoopmrccancelcard.CloseEnd WithEnd If
End SubPrivate Sub ShowData4()'再次对student_info表操作Dim mrcST As ADODB.RecordsetDim STSQL As StringDim STMsgText As StringSTSQL = "select * from student_info where UserID='" & Trim(comboControlUID.Text) & "' and Ischeck='未结账' and type='临时用户'"Set mrcST = ExecuteSQL(STSQL, STMsgText)If mrcST.EOF = True ThenmrcST.CloseWith MSHFlexGrid4.Rows = 1.CellAlignment = 4.TextMatrix(0, 0) = "学号".TextMatrix(0, 1) = "卡号".TextMatrix(0, 2) = "日期".TextMatrix(0, 3) = "时间"End WithElseWith MSHFlexGrid4.Rows = 1Do While mrcST.EOF = False.Rows = .Rows + 1.CellAlignment = 4.TextMatrix(.Rows - 1, 0) = Trim(mrcST.Fields(1)).TextMatrix(.Rows - 1, 1) = Trim(mrcST.Fields(0)).TextMatrix(.Rows - 1, 2) = Trim(mrcST.Fields(12)).TextMatrix(.Rows - 1, 3) = Trim(mrcST.Fields(13))mrcST.MoveNextLoopmrcST.CloseEnd WithEnd If
End Sub
Private Sub All()Dim Temporary As Double '临时收费Dim Money As Double '充值总金额Dim Cancel As Double '退卡金额'对Student_info表操作Dim mrcstudent As ADODB.Recordset '用于存放记录集Dim studentSQL As String '用于存放SQL语句Dim studentMsgText As String '用于存放返回信息'对recharge_info表操作Dim mrcrecharge As ADODB.Recordset '用于存放记录集Dim rechargeSQL As String '用于存放SQL语句Dim rechargeMsgText As String '用于存放返回信息'对cancelcard_info表操作Dim mrccancelcard As ADODB.Recordset '用于存放记录集Dim cancelcardSQL As String '用于存放SQL语句Dim cancelcardMsgText As String '用于存放返回信息'再次对student_info表操作Dim mrcST As ADODB.RecordsetDim STSQL As StringDim STMsgText As String'售卡张数studentSQL = "select * from student_info where UserID='" & Trim(comboControlUID.Text) & "' and Ischeck='未结账'"Set mrcstudent = ExecuteSQL(studentSQL, studentMsgText)If mrcstudent.RecordCount = 0 ThentxtSellCard.Text = "0"mrcstudent.CloseElsetxtSellCard.Text = mrcstudent.RecordCountmrcstudent.CloseEnd If'充值金额rechargeSQL = "select * from recharge_info where UserID ='" & Trim(comboControlUID.Text) & "' and status='未结账'"Set mrcrecharge = ExecuteSQL(rechargeSQL, rechargeMsgText)If mrcrecharge.EOF = True ThentxtReCharge.Text = "0"mrcrecharge.CloseElseMoney = 0Do While mrcrecharge.EOF = FalseMoney = Money + Val(mrcrecharge.Fields(3))mrcrecharge.MoveNextLooptxtReCharge.Text = Moneymrcrecharge.CloseEnd If'退卡张数和退卡金额cancelcardSQL = "select * from cancelcard_info where UserID='" & Trim(comboControlUID.Text) & "' and status='未结账'"Set mrccancelcard = ExecuteSQL(cancelcardSQL, cancelcardMsgText)If mrccancelcard.RecordCount = 0 ThentxtCancelCard.Text = "0"ElsetxtCancelCard.Text = mrccancelcard.RecordCountEnd IfIf mrccancelcard.EOF = True ThentxtCancelCharge.Text = "0"ElseCancel = 0Do While mrccancelcard.EOF = FalseCancel = Cancel + Val(mrccancelcard.Fields(2))mrccancelcard.MoveNextLooptxtCancelCharge = Cancelmrccancelcard.CloseEnd If'临时收费金额STSQL = "select * from student_info where UserID='" & Trim(comboControlUID.Text) & "' and Ischeck='未结账' and type='临时用户'"Set mrcST = ExecuteSQL(STSQL, STMsgText)If mrcST.EOF = True ThentxtTemporaryCharge.Text = "0"mrcST.CloseElseTemporary = 0Do While mrcST.EOF = FalseTemporary = Temporary + Val(mrcST.Fields(7))mrcST.MoveNextLooptxtTemporaryCharge.Text = TemporarymrcST.CloseEnd If'总售卡数txtAllSellCard.Text = Int(txtSellCard.Text) - Int(txtCancelCard.Text)'应收金额txtShouldCharge.Text = Val(txtReCharge.Text) + Val(txtTemporaryCharge.Text) - Val(txtCancelCharge.Text)End Sub

结账的操作

Private Sub cmdCloseCharge_Click()Dim ReMain As DoubleDim ReCharge As Double '充值金额Dim Cancel As Double '退卡金额Dim Consume As Double '总金额'对line_info表操作Dim mrcline As ADODB.Recordset '用于存放记录集Dim lineSQL As String '用于存放SQL语句Dim lineMsgText As String '用于存放返回信息'对Student_info表操作Dim mrcstudent As ADODB.Recordset '用于存放记录集Dim studentSQL As String '用于存放SQL语句Dim studentMsgText As String '用于存放返回信息'对recharge_info表操作Dim mrcrecharge As ADODB.Recordset '用于存放记录集Dim rechargeSQL As String '用于存放SQL语句Dim rechargeMsgText As String '用于存放返回信息'对cancelcard_info表操作Dim mrccancelcard As ADODB.Recordset '用于存放记录集Dim cancelcardSQL As String '用于存放SQL语句Dim cancelcardMsgText As String '用于存放返回信息'对checkday_info表再次操作Dim mrccheck As ADODB.Recordset '用于存放记录集Dim checkSQL As String '用于存放SQL语句Dim checkMsgText As String '用于存放返回信息'对CheckDay_info表操作Dim mrccheckday As ADODB.Recordset '用于存放记录集Dim checkdaySQL As String '用于存放SQL语句Dim checkdayMsgText As String '用于存放返回信息If comboControlUID.Text = "" ThenMsgBox "请选择人员!", vbOKOnly + vbInformation, "提示"comboControlUID.SetFocusExit SubElsecheckdaySQL = "select * from checkday_info where date='" & Date & "'"Set mrccheckday = ExecuteSQL(checkdaySQL, checkdayMsgText)lineSQL = "select * from line_info where status='正常下机' and offdate='" & Date & "'"Set mrcline = ExecuteSQL(lineSQL, lineMsgText)Consume = 0If mrcline.EOF = True ThenConsume = 0mrcline.CloseElseDo While mrcline.EOF = FalseConsume = Consume + Val(mrcline.Fields(11))mrcline.MoveNextLoopmrcline.CloseEnd If'student_info结账studentSQL = "select * from student_info where UserID='" & Trim(comboControlUID.Text) & "' and Ischeck='未结账'"Set mrcstudent = ExecuteSQL(studentSQL, studentMsgText)If mrcstudent.EOF = False ThenDo While mrcstudent.EOF = Falsemrcstudent.Fields(11) = "结账"mrcstudent.Updatemrcstudent.MoveNextLoopmrcstudent.CloseEnd If'recharge_info结账rechargeSQL = "select * from recharge_info where UserID ='" & Trim(comboControlUID.Text) & "' and status='未结账'"Set mrcrecharge = ExecuteSQL(rechargeSQL, rechargeMsgText)ReCharge = 0If mrcrecharge.EOF = False ThenDo While mrcrecharge.EOF = FalseReCharge = ReCharge + Val(mrcrecharge.Fields(3))mrcrecharge.Fields(7) = "结账"mrcrecharge.Updatemrcrecharge.MoveNextLoopmrcrecharge.CloseElseReCharge = 0mrcrecharge.CloseEnd If'cancelcard_info结账cancelcardSQL = "select * from cancelcard_info where UserID='" & Trim(comboControlUID.Text) & "' and status='未结账'"Set mrccancelcard = ExecuteSQL(cancelcardSQL, cancelcardMsgText)Cancel = 0If mrccancelcard.EOF = False ThenDo While mrccancelcard.EOF = FalseCancel = Cancel + Val(mrccancelcard.Fields(2))mrccancelcard.Fields(6) = "结账"mrccancelcard.Updatemrccancelcard.MoveNextLoopmrccancelcard.CloseElseCancel = 0mrccancelcard.CloseEnd IfcheckSQL = "select * from checkday_info where date='" & Date - 1 & "'"Set mrccheck = ExecuteSQL(checkSQL, checkMsgText)ReMain = 0If mrccheck.EOF = True ThenReMain = 0mrccheck.CloseElseReMain = Val(mrccheck.Fields(4))mrccheck.CloseEnd IfIf mrccheckday.EOF = True Thenmrccheckday.AddNewmrccheckday.Fields(0) = ReMainmrccheckday.Fields(1) = ReChargemrccheckday.Fields(2) = Consumemrccheckday.Fields(3) = Cancelmrccheckday.Fields(4) = ReCharge - Cancelmrccheckday.Fields(5) = Datemrccheckday.Updatemrccheckday.CloseMsgBox "结账成功!", vbOKOnly + vbInformation, "提示"Elsemrccheckday.Fields(0) = ReMainmrccheckday.Fields(1) = ReChargemrccheckday.Fields(2) = Consumemrccheckday.Fields(3) = Cancelmrccheckday.Fields(4) = ReCharge - Cancelmrccheckday.Fields(5) = Datemrccheckday.Updatemrccheckday.CloseMsgBox "结账成功!", vbOKOnly + vbInformation, "提示"End IfEnd If
End Sub

优化方面:

1.背景图随窗体改变而改变

Dim H As Single '定义窗体高的变量
Dim W As Single '定义窗体高的变量
Private Sub Form_Load()'对User_info表操作Dim mrcuser As ADODB.Recordset '用于存放记录集Dim userSQL As String '用于存放SQL语句Dim userMsgText As String '用于存放返回信息userSQL = "select * from user_info where level='操作员'or level='管理员'"Set mrcuser = ExecuteSQL(userSQL, userMsgText)If mrcuser.EOF = True ThenMsgBox "无用户数据记录!", vbOKOnly + vbInformation, "提示"Exit SubElseDo While mrcuser.EOF = FalsecomboControlUID.AddItem mrcuser.Fields(0)mrcuser.MoveNextLoopEnd IfWith MSHFlexGrid1.Rows = 1.CellAlignment = 4.TextMatrix(0, 0) = "学号".TextMatrix(0, 1) = "卡号".TextMatrix(0, 2) = "日期".TextMatrix(0, 3) = "时间"End WithWith MSHFlexGrid2.Rows = 1.CellAlignment = 4.TextMatrix(0, 0) = "学号".TextMatrix(0, 1) = "卡号".TextMatrix(0, 2) = "充值金额".TextMatrix(0, 3) = "日期".TextMatrix(0, 4) = "时间"End WithWith MSHFlexGrid3.Rows = 1.CellAlignment = 4.TextMatrix(0, 0) = "学号".TextMatrix(0, 1) = "卡号".TextMatrix(0, 2) = "日期".TextMatrix(0, 3) = "时间".TextMatrix(0, 4) = "退卡金额"End WithWith MSHFlexGrid4.Rows = 1.CellAlignment = 4.TextMatrix(0, 0) = "学号".TextMatrix(0, 1) = "卡号".TextMatrix(0, 2) = "日期".TextMatrix(0, 3) = "时间"End WithH = Me.HeightW = Me.Width
End SubPrivate Sub Form_Resize()Me.Height = HMe.Width = WMe.PaintPicture Me.Picture, 0, 0, Me.ScaleWidth, Me.ScaleHeight '实现背景图随窗体变大而改变
End Sub

2.不可输入值

Private Sub comboControlUID_KeyPress(KeyAscii As Integer)KeyAscii = 0 '不可输入值
End Sub

3.禁止粘贴

Private Sub txtSellCard_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)If Button = 2 ThenClipboard.ClearEnd If
End Sub

4.限制字符类型
https://blog.csdn.net/TGB__15__ZYB/article/details/86636625

这篇关于第一次机房收费系统之管理员结账的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/850607

相关文章

什么是cron? Linux系统下Cron定时任务使用指南

《什么是cron?Linux系统下Cron定时任务使用指南》在日常的Linux系统管理和维护中,定时执行任务是非常常见的需求,你可能需要每天执行备份任务、清理系统日志或运行特定的脚本,而不想每天... 在管理 linux 服务器的过程中,总有一些任务需要我们定期或重复执行。就比如备份任务,通常会选在服务器资

TP-LINK/水星和hasivo交换机怎么选? 三款网管交换机系统功能对比

《TP-LINK/水星和hasivo交换机怎么选?三款网管交换机系统功能对比》今天选了三款都是”8+1″的2.5G网管交换机,分别是TP-LINK水星和hasivo交换机,该怎么选呢?这些交换机功... TP-LINK、水星和hasivo这三台交换机都是”8+1″的2.5G网管交换机,我手里的China编程has

基于Qt实现系统主题感知功能

《基于Qt实现系统主题感知功能》在现代桌面应用程序开发中,系统主题感知是一项重要的功能,它使得应用程序能够根据用户的系统主题设置(如深色模式或浅色模式)自动调整其外观,Qt作为一个跨平台的C++图形用... 目录【正文开始】一、使用效果二、系统主题感知助手类(SystemThemeHelper)三、实现细节

CentOS系统使用yum命令报错问题及解决

《CentOS系统使用yum命令报错问题及解决》文章主要讲述了在CentOS系统中使用yum命令时遇到的错误,并提供了个人解决方法,希望对大家有所帮助,并鼓励大家支持脚本之家... 目录Centos系统使用yum命令报错找到文件替换源文件为总结CentOS系统使用yum命令报错http://www.cppc

不懂推荐算法也能设计推荐系统

本文以商业化应用推荐为例,告诉我们不懂推荐算法的产品,也能从产品侧出发, 设计出一款不错的推荐系统。 相信很多新手产品,看到算法二字,多是懵圈的。 什么排序算法、最短路径等都是相对传统的算法(注:传统是指科班出身的产品都会接触过)。但对于推荐算法,多数产品对着网上搜到的资源,都会无从下手。特别当某些推荐算法 和 “AI”扯上关系后,更是加大了理解的难度。 但,不了解推荐算法,就无法做推荐系

基于人工智能的图像分类系统

目录 引言项目背景环境准备 硬件要求软件安装与配置系统设计 系统架构关键技术代码示例 数据预处理模型训练模型预测应用场景结论 1. 引言 图像分类是计算机视觉中的一个重要任务,目标是自动识别图像中的对象类别。通过卷积神经网络(CNN)等深度学习技术,我们可以构建高效的图像分类系统,广泛应用于自动驾驶、医疗影像诊断、监控分析等领域。本文将介绍如何构建一个基于人工智能的图像分类系统,包括环境

水位雨量在线监测系统概述及应用介绍

在当今社会,随着科技的飞速发展,各种智能监测系统已成为保障公共安全、促进资源管理和环境保护的重要工具。其中,水位雨量在线监测系统作为自然灾害预警、水资源管理及水利工程运行的关键技术,其重要性不言而喻。 一、水位雨量在线监测系统的基本原理 水位雨量在线监测系统主要由数据采集单元、数据传输网络、数据处理中心及用户终端四大部分构成,形成了一个完整的闭环系统。 数据采集单元:这是系统的“眼睛”,

嵌入式QT开发:构建高效智能的嵌入式系统

摘要: 本文深入探讨了嵌入式 QT 相关的各个方面。从 QT 框架的基础架构和核心概念出发,详细阐述了其在嵌入式环境中的优势与特点。文中分析了嵌入式 QT 的开发环境搭建过程,包括交叉编译工具链的配置等关键步骤。进一步探讨了嵌入式 QT 的界面设计与开发,涵盖了从基本控件的使用到复杂界面布局的构建。同时也深入研究了信号与槽机制在嵌入式系统中的应用,以及嵌入式 QT 与硬件设备的交互,包括输入输出设

JAVA智听未来一站式有声阅读平台听书系统小程序源码

智听未来,一站式有声阅读平台听书系统 🌟 开篇:遇见未来,从“智听”开始 在这个快节奏的时代,你是否渴望在忙碌的间隙,找到一片属于自己的宁静角落?是否梦想着能随时随地,沉浸在知识的海洋,或是故事的奇幻世界里?今天,就让我带你一起探索“智听未来”——这一站式有声阅读平台听书系统,它正悄悄改变着我们的阅读方式,让未来触手可及! 📚 第一站:海量资源,应有尽有 走进“智听

【区块链 + 人才服务】可信教育区块链治理系统 | FISCO BCOS应用案例

伴随着区块链技术的不断完善,其在教育信息化中的应用也在持续发展。利用区块链数据共识、不可篡改的特性, 将与教育相关的数据要素在区块链上进行存证确权,在确保数据可信的前提下,促进教育的公平、透明、开放,为教育教学质量提升赋能,实现教育数据的安全共享、高等教育体系的智慧治理。 可信教育区块链治理系统的顶层治理架构由教育部、高校、企业、学生等多方角色共同参与建设、维护,支撑教育资源共享、教学质量评估、