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
| $orderBy = "";
if (isset($_GET["tri"]))
{
switch ($_GET["tri"])
{
case "code" :
$orderBy = " k.id asc";
break;
case "libelle" :
$orderBy = " LTRIM(k.libelle) asc";
break;
case "marque" :
$orderBy = " marque asc";
break;
case "four" :
$orderBy = " four asc";
break;
case "paTTC" :
$orderBy = " paTTC asc";
break;
case "pvTTC" :
$orderBy = " pvTTC asc";
break;
case "fdp" :
$orderBy = " k.fdp asc";
break;
case "marge" :
$orderBy = " k.marge asc";
break;
case "ppi" :
$orderBy = " k.ppi asc";
break;
}
}
else
$orderBy = " LTRIM(k.libelle) asc";
$sql1 =$ewp->sqlQuery ("SELECT k.id, k.libelle, k.pa, k.tva, k.marge, k.ecotaxe, k.taxedd, k.fdp, k.ppi, f.raison_sociale as four, c.code, c.kdo, mq.libelle as marque,
(k.pa + (1 + (k.tva / 100)) + k.ecotaxe + k.taxedd) as paTTC,
((((k.pa + (1 + (k.tva / 100))) + k.ecotaxe + k.taxedd) * (1 + (k.marge / 100))) * (1 + (".$o->marge." / 100))) as pvTTC
FROM ".KDO." k
LEFT JOIN ".MARQUE." mq ON k.marque=mq.id
LEFT JOIN ".FOUR." f ON f.id=k.fournisseur
LEFT JOIN ".CAT." c ON c.kdo=k.id
WHERE c.challenge=(SELECT id FROM ".CHALL." WHERE dossier='".$_GET["id"]."')
ORDER BY ".$orderBy, __LINE__, 1);
$choix = "dossiers_fiche&id=".$_GET["id"];
$ewp->newTab ("list",1,2);
$ewp->cellCfg (1,null,null,'td');
$ewp->cellCfg ("titre",null,null,"th");
$ewp->mkCols ();
$ewp->mkCell ('Miniature','titre','width:80px');
$ewp->mkCell ('Code art.','titre','width:35px', null, null, $choix, 'code');
$ewp->mkCell ('Désignation','titre','width:225px', null, null, $choix, 'libelle');
$ewp->mkCell ('Marque','titre','width:120px', null, null, $choix, 'marque');
$ewp->mkCell ('Fournisseur','titre','width:110px', null, null, $choix, 'four');
$ewp->mkCell ('Prix achat TTC','titre','width:75px', null, null, $choix, 'paTTC');
$ewp->mkCell ('Marge produit','titre','width:55px', null, null, $choix, 'marge');
$ewp->mkCell ('Marge service','titre','width:55px', null, null, $choix, 'marge');
$ewp->mkCell ('Frais de port HT','titre','width:70px', null, null, $choix, 'fdp');
$ewp->mkCell ('Prix vente TTC','titre','width:75px', null, null, $choix, 'pvTTC');
$ewp->mkCell ('Prix public indicatif','titre','width:75px', null, null, $choix, 'ppi');
$destination = "dossiers";
$i1=0;
if ($ewp->sqlCount($sql1) > 0)
{
$ewp->mkCell('','titre','width:30px');
$ewp->mkCell('','titre','width:30px');
$ewp->closeCols();
while($o1=$ewp->sqlGetObj($sql1))
{
$i1++;
$ewp->mkCols (($i1%2==0)?"alt":"",null,$o1->id);
$ewp->mkCell ("<img src=\"http://www.xxx.com/xxx/".$o1->id.".jpg\" alt=\"-\" />\n",1,'text-align:center;');
$ewp->mkCell ($o1->id,1,'text-align:center;', null, null, $destination, null, $o1->id);
$ewp->mkCell ($o1->libelle,1,'text-align:left;', null, null, $destination, null, $o1->id);
$ewp->mkCell ($o1->marque,1,'text-align:center;', null, null, $destination, null, $o1->id);
$ewp->mkCell ($o1->four,1,'text-align:center;', null, null, $destination, null, $o1->id);
$ewp->mkCell (number_format($o1->paTTC, 2, ",", " ") . " ", 1, 'text-align:right;', null, null, $destination, null, $o1->id);
$ewp->mkCell (number_format($o1->marge, 2, ",", " ")." %", 1, 'text-align:right;', null, null, $destination, null, $o1->id);
$ewp->mkCell (number_format($o->marge, 2, ",", " ")." %", 1, 'text-align:right;', null, null, $destination, null, $o1->id);
$ewp->mkCell (number_format($o1->fdp, 2, ",", " ") . " ", 1, 'text-align:right;', null, null, $destination, null, $o1->id);
$ewp->mkCell ("<b>".number_format($o1->pvTTC, 2, ",", " ")." </b>", 1, 'text-align:right;background-color:#DCABCC', null, null, $destination, null, $o1->id);
$ewp->mkCell (number_format($o1->ppi, 2, ",", " ")." ", 1, 'text-align:right;', null, null, $destination, null, $o1->id);
$ewp->mkCellSites("<a href=\"#\" title=\"Supprimer cet article\"
onclick=\"if (confirm('Etes-vous sur de vouloir effacer cet article ?')) window.location='index.php?choix=dossiers_delete_article&id=".$_GET["id"]."&article=".$o1->id."';
\"><img src=\"img/suppression.png\" border=\"0\" alt=\"Suppression\" /></a>", 1, 'color:black;', null, null, 0);
$ewp->mkCellSites("<a href=\"index.php?choix=dossiers_commande_article&dossier=".$_GET["id"]."&article=".$o1->id."\" title=\"Ajouter en commande\">
<img src=\"img/add.png\" border=\"0\" alt=\"Ajouter en commande\" /></a>", 1, 'color:black;', null, null, 0);
$ewp->closeCols();
}
}
else
{
$ewp->closeCols();
$ewp->mkCols();
$ewp->mkCell("Aucun article n'a été sélectionné pour ce dossier", 1, 'width:100%;',11);
$ewp->closeCols();
}
$ewp->closeTab();
$ewp->br(2); |
Partager