在fastreport的pascalscript里面我没有搞明白怎么调用sysutil……所以写了一个比较笨办法的转换函数
不过好处是应该适用于所有版本——因为使用的是最基础的东西……
只能转换小于一万亿的数字,更大的得改写一下。
function MoneyToCharacter(Money:real):string; //数字转换为中文大写
var
temp:string;
resu:string;
jf:string;
i,j,j_1,jiao,fen:integer;
len:integer;
Num:array[0..9] of string;
A:array[0..13] of string;
begin
Num[0]:='零';
num[1]:='壹';
Num[2]:='贰';
num[3]:='叁';
Num[4]:='肆';
num[5]:='伍';
Num[6]:='陆';
num[7]:='柒';
Num[8]:='捌';
num[9]:='玖';
a[0]:='分';
a[1]:='角';
a[2]:='元';
a[3]:='拾';
a[4]:='佰';
a[5]:='仟';
a[6]:='万';
a[7]:='拾';
a[8]:='佰';
a[9]:='仟';
a[10]:='亿';
a[11]:='拾';
a[12]:='佰';
a[13]:='仟';
temp:=trim(inttostr(trunc(round(money*100))));
len:=length(temp);
resu:='';
if (len>13) or (len=0) then
begin
exit;
end;
jiao:=strtoint(copy(temp,len-1,1));
fen:=strtoint(copy(temp,len,1));
if (fen=0) then begin
if (jiao=0) then begin
jf:='整';
end else begin
jf:=num[jiao]+'角整';
end;
end
else begin
if (jiao=0) then begin
jf:='零'+Num[fen]+'分';
end else begin
jf:=num[jiao]+'角'+num[fen]+'分';
end;
end;
for i:=1 to len-2 do
begin
j:=strtoint(copy(temp,i,1));
if (j=0) then
begin
j_1:=strtoint(copy(temp,i+1,1));
if (j_1=0) then
begin
continue;
end;
if (a[len-i]='万') or (a[len-i]='亿') then
begin
resu:=resu+a[len-i]+num[j];
end
else
if (a[len-i]='元') then begin
resu:=resu+'元';
end else
begin
resu:=resu+num[j];
end;
end
else
begin
resu:=resu+num[j]+a[len-i];
end;
end;
result:=resu+jf;
end;
begin
end.