Siguiendo las guias me va muy bn con las imagenes, con texto, cabeceras y footer, pero cuando ya desee obtener informacion de la base de datos, estos no se me muestran en pantalla.
Especificamente es con el ultimo while, que por lo visto no me esta generando datos pues muestro otros valores en la tabla y si los muestra, ojala alguien me pueda ayudar con esto.
Adjunto el código actual:
Código:
PD: Antes me generaban error las lineas de mysql, les agregue el "@" y dejo de mostrarlo, alguien sabe esto k indica?<?php require('fpdf.php'); class PDF extends FPDF { //Cabecera de página function Header() { //Logo $this->Image('ns_header.jpg',10,10,70,30); //Arial bold 15 $this->SetFont('Arial','B',12); $this->SetFont(''); //Movernos a la derecha $this->Cell(70); //Ampliar ancho del borde $this->SetLineWidth(0.4); //Título $this->Cell(80,30,'REPORTE DE ACTIVIDADES',1,0,'C'); //Formato en Título $this->Cell(40,30,'FR-07',1,0,'C'); //Formato en Título $this->Cell(-40,40,'V. 2',0,0,'C'); //Movernos a la derecha $this->Cell(-150,30,' ',1,0,'R'); //Numero de pagina $this->Cell(190,37,' ',1,0,'R'); //Numero de pagina $this->Cell(0,67,'Página '.$this->PageNo().' de {nb}',0,0,'R'); //Salto de línea $this->Ln(50); } //Pie de página function Footer() { //Posición: a 1,5 cm del final $this->SetY(-20); //Arial no italic 12 $this->SetFont('Arial','I',10); $this->SetFont(''); //Color de Llenado de cuadro $this->SetFillColor(200,200,200); //Gris según escala RGB //Ampliar ancho del borde $this->SetLineWidth(0.4); //Cuadro $this->Cell(0,15,'',1,0,'L',1); //Celdas $this->Cell(-345,10,'Fecha Edición:',0,0,'C'); //Celdas $this->Cell(0,10,'Aprobó: Santiago Jiménez',0,0,'R'); //Celdas $this->Cell(-200,10,'Elaboró: Natalia López Vásquez',0,0,'C'); //Celdas $this->Cell(56,20,'01/12/06',0,0,'C'); //Celdas $this->Cell(88,20,'Cargo: Coordinadora de Calidad',0,0,'C'); //Celdas $this->Cell(70,20,'Cargo: Gerente General',0,0,'C'); } } //Tabla coloreada function FancyTable($header,$data) { //Colores, ancho de línea y fuente en negrita $this->SetFillColor(255,0,0); $this->SetTextColor(255); $this->SetDrawColor(128,0,0); $this->SetLineWidth(.3); $this->SetFont('','B'); //Cabecera $w=array(40,35,40,45); for($i=0;$i<count($header);$i++) $this->Cell($w[$i],7,$header[$i],1,0,'C',1); $this->Ln(); //Restauración de colores y fuentes $this->SetFillColor(224,235,255); $this->SetTextColor(0); $this->SetFont(''); //Datos $fill=0; foreach($data as $row) { $this->Cell($w[0],6,$row[0],'LR',0,'L',$fill); $this->Cell($w[1],6,$row[1],'LR',0,'L',$fill); $this->Cell($w[2],6,number_format($row[2]),'LR',0,'R',$fill); $this->Cell($w[3],6,number_format($row[3]),'LR',0,'R',$fill); $this->Ln(); $fill=!$fill; } $this->Cell(array_sum($w),0,'','T'); } $prueba1=4; $idCliente=1; $idEstReg="P"; $id=11; $login="admin"; $cliente="AVON S.A"; $nombre="Frank Heiler Corrales Salazar"; $fechaInicia = "2008-09-01"; $fechaFinaliza = "2008-09-30"; $pdf=new PDF(); $pdf->SetFont('Arial','',11); $pdf->AddPage(); //Linea de Información de Cliente $pdf->Cell(0,8,'Cliente: '.$cliente,0,0,'L'); //Salto de linea para el undeline $pdf->Ln(1); //Movimiento a la derecha $pdf->Cell(55); //Undeline $pdf->Cell(100,5,' ','B',0,'L'); //Salto de linea para la siguiente información $pdf->Ln(3); $pdf->Cell(0,16,'Nombre: '.$nombre,0,0,'L'); $pdf->Ln(1); //Movimiento a la derecha $pdf->Cell(55); //Undeline $pdf->Cell(100,9,' ','B',0,'L'); //Salto de linea para la siguiente información $pdf->Ln(3); $pdf->Cell(0,24,'Fecha inicial de reporte: '.$fechaInicia,0,0,'L'); $pdf->Ln(1); //Movimiento a la derecha $pdf->Cell(55); //Undeline $pdf->Cell(100,13,' ','B',0,'L'); //Salto de linea para la siguiente información $pdf->Ln(3); $pdf->Cell(0,32,'Fecha final de reporte: '.$fechaFinaliza,0,0,'L'); $pdf->Ln(1); //Movimiento a la derecha $pdf->Cell(55); //Undeline $pdf->Cell(100,17,' ','B',0,'L'); //Salto de linea final $pdf->Ln(30); //Tabla //Colores, ancho de línea y fuente en negrita //$pdf->SetFillColor(255,0,0); //$pdf->SetTextColor(255); //$pdf->SetDrawColor(128,0,0); $pdf->SetLineWidth(0.4); $pdf->SetFont('','B'); //Cabecera //Valores de ancho de tabla $w=array(40,35,115); //Array de Cabecera $header=array('Fecha','Horas','Descripción de las actividades'); for($i=0;$i<count($header);$i++) $pdf->Cell($w[$i],7,$header[$i],1,0,'C'); $pdf->Ln(); //Información del reporte $sqlReg = "select * from webcal_regns where cal_id = $id and cal_login = $login and cal_idEstReg = $idEstReg" ; $resReg =@mysql_query($sqlReg); while($filaReg=@mysql_fetch_array($resReg)) { $fechaReg=date("Y-m-d",$filaReg[cal_date]); if($fechaReg >= $fechaInicia && $fechaReg <= $fechaFinaliza) { $detail=array($fechaReg,$filaReg["cal_time"],$filaReg["cal_description"]); $pdf->Cell($w[0],7,$fechaReg,1,0,'C'); $pdf->Cell($w[1],7,$fila["cal_time"],1,0,'C'); $pdf->Cell($w[2],7,$pdf->WriteHTML($fila["cal_description"]),1,0,'C'); } } $pdf->Output(); ?>
De antemano muchas gracias por su ayuda!
![sonriente](http://static.forosdelweb.com/fdwtheme/images/smilies/smile.png)