• REFERENCIA
  • |
  • DOWNLOAD
  • |
  • TIPS
  • |
  • TWITTER
  • |
  • Índice general ‹ TOOLBOX ‹ Recortes de código
  • FAQ
  • Registrarse
  • Login
  • RSS
  • Cambiar tamaño de la fuente
  • Pasar importe numerico a letra.

  • Imprimir vista
  • Linkedin Twitter Facebook Delicious Digg Twitter |
Recortes de código. trucos rápidos
Publicar una respuesta
7 mensajes • Página 1 de 1

Pasar importe numerico a letra.

Notapor Jesus-DBFile » 14 Abr 2008, 10:16

El campo TOTAL FACTURA es el que da el resultado numerico. El resultado de este campo de calculo debe ser de texto.

Activar/desactivar numeración | Mostrar/Ocultar | Seleccionar todo
  1. If(Length(GetAsText(Int(TOTAL FACTURA))) > 7; "";
  2. Substitute(Trim(If(Length(GetAsText(Int(TOTAL FACTURA))) = 8 or
  3. Length(GetAsText(Int(TOTAL FACTURA))) = 7
  4. ;Choose(If(Length(GetAsText(Int(TOTAL FACTURA))) >=
  5. 8;Left(Int(TOTAL FACTURA);2);If(Length(GetAsText(Int(TOTAL FACTURA)))=7;Left(Int(TOTAL FACTURA);1);
  6. ""));
  7. "";"un";"dos";"tres";"cuatro";"cinco";"seis";"siete";"ocho";"nueve") &
  8. Case(IsEmpty(If(Length(GetAsText(Int(TOTAL FACTURA))) >=
  9. 8;Left(Int(TOTAL FACTURA);2);If(Length(GetAsText(Int(TOTAL FACTURA)))=7;Left(Int(TOTAL FACTURA);1);
  10. ""))) ; "" ;If(Length(GetAsText(Int(TOTAL FACTURA))) >=
  11. 8;Left(Int(TOTAL FACTURA);2);If(Length(GetAsText(Int(TOTAL FACTURA)))=7;Left(Int(TOTAL FACTURA);1);
  12. "")) = 1 ; " millón ";" millones "); "" ) &
  13. If(Length(GetAsText(Int(TOTAL FACTURA))) >=
  14. 6;Choose(If(Length(GetAsText(Int(TOTAL FACTURA))) >=
  15. 6;Middle(Int(TOTAL FACTURA);Length(GetAsText(Int(TOTAL FACTURA)))-5;1);""); "";If(
  16. If(Length(GetAsText(Int(TOTAL FACTURA))) >=
  17. 5;Middle(Int(TOTAL FACTURA);Length(GetAsText(Int(TOTAL FACTURA)))-4;2);If(Length(GetAsText(
  18. Int(TOTAL FACTURA))) =
  19. 4;Middle(Int(TOTAL FACTURA);Length(GetAsText(Int(TOTAL FACTURA)))-3;1);"")) ="00";"cien
  20. ";"ciento ");"doscientos ";"trescientos ";"cuatrocientos ";"quinientos
  21. ";"seiscientos ";"ochocientos ";"novecientos ") ; "" ) &
  22. If(Length(GetAsText(Int(TOTAL FACTURA))) >= 5
  23. ;Choose(If(Length(GetAsText(Int(TOTAL FACTURA))) >=
  24. 5;Middle(Int(TOTAL FACTURA);Length(GetAsText(Int(TOTAL FACTURA)))-4;2);If(Length(GetAsText(
  25. Int(TOTAL FACTURA))) =
  26. 4;Middle(Int(TOTAL FACTURA);Length(GetAsText(Int(TOTAL FACTURA)))-3;1);"")); "
  27. ";Case(IsEmpty(If(Length(GetAsText(Int(TOTAL FACTURA))) >=
  28. 6;Middle(Int(TOTAL FACTURA);Length(GetAsText(Int(TOTAL FACTURA)))-5;1);"")) ; ""
  29. ;"un");"dos";"tres";"cuatro";"cinco";"seis";"siete";"ocho";"nueve";"diez";"
  30. once";"doce";"trece";"catorce";"quince";"dieciseis";"diecisiete";"dieciocho
  31. ";"diecinueve";"veinte";"veintiuna";"veintidos";"veintitres";"veinticuatro"
  32. ;"veinticinco";"veintiseis";"veintisiete";"veintiocho";"veintinueve";"trein
  33. ta";"treinta y una";"treinta y dos";"treinta y tres";"treinta y
  34. cuatro";"treinta y cinco";"treinta y seis";"treinta y siete";"treinta y
  35. ocho";"treinta y nueve";"cuarenta";"cuarenta y una";"cuarenta y
  36. dos";"cuarenta y tres";"cuarenta y cuatro";"cuarenta y cinco";"cuarenta y
  37. seis";"cuarenta y siete";"cuarenta y ocho";"cuarenta y
  38. nueve";"cincuenta";"cincuenta y una";"cincuenta y dos";"cincuenta y
  39. tres";"cincuenta y cuatro";"cincuenta y cinco";"cincuenta y
  40. seis";"cincuenta y siete";"cincuenta y ocho";"cincuenta y
  41. nueve";"sesenta";"sesenta y una";"sesenta y dos";"sesenta y
  42. tres";"sesenta y cuatro";"sesenta y cinco";"sesenta y seis";"sesenta y
  43. siete";"sesenta y ocho";"sesenta y nueve";"setenta";"setenta y
  44. una";"setenta y dos";"setenta y tres";"setenta y cuatro";"setenta y
  45. cinco";"setenta y seis";"setenta y siete";"setenta y ocho";"setenta y
  46. nueve";"ochenta";"ochenta y una";"ochenta y dos";"ochenta y
  47. tres";"ochenta y cuatro";"ochenta y cinco";"ochenta y seis";"ochenta y
  48. siete";"ochenta y ocho";"ochenta y nueve";"noventa";"noveinta y
  49. una";"noventa y dos";"noventa y tres";"noventa y cuatro";"noventa y
  50. cinco";"noventa y seis";"noventa y siete";"noventa y ocho";"noventa y
  51. nueve") & If(If(Length(GetAsText(Int(TOTAL FACTURA))) >=
  52. 5;Middle(Int(TOTAL FACTURA);Length(GetAsText(Int(TOTAL FACTURA)))-4;2);If(Length(GetAsText(
  53. Int(TOTAL FACTURA))) =
  54. 4;Middle(Int(TOTAL FACTURA);Length(GetAsText(Int(TOTAL FACTURA)))-3;1);"")) = "0" or
  55. If(Length(GetAsText(Int(TOTAL FACTURA))) >=
  56. 5;Middle(Int(TOTAL FACTURA);Length(GetAsText(Int(TOTAL FACTURA)))-4;2);If(Length(GetAsText(
  57. Int(TOTAL FACTURA))) =
  58. 4;Middle(Int(TOTAL FACTURA);Length(GetAsText(Int(TOTAL FACTURA)))-3;1);"")) = "00" and
  59. If(Length(GetAsText(Int(TOTAL FACTURA))) >=
  60. 6;Middle(Int(TOTAL FACTURA);Length(GetAsText(Int(TOTAL FACTURA)))-5;1);"") = "0" ; "" ; "
  61. mil "); If(Length(GetAsText(Int(TOTAL FACTURA))) = 4
  62. ;Choose(If(Length(GetAsText(Int(TOTAL FACTURA))) >=
  63. 5;Middle(Int(TOTAL FACTURA);Length(GetAsText(Int(TOTAL FACTURA)))-4;2);If(Length(GetAsText(
  64. Int(TOTAL FACTURA))) =
  65. 4;Middle(Int(TOTAL FACTURA);Length(GetAsText(Int(TOTAL FACTURA)))-3;1);"")); "
  66. ";Case(IsEmpty(If(Length(GetAsText(Int(TOTAL FACTURA))) >=
  67. 6;Middle(Int(TOTAL FACTURA);Length(GetAsText(Int(TOTAL FACTURA)))-5;1);"")) ; ""
  68. ;"un");"dos";"tres";"cuatro";"cinco";"seis";"siete";"ocho";"nueve") & "
  69. mil "; "")) & Choose(If(Length(GetAsText(Int(TOTAL FACTURA))) >=
  70. 3;Middle(Int(TOTAL FACTURA);Length(GetAsText(Int(TOTAL FACTURA)))-2;1);"");
  71. "";If(If(Length(GetAsText(Int(TOTAL FACTURA))) =
  72. 1;Right(Int(TOTAL FACTURA);1);Right(Int(TOTAL FACTURA);2)) ="00" ; "cien" ;
  73. "ciento");"doscientos";"trescientos";"cuatrocientos";"quinientos";"seiscien
  74. tos";"ochocientos";"novecientos") & If(If(Length(GetAsText(Int(TOTAL FACTURA))) =
  75. 1;Right(Int(TOTAL FACTURA);1);Right(Int(TOTAL FACTURA);2)) ="00" ; "" ; " ") &
  76. Choose(If(Length(GetAsText(Int(TOTAL FACTURA))) =
  77. 1;Right(Int(TOTAL FACTURA);1);Right(Int(TOTAL FACTURA);2));
  78. "";"un";"dos";"tres";"cuatro";"cinco";"seis";"siete";"ocho";"nueve";"diez";
  79. "once";"doce";"trece";"catorce";"quince";"dieciseis";"diecisiete";"diecioch
  80. o";"diecinueve";"veinte";"veintiun";"veintidos";"veintitres";"veinticuatro"
  81. ;"veinticinco";"veintiseis";"veintisiete";"veintiocho";"veintinueve";"trein
  82. ta";"treinta y un";"treinta y dos";"treinta y tres";"treinta y
  83. cuatro";"treinta y cinco";"treinta y seis";"treinta y siete";"treinta y
  84. ocho";"treinta y nueve";"cuarenta";"cuarenta y un";"cuarenta y
  85. dos";"cuarenta y tres";"cuarenta y cuatro";"cuarenta y cinco";"cuarenta y
  86. seis";"cuarenta y siete";"cuarenta y ocho";"cuarenta y
  87. nueve";"cincuenta";"cincuenta y un";"cincuenta y dos";"cincuenta y
  88. tres";"cincuenta y cuatro";"cincuenta y cinco";"cincuenta y
  89. seis";"cincuenta y siete";"cincuenta y ocho";"cincuenta y
  90. nueve";"sesenta";"sesenta y un";"sesenta y dos";"sesenta y tres";"sesenta
  91. y cuatro";"sesenta y cinco";"sesenta y seis";"sesenta y siete";"sesenta y
  92. ocho";"sesenta y nueve";"setenta";"setenta y un";"setenta y dos";"setenta
  93. y tres";"setenta y cuatro";"setenta y cinco";"setenta y seis";"setenta y
  94. siete";"setenta y ocho";"setenta y nueve";"ochenta";"ochenta y
  95. un";"ochenta y dos";"ochenta y tres";"ochenta y cuatro";"ochenta y
  96. cinco";"ochenta y seis";"ochenta y siete";"ochenta y ocho";"ochenta y
  97. nueve";"noventa";"noveinta y un";"noventa y dos";"noventa y
  98. tres";"noventa y cuatro";"noventa y cinco";"noventa y seis";"noventa y
  99. siete";"noventa y ocho";"noventa y nueve") &
  100. If(If(Length(GetAsText(Int(TOTAL FACTURA))) =
  101. 1;Right(Int(TOTAL FACTURA);1);Right(Int(TOTAL FACTURA);2)) = 1; " euro"; " euros") &
  102. If(If(Length(GetAsText(Round( TOTAL FACTURA - Int(TOTAL FACTURA); 2 ) * 100)) =
  103. 1;Right(Round( TOTAL FACTURA - Int(TOTAL FACTURA); 2 ) * 100;1);Right(Round( TOTAL FACTURA -
  104. Int(TOTAL FACTURA); 2 ) * 100;2)) <> 0 ; " con " &
  105. Choose(If(Length(GetAsText(Round( TOTAL FACTURA - Int(TOTAL FACTURA); 2 ) * 100)) =
  106. 1;Right(Round( TOTAL FACTURA - Int(TOTAL FACTURA); 2 ) * 100;1);Right(Round( TOTAL FACTURA -
  107. Int(TOTAL FACTURA); 2 ) * 100;2));
  108. "";"un";"dos";"tres";"cuatro";"cinco";"seis";"siete";"ocho";"nueve";"diez";
  109. "once";"doce";"trece";"catorce";"quince";"dieciseis";"diecisiete";"diecioch
  110. o";"diecinueve";"veinte";"veintiun";"veintidos";"veintitres";"veinticuatro"
  111. ;"veinticinco";"veintiseis";"veintisiete";"veintiocho";"veintinueve";"trein
  112. ta";"treinta y un";"treinta y dos";"treinta y tres";"treinta y
  113. cuatro";"treinta y cinco";"treinta y seis";"treinta y siete";"treinta y
  114. ocho";"treinta y nueve";"cuarenta";"cuarenta y un";"cuarenta y
  115. dos";"cuarenta y tres";"cuarenta y cuatro";"cuarenta y cinco";"cuarenta y
  116. seis";"cuarenta y siete";"cuarenta y ocho";"cuarenta y
  117. nueve";"cincuenta";"cincuenta y un";"cincuenta y dos";"cincuenta y
  118. tres";"cincuenta y cuatro";"cincuenta y cinco";"cincuenta y
  119. seis";"cincuenta y siete";"cincuenta y ocho";"cincuenta y
  120. nueve";"sesenta";"sesenta y un";"sesenta y dos";"sesenta y tres";"sesenta
  121. y cuatro";"sesenta y cinco";"sesenta y seis";"sesenta y siete";"sesenta y
  122. ocho";"sesenta y nueve";"setenta";"setenta y un";"setenta y dos";"setenta
  123. y tres";"setenta y cuatro";"setenta y cinco";"setenta y seis";"setenta y
  124. siete";"setenta y ocho";"setenta y nueve";"ochenta";"ochenta y
  125. una";"ochenta y dos";"ochenta y tres";"ochenta y cuatro";"ochenta y
  126. cinco";"ochenta y seis";"ochenta y siete";"ochenta y ocho";"ochenta y
  127. nueve";"noventa";"noveinta y un";"noventa y dos";"noventa y
  128. tres";"noventa y cuatro";"noventa y cinco";"noventa y seis";"noventa y
  129. siete";"noventa y ocho";"noventa y nueve") &
  130. Case(If(Length(GetAsText(Round( TOTAL FACTURA - Int(TOTAL FACTURA); 2 ) * 100)) =
  131. 1;Right(Round( TOTAL FACTURA - Int(TOTAL FACTURA); 2 ) * 100;1);Right(Round( TOTAL FACTURA -
  132. Int(TOTAL FACTURA); 2 ) * 100;2)) = 1 ; " céntimo" ; " céntimos"); "")); "  " ; "
  133. " ))


Jesus Sanchez
Database Developer
info@dbfile.es
Avatar de Usuario
Jesus-DBFile
 
Mensajes: 156
Registrado: 10 Abr 2008, 19:56
Ubicación: Valencia, España
Blog: View Blog (0)
  • Sitio web
Arriba

Re: Pasar importe numerico a letra.

Notapor Antoniofile » 20 Jun 2009, 21:08

En el recorte de codigo tienes un error, le falta "setecientos"
Recibir un saludo.
Antoniofile
 
Mensajes: 6
Registrado: 15 Jun 2009, 19:21
Blog: View Blog (0)
Arriba

Re: Pasar importe numerico a letra.

Notapor Harold » 23 Jun 2009, 18:47

Jooooder,.... menudo currro

Enhorabuena

Enrique
Avatar de Usuario
Harold
 
Mensajes: 44
Registrado: 19 Sep 2008, 16:39
Ubicación: Valencia
Blog: View Blog (0)
  • Sitio web
Arriba

Re: Pasar importe numerico a letra.

Notapor Jesus-DBFile » 24 Jun 2009, 09:35

La formula no es mia, creo que la consegui de la antigua lista FmClub, solo la puse aqui al inaugurar el foro para colaborar con los contenidos, ya hace más de un año....

Pero digo lo mismo, enhorabuena al que la desarrollo!!

Saludos.
Avatar de Usuario
Jesus-DBFile
 
Mensajes: 156
Registrado: 10 Abr 2008, 19:56
Ubicación: Valencia, España
Blog: View Blog (0)
  • Sitio web
Arriba

Re: Pasar importe numerico a letra.

Notapor fsans » 25 Jun 2009, 09:25

No sé porqué este es un tema recursivo, que de vez en cuando se trata de redescubrir volviendo siempre a soluciones arcaicas, aunque tambien es cierto que sucede con muchos otros topicos... ¿ quizás nadie se molesta en hacer una simple busqueda en el foro ?

Despues de varios años especulando sobre la mejor opcion sobre como calcular la expresion correspondiente a una cifra, es español, en FMClub desarrollamos esta version muy evolucionada y simple, valida para FileMaker 8.5 o posterior:

viewtopic.php?f=31&t=39

Esta disponible en español, catalan y creo que galego, y es fácil de adaptar a otras lenguas simplemente editando los strings de idioma disponibles. Hay tambien un ejemplo para descargar al final del post referenciado, o bien se puede usar la formula como custom function.
Avatar de Usuario
fsans
Site Admin
 
Mensajes: 474
Registrado: 09 Abr 2008, 11:04
Ubicación: Barcelona, España
Blog: View Blog (1)
  • fsans
  • Sitio web
Arriba

Re: Pasar importe numerico a letra.

Notapor Antoniofile » 11 Sep 2009, 17:52

cuando el resultado es negativo, por ejemplo aplicandolo para unos abonos de facturas, no da bien el resultado.
Antoniofile
 
Mensajes: 6
Registrado: 15 Jun 2009, 19:21
Blog: View Blog (0)
Arriba

Re: Pasar importe numerico a letra.

Notapor Buzzly » 11 Sep 2009, 21:19

Antoniofile escribió:cuando el resultado es negativo, por ejemplo aplicandolo para unos abonos de facturas, no da bien el resultado.

Hola!!

Prueba usando la función ABS(valor) para que tomé el valor númerico sin importar el signo.

Atte.
Héctor Cornejo Cravioto
Piensa diferente... y vivirás mejor
Buzzly
 
Mensajes: 67
Registrado: 13 Mar 2009, 00:31
Blog: View Blog (0)
Arriba


Publicar una respuesta
7 mensajes • Página 1 de 1

  • FMClub Sponsoring

Si te ha resultado útil, contribuye con una donación a FMClub. Los fondos recibidos se destinan a financiar el hosting y mantenimiento del sitio web. Cualquier cantidad será muy apreciada ! Los pagos pueden realizarse vía PayPal o cualquier tarjeta de crédito.


Volver a Recortes de código



¿Quién está conectado?

Usuarios navegando por este Foro: Yahoo [Bot] y 1 invitado

  • Índice general
  • Borrar cookies • Horarios UTC + 1 hora [ DST ]

  • FMClub Sponsoring
SetFile Codigo Red Bases & Datos Desarrollos FileMaker NetworkBCN worldcloud.com The FlexClub
FMClub © 1999-2009 Network BCN Software, Barcelona, Spain • Powered by phpBB © phpBB Group
611,731 Vistas