diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index ffc0b8d8264..4132dda2bdf 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -231,6 +231,7 @@ if ($user->comm > 0 && $conf->commercial )
/*
* Factures impayées
+ *
*/
$sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp, f.total_ttc, sum(pf.amount) as am";
@@ -247,9 +248,9 @@ if ( $db->query($sql) )
if ($num)
{
print '
';
- print '| Factures impayées | Reçu |
';
+ print '| Factures impayées | Montant TTC | Reçu |
';
$var = True;
- $total = 0;
+ $total = $totalam = 0;
while ($i < $num)
{
$obj = $db->fetch_object( $i);
@@ -297,11 +298,6 @@ else
{
print $db->error();
}
-/*
- *
- *
- */
-
/*
* Factures a payer
@@ -309,7 +305,7 @@ else
*/
if ($user->societe_id == 0)
{
- $sql = "SELECT ff.total_ttc as amount, ff.libelle, ff.rowid";
+ $sql = "SELECT ff.rowid, ff.facnumber, ff.libelle, ff.total_ttc as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff";
$sql .= " WHERE ff.paye=0";
@@ -319,21 +315,26 @@ if ($user->societe_id == 0)
if ($num)
{
print '';
- print '| Factures à payer | ';
+ print '
| Factures à payer | Montant TTC |
';
print "\n";
$i = 0;
$var = True;
+ $total = $totalam = 0;
while ($i < $num)
{
$obj = $db->fetch_object( $i);
$var = !$var;
- print "";
- print '| '.img_file().' ';
- print ''.$obj->libelle.' | ';
+ print '
| '.img_file().'';
+ print ' '.$obj->facnumber.' | ';
+ print ''.$obj->libelle.' | ';
print ''.price($obj->amount).' | ';
print '
';
+ $total += $obj->total_ttc;
+ $totalam += $obj->am;
$i++;
- }
+ }
+ $var=!$var;
+ print '| Reste à payer : '.price($total-$totalam).' | '.price($total).' |
';
print '
';
}
}