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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
| <?php
define('FPDF_FONTPATH','font/');
require('../pdf/fpdf.php');
require('../fonction.php');
require("../connect.php");
$id_facture = $_GET['id'];
$sql = "SELECT facture.id_facture, client.civilite, client.nom, client.prenom, facture.type_choix, facture.date_saisie1, facture.date_saisie2, facture.compteur1, facture.compteur2, client.adresse1, client.code_postal1, client.ville1, client.adresse2, client.code_postal2, client.ville2, facture.designation FROM facture INNER JOIN client ON facture.id_client = client.id_client WHERE (((facture.id_facture)=$id_facture))";
$result = mysql_query($sql);
$row=mysql_fetch_array($result);
class PDF extends FPDF
{
//En-tête
function Header()
{
//Logo
$this->Image('../images/logo1.jpg',12,17,33);
//Police Arial gras 15
$this->SetFont('Arial','B',14);
//Décalage à droite
$this->SetXY(12,40);
$this->Cell(50,8,'NOM',0,0,'L');
$this->SetFont('Arial','',9);
$this->SetXY(12,48);
$this->Cell(50,5,'Adresse',0,0,'L');
$this->SetXY(12,53);
$this->Cell(50,5,'00000 VILLE',0,0,'L');
$this->SetXY(12,58);
$this->Cell(50,5,'00 00 00 00 00',0,0,'L');
$this->SetXY(118,17);
$nom_jour_fr = array("Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi");
$mois_fr = Array("", "janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août",
"septembre", "octobre", "novembre", "décembre");
list($nom_jour, $jour, $mois, $annee) = explode('/', date("w/d/n/Y"));
$this->Cell(80,5,$nom_jour_fr[$nom_jour].' '.$jour.' '.$mois_fr[$mois].' '.$annee,0,0,'R');
if ($row['type_choix'] == 'DEVIS')
{$compteur = $row['compteur1'];
list($annee, $mois, $jour) = explode('-', $row['date_saisie1']);
$a = 'DEV-';}
else
{$compteur = $row['compteur2'];
list($annee, $mois, $jour) = explode('-', $row['date_saisie2']);
$a = 'FACT-';
$a_d = 'DEV-';
$compteur_d = $row['compteur1'];
list($annee_d, $mois_d, $jour_d) = explode('-', $row['date_saisie1']);
$annee_d = substr("$annee_d", -2, 2);
switch ($compteur_d)
{case ($compteur_d < 10) :
$b_d = "00";
break;
case (($compteur_d >= 10) && ($compteur_d < 100)) :
$b_d = "0";
break;
case ($compteur_d >=100) :
$b_d = null;
break;}
}
$annee = substr("$annee", -2, 2);
switch ($compteur)
{case ($compteur < 10) :
$b = "00";
break;
case (($compteur >= 10) && ($compteur < 100)) :
$b = "0";
break;
case ($compteur >=100) :
$b = null;
break;}
$this->SetXY(60,25);
$this->SetTextColor(255,0,0);
$this->SetFont('Arial','B',14);
$this->Cell(140,8,$a.$annee.$mois.$b.$compteur,0,0,'C');
if (empty($compteur_d))
{}
else
{$this->SetXY(60,33);
$this->SetTextColor(0,0,255);
$this->SetFont('Arial','I',9);
$this->Cell(140,5,$a_d.$annee_d.$mois_d.$b_d.$compteur_d,0,0,'C');}
$this->SetTextColor(0,0,0);
$this->SetXY(75,42);
$this->SetFont('Arial','BU',9);
$this->Cell(125,5,'Destinataire :',0,0,'L');
$this->SetFont('Arial','B',9);
$this->SetXY(100,42);
$this->Cell(100,5,$row['civilite']." ".$row['prenom']." ".$row['nom'],0,0,'L');
$this->SetFont('Arial','',9);
$this->SetXY(100,47);
if (empty($row['adresse2']))
{$this->MultiCell(100,5,$row['adresse1'],0,'L');
$y = $this->GetY();
$this->SetXY(100,$y);
$this->Cell(100,5,$row['code_postal1']." ".$row['ville1'],0,0,'L');}
else
{$this->MultiCell(100,5,$row['adresse2'],0,'L');
$y = $this->GetY();
$this->SetXY(100,$y);
$this->Cell(100,5,$row['code_postal2']." ".$row['ville2'],0,0,'L');}
$y = $this->GetY();
$this->Line(10,15,200,15);
$this->Line(10,$y+7,200,$y+7);
$this->Line(10,15,10,$y+7);
$this->Line(200,15,200,$y+7);
$this->SetXY(10,$y+9);
$this->MultiCell(190,5,inmodif_lettre($row['designation']),1,'L');
$y = $this->GetY()+2;
$this->SetFont('Arial','B',9);
$this->SetXY(10,$y);
$this->Cell(90,5,"DESIGNATION",1,0,'C');
$this->SetXY(100,$y);
$this->Cell(10,5,"UNITE",1,0,'C');
$this->SetXY(110,$y);
$this->Cell(24,5,"PRIX",1,0,'C');
$this->SetXY(134,$y);
$this->Cell(10,5,"QTE",1,0,'C');
$this->SetXY(144,$y);
$this->Cell(28,5,"PRIX HT",1,0,'C');
$this->SetXY(172,$y);
$this->Cell(28,5,"PRIX TTC",1,0,'C');
//Saut de ligne
$this->Ln(20);
}
//Pied de page
function Footer()
{
//Positionnement à 1,5 cm du bas
$this->SetY(-15);
//Police Arial italique 8
$this->SetFont('Arial','I',8);
//Numéro de page
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'R');
}
}
//Instanciation de la classe dérivée
$pdf=new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetXY(10,60);
$pdf->Cell(28,5,"ESSAI",1,0,'C');
$pdf->Output();
?> |
Partager