diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index d7b2a85748a..d188962b139 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -502,18 +502,17 @@ else
print '
';
- /*
- * Liste des paiements
- */
-
print '';
print '';
print '| '.$langs->trans('DateEcheance').' | ';
print dolibarr_print_date($fac->date_echeance,'%A %d %B %Y').' | ';
- print '| '.$langs->trans('Payments').' | ';
-
+ /*
+ * Liste des paiements
+ */
+ print '';
+ print $langs->trans('Payments').' : ';
$sql = 'SELECT '.$db->pdate('datep').' as dp, pf.amount,';
$sql .= ' c.libelle as paiement_type, p.num_paiement, p.rowid';
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p';
@@ -526,11 +525,8 @@ else
if ($result)
{
$num = $db->num_rows($result);
- $i = 0; $total = 0;
-
- print ' | ';
+ $i = 0; $totalpaye = 0;
print '';
-
print '';
print '| '.$langs->trans('Date').' | ';
print ''.$langs->trans('Type').' | ';
@@ -560,22 +556,22 @@ else
}
print ' ';
- $total = $total + $objp->amount;
+ $totalpaye += $objp->amount;
$i++;
}
- print '| '.$langs->trans('Total').' : | '.price($total).' | '.$langs->trans('Currency'.$conf->monnaie)." | \n";
-
- if ($fac->statut > 0)
+ if ($fac->paye == 0)
{
- $resteapayer = abs($fac->total_ttc - $total);
- print '| '.$langs->trans('RemainderToPay').' : | ';
- print ''.price($resteapayer).' | '.$langs->trans('Currency'.$conf->monnaie).' | ';
- print ' ';
- }
+ print '| '.$langs->trans('AlreadyPayed').' : | '.price($totalpaye).' | '.$langs->trans('Currency'.$conf->monnaie).' | ';
+ print '| '.$langs->trans("Billed").' : | '.price($fac->total_ttc).' | '.$langs->trans('Currency'.$conf->monnaie).' | ';
+ $resteapayer = $fac->total_ttc - $totalpaye;
+
+ print '| '.$langs->trans('RemainderToPay').' : | ';
+ print ''.price($resteapayer).' | '.$langs->trans('Currency'.$conf->monnaie).' | ';
+ }
print ' ';
- $db->free();
+ $db->free($result);
}
else
{
diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php
index 10a274560ae..0053d315101 100644
--- a/htdocs/fourn/facture/paiement.php
+++ b/htdocs/fourn/facture/paiement.php
@@ -271,7 +271,7 @@ if ($action == 'create' || $action == 'add_paiement')
print ' | ';
print '| '.$langs->trans('Bill').' | '.$langs->trans('Date').' | ';
print ''.$langs->trans('AmountTTC').' | ';
- print ''.$langs->trans('Paied').' | ';
+ print ''.$langs->trans('AlreadyPayed').' | ';
print ''.$langs->trans('RemainderToPay').' | ';
print ''.$langs->trans('Amount').' | ';
print ' ';
|