📄 frmoverduefine.frm
字号:
Left = 240
Top = 420
Width = 4095
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "读者编号:"
Height = 180
Left = 360
TabIndex = 15
Top = 600
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "过期归还"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 240
Left = 240
TabIndex = 12
Top = 120
Width = 960
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "总超期罚金(元):"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 4800
TabIndex = 10
Top = 7482
Width = 1680
End
End
Attribute VB_Name = "frmoverduefine"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'-------------------------------------------------------
' 作者:邹雪桃
' 功能: 对欠款读者进行交罚款操作.先选择所要交款的欠款读者,
' 要欠款的图书,再添加,执行操作。
'-------------------------------------------------------
Dim sum As Single '存放总罚金
Public Sub clean()
'清空窗体的数据
txt读者编号.Text = ""
lst读者.Rows = 0
lst图书.Rows = 0
Call cmdclear_Click
cmdadd.Enabled = False
cmd图书选择.Enabled = False
txt罚金.Text = Format(Val(""), "0.00")
End Sub
Private Sub cmdadd_Click()
Dim rs As New ADODB.Recordset
Dim sql As String
If txt读者编号.Text = "" Then
MsgBox "请先选择读者编号。", vbInformation + vbOKOnly, "提示"
ElseIf lst图书.TextMatrix(0, 0) = "" Then
MsgBox "请先选择罚款的图书。", vbInformation + vbOKOnly, "提示"
Else
Dim i As Integer
With finebookGrid
If .Rows >= 2 Then
For i = 1 To .Rows - 1
'当前所选图书信息中图书编号和借阅日期与列表finebookGrid中的图书编号和借阅日期相同的显示错误信息,不同的就添加列表中
If Trim(.TextMatrix(i, 0)) = Trim(lst图书.TextMatrix(0, 1)) And Trim(.TextMatrix(i, 2)) = Trim(lst图书.TextMatrix(3, 1)) Then
MsgBox "列表中已经有编号为" & lst图书.TextMatrix(0, 1) & "的图书已经存在了,不能添加。", vbExclamation + vbOKOnly, "警告"
Exit Sub
End If
Next
End If
End With
sql = "select 逾期后每天罚款金额 from dzlbb where 读者类别 = '" & Trim(lst读者.TextMatrix(3, 1)) & "'"
Set rs = TransactSQL(sql)
finebookGrid.AddItem lst图书.TextMatrix(0, 1) & vbTab & lst图书.TextMatrix(1, 1) & vbTab & lst图书.TextMatrix(3, 1) & vbTab & lst图书.TextMatrix(2, 1) & vbTab & lst图书.TextMatrix(6, 1) & vbTab & rs(0) & vbTab & lst图书.TextMatrix(7, 1)
rs.Close
sum = sum + Val(lst图书.TextMatrix(7, 1))
txtfinesum.Text = Format(sum, "0.00")
txt罚金.Text = Format(sum, "0.00")
cmdadd.Enabled = False
cmddel.Enabled = True
cmdexec.Enabled = True
cmdclear.Enabled = True
End If
End Sub
Private Sub cmdclear_Click()
finebookGrid.Rows = 1
txtfinesum.Text = Format(Val(""), "0.00")
txt罚金.Text = Format(Val(""), "0.00")
cmddel.Enabled = False
cmdexec.Enabled = False
End Sub
Private Sub cmddel_Click()
With finebookGrid
If .TextMatrix(.Row, 0) = "" Then
MsgBox "请选择当前表中的图书记录。"
ElseIf .Rows = 2 Then
.Rows = 1
Call cmdclear_Click
cmdclear.Enabled = False
Else
.RemoveItem (.Row)
End If
End With
End Sub
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub cmdexec_Click()
Dim rs As New ADODB.Recordset
Dim sql As String
Dim bookno As String
Dim i As Integer
If Val(txt罚金.Text) < 0 Then
MsgBox "实际罚款金额要大于等0!", vbCritical + vbOKOnly, "错误"
txt罚金.Text = Format(Val(""), "0.00")
Exit Sub
End If
With finebookGrid
If .Rows <= 1 Then
MsgBox "当前表中没有要执行操作的数据,请选加入数据再进行操作。", vbCritical + vbOKOnly, "错误"
Exit Sub
End If
For i = 1 To .Rows - 1
bookno = Trim(.TextMatrix(i, 0))
sql = "select * from hsxxb where 读者编号 = '" & Trim(txt读者编号.Text) & "' and 图书编号 = '" & bookno & "' and 是否交款='是' "
Set rs = TransactSQL(sql)
While Not rs.EOF
If DateDiff("d", .TextMatrix(i, 2), rs(5)) = 0 Then
rs(10) = "否" '在 还书信息表 hsxxb中把相应交了欠款的记录的<是否交款>值设为"否"
rs.Update
End If
rs.MoveNext
Wend
rs.Close
sql = "insert into fkxxb values('" & bookno & "','" & Trim(.TextMatrix(i, 1)) & _
"','" & Trim(txt读者编号.Text) & "','" & Trim(lst读者.TextMatrix(0, 1)) & "'," & 0# & _
"," & Val(.TextMatrix(i, 3)) & "," & Val(.TextMatrix(i, 6)) & "," & _
Format(Val(txt罚金.Text), "0.00") & ",'" & Format(Now, "yyyy-mm-dd") & "','过期罚款','" & user & "')"
TransactSQL (sql) '在fkxxb罚款信息表插入一条记录
Next
End With
MsgBox "交款成功!", vbInformation + vbOKOnly, "信息"
Call clean
End Sub
Private Sub cmd读者选择_Click()
If TransactSQL("select * from hsxxb where 是否交款='是'").EOF Then
MsgBox "没有欠款读者。", vbOKOnly + vbInformation
Else
frmreaderfine_choose.Show 1
End If
sum = 0
End Sub
Private Sub cmd图书选择_Click()
frmbookfine_choose.Show 1
End Sub
Private Sub Form_Load()
Call fullpic(Me, Picbg1) '背景图
Me.Left = (frmmain.ScaleWidth - Me.Width) / 2
Me.Top = (frmmain.ScaleHeight - Me.Height) / 2
lst读者.ColWidth(0) = lst读者.Width / 3
lst读者.ColWidth(1) = lst读者.Width - lst读者.ColWidth(0)
'lst读者.ColAlignment(0) = 0
lst读者.ColAlignment(1) = 1
lst图书.ColWidth(0) = lst图书.Width / 3
lst图书.ColWidth(1) = lst图书.Width - lst图书.ColWidth(0)
lst图书.RowHeightMin = lst图书.Height / 8
'lst图书.ColAlignment(0) = 0
lst图书.ColAlignment(1) = 1
With finebookGrid
.Cols = 7
.Rows = 1
.TextMatrix(0, 0) = "图书编号"
.TextMatrix(0, 1) = "图书名称"
.TextMatrix(0, 2) = "借阅日期"
.TextMatrix(0, 3) = "借阅数量"
.TextMatrix(0, 4) = "过期天数"
.TextMatrix(0, 5) = "每天罚金"
.TextMatrix(0, 6) = "超期罚金"
.ColAlignment(0) = 1
.ColWidth(0) = .Width / 7
.ColWidth(1) = .Width / 7
.ColWidth(2) = .Width / 7
.ColWidth(3) = .Width / 7
.ColWidth(4) = .Width / 7
.ColWidth(5) = .Width / 7
.ColWidth(6) = .Width / 7
End With
txtfinesum.Text = 0
cmd图书选择.Enabled = False
cmdadd.Enabled = False
cmddel.Enabled = False
cmdexec.Enabled = False
lst读者.FontSize = 10
lst图书.FontSize = 10
End Sub
Private Sub txt罚金_Change()
If Not IsNumeric(txt罚金.Text) And txt罚金.Text <> "" Then
MsgBox "只能输入数值!", vbCritical + vbOKOnly, "错误"
txt罚金.Text = Format(Val(""), "0.00")
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -