diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 2cdf92a7863..baa3d9e3716 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -143,8 +143,9 @@ $arrayfields=array( 'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || ! empty($ref))?0:1), 'position'=>1000), 'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600), 'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605), - 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1000), - 'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010), + 'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>1000), + 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1001), + 'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010), 'b.conciliated'=>array('label'=>$langs->trans("Conciliated"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile'?1:0), 'position'=>1020), ); // Extra fields @@ -865,14 +866,21 @@ if ($resql) print ''; print ''; } + if (! empty($arrayfields['balancebefore']['checked'])) + { + print ''; + $htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue")); + print $form->textwithpicto('', $htmltext, 1); + print ''; + } if (! empty($arrayfields['balance']['checked'])) { - print ''; - $htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue")); - print $form->textwithpicto('', $htmltext, 1); - print ''; + print ''; + $htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue")); + print $form->textwithpicto('', $htmltext, 1); + print ''; } - // 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