📄 frmreturn.frm
字号:
VERSION 5.00
Begin VB.Form FrmReturn
Caption = "还 书"
ClientHeight = 1275
ClientLeft = 60
ClientTop = 345
ClientWidth = 3510
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 1275
ScaleWidth = 3510
Begin VB.TextBox txt
ForeColor = &H00FF0000&
Height = 270
Left = 1080
TabIndex = 0
Top = 240
Width = 2055
End
Begin VB.CommandButton cmdR
Caption = "确认(&O)"
Enabled = 0 'False
Height = 375
Index = 0
Left = 240
TabIndex = 3
Top = 720
Width = 1335
End
Begin VB.CommandButton cmdR
Cancel = -1 'True
Caption = "返回(&R)"
Height = 375
Index = 1
Left = 1920
TabIndex = 2
Top = 720
Width = 1335
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "图书编号"
ForeColor = &H8000000D&
Height = 180
Left = 240
TabIndex = 1
Top = 285
Width = 720
End
End
Attribute VB_Name = "FrmReturn"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdR_Click(Index As Integer)
On Error GoTo R_Err:
If Index = 1 Then Unload Me: Exit Sub
Call QueryInfo("select case when (reborrow='否' and datediff(day,borrowdate,getdate())<=30 )" & _
" or (reborrow='是' and datediff(day,borrowdate,getdate())<=15 ) " & _
" then datediff(day,borrowdate,getdate()) " & _
" when reborrow='否'and datediff(day,borrowdate,getdate())>30" & _
" then 30-datediff(day,borrowdate,getdate())" & _
" else 15-datediff(day,borrowdate,getdate()) End " & _
" from borrow where returndate is null and bookid='" & Choose(Txt) & "'")
If DBRct.EOF Then GoTo R_Err
DBRct.MoveFirst
If DBRct.Fields(0) < 0 Then
Call ExecuteSQL("update readers set publish=publish+" & -DBRct.Fields(0) * 0.2 & " where readerid in (select readerid from " & _
"borrow where returndate is null and bookid='" & Choose(Txt) & "')")
End If
Call ExecuteSQL("update borrow set returndate=getdate(),reborrow='已还' where returndate is null and bookid='" & Choose(Txt) & "'")
Call QueryInfo("select * from books where bookid='" & Choose(Txt) & "'")
MsgBox "图书:" & DBRct.Fields("bookname").Value & vbCrLf & "还书成功!", vbInformation, "成功"
Txt = Empty
Exit Sub
R_Err:
MsgBox "该书未被借或根本没有该书!", vbInformation, "还书失败"
End Sub
Private Sub Form_Resize()
If Me.Height <= 500 Or Me.Width <= 1500 Then Exit Sub
Me.Height = 1680
Me.Width = 3630
End Sub
Private Sub txt_Change()
If Txt = Empty Then cmdR(0).Enabled = False Else cmdR(0).Enabled = True
End Sub
Private Sub txt_KeyPress(KeyAscii As Integer)
If Txt <> Empty And KeyAscii = 13 Then cmdR_Click (0)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -