PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → NumberInWords in spanish
NumberInWords in spanish
Débuté par Antonio Díaz, 15 fév. 2024 21:52 - 9 réponses
Membre enregistré
71 messages
Popularité : +2 (2 votes)
Posté le 15 février 2024 - 21:52
Hi guys,

This is probably simple but I can't find a way. Is there a way to make the NumberInWords() function return the string in spanish?...

Thank you in advance.

--

Antonio Diaz
Emphasys Software, S.C.
Membre enregistré
3 347 messages
Popularité : +93 (137 votes)
Posté le 15 février 2024 - 23:08
hi, to check with PCSOFT but I believe that
by default the function only uses English and French
you may need to use wdmsg to set up the spanish translation
I therefore advise you to contact support to be sure.
Membre enregistré
71 messages
Popularité : +2 (2 votes)
Posté le 16 février 2024 - 03:11
Thanks Popoy, I will do that....

--

Antonio Diaz
Emphasys Software, S.C.
Membre enregistré
88 messages
Popularité : +3 (3 votes)
Posté le 16 février 2024 - 16:06
Hi Antonio,

If that way doesn't work, let me know. Here are automatic tests using my fonction :
TestAjouteItération("A",*,"A")
TestAjouteItération(0,*,"cero")
TestAjouteItération(1,*,"uno")
TestAjouteItération(5,*,"cinco")
TestAjouteItération(10,*,"diez")
TestAjouteItération(15,*,"quince")
TestAjouteItération(20,*,"veinte")
TestAjouteItération(21,*,"veintiuno")
TestAjouteItération(35,*,"treinta y cinco")
TestAjouteItération(49,*,"cuarenta y nueve")
TestAjouteItération(53,*,"cincuenta y tres")
TestAjouteItération(67,*,"sesenta y siete")
TestAjouteItération(89,*,"ochenta y nueve")
TestAjouteItération(101,*,"ciento uno")
TestAjouteItération(125,*,"ciento veinticinco")
TestAjouteItération(256,*,"doscientos cincuenta y seis")
TestAjouteItération(374,*,"trescientos setenta y cuatro")
TestAjouteItération(489,*,"cuatrocientos ochenta y nueve")
TestAjouteItération(596,*,"quinientos noventa y seis")
TestAjouteItération(823,*,"ochocientos veintitrés")
TestAjouteItération(1234,*,"mil doscientos treinta y cuatro")
TestAjouteItération(2567,*,"dos mil quinientos sesenta y siete")
TestAjouteItération(3852,*,"tres mil ochocientos cincuenta y dos")
TestAjouteItération(4989,*,"cuatro mil novecientos ochenta y nueve")
TestAjouteItération(6874,*,"seis mil ochocientos setenta y cuatro")
TestAjouteItération(9761,*,"nueve mil setecientos sesenta y uno")
TestAjouteItération(12345,*,"doce mil trescientos cuarenta y cinco")
TestAjouteItération(25678,*,"veinticinco mil seiscientos setenta y ocho")
TestAjouteItération(38529,*,"treinta y ocho mil quinientos veintinueve")
TestAjouteItération(49893,*,"cuarenta y nueve mil ochocientos noventa y tres")
TestAjouteItération(68742,*,"sesenta y ocho mil setecientos cuarenta y dos")
TestAjouteItération(97615,*,"noventa y siete mil seiscientos quince")
TestAjouteItération(1234567,*,"un millón doscientos treinta y cuatro mil quinientos sesenta y siete")
TestAjouteItération(2567890,*,"dos millones quinientos sesenta y siete mil ochocientos noventa")
TestAjouteItération(3852903,*,"tres millones ochocientos cincuenta y dos mil novecientos tres")
TestAjouteItération(4989301,*,"cuatro millones novecientos ochenta y nueve mil trescientos uno")
TestAjouteItération(6874265,*,"seis millones ochocientos setenta y cuatro mil doscientos sesenta y cinco")
TestAjouteItération(9761538,*,"nueve millones setecientos sesenta y uno mil quinientos treinta y ocho")
TestAjouteItération(57.89756, PartieDécimaleStandard,"ochenta y nueve siete cinco seis")

--
Bon dev.

Patrick Lalemand
https://www.lapalys.ca
Membre enregistré
71 messages
Popularité : +2 (2 votes)
Posté le 17 février 2024 - 01:21
Hey Patrick,

It's accurate!!, do you have this in Windev?....

--

Antonio Diaz
Emphasys Software, S.C.
Posté le 17 février 2024 - 13:25
Saludos desde Venezuela-
Aqui esta función que desarrollé para pasar números a monto escrito

PROCEDURE MONTOESC(cyMONTO is currency = 0)
IF cyMONTO = 0 THEN RESULT ""

arrUNIDEC is array of 0 string
arrCENTENA is array of 0 string
arrUNIDEC = ["UN", "DOS", "TRES", "CUATRO", "CINCO", "SEIS", "SIETE", "OCHO", "NUEVE",...
"DIEZ", "ONCE", "DOCE", "TRECE", "CATORCE", "QUINCE", "DIECISEIS", "DIECISIETE", "DIECIOCHO", "DIECINUEVE",...
"VEINTE", "VEINTIUN", "VEINTIDOS", "VEINTITRES", "VEINTICUATRO", "VEINTICINCO", "VEINTISEIS", "VEINTISIETE", "VEINTIOCHO", "VEINTINUEVE",...
"TREINTA", "TREINTA Y UN", "TREINTA Y DOS", "TREINTA Y TRES", "TREINTA Y CUATRO", "TREINTA Y CINCO", "TREINTA Y SEIS", "TREINTA Y SIETE", "TREINTA Y OCHO", "TREINTA Y NUEVE",...
"CUARENTA", "CUARENTA Y UN", "CUARENTA Y DOS", "CUARENTA Y TRES", "CUARENTA Y CUATRO", "CUARENTA Y CINCO", "CUARENTA Y SEIS", "CUARENTA Y SIETE", "CUARENTA Y OCHO", "CUARENTA Y NUEVE",...
"CINCUENTA", "CINCUENTA Y UN", "CINCUENTA Y DOS", "CINCUENTA Y TRES", "CINCUENTA Y CUATRO", "CINCUENTA Y CINCO", "CINCUENTA Y SEIS", "CINCUENTA Y SIETE", "CINCUENTA Y OCHO", "CINCUENTA Y NUEVE",...
"SESENTA", "SESENTA Y UN", "SESENTA Y DOS", "SESENTA Y TRES", "SESENTA Y CUATRO", "SESENTA Y CINCO", "SESENTA Y SEIS", "SESENTA Y SIETE", "SESENTA Y OCHO", "SESENTA Y NUEVE",...
"SETENTA", "SETENTA Y UN", "SETENTA Y DOS", "SETENTA Y TRES", "SETENTA Y CUATRO", "SETENTA Y CINCO", "SETENTA Y SEIS", "SETENTA Y SIETE", "SETENTA Y OCHO", "SETENTA Y NUEVE",...
"OCHENTA", "OCHENTA Y UN", "OCHENTA Y DOS", "OCHENTA Y TRES", "OCHENTA Y CUATRO", "OCHENTA Y CINCO", "OCHENTA Y SEIS", "OCHENTA Y SIETE", "OCHENTA Y OCHO", "OCHENTA Y NUEVE",...
"NOVENTA", "NOVENTA Y UN", "NOVENTA Y DOS", "NOVENTA Y TRES", "NOVENTA Y CUATRO", "NOVENTA Y CINCO", "NOVENTA Y SEIS", "NOVENTA Y SIETE", "NOVENTA Y OCHO", "NOVENTA Y NUEVE"
]

arrCENTENA = ["CIENTO", "DOSCIENTOS", "TRESCIENTOS", "CUATROCIENTOS", "QUINIENTOS", "SEISCIENTOS", "SETECIENTOS", "OCHOCIENTOS", "NOVECIENTOS"]


sMONTO_ESC is string = ""
cyMONTO_ENTERO is currency = IntegerPart(cyMONTO)
sMONTO is string = NumToString(cyMONTO_ENTERO, "012d")
nMONTO_DECIMAL is int = Round(cyMONTO - cyMONTO_ENTERO, 2) * 100
sDECIMALES is string = NumToString(nMONTO_DECIMAL, "02d")

arrTRIPLE is array of 4 string
arrTRIPLE[1] = Left(sMONTO, 3)
arrTRIPLE[2] = Middle(sMONTO, 4, 3)
arrTRIPLE[3] = Middle(sMONTO, 7, 3)
arrTRIPLE[4] = Middle(sMONTO, 10, 3)

FOR nIND = 1 TO 4
sTRIPLE is string = arrTRIPLE[nIND]
nTRIPLE is int = Val(sTRIPLE)
nCENTENA is int = Val(Left(sTRIPLE, 1))
nUNIDEC is int = Val(Middle(sTRIPLE, 2))
nUNIDAD is int = Val(Middle(sTRIPLE, 3, 1))
IF nCENTENA > 0 THEN
IF nTRIPLE = 100 THEN
sMONTO_ESC = sMONTO_ESC + " " + "CIEN"
ELSE
sMONTO_ESC = sMONTO_ESC + " " + arrCENTENA[nCENTENA]
END
END
IF nUNIDEC > 0 THEN
sMONTO_ESC = sMONTO_ESC + " " + arrUNIDEC[nUNIDEC]
END
IF nIND = 1 AND (nCENTENA <> 0 OR nUNIDEC <> 0) THEN
IF nTRIPLE = 1
sMONTO_ESC += " MILLARDO"
ELSE
sMONTO_ESC += " MILLARDOS"
END
END
IF nIND = 2 AND (nCENTENA <> 0 OR nUNIDEC <> 0) THEN
IF Val(sTRIPLE) = 1 THEN
sMONTO_ESC += " MILLON"
ELSE
sMONTO_ESC += " MILLONES"
END
END
IF nIND = 3 AND (nCENTENA <> 0 OR nUNIDEC <> 0) THEN sMONTO_ESC += " MIL"
IF nIND = 4 AND nUNIDEC <> 0 AND nUNIDEC <> 11 AND nUNIDAD = 1 THEN sMONTO_ESC += "O" // EL ULTIMO 1 QUE NO DIGA UN SINO UNO
END

RESULT NoSpace(sMONTO_ESC + " CON " + sDECIMALES + "/100")
Posté le 17 février 2024 - 13:26
Retorna el monto escrito

PROCEDURE MONTOESC(cyMONTO is currency = 0)
//MONTOESC.PRG * AUTOR. JOSE MANRIQUE 7/88 DERECHOS RESERVADOS / ACTUALIZCION 04/2021
IF cyMONTO = 0 THEN RESULT ""

arrUNIDEC is array of 0 string
arrCENTENA is array of 0 string
arrUNIDEC = ["UN", "DOS", "TRES", "CUATRO", "CINCO", "SEIS", "SIETE", "OCHO", "NUEVE",...
"DIEZ", "ONCE", "DOCE", "TRECE", "CATORCE", "QUINCE", "DIECISEIS", "DIECISIETE", "DIECIOCHO", "DIECINUEVE",...
"VEINTE", "VEINTIUN", "VEINTIDOS", "VEINTITRES", "VEINTICUATRO", "VEINTICINCO", "VEINTISEIS", "VEINTISIETE", "VEINTIOCHO", "VEINTINUEVE",...
"TREINTA", "TREINTA Y UN", "TREINTA Y DOS", "TREINTA Y TRES", "TREINTA Y CUATRO", "TREINTA Y CINCO", "TREINTA Y SEIS", "TREINTA Y SIETE", "TREINTA Y OCHO", "TREINTA Y NUEVE",...
"CUARENTA", "CUARENTA Y UN", "CUARENTA Y DOS", "CUARENTA Y TRES", "CUARENTA Y CUATRO", "CUARENTA Y CINCO", "CUARENTA Y SEIS", "CUARENTA Y SIETE", "CUARENTA Y OCHO", "CUARENTA Y NUEVE",...
"CINCUENTA", "CINCUENTA Y UN", "CINCUENTA Y DOS", "CINCUENTA Y TRES", "CINCUENTA Y CUATRO", "CINCUENTA Y CINCO", "CINCUENTA Y SEIS", "CINCUENTA Y SIETE", "CINCUENTA Y OCHO", "CINCUENTA Y NUEVE",...
"SESENTA", "SESENTA Y UN", "SESENTA Y DOS", "SESENTA Y TRES", "SESENTA Y CUATRO", "SESENTA Y CINCO", "SESENTA Y SEIS", "SESENTA Y SIETE", "SESENTA Y OCHO", "SESENTA Y NUEVE",...
"SETENTA", "SETENTA Y UN", "SETENTA Y DOS", "SETENTA Y TRES", "SETENTA Y CUATRO", "SETENTA Y CINCO", "SETENTA Y SEIS", "SETENTA Y SIETE", "SETENTA Y OCHO", "SETENTA Y NUEVE",...
"OCHENTA", "OCHENTA Y UN", "OCHENTA Y DOS", "OCHENTA Y TRES", "OCHENTA Y CUATRO", "OCHENTA Y CINCO", "OCHENTA Y SEIS", "OCHENTA Y SIETE", "OCHENTA Y OCHO", "OCHENTA Y NUEVE",...
"NOVENTA", "NOVENTA Y UN", "NOVENTA Y DOS", "NOVENTA Y TRES", "NOVENTA Y CUATRO", "NOVENTA Y CINCO", "NOVENTA Y SEIS", "NOVENTA Y SIETE", "NOVENTA Y OCHO", "NOVENTA Y NUEVE"
]

arrCENTENA = ["CIENTO", "DOSCIENTOS", "TRESCIENTOS", "CUATROCIENTOS", "QUINIENTOS", "SEISCIENTOS", "SETECIENTOS", "OCHOCIENTOS", "NOVECIENTOS"]


sMONTO_ESC is string = ""
cyMONTO_ENTERO is currency = IntegerPart(cyMONTO)
sMONTO is string = NumToString(cyMONTO_ENTERO, "012d")
nMONTO_DECIMAL is int = Round(cyMONTO - cyMONTO_ENTERO, 2) * 100
sDECIMALES is string = NumToString(nMONTO_DECIMAL, "02d")

arrTRIPLE is array of 4 string
arrTRIPLE[1] = Left(sMONTO, 3)
arrTRIPLE[2] = Middle(sMONTO, 4, 3)
arrTRIPLE[3] = Middle(sMONTO, 7, 3)
arrTRIPLE[4] = Middle(sMONTO, 10, 3)

FOR nIND = 1 TO 4
sTRIPLE is string = arrTRIPLE[nIND]
nTRIPLE is int = Val(sTRIPLE)
nCENTENA is int = Val(Left(sTRIPLE, 1))
nUNIDEC is int = Val(Middle(sTRIPLE, 2))
nUNIDAD is int = Val(Middle(sTRIPLE, 3, 1))
IF nCENTENA > 0 THEN
IF nTRIPLE = 100 THEN
sMONTO_ESC = sMONTO_ESC + " " + "CIEN"
ELSE
sMONTO_ESC = sMONTO_ESC + " " + arrCENTENA[nCENTENA]
END
END
IF nUNIDEC > 0 THEN
sMONTO_ESC = sMONTO_ESC + " " + arrUNIDEC[nUNIDEC]
END
IF nIND = 1 AND (nCENTENA <> 0 OR nUNIDEC <> 0) THEN
IF nTRIPLE = 1
sMONTO_ESC += " MILLARDO"
ELSE
sMONTO_ESC += " MILLARDOS"
END
END
IF nIND = 2 AND (nCENTENA <> 0 OR nUNIDEC <> 0) THEN
IF Val(sTRIPLE) = 1 THEN
sMONTO_ESC += " MILLON"
ELSE
sMONTO_ESC += " MILLONES"
END
END
IF nIND = 3 AND (nCENTENA <> 0 OR nUNIDEC <> 0) THEN sMONTO_ESC += " MIL"
IF nIND = 4 AND nUNIDEC <> 0 AND nUNIDEC <> 11 AND nUNIDAD = 1 THEN sMONTO_ESC += "O" // EL ULTIMO 1 QUE NO DIGA UN SINO UNO
END

RESULT NoSpace(sMONTO_ESC + " CON " + sDECIMALES + "/100")
Membre enregistré
71 messages
Popularité : +2 (2 votes)
Posté le 20 février 2024 - 19:10
Muchísimas gracias, José!!! Abrazo desde México!

--

Antonio Diaz
Emphasys Software, S.C.
Membre enregistré
18 messages
Posté le 27 février 2024 - 14:11
Hola Antonio.

Si gustas puedes pasarte por nuestra comunidad Windev en español para cualquier consulta, organizada por temas y donde ademas hay excelentes videos de aprendizajes.

Comunidad Discord en Español: https://discord.gg/9xDAJ6ugQr

Saludos.
Membre enregistré
71 messages
Popularité : +2 (2 votes)
Posté le 27 février 2024 - 20:56
Gracias Leonardo, ya entré... Saludos...

--

Antonio Diaz
Emphasys Software, S.C.