fastReport 有没有大写金额的函数啊
fastReport 有没有大写金额的函数啊
我的值是变的。
[解决办法]
//小写金额转大写Function XxToDx(const hjnum:real):String;var Vstr,zzz,cc,cc1,Presult:string; xxbb :array[1..12]of string; uppna:array[0..9] of string; iCount,iZero,vPoint,vdtlno:integer;begin //*设置大写中文数字和相应单位数组*// xxbb[1]:='亿'; xxbb[2]:='仟'; xxbb[3]:='佰'; xxbb[4]:='拾'; xxbb[5]:='万'; xxbb[6]:='仟'; xxbb[7]:='佰'; xxbb[8]:='拾'; xxbb[9]:='元'; xxbb[10]:='.'; xxbb[11]:='角'; xxbb[12]:='分'; uppna[0]:='零'; uppna[1]:='壹'; uppna[2]:='贰'; uppna[3]:='叁'; uppna[4]:='肆'; uppna[5]:='伍'; uppna[6]:='陆'; uppna[7]:='柒'; uppna[8]:='捌'; uppna[9]:='玖'; Str(hjnum:12:2,Vstr); cc:=''; cc1:=''; zzz:=''; result:=''; presult:=''; iZero:=0; vPoint:=0; //(1)对前面金额进行转换.一位一位地转换. For iCount:=1 to 10 do begin cc:=Vstr[iCount]; if cc<>' ' then begin zzz:=xxbb[iCount]; if cc='0' then begin if iZero<1 then //*对“零”进行判断*// cc:='零' else cc:=''; if iCount=5 then //*对万位“零”的处理*// if copy(result,length(result)-1,2)='零' then result:=copy(result,1,length(result)-2)+xxbb[iCount]+'零' //else // result:=copy(result,1,length(result)-2)+xxbb[iCount]+'元' else result:=result+xxbb[iCount]; cc1:=cc; zzz:=''; iZero:=iZero+1; end else begin if cc='.' then begin cc:=''; if (cc1='') or (cc1='零') then begin Presult:=copy(result,1,Length(result)-2); result:=Presult; iZero:=15; end; if iZero>=1 then zzz:=xxbb[9] else zzz:=''; vPoint:=1; end else begin iZero:=0; cc:=uppna[StrToInt(cc)]; end end; result:=result+(cc+zzz) End; //End of Condition ==>if cc<>' ' then End; //End for Loop //(2)对小数点后两位进行处理 if Vstr[11]='0' then //小数点后第一位是0. begin if Vstr[12]<>'0' then begin //cc:='零'; //result:=result+cc; cc:='零'+uppna[StrToInt(Vstr[12])]; //result:=result+(uppna[0]+cc+xxbb[12]); result:=result+(cc+xxbb[12]); end end else begin //小数点后第一位不是0 //if iZero=15 then //begin // cc:='零'; // result:=result+cc; //end; cc:=uppna[StrToInt(Vstr[11])]; result:=result+(cc+xxbb[11]); if Vstr[12]<>'0' then begin cc:=uppna[StrToInt(Vstr[12])]; result:=result+(cc+xxbb[12]); end; End; if Pos('分',Result)<=0 then Result:=Result+'整';