32require
'../../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeeping.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/lettering.class.php';
52$langs->loadLangs(array(
"accountancy",
"categories",
"compta"));
58$action =
GETPOST(
'action',
'aZ09');
59$massaction =
GETPOST(
'massaction',
'alpha');
60$confirm =
GETPOST(
'confirm',
'alpha');
61$toselect =
GETPOST(
'toselect',
'array');
62$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'bookkeepinglist';
65$search_mvt_num =
GETPOST(
'search_mvt_num',
'alpha');
66$search_doc_type =
GETPOST(
"search_doc_type",
'alpha');
67$search_doc_ref =
GETPOST(
"search_doc_ref",
'alpha');
68$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
69$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
70$search_date_startday =
GETPOSTINT(
'search_date_startday');
71$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
72$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
73$search_date_endday =
GETPOSTINT(
'search_date_endday');
74$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
75$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
77$search_date_creation_startyear =
GETPOSTINT(
'search_date_creation_startyear');
78$search_date_creation_startmonth =
GETPOSTINT(
'search_date_creation_startmonth');
79$search_date_creation_startday =
GETPOSTINT(
'search_date_creation_startday');
80$search_date_creation_endyear =
GETPOSTINT(
'search_date_creation_endyear');
81$search_date_creation_endmonth =
GETPOSTINT(
'search_date_creation_endmonth');
82$search_date_creation_endday =
GETPOSTINT(
'search_date_creation_endday');
83$search_date_creation_start =
dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear);
84$search_date_creation_end =
dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear);
85$search_date_modification_startyear =
GETPOSTINT(
'search_date_modification_startyear');
86$search_date_modification_startmonth =
GETPOSTINT(
'search_date_modification_startmonth');
87$search_date_modification_startday =
GETPOSTINT(
'search_date_modification_startday');
88$search_date_modification_endyear =
GETPOSTINT(
'search_date_modification_endyear');
89$search_date_modification_endmonth =
GETPOSTINT(
'search_date_modification_endmonth');
90$search_date_modification_endday =
GETPOSTINT(
'search_date_modification_endday');
91$search_date_modification_start =
dol_mktime(0, 0, 0, $search_date_modification_startmonth, $search_date_modification_startday, $search_date_modification_startyear);
92$search_date_modification_end =
dol_mktime(23, 59, 59, $search_date_modification_endmonth, $search_date_modification_endday, $search_date_modification_endyear);
93$search_date_export_startyear =
GETPOSTINT(
'search_date_export_startyear');
94$search_date_export_startmonth =
GETPOSTINT(
'search_date_export_startmonth');
95$search_date_export_startday =
GETPOSTINT(
'search_date_export_startday');
96$search_date_export_endyear =
GETPOSTINT(
'search_date_export_endyear');
97$search_date_export_endmonth =
GETPOSTINT(
'search_date_export_endmonth');
98$search_date_export_endday =
GETPOSTINT(
'search_date_export_endday');
99$search_date_export_start =
dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
100$search_date_export_end =
dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
101$search_date_validation_startyear =
GETPOSTINT(
'search_date_validation_startyear');
102$search_date_validation_startmonth =
GETPOSTINT(
'search_date_validation_startmonth');
103$search_date_validation_startday =
GETPOSTINT(
'search_date_validation_startday');
104$search_date_validation_endyear =
GETPOSTINT(
'search_date_validation_endyear');
105$search_date_validation_endmonth =
GETPOSTINT(
'search_date_validation_endmonth');
106$search_date_validation_endday =
GETPOSTINT(
'search_date_validation_endday');
107$search_date_validation_start =
dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear);
108$search_date_validation_end =
dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
110$search_date_due_start_day =
GETPOSTINT(
'search_date_due_start_day');
111$search_date_due_start_month =
GETPOSTINT(
'search_date_due_start_month');
112$search_date_due_start_year =
GETPOSTINT(
'search_date_due_start_year');
113$search_date_due_start =
dol_mktime(0, 0, 0, $search_date_due_start_month, $search_date_due_start_day, $search_date_due_start_year);
115$search_date_due_end_day =
GETPOSTINT(
'search_date_due_end_day');
116$search_date_due_end_month =
GETPOSTINT(
'search_date_due_end_month');
117$search_date_due_end_year =
GETPOSTINT(
'search_date_due_end_year');
118$search_date_due_end =
dol_mktime(23, 59, 59, $search_date_due_end_month, $search_date_due_end_day, $search_date_due_end_year);
119$search_import_key =
GETPOST(
"search_import_key",
'alpha');
121$search_account_category =
GETPOSTINT(
'search_account_category');
123$search_accountancy_code =
GETPOST(
"search_accountancy_code",
'alpha');
124$search_accountancy_code_start =
GETPOST(
'search_accountancy_code_start',
'alpha');
125if ($search_accountancy_code_start == - 1) {
126 $search_accountancy_code_start =
'';
128$search_accountancy_code_end =
GETPOST(
'search_accountancy_code_end',
'alpha');
129if ($search_accountancy_code_end == - 1) {
130 $search_accountancy_code_end =
'';
133$search_accountancy_aux_code =
GETPOST(
"search_accountancy_aux_code",
'alpha');
134$search_accountancy_aux_code_start =
GETPOST(
'search_accountancy_aux_code_start',
'alpha');
135if ($search_accountancy_aux_code_start == - 1) {
136 $search_accountancy_aux_code_start =
'';
138$search_accountancy_aux_code_end =
GETPOST(
'search_accountancy_aux_code_end',
'alpha');
139if ($search_accountancy_aux_code_end == - 1) {
140 $search_accountancy_aux_code_end =
'';
142$search_mvt_label =
GETPOST(
'search_mvt_label',
'alpha');
143$search_direction =
GETPOST(
'search_direction',
'alpha');
144$search_debit =
GETPOST(
'search_debit',
'alpha');
145$search_credit =
GETPOST(
'search_credit',
'alpha');
146$search_ledger_code =
GETPOST(
'search_ledger_code',
'array');
147$search_lettering_code =
GETPOST(
'search_lettering_code',
'alpha');
148$search_not_reconciled =
GETPOST(
'search_not_reconciled',
'alpha');
152$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
153$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
154$optioncss =
GETPOST(
'optioncss',
'alpha');
156if (empty($page) || $page < 0) {
159$offset = $limit * $page;
160$pageprev = $page - 1;
161$pagenext = $page + 1;
162if ($sortorder ==
"") {
165if ($sortfield ==
"") {
166 $sortfield =
"t.piece_num,t.rowid";
171$hookmanager->initHooks(array(
'bookkeepinglist'));
174$form =
new Form($db);
176if (!in_array($action, array(
'delmouv',
'delmouvconfirm')) && !GETPOSTISSET(
'begin') && !GETPOSTISSET(
'formfilteraction') &&
GETPOST(
'page',
'alpha') ==
'' && !
GETPOSTINT(
'noreset') && $user->hasRight(
'accounting',
'mouvements',
'export')) {
177 if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET(
'restore_lastsearch_values') && !
GETPOST(
'search_accountancy_code_start')) {
178 $query =
"SELECT date_start, date_end from ".MAIN_DB_PREFIX.
"accounting_fiscalyear ";
179 $query .=
" where date_start < '".$db->idate(
dol_now()).
"' and date_end > '".$db->idate(
dol_now()).
"' limit 1";
180 $res = $db->query($query);
182 if ($db->num_rows($res) > 0) {
183 $fiscalYear = $db->fetch_object($res);
184 $search_date_start = strtotime($fiscalYear->date_start);
185 $search_date_end = strtotime($fiscalYear->date_end);
192 $year_end = $year_start + 1;
193 $month_end = $month_start - 1;
194 if ($month_end < 1) {
198 $search_date_start =
dol_mktime(0, 0, 0, $month_start, 1, $year_start);
206 't.piece_num' => array(
'label' => $langs->trans(
"TransactionNumShort"),
'checked' => 1),
207 't.code_journal' => array(
'label' => $langs->trans(
"Codejournal"),
'checked' => 1),
208 't.doc_date' => array(
'label' => $langs->trans(
"Docdate"),
'checked' => 1),
209 't.doc_ref' => array(
'label' => $langs->trans(
"Piece"),
'checked' => 1),
210 't.numero_compte' => array(
'label' => $langs->trans(
"AccountAccountingShort"),
'checked' => 1),
211 't.subledger_account' => array(
'label' => $langs->trans(
"SubledgerAccount"),
'checked' => 1),
212 't.label_operation' => array(
'label' => $langs->trans(
"Label"),
'checked' => 1),
213 't.debit' => array(
'label' => $langs->trans(
"AccountingDebit"),
'checked' => 1),
214 't.credit' => array(
'label' => $langs->trans(
"AccountingCredit"),
'checked' => 1),
215 't.lettering_code' => array(
'label' => $langs->trans(
"LetteringCode"),
'checked' => 1),
216 't.date_creation' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' => 0),
217 't.tms' => array(
'label' => $langs->trans(
"DateModification"),
'checked' => 0),
218 't.date_export' => array(
'label' => $langs->trans(
"DateExport"),
'checked' => 0),
219 't.date_validated' => array(
'label' => $langs->trans(
"DateValidationAndLock"),
'checked' => 0,
'enabled' => !
getDolGlobalString(
"ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
220 't.date_lim_reglement' => array(
'label' => $langs->trans(
"DateDue"),
'checked' => 0),
221 't.import_key' => array(
'label' => $langs->trans(
"ImportId"),
'checked' => 0,
'position' => 1100),
225 unset($arrayfields[
't.lettering_code']);
230if (!isModEnabled(
'accounting')) {
233if ($user->socid > 0) {
236if (!$user->hasRight(
'accounting',
'mouvements',
'lire')) {
240$permissiontoadd = $user->hasRight(
'accounting',
'mouvements',
'creer');
249if (
GETPOST(
'cancel',
'alpha')) {
253if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'preunletteringauto' && $massaction !=
'preunletteringmanual' && $massaction !=
'predeletebookkeepingwriting') {
257$parameters = array(
'socid' => $socid);
258$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
263if (empty($reshook)) {
264 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
266 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
267 $search_mvt_num =
'';
268 $search_doc_type =
'';
269 $search_doc_ref =
'';
270 $search_doc_date =
'';
271 $search_account_category =
'';
272 $search_accountancy_code =
'';
273 $search_accountancy_code_start =
'';
274 $search_accountancy_code_end =
'';
275 $search_accountancy_aux_code =
'';
276 $search_accountancy_aux_code_start =
'';
277 $search_accountancy_aux_code_end =
'';
278 $search_mvt_label =
'';
279 $search_direction =
'';
280 $search_ledger_code = array();
281 $search_date_startyear =
'';
282 $search_date_startmonth =
'';
283 $search_date_startday =
'';
284 $search_date_endyear =
'';
285 $search_date_endmonth =
'';
286 $search_date_endday =
'';
287 $search_date_start =
'';
288 $search_date_end =
'';
289 $search_date_creation_startyear =
'';
290 $search_date_creation_startmonth =
'';
291 $search_date_creation_startday =
'';
292 $search_date_creation_endyear =
'';
293 $search_date_creation_endmonth =
'';
294 $search_date_creation_endday =
'';
295 $search_date_creation_start =
'';
296 $search_date_creation_end =
'';
297 $search_date_modification_startyear =
'';
298 $search_date_modification_startmonth =
'';
299 $search_date_modification_startday =
'';
300 $search_date_modification_endyear =
'';
301 $search_date_modification_endmonth =
'';
302 $search_date_modification_endday =
'';
303 $search_date_modification_start =
'';
304 $search_date_modification_end =
'';
305 $search_date_export_startyear =
'';
306 $search_date_export_startmonth =
'';
307 $search_date_export_startday =
'';
308 $search_date_export_endyear =
'';
309 $search_date_export_endmonth =
'';
310 $search_date_export_endday =
'';
311 $search_date_export_start =
'';
312 $search_date_export_end =
'';
313 $search_date_validation_startyear =
'';
314 $search_date_validation_startmonth =
'';
315 $search_date_validation_startday =
'';
316 $search_date_validation_endyear =
'';
317 $search_date_validation_endmonth =
'';
318 $search_date_validation_endday =
'';
319 $search_date_validation_start =
'';
320 $search_date_validation_end =
'';
322 $search_date_due_start_day =
'';
323 $search_date_due_start_month =
'';
324 $search_date_due_start_year =
'';
325 $search_date_due_start =
'';
327 $search_date_due_end_day =
'';
328 $search_date_due_end_month =
'';
329 $search_date_due_end_year =
'';
330 $search_date_due_end =
'';
333 $search_lettering_code =
'';
334 $search_not_reconciled =
'';
335 $search_import_key =
'';
341 if (!empty($search_date_start)) {
342 $filter[
't.doc_date>='] = $search_date_start;
344 $param .=
'&search_date_startmonth='.((int) $tmp[
'mon']).
'&search_date_startday='.((int) $tmp[
'mday']).
'&search_date_startyear='.((int) $tmp[
'year']);
346 if (!empty($search_date_end)) {
347 $filter[
't.doc_date<='] = $search_date_end;
349 $param .=
'&search_date_endmonth='.((int) $tmp[
'mon']).
'&search_date_endday='.((int) $tmp[
'mday']).
'&search_date_endyear='.((int) $tmp[
'year']);
351 if (!empty($search_doc_date)) {
352 $filter[
't.doc_date'] = $search_doc_date;
354 $param .=
'&doc_datemonth='.((int) $tmp[
'mon']).
'&doc_dateday='.((int) $tmp[
'mday']).
'&doc_dateyear='.((int) $tmp[
'year']);
356 if (!empty($search_doc_type)) {
357 $filter[
't.doc_type'] = $search_doc_type;
358 $param .=
'&search_doc_type='.urlencode($search_doc_type);
360 if (!empty($search_doc_ref)) {
361 $filter[
't.doc_ref'] = $search_doc_ref;
362 $param .=
'&search_doc_ref='.urlencode($search_doc_ref);
364 if ($search_account_category !=
'-1' && !empty($search_account_category)) {
365 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountancycategory.class.php';
368 $listofaccountsforgroup = $accountingcategory->getCptsCat(0,
'fk_accounting_category = '.((
int) $search_account_category));
369 $listofaccountsforgroup2 = array();
370 if (is_array($listofaccountsforgroup)) {
371 foreach ($listofaccountsforgroup as $tmpval) {
372 $listofaccountsforgroup2[] =
"'".$db->escape($tmpval[
'account_number']).
"'";
375 if (!empty($listofaccountsforgroup2)) {
376 $filter[
't.search_accounting_code_in'] = implode(
',', $listofaccountsforgroup2);
378 $filter[
't.search_accounting_code_in'] =
"''";
379 setEventMessages($langs->trans(
"ThisCategoryHasNoItems"),
null,
'warnings');
381 $param .=
'&search_account_category='.urlencode((
string) ($search_account_category));
383 if (!empty($search_accountancy_code)) {
384 $filter[
't.numero_compte'] = $search_accountancy_code;
385 $param .=
'&search_accountancy_code='.urlencode($search_accountancy_code);
387 if (!empty($search_accountancy_code_start)) {
388 $filter[
't.numero_compte>='] = $search_accountancy_code_start;
389 $param .=
'&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
391 if (!empty($search_accountancy_code_end)) {
392 $filter[
't.numero_compte<='] = $search_accountancy_code_end;
393 $param .=
'&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
395 if (!empty($search_accountancy_aux_code)) {
396 $filter[
't.subledger_account'] = $search_accountancy_aux_code;
397 $param .=
'&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
399 if (!empty($search_accountancy_aux_code_start)) {
400 $filter[
't.subledger_account>='] = $search_accountancy_aux_code_start;
401 $param .=
'&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
403 if (!empty($search_accountancy_aux_code_end)) {
404 $filter[
't.subledger_account<='] = $search_accountancy_aux_code_end;
405 $param .=
'&search_accountancy_aux_code_end='.urlencode($search_accountancy_aux_code_end);
407 if (!empty($search_mvt_label)) {
408 $filter[
't.label_operation'] = $search_mvt_label;
409 $param .=
'&search_mvt_label='.urlencode($search_mvt_label);
411 if (!empty($search_direction)) {
412 $filter[
't.sens'] = $search_direction;
413 $param .=
'&search_direction='.urlencode($search_direction);
415 if (!empty($search_ledger_code)) {
416 $filter[
't.code_journal'] = $search_ledger_code;
417 foreach ($search_ledger_code as $code) {
418 $param .=
'&search_ledger_code[]='.urlencode($code);
421 if (!empty($search_mvt_num)) {
422 $filter[
't.piece_num'] = $search_mvt_num;
423 $param .=
'&search_mvt_num='.urlencode((
string) ($search_mvt_num));
425 if (!empty($search_date_creation_start)) {
426 $filter[
't.date_creation>='] = $search_date_creation_start;
428 $param .=
'&search_date_creation_startmonth='.((int) $tmp[
'mon']).
'&search_date_creation_startday='.((int) $tmp[
'mday']).
'&search_date_creation_startyear='.((int) $tmp[
'year']);
430 if (!empty($search_date_creation_end)) {
431 $filter[
't.date_creation<='] = $search_date_creation_end;
433 $param .=
'&search_date_creation_endmonth='.((int) $tmp[
'mon']).
'&search_date_creation_endday='.((int) $tmp[
'mday']).
'&search_date_creation_endyear='.((int) $tmp[
'year']);
435 if (!empty($search_date_modification_start)) {
436 $filter[
't.tms>='] = $search_date_modification_start;
437 $tmp =
dol_getdate($search_date_modification_start);
438 $param .=
'&search_date_modification_startmonth='.((int) $tmp[
'mon']).
'&search_date_modification_startday='.((int) $tmp[
'mday']).
'&search_date_modification_startyear='.((int) $tmp[
'year']);
440 if (!empty($search_date_modification_end)) {
441 $filter[
't.tms<='] = $search_date_modification_end;
443 $param .=
'&search_date_modification_endmonth='.((int) $tmp[
'mon']).
'&search_date_modification_endday='.((int) $tmp[
'mday']).
'&search_date_modification_endyear='.((int) $tmp[
'year']);
445 if (!empty($search_date_export_start)) {
446 $filter[
't.date_export>='] = $search_date_export_start;
448 $param .=
'&search_date_export_startmonth='.((int) $tmp[
'mon']).
'&search_date_export_startday='.((int) $tmp[
'mday']).
'&search_date_export_startyear='.((int) $tmp[
'year']);
450 if (!empty($search_date_export_end)) {
451 $filter[
't.date_export<='] = $search_date_export_end;
453 $param .=
'&search_date_export_endmonth='.((int) $tmp[
'mon']).
'&search_date_export_endday='.((int) $tmp[
'mday']).
'&search_date_export_endyear='.((int) $tmp[
'year']);
455 if (!empty($search_date_validation_start)) {
456 $filter[
't.date_validated>='] = $search_date_validation_start;
458 $param .=
'&search_date_validation_startmonth='.((int) $tmp[
'mon']).
'&search_date_validation_startday='.((int) $tmp[
'mday']).
'&search_date_validation_startyear='.((int) $tmp[
'year']);
460 if (!empty($search_date_validation_end)) {
461 $filter[
't.date_validated<='] = $search_date_validation_end;
463 $param .=
'&search_date_validation_endmonth='.((int) $tmp[
'mon']).
'&search_date_validation_endday='.((int) $tmp[
'mday']).
'&search_date_validation_endyear='.((int) $tmp[
'year']);
466 if (!empty($search_date_due_start)) {
467 $filter[
't.date_lim_reglement>='] = $search_date_due_start;
468 $param .=
'&search_date_due_start_day='.$search_date_due_start_day.
'&search_date_due_start_month='.$search_date_due_start_month.
'&search_date_due_start_year='.$search_date_due_start_year;
471 if (!empty($search_date_due_end)) {
472 $filter[
't.date_lim_reglement<='] = $search_date_due_end;
473 $param .=
'&search_date_due_end_day='.$search_date_due_end_day.
'&search_date_due_end_month='.$search_date_due_end_month.
'&search_date_due_end_year='.$search_date_due_end_year;
475 if (!empty($search_debit)) {
476 $filter[
't.debit'] = $search_debit;
477 $param .=
'&search_debit='.urlencode($search_debit);
479 if (!empty($search_credit)) {
480 $filter[
't.credit'] = $search_credit;
481 $param .=
'&search_credit='.urlencode($search_credit);
483 if (!empty($search_lettering_code)) {
484 $filter[
't.lettering_code'] = $search_lettering_code;
485 $param .=
'&search_lettering_code='.urlencode($search_lettering_code);
487 if (!empty($search_not_reconciled)) {
488 $filter[
't.reconciled_option'] = $search_not_reconciled;
489 $param .=
'&search_not_reconciled='.urlencode($search_not_reconciled);
491 if (!empty($search_import_key)) {
492 $filter[
't.import_key'] = $search_import_key;
493 $param .=
'&search_import_key='.urlencode($search_import_key);
497 $objectclass =
'Bookkeeping';
498 $objectlabel =
'Bookkeeping';
499 $permissiontoread = $user->hasRight(
'societe',
'lire');
500 $permissiontodelete = $user->hasRight(
'societe',
'supprimer');
501 $permissiontoadd = $user->hasRight(
'societe',
'creer');
502 $uploaddir =
$conf->societe->dir_output;
505 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
507 if (!$error && $action ==
'deletebookkeepingwriting' && $confirm ==
"yes" && $user->hasRight(
'accounting',
'mouvements',
'supprimer')) {
512 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect,
true);
513 if ($nb_lettering < 0) {
522 foreach ($toselect as $toselectid) {
523 $result =
$object->fetch($toselectid);
524 if ($result > 0 && (!isset(
$object->date_validation) ||
$object->date_validation ===
'')) {
533 } elseif ($result < 0) {
537 } elseif (isset(
$object->date_validation) &&
$object->date_validation !=
'') {
538 setEventMessages($langs->trans(
"ValidatedRecordWhereFound"),
null,
'errors');
551 } elseif ($nbok > 0) {
557 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?noreset=1".($param ?
'&'.$param :
''));
566 if ($massaction ==
'letteringauto' && $permissiontoadd) {
568 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
569 if ($nb_lettering < 0) {
572 $nb_lettering = max(0, abs($nb_lettering) - 2);
573 } elseif ($nb_lettering == 0) {
575 setEventMessages($langs->trans(
'AccountancyNoLetteringModified'), array(),
'mesgs');
577 if ($nb_lettering == 1) {
578 setEventMessages($langs->trans(
'AccountancyOneLetteringModifiedSuccessfully'), array(),
'mesgs');
579 } elseif ($nb_lettering > 1) {
580 setEventMessages($langs->trans(
'AccountancyLetteringModifiedSuccessfully', $nb_lettering), array(),
'mesgs');
584 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
587 } elseif ($massaction ==
'letteringmanual' && $permissiontoadd) {
589 $result = $lettering->updateLettering($toselect);
593 setEventMessages($langs->trans(
'AccountancyOneLetteringModifiedSuccessfully'), array(),
'mesgs');
594 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
597 } elseif ($action ==
'unletteringauto' && $confirm ==
"yes" && $permissiontoadd) {
599 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect,
true);
600 if ($nb_lettering < 0) {
603 $nb_lettering = max(0, abs($nb_lettering) - 2);
604 } elseif ($nb_lettering == 0) {
606 setEventMessages($langs->trans(
'AccountancyNoUnletteringModified'), array(),
'mesgs');
608 if ($nb_lettering == 1) {
609 setEventMessages($langs->trans(
'AccountancyOneUnletteringModifiedSuccessfully'), array(),
'mesgs');
610 } elseif ($nb_lettering > 1) {
611 setEventMessages($langs->trans(
'AccountancyUnletteringModifiedSuccessfully', $nb_lettering), array(),
'mesgs');
615 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
618 } elseif ($action ==
'unletteringmanual' && $confirm ==
"yes" && $permissiontoadd) {
620 $nb_lettering = $lettering->deleteLettering($toselect);
621 if ($nb_lettering < 0) {
624 setEventMessages($langs->trans(
'AccountancyOneUnletteringModifiedSuccessfully'), array(),
'mesgs');
625 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
638$sql .=
" t.doc_date,";
639$sql .=
" t.doc_type,";
640$sql .=
" t.doc_ref,";
642$sql .=
" t.fk_docdet,";
643$sql .=
" t.thirdparty_code,";
644$sql .=
" t.subledger_account,";
645$sql .=
" t.subledger_label,";
646$sql .=
" t.numero_compte,";
647$sql .=
" t.label_compte,";
648$sql .=
" t.label_operation,";
651$sql .=
" t.lettering_code,";
652$sql .=
" t.montant as amount,";
654$sql .=
" t.fk_user_author,";
655$sql .=
" t.import_key,";
656$sql .=
" t.code_journal,";
657$sql .=
" t.journal_label,";
658$sql .=
" t.piece_num,";
659$sql .=
" t.date_creation,";
660$sql .=
" t.tms as date_modification,";
661$sql .=
" t.date_export,";
662$sql .=
" t.date_validated as date_validation,";
663$sql .=
" t.date_lim_reglement,";
664$sql .=
" t.import_key";
668$sql .=
' FROM '.MAIN_DB_PREFIX.$object->table_element.
' as t';
671if (count($filter) > 0) {
672 foreach ($filter as $key => $value) {
673 if ($key ==
't.doc_date') {
674 $sqlwhere[] = $db->sanitize($key).
" = '".$db->idate($value).
"'";
675 } elseif ($key ==
't.doc_date>=') {
676 $sqlwhere[] =
"t.doc_date >= '".$db->idate($value).
"'";
677 } elseif ($key ==
't.doc_date<=') {
678 $sqlwhere[] =
"t.doc_date <= '".$db->idate($value).
"'";
679 } elseif ($key ==
't.doc_date>') {
680 $sqlwhere[] =
"t.doc_date > '".$db->idate($value).
"'";
681 } elseif ($key ==
't.doc_date<') {
682 $sqlwhere[] =
"t.doc_date < '".$db->idate($value).
"'";
683 } elseif ($key ==
't.numero_compte>=') {
684 $sqlwhere[] =
"t.numero_compte >= '".$db->escape($value).
"'";
685 } elseif ($key ==
't.numero_compte<=') {
686 $sqlwhere[] =
"t.numero_compte <= '".$db->escape($value).
"'";
687 } elseif ($key ==
't.subledger_account>=') {
688 $sqlwhere[] =
"t.subledger_account >= '".$db->escape($value).
"'";
689 } elseif ($key ==
't.subledger_account<=') {
690 $sqlwhere[] =
"t.subledger_account <= '".$db->escape($value).
"'";
691 } elseif ($key ==
't.fk_doc' || $key ==
't.fk_docdet' || $key ==
't.piece_num') {
692 $sqlwhere[] = $db->sanitize($key).
' = '.((int) $value);
693 } elseif ($key ==
't.subledger_account' || $key ==
't.numero_compte') {
694 $sqlwhere[] = $db->sanitize($key).
" LIKE '".$db->escape($db->escapeforlike($value)).
"%'";
695 } elseif ($key ==
't.subledger_account') {
697 } elseif ($key ==
't.tms>=') {
698 $sqlwhere[] =
"t.tms >= '".$db->idate($value).
"'";
699 } elseif ($key ==
't.tms<=') {
700 $sqlwhere[] =
"t.tms <= '".$db->idate($value).
"'";
701 } elseif ($key ==
't.date_creation>=') {
702 $sqlwhere[] =
"t.date_creation >= '".$db->idate($value).
"'";
703 } elseif ($key ==
't.date_creation<=') {
704 $sqlwhere[] =
"t.date_creation <= '".$db->idate($value).
"'";
705 } elseif ($key ==
't.date_export>=') {
706 $sqlwhere[] =
"t.date_export >= '".$db->idate($value).
"'";
707 } elseif ($key ==
't.date_export<=') {
708 $sqlwhere[] =
"t.date_export <= '".$db->idate($value).
"'";
709 } elseif ($key ==
't.date_validated>=') {
710 $sqlwhere[] =
"t.date_validated >= '".$db->idate($value).
"'";
711 } elseif ($key ==
't.date_validated<=') {
712 $sqlwhere[] =
"t.date_validated <= '".$db->idate($value).
"'";
713 } elseif ($key ==
't.date_lim_reglement>=') {
714 $sqlwhere[] =
"t.date_lim_reglement >= '".$db->idate($value).
"'";
715 } elseif ($key ==
't.date_lim_reglement<=') {
716 $sqlwhere[] =
"t.date_lim_reglement <= '".$db->idate($value).
"'";
717 } elseif ($key ==
't.credit' || $key ==
't.debit') {
719 } elseif ($key ==
't.reconciled_option') {
720 $sqlwhere[] =
't.lettering_code IS NULL';
721 } elseif ($key ==
't.code_journal' && !empty($value)) {
722 if (is_array($value)) {
723 $sqlwhere[] =
natural_search(
"t.code_journal", implode(
',', $value), 3, 1);
727 } elseif ($key ==
't.search_accounting_code_in' && !empty($value)) {
728 $sqlwhere[] =
't.numero_compte IN ('.$db->sanitize($value, 1).
')';
734$sql .=
' WHERE t.entity IN ('.getEntity(
'accountancy').
')';
736if (count($sqlwhere) > 0) {
737 $sql .=
' AND '.implode(
' AND ', $sqlwhere);
748$title_page = $langs->trans(
"Operations").
' - '.$langs->trans(
"Journals");
751$nbtotalofrecords =
'';
754 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
755 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
756 $resql = $db->query($sqlforcount);
758 $objforcount = $db->fetch_object($resql);
759 $nbtotalofrecords = $objforcount->nbtotalofrecords;
764 if (($page * $limit) > $nbtotalofrecords) {
772$sql .= $db->order($sortfield, $sortorder);
774 $sql .= $db->plimit($limit + 1, $offset);
777$resql = $db->query($sql);
783$num = $db->num_rows($resql);
785$arrayofselected = is_array($toselect) ? $toselect : array();
789$help_url =
'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double';
790llxHeader(
'', $title_page, $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy accountancy-consultation page-journal');
798if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
799 $param .=
'&contextpage='.urlencode($contextpage);
801if ($limit > 0 && $limit !=
$conf->liste_limit) {
802 $param .=
'&limit='.((int) $limit);
806$arrayofmassactions = array();
807if (
getDolGlobalInt(
'ACCOUNTING_ENABLE_LETTERING') && $user->hasRight(
'accounting',
'mouvements',
'creer')) {
808 $arrayofmassactions[
'letteringauto'] =
img_picto(
'',
'check',
'class="pictofixedwidth"') . $langs->trans(
'LetteringAuto');
809 $arrayofmassactions[
'preunletteringauto'] =
img_picto(
'',
'uncheck',
'class="pictofixedwidth"') . $langs->trans(
'UnletteringAuto');
810 $arrayofmassactions[
'letteringmanual'] =
img_picto(
'',
'check',
'class="pictofixedwidth"') . $langs->trans(
'LetteringManual');
811 $arrayofmassactions[
'preunletteringmanual'] =
img_picto(
'',
'uncheck',
'class="pictofixedwidth"') . $langs->trans(
'UnletteringManual');
813if ($user->hasRight(
'accounting',
'mouvements',
'supprimer')) {
814 $arrayofmassactions[
'predeletebookkeepingwriting'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
816if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'preunletteringauto',
'preunletteringmanual',
'predeletebookkeepingwriting'))) {
817 $arrayofmassactions = array();
819$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
821print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
822print
'<input type="hidden" name="token" value="'.newToken().
'">';
823print
'<input type="hidden" name="action" value="list">';
824if ($optioncss !=
'') {
825 print
'<input type="hidden" name="optioncss" value="'.urlencode($optioncss).
'">';
827print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
828print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
829print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
830print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
833 $buttonLabel = $langs->trans(
"ExportFilteredList");
835 $buttonLabel = $langs->trans(
"ExportList");
838$parameters = array(
'param' => $param);
839$reshook = $hookmanager->executeHooks(
'addMoreActionsButtonsList', $parameters, $object, $action);
844$newcardbutton = empty($hookmanager->resPrint) ?
'' : $hookmanager->resPrint;
846if (empty($reshook)) {
847 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewFlatList'),
'',
'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.
'/accountancy/bookkeeping/list.php?'.$param,
'', 1, array(
'morecss' =>
'marginleftonly btnTitleSelected'));
848 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'GroupByAccountAccounting'),
'',
'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.
'/accountancy/bookkeeping/listbyaccount.php?'.$param,
'', 1, array(
'morecss' =>
'marginleftonly'));
849 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'GroupBySubAccountAccounting'),
'',
'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.
'/accountancy/bookkeeping/listbyaccount.php?type=sub'.$param,
'', 1, array(
'morecss' =>
'marginleftonly'));
851 $url =
'./card.php?action=create';
852 if (!empty($socid)) {
853 $url .=
'&socid='.$socid;
856 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewAccountingMvt'),
'',
'fa fa-plus-circle paddingleft', $url,
'', $user->hasRight(
'accounting',
'mouvements',
'creer'));
859print_barre_liste($title_page, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'title_accountancy', 0, $newcardbutton,
'', $limit, 0, 0, 1);
861if ($massaction ==
'preunletteringauto') {
862 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassUnletteringAuto"), $langs->trans(
"ConfirmMassUnletteringQuestion", count($toselect)),
"unletteringauto",
null,
'', 0, 200, 500, 1);
863} elseif ($massaction ==
'preunletteringmanual') {
864 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassUnletteringManual"), $langs->trans(
"ConfirmMassUnletteringQuestion", count($toselect)),
"unletteringmanual",
null,
'', 0, 200, 500, 1);
865} elseif ($massaction ==
'predeletebookkeepingwriting') {
866 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDeleteBookkeepingWriting"), $langs->trans(
"ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)),
"deletebookkeepingwriting",
null,
'', 0, 200, 500, 1);
873include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
875$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
876$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
877if ($massactionbutton && $contextpage !=
'poslist') {
878 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
882$moreforfilter .=
'<div class="divsearchfield">';
883$moreforfilter .= $langs->trans(
'AccountingCategory').
': ';
884$moreforfilter .=
'<div class="nowrap inline-block">';
885$moreforfilter .= $formaccounting->select_accounting_category($search_account_category,
'search_account_category', 1, 0, 0, 0);
886$moreforfilter .=
'</div>';
887$moreforfilter .=
'</div>';
889$parameters = array();
890$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
891if (empty($reshook)) {
892 $moreforfilter .= $hookmanager->resPrint;
894 $moreforfilter = $hookmanager->resPrint;
897print
'<div class="liste_titre liste_titre_bydiv centpercent">';
901print
'<div class="div-table-responsive">';
902print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">';
905print
'<tr class="liste_titre_filter">';
908 print
'<td class="liste_titre center">';
909 $searchpicto = $form->showFilterButtons(
'left');
914if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
915 print
'<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).
'"></td>';
918if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
919 print
'<td class="liste_titre center">';
920 print $formaccounting->multi_select_journal($search_ledger_code,
'search_ledger_code', 0, 1, 1, 1,
'small maxwidth75');
924if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
925 print
'<td class="liste_titre center">';
926 print
'<div class="nowrapfordate">';
927 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
929 print
'<div class="nowrapfordate">';
930 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
935if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
936 print
'<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="'.dol_escape_htmltag($search_doc_ref).
'"></td>';
939if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
940 print
'<td class="liste_titre">';
941 print
'<div class="nowrap">';
942 print $formaccounting->select_account($search_accountancy_code_start,
'search_accountancy_code_start', $langs->trans(
'From'), array(), 1, 1,
'maxwidth150',
'account');
944 print
'<div class="nowrap">';
945 print $formaccounting->select_account($search_accountancy_code_end,
'search_accountancy_code_end', $langs->trans(
'to'), array(), 1, 1,
'maxwidth150',
'account');
950if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
951 print
'<td class="liste_titre">';
955 print
'<div class="nowrap">';
957 print $formaccounting->select_auxaccount($search_accountancy_aux_code_start,
'search_accountancy_aux_code_start', $langs->trans(
'From'),
'maxwidth250',
'subledgeraccount');
959 print
'<div class="nowrap">';
960 print $formaccounting->select_auxaccount($search_accountancy_aux_code_end,
'search_accountancy_aux_code_end', $langs->trans(
'to'),
'maxwidth250',
'subledgeraccount');
963 print
'<input type="text" class="maxwidth75" name="search_accountancy_aux_code" value="'.dol_escape_htmltag($search_accountancy_aux_code).
'">';
968if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
969 print
'<td class="liste_titre">';
970 print
'<input type="text" size="7" class="flat" name="search_mvt_label" value="'.dol_escape_htmltag($search_mvt_label).
'"/>';
974if (!empty($arrayfields[
't.debit'][
'checked'])) {
975 print
'<td class="liste_titre right">';
976 print
'<input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).
'">';
980if (!empty($arrayfields[
't.credit'][
'checked'])) {
981 print
'<td class="liste_titre right">';
982 print
'<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).
'">';
986if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
987 print
'<td class="liste_titre center">';
988 print
'<input type="text" size="3" class="flat" name="search_lettering_code" value="'.dol_escape_htmltag($search_lettering_code).
'"/>';
989 print
'<br><span class="nowrap"><input type="checkbox" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled ==
'notreconciled' ?
' checked' :
'').
'>'.$langs->trans(
"NotReconciled").
'</span>';
994$parameters = array(
'arrayfields' => $arrayfields);
995$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
996print $hookmanager->resPrint;
999if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1000 print
'<td class="liste_titre center">';
1001 print
'<div class="nowrapfordate">';
1002 print $form->selectDate($search_date_creation_start,
'search_date_creation_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1004 print
'<div class="nowrapfordate">';
1005 print $form->selectDate($search_date_creation_end,
'search_date_creation_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1010if (!empty($arrayfields[
't.tms'][
'checked'])) {
1011 print
'<td class="liste_titre center">';
1012 print
'<div class="nowrapfordate">';
1013 print $form->selectDate($search_date_modification_start,
'search_date_modification_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1015 print
'<div class="nowrapfordate">';
1016 print $form->selectDate($search_date_modification_end,
'search_date_modification_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1021if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1022 print
'<td class="liste_titre center">';
1023 print
'<div class="nowrapfordate">';
1024 print $form->selectDate($search_date_export_start,
'search_date_export_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1026 print
'<div class="nowrapfordate">';
1027 print $form->selectDate($search_date_export_end,
'search_date_export_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1032if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1033 print
'<td class="liste_titre center">';
1034 print
'<div class="nowrapfordate">';
1035 print $form->selectDate($search_date_validation_start,
'search_date_validation_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1037 print
'<div class="nowrapfordate">';
1038 print $form->selectDate($search_date_validation_end,
'search_date_validation_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1043if (!empty($arrayfields[
't.date_lim_reglement'][
'checked'])) {
1044 print
'<td class="liste_titre center">';
1045 print
'<div class="nowrapfordate">';
1046 print $form->selectDate($search_date_due_start,
'search_date_due_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1048 print
'<div class="nowrapfordate">';
1049 print $form->selectDate($search_date_due_end,
'search_date_due_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1053if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1054 print
'<td class="liste_titre center">';
1055 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1060 print
'<td class="liste_titre center">';
1061 $searchpicto = $form->showFilterButtons();
1067print
'<tr class="liste_titre">';
1069 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch actioncolumn ');
1071if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
1072 print_liste_field_titre($arrayfields[
't.piece_num'][
'label'], $_SERVER[
'PHP_SELF'],
"t.piece_num",
"", $param,
"", $sortfield, $sortorder);
1074if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
1075 print_liste_field_titre($arrayfields[
't.code_journal'][
'label'], $_SERVER[
'PHP_SELF'],
"t.code_journal",
"", $param,
'', $sortfield, $sortorder,
'center ');
1077if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1078 print_liste_field_titre($arrayfields[
't.doc_date'][
'label'], $_SERVER[
'PHP_SELF'],
"t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1080if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1081 print_liste_field_titre($arrayfields[
't.doc_ref'][
'label'], $_SERVER[
'PHP_SELF'],
"t.doc_ref",
"", $param,
"", $sortfield, $sortorder);
1083if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
1084 print_liste_field_titre($arrayfields[
't.numero_compte'][
'label'], $_SERVER[
'PHP_SELF'],
"t.numero_compte",
"", $param,
"", $sortfield, $sortorder);
1086if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
1087 print_liste_field_titre($arrayfields[
't.subledger_account'][
'label'], $_SERVER[
'PHP_SELF'],
"t.subledger_account",
"", $param,
"", $sortfield, $sortorder);
1089if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1090 print_liste_field_titre($arrayfields[
't.label_operation'][
'label'], $_SERVER[
'PHP_SELF'],
"t.label_operation",
"", $param,
"", $sortfield, $sortorder);
1092if (!empty($arrayfields[
't.debit'][
'checked'])) {
1093 print_liste_field_titre($arrayfields[
't.debit'][
'label'], $_SERVER[
'PHP_SELF'],
"t.debit",
"", $param,
'', $sortfield, $sortorder,
'right ');
1095if (!empty($arrayfields[
't.credit'][
'checked'])) {
1096 print_liste_field_titre($arrayfields[
't.credit'][
'label'], $_SERVER[
'PHP_SELF'],
"t.credit",
"", $param,
'', $sortfield, $sortorder,
'right ');
1098if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1099 print_liste_field_titre($arrayfields[
't.lettering_code'][
'label'], $_SERVER[
'PHP_SELF'],
"t.lettering_code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1102$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1103$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1104print $hookmanager->resPrint;
1105if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1106 print_liste_field_titre($arrayfields[
't.date_creation'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center ');
1108if (!empty($arrayfields[
't.tms'][
'checked'])) {
1109 print_liste_field_titre($arrayfields[
't.tms'][
'label'], $_SERVER[
'PHP_SELF'],
"t.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
1111if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1112 print_liste_field_titre($arrayfields[
't.date_export'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_export,t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1114if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1115 print_liste_field_titre($arrayfields[
't.date_validated'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_validated,t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1118if (!empty($arrayfields[
't.date_lim_reglement'][
'checked'])) {
1119 print_liste_field_titre($arrayfields[
't.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
't.date_lim_reglement',
'', $param,
'', $sortfield, $sortorder,
'center ');
1121if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1122 print_liste_field_titre($arrayfields[
't.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"t.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1125 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1135$totalarray = array();
1136$totalarray[
'nbfield'] = 0;
1137$totalarray[
'val'] = array();
1138$totalarray[
'val'][
'totaldebit'] = 0;
1139$totalarray[
'val'][
'totalcredit'] = 0;
1141while ($i < min($num, $limit)) {
1142 $obj = $db->fetch_object($resql);
1147 $line->id = $obj->rowid;
1148 $line->doc_date = $db->jdate($obj->doc_date);
1149 $line->doc_type = $obj->doc_type;
1150 $line->doc_ref = $obj->doc_ref;
1151 $line->fk_doc = $obj->fk_doc;
1152 $line->fk_docdet = $obj->fk_docdet;
1153 $line->thirdparty_code = $obj->thirdparty_code;
1154 $line->subledger_account = $obj->subledger_account;
1155 $line->subledger_label = $obj->subledger_label;
1156 $line->numero_compte = $obj->numero_compte;
1157 $line->label_compte = $obj->label_compte;
1158 $line->label_operation = $obj->label_operation;
1159 $line->debit = $obj->debit;
1160 $line->credit = $obj->credit;
1161 $line->montant = $obj->amount;
1162 $line->amount = $obj->amount;
1163 $line->sens = $obj->sens;
1164 $line->lettering_code = $obj->lettering_code;
1165 $line->fk_user_author = $obj->fk_user_author;
1166 $line->import_key = $obj->import_key;
1167 $line->code_journal = $obj->code_journal;
1168 $line->journal_label = $obj->journal_label;
1169 $line->piece_num = $obj->piece_num;
1170 $line->date_creation = $db->jdate($obj->date_creation);
1171 $line->date_modification = $db->jdate($obj->date_modification);
1172 $line->date_export = $db->jdate($obj->date_export);
1173 $line->date_validation = $db->jdate($obj->date_validation);
1175 $line->date_lim_reglement = $db->jdate($obj->date_lim_reglement);
1177 print
'<tr class="oddeven">';
1180 print
'<td class="nowraponall center">';
1181 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
1183 if (in_array($line->id, $arrayofselected)) {
1186 print
'<input id="cb'.$line->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.
'"'.($selected ?
' checked="checked"' :
'').
' />';
1190 $totalarray[
'nbfield']++;
1195 if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
1198 $object->piece_num = $line->piece_num;
1199 print
$object->getNomUrl(1,
'', 0,
'', 1);
1202 $totalarray[
'nbfield']++;
1207 if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
1208 if (empty(
$conf->cache[
'accountingjournal'][$line->code_journal])) {
1210 $accountingjournal->fetch(0, $line->code_journal);
1211 $conf->cache[
'accountingjournal'][$line->code_journal] = $accountingjournal;
1213 $accountingjournal =
$conf->cache[
'accountingjournal'][$line->code_journal];
1216 $journaltoshow = (($accountingjournal->id > 0) ? $accountingjournal->getNomUrl(0, 0, 0,
'', 0) : $line->code_journal);
1217 print
'<td class="center tdoverflowmax150">'.$journaltoshow.
'</td>';
1219 $totalarray[
'nbfield']++;
1224 if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1225 print
'<td class="center">'.dol_print_date($line->doc_date,
'day').
'</td>';
1227 $totalarray[
'nbfield']++;
1233 if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1234 $objectstatic =
null;
1236 if ($line->doc_type ===
'customer_invoice') {
1237 $langs->loadLangs(array(
'bills'));
1239 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
1240 $objectstatic =
new Facture($db);
1241 $objectstatic->fetch($line->fk_doc);
1246 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$objectstatic->id;
1247 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1248 } elseif ($line->doc_type ===
'supplier_invoice') {
1249 $langs->loadLangs(array(
'bills'));
1251 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
1253 $objectstatic->fetch($line->fk_doc);
1255 $modulepart =
'invoice_supplier';
1260 $filedir =
getMultidirOutput($objectstatic,
'', 1).dol_sanitizeFileName($line->doc_ref);
1261 $subdir =
getMultidirOutput($objectstatic,
'', 1,
'outputrel').dol_sanitizeFileName($line->doc_ref);
1264 if ($objectstatic->id > 0) {
1265 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
1267 $documentlink = $line->doc_ref;
1269 } elseif ($line->doc_type ===
'expense_report') {
1270 $langs->loadLangs(array(
'trips'));
1272 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
1274 $objectstatic->fetch($line->fk_doc);
1279 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$objectstatic->id;
1280 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1281 } elseif ($line->doc_type ===
'bank') {
1282 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
1284 $objectstatic->fetch($line->fk_doc);
1290 $labeltoshowalt =
'';
1291 $classforlabel =
'';
1292 if (($line->doc_type ===
'customer_invoice' || $line->doc_type ===
'supplier_invoice' || $line->doc_type ===
'expense_report') && is_object($objectstatic)) {
1293 $labeltoshow .= $objectstatic->getNomUrl(1,
'', 0, 0,
'', 0, -1, 1);
1294 $labeltoshow .= $documentlink;
1295 $labeltoshowalt .= $objectstatic->ref;
1296 } elseif ($line->doc_type ===
'bank' && is_object($objectstatic)) {
1297 $labeltoshow .= $objectstatic->getNomUrl(1);
1298 $labeltoshowalt .= $objectstatic->ref;
1299 $bank_ref = strstr($line->doc_ref,
'-');
1300 $labeltoshow .=
" " . $bank_ref;
1301 $labeltoshowalt .=
" " . $bank_ref;
1303 $labeltoshow .= $line->doc_ref;
1304 $labeltoshowalt .= $line->doc_ref;
1305 $classforlabel =
'tdoverflowmax250';
1308 print
'<td class="nowraponall'.($classforlabel ?
' '.$classforlabel :
'').
'" title="'.
dol_escape_htmltag($labeltoshowalt).
'">';
1312 $totalarray[
'nbfield']++;
1317 if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
1318 print
'<td>'.length_accountg($line->numero_compte).
'</td>';
1320 $totalarray[
'nbfield']++;
1325 if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
1326 print
'<td>'.length_accounta($line->subledger_account).
'</td>';
1328 $totalarray[
'nbfield']++;
1333 if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1334 print
'<td class="small tdoverflowmax200" title="'.dol_escape_htmltag($line->label_operation).
'">'.
dol_escape_htmltag($line->label_operation).
'</td>';
1336 $totalarray[
'nbfield']++;
1341 if (!empty($arrayfields[
't.debit'][
'checked'])) {
1342 print
'<td class="right nowraponall amount">'.($line->debit != 0 ?
price($line->debit) :
'').
'</td>';
1344 $totalarray[
'nbfield']++;
1347 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totaldebit';
1349 $totalarray[
'val'][
'totaldebit'] += $line->debit;
1353 if (!empty($arrayfields[
't.credit'][
'checked'])) {
1354 print
'<td class="right nowraponall amount">'.($line->credit != 0 ?
price($line->credit) :
'').
'</td>';
1356 $totalarray[
'nbfield']++;
1359 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalcredit';
1361 $totalarray[
'val'][
'totalcredit'] += $line->credit;
1365 if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1366 print
'<td class="center">'.$line->lettering_code.
'</td>';
1368 $totalarray[
'nbfield']++;
1373 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1374 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1375 print $hookmanager->resPrint;
1378 if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1379 print
'<td class="center">'.dol_print_date($line->date_creation,
'dayhour',
'tzuserrel').
'</td>';
1381 $totalarray[
'nbfield']++;
1386 if (!empty($arrayfields[
't.tms'][
'checked'])) {
1387 print
'<td class="center">'.dol_print_date($line->date_modification,
'dayhour',
'tzuserrel').
'</td>';
1389 $totalarray[
'nbfield']++;
1394 if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1395 print
'<td class="center nowraponall">'.dol_print_date($line->date_export,
'dayhour',
'tzuserrel').
'</td>';
1397 $totalarray[
'nbfield']++;
1402 if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1403 print
'<td class="center nowraponall">'.dol_print_date($line->date_validation,
'dayhour',
'tzuserrel').
'</td>';
1405 $totalarray[
'nbfield']++;
1410 if (!empty($arrayfields[
't.date_lim_reglement'][
'checked'])) {
1411 print
'<td class="center">'.dol_print_date($line->date_lim_reglement,
'day').
'</td>';
1413 $totalarray[
'nbfield']++;
1417 if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1418 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($obj->import_key).
'">'.
dol_escape_htmltag($obj->import_key).
"</td>\n";
1420 $totalarray[
'nbfield']++;
1426 print
'<td class="nowraponall center">';
1427 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
1429 if (in_array($line->id, $arrayofselected)) {
1432 print
'<input id="cb'.$line->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.
'"'.($selected ?
' checked="checked"' :
'').
' />';
1436 $totalarray[
'nbfield']++;
1447include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1452 foreach ($arrayfields as $key => $val) {
1453 if (!empty($val[
'checked'])) {
1457 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1460$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1461$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1462print $hookmanager->resPrint;
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage 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.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
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.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
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.
if(!function_exists( 'utf8_encode')) if(!function_exists('utf8_decode')) if(!function_exists( 'str_starts_with')) if(!function_exists('str_ends_with')) if(!function_exists( 'str_contains')) getMultidirOutput($object, $module='', $forobject=0, $mode='output')
Return the full path of the directory where a module (or an object of a module) stores its files.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.