dolibarr  19.0.0-dev
listbyaccount.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr>
3  * Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
4  * Copyright (C) 2013-2020 Florian Henry <florian.henry@open-concept.pro>
5  * Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
6  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
28 // Load Dolibarr environment
29 require '../../main.inc.php';
30 
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
38 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
39 
40 // Load translation files required by the page
41 $langs->loadLangs(array("accountancy", "compta"));
42 
43 $action = GETPOST('action', 'aZ09');
44 $socid = GETPOST('socid', 'int');
45 $massaction = GETPOST('massaction', 'alpha');
46 $confirm = GETPOST('confirm', 'alpha');
47 $toselect = GETPOST('toselect', 'array');
48 $type = GETPOST('type', 'alpha');
49 if ($type == 'sub') {
50  $context_default = 'bookkeepingbysubaccountlist';
51 } else {
52  $context_default = 'bookkeepingbyaccountlist';
53 }
54 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : $context_default;
55 $search_date_startyear = GETPOST('search_date_startyear', 'int');
56 $search_date_startmonth = GETPOST('search_date_startmonth', 'int');
57 $search_date_startday = GETPOST('search_date_startday', 'int');
58 $search_date_endyear = GETPOST('search_date_endyear', 'int');
59 $search_date_endmonth = GETPOST('search_date_endmonth', 'int');
60 $search_date_endday = GETPOST('search_date_endday', 'int');
61 $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
62 $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
63 $search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
64 $search_date_export_startyear = GETPOST('search_date_export_startyear', 'int');
65 $search_date_export_startmonth = GETPOST('search_date_export_startmonth', 'int');
66 $search_date_export_startday = GETPOST('search_date_export_startday', 'int');
67 $search_date_export_endyear = GETPOST('search_date_export_endyear', 'int');
68 $search_date_export_endmonth = GETPOST('search_date_export_endmonth', 'int');
69 $search_date_export_endday = GETPOST('search_date_export_endday', 'int');
70 $search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
71 $search_date_export_end = dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
72 $search_date_validation_startyear = GETPOST('search_date_validation_startyear', 'int');
73 $search_date_validation_startmonth = GETPOST('search_date_validation_startmonth', 'int');
74 $search_date_validation_startday = GETPOST('search_date_validation_startday', 'int');
75 $search_date_validation_endyear = GETPOST('search_date_validation_endyear', 'int');
76 $search_date_validation_endmonth = GETPOST('search_date_validation_endmonth', 'int');
77 $search_date_validation_endday = GETPOST('search_date_validation_endday', 'int');
78 $search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear);
79 $search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
80 $search_import_key = GETPOST("search_import_key", 'alpha');
81 
82 $search_account_category = GETPOST('search_account_category', 'int');
83 
84 $search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
85 if ($search_accountancy_code_start == - 1) {
86  $search_accountancy_code_start = '';
87 }
88 $search_accountancy_code_end = GETPOST('search_accountancy_code_end', 'alpha');
89 if ($search_accountancy_code_end == - 1) {
90  $search_accountancy_code_end = '';
91 }
92 $search_doc_ref = GETPOST('search_doc_ref', 'alpha');
93 $search_label_operation = GETPOST('search_label_operation', 'alpha');
94 $search_mvt_num = GETPOST('search_mvt_num', 'int');
95 $search_direction = GETPOST('search_direction', 'alpha');
96 $search_ledger_code = GETPOST('search_ledger_code', 'array');
97 $search_debit = GETPOST('search_debit', 'alpha');
98 $search_credit = GETPOST('search_credit', 'alpha');
99 $search_lettering_code = GETPOST('search_lettering_code', 'alpha');
100 $search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
101 
102 if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
103  $action = 'delbookkeepingyear';
104 }
105 
106 // Load variable for pagination
107 $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
108 $sortfield = GETPOST('sortfield', 'aZ09comma');
109 $sortorder = GETPOST('sortorder', 'aZ09comma');
110 $optioncss = GETPOST('optioncss', 'alpha');
111 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
112 if (empty($page) || $page < 0) {
113  $page = 0;
114 }
115 $offset = $limit * $page;
116 $pageprev = $page - 1;
117 $pagenext = $page + 1;
118 if ($sortorder == "") {
119  $sortorder = "ASC";
120 }
121 if ($sortfield == "") {
122  $sortfield = "t.doc_date,t.rowid";
123 }
124 
125 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
126 $object = new BookKeeping($db);
127 $formfile = new FormFile($db);
128 $hookmanager->initHooks(array($context_default));
129 
130 $formaccounting = new FormAccounting($db);
131 $form = new Form($db);
132 
133 if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('search_date_startday') && !GETPOSTISSET('search_date_startmonth') && !GETPOSTISSET('search_date_starthour')) {
134  $sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
135  $sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
136  $sql .= $db->plimit(1);
137  $res = $db->query($sql);
138 
139  if ($res->num_rows > 0) {
140  $fiscalYear = $db->fetch_object($res);
141  $search_date_start = strtotime($fiscalYear->date_start);
142  $search_date_end = strtotime($fiscalYear->date_end);
143  } else {
144  $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
145  $year_start = dol_print_date(dol_now(), '%Y');
146  if (dol_print_date(dol_now(), '%m') < $month_start) {
147  $year_start--; // If current month is lower that starting fiscal month, we start last year
148  }
149  $year_end = $year_start + 1;
150  $month_end = $month_start - 1;
151  if ($month_end < 1) {
152  $month_end = 12;
153  $year_end--;
154  }
155  $search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
156  $search_date_end = dol_get_last_day($year_end, $month_end);
157  }
158 }
159 
160 $arrayfields = array(
161  // 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
162  't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
163  't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
164  't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
165  't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
166  't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
167  't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1),
168  't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1),
169  't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
170  't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
171  't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
172  't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100),
173 );
174 
175 if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
176  unset($arrayfields['t.lettering_code']);
177 }
178 
179 if ($search_date_start && empty($search_date_startyear)) {
180  $tmparray = dol_getdate($search_date_start);
181  $search_date_startyear = $tmparray['year'];
182  $search_date_startmonth = $tmparray['mon'];
183  $search_date_startday = $tmparray['mday'];
184 }
185 if ($search_date_end && empty($search_date_endyear)) {
186  $tmparray = dol_getdate($search_date_end);
187  $search_date_endyear = $tmparray['year'];
188  $search_date_endmonth = $tmparray['mon'];
189  $search_date_endday = $tmparray['mday'];
190 }
191 
192 if (!isModEnabled('accounting')) {
193  accessforbidden();
194 }
195 if ($user->socid > 0) {
196  accessforbidden();
197 }
198 if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
199  accessforbidden();
200 }
201 
202 $error = 0;
203 
204 
205 /*
206  * Action
207  */
208 
209 $param = '';
210 
211 if (GETPOST('cancel', 'alpha')) {
212  $action = 'list';
213  $massaction = '';
214 }
215 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto' && $massaction != 'preunletteringmanual' && $massaction != 'predeletebookkeepingwriting') {
216  $massaction = '';
217 }
218 
219 $parameters = array('socid'=>$socid);
220 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
221 if ($reshook < 0) {
222  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
223 }
224 
225 if (empty($reshook)) {
226  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
227 
228  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
229  $search_doc_date = '';
230  $search_account_category = '';
231  $search_accountancy_code_start = '';
232  $search_accountancy_code_end = '';
233  $search_label_account = '';
234  $search_doc_ref = '';
235  $search_label_operation = '';
236  $search_mvt_num = '';
237  $search_direction = '';
238  $search_ledger_code = array();
239  $search_date_start = '';
240  $search_date_end = '';
241  $search_date_startyear = '';
242  $search_date_startmonth = '';
243  $search_date_startday = '';
244  $search_date_endyear = '';
245  $search_date_endmonth = '';
246  $search_date_endday = '';
247  $search_date_export_start = '';
248  $search_date_export_end = '';
249  $search_date_export_startyear = '';
250  $search_date_export_startmonth = '';
251  $search_date_export_startday = '';
252  $search_date_export_endyear = '';
253  $search_date_export_endmonth = '';
254  $search_date_export_endday = '';
255  $search_date_validation_start = '';
256  $search_date_validation_end = '';
257  $search_date_validation_startyear = '';
258  $search_date_validation_startmonth = '';
259  $search_date_validation_startday = '';
260  $search_date_validation_endyear = '';
261  $search_date_validation_endmonth = '';
262  $search_date_validation_endday = '';
263  $search_debit = '';
264  $search_credit = '';
265  $search_lettering_code = '';
266  $search_not_reconciled = '';
267  $search_import_key = '';
268  $toselect = array();
269  }
270 
271  // Must be after the remove filter action, before the export.
272  $filter = array();
273 
274  if (!empty($search_date_start)) {
275  $filter['t.doc_date>='] = $search_date_start;
276  $param .= '&search_date_startmonth='.$search_date_startmonth.'&search_date_startday='.$search_date_startday.'&search_date_startyear='.$search_date_startyear;
277  }
278  if (!empty($search_date_end)) {
279  $filter['t.doc_date<='] = $search_date_end;
280  $param .= '&search_date_endmonth='.$search_date_endmonth.'&search_date_endday='.$search_date_endday.'&search_date_endyear='.$search_date_endyear;
281  }
282  if (!empty($search_doc_date)) {
283  $filter['t.doc_date'] = $search_doc_date;
284  $param .= '&doc_datemonth='.GETPOST('doc_datemonth', 'int').'&doc_dateday='.GETPOST('doc_dateday', 'int').'&doc_dateyear='.GETPOST('doc_dateyear', 'int');
285  }
286  if ($search_account_category != '-1' && !empty($search_account_category)) {
287  require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php';
288  $accountingcategory = new AccountancyCategory($db);
289 
290  $listofaccountsforgroup = $accountingcategory->getCptsCat(0, 'fk_accounting_category = '.((int) $search_account_category));
291  $listofaccountsforgroup2 = array();
292  if (is_array($listofaccountsforgroup)) {
293  foreach ($listofaccountsforgroup as $tmpval) {
294  $listofaccountsforgroup2[] = "'".$db->escape($tmpval['id'])."'";
295  }
296  }
297  $filter['t.search_accounting_code_in'] = join(',', $listofaccountsforgroup2);
298  $param .= '&search_account_category='.urlencode($search_account_category);
299  }
300  if (!empty($search_accountancy_code_start)) {
301  if ($type == 'sub') {
302  $filter['t.subledger_account>='] = $search_accountancy_code_start;
303  } else {
304  $filter['t.numero_compte>='] = $search_accountancy_code_start;
305  }
306  $param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
307  }
308  if (!empty($search_accountancy_code_end)) {
309  if ($type == 'sub') {
310  $filter['t.subledger_account<='] = $search_accountancy_code_end;
311  } else {
312  $filter['t.numero_compte<='] = $search_accountancy_code_end;
313  }
314  $param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
315  }
316  if (!empty($search_label_account)) {
317  $filter['t.label_compte'] = $search_label_account;
318  $param .= '&search_label_compte='.urlencode($search_label_account);
319  }
320  if (!empty($search_mvt_num)) {
321  $filter['t.piece_num'] = $search_mvt_num;
322  $param .= '&search_mvt_num='.urlencode($search_mvt_num);
323  }
324  if (!empty($search_doc_ref)) {
325  $filter['t.doc_ref'] = $search_doc_ref;
326  $param .= '&search_doc_ref='.urlencode($search_doc_ref);
327  }
328  if (!empty($search_label_operation)) {
329  $filter['t.label_operation'] = $search_label_operation;
330  $param .= '&search_label_operation='.urlencode($search_label_operation);
331  }
332  if (!empty($search_direction)) {
333  $filter['t.sens'] = $search_direction;
334  $param .= '&search_direction='.urlencode($search_direction);
335  }
336  if (!empty($search_ledger_code)) {
337  $filter['t.code_journal'] = $search_ledger_code;
338  foreach ($search_ledger_code as $code) {
339  $param .= '&search_ledger_code[]='.urlencode($code);
340  }
341  }
342  if (!empty($search_debit)) {
343  $filter['t.debit'] = $search_debit;
344  $param .= '&search_debit='.urlencode($search_debit);
345  }
346  if (!empty($search_credit)) {
347  $filter['t.credit'] = $search_credit;
348  $param .= '&search_credit='.urlencode($search_credit);
349  }
350  if (!empty($search_lettering_code)) {
351  $filter['t.lettering_code'] = $search_lettering_code;
352  $param .= '&search_lettering_code='.urlencode($search_lettering_code);
353  }
354  if (!empty($search_not_reconciled)) {
355  $filter['t.reconciled_option'] = $search_not_reconciled;
356  $param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
357  }
358  if (!empty($search_date_export_start)) {
359  $filter['t.date_export>='] = $search_date_export_start;
360  $param .= '&search_date_export_startmonth='.$search_date_export_startmonth.'&search_date_export_startday='.$search_date_export_startday.'&search_date_export_startyear='.$search_date_export_startyear;
361  }
362  if (!empty($search_date_export_end)) {
363  $filter['t.date_export<='] = $search_date_export_end;
364  $param .= '&search_date_export_endmonth='.$search_date_export_endmonth.'&search_date_export_endday='.$search_date_export_endday.'&search_date_export_endyear='.$search_date_export_endyear;
365  }
366  if (!empty($search_date_validation_start)) {
367  $filter['t.date_validated>='] = $search_date_validation_start;
368  $param .= '&search_date_validation_startmonth='.$search_date_validation_startmonth.'&search_date_validation_startday='.$search_date_validation_startday.'&search_date_validation_startyear='.$search_date_validation_startyear;
369  }
370  if (!empty($search_date_validation_end)) {
371  $filter['t.date_validated<='] = $search_date_validation_end;
372  $param .= '&search_date_validation_endmonth='.$search_date_validation_endmonth.'&search_date_validation_endday='.$search_date_validation_endday.'&search_date_validation_endyear='.$search_date_validation_endyear;
373  }
374  if (!empty($search_import_key)) {
375  $filter['t.import_key'] = $search_import_key;
376  $param .= '&search_import_key='.urlencode($search_import_key);
377  }
378  // param with type of list
379  $url_param = substr($param, 1); // remove first "&"
380  if (!empty($type)) {
381  $param = '&type='.$type.$param;
382  }
383 
384  //if ($action == 'delbookkeepingyearconfirm' && $user->hasRight('accounting', 'mouvements', 'supprimer')_tous) {
385  // $delmonth = GETPOST('delmonth', 'int');
386  // $delyear = GETPOST('delyear', 'int');
387  // if ($delyear == -1) {
388  // $delyear = 0;
389  // }
390  // $deljournal = GETPOST('deljournal', 'alpha');
391  // if ($deljournal == -1) {
392  // $deljournal = 0;
393  // }
394  //
395  // if (!empty($delmonth) || !empty($delyear) || !empty($deljournal)) {
396  // $result = $object->deleteByYearAndJournal($delyear, $deljournal, '', ($delmonth > 0 ? $delmonth : 0));
397  // if ($result < 0) {
398  // setEventMessages($object->error, $object->errors, 'errors');
399  // } else {
400  // setEventMessages("RecordDeleted", null, 'mesgs');
401  // }
402  //
403  // // Make a redirect to avoid to launch the delete later after a back button
404  // header("Location: ".$_SERVER["PHP_SELF"].($param ? '?'.$param : ''));
405  // exit;
406  // } else {
407  // setEventMessages("NoRecordDeleted", null, 'warnings');
408  // }
409  //}
410 
411  // Mass actions
412  $objectclass = 'Bookkeeping';
413  $objectlabel = 'Bookkeeping';
414  $permissiontoread = $user->hasRight('societe', 'lire');
415  $permissiontodelete = $user->hasRight('societe', 'supprimer');
416  $permissiontoadd = $user->hasRight('societe', 'creer');
417  $uploaddir = $conf->societe->dir_output;
418  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
419 
420  if (!$error && $action == 'deletebookkeepingwriting' && $confirm == "yes" && $user->hasRight('accounting', 'mouvements', 'supprimer')) {
421  $db->begin();
422 
423  if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
424  $lettering = new Lettering($db);
425  $nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true);
426  if ($nb_lettering < 0) {
427  setEventMessages('', $lettering->errors, 'errors');
428  $error++;
429  }
430  }
431 
432  $nbok = 0;
433  if (!$error) {
434  foreach ($toselect as $toselectid) {
435  $result = $object->fetch($toselectid);
436  if ($result > 0 && (!isset($object->date_validation) || $object->date_validation === '')) {
437  $result = $object->deleteMvtNum($object->piece_num);
438  if ($result > 0) {
439  $nbok++;
440  } else {
441  setEventMessages($object->error, $object->errors, 'errors');
442  $error++;
443  break;
444  }
445  } elseif ($result < 0) {
446  setEventMessages($object->error, $object->errors, 'errors');
447  $error++;
448  break;
449  }
450  }
451  }
452 
453  if (!$error) {
454  $db->commit();
455 
456  // Message for elements well deleted
457  if ($nbok > 1) {
458  setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
459  } elseif ($nbok > 0) {
460  setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
461  } elseif (!$error) {
462  setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs');
463  }
464 
465  header("Location: ".$_SERVER["PHP_SELF"]."?noreset=1".($param ? '&'.$param : ''));
466  exit;
467  } else {
468  $db->rollback();
469  }
470  }
471 
472  // others mass actions
473  if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
474  if ($massaction == 'letteringauto') {
475  $lettering = new Lettering($db);
476  $nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
477  if ($nb_lettering < 0) {
478  setEventMessages('', $lettering->errors, 'errors');
479  $error++;
480  $nb_lettering = max(0, abs($nb_lettering) - 2);
481  } elseif ($nb_lettering == 0) {
482  $nb_lettering = 0;
483  setEventMessages($langs->trans('AccountancyNoLetteringModified'), array(), 'mesgs');
484  }
485  if ($nb_lettering == 1) {
486  setEventMessages($langs->trans('AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
487  } elseif ($nb_lettering > 1) {
488  setEventMessages($langs->trans('AccountancyLetteringModifiedSuccessfully', $nb_lettering), array(), 'mesgs');
489  }
490 
491  if (!$error) {
492  header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
493  exit();
494  }
495  } elseif ($massaction == 'letteringmanual') {
496  $lettering = new Lettering($db);
497  $result = $lettering->updateLettering($toselect);
498  if ($result < 0) {
499  setEventMessages('', $lettering->errors, 'errors');
500  } else {
501  setEventMessages($langs->trans('AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
502  header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
503  exit();
504  }
505  } elseif ($action == 'unletteringauto' && $confirm == "yes") {
506  $lettering = new Lettering($db);
507  $nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true);
508  if ($nb_lettering < 0) {
509  setEventMessages('', $lettering->errors, 'errors');
510  $error++;
511  $nb_lettering = max(0, abs($nb_lettering) - 2);
512  } elseif ($nb_lettering == 0) {
513  $nb_lettering = 0;
514  setEventMessages($langs->trans('AccountancyNoUnletteringModified'), array(), 'mesgs');
515  }
516  if ($nb_lettering == 1) {
517  setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs');
518  } elseif ($nb_lettering > 1) {
519  setEventMessages($langs->trans('AccountancyUnletteringModifiedSuccessfully', $nb_lettering), array(), 'mesgs');
520  }
521 
522  if (!$error) {
523  header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
524  exit();
525  }
526  } elseif ($action == 'unletteringmanual' && $confirm == "yes") {
527  $lettering = new Lettering($db);
528  $nb_lettering = $lettering->deleteLettering($toselect);
529  if ($result < 0) {
530  setEventMessages('', $lettering->errors, 'errors');
531  } else {
532  setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs');
533  header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
534  exit();
535  }
536  }
537  }
538 }
539 
540 
541 /*
542  * View
543  */
544 
545 $formaccounting = new FormAccounting($db);
546 $formfile = new FormFile($db);
547 $formother = new FormOther($db);
548 $form = new Form($db);
549 
550 $title_page = $langs->trans("Operations").' - '.$langs->trans("VueByAccountAccounting").' (';
551 if ($type == 'sub') {
552  $title_page .= $langs->trans("BookkeepingSubAccount");
553 } else {
554  $title_page .= $langs->trans("Bookkeeping");
555 }
556 $title_page .= ')';
557 
558 llxHeader('', $title_page);
559 
560 // List
561 $nbtotalofrecords = '';
562 if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
563  // TODO Perf Replace this by a count
564  if ($type == 'sub') {
565  $nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 1, 1);
566  } else {
567  $nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 0, 1);
568  }
569 
570  if ($nbtotalofrecords < 0) {
571  setEventMessages($object->error, $object->errors, 'errors');
572  $error++;
573  }
574 }
575 
576 if (!$error) {
577  if ($type == 'sub') {
578  $result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1);
579  } else {
580  $result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 0);
581  }
582 
583  if ($result < 0) {
584  setEventMessages($object->error, $object->errors, 'errors');
585  }
586 }
587 
588 $arrayofselected = is_array($toselect) ? $toselect : array();
589 
590 $num = count($object->lines);
591 
592 
594 // $form_question = array();
595 // $delyear = GETPOST('delyear', 'int');
596 // $deljournal = GETPOST('deljournal', 'alpha');
597 //
598 // if (empty($delyear)) {
599 // $delyear = dol_print_date(dol_now(), '%Y');
600 // }
601 // $month_array = array();
602 // for ($i = 1; $i <= 12; $i++) {
603 // $month_array[$i] = $langs->trans("Month".sprintf("%02d", $i));
604 // }
605 // $year_array = $formaccounting->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
606 // $journal_array = $formaccounting->select_journal($deljournal, 'deljournal', '', 1, 1, 1, '', 0, 1);
607 //
608 // $form_question['delmonth'] = array(
609 // 'name' => 'delmonth',
610 // 'type' => 'select',
611 // 'label' => $langs->trans('DelMonth'),
612 // 'values' => $month_array,
613 // 'default' => ''
614 // );
615 // $form_question['delyear'] = array(
616 // 'name' => 'delyear',
617 // 'type' => 'select',
618 // 'label' => $langs->trans('DelYear'),
619 // 'values' => $year_array,
620 // 'default' => $delyear
621 // );
622 // $form_question['deljournal'] = array(
623 // 'name' => 'deljournal',
624 // 'type' => 'other', // We don't use select here, the journal_array is already a select html component
625 // 'label' => $langs->trans('DelJournal'),
626 // 'value' => $journal_array,
627 // 'default' => $deljournal
628 // );
629 //
630 // $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'delbookkeepingyearconfirm', $form_question, '', 1, 300);
631 //}
632 
633 // Print form confirm
635 print $formconfirm;
636 
637 // List of mass actions available
638 $arrayofmassactions = array();
639 if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
640  $arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto');
641  $arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto');
642  $arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual');
643  $arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual');
644 }
645 if ($user->hasRight('accounting', 'mouvements', 'supprimer')) {
646  $arrayofmassactions['predeletebookkeepingwriting'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
647 }
648 if (GETPOST('nomassaction', 'int') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'predeletebookkeepingwriting'))) {
649  $arrayofmassactions = array();
650 }
651 $massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
652 
653 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
654 print '<input type="hidden" name="token" value="'.newToken().'">';
655 print '<input type="hidden" name="action" value="list">';
656 if ($optioncss != '') {
657  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
658 }
659 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
660 print '<input type="hidden" name="type" value="'.$type.'">';
661 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
662 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
663 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
664 
665 $parameters = array('param' => $param);
666 $reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
667 if ($reshook < 0) {
668  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
669 }
670 
671 $newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
672 
673 if (empty($reshook)) {
674  $newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
675  if ($type == 'sub') {
676  $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
677  $newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
678  } else {
679  $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
680  $newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
681  }
682  $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
683 }
684 
685 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
686  $param .= '&contextpage='.urlencode($contextpage);
687 }
688 if ($limit > 0 && $limit != $conf->liste_limit) {
689  $param .= '&limit='.((int) $limit);
690 }
691 
692 print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
693 
694 if ($massaction == 'preunletteringauto') {
695  print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringAuto"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringauto", null, '', 0, 200, 500, 1);
696 } elseif ($massaction == 'preunletteringmanual') {
697  print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringManual"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringmanual", null, '', 0, 200, 500, 1);
698 } elseif ($massaction == 'predeletebookkeepingwriting') {
699  print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeleteBookkeepingWriting"), $langs->trans("ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)), "deletebookkeepingwriting", null, '', 0, 200, 500, 1);
700 }
701 //DeleteMvt=Supprimer des lignes d'opérations de la comptabilité
702 //DelMonth=Mois à effacer
703 //DelYear=Année à supprimer
704 //DelJournal=Journal à supprimer
705 //ConfirmDeleteMvt=Cette action supprime les lignes des opérations pour l'année/mois et/ou pour le journal sélectionné (au moins un critère est requis). Vous devrez utiliser de nouveau la fonctionnalité '%s' pour retrouver vos écritures dans la comptabilité.
706 //ConfirmDeleteMvtPartial=Cette action supprime l'écriture de la comptabilité (toutes les lignes opérations liées à une même écriture seront effacées).
707 
708 //$topicmail = "Information";
709 //$modelmail = "accountingbookkeeping";
710 //$objecttmp = new BookKeeping($db);
711 //$trackid = 'bk'.$object->id;
712 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
713 
714 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
715 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
716 if ($massactionbutton && $contextpage != 'poslist') {
717  $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
718 }
719 
720 // Reverse sort order
721 if (preg_match('/^asc/i', $sortorder)) {
722  $sortorder = "asc";
723 } else {
724  $sortorder = "desc";
725 }
726 
727 // Warning to explain why list of record is not consistent with the other list view (missing a lot of lines)
728 if ($type == 'sub') {
729  print info_admin($langs->trans("WarningRecordWithoutSubledgerAreExcluded"));
730 }
731 
732 $moreforfilter = '';
733 
734 // Search on accountancy custom groups or account
735 $moreforfilter .= '<div class="divsearchfield">';
736 $moreforfilter .= $langs->trans('AccountAccounting').': ';
737 $moreforfilter .= '<div class="nowrap inline-block">';
738 if ($type == 'sub') {
739  $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), 'maxwidth200');
740 } else {
741  $moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth200');
742 }
743 $moreforfilter .= ' ';
744 if ($type == 'sub') {
745  $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), 'maxwidth200');
746 } else {
747  $moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth200');
748 }
749 $moreforfilter .= '</div>';
750 $moreforfilter .= '</div>';
751 
752 $moreforfilter .= '<div class="divsearchfield">';
753 $moreforfilter .= $langs->trans('AccountingCategory').': ';
754 $moreforfilter .= '<div class="nowrap inline-block">';
755 $moreforfilter .= $formaccounting->select_accounting_category($search_account_category, 'search_account_category', 1, 0, 0, 0);
756 $moreforfilter .= '</div>';
757 $moreforfilter .= '</div>';
758 
759 $parameters = array();
760 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
761 if (empty($reshook)) {
762  $moreforfilter .= $hookmanager->resPrint;
763 } else {
764  $moreforfilter = $hookmanager->resPrint;
765 }
766 
767 print '<div class="liste_titre liste_titre_bydiv centpercent">';
768 print $moreforfilter;
769 print '</div>';
770 
771 print '<div class="div-table-responsive">';
772 print '<table class="tagtable liste centpercent">';
773 
774 // Filters lines
775 print '<tr class="liste_titre_filter">';
776 // Action column
777 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
778  print '<td class="liste_titre center">';
779  $searchpicto = $form->showFilterButtons('left');
780  print $searchpicto;
781  print '</td>';
782 }
783 // Movement number
784 if (!empty($arrayfields['t.piece_num']['checked'])) {
785  print '<td class="liste_titre"><input type="text" name="search_mvt_num" class="width50" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
786 }
787 // Code journal
788 if (!empty($arrayfields['t.code_journal']['checked'])) {
789  print '<td class="liste_titre center">';
790  print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'maxwidth75');
791  print '</td>';
792 }
793 // Date document
794 if (!empty($arrayfields['t.doc_date']['checked'])) {
795  print '<td class="liste_titre center">';
796  print '<div class="nowrap">';
797  print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
798  print '</div>';
799  print '<div class="nowrap">';
800  print $form->selectDate($search_date_end, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
801  print '</div>';
802  print '</td>';
803 }
804 // Ref document
805 if (!empty($arrayfields['t.doc_ref']['checked'])) {
806  print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_doc_ref" value="'.dol_escape_htmltag($search_doc_ref).'"/></td>';
807 }
808 // Label operation
809 if (!empty($arrayfields['t.label_operation']['checked'])) {
810  print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_operation" value="'.dol_escape_htmltag($search_label_operation).'"/></td>';
811 }
812 // Debit
813 if (!empty($arrayfields['t.debit']['checked'])) {
814  print '<td class="liste_titre right"><input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'"></td>';
815 }
816 // Credit
817 if (!empty($arrayfields['t.credit']['checked'])) {
818  print '<td class="liste_titre right"><input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'"></td>';
819 }
820 // Lettering code
821 if (!empty($arrayfields['t.lettering_code']['checked'])) {
822  print '<td class="liste_titre center">';
823  print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
824  print '<br><span class="nowrap"><input type="checkbox" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
825  print '</td>';
826 }
827 // Date export
828 if (!empty($arrayfields['t.date_export']['checked'])) {
829  print '<td class="liste_titre center">';
830  print '<div class="nowrap">';
831  print $form->selectDate($search_date_export_start, 'search_date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
832  print '</div>';
833  print '<div class="nowrap">';
834  print $form->selectDate($search_date_export_end, 'search_date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
835  print '</div>';
836  print '</td>';
837 }
838 // Date validation
839 if (!empty($arrayfields['t.date_validated']['checked'])) {
840  print '<td class="liste_titre center">';
841  print '<div class="nowrap">';
842  print $form->selectDate($search_date_validation_start, 'search_date_validation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
843  print '</div>';
844  print '<div class="nowrap">';
845  print $form->selectDate($search_date_validation_end, 'search_date_validation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
846  print '</div>';
847  print '</td>';
848 }
849 if (!empty($arrayfields['t.import_key']['checked'])) {
850  print '<td class="liste_titre center">';
851  print '<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">';
852  print '</td>';
853 }
854 
855 // Fields from hook
856 $parameters = array('arrayfields'=>$arrayfields);
857 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
858 print $hookmanager->resPrint;
859 
860 // Action column
861 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
862  print '<td class="liste_titre center">';
863  $searchpicto = $form->showFilterButtons();
864  print $searchpicto;
865  print '</td>';
866 }
867 print "</tr>\n";
868 
869 print '<tr class="liste_titre">';
870 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
871  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
872 }
873 if (!empty($arrayfields['t.piece_num']['checked'])) {
874  print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder, 'tdoverflowmax80imp ');
875 }
876 if (!empty($arrayfields['t.code_journal']['checked'])) {
877  print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
878 }
879 if (!empty($arrayfields['t.doc_date']['checked'])) {
880  print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
881 }
882 if (!empty($arrayfields['t.doc_ref']['checked'])) {
883  print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
884 }
885 if (!empty($arrayfields['t.label_operation']['checked'])) {
886  print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
887 }
888 if (!empty($arrayfields['t.debit']['checked'])) {
889  print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
890 }
891 if (!empty($arrayfields['t.credit']['checked'])) {
892  print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
893 }
894 if (!empty($arrayfields['t.lettering_code']['checked'])) {
895  print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
896 }
897 if (!empty($arrayfields['t.date_export']['checked'])) {
898  print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center ');
899 }
900 if (!empty($arrayfields['t.date_validated']['checked'])) {
901  print_liste_field_titre($arrayfields['t.date_validated']['label'], $_SERVER['PHP_SELF'], "t.date_validated", "", $param, '', $sortfield, $sortorder, 'center ');
902 }
903 if (!empty($arrayfields['t.import_key']['checked'])) {
904  print_liste_field_titre($arrayfields['t.import_key']['label'], $_SERVER["PHP_SELF"], "t.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
905 }
906 // Hook fields
907 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
908 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
909 print $hookmanager->resPrint;
910 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
911  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
912 }
913 print "</tr>\n";
914 
915 $displayed_account_number = null; // Start with undefined to be able to distinguish with empty
916 
917 // Loop on record
918 // --------------------------------------------------------------------
919 $i = 0;
920 
921 $totalarray = array();
922 $totalarray['val'] = array ();
923 $totalarray['nbfield'] = 0;
924 $total_debit = 0;
925 $total_credit = 0;
926 $sous_total_debit = 0;
927 $sous_total_credit = 0;
928 $totalarray['val']['totaldebit'] = 0;
929 $totalarray['val']['totalcredit'] = 0;
930 
931 while ($i < min($num, $limit)) {
932  $line = $object->lines[$i];
933 
934  $total_debit += $line->debit;
935  $total_credit += $line->credit;
936 
937  if ($type == 'sub') {
938  $accountg = length_accounta($line->subledger_account);
939  } else {
940  $accountg = length_accountg($line->numero_compte);
941  }
942  //if (empty($accountg)) $accountg = '-';
943 
944  $colspan = 0; // colspan before field 'label of operation'
945  $colspanend = 3; // colspan after debit/credit
946  if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; }
947  if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; }
948  if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; }
949  if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; }
950  if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; }
951  if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; }
952  if (!empty($arrayfields['t.date_validating']['checked'])) { $colspanend++; }
953  if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; }
954  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
955  $colspan++;
956  $colspanend--;
957  }
958 
959  // Is it a break ?
960  if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
961  // Show a subtotal by accounting account
962  if (isset($displayed_account_number)) {
963  print '<tr class="liste_total">';
964  if ($type == 'sub') {
965  print '<td class="right" colspan="' . $colspan . '">' . $langs->trans("TotalForAccount") . ' ' . length_accounta($displayed_account_number) . ':</td>';
966  } else {
967  print '<td class="right" colspan="' . $colspan . '">' . $langs->trans("TotalForAccount") . ' ' . length_accountg($displayed_account_number) . ':</td>';
968  }
969  print '<td class="nowrap right">'.price(price2num($sous_total_debit, 'MT')).'</td>';
970  print '<td class="nowrap right">'.price(price2num($sous_total_credit, 'MT')).'</td>';
971  print '<td colspan="'.$colspanend.'"></td>';
972  print '</tr>';
973  // Show balance of last shown account
974  $balance = $sous_total_debit - $sous_total_credit;
975  print '<tr class="liste_total">';
976  print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
977  if ($balance > 0) {
978  print '<td class="nowraponall right">';
979  print price(price2num($sous_total_debit - $sous_total_credit, 'MT'));
980  print '</td>';
981  print '<td></td>';
982  } else {
983  print '<td></td>';
984  print '<td class="nowraponall right">';
985  print price(price2num($sous_total_credit - $sous_total_debit, 'MT'));
986  print '</td>';
987  }
988  print '<td colspan="'.$colspanend.'"></td>';
989  print '</tr>';
990  }
991 
992  // Show the break account
993  print '<tr class="trforbreak">';
994  print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : count($arrayfields)+1).'" class="tdforbreak">';
995  if ($type == 'sub') {
996  if ($line->subledger_account != "" && $line->subledger_account != '-1') {
997  print empty($line->subledger_label) ? '<span class="error">'.$langs->trans("Unknown").'</span>' : $line->subledger_label;
998  print ' : ';
999  print length_accounta($line->subledger_account);
1000  } else {
1001  // Should not happen: subledger account must be null or a non empty value
1002  print '<span class="error">' . $langs->trans("Unknown");
1003  if ($line->subledger_label) {
1004  print ' (' . $line->subledger_label . ')';
1005  $htmltext = 'EmptyStringForSubledgerAccountButSubledgerLabelDefined';
1006  } else {
1007  $htmltext = 'EmptyStringForSubledgerAccountAndSubledgerLabel';
1008  }
1009  print $form->textwithpicto('', $htmltext);
1010  print '</span>';
1011  }
1012  } else {
1013  if ($line->numero_compte != "" && $line->numero_compte != '-1') {
1014  print length_accountg($line->numero_compte) . ' : ' . $object->get_compte_desc($line->numero_compte);
1015  } else {
1016  print '<span class="error">' . $langs->trans("Unknown") . '</span>';
1017  }
1018  }
1019  print '</td>';
1020  print '</tr>';
1021 
1022  $displayed_account_number = $accountg;
1023  //if (empty($displayed_account_number)) $displayed_account_number='-';
1024  $sous_total_debit = 0;
1025  $sous_total_credit = 0;
1026 
1027  $colspan = 0;
1028  }
1029 
1030  print '<tr class="oddeven">';
1031  // Action column
1032  if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1033  print '<td class="nowraponall center">';
1034  if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1035  $selected = 0;
1036  if (in_array($line->id, $arrayofselected)) {
1037  $selected = 1;
1038  }
1039  print '<input id="cb' . $line->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id . '"' . ($selected ? ' checked="checked"' : '') . ' />';
1040  }
1041  print '</td>';
1042  if (!$i) {
1043  $totalarray['nbfield']++;
1044  }
1045  }
1046  // Piece number
1047  if (!empty($arrayfields['t.piece_num']['checked'])) {
1048  print '<td>';
1049  $object->id = $line->id;
1050  $object->piece_num = $line->piece_num;
1051  print $object->getNomUrl(1, '', 0, '', 1);
1052  print '</td>';
1053  if (!$i) {
1054  $totalarray['nbfield']++;
1055  }
1056  }
1057 
1058  // Journal code
1059  if (!empty($arrayfields['t.code_journal']['checked'])) {
1060  $accountingjournal = new AccountingJournal($db);
1061  $result = $accountingjournal->fetch('', $line->code_journal);
1062  $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
1063  print '<td class="center tdoverflowmax80">'.$journaltoshow.'</td>';
1064  if (!$i) {
1065  $totalarray['nbfield']++;
1066  }
1067  }
1068 
1069  // Document date
1070  if (!empty($arrayfields['t.doc_date']['checked'])) {
1071  print '<td class="center">'.dol_print_date($line->doc_date, 'day').'</td>';
1072  if (!$i) {
1073  $totalarray['nbfield']++;
1074  }
1075  }
1076 
1077  // Document ref
1078  if (!empty($arrayfields['t.doc_ref']['checked'])) {
1079  if ($line->doc_type == 'customer_invoice') {
1080  $langs->loadLangs(array('bills'));
1081 
1082  require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1083  $objectstatic = new Facture($db);
1084  $objectstatic->fetch($line->fk_doc);
1085  //$modulepart = 'facture';
1086 
1087  $filename = dol_sanitizeFileName($line->doc_ref);
1088  $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
1089  $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
1090  $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1091  } elseif ($line->doc_type == 'supplier_invoice') {
1092  $langs->loadLangs(array('bills'));
1093 
1094  require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
1095  $objectstatic = new FactureFournisseur($db);
1096  $objectstatic->fetch($line->fk_doc);
1097  //$modulepart = 'invoice_supplier';
1098 
1099  $filename = dol_sanitizeFileName($line->doc_ref);
1100  $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
1101  $subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
1102  $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
1103  } elseif ($line->doc_type == 'expense_report') {
1104  $langs->loadLangs(array('trips'));
1105 
1106  require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
1107  $objectstatic = new ExpenseReport($db);
1108  $objectstatic->fetch($line->fk_doc);
1109  //$modulepart = 'expensereport';
1110 
1111  $filename = dol_sanitizeFileName($line->doc_ref);
1112  $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
1113  $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
1114  $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1115  } elseif ($line->doc_type == 'bank') {
1116  require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
1117  $objectstatic = new AccountLine($db);
1118  $objectstatic->fetch($line->fk_doc);
1119  } else {
1120  // Other type
1121  }
1122 
1123  print '<td class="maxwidth400">';
1124 
1125  print '<table class="nobordernopadding"><tr class="nocellnopadd">';
1126  // Picto + Ref
1127  print '<td class="nobordernopadding">';
1128 
1129  if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') {
1130  print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
1131  print $documentlink;
1132  } elseif ($line->doc_type == 'bank') {
1133  print $objectstatic->getNomUrl(1);
1134  $bank_ref = strstr($line->doc_ref, '-');
1135  print " " . $bank_ref;
1136  } else {
1137  print $line->doc_ref;
1138  }
1139  print '</td></tr></table>';
1140 
1141  print "</td>\n";
1142  if (!$i) {
1143  $totalarray['nbfield']++;
1144  }
1145  }
1146 
1147  // Label operation
1148  if (!empty($arrayfields['t.label_operation']['checked'])) {
1149  // Affiche un lien vers la facture client/fournisseur
1150  $doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
1151  print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>'.$line->label_operation.'</td>' : '<td>'.$line->label_operation.'<br><span style="font-size:0.8em">('.length_accounta($line->subledger_account).')</span></td>';
1152  if (!$i) {
1153  $totalarray['nbfield']++;
1154  }
1155  }
1156 
1157  // Amount debit
1158  if (!empty($arrayfields['t.debit']['checked'])) {
1159  print '<td class="right nowraponall amount">'.($line->debit != 0 ? price($line->debit) : '').'</td>';
1160  if (!$i) {
1161  $totalarray['nbfield']++;
1162  }
1163  if (!$i) {
1164  $totalarray['pos'][$totalarray['nbfield']] = 'totaldebit';
1165  }
1166  $totalarray['val']['totaldebit'] += $line->debit;
1167  }
1168 
1169  // Amount credit
1170  if (!empty($arrayfields['t.credit']['checked'])) {
1171  print '<td class="right nowraponall amount">'.($line->credit != 0 ? price($line->credit) : '').'</td>';
1172  if (!$i) {
1173  $totalarray['nbfield']++;
1174  }
1175  if (!$i) {
1176  $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit';
1177  }
1178  $totalarray['val']['totalcredit'] += $line->credit;
1179  }
1180 
1181  // Lettering code
1182  if (!empty($arrayfields['t.lettering_code']['checked'])) {
1183  print '<td class="center">'.$line->lettering_code.'</td>';
1184  if (!$i) {
1185  $totalarray['nbfield']++;
1186  }
1187  }
1188 
1189  // Exported operation date
1190  if (!empty($arrayfields['t.date_export']['checked'])) {
1191  print '<td class="center">'.dol_print_date($line->date_export, 'dayhour').'</td>';
1192  if (!$i) {
1193  $totalarray['nbfield']++;
1194  }
1195  }
1196 
1197  // Validated operation date
1198  if (!empty($arrayfields['t.date_validated']['checked'])) {
1199  print '<td class="center">'.dol_print_date($line->date_validation, 'dayhour').'</td>';
1200  if (!$i) {
1201  $totalarray['nbfield']++;
1202  }
1203  }
1204 
1205  if (!empty($arrayfields['t.import_key']['checked'])) {
1206  print '<td class="tdoverflowmax100">'.$line->import_key."</td>\n";
1207  if (!$i) {
1208  $totalarray['nbfield']++;
1209  }
1210  }
1211 
1212  // Fields from hook
1213  $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$line);
1214  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
1215  print $hookmanager->resPrint;
1216 
1217  // Action column
1218  if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1219  print '<td class="nowraponall center">';
1220  if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1221  $selected = 0;
1222  if (in_array($line->id, $arrayofselected)) {
1223  $selected = 1;
1224  }
1225  print '<input id="cb' . $line->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id . '"' . ($selected ? ' checked="checked"' : '') . ' />';
1226  }
1227  print '</td>';
1228  if (!$i) {
1229  $totalarray['nbfield']++;
1230  }
1231  }
1232 
1233  // Comptabilise le sous-total
1234  $sous_total_debit += $line->debit;
1235  $sous_total_credit += $line->credit;
1236 
1237  print "</tr>\n";
1238 
1239  $i++;
1240 }
1241 
1242 if ($num > 0 && $colspan > 0) {
1243  print '<tr class="liste_total">';
1244  print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
1245  print '<td class="nowrap right">'.price(price2num($sous_total_debit, 'MT')).'</td>';
1246  print '<td class="nowrap right">'.price(price2num($sous_total_credit, 'MT')).'</td>';
1247  print '<td colspan="'.$colspanend.'"></td>';
1248  print '</tr>';
1249  // Show balance of last shown account
1250  $balance = $sous_total_debit - $sous_total_credit;
1251  print '<tr class="liste_total">';
1252  print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
1253  if ($balance > 0) {
1254  print '<td class="nowraponall right">';
1255  print price(price2num($sous_total_debit - $sous_total_credit, 'MT'));
1256  print '</td>';
1257  print '<td></td>';
1258  } else {
1259  print '<td></td>';
1260  print '<td class="nowraponall right">';
1261  print price(price2num($sous_total_credit - $sous_total_debit, 'MT'));
1262  print '</td>';
1263  }
1264  print '<td colspan="'.$colspanend.'"></td>';
1265  print '</tr>';
1266 }
1267 
1268 
1269 // Clean total values to round them
1270 if (!empty($totalarray['val']['totaldebit'])) {
1271  $totalarray['val']['totaldebit'] = price2num($totalarray['val']['totaldebit'], 'MT');
1272 }
1273 if (!empty($totalarray['val']['totalcredit'])) {
1274  $totalarray['val']['totalcredit'] = price2num($totalarray['val']['totalcredit'], 'MT');
1275 }
1276 
1277 
1278 // Show total line
1279 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1280 
1281 // If no record found
1282 if ($num == 0) {
1283  $colspan = 1;
1284  foreach ($arrayfields as $key => $val) {
1285  if (!empty($val['checked'])) {
1286  $colspan++;
1287  }
1288  }
1289  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1290 }
1291 
1292 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
1293 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1294 print $hookmanager->resPrint;
1295 
1296 print "</table>";
1297 print '</div>';
1298 
1299 // TODO Replace this with mass delete action
1300 //if ($user->hasRight('accounting', 'mouvements, 'supprimer_tous')) {
1301 // print '<div class="tabsAction tabsActionNoBottom">'."\n";
1302 // print '<a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear&token='.newToken().($param ? '&'.$param : '').'">'.$langs->trans("DeleteMvt").'</a>';
1303 // print '</div>';
1304 //}
1305 
1306 print '</form>';
1307 
1308 // End of page
1309 llxFooter();
1310 $db->close();
length_accounta
length_accounta($accounta)
Return Auxiliary accounting account of thirdparties with defined length.
Definition: accounting.lib.php:133
dol_getdate
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
Definition: functions.lib.php:2925
dol_sanitizeFileName
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
Definition: functions.lib.php:1323
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:70
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:609
FactureFournisseur
Class to manage suppliers invoices.
Definition: fournisseur.facture.class.php:51
AccountancyCategory
Class to manage categories of an accounting account.
Definition: accountancycategory.class.php:32
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
FormOther
Classe permettant la generation de composants html autre Only common components are here.
Definition: html.formother.class.php:39
Facture
Class to manage invoices.
Definition: facture.class.php:60
FormAccounting
Class to manage generation of HTML components for accounting management.
Definition: html.formaccounting.class.php:33
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5955
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2675
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:4135
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
get_exdir
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
Definition: functions.lib.php:6882
$formconfirm
$formconfirm
if ($action == 'delbookkeepingyear') {
Definition: listbyaccount.php:634
FormFile
Class to offer components to list and upload files.
Definition: html.formfile.class.php:36
AccountingJournal
Class to manage accounting journals.
Definition: accountingjournal.class.php:27
dolGetButtonTitle
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.
Definition: functions.lib.php:11263
length_accountg
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
Definition: accounting.lib.php:94
print_barre_liste
print_barre_liste($titre, $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.
Definition: functions.lib.php:5530
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
Definition: functions.lib.php:8673
$sql
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
Definition: index.php:746
dol_get_last_day
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Definition: date.lib.php:595
info_admin
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
Definition: functions.lib.php:5063
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:207
BookKeeping
Class to manage Ledger (General Ledger and Subledger)
Definition: bookkeeping.class.php:33
getDolGlobalString
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
Definition: functions.lib.php:142
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:509
print_liste_field_titre
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Definition: functions.lib.php:5295
Lettering
Class Lettering.
Definition: lettering.class.php:34
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:53
AccountLine
Class to manage bank transaction lines.
Definition: account.class.php:1874
ExpenseReport
Class to manage Trips and Expenses.
Definition: expensereport.class.php:36
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:3056
price
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.
Definition: functions.lib.php:5829
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
Definition: security.lib.php:1169
dol_mktime
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
Definition: functions.lib.php:2968
getDolGlobalInt
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
Definition: functions.lib.php:156