33require
'../../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfiscalyear.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeeping.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/lettering.class.php';
54$langs->loadLangs(array(
"accountancy",
"categories",
"compta"));
58$journal_code =
GETPOST(
'code_journal',
'alpha');
59$account =
GETPOST(
"account",
'int');
63$action =
GETPOST(
'action',
'aZ09');
64$massaction =
GETPOST(
'massaction',
'alpha');
65$confirm =
GETPOST(
'confirm',
'alpha');
66$toselect =
GETPOST(
'toselect',
'array');
67$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'bookkeepinglist';
70$search_mvt_num =
GETPOST(
'search_mvt_num',
'alpha');
71$search_doc_type =
GETPOST(
"search_doc_type",
'alpha');
72$search_doc_ref =
GETPOST(
"search_doc_ref",
'alpha');
74$search_doc_date =
GETPOSTDATE(
'doc_date',
'getpost');
76$search_date_start =
GETPOSTDATE(
'search_date_start',
'getpost',
'auto',
'search_date_start_accountancy');
77$search_date_end =
GETPOSTDATE(
'search_date_end',
'getpostend',
'auto',
'search_date_end_accountancy');
79$search_date_creation_start =
GETPOSTDATE(
'search_date_creation_start',
'getpost');
80$search_date_creation_end =
GETPOSTDATE(
'search_date_creation_end',
'getpostend');
82$search_date_modification_start =
GETPOSTDATE(
'search_date_modification_start',
'getpost');
83$search_date_modification_end =
GETPOSTDATE(
'search_date_modification_end',
'getpostend');
85$search_date_export_start =
GETPOSTDATE(
'search_date_export_start',
'getpost');
86$search_date_export_end =
GETPOSTDATE(
'search_date_export_end',
'getpostend');
88$search_date_validation_start =
GETPOSTDATE(
'search_date_validation_start',
'getpost');
89$search_date_validation_end =
GETPOSTDATE(
'search_date_validation_end',
'getpostend');
92$search_date_due_start_day =
GETPOSTINT(
'search_date_due_start_day');
93$search_date_due_start_month =
GETPOSTINT(
'search_date_due_start_month');
94$search_date_due_start_year =
GETPOSTINT(
'search_date_due_start_year');
95$search_date_due_start =
GETPOSTDATE(
'search_date_due_start_',
'getpost');
98$search_date_due_end_day =
GETPOSTINT(
'search_date_due_end_day');
99$search_date_due_end_month =
GETPOSTINT(
'search_date_due_end_month');
100$search_date_due_end_year =
GETPOSTINT(
'search_date_due_end_year');
101$search_date_due_end =
GETPOSTDATE(
'search_date_due_end_',
'getpostend');
103$search_import_key =
GETPOST(
"search_import_key",
'alpha');
105$search_account_category =
GETPOSTINT(
'search_account_category');
107$search_accountancy_code =
GETPOST(
"search_accountancy_code",
'alpha');
108$search_accountancy_code_start =
GETPOST(
'search_accountancy_code_start',
'alpha');
109if ($search_accountancy_code_start == - 1) {
110 $search_accountancy_code_start =
'';
112$search_accountancy_code_end =
GETPOST(
'search_accountancy_code_end',
'alpha');
113if ($search_accountancy_code_end == - 1) {
114 $search_accountancy_code_end =
'';
117$search_accountancy_aux_code =
GETPOST(
"search_accountancy_aux_code",
'alpha');
118$search_accountancy_aux_code_start =
GETPOST(
'search_accountancy_aux_code_start',
'alpha');
119if ($search_accountancy_aux_code_start == - 1) {
120 $search_accountancy_aux_code_start =
'';
122$search_accountancy_aux_code_end =
GETPOST(
'search_accountancy_aux_code_end',
'alpha');
123if ($search_accountancy_aux_code_end == - 1) {
124 $search_accountancy_aux_code_end =
'';
126$search_mvt_label =
GETPOST(
'search_mvt_label',
'alpha');
127$search_direction =
GETPOST(
'search_direction',
'alpha');
128$search_debit =
GETPOST(
'search_debit',
'alpha');
129$search_credit =
GETPOST(
'search_credit',
'alpha');
130$search_ledger_code =
GETPOST(
'search_ledger_code',
'array');
131$search_lettering_code =
GETPOST(
'search_lettering_code',
'alpha');
132$search_not_reconciled =
GETPOST(
'search_not_reconciled',
'alpha');
136$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
137$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
138$optioncss =
GETPOST(
'optioncss',
'alpha');
140if (empty($page) || $page < 0) {
143$offset = $limit * $page;
144$pageprev = $page - 1;
145$pagenext = $page + 1;
146if ($sortorder ==
"") {
149if ($sortfield ==
"") {
150 $sortfield =
"t.piece_num,t.rowid";
155$hookmanager->initHooks(array(
'bookkeepinglist'));
159$form =
new Form($db);
161if (!in_array($action, array(
'delmouv',
'delmouvconfirm')) && !GETPOSTISSET(
'begin') && !GETPOSTISSET(
'formfilteraction') &&
GETPOST(
'page',
'alpha') ==
'' && !
GETPOSTINT(
'noreset') && $user->hasRight(
'accounting',
'mouvements',
'export')) {
162 if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET(
'restore_lastsearch_values') && !
GETPOST(
'search_mvt_num') && !
GETPOST(
'search_accountancy_code_start')) {
163 $sql =
"SELECT date_start, date_end";
164 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_fiscalyear ";
166 $sql .=
" WHERE rowid = " .
getDolGlobalInt(
'ACCOUNTANCY_FISCALYEAR_DEFAULT');
168 $sql .=
" WHERE date_start < '" . $db->idate(
dol_now()) .
"' and date_end > '" . $db->idate(
dol_now()) .
"'";
170 $sql .= $db->plimit(1);
171 $res = $db->query($sql);
173 if ($db->num_rows($res) > 0) {
174 $fiscalYear = $db->fetch_object($res);
175 $search_date_start = strtotime($fiscalYear->date_start);
176 $search_date_end = strtotime($fiscalYear->date_end);
183 $year_end = $year_start + 1;
184 $month_end = $month_start - 1;
185 if ($month_end < 1) {
189 $search_date_start =
dol_mktime(0, 0, 0, $month_start, 1, $year_start);
197 't.piece_num' => array(
'label' => $langs->trans(
"TransactionNumShort"),
'checked' =>
'1'),
198 't.code_journal' => array(
'label' => $langs->trans(
"Codejournal"),
'checked' =>
'1'),
199 't.doc_date' => array(
'label' => $langs->trans(
"Docdate"),
'checked' =>
'1'),
200 't.doc_ref' => array(
'label' => $langs->trans(
"Piece"),
'checked' =>
'1'),
201 't.numero_compte' => array(
'label' => $langs->trans(
"AccountAccountingShort"),
'checked' =>
'1'),
202 't.subledger_account' => array(
'label' => $langs->trans(
"SubledgerAccount"),
'checked' =>
'1'),
203 't.label_operation' => array(
'label' => $langs->trans(
"Label"),
'checked' =>
'1'),
204 't.debit' => array(
'label' => $langs->trans(
"AccountingDebit"),
'checked' =>
'1'),
205 't.credit' => array(
'label' => $langs->trans(
"AccountingCredit"),
'checked' =>
'1'),
206 't.lettering_code' => array(
'label' => $langs->trans(
"LetteringCode"),
'checked' =>
'1'),
207 't.date_creation' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' =>
'0'),
208 't.tms' => array(
'label' => $langs->trans(
"DateModification"),
'checked' =>
'0'),
209 't.date_export' => array(
'label' => $langs->trans(
"DateExport"),
'checked' =>
'0'),
210 't.date_validated' => array(
'label' => $langs->trans(
"DateValidationAndLock"),
'checked' =>
'0',
'enabled' => (
string) (
int) !
getDolGlobalString(
"ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
211 't.date_lim_reglement' => array(
'label' => $langs->trans(
"DateDue"),
'checked' =>
'0'),
212 't.import_key' => array(
'label' => $langs->trans(
"ImportId"),
'checked' =>
'0',
'position' => 1100),
216 unset($arrayfields[
't.lettering_code']);
221if (!isModEnabled(
'accounting')) {
224if ($user->socid > 0) {
227if (!$user->hasRight(
'accounting',
'mouvements',
'lire')) {
232$permissiontoread = $user->hasRight(
'accounting',
'mouvements',
'lire');
233$permissiontoadd = $user->hasRight(
'accounting',
'mouvements',
'creer');
234$permissiontodelete = $user->hasRight(
'accounting',
'mouvements',
'supprimer');
235$permissiontoexport = $user->hasRight(
'accounting',
'mouvements',
'export');
245if (
GETPOST(
'cancel',
'alpha')) {
249if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'preunletteringauto' && $massaction !=
'preunletteringmanual' && $massaction !=
'predeletebookkeepingwriting' && $massaction !=
'preclonebookkeepingwriting' && $massaction !=
'preassignaccountbookkeepingwriting' && $massaction !=
'prereturnaccountbookkeepingwriting') {
253$parameters = array(
'socid' => $socid);
254$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
259if (empty($reshook)) {
260 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
262 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
263 $search_mvt_num =
'';
264 $search_doc_type =
'';
265 $search_doc_ref =
'';
266 $search_doc_date =
'';
267 $search_account_category =
'';
268 $search_accountancy_code =
'';
269 $search_accountancy_code_start =
'';
270 $search_accountancy_code_end =
'';
271 $search_accountancy_aux_code =
'';
272 $search_accountancy_aux_code_start =
'';
273 $search_accountancy_aux_code_end =
'';
274 $search_mvt_label =
'';
275 $search_direction =
'';
276 $search_ledger_code = array();
277 $search_date_start =
'';
278 $search_date_end =
'';
279 $search_date_creation_start =
'';
280 $search_date_creation_end =
'';
281 $search_date_modification_start =
'';
282 $search_date_modification_end =
'';
283 $search_date_export_start =
'';
284 $search_date_export_end =
'';
285 $search_date_validation_start =
'';
286 $search_date_validation_end =
'';
288 $search_date_due_start_day =
'';
289 $search_date_due_start_month =
'';
290 $search_date_due_start_year =
'';
291 $search_date_due_start =
'';
293 $search_date_due_end_day =
'';
294 $search_date_due_end_month =
'';
295 $search_date_due_end_year =
'';
296 $search_date_due_end =
'';
299 $search_lettering_code =
'';
300 $search_not_reconciled =
'';
301 $search_import_key =
'';
303 unset($_SESSION[
'DOLDATE_search_date_start_accountancy_day']);
304 unset($_SESSION[
'DOLDATE_search_date_start_accountancy_month']);
305 unset($_SESSION[
'DOLDATE_search_date_start_accountancy_year']);
306 unset($_SESSION[
'DOLDATE_search_date_end_accountancy_day']);
307 unset($_SESSION[
'DOLDATE_search_date_end_accountancy_month']);
308 unset($_SESSION[
'DOLDATE_search_date_end_accountancy_year']);
312 if (!empty($search_date_start)) {
313 $filter[
't.doc_date>='] = $search_date_start;
315 $param .=
'&search_date_startmonth='.((int) $tmp[
'mon']).
'&search_date_startday='.((int) $tmp[
'mday']).
'&search_date_startyear='.((int) $tmp[
'year']);
317 if (!empty($search_date_end)) {
318 $filter[
't.doc_date<='] = $search_date_end;
320 $param .=
'&search_date_endmonth='.((int) $tmp[
'mon']).
'&search_date_endday='.((int) $tmp[
'mday']).
'&search_date_endyear='.((int) $tmp[
'year']);
322 if (!empty($search_doc_date)) {
323 $filter[
't.doc_date'] = $search_doc_date;
325 $param .=
'&doc_datemonth='.((int) $tmp[
'mon']).
'&doc_dateday='.((int) $tmp[
'mday']).
'&doc_dateyear='.((int) $tmp[
'year']);
327 if (!empty($search_doc_type)) {
328 $filter[
't.doc_type'] = $search_doc_type;
329 $param .=
'&search_doc_type='.urlencode($search_doc_type);
331 if (!empty($search_doc_ref)) {
332 $filter[
't.doc_ref'] = $search_doc_ref;
333 $param .=
'&search_doc_ref='.urlencode($search_doc_ref);
335 if ($search_account_category !=
'-1' && !empty($search_account_category)) {
336 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountancycategory.class.php';
339 $listofaccountsforgroup = $accountingcategory->getCptsCat(0,
'fk_accounting_category = '.((
int) $search_account_category));
340 $listofaccountsforgroup2 = array();
341 if (is_array($listofaccountsforgroup)) {
342 foreach ($listofaccountsforgroup as $tmpval) {
343 $listofaccountsforgroup2[] =
"'".$db->escape((
string) $tmpval[
'account_number']).
"'";
346 if (!empty($listofaccountsforgroup2)) {
347 $filter[
't.search_accounting_code_in'] = implode(
',', $listofaccountsforgroup2);
349 $filter[
't.search_accounting_code_in'] =
"''";
350 setEventMessages($langs->trans(
"ThisCategoryHasNoItems"),
null,
'warnings');
352 $param .=
'&search_account_category='.urlencode((
string) ($search_account_category));
354 if (!empty($search_accountancy_code)) {
355 $filter[
't.numero_compte'] = $search_accountancy_code;
356 $param .=
'&search_accountancy_code='.urlencode($search_accountancy_code);
358 if (!empty($search_accountancy_code_start)) {
359 $filter[
't.numero_compte>='] = $search_accountancy_code_start;
360 $param .=
'&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
362 if (!empty($search_accountancy_code_end)) {
363 $filter[
't.numero_compte<='] = $search_accountancy_code_end;
364 $param .=
'&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
366 if (!empty($search_accountancy_aux_code)) {
367 $filter[
't.subledger_account'] = $search_accountancy_aux_code;
368 $param .=
'&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
370 if (!empty($search_accountancy_aux_code_start)) {
371 $filter[
't.subledger_account>='] = $search_accountancy_aux_code_start;
372 $param .=
'&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
374 if (!empty($search_accountancy_aux_code_end)) {
375 $filter[
't.subledger_account<='] = $search_accountancy_aux_code_end;
376 $param .=
'&search_accountancy_aux_code_end='.urlencode($search_accountancy_aux_code_end);
378 if (!empty($search_mvt_label)) {
379 $filter[
't.label_operation'] = $search_mvt_label;
380 $param .=
'&search_mvt_label='.urlencode($search_mvt_label);
382 if (!empty($search_direction)) {
383 $filter[
't.sens'] = $search_direction;
384 $param .=
'&search_direction='.urlencode($search_direction);
386 if (!empty($search_ledger_code)) {
387 $filter[
't.code_journal'] = $search_ledger_code;
388 foreach ($search_ledger_code as $code) {
389 $param .=
'&search_ledger_code[]='.urlencode($code);
392 if (!empty($search_mvt_num)) {
393 $filter[
't.piece_num'] = $search_mvt_num;
394 $param .=
'&search_mvt_num='.urlencode((
string) ($search_mvt_num));
396 if (!empty($search_date_creation_start)) {
397 $filter[
't.date_creation>='] = $search_date_creation_start;
399 $param .=
'&search_date_creation_startmonth='.((int) $tmp[
'mon']).
'&search_date_creation_startday='.((int) $tmp[
'mday']).
'&search_date_creation_startyear='.((int) $tmp[
'year']);
401 if (!empty($search_date_creation_end)) {
402 $filter[
't.date_creation<='] = $search_date_creation_end;
404 $param .=
'&search_date_creation_endmonth='.((int) $tmp[
'mon']).
'&search_date_creation_endday='.((int) $tmp[
'mday']).
'&search_date_creation_endyear='.((int) $tmp[
'year']);
406 if (!empty($search_date_modification_start)) {
407 $filter[
't.tms>='] = $search_date_modification_start;
408 $tmp =
dol_getdate($search_date_modification_start);
409 $param .=
'&search_date_modification_startmonth='.((int) $tmp[
'mon']).
'&search_date_modification_startday='.((int) $tmp[
'mday']).
'&search_date_modification_startyear='.((int) $tmp[
'year']);
411 if (!empty($search_date_modification_end)) {
412 $filter[
't.tms<='] = $search_date_modification_end;
414 $param .=
'&search_date_modification_endmonth='.((int) $tmp[
'mon']).
'&search_date_modification_endday='.((int) $tmp[
'mday']).
'&search_date_modification_endyear='.((int) $tmp[
'year']);
416 if (!empty($search_date_export_start)) {
417 $filter[
't.date_export>='] = $search_date_export_start;
419 $param .=
'&search_date_export_startmonth='.((int) $tmp[
'mon']).
'&search_date_export_startday='.((int) $tmp[
'mday']).
'&search_date_export_startyear='.((int) $tmp[
'year']);
421 if (!empty($search_date_export_end)) {
422 $filter[
't.date_export<='] = $search_date_export_end;
424 $param .=
'&search_date_export_endmonth='.((int) $tmp[
'mon']).
'&search_date_export_endday='.((int) $tmp[
'mday']).
'&search_date_export_endyear='.((int) $tmp[
'year']);
426 if (!empty($search_date_validation_start)) {
427 $filter[
't.date_validated>='] = $search_date_validation_start;
429 $param .=
'&search_date_validation_startmonth='.((int) $tmp[
'mon']).
'&search_date_validation_startday='.((int) $tmp[
'mday']).
'&search_date_validation_startyear='.((int) $tmp[
'year']);
431 if (!empty($search_date_validation_end)) {
432 $filter[
't.date_validated<='] = $search_date_validation_end;
434 $param .=
'&search_date_validation_endmonth='.((int) $tmp[
'mon']).
'&search_date_validation_endday='.((int) $tmp[
'mday']).
'&search_date_validation_endyear='.((int) $tmp[
'year']);
437 if (!empty($search_date_due_start)) {
438 $filter[
't.date_lim_reglement>='] = $search_date_due_start;
439 $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;
442 if (!empty($search_date_due_end)) {
443 $filter[
't.date_lim_reglement<='] = $search_date_due_end;
444 $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;
446 if (!empty($search_debit)) {
447 $filter[
't.debit'] = $search_debit;
448 $param .=
'&search_debit='.urlencode($search_debit);
450 if (!empty($search_credit)) {
451 $filter[
't.credit'] = $search_credit;
452 $param .=
'&search_credit='.urlencode($search_credit);
454 if (!empty($search_lettering_code)) {
455 $filter[
't.lettering_code'] = $search_lettering_code;
456 $param .=
'&search_lettering_code='.urlencode($search_lettering_code);
458 if (!empty($search_not_reconciled)) {
459 $filter[
't.reconciled_option'] = $search_not_reconciled;
460 $param .=
'&search_not_reconciled='.urlencode($search_not_reconciled);
462 if (!empty($search_import_key)) {
463 $filter[
't.import_key'] = $search_import_key;
464 $param .=
'&search_import_key='.urlencode($search_import_key);
468 if ($action ===
'exporttopdf' && $permissiontoadd) {
469 $object->fetchAll(
'ASC,ASC,ASC',
'code_journal,doc_date,piece_num', 0, 0, $filter);
470 require_once DOL_DOCUMENT_ROOT .
'/core/modules/accountancy/doc/pdf_bookkeeping.modules.php';
472 $pdf->fromDate = $search_date_start;
473 $pdf->toDate = $search_date_end;
475 $result = $pdf->write_file($object, $langs);
486 $objectclass =
'Bookkeeping';
487 $objectlabel =
'Bookkeeping';
488 $uploaddir =
$conf->societe->dir_output;
491 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
493 if (!$error && $action ==
'deletebookkeepingwriting' && $confirm ==
"yes" && $user->hasRight(
'accounting',
'mouvements',
'supprimer')) {
498 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect,
true);
499 if ($nb_lettering < 0) {
508 foreach ($toselect as $toselectid) {
509 $result =
$object->fetch($toselectid);
510 if ($result > 0 && (!isset(
$object->date_validation) ||
$object->date_validation ===
'')) {
519 } elseif ($result < 0) {
523 } elseif (isset(
$object->date_validation) &&
$object->date_validation !=
'') {
524 setEventMessages($langs->trans(
"ValidatedRecordWhereFound"),
null,
'errors');
537 } elseif ($nbok > 0) {
543 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?noreset=1".($param ?
'&'.$param :
''));
551 if (!$error && $action ==
'clonebookkeepingwriting' && $confirm ==
"yes" && $user->hasRight(
'accounting',
'mouvements',
'creer')) {
552 $result =
$object->newCloneMass($toselect, $journal_code, $massdate);
558 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?noreset=1".($param ?
'&'.$param :
''));
566 if (!$error && $action ==
'assignaccountbookkeepingwriting' && $confirm ==
"yes" && $user->hasRight(
'accounting',
'mouvements',
'creer')) {
567 $result =
$object->assignAccountMass($toselect, (
int) $account);
573 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?noreset=1".($param ?
'&'.$param :
''));
581 if (!$error && $action ==
'returnaccountbookkeepingwriting' && $confirm ==
"yes" && $user->hasRight(
'accounting',
'mouvements',
'creer')) {
582 $result =
$object->newReturnAccount($toselect, $journal_code, $massdate);
588 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?noreset=1".($param ?
'&'.$param :
''));
597 if ($massaction ==
'letteringauto' && $permissiontoadd) {
599 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
600 if ($nb_lettering < 0) {
603 $nb_lettering = max(0, abs($nb_lettering) - 2);
604 } elseif ($nb_lettering == 0) {
606 setEventMessages($langs->trans(
'AccountancyNoLetteringModified'), array(),
'mesgs');
608 if ($nb_lettering == 1) {
609 setEventMessages($langs->trans(
'AccountancyOneLetteringModifiedSuccessfully'), array(),
'mesgs');
610 } elseif ($nb_lettering > 1) {
611 setEventMessages($langs->trans(
'AccountancyLetteringModifiedSuccessfully', $nb_lettering), array(),
'mesgs');
615 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
618 } elseif ($massaction ==
'letteringmanual' && $permissiontoadd) {
620 $result = $lettering->updateLettering($toselect);
624 setEventMessages($langs->trans(
'AccountancyOneLetteringModifiedSuccessfully'), array(),
'mesgs');
625 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
628 } elseif ($action ==
'unletteringauto' && $confirm ==
"yes" && $permissiontoadd) {
630 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect,
true);
631 if ($nb_lettering < 0) {
634 $nb_lettering = max(0, abs($nb_lettering) - 2);
635 } elseif ($nb_lettering == 0) {
637 setEventMessages($langs->trans(
'AccountancyNoUnletteringModified'), array(),
'mesgs');
639 if ($nb_lettering == 1) {
640 setEventMessages($langs->trans(
'AccountancyOneUnletteringModifiedSuccessfully'), array(),
'mesgs');
641 } elseif ($nb_lettering > 1) {
642 setEventMessages($langs->trans(
'AccountancyUnletteringModifiedSuccessfully', $nb_lettering), array(),
'mesgs');
646 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
649 } elseif ($action ==
'unletteringmanual' && $confirm ==
"yes" && $permissiontoadd) {
651 $nb_lettering = $lettering->deleteLettering($toselect);
652 if ($nb_lettering < 0) {
655 setEventMessages($langs->trans(
'AccountancyOneUnletteringModifiedSuccessfully'), array(),
'mesgs');
656 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
669$sql .=
" t.doc_date,";
670$sql .=
" t.doc_type,";
671$sql .=
" t.doc_ref,";
673$sql .=
" t.fk_docdet,";
674$sql .=
" t.thirdparty_code,";
675$sql .=
" t.subledger_account,";
676$sql .=
" t.subledger_label,";
677$sql .=
" t.numero_compte,";
678$sql .=
" t.label_compte,";
679$sql .=
" t.label_operation,";
682$sql .=
" t.lettering_code,";
683$sql .=
" t.montant as amount,";
685$sql .=
" t.fk_user_author,";
686$sql .=
" t.import_key,";
687$sql .=
" t.code_journal,";
688$sql .=
" t.journal_label,";
689$sql .=
" t.piece_num,";
691$sql .=
" t.date_creation,";
692$sql .=
" t.tms as date_modification,";
693$sql .=
" t.date_export,";
694$sql .=
" t.date_validated as date_validation,";
695$sql .=
" t.date_lim_reglement,";
696$sql .=
" t.import_key";
700$sql .=
' FROM '.MAIN_DB_PREFIX.$object->table_element.
' as t';
703if (count($filter) > 0) {
704 foreach ($filter as $key => $value) {
705 if ($key ==
't.doc_date') {
706 $sqlwhere[] = $db->sanitize($key).
" = '".$db->idate($value).
"'";
707 } elseif ($key ==
't.doc_date>=') {
708 $sqlwhere[] =
"t.doc_date >= '".$db->idate($value).
"'";
709 } elseif ($key ==
't.doc_date<=') {
710 $sqlwhere[] =
"t.doc_date <= '".$db->idate($value).
"'";
711 } elseif ($key ==
't.numero_compte>=') {
712 $sqlwhere[] =
"t.numero_compte >= '".$db->escape($value).
"'";
713 } elseif ($key ==
't.numero_compte<=') {
714 $sqlwhere[] =
"t.numero_compte <= '".$db->escape($value).
"'";
715 } elseif ($key ==
't.subledger_account>=') {
716 $sqlwhere[] =
"t.subledger_account >= '".$db->escape($value).
"'";
717 } elseif ($key ==
't.subledger_account<=') {
718 $sqlwhere[] =
"t.subledger_account <= '".$db->escape($value).
"'";
719 } elseif ($key ==
't.piece_num') {
722 } elseif ($key ==
't.subledger_account' || $key ==
't.numero_compte') {
723 $sqlwhere[] = $db->sanitize($key).
" LIKE '".$db->escape($db->escapeforlike($value)).
"%'";
726 } elseif ($key ==
't.tms>=') {
727 $sqlwhere[] =
"t.tms >= '".$db->idate($value).
"'";
728 } elseif ($key ==
't.tms<=') {
729 $sqlwhere[] =
"t.tms <= '".$db->idate($value).
"'";
730 } elseif ($key ==
't.date_creation>=') {
731 $sqlwhere[] =
"t.date_creation >= '".$db->idate($value).
"'";
732 } elseif ($key ==
't.date_creation<=') {
733 $sqlwhere[] =
"t.date_creation <= '".$db->idate($value).
"'";
734 } elseif ($key ==
't.date_export>=') {
735 $sqlwhere[] =
"t.date_export >= '".$db->idate($value).
"'";
736 } elseif ($key ==
't.date_export<=') {
737 $sqlwhere[] =
"t.date_export <= '".$db->idate($value).
"'";
738 } elseif ($key ==
't.date_validated>=') {
739 $sqlwhere[] =
"t.date_validated >= '".$db->idate($value).
"'";
740 } elseif ($key ==
't.date_validated<=') {
741 $sqlwhere[] =
"t.date_validated <= '".$db->idate($value).
"'";
742 } elseif ($key ==
't.date_lim_reglement>=') {
743 $sqlwhere[] =
"t.date_lim_reglement >= '".$db->idate($value).
"'";
744 } elseif ($key ==
't.date_lim_reglement<=') {
745 $sqlwhere[] =
"t.date_lim_reglement <= '".$db->idate($value).
"'";
746 } elseif ($key ==
't.credit' || $key ==
't.debit') {
748 } elseif ($key ==
't.reconciled_option') {
749 $sqlwhere[] =
't.lettering_code IS NULL';
750 } elseif ($key ==
't.code_journal' && !empty($value)) {
751 if (is_array($value)) {
752 $sqlwhere[] =
natural_search(
"t.code_journal", implode(
',', $value), 3, 1);
756 } elseif ($key ==
't.search_accounting_code_in' && !empty($value)) {
757 $sqlwhere[] =
't.numero_compte IN ('.$db->sanitize($value, 1).
')';
763$sql .=
' WHERE t.entity IN ('.getEntity(
'accountancy').
')';
765if (count($sqlwhere) > 0) {
766 $sql .=
' AND '.implode(
' AND ', $sqlwhere);
777$title_page = $langs->trans(
"Operations").
' - '.$langs->trans(
"Journals");
780$nbtotalofrecords =
'';
783 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
784 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
785 $resql = $db->query($sqlforcount);
787 $objforcount = $db->fetch_object($resql);
788 $nbtotalofrecords = $objforcount->nbtotalofrecords;
793 if (($page * $limit) > $nbtotalofrecords) {
802$sql .= $db->order($sortfield, $sortorder);
804 $sql .= $db->plimit($limit + 1, $offset);
807$resql = $db->query($sql);
813$num = $db->num_rows($resql);
815$arrayofselected = is_array($toselect) ? $toselect : array();
819$help_url =
'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double';
820llxHeader(
'', $title_page, $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy accountancy-consultation page-journal');
828if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
829 $param .=
'&contextpage='.urlencode($contextpage);
831if ($limit > 0 && $limit !=
$conf->liste_limit) {
832 $param .=
'&limit='.((int) $limit);
836$arrayofmassactions = array();
837if (
getDolGlobalInt(
'ACCOUNTING_ENABLE_LETTERING') && $user->hasRight(
'accounting',
'mouvements',
'creer')) {
838 $arrayofmassactions[
'letteringauto'] =
img_picto(
'',
'check',
'class="pictofixedwidth"') . $langs->trans(
'LetteringAuto');
839 $arrayofmassactions[
'preunletteringauto'] =
img_picto(
'',
'uncheck',
'class="pictofixedwidth"') . $langs->trans(
'UnletteringAuto');
840 $arrayofmassactions[
'letteringmanual'] =
img_picto(
'',
'check',
'class="pictofixedwidth"') . $langs->trans(
'LetteringManual');
841 $arrayofmassactions[
'preunletteringmanual'] =
img_picto(
'',
'uncheck',
'class="pictofixedwidth"') . $langs->trans(
'UnletteringManual');
843if ($user->hasRight(
'accounting',
'mouvements',
'creer')) {
844 $arrayofmassactions[
'preclonebookkeepingwriting'] =
img_picto(
'',
'clone',
'class="pictofixedwidth"').$langs->trans(
"Clone");
846if ($user->hasRight(
'accounting',
'mouvements',
'creer')) {
847 $arrayofmassactions[
'preassignaccountbookkeepingwriting'] =
img_picto(
'',
'fa-exchange-alt',
'class="pictofixedwidth"').$langs->trans(
"AssignAccount");
849if ($user->hasRight(
'accounting',
'mouvements',
'creer')) {
850 $arrayofmassactions[
'prereturnaccountbookkeepingwriting'] =
img_picto(
'',
'undo',
'class="pictofixedwidth"').$langs->trans(
"ReturnAccount");
852if ($user->hasRight(
'accounting',
'mouvements',
'supprimer')) {
853 $arrayofmassactions[
'predeletebookkeepingwriting'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
856if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'preunletteringauto',
'preunletteringmanual',
'predeletebookkeepingwriting',
'preclonebookkeepingwriting',
'preassignaccountbookkeepingwriting',
'prereturnaccountbookkeepingwriting'))) {
857 $arrayofmassactions = array();
859$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
861print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
862print
'<input type="hidden" name="token" value="'.newToken().
'">';
863print
'<input type="hidden" name="action" value="list">';
864if ($optioncss !=
'') {
865 print
'<input type="hidden" name="optioncss" value="'.urlencode($optioncss).
'">';
867print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
868print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
869print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
870print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
873 $buttonLabel = $langs->trans(
"ExportFilteredList");
875 $buttonLabel = $langs->trans(
"ExportList");
878$parameters = array(
'param' => $param);
879$reshook = $hookmanager->executeHooks(
'addMoreActionsButtonsList', $parameters, $object, $action);
884$newcardbutton = empty($hookmanager->resPrint) ?
'' : $hookmanager->resPrint;
886if (empty($reshook)) {
887 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewFlatList'),
'',
'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.
'/accountancy/bookkeeping/list.php?'.$param,
'', 1, array(
'morecss' =>
'marginleftonly btnTitleSelected'));
888 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'GroupByAccountAccounting'),
'',
'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.
'/accountancy/bookkeeping/listbyaccount.php?'.$param,
'', 1, array(
'morecss' =>
'marginleftonly'));
889 $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'));
890 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ExportToPdf'),
'',
'fa fa-file-pdf paddingleft', $_SERVER[
'PHP_SELF'] .
'?action=exporttopdf&' . $param,
'', $permissiontoexport, array(
'morecss' =>
'marginleftonly'));
892 $url =
'./card.php?action=create'.(!empty($type) ?
'&type=sub' :
'').
'&backtopage='.urlencode($_SERVER[
'PHP_SELF']);
893 if (!empty($socid)) {
894 $url .=
'&socid='.$socid;
897 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewAccountingMvt'),
'',
'fa fa-plus-circle paddingleft', $url,
'', $permissiontoadd);
900print_barre_liste($title_page, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'title_accountancy', 0, $newcardbutton,
'', $limit, 0, 0, 1);
902if ($massaction ==
'preunletteringauto') {
903 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassUnletteringAuto"), $langs->trans(
"ConfirmMassUnletteringQuestion", count($toselect)),
"unletteringauto",
null,
'', 0, 200, 500, 1);
904} elseif ($massaction ==
'preunletteringmanual') {
905 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassUnletteringManual"), $langs->trans(
"ConfirmMassUnletteringQuestion", count($toselect)),
"unletteringmanual",
null,
'', 0, 200, 500, 1);
906} elseif ($massaction ==
'predeletebookkeepingwriting') {
907 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDeleteBookkeepingWriting"), $langs->trans(
"ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)),
"deletebookkeepingwriting",
null,
'', 0, 200, 500, 1);
908} elseif ($massaction ==
'preassignaccountbookkeepingwriting') {
909 $input = $formaccounting->select_account(
'',
'account', 1);
910 $formquestion = array(array(
'type' =>
'other',
'name' =>
'account',
'label' =>
'<span class="fieldrequired">' . $langs->trans(
"AccountAccountingShort") .
'</span>',
'value' => $input),);
911 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"confirmMassAssignAccountBookkeepingWritingConfirm"), $langs->trans(
"ConfirmMassAssignAccountBookkeepingWritingQuestion", count($toselect)),
"assignaccountbookkeepingwriting", $formquestion,
'', 0, 200, 500, 1);
912} elseif ($massaction ==
'preclonebookkeepingwriting') {
913 $input1 = $form->selectDate(
'',
'massdate', 0, 0, 0,
"create_mvt", 1, 1);
914 $input2 = $formaccounting->select_journal($journal_code,
'code_journal', 0, 0, 1, 1) .
'</td>';
915 $formquestion = array(
918 'name' =>
'massdate',
919 'label' =>
'<span class="fieldrequired">' . $langs->trans(
"Docdate") .
'</span>',
925 $formquestion[] = array(
927 'name' =>
'code_journal',
928 'label' =>
'<span class="fieldrequired">' . $langs->trans(
"Codejournal") .
'</span>',
933 print $form->formconfirm(
934 $_SERVER[
"PHP_SELF"],
935 $langs->trans(
"ConfirmMassCloneBookkeepingWriting"),
936 $langs->trans(
"ConfirmMassCloneBookkeepingWritingQuestion", count($toselect)),
937 "clonebookkeepingwriting",
941} elseif ($massaction ==
'prereturnaccountbookkeepingwriting') {
942 $input1 = $form->selectDate(
'',
'massdate', 0, 0, 0,
"create_mvt", 1, 1);
943 $formquestion = array(array(
'type' =>
'other',
'name' =>
'massdate',
'label' =>
'<span class="fieldrequired">' . $langs->trans(
"Docdate") .
'</span>',
'value' => $input1));
944 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassReturnAccountBookkeepingWriting"), $langs->trans(
"ConfirmMassReturnAccountBookkeepingWritingQuestion", count($toselect)),
"returnaccountbookkeepingwriting", $formquestion,
'', 0, 200, 500, 1);
951include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
953$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
954$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
955if ($massactionbutton && $contextpage !=
'poslist') {
956 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
960$moreforfilter .=
'<div class="divsearchfield">';
961$moreforfilter .= $langs->trans(
'AccountingCategory').
': ';
962$moreforfilter .=
'<div class="nowrap inline-block">';
963$moreforfilter .= $formaccounting->select_accounting_category($search_account_category,
'search_account_category', 1, 0, 0, 0);
964$moreforfilter .=
'</div>';
965$moreforfilter .=
'</div>';
967$parameters = array();
968$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
969if (empty($reshook)) {
970 $moreforfilter .= $hookmanager->resPrint;
972 $moreforfilter = $hookmanager->resPrint;
975print
'<div class="liste_titre liste_titre_bydiv centpercent">';
979print
'<div class="div-table-responsive">';
980print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">';
983print
'<tr class="liste_titre_filter">';
986 print
'<td class="liste_titre center">';
987 $searchpicto = $form->showFilterButtons(
'left');
992if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
993 print
'<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).
'"></td>';
996if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
997 print
'<td class="liste_titre center">';
998 print $formaccounting->multi_select_journal($search_ledger_code,
'search_ledger_code', 0, 1, 1, 1,
'maxwidth75');
1002if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1003 print
'<td class="liste_titre center">';
1004 print
'<div class="nowrapfordate">';
1005 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1007 print
'<div class="nowrapfordate">';
1008 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1013if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1014 print
'<td class="liste_titre"><input type="text" name="search_doc_ref" class="width75" value="'.dol_escape_htmltag($search_doc_ref).
'"></td>';
1017if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
1018 print
'<td class="liste_titre">';
1019 print
'<div class="nowrap">';
1020 print $formaccounting->select_account($search_accountancy_code_start,
'search_accountancy_code_start', $langs->trans(
'From'), array(), 1, 1,
'maxwidth150',
'account');
1022 print
'<div class="nowrap">';
1023 print $formaccounting->select_account($search_accountancy_code_end,
'search_accountancy_code_end', $langs->trans(
'to'), array(), 1, 1,
'maxwidth150',
'account');
1028if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
1029 print
'<td class="liste_titre">';
1033 print
'<div class="nowrap">';
1035 print $formaccounting->select_auxaccount($search_accountancy_aux_code_start,
'search_accountancy_aux_code_start', $langs->trans(
'From'),
'maxwidth250',
'subledgeraccount');
1037 print
'<div class="nowrap">';
1038 print $formaccounting->select_auxaccount($search_accountancy_aux_code_end,
'search_accountancy_aux_code_end', $langs->trans(
'to'),
'maxwidth250',
'subledgeraccount');
1041 print
'<input type="text" class="maxwidth75" name="search_accountancy_aux_code" value="'.dol_escape_htmltag($search_accountancy_aux_code).
'">';
1046if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1047 print
'<td class="liste_titre">';
1048 print
'<input type="text" size="7" class="flat" name="search_mvt_label" value="'.dol_escape_htmltag($search_mvt_label).
'"/>';
1052if (!empty($arrayfields[
't.debit'][
'checked'])) {
1053 print
'<td class="liste_titre right">';
1054 print
'<input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).
'">';
1058if (!empty($arrayfields[
't.credit'][
'checked'])) {
1059 print
'<td class="liste_titre right">';
1060 print
'<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).
'">';
1064if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1065 print
'<td class="liste_titre center">';
1066 print
'<input type="text" size="3" class="flat" name="search_lettering_code" value="'.dol_escape_htmltag($search_lettering_code).
'"/>';
1067 print
'<br><span class="nowrap"><input type="checkbox" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled ==
'notreconciled' ?
' checked' :
'').
'>'.$langs->trans(
"NotReconciled").
'</span>';
1072$parameters = array(
'arrayfields' => $arrayfields);
1073$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1074print $hookmanager->resPrint;
1077if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1078 print
'<td class="liste_titre center">';
1079 print
'<div class="nowrapfordate">';
1080 print $form->selectDate($search_date_creation_start,
'search_date_creation_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1082 print
'<div class="nowrapfordate">';
1083 print $form->selectDate($search_date_creation_end,
'search_date_creation_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1088if (!empty($arrayfields[
't.tms'][
'checked'])) {
1089 print
'<td class="liste_titre center">';
1090 print
'<div class="nowrapfordate">';
1091 print $form->selectDate($search_date_modification_start,
'search_date_modification_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1093 print
'<div class="nowrapfordate">';
1094 print $form->selectDate($search_date_modification_end,
'search_date_modification_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1099if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1100 print
'<td class="liste_titre center">';
1101 print
'<div class="nowrapfordate">';
1102 print $form->selectDate($search_date_export_start,
'search_date_export_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1104 print
'<div class="nowrapfordate">';
1105 print $form->selectDate($search_date_export_end,
'search_date_export_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1110if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1111 print
'<td class="liste_titre center">';
1112 print
'<div class="nowrapfordate">';
1113 print $form->selectDate($search_date_validation_start,
'search_date_validation_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1115 print
'<div class="nowrapfordate">';
1116 print $form->selectDate($search_date_validation_end,
'search_date_validation_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1121if (!empty($arrayfields[
't.date_lim_reglement'][
'checked'])) {
1122 print
'<td class="liste_titre center">';
1123 print
'<div class="nowrapfordate">';
1124 print $form->selectDate($search_date_due_start,
'search_date_due_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1126 print
'<div class="nowrapfordate">';
1127 print $form->selectDate($search_date_due_end,
'search_date_due_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1131if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1132 print
'<td class="liste_titre center">';
1133 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1138 print
'<td class="liste_titre center">';
1139 $searchpicto = $form->showFilterButtons();
1145print
'<tr class="liste_titre">';
1147 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch actioncolumn ');
1149if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
1150 print_liste_field_titre($arrayfields[
't.piece_num'][
'label'], $_SERVER[
'PHP_SELF'],
"t.piece_num",
"", $param,
"", $sortfield, $sortorder);
1152if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
1153 print_liste_field_titre($arrayfields[
't.code_journal'][
'label'], $_SERVER[
'PHP_SELF'],
"t.code_journal",
"", $param,
'', $sortfield, $sortorder,
'center ');
1155if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1156 print_liste_field_titre($arrayfields[
't.doc_date'][
'label'], $_SERVER[
'PHP_SELF'],
"t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1158if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1159 print_liste_field_titre($arrayfields[
't.doc_ref'][
'label'], $_SERVER[
'PHP_SELF'],
"t.doc_ref",
"", $param,
"", $sortfield, $sortorder);
1161if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
1162 print_liste_field_titre($arrayfields[
't.numero_compte'][
'label'], $_SERVER[
'PHP_SELF'],
"t.numero_compte",
"", $param,
"", $sortfield, $sortorder);
1164if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
1165 print_liste_field_titre($arrayfields[
't.subledger_account'][
'label'], $_SERVER[
'PHP_SELF'],
"t.subledger_account",
"", $param,
"", $sortfield, $sortorder);
1167if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1168 print_liste_field_titre($arrayfields[
't.label_operation'][
'label'], $_SERVER[
'PHP_SELF'],
"t.label_operation",
"", $param,
"", $sortfield, $sortorder);
1170if (!empty($arrayfields[
't.debit'][
'checked'])) {
1171 print_liste_field_titre($arrayfields[
't.debit'][
'label'], $_SERVER[
'PHP_SELF'],
"t.debit",
"", $param,
'', $sortfield, $sortorder,
'right ');
1173if (!empty($arrayfields[
't.credit'][
'checked'])) {
1174 print_liste_field_titre($arrayfields[
't.credit'][
'label'], $_SERVER[
'PHP_SELF'],
"t.credit",
"", $param,
'', $sortfield, $sortorder,
'right ');
1176if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1177 print_liste_field_titre($arrayfields[
't.lettering_code'][
'label'], $_SERVER[
'PHP_SELF'],
"t.lettering_code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1180$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1181$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1182print $hookmanager->resPrint;
1183if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1184 print_liste_field_titre($arrayfields[
't.date_creation'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center ');
1186if (!empty($arrayfields[
't.tms'][
'checked'])) {
1187 print_liste_field_titre($arrayfields[
't.tms'][
'label'], $_SERVER[
'PHP_SELF'],
"t.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
1189if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1190 print_liste_field_titre($arrayfields[
't.date_export'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_export,t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1192if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1193 print_liste_field_titre($arrayfields[
't.date_validated'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_validated,t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1196if (!empty($arrayfields[
't.date_lim_reglement'][
'checked'])) {
1197 print_liste_field_titre($arrayfields[
't.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
't.date_lim_reglement',
'', $param,
'', $sortfield, $sortorder,
'center ');
1199if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1200 print_liste_field_titre($arrayfields[
't.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"t.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1203 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1219while ($i < min($num, $limit)) {
1220 $obj = $db->fetch_object($resql);
1225 $line->id = $obj->rowid;
1226 $line->doc_date = $db->jdate($obj->doc_date);
1227 $line->doc_type = $obj->doc_type;
1228 $line->doc_ref = $obj->doc_ref;
1229 $line->fk_doc = $obj->fk_doc;
1230 $line->fk_docdet = $obj->fk_docdet;
1231 $line->thirdparty_code = $obj->thirdparty_code;
1232 $line->subledger_account = $obj->subledger_account;
1233 $line->subledger_label = $obj->subledger_label;
1234 $line->numero_compte = $obj->numero_compte;
1235 $line->label_compte = $obj->label_compte;
1236 $line->label_operation = $obj->label_operation;
1237 $line->debit = $obj->debit;
1238 $line->credit = $obj->credit;
1239 $line->montant = $obj->amount;
1240 $line->amount = $obj->amount;
1241 $line->sens = $obj->sens;
1242 $line->lettering_code = $obj->lettering_code;
1243 $line->fk_user_author = $obj->fk_user_author;
1244 $line->import_key = $obj->import_key;
1245 $line->code_journal = $obj->code_journal;
1246 $line->journal_label = $obj->journal_label;
1247 $line->piece_num = $obj->piece_num;
1248 $line->ref = $obj->ref;
1249 $line->date_creation = $db->jdate($obj->date_creation);
1250 $line->date_modification = $db->jdate($obj->date_modification);
1251 $line->date_export = $db->jdate($obj->date_export);
1252 $line->date_validation = $db->jdate($obj->date_validation);
1254 $line->date_lim_reglement = $db->jdate($obj->date_lim_reglement);
1256 print
'<tr class="oddeven">';
1259 print
'<td class="nowraponall center">';
1260 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
1262 if (in_array($line->id, $arrayofselected)) {
1265 print
'<input id="cb'.$line->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.
'"'.($selected ?
' checked="checked"' :
'').
' />';
1274 if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
1277 $object->piece_num = $line->piece_num;
1279 print
$object->getNomUrl(1,
'', 0,
'', 1);
1287 if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
1288 if (empty(
$conf->cache[
'accountingjournal'][$line->code_journal])) {
1290 $accountingjournal->fetch(0, $line->code_journal);
1291 $conf->cache[
'accountingjournal'][$line->code_journal] = $accountingjournal;
1293 $accountingjournal =
$conf->cache[
'accountingjournal'][$line->code_journal];
1296 $journaltoshow = (($accountingjournal->id > 0) ? $accountingjournal->getNomUrl(0, 0, 0,
'', 0) : $line->code_journal);
1297 print
'<td class="center tdoverflowmax150">'.$journaltoshow.
'</td>';
1304 if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1305 print
'<td class="center">'.dol_print_date($line->doc_date,
'day').
'</td>';
1313 if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1314 $objectstatic =
null;
1316 if ($line->doc_type ===
'customer_invoice') {
1317 $langs->loadLangs(array(
'bills'));
1319 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
1320 $objectstatic =
new Facture($db);
1321 $objectstatic->fetch($line->fk_doc);
1326 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$objectstatic->id;
1327 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1328 } elseif ($line->doc_type ===
'supplier_invoice') {
1329 $langs->loadLangs(array(
'bills'));
1331 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
1333 $objectstatic->fetch($line->fk_doc);
1335 $modulepart =
'invoice_supplier';
1340 $filedir =
getMultidirOutput($objectstatic,
'', 1).dol_sanitizeFileName($line->doc_ref);
1341 $subdir =
getMultidirOutput($objectstatic,
'', 1,
'outputrel').dol_sanitizeFileName($line->doc_ref);
1344 if ($objectstatic->id > 0) {
1345 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
1347 $documentlink = $line->doc_ref;
1349 } elseif ($line->doc_type ===
'expense_report') {
1350 $langs->loadLangs(array(
'trips'));
1352 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
1354 $objectstatic->fetch($line->fk_doc);
1359 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$objectstatic->id;
1360 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1361 } elseif ($line->doc_type ===
'bank') {
1362 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
1364 $objectstatic->fetch($line->fk_doc);
1370 $labeltoshowalt =
'';
1371 $classforlabel =
'';
1372 if (($line->doc_type ===
'customer_invoice' || $line->doc_type ===
'supplier_invoice' || $line->doc_type ===
'expense_report') && is_object($objectstatic)) {
1373 $labeltoshow .= $objectstatic->getNomUrl(1,
'', 0, 0,
'', 0, -1, 1);
1374 $labeltoshow .= $documentlink;
1375 $labeltoshowalt .= $objectstatic->ref;
1376 } elseif ($line->doc_type ===
'bank' && is_object($objectstatic)) {
1377 $labeltoshow .= $objectstatic->getNomUrl(1);
1378 $labeltoshowalt .= $objectstatic->ref;
1379 $bank_ref = strstr($line->doc_ref,
'-');
1380 $labeltoshow .=
" " . $bank_ref;
1381 $labeltoshowalt .=
" " . $bank_ref;
1383 $labeltoshow .= $line->doc_ref;
1384 $labeltoshowalt .= $line->doc_ref;
1385 $classforlabel =
'tdoverflowmax250';
1388 print
'<td class="nowraponall'.($classforlabel ?
' '.$classforlabel :
'').
'" title="'.
dol_escape_htmltag($labeltoshowalt).
'">';
1397 if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
1398 print
'<td>'.length_accountg($line->numero_compte).
'</td>';
1405 if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
1406 print
'<td>'.length_accounta($line->subledger_account).
'</td>';
1413 if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1414 print
'<td class="small tdoverflowmax200" title="'.dol_escape_htmltag($line->label_operation).
'">'.
dol_escape_htmltag($line->label_operation).
'</td>';
1421 if (!empty($arrayfields[
't.debit'][
'checked'])) {
1422 print
'<td class="right nowraponall amount">'.($line->debit != 0 ?
price($line->debit) :
'').
'</td>';
1433 if (!empty($arrayfields[
't.credit'][
'checked'])) {
1434 print
'<td class="right nowraponall amount">'.($line->credit != 0 ?
price($line->credit) :
'').
'</td>';
1441 $totalarray[
'val'][
'totalcredit'] += $line->credit;
1445 if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1446 print
'<td class="center">'.$line->lettering_code.
'</td>';
1453 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1454 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1455 print $hookmanager->resPrint;
1458 if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1459 print
'<td class="center">'.dol_print_date($line->date_creation,
'dayhour',
'tzuserrel').
'</td>';
1466 if (!empty($arrayfields[
't.tms'][
'checked'])) {
1467 print
'<td class="center">'.dol_print_date($line->date_modification,
'dayhour',
'tzuserrel').
'</td>';
1474 if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1475 print
'<td class="center nowraponall">'.dol_print_date($line->date_export,
'dayhour',
'tzuserrel').
'</td>';
1482 if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1483 print
'<td class="center nowraponall">'.dol_print_date($line->date_validation,
'dayhour',
'tzuserrel').
'</td>';
1490 if (!empty($arrayfields[
't.date_lim_reglement'][
'checked'])) {
1491 print
'<td class="center">'.dol_print_date($line->date_lim_reglement,
'day').
'</td>';
1497 if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1498 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($obj->import_key).
'">'.
dol_escape_htmltag($obj->import_key).
"</td>\n";
1506 print
'<td class="nowraponall center">';
1507 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
1509 if (in_array($line->id, $arrayofselected)) {
1512 print
'<input id="cb'.$line->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.
'"'.($selected ?
' checked="checked"' :
'').
' />';
1527include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1532 foreach ($arrayfields as $key => $val) {
1533 if (!empty($val[
'checked'])) {
1537 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1540$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1541$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1542print $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.
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_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTDATE($prefix, $hourTime='', $gm='auto', $saverestore='')
Helper function that combines values of a dolibarr DatePicker (such as Form\selectDate) for year,...
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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...
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
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).
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.