Files
2020-01-27 08:56:08 +01:00

84 lines
3.0 KiB
PHP

<?php
include_once(realpath(dirname(__FILE__)) . "/../../../../fonctions/authplugins.php");
autorisation("statsplus");
?>
<p align="right" class="geneva11Reg_3B4B5B"><a href="accueil.php" class="lien04">Accueil </a> <img src="gfx/suivant.gif" width="12" height="9" border="0" />
<select id="staturl">
<option value="#"></option>
<option value="module.php?nom=statsplus&graph=ouverture">Ventes par an</option>
<option value="module.php?nom=statsplus&graph=3mois">Ventes sur 12 mois</option>
<option value="module.php?nom=statsplus&graph=heures">Ventes par heure</option>
<option value="module.php?nom=statsplus&graph=jours">Ventes par jour</option>
<option value="module.php?nom=statsplus&graph=produits">Produits</option>
<option value="module.php?nom=statsplus&graph=commandes">Commandes</option>
<option value="module.php?nom=statsplus&graph=clients">Clients</option>
<option value="module.php?nom=statsplus&graph=paiement">Paiements</option>
</select>
<img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="#" class="lien04">Stats de ventes clients</a>
</p>
<!--
<img src="../client/plugins/statsplus/graphs/graph_produits.php" alt="-" />
-->
<?php
$client = new Client();
$refer = array();
$query_test = "select id,nom,prenom from $client->table";
$resul_test = mysql_query($query_test, $client->link);
while($row_test = mysql_fetch_array($resul_test)){
$commande = new Commande();
$query_testa = "select * from $commande->table WHERE client='".$row_test[0]."' AND (statut='2' OR statut='3' OR statut='4')";
$resul_testa = mysql_query($query_testa, $commande->link);
while($row_testa = mysql_fetch_array($resul_testa)){
$venteprod = new Venteprod();
$cpta += 1;
$query_testb = "select * from $venteprod->table where commande='".$row_testa[0]."'";
$resul_testb = mysql_query($query_testb, $venteprod->link);
while($row_testb = mysql_fetch_array($resul_testb)){
$cptb += $row_testb[6];
}
}
if($cpta >=1){
$refer[] = $row_test[1].",".$row_test[2].",".$cpta.",".$cptb;
}
$cpta='';
$cptb='';
}
$annee = substr($row_test->date, 0, 4);
/*
$query_test = "select * from $commande->table where statut>=2 order by date desc limit 0,1";
$resul_test = mysql_query($query_test, $commande->link);
$row_test = mysql_fetch_object($resul_test);
$anneefin = substr($row_test->date, 0, 4);
*/
?>
<table cellpadding="0" cellspacing="0" border="0" width="100%" id="stats" class="display">
<thead>
<tr class="cellule_sombre">
<th height="30">Nom</th>
<th height="30">Pr&eacute;nom</th>
<th height="30">Nb</th>
<th height="30">C.A &euro;</th>
</tr>
</thead>
<tbody>
<?php
foreach($refer as $ref){
$cut = preg_split('#,#', $ref);
?>
<tr class="cellule_claire">
<td height="30"><?php echo $cut[0]; ?></td>
<td height="30"><?php echo $cut[1]; ?></td>
<td height="30"><?php echo $cut[2]; ?></td>
<td height="30"><?php echo ceil($cut[3]); ?></td>
</tr>
<?php
}
?>
<tbody>
</table>