📄 frmdeposit.frm
字号:
VERSION 5.00
Begin VB.Form frmDeposit
BackColor = &H00404040&
BorderStyle = 1 'Fixed Single
Caption = "存款"
ClientHeight = 3615
ClientLeft = 45
ClientTop = 435
ClientWidth = 7275
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3615
ScaleWidth = 7275
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取 消"
Height = 345
Left = 3960
TabIndex = 10
Top = 3000
Width = 975
End
Begin VB.CommandButton cmdFinally
Caption = "完 成"
Default = -1 'True
Height = 345
Left = 2760
TabIndex = 9
Top = 3000
Width = 975
End
Begin VB.TextBox txt
Appearance = 0 'Flat
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
IMEMode = 3 'DISABLE
Index = 3
Left = 3240
TabIndex = 8
Top = 2400
Width = 2415
End
Begin VB.TextBox txt
Appearance = 0 'Flat
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
IMEMode = 3 'DISABLE
Index = 2
Left = 3240
TabIndex = 7
Top = 1920
Width = 2415
End
Begin VB.TextBox txt
Appearance = 0 'Flat
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
IMEMode = 3 'DISABLE
Index = 1
Left = 3240
TabIndex = 4
Top = 1440
Width = 2415
End
Begin VB.TextBox txt
Appearance = 0 'Flat
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
IMEMode = 3 'DISABLE
Index = 0
Left = 3240
TabIndex = 2
Top = 960
Width = 2415
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "请再次输入存款金额:"
ForeColor = &H00FFFFFF&
Height = 180
Index = 3
Left = 1320
TabIndex = 6
Top = 2520
Width = 1800
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "请输入存款金额:"
ForeColor = &H00FFFFFF&
Height = 180
Index = 1
Left = 1680
TabIndex = 5
Top = 2040
Width = 1440
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "请再次输入帐户号码:"
ForeColor = &H00FFFFFF&
Height = 180
Index = 0
Left = 1320
TabIndex = 3
Top = 1560
Width = 1800
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "请输入帐户号码:"
ForeColor = &H00FFFFFF&
Height = 180
Index = 4
Left = 1680
TabIndex = 1
Top = 1080
Width = 1440
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "存款"
BeginProperty Font
Name = "华文新魏"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 315
Index = 2
Left = 3240
TabIndex = 0
Top = 240
Width = 630
End
Begin VB.Line line
BorderColor = &H00FFFFFF&
BorderWidth = 2
X1 = 0
X2 = 7440
Y1 = 600
Y2 = 600
End
End
Attribute VB_Name = "frmDeposit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rst As Recordset
Dim nowDate As String
Dim nowTime As String
Dim passTime As Double
Dim percentage As Double
Dim money As Double
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdFinally_Click()
Set rst = New Recordset
nowTime = Now
nowDate = Format(nowTime, "yyyy") + Format(nowTime, "mm") + Format(nowTime, "dd") + Format(nowTime, "hh") + Format(nowTime, "nn") + Format(nowTime, "ss")
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'判断用户输入金额的正确性↓
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If txt(0).Text = txt(1).Text Then
If txt(2).Text <> txt(3).Text Then
MsgBox "请确定两次输入的存款金额相同"
Exit Sub
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim depositMoney As Double
Dim getErr As Boolean
getErr = True
On Error GoTo errMoney
depositMoney = CDbl(txt(2).Text)
getErr = False
errMoney:
If getErr = True Then
MsgBox "请确定你所输入的金额为数字!"
Exit Sub
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'判断帐户存在↓
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Call LinkDB(landWay, SName, "weboy", SUName, SUPw)
con.Open
Dim have As Boolean
have = False
On Error GoTo errHave
rst.Open "select id from CConsumers", con, adOpenDynamic, adLockOptimistic
rst.MoveFirst
Do While Not rst.EOF
If rst!id = txt(0).Text Then
have = True
Exit Do
End If
rst.MoveNext
Loop
errHave:
If have = False Then '如果账户不在存
MsgBox "对不起,此帐户不存在!"
Exit Sub
Else '如果账户存在
rst.Close
''''''''''''''''''''''''''''''''判断此次操作是否为此客户的第一次↓
rst.Open "select * from " & txt(0).Text, con, adOpenDynamic, adLockOptimistic
Dim have2 As Boolean
have = False
Dim i As Integer
i = 0
On Error GoTo errHave2
rst.MoveFirst
Do While Not rst.EOF
i = i + 1
rst.MoveNext
Loop
have = True
errHave2:
If have = False Then '如果为第一次
con.Execute "insert " & txt(0).Text & " values('" & nowDate & "','set','" & txt(2).Text & "','" & txt(2).Text & "','" & userName & "')"
MsgBox "存款成功"
Unload Me
Else '如果非第一次
If i = 1 Then '如果以前只进行过一次操作
rst.MoveFirst
'''''''''''''''''根据用户以前的操作时间得出经过的时间↓
passTime = (CDbl(Mid(nowDate, 1, 4)) - CDbl(Mid(rst!Wdate, 1, 4))) * 12 + (CDbl(Mid(nowDate, 5, 2)) - CDbl(Mid(rst!Wdate, 5, 2)))
'''''''''''''''''根据经过的时间及利率算出利息↓
money = CDbl(txt(2).Text) + (1 + passTime * ((percentage0 / 100) / 12)) * CDbl(rst!balance)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
con.Execute "insert " & txt(0).Text & " values('" & nowDate & "','set','" & txt(2).Text & "','" & money & "','" & userName & "')"
Call printDeposit '判断客户是否需要打印
rst.Close
con.Close
MsgBox "存款完成"
Unload Me
Else '如果以前不只进行过一次操作
rst.MoveLast
passTime = (CDbl(Mid(nowDate, 1, 4)) - CDbl(Mid(rst!Wdate, 1, 4))) * 12 + (CDbl(Mid(nowDate, 5, 2)) - CDbl(Mid(rst!Wdate, 5, 2)))
money = CDbl(txt(2).Text) + (1 + passTime * ((percentage0 / 100) / 12)) * CDbl(rst!balance)
con.Execute "insert " & txt(0).Text & " values('" & nowDate & "','set','" & txt(2).Text & "','" & money & "','" & userName & "')"
Call printDeposit
rst.Close
con.Close
MsgBox "存款完成"
Unload Me
End If
End If
End If
Else
MsgBox "请确定两次输入的帐户值相同"
Exit Sub
End If
End Sub
'响应 "打印" 按钮
Private Sub printDeposit()
If MsgBox("存款成功,请问是否需要打印存根?", vbOKCancel, "提示") = vbOK Then
frmPrintDeposit.lbl(1).Caption = txt(0).Text
frmPrintDeposit.lbl(3).Caption = txt(2).Text & " 元"
frmPrintDeposit.lbl(4).Caption = money & " 元"
frmPrintDeposit.lbl(5).Caption = nowTime
frmPrintDeposit.lbl(6).Caption = userName
frmPrintDeposit.PrintForm
Unload frmPrintDeposit
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -