您的位置:首页 > 其它

Lotus中货币数字转换成人民币大写

2006-12-22 16:37 267 查看
首先创建一个数字域,为两位小数。域名Total,
另外一个域为TotalSum
用来显示转换后的结果。

1
在TotalSum
中的entering
域中加入如下代码:

******************************************************

Sub Entering(Source As Field)

Dim workspace As New notesuiworkspace

Dim uidoc As notesuidocument

Set uidoc = workspace.currentdocument

Dim lef,rig As String

Dim Cur As String

Cur=/"
万仟佰拾亿仟佰拾万仟佰拾元/"

Dim MyStr As String

Insert=uidoc.fieldgettext(/"totle/")

n=Len(insert)

lef=Left(insert,n-3)

rig=Right(insert,2)

ln=Len(lef)

rn=Len(rig)

For i=1 To ln

MyStr=MyStr+C(Mid(lef,i,1))+Mid(cur,13-ln+i,1)

Next i

MyStr=MyStr+C(Left(rig,1))+/"
角/"+C(Right(rig,1))+/"
分/"

Call uidoc.fieldsettext(/"totalsum/",mystr)

End Sub

************************************************************

在表单中加入自定义函数C():

Function C(S As String) As String

If S=/"1/" Then

C=/"
壹/"

End If

If S=/"2/" Then

C=/"
贰/"

End If

If S=/"3/" Then

C=/"
叁/"

End If

If S=/"4/" Then

C=/"
肆/"

End If

If S=/"5/" Then

C=/"
伍/"

End If

If S=/"6/" Then

C=/"
陆/"

End If

If S=/"7/" Then

C=/"
柒/"

End If

If S=/"8/" Then

C=/"
捌/"

End If

If S=/"9/" Then

C=/"
玖/"

End If

If S=/"0/" Then

C=/"
零/"

End If

End Function
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: