Ajout de 2 fonction pour calcul de stats sur la fiche produit
This commit is contained in:
parent
118357d1af
commit
a9854b2b66
@ -113,6 +113,49 @@ class Product
|
|||||||
$this->db->free();
|
$this->db->free();
|
||||||
return $result;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user