diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php
index 736aec48644..736581e9248 100644
--- a/htdocs/accountancy/bookkeeping/balance.php
+++ b/htdocs/accountancy/bookkeeping/balance.php
@@ -23,6 +23,7 @@
* \ingroup Advanced accountancy
* \brief Balance of book keeping
*/
+
require '../../main.inc.php';
// Class
@@ -184,7 +185,7 @@ else {
print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
- print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
+ print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
print "\n";
@@ -213,6 +214,9 @@ else {
$total_debit = 0;
$total_credit = 0;
+ $sous_total_debit = 0;
+ $sous_total_credit = 0;
+ $displayed_account = "";
foreach ( $object->lines as $line ) {
$var = ! $var;
@@ -220,33 +224,59 @@ else {
$total_debit += $line->debit;
$total_credit += $line->credit;
$description = $object->get_compte_desc($line->numero_compte); // Search description of the account
+ $root_account_description = $object->get_compte_racine($line->numero_compte);
if(empty($description)){
$link = '' . img_edit_add() .'';
}
print '
';
+
+ // Permet d'afficher le compte comptable
+ if ($root_account_description != $displayed_account) {
+
+ // Affiche un Sous-Total par compte comptable
+ if ($displayed_account != "") {
+ print '
| '.$langs->trans("SubTotal") . ': | '.price($sous_total_debit).' | '.price($sous_total_credit).' | '.price($sous_total_credit-$sous_total_debit).' | ';
+ print " | \n";
+ print '
';
+ }
+
+ // Affiche le compte comptable en début de ligne
+ print "";
+ print '| '. $root_account_description .' | ';
+ print '
';
+
+ $displayed_account = $root_account_description;
+ $sous_total_debit = 0;
+ $sous_total_credit = 0;
+ }
+
+ // $object->get_compte_racine($line->numero_compte);
+
+
print '' . length_accountg($line->numero_compte) . ' | ';
print '' . $description . ' | ';
print '' . number_format($line->debit, 2, ',', ' ') . ' | ';
- print '' . number_format($line->credit, 2, ',', ' ') . ' | ';
- print '' . number_format($line->credit - $line->debit, 2, ',', ' ') . ' | ';
+ print '' . number_format($line->credit, 2, ',', ' ') . ' | ';
+ print '' . number_format($line->credit - $line->debit, 2, ',', ' ') . ' | ';
print '' . $link;
print ' | ';
print "\n";
+
+ // Comptabilise le sous-total
+ $sous_total_debit += $line->debit;
+ $sous_total_credit += $line->credit;
+
}
- print '';
- print ' | ';
- print ' | ';
- print '';
- print price($total_debit);
- print ' | ';
- print '';
- print price($total_credit);
- print ' | ';
- print '' . price($total_credit - $total_debit) . ' | ';
- print ' | ';
- print '
';
+ print '| '.$langs->trans("SubTotal") . ': | '.price($sous_total_debit).' | '.price($sous_total_credit).' | '.price($sous_total_credit-$sous_total_debit).' | ';
+ print " | \n";
+ print '
';
+
+ print '| '.$langs->trans("AccountBalance") . ': | '.price($total_debit).' | '.price($total_credit).' | '.price($total_credit-$total_debit).' | ';
+ print " | \n";
+ print '
';
+
print "";
print '';
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index 23148213aa0..5eafa920973 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -258,7 +258,6 @@ if ($action == 'export_csv') {
*/
$title_page = $langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end);
-
llxHeader('', $title_page);
// List
@@ -315,6 +314,7 @@ print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield
print '