--------------------
票据
客户:
地址: Date:
-------------------------
|货名 | 数量 | 单价 金额
|
| 2
| 3
| 4
| 5
| 6
|
------------------------------------------放在masterdata 上
总金额大写: 合计小写:
-------------------放在masterfooter上 请问如果“合计小写”里的数据 是在预览的时候 “金额”这一项的合计
(sum(jinge)),那么怎样将这个“合计小写”里的数据转换成大写金额并付给”合计大写”呢????(我已有小写转换大写的函数) 加急!!!!再线等待!!!!
票据
客户:
地址: Date:
-------------------------
|货名 | 数量 | 单价 金额
|
| 2
| 3
| 4
| 5
| 6
|
------------------------------------------放在masterdata 上
总金额大写: 合计小写:
-------------------放在masterfooter上 请问如果“合计小写”里的数据 是在预览的时候 “金额”这一项的合计
(sum(jinge)),那么怎样将这个“合计小写”里的数据转换成大写金额并付给”合计大写”呢????(我已有小写转换大写的函数) 加急!!!!再线等待!!!!
f := [TRIM(STR([ADOQuery1."总金额"]))];
jg := '';
if copy(f, 1, 1) = '-' then
begin
f := copy(f,2,length(f) - 1);
fs := '负';
end
else
fs := '';
dx := '零壹贰叁肆伍陆柒捌玖';
d2 := '拾佰仟万亿';
i := Pos('.',f); //小数点位置
if i = 0 then
begin
zs := f; //整数
xs := '';
end
else
begin
zs := copy(f, 1, i - 1); //整数部分
xs := copy(f, i + 1, 200);
end;
ws := 0; //l := 0;
for i := 1 to Length(zs) do
begin
ws := ws + 1;
h := '';
w := int(copy(zs, Length(zs) + 1 - i, 1));
if (w = 0) and (i = Length(zs)) then
jg := '零';
if w > 0 then
begin
if (ws >= 2) and (ws <= 5) then
h:=copy(d2, (ws - 1) * 2 - 1, 2);
if (ws >= 6) and (ws <= 8) then
begin
h:=copy(d2,(ws-5)*2-1,2);
if Pos('万', jg) = 0 then
h := h + '万';
end;
if (ws >= 10) and(ws <= 13) then
h := copy(d2, (ws - 9) * 2 - 1, 2);
end;
jg := copy(dx, (w + 1) * 2- 1, 2) + h + jg;
if ws = 9 then
jg := copy(jg, 1, 2) + '亿' + copy(jg, 3, 200);
end;
j := Pos('零零', jg);
while j > 0 do
begin
jg := copy(jg, 1, j - 1) + copy(jg, j + 2, 200);
j := Pos('零零', jg);
end;
if (Length(jg) > 1) and (copy(jg, length(jg) - 1, 2) = '零') then
jg := copy(jg, 1, Length(jg) - 2);
j := Pos('零亿', jg);
if j > 0 then
jg := copy(jg, 1, j - 1) + copy(jg, j + 2, 200);
//转换小数部分
lx := Length(xs);
if lx > 0 then
begin
jg := jg + '元';
for i := 1 to lx do
begin
if i=1 then
begin
jg := jg + copy(dx, int(copy(xs,i,1))*2 + 1, 2);
jg := jg +'角';
end;
if i=2 then
begin
jg := jg + copy(dx, int(copy(xs,i,1))*2 + 1, 2);
jg := jg +'分';
end;
end;
j := Pos('零角零分',jg);
if j>0 then
jg := copy(jg,1,j-1)+copy(jg,j+8,200)+'整';
j := Pos('零角',jg);
if j>0 then
jg := copy(jg,1,j-1)+copy(jg,j+4,200);
j := Pos('零分',jg);
if j>0 then
jg := copy(jg,1,j-1)+copy(jg,j+4,200);
end
else
jg := jg + '元整';
memo.clear;
memo.add('合计(小写):¥[STR([ADOQuery4."总金额"])] (' + fs + jg + ')');
end
begin
f := [TRIM(STR(SUM([ADOQuery1."jinge"])))];
jg := '';
if copy(f, 1, 1) = '-' then
begin
f := copy(f,2,length(f) - 1);
fs := '负';
end
else
fs := '';
dx := '零壹贰叁肆伍陆柒捌玖';
d2 := '拾佰仟万亿';
i := Pos('.',f); //小数点位置
if i = 0 then
begin
zs := f; //整数
xs := '';
end
else
begin
zs := copy(f, 1, i - 1); //整数部分
xs := copy(f, i + 1, 200);
end;
ws := 0; //l := 0;
for i := 1 to Length(zs) do
begin
ws := ws + 1;
h := '';
w := int(copy(zs, Length(zs) + 1 - i, 1));
if (w = 0) and (i = Length(zs)) then
jg := '零';
if w > 0 then
begin
if (ws >= 2) and (ws <= 5) then
h:=copy(d2, (ws - 1) * 2 - 1, 2);
if (ws >= 6) and (ws <= 8) then
begin
h:=copy(d2,(ws-5)*2-1,2);
if Pos('万', jg) = 0 then
h := h + '万';
end;
if (ws >= 10) and(ws <= 13) then
h := copy(d2, (ws - 9) * 2 - 1, 2);
end;
jg := copy(dx, (w + 1) * 2- 1, 2) + h + jg;
if ws = 9 then
jg := copy(jg, 1, 2) + '亿' + copy(jg, 3, 200);
end;
j := Pos('零零', jg);
while j > 0 do
begin
jg := copy(jg, 1, j - 1) + copy(jg, j + 2, 200);
j := Pos('零零', jg);
end;
if (Length(jg) > 1) and (copy(jg, length(jg) - 1, 2) = '零') then
jg := copy(jg, 1, Length(jg) - 2);
j := Pos('零亿', jg);
if j > 0 then
jg := copy(jg, 1, j - 1) + copy(jg, j + 2, 200);
//转换小数部分
lx := Length(xs);
if lx > 0 then
begin
jg := jg + '元';
for i := 1 to lx do
begin
if i=1 then
begin
jg := jg + copy(dx, int(copy(xs,i,1))*2 + 1, 2);
jg := jg +'角';
end;
if i=2 then
begin
jg := jg + copy(dx, int(copy(xs,i,1))*2 + 1, 2);
jg := jg +'分';
end;
end;
j := Pos('零角零分',jg);
if j>0 then
jg := copy(jg,1,j-1)+copy(jg,j+8,200)+'整';
j := Pos('零角',jg);
if j>0 then
jg := copy(jg,1,j-1)+copy(jg,j+4,200);
j := Pos('零分',jg);
if j>0 then
jg := copy(jg,1,j-1)+copy(jg,j+4,200);
end
else
jg := jg + '元整';
memo.clear;
memo.add('合计(小写):¥[STR(SUM([ADOQuery1."jinge"]))](' + fs + jg + ')');
end