The realization of the computer room charging system on and off the computer operation code
Foreword
The upper and lower levels are the most basic operations of the computer room charging system. There is no on and off the machine. The subsequent operations are based on the operation of the upper and lower levels and serve the upper and lower levels. Therefore, we need to clear the operation idea first when we get the computer room. !
On
the computer, you go to the Internet cafe, swipe your ID card at the network management, select your own machine, then enter the ID number and password, and enter the main interface. At this time, the system starts timing, and at the same time on the user interface, you also You can see a series of information about your account such as the balance, the time of the machine, etc.!
Our computer room charging system is simply three parts: Judge, Input, Output! (relatively simple)
The simple and clear flow
chart is presented
. Getting off the plane is the opposite of getting on the plane, that is, you are finished playing, ready to go home, and settle the bill, or the system will still calculate the time for you, next time When you come, your internet bill will be gone!
(Here is a little story, I want to tell you about it, I used to like to surf the Internet. Once I went to an Internet cafe, I ran out of money in my ID card, so I charged a lot (because the more I rush, the more I send.) , but when I got home, I didn't know if I didn't check out or there was a problem with the machine, so I didn't get off the plane. When I went in two days later, the money I charged was gone! Regarding the issue of the charging system, I am a consumer who has been miserable, so everyone must manage their own off-camera process, do not trap consumers)
The steps of getting off the computer and getting on the computer are roughly the same, and the most is money and time. Calculate (time is money)!
Without further ado, here is the flow chart!
Here comes the code for time and money calculation!
Define some variables to store data
Dim intlinetime As Integer 'Store the actual online time
Dim intconsume As Single
Dim curconsume As Single 'Store the time when the money is actually spent
Dim curbalance As Single 'Store the user's balance
Dim fixedunit As Single 'Store the unit amount
Dim temunit As Single 'Store the unit time
Dim a As Integer
Dim remaincash As Single
for calculation'Online
duration calculation
intlinetime = (Date - DateValue(mrc1!onDate)) * 1440 + (Hour(Time) - Hour(TimeValue(mrc1!ontime))) * 60 + (Minute(Time) - Minute(TimeValue(mrc1!ontime)))
'The time unit is minutes
' to get the data of the basic table
txtsql3 = "select * from Basicdata_Info"
Set mrc3 = ExecuteSQL(txtsql3, msgtext) 'mrc3 connects to the basicdata table
mrc3.MoveLast
'The cost per unit of time (the fixed user, the temporary user unit The cost of time is assigned to the cost separately)
fixedunit = Val(mrc3.Fields(0)) 'Assign the amount of the fixed user to the variable
temunit = Val(mrc3.Fields(1)) 'Assign the amount of the temporary user to the variable
' to determine whether the online time is less than the preparation time, if Less than the consumption amount=0
If intlinetime <= Val(Trim(mrc3.Fields(4))) Then
txtofftime.Text = "0"
Else
'Determine whether the online time is less than the minimum consumption time, if it is less than 0
If intlinetime < Val(Trim(mrc3.Fields(3))) Then
txtctime.Text = "0"
End If
End If
'Online time is greater than unit time, it is counted according to the number of units of time, divided into fixed users and temporary users
If intlinetime >= Val(Trim(mrc3!leastTime)) And intlinetime And Trim(mrc!Type) = "fixed user" Then
a = Int(intlinetime / Val(Trim(mrc3!unitTime)))
If a = intlinetime / Trim(mrc3!unitTime) Then
curconsume = a
Else
curconsume = a + 1
End If
txtcash.Text = Val(curconsume) * Val(fixedunit)
3
If txtcash.Text = "" Then txtcash.Text = "0"
Else
If intlinetime >= Val(Trim(mrc3!leastTime)) And intlinetime
And Trim(mrc.Fields(14)) = "临时用户" Then
a = Int(intlinetime / Val(Trim(mrc3!unitTime)))
If a = intlinetime / Trim(mrc3!unitTime) Then
curconsume = a
Else
curconsume = a + 1
End If
txtcash.Text = Val(curconsume) * Val(temunit)
End If
End If
'更新student表
txtsql = "select * from student_Info where cardno='" & Trim(txtcardno.Text) & "'"
Set mrc = ExecuteSQL(txtsql, msgtext)
remaincash = mrc!cash - Val(txtcash.Text)
mrc.Fields(7) = remaincash
mrc.Update
mrc.Close
后语
希望对大家有所帮助!
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=326485843&siteId=291194637
Ranking