📄 retbook.frm
字号:
VERSION 5.00
Begin VB.Form retbook
Caption = "图示归还"
ClientHeight = 4515
ClientLeft = 60
ClientTop = 345
ClientWidth = 5910
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 4515
ScaleWidth = 5910
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton cmdret
Caption = "返回"
Height = 495
Left = 2400
TabIndex = 12
Top = 3840
Width = 855
End
Begin VB.Frame frame2
Caption = "还书人信息"
Height = 1575
Left = 240
TabIndex = 3
Top = 1920
Width = 5415
Begin VB.TextBox txtborcan
Height = 375
Left = 2760
TabIndex = 14
Top = 960
Width = 855
End
Begin VB.TextBox txtfine
Height = 375
Left = 4560
TabIndex = 11
Top = 960
Width = 735
End
Begin VB.TextBox txtboralready
Height = 375
Left = 960
TabIndex = 9
Top = 960
Width = 855
End
Begin VB.TextBox txtreadername
Height = 375
Left = 3480
TabIndex = 7
Top = 240
Width = 1575
End
Begin VB.TextBox txtreaderid
Height = 375
Left = 1200
TabIndex = 5
Top = 240
Width = 1455
End
Begin VB.Label Label5
Caption = "可借书数"
Height = 255
Left = 1920
TabIndex = 13
Top = 1080
Width = 975
End
Begin VB.Label Label4
Caption = "罚金累计"
Height = 375
Left = 3720
TabIndex = 10
Top = 1080
Width = 1215
End
Begin VB.Label Label3
Alignment = 2 'Center
Caption = "已借书数"
Height = 255
Left = 120
TabIndex = 8
Top = 1080
Width = 855
End
Begin VB.Label Label2
Alignment = 2 'Center
Caption = "姓名"
Height = 255
Left = 2880
TabIndex = 6
Top = 360
Width = 615
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "借书证号"
Height = 255
Left = 120
TabIndex = 4
Top = 360
Width = 1095
End
End
Begin VB.Frame Frame1
Caption = "输入图书编号"
Height = 1215
Left = 480
TabIndex = 0
Top = 360
Width = 4455
Begin VB.CommandButton cmdok
Caption = "确定"
Height = 495
Left = 3240
TabIndex = 2
Top = 480
Width = 735
End
Begin VB.TextBox txtbookid
Height = 495
Left = 360
TabIndex = 1
Top = 480
Width = 2415
End
End
End
Attribute VB_Name = "retbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public readerid As String
Public bookid As String
Private Sub cmdok_Click()
Dim txtsql, msgtext As String
Dim bors As ADODB.Recordset
Dim bs As ADODB.Recordset
Dim rs As ADODB.Recordset
Dim bookeds As ADODB.Recordset
bookid = Trim(txtbookid.Text)
If bookid <> "" Then
txtsql = "select * from borrowinfo where bookid='" & bookid & "'"
Set bors = ExecuteSQL(txtsql, msgtext)
If bors.EOF = True Then
MsgBox "该书不是从本图书管所借,不能归还!", vbOKOnly + vbExclamation, "警告"
Else
readerid = Trim(bors.Fields("readerid"))
txtsql = "select * from books where bookid='" & bookid & "'"
Set bs = ExecuteSQL(txtsql, msgtext)
bs.Fields("borrow") = "n"
bs.Update
If bs.Fields("booked") = "y" Then
txtsql = "select * from booked where bookid='" & bookid & "'"
Set bookeds = ExecuteSQL(txtsql, msgtext)
While (bookeds.EOF = False)
bookeds.Fields("retdate") = Date
bookeds.MoveNext
Wend
End If
txtsql = "select * from readers where readerid='" & readerid & "'"
Set rs = ExecuteSQL(txtsql, msgtext)
rs.Fields("boralready") = rs.Fields("boralready") - 1
rs.Update
txtreaderid.Text = readerid
txtreadername.Text = rs.Fields("readername")
txtboralready.Text = rs.Fields("boralready")
txtborcan.Text = rs.Fields("booknum") - rs.Fields("boralready")
If (Date - bors.Fields("borrowdate") < bors.Fields("bookdays")) Then
txtfine.Text = rs.Fields("fine")
Else
txtfine.Text = (Date - bors.Fields("borrowdate") - bors.Fields("bookdays")) * 0.2
rs.Fields("fine") = txtfine.Text
rs.Update
MsgBox "超期" & Date - bors.Fields("borrowdate") - bors.Fields("bookdays") & "天,罚款" & txtfine.Text & "元!", vbOKOnly + vbExclamation, "警告"
End If
bors.Delete
bors.Update
bors.Close
bs.Close
rs.Close
txtreaderid.Enabled = False
txtreadername.Enabled = False
txtboralready.Enabled = False
txtborcan.Enabled = False
txtfine.Enabled = False
End If
Else
MsgBox "借书证号不能为空,请输入!", vbOKOnly + vbExclamation, "警告"
End If
End Sub
Private Sub cmdret_Click()
Unload Me
End Sub
Private Sub Form_Load()
readerid = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -