📄 returnbook.frm
字号:
VERSION 5.00
Begin VB.Form returnbook
BorderStyle = 1 'Fixed Single
Caption = "正在进行还书操作"
ClientHeight = 5880
ClientLeft = 4380
ClientTop = 2775
ClientWidth = 7455
Icon = "returnbook.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 5880
ScaleWidth = 7455
Begin VB.Frame Frame2
Caption = "书籍信息"
Height = 4575
Left = 120
TabIndex = 4
Top = 1200
Width = 7215
Begin VB.CommandButton Command2
Caption = "关闭(&C)"
Height = 495
Left = 4920
TabIndex = 28
Top = 3960
Width = 1935
End
Begin VB.CommandButton Command1
Caption = "确认还书(&R)"
Enabled = 0 'False
Height = 495
Left = 4920
TabIndex = 27
Top = 3360
Width = 1935
End
Begin VB.TextBox txtM
Height = 375
Left = 4920
TabIndex = 26
Top = 2760
Width = 1935
End
Begin VB.TextBox txtRd
Height = 375
Left = 4920
TabIndex = 24
Top = 2160
Width = 1935
End
Begin VB.TextBox txtLd
Height = 375
Left = 4920
TabIndex = 22
Top = 1560
Width = 1935
End
Begin VB.TextBox txtreader
Height = 375
Left = 4920
TabIndex = 20
Top = 960
Width = 1935
End
Begin VB.TextBox txtsum
Height = 375
Left = 1200
TabIndex = 18
Top = 3960
Width = 1935
End
Begin VB.TextBox txtday
Height = 375
Left = 1200
TabIndex = 16
Top = 3360
Width = 1935
End
Begin VB.TextBox txtdate
Height = 375
Left = 1200
TabIndex = 14
Top = 2760
Width = 1935
End
Begin VB.TextBox txtym
Height = 375
Left = 1200
TabIndex = 12
Top = 2160
Width = 1935
End
Begin VB.TextBox txtzl
Height = 375
Left = 1200
TabIndex = 10
Top = 1560
Width = 1935
End
Begin VB.TextBox txtreaderid
Height = 375
Left = 1200
TabIndex = 8
Top = 960
Width = 1935
End
Begin VB.TextBox txtbookname
Height = 375
Left = 1200
TabIndex = 6
Top = 360
Width = 3375
End
Begin VB.Label Label13
Caption = "罚款金额:"
Height = 375
Left = 3840
TabIndex = 25
Top = 2880
Width = 975
End
Begin VB.Label Label12
Caption = "还书日期:"
Height = 375
Left = 3840
TabIndex = 23
Top = 2280
Width = 975
End
Begin VB.Label Label11
Caption = "借书日期:"
Height = 375
Left = 3840
TabIndex = 21
Top = 1680
Width = 975
End
Begin VB.Label Label10
Caption = "读者姓名:"
Height = 375
Left = 3840
TabIndex = 19
Top = 1080
Width = 975
End
Begin VB.Label Label9
Caption = "超出天数:"
Height = 375
Left = 240
TabIndex = 17
Top = 4080
Width = 975
End
Begin VB.Label Label8
Caption = "实际天数:"
Height = 375
Left = 240
TabIndex = 15
Top = 3480
Width = 975
End
Begin VB.Label Label7
Caption = "规定天数:"
Height = 375
Left = 240
TabIndex = 13
Top = 2880
Width = 975
End
Begin VB.Label Label6
Caption = "书籍页码:"
Height = 375
Left = 240
TabIndex = 11
Top = 2280
Width = 975
End
Begin VB.Label Label5
Caption = "书籍种类:"
Height = 375
Left = 240
TabIndex = 9
Top = 1680
Width = 975
End
Begin VB.Label Label4
Caption = "读者编号:"
Height = 375
Left = 240
TabIndex = 7
Top = 1080
Width = 975
End
Begin VB.Label Label3
Caption = "书籍名称:"
Height = 255
Left = 240
TabIndex = 5
Top = 480
Width = 975
End
End
Begin VB.Frame Frame1
Caption = "输入书籍编号"
Height = 975
Left = 120
TabIndex = 0
Top = 120
Width = 7215
Begin VB.TextBox txtbookid
BackColor = &H00C0FFFF&
Height = 375
Left = 1440
TabIndex = 2
Top = 360
Width = 2535
End
Begin VB.Label Label2
Caption = "〈输入编号后按确定键〉"
ForeColor = &H000000FF&
Height = 255
Left = 4200
TabIndex = 3
Top = 480
Width = 2055
End
Begin VB.Label Label1
Caption = "书籍编号:"
Height = 255
Left = 480
TabIndex = 1
Top = 480
Width = 975
End
End
End
Attribute VB_Name = "returnbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
g_strsql = "select * from lentinfo where 书籍编号='" & txtbookid.Text & "'and 读者编号= '" & txtreaderid.Text & "'" _
& "and 借书日期=#" & txtLd.Text & "#"
Set g_rs = g_db.OpenRecordset(g_strsql)
With g_rs
.Edit
.Fields("还书日期").Value = txtRd.Text
.Fields("超出天数").Value = txtsum.Text
.Fields("罚款金额").Value = txtM.Text
.Update
End With
Set g_rs = Nothing
g_strsql = "select * from bookinfo where 书籍编号='" & txtbookid.Text & "'"
Set g_rs = g_db.OpenRecordset(g_strsql)
With g_rs
.Edit
.Fields("是否借出").Value = False
.Update
End With
Set g_rs = Nothing
txtbookid.Text = ""
txtbookid.SetFocus
txtbookname.Text = ""
txtreaderid.Text = ""
txtzl.Text = ""
txtym.Text = ""
txtdate.Text = ""
txtday.Text = ""
txtsum.Text = ""
txtreader.Text = ""
txtLd.Text = ""
txtRd.Text = ""
txtM.Text = ""
Command1.Enabled = False
MsgBox "归还完毕,请返回!", vbInformation + vbOKOnly, "信息"
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
dbl
End Sub
Private Sub txtbookid_keypress(keyascii As Integer)
If keyascii = "13" And txtbookid.Text <> "" Then
g_strsql = "select bookinfo.书籍名称,readerinfo.读者姓名,booktype.书籍类别," _
& " bookinfo.书籍页码,lentinfo.书籍编号,lentinfo.读者编号,lentinfo.借书日期, " _
& " booktype.借出天数" _
& " from bookinfo,readerinfo,booktype,lentinfo " _
& " where readerinfo.读者编号=lentinfo.读者编号 and bookinfo.书籍编号=lentinfo.书籍编号 " _
& " and bookinfo.书籍编号='" & txtbookid.Text & "' and bookinfo.类别代码=booktype.类别代码 and 还书日期 is null"
Set g_rs = g_db.OpenRecordset(g_strsql)
If Not g_rs.EOF Then
txtbookname.Text = g_rs!书籍名称
txtreaderid.Text = g_rs!读者编号
txtzl.Text = g_rs!书籍类别
txtym.Text = g_rs!书籍页码
txtreader.Text = g_rs!读者姓名
txtLd.Text = g_rs!借书日期
txtdate.Text = g_rs!借出天数
txtRd.Text = Date
txtday.Text = CStr(Date - g_rs!借书日期)
If CInt(txtday.Text) - CInt(txtdate.Text) > 0 Then
txtsum.Text = CStr(CInt(txtday.Text) - CInt(txtdate.Text))
Else
txtsum.Text = "0"
End If
Set g_rs = Nothing
Set g_rs = g_db.OpenRecordset("select * from setinfo")
txtM.Text = g_rs!罚款 * CInt(txtsum.Text)
Set g_rs = Nothing
Command1.Enabled = True
Else
Set g_rs = Nothing
MsgBox "没有该图书信息或该图书尚未借出,请返回!", vbInformation + vbOKOnly, "信息"
txtbookid.Text = ""
txtbookid.SetFocus
txtbookname.Text = ""
txtreaderid.Text = ""
txtzl.Text = ""
txtym.Text = ""
txtdate.Text = ""
txtday.Text = ""
txtsum.Text = ""
txtreader.Text = ""
txtLd.Text = ""
txtRd.Text = ""
txtM.Text = ""
End If
ElseIf keyascii = "13" And txtbookid.Text = "" Then
MsgBox "请输入需要返还的图书编号!", vbInformation + vbOKOnly, "信息"
txtbookid.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -