function Convert(money: real): string; var smallMode:string; bigChar,powerChar:string[2]; power,dotPos,i:integer; begin power:=-2; smallMode:=FormatFloat('0.00',money); dotPos:=System.Pos('.',smallMode); for i:=length(smallMode) downto 1 do begin if i=dotPos then continue; case StrToInt(Copy(smallMode,i,1)) of 1:bigChar:='壹'; 2:bigChar:='贰'; 3:bigChar:='叁'; 4:bigChar:='肆'; 5:bigChar:='伍'; 6:bigChar:='陆'; 7:bigChar:='柒'; 8:bigChar:='捌'; 9:bigChar:='玖'; 0:bigChar:='零'; end; case power of -3:powerChar:='厘'; -2:powerChar:='分'; -1:powerChar:='角'; 0 :powerChar:='元'; 1,5,9 :powerChar:='拾'; 2,6,10:powerChar:='佰'; 3,7,11:powerChar:='千'; 4,12:powerChar:='万'; 8 :powerChar:='亿'; end; Inc(power); Result:=bigChar+powerChar+Result; end; end;
或者写delphi函数,然后赋值
或留个qq请教,请教在ReportBuilder写脚本函数,然后调用
或者写delphi函数,然后赋值
var smallMode:string;
bigChar,powerChar:string[2];
power,dotPos,i:integer;
begin
power:=-2;
smallMode:=FormatFloat('0.00',money);
dotPos:=System.Pos('.',smallMode);
for i:=length(smallMode) downto 1 do begin
if i=dotPos then continue;
case StrToInt(Copy(smallMode,i,1)) of
1:bigChar:='壹';
2:bigChar:='贰';
3:bigChar:='叁';
4:bigChar:='肆';
5:bigChar:='伍';
6:bigChar:='陆';
7:bigChar:='柒';
8:bigChar:='捌';
9:bigChar:='玖';
0:bigChar:='零';
end;
case power of
-3:powerChar:='厘';
-2:powerChar:='分';
-1:powerChar:='角';
0 :powerChar:='元';
1,5,9 :powerChar:='拾';
2,6,10:powerChar:='佰';
3,7,11:powerChar:='千';
4,12:powerChar:='万';
8 :powerChar:='亿';
end;
Inc(power);
Result:=bigChar+powerChar+Result;
end;
end;