📄 frmreturnenter.frm
字号:
VERSION 5.00
Begin VB.Form frmreturnenter
BorderStyle = 3 'Fixed Dialog
Caption = "返还登记"
ClientHeight = 2715
ClientLeft = 2895
ClientTop = 3480
ClientWidth = 7500
Icon = "frmreturnenter.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 2715
ScaleWidth = 7500
ShowInTaskbar = 0 'False
Begin VB.CommandButton Cmdenter
Caption = "登记"
Height = 375
Left = 3840
TabIndex = 16
Top = 2280
Width = 975
End
Begin VB.TextBox Txtfine
Height = 315
Left = 4800
TabIndex = 15
Top = 1320
Width = 1695
End
Begin VB.TextBox Txtreaderindex
Height = 315
Left = 1440
TabIndex = 13
Top = 120
Width = 1695
End
Begin VB.TextBox Txtreturntime
Height = 315
Left = 4800
TabIndex = 12
Top = 720
Width = 1695
End
Begin VB.TextBox Txtbookname
Height = 315
Left = 4800
TabIndex = 11
Top = 120
Width = 2415
End
Begin VB.TextBox Txtreturntimes
Height = 315
Left = 1440
TabIndex = 10
Top = 1920
Width = 1695
End
Begin VB.TextBox Txtborrowtime
Height = 315
Left = 1440
TabIndex = 9
Top = 1320
Width = 1695
End
Begin VB.TextBox Txtbookindex
Height = 315
Left = 1440
TabIndex = 8
Top = 720
Width = 1695
End
Begin VB.CommandButton Cmdclose
Caption = "关闭"
Height = 375
Left = 6240
TabIndex = 7
Top = 2280
Width = 975
End
Begin VB.CommandButton Cmdtransat
Caption = "返还处理"
Height = 375
Left = 5040
TabIndex = 6
Top = 2280
Width = 975
End
Begin VB.Label Lblfine
AutoSize = -1 'True
Caption = "过期罚金"
Height = 180
Left = 3480
TabIndex = 14
Top = 1440
Width = 720
End
Begin VB.Label Lblbookname
AutoSize = -1 'True
Caption = "图 书 名 称"
Height = 180
Left = 3480
TabIndex = 5
Top = 240
Width = 990
End
Begin VB.Label Lblreturntime
AutoSize = -1 'True
Caption = "预计返还时间"
Height = 180
Left = 3480
TabIndex = 4
Top = 840
Width = 1080
End
Begin VB.Label Lblreturntime2
AutoSize = -1 'True
Caption = "实际返还时间"
Height = 180
Left = 240
TabIndex = 3
Top = 2040
Width = 1080
End
Begin VB.Label Lblborrowtime
AutoSize = -1 'True
Caption = "借阅时间"
Height = 180
Left = 240
TabIndex = 2
Top = 1440
Width = 720
End
Begin VB.Label Lblbookindex
AutoSize = -1 'True
Caption = "图书编号"
Height = 180
Left = 240
TabIndex = 1
Top = 840
Width = 720
End
Begin VB.Label Lblreaderindex
AutoSize = -1 'True
Caption = "读者编号"
Height = 180
Left = 240
TabIndex = 0
Top = 240
Width = 720
End
End
Attribute VB_Name = "frmreturnenter"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Cmdclose_Click()
Unload Me
End Sub
Private Sub Cmdenter_Click()
'登记时清空窗体
Txtreaderindex.Text = Empty
Txtbookindex.Text = Empty
Txtbookname.Text = Empty
Txtborrowtime.Text = Empty
Txtreturntime.Text = Empty
End Sub
Private Sub Cmdtransat_Click()
'Dim degre As Integer
Dim strInsertSQL As String
'判断输入的数据是否完整
If (Trim(Txtreaderindex.Text) = Empty) _
Or (Trim(Txtbookindex.Text) = Empty) Then
MsgBox "请输入读者编号和图书编号...", vbInformation + vbOKOnly, "返还资料不完整"
' 弹出消息框,判断输入的数据是否准确,如果准确向数据库中倒入数据
ElseIf MsgBox("读者编号:" & Trim(Txtreaderindex.Text) & vbCrLf & _
"图书编号:" & Trim(Txtbookindex.Text) & vbCrLf & _
"图书名称:" & Trim(Txtbookname.Text) & vbCrLf & _
"借阅时间:" & Trim(Txtborrowtime.Text) & vbCrLf & _
"预计返还时间:" & Trim(Txtreturntime.Text) & vbCrLf & _
"实际返还时间:" & Trim(Txtreturntimes.Text) & vbCrLf & _
"过期处理:" & Trim(Txtfine.Text) _
, vbOKCancel + vbInformation, "返还资料确认") = vbOK Then
If g_DBRct.State = adStateOpen Then
g_DBRct.Close
End If
'在借阅表中插入返回时间,更改图书的状态为在库,向图书表中的数量字段加一
g_DBCon.Execute ("update borrowmessage set returntimes='" & CDate(Trim(Txtreturntimes.Text)) & "'where bookindex='" & Trim(Txtbookindex.Text) & "'and readerindex='" & Trim(Txtreaderindex.Text) & "'")
g_DBCon.Execute ("update borrowmessage set states=1 where bookindex='" & Trim(Txtbookindex.Text) & "'and readerindex='" & Trim(Txtreaderindex.Text) & "'")
g_DBCon.Execute ("update bookmessage set numbers=numbers+1 where bookindex='" & Trim(Txtbookindex.Text) & "'")
MsgBox "返还资料已保存...", vbInformation + vbOKOnly, "保存成功"
Txtreaderindex.Text = Empty
Txtbookindex.Text = Empty
Txtbookname.Text = Empty
End If
End Sub
Private Sub Form_Load()
'窗体加载时,自动生成返回时间
Txtreturntimes.Text = Date
Txtreaderindex.Text = Empty
Txtbookindex.Text = Empty
Txtbookname.Text = Empty
Txtborrowtime.Text = Empty
Txtreturntime.Text = Empty
End Sub
Private Sub Txtbookindex_click()
If g_DBRct.State = adStateOpen Then
g_DBRct.Close
End If
'判断读者编号是否存在
g_DBRct.Filter = "readerindex='" & Trim(Txtreaderindex.Text) & "'"
g_DBRct.Open "select readerindex from readermessage", g_DBCon, adOpenDynamic, adLockOptimistic
If g_DBRct.BOF = True And g_DBRct.EOF = True Then
MsgBox "读者编号不存在!", vbCritical + vbYesNo, "错误读者编号"
Txtreaderindex.Text = ""
End If
End Sub
Private Sub Txtbookname_click()
Dim x As Integer
If g_DBRct.State = adStateOpen Then
g_DBRct.Close
End If
'判断图书编号是否存在
g_DBRct.Filter = "bookindex='" & Trim(Txtbookindex.Text) & "'"
g_DBRct.Open "select bookindex,bookname from bookmessage", g_DBCon, adOpenDynamic, adLockOptimistic
If g_DBRct.BOF = True And g_DBRct.EOF = True Then
MsgBox "图书编号不存在!", vbCritical + vbYesNo, "错误图书编号"
Txtbookindex.Text = ""
Else
Txtbookname.Text = g_DBRct!bookname
If g_DBRct.State = adStateOpen Then
g_DBRct.Close
Set g_DBRct = Nothing
End If
'自动生成图书名称
Dim st As String
st = "select BorrowTime,ReturnTime from BorrowMessage where states=0 and bookindex=" & Trim(Txtbookindex.Text)
'判断图书是否反还
g_DBRct.Open st, g_DBCon, adOpenDynamic, adLockOptimistic
If g_DBRct.BOF = True And g_DBRct.EOF = True Then
MsgBox "该书已经返还了!", vbInformation + vbOKOnly, "书已返还"
Txtbookindex.Text = ""
Txtbookname.Text = ""
Else
'自动生成借阅时间与理论返还书间
Txtborrowtime.Text = g_DBRct!borrowtime
Txtreturntime.Text = g_DBRct!returntime
'判断是否超过时间,如超时,则给出罚款金额
x = Date - CDate(Txtreturntime.Text)
If x > 0 Then
Txtfine.Text = "超过" & CStr(x) & "天,罚款金额为:" & CStr(x * 0.5) & "元"
Else
Txtfine.Text = "没有超过时间"
End If
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -