📄 frmreturn.frm
字号:
VERSION 5.00
Begin VB.Form frmReturn
BackColor = &H00FFFFFF&
Caption = "还书"
ClientHeight = 5940
ClientLeft = 120
ClientTop = 420
ClientWidth = 10875
LinkTopic = "Form2"
MDIChild = -1 'True
ScaleHeight = 5940
ScaleWidth = 10875
WindowState = 2 'Maximized
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 495
Left = 7440
TabIndex = 14
Top = 5040
Width = 1215
End
Begin VB.CommandButton cmdSave
Caption = "保存"
Height = 495
Left = 6000
TabIndex = 13
Top = 5040
Width = 1215
End
Begin VB.TextBox txtFineAmt
Height = 615
Left = 2520
TabIndex = 12
Text = "Text1"
Top = 4560
Width = 1695
End
Begin VB.TextBox txtDaysUsed
BackColor = &H00FFFFFF&
Height = 615
Left = 2520
TabIndex = 9
Text = "Text1"
Top = 3780
Width = 1695
End
Begin VB.TextBox txtLibraryId
BackColor = &H00FFFFFF&
Height = 615
Left = 2520
TabIndex = 8
Text = "Text1"
Top = 3000
Width = 1695
End
Begin VB.TextBox txtReturnDate
BackColor = &H00FFFFFF&
Height = 615
Left = 2520
TabIndex = 6
Text = "Text1"
Top = 2220
Width = 1695
End
Begin VB.TextBox txtIssueDate
Height = 615
Left = 2520
TabIndex = 4
Text = "Text2"
Top = 1440
Width = 1695
End
Begin VB.Frame Frame1
Caption = "输入图书编号后回车"
BeginProperty Font
Name = "宋体"
Size = 7.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 600
TabIndex = 0
Top = 480
Width = 6855
Begin VB.TextBox txtBookId
BackColor = &H00FFFFFF&
Height = 510
Left = 1920
TabIndex = 2
Text = "Text1"
Top = 120
Width = 1935
End
Begin VB.Label Label1
Caption = "图书编号"
BeginProperty Font
Name = "微软雅黑"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 0
TabIndex = 1
Top = 240
Width = 1575
End
End
Begin VB.Label Label6
Caption = "罚款金额"
BeginProperty Font
Name = "微软雅黑"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 11
Top = 4560
Width = 1455
End
Begin VB.Label Label5
Caption = "出借日期"
BeginProperty Font
Name = "微软雅黑"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 10
Top = 3840
Width = 1215
End
Begin VB.Label Label4
Caption = "图书馆编号"
BeginProperty Font
Name = "微软雅黑"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 600
TabIndex = 7
Top = 3000
Width = 1455
End
Begin VB.Label Label3
Caption = "归还日期"
BeginProperty Font
Name = "微软雅黑"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 5
Top = 2280
Width = 1575
End
Begin VB.Label Label2
Caption = "出借日期"
BeginProperty Font
Name = "微软雅黑"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 3
Top = 1440
Width = 1455
End
End
Attribute VB_Name = "frmReturn"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdCancel_Click()
End
End Sub
Private Sub cmdSave_Click()
If txtLibraryId.Text = "" Then
cmdSave.Enabled = False
End If
rsIssueInfo.Delete
txtFineAmt.Visible = False
lblFineAmt.Visible = False
Call clear
End Sub
'以下的clear函数用于清空文本信息
Private Sub clear()
txtIssueDate.Text = ""
txtBookId.Text = ""
txtDaysUsed.Text = ""
txtFineAmt.Text = ""
txtLibraryId.Text = ""
txtReturnDate.Text = ""
txtBookId.SetFocus
End Sub
'文本框的KeyPress事件
Private Sub Txtbookid_KeyPress(KeyAscii As Integer)
Dim BookNo As String
Dim issueDate As Date
Dim currDate As Date
Dim totalDaysUsed As Integer
Dim totalFineAmt As Integer
'获取图书编号值
BookNo = txtBookId.Text
'若用户按回车键,则自动产生记录
If KeyAscii = 13 Then
clear
If Not IsNumeric(BookNo) Then
MsgBox "Invalid search key entered", vbCritical, "Search error"
Call clear
Exit Sub
End If
rsIssueInfo.MoveFirst
For i = 0 To rsIssueInfo.RecordCount
If rsIssueInfo.EOF = True Then
Exit For
End If
'将数据库中的值返回到页面中
If rsIssueInfo(0) = Val(Trim$(BookNo)) Then
txtLibraryId.Text = rsIssueInfo(2)
txtReturnDate.Text = Format(Now, "mm/dd/yy")
txtIssueDate.Text = rsIssueInfo(1)
issueDate = CDate(txtIssueDate.Text)
currDate = CDate(Format(Now, "mm/dd/yy"))
totalDaysUsed = DateDiff("d", issueDate, currDate)
If totalDaysUsed > maxDays Then '判断学生还书是否过期
txtFineAmt.Visible = True
lblFineAmt.Visible = True
'计算过期金额
totalDaysUsed = totalDaysUsed - maxDays
totalFineAmt = fineAmt * totalDaysUsed
txtDaysUsed.ForeColor = vbRed
txtFineAmt.ForeColor = vbRed
txtDaysUsed.Text = totalDaysUsed & "Days Beyond Limit"
txtFineAmt.Text = "$" & totalFineAmt
Else
txtDaysUsed.ForeColor = vbBlack
txtFineAmt.Visible = False
lblFineAmt.Visible = False
txtDaysUsed.Text = totalDaysUsed
End If
Exit For
End If
rsIssueInfo.MoveNext
Next
If txtLibraryId.Text = "" Then
MsgBox "Search Not Found", vbInformation, "Search Result"
cmdSave.Enabled = False
clear
Else
cmdSave.Enabled = True
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -