Tema: fpdf
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/08/2007, 03:33
Avatar de SILVI85
SILVI85
 
Fecha de Ingreso: julio-2007
Mensajes: 109
Antigüedad: 16 años, 9 meses
Puntos: 1
Pregunta fpdf

alguien que me pueda ayudar con este codigo,no me funciona con I.E:

Código PHP:
<?php
require('fpdf.php');

include(
"conexion.php");


$cadena="SELECT e.nref,a.nombre,e.fecha_alta,e.fecha_baja,p.tipo,u.nombre,ub.nombre,e.observaciones,e.estado FROM elementos e,articulos a,procedencias p,unidades_organizativas u ,ubicaciones ub WHERE e.id_articulo=a.id AND e.id_procedencia=p.id AND e.id_pertenencia=u.id AND e.id_ubicacion=ub.id ORDER BY E.NREF INTO OUTFILE \"a.txt\" FIELDS TERMINATED BY ';' ";
$consulta=mysql_query($cadena,$conexion) or die ("Error al consultar familias a null");



//copia
$file 'C:\Archivos de programa\EasyPHP1-8\mysql\data\inventario\a.txt';
$newfile 'a.txt';
if (!
copy($file$newfile))
echo 
"fallo para copiar $file...\n";

//borra
$dir='C:\Archivos de programa\EasyPHP1-8\mysql\data\inventario\a.txt'
if(
file_exists($dir)) 

if(!
unlink($dir)) 
print 
"El archivo no fue borrado"




class 
PDF extends FPDF
{
//Cargar los datos


function LoadData($file)
{
    
//Leer las líneas del fichero
    
$lines=file($file);
    
$data=array();
    foreach(
$lines as $line)
        
$data[]=explode(';',chop($line));
    return 
$data;
}

//Tabla simple
function BasicTable($header,$data)
{

$this->SetFont('Arial','',14);
    
//Cabecera
      
  
    
foreach($header as $col)
       
$this->Cell(30,15,$col,1,0,'C');

    
$this->Ln();
    
//Datos
    
foreach($data as $row)
    {   
        foreach(
$row as $col)
        {
                
$this->Cell(30,6,$col,1,0,'C');
                     
                     
                      
                     
                    }
        
$this->Ln();
    }
}


function 
Header()
{
        
$this->Image('logo.png',10,8,50,10);
    
//Movernos a la derecha
    
$this->setXY(20,14); 
    
//Título
    
$this->SetTextColor(0,100,20);
    
$this->SetFont('Arial','B',16);
    
$this->Cell(30,10,'CONSEJERÍA DE EDUCACIÓN',0,0,'C');

    
//Salto de línea
    
$this->Ln(10);
    
$this->Cell(120);
    
$this->SetTextColor(0,0,0);
    
$this->SetFont('Times','B',14);
    
$this->Cell(30,10,'ANEXO',0,0,'C');
    
    
    
$this->Ln(10);
    
$this->Cell(85);
    
$this->Cell(100,8,'REGISTRO DE INVENTARIO',1,0,'C');

    
$this->Ln(10);
    
$this->Cell(5);
    
$this->SetFont('Arial','',14);
    
$this->Cell(15,10,'Centro:  ',0,0,'C');
    
//$this->Cell(15,10);
  
    
$this->Cell(130,10,'_____________________________________________',0,0,'C');
        
$this->Cell(3);
    
    
$this->Cell(30,10,'Curso Escolar:  ',0,0,'C');
        
$this->Cell(1);
    
$this->Cell(38,10,'______ /______',0,0,'C');        
        
$this->Ln(10);

        
$this->Cell(5);
    
$this->Cell(15,10,'Código:  ',0,0,'C');
    
//$this->Cell(15,10);
    
$this->Cell(1);
    
$this->Cell(30,10,'__________',0,0,'C');
        
$this->Cell(1);
    
    
$this->Cell(30,10,'Provincia:  ',0,0,'C');
        
$this->Cell(1);
    
$this->Cell(30,10,'_____________',0,0,'C');        
        
$this->Cell(5);
        
$this->Cell(30,10,'Localidad:  ',0,0,'C');
        
$this->Cell(1);
    
$this->Cell(70,10,'___________________________',0,0,'C');        
        
$this->Ln(10);
$this->Cell(80);

        
$this->Cell(100,10,'LIBRO DE ENTRADAS EN EL CURSO ESCOLAR ',0,0,'C');
$this->Cell(10);
$f2="FECHA: ";
$f=date("d/m/Y");
    
$this->Cell(50,10,$f2.$f,0,0,'C');
  


         
$this->Ln(15);
 
}


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,'Página: '.$this->PageNo().'/{nb}',0,0,'C');
}

}


//$pdf=new PDF();
$pdf=new PDF('L','mm','A4');
//Títulos de las columnas
$pdf->Header();

$header=array('Nº Registro','Artículo','F.Alta','F.Baja','Procedencia','Pertenencia','Ubicacion','Observ.','Estado');


// echo date ( "d/m/Y" );

//Carga de datos

$data=$pdf->LoadData('a.txt');

$pdf->SetFont('Arial','',14);
$pdf->AliasNbPages();

$pdf->AddPage();
$pdf->BasicTable($header,$data);

//$pdf->AddPage();
//$pdf->ImprovedTable($header,$data);
//$pdf->AddPage();
//$pdf->FancyTable($header,$data);

$pdf->Output();

$dir='a.txt'
if(
file_exists($dir)) 

if(!
unlink($dir)) 
print 
"El archivo no fue borrado"

?>