From a9854b2b666b4bee293374481cc91c65991b36db Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 24 Jun 2003 21:36:31 +0000 Subject: [PATCH] Ajout de 2 fonction pour calcul de stats sur la fiche produit --- htdocs/product.class.php3 | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/htdocs/product.class.php3 b/htdocs/product.class.php3 index aa84eddb042..f7951b48fb2 100644 --- a/htdocs/product.class.php3 +++ b/htdocs/product.class.php3 @@ -113,6 +113,49 @@ class Product $this->db->free(); return $result; } + /* + * + * + */ + Function count_propale() + { + $sql = "SELECT pd.fk_propal"; + $sql .= " FROM llx_propaldet as pd, llx_product as p"; + $sql .= " WHERE p.rowid = pd.fk_product AND p.rowid = ".$this->id; + $sql .= " GROUP BY pd.fk_propal"; + $result = $this->db->query($sql) ; + + if ( $result ) + { + return $this->db->num_rows(); + } + else + { + return 0; + } + } + /* + * + * + */ + Function count_propale_client() + { + $sql = "SELECT pr.fk_soc"; + $sql .= " FROM llx_propaldet as pd, llx_product as p, llx_propal as pr"; + $sql .= " WHERE p.rowid = pd.fk_product AND pd.fk_propal = pr.rowid AND p.rowid = ".$this->id; + $sql .= " GROUP BY pr.fk_soc"; + + $result = $this->db->query($sql) ; + + if ( $result ) + { + return $this->db->num_rows(); + } + else + { + return 0; + } + } } ?>