33require
'../../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfiscalyear.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeeping.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/lettering.class.php';
53$langs->loadLangs(array(
"accountancy",
"categories",
"compta",
"other"));
57$journal_code =
GETPOST(
'code_journal',
'alpha');
58$account =
GETPOST(
"account",
'int');
62$action =
GETPOST(
'action',
'aZ09');
63$massaction =
GETPOST(
'massaction',
'alpha');
64$confirm =
GETPOST(
'confirm',
'alpha');
65$toselect =
GETPOST(
'toselect',
'array:int');
66$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
69$search_mvt_num =
GETPOST(
'search_mvt_num',
'alpha');
70$search_doc_type =
GETPOST(
"search_doc_type",
'alpha');
71$search_doc_ref =
GETPOST(
"search_doc_ref",
'alpha');
73$search_doc_date =
GETPOSTDATE(
'doc_date',
'getpost');
75$search_date_start =
GETPOSTDATE(
'search_date_start',
'getpost',
'auto',
'search_date_start_accountancy');
76$search_date_end =
GETPOSTDATE(
'search_date_end',
'getpostend',
'auto',
'search_date_end_accountancy');
78$search_date_creation_start =
GETPOSTDATE(
'search_date_creation_start',
'getpost');
79$search_date_creation_end =
GETPOSTDATE(
'search_date_creation_end',
'getpostend');
81$search_date_modification_start =
GETPOSTDATE(
'search_date_modification_start',
'getpost');
82$search_date_modification_end =
GETPOSTDATE(
'search_date_modification_end',
'getpostend');
84$search_date_export_start =
GETPOSTDATE(
'search_date_export_start',
'getpost');
85$search_date_export_end =
GETPOSTDATE(
'search_date_export_end',
'getpostend');
87$search_date_validation_start =
GETPOSTDATE(
'search_date_validation_start',
'getpost');
88$search_date_validation_end =
GETPOSTDATE(
'search_date_validation_end',
'getpostend');
91$search_date_due_start_day =
GETPOSTINT(
'search_date_due_start_day');
92$search_date_due_start_month =
GETPOSTINT(
'search_date_due_start_month');
93$search_date_due_start_year =
GETPOSTINT(
'search_date_due_start_year');
94$search_date_due_start =
GETPOSTDATE(
'search_date_due_start_',
'getpost');
97$search_date_due_end_day =
GETPOSTINT(
'search_date_due_end_day');
98$search_date_due_end_month =
GETPOSTINT(
'search_date_due_end_month');
99$search_date_due_end_year =
GETPOSTINT(
'search_date_due_end_year');
100$search_date_due_end =
GETPOSTDATE(
'search_date_due_end_',
'getpostend');
102$search_import_key =
GETPOST(
"search_import_key",
'alpha');
104$search_account_category =
GETPOSTINT(
'search_account_category');
106$search_accountancy_code =
GETPOST(
"search_accountancy_code",
'alpha');
107$search_accountancy_code_start =
GETPOST(
'search_accountancy_code_start',
'alpha');
108if ($search_accountancy_code_start == - 1) {
109 $search_accountancy_code_start =
'';
111$search_accountancy_code_end =
GETPOST(
'search_accountancy_code_end',
'alpha');
112if ($search_accountancy_code_end == - 1) {
113 $search_accountancy_code_end =
'';
116$search_accountancy_aux_code =
GETPOST(
"search_accountancy_aux_code",
'alpha');
117$search_accountancy_aux_code_start =
GETPOST(
'search_accountancy_aux_code_start',
'alpha');
118if ($search_accountancy_aux_code_start == - 1) {
119 $search_accountancy_aux_code_start =
'';
121$search_accountancy_aux_code_end =
GETPOST(
'search_accountancy_aux_code_end',
'alpha');
122if ($search_accountancy_aux_code_end == - 1) {
123 $search_accountancy_aux_code_end =
'';
125$search_mvt_label =
GETPOST(
'search_mvt_label',
'alpha');
126$search_direction =
GETPOST(
'search_direction',
'alpha');
127$search_debit =
GETPOST(
'search_debit',
'alpha');
128$search_credit =
GETPOST(
'search_credit',
'alpha');
129$search_ledger_code =
GETPOST(
'search_ledger_code',
'array');
130$search_lettering_code =
GETPOST(
'search_lettering_code',
'alpha');
131$search_not_reconciled =
GETPOST(
'search_not_reconciled',
'alpha');
135$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
136$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
137$optioncss =
GETPOST(
'optioncss',
'alpha');
139if (empty($page) || $page < 0) {
142$offset = $limit * $page;
143$pageprev = $page - 1;
144$pagenext = $page + 1;
145if ($sortorder ==
"") {
148if ($sortfield ==
"") {
149 $sortfield =
"t.piece_num,t.rowid";
154$hookmanager->initHooks(array(
'bookkeepinglist'));
158$form =
new Form($db);
160if (!in_array($action, array(
'delmouv',
'delmouvconfirm')) && !
GETPOSTISSET(
'begin') && !
GETPOSTISSET(
'formfilteraction') &&
GETPOST(
'page',
'alpha') ==
'' && !
GETPOSTINT(
'noreset') && $user->hasRight(
'accounting',
'mouvements',
'export')) {
161 if (empty($search_date_start) && empty($search_date_end) && !
GETPOSTISSET(
'restore_lastsearch_values') && !
GETPOST(
'search_mvt_num') && !
GETPOST(
'search_accountancy_code_start')) {
162 $sql =
"SELECT date_start, date_end";
163 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_fiscalyear ";
165 $sql .=
" WHERE rowid = " .
getDolGlobalInt(
'ACCOUNTANCY_FISCALYEAR_DEFAULT');
167 $sql .=
" WHERE date_start < '" . $db->idate(
dol_now()) .
"' and date_end > '" . $db->idate(
dol_now()) .
"'";
169 $sql .= $db->plimit(1);
170 $res = $db->query($sql);
172 if ($db->num_rows($res) > 0) {
173 $fiscalYear = $db->fetch_object($res);
174 $search_date_start = strtotime($fiscalYear->date_start);
175 $search_date_end = strtotime($fiscalYear->date_end);
182 $year_end = $year_start + 1;
183 $month_end = $month_start - 1;
184 if ($month_end < 1) {
188 $search_date_start =
dol_mktime(0, 0, 0, $month_start, 1, $year_start);
196 't.piece_num' => array(
'label' => $langs->trans(
"TransactionNumShort"),
'checked' =>
'1'),
197 't.code_journal' => array(
'label' => $langs->trans(
"Codejournal"),
'checked' =>
'1'),
198 't.doc_date' => array(
'label' => $langs->trans(
"Docdate"),
'checked' =>
'1'),
199 't.doc_ref' => array(
'label' => $langs->trans(
"Piece"),
'checked' =>
'1'),
200 't.numero_compte' => array(
'label' => $langs->trans(
"AccountAccountingShort"),
'checked' =>
'1'),
201 't.subledger_account' => array(
'label' => $langs->trans(
"SubledgerAccount"),
'checked' =>
'1'),
202 't.label_operation' => array(
'label' => $langs->trans(
"Label"),
'checked' =>
'1'),
203 't.debit' => array(
'label' => $langs->trans(
"AccountingDebit"),
'checked' =>
'1'),
204 't.credit' => array(
'label' => $langs->trans(
"AccountingCredit"),
'checked' =>
'1'),
205 't.lettering_code' => array(
'label' => $langs->trans(
"LetteringCode"),
'checked' =>
'1'),
206 't.date_creation' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' =>
'0'),
207 't.tms' => array(
'label' => $langs->trans(
"DateModification"),
'checked' =>
'0'),
208 't.date_export' => array(
'label' => $langs->trans(
"DateExport"),
'checked' =>
'0'),
209 't.date_validated' => array(
'label' => $langs->trans(
"DateValidationAndLock"),
'checked' =>
'0',
'enabled' => (
string) (
int) !
getDolGlobalString(
"ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
210 't.date_lim_reglement' => array(
'label' => $langs->trans(
"DateDue"),
'checked' =>
'0'),
211 't.import_key' => array(
'label' => $langs->trans(
"ImportId"),
'checked' =>
'0',
'position' => 1100),
214$parameters = array(
'arrayfields' => &$arrayfields);
215$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
218 unset($arrayfields[
't.lettering_code']);
226if ($user->socid > 0) {
229if (!$user->hasRight(
'accounting',
'mouvements',
'lire')) {
234$permissiontoread = $user->hasRight(
'accounting',
'mouvements',
'lire');
235$permissiontoadd = $user->hasRight(
'accounting',
'mouvements',
'creer');
236$permissiontodelete = $user->hasRight(
'accounting',
'mouvements',
'supprimer');
237$permissiontoexport = $user->hasRight(
'accounting',
'mouvements',
'export');
247if (
GETPOST(
'cancel',
'alpha')) {
251if (!
GETPOST(
'confirmmassaction',
'alpha') &&
252 !in_array($massaction, [
253 'pregeneralunmatchingmanual',
254 'predeletebookkeepingwriting',
255 'preclonebookkeepingwriting',
256 'preassignaccountbookkeepingwriting',
257 'prereturnaccountbookkeepingwriting'
262$parameters = array(
'socid' => $socid);
263$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
265 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
268if (empty($reshook)) {
269 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
271 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
272 $search_mvt_num =
'';
273 $search_doc_type =
'';
274 $search_doc_ref =
'';
275 $search_doc_date =
'';
276 $search_account_category =
'';
277 $search_accountancy_code =
'';
278 $search_accountancy_code_start =
'';
279 $search_accountancy_code_end =
'';
280 $search_accountancy_aux_code =
'';
281 $search_accountancy_aux_code_start =
'';
282 $search_accountancy_aux_code_end =
'';
283 $search_mvt_label =
'';
284 $search_direction =
'';
285 $search_ledger_code = array();
286 $search_date_start =
'';
287 $search_date_end =
'';
288 $search_date_creation_start =
'';
289 $search_date_creation_end =
'';
290 $search_date_modification_start =
'';
291 $search_date_modification_end =
'';
292 $search_date_export_start =
'';
293 $search_date_export_end =
'';
294 $search_date_validation_start =
'';
295 $search_date_validation_end =
'';
297 $search_date_due_start_day =
'';
298 $search_date_due_start_month =
'';
299 $search_date_due_start_year =
'';
300 $search_date_due_start =
'';
302 $search_date_due_end_day =
'';
303 $search_date_due_end_month =
'';
304 $search_date_due_end_year =
'';
305 $search_date_due_end =
'';
308 $search_lettering_code =
'';
309 $search_not_reconciled =
'';
310 $search_import_key =
'';
312 unset($_SESSION[
'DOLDATE_search_date_start_accountancy_day']);
313 unset($_SESSION[
'DOLDATE_search_date_start_accountancy_month']);
314 unset($_SESSION[
'DOLDATE_search_date_start_accountancy_year']);
315 unset($_SESSION[
'DOLDATE_search_date_end_accountancy_day']);
316 unset($_SESSION[
'DOLDATE_search_date_end_accountancy_month']);
317 unset($_SESSION[
'DOLDATE_search_date_end_accountancy_year']);
321 if (!empty($search_date_start)) {
322 $filter[
't.doc_date>='] = $search_date_start;
324 $param .=
'&search_date_startmonth='.((int) $tmp[
'mon']).
'&search_date_startday='.((int) $tmp[
'mday']).
'&search_date_startyear='.((int) $tmp[
'year']);
326 if (!empty($search_date_end)) {
327 $filter[
't.doc_date<='] = $search_date_end;
329 $param .=
'&search_date_endmonth='.((int) $tmp[
'mon']).
'&search_date_endday='.((int) $tmp[
'mday']).
'&search_date_endyear='.((int) $tmp[
'year']);
331 if (!empty($search_doc_date)) {
332 $filter[
't.doc_date'] = $search_doc_date;
334 $param .=
'&doc_datemonth='.((int) $tmp[
'mon']).
'&doc_dateday='.((int) $tmp[
'mday']).
'&doc_dateyear='.((int) $tmp[
'year']);
336 if (!empty($search_doc_type)) {
337 $filter[
't.doc_type'] = $search_doc_type;
338 $param .=
'&search_doc_type='.urlencode($search_doc_type);
340 if (!empty($search_doc_ref)) {
341 $filter[
't.doc_ref'] = $search_doc_ref;
342 $param .=
'&search_doc_ref='.urlencode($search_doc_ref);
344 if ($search_account_category !=
'-1' && !empty($search_account_category)) {
345 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountancycategory.class.php';
348 $listofaccountsforgroup = $accountingcategory->getCptsCat(0,
'fk_accounting_category = '.((
int) $search_account_category));
349 $listofaccountsforgroup2 = array();
350 if (is_array($listofaccountsforgroup)) {
351 foreach ($listofaccountsforgroup as $tmpval) {
352 $listofaccountsforgroup2[] =
"'".$db->escape((
string) $tmpval[
'account_number']).
"'";
355 if (!empty($listofaccountsforgroup2)) {
356 $filter[
't.search_accounting_code_in'] = implode(
',', $listofaccountsforgroup2);
358 $filter[
't.search_accounting_code_in'] =
"''";
359 setEventMessages($langs->trans(
"ThisCategoryHasNoItems"),
null,
'warnings');
361 $param .=
'&search_account_category='.urlencode((
string) ($search_account_category));
363 if (!empty($search_accountancy_code)) {
364 $filter[
't.numero_compte'] = $search_accountancy_code;
365 $param .=
'&search_accountancy_code='.urlencode($search_accountancy_code);
367 if (!empty($search_accountancy_code_start)) {
368 $filter[
't.numero_compte>='] = $search_accountancy_code_start;
369 $param .=
'&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
371 if (!empty($search_accountancy_code_end)) {
372 $filter[
't.numero_compte<='] = $search_accountancy_code_end;
373 $param .=
'&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
375 if (!empty($search_accountancy_aux_code)) {
376 $filter[
't.subledger_account'] = $search_accountancy_aux_code;
377 $param .=
'&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
379 if (!empty($search_accountancy_aux_code_start)) {
380 $filter[
't.subledger_account>='] = $search_accountancy_aux_code_start;
381 $param .=
'&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
383 if (!empty($search_accountancy_aux_code_end)) {
384 $filter[
't.subledger_account<='] = $search_accountancy_aux_code_end;
385 $param .=
'&search_accountancy_aux_code_end='.urlencode($search_accountancy_aux_code_end);
387 if (!empty($search_mvt_label)) {
388 $filter[
't.label_operation'] = $search_mvt_label;
389 $param .=
'&search_mvt_label='.urlencode($search_mvt_label);
391 if (!empty($search_direction)) {
392 $filter[
't.sens'] = $search_direction;
393 $param .=
'&search_direction='.urlencode($search_direction);
395 if (!empty($search_ledger_code)) {
396 $filter[
't.code_journal'] = $search_ledger_code;
397 foreach ($search_ledger_code as $code) {
398 $param .=
'&search_ledger_code[]='.urlencode($code);
401 if (!empty($search_mvt_num)) {
402 $filter[
't.piece_num'] = $search_mvt_num;
403 $param .=
'&search_mvt_num='.urlencode((
string) ($search_mvt_num));
405 if (!empty($search_date_creation_start)) {
406 $filter[
't.date_creation>='] = $search_date_creation_start;
408 $param .=
'&search_date_creation_startmonth='.((int) $tmp[
'mon']).
'&search_date_creation_startday='.((int) $tmp[
'mday']).
'&search_date_creation_startyear='.((int) $tmp[
'year']);
410 if (!empty($search_date_creation_end)) {
411 $filter[
't.date_creation<='] = $search_date_creation_end;
413 $param .=
'&search_date_creation_endmonth='.((int) $tmp[
'mon']).
'&search_date_creation_endday='.((int) $tmp[
'mday']).
'&search_date_creation_endyear='.((int) $tmp[
'year']);
415 if (!empty($search_date_modification_start)) {
416 $filter[
't.tms>='] = $search_date_modification_start;
417 $tmp =
dol_getdate($search_date_modification_start);
418 $param .=
'&search_date_modification_startmonth='.((int) $tmp[
'mon']).
'&search_date_modification_startday='.((int) $tmp[
'mday']).
'&search_date_modification_startyear='.((int) $tmp[
'year']);
420 if (!empty($search_date_modification_end)) {
421 $filter[
't.tms<='] = $search_date_modification_end;
423 $param .=
'&search_date_modification_endmonth='.((int) $tmp[
'mon']).
'&search_date_modification_endday='.((int) $tmp[
'mday']).
'&search_date_modification_endyear='.((int) $tmp[
'year']);
425 if (!empty($search_date_export_start)) {
426 $filter[
't.date_export>='] = $search_date_export_start;
428 $param .=
'&search_date_export_startmonth='.((int) $tmp[
'mon']).
'&search_date_export_startday='.((int) $tmp[
'mday']).
'&search_date_export_startyear='.((int) $tmp[
'year']);
430 if (!empty($search_date_export_end)) {
431 $filter[
't.date_export<='] = $search_date_export_end;
433 $param .=
'&search_date_export_endmonth='.((int) $tmp[
'mon']).
'&search_date_export_endday='.((int) $tmp[
'mday']).
'&search_date_export_endyear='.((int) $tmp[
'year']);
435 if (!empty($search_date_validation_start)) {
436 $filter[
't.date_validated>='] = $search_date_validation_start;
438 $param .=
'&search_date_validation_startmonth='.((int) $tmp[
'mon']).
'&search_date_validation_startday='.((int) $tmp[
'mday']).
'&search_date_validation_startyear='.((int) $tmp[
'year']);
440 if (!empty($search_date_validation_end)) {
441 $filter[
't.date_validated<='] = $search_date_validation_end;
443 $param .=
'&search_date_validation_endmonth='.((int) $tmp[
'mon']).
'&search_date_validation_endday='.((int) $tmp[
'mday']).
'&search_date_validation_endyear='.((int) $tmp[
'year']);
446 if (!empty($search_date_due_start)) {
447 $filter[
't.date_lim_reglement>='] = $search_date_due_start;
448 $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;
451 if (!empty($search_date_due_end)) {
452 $filter[
't.date_lim_reglement<='] = $search_date_due_end;
453 $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;
455 if (!empty($search_debit)) {
456 $filter[
't.debit'] = $search_debit;
457 $param .=
'&search_debit='.urlencode($search_debit);
459 if (!empty($search_credit)) {
460 $filter[
't.credit'] = $search_credit;
461 $param .=
'&search_credit='.urlencode($search_credit);
463 if (!empty($search_lettering_code)) {
464 $filter[
't.lettering_code'] = $search_lettering_code;
465 $param .=
'&search_lettering_code='.urlencode($search_lettering_code);
467 if (!empty($search_not_reconciled)) {
468 $filter[
't.reconciled_option'] = $search_not_reconciled;
469 $param .=
'&search_not_reconciled='.urlencode($search_not_reconciled);
471 if (!empty($search_import_key)) {
472 $filter[
't.import_key'] = $search_import_key;
473 $param .=
'&search_import_key='.urlencode($search_import_key);
477 if ($action ===
'exporttopdf' && $permissiontoadd) {
478 $object->fetchAll(
'ASC,ASC,ASC',
'code_journal,doc_date,piece_num', 0, 0, $filter);
479 require_once DOL_DOCUMENT_ROOT .
'/core/modules/accountancy/doc/pdf_bookkeeping.modules.php';
481 $pdf->fromDate = $search_date_start;
482 $pdf->toDate = $search_date_end;
484 $result = $pdf->write_file($object, $langs);
487 setEventMessage($pdf->error,
"errors");
495 $objectclass =
'Bookkeeping';
496 $objectlabel =
'Bookkeeping';
497 $uploaddir =
$conf->societe->dir_output;
501 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
503 if (!$error && $action ==
'deletebookkeepingwriting' && $confirm ==
"yes" && $user->hasRight(
'accounting',
'mouvements',
'supprimer')) {
508 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect,
true);
509 if ($nb_lettering < 0) {
510 setEventMessages(
'', $lettering->errors,
'errors');
518 foreach ($toselect as $toselectid) {
519 $result =
$object->fetch($toselectid);
520 if ($result > 0 && (!isset(
$object->date_validation) ||
$object->date_validation ===
'')) {
524 } elseif ($result == 0) {
525 setEventMessages($langs->trans(
"ErrorBookkeepingDocDateNotOnActiveFiscalPeriod"),
null,
'errors');
533 } elseif ($result < 0) {
537 } elseif (isset(
$object->date_validation) &&
$object->date_validation !=
'') {
538 setEventMessages($langs->trans(
"ValidatedRecordWhereFound"),
null,
'errors');
550 setEventMessages($langs->trans(
"RecordsDeleted", $nbok),
null,
'mesgs');
551 } elseif ($nbok > 0) {
552 setEventMessages($langs->trans(
"RecordDeleted", $nbok),
null,
'mesgs');
554 setEventMessages($langs->trans(
"NoRecordDeleted"),
null,
'mesgs');
557 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?noreset=1".($param ?
'&'.$param :
''));
565 if (!$error && $action ==
'clonebookkeepingwriting' && $confirm ==
"yes" && $user->hasRight(
'accounting',
'mouvements',
'creer')) {
566 $result =
$object->newCloneMass($toselect, $journal_code, $massdate);
573 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?noreset=1".($param ?
'&'.$param :
''));
581 if (!$error && $action ==
'assignaccountbookkeepingwriting' && $confirm ==
"yes" && $user->hasRight(
'accounting',
'mouvements',
'creer')) {
582 $result =
$object->assignAccountMass($toselect, (
int) $account);
589 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?noreset=1".($param ?
'&'.$param :
''));
597 if (!$error && $action ==
'returnaccountbookkeepingwriting' && $confirm ==
"yes" && $user->hasRight(
'accounting',
'mouvements',
'creer')) {
598 $result =
$object->newReturnAccount($toselect, $journal_code, $massdate);
605 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?noreset=1".($param ?
'&'.$param :
''));
614 if ($massaction ==
'generalmatchingmanual' && $permissiontoadd) {
616 $result = $lettering->updateGeneralMatching($toselect);
618 setEventMessages(
'', $lettering->errors,
'errors');
620 setEventMessages($langs->trans($result == 0 ?
'AccountancyNoMachingModified' :
'AccountancyOneMatchingModifiedSuccessfully'), array(),
'mesgs');
621 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
624 } elseif ($massaction ==
'generalmatchingpartial' && $permissiontoadd) {
626 $result = $lettering->updateGeneralMatching($toselect,
true);
628 setEventMessages(
'', $lettering->errors,
'errors');
630 setEventMessages($langs->trans($result == 0 ?
'AccountancyNoMachingModified' :
'AccountancyOneMatchingModifiedSuccessfully'), array(),
'mesgs');
631 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
634 } elseif ($action ==
'generalunmatchingmanual' && $confirm ==
'yes' && $permissiontodelete) {
636 $result = $lettering->deleteGeneralMatching($toselect);
638 setEventMessages(
'', $lettering->errors,
'errors');
640 setEventMessages($langs->trans($result == 0 ?
'AccountancyNoUnmatchingModified' :
'AccountancyOneUnmatchingModifiedSuccessfully'), [],
'mesgs');
641 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
654$sql .=
" t.doc_date,";
655$sql .=
" t.doc_type,";
656$sql .=
" t.doc_ref,";
658$sql .=
" t.fk_docdet,";
659$sql .=
" t.thirdparty_code,";
660$sql .=
" t.subledger_account,";
661$sql .=
" t.subledger_label,";
662$sql .=
" t.numero_compte,";
663$sql .=
" t.label_compte,";
664$sql .=
" t.label_operation,";
667$sql .=
" t.lettering_code,";
668$sql .=
" t.matching_general,";
669$sql .=
" t.montant as amount,";
671$sql .=
" t.fk_user_author,";
672$sql .=
" t.import_key,";
673$sql .=
" t.code_journal,";
674$sql .=
" t.journal_label,";
675$sql .=
" t.piece_num,";
677$sql .=
" t.date_creation,";
678$sql .=
" t.tms as date_modification,";
679$sql .=
" t.date_export,";
680$sql .=
" t.date_validated as date_validation,";
681$sql .=
" t.date_lim_reglement,";
682$sql .=
" t.import_key";
686$sql .=
' FROM '.MAIN_DB_PREFIX.$object->table_element.
' as t';
689if (count($filter) > 0) {
690 foreach ($filter as $key => $value) {
691 if ($key ==
't.doc_date') {
692 $sqlwhere[] = $db->sanitize($key).
" = '".$db->idate($value).
"'";
693 } elseif ($key ==
't.doc_date>=') {
694 $sqlwhere[] =
"t.doc_date >= '".$db->idate($value).
"'";
695 } elseif ($key ==
't.doc_date<=') {
696 $sqlwhere[] =
"t.doc_date <= '".$db->idate($value).
"'";
697 } elseif ($key ==
't.numero_compte>=') {
698 $sqlwhere[] =
"t.numero_compte >= '".$db->escape($value).
"'";
699 } elseif ($key ==
't.numero_compte<=') {
700 $sqlwhere[] =
"t.numero_compte <= '".$db->escape($value).
"'";
701 } elseif ($key ==
't.subledger_account>=') {
702 $sqlwhere[] =
"t.subledger_account >= '".$db->escape($value).
"'";
703 } elseif ($key ==
't.subledger_account<=') {
704 $sqlwhere[] =
"t.subledger_account <= '".$db->escape($value).
"'";
705 } elseif ($key ==
't.piece_num') {
708 } elseif ($key ==
't.subledger_account' || $key ==
't.numero_compte') {
709 $sqlwhere[] = $db->sanitize($key).
" LIKE '".$db->escape($db->escapeforlike($value)).
"%'";
712 } elseif ($key ==
't.tms>=') {
713 $sqlwhere[] =
"t.tms >= '".$db->idate($value).
"'";
714 } elseif ($key ==
't.tms<=') {
715 $sqlwhere[] =
"t.tms <= '".$db->idate($value).
"'";
716 } elseif ($key ==
't.date_creation>=') {
717 $sqlwhere[] =
"t.date_creation >= '".$db->idate($value).
"'";
718 } elseif ($key ==
't.date_creation<=') {
719 $sqlwhere[] =
"t.date_creation <= '".$db->idate($value).
"'";
720 } elseif ($key ==
't.date_export>=') {
721 $sqlwhere[] =
"t.date_export >= '".$db->idate($value).
"'";
722 } elseif ($key ==
't.date_export<=') {
723 $sqlwhere[] =
"t.date_export <= '".$db->idate($value).
"'";
724 } elseif ($key ==
't.date_validated>=') {
725 $sqlwhere[] =
"t.date_validated >= '".$db->idate($value).
"'";
726 } elseif ($key ==
't.date_validated<=') {
727 $sqlwhere[] =
"t.date_validated <= '".$db->idate($value).
"'";
728 } elseif ($key ==
't.date_lim_reglement>=') {
729 $sqlwhere[] =
"t.date_lim_reglement >= '".$db->idate($value).
"'";
730 } elseif ($key ==
't.date_lim_reglement<=') {
731 $sqlwhere[] =
"t.date_lim_reglement <= '".$db->idate($value).
"'";
732 } elseif ($key ==
't.credit' || $key ==
't.debit') {
734 } elseif ($key ==
't.reconciled_option') {
735 $sqlwhere[] =
't.lettering_code IS NULL';
736 } elseif ($key ==
't.code_journal' && !empty($value)) {
737 if (is_array($value)) {
738 $sqlwhere[] =
natural_search(
"t.code_journal", implode(
',', $value), 3, 1);
742 } elseif ($key ==
't.search_accounting_code_in' && !empty($value)) {
743 $sqlwhere[] =
't.numero_compte IN ('.$db->sanitize($value, 1).
')';
749$sql .=
' WHERE t.entity IN ('.getEntity(
'accountancy').
')';
751if (count($sqlwhere) > 0) {
752 $sql .=
' AND '.implode(
' AND ', $sqlwhere);
763$title_page = $langs->trans(
"Operations").
' - '.$langs->trans(
"Journals");
766$nbtotalofrecords =
'';
769 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
770 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
771 $resql = $db->query($sqlforcount);
773 $objforcount = $db->fetch_object($resql);
774 $nbtotalofrecords = $objforcount->nbtotalofrecords;
776 dol_print_error($db);
779 if (($page * $limit) > (
int) $nbtotalofrecords) {
788$sql .= $db->order($sortfield, $sortorder);
790 $sql .= $db->plimit($limit + 1, $offset);
793$resql = $db->query($sql);
795 dol_print_error($db);
799$num = $db->num_rows($resql);
801$arrayofselected = is_array($toselect) ? $toselect : array();
805$help_url =
'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double';
806llxHeader(
'', $title_page, $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy accountancy-consultation page-journal');
814if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
815 $param .=
'&contextpage='.urlencode($contextpage);
817if ($limit > 0 && $limit !=
$conf->liste_limit) {
818 $param .=
'&limit='.((int) $limit);
822$arrayofmassactions = array();
823if (
getDolGlobalInt(
'ACCOUNTING_ENABLE_LETTERING') && $user->hasRight(
'accounting',
'mouvements',
'creer')) {
824 $arrayofmassactions[
'generalmatchingmanual'] = img_picto(
'',
'check',
'class="pictofixedwidth"') . $langs->trans(
'GeneralMatchingManual');
825 $arrayofmassactions[
'generalmatchingpartial'] = img_picto(
'',
'check',
'class="pictofixedwidth"') . $langs->trans(
'GeneralMatchingPartial');
826 $arrayofmassactions[
'pregeneralunmatchingmanual'] = img_picto(
'',
'uncheck',
'class="pictofixedwidth"') . $langs->trans(
'GeneralUnmatchingManual');
828if ($user->hasRight(
'accounting',
'mouvements',
'creer')) {
829 $arrayofmassactions[
'preclonebookkeepingwriting'] = img_picto(
'',
'clone',
'class="pictofixedwidth"').$langs->trans(
"Clone");
831if ($user->hasRight(
'accounting',
'mouvements',
'creer')) {
832 $arrayofmassactions[
'preassignaccountbookkeepingwriting'] = img_picto(
'',
'fa-exchange-alt',
'class="pictofixedwidth"').$langs->trans(
"AssignAccount");
834if ($user->hasRight(
'accounting',
'mouvements',
'creer')) {
835 $arrayofmassactions[
'prereturnaccountbookkeepingwriting'] = img_picto(
'',
'undo',
'class="pictofixedwidth"').$langs->trans(
"ReturnAccount");
837if ($user->hasRight(
'accounting',
'mouvements',
'supprimer')) {
838 $arrayofmassactions[
'predeletebookkeepingwriting'] = img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
842 || in_array($massaction,
844 'pregeneralunmatchingmanual',
845 'predeletebookkeepingwriting',
846 'preclonebookkeepingwriting',
847 'preassignaccountbookkeepingwriting',
848 'prereturnaccountbookkeepingwriting'
851 $arrayofmassactions = array();
853$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
855print
'<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
856print
'<input type="hidden" name="token" value="'.newToken().
'">';
857print
'<input type="hidden" name="action" value="list">';
858if ($optioncss !=
'') {
859 print
'<input type="hidden" name="optioncss" value="'.urlencode($optioncss).
'">';
861print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
862print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
863print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
864print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
867 $buttonLabel = $langs->trans(
"ExportFilteredList");
869 $buttonLabel = $langs->trans(
"ExportList");
872$parameters = array(
'param' => $param);
873$reshook = $hookmanager->executeHooks(
'addMoreActionsButtonsList', $parameters, $object, $action);
875 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
878$newcardbutton = empty($hookmanager->resPrint) ?
'' : $hookmanager->resPrint;
880if (empty($reshook)) {
881 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewFlatList'),
'',
'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.
'/accountancy/bookkeeping/list.php?'.$param,
'', 1, array(
'morecss' =>
'marginleftonly btnTitleSelected'));
882 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'GroupByAccountAccounting'),
'',
'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.
'/accountancy/bookkeeping/listbyaccount.php?'.$param,
'', 1, array(
'morecss' =>
'marginleftonly'));
883 $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'));
884 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ExportToPdf'),
'',
'fa fa-file-pdf paddingleft', $_SERVER[
'PHP_SELF'] .
'?token=' .
newToken() .
'&action=exporttopdf&' . $param,
'', $permissiontoexport, array(
'morecss' =>
'marginleftonly'));
886 $url =
'./card.php?action=create'.(!empty($type) ?
'&type=sub' :
'').
'&backtopage='.urlencode($_SERVER[
'PHP_SELF']);
887 if (!empty($socid)) {
888 $url .=
'&socid='.$socid;
891 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewAccountingMvt'),
'',
'fa fa-plus-circle paddingleft', $url,
'', $permissiontoadd);
894print_barre_liste($title_page, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'title_accountancy', 0, $newcardbutton,
'', $limit, 0, 0, 1);
896if ($massaction ==
'pregeneralunmatchingmanual') {
897 print $form->formconfirm($_SERVER[
'PHP_SELF'], $langs->trans(
'ConfirmMassGeneralUnmatchingManual'), $langs->trans(
"ConfirmMassGeneralUnmatchingQuestion", count($toselect)),
"generalunmatchingmanual",
null,
'', 0, 200, 500, 1);
898} elseif ($massaction ==
'predeletebookkeepingwriting') {
899 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDeleteBookkeepingWriting"), $langs->trans(
"ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)),
"deletebookkeepingwriting",
null,
'', 0, 200, 500, 1);
900} elseif ($massaction ==
'preassignaccountbookkeepingwriting') {
901 $input = $formaccounting->select_account(
'',
'account', 1);
902 $formquestion = array(array(
'type' =>
'other',
'name' =>
'account',
'label' =>
'<span class="fieldrequired">' . $langs->trans(
"AccountAccountingShort") .
'</span>',
'value' => $input),);
903 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"confirmMassAssignAccountBookkeepingWritingConfirm"), $langs->trans(
"ConfirmMassAssignAccountBookkeepingWritingQuestion", count($toselect)),
"assignaccountbookkeepingwriting", $formquestion,
'', 0, 200, 500, 1);
904} elseif ($massaction ==
'preclonebookkeepingwriting') {
905 $input1 = $form->selectDate(
'',
'massdate', 0, 0, 0,
"create_mvt", 1, 1);
906 $input2 = $formaccounting->select_journal($journal_code,
'code_journal', 0, 0, 1, 1) .
'</td>';
907 $formquestion = array(
910 'name' =>
'massdate',
911 'label' =>
'<span class="fieldrequired">' . $langs->trans(
"Docdate") .
'</span>',
917 $formquestion[] = array(
919 'name' =>
'code_journal',
920 'label' =>
'<span class="fieldrequired">' . $langs->trans(
"Codejournal") .
'</span>',
925 print $form->formconfirm(
926 $_SERVER[
"PHP_SELF"],
927 $langs->trans(
"ConfirmMassCloneBookkeepingWriting"),
928 $langs->trans(
"ConfirmMassCloneBookkeepingWritingQuestion", count($toselect)),
929 "clonebookkeepingwriting",
933} elseif ($massaction ==
'prereturnaccountbookkeepingwriting') {
934 $input1 = $form->selectDate(
'',
'massdate', 0, 0, 0,
"create_mvt", 1, 1);
935 $formquestion = array(array(
'type' =>
'other',
'name' =>
'massdate',
'label' =>
'<span class="fieldrequired">' . $langs->trans(
"Docdate") .
'</span>',
'value' => $input1));
936 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassReturnAccountBookkeepingWriting"), $langs->trans(
"ConfirmMassReturnAccountBookkeepingWritingQuestion", count($toselect)),
"returnaccountbookkeepingwriting", $formquestion,
'', 0, 200, 500, 1);
943include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
945$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
946$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
947if ($massactionbutton && $contextpage !=
'poslist') {
948 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
952$moreforfilter .=
'<div class="divsearchfield">';
953$moreforfilter .= $langs->trans(
'AccountingCategory').
': ';
954$moreforfilter .=
'<div class="nowrap inline-block">';
955$moreforfilter .= $formaccounting->select_accounting_category($search_account_category,
'search_account_category', 1, 0, 0, 0);
956$moreforfilter .=
'</div>';
957$moreforfilter .=
'</div>';
959$parameters = array();
960$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
961if (empty($reshook)) {
962 $moreforfilter .= $hookmanager->resPrint;
964 $moreforfilter = $hookmanager->resPrint;
967print
'<div class="liste_titre liste_titre_bydiv centpercent">';
971print
'<div class="div-table-responsive">';
972print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">';
975print
'<tr class="liste_titre_filter">';
977if (
$conf->main_checkbox_left_column) {
978 print
'<td class="liste_titre center">';
979 $searchpicto = $form->showFilterButtons(
'left');
984if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
985 print
'<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).
'"></td>';
988if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
989 print
'<td class="liste_titre center">';
990 print $formaccounting->multi_select_journal($search_ledger_code,
'search_ledger_code', 0, 1, 1, 1,
'maxwidth75');
994if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
995 print
'<td class="liste_titre center">';
996 print
'<div class="nowrapfordate">';
997 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
999 print
'<div class="nowrapfordate">';
1000 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1005if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1006 print
'<td class="liste_titre"><input type="text" name="search_doc_ref" class="width75" value="'.dol_escape_htmltag($search_doc_ref).
'"></td>';
1009if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
1010 print
'<td class="liste_titre">';
1011 print
'<div class="nowrap">';
1012 print $formaccounting->select_account($search_accountancy_code_start,
'search_accountancy_code_start', $langs->trans(
'From'), array(), 1, 1,
'maxwidth150',
'account');
1014 print
'<div class="nowrap">';
1015 print $formaccounting->select_account($search_accountancy_code_end,
'search_accountancy_code_end', $langs->trans(
'to'), array(), 1, 1,
'maxwidth150',
'account');
1020if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
1021 print
'<td class="liste_titre">';
1022 print
'<div class="nowrap">';
1023 print $formaccounting->select_auxaccount($search_accountancy_aux_code_start,
'search_accountancy_aux_code_start', $langs->trans(
'From'),
'maxwidth250',
'subledgeraccount');
1025 print
'<div class="nowrap">';
1026 print $formaccounting->select_auxaccount($search_accountancy_aux_code_end,
'search_accountancy_aux_code_end', $langs->trans(
'to'),
'maxwidth250',
'subledgeraccount');
1031if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1032 print
'<td class="liste_titre">';
1033 print
'<input type="text" size="7" class="flat" name="search_mvt_label" value="'.dol_escape_htmltag($search_mvt_label).
'"/>';
1037if (!empty($arrayfields[
't.debit'][
'checked'])) {
1038 print
'<td class="liste_titre right">';
1039 print
'<input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).
'">';
1043if (!empty($arrayfields[
't.credit'][
'checked'])) {
1044 print
'<td class="liste_titre right">';
1045 print
'<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).
'">';
1049if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1050 print
'<td class="liste_titre center">';
1051 print
'<input type="text" size="3" class="flat" name="search_lettering_code" value="'.dol_escape_htmltag($search_lettering_code).
'"/>';
1052 print
'<br><span class="nowrap"><input type="checkbox" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled ==
'notreconciled' ?
' checked' :
'').
'>'.$langs->trans(
"NotReconciled").
'</span>';
1057$parameters = array(
'arrayfields' => $arrayfields);
1058$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1059print $hookmanager->resPrint;
1062if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1063 print
'<td class="liste_titre center">';
1064 print
'<div class="nowrapfordate">';
1065 print $form->selectDate($search_date_creation_start,
'search_date_creation_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1067 print
'<div class="nowrapfordate">';
1068 print $form->selectDate($search_date_creation_end,
'search_date_creation_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1073if (!empty($arrayfields[
't.tms'][
'checked'])) {
1074 print
'<td class="liste_titre center">';
1075 print
'<div class="nowrapfordate">';
1076 print $form->selectDate($search_date_modification_start,
'search_date_modification_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1078 print
'<div class="nowrapfordate">';
1079 print $form->selectDate($search_date_modification_end,
'search_date_modification_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1084if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1085 print
'<td class="liste_titre center">';
1086 print
'<div class="nowrapfordate">';
1087 print $form->selectDate($search_date_export_start,
'search_date_export_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1089 print
'<div class="nowrapfordate">';
1090 print $form->selectDate($search_date_export_end,
'search_date_export_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1095if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1096 print
'<td class="liste_titre center">';
1097 print
'<div class="nowrapfordate">';
1098 print $form->selectDate($search_date_validation_start,
'search_date_validation_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1100 print
'<div class="nowrapfordate">';
1101 print $form->selectDate($search_date_validation_end,
'search_date_validation_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1106if (!empty($arrayfields[
't.date_lim_reglement'][
'checked'])) {
1107 print
'<td class="liste_titre center">';
1108 print
'<div class="nowrapfordate">';
1109 print $form->selectDate($search_date_due_start,
'search_date_due_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1111 print
'<div class="nowrapfordate">';
1112 print $form->selectDate($search_date_due_end,
'search_date_due_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1116if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1117 print
'<td class="liste_titre center">';
1118 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1122if (!
$conf->main_checkbox_left_column) {
1123 print
'<td class="liste_titre center">';
1124 $searchpicto = $form->showFilterButtons();
1130print
'<tr class="liste_titre">';
1131if (
$conf->main_checkbox_left_column) {
1132 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch actioncolumn ');
1134if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
1135 print_liste_field_titre($arrayfields[
't.piece_num'][
'label'], $_SERVER[
'PHP_SELF'],
"t.piece_num",
"", $param,
"", $sortfield, $sortorder);
1137if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
1138 print_liste_field_titre($arrayfields[
't.code_journal'][
'label'], $_SERVER[
'PHP_SELF'],
"t.code_journal",
"", $param,
'', $sortfield, $sortorder,
'center ');
1140if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1141 print_liste_field_titre($arrayfields[
't.doc_date'][
'label'], $_SERVER[
'PHP_SELF'],
"t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1143if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1144 print_liste_field_titre($arrayfields[
't.doc_ref'][
'label'], $_SERVER[
'PHP_SELF'],
"t.doc_ref",
"", $param,
"", $sortfield, $sortorder);
1146if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
1147 print_liste_field_titre($arrayfields[
't.numero_compte'][
'label'], $_SERVER[
'PHP_SELF'],
"t.numero_compte",
"", $param,
"", $sortfield, $sortorder);
1149if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
1150 print_liste_field_titre($arrayfields[
't.subledger_account'][
'label'], $_SERVER[
'PHP_SELF'],
"t.subledger_account",
"", $param,
"", $sortfield, $sortorder);
1152if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1153 print_liste_field_titre($arrayfields[
't.label_operation'][
'label'], $_SERVER[
'PHP_SELF'],
"t.label_operation",
"", $param,
"", $sortfield, $sortorder);
1155if (!empty($arrayfields[
't.debit'][
'checked'])) {
1156 print_liste_field_titre($arrayfields[
't.debit'][
'label'], $_SERVER[
'PHP_SELF'],
"t.debit",
"", $param,
'', $sortfield, $sortorder,
'right ');
1158if (!empty($arrayfields[
't.credit'][
'checked'])) {
1159 print_liste_field_titre($arrayfields[
't.credit'][
'label'], $_SERVER[
'PHP_SELF'],
"t.credit",
"", $param,
'', $sortfield, $sortorder,
'right ');
1161if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1162 print_liste_field_titre($arrayfields[
't.lettering_code'][
'label'], $_SERVER[
'PHP_SELF'],
"t.lettering_code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1165$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1166$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1167print $hookmanager->resPrint;
1168if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1169 print_liste_field_titre($arrayfields[
't.date_creation'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center ');
1171if (!empty($arrayfields[
't.tms'][
'checked'])) {
1172 print_liste_field_titre($arrayfields[
't.tms'][
'label'], $_SERVER[
'PHP_SELF'],
"t.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
1174if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1175 print_liste_field_titre($arrayfields[
't.date_export'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_export,t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1177if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1178 print_liste_field_titre($arrayfields[
't.date_validated'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_validated,t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1181if (!empty($arrayfields[
't.date_lim_reglement'][
'checked'])) {
1182 print_liste_field_titre($arrayfields[
't.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
't.date_lim_reglement',
'', $param,
'', $sortfield, $sortorder,
'center ');
1184if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1185 print_liste_field_titre($arrayfields[
't.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"t.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1187if (!
$conf->main_checkbox_left_column) {
1188 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1198$totalarray = array();
1199$totalarray[
'nbfield'] = 0;
1200$totalarray[
'val'] = array();
1201$totalarray[
'val'][
'totaldebit'] = 0;
1202$totalarray[
'val'][
'totalcredit'] = 0;
1204while ($i < min($num, $limit)) {
1205 $obj = $db->fetch_object($resql);
1210 $line->id = $obj->rowid;
1211 $line->doc_date = $db->jdate($obj->doc_date);
1212 $line->doc_type = $obj->doc_type;
1213 $line->doc_ref = $obj->doc_ref;
1214 $line->fk_doc = $obj->fk_doc;
1215 $line->fk_docdet = $obj->fk_docdet;
1216 $line->thirdparty_code = $obj->thirdparty_code;
1217 $line->subledger_account = $obj->subledger_account;
1218 $line->subledger_label = $obj->subledger_label;
1219 $line->numero_compte = $obj->numero_compte;
1220 $line->label_compte = $obj->label_compte;
1221 $line->label_operation = $obj->label_operation;
1222 $line->debit = $obj->debit;
1223 $line->credit = $obj->credit;
1224 $line->montant = $obj->amount;
1225 $line->amount = $obj->amount;
1226 $line->sens = $obj->sens;
1227 $line->lettering_code = $obj->lettering_code;
1228 $line->matching_general = $obj->matching_general;
1229 $line->fk_user_author = $obj->fk_user_author;
1230 $line->import_key = $obj->import_key;
1231 $line->code_journal = $obj->code_journal;
1232 $line->journal_label = $obj->journal_label;
1233 $line->piece_num = $obj->piece_num;
1234 $line->ref = $obj->ref;
1235 $line->date_creation = $db->jdate($obj->date_creation);
1236 $line->date_modification = $db->jdate($obj->date_modification);
1237 $line->date_export = $db->jdate($obj->date_export);
1238 $line->date_validation = $db->jdate($obj->date_validation);
1240 $line->date_lim_reglement = $db->jdate($obj->date_lim_reglement);
1242 print
'<tr class="oddeven">';
1244 if (
$conf->main_checkbox_left_column) {
1245 print
'<td class="nowraponall center">';
1246 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
1248 if (in_array($line->id, $arrayofselected)) {
1251 print
'<input id="cb'.$line->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.
'"'.($selected ?
' checked="checked"' :
'').
' />';
1255 $totalarray[
'nbfield']++;
1260 if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
1261 print
'<td class="nowraponall">';
1263 $object->piece_num = $line->piece_num;
1265 print
$object->getNomUrl(1,
'', 0,
'', 1);
1266 print
'<span class="hideonsmartphone">';
1267 if (!empty($line->date_export)) {
1268 print img_picto($langs->trans(
"DateExport").
": ".
dol_print_date($line->date_export,
'dayhour').
" (".$langs->trans(
"TransactionExportDesc").
")",
'fa-file-export',
'class="paddingleft pictofixedwidth opacitymedium"');
1270 if (!empty($line->date_validation)) {
1271 print img_picto($langs->trans(
"DateValidation").
": ".
dol_print_date($line->date_validation,
'dayhour').
" (".$langs->trans(
"TransactionBlockedLockedDesc").
")",
'fa-lock',
'class="paddingleft pictofixedwidth opacitymedium"');
1276 $totalarray[
'nbfield']++;
1281 if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
1282 if (empty(
$conf->cache[
'accountingjournal'][$line->code_journal])) {
1284 $accountingjournal->fetch(0, $line->code_journal);
1285 $conf->cache[
'accountingjournal'][$line->code_journal] = $accountingjournal;
1287 $accountingjournal =
$conf->cache[
'accountingjournal'][$line->code_journal];
1290 $journaltoshow = (($accountingjournal->id > 0) ? $accountingjournal->getNomUrl(0, 0, 0,
'', 0) : $line->code_journal);
1291 print
'<td class="center tdoverflowmax150">'.$journaltoshow.
'</td>';
1293 $totalarray[
'nbfield']++;
1298 if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1299 print
'<td class="center">'.dol_print_date($line->doc_date,
'day').
'</td>';
1301 $totalarray[
'nbfield']++;
1307 if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1309 $objectstatic =
null;
1311 if ($line->doc_type ===
'customer_invoice') {
1312 $langs->loadLangs(array(
'bills'));
1314 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
1315 $objectstatic =
new Facture($db);
1316 $objectstatic->fetch($line->fk_doc);
1321 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$objectstatic->id;
1322 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1323 } elseif ($line->doc_type ===
'supplier_invoice') {
1324 $langs->loadLangs(array(
'bills'));
1326 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
1328 $objectstatic->fetch($line->fk_doc);
1330 $modulepart =
'invoice_supplier';
1335 $filedir =
getMultidirOutput($objectstatic,
'', 1).dol_sanitizeFileName($line->doc_ref);
1336 $subdir =
getMultidirOutput($objectstatic,
'', 1,
'outputrel').dol_sanitizeFileName($line->doc_ref);
1339 if ($objectstatic->id > 0) {
1340 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
1342 $documentlink = $line->doc_ref;
1344 } elseif ($line->doc_type ===
'expense_report') {
1345 $langs->loadLangs(array(
'trips'));
1347 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
1349 $objectstatic->fetch($line->fk_doc);
1354 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$objectstatic->id;
1355 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1356 } elseif ($line->doc_type ===
'bank') {
1357 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
1359 $objectstatic->fetch($line->fk_doc);
1365 $labeltoshowalt =
'';
1366 $classforlabel =
'';
1367 if (($line->doc_type ===
'customer_invoice' || $line->doc_type ===
'supplier_invoice' || $line->doc_type ===
'expense_report') && is_object($objectstatic)) {
1368 $labeltoshow .= $objectstatic->getNomUrl(1,
'', 0, 0,
'', 0, -1, 1);
1369 $labeltoshow .= $documentlink;
1370 $labeltoshowalt .= $objectstatic->ref;
1371 } elseif ($line->doc_type ===
'bank' && is_object($objectstatic)) {
1372 $labeltoshow .= $objectstatic->getNomUrl(1);
1373 $labeltoshowalt .= $objectstatic->ref;
1374 $bank_ref = strstr($line->doc_ref,
'-');
1375 $labeltoshow .=
" " . $bank_ref;
1376 $labeltoshowalt .=
" " . $bank_ref;
1378 $labeltoshow .= $line->doc_ref;
1379 $labeltoshowalt .= $line->doc_ref;
1380 $classforlabel =
'tdoverflowmax250';
1383 print
'<td class="nowraponall'.($classforlabel ?
' '.$classforlabel :
'').
'" title="'.
dol_escape_htmltag($labeltoshowalt).
'">';
1387 $totalarray[
'nbfield']++;
1392 if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
1393 print
'<td>'.length_accountg($line->numero_compte).
'</td>';
1395 $totalarray[
'nbfield']++;
1400 if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
1401 print
'<td>'.length_accounta($line->subledger_account).
'</td>';
1403 $totalarray[
'nbfield']++;
1408 if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1409 print
'<td class="small tdoverflowmax200" title="'.dol_escape_htmltag($line->label_operation).
'">'.
dol_escape_htmltag($line->label_operation).
'</td>';
1411 $totalarray[
'nbfield']++;
1416 if (!empty($arrayfields[
't.debit'][
'checked'])) {
1417 print
'<td class="right nowraponall amount">'.($line->debit != 0 ?
price($line->debit) :
'').
'</td>';
1419 $totalarray[
'nbfield']++;
1422 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totaldebit';
1424 $totalarray[
'val'][
'totaldebit'] += $line->debit;
1428 if (!empty($arrayfields[
't.credit'][
'checked'])) {
1429 print
'<td class="right nowraponall amount">'.($line->credit != 0 ?
price($line->credit) :
'').
'</td>';
1431 $totalarray[
'nbfield']++;
1434 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalcredit';
1436 $totalarray[
'val'][
'totalcredit'] += $line->credit;
1440 if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1444 if (!empty($line->matching_general)) {
1445 $tooltipText .= $langs->trans(
'GeneralMatching');
1447 $badge .=
"badge-status4";
1448 } elseif (empty($line->matching_general) && !empty($line->lettering_code)) {
1449 $tooltipText .= $langs->trans(
'AuxiliaryMatching');
1451 $badge .=
"badge-status1";
1453 print
'<td class="center classfortooltip" title="'.$tooltipText.
'"><span class="badge '.$badge.
'"><i class="fas '.$icon.
' fa-xs"></i> '.$line->lettering_code.
'</span></td>';
1455 $totalarray[
'nbfield']++;
1460 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1461 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1462 print $hookmanager->resPrint;
1465 if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1466 print
'<td class="center">'.dol_print_date($line->date_creation,
'dayhour',
'tzuserrel').
'</td>';
1468 $totalarray[
'nbfield']++;
1473 if (!empty($arrayfields[
't.tms'][
'checked'])) {
1474 print
'<td class="center">'.dol_print_date($line->date_modification,
'dayhour',
'tzuserrel').
'</td>';
1476 $totalarray[
'nbfield']++;
1481 if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1482 print
'<td class="center nowraponall">'.dol_print_date($line->date_export,
'dayhour',
'tzuserrel').
'</td>';
1484 $totalarray[
'nbfield']++;
1489 if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1490 print
'<td class="center nowraponall">'.dol_print_date($line->date_validation,
'dayhour',
'tzuserrel').
'</td>';
1492 $totalarray[
'nbfield']++;
1497 if (!empty($arrayfields[
't.date_lim_reglement'][
'checked'])) {
1498 print
'<td class="center">'.dol_print_date($line->date_lim_reglement,
'day').
'</td>';
1500 $totalarray[
'nbfield']++;
1504 if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1505 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($obj->import_key).
'">'.
dol_escape_htmltag($obj->import_key).
"</td>\n";
1507 $totalarray[
'nbfield']++;
1512 if (!
$conf->main_checkbox_left_column) {
1513 print
'<td class="nowraponall center">';
1514 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
1516 if (in_array($line->id, $arrayofselected)) {
1519 print
'<input id="cb'.$line->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.
'"'.($selected ?
' checked="checked"' :
'').
' />';
1523 $totalarray[
'nbfield']++;
1534include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1539 foreach ($arrayfields as $key => $val) {
1540 if (!empty($val[
'checked'])) {
1544 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1547$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1548$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1549print $hookmanager->resPrint;
if(! $sortfield) if(! $sortorder) $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.
Class to build sending documents with model Espadon.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
GETPOSTDATE($prefix, $hourTime='', $gm='auto', $saverestore='')
Helper function that combines values of a dolibarr DatePicker (such as Form\selectDate) for year,...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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 a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.