Espero que te sea de utilidad.
Saludos José **************************************** *TRANSFORMA NUMEROS A LETRAS * *SON LAS FUNCIONES CONVIERTE Y OBT_CANT* **************************************** function CONVIERTE_NUM_TO_LETRAS parameters total * Autor: Anselmo Antonio Ortiz Alcocer * Corrreo: ortiza...@hotmail.com * 26/06/2001 dimension aUnidades(9), aDecenas(14), aCentenas(10) aUnidades(1) = 'UN' aUnidades(2) = 'DOS' aUnidades(3) = 'TRES' aUnidades(4) = 'CUATRO' aUnidades(5) = 'CINCO' aUnidades(6) = 'SEIS' aUnidades(7) = 'SIETE' aUnidades(8) = 'OCHO' aUnidades(9) = 'NUEVE' aDecenas(1) = 'DIEZ' aDecenas(2) = 'ONCE' aDecenas(3) = 'DOCE' aDecenas(4) = 'TRECE' aDecenas(5) = 'CATORCE' aDecenas(6) = 'QUINCE' aDecenas(7) = 'VEINTE' aDecenas(8) = 'TREINTA' aDecenas(9) = 'CUARENTA' aDecenas(10) = 'CINCUENTA' aDecenas(11) = 'SESENTA' aDecenas(12) = 'SETENTA' aDecenas(13) = 'OCHENTA' aDecenas(14) = 'NOVENTA' aCentenas(1) = 'CIEN' aCentenas(2) = 'DOSCIENTOS' aCentenas(3) = 'TRESCIENTOS' aCentenas(4) = 'CUATROCIENTOS' aCentenas(5) = 'QUINIENTOS' aCentenas(6) = 'SEISCIENTOS' aCentenas(7) = 'SETECIENTOS' aCentenas(8) = 'OCHOCIENTOS' aCentenas(9) = 'NOVECIENTOS' vTotal = str(int(total), 12) do case case empty(val(vTotal)) Texto = 'CERO PESOS' case val(vTotal) = 1 Texto = 'UN PESO' otherwise tCientos = obt_cant(substr(vTotal,10,3)) tMiles = obt_cant(substr(vTotal,7,3)) tMillones = obt_cant(substr(vTotal,4,3)) tMilMillones = obt_cant(substr(vTotal,1,3)) tCientos = tCientos tMiles = iif(empty(tMiles), '', ; iif(tMiles='UN', '', tMiles + ' ') + 'MIL ') tMillones = iif(empty(tMillones), '', ; tMillones + ' MILLON' + iif(tMillones='UN', ' ', 'ES ') +; iif(empty(tMiles + tCientos), 'DE', '')) tMilMillones = iif(empty(tMilMillones), '', ; iif(tMilMillones='UN', '', tMilMillones + ' ') + 'MIL ' +; iif(empty(tMillones), 'MILLONES ', ' ') +; iif(empty(tMillones + tMiles + tCientos), 'DE', '')) Texto = strtran(tMilMillones + tMillones + tMiles + tCientos, ' ', ' ') endcase return 'PESOS : '+Texto + iif(!empty(total), ' CON ' + ; strtran(transform(int((total - int(total)) * ; 100), '**'), '*', '0') + ' CENTAVOS', '') endfunc function obt_cant parameter valor public Unidades, Decenas, Centenas if empty(val(valor)) return '' endif store '' to tUnidades, tDecenas, tCentenas Unidades = int(val(substr(valor,3,1))) Decenas = int(val(substr(valor,2,1))) Centenas = int(val(substr(valor,1,1))) valor = int(val(valor)) tUnidades = iif(!empty(unidades), aUnidades(Unidades), '') if !empty(decenas) if decenas = 1 tDecenas = iif(val(right(str(valor,3),2)) >= 10 and ; val(right(str(valor,3),2)) <= 15, aDecenas(val(right(str(valor,3),2)) - 9), 'DIECI' + tUnidades) tUnidades = '' else tDecenas = aDecenas(decenas + 5) if !empty(unidades) tDecenas = left(tDecenas, len(tDecenas) - 1) + 'I' endif endif endif if !empty(centenas) tCentenas = aCentenas(centenas) if valor > 100 if centenas = 1 tCentenas = tCentenas + 'TO ' else tCentenas = tCentenas + ' ' endif endif endif return tCentenas + tDecenas + tUnidades endfunc ________________________________ De: GUFA@mug.org.ar <GUFA@mug.org.ar> en nombre de PabloC <pablo.canon...@mug.org.ar> Enviado: miércoles, 11 de enero de 2017 04:01 p. m. Para: GUFA List Member Asunto: [GUFA] Pasar numeros a texto Yo históricamente uso esto y no recuerdo haber tenido problemas cTotal = Chrtran(Alltrim(Str(yTotal,10,2)),'.','') From: GUFA@mug.org.ar [mailto:GUFA@mug.org.ar] On Behalf Of Sergio D.Castellari Sent: miércoles, 11 de enero de 2017 12:42 To: GUFA List Member <GUFA@mug.org.ar> Subject: [GUFA] Pasar numeros a texto Hola gente, ¿¿¿ Alguien tiene una función para transformar un numero (con decimales) a texto que quiera compartirla ??? Tengo 2 funciones que venia usando, pero descubrí que tienen una falla, y determinados números del rango 20000, los escribe mal. Saludos, Sergio Castellari