我手头有个Foxpro的挺不错,等有空时转成Delphi给你吧
解决方案 »
- oracle表锁的问题
- 怎么样把win98 下的进程读取到一个文本文件中去
- ADOStoredProc,在线急等。
- 如何监控某个驱动器或目录及其下面的所有子目录的创建文件的动作...解决即给分
- 高分求救:如何用SQL语句实现这样的功能?分不够可以再加
- ★★★我的turbo pascal 7.0无法生成EXE文件怎么办(好像是缺少systerm单元)?哪有完整的turbo pascal 7.0下载?
- 请问怎么修改DLL文件?谢谢
- DELPHI创建IIS后如何自动创建WebService里面的应用程序
- 请问高手,怎样为DBGRID记录行加颜色
- delphi Dock 后 句柄问题
- 关于另存Word文档我的代码,请帮我改一改,急啊,谢谢!!
- 好书推荐,<<C++ Builder 5.0 开发大全>>,138元,爽!!!赶快买呀!!!!!!!!!!
FUNCTION ChinaTotal(Aje:Currency):string;
var
s_1,s_2:widestring;
s_5:char;
s_4:string;
i:integer;
mm:string;
s_6,s_7:widestring;
begin
s_4:=format('%10d',[trunc(aje*100)]);
s_1:='零壹贰叁肆伍陆柒捌玖';
s_2:='仟佰拾万仟佰拾元角分';
i:=1;
mm:='';
WHILE i<=10 do
begin
s_5:=s_4[i];
IF s_5<>' ' then
begin
s_6:=s_1[ord(s_5)-ORD('0')+1];
s_7:=s_2[i];
IF (s_5='0') AND (i<>4) AND (i<>8) then
s_7:='';
IF (copy(s_4,i,2)='00') OR ( (s_5='0') AND (i in [4,8,10])) then
s_6:='';
mm:=mm+s_6+s_7;
IF (s_4[i]='0') AND ((s_4[i+1]<>'0') AND (i in [4,8])) then
mm:=mm+s_1[1];
END;
inc(i);
END ;
IF s_5='0' then mm:=mm+'整';
result:=mm;
end;
TEnumMoneyUnitCn = (eMUCYuan, eMUCJiao, eMUCFen); //中文货币单位枚举类型const
cMaxCnNumMask = 12; //中文货币最大数位 cCnMoney = '¥'; //中文货币小写符号 cCnNumCodeLw: array['0' .. '9'] of string = //中文数字列表1
('○', '一', '二', '三', '四', '五', '六', '七', '八', '九'); cCnNumCodeUp: array['0' .. '9'] of string = //中文数字列表2
('零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'); cCnNumMaskLw: array[1 .. cMaxCnNumMask] of string = //中文数位列表1
('', '十', '百', '千', '万', '十', '百', '千', '乙', '十', '百', '千'); cCnNumMaskUp: array[1 .. cMaxCnNumMask] of string = //中文数位列表2
('', '拾', '佰', '仟', '万', '拾', '佰', '仟', '亿', '拾', '佰', '仟'); cCnMoneyCode: array[TEnumMoneyUnitCn] of string = //中文货币单位列表
('圆', '角', '分');function StrLeft(const mStr: string; mDelimiter: string): string;
begin
Result := Copy(mStr, 1, Pos(mDelimiter, mStr) - 1);
end; { StrLeft }function StrRight(const mStr: string; mDelimiter: string): string;
begin
if Pos(mDelimiter, mStr) <= 0 then
Result := ''
else Result := Copy(mStr, Pos(mDelimiter, mStr) + Length(mDelimiter), MaxInt);
end; { StrRight }function Iif(mBool: Boolean; mDataA: Variant; mDataB: Variant): Variant;
begin
if mBool then
Result := mDataA
else Result := mDataB;
end; { Iif }function ZsAToC(mFloat: Real): string; { 返回中文表示的数字 }
var
sTemp, lStr, rStr: string;
J: Integer;{ ---------------------begin------------------------ }
function fZsLeft(s: string): string;
var
I, K, Len: Integer;
Hxm: Boolean; //出现0
Lcy: Boolean;
begin
Result := '';
Len := Length(s);
J := 0;
if s <> '0' then begin
Hxm := False; Lcy := False;
for I := 1 to Len do begin
K := Len - I + 1;
if s[I] <> '0' then begin
J := 0;
if Hxm then Result := Result + cCnNumCodeUp['0'];
Result := Result + Concat(cCnNumCodeUp[s[I]], cCnNumMaskUp[K]);
Hxm := False;
Lcy := True;
end else begin
Hxm := True;
if (Lcy) and ((K + 4) mod 4 = 1) then begin
J := K;
if (Lcy) and (J <> 0) then Result := Result + cCnNumMaskUp[J];
Lcy := False;
end;
end; { if[s[I] <> '0'] }
end; { for }
end { if[s <> '0'] }
else Result := cCnNumCodeUp['0'];
end; { fZsLeft } function fZsRight(s: string): string;
begin
Result := '';
if s <> '00' then begin
Result := Result + Iif((Int(mFloat) = 0) and (s[1] = '0'), '',
cCnNumCodeUp[s[1]]) + Iif(s[1] <> '0',
cCnMoneyCode[eMUCJiao], '');
if s[2] <> '0' then
Result := Result + cCnNumCodeUp[s[2]] + cCnMoneyCode[eMUCFen];
end else Result := '整';
end; { fZsLeft }
{ ---------------------end------------------------ }begin
if mFloat <> 0 then begin
Str(mFloat:0:2, sTemp);
lStr := fZsLeft(StrLeft(sTemp, '.'));
rStr := fZsRight(StrRight(sTemp, '.'));
Result := Iif(lStr = cCnNumCodeUp['0'], '', lStr + cCnMoneyCode[eMUCYuan])
+ rStr;
end else Result := cCnNumCodeUp['0'] + cCnMoneyCode[eMUCYuan] + '整';
end; { ZsAToC }
var SmallMonth,BigMonth:string;
wei1,qianwei1:string[2];
qianwei,dianweizhi,qian:integer;
begin
{------- 修改参数令值更精确 -------}
{小数点后的位置,需要的话也可以改动-2值}
qianwei:=-2;
{转换成货币形式,需要的话小数点后加多几个零}
Smallmonth:=formatfloat('0.00',small);
{---------------------------------}
dianweizhi :=pos('.',Smallmonth);{小数点的位置}
{循环小写货币的每一位,从小写的右边位置到左边}
for qian:=length(Smallmonth) downto 1 do
begin
{如果读到的不是小数点就继续}
if qian<>dianweizhi then
begin
{位置上的数转换成大写}
case strtoint(copy(Smallmonth,qian,1)) of
1:wei1:='壹'; 2:wei1:='贰';
3:wei1:='叁'; 4:wei1:='肆';
5:wei1:='伍'; 6:wei1:='陆';
7:wei1:='柒'; 8:wei1:='捌';
9:wei1:='玖'; 0:wei1:='零';
end;
{判断大写位置,可以继续增大到real类型的最大值}
case qianwei of
-3:qianwei1:='厘';
-2:qianwei1:='分';
-1:qianwei1:='角';
0 :qianwei1:='元';
1 :qianwei1:='拾';
2 :qianwei1:='佰';
3 :qianwei1:='千';
4 :qianwei1:='万';
5 :qianwei1:='拾';
6 :qianwei1:='佰';
7 :qianwei1:='千';
8 :qianwei1:='亿';
9 :qianwei1:='十';
10:qianwei1:='佰';
11:qianwei1:='千';
end;
inc(qianwei);
BigMonth :=wei1+qianwei1+BigMonth;{组合成大写金额}
end;
end;
SmallTOBig:=BigMonth;
end;调用如下“edit1.text:=SmallTOBig(1234567890.1234);”他自动默认小数点后两位