📄 lendandback.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form lendandback
AutoRedraw = -1 'True
BorderStyle = 1 'Fixed Single
Caption = "借书&还书"
ClientHeight = 4320
ClientLeft = 45
ClientTop = 330
ClientWidth = 6795
LinkTopic = "Form2"
MaxButton = 0 'False
MDIChild = -1 'True
Picture = "lendandback.frx":0000
ScaleHeight = 4320
ScaleWidth = 6795
Begin VB.CommandButton Command3
Caption = "取消"
Height = 375
Left = 5280
Picture = "lendandback.frx":9C09
Style = 1 'Graphical
TabIndex = 12
Top = 3600
Width = 975
End
Begin VB.CommandButton Command2
Caption = "还书"
Height = 375
Left = 5280
Picture = "lendandback.frx":C469
Style = 1 'Graphical
TabIndex = 11
Top = 3120
Width = 975
End
Begin VB.CommandButton Command1
Caption = "借书"
Height = 375
Left = 5280
Picture = "lendandback.frx":ECC9
Style = 1 'Graphical
TabIndex = 10
Top = 2640
Width = 975
End
Begin MSComctlLib.ListView ListView1
Height = 1575
Left = 120
TabIndex = 8
Top = 600
Width = 6495
_ExtentX = 11456
_ExtentY = 2778
LabelWrap = -1 'True
HideSelection = -1 'True
FullRowSelect = -1 'True
GridLines = -1 'True
HotTracking = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = 14737632
BorderStyle = 1
Appearance = 1
NumItems = 0
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
Height = 270
Index = 3
Left = 3720
TabIndex = 7
Text = "Text1"
Top = 3360
Width = 855
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
Height = 270
Index = 2
Left = 1680
TabIndex = 6
Text = "Text1"
Top = 3360
Width = 855
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
Height = 270
Index = 1
Left = 3720
TabIndex = 5
Text = "Text1"
Top = 2640
Width = 855
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
Height = 270
Index = 0
Left = 1680
TabIndex = 4
Text = "Text1"
Top = 2640
Width = 855
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 240
Left = 1080
TabIndex = 9
Top = 3240
Width = 150
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "班级"
Height = 180
Index = 3
Left = 3120
TabIndex = 3
Top = 3480
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "共欠罚金"
Height = 180
Index = 2
Left = 720
TabIndex = 2
Top = 3480
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "姓名"
Height = 180
Index = 1
Left = 3120
TabIndex = 1
Top = 2760
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "借书借号"
Height = 180
Index = 0
Left = 720
TabIndex = 0
Top = 2760
Width = 720
End
End
Attribute VB_Name = "lendandback"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
lendbook.Show (1)
displendbook
End Sub
Private Sub Command2_Click()
Unload Me
backbook.Show
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim sql As String
Dim i As Integer
sql = "select username,name,money,class from person where username='" & username & "'"
opendb sql, ""
For i = 0 To rs.Fields.Count - 1
Text1(i).Text = rs(i).Value & " "
Text1(i).Locked = True
Next
closedb
ListView1.View = lvwReport
ListView1.ColumnHeaders.Add , , "借书证号"
ListView1.ColumnHeaders.Add , , "借书人姓名"
ListView1.ColumnHeaders.Add , , "图书编号"
ListView1.ColumnHeaders.Add , , "书名"
ListView1.ColumnHeaders.Add , , "价格"
ListView1.ColumnHeaders.Add , , "类别"
ListView1.ColumnHeaders.Add , , "出版社"
ListView1.ColumnHeaders.Add , , "借出日期"
ListView1.ColumnHeaders.Add , , "应还日期"
displendbook
End Sub
Private Sub displendbook()
Dim sql As String
Dim i As Integer
Dim n As Integer
sql = "select * from lendbook where username='" & username & "'"
opendb sql, ""
If rs.EOF Then
MsgBox "您没有借书!", 64, "提示"
closedb
Exit Sub
Else
n = rs.RecordCount
If n = booktotal Then
Command1.Enabled = False
Label2.ForeColor = &HFF&
Label2.Caption = "您已经借了" & Trim(Str(n)) & "本书了,您不以再借书了。"
Else
Label2.ForeColor = &H80000012
Label2.Caption = "您已经借了" & Trim(Str(n)) & "本书了,您还可以借" & Trim(Str(2 - n)) & "本书。"
End If
ListView1.ListItems.Clear
ListView1.GridLines = True
For j = 1 To rs.RecordCount '列出用户所借的书
ListView1.ListItems.Add , , rs.Fields("username") & vbNullString
With ListView1.ListItems(j)
.SubItems(1) = rs.Fields("name") & vbNullString
.SubItems(2) = rs.Fields("bookno") & vbNullString
.SubItems(3) = rs.Fields("booktitle") & vbNullString
.SubItems(4) = rs.Fields("price") & vbNullString
.SubItems(5) = rs.Fields("sort") & vbNullString
.SubItems(6) = rs.Fields("press") & vbNullString
.SubItems(7) = rs.Fields("lenddate") & vbNullString
.SubItems(8) = rs.Fields("backdate") & vbNullString
End With
'统计过期书名
If (Date - CDate(rs("backdate"))) > 0 Then
bookname = bookname & "《" & rs("booktitle") & "》,"
End If
rs.MoveNext
Next
closedb
If Right(bookname, 1) = "," Then
bookname = Mid(bookname, 1, InStrRev(bookname, ",") - 1)
End If
If Trim(bookname) <> "" And money > 0 Then
MsgBox "您的" & Trim(bookname) & "已经过期,请尽快还掉。您所要交的罚金是:" & Trim(Str(money)) & "元", 64, "提示"
ElseIf Trim(bookname) <> "" Then
MsgBox "您的" & Trim(bookname) & "已经过期,请尽快还掉", 64, "提示"
ElseIf money > 0 Then
MsgBox "您要交的罚金:" & Trim(Str(money)) & "元", 64, "提示"
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -