Ver Mensaje Individual
  #5 (permalink)  
Antiguo 24/01/2013, 07:25
daicrel
 
Fecha de Ingreso: enero-2013
Mensajes: 36
Antigüedad: 11 años, 3 meses
Puntos: 0
Respuesta: Como hacer un reporte fpdf

Cita:
Iniciado por RastaMart Ver Mensaje
Mira te paso el ejemplo que uso, igual te puede ayudar...

La vdd a mi me jala bien pero no se que tan bien este estructurado.


Código PHP:

<?php
session_start
();
require(
'fpdf.php');
include(
"../conexion.php"); 
    
class 
PDF extends FPDF
{
  
//Cabecera de página
    
function Header()
    {
       
       
$this->Rect(1,1,213,31);
       
$this->Rect(1,31,213,1,'DF');
        
//Logo
        
$this->Image('../images/Logo',13,2,25,27);
        
//Arial bold 15
        
$this->SetFont('Arial','B',14);
        
//Movernos a la derecha
        
$this->Cell(30);
        
//Título
        
$this->Cell(170,4,'TITULO',0,0,'C');
        
$this->Ln(9);
        
$this->SetFont('Arial','B',10);
        
$this->Cell(36);
        
$this->MultiCell(170,5,'Algun mensaje:');
        
//$this->SetFont('Arial','',6);
    
        
$this->SetFont('Arial','',8);
        
$this->Line(1,32,214,32);
        
        
$this->Text(15,36,'No.');
        
$this->Text(30,36,'Cliente');
        
$this->Text(55,36,'Nombre');
        
$this->Text(100,36,'Apellidos');
        
$this->Text(180,36,'Firma');
        
        
$this->Line(1,38,214,38);
        
$this->Line(1,39,214,39);
        
//Salto de línea
        
$this->Ln(10);
        
$this->SetY(45);
    }

    
//Pie de página
    
function Footer()
    {
      
      
//Posición: a 1,5 cm del final
        
$this->SetY(-15);
        
//Arial italic 8
        
$this->SetFont('Arial','I',8);
        
//Número de página
        
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
      
$fechadate("Y-m-d");
       
$hora=date("H:i:s");
      
$this->Line(1,266,214,266);
      
$this->Line(1,273,214,273);
      
$fechadate("Y-m-d");
       
$hora=date("H:i:s");
       
$this->Text(10,270.5,$fecha);
        
$this->Text(30,270.5,$hora);
        
$this->Text(148,270.5,$this->f_ini);
        
$this->Text(180,270.5,$this->f_fin);
    }

    function 
__construct()
    {       
        
//Llama al constructor de su clase Padre.
        //Modificar aka segun la forma del papel del reporte
        
parent::__construct('P','mm','Letter');
    }
}

    
//Creación del objeto de la clase heredada
    
$pdf=new PDF();
    
$pdf->SetTopMargin(5.4);
    
$pdf->SetLeftMargin(4.5);    
    
$pdf->AliasNbPages();
    
$pdf->SetFont('Times','',9);
    
$fecha_ini =$_POST['fecha_ini'] ." "$_POST['hora_ini'];
    
$pdf->f_ini$fecha_ini;
    
$fecha_fin =$_POST['fecha_fin'] ." "$_POST['hora_fin'];
    
$pdf->f_fin=$fecha_fin;

        
$queEmp "CONSULTA SQL";
        
$resEmp mysql_query($queEmp$conect);
        
$j=1;
    
$pdf->AddPage();    
        
        while(
$row mysql_fetch_array($resEmp))
        {
          
$code $row["num_cliente"];
          
$name $row["nombre"];
          
$apellidos $row["apellidos"];
          
$pdf->Text(15,$pdf->GetY(),($j));
          
$pdf->Text(30,$pdf->GetY(),$code);
          
$pdf->Text(55,$pdf->GetY(),$name);
          
$pdf->Text(100,$pdf->GetY(),$apellidos);
          
$pdf->Text(160,$pdf->GetY(),'____________________________');
          
$pdf->cell(0,6.5,'',0,1);
        
$j=$j+1;
        }
           
$pdf->cell(0,8,'',0,1);
                 
$pdf->Text(30,$pdf->GetY(),'Nombre');
           
$pdf->Text(115,$pdf->GetY(),'Fecha');
           
$pdf->Text(160,$pdf->GetY(),'Firma');
           
$pdf->cell(0,5,'',0,1);
           
$pdf->Text(15,$pdf->GetY(),'_________________________________________');
           
$pdf->Text(100,$pdf->GetY(),'________________________');
           
$pdf->Text(145,$pdf->GetY(),'________________________');
    
$pdf->Output();    
?>

Igual te puede servir, cualquier duda estamos a las ordenes.

lo Probe y nada, no me sale ahora nada lo tengo q guardar .php por q asi guarde el anterior y y me daba pero no me aparecen las columnas q yo quiero, o como quiero.