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
|
require('fpdf/fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B', 11);
//A gauche
$pdf->SetXY(10, 10);
$txt = "Societe
SIRET
13 rue des Adresses
13015 MARSEILLE";
$pdf->SetFillColor(153, 195, 195);
$pdf->MultiCell(80, 5, $txt, 1, 'L', true);
$pdf->SetXY(10, 30);
$txt = "Téléphone: 00 11 22 33 44 55
E-Mail: exampl@mail.org";
$pdf->SetFillColor(153, 215, 215);
$pdf->MultiCell(80, 5, $txt, 1, 'L', true);
//A droite
$pdf->SetXY(-80, 10);
$txt = $_POST['nom']."
".$_POST['adresse']."
".$_POST['codep']."
".$_POST['contact'];
$pdf->SetFillColor(153, 195, 195);
$pdf->MultiCell(70, 5, $txt, 1, 'L', true);
//Date
$pdf->SetXY(25, 60);
$pdf->Cell(10, 5, "Date:");
$pdf->SetFont('Arial','',11);
$pdf->Cell(10, 5, $_POST['date']);
//Tableau
$pdf->SetXY(10, 75);
$pdf->SetFont('Arial','B',11);
$pdf->SetFillColor(153, 205, 205);
$pdf->Cell(100, 5, "Désignation", 1, 0, 'C', true);
$pdf->Cell(30, 5, "Qte", true, 0, 'C', true);
$pdf->Cell(30, 5, "Prix Uni", true, 0, 'C', true);
$pdf->Cell(30, 5, "Total", true, 1, 'C', true);
$pdf->SetFillColor(255, 255, 255);
$totaux = 0;
$bg = false;
for($i=0; $i!=($_POST['nb']+1); $i++) {
if($bg) {
$pdf->SetFillColor(225, 245, 255);
$bg=false;
}else {
$pdf->SetFillColor(255, 255, 255);
$bg=true;
}
$pdf->Cell(100, 5, $_POST['nom'.$i], true, 0, 'L', true);
$pdf->Cell(30, 5, $_POST['qte'.$i], true, 0, 'C', true);
$pdf->Cell(30, 5, $_POST['pri'.$i]." E", true, 0, 'C', true);
$total = $_POST['pri'.$i] * $_POST['qte'.$i];
$totaux = $totaux + $total;
$pdf->Cell(30, 5, $total." E", true, 1, 'C', true);
}
$pdf->SetX(-55);
$pdf->SetFont('Arial','B',11);
$pdf->Cell(15, 5, "TOTAL:", false, 0, 'C', true);
$pdf->Cell(30, 5, $totaux." E", true, 1, 'C', true);
$pdf->SetFillColor(255, 255, 255);
$pdf->SetX(-70);
$pdf->SetFont('Arial','',10);
$pdf->Cell(60, 5, "TVA non applicable, art. 293 B du CGI", false, 0, 'C', true);
$pdf->ln(15);
$pdf->SetX(10, $pdf->getY());
$pdf->Cell(55, 60, '', false, 0, 'L', $pdf->Image('http://127.0.0.1/ton/image.jpg', 10, $pdf->getY(), 55, 60));
$pdf->Output(); |
Partager