Merge pull request #17786 from FHenry/12_fix_ordersupplierstats

FIX: order supplier stats by category now display figures
This commit is contained in:
Laurent Destailleur 2021-06-04 09:39:17 +02:00 committed by GitHub
commit 164fe9fb4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;
}