32require
'../../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeeping.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/lettering.class.php';
52$langs->loadLangs(array(
"accountancy",
"compta"));
58$action =
GETPOST(
'action',
'aZ09');
59$massaction =
GETPOST(
'massaction',
'alpha');
60$confirm =
GETPOST(
'confirm',
'alpha');
61$toselect =
GETPOST(
'toselect',
'array');
62$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'bookkeepinglist';
65$search_mvt_num =
GETPOST(
'search_mvt_num',
'alpha');
66$search_doc_type =
GETPOST(
"search_doc_type",
'alpha');
67$search_doc_ref =
GETPOST(
"search_doc_ref",
'alpha');
68$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
69$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
70$search_date_startday =
GETPOSTINT(
'search_date_startday');
71$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
72$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
73$search_date_endday =
GETPOSTINT(
'search_date_endday');
74$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
75$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
77$search_date_creation_startyear =
GETPOSTINT(
'search_date_creation_startyear');
78$search_date_creation_startmonth =
GETPOSTINT(
'search_date_creation_startmonth');
79$search_date_creation_startday =
GETPOSTINT(
'search_date_creation_startday');
80$search_date_creation_endyear =
GETPOSTINT(
'search_date_creation_endyear');
81$search_date_creation_endmonth =
GETPOSTINT(
'search_date_creation_endmonth');
82$search_date_creation_endday =
GETPOSTINT(
'search_date_creation_endday');
83$search_date_creation_start =
dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear);
84$search_date_creation_end =
dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear);
85$search_date_modification_startyear =
GETPOSTINT(
'search_date_modification_startyear');
86$search_date_modification_startmonth =
GETPOSTINT(
'search_date_modification_startmonth');
87$search_date_modification_startday =
GETPOSTINT(
'search_date_modification_startday');
88$search_date_modification_endyear =
GETPOSTINT(
'search_date_modification_endyear');
89$search_date_modification_endmonth =
GETPOSTINT(
'search_date_modification_endmonth');
90$search_date_modification_endday =
GETPOSTINT(
'search_date_modification_endday');
91$search_date_modification_start =
dol_mktime(0, 0, 0, $search_date_modification_startmonth, $search_date_modification_startday, $search_date_modification_startyear);
92$search_date_modification_end =
dol_mktime(23, 59, 59, $search_date_modification_endmonth, $search_date_modification_endday, $search_date_modification_endyear);
93$search_date_export_startyear =
GETPOSTINT(
'search_date_export_startyear');
94$search_date_export_startmonth =
GETPOSTINT(
'search_date_export_startmonth');
95$search_date_export_startday =
GETPOSTINT(
'search_date_export_startday');
96$search_date_export_endyear =
GETPOSTINT(
'search_date_export_endyear');
97$search_date_export_endmonth =
GETPOSTINT(
'search_date_export_endmonth');
98$search_date_export_endday =
GETPOSTINT(
'search_date_export_endday');
99$search_date_export_start =
dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
100$search_date_export_end =
dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
101$search_date_validation_startyear =
GETPOSTINT(
'search_date_validation_startyear');
102$search_date_validation_startmonth =
GETPOSTINT(
'search_date_validation_startmonth');
103$search_date_validation_startday =
GETPOSTINT(
'search_date_validation_startday');
104$search_date_validation_endyear =
GETPOSTINT(
'search_date_validation_endyear');
105$search_date_validation_endmonth =
GETPOSTINT(
'search_date_validation_endmonth');
106$search_date_validation_endday =
GETPOSTINT(
'search_date_validation_endday');
107$search_date_validation_start =
dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear);
108$search_date_validation_end =
dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
110$search_date_due_start_day =
GETPOSTINT(
'search_date_due_start_day');
111$search_date_due_start_month =
GETPOSTINT(
'search_date_due_start_month');
112$search_date_due_start_year =
GETPOSTINT(
'search_date_due_start_year');
113$search_date_due_start =
dol_mktime(0, 0, 0, $search_date_due_start_month, $search_date_due_start_day, $search_date_due_start_year);
115$search_date_due_end_day =
GETPOSTINT(
'search_date_due_end_day');
116$search_date_due_end_month =
GETPOSTINT(
'search_date_due_end_month');
117$search_date_due_end_year =
GETPOSTINT(
'search_date_due_end_year');
118$search_date_due_end =
dol_mktime(23, 59, 59, $search_date_due_end_month, $search_date_due_end_day, $search_date_due_end_year);
119$search_import_key =
GETPOST(
"search_import_key",
'alpha');
121$search_account_category =
GETPOSTINT(
'search_account_category');
123$search_accountancy_code =
GETPOST(
"search_accountancy_code",
'alpha');
124$search_accountancy_code_start =
GETPOST(
'search_accountancy_code_start',
'alpha');
125if ($search_accountancy_code_start == - 1) {
126 $search_accountancy_code_start =
'';
128$search_accountancy_code_end =
GETPOST(
'search_accountancy_code_end',
'alpha');
129if ($search_accountancy_code_end == - 1) {
130 $search_accountancy_code_end =
'';
133$search_accountancy_aux_code =
GETPOST(
"search_accountancy_aux_code",
'alpha');
134$search_accountancy_aux_code_start =
GETPOST(
'search_accountancy_aux_code_start',
'alpha');
135if ($search_accountancy_aux_code_start == - 1) {
136 $search_accountancy_aux_code_start =
'';
138$search_accountancy_aux_code_end =
GETPOST(
'search_accountancy_aux_code_end',
'alpha');
139if ($search_accountancy_aux_code_end == - 1) {
140 $search_accountancy_aux_code_end =
'';
142$search_mvt_label =
GETPOST(
'search_mvt_label',
'alpha');
143$search_direction =
GETPOST(
'search_direction',
'alpha');
144$search_debit =
GETPOST(
'search_debit',
'alpha');
145$search_credit =
GETPOST(
'search_credit',
'alpha');
146$search_ledger_code =
GETPOST(
'search_ledger_code',
'array');
147$search_lettering_code =
GETPOST(
'search_lettering_code',
'alpha');
148$search_not_reconciled =
GETPOST(
'search_not_reconciled',
'alpha');
152$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
153$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
154$optioncss =
GETPOST(
'optioncss',
'alpha');
156if (empty($page) || $page < 0) {
159$offset = $limit * $page;
160$pageprev = $page - 1;
161$pagenext = $page + 1;
162if ($sortorder ==
"") {
165if ($sortfield ==
"") {
166 $sortfield =
"t.piece_num,t.rowid";
171$hookmanager->initHooks(array(
'bookkeepinglist'));
174$form =
new Form($db);
176if (!in_array($action, array(
'delmouv',
'delmouvconfirm')) && !GETPOSTISSET(
'begin') && !GETPOSTISSET(
'formfilteraction') &&
GETPOST(
'page',
'alpha') ==
'' && !
GETPOSTINT(
'noreset') && $user->hasRight(
'accounting',
'mouvements',
'export')) {
177 if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET(
'restore_lastsearch_values') && !
GETPOST(
'search_accountancy_code_start')) {
178 $query =
"SELECT date_start, date_end from ".MAIN_DB_PREFIX.
"accounting_fiscalyear ";
179 $query .=
" where date_start < '".$db->idate(
dol_now()).
"' and date_end > '".$db->idate(
dol_now()).
"' limit 1";
180 $res = $db->query($query);
182 if ($db->num_rows($res) > 0) {
183 $fiscalYear = $db->fetch_object($res);
184 $search_date_start = strtotime($fiscalYear->date_start);
185 $search_date_end = strtotime($fiscalYear->date_end);
192 $year_end = $year_start + 1;
193 $month_end = $month_start - 1;
194 if ($month_end < 1) {
198 $search_date_start =
dol_mktime(0, 0, 0, $month_start, 1, $year_start);
206 't.piece_num' => array(
'label' => $langs->trans(
"TransactionNumShort"),
'checked' => 1),
207 't.code_journal' => array(
'label' => $langs->trans(
"Codejournal"),
'checked' => 1),
208 't.doc_date' => array(
'label' => $langs->trans(
"Docdate"),
'checked' => 1),
209 't.doc_ref' => array(
'label' => $langs->trans(
"Piece"),
'checked' => 1),
210 't.numero_compte' => array(
'label' => $langs->trans(
"AccountAccountingShort"),
'checked' => 1),
211 't.subledger_account' => array(
'label' => $langs->trans(
"SubledgerAccount"),
'checked' => 1),
212 't.label_operation' => array(
'label' => $langs->trans(
"Label"),
'checked' => 1),
213 't.debit' => array(
'label' => $langs->trans(
"AccountingDebit"),
'checked' => 1),
214 't.credit' => array(
'label' => $langs->trans(
"AccountingCredit"),
'checked' => 1),
215 't.lettering_code' => array(
'label' => $langs->trans(
"LetteringCode"),
'checked' => 1),
216 't.date_creation' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' => 0),
217 't.tms' => array(
'label' => $langs->trans(
"DateModification"),
'checked' => 0),
218 't.date_export' => array(
'label' => $langs->trans(
"DateExport"),
'checked' => 0),
219 't.date_validated' => array(
'label' => $langs->trans(
"DateValidationAndLock"),
'checked' => 0,
'enabled' => !
getDolGlobalString(
"ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
220 't.date_lim_reglement' => array(
'label' => $langs->trans(
"DateDue"),
'checked' => 0),
221 't.import_key' => array(
'label' => $langs->trans(
"ImportId"),
'checked' => 0,
'position' => 1100),
225 unset($arrayfields[
't.lettering_code']);
230if (!isModEnabled(
'accounting')) {
233if ($user->socid > 0) {
236if (!$user->hasRight(
'accounting',
'mouvements',
'lire')) {
240$permissiontoadd = $user->hasRight(
'accounting',
'mouvements',
'creer');
249if (
GETPOST(
'cancel',
'alpha')) {
253if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'preunletteringauto' && $massaction !=
'preunletteringmanual' && $massaction !=
'predeletebookkeepingwriting') {
257$parameters = array(
'socid' => $socid);
258$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
263if (empty($reshook)) {
264 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
266 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
267 $search_mvt_num =
'';
268 $search_doc_type =
'';
269 $search_doc_ref =
'';
270 $search_doc_date =
'';
271 $search_account_category =
'';
272 $search_accountancy_code =
'';
273 $search_accountancy_code_start =
'';
274 $search_accountancy_code_end =
'';
275 $search_accountancy_aux_code =
'';
276 $search_accountancy_aux_code_start =
'';
277 $search_accountancy_aux_code_end =
'';
278 $search_mvt_label =
'';
279 $search_direction =
'';
280 $search_ledger_code = array();
281 $search_date_startyear =
'';
282 $search_date_startmonth =
'';
283 $search_date_startday =
'';
284 $search_date_endyear =
'';
285 $search_date_endmonth =
'';
286 $search_date_endday =
'';
287 $search_date_start =
'';
288 $search_date_end =
'';
289 $search_date_creation_startyear =
'';
290 $search_date_creation_startmonth =
'';
291 $search_date_creation_startday =
'';
292 $search_date_creation_endyear =
'';
293 $search_date_creation_endmonth =
'';
294 $search_date_creation_endday =
'';
295 $search_date_creation_start =
'';
296 $search_date_creation_end =
'';
297 $search_date_modification_startyear =
'';
298 $search_date_modification_startmonth =
'';
299 $search_date_modification_startday =
'';
300 $search_date_modification_endyear =
'';
301 $search_date_modification_endmonth =
'';
302 $search_date_modification_endday =
'';
303 $search_date_modification_start =
'';
304 $search_date_modification_end =
'';
305 $search_date_export_startyear =
'';
306 $search_date_export_startmonth =
'';
307 $search_date_export_startday =
'';
308 $search_date_export_endyear =
'';
309 $search_date_export_endmonth =
'';
310 $search_date_export_endday =
'';
311 $search_date_export_start =
'';
312 $search_date_export_end =
'';
313 $search_date_validation_startyear =
'';
314 $search_date_validation_startmonth =
'';
315 $search_date_validation_startday =
'';
316 $search_date_validation_endyear =
'';
317 $search_date_validation_endmonth =
'';
318 $search_date_validation_endday =
'';
319 $search_date_validation_start =
'';
320 $search_date_validation_end =
'';
322 $search_date_due_start_day =
'';
323 $search_date_due_start_month =
'';
324 $search_date_due_start_year =
'';
325 $search_date_due_start =
'';
327 $search_date_due_end_day =
'';
328 $search_date_due_end_month =
'';
329 $search_date_due_end_year =
'';
330 $search_date_due_end =
'';
333 $search_lettering_code =
'';
334 $search_not_reconciled =
'';
335 $search_import_key =
'';
341 if (!empty($search_date_start)) {
342 $filter[
't.doc_date>='] = $search_date_start;
344 $param .=
'&search_date_startmonth='.((int) $tmp[
'mon']).
'&search_date_startday='.((int) $tmp[
'mday']).
'&search_date_startyear='.((int) $tmp[
'year']);
346 if (!empty($search_date_end)) {
347 $filter[
't.doc_date<='] = $search_date_end;
349 $param .=
'&search_date_endmonth='.((int) $tmp[
'mon']).
'&search_date_endday='.((int) $tmp[
'mday']).
'&search_date_endyear='.((int) $tmp[
'year']);
351 if (!empty($search_doc_date)) {
352 $filter[
't.doc_date'] = $search_doc_date;
354 $param .=
'&doc_datemonth='.((int) $tmp[
'mon']).
'&doc_dateday='.((int) $tmp[
'mday']).
'&doc_dateyear='.((int) $tmp[
'year']);
356 if (!empty($search_doc_type)) {
357 $filter[
't.doc_type'] = $search_doc_type;
358 $param .=
'&search_doc_type='.urlencode($search_doc_type);
360 if (!empty($search_doc_ref)) {
361 $filter[
't.doc_ref'] = $search_doc_ref;
362 $param .=
'&search_doc_ref='.urlencode($search_doc_ref);
364 if ($search_account_category !=
'-1' && !empty($search_account_category)) {
365 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountancycategory.class.php';
368 $listofaccountsforgroup = $accountingcategory->getCptsCat(0,
'fk_accounting_category = '.((
int) $search_account_category));
369 $listofaccountsforgroup2 = array();
370 if (is_array($listofaccountsforgroup)) {
371 foreach ($listofaccountsforgroup as $tmpval) {
372 $listofaccountsforgroup2[] =
"'".$db->escape($tmpval[
'id']).
"'";
375 $filter[
't.search_accounting_code_in'] = implode(
',', $listofaccountsforgroup2);
376 $param .=
'&search_account_category='.urlencode((
string) ($search_account_category));
378 if (!empty($search_accountancy_code)) {
379 $filter[
't.numero_compte'] = $search_accountancy_code;
380 $param .=
'&search_accountancy_code='.urlencode($search_accountancy_code);
382 if (!empty($search_accountancy_code_start)) {
383 $filter[
't.numero_compte>='] = $search_accountancy_code_start;
384 $param .=
'&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
386 if (!empty($search_accountancy_code_end)) {
387 $filter[
't.numero_compte<='] = $search_accountancy_code_end;
388 $param .=
'&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
390 if (!empty($search_accountancy_aux_code)) {
391 $filter[
't.subledger_account'] = $search_accountancy_aux_code;
392 $param .=
'&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
394 if (!empty($search_accountancy_aux_code_start)) {
395 $filter[
't.subledger_account>='] = $search_accountancy_aux_code_start;
396 $param .=
'&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
398 if (!empty($search_accountancy_aux_code_end)) {
399 $filter[
't.subledger_account<='] = $search_accountancy_aux_code_end;
400 $param .=
'&search_accountancy_aux_code_end='.urlencode($search_accountancy_aux_code_end);
402 if (!empty($search_mvt_label)) {
403 $filter[
't.label_operation'] = $search_mvt_label;
404 $param .=
'&search_mvt_label='.urlencode($search_mvt_label);
406 if (!empty($search_direction)) {
407 $filter[
't.sens'] = $search_direction;
408 $param .=
'&search_direction='.urlencode($search_direction);
410 if (!empty($search_ledger_code)) {
411 $filter[
't.code_journal'] = $search_ledger_code;
412 foreach ($search_ledger_code as $code) {
413 $param .=
'&search_ledger_code[]='.urlencode($code);
416 if (!empty($search_mvt_num)) {
417 $filter[
't.piece_num'] = $search_mvt_num;
418 $param .=
'&search_mvt_num='.urlencode((
string) ($search_mvt_num));
420 if (!empty($search_date_creation_start)) {
421 $filter[
't.date_creation>='] = $search_date_creation_start;
423 $param .=
'&search_date_creation_startmonth='.((int) $tmp[
'mon']).
'&search_date_creation_startday='.((int) $tmp[
'mday']).
'&search_date_creation_startyear='.((int) $tmp[
'year']);
425 if (!empty($search_date_creation_end)) {
426 $filter[
't.date_creation<='] = $search_date_creation_end;
428 $param .=
'&search_date_creation_endmonth='.((int) $tmp[
'mon']).
'&search_date_creation_endday='.((int) $tmp[
'mday']).
'&search_date_creation_endyear='.((int) $tmp[
'year']);
430 if (!empty($search_date_modification_start)) {
431 $filter[
't.tms>='] = $search_date_modification_start;
432 $tmp =
dol_getdate($search_date_modification_start);
433 $param .=
'&search_date_modification_startmonth='.((int) $tmp[
'mon']).
'&search_date_modification_startday='.((int) $tmp[
'mday']).
'&search_date_modification_startyear='.((int) $tmp[
'year']);
435 if (!empty($search_date_modification_end)) {
436 $filter[
't.tms<='] = $search_date_modification_end;
438 $param .=
'&search_date_modification_endmonth='.((int) $tmp[
'mon']).
'&search_date_modification_endday='.((int) $tmp[
'mday']).
'&search_date_modification_endyear='.((int) $tmp[
'year']);
440 if (!empty($search_date_export_start)) {
441 $filter[
't.date_export>='] = $search_date_export_start;
443 $param .=
'&search_date_export_startmonth='.((int) $tmp[
'mon']).
'&search_date_export_startday='.((int) $tmp[
'mday']).
'&search_date_export_startyear='.((int) $tmp[
'year']);
445 if (!empty($search_date_export_end)) {
446 $filter[
't.date_export<='] = $search_date_export_end;
448 $param .=
'&search_date_export_endmonth='.((int) $tmp[
'mon']).
'&search_date_export_endday='.((int) $tmp[
'mday']).
'&search_date_export_endyear='.((int) $tmp[
'year']);
450 if (!empty($search_date_validation_start)) {
451 $filter[
't.date_validated>='] = $search_date_validation_start;
453 $param .=
'&search_date_validation_startmonth='.((int) $tmp[
'mon']).
'&search_date_validation_startday='.((int) $tmp[
'mday']).
'&search_date_validation_startyear='.((int) $tmp[
'year']);
455 if (!empty($search_date_validation_end)) {
456 $filter[
't.date_validated<='] = $search_date_validation_end;
458 $param .=
'&search_date_validation_endmonth='.((int) $tmp[
'mon']).
'&search_date_validation_endday='.((int) $tmp[
'mday']).
'&search_date_validation_endyear='.((int) $tmp[
'year']);
461 if (!empty($search_date_due_start)) {
462 $filter[
't.date_lim_reglement>='] = $search_date_due_start;
463 $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;
466 if (!empty($search_date_due_end)) {
467 $filter[
't.date_lim_reglement<='] = $search_date_due_end;
468 $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;
470 if (!empty($search_debit)) {
471 $filter[
't.debit'] = $search_debit;
472 $param .=
'&search_debit='.urlencode($search_debit);
474 if (!empty($search_credit)) {
475 $filter[
't.credit'] = $search_credit;
476 $param .=
'&search_credit='.urlencode($search_credit);
478 if (!empty($search_lettering_code)) {
479 $filter[
't.lettering_code'] = $search_lettering_code;
480 $param .=
'&search_lettering_code='.urlencode($search_lettering_code);
482 if (!empty($search_not_reconciled)) {
483 $filter[
't.reconciled_option'] = $search_not_reconciled;
484 $param .=
'&search_not_reconciled='.urlencode($search_not_reconciled);
486 if (!empty($search_import_key)) {
487 $filter[
't.import_key'] = $search_import_key;
488 $param .=
'&search_import_key='.urlencode($search_import_key);
492 $objectclass =
'Bookkeeping';
493 $objectlabel =
'Bookkeeping';
494 $permissiontoread = $user->hasRight(
'societe',
'lire');
495 $permissiontodelete = $user->hasRight(
'societe',
'supprimer');
496 $permissiontoadd = $user->hasRight(
'societe',
'creer');
497 $uploaddir =
$conf->societe->dir_output;
500 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
502 if (!$error && $action ==
'deletebookkeepingwriting' && $confirm ==
"yes" && $user->hasRight(
'accounting',
'mouvements',
'supprimer')) {
507 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect,
true);
508 if ($nb_lettering < 0) {
517 foreach ($toselect as $toselectid) {
518 $result =
$object->fetch($toselectid);
519 if ($result > 0 && (!isset(
$object->date_validation) ||
$object->date_validation ===
'')) {
528 } elseif ($result < 0) {
532 } elseif (isset(
$object->date_validation) &&
$object->date_validation !=
'') {
533 setEventMessages($langs->trans(
"ValidatedRecordWhereFound"),
null,
'errors');
546 } elseif ($nbok > 0) {
552 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?noreset=1".($param ?
'&'.$param :
''));
561 if ($massaction ==
'letteringauto' && $permissiontoadd) {
563 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
564 if ($nb_lettering < 0) {
567 $nb_lettering = max(0, abs($nb_lettering) - 2);
568 } elseif ($nb_lettering == 0) {
570 setEventMessages($langs->trans(
'AccountancyNoLetteringModified'), array(),
'mesgs');
572 if ($nb_lettering == 1) {
573 setEventMessages($langs->trans(
'AccountancyOneLetteringModifiedSuccessfully'), array(),
'mesgs');
574 } elseif ($nb_lettering > 1) {
575 setEventMessages($langs->trans(
'AccountancyLetteringModifiedSuccessfully', $nb_lettering), array(),
'mesgs');
579 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
582 } elseif ($massaction ==
'letteringmanual' && $permissiontoadd) {
584 $result = $lettering->updateLettering($toselect);
588 setEventMessages($langs->trans(
'AccountancyOneLetteringModifiedSuccessfully'), array(),
'mesgs');
589 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
592 } elseif ($action ==
'unletteringauto' && $confirm ==
"yes" && $permissiontoadd) {
594 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect,
true);
595 if ($nb_lettering < 0) {
598 $nb_lettering = max(0, abs($nb_lettering) - 2);
599 } elseif ($nb_lettering == 0) {
601 setEventMessages($langs->trans(
'AccountancyNoUnletteringModified'), array(),
'mesgs');
603 if ($nb_lettering == 1) {
604 setEventMessages($langs->trans(
'AccountancyOneUnletteringModifiedSuccessfully'), array(),
'mesgs');
605 } elseif ($nb_lettering > 1) {
606 setEventMessages($langs->trans(
'AccountancyUnletteringModifiedSuccessfully', $nb_lettering), array(),
'mesgs');
610 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
613 } elseif ($action ==
'unletteringmanual' && $confirm ==
"yes" && $permissiontoadd) {
615 $nb_lettering = $lettering->deleteLettering($toselect);
616 if ($nb_lettering < 0) {
619 setEventMessages($langs->trans(
'AccountancyOneUnletteringModifiedSuccessfully'), array(),
'mesgs');
620 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
633$sql .=
" t.doc_date,";
634$sql .=
" t.doc_type,";
635$sql .=
" t.doc_ref,";
637$sql .=
" t.fk_docdet,";
638$sql .=
" t.thirdparty_code,";
639$sql .=
" t.subledger_account,";
640$sql .=
" t.subledger_label,";
641$sql .=
" t.numero_compte,";
642$sql .=
" t.label_compte,";
643$sql .=
" t.label_operation,";
646$sql .=
" t.lettering_code,";
647$sql .=
" t.montant as amount,";
649$sql .=
" t.fk_user_author,";
650$sql .=
" t.import_key,";
651$sql .=
" t.code_journal,";
652$sql .=
" t.journal_label,";
653$sql .=
" t.piece_num,";
654$sql .=
" t.date_creation,";
655$sql .=
" t.tms as date_modification,";
656$sql .=
" t.date_export,";
657$sql .=
" t.date_validated as date_validation,";
658$sql .=
" t.date_lim_reglement,";
659$sql .=
" t.import_key";
663$sql .=
' FROM '.MAIN_DB_PREFIX.$object->table_element.
' as t';
666if (count($filter) > 0) {
667 foreach ($filter as $key => $value) {
668 if ($key ==
't.doc_date') {
669 $sqlwhere[] = $db->sanitize($key).
" = '".$db->idate($value).
"'";
670 } elseif ($key ==
't.doc_date>=') {
671 $sqlwhere[] =
"t.doc_date >= '".$db->idate($value).
"'";
672 } elseif ($key ==
't.doc_date<=') {
673 $sqlwhere[] =
"t.doc_date <= '".$db->idate($value).
"'";
674 } elseif ($key ==
't.doc_date>') {
675 $sqlwhere[] =
"t.doc_date > '".$db->idate($value).
"'";
676 } elseif ($key ==
't.doc_date<') {
677 $sqlwhere[] =
"t.doc_date < '".$db->idate($value).
"'";
678 } elseif ($key ==
't.numero_compte>=') {
679 $sqlwhere[] =
"t.numero_compte >= '".$db->escape($value).
"'";
680 } elseif ($key ==
't.numero_compte<=') {
681 $sqlwhere[] =
"t.numero_compte <= '".$db->escape($value).
"'";
682 } elseif ($key ==
't.subledger_account>=') {
683 $sqlwhere[] =
"t.subledger_account >= '".$db->escape($value).
"'";
684 } elseif ($key ==
't.subledger_account<=') {
685 $sqlwhere[] =
"t.subledger_account <= '".$db->escape($value).
"'";
686 } elseif ($key ==
't.fk_doc' || $key ==
't.fk_docdet' || $key ==
't.piece_num') {
687 $sqlwhere[] = $db->sanitize($key).
' = '.((int) $value);
688 } elseif ($key ==
't.subledger_account' || $key ==
't.numero_compte') {
689 $sqlwhere[] = $db->sanitize($key).
" LIKE '".$db->escape($db->escapeforlike($value)).
"%'";
690 } elseif ($key ==
't.subledger_account') {
692 } elseif ($key ==
't.tms>=') {
693 $sqlwhere[] =
"t.tms >= '".$db->idate($value).
"'";
694 } elseif ($key ==
't.tms<=') {
695 $sqlwhere[] =
"t.tms <= '".$db->idate($value).
"'";
696 } elseif ($key ==
't.date_creation>=') {
697 $sqlwhere[] =
"t.date_creation >= '".$db->idate($value).
"'";
698 } elseif ($key ==
't.date_creation<=') {
699 $sqlwhere[] =
"t.date_creation <= '".$db->idate($value).
"'";
700 } elseif ($key ==
't.date_export>=') {
701 $sqlwhere[] =
"t.date_export >= '".$db->idate($value).
"'";
702 } elseif ($key ==
't.date_export<=') {
703 $sqlwhere[] =
"t.date_export <= '".$db->idate($value).
"'";
704 } elseif ($key ==
't.date_validated>=') {
705 $sqlwhere[] =
"t.date_validated >= '".$db->idate($value).
"'";
706 } elseif ($key ==
't.date_validated<=') {
707 $sqlwhere[] =
"t.date_validated <= '".$db->idate($value).
"'";
708 } elseif ($key ==
't.date_lim_reglement>=') {
709 $sqlwhere[] =
"t.date_lim_reglement >= '".$db->idate($value).
"'";
710 } elseif ($key ==
't.date_lim_reglement<=') {
711 $sqlwhere[] =
"t.date_lim_reglement <= '".$db->idate($value).
"'";
712 } elseif ($key ==
't.credit' || $key ==
't.debit') {
714 } elseif ($key ==
't.reconciled_option') {
715 $sqlwhere[] =
't.lettering_code IS NULL';
716 } elseif ($key ==
't.code_journal' && !empty($value)) {
717 if (is_array($value)) {
718 $sqlwhere[] =
natural_search(
"t.code_journal", implode(
',', $value), 3, 1);
722 } elseif ($key ==
't.search_accounting_code_in' && !empty($value)) {
723 $sqlwhere[] =
't.numero_compte IN ('.$db->sanitize($value, 1).
')';
729$sql .=
' WHERE t.entity IN ('.getEntity(
'accountancy').
')';
731if (count($sqlwhere) > 0) {
732 $sql .=
' AND '.implode(
' AND ', $sqlwhere);
743$title_page = $langs->trans(
"Operations").
' - '.$langs->trans(
"Journals");
746$nbtotalofrecords =
'';
749 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
750 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
751 $resql = $db->query($sqlforcount);
753 $objforcount = $db->fetch_object($resql);
754 $nbtotalofrecords = $objforcount->nbtotalofrecords;
759 if (($page * $limit) > $nbtotalofrecords) {
767$sql .= $db->order($sortfield, $sortorder);
769 $sql .= $db->plimit($limit + 1, $offset);
772$resql = $db->query($sql);
778$num = $db->num_rows($resql);
780$arrayofselected = is_array($toselect) ? $toselect : array();
784$help_url =
'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double';
785llxHeader(
'', $title_page, $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy accountancy-consultation page-journal');
793if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
794 $param .=
'&contextpage='.urlencode($contextpage);
796if ($limit > 0 && $limit !=
$conf->liste_limit) {
797 $param .=
'&limit='.((int) $limit);
801$arrayofmassactions = array();
802if (
getDolGlobalInt(
'ACCOUNTING_ENABLE_LETTERING') && $user->hasRight(
'accounting',
'mouvements',
'creer')) {
803 $arrayofmassactions[
'letteringauto'] =
img_picto(
'',
'check',
'class="pictofixedwidth"') . $langs->trans(
'LetteringAuto');
804 $arrayofmassactions[
'preunletteringauto'] =
img_picto(
'',
'uncheck',
'class="pictofixedwidth"') . $langs->trans(
'UnletteringAuto');
805 $arrayofmassactions[
'letteringmanual'] =
img_picto(
'',
'check',
'class="pictofixedwidth"') . $langs->trans(
'LetteringManual');
806 $arrayofmassactions[
'preunletteringmanual'] =
img_picto(
'',
'uncheck',
'class="pictofixedwidth"') . $langs->trans(
'UnletteringManual');
808if ($user->hasRight(
'accounting',
'mouvements',
'supprimer')) {
809 $arrayofmassactions[
'predeletebookkeepingwriting'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
811if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'preunletteringauto',
'preunletteringmanual',
'predeletebookkeepingwriting'))) {
812 $arrayofmassactions = array();
814$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
816print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
817print
'<input type="hidden" name="token" value="'.newToken().
'">';
818print
'<input type="hidden" name="action" value="list">';
819if ($optioncss !=
'') {
820 print
'<input type="hidden" name="optioncss" value="'.urlencode($optioncss).
'">';
822print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
823print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
824print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
825print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
828 $buttonLabel = $langs->trans(
"ExportFilteredList");
830 $buttonLabel = $langs->trans(
"ExportList");
833$parameters = array(
'param' => $param);
834$reshook = $hookmanager->executeHooks(
'addMoreActionsButtonsList', $parameters, $object, $action);
839$newcardbutton = empty($hookmanager->resPrint) ?
'' : $hookmanager->resPrint;
841if (empty($reshook)) {
842 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewFlatList'),
'',
'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.
'/accountancy/bookkeeping/list.php?'.$param,
'', 1, array(
'morecss' =>
'marginleftonly btnTitleSelected'));
843 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'GroupByAccountAccounting'),
'',
'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.
'/accountancy/bookkeeping/listbyaccount.php?'.$param,
'', 1, array(
'morecss' =>
'marginleftonly'));
844 $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'));
846 $url =
'./card.php?action=create';
847 if (!empty($socid)) {
848 $url .=
'&socid='.$socid;
851 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewAccountingMvt'),
'',
'fa fa-plus-circle paddingleft', $url,
'', $user->hasRight(
'accounting',
'mouvements',
'creer'));
854print_barre_liste($title_page, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'title_accountancy', 0, $newcardbutton,
'', $limit, 0, 0, 1);
856if ($massaction ==
'preunletteringauto') {
857 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassUnletteringAuto"), $langs->trans(
"ConfirmMassUnletteringQuestion", count($toselect)),
"unletteringauto",
null,
'', 0, 200, 500, 1);
858} elseif ($massaction ==
'preunletteringmanual') {
859 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassUnletteringManual"), $langs->trans(
"ConfirmMassUnletteringQuestion", count($toselect)),
"unletteringmanual",
null,
'', 0, 200, 500, 1);
860} elseif ($massaction ==
'predeletebookkeepingwriting') {
861 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDeleteBookkeepingWriting"), $langs->trans(
"ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)),
"deletebookkeepingwriting",
null,
'', 0, 200, 500, 1);
868include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
870$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
871$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
872if ($massactionbutton && $contextpage !=
'poslist') {
873 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
877$moreforfilter .=
'<div class="divsearchfield">';
878$moreforfilter .= $langs->trans(
'AccountingCategory').
': ';
879$moreforfilter .=
'<div class="nowrap inline-block">';
880$moreforfilter .= $formaccounting->select_accounting_category($search_account_category,
'search_account_category', 1, 0, 0, 0);
881$moreforfilter .=
'</div>';
882$moreforfilter .=
'</div>';
884$parameters = array();
885$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
886if (empty($reshook)) {
887 $moreforfilter .= $hookmanager->resPrint;
889 $moreforfilter = $hookmanager->resPrint;
892print
'<div class="liste_titre liste_titre_bydiv centpercent">';
896print
'<div class="div-table-responsive">';
897print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">';
900print
'<tr class="liste_titre_filter">';
903 print
'<td class="liste_titre center">';
904 $searchpicto = $form->showFilterButtons(
'left');
909if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
910 print
'<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).
'"></td>';
913if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
914 print
'<td class="liste_titre center">';
915 print $formaccounting->multi_select_journal($search_ledger_code,
'search_ledger_code', 0, 1, 1, 1,
'small maxwidth75');
919if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
920 print
'<td class="liste_titre center">';
921 print
'<div class="nowrapfordate">';
922 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
924 print
'<div class="nowrapfordate">';
925 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
930if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
931 print
'<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="'.dol_escape_htmltag($search_doc_ref).
'"></td>';
934if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
935 print
'<td class="liste_titre">';
936 print
'<div class="nowrap">';
937 print $formaccounting->select_account($search_accountancy_code_start,
'search_accountancy_code_start', $langs->trans(
'From'), array(), 1, 1,
'maxwidth150',
'account');
939 print
'<div class="nowrap">';
940 print $formaccounting->select_account($search_accountancy_code_end,
'search_accountancy_code_end', $langs->trans(
'to'), array(), 1, 1,
'maxwidth150',
'account');
945if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
946 print
'<td class="liste_titre">';
950 print
'<div class="nowrap">';
952 print $formaccounting->select_auxaccount($search_accountancy_aux_code_start,
'search_accountancy_aux_code_start', $langs->trans(
'From'),
'maxwidth250',
'subledgeraccount');
954 print
'<div class="nowrap">';
955 print $formaccounting->select_auxaccount($search_accountancy_aux_code_end,
'search_accountancy_aux_code_end', $langs->trans(
'to'),
'maxwidth250',
'subledgeraccount');
958 print
'<input type="text" class="maxwidth75" name="search_accountancy_aux_code" value="'.dol_escape_htmltag($search_accountancy_aux_code).
'">';
963if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
964 print
'<td class="liste_titre">';
965 print
'<input type="text" size="7" class="flat" name="search_mvt_label" value="'.dol_escape_htmltag($search_mvt_label).
'"/>';
969if (!empty($arrayfields[
't.debit'][
'checked'])) {
970 print
'<td class="liste_titre right">';
971 print
'<input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).
'">';
975if (!empty($arrayfields[
't.credit'][
'checked'])) {
976 print
'<td class="liste_titre right">';
977 print
'<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).
'">';
981if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
982 print
'<td class="liste_titre center">';
983 print
'<input type="text" size="3" class="flat" name="search_lettering_code" value="'.dol_escape_htmltag($search_lettering_code).
'"/>';
984 print
'<br><span class="nowrap"><input type="checkbox" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled ==
'notreconciled' ?
' checked' :
'').
'>'.$langs->trans(
"NotReconciled").
'</span>';
989$parameters = array(
'arrayfields' => $arrayfields);
990$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
991print $hookmanager->resPrint;
994if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
995 print
'<td class="liste_titre center">';
996 print
'<div class="nowrapfordate">';
997 print $form->selectDate($search_date_creation_start,
'search_date_creation_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
999 print
'<div class="nowrapfordate">';
1000 print $form->selectDate($search_date_creation_end,
'search_date_creation_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1005if (!empty($arrayfields[
't.tms'][
'checked'])) {
1006 print
'<td class="liste_titre center">';
1007 print
'<div class="nowrapfordate">';
1008 print $form->selectDate($search_date_modification_start,
'search_date_modification_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1010 print
'<div class="nowrapfordate">';
1011 print $form->selectDate($search_date_modification_end,
'search_date_modification_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1016if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1017 print
'<td class="liste_titre center">';
1018 print
'<div class="nowrapfordate">';
1019 print $form->selectDate($search_date_export_start,
'search_date_export_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1021 print
'<div class="nowrapfordate">';
1022 print $form->selectDate($search_date_export_end,
'search_date_export_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1027if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1028 print
'<td class="liste_titre center">';
1029 print
'<div class="nowrapfordate">';
1030 print $form->selectDate($search_date_validation_start,
'search_date_validation_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1032 print
'<div class="nowrapfordate">';
1033 print $form->selectDate($search_date_validation_end,
'search_date_validation_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1038if (!empty($arrayfields[
't.date_lim_reglement'][
'checked'])) {
1039 print
'<td class="liste_titre center">';
1040 print
'<div class="nowrapfordate">';
1041 print $form->selectDate($search_date_due_start,
'search_date_due_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1043 print
'<div class="nowrapfordate">';
1044 print $form->selectDate($search_date_due_end,
'search_date_due_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1048if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1049 print
'<td class="liste_titre center">';
1050 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1055 print
'<td class="liste_titre center">';
1056 $searchpicto = $form->showFilterButtons();
1062print
'<tr class="liste_titre">';
1064 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch actioncolumn ');
1066if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
1067 print_liste_field_titre($arrayfields[
't.piece_num'][
'label'], $_SERVER[
'PHP_SELF'],
"t.piece_num",
"", $param,
"", $sortfield, $sortorder);
1069if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
1070 print_liste_field_titre($arrayfields[
't.code_journal'][
'label'], $_SERVER[
'PHP_SELF'],
"t.code_journal",
"", $param,
'', $sortfield, $sortorder,
'center ');
1072if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1073 print_liste_field_titre($arrayfields[
't.doc_date'][
'label'], $_SERVER[
'PHP_SELF'],
"t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1075if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1076 print_liste_field_titre($arrayfields[
't.doc_ref'][
'label'], $_SERVER[
'PHP_SELF'],
"t.doc_ref",
"", $param,
"", $sortfield, $sortorder);
1078if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
1079 print_liste_field_titre($arrayfields[
't.numero_compte'][
'label'], $_SERVER[
'PHP_SELF'],
"t.numero_compte",
"", $param,
"", $sortfield, $sortorder);
1081if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
1082 print_liste_field_titre($arrayfields[
't.subledger_account'][
'label'], $_SERVER[
'PHP_SELF'],
"t.subledger_account",
"", $param,
"", $sortfield, $sortorder);
1084if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1085 print_liste_field_titre($arrayfields[
't.label_operation'][
'label'], $_SERVER[
'PHP_SELF'],
"t.label_operation",
"", $param,
"", $sortfield, $sortorder);
1087if (!empty($arrayfields[
't.debit'][
'checked'])) {
1088 print_liste_field_titre($arrayfields[
't.debit'][
'label'], $_SERVER[
'PHP_SELF'],
"t.debit",
"", $param,
'', $sortfield, $sortorder,
'right ');
1090if (!empty($arrayfields[
't.credit'][
'checked'])) {
1091 print_liste_field_titre($arrayfields[
't.credit'][
'label'], $_SERVER[
'PHP_SELF'],
"t.credit",
"", $param,
'', $sortfield, $sortorder,
'right ');
1093if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1094 print_liste_field_titre($arrayfields[
't.lettering_code'][
'label'], $_SERVER[
'PHP_SELF'],
"t.lettering_code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1097$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1098$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1099print $hookmanager->resPrint;
1100if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1101 print_liste_field_titre($arrayfields[
't.date_creation'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center ');
1103if (!empty($arrayfields[
't.tms'][
'checked'])) {
1104 print_liste_field_titre($arrayfields[
't.tms'][
'label'], $_SERVER[
'PHP_SELF'],
"t.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
1106if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1107 print_liste_field_titre($arrayfields[
't.date_export'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_export,t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1109if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1110 print_liste_field_titre($arrayfields[
't.date_validated'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_validated,t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1113if (!empty($arrayfields[
't.date_lim_reglement'][
'checked'])) {
1114 print_liste_field_titre($arrayfields[
't.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
't.date_lim_reglement',
'', $param,
'', $sortfield, $sortorder,
'center ');
1116if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1117 print_liste_field_titre($arrayfields[
't.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"t.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1120 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1130$totalarray = array();
1131$totalarray[
'nbfield'] = 0;
1132$totalarray[
'val'] = array();
1133$totalarray[
'val'][
'totaldebit'] = 0;
1134$totalarray[
'val'][
'totalcredit'] = 0;
1136while ($i < min($num, $limit)) {
1137 $obj = $db->fetch_object($resql);
1142 $line->id = $obj->rowid;
1143 $line->doc_date = $db->jdate($obj->doc_date);
1144 $line->doc_type = $obj->doc_type;
1145 $line->doc_ref = $obj->doc_ref;
1146 $line->fk_doc = $obj->fk_doc;
1147 $line->fk_docdet = $obj->fk_docdet;
1148 $line->thirdparty_code = $obj->thirdparty_code;
1149 $line->subledger_account = $obj->subledger_account;
1150 $line->subledger_label = $obj->subledger_label;
1151 $line->numero_compte = $obj->numero_compte;
1152 $line->label_compte = $obj->label_compte;
1153 $line->label_operation = $obj->label_operation;
1154 $line->debit = $obj->debit;
1155 $line->credit = $obj->credit;
1156 $line->montant = $obj->amount;
1157 $line->amount = $obj->amount;
1158 $line->sens = $obj->sens;
1159 $line->lettering_code = $obj->lettering_code;
1160 $line->fk_user_author = $obj->fk_user_author;
1161 $line->import_key = $obj->import_key;
1162 $line->code_journal = $obj->code_journal;
1163 $line->journal_label = $obj->journal_label;
1164 $line->piece_num = $obj->piece_num;
1165 $line->date_creation = $db->jdate($obj->date_creation);
1166 $line->date_modification = $db->jdate($obj->date_modification);
1167 $line->date_export = $db->jdate($obj->date_export);
1168 $line->date_validation = $db->jdate($obj->date_validation);
1170 $line->date_lim_reglement = $db->jdate($obj->date_lim_reglement);
1172 print
'<tr class="oddeven">';
1175 print
'<td class="nowraponall center">';
1176 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
1178 if (in_array($line->id, $arrayofselected)) {
1181 print
'<input id="cb'.$line->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.
'"'.($selected ?
' checked="checked"' :
'').
' />';
1185 $totalarray[
'nbfield']++;
1190 if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
1193 $object->piece_num = $line->piece_num;
1194 print
$object->getNomUrl(1,
'', 0,
'', 1);
1197 $totalarray[
'nbfield']++;
1202 if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
1203 if (empty(
$conf->cache[
'accountingjournal'][$line->code_journal])) {
1205 $accountingjournal->fetch(0, $line->code_journal);
1206 $conf->cache[
'accountingjournal'][$line->code_journal] = $accountingjournal;
1208 $accountingjournal =
$conf->cache[
'accountingjournal'][$line->code_journal];
1211 $journaltoshow = (($accountingjournal->id > 0) ? $accountingjournal->getNomUrl(0, 0, 0,
'', 0) : $line->code_journal);
1212 print
'<td class="center tdoverflowmax150">'.$journaltoshow.
'</td>';
1214 $totalarray[
'nbfield']++;
1219 if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1220 print
'<td class="center">'.dol_print_date($line->doc_date,
'day').
'</td>';
1222 $totalarray[
'nbfield']++;
1228 if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1229 $objectstatic =
null;
1231 if ($line->doc_type ===
'customer_invoice') {
1232 $langs->loadLangs(array(
'bills'));
1234 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
1235 $objectstatic =
new Facture($db);
1236 $objectstatic->fetch($line->fk_doc);
1241 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$objectstatic->id;
1242 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1243 } elseif ($line->doc_type ===
'supplier_invoice') {
1244 $langs->loadLangs(array(
'bills'));
1246 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
1248 $objectstatic->fetch($line->fk_doc);
1250 $modulepart =
'invoice_supplier';
1255 $filedir =
getMultidirOutput($objectstatic,
'', 1).dol_sanitizeFileName($line->doc_ref);
1256 $subdir =
getMultidirOutput($objectstatic,
'', 1,
'outputrel').dol_sanitizeFileName($line->doc_ref);
1259 if ($objectstatic->id > 0) {
1260 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
1262 $documentlink = $line->doc_ref;
1264 } elseif ($line->doc_type ===
'expense_report') {
1265 $langs->loadLangs(array(
'trips'));
1267 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
1269 $objectstatic->fetch($line->fk_doc);
1274 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$objectstatic->id;
1275 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1276 } elseif ($line->doc_type ===
'bank') {
1277 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
1279 $objectstatic->fetch($line->fk_doc);
1285 $labeltoshowalt =
'';
1286 $classforlabel =
'';
1287 if (($line->doc_type ===
'customer_invoice' || $line->doc_type ===
'supplier_invoice' || $line->doc_type ===
'expense_report') && is_object($objectstatic)) {
1288 $labeltoshow .= $objectstatic->getNomUrl(1,
'', 0, 0,
'', 0, -1, 1);
1289 $labeltoshow .= $documentlink;
1290 $labeltoshowalt .= $objectstatic->ref;
1291 } elseif ($line->doc_type ===
'bank' && is_object($objectstatic)) {
1292 $labeltoshow .= $objectstatic->getNomUrl(1);
1293 $labeltoshowalt .= $objectstatic->ref;
1294 $bank_ref = strstr($line->doc_ref,
'-');
1295 $labeltoshow .=
" " . $bank_ref;
1296 $labeltoshowalt .=
" " . $bank_ref;
1298 $labeltoshow .= $line->doc_ref;
1299 $labeltoshowalt .= $line->doc_ref;
1300 $classforlabel =
'tdoverflowmax250';
1303 print
'<td class="nowraponall'.($classforlabel ?
' '.$classforlabel :
'').
'" title="'.
dol_escape_htmltag($labeltoshowalt).
'">';
1307 $totalarray[
'nbfield']++;
1312 if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
1313 print
'<td>'.length_accountg($line->numero_compte).
'</td>';
1315 $totalarray[
'nbfield']++;
1320 if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
1321 print
'<td>'.length_accounta($line->subledger_account).
'</td>';
1323 $totalarray[
'nbfield']++;
1328 if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1329 print
'<td class="small tdoverflowmax200" title="'.dol_escape_htmltag($line->label_operation).
'">'.
dol_escape_htmltag($line->label_operation).
'</td>';
1331 $totalarray[
'nbfield']++;
1336 if (!empty($arrayfields[
't.debit'][
'checked'])) {
1337 print
'<td class="right nowraponall amount">'.($line->debit != 0 ?
price($line->debit) :
'').
'</td>';
1339 $totalarray[
'nbfield']++;
1342 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totaldebit';
1344 $totalarray[
'val'][
'totaldebit'] += $line->debit;
1348 if (!empty($arrayfields[
't.credit'][
'checked'])) {
1349 print
'<td class="right nowraponall amount">'.($line->credit != 0 ?
price($line->credit) :
'').
'</td>';
1351 $totalarray[
'nbfield']++;
1354 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalcredit';
1356 $totalarray[
'val'][
'totalcredit'] += $line->credit;
1360 if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1361 print
'<td class="center">'.$line->lettering_code.
'</td>';
1363 $totalarray[
'nbfield']++;
1368 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1369 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1370 print $hookmanager->resPrint;
1373 if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1374 print
'<td class="center">'.dol_print_date($line->date_creation,
'dayhour',
'tzuserrel').
'</td>';
1376 $totalarray[
'nbfield']++;
1381 if (!empty($arrayfields[
't.tms'][
'checked'])) {
1382 print
'<td class="center">'.dol_print_date($line->date_modification,
'dayhour',
'tzuserrel').
'</td>';
1384 $totalarray[
'nbfield']++;
1389 if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1390 print
'<td class="center nowraponall">'.dol_print_date($line->date_export,
'dayhour',
'tzuserrel').
'</td>';
1392 $totalarray[
'nbfield']++;
1397 if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1398 print
'<td class="center nowraponall">'.dol_print_date($line->date_validation,
'dayhour',
'tzuserrel').
'</td>';
1400 $totalarray[
'nbfield']++;
1405 if (!empty($arrayfields[
't.date_lim_reglement'][
'checked'])) {
1406 print
'<td class="center">'.dol_print_date($line->date_lim_reglement,
'day').
'</td>';
1408 $totalarray[
'nbfield']++;
1412 if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1413 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($obj->import_key).
'">'.
dol_escape_htmltag($obj->import_key).
"</td>\n";
1415 $totalarray[
'nbfield']++;
1421 print
'<td class="nowraponall center">';
1422 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
1424 if (in_array($line->id, $arrayofselected)) {
1427 print
'<input id="cb'.$line->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.
'"'.($selected ?
' checked="checked"' :
'').
' />';
1431 $totalarray[
'nbfield']++;
1442include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1447 foreach ($arrayfields as $key => $val) {
1448 if (!empty($val[
'checked'])) {
1452 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1455$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1456$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1457print $hookmanager->resPrint;
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage bank transaction lines.
Class to manage categories of an accounting account.
Class to manage accounting journals.
Class to manage Ledger (General Ledger and Subledger)
Class to manage Trips and Expenses.
Class to manage suppliers invoices.
Class to manage invoices.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if(!function_exists( 'utf8_encode')) if(!function_exists('utf8_decode')) if(!function_exists( 'str_starts_with')) if(!function_exists('str_ends_with')) if(!function_exists( 'str_contains')) getMultidirOutput($object, $module='', $forobject=0, $mode='output')
Return the full path of the directory where a module (or an object of a module) stores its files.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.