From 1823a9c1c88d3dc21ccb0dedce689b0fab65601a Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Fri, 27 Jun 2003 16:11:26 +0000 Subject: [PATCH] Ajout d'une fonction pour compter la presence dans les factures --- htdocs/product.class.php3 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/htdocs/product.class.php3 b/htdocs/product.class.php3 index 1e36f6d0180..962b93fbffe 100644 --- a/htdocs/product.class.php3 +++ b/htdocs/product.class.php3 @@ -158,5 +158,28 @@ class Product return 0; } } + /* + * + * + */ + Function count_facture() + { + $sql = "SELECT pd.fk_facture"; + $sql .= " FROM llx_facturedet as pd, llx_product as p"; + $sql .= " WHERE p.rowid = pd.fk_product AND p.rowid = ".$this->id; + $sql .= " GROUP BY pd.fk_facture"; + + $result = $this->db->query($sql) ; + + if ( $result ) + { + return $this->db->num_rows(); + } + else + { + return 0; + } + } + } ?>