From 9e6defab04243c48cd5f393a157bf2f571a58f33 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Tue, 25 Sep 2012 21:30:55 +0200
Subject: [PATCH] Fix on total

---
 htdocs/compta/recap-compta.php | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php
index 9b3cc8b487a..e3fcd8db695 100644
--- a/htdocs/compta/recap-compta.php
+++ b/htdocs/compta/recap-compta.php
@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2010 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2012 Laurent Destailleur  <eldy@users.sourceforge.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -133,14 +133,15 @@ if ($socid > 0)
 				$totalpaye = $fac->getSommePaiement();
 
 				$var=!$var;
-				print "<tr $bc[$var]>";
+				print "<tr ".$bc[$var].">";
 
 				print "<td align=\"center\">".dol_print_date($fac->date)."</td>\n";
 				print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id.'">'.img_object($langs->trans("ShowBill"),"bill")." ".$fac->ref."</a></td>\n";
 
 				print '<td aling="left">'.$fac->getLibStatut(2,$totalpaye).'</td>';
 				print '<td align="right">'.price($fac->total_ttc)."</td>\n";
-				$solde = $solde + $fac->total_ttc;
+				if (($fac->statut == 3 ) || ($fac->statut == 2 && ! $fact->close_code) )  $solde = $solde = $solde + $totalpaye;
+				else $solde = $solde + $fac->total_ttc;
 
 				print '<td align="right">&nbsp;</td>';
 				print '<td align="right">'.price($solde)."</td>\n";
-- 
GitLab