FTP | CCD | Buscar | Trucos | Trabajo | Foros |
#21
|
||||
|
||||
Pues usa la función que he puesto yo antes.
Y veo que ecfisa también. Creo que con ellas no tendrás ese problema. |
#22
|
||||
|
||||
En realidad, las funciones de redondeo nativas de Delphi no fueron de todo buenas en las versiones de años anteriores. En Delphi 7, por ejemplo, es evidente un bug de signo en la función SimpleRoundTo.
Delphi 7: Delphi XE2: Viendo el código fuente de la unidad Math, noto que Embarcadero ha insertado diversos cambios relacionados con las funciones de redondeo, y las pruebas arrojan mejores resultados que en Delphi 7. Por otra parte, parece que SetRoundMode ya no tiene efecto sobre RoundTo, lo cual puede ser bueno o malo, dependiendo de si utilizábamos o no esta última para hacer operaciones de ceil y floor (como las ilustradas por Nelson en el mensaje 17). novato_erick no deberá tener más problemas si usa una versión reciente de Delphi. Pero cabe recordarle que hay muchas funciones hechas por la Comunidad (como las que ya le sugirieron) que puede emplear de manera igualmente efectiva en versiones de Delphi como la 7. Tal vez el siguiente código ayude a apreciar lo que comento en los párrafos anteriores. Para quien pueda hacerlo, recomiendo probarlo tanto en Delphi 7 como en XE2, pues con ello notará las diferencias. Incluyo en estas pruebas unas con ghRound (función de GHF) a fin de ofrecerle una alternativa más a nuestro compañero. Finalmente, creo que vale la pena echar un vistazo a este par de antiguos hilos (tan antiguos como el proceso de pulimento de mi carácter ): http://www.clubdelphi.com/foros/show...573#post170573 http://www.clubdelphi.com/foros/showthread.php?t=38102 Un saludo. Al González. |
#23
|
||||
|
||||
Cita:
|
#24
|
|||
|
|||
hola Al González cómo siempre tus aportes igual que el de tus colegas casimiro, ecfisa son un ejemplo de conocimiento y enriquecimiento en este foro los felicito y les doy las gracias..
Al González Cita:
Algo curioso casimiro utilicé tu función que me recomendabas y la de ecfisa también pero tengo el mismo problema no me redondean cuando el tercer valor decimal ejemplo: 5.265 u otro valores. por eso busqué la ayuda de delphi y otros hilos es extraño que no suceda muy a menudo. ya me está volviendo loco ese redonde porque la imp fiscal si lo hace siempre para arriba y en cosasiones es 0.01 centécimos el valor que me hace falta en la factura... Saludos chicos pd: disculpen si no he mencionado a las otras personas que me han siempre colaborado pero son varios que olvido sus nick... pero igual manera son muy útiles sus aportes gracias chicos Última edición por novato_erick fecha: 22-04-2014 a las 19:40:39. |
#25
|
||||
|
||||
Pon un ejemplo concreto, con código, datos, valores, todo.
¡Y a saber cómo redondea esa impresora! |
#26
|
||||
|
||||
Cita:
A ver... proba de este modo:
Ejemplo:
Saludos
__________________
Daniel Didriksen Guía de estilo - Uso de las etiquetas - La otra guía de estilo .... |
#27
|
|||
|
|||
Hola Chicos lastimosamente la impresora fiscal tiene una dll llamada BEMAFI32.dll el cual llama una funciones en el que están dentro de una unidad que la llame declaraciones y busque cómo la impresora realiza el redondeo y solamente tiene esto:
más nada jejeje igual que otras funciones que utilizo. en cuanto a código de ejemplo hago lo siguiente:
Saludos novato_erick |
#28
|
|||
|
|||
Hola una imagen para que vean pueda ser más ilustrado eso es en el caso de una variable que maneja los descuentos pero lo mismo sucede en otras variables con el redondeo.
Saludos novato_erick |
#29
|
||||
|
||||
novato_erick,
Cita:
El código anterior redondea un número tipo double al número de decimales especificados con redondeo al infinito, como se muestra en la siguiente imagen: Espero sea útil Nelson. Última edición por nlsgarcia fecha: 22-04-2014 a las 21:30:27. |
#30
|
|||
|
|||
hola eficsa utilice la funcion redondeo
implementaré la función en todos los procedimientos que necesito redondear a dos decimales despues que hago el cálculo de descuentos e impuestos creo que doy por solucionado este tema del redondeo pero que extraño que las funciones estandar que tiene delphi no realice bien esto. Pero claro todo tiene sus ventajas ya que no hay que atenerse a lo creado si no hay que crear... Gracias Chicos en realidad muchas gracias por todo... Saludos novato_eric |
#31
|
|||
|
|||
Yupiiiiiiiiiiiiiiiiiiiii Chicos listo utilicé la función en todas las variables que necesitaba y ahora si me cuadra con la impresora Fiscal y el sistema...
Chicos Agradecidos enormeeeeeeeeeeeementeeeeeeeeee por su ayuda.... Un Gran Saludos Gracias.... |
|
|
|