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
| <?php
require('fpdf.php');
//on recup le num commande
if(!empty($_GET['numcommande']))
{
$numcommande=$_GET['numcommande'];
}
else
{
$numcommande=1;
}
class PDF extends FPDF
{
//En-tête
function Header()
{
//Logo
$this->Image('codebarrecommande.png',170,25,33);
//Police Arial gras 15
$this->SetFont('Arial','B',15);
//Décalage à droite
$this->Cell(60);
//Titre
$this->Cell(70,10,'Bon de préparation',1,0,'C');
//Saut de ligne
$this->Ln(10);
}
//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,'C');
}
//Tableau simple
function BasicTable($header)
{
//En-tête
foreach($header as $col)
$this->Cell(40,7,$col,1);
$this->Ln();
//Données
connect();
$req="select `article-commande`.`id-article`,`nom-art`,`nom-taille`,`qte-cde` from `article-commande`,`article`,taille where `id-cde`=$numcommande
and `article-commande`.`id-article`=`article`.`id-art`
and `article-commande`.`id-taille`=`taille`.`id-taille`";
$res1=mysql_query($req);
$i=0;
while($line=mysql_fetch_array($res1))
{
//req qui recherche les emplacements
$req2="select `desc-empl` from emplacement,`emplacement-article` where `id-art`=$line[0]
and `emplacement-article`.`id-empl`=`emplacement`.`id-empl`
";
$res2=mysql_query($req2);
$empl="";
while($line2=mysql_fetch_array($res2))
{
if($empl!="")
{
$empl=$empl."\n";
}
$empl=$empl.$line2[0];
}
//ici j'écris dans les cellules
$this->Cell(40,6,$line[1],1);
$this->Cell(40,6,$line[2],1);
$this->Cell(40,6,$line[3],1);
$this->Cell(40,6,$empl,1);
$this->Ln();
}
close();
}
}
//Instanciation de la classe dérivée
$pdf=new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',12);
$num=GetNumIntern($numcommande);
$pdf->Cell(0,10,'Site: '.GetSite($numcommande),0,1);
$pdf->Cell(0,10,'Commande n° '.$num,0,1);
$pdf->Cell(0,10,'Destinataire: '.GetInfoClient($numcommande),0,1);
//creation du contenu de la commande
$header=array('Désignation','Taille','Quantité','Emplacement');
$pdf->BasicTable($header);
/*
for($i=1;$i<=40;$i++)
$pdf->Cell(0,10,'Impression de la ligne numéro '.$i,0,1);*/
$pdf->Output();
?> |
Partager