FIX count negative in stats whithcredit note

This commit is contained in:
ptibogxiv 2019-08-06 16:54:44 +02:00 committed by GitHub
parent 22575bb6e7
commit 3e94b3dc59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2792,7 +2792,7 @@ class Product extends CommonObject
global $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(fd.qty) as qty";
$sql.= " COUNT(fd.rowid) as nb_rows, SUM(CASE WHEN type != 2 THEN fd.qty ELSE -(fd.qty) END) as qty";
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";