Crystal Report - Traduccion de Numeros a letras

 
Vista:

Traduccion de Numeros a letras

Publicado por Timoteo (2 intervenciones) el 31/07/2008 00:24:14
que tal, estoy migrando de la version 8 a la 10 en crystal report, mi problema es que la version 10 no soporta las formulas que tengo diseñadas en la version 8 para que los importes de mis facturas sean traducidas a letras es decir, 10298.50 Pesos en mi formula de version 8 este monto se traduce a Diez Mil docientos noventa y ocho pesos 50/100 MN, al usar el crystal version 10 mi formula no funciona y me dicen que tengo que usar el comando TOWORD pero este no traduce de forma correcta el monto, existe o tendran a la mano alguna formulita para probarla en mis sistemas. no tengo tanta experiencia en la version 10 asi que si me pueden pasar algun tips se los agradecere.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Traduccion de Numeros a letras

Publicado por lucky (1 intervención) el 28/10/2008 02:01:35
HOLA QUE TAL ALGUIEN QUE PUDIERA AUXILIARME PARA TRASLADAR NUMEROS A TEXTO CON EL FIN DE QUE QUEDEN EN UN RECIBO TIPO CHEQUE
TRABAJO EN LA CIUDAD DE MEXICO EN LYF EN UNA AREA ADMINISTRATIVA QUE MANEJA MUCHO EL TENER QUE ESCRIBIR CANTIDADES Y SU CORRESPONDIENTE EN TEXTO PARA SER PAGADOS OJALA Y ALGUIEN ME AYUDE, GRACIAS
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Traduccion de Numeros a letras

Publicado por Rodrigo (1 intervención) el 13/11/2008 14:32:28
Hola,

Te adjunto la formula en Crystal, usa el campo @totTot como importe.

Saludos !!


StringVar Cadenaglobal:="";
StringVar Valor:="S";
cadenaGlobal:=ToText({@totTot});
cadenaGlobal:=Trim(cadenaGlobal);
StringVar Resultado:="";
StringVar Decimales:= Right (cadenaGlobal,2 );
StringVar Unidades:= Right (cadenaGlobal,4 );
StringVar Decenas:=Right (cadenaGlobal,5 );
StringVar Centenas:=Right(cadenaGlobal,6);
StringVar Umillar:=Right (cadenaGlobal,8 );
StringVar Dmilllar:=Right(cadenaGlobal,9);
StringVar Cmilllar:=Right(CadenaGlobal,10);
StringVar milllares:=cadenaGlobal[2 to 2];
if abs({@totTot}) < 1 then
"0 Pesos "+Decimales+" /100 M.N."
else

if Left(Cmilllar,1)="9" then
resultado:=resultado+"Novecientos ";
if Left(Cmilllar,1)="8" then
resultado:=resultado+"Ochocientos ";
if Left(Cmilllar,1)="7" then
resultado:=resultado+"Setecientos ";
if Left(Cmilllar,1)="6" then
resultado:=resultado+"Seiscientos ";
if Left(Cmilllar,1)="5" then
resultado:=resultado+"Quinientos ";
if Left(Cmilllar,1)="4" then
resultado:=resultado+"Cuatrocientos ";
if Left(Cmilllar,1)="3" then
resultado:=resultado+"Trescientos ";
if Left(Cmilllar,1)="2" then
resultado:=resultado+"Doscientos ";
if Left(Cmilllar,1)="1" then
resultado:=resultado+"Cien(to) ";

if Left(Dmilllar,1)="9" then
resultado:=resultado+"Noventa ";
if Left(Dmilllar,1)="8" then
resultado:=resultado+"Ochenta ";
if Left(Dmilllar,1)="7" then
resultado:=resultado+"Setenta ";
if Left(Dmilllar,1)="6" then
resultado:=resultado+"Sesenta ";
if Left(Dmilllar,1)="5" then
resultado:=resultado+"Cincuenta ";
if Left(Dmilllar,1)="4" then
resultado:=resultado+"Cuarenta ";
if Left(Dmilllar,1)="3" then
resultado:=resultado+"Treinta ";
if Left(Dmilllar,1)="2" then
resultado:=resultado+"Veinti ";
if Left(Dmilllar,1)="1" then
resultado:=resultado+"Diez ";

if Left(Dmilllar,1) <> "0" and {@totTot} > 100000 then
resultado:=resultado+" y ";

if Left(Umillar,1)="9" then
resultado:=resultado+"Nueve ";
if Left(Umillar,1)="8" then
resultado:=resultado+"Ocho ";
if Left(Umillar,1)="7" then
resultado:=resultado+"Siete ";
if Left(Umillar,1)="6" then
resultado:=resultado+"Seis ";
if Left(Umillar,1)="5" then
resultado:=resultado+"Cinco ";
if Left(Umillar,1)="4" then
resultado:=resultado+"Cuatro ";
if Left(Umillar,1)="3" then
resultado:=resultado+"Tres ";
if Left(Umillar,1)="2" then
resultado:=resultado+"Dos ";
if Left(Umillar,1)="1" then
resultado:=resultado+"Un ";

if abs({@totTot}) >= 1000 and valor <> "N"then
resultado:=resultado+" Mil "; valor:="N";

if Left(Centenas,1)="9" then
resultado:=resultado+"Novecientos ";
if Left(Centenas,1)="8" then
resultado:=resultado+"Ochocientos ";
if Left(Centenas,1)="7" then
resultado:=resultado+"Setecientos ";
if Left(Centenas,1)="6" then
resultado:=resultado+"Seiscientos ";
if Left(Centenas,1)="5" then
resultado:=resultado+"Quinientos ";
if Left(Centenas,1)="4" then
resultado:=resultado+"Cuatrocientos ";
if Left(Centenas,1)="3" then
resultado:=resultado+"Trescientos ";
if Left(Centenas,1)="2" then
resultado:=resultado+"Doscientos ";
if Left(Centenas,1)="1" then
resultado:=resultado+"Cien(to) ";

if abs({@totTot}) >= 100000 then
resultado:=resultado+" Mil ";
if Left(decenas,1)="9" then
resultado:=resultado+"Noventa ";
if Left(decenas,1)="8" then
resultado:=resultado+"Ochenta ";
if Left(decenas,1)="7" then
resultado:=resultado+"Setenta ";
if Left(decenas,1)="6" then
resultado:=resultado+"Sesenta ";
if Left(decenas,1)="5" then
resultado:=resultado+"Cincuenta ";
if Left(decenas,1)="4" then
resultado:=resultado+"Cuarenta ";
if Left(decenas,1)="3" then
resultado:=resultado+"Treinta ";
if Left(decenas,1)="2" then
resultado:=resultado+"Veinte(i) ";
if Left(decenas,1)="1" then
resultado:=resultado+"Diez ";

if Left(decenas,1) <> "0" and Left(unidades,1) <> "0"then
resultado:=resultado+" y ";

if Left(Unidades,1)="9" then
resultado:=resultado+"Nueve ";
if Left(Unidades,1)="8" then
resultado:=resultado+"Ocho ";
if Left(Unidades,1)="7" then
resultado:=resultado+"Siete ";
if Left(Unidades,1)="6" then
resultado:=resultado+"Seis ";
if Left(Unidades,1)="5" then
resultado:=resultado+"Cinco ";
if Left(Unidades,1)="4" then
resultado:=resultado+"Cuatro ";
if Left(Unidades,1)="3" then
resultado:=resultado+"Tres ";
if Left(Unidades,1)="2" then
resultado:=resultado+"Dos ";
if Left(Unidades,1)="1" then
resultado:=resultado+"Un ";

if abs({@totTot}) < 100000 and abs({@totTot}) > 1000 and valor <> "N" then
resultado:=resultado+" Mil ";

Resultado+" Pesos "+Decimales+" /100 M.N."
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Traduccion de Numeros a letras

Publicado por Karen Abarca (1 intervención) el 18/03/2022 20:19:10
Hola, solo quisiera saber a que hace referencia la cadena "S" (StringVar Valor:="S"), o cuando es que cambia?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar