diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 751bfb6ff6c..2d61982a80e 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -1432,10 +1432,10 @@ if ($resql)
// Status
if (! empty($arrayfields['f.fk_statut']['checked']))
{
- print '
';
- print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5,$paiement,$obj->type);
- print " | ";
- if (! $i) $totalarray['nbfield']++;
+ print '';
+ print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5,$paiement,$obj->type);
+ print " | ";
+ if (! $i) $totalarray['nbfield']++;
}
// Action column
diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php
index e9eb3d41859..e8fd04ac818 100644
--- a/htdocs/product/stats/facture.php
+++ b/htdocs/product/stats/facture.php
@@ -141,7 +141,7 @@ if ($id > 0 || ! empty($ref))
elseif ($user->rights->facture->lire)
{
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,";
- $sql.= " f.facnumber, f.datef, f.paye, f.fk_statut as statut, f.rowid as facid,";
+ $sql.= " f.facnumber, f.datef, f.paye, f.type, f.fk_statut as statut, f.rowid as facid,";
$sql.= " d.rowid, d.total_ht as total_ht, d.qty"; // We must keep the d.rowid here to not loose record because of the distinct used to ignore duplicate line when link on societe_commerciaux is used
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
@@ -232,23 +232,24 @@ if ($id > 0 || ! empty($ref))
$var=True;
while ($i < min($num,$conf->liste_limit))
{
- $objp = $db->fetch_object($result);
+ $objp = $db->fetch_object($result);
+ $invoicestatic->id=$objp->facid;
+ $invoicestatic->ref=$objp->facnumber;
+ $societestatic->fetch($objp->socid);
+ $paiement = $invoicestatic->getSommePaiement();
$var=!$var;
print '';
print '| ';
- $invoicestatic->id=$objp->facid;
- $invoicestatic->ref=$objp->facnumber;
print $invoicestatic->getNomUrl(1);
print " | \n";
- $societestatic->fetch($objp->socid);
print ''.$societestatic->getNomUrl(1).' | ';
print "".$objp->code_client." | \n";
print '';
print dol_print_date($db->jdate($objp->datef),'day')." | ";
print ''.$objp->qty." | \n";
print ''.price($objp->total_ht)." | \n";
- print ''.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).' | ';
+ print ''.$invoicestatic->LibStatut($objp->paye,$objp->statut,5,$paiement,$objp->type).' | ';
print "
\n";
$i++;