diff --git a/htdocs/product.class.php b/htdocs/product.class.php index a8e84a5570f..6a164ea7218 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -416,8 +416,8 @@ class Product return $this->_get_stats($sql); } - /* - * + /** + *Renvoie le nombre de facture dans lesquelles figure le produit * */ Function get_num_vente() @@ -427,6 +427,19 @@ class Product $sql .= " WHERE f.rowid = d.fk_facture and f.paye = 1 and d.fk_product =".$this->id; $sql .= " GROUP BY date_format(f.datef,'%Y%m') DESC ;"; + return $this->_get_stats($sql); + } + /** + *Renvoie le nombre de proaple dans lesquelles figure le produit + * + */ + Function get_num_propal() + { + $sql = "SELECT count(*), date_format(p.datep, '%Y%m') "; + $sql .= " FROM ".MAIN_DB_PREFIX."propaldet as d, ".MAIN_DB_PREFIX."propal as p"; + $sql .= " WHERE p.rowid = d.fk_propal and d.fk_product =".$this->id; + $sql .= " GROUP BY date_format(p.datep,'%Y%m') DESC ;"; + return $this->_get_stats($sql); } /*