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