[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 03/03: Task #1191 - Ajouter les totaux dans l
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 03/03: Task #1191 - Ajouter les totaux dans l'historique de la CA #1191 : add totals to ANCBS and ANCHOP |
Date: |
Mon, 02 Nov 2015 18:09:47 +0000 |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 4ae28d4413f3dc244555c8f8d6a5b0544abc2ce6
Author: Dany De Bontridder <address@hidden>
Date: Mon Nov 2 19:03:11 2015 +0100
Task #1191 - Ajouter les totaux dans l'historique de la CA
#1191 : add totals to ANCBS and ANCHOP
---
include/class/class_anc_balance_simple.php | 14 ++++++++++++++
include/class/class_anc_listing.php | 24 ++++++++++++++++++++++--
2 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/include/class/class_anc_balance_simple.php
b/include/class/class_anc_balance_simple.php
index 000e762..f700c6c 100644
--- a/include/class/class_anc_balance_simple.php
+++ b/include/class/class_anc_balance_simple.php
@@ -139,6 +139,8 @@ class Anc_Balance_Simple extends Anc_Print
return $array;
}
+ bcscale(2);
+ $deb_side=0;$cred_side=0;
foreach ( $array as $row)
{
$odd++;
@@ -154,7 +156,19 @@ class Anc_Balance_Simple extends Anc_Print
$deb=($row['solde'] == 0 )?'':$deb;
$r.=sprintf("<td>%s</td>",$deb);
$r.="</tr>";
+ $deb_side=bcadd($deb_side,$row['sum_deb']);
+ $cred_side=bcadd($cred_side,$row['sum_cred']);
+
}
+ $r.='<tr class="highlight">';
+ $r.=td(_("Total"));
+ $r.=td(nbm($deb_side));
+ $r.=td(nbm($cred_side));
+ $solde_side=abs(bcsub($deb_side,$cred_side));
+ $r.=td(nbm($solde_side));
+ if ( $deb_side == $cred_side ) $r.=td("=");
+ else if ( $deb_side > $cred_side ) $r.=td("D");
+ else $r.=td("C");
$r.="</table>";
return $r;
}
diff --git a/include/class/class_anc_listing.php
b/include/class/class_anc_listing.php
index 9804ad9..014fd6d 100644
--- a/include/class/class_anc_listing.php
+++ b/include/class/class_anc_listing.php
@@ -70,6 +70,8 @@ class Anc_Listing extends Anc_Print
{
return 0;
}
+ $cred=0;$deb=0;
+ bcscale(2);
$r.= '<table class="result" style="width=100%">';
$r.= '<tr>'.
'<th>'._('Date').'</th>'.
@@ -100,11 +102,29 @@ class Anc_Listing extends Anc_Print
td($row['jr_comment']).
'<td>'.$detail.'</td>'.
'<td class="num">'.nbm($row['oa_amount']).'</td>'.
- '<td>'.(($row['oa_debit']=='f')?'CREDIT':'DEBIT').'</td>';
+ '<td>'.(($row['oa_debit']=='f')?'C':'D').'</td>';
$r.= '</tr>';
+ if ( $row['oa_debit'] == 'f')
{$cred=bcadd($cred,$row['oa_amount']);}
+ if ( $row['oa_debit'] == 't') {$deb=bcadd($deb,$row['oa_amount']);}
}
+
$r.= '</table>';
- return $r;
+ ob_start();
+ echo _("Total");
+ echo '<ol style="list-style:none">';
+ echo '<li>'.nbm($deb).' D '.'</li>';
+ echo '<li>'.nbm($cred).' C '.'</li>';
+ echo '<li>';
+ echo _('Solde');
+ $solde=abs(bcsub($deb,$cred));
+ echo $solde;
+ if ( $cred == $deb ) echo " = ";
+ else if ( $cred > $deb ) echo " C ";
+ else echo ' D ';
+
+ $r_solde=ob_get_clean();
+
+ return $r.$r_solde;
}
/*!
* \brief load the data from the database