';
}
- // Numero statement
+ // Numero statement
if (! empty($arrayfields['b.num_releve']['checked']))
{
print '
';
@@ -904,6 +912,7 @@ if ($resql)
if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'],$_SERVER['PHP_SELF'],'ba.ref','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
+ if (! empty($arrayfields['balancebefore']['checked'])) print_liste_field_titre($arrayfields['balancebefore']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['b.num_releve']['checked'])) print_liste_field_titre($arrayfields['b.num_releve']['label'],$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['b.conciliated']['checked'])) print_liste_field_titre($arrayfields['b.conciliated']['label'],$_SERVER['PHP_SELF'],'b.rappro','',$param,'align="center"',$sortfield,$sortorder);
@@ -929,7 +938,7 @@ if ($resql)
$objp = $db->fetch_object($resql);
// If we are in a situation where we need/can show balance, we calculate the start of balance
- if (! $balancecalculated && ! empty($arrayfields['balance']['checked']) && $mode_balance_ok)
+ if (! $balancecalculated && (! empty($arrayfields['balancebefore']['checked']) || ! empty($arrayfields['balance']['checked'])) && $mode_balance_ok)
{
if (! $account)
{
@@ -970,7 +979,7 @@ if ($resql)
$balancefieldfound=false;
foreach($arrayfields as $key => $val)
{
- if ($key == 'balance')
+ if ($key == 'balancebefore' || $key == 'balance')
{
$balancefieldfound=true;
continue;
@@ -1284,25 +1293,46 @@ if ($resql)
if (! $i) $totalarray['totalcredfield']=$totalarray['nbfield'];
}
+ // Balance before
+ if (! empty($arrayfields['balancebefore']['checked']))
+ {
+ if ($mode_balance_ok)
+ {
+ $balancebefore = price2num($balance - ($sign * $objp->amount),'MT');
+ if ($balancebefore >= 0)
+ {
+ print '
'.price($balancebefore).'
';
+ }
+ else
+ {
+ print '
'.price($balancebefore).'
';
+ }
+ }
+ else
+ {
+ print '
-
';
+ }
+ if (! $i) $totalarray['nbfield']++;
+ }
// Balance
if (! empty($arrayfields['balance']['checked']))
{
- if ($mode_balance_ok)
- {
- if ($balance >= 0)
- {
- print '
'.price($balance).'
';
- }
- else
- {
- print '
'.price($balance).'
';
- }
- }
- else
- {
- print '
-
';
- }
- if (! $i) $totalarray['nbfield']++;
+ if ($mode_balance_ok)
+ {
+ if ($balance >= 0)
+ {
+ print '
'.price($balance).'
';
+ }
+ else
+ {
+ print '
'.price($balance).'
';
+ }
+ }
+ else
+ {
+ print '
-
';
+ }
+ if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['b.num_releve']['checked']))
diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang
index 8c402d53705..e54d613628e 100644
--- a/htdocs/langs/en_US/compta.lang
+++ b/htdocs/langs/en_US/compta.lang
@@ -24,6 +24,7 @@ PaymentsNotLinkedToInvoice=Payments not linked to any invoice, so not linked to
PaymentsNotLinkedToUser=Payments not linked to any user
Profit=Profit
AccountingResult=Accounting result
+BalanceBefore=Balance (before)
Balance=Balance
Debit=Debit
Credit=Credit