Update product.class.php
This commit is contained in:
parent
3e94b3dc59
commit
33cf4d8417
@ -2788,11 +2788,10 @@ class Product extends CommonObject
|
||||
public function load_stats_facture($socid = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
global $user;
|
||||
global $db, $conf, $user;
|
||||
|
||||
$sql = "SELECT COUNT(DISTINCT f.fk_soc) as nb_customers, COUNT(DISTINCT f.rowid) as nb,";
|
||||
$sql.= " COUNT(fd.rowid) as nb_rows, SUM(CASE WHEN type != 2 THEN fd.qty ELSE -(fd.qty) END) as qty";
|
||||
$sql.= " COUNT(fd.rowid) as nb_rows, sum(".$db->ifsql('f.type != 2', 'fd.qty', 'fd.qty * -1').") as qty";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user