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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
<?php
//define('FPDF_FONTPATH','/home/www/font/');
require('../fpdf/fpdf.php');
include("fonction/fonction.bdd.php");
connexion_mysql();
$id_audit= $_POST["id_audit"];
//echo $id_audit;
$sql="SELECT question_qt_audit, s_rps_audit, a_rps_audit, n_rps_audit, commentaire_rps_audit
FROM rps_audit
INNER JOIN qt_audit ON qt_audit.id_qt_audit=rps_audit.id_qt_audit
INNER JOIN information_audit ON information_audit.id_audit=qt_audit.id_audit
WHERE information_audit.id_audit='$id_audit';";
$query= mysql_query($sql) or die("2/Mysql error:".mysql_error());
//Connexion à la base
$pdf=new FPDF('L','mm','A4');
$pdf->SetFont('Arial','B',16);
$pdf->Open();
$pdf->AddPage();
$res = mysql_num_rows($query);
//echo $res;
if($res==0)
{
$pdf->Cell(50,10,'test' ,1);
}
else
{
$pdf->SetFillColor(232,232,232);
//Bold Font for Field Name
$pdf->SetFont('Arial','B',12);
$pdf->SetY(10);
$pdf->SetX(10);
$pdf->Cell(30,6,'Question',1,0,'C',1);
$pdf->SetX(40);
$pdf->Cell(30,6,'Sastifaisant',1,0,'C',1);
$pdf->SetX(70);
$pdf->Cell(30,6,'A Ameliorer',1,0,'C',1);
$pdf->SetX(100);
$pdf->Cell(30,6,'Nul',1,0,'C',1);
$pdf->SetX(130);
$pdf->Cell(30,6,'Commentaire',1,0,'C',1);
$pdf->Ln();
$position_y=16;
while ( $ligne = mysql_fetch_array( $query ))
{
$pdf->SetFont('Arial','',12);
$pdf->SetY($position_y);
$pdf->SetX(10);
$pdf->MultiCell(30,6,$ligne["question_qt_audit"],1);
//$pdf->SetY(156);
if(isset($ligne["s_rps_audit"]) && $ligne["s_rps_audit"]!= 0)
{
$pdf->SetX(40);
$pdf->MultiCell(30,6,'X',1);
}
else
{
$pdf->SetX(40);
$pdf->MultiCell(30,6,' ',1);
}
//$pdf->SetY(156);
$pdf->SetX(70);
if(isset($ligne["a_rps_audit"]) && $ligne["a_rps_audit"] !=0)
{
$pdf->MultiCell(30,6,'X',1,'R');
$pdf->SetX(100);
}
else
{
$pdf->MultiCell(30,6,' ',1,'R');
$pdf->SetX(100);
}
if(isset($ligne["n_rps_audit"]) && $ligne["n_rps_audit"] !=0)
{
$pdf->MultiCell(30,6,'X',1,'R');
$pdf->SetX(130);
}
else
{
$pdf->MultiCell(30,6,' ',1,'R');
$pdf->SetX(130);
}
$pdf->MultiCell(30,6,$ligne["commentaire_rps_audit"],1,'R');
$pdf->SetX(160);
//$position_y=$position_y+16;
}
}
$pdf->Output();
?> |
Partager