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';
50$langs->loadLangs(array(
"accountancy",
"compta"));
52$action =
GETPOST(
'action',
'aZ09');
53$optioncss =
GETPOST(
'optioncss',
'alpha');
54$type =
GETPOST(
'type',
'alpha');
56 $context_default =
'balancesubaccountlist';
58 $context_default =
'balancelist';
60$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : $context_default;
61$show_subgroup =
GETPOST(
'show_subgroup',
'alpha');
63$search_date_start =
GETPOSTDATE(
'date_start',
'getpost',
'auto',
'search_date_start_accountancy');
64$search_date_end =
GETPOSTDATE(
'date_end',
'getpostend',
'auto',
'search_date_end_accountancy');
66$search_ledger_code =
GETPOST(
'search_ledger_code',
'array');
67$search_accountancy_code_start =
GETPOST(
'search_accountancy_code_start',
'alpha');
68if ($search_accountancy_code_start == - 1) {
69 $search_accountancy_code_start =
'';
71$search_accountancy_code_end =
GETPOST(
'search_accountancy_code_end',
'alpha');
72if ($search_accountancy_code_end == - 1) {
73 $search_accountancy_code_end =
'';
75$search_not_reconciled =
GETPOST(
'search_not_reconciled',
'alpha');
79$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
80$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
82if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
86$offset = $limit * $page;
89if ($sortorder ==
"") {
92if ($sortfield ==
"") {
93 $sortfield =
"t.numero_compte";
98$hookmanager->initHooks(array($contextpage));
103if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET(
'formfilteraction')) {
104 $sql =
"SELECT date_start, date_end";
105 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_fiscalyear ";
107 $sql .=
" WHERE rowid = " .
getDolGlobalInt(
'ACCOUNTANCY_FISCALYEAR_DEFAULT');
109 $sql .=
" WHERE date_start < '" .
$db->idate(
dol_now()) .
"' and date_end > '" .
$db->idate(
dol_now()) .
"'";
111 $sql .=
$db->plimit(1);
112 $res =
$db->query($sql);
114 if (
$db->num_rows($res) > 0) {
115 $fiscalYear =
$db->fetch_object($res);
116 $search_date_start = strtotime($fiscalYear->date_start);
117 $search_date_end = strtotime($fiscalYear->date_end);
124 $year_end = $year_start + 1;
125 $month_end = $month_start - 1;
126 if ($month_end < 1) {
130 $search_date_start =
dol_mktime(0, 0, 0, $month_start, 1, $year_start);
138if ($user->socid > 0) {
141if (!$user->hasRight(
'accounting',
'mouvements',
'lire')) {
146$permissiontoread = $user->hasRight(
'accounting',
'mouvements',
'lire');
147$permissiontoadd = $user->hasRight(
'accounting',
'mouvements',
'creer');
148$permissiontodelete = $user->hasRight(
'accounting',
'mouvements',
'supprimer');
149$permissiontoexport = $user->hasRight(
'accounting',
'mouvements',
'export');
158$parameters = array();
159$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
166if (empty($reshook)) {
167 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
169 $search_date_start =
'';
170 $search_date_end =
'';
171 $search_accountancy_code_start =
'';
172 $search_accountancy_code_end =
'';
173 $search_not_reconciled =
'';
174 $search_ledger_code = array();
175 unset($_SESSION[
'DOLDATE_search_date_start_accountancy_day']);
176 unset($_SESSION[
'DOLDATE_search_date_start_accountancy_month']);
177 unset($_SESSION[
'DOLDATE_search_date_start_accountancy_year']);
178 unset($_SESSION[
'DOLDATE_search_date_end_accountancy_day']);
179 unset($_SESSION[
'DOLDATE_search_date_end_accountancy_month']);
180 unset($_SESSION[
'DOLDATE_search_date_end_accountancy_year']);
183 if (!empty($search_date_start)) {
184 $filter[
't.doc_date>='] = $search_date_start;
185 $param .=
'&date_startmonth=' .
GETPOSTINT(
'date_startmonth') .
'&date_startday=' .
GETPOSTINT(
'date_startday') .
'&date_startyear=' .
GETPOSTINT(
'date_startyear');
187 if (!empty($search_date_end)) {
188 $filter[
't.doc_date<='] = $search_date_end;
189 $param .=
'&date_endmonth=' .
GETPOSTINT(
'date_endmonth') .
'&date_endday=' .
GETPOSTINT(
'date_endday') .
'&date_endyear=' .
GETPOSTINT(
'date_endyear');
191 if (!empty($search_accountancy_code_start)) {
192 if ($type ==
'sub') {
193 $filter[
't.subledger_account>='] = $search_accountancy_code_start;
195 $filter[
't.numero_compte>='] = $search_accountancy_code_start;
197 $param .=
'&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
199 if (!empty($search_accountancy_code_end)) {
200 if ($type ==
'sub') {
201 $filter[
't.subledger_account<='] = $search_accountancy_code_end;
203 $filter[
't.numero_compte<='] = $search_accountancy_code_end;
205 $param .=
'&search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
207 if (!empty($search_ledger_code)) {
208 $filter[
't.code_journal'] = $search_ledger_code;
209 foreach ($search_ledger_code as $code) {
210 $param .=
'&search_ledger_code[]=' . urlencode($code);
213 if (!empty($search_not_reconciled)) {
214 $filter[
't.reconciled_option'] = $search_not_reconciled;
215 $param .=
'&search_not_reconciled='.urlencode($search_not_reconciled);
217 if (!empty($show_subgroup)) {
218 $param .=
'&show_subgroup='.urlencode($show_subgroup);
222 $url_param = substr($param, 1);
224 $param =
'&type=' . $type . $param;
228if ($action ==
'export' && $user->hasRight(
'accounting',
'mouvements',
'lire')) {
229 $exportType =
GETPOST(
'export_type');
231 if ($type ==
'sub') {
232 $result =
$object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter,
'AND', 1);
234 $result =
$object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter);
240 if ($exportType ===
'csv') {
242 $filename =
'balance';
243 $type_export =
'balance';
244 include DOL_DOCUMENT_ROOT.
'/accountancy/tpl/export_journal.tpl.php';
246 foreach (
$object->lines as $line) {
247 if ($type ==
'sub') {
249 print
'"' . $line->subledger_label .
'"' . $sep;
252 print
'"' .
$object->get_compte_desc($line->numero_compte) .
'"' . $sep;
254 print
'"'.price($line->debit).
'"'.$sep;
255 print
'"'.price($line->credit).
'"'.$sep;
256 print
'"'.price($line->debit - $line->credit).
'"'.$sep;
261 require_once DOL_DOCUMENT_ROOT .
'/core/modules/accountancy/doc/pdf_balance.modules.php';
264 if (empty($pdf->fromDate)) {
268 if (empty($pdf->toDate)) {
271 $pdf->balanceType = $type;
273 $result = $pdf->write_file($object, $langs);
290 $title_page = $langs->trans(
"AccountBalanceSubAccount");
292 $title_page = $langs->trans(
"AccountBalance");
295$help_url =
'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double';
297llxHeader(
'', $title_page, $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy accountancy-consultation page-'.(($type ==
'sub') ?
'sub' :
'').
'balance');
300if ($action !=
'export') {
302 $nbtotalofrecords =
'';
304 if ($type ==
'sub') {
305 $nbtotalofrecords =
$object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter,
'AND', 1);
307 $nbtotalofrecords =
$object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
310 if ($nbtotalofrecords < 0) {
315 if ($type ==
'sub') {
316 $result =
$object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter,
'AND', 1);
318 $result =
$object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter);
325 print
'<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
326 print
'<input type="hidden" name="token" value="'.newToken().
'">';
327 print
'<input type="hidden" name="action" id="action" value="list">';
328 print
'<input type="hidden" name="export_type" id="export_type" value="">';
329 if ($optioncss !=
'') {
330 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
332 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
333 print
'<input type="hidden" name="type" value="'.$type.
'">';
334 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
335 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
336 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
337 print
'<input type="hidden" name="page" value="'.$page.
'">';
341 $parameters = array();
342 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
348 $newcardbutton = empty($hookmanager->resPrint) ?
'' : $hookmanager->resPrint;
350 if (empty($reshook)) {
351 if ($type ==
'sub') {
352 $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'));
353 $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'));
355 $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'));
356 $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'));
359 $newcardbutton .= dolGetButtonTitle($langs->trans(
"Export").
' (' .
getDolGlobalString(
'ACCOUNTING_EXPORT_FORMAT').
')',
'',
'fa fa-file-csv paddingleft', $_SERVER[
'PHP_SELF'],
'exportcsvbutton', $permissiontoexport, array(
'morecss' =>
'marginleftonly'));
361 print
'<script type="text/javascript">
362 jQuery(document).ready(function() {
363 jQuery("#exportcsvbutton, #exportpdfbutton").click(function(event) {
364 event.preventDefault();
365 const exportType = this.id === "exportcsvbutton" ? "csv" : "pdf";
366 console.log("Set action to export, export_type to " + exportType);
367 jQuery("#action").val("export");
368 jQuery("#export_type").val(exportType);
369 jQuery("#searchFormList").submit();
370 jQuery("#action").val("list");
375 $newcardbutton .= dolGetButtonTitle($langs->trans(
'ExportToPdf'),
'',
'fa fa-file-pdf paddingleft', $_SERVER[
'PHP_SELF'] .
'&token=' . newToken(),
'exportpdfbutton', $permissiontoexport, array(
'morecss' =>
'marginleftonly'));
377 $newcardbutton .= dolGetButtonTitleSeparator();
378 $newcardbutton .= dolGetButtonTitle($langs->trans(
'NewAccountingMvt'),
'',
'fa fa-plus-circle paddingleft', DOL_URL_ROOT.
'/accountancy/bookkeeping/card.php?action=create'.(!empty($type)?
'&type=sub':
'').
'&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
380 if ($contextpage != $_SERVER[
"PHP_SELF"]) {
381 $param .=
'&contextpage='.urlencode($contextpage);
383 if ($limit > 0 && $limit !=
$conf->liste_limit) {
384 $param .=
'&limit='.((int) $limit);
387 print_barre_liste($title_page, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $result, $nbtotalofrecords,
'title_accountancy', 0, $newcardbutton,
'', $limit, 0, 0, 1);
389 $selectedfields =
'';
392 if ($type ==
'sub') {
393 print
info_admin($langs->trans(
"WarningRecordWithoutSubledgerAreExcluded"));
398 $moreforfilter .=
'<div class="divsearchfield">';
399 $moreforfilter .= $langs->trans(
'DateStart').
': ';
400 $moreforfilter .= $form->selectDate($search_date_start ? $search_date_start : -1,
'date_start', 0, 0, 1,
'', 1, 0);
401 $moreforfilter .= $langs->trans(
'DateEnd').
': ';
402 $moreforfilter .= $form->selectDate($search_date_end ? $search_date_end : -1,
'date_end', 0, 0, 1,
'', 1, 0);
403 $moreforfilter .=
'</div>';
405 $moreforfilter .=
'<div class="divsearchfield">';
406 $moreforfilter .=
'<label for="show_subgroup">'.$langs->trans(
'ShowSubtotalByGroup').
'</label>: ';
407 $moreforfilter .=
'<input type="checkbox" name="show_subgroup" id="show_subgroup" value="show_subgroup"'.($show_subgroup ==
'show_subgroup' ?
' checked' :
'').
'>';
408 $moreforfilter .=
'</div>';
410 $moreforfilter .=
'<div class="divsearchfield">';
411 $moreforfilter .= $langs->trans(
"Journals").
': ';
412 $moreforfilter .= $formaccounting->multi_select_journal($search_ledger_code,
'search_ledger_code', 0, 1, 1, 1);
413 $moreforfilter .=
'</div>';
416 $moreforfilter .=
'<div class="divsearchfield">';
418 $moreforfilter .= $langs->trans(
'AccountAccounting').
': ';
419 if ($type ==
'sub') {
420 $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start,
'search_accountancy_code_start', $langs->trans(
'From'),
'maxwidth200');
422 $moreforfilter .= $formaccounting->select_account($search_accountancy_code_start,
'search_accountancy_code_start', $langs->trans(
'From'), array(), 1, 1,
'maxwidth200',
'accounts');
424 $moreforfilter .=
' ';
425 if ($type ==
'sub') {
426 $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end,
'search_accountancy_code_end', $langs->trans(
'to'),
'maxwidth200');
428 $moreforfilter .= $formaccounting->select_account($search_accountancy_code_end,
'search_accountancy_code_end', $langs->trans(
'to'), array(), 1, 1,
'maxwidth200',
'accounts');
430 $moreforfilter .=
'</div>';
433 $moreforfilter .=
'<div class="divsearchfield">';
434 $moreforfilter .=
'<label for="notreconciled">'.$langs->trans(
'NotReconciled').
'</label>: ';
435 $moreforfilter .=
'<input type="checkbox" name="search_not_reconciled" id="notreconciled" value="notreconciled"'.($search_not_reconciled ==
'notreconciled' ?
' checked' :
'').
'>';
436 $moreforfilter .=
'</div>';
439 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
440 print $moreforfilter;
441 $parameters = array();
442 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
443 print $hookmanager->resPrint;
449 print
'<table class="liste '.($moreforfilter ?
"listwithfilterbefore" :
"").
'">';
451 print
'<tr class="liste_titre_filter">';
453 if (
$conf->main_checkbox_left_column) {
454 print
'<td class="liste_titre maxwidthsearch">';
455 $searchpicto = $form->showFilterButtons();
460 print
'<td class="liste_titre" colspan="'.$colspan.
'">';
464 $parameters = array();
465 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
466 print $hookmanager->resPrint;
469 if (!
$conf->main_checkbox_left_column) {
470 print
'<td class="liste_titre maxwidthsearch">';
471 $searchpicto = $form->showFilterButtons();
477 print
'<tr class="liste_titre">';
478 if (
$conf->main_checkbox_left_column) {
479 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
481 print_liste_field_titre(
"AccountAccounting", $_SERVER[
'PHP_SELF'],
"t.numero_compte",
"", $param,
"", $sortfield, $sortorder);
487 print_liste_field_titre(
"OpeningBalance", $_SERVER[
'PHP_SELF'],
"",
"", $param,
'class="right"', $sortfield, $sortorder);
489 print_liste_field_titre(
"AccountingDebit", $_SERVER[
'PHP_SELF'],
"t.debit",
"", $param,
'class="right"', $sortfield, $sortorder);
490 print_liste_field_titre(
"AccountingCredit", $_SERVER[
'PHP_SELF'],
"t.credit",
"", $param,
'class="right"', $sortfield, $sortorder);
491 print_liste_field_titre(
"Balance", $_SERVER[
"PHP_SELF"],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
494 $parameters = array(
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
495 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
496 print $hookmanager->resPrint;
498 if (!
$conf->main_checkbox_left_column) {
499 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
505 $sous_total_debit = 0;
506 $sous_total_credit = 0;
507 $total_opening_balance = 0;
508 $sous_total_opening_balance = 0;
509 $displayed_account =
"";
516 $sql =
"SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance";
517 $sql .=
" FROM " . MAIN_DB_PREFIX .
"accounting_bookkeeping as t";
518 $sql .=
" WHERE t.entity = " .
$conf->entity;
519 $sql .=
" AND t.doc_date < '" .
$db->idate($search_date_start) .
"'";
520 $sql .=
" GROUP BY t.numero_compte";
522 $resql =
$db->query($sql);
523 $opening_balances = array();
525 $nrows =
$db->num_rows($resql);
526 for ($i = 0; $i < $nrows; $i++) {
527 $arr =
$db->fetch_array($resql);
528 if (is_array($arr)) {
529 $opening_balances[
"'" . $arr[
'numero_compte'] .
"'"] = $arr[
'opening_balance'];
537 foreach (
$object->lines as $line) {
539 $accountingaccountstatic->id = 0;
540 $accountingaccountstatic->account_number =
'';
541 $accounting_account =
'';
543 if ($type !=
'sub') {
544 $accountingaccountstatic->fetch(0, $line->numero_compte,
true);
545 if (!empty($accountingaccountstatic->account_number)) {
546 $accounting_account = $accountingaccountstatic->getNomUrl(0, 1, 1);
553 $total_debit += $line->debit;
554 $total_credit += $line->credit;
555 $opening_balance = isset($opening_balances[
"'".$line->numero_compte.
"'"]) ? $opening_balances[
"'".$line->numero_compte.
"'"] : 0;
556 $total_opening_balance += $opening_balance;
558 $tmparrayforrootaccount =
$object->getRootAccount($line->numero_compte);
559 $root_account_description = $tmparrayforrootaccount[
'label'];
560 $root_account_number = $tmparrayforrootaccount[
'account_number'];
565 if (empty($accountingaccountstatic->label) && $accountingaccountstatic->id > 0) {
566 $link =
'<a class="editfielda reposition" href="' . DOL_URL_ROOT .
'/accountancy/admin/card.php?action=update&token=' . newToken() .
'&id=' . $accountingaccountstatic->id .
'">' .
img_edit() .
'</a>';
567 } elseif ($accounting_account ==
'NotDefined') {
568 $link =
'<a href="' . DOL_URL_ROOT .
'/accountancy/admin/card.php?action=create&token=' . newToken() .
'&accountingaccount=' .
length_accountg($line->numero_compte) .
'">' .
img_edit_add() .
'</a>';
577 if (!empty($show_subgroup)) {
579 if (empty($displayed_account) || $root_account_number != $displayed_account) {
581 if ($displayed_account !=
"") {
582 print
'<tr class="liste_total">';
583 print
'<td class="right">'.$langs->trans(
"SubTotal").
':</td>';
584 if (
$conf->main_checkbox_left_column) {
588 print
'<td class="right nowraponall amount">'.price($sous_total_opening_balance).
'</td>';
590 print
'<td class="right nowraponall amount">'.price($sous_total_debit).
'</td>';
591 print
'<td class="right nowraponall amount">'.price($sous_total_credit).
'</td>';
593 print
'<td class="right nowraponall amount">'.price(
price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit)).
'</td>';
595 print
'<td class="right nowraponall amount">'.price(
price2num($sous_total_debit - $sous_total_credit)).
'</td>';
597 if (!
$conf->main_checkbox_left_column) {
604 print
'<tr class="trforbreak">';
605 print
'<td colspan="'.($colspan + 1).
'" class="tdforbreak">'.$root_account_number.($root_account_description ?
' - '.$root_account_description :
'').
'</td>';
608 $displayed_account = $root_account_number;
609 $sous_total_debit = 0;
610 $sous_total_credit = 0;
611 $sous_total_opening_balance = 0;
615 print
'<tr class="oddeven">';
618 if (
$conf->main_checkbox_left_column) {
619 print
'<td class="center">';
625 if ($type ==
'sub') {
626 print
'<td>'.$line->subledger_account.
' <span class="opacitymedium">('.$line->subledger_label.
')</span></td>';
628 print
'<td>'.$accounting_account.
'</td>';
638 print
'<td class="right nowraponall amount">'.price(
price2num($opening_balance,
'MT')).
'</td>';
642 if ($type ==
'sub') {
643 if ($line->subledger_account) {
644 $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);
645 if (GETPOSTISSET(
'date_startmonth')) {
646 $urlzoom .=
'&search_date_startmonth=' .
GETPOSTINT(
'date_startmonth') .
'&search_date_startday=' .
GETPOSTINT(
'date_startday') .
'&search_date_startyear=' .
GETPOSTINT(
'date_startyear');
648 if (GETPOSTISSET(
'date_endmonth')) {
649 $urlzoom .=
'&search_date_endmonth=' .
GETPOSTINT(
'date_endmonth') .
'&search_date_endday=' .
GETPOSTINT(
'date_endday') .
'&search_date_endyear=' .
GETPOSTINT(
'date_endyear');
653 if ($line->numero_compte) {
654 $urlzoom = DOL_URL_ROOT .
'/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . urlencode($line->numero_compte) .
'&search_accountancy_code_end=' . urlencode($line->numero_compte);
655 if (GETPOSTISSET(
'date_startmonth')) {
656 $urlzoom .=
'&search_date_startmonth=' .
GETPOSTINT(
'date_startmonth') .
'&search_date_startday=' .
GETPOSTINT(
'date_startday') .
'&search_date_startyear=' .
GETPOSTINT(
'date_startyear');
658 if (GETPOSTISSET(
'date_endmonth')) {
659 $urlzoom .=
'&search_date_endmonth=' .
GETPOSTINT(
'date_endmonth') .
'&search_date_endday=' .
GETPOSTINT(
'date_endday') .
'&search_date_endyear=' .
GETPOSTINT(
'date_endyear');
664 print
'<td class="right nowraponall amount"><a href="'.$urlzoom.
'">'.
price(
price2num($line->debit,
'MT')).
'</a></td>';
666 print
'<td class="right nowraponall amount"><a href="'.$urlzoom.
'">'.
price(
price2num($line->credit,
'MT')).
'</a></td>';
669 print
'<td class="right nowraponall amount">'.price(
price2num($opening_balance + $line->debit - $line->credit,
'MT')).
'</td>';
671 print
'<td class="right nowraponall amount">'.price(
price2num($line->debit - $line->credit,
'MT')).
'</td>';
675 if (!
$conf->main_checkbox_left_column) {
676 print
'<td class="center">';
684 $sous_total_debit += $line->debit;
685 $sous_total_credit += $line->credit;
686 $sous_total_opening_balance += $opening_balance;
689 if (!empty($show_subgroup)) {
690 print
'<tr class="liste_total">';
692 if (
$conf->main_checkbox_left_column) {
695 print
'<td class="right">'.$langs->trans(
"SubTotal").
':</td>';
697 print
'<td class="right nowraponall amount">'.price(
price2num($sous_total_opening_balance,
'MT')).
'</td>';
699 print
'<td class="right nowraponall amount">'.price(
price2num($sous_total_debit,
'MT')).
'</td>';
700 print
'<td class="right nowraponall amount">'.price(
price2num($sous_total_credit,
'MT')).
'</td>';
702 print
'<td class="right nowraponall amount">' .
price(
price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit,
'MT')) .
'</td>';
704 print
'<td class="right nowraponall amount">' .
price(
price2num($sous_total_debit - $sous_total_credit,
'MT')) .
'</td>';
707 if (!
$conf->main_checkbox_left_column) {
713 print
'<tr class="liste_total">';
715 if (
$conf->main_checkbox_left_column) {
718 print
'<td class="right">'.$langs->trans(
"AccountBalance").
':</td>';
720 print
'<td class="nowrap right">'.price(
price2num($total_opening_balance,
'MT')).
'</td>';
722 print
'<td class="right nowraponall amount">'.price(
price2num($total_debit,
'MT')).
'</td>';
723 print
'<td class="right nowraponall amount">'.price(
price2num($total_credit,
'MT')).
'</td>';
725 print
'<td class="right nowraponall amount">' .
price(
price2num($total_opening_balance + $total_debit - $total_credit,
'MT')) .
'</td>';
727 print
'<td class="right nowraponall amount">' .
price(
price2num($total_debit - $total_credit,
'MT')) .
'</td>';
730 if (!
$conf->main_checkbox_left_column) {
736 if (
getDolGlobalString(
'ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT')) {
737 print
'<tr class="liste_total">';
738 if (
$conf->main_checkbox_left_column) {
741 print
'<td class="right">' . $langs->trans(
"AccountingResult") .
':</td>';
746 $accountingResult =
$object->accountingResult($search_date_start, $search_date_end);
747 if ($accountingResult < 0) {
748 $accountingResultDebit =
price(abs((
float)
price2num($accountingResult,
'MT')));
749 $accountingResultCredit =
'';
750 $accountingResultClassCSS =
' error';
752 $accountingResultDebit =
'';
753 $accountingResultCredit =
price(
price2num($accountingResult,
'MT'));
754 $accountingResultClassCSS =
' green';
756 print
'<td class="right nowraponall amount' . $accountingResultClassCSS .
'">' . $accountingResultDebit .
'</td>';
757 print
'<td class="right nowraponall amount' . $accountingResultClassCSS .
'">' . $accountingResultCredit .
'</td>';
760 if (!
$conf->main_checkbox_left_column) {
766 $parameters = array();
767 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
768 print $hookmanager->resPrint;
if(! $sortfield) if(! $sortorder) $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.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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)
Class to build sending documents with model Espadon.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_now($mode='gmt')
Return date for now.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTDATE($prefix, $hourTime='', $gm='auto', $saverestore='')
Helper function that combines values of a dolibarr DatePicker (such as Form\selectDate) for year,...
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='')
Show information in HTML for admin users or standard users.
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 '.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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 a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.