Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Impresión
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 22-11-2021
luchifer luchifer is offline
No confirmado
 
Registrado: jul 2007
Ubicación: Santa Cruz - Bolivia
Posts: 50
Poder: 0
luchifer Va por buen camino
Problemas Maestro/Detalle

Jovenes Buenos dias:


Estoy haciendo un reporte anualizado de cuentas bajo el formato MAESTRO DETALLE. Pretendo el mismo salga asi:
ene feb mar abr may jun ........ dic total
Activo
Bancos 520 600 650 700 800 900
ctas x 600 800 550 600 700 800
total 1120 1400 1200 1300 1500 1700

La instruccion para el Query del maestro es:

select idbal, cta, descri from lplancta where (idbal='2' or idbal='3' or idbal='7') and nivel='1'

Y la instruccion para el detalle es:

select distinct c.idbal, m.cta, c.descri,
(select sum(i.debe-i.haber) from lcontmov i where i.cta=m.cta and month(i.fecha)=1 and year(i.fecha)=2021) as di1,
(select sum(i.debe-i.haber) from lcontmov i where i.cta=m.cta and month(i.fecha)=2 and year(i.fecha)=2021) as di2,
(select sum(i.debe-i.haber) from lcontmov i where i.cta=m.cta and month(i.fecha)=3 and year(i.fecha)=2021) as di3,
(select sum(i.debe-i.haber) from lcontmov i where i.cta=m.cta and month(i.fecha)=4 and year(i.fecha)=2021) as di4,
(select sum(i.debe-i.haber) from lcontmov i where i.cta=m.cta and month(i.fecha)=5 and year(i.fecha)=2021) as di5,
(select sum(i.debe-i.haber) from lcontmov i where i.cta=m.cta and month(i.fecha)=6 and year(i.fecha)=2021) as di6,
(select sum(i.debe-i.haber) from lcontmov i where i.cta=m.cta and month(i.fecha)=7 and year(i.fecha)=2021) as di7,
(select sum(i.debe-i.haber) from lcontmov i where i.cta=m.cta and month(i.fecha)=8 and year(i.fecha)=2021) as di8,
(select sum(i.debe-i.haber) from lcontmov i where i.cta=m.cta and month(i.fecha)=9 and year(i.fecha)=2021) as di9,
(select sum(i.debe-i.haber) from lcontmov i where i.cta=m.cta and month(i.fecha)=10 and year(i.fecha)=2021) as di10,
(select sum(i.debe-i.haber) from lcontmov i where i.cta=m.cta and month(i.fecha)=11 and year(i.fecha)=2021) as di11,
(select sum(i.debe-i.haber) from lcontmov i where i.cta=m.cta and month(i.fecha)=12 and year(i.fecha)=2021) as di12
from lcontmov m, lplancta c
where c.idbal=:idbal and m.cta=c.cta and year(m.fecha)=2021
order by m.cta

Y el momento de enlazar me da el erro objeto parameter mal definido.

ALGUIEN PODRIA POR FAVOR ORIENTARME Y DECIRME DONDE ME ESTOY EQUIVOCANDO
Responder Con Cita
  #2  
Antiguo 23-11-2021
Avatar de kuan-yiu
[kuan-yiu] kuan-yiu is offline
Miembro Premium
 
Registrado: jun 2006
Ubicación: Galicia. España.
Posts: 1.017
Poder: 19
kuan-yiu Va camino a la fama
Además de como tengas definidas las consultas tienes que enlazar ambos TQuery para que se comporten como deseas.
Responder Con Cita
  #3  
Antiguo 23-11-2021
luchifer luchifer is offline
No confirmado
 
Registrado: jul 2007
Ubicación: Santa Cruz - Bolivia
Posts: 50
Poder: 0
luchifer Va por buen camino
maestro detalle

Justamente estoy tratando de enlazar el detalle con el maestro a travez del identificador de balance. Creen que pueda ser el distinct porque en otra consulta sin maestro detalle funciona perfectamente
Responder Con Cita
  #4  
Antiguo 23-11-2021
Avatar de kuan-yiu
[kuan-yiu] kuan-yiu is offline
Miembro Premium
 
Registrado: jun 2006
Ubicación: Galicia. España.
Posts: 1.017
Poder: 19
kuan-yiu Va camino a la fama
No sé como lo estás enlazando o que usas para los reportes pero si enlazas una TQuery con otra hay muchos modos de hacerlo.
Si lo haces directamente por código para controlar cuando y como se ejecuta al menos en el TQuery que tiene el detalle debes haber definido en TParams de qué tipo son todos esos campos que usas para enlazar:
qMaestro: componente que tiene la consulta principal.
qDetalle: componente que tiene las líneas de detalle.
qDetalle.params: todos los campos por los que enlazas para que la subconsulta sepa de que tipo son y como debe enlazarlos (qDetalle.params[0].name: el nombre de la variable, qDetalle.params[0].DataType: el tipo de dato, ...)
Yo lo hago en tiempo de diseño en el propio componente del reporte, pero puedes hacerlo por código si lo necesitas así porque la consulta cambia.
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

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
Problemas Con Maestro Detalle nikotina Varios 6 13-06-2008 16:48:26
Problemas con Maestro Detalle FelipeDiaz Conexión con bases de datos 2 02-11-2007 18:05:37
problemas maestro-detalle DBexpress jmlifi Conexión con bases de datos 2 16-06-2006 13:27:05
Problemas con Datamodule y maestro detalle Carlex Conexión con bases de datos 3 24-04-2006 15:23:44
problemas maestro-detalle jmlifi Varios 1 28-11-2005 22:10:22


La franja horaria es GMT +2. Ahora son las 14:03:25.


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