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 ''; + print ''; $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 '
Factures impayéesReçu
Factures impayéesMontant TTCReçu
'; - print ''; + print ''; print "\n"; $i = 0; $var = True; + $total = $totalam = 0; while ($i < $num) { $obj = $db->fetch_object( $i); $var = !$var; - print ""; - print ''; + print ''; + print ''; print ''; print ''; + $total += $obj->total_ttc; + $totalam += $obj->am; $i++; - } + } + $var=!$var; + print ''; print '
Factures à payer
Factures à payerMontant TTC
'.img_file().' '; - print ''.$obj->libelle.'
'.img_file().''; + print ' '.$obj->facnumber.''.$obj->libelle.''.price($obj->amount).'
Reste à payer : '.price($total-$totalam).''.price($total).'

'; } }