Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Bases de datos > Firebird e Interbase
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 27-02-2025
chenech chenech is offline
Miembro
 
Registrado: dic 2013
Posts: 138
Poder: 13
chenech Va por buen camino
Prueba así a ver:
Código:
CAST(SUM(PVP * UNIDADES) AS NUMERIC(9, 2)) AS BASE, 
CAST(SUM((PVP * UNIDADES) * IVA / 100) AS NUMERIC(9, 2)) AS IMPIVA, 
CAST(CAST(SUM(PVP * UNIDADES) AS NUMERIC(9, 2)) + CAST(SUM((PVP * UNIDADES) * IVA / 100) AS NUMERIC(9, 2)) AS NUMERIC(9, 2)) AS TOTAL
Responder Con Cita
  #2  
Antiguo 27-02-2025
Avatar de Casimiro Noteví
Casimiro Noteví Casimiro Noteví is offline
Merodeador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.675
Poder: 10
Casimiro Noteví Tiene un aura espectacularCasimiro Noteví Tiene un aura espectacular
Sería necesario saber exactamente qué datos tienes en ese campo, porque no me cuadra que no redondee correctamente, jamás tuve ese problema.
Responder Con Cita
  #3  
Antiguo 28-02-2025
Avatar de fjcg02
[fjcg02] fjcg02 is offline
Miembro Premium
 
Registrado: dic 2003
Ubicación: Zamudio
Posts: 1.418
Poder: 24
fjcg02 Va camino a la fama
Prueba esto....

Código SQL [-]
SELECT
TOT.CODIGO,
TOT.PORC_IVA,
TOT.BASE * TOT.PORC_IVA/100 AS CUOTA_1,
round( TOT.BASE * TOT.PORC_IVA/100, 2) AS CUOTA_2,
FROM
  (
    SELECT 
    A.CODIGO, 
    D.PORC_IVA, 
    SUM(D.IMPORTE_VENTA) AS BASE
    FROM CAB_VENTAS A LEFT JOIN DET_MOVIMIENTOS D ON A.TIPO_DOCUMENTO = D.TIPO_CABECERA AND A.CODIGO = D.COD_CABECERA
    where a.codigo = 939006
    GROUP BY A.CODIGO, D.PORC_IVA
   ) TOT

Saludos
__________________
Cuando los grillos cantan, es que es de noche - viejo proverbio chino -
Responder Con Cita
  #4  
Antiguo 03-03-2025
afxe afxe is offline
Miembro
 
Registrado: jul 2004
Ubicación: Malaga-España
Posts: 295
Poder: 23
afxe Va por buen camino
Cita:
Empezado por fjcg02 Ver Mensaje
Prueba esto....

Código SQL [-]
SELECT
TOT.CODIGO,
TOT.PORC_IVA,
TOT.BASE * TOT.PORC_IVA/100 AS CUOTA_1,
round( TOT.BASE * TOT.PORC_IVA/100, 2) AS CUOTA_2,
FROM
  (
    SELECT 
    A.CODIGO, 
    D.PORC_IVA, 
    SUM(D.IMPORTE_VENTA) AS BASE
    FROM CAB_VENTAS A LEFT JOIN DET_MOVIMIENTOS D ON A.TIPO_DOCUMENTO = D.TIPO_CABECERA AND A.CODIGO = D.COD_CABECERA
    where a.codigo = 939006
    GROUP BY A.CODIGO, D.PORC_IVA
   ) TOT

Saludos
Sigue sin funcionar....
__________________
Amar al mundo apasionadamente.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Problema con redondeos en doubles briast OOP 3 05-04-2012 11:10:16
Redondeos y no redondeos vivamotos C++ Builder 6 12-06-2010 00:29:48
Redondeos con Firebird 2.0 Jose_T Firebird e Interbase 12 19-01-2007 19:57:02
problemas con float y redondeos wonder boy Firebird e Interbase 17 27-12-2005 20:59:06
Problemas con Redondeos AGAG4 Varios 4 14-11-2005 23:38:44


La franja horaria es GMT +2. Ahora son las 19:52:07.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi