diff --git a/class/ligneFacture.php b/class/lignefacture.php similarity index 100% rename from class/ligneFacture.php rename to class/lignefacture.php diff --git a/class/ligneOrdonnance.php b/class/ligneordonnance.php similarity index 100% rename from class/ligneOrdonnance.php rename to class/ligneordonnance.php diff --git a/class/stats.php b/class/stats.php index 22b0913438373e2b91d3a784e9017c6de041f845..3b5dc0b790a2f63700ebf1b390c75df7f65efbde 100644 --- a/class/stats.php +++ b/class/stats.php @@ -2,16 +2,12 @@ class Stats { - public function factureMoyClient() + public function factureMoy() { $bdd = new Db(); - $requete_prepare = $bdd->db->prepare(" SELECT SUM(t.prix)/COUNT(*) AS value - FROM ( SELECT c.nom, c.prenom, SUM(f.prix_total) AS prix - FROM animal a, client c, facture f - WHERE a.client = c.id - AND f.animal = a.id - GROUP BY c.nom, c.prenom, c.id) t" ); // on prépare notre requête + $requete_prepare = $bdd->db->prepare(" SELECT SUM(f.prix_total)/COUNT(*) AS value + FROM facture f" ); // on prépare notre requête $requete_prepare->execute(); $ligne = $requete_prepare->fetch(PDO::FETCH_ASSOC); diff --git a/view/stats.php b/view/stats.php index 108c260a36b12b8eb816222aa9f530754f0e46d5..d352d80a22ca388a9093222c00f0d29822ca9eed 100644 --- a/view/stats.php +++ b/view/stats.php @@ -6,8 +6,8 @@ <table class="table"> <thead> - <th>Facture moyenne par client : /th> - <th><?php $tmp = $stats->factureMoyClient(); $nb_formated = number_format($tmp["value"], 2, ',', ' '); echo $nb_formated; ?></th> + <th>Facture moyenne : </th> + <th><?php $tmp = $stats->factureMoy(); $nb_formated = number_format($tmp["value"], 2, ',', ' '); echo $nb_formated; ?></th> </thead> <tbody> <tr>