From fb88c68ddba08d45955cb5e7d94c3fab66d04c61 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 2 Sep 2020 05:15:58 +0200 Subject: [PATCH] New Accountancy - Balance - Move to getNomUrl on accounting account --- htdocs/accountancy/bookkeeping/balance.php | 31 +++++++++++++--------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 4de2be6fcbb..059e1eb57b1 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -1,7 +1,7 @@ * Copyright (C) 2016 Florian Henry - * Copyright (C) 2016-2019 Alexandre Spangaro + * Copyright (C) 2016-2020 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -31,6 +31,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; @@ -244,7 +245,7 @@ if ($action != 'export_csv') print ''; print ''; - print ''; print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder); @@ -274,6 +274,8 @@ if ($action != 'export_csv') $sous_total_credit = 0; $displayed_account = ""; + $accountingaccountstatic = new AccountingAccount($db); + $sql = "select t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance from ".MAIN_DB_PREFIX."accounting_bookkeeping as t where entity in ".$conf->entity; $sql .= " AND t.doc_date < '".$db->idate($search_date_start)."' GROUP BY t.numero_compte"; $resql = $db->query($sql); @@ -286,12 +288,18 @@ if ($action != 'export_csv') foreach ($object->lines as $line) { + $accountingaccountstatic->fetch(null, $line->numero_compte, true); + if (!empty($accountingaccountstatic->account_number)) { + $accounting_account = $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); + } else { + $accounting_account = length_accountg($line->numero_compte); + } + $link = ''; $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)) { + if (empty($accountingaccountstatic->account_number)) { $link = ''.img_edit_add().''; } print ''; @@ -303,7 +311,7 @@ if ($action != 'export_csv') // Show subtotal per accounting account if ($displayed_account != "") { print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -313,7 +321,7 @@ if ($action != 'export_csv') // Show first line of a break print ''; - print ''; + print ''; print ''; $displayed_account = $root_account_description; @@ -321,10 +329,9 @@ if ($action != 'export_csv') $sous_total_credit = 0; } } - // $object->get_compte_racine($line->numero_compte); - print ''; - print ''; + // $object->get_compte_racine($line->numero_compte); + print ''; print ''; print ''; print ''; @@ -340,12 +347,12 @@ if ($action != 'export_csv') if (!empty($show_subgroup)) { - print ''; + print ''; print "\n"; print ''; } - print ''; + print ''; print "\n"; print '';
'; + print ''; print $langs->trans('From'); print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, ''); print ' '; @@ -260,7 +261,6 @@ if ($action != 'export_csv') print '
'.$langs->trans("SubTotal").':'.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).''.price(price2num($sous_total_credit - $sous_total_debit)).'
'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').''.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'
'.length_accountg($line->numero_compte).''.$description.''.$accounting_account.''.price($opening_balances["'".$line->numero_compte."'"]).''.price($line->debit).''.price($line->credit).'
'.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).''.price(price2num($sous_total_debit - $sous_total_credit)).'
'.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).''.price(price2num($sous_total_debit - $sous_total_credit)).'
'.$langs->trans("AccountBalance").':'.price($total_debit).''.price($total_credit).''.price(price2num($total_debit - $total_credit)).'
'.$langs->trans("AccountBalance").':'.price($total_debit).''.price($total_credit).''.price(price2num($total_debit - $total_credit)).'