2:开始模仿人家的财务管理系统写需求分析,做出一个原型。
3:再多下卜悉让几个财务管理系统,陆缺吸收人家的优点。进一步开发。
4:开始测试型局,发放试用版,推出正式版。
以上只供快速开发及对财务管理系统不是很了解的人使用。
“单价”——Text1“数量”——Text2
“折扣”——Text3
“计算”——Command1
“清除”——Command2
代码如下。
==================================
Private Sub Command1_Click()
On Error GoTo e
MsgBox "枝孝应游伏付款" &Text1.Text * Text2.Text * (1 - Text3.Text)
Exit Sub
e:
MsgBox "数据输入错误"
End Sub
Private Sub Command2_Click()
Call Form_Load
End Sub
Private Sub text3_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyReturn
Call Command1_Click
Case vbKeyEscape
Call Form_Load
End Select
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Command1.Caption = "计算"
Command2.Caption = "清神搭携除"
End Sub
一直在用的函数,网上摘来的。通过搜索也可以找到不少。Public Function CurrencyToStr(ByVal Number As Currency) As String
Number = Val(Trim(Number))
If Number = 0 Then CurrencyToStr = "": Exit Function
Dim str1Ary As Variant, str2Ary As Variant
str1Ary = Split("零 壹 贰 叁 肆 伍 陆 柒 捌 玖")
str2Ary = Split("分 角 元 拾 佰 仟 万 拾 佰 仟 亿 拾 佰 仟 万 拾 佰")
Dim a As Long, b As Long '循环基数
Dim tmp1 As String'贺凯临时转换
Dim tmp2 As String'临时转换结果
Dim Point As Long '小数点位置
If Number <= -922337203685477# Or Number >= 922337203685477# Then
Exit Function
End If
tmp1 = Round(Number, 2)
tmp1 = Replace(tmp1, "-", "") '先去掉“-”号
Point = InStr(tmp1, ".") '取得小数点位置
If Point = 0 Then '如果滑册有小数点,最大佰万亿
b = Len(tmp1) + 2 '加2位小数
Else
b = Len(Left(tmp1, Point + 1)) '包括点加2位小数
End If
''先将所有数字替换为中文
For a = 9 To 0 Step -1
tmp1 = Replace(Replace(tmp1, a, str1Ary(a)), ".", "")
Next
For a = 1 To b
b = b - 1
If Mid(tmp1, a, 1) <>"" Then
If b >UBound(str2Ary) Then Exit For
tmp2 = tmp2 &Mid(tmp1, a, 1) &str2Ary(b)
End If
Next
If tmp2 = "" Then CurrencyToStr = "": Exit Function
''〓下面为非正式财务算法,可以去掉〓
For a = 1 To Len(tmp2)
tmp2 = Replace(tmp2, "零亿", "亿零")
tmp2 = Replace(tmp2, "零万", "万零")
tmp2 = Replace(tmp2, "零仟", "零")
tmp2 = Replace(tmp2, "零佰", "零")
tmp2 = Replace(tmp2, "零拾信拍宏", "零")
tmp2 = Replace(tmp2, "零元", "元")
tmp2 = Replace(tmp2, "零零", "零")
tmp2 = Replace(tmp2, "亿万", "亿")
Next
''〓上面为非正式财务算法,可以去掉〓
If Point = 1 Then tmp2 = "零元" + tmp2
If Number <0 Then tmp2 = "负" + tmp2
If Point = 0 Then tmp2 = tmp2 + "整"
CurrencyToStr = tmp2
End Function
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)