📄 menjin.frm
字号:
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 375
Left = 4800
TabIndex = 8
Top = 480
Width = 1695
End
Begin VB.Label Label4
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H00404000&
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 375
Left = 1800
TabIndex = 7
Top = 480
Width = 1695
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "卡号:"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 840
TabIndex = 6
Top = 480
Width = 810
End
End
Begin VB.Frame Frame1
Height = 855
Left = 1080
TabIndex = 0
Top = 1080
Width = 9855
Begin VB.Timer Timer1
Interval = 1000
Left = 6120
Top = 120
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00404000&
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 375
Left = 960
TabIndex = 2
Top = 360
Width = 2175
End
Begin VB.Label Label41
AutoSize = -1 'True
Caption = "注册人数:"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 6720
TabIndex = 44
Top = 360
Width = 1440
End
Begin VB.Label Label39
Alignment = 2 'Center
BackColor = &H00FFFFFF&
BorderStyle = 1 'Fixed Single
Caption = "0"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 375
Left = 8400
TabIndex = 43
Top = 360
Width = 975
End
Begin VB.Label Label3
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H00404000&
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 375
Left = 4680
TabIndex = 4
Top = 360
Width = 1695
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "当前时间:"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 3240
TabIndex = 3
Top = 360
Width = 1440
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "卡号:"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 120
TabIndex = 1
Top = 360
Width = 810
End
End
Begin VB.Shape Shape1
BorderStyle = 6 'Inside Solid
BorderWidth = 3
Height = 8535
Left = 480
Top = 240
Width = 11055
End
Begin VB.Label Label29
Alignment = 2 'Center
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H000080FF&
BorderStyle = 1 'Fixed Single
Caption = "北华大学计算中心开放实验室"
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 465
Left = 3195
TabIndex = 40
Top = 480
Width = 5910
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Const connstr = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=nccc.mdb"
Dim feilv As Double
Private Sub Command1_Click()
temp = 0
sql = "select * from 临时表"
Set rs = conn.Execute(sql)
Do While Not rs.EOF
temp = temp + 1
rs.MoveNext
Loop
Label39.Caption = temp
End Sub
Private Sub Command2_Click()
Set rs = Nothing
Set conn = Nothing
Unload Me
End Sub
Private Sub Command3_Click()
Shell "上机注册.exe", vbNormalFocus
End Sub
Private Sub Form_Load()
conn.Open connstr
temp = 0
sql = "select * from 临时表"
Set rs = conn.Execute(sql)
Do While Not rs.EOF
temp = temp + 1
rs.MoveNext
Loop
Label39.Caption = temp
End Sub
Private Sub Label42_Click()
MsgBox "作者: 北华大学 李鑫 "
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
temp = Text1.Text
temp = Mid(Text1.Text, 1, 7)
sql = "select * from 临时表 where 卡号='" & temp & "'"
Set rs = conn.Execute(sql)
If rs.EOF Or rs.BOF Then
Label22.Caption = ""
Label23.Caption = ""
Label24.Caption = ""
Label25.Caption = ""
Label26.Caption = ""
Label32.Caption = ""
Label33.Caption = ""
Label28.Caption = ""
Label38.Caption = ""
Label17.Caption = ""
temp = "*" & Text1 & "*"
sql = " select * from 基本表 where 条形码='" & temp & "'"
Set rs = conn.Execute(sql)
If rs.EOF Or rs.BOF Then
Label4.Caption = ""
Label6.Caption = ""
Label7.Caption = ""
Label14.Caption = "无此用户信息,非法帐号!注册无效!"
Else
Label4.Caption = rs("卡号")
Label6.Caption = rs("姓名")
Label7.Caption = rs("班级")
sql = "select * from 总帐表 where 卡号='" & Label4.Caption & "'"
Set rs = conn.Execute(sql)
If rs.EOF Or rs.BOF Then
Label14.Caption = "合法用户但是帐号没建立!注册无效!"
Label9.Caption = 0
Label8.Caption = 0
Else
Label9.Caption = rs("自费金额")
Label8.Caption = rs("教学金额")
If rs("自费金额") < 0 Then
Label14.Caption = "自费不足,请补足后上机!注册无效!"
Else
sql = " insert into 临时表 (卡号,注册时间) values ('" & Label4.Caption & "',#" & Now & "#)"
Label14.Caption = "注册成功!欢迎来到北华大学开放实验室!"
conn.Execute sql
End If
End If
End If
Else
Label4.Caption = ""
Label6.Caption = ""
Label7.Caption = ""
Label9.Caption = ""
Label8.Caption = ""
Label14.Caption = ""
temp = "*" & Text1 & "*"
zc_time = rs("注册时间")
sql = " select * from 基本表 where 条形码='" & temp & "'"
Set rs = conn.Execute(sql)
Label26.Caption = rs("卡号")
Label25.Caption = rs("姓名")
Label24.Caption = rs("班级")
sql = "select * from 总帐表 where 卡号='" & Label26.Caption & "'"
Set rs = conn.Execute(sql)
Label22.Caption = rs("自费金额")
Label23.Caption = rs("教学金额")
zx_time = Now
sq_n = Year(zx_time) - Year(zc_time)
sq_y = Month(zx_time) - Month(zc_time)
sq_r = Day(zx_time) - Day(zc_time)
If sq_n <> 0 Or sq_y <> 0 Or sq_r <> 0 Then
zx_time = Date & " " & #9:30:00 PM#
End If
sq_h = Int(Hour(zx_time)) - Int(Hour(zc_time))
sq_m = Int(Minute(zx_time)) - Int(Minute(zc_time))
jishi = Int(sq_h * 60) + Int(sq_m)
'定义费率
feilv = 1.5 / 60
qianshu = feilv * jishi
Label38.Caption = qianshu
jiaoxue = Val(Label23.Caption) - qianshu
zifei = 0
If jiaoxue <= 0 Then
zifei = Val(Label22.Caption) + jiaoxue
jiaoxue = 0
End If
Label23.Caption = jiaoxue
Label22.Caption = zifei
Label28.Caption = jishi & "分钟"
Label32.Caption = Month(zc_time) & "月" & Day(zc_time) & "日" & Hour(zc_time) & "点" & Minute(zc_time) & "分"
Label33.Caption = Month(zx_time) & "月" & Day(zx_time) & "日" & Hour(zx_time) & "点" & Minute(zx_time) & "分"
Label17.Caption = "注销完成,谢谢使用!"
sql = " insert into 流水账 (卡号,注册时间,注销时间,金额) values ('" & Label26.Caption & "','" & zc_time & "','" & zx_time & "','" & qianshu & "')"
conn.Execute sql
sql = "delete * from 临时表 where 卡号='" & Label26.Caption & "'"
conn.Execute sql
sql = "update 总帐表 set 教学金额=" & jiaoxue & ",自费金额=" & zifei & " where 卡号='" & Label26.Caption & "'"
conn.Execute sql
End If
Text1 = ""
End If
temp = 0
sql = "select * from 临时表"
Set rs = conn.Execute(sql)
Do While Not rs.EOF
temp = temp + 1
rs.MoveNext
Loop
Label39.Caption = temp
End Sub
Private Sub Timer1_Timer()
Label3.Caption = Time
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -