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
|
<?php
require('php/fpdf/fpdf.php');
include("php/mysql_table.php");
include("php/fonction.bdd.php");
if(isset($_GET["id_bc"]))
{
$id_bc=$_GET["id_bc"];
//
}
{
}
connexion_mysql();
class PDF extends PDF_MySQL_Table
{
function Header()
{
//Titre
$id_bc=$_GET["id_bc"];
$this->SetFont('Arial','',11);
$this->Image('img/marque.png',10,6,170,14);
$this->Ln(10);
$sql= "
SELECT bc.id_bc, u.nom AS nom, u.prenom AS prenom, date_format( bc.date, '%d/%m/%Y' ) AS date, s.nom AS societe, s.adresse AS asociete, s.ville AS sville, s.cp AS scp, s.siret AS siret, c.nom AS cnom, c.adresse AS cadresse, c.ville AS cville, c.cp AS ccp, c.tel AS ctel, c.fax AS cfax, uv.nom AS uvnom, uv.prenom AS uvprenom, date_format(bc.date_users_valid, '%d/%m/%Y') as datevalider, bc.remarque,FORMAT(SUM(bca.qte),2) as qte_total, FORMAT(SUM(bca.prix_unitaire),2) as prix_total
FROM boncommande bc
INNER JOIN boncommande_article bca ON bca.id_bc=bc.id_bc
INNER JOIN users u ON bc.id_users = u.id_users
INNER JOIN societe s ON bc.id_societe = s.id_societe
INNER JOIN concessions c ON bc.id_concessions = c.id_concessions
INNER JOIN users uv ON bc.id_users_valid = uv.id_users
WHERE bc.id_bc = '".$id_bc."'";
//echo $sql;
$query= mysql_query($sql) or die('erreur');
$list2 = mysql_fetch_array( $query );
// echo '
// <tr><td>N°Bon Commande</td><td><input type="text" name="id_bc" value="'.$list2["id_bc"].'" readonly="readonly""/></td></tr>
// <tr><td>Utilisateur</td><td>'.$list2["nom"].''.$list2["prenom"].'</td></tr>
// <tr><td>date</td><td>'.$list2["date"].'</td></tr>
// <tr><td>Société</td><td>'.$list2["societe"].'</td></tr>
// <tr><td>Concession</td><td>'.$list2["concession"].'</td></tr>
// ';
$this->SetFillColor(150);
$this->SetFont('');
$this->RoundedRect(10, 25, 70, 20, 3.5, 'FD');
$this->SetXY( 10, 25);
$this->MultiCell(70,5,$list2["societe"]."\n".$list2["cnom"]. "\n".$list2["cadresse"]."\n".$list2["ccp"]." ". $list2["cville"] ." ",0);
$this->SetFillColor(127);
$this->RoundedRect(125, 25, 70, 10, 3.5, 'FD');
$this->SetXY( 125, 27);
$this->MultiCell(70,5," BON DE COMMANDE N°#",0);
$this->Ln();
$this->SetFillColor(225);
$this->RoundedRect(125, 50, 70, 20, 3.5, 'FD');
$this->SetXY( 125, 50);
$this->MultiCell(70,5,"aaaaaaaaaaaaaaaaaaaaaaaaaa\n aaaaaaaaaaaaaaaaaaaaa\n aaaaaa\n eeeeeeeeeeeeeeeeeeeeeeeee \n",0);
$this->Ln();
$this->SetFillColor(225);
$this->RoundedRect(10, 75, 180, 10, 3.5, 'FD');
$this->MultiCell(180,10,"Remarque:".$list2["remarque"],0);
$this->Ln();
$this->SetFillColor(204,0,0);
$this->SetFont('Arial','B',11);
$this->RoundedRect(10, 95, 180, 10, 3.5, 'FD');
$this->MultiCell(180,10,"Joindre ce document à la facture ou bien faire apparaitre le numéro BC #".$list2["id_bc"],0, "C");
$this->SetFillColor(192);
$this->RoundedRect(10, 255, 70, 5, 3.5, 'FD');
$this->SetXY( 10, 255);
$this->MultiCell(120,5,"de:".$list2["nom"]. " ". $list2["prenom"]."(". $list2["date"].")",0);
$this->RoundedRect(10, 262, 95, 5, 3.5, 'FD');
$this->SetXY( 10, 262);
$this->MultiCell(120,5,"Validé par:".$list2["uvnom"]. "". $list2["uvprenom"] ."(le ". $list2["datevalider"].")",0);
$this->RoundedRect(140, 255, 30, 5, 3.5, 'FD');
$this->SetXY( 140, 255);
$this->MultiCell(80,5,"Qte :".$list2["qte_total"]. "",0);
$this->RoundedRect(170, 255, 30, 5, 3.5, 'FD');
$this->SetXY( 170, 255);
$this->MultiCell(80,5,"Prix :".$list2["prix_total"]. "",0);
//Imprime l'en-tête du tableau si nécessaire
parent::Header();
}
function Footer()
{
// Positionnement à 1,5 cm du bas
$this->SetY(-15);
// Police Arial italique 8
$this->SetFont('Arial','I',8);
// Numéro de page centré
$this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');
}
}
$pdf = new PDF();
$pdf->AddPage();
$pdf->SetFont('Arial','',11);
$pdf->SetAutoPageBreak(true,55);
$pdf->SetXY( 10, 110);
$pdf->Ln();
$pdf->Table('select s.nom as service, m.nom marque, ref_int, descriptif, FORMAT(qte,2) as Qte, FORMAT(prix_unitaire,2) as Prix
FROM boncommande_article bca
INNER JOIN services s ON s.id_services= bca.id_services
INNER JOIN marque m ON m.id_marque=bca.id_marque
WHERE bca.id_bc="'.$id_bc.'"');
$pdf->Output();
?> |
Partager