⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmreturning3.frm

📁 School Library system to manage students borrowing and returning books
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Left            =   4800
         Style           =   1  'Graphical
         TabIndex        =   2
         Top             =   4560
         Width           =   1095
      End
      Begin VB.TextBox txtfine 
         Alignment       =   1  'Right Justify
         DataField       =   "fine"
         DataSource      =   "datborrowed"
         Enabled         =   0   'False
         Height          =   285
         Left            =   2760
         TabIndex        =   1
         Text            =   "Kshs."
         Top             =   3240
         Width           =   975
      End
      Begin VB.Label Label4 
         Caption         =   "Other Books in Possesion"
         Height          =   375
         Left            =   7560
         TabIndex        =   33
         Top             =   240
         Width           =   2055
      End
      Begin VB.Label Label1 
         Caption         =   "Book  ID"
         Height          =   255
         Index           =   1
         Left            =   240
         TabIndex        =   16
         Top             =   960
         Width           =   855
      End
      Begin VB.Label Label1 
         Caption         =   "Date Borrowed"
         Height          =   255
         Index           =   2
         Left            =   240
         TabIndex        =   15
         Top             =   1680
         Width           =   1215
      End
      Begin VB.Label Label1 
         Caption         =   "Date to Return"
         Height          =   255
         Index           =   3
         Left            =   240
         TabIndex        =   14
         Top             =   2040
         Width           =   1215
      End
      Begin VB.Label Label2 
         Caption         =   "Book Name"
         Height          =   255
         Left            =   240
         TabIndex        =   13
         Top             =   480
         Width           =   855
      End
      Begin VB.Label Label3 
         Caption         =   "ISBN"
         Height          =   255
         Left            =   240
         TabIndex        =   12
         Top             =   1320
         Width           =   855
      End
      Begin VB.Label lblreturned 
         Caption         =   "Date Returned"
         Height          =   255
         Left            =   240
         TabIndex        =   11
         Top             =   2400
         Width           =   1095
      End
      Begin VB.Label lblamount 
         Caption         =   "Amount Charged"
         Height          =   255
         Left            =   1440
         TabIndex        =   10
         Top             =   2880
         Width           =   1215
      End
      Begin VB.Label lblfine 
         Caption         =   "Fine"
         Height          =   255
         Left            =   3000
         TabIndex        =   9
         Top             =   2880
         Width           =   615
      End
   End
End
Attribute VB_Name = "frmreturning"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim bookid As String, bid As String, curtype As String, X As String, find As String, askuser As String, noor As String, value As Currency
Private Sub cbobookname_click()
'getting that record and displaing its details to the user
If cbobookname <> "" Then
search
find = cbobookname.Text
X = txtbid.Text
listbooksinposession
search
Else
End If

End Sub
Private Sub search()
'for seaching the selected book
Dim a, b
datborrowed.Recordset.MoveFirst
find = cbobookname.Text
If Trim(find) <> "" Then
find = "bookname='" + find + "'"

datborrowed.Recordset.FindFirst find
ElseIf find = "" Then
a = MsgBox("you must give a name", vbInformation, "Book id")
End If

If datborrowed.Recordset.NoMatch Then
b = MsgBox("no such name", vbInformation, "Book ID not found")
End If
End Sub

Private Sub cmdexit_Click()
Unload Me
End Sub

Private Sub cmdsave_Click()
If cbobookname <> "" Then
CallSave
Else
MsgBox "No Books Selected"
End If
End Sub

Private Sub Form_Activate()
'used for returning books that have been borrowed
Dim book As String, count1 As Long
On Error GoTo er
datborrowed.Recordset.MoveFirst
Do While Not datborrowed.Recordset.EOF
bookname = datborrowed.Recordset.Fields("bookname")
cbobookname.AddItem bookname
count1 = count1 + 1
datborrowed.Recordset.movenext
Loop
If count1 = 0 Then
er: MsgBox "There are no Books Borrowed"
Unload Me
End If
'txttotal.Text = 0
End Sub
Private Sub CallSave()
'for saving the data
Dim amount As Currency, fine, tamount As Currency
Dim datet As Date
amount = txtamount.Text
fine = txtfine.Text
'tamount = txttotal.Text
datet = Date
bid = txtbid.Text
bookid = txtbookid.Text
noor = cbobookname.Text
searchbookinfo
searchcirc
calculatetotal
datreturn.Recordset.addnew
datreturn.Recordset.Fields("bookID") = bookid
datreturn.Recordset.Fields("studentID") = bid
datreturn.Recordset.Fields("amount") = amount
datreturn.Recordset.Fields("fine") = fine
datreturn.Recordset.Fields("total") = value
datreturn.Recordset.Fields("date") = datet
datreturn.Recordset.Update
populate
End Sub
Private Sub searchbookinfo()
'searching trough the book details table and update the record
Dim a, b, find
datbookinfo.Recordset.MoveFirst
find = txtbookid.Text
If Trim(find) <> "" Then
find = "bookid='" + find + "'"
datbookinfo.Recordset.FindFirst find
datbookinfo.Recordset.Edit
datbookinfo.Recordset.Fields("borrowed") = 0
datbookinfo.Recordset.Update
MsgBox "Book successiful"
ElseIf find = "" Then
a = MsgBox("you must give a name", vbInformation, "Book id")
End If

If datbookinfo.Recordset.NoMatch Then
b = MsgBox("No such name", vbInformation, "Book ID not found")
End If
End Sub
Private Sub searchcirc()
'searching the book trough the circulation table and delting the record
Dim a, b, find As String
datborrowedtable.Recordset.MoveFirst
find = txtbookid.Text
If Trim(find) <> "" Then
find = "bookID='" + find + "'"

datborrowedtable.Recordset.FindFirst find
datborrowedtable.Recordset.Edit
datborrowedtable.Recordset.Delete
datborrowedtable.Refresh
ElseIf find = "" Then
a = MsgBox("you must give a name", vbInformation, "Book id")
End If

If datborrowedtable.Recordset.NoMatch Then
b = MsgBox("No such name", vbInformation, "Book ID not found")
End If
End Sub
 
Private Sub Form_Load()
curtype = "Kshs."
End Sub

Private Sub listbooksinposession()
'to display other books that the borrower has
Dim Y
On Error GoTo Errormoha
Y = cbobookname.Text
lstbooks.Clear
datborrowed.Recordset.MoveFirst
Do While Not datborrowed.Recordset.EOF
If datborrowed.Recordset.Fields("studentID") = X Then
Dim mnu As String
mnu = datborrowed.Recordset.Fields("bookname")
     If mnu = Y Then
     Else
     lstbooks.AddItem mnu
     End If
Else
End If
datborrowed.Recordset.movenext
Loop
Errormoha:

End Sub

Private Sub populate()
'asking user if he awnts to return morebooks after an initial return was successiful
askuser = MsgBox("Successifull, Want to Return Another?", vbYesNoCancel + vbCritical, "Borrowing Book")

     If askuser = vbYes Then
     frmsuccessiful.TIMEME2.Enabled = True
     Unload frmreturning
     
     ElseIf askuser = vbNo Then
     Unload Me
     End If
End Sub
Private Sub cleartxtboxes()
txtbookid.Text = ""
txtfn.Text = ""
txtsn.Text = ""
txttn.Text = ""
txtbid.Text = ""
txttotal.Text = 0
txtamount.Text = ""
txtfine.Text = ""
txtisbn.Text = ""
txtdateb.Text = ""
txtdater.Text = ""
txtdatetor.Text = ""
txtbaddress.Text = ""
End Sub
Private Sub repopulate()
'populating the combo box with books that have been borrowed
Dim countbook As Long, c, b
countbook = 0
datbookinfo.Recordset.MoveFirst
Do While Not datbookinfo.Recordset.EOF
b = datbookinfo.Recordset.Fields("bookname")
If datbookinfo.Recordset.Fields("borrowed") = 1 Then
cbobookname.AddItem b
countbook = countbook + 1
End If
datbookinfo.Recordset.movenext
Loop
If countbook = 0 Then
c = MsgBox("There are no Books Borrowed", vbOKCancel + vbCritical, "Book Borrowing")
Unload Me
ElseIf countbook > 0 Then
Exit Sub
End If
End Sub
Private Sub calculatetotal()
Dim z As Integer, s As Date, d As Date
txtdater.Text = Date
s = Date
d = txtdatetor.Text
z = (s - d)
If z < 0 Then
value = txtamount.Text
ElseIf z > 0 Then
value = txtamount + (z * txtfine)
End If
txttotal.Text = curtype & value
MsgBox "Total amount to collect is" & vbNewLine & value
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -