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

📄 rent.frm

📁 现阶段很多图书租赁店仍然使用手工方式管理
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   2
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   6840
      Top             =   4200
      Visible         =   0   'False
      Width           =   1320
      _ExtentX        =   2328
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CommandButton Getback 
      Caption         =   "返还"
      Height          =   375
      Left            =   6000
      TabIndex        =   6
      Top             =   4200
      Width           =   735
   End
   Begin VB.CommandButton Rent 
      Caption         =   "出租"
      Height          =   375
      Left            =   5040
      TabIndex        =   5
      Top             =   4200
      Width           =   735
   End
   Begin VB.TextBox memberNumber 
      Height          =   375
      Left            =   3840
      TabIndex        =   1
      Top             =   4200
      Width           =   855
   End
   Begin VB.TextBox BookNumber 
      Height          =   375
      Left            =   1440
      TabIndex        =   0
      Top             =   4200
      Width           =   855
   End
   Begin VB.Label Label4 
      Caption         =   "租书记录"
      Height          =   375
      Left            =   120
      TabIndex        =   11
      Top             =   1440
      Width           =   855
   End
   Begin VB.Label Label3 
      Caption         =   "图书信息"
      Height          =   255
      Left            =   120
      TabIndex        =   9
      Top             =   2520
      Width           =   855
   End
   Begin VB.Label Label2 
      Caption         =   "会员信息"
      Height          =   255
      Left            =   120
      TabIndex        =   7
      Top             =   240
      Width           =   975
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "提示: 出租书请输入图书的编号和会员编号。还书直接输入图书编号,点击返还即可。输入编号后按ENTER可查看当前图书或会员信息"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Index           =   2
      Left            =   0
      TabIndex        =   4
      Top             =   3600
      Width           =   5535
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Caption         =   "输入会员编号"
      Height          =   255
      Index           =   1
      Left            =   2520
      TabIndex        =   3
      Top             =   4320
      Width           =   1095
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Caption         =   "输入图书编号"
      Height          =   255
      Index           =   0
      Left            =   120
      TabIndex        =   2
      Top             =   4320
      Width           =   1095
   End
End
Attribute VB_Name = "rent"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rentprice As Double '租金
Dim memberMoney As Double '会员帐户金额
Private Sub BookNumber_KeyPress(KeyAscii As Integer) '绑定图书数据源
If KeyAscii = vbKeyReturn Then
Adodc1.RecordSource = "select id,name,state,lastrentmember,rentprice,times from bookinfo where id='" & BookNumber & "'"
Adodc1.Refresh


End If
End Sub

Private Sub Form_Load()
Adodc1.ConnectionString = Str
Adodc2.ConnectionString = Str
Adodc3.ConnectionString = Str
End Sub

Private Sub Getback_Click()

If BookNumber = "" Then
   MsgBox "请输入图书编号", vbOKOnly, "错误"
   Else
    Dim memberId As String
    Dim rentTimes As Integer
    Dim rst As ADODB.Recordset
    Set rst = New ADODB.Recordset
    rst.Open "select rentprice,times from bookinfo where id='" & BookNumber & "'", cnn, adOpenDynamic, adLockReadOnly
      If rst.EOF Then
      MsgBox "图书编号错误", vbOKOnly, "错误"
      Else
      rentprice = rst("rentprice")
      rentTimes = rst("times") + 1
      End If
    rst.Close
    Set rst = Nothing                '获得图书的租金和租次信息
    Set rst = New ADODB.Recordset
    rst.Open "select * from rentinfo where bookid='" & BookNumber & "' and restoredate is null", cnn, adOpenDynamic, adLockReadOnly
    memberId = rst("memberid")
    rst.Close
    Set rst = Nothing          '将还书日期记录,并将会员号得到
    Set rst = New ADODB.Recordset
    rst.Open "select remainmoney from memberinfo where id='" & memberId & "'", cnn, adOpenDynamic, adLockReadOnly
    memberMoney = rst("remainmoney")
    rst.Close
    Set rst = Nothing           '得到会员的余额
    cnn.Execute "update bookinfo set state=1,times=" & rentTimes & " where id='" & BookNumber & "'"
    cnn.Execute "update memberinfo set remainmoney=" & memberMoney - rentprice & " where id='" & memberId & "'"
    cnn.Execute "update rentinfo set restoredate='" & Now & "'"
    MsgBox "返还成功!", vbOKOnly, "操作成功"
End If
End Sub

Private Sub memberNumber_KeyPress(KeyAscii As Integer) '绑定会员数据源
If KeyAscii = vbKeyReturn Then
Adodc2.RecordSource = "select * from memberinfo where id='" & memberNumber & "'"
Adodc2.Refresh
Adodc3.RecordSource = "select * from rentinfo where memberid='" & memberNumber & "'"
Adodc3.Refresh
End If
End Sub

Private Sub Rent_Click()
If BookNumber = "" Or memberNumber = "" Then
   MsgBox "请输入图书编号和会员编号", vbOKOnly, "错误"
   Else
   cnn.Execute "update bookinfo set state=0 where id='" & BookNumber & "'"
   cnn.Execute "insert into rentinfo(memberid,bookid,rentdate) values('" & memberNumber & "','" & BookNumber _
   & "','" & Now & "')"
   MsgBox "租借成功", vbOKOnly, "操作成功"
End If
End Sub

⌨️ 快捷键说明

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