📄 frmreturn.frm
字号:
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 720
TabIndex = 10
Top = 2160
Width = 1260
End
Begin VB.Label lblLibraryId
AutoSize = -1 'True
Caption = "借书证号"
BeginProperty Font
Name = "Times New Roman"
Size = 14.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 720
TabIndex = 9
Top = 2760
Width = 1260
End
Begin VB.Label lblInfo
Alignment = 2 'Center
BackColor = &H00000080&
Caption = "还书信息记录"
BeginProperty Font
Name = "Times New Roman"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 375
Left = 0
TabIndex = 6
Top = 0
Width = 5775
End
End
Attribute VB_Name = "frmReturn"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim BookNo As String
Dim issueDate As Date
Dim currDate As Date
Dim totalDaysUsed As Integer
Dim totalFineAmt As Integer
'assigning Srch value
BookNo = txtBookId.Text
'If enter is pressed by user than auto-generate record
clear
'Prompt if invalid search key is entered by user
If Not IsNumeric(BookNo) Then
MsgBox "输入有误!!", vbCritical, "查找出错"
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, "yyyy-mm-dd")
txtIssueDate.Text = rsIssueInfo(1)
issueDate = CDate(txtIssueDate.Text)
currDate = CDate(Format(Now, "yyyy-mm-dd"))
totalDaysUsed = DateDiff("d", issueDate, currDate)
If totalDaysUsed > 60 Then
txtFineAmt.Visible = True
lblFineAmt.Visible = True
totalDaysUsed = totalDaysUsed - 60
totalFineAmt = 0.1 * totalDaysUsed
txtDaysUsed.ForeColor = vbRed
txtFineAmt.ForeColor = vbRed
txtDaysUsed.Text = totalDaysUsed & "超期"
txtFineAmt.Text = "¥" & totalFineAmt
Else
txtDaysUsed.ForeColor = vbBlack
txtFineAmt.Visible = False
lblFineAmt.Visible = False
txtDaysUsed.Text = totalDaysUsed
End If
'txtDaysUsed.Text = totalDaysUsed
'MsgBox "Total days used " & totalDaysUsed & " And Fine amt is " & totalFineAmt
Exit For
End If
rsIssueInfo.MoveNext
Next
If txtLibraryId.Text = "" Then
MsgBox "无此记录!!", vbInformation, "查找结果"
cmdSave.Enabled = False
clear
Else
cmdSave.Enabled = True
End If
End Sub
Private Sub Form_Load()
'Setting up the info. label
lblInfo.Left = Me.ScaleLeft
lblInfo.Top = Me.ScaleTop
lblInfo.Width = Screen.Width
txtFineAmt.Visible = False
lblFineAmt.Visible = False
Frame2.Left = (Screen.Width - Frame2.Width) / 2
If rsIssueInfo.RecordCount = 0 Then
MsgBox "No Book Issued and so No Return", vbInformation, "Record Issue Book Record"
Unload Me
End If
cmdSave.Enabled = False
End Sub
Private Sub Form_Activate()
clear
End Sub
Private Sub cmdBookOpen_Click()
frmBookInfo.Show
frmBookInfo.SetFocus
End Sub
Private Sub cmdMemberOpen_Click()
frmMemberInfo.Show
frmMemberInfo.SetFocus
End Sub
'========================================================
'Database Related Code...!!!
'========================================================
Private Sub cmdCancel_Click()
clear
End Sub
'Delete Record or Return Book
Private Sub cmdsave_click()
'On Error Resume Next
If txtLibraryId.Text = "" Then
cmdSave.Enabled = False
End If
rsIssueInfo.Delete
txtFineAmt.Visible = False
lblFineAmt.Visible = False
Call clear
End Sub
'Supporting Function
'Simple clearing of textBox
Private Sub clear()
txtIssueDate.Text = ""
txtBookId.Text = ""
txtDaysUsed.Text = ""
txtFineAmt.Text = ""
txtLibraryId.Text = ""
txtReturnDate.Text = ""
txtBookId.SetFocus
End Sub
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
'assigning Srch value
BookNo = txtBookId.Text
'If enter is pressed by user than auto-generate record
If KeyAscii = 13 Then
clear
'Prompt if invalid search key is entered by user
If Not IsNumeric(BookNo) Then
MsgBox "输入有误!!", vbCritical, "查找出错"
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)
txtIssueDate.Text = rsIssueInfo(1)
txtReturnDate.Text = Format(Now, "yyyy-mm-dd")
issueDate = CDate(txtIssueDate.Text)
currDate = CDate(Format(Now, "yyyy-mm-dd"))
totalDaysUsed = DateDiff("d", issueDate, currDate)
If totalDaysUsed > 60 Then
txtFineAmt.Visible = True
lblFineAmt.Visible = True
totalDaysUsed = totalDaysUsed - 60
totalFineAmt = 0.1 * totalDaysUsed
txtDaysUsed.ForeColor = vbRed
txtFineAmt.ForeColor = vbRed
txtDaysUsed.Text = totalDaysUsed & "超期"
txtFineAmt.Text = "¥" & totalFineAmt
Else
txtDaysUsed.ForeColor = vbBlack
txtFineAmt.Visible = False
lblFineAmt.Visible = False
txtDaysUsed.Text = totalDaysUsed
End If
'txtDaysUsed.Text = totalDaysUsed
'MsgBox "Total days used " & totalDaysUsed & " And Fine amt is " & totalFineAmt
Exit For
End If
rsIssueInfo.MoveNext
Next
If txtLibraryId.Text = "" Then
MsgBox "无此记录!!", vbInformation, "查找结果"
cmdSave.Enabled = False
clear
Else
cmdSave.Enabled = True
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -