&Compuesto(1) = 'UN'
&Compuesto(2) = 'DOS'
&Compuesto(3) = 'TRES'
&Compuesto(4) = 'CUATRO'
&Compuesto(5) = 'CINCO'
&Compuesto(6) = 'SEIS'
&Compuesto(7) = 'SIETE'
&Compuesto(8) = 'OCHO'
&Compuesto(9) = 'NUEVE'
&Compuesto(10) = 'DIEZ'
&Compuesto(11) = 'ONCE'
&Compuesto(12) = 'DOCE'
&Compuesto(13) = 'TRECE'
&Compuesto(14) = 'CATORCE'
&Compuesto(15) = 'QUINCE'
&Compuesto(16) = 'DIECISEIS'
&Compuesto(17) = 'DIECISIETE'
&Compuesto(18) = 'DIECIOCHO'
&Compuesto(19) = 'DIECINUEVE'
&Compuesto(20) = 'VEINTE'
&Compuesto(21) = 'VEINTIUN'
&Compuesto(22) = 'VEINTIDOS'
&Compuesto(23) = 'VEINTITRES'
&Compuesto(24) = 'VEINTICUATRO'
&Compuesto(25) = 'VEINTICINCO'
&Compuesto(26) = 'VEINTISEIS'
&Compuesto(27) = 'VEINTISIETE'
&Compuesto(28) = 'VEINTIOCHO'
&Compuesto(29) = 'VEINTINUEVE'
&Decenas(3) = 'TREINTA'
&Decenas(4) = 'CUARENTA'
&Decenas(5) = 'CINCUENTA'
&Decenas(6) = 'SESENTA'
&Decenas(7) = 'SETENTA'
&Decenas(8) = 'OCHENTA'
&Decenas(9) = 'NOVENTA'
&Centenas(1) = 'CIEN'
&Centenas(2) = 'DOSCIENTOS'
&Centenas(3) = 'TRESCIENTOS'
&Centenas(4) = 'CUATROCIENTOS'
&Centenas(5) = 'QUINIENTOS'
&Centenas(6) = 'SEISCIENTOS'
&Centenas(7) = 'SETECIENTOS'
&Centenas(8) = 'OCHOCIENTOS'
&Centenas(9) = 'NOVECIENTOS'
// ******************************************************************************************
&String=''
&NumStr1 = str(&Numero, 12, 2)
&CenStr = substr(&NumStr1, 11, 2)
// ***** Toma el número sin espacios ni decimales
&NumStr2 = ''
&i = 1
Do While &i <= 9
If substr(&NumStr1, &i, 1) <> ' '
&NumStr2 = &NumStr2 + substr(&NumStr1, &i, 1)
EndIf
&i = &i + 1
EndDo
// ***** Reparte el número en tres pares: centenas, miles y millones
&NumStr2 = '000000000' + &NumStr2
&PosNum = len(&NumStr2) - 9 + 1
&NumArr(1) = substr(&NumStr2, &PosNum, 3)
&PosNum = len(&NumStr2) - 6 + 1
&NumArr(2) = substr(&NumStr2, &PosNum, 3)
&PosNum = len(&NumStr2) - 3 + 1
&NumArr(3) = substr(&NumStr2, &PosNum, 3)
// ***** Recorre los numeros del array
&Contador = 1
Do While &Contador <= 3
// *** Verifica que no sea cero el numero a evaluar
If val(&NumArr( &Contador)) > 0
// ***** Toma los dígitos
&Digito1 = val(substr(&NumArr(&Contador) ,3 ,1))
&Digito2 = val(substr(&NumArr(&Contador) ,2 ,1))
&Digito3 = val(substr(&NumArr(&Contador) ,1 ,1))
&Numero2 = val(substr(&NumArr(&Contador) ,2 ,2))
// ***** Agrega el texto de las centenas
If &Digito3 > 0
If &Digito3 = 1 .AND. &Numero2 > 0
&String = &String + ' CIENTO'
Else
&String = &String +' '+ &Centenas(&Digito3)
EndIf
Endif
// ***** Agrega el texto de las centenas y unidades
If &Numero2 > 0
If &Numero2 >= 1 .AND. &Numero2 <= 29
// ***** El número puede ser tomado del array
&String = &String +' '+ &Compuesto(&Numero2)
// ***** Agrega un "O" si el número es 1 o 21
If (&Numero2 = 1 .OR. &Numero2 = 21) .AND. &Contador = 3
&String = &String + 'O'
EndIf
Else
// ***** El número debe ser formado con los dos dígitos
&String = &String +' '+ &Decenas(&Digito2)
If &Digito1 > 0
&String = &String +' Y '+ &Compuesto(&Digito1)
EndIf
EndIf
EndIf
// ***** Agrega el texto MIL y MILLON
If &Contador=2
&String = &String +' MIL'
EndIf
If &Contador=1
If val(&NumArr(&Contador)) = 1
&String = &String +' MILLON'
Else
&String = &String +' MILLONES'
Endif
EndIf
EndIf
&Contador = &Contador + 1
EndDo
// ***** Quita el primer espacio en blanco
If &String >= ' '
&String = substr(&String ,2 ,160)
EndIf
If val(&CenStr) > 0
If &String >= ' '
&String = &String + ' con '+&CenStr + '/100'
Else
&String = 'CERO con ' + &CenStr + '/100'
EndIf
EndIf
If &ConX = 'S'
&String = &String + '------------------------------------------------------------------------------------------------'
&String = &String + '------------------------------------------------------------------------------------------------'
EndIf