水晶报表的脚本编码语言Basic Syntax 我不知道是什么类型的Basic .我用VB SCRIPT 在WEB脚本里调试得好好的放到水晶报表里确不能用.
几经摸索修改,总算调试通过了.希望对大家有所帮助.
Function Moneyc (thenumber as string)
dim Money as string
dim i as number
dim String1 as string
dim String2 as string
dim ilength as number
dim checkp as string '定义变量
dim one(100) as string
dim onestr(100) as string '定义数组
dim thenumber2 as number
String1 = "零壹贰叁肆伍陆柒捌玖"
String2 = "万仟佰拾亿仟佰拾万仟佰拾元角分厘毫"
' checkp=instr(thenumber,".") '判断是否含有小数位
thenumber2 = instr(thenumber,".")
if instr(thenumber,".")<>0 then
thenumber=replace(thenumber,".","") '去除小数位
end if
ilength=len(thenumber) '取得数据长度
for i=1 to ilength
one(i)=mid(thenumber,i,1) '循环取得每一位的数字
one(i)=mid(string1,ToNumber (one(i))+1,1)'循环取得数字对应的大写
if thenumber2>i then '不含有小数的数据其数字对应的单位
onestr(i)=mid(string2,14-thenumber2+i,1)
else '含有小数的数据其数字对应的单位
onestr(i)=mid(string2,14+i-thenumber2,1)
end if
one(i)=one(i)&onestr(i)'将数字与单位组合
next
Money=replace(join(one)," ","") '取得数组中所有的元素,并连接起来
Money=replace(Money,"零元","元")
Money=replace(Money,"零万","万")
Money=replace(Money,"零亿","亿")
Money=replace(Money,"零仟","零")
Money=replace(Money,"零佰","零")
Money=replace(Money,"零拾","零")
do while not (instr(Money,"零零")=0 )
Money=replace(Money,"零零","零")
loop
Moneyc=replace(Money,"零元","元")
End Function