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
|
<?php define('FPDF_FONTPATH','font/'); include("fond.php");
require("connect_atelier.php"); require('fpdf.php');
$req=$_POST['passage_req']; $pdf=new FPDF('P','cm','A4');
//Titres des colonnes
$header=array('Nb','Winpark','Matériel','Modèle','Numéro','Unité','Utilisation','Nom CSAV'); $pdf->SetFont('Arial','B',14); $pdf->AddPage();
$pdf->SetFillColor(96,96,96);
$pdf->SetTextColor(255,255,255);
$resultat=mysql_query(stripslashes($req),$connect)or die ('<br><br><br><center>La reponse ne contient aucun enregistrement <br><br> ou <br><br> une erreur est survenue qui est : '.mysql_error().'</center>' );
$pdf->SetXY(3,3);
for($i=0;$i<sizeof($header);$i++)
$pdf->cell(5,1,$header[$i],1,0,'C',1)
; $pdf->SetFillColor(0xdd,0xdd,0xdd);
$pdf->SetTextColor(0,0,0); $pdf->SetFont('Arial','',10);
$pdf->SetXY(8,$pdf->GetY()+1);
$fond=0;
$j=1;
while($row=mysql_fetch_array($resultat)) { $pdf->cell(5,0.7,$j,1,0,'C',$fond); $j=$j+1;
$pdf->cell(5,0.7,$row['winpark'],1,0,'C',$fond);
$pdf->cell(5,0.7,$row['materiel'],1,0,'C',$fond);
$pdf->cell(5,0.7,$row['modele'],1,0,'C',$fond);
$pdf->cell(5,0.7,$row['numero'],1,0,'C',$fond);
$pdf->cell(5,0.7,$row['unite'],1,0,'C',$fond);
$pdf->cell(5,0.7,$row['utilisation'],1,0,'C',$fond);
$pdf->cell(5,0.7,$row['nom_csav'],1,0,'C',$fond);
$pdf->SetXY(3,$pdf->GetY()+0.7);
$fond=!$fond;
}
$pdf->output(); ?> |
Partager