Ne comptabilise que les commandes validées

This commit is contained in:
Rodolphe Quiedeville 2003-11-08 17:13:24 +00:00
parent f012b86013
commit aa766df8f9

View File

@ -35,7 +35,7 @@ class CommandeStats
Function getNbCommandeByYear() Function getNbCommandeByYear()
{ {
$result = array(); $result = array();
$sql = "SELECT date_format(date_commande,'%Y') as dm, count(*) FROM llx_commande GROUP BY dm DESC"; $sql = "SELECT date_format(date_commande,'%Y') as dm, count(*) FROM llx_commande GROUP BY dm DESC WHERE fk_statut > 0";
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
$num = $this->db->num_rows(); $num = $this->db->num_rows();
@ -59,7 +59,7 @@ class CommandeStats
{ {
$result = array(); $result = array();
$sql = "SELECT date_format(date_commande,'%m') as dm, count(*) FROM llx_commande"; $sql = "SELECT date_format(date_commande,'%m') as dm, count(*) FROM llx_commande";
$sql .= " WHERE date_format(date_commande,'%Y') = $year"; $sql .= " WHERE date_format(date_commande,'%Y') = $year AND fk_statut > 0";
$sql .= " GROUP BY dm DESC"; $sql .= " GROUP BY dm DESC";
if ($this->db->query($sql)) if ($this->db->query($sql))
@ -91,7 +91,7 @@ class CommandeStats
{ {
$result = array(); $result = array();
$sql = "SELECT date_format(date_commande,'%m') as dm, sum(total_ht) FROM llx_commande"; $sql = "SELECT date_format(date_commande,'%m') as dm, sum(total_ht) FROM llx_commande";
$sql .= " WHERE date_format(date_commande,'%Y') = $year"; $sql .= " WHERE date_format(date_commande,'%Y') = $year AND fk_statut > 0";
$sql .= " GROUP BY dm DESC"; $sql .= " GROUP BY dm DESC";
if ($this->db->query($sql)) if ($this->db->query($sql))
@ -123,7 +123,7 @@ class CommandeStats
{ {
$result = array(); $result = array();
$sql = "SELECT date_format(date_commande,'%m') as dm, avg(total_ht) FROM llx_commande"; $sql = "SELECT date_format(date_commande,'%m') as dm, avg(total_ht) FROM llx_commande";
$sql .= " WHERE date_format(date_commande,'%Y') = $year"; $sql .= " WHERE date_format(date_commande,'%Y') = $year AND fk_statut > 0";
$sql .= " GROUP BY dm DESC"; $sql .= " GROUP BY dm DESC";
if ($this->db->query($sql)) if ($this->db->query($sql))