广发信用卡提现手续费及利息计算器VB源码[原创]

最近有点闲,刚好广发信用卡的业务员来公司推销!就写了这个计算器!

界面效果:

代码如下:

Private Sub Command1_Click()
    Label4.Caption = ""
    If Not IsNumeric(Text1.Text) Then MsgBox "提现金额只能为数字!请重新输入!", vbOKOnly + vbInformation, "提示!": Text1.SetFocus: Exit Sub
    If Not IsNumeric(Text2.Text) Then MsgBox "还款天数只能为数字!请重新输入!", vbOKOnly + vbInformation, "提示!": Text2.SetFocus: Exit Sub
    Dim TX As Double, SXF As Double, TS As Double, LXR As Double, LX As Double, RS As Double
    TX = CDbl(Text1.Text)
    TS = CDbl(Text2.Text)
    'If TX <= 0 Or (TX Mod 100) <> 0 Then MsgBox "提现金额必须大于零且为100的倍数!", vbOKOnly + vbInformation, "提示!": Text1.SetFocus: Exit Sub
    If TX <= 0 Then MsgBox "提现金额必须大于零!", vbOKOnly + vbInformation, "提示!": Text1.SetFocus: Exit Sub
    If TS <= 0 Then MsgBox "天数必须为大于零的正整数!", vbOKOnly + vbInformation, "提示!": Text2.SetFocus: Exit Sub
    If TS > Fix(TS) Then TS = Fix(TS) + 1: Text2.Text = CStr(TS) Else TS = Fix(TS): Text2.Text = TS '天数取整
    SXF = TX * 0.025
    If SXF < 10 Then SXF = 10 Else SXF = Round(SXF, 2) '手续费最低收取10RMB,小数部分保留两位
    Dim i As Double
    LXR = TX
    For i = 1 To TS Step 1
        LX = LXR * 0.0005
        LXR = LXR + LX
    Next i
    If (LXR - TX) < 1 Then LX = 1 Else LX = Round(LXR - TX, 2)   '利息最低收取1RMB
    RS = TX + SXF + LX   '应还金额为:提现金额+手续费+利息
    Text3.Text = CStr(RS)
    Label4.Caption = "其中包含手续费:" & CStr(SXF) & " RMB  利息:" & CStr(LX) & " RMB"
    Label4.Left = Me.Width / 2 - Label4.Width / 2
    Text1.SetFocus
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyF1 Then MsgBox "广发银行提现手续费按2.5%收取,最低10元!" & vbCrLf & vbCrLf & "按万分之五收取日息!利滚利的计算方式!(最低1RMB)"
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = 27 Then Unload Me
End Sub
Private Sub Form_Load()
    lblShow.Caption = "广发行提现手续费按2.5%收取(最低10RMB)!" & vbCrLf & vbCrLf & "按万分之五收取日息!利滚利的计算方式!(最低1RMB)"
    lblShow.Left = Me.Width / 2 - lblShow.Width / 2
    Label4.Left = Me.Width / 2 - Label4.Width / 2
    Me.Left = Screen.Width / 2 - Me.Width / 2
    Me.Top = Screen.Height / 2 - Me.Height / 2
End Sub
Private Sub Text1_GotFocus()
    If Len(Text1.Text) > 0 Then Text1.SelStart = 0: Text1.SelLength = Len(Text1.Text)
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
    If Trim(Text1.Text) <> "" And KeyAscii = 13 Then Text2.SetFocus
End Sub
Private Sub Text2_GotFocus()
    If Len(Text2.Text) > 0 Then Text2.SelStart = 0: Text2.SelLength = Len(Text2.Text)
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
    If Trim(Text1.Text) <> "" And Trim(Text2.Text) <> "" And KeyAscii = 13 Then Command1_Click
End Sub

原文地址:https://www.cnblogs.com/mic86/p/1766428.html