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

📄 frmretbook.frm

📁 这是一个比较实用的图书馆管理系统的源代码。
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmRetbook 
   Caption         =   "还书处理"
   ClientHeight    =   4125
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4905
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4125
   ScaleWidth      =   4905
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton Comm3 
      Caption         =   "返回"
      Height          =   495
      Left            =   2520
      TabIndex        =   15
      Top             =   3240
      Width           =   1335
   End
   Begin VB.CommandButton Comm2 
      Caption         =   "列罚款单"
      Height          =   495
      Left            =   600
      TabIndex        =   14
      Top             =   3240
      Width           =   1215
   End
   Begin VB.Frame Frame2 
      Caption         =   "还书人信息"
      Height          =   1575
      Left            =   360
      TabIndex        =   3
      Top             =   1440
      Width           =   4335
      Begin VB.TextBox Text2 
         Height          =   315
         Index           =   4
         Left            =   3480
         TabIndex        =   13
         Top             =   960
         Width           =   615
      End
      Begin VB.TextBox Text2 
         Height          =   315
         Index           =   3
         Left            =   2280
         TabIndex        =   12
         Top             =   960
         Width           =   615
      End
      Begin VB.TextBox Text2 
         Height          =   315
         Index           =   2
         Left            =   840
         TabIndex        =   11
         Top             =   960
         Width           =   615
      End
      Begin VB.TextBox Text2 
         Height          =   315
         Index           =   1
         Left            =   2640
         TabIndex        =   10
         Top             =   360
         Width           =   1455
      End
      Begin VB.TextBox Text2 
         Height          =   315
         Index           =   0
         Left            =   840
         TabIndex        =   9
         Top             =   360
         Width           =   1215
      End
      Begin VB.Label Label1 
         Caption         =   "罚金"
         Height          =   375
         Index           =   4
         Left            =   3000
         TabIndex        =   8
         Top             =   960
         Width           =   615
      End
      Begin VB.Label Label1 
         Caption         =   "可借书数"
         Height          =   375
         Index           =   3
         Left            =   1560
         TabIndex        =   7
         Top             =   960
         Width           =   855
      End
      Begin VB.Label Label1 
         Caption         =   "已借书数"
         Height          =   375
         Index           =   2
         Left            =   120
         TabIndex        =   6
         Top             =   960
         Width           =   855
      End
      Begin VB.Label Label1 
         Caption         =   "姓名"
         Height          =   375
         Index           =   1
         Left            =   2280
         TabIndex        =   5
         Top             =   360
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "借书证号"
         Height          =   375
         Index           =   0
         Left            =   120
         TabIndex        =   4
         Top             =   360
         Width           =   855
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "输入编号"
      Height          =   975
      Left            =   360
      TabIndex        =   0
      Top             =   240
      Width           =   4335
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   240
         TabIndex        =   2
         Top             =   360
         Width           =   1935
      End
      Begin VB.CommandButton Comm1 
         Caption         =   "确定"
         Height          =   375
         Left            =   2760
         TabIndex        =   1
         Top             =   360
         Width           =   975
      End
   End
End
Attribute VB_Name = "frmRetbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public rno As String
Public bno As stri

Private Sub Comm1_Click() '输入图书编号确定
  bno = Trim(Text1.Text)
  Dim brs As ADODB.Recordset
  Dim bs As ADODB.Recordset
  Dim rs As ADODB.Recordset
  If bno <> "" Then
     Dim sqltxt As String
       sqltxt = "select * from borrow where 图书编号='" + bno + "'"
       Set brs = exesql(sqltxt)
       If brs.RecordCount = 0 Then
          MsgBox "该书不是从本图书馆借的,不能归还!", vbOKOnly, "信息提示"
        Else
          If Trim(brs.Fields("借书证号")) <> rno Then
             If rno <> "" Then '另一读者还书,自动列出上一个还书人的罚款单
             dstr = "罚款单" + Chr(10) + Chr(13)
             dstr = dstr + "姓名:" + Trim(Text2(1).Text) + "(" + rno + _
                 ")罚款总额:" + Str(Text2(4).Text) + "元"
              MsgBox dstr, vbOKOnly, "列罚款单"
           End If
           
           rno = Trim(brs.Fields("借书证号"))
           sqltxt = "select * from book where 图书编号='" + bno + "'"
        '处理图书记录
        Set bs = extsql(sqltxt)
        bs.Fields("借否") = "否"
        bs.Update
        
        sqltxt = "select * from reader where 借书证号='" + rno + "'"
        '处理图书记录
        Set rs = exesql(sqltxt)
        rs.Fields("已借书数") = rs.Fields("已借书数") - 1
        rs.Update
        
        Text2(0).Text = rno '修改界面显示
        Text2(1) = rs.Fields("姓名")
        Text2(2) = rs.Fields("已借书数")
        Text2(3) = rs.Fields("借书总数") - rs.Fields("已借书数")
        
        If (Date - brs.Fields("借书日期 ") < rs.Fields("借书天数")) Then
           Text2(4).Text = 0
        Else
           Text2(4).Text = (Date - brs.Fields("借书日期") - rs.Fields("借书天数")) * rs.Fields("过期罚款")
        End If
        
        MsgBox "过期罚款:" + Str(rs.Fields("过期罚款"))
     Else   '连续还书,即还第2本书,第3本书......
         rno = Trim(brs.Fields("借书证号"))
         sqltxt = "select * from book where 图书编号='" + bno + "'"
         '处理图书记录
         Set bs = exesql(sqltxt)
         bs.Fields("借否") = "否"
         bs.Update
         '处理读者记录
         sqltxt = "select * from reader where 借书证号='" + rno + "'"
         Set rs = exesql(sqltxt)
         rs.Fields("已借书数") = rs.Fields("已借书数") - 1
         rs.Update
         
         If (Date - brs.Fields("借书日期 ") > rs.Fields("借书天数")) Then
           '修改界面显示
           Text2(4).Text = Val(Text2(4).Text) + (Date - brs.Fields("借书日期") - _
             rs.Fields("借书天数")) * rs.Fields("过期罚款")
          End If
       End If
       
       brs.Delete   '删除借书记录
       brs.Update
      End If
    Else   '图书编号不能为空
        MsgBox "图书编号不能为空", vbOKOnly, "信息提示"
   End If
       
        
End Sub

Private Sub Comm2_Click()  '列罚款单
  Dim dstr As String
  dstr = "罚款单" + Chr(10) + Chr(13)
             dstr = dstr + "姓名:" + Trim(Text2(1).Text) + "(" + Trim(Text2(0).Text) + _
                 ")罚款总额:" + Str(Text2(4).Text) + "元"
              MsgBox dstr, vbOKOnly, "列罚款单"
  
End Sub

Private Sub Comm3_Click()
  Unload Me
End Sub

Private Sub Form_Load()
  rno = ""           '保存还书人的借书证号,初始化为空
End Sub

⌨️ 快捷键说明

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