procedure TfmBMZC.BitBtn2Click(Sender: TObject);
const
chNum : array[0..9] of string = ('零','壹','贰','叁','肆','伍','陆','柒','捌','玖');
chBit : array[0..3] of string = ('圆','拾','佰','仟');
var
y, m, d : Word;
s : string;
len, n , tmp: integer;
bIsZero : Boolean;
begin
DecodeDate(Date, y, m, d);
jf:=jfjeChange(mEdJFJE.Text);
with fmPrint do begin
qrYear.Caption:=IntToStr(y);
qrMonth.Caption:=IntToStr(m);
qrDay.Caption:=IntToStr(d);
//对照表生成小写金额的大写
bIsZero:=false;
n:=Pos('.', jf); //小数点前的处理
if n=0 then
len:=Length(jf)
else
len:=n-1;
for n:=1 to len do begin
tmp:=StrToInt(jf[n]);
if tmp=0 then begin
if n<len then
bIsZero:=true
else if n=len then
s:=s + chBit[len-n];
end
else begin
if bIsZero then begin
s:=s+chNum[0]+chNum[tmp] + chBit[len-n];
bIsZero:=false;
end
else
s:=s+chNum[tmp] + chBit[len-n];
end;
end;
if Length(jf)>len then begin //小数点后的处理
if len+2<=Length(jf) then begin
tmp:=StrToInt(jf[len+2]);
if tmp=0 then
s:=s+'零'
else
s:=s+chNum[tmp]+'角';
end;
if len+3<=Length(jf) then
s:=s+chNum[StrToInt(jf[len+3])]+'分';
end;
qrDMoney.Caption:=s;