Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/04/2012, 00:55
luisinho69
 
Fecha de Ingreso: febrero-2010
Mensajes: 16
Antigüedad: 14 años, 3 meses
Puntos: 0
Crear varios archivos PDF con FPDF en PHP

Estimados,

Tengo el siguiente problema:

Necesito crear tantos archivos (documentos) pdf como numeros telefonicos tenga, es decir para cada numero telefonico debe crearse un PDF, he intentado pero solo consigo crear una pagina por numero telefonico.

Aqui les dejo el codigo:
Código PHP:
class PDF extends FPDF
{
//Cargar los datos



//Una tabla más completa
function ImprovedTable($header)
{

                        
    
//Anchuras de las columnas
    
$w=array(12,25,20,25,35,20,10,20);
    
    
    
//Cabeceras
    
for($i=0;$i<count($header);$i++)
        
$this->Cell($w[$i],7,$header[$i],1,0,'C');
    
$this->Ln();
    
//Datos
    
                        
    
$consultadel2"SELECT * FROM organizar_datos GROUP BY `strSubCta`";
                        
$resultadodel2mysql_query($consultadel2);
                        while (
$filadel2mysql_fetch_array($resultadodel2))
                        {
                        
                        
$consultadel"SELECT * FROM organizar_datos where strSubCta=$filadel2[2] and strCallType='R' order by strSubCta";
                        
$resultadodelmysql_query($consultadel);
                        while (
$filadelmysql_fetch_array($resultadodel))
                        {
                        
$this->Cell($w[0],6,$filadel[0],'LR');
                        
$this->Cell($w[1],6,$filadel[6],'LR');
                        
$this->Cell($w[2],6,$filadel[7],'LR');
                        
$this->Cell($w[3],6,$filadel[8],'LR');
                        
$this->Cell($w[4],6,$filadel[9],'LR');
                        
$this->Cell($w[5],6,$filadel[10],'LR');
                        
$this->Cell($w[6],6,$filadel[11],'LR');
                        
$this->Cell($w[7],6,$filadel[12],'LR');
                        
$this->Ln();
                        
                        }
                    
                    }
    
        
//Línea de cierre
    
$this->Cell(array_sum($w),0,'','T');
}


}



$pdf=new PDF();
//Títulos de las columnas
$header=array('Nº','Fecha','Hora','Numero','Destino','Duracion','Tarifa','Monto Bs.');
//Carga de datos

$pdf->SetFont('Arial','',12);


$pdf->AddPage();
$pdf->ImprovedTable($header);
$pdf->Output("PDF/hola.pdf"); 
Este codigo me genera un unico archivo pdf, la idea es que para cada telefono que me traiga de esta consulta

Código PHP:
$consultadel2"SELECT * FROM organizar_datos GROUP BY `strSubCta`";
                        
$resultadodel2mysql_query($consultadel2);
                        while (
$filadel2mysql_fetch_array($resultadodel2))
                        {

se me genere un documento pdf con la informacion que se filtra en el siguiente ciclo

Código PHP:
$consultadel"SELECT * FROM organizar_datos where strSubCta=$filadel2[2] and strCallType='R' order by strSubCta";
                        
$resultadodelmysql_query($consultadel);
                        while (
$filadelmysql_fetch_array($resultadodel))
                        {
                        
$this->Cell($w[0],6,$filadel[0],'LR');
                        
$this->Cell($w[1],6,$filadel[6],'LR');
                        
$this->Cell($w[2],6,$filadel[7],'LR');
                        
$this->Cell($w[3],6,$filadel[8],'LR');
                        
$this->Cell($w[4],6,$filadel[9],'LR');
                        
$this->Cell($w[5],6,$filadel[10],'LR');
                        
$this->Cell($w[6],6,$filadel[11],'LR');
                        
$this->Cell($w[7],6,$filadel[12],'LR');
                        
$this->Ln();
                        
                        } 
La idea principal es si me pudieran encaminar a generar estos multiples archivos que se van a ir almacenando en disco en una ruta determinada, por ahora solo se me genera uno, y la verdad no consigo como hacerlo un poco de ayuda seguro me refrescara las ideas.

Saludos cordiales gracias de antemano.