搜档网
当前位置:搜档网 › Crystal Report金额转成中文大写

Crystal Report金额转成中文大写

StringVar x;
StringVar xx := "";
NumberVar z;
NumberVar i;
x := ToText({OPOR.DocTotal});
x := Replace(x,",","");
x := Replace(x,".","");
z := length(x)-2;

for i := z to -1 step -1 do
(
select i
case 10 : if(Mid(x,z-i+1,1)<>"0") then xx := Mid(x,z-i+1,1) + "?"
case 9 : if(Mid(x,z-i+1,1)<>"0") then xx := xx + Mid(x,z-i+1,1) + "?" else xx := xx + "?"
case 8 : if(Mid(x,z-i+1,1)<>"0") then xx := xx + Mid(x,z-i+1,1) + "?"
case 7 : if(Mid(x,z-i+1,1)<>"0") then xx := xx + Mid(x,z-i+1,1) + "?"
case 6 : if(Mid(x,z-i+1,1)<>"0") then xx := xx + Mid(x,z-i+1,1) + "?"
case 5 : if(Mid(x,z-i+1,1)<>"0") then xx := xx + Mid(x,z-i+1,1) + "?" else xx := xx + "?"
case 4 : if(Mid(x,z-i+1,1)<>"0") then xx := xx + Mid(x,z-i+1,1) + "?" else xx := xx + "?"
case 3 : if(Mid(x,z-i+1,1)<>"0") then xx := xx + Mid(x,z-i+1,1) + "?" else xx := xx + "?"
case 2 : if(Mid(x,z-i+1,1)<>"0") then xx := xx + Mid(x,z-i+1,1) + "?" else xx := xx + "?"
case 1 : if(Mid(x,z-i+1,1)<>"0") then xx := xx + Mid(x,z-i+1,1)+"?"
case 0 : if(Mid(x,z-i+1,1)<>"0") then xx := xx + Mid(x,z-i+1,1)+"?"
case -1 : if(Mid(x,z-i+1,1)<>"0") then xx := xx + Mid(x,z-i+1,1) else xx :=xx+"?"
);
xx := Replace(xx,"1","?");
xx := Replace(xx,"2","?");
xx := Replace(xx,"3","?");
xx := Replace(xx,"4","?");
xx := Replace(xx,"5","?");
xx := Replace(xx,"6","?");
xx := Replace(xx,"7","?");
xx := Replace(xx,"8","?");
xx := Replace(xx,"9","?");
if instr(xx,'?')<=0 then
if instr(xx,'?')>0 then
xx:=left(xx,instr(xx,'?')-2)+'?'+right(xx,len(xx)-instr(xx,'?')+2);


if right(xx,1)='?' then
if instr(xx,'?')>0 then
xx :=left(xx,len(xx)-1)+'?'
else
xx :=left(xx,len(xx)-1)+'??'
else
xx :=xx + "?";

相关主题