PHP - Poner etiquetas a un reporte

 
Vista:

Poner etiquetas a un reporte

Publicado por Cristian (42 intervenciones) el 29/01/2013 23:39:36
Veran tengo el siguiente reporte pdf, pero el problema es que me muestra la consulta, mas no los encabezados, quisiera que me muestre el encabezado. u como le agrego
este es mi codigo estoy usando fpdf17,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
require('fpdf.php');
 
class PDF extends FPDF
{
function header()
{
$this->Image('poweredby_sugarcrm_65.png',16,10,33);
$this->SetFont('arial','B',7);
$this->Cell(50);
$this->Cell(80,10,'Fecha de Reuniones',0,0,'C');
$this->Ln(15);
$this->Cell(80,10,'______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________',0,0,'C');
$this->Ln(15);
}
function Footer()
{
$this->SetY(-10);
$this->SetFont('Arial','I',8);
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}
$pdf=new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
 
$Proyecto = $_POST['txtProyecto'];
$FechaInicio = $_POST['txtFechaInicio'];
$FechaFinal = $_POST['txtFechaFinal'];
 
$conexion=mysql_connect("localhost","root","") or die("problema con el servidor");
mysql_select_db("reunionesongeipcm",$conexion) or die ("no selecciona la base de datos");
 
$consulta = mysql_query("select personal.nomProyecto, personal.nomPersonal,agenda.desAsunto, agenda.tipo,agenda.fecInicio,
agenda.horaInicio, agenda.horaFin , agenda.desLugar from agenda left join personal on 
agenda.codPersonal = personal.codPersonal where agenda.fecInicio BETWEEN  '$FechaInicio'  AND  '$FechaFinal' AND personal.nomProyecto = '$Proyecto' order by agenda.fecInicio asc;
",$conexion);
while($resultado = mysql_fetch_array($consulta)){
 
$pdf->Cell(8,5,$resultado['nomProyecto'],1,0,'left');
$pdf->Cell(30,5,$resultado['nomPersonal'],1,0,'left');
$pdf->Cell(70,5,$resultado['desAsunto'],1,0,'left');
$pdf->Cell(15,5,$resultado['tipo'],1,0,'left');
$pdf->Cell(20,5,$resultado['fecInicio'],1,0,'left');
$pdf->Cell(8,5,$resultado['horaInicio'],1,0,'left');
$pdf->Cell(9,5,$resultado['horaFin'],1,0,'left');
$pdf->Cell(40,5,$resultado['desLugar'],1,0,'left');
 
 
//$pdf->Cell(45,5,$resultado['fecInicio'],1,0,'C'); 
$pdf->Ln();
}
$pdf->Output();
?>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Poner etiquetas a un reporte

Publicado por Alexis Ochoa (92 intervenciones) el 31/01/2013 01:18:16
¿Te refieres al encabezado de la tabla donde se listan los resultados? Porque no aparecerá si no lo escribes xD

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$pdf->Cell(8,5,'Columna1',1,0,'left');
$pdf->Cell(30,5,'Columna2',1,0,'left');
$pdf->Cell(70,5,'Columna3',1,0,'left');
$pdf->Cell(15,5,'Columna4',1,0,'left');
$pdf->Cell(20,5,'Columna5',1,0,'left');
$pdf->Cell(8,5,'Columna6',1,0,'left');
$pdf->Cell(9,5,'Columna7',1,0,'left');
$pdf->Cell(40,5,'Columna8',1,0,'left');
 
while($resultado = mysql_fetch_array($consulta)){
 
$pdf->Cell(8,5,$resultado['nomProyecto'],1,0,'left');
$pdf->Cell(30,5,$resultado['nomPersonal'],1,0,'left');
$pdf->Cell(70,5,$resultado['desAsunto'],1,0,'left');
$pdf->Cell(15,5,$resultado['tipo'],1,0,'left');
$pdf->Cell(20,5,$resultado['fecInicio'],1,0,'left');
$pdf->Cell(8,5,$resultado['horaInicio'],1,0,'left');
$pdf->Cell(9,5,$resultado['horaFin'],1,0,'left');
$pdf->Cell(40,5,$resultado['desLugar'],1,0,'left');
 
 
//$pdf->Cell(45,5,$resultado['fecInicio'],1,0,'C'); 
$pdf->Ln();
}


Ahora, si tienes muchos resultados y esto te genera más de una página y quieres que el encabezado de la tabla aparezca en todas las páginas, escribes eso mismo pero en la función header() (Recuerda que en esta función no es $pdf->algo sino $this->algo)

Espero haberme explicado
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar