. */ /* */ /*************************************************************************************/ require_once("pre.php"); require_once("auth.php"); require_once("../lib/magpierss/extlib/Snoopy.class.inc"); ?>
query($query); return $resul ? $cnx->get_result($resul, 0, 0) : 0; } $cond_commande_paye = "statut >= ".Commande::PAYE." and statut <> ".Commande::ANNULE; $in_commande_paye = "select id from ".Commande::TABLE." where $cond_commande_paye"; $nbclient = get_result("select count(*) as nb from ".Client::TABLE); $nbproduit = get_result("select count(*) as nb from ".Produit::TABLE); $nbcmdinstance = get_result("select count(*) as nb from ".Commande::TABLE." where statut < ".Commande::TRAITEMENT); $nbcmdtraitement = get_result("select count(*) as nb from ".Commande::TABLE." where statut = ".Commande::TRAITEMENT); $nbcmdlivree = get_result("select count(*) as nb from ".Commande::TABLE." where statut = ".Commande::EXPEDIE); $nbproduitenligne = get_result("select count(*) as nb from ".Produit::TABLE." where ligne=1"); $nbproduithorsligne = $nbproduit-$nbproduitenligne; $port = get_result("select sum(port) as totport from ".Commande::TABLE." where $cond_commande_paye"); $ca = round(get_result("SELECT sum(quantite*prixu) as ca FROM ".Venteprod::TABLE." where commande in ($in_commande_paye)"), 2); $ca += get_result("SELECT sum(port) as ca FROM ".Commande::TABLE." where id in ($in_commande_paye)"); $ca -= get_result("SELECT sum(remise) as ca FROM ".Commande::TABLE." where id in ($in_commande_paye)"); $casf = $ca - $port; $nbCommande = get_result("SELECT count(*) as nbCommande FROM ".Commande::TABLE." where $cond_commande_paye"); if($nbCommande > 0) $panierMoyen = round(($ca/$nbCommande),2); else $panierMoyen = 0; // La liste des commandes du mois courant $query = "select id from ".Commande::TABLE." where datefact like '".date("Y")."-".date("m")."-%%' and $cond_commande_paye"; $resul = $cnx->query($query); $list = array(); while($resul && $row = $cnx->fetch_object($resul)) { $list[] = $row->id; } if (count($list) == 0) $list = '0'; else $list = implode(',', $list); $camois = round(get_result("SELECT sum(quantite*prixu) as camois FROM ".Venteprod::TABLE." where commande in ($list)"), 2); $camois += get_result("SELECT sum(port) as port FROM ".Commande::TABLE." where id in ($list)"); $camois -= get_result("SELECT sum(remise) as remise FROM ".Commande::TABLE." where id in ($list)"); $nbcmdannulee = get_result("select count(*) as nbcmdannulee from ".Commande::TABLE." where statut = ".Commande::ANNULE); $nbrubrique = get_result("select count(id) as nbRubrique from ".Rubrique::TABLE); // Dernière version $snoopy = new Snoopy(); if($snoopy->fetch("http://thelia.net/version.php")) { $versiondispo = trim($snoopy->results); if(! preg_match("/^[0-9.]*$/", $versiondispo)) $versiondispo = ""; } else { $versiondispo = ""; } ?>