FIX: order supplier stats by category now display figures

This commit is contained in:
Florian HENRY 2021-06-01 15:30:17 +02:00
parent 3187c096c3
commit c91b9d613a

View File

@ -78,6 +78,7 @@ class CommandeStats extends Stats
$this->field = 'total_ht';
$this->field_line = 'total_ht';
$this->where .= " c.fk_statut > 0"; // Not draft and not cancelled
$this->categ_link=MAIN_DB_PREFIX.'categorie_societe';
}
elseif ($mode == 'supplier')
{
@ -87,6 +88,7 @@ class CommandeStats extends Stats
$this->field = 'total_ht';
$this->field_line = 'total_ht';
$this->where .= " c.fk_statut > 2"; // Only approved & ordered
$this->categ_link=MAIN_DB_PREFIX.'categorie_fournisseur';
}
//$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
$this->where .= ' AND c.entity IN ('.getEntity('commande').')';
@ -106,7 +108,7 @@ class CommandeStats extends Stats
if ($categid)
{
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cats ON cats.fk_soc = c.fk_soc';
$this->join .= ' LEFT JOIN '.$this->categ_link.' as cats ON cats.fk_soc = c.fk_soc';
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cat.rowid = cats.fk_categorie';
$this->where .= ' AND cat.rowid = '.$categid;
}