Portal    Foro    Buscar    FAQ    Registrarse    Conectarse


Publicar nuevo tema  Responder al tema 
Página 1 de 1
 
 
Asociar Fuentes De Datos A Traves De Un Campo Clave Con Gb.report
Autor Mensaje
Responder citando   Descargar mensaje  
Mensaje Asociar Fuentes De Datos A Traves De Un Campo Clave Con Gb.report 
 
buenos dias muchachos uso ubuntu 10,10 y gambas 3.1 quisiera pedirles el favor de informarme si es posible asociar fuentes de datos o contenedores en funcion de un campo clave he usado  stimulsoftreprt para vb.net que permite asociar fuentes de datos en funcion de un campo clave para poder mostar detalles de una tabla maestra, no se si con gb.report sea posible pues quisiera cambiar los reportes del proyecto de grado que los hice en html a gb.report.

aqui les dejo el codigo que generé del reporte en html y la imagen de lo que quisiera poder hacer con gb.report que tiene un pequeño error en la tabla carcteristicas pero basicamente es lo que quiero mostrar :


If CInt(modulofunciones.nivel) < 2 Then
  consultareport = modulofunciones.conexion.Exec("select tblequipos.descrip,tblequipos.cod_refe, tblequipos.status,tblequipos.motivo,tblequipos.cod_equipo from tblequipos where 1=1 " & cadena1 & cadena2 & cadena3 & " ")
  
  Else
  consultareport = modulofunciones.conexion.Exec("select tblequipos.descrip,tblequipos.cod_refe, tblequipos.status,tblequipos.motivo,tblequipos.cod_equipo from tblequipos where tblequipos.cod_espe=" & modulofunciones.codigo_especialidad & " " & cadena1 & cadena2 & cadena3 & " ")
  Endif
' primera parte del reporte - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 Open "/tmp/reporte.html" For Create As #Reporte
 Reporte = Open "/tmp/reporte.html" For Create
 Print #Reporte, "<html>"
'
 Print #Reporte, " <head><title>Reporte de  equipos-</title></head>"
 Print #Reporte, " <body topmargin = '2' leftmargin='2'>"
 Print #Reporte, "   <table align = 'center' width = 1200 border = '2' cellpadding='0' cellspacing='0'>"
'
 Print #Reporte, "     <tr>"
 Print #Reporte, "       <td align = 'center' width=100><b> <IMG SRC='/home/eduardo/Escritorio/laboratorios/iconos/iutai.jpeg' width=100 height=100 ></b> </td>"
 Print #Reporte, "       <td align = 'center'width= 800><b> Republica Bolivariana de Venezuela</b> <br><b> Ministerio del Poder Popular para la Educacion</b><br><b> Instituto Universitario de Tecnologia Agro-Industrial</b></td>"
 Print #Reporte, "     </tr>"
 Print #Reporte, "   </table>"
 Print #Reporte, " <br> "
 Print #Reporte, " <br> "
'
'
'
 For i = 0 To consulta.Count - 1
'
 vector[i] = consulta[4]
'
'
 Print #Reporte, "   <table align = 'center' width = 1200 border = '2' cellpadding='0' cellspacing='0'>" ' inicio tabla mayor
 Print #Reporte, "     <tr bgcolor='#CCCC99'>" 'inicio fila mayor
 Print #Reporte, "       <td  align = 'center'>" "" ' inicio columna mayor
 Print #Reporte, "   <table align = 'center' width = 1200 border = '2' cellpadding='0' cellspacing='0'>"
 Print #Reporte, "     <caption><h2>EQUIPO</h2></caption>"
 Print #Reporte, "     <tr>"
 Print #Reporte, "       <td align = 'center' width= 300><b>DESCRIPCION</b></td>"
 Print #Reporte, "       <td align = 'center'width= 800><b>CODIGO DE REFERENCIA</b></td>"
 Print #Reporte, "       <td align = 'center'width= 380><b>ESTATUS</b></td>"
 Print #Reporte, "       <td align = 'center'width= 200><b>MOTIVO DE ANULACION</b></td>"
 Print #Reporte, "     </tr>"
 Print #Reporte, "     <tr>"
'
'
'
 Print #Reporte, "     <tr>"
    Print #Reporte, "       <td align = 'center'>" & consulta[0] & " </td>"
    Print #Reporte, "       <td align = 'center'>" & consulta[1] & " </td>"
    If CInt(consulta[2]) = 0 Then
    Print #Reporte, "       <td align = 'center'> ACTIVO </td>"
    Else
    Print #Reporte, "       <td align = 'center'> ANULADO </td>"
    Endif
    Print #Reporte, "       <td align = 'center'>" & consulta[3] & " </td>"
  Print #Reporte, "     <tr>"
  consulta.MoveNext
'
  Print #Reporte, "   </table>"
'
'  'segunda parte del reporte-----------------------------------------------------------------------
'
' 'SEGUNDA TABLA-------------------------------------------------------------
'
 If CInt(modulofunciones.nivel) < 2 Then
 consulta1 = modulofunciones.conexion.Exec("select tbldispositivos.descrip,to_char(tblequipodisp.fecha_regi,'DD/MM/YYYY'),tbldispositivos.status,tbldispositivos.motivo from tbldispositivos inner join tblequipodisp on(tbldispositivos.cod_dispositivo=tblequipodisp.cod_dispositivo) where tblequipodisp.cod_equipo=" & CInt(vector[i]) & " order by tbldispositivos.descrip")
 Else
 consulta1 = modulofunciones.conexion.Exec("select tbldispositivos.descrip,to_char(tblequipodisp.fecha_regi,'DD/MM/YYYY'),tbldispositivos.status,tbldispositivos.motivo from tbldispositivos inner join tblequipodisp on(tbldispositivos.cod_dispositivo=tblequipodisp.cod_dispositivo) where tblequipodisp.cod_equipo=" & CInt(vector[i]) & " and tbldispositivos.cod_espe=" & modulofunciones.codigo_especialidad & " order by tbldispositivos.descrip")
 Endif
'
 If consulta1.Count > 0 Then
'
 Print #Reporte, " <br> "
'
'
 Print #Reporte, "   <table align = 'center' width = 1200 border = '2' cellpadding='0' cellspacing='0'>"
 Print #Reporte, "     <caption><h2>DISPOSITIVOS DEL EQUIPO</h2></caption>"
 Print #Reporte, "     <tr>"
 Print #Reporte, "       <td align = 'center' width= 300><b>DESCRIPCION</b></td>"
 Print #Reporte, "       <td align = 'center'width= 800><b>FECHA DE REGISTRO</b></td>"
 Print #Reporte, "       <td align = 'center'width= 380><b>ESTATUS</b></td>"
 Print #Reporte, "       <td align = 'center'width= 200><b>MOTIVO DE ANULACION</b></td>"
 Print #Reporte, "     </tr>"
'
'
 For j = 0 To consulta1.Count - 1
'
 Print #Reporte, "     <tr>"
'
'
'
    Print #Reporte, "       <td align = 'center'>" & consulta1[0] & " </td>"
    Print #Reporte, "       <td align = 'center'>" & consulta1[1] & " </td>"
    If CInt(consulta1[2]) = 0 Then
    Print #Reporte, "       <td align = 'center'>ACTIVO</td>"
   Else
    Print #Reporte, "       <td align = 'center'>ANULADO</td>"
    Endif
    Print #Reporte, "       <td align = 'center'>" & consulta1[3] & " </td>"
 Print #Reporte, "     </tr>"
  consulta1.MoveNext
  Next
  
'
'
 Endif
'
 Print #Reporte, "   </table>"
' ' FIN DE SEGUNDA TABLA---------------------------------------------------------------
'
'
' ' TERCERA TABLA---------------------------------------------------------------------
'
 If CInt(modulofunciones.nivel) < 2 Then
 consulta2 = modulofunciones.conexion.Exec("select tblmacs.dir_mac,tblmacs.status,tblmacs.motivo from tblmacs inner join tblequipos on(tblequipos.cod_equipo=tblmacs.cod_equipo) where tblequipos.cod_equipo=" & vector[i] & " order by tblequipos.descrip")
 Else
 consulta2 = modulofunciones.conexion.Exec("select tblmacs.dir_mac,tblmacs.status ,tblmacs.motivo from tblmacs inner join tblequipos on(tblequipos.cod_equipo=tblmacs.cod_equipo) where tblequipos.cod_equipo=" & vector[i] & " and tblequipos.cod_espe=" & modulofunciones.codigo_especialidad & " order by tblequipos.descrip")
 Endif
 If consulta2.Count > 0 Then
 Print #Reporte, " <br> "
'
'
 Print #Reporte, "   <table align = 'center' width = 1200 border = '2' cellpadding='0' cellspacing='0'>"
 Print #Reporte, "     <caption><h2>MACS DEL EQUIPO</h2></caption>"
 Print #Reporte, "     <tr>"
 Print #Reporte, "       <td align = 'center' width= 300><b>MAC</b></td>"
 Print #Reporte, "       <td align = 'center'width= 800><b>ESTATUS</b></td>"
Print #Reporte, "       <td align = 'center'width= 380><b>MOTIVO DE ANULACION</b></td>"
Print #Reporte, "     </tr>"


For j = 0 To consulta2.Count - 1
'
Print #Reporte, "     <tr>"
   Print #Reporte, "       <td align = 'center'>" & consulta2[0] & " </td>"
   If CInt(consulta2[1]) Then
   Print #Reporte, "       <td align = 'center'>ACTIVO</td>"
   Else
   Print #Reporte, "       <td align = 'center'>ANULADO</td>"
   Endif
   Print #Reporte, "       <td align = 'center'>" & consulta2[2] & " </td>"
 Print #Reporte, "     </tr>"
 consulta2.MoveNext
 Next
Endif
Print #Reporte, "   </table>"
'
'
' ' FIN DE TERCERA TABLA--------------------------------------------------------------
'
' 'ULTIMA TABLA------------------------------------------------------------------------
'
If CInt(modulofunciones.nivel) < 2 Then
consulta3 = modulofunciones.conexion.Exec("select tbltipocaracteristica.descrip,tblcaracteristicas.tarjeta,tblcaracteristicas.procesador,tblcaracteristicas.memoria,tblcaracteristicas.disco from tblequipos inner join tblequipodisp on(tblequipos.cod_equipo=tblequipodisp.cod_equipo) inner join tbldispositivos on(tblequipodisp.cod_dispositivo=tbldispositivos.cod_dispositivo) inner join tbltipocaracteristica on(tbldispositivos.cod_tipocaracteristica=tbltipocaracteristica.cod_tipocaracteristica) inner join tblcaracteristicas on(tbltipocaracteristica.cod_tipocaracteristica=tblcaracteristicas.cod_tipocaracteristica) where tblequipos.cod_equipo=" & vector[i] & " order by tblequipos.descrip ")
Else
consulta3 = modulofunciones.conexion.Exec("select tbltipocaracteristica.descrip,tblcaracteristicas.tarjeta,tblcaracteristicas.procesador,tblcaracteristicas.memoria,tblcaracteristicas.disco from tblequipos inner join tblequipodisp on(tblequipos.cod_equipo=tblequipodisp.cod_equipo) inner join tbldispositivos on(tblequipodisp.cod_dispositivo=tbldispositivos.cod_dispositivo) inner join tbltipocaracteristica on(tbldispositivos.cod_tipocaracteristica=tbltipocaracteristica.cod_tipocaracteristica) inner join tblcaracteristicas on(tbltipocaracteristica.cod_tipocaracteristica=tblcaracteristicas.cod_tipocaracteristica) where tblequipos.cod_equipo=" & vector[i] & " and tblequipos.cod_espe = " & modulofunciones.codigo_especialidad & " order by tblequipos.descrip ")
Endif
If consulta3.Count > 0 Then
Print #Reporte, " <br> "


Print #Reporte, "   <table align = 'center' width = 1200 border = '2' cellpadding='0' cellspacing='0'>"
Print #Reporte, "     <caption><h2>CARACTERISTICAS DEL CASE</h2></caption>"
Print #Reporte, "     <tr>"
Print #Reporte, "       <td align = 'center' width= 300><b>TIPO CASE</b></td>"
Print #Reporte, "       <td align = 'center'width= 800><b>TARJETA MADRE</b></td>"
Print #Reporte, "       <td align = 'center'width= 380><b>PROCESADOR</b></td>"
Print #Reporte, "       <td align = 'center'width= 380><b>MEMORIA</b></td>"
Print #Reporte, "       <td align = 'center'width= 380><b>DISCO</b></td>"
Print #Reporte, "     </tr>"


For j = 0 To consulta3.Count - 1

Print #Reporte, "     <tr>"
   Print #Reporte, "       <td align = 'center'>" & consulta3[0] & " </td>"
   Print #Reporte, "       <td align = 'center'>" & consulta3[1] & " </td>"
   Print #Reporte, "       <td align = 'center'>" & consulta3[2] & " </td>"
   Print #Reporte, "       <td align = 'center'>" & consulta3[3] & " </td>"
   Print #Reporte, "       <td align = 'center'>" & consulta3[4] & " </td>"
 Print #Reporte, "     </tr>"
 consulta3.MoveNext
 Next
Endif
Print #Reporte, "   </table>"






'
' 'FIN DE ULTIMA TABLA
'
'
'
'
 Print #Reporte, "</td>" ' fin de columna mayor
 Print #Reporte, "     </tr>" ' fin de fila mayor
 Print #Reporte, "   </table>" 'fin de tabla mayor
 
 Print #Reporte, " <br> "
Print #Reporte, " <br> "
 Print #Reporte, " <br> "
Print #Reporte, " <br> "
 Next  ' NEXT DE FOR I







Print #Reporte, " <form>"
Print #Reporte, " <center>"
Print #Reporte, " <HR width=1200> "
Print #Reporte, " <br> "
Print #Reporte, " <br> "
Print #Reporte, " <input type='button' value='Imprimir' OnClick='window.print()'>"

' PRINT #Reporte, " <input type='button' value='Cerrar' OnClick='window.close()'>"
 Print #Reporte, " </center>"
 Print #Reporte, "</form>"
Print #Reporte, " </body>"
Print #Reporte, "</html>"
Close #Reporte
Exec ["firefox", "/tmp/reporte.html"]



pantallazo
 



 
última edición por victoria el Martes, 17 Abril 2012, 17:37; editado 1 vez 
victoria - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Asociar Fuentes De Datos A Traves De Un Campo Clave Con Gb.report 
 
Hola

La verdad es que nunca he usado gb.report, pero las mejoras tan significativas en las nuevas versiones de gambas han despertado mi interés y el de mucha gente, supongo.

En cualquier caso, cualquier cosa que puedas hacer en html seguro que es posible hacerla también en gb.report. No veo las razones para lo contrario, lo único es que al no estar muy documentado, costará al principio hacerlo de la mejor forma.

Si no recuerdo mal, alguien aquí en el foro escribió un post demostrando su uso de una forma sencilla. Prueba a buscarlo, quizás te ayude.

Saludos
 




===================
Jesús Guardón

Por favor, usemos el corrector ortográfico antes de pulsar el botón "Enviar".

"uo ǝs ʇɐu pıɟıɔıן ɐdɹǝupǝɹ ɐ dɹoƃɹɐɯɐɹ, soןo ɥɐʎ bnǝ dɹodouǝɹsǝןo"
 
jguardon - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Asociar Fuentes De Datos A Traves De Un Campo Clave Con Gb.report 
 
gracias por la respuesta!, si yo vi el post muy bueno, de hecho ese fue mi guia para empezar a realizar los reportes con gb. report pero estuve indagando y probando para poder enlazar ya sean contenedores o de ser posible fuentes de datos para poder mostrar el reporte como lo monte en html, si logre montar la informacion en diferentes contenedores pero no enlazados, por ahora lo monte lineal que no se ve muy bien que digamos pero bueno mientras averiguo sera asi como aparece en la imagen. la diferencia por un lado es que no hay que bregar tanto con el cuadre de la información en la hoja, recuerda que en html hay que cuadrar esa parte por código con gb.report ya seleccionas el tipo de hoja y listo. por otro lado como tu dices con html yo ya se diseñar mis reportes como los necesite en cambio con gb.report aun no. y los profesores de la universidad a la que les queda el proyecto vieron los reportes en html y pidieron que al menos los montara en fpdf pero tampoco logre enviar mis parámetros generados por gambas a través de url para trabajar con fpdf pantallazo_1334759081_169479
 



 
victoria - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Asociar Fuentes De Datos A Traves De Un Campo Clave Con Gb.report 
 
Hola, ayer me pue a jugar con el código fuente del componente gb.report y me di cuenta de la cantidad de ejemplos que hay, además de la cantidad de cosas que aun no se sobre el tema, adjunto dejo un ejemplo más simple y que seguramente te va a servir para lo que quieres.

Si antes pensaba que gb.report es una genialidad de componente ahora estoy completamente seguro

gb-report-example-0.0.1.tar.gz
Descripción: Ejemplo de Reporte en Gambas 3.1 
Descargar
Nombre del archivo: gb-report-example-0.0.1.tar.gz
Tamaño: 17.41 KB
Descargado: 38 veces
gb-report-example-0.0.1.tar.gz
Descripción: Ejemplo de Reporte en Gambas 3.1 
Descargar
Nombre del archivo: gb-report-example-0.0.1.tar.gz
Tamaño: 17.41 KB
Descargado: 38 veces
gb-report-example-0.0.1.tar.gz
Descripción: Ejemplo de Reporte en Gambas 3.1 
Descargar
Nombre del archivo: gb-report-example-0.0.1.tar.gz
Tamaño: 17.41 KB
Descargado: 38 veces

 




===================
William Cabrera
Mi Blog
Mi Twitter
IRC de Gambas en Español
 
willicab - Ver perfil del usuarioEnviar mensaje privadoVisitar sitio web del usuario 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Asociar Fuentes De Datos A Traves De Un Campo Clave Con Gb.report 
 
gracias por el ejemplo pero pues aun presento dos problemas por cada registro de equipos necesito sacar el detalle de los dispositivos del equipo, macs del equipo y características del case eso quiere decir que necesitaría enlazar fuentes de datos que creo que por ahora gb.report no tiene esa propiedad o sacar los detalles en contenedores separados que es como lo estaba haciendo como para medio cuadrar la cuestión pero resulta que el contenedor de datos del equipo crece según la cantidad de registros de equipos existan y estoy intentando desde hace días que un siguiente contenedor se ubique justo después de que termine cada contenedor de datos pero aun nada. se me ha complicado la cuestión porque a veces me deja espacios muy grandes o cuando la información en el contenedor es mucha sale incompleta la información. como en el caso de la imagen. me ha sacado canas el editor jeee,jeee,jee pero le sigo dando con ese porque son escasos los reportes que necesito bajo ese estilo del html que envié pantallazo_1334966648_841301  en la imagen de resto son todos lineales y me sirve bastante el gb.report para ello
 



 
victoria - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Asociar Fuentes De Datos A Traves De Un Campo Clave Con Gb.report 
 
Sería de mucha ayuda si pudieras pasar la estructura de la basde de datos que estás usando y algunos registros de ejemplo, creo que con eso podría entender mejor lo que estás buscando.

Por otro lado tal vez pueda ayudarte cambiando la sintaxis al momento de mostrar los datos, es decir, en lugar de usar

Last.data = hRes1!campo


puedes usar

Last.data = hRes1["tabla.campo"]

 




===================
William Cabrera
Mi Blog
Mi Twitter
IRC de Gambas en Español
 
willicab - Ver perfil del usuarioEnviar mensaje privadoVisitar sitio web del usuario 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Asociar Fuentes De Datos A Traves De Un Campo Clave Con Gb.report 
 
buenos días muchachos! gracias por sus respuestas. envio adjunto los backups de postgresql de la tabla equipos y la tabla de macs con datos ejemplo. de allí saco la primera parte de la ultima imagen del reporte que monte. la idea es la siguiente: un equipo puede tener varias macs. seria una relación  1------N , entonces debería mostrar en un contenedor los datos principales del equipo y poder incrustar las diferentes macs por cada equipo en un contenedor  y si sucesivamente con todos los equipos sin necesidad de repetir los datos principales de los equipos como actualmente me ha tocado hacerlo por motivos de no saber como asociar los 2 contenedores. eso quiere decir en mi opinión que ese segundo contenedor debe estar asociado al primero en función del código del equipo para poder mostrar los datos como en el html que monte por cada equipo .

tablas.tar.gz
Descripción: tabla de equipos y tabla de macs 
Descargar
Nombre del archivo: tablas.tar.gz
Tamaño: 1.71 KB
Descargado: 42 veces
tablas.tar.gz
Descripción: tabla de equipos y tabla de macs 
Descargar
Nombre del archivo: tablas.tar.gz
Tamaño: 1.71 KB
Descargado: 42 veces
tablas.tar.gz
Descripción: tabla de equipos y tabla de macs 
Descargar
Nombre del archivo: tablas.tar.gz
Tamaño: 1.71 KB
Descargado: 42 veces

 



 
victoria - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Mostrar mensajes anteriores:    
 
OcultarTemas parecidos
Tema Autor Foro Respuestas último mensaje
No hay nuevos mensajes Datos Almacenados En Un Campo Integer De U... aristicol Bases de Datos 0 Domingo, 27 Diciembre 2009, 20:40 Ver último mensaje
aristicol
No hay nuevos mensajes Incompatibilidad Entre Gb.qt, Gb.report Y ... grepNova Bases de Datos 0 Jueves, 26 Agosto 2010, 17:51 Ver último mensaje
grepNova
No hay nuevos mensajes SQLite - Conectarse A Traves De Una Red Lo... abarzuaf Bases de Datos 6 Jueves, 16 Septiembre 2010, 19:32 Ver último mensaje
ahtonio
No hay nuevos mensajes OpenGL A Traves De Las LIBRERIAS EXTERNAS ... tercoIDE General 7 Domingo, 17 May 2020, 23:10 Ver último mensaje
tercoIDE
 

Publicar nuevo tema  Responder al tema  Página 1 de 1
 

Usuarios navegando en este tema: 0 registrados, 0 ocultos y 1 invitado
Usuarios registrados conectados: Ninguno


 
Lista de permisos
No puede crear mensajes
No puede responder temas
No puede editar sus mensajes
No puede borrar sus mensajes
No puede votar en encuestas
No puede adjuntar archivos
Puede descargar archivos
No puede publicar eventos en el calendario



  

 

cron