29require
'../../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeeping.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountancyexport.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
42$langs->loadLangs(array(
"accountancy",
"compta"));
44$action =
GETPOST(
'action',
'aZ09');
45$optioncss =
GETPOST(
'optioncss',
'alpha');
46$type =
GETPOST(
'type',
'alpha');
48 $context_default =
'balancesubaccountlist';
50 $context_default =
'balancelist';
52$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : $context_default;
53$show_subgroup =
GETPOST(
'show_subgroup',
'alpha');
56$search_ledger_code =
GETPOST(
'search_ledger_code',
'array');
57$search_accountancy_code_start =
GETPOST(
'search_accountancy_code_start',
'alpha');
58if ($search_accountancy_code_start == - 1) {
59 $search_accountancy_code_start =
'';
61$search_accountancy_code_end =
GETPOST(
'search_accountancy_code_end',
'alpha');
62if ($search_accountancy_code_end == - 1) {
63 $search_accountancy_code_end =
'';
65$search_not_reconciled =
GETPOST(
'search_not_reconciled',
'alpha');
69$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
70$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
72if (empty($page) || $page == -1 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') || (empty($toselect) && $massaction ===
'0')) {
75$offset = $limit * $page;
78if ($sortorder ==
"") {
81if ($sortfield ==
"") {
82 $sortfield =
"t.numero_compte";
87$hookmanager->initHooks(array($contextpage));
93if (empty($search_date_start) && !GETPOSTISSET(
'formfilteraction')) {
94 $sql =
"SELECT date_start, date_end from ".MAIN_DB_PREFIX.
"accounting_fiscalyear ";
95 $sql .=
" WHERE date_start < '".$db->idate(
dol_now()).
"' AND date_end > '".$db->idate(
dol_now()).
"'";
96 $sql .= $db->plimit(1);
97 $res = $db->query($sql);
99 if ($db->num_rows($res) > 0) {
100 $fiscalYear = $db->fetch_object($res);
101 $search_date_start = strtotime($fiscalYear->date_start);
102 $search_date_end = strtotime($fiscalYear->date_end);
109 $year_end = $year_start + 1;
110 $month_end = $month_start - 1;
111 if ($month_end < 1) {
115 $search_date_start =
dol_mktime(0, 0, 0, $month_start, 1, $year_start);
120if (!isModEnabled(
'accounting')) {
123if ($user->socid > 0) {
126if (!$user->hasRight(
'accounting',
'mouvements',
'lire')) {
136$parameters = array();
137$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
142if (empty($reshook)) {
143 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
145 $search_date_start =
'';
146 $search_date_end =
'';
147 $search_date_startyear =
'';
148 $search_date_startmonth =
'';
149 $search_date_startday =
'';
150 $search_date_endyear =
'';
151 $search_date_endmonth =
'';
152 $search_date_endday =
'';
153 $search_accountancy_code_start =
'';
154 $search_accountancy_code_end =
'';
155 $search_not_reconciled =
'';
156 $search_ledger_code = array();
163 if (!empty($search_date_start)) {
164 $filter[
't.doc_date>='] = $search_date_start;
165 $param .=
'&date_startmonth=' .
GETPOSTINT(
'date_startmonth') .
'&date_startday=' .
GETPOSTINT(
'date_startday') .
'&date_startyear=' .
GETPOSTINT(
'date_startyear');
167 if (!empty($search_date_end)) {
168 $filter[
't.doc_date<='] = $search_date_end;
169 $param .=
'&date_endmonth=' .
GETPOSTINT(
'date_endmonth') .
'&date_endday=' .
GETPOSTINT(
'date_endday') .
'&date_endyear=' .
GETPOSTINT(
'date_endyear');
171 if (!empty($search_doc_date)) {
172 $filter[
't.doc_date'] = $search_doc_date;
173 $param .=
'&doc_datemonth=' .
GETPOSTINT(
'doc_datemonth') .
'&doc_dateday=' .
GETPOSTINT(
'doc_dateday') .
'&doc_dateyear=' .
GETPOSTINT(
'doc_dateyear');
175 if (!empty($search_accountancy_code_start)) {
176 if ($type ==
'sub') {
177 $filter[
't.subledger_account>='] = $search_accountancy_code_start;
179 $filter[
't.numero_compte>='] = $search_accountancy_code_start;
181 $param .=
'&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
183 if (!empty($search_accountancy_code_end)) {
184 if ($type ==
'sub') {
185 $filter[
't.subledger_account<='] = $search_accountancy_code_end;
187 $filter[
't.numero_compte<='] = $search_accountancy_code_end;
189 $param .=
'&search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
191 if (!empty($search_ledger_code)) {
192 $filter[
't.code_journal'] = $search_ledger_code;
193 foreach ($search_ledger_code as $code) {
194 $param .=
'&search_ledger_code[]=' . urlencode($code);
197 if (!empty($search_not_reconciled)) {
198 $filter[
't.reconciled_option'] = $search_not_reconciled;
199 $param .=
'&search_not_reconciled='.urlencode($search_not_reconciled);
203 $url_param = substr($param, 1);
205 $param =
'&type=' . $type . $param;
209if ($action ==
'export_csv') {
212 $filename =
'balance';
213 $type_export =
'balance';
214 include DOL_DOCUMENT_ROOT.
'/accountancy/tpl/export_journal.tpl.php';
216 if ($type ==
'sub') {
217 $result =
$object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter,
'AND', 1);
219 $result =
$object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter);
225 foreach (
$object->lines as $line) {
226 if ($type ==
'sub') {
228 print
'"' . $line->subledger_label .
'"' . $sep;
231 print
'"' .
$object->get_compte_desc($line->numero_compte) .
'"' . $sep;
233 print
'"'.price($line->debit).
'"'.$sep;
234 print
'"'.price($line->credit).
'"'.$sep;
235 print
'"'.price($line->debit - $line->credit).
'"'.$sep;
248 $title_page = $langs->trans(
"AccountBalanceSubAccount");
250 $title_page = $langs->trans(
"AccountBalance");
253$help_url =
'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double';
255llxHeader(
'', $title_page, $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy accountancy-consultation page-'.(($type ==
'sub') ?
'sub' :
'').
'balance');
258if ($action !=
'export_csv') {
260 $nbtotalofrecords =
'';
262 if ($type ==
'sub') {
263 $nbtotalofrecords =
$object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter,
'AND', 1);
265 $nbtotalofrecords =
$object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
268 if ($nbtotalofrecords < 0) {
273 if ($type ==
'sub') {
274 $result =
$object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter,
'AND', 1);
276 $result =
$object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter);
283 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
284 print
'<input type="hidden" name="token" value="'.newToken().
'">';
285 print
'<input type="hidden" name="action" id="action" value="list">';
286 if ($optioncss !=
'') {
287 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
289 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
290 print
'<input type="hidden" name="type" value="'.$type.
'">';
291 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
292 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
293 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
294 print
'<input type="hidden" name="page" value="'.$page.
'">';
298 $parameters = array();
299 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
305 $newcardbutton = empty($hookmanager->resPrint) ?
'' : $hookmanager->resPrint;
307 if (empty($reshook)) {
308 $newcardbutton =
'<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans(
"Export").
' (' .
getDolGlobalString(
'ACCOUNTING_EXPORT_FORMAT').
')" />';
310 print
'<script type="text/javascript">
311 jQuery(document).ready(function() {
312 jQuery("#exportcsvbutton").click(function(event) {
313 event.preventDefault();
314 console.log("Set action to export_csv");
315 jQuery("#action").val("export_csv");
316 jQuery("#searchFormList").submit();
317 jQuery("#action").val("list");
322 if ($type ==
'sub') {
323 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'AccountBalance').
" - ".$langs->trans(
'GroupByAccountAccounting'),
'',
'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT .
'/accountancy/bookkeeping/balance.php?' . $url_param,
'', 1, array(
'morecss' =>
'marginleftonly'));
324 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'AccountBalance').
" - ".$langs->trans(
'GroupBySubAccountAccounting'),
'',
'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT .
'/accountancy/bookkeeping/balance.php?type=sub&' . $url_param,
'', 1, array(
'morecss' =>
'marginleftonly btnTitleSelected'));
326 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'AccountBalance').
" - ".$langs->trans(
'GroupByAccountAccounting'),
'',
'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT .
'/accountancy/bookkeeping/balance.php?' . $url_param,
'', 1, array(
'morecss' =>
'marginleftonly btnTitleSelected'));
327 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'AccountBalance').
" - ".$langs->trans(
'GroupBySubAccountAccounting'),
'',
'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT .
'/accountancy/bookkeeping/balance.php?type=sub&' . $url_param,
'', 1, array(
'morecss' =>
'marginleftonly'));
330 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewAccountingMvt'),
'',
'fa fa-plus-circle paddingleft', DOL_URL_ROOT.
'/accountancy/bookkeeping/card.php?action=create');
332 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
333 $param .=
'&contextpage='.urlencode($contextpage);
335 if ($limit > 0 && $limit != $conf->liste_limit) {
336 $param .=
'&limit='.((int) $limit);
339 print_barre_liste($title_page, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $result, $nbtotalofrecords,
'title_accountancy', 0, $newcardbutton,
'', $limit, 0, 0, 1);
341 $selectedfields =
'';
344 if ($type ==
'sub') {
345 print
info_admin($langs->trans(
"WarningRecordWithoutSubledgerAreExcluded"));
350 $moreforfilter .=
'<div class="divsearchfield">';
351 $moreforfilter .= $langs->trans(
'DateStart').
': ';
352 $moreforfilter .= $form->selectDate($search_date_start ? $search_date_start : -1,
'date_start', 0, 0, 1,
'', 1, 0);
353 $moreforfilter .= $langs->trans(
'DateEnd').
': ';
354 $moreforfilter .= $form->selectDate($search_date_end ? $search_date_end : -1,
'date_end', 0, 0, 1,
'', 1, 0);
355 $moreforfilter .=
'</div>';
357 $moreforfilter .=
'<div class="divsearchfield">';
358 $moreforfilter .=
'<label for="show_subgroup">'.$langs->trans(
'ShowSubtotalByGroup').
'</label>: ';
359 $moreforfilter .=
'<input type="checkbox" name="show_subgroup" id="show_subgroup" value="show_subgroup"'.($show_subgroup ==
'show_subgroup' ?
' checked' :
'').
'>';
360 $moreforfilter .=
'</div>';
362 $moreforfilter .=
'<div class="divsearchfield">';
363 $moreforfilter .= $langs->trans(
"Journals").
': ';
364 $moreforfilter .= $formaccounting->multi_select_journal($search_ledger_code,
'search_ledger_code', 0, 1, 1, 1);
365 $moreforfilter .=
'</div>';
368 $moreforfilter .=
'<div class="divsearchfield">';
370 $moreforfilter .= $langs->trans(
'AccountAccounting').
': ';
371 if ($type ==
'sub') {
372 $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start,
'search_accountancy_code_start', $langs->trans(
'From'),
'maxwidth200');
374 $moreforfilter .= $formaccounting->select_account($search_accountancy_code_start,
'search_accountancy_code_start', $langs->trans(
'From'), array(), 1, 1,
'maxwidth200',
'accounts');
376 $moreforfilter .=
' ';
377 if ($type ==
'sub') {
378 $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end,
'search_accountancy_code_end', $langs->trans(
'to'),
'maxwidth200');
380 $moreforfilter .= $formaccounting->select_account($search_accountancy_code_end,
'search_accountancy_code_end', $langs->trans(
'to'), array(), 1, 1,
'maxwidth200',
'accounts');
382 $moreforfilter .=
'</div>';
385 $moreforfilter .=
'<div class="divsearchfield">';
386 $moreforfilter .=
'<label for="notreconciled">'.$langs->trans(
'NotReconciled').
'</label>: ';
387 $moreforfilter .=
'<input type="checkbox" name="search_not_reconciled" id="notreconciled" value="notreconciled"'.($search_not_reconciled ==
'notreconciled' ?
' checked' :
'').
'>';
388 $moreforfilter .=
'</div>';
391 if (!empty($moreforfilter)) {
392 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
393 print $moreforfilter;
394 $parameters = array();
395 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
396 print $hookmanager->resPrint;
403 print
'<table class="liste '.($moreforfilter ?
"listwithfilterbefore" :
"").
'">';
405 print
'<tr class="liste_titre_filter">';
408 print
'<td class="liste_titre maxwidthsearch">';
409 $searchpicto = $form->showFilterButtons();
414 print
'<td class="liste_titre" colspan="'.$colspan.
'">';
418 $parameters = array();
419 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
420 print $hookmanager->resPrint;
424 print
'<td class="liste_titre maxwidthsearch">';
425 $searchpicto = $form->showFilterButtons();
431 print
'<tr class="liste_titre">';
433 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
435 print_liste_field_titre(
"AccountAccounting", $_SERVER[
'PHP_SELF'],
"t.numero_compte",
"", $param,
"", $sortfield, $sortorder);
441 print_liste_field_titre(
"OpeningBalance", $_SERVER[
'PHP_SELF'],
"", $param,
"",
'class="right"', $sortfield, $sortorder);
443 print_liste_field_titre(
"AccountingDebit", $_SERVER[
'PHP_SELF'],
"t.debit",
"", $param,
'class="right"', $sortfield, $sortorder);
444 print_liste_field_titre(
"AccountingCredit", $_SERVER[
'PHP_SELF'],
"t.credit",
"", $param,
'class="right"', $sortfield, $sortorder);
445 print_liste_field_titre(
"Balance", $_SERVER[
"PHP_SELF"],
"", $param,
"",
'class="right"', $sortfield, $sortorder);
448 $parameters = array(
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
449 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
450 print $hookmanager->resPrint;
453 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
459 $sous_total_debit = 0;
460 $sous_total_credit = 0;
461 $total_opening_balance = 0;
462 $sous_total_opening_balance = 0;
463 $displayed_account =
"";
470 $sql =
"SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance";
471 $sql .=
" FROM " . MAIN_DB_PREFIX .
"accounting_bookkeeping as t";
472 $sql .=
" WHERE t.entity = " . $conf->entity;
473 $sql .=
" AND t.doc_date < '" . $db->idate($search_date_start) .
"'";
474 $sql .=
" GROUP BY t.numero_compte";
476 $resql = $db->query($sql);
477 $opening_balances = array();
479 $nrows = $db->num_rows($resql);
480 for ($i = 0; $i < $nrows; $i++) {
481 $arr = $db->fetch_array($resql);
482 if (is_array($arr)) {
483 $opening_balances[
"'" . $arr[
'numero_compte'] .
"'"] = $arr[
'opening_balance'];
491 foreach (
$object->lines as $line) {
493 $accountingaccountstatic->id = 0;
494 $accountingaccountstatic->account_number =
'';
495 $accounting_account =
'';
497 if ($type !=
'sub') {
498 $accountingaccountstatic->fetch(0, $line->numero_compte,
true);
499 if (!empty($accountingaccountstatic->account_number)) {
500 $accounting_account = $accountingaccountstatic->getNomUrl(0, 1, 1);
507 $total_debit += $line->debit;
508 $total_credit += $line->credit;
509 $opening_balance = isset($opening_balances[
"'".$line->numero_compte.
"'"]) ? $opening_balances[
"'".$line->numero_compte.
"'"] : 0;
510 $total_opening_balance += $opening_balance;
512 $tmparrayforrootaccount =
$object->getRootAccount($line->numero_compte);
513 $root_account_description = $tmparrayforrootaccount[
'label'];
514 $root_account_number = $tmparrayforrootaccount[
'account_number'];
519 if (empty($accountingaccountstatic->label) && $accountingaccountstatic->id > 0) {
520 $link =
'<a class="editfielda reposition" href="' . DOL_URL_ROOT .
'/accountancy/admin/card.php?action=update&token=' . newToken() .
'&id=' . $accountingaccountstatic->id .
'">' .
img_edit() .
'</a>';
521 } elseif ($accounting_account ==
'NotDefined') {
522 $link =
'<a href="' . DOL_URL_ROOT .
'/accountancy/admin/card.php?action=create&token=' . newToken() .
'&accountingaccount=' .
length_accountg($line->numero_compte) .
'">' .
img_edit_add() .
'</a>';
531 if (!empty($show_subgroup)) {
533 if (empty($displayed_account) || $root_account_number != $displayed_account) {
535 if ($displayed_account !=
"") {
536 print
'<tr class="liste_total">';
537 print
'<td class="right">'.$langs->trans(
"SubTotal").
':</td>';
542 print
'<td class="right nowraponall amount">'.price($sous_total_opening_balance).
'</td>';
544 print
'<td class="right nowraponall amount">'.price($sous_total_debit).
'</td>';
545 print
'<td class="right nowraponall amount">'.price($sous_total_credit).
'</td>';
547 print
'<td class="right nowraponall amount">'.price(
price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit)).
'</td>';
549 print
'<td class="right nowraponall amount">'.price(
price2num($sous_total_debit - $sous_total_credit)).
'</td>';
558 print
'<tr class="trforbreak">';
559 print
'<td colspan="'.($colspan + 1).
'" class="tdforbreak">'.$root_account_number.($root_account_description ?
' - '.$root_account_description :
'').
'</td>';
562 $displayed_account = $root_account_number;
563 $sous_total_debit = 0;
564 $sous_total_credit = 0;
565 $sous_total_opening_balance = 0;
569 print
'<tr class="oddeven">';
573 print
'<td class="center">';
579 if ($type ==
'sub') {
580 print
'<td>'.$line->subledger_account.
' <span class="opacitymedium">('.$line->subledger_label.
')</span></td>';
582 print
'<td>'.$accounting_account.
'</td>';
592 print
'<td class="right nowraponall amount">'.price(
price2num($opening_balance,
'MT')).
'</td>';
596 if ($type ==
'sub') {
597 if ($line->subledger_account) {
598 $urlzoom = DOL_URL_ROOT .
'/accountancy/bookkeeping/listbyaccount.php?type=sub&search_accountancy_code_start=' . urlencode($line->subledger_account) .
'&search_accountancy_code_end=' . urlencode($line->subledger_account);
599 if (GETPOSTISSET(
'date_startmonth')) {
600 $urlzoom .=
'&search_date_startmonth=' .
GETPOSTINT(
'date_startmonth') .
'&search_date_startday=' .
GETPOSTINT(
'date_startday') .
'&search_date_startyear=' .
GETPOSTINT(
'date_startyear');
602 if (GETPOSTISSET(
'date_endmonth')) {
603 $urlzoom .=
'&search_date_endmonth=' .
GETPOSTINT(
'date_endmonth') .
'&search_date_endday=' .
GETPOSTINT(
'date_endday') .
'&search_date_endyear=' .
GETPOSTINT(
'date_endyear');
607 if ($line->numero_compte) {
608 $urlzoom = DOL_URL_ROOT .
'/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . urlencode($line->numero_compte) .
'&search_accountancy_code_end=' . urlencode($line->numero_compte);
609 if (GETPOSTISSET(
'date_startmonth')) {
610 $urlzoom .=
'&search_date_startmonth=' .
GETPOSTINT(
'date_startmonth') .
'&search_date_startday=' .
GETPOSTINT(
'date_startday') .
'&search_date_startyear=' .
GETPOSTINT(
'date_startyear');
612 if (GETPOSTISSET(
'date_endmonth')) {
613 $urlzoom .=
'&search_date_endmonth=' .
GETPOSTINT(
'date_endmonth') .
'&search_date_endday=' .
GETPOSTINT(
'date_endday') .
'&search_date_endyear=' .
GETPOSTINT(
'date_endyear');
618 print
'<td class="right nowraponall amount"><a href="'.$urlzoom.
'">'.
price(
price2num($line->debit,
'MT')).
'</a></td>';
620 print
'<td class="right nowraponall amount"><a href="'.$urlzoom.
'">'.
price(
price2num($line->credit,
'MT')).
'</a></td>';
623 print
'<td class="right nowraponall amount">'.price(
price2num($opening_balance + $line->debit - $line->credit,
'MT')).
'</td>';
625 print
'<td class="right nowraponall amount">'.price(
price2num($line->debit - $line->credit,
'MT')).
'</td>';
630 print
'<td class="center">';
638 $sous_total_debit += $line->debit;
639 $sous_total_credit += $line->credit;
640 $sous_total_opening_balance += $opening_balance;
643 if (!empty($show_subgroup)) {
644 print
'<tr class="liste_total">';
649 print
'<td class="right">'.$langs->trans(
"SubTotal").
':</td>';
651 print
'<td class="right nowraponall amount">'.price(
price2num($sous_total_opening_balance,
'MT')).
'</td>';
653 print
'<td class="right nowraponall amount">'.price(
price2num($sous_total_debit,
'MT')).
'</td>';
654 print
'<td class="right nowraponall amount">'.price(
price2num($sous_total_credit,
'MT')).
'</td>';
656 print
'<td class="right nowraponall amount">' .
price(
price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit,
'MT')) .
'</td>';
658 print
'<td class="right nowraponall amount">' .
price(
price2num($sous_total_debit - $sous_total_credit,
'MT')) .
'</td>';
667 print
'<tr class="liste_total">';
672 print
'<td class="right">'.$langs->trans(
"AccountBalance").
':</td>';
674 print
'<td class="nowrap right">'.price(
price2num($total_opening_balance,
'MT')).
'</td>';
676 print
'<td class="right nowraponall amount">'.price(
price2num($total_debit,
'MT')).
'</td>';
677 print
'<td class="right nowraponall amount">'.price(
price2num($total_credit,
'MT')).
'</td>';
679 print
'<td class="right nowraponall amount">' .
price(
price2num($total_opening_balance + $total_debit - $total_credit,
'MT')) .
'</td>';
681 print
'<td class="right nowraponall amount">' .
price(
price2num($total_debit - $total_credit,
'MT')) .
'</td>';
690 if (
getDolGlobalString(
'ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT')) {
691 print
'<tr class="liste_total">';
695 print
'<td class="right">' . $langs->trans(
"AccountingResult") .
':</td>';
700 $accountingResult =
$object->accountingResult($search_date_start, $search_date_end);
701 if ($accountingResult < 0) {
702 $accountingResultDebit =
price(abs((
float)
price2num($accountingResult,
'MT')));
703 $accountingResultCredit =
'';
704 $accountingResultClassCSS =
' error';
706 $accountingResultDebit =
'';
707 $accountingResultCredit =
price(
price2num($accountingResult,
'MT'));
708 $accountingResultClassCSS =
' green';
710 print
'<td class="right nowraponall amount' . $accountingResultClassCSS .
'">' . $accountingResultDebit .
'</td>';
711 print
'<td class="right nowraponall amount' . $accountingResultClassCSS .
'">' . $accountingResultCredit .
'</td>';
720 $parameters = array();
721 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
722 print $hookmanager->resPrint;
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
length_accounta($accounta)
Return Auxiliary accounting account of thirdparties with defined length.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage accounting accounts.
Class to manage Ledger (General Ledger and Subledger)
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_edit_add($titlealt='default', $other='')
Show logo +.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.