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
| // Affiche les commandes sous forme de tableaux
?>
<?php
function show($all,$sort)
{
$db=&$GLOBALS["db"];
$etat=&$GLOBALS["etat"];
$query="SELECT k_commande,dt,k_typ_clt,genre,nom,prenom,poids,ss_total,prix_trans,t_commandes.tva,status,etat,t_clt.k_clt,paie_des_c_fr,trans_des_c_fr FROM t_commandes,t_clt WHERE t_commandes.k_clt=t_clt.k_clt";
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// k_commande datetime k_typ_clt genre nom prenom poids ss_total prix_trans tva status etat k_clt paie_des_c_fr trans_des_c_fr
if(!$all) $query.=" AND etat!='Traitée' AND etat!='Annulée'";
?>
<form method="post" action="http://localhost/htdocs/admin/com.php?todo=show">
<label for="nombres">Combien de commandes voulez-vous voir ?</label>
<select name="nombres">
<option value=<?php $query.=" ORDER BY dt LIMIT 0,30";?>>0-30</option>
<option value=<?php $query.=" ORDER BY dt LIMIT 0,60";?>>0-60</option>
<input type="submit" value="OK" />
</form>
<?php
//$query.=" ORDER BY dt LIMIT 0,30";
fill_array(&$query,$coms);
print_return_ex();
// Calcul les totaux
for($i=0;$i<count($coms);++$i)
{
$com=&$coms[$i];
$com[3]=sprintf("%s %s %s",$com[3],$com[4],$com[5]);
$com[4]=$com[7]+$com[8]; // total_ht
$com[5]=$com[4]*$com[9]; // total_ttc
}
unset($com);
_sort($coms,$sort,($sort==0 || $sort==1 || $sort==4 || $sort==10)?"DESC":"ASC");
if(_in_array($etat[0],$coms,11)!==false) { print_com_table($all,$sort,$coms,true); echo "<BR>"; }
print_com_table($all,$sort,$coms,false);
}
?> |
Partager