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';
44$langs->loadLangs(array(
"accountancy",
"compta"));
50$action =
GETPOST(
'action',
'aZ09');
51$massaction =
GETPOST(
'massaction',
'alpha');
52$confirm =
GETPOST(
'confirm',
'alpha');
53$toselect =
GETPOST(
'toselect',
'array');
54$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'bookkeepinglist';
57$search_mvt_num =
GETPOST(
'search_mvt_num',
'alpha');
58$search_doc_type =
GETPOST(
"search_doc_type",
'alpha');
59$search_doc_ref =
GETPOST(
"search_doc_ref",
'alpha');
60$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
61$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
62$search_date_startday =
GETPOSTINT(
'search_date_startday');
63$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
64$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
65$search_date_endday =
GETPOSTINT(
'search_date_endday');
66$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
67$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
69$search_date_creation_startyear =
GETPOSTINT(
'search_date_creation_startyear');
70$search_date_creation_startmonth =
GETPOSTINT(
'search_date_creation_startmonth');
71$search_date_creation_startday =
GETPOSTINT(
'search_date_creation_startday');
72$search_date_creation_endyear =
GETPOSTINT(
'search_date_creation_endyear');
73$search_date_creation_endmonth =
GETPOSTINT(
'search_date_creation_endmonth');
74$search_date_creation_endday =
GETPOSTINT(
'search_date_creation_endday');
75$search_date_creation_start =
dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear);
76$search_date_creation_end =
dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear);
77$search_date_modification_startyear =
GETPOSTINT(
'search_date_modification_startyear');
78$search_date_modification_startmonth =
GETPOSTINT(
'search_date_modification_startmonth');
79$search_date_modification_startday =
GETPOSTINT(
'search_date_modification_startday');
80$search_date_modification_endyear =
GETPOSTINT(
'search_date_modification_endyear');
81$search_date_modification_endmonth =
GETPOSTINT(
'search_date_modification_endmonth');
82$search_date_modification_endday =
GETPOSTINT(
'search_date_modification_endday');
83$search_date_modification_start =
dol_mktime(0, 0, 0, $search_date_modification_startmonth, $search_date_modification_startday, $search_date_modification_startyear);
84$search_date_modification_end =
dol_mktime(23, 59, 59, $search_date_modification_endmonth, $search_date_modification_endday, $search_date_modification_endyear);
85$search_date_export_startyear =
GETPOSTINT(
'search_date_export_startyear');
86$search_date_export_startmonth =
GETPOSTINT(
'search_date_export_startmonth');
87$search_date_export_startday =
GETPOSTINT(
'search_date_export_startday');
88$search_date_export_endyear =
GETPOSTINT(
'search_date_export_endyear');
89$search_date_export_endmonth =
GETPOSTINT(
'search_date_export_endmonth');
90$search_date_export_endday =
GETPOSTINT(
'search_date_export_endday');
91$search_date_export_start =
dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
92$search_date_export_end =
dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
93$search_date_validation_startyear =
GETPOSTINT(
'search_date_validation_startyear');
94$search_date_validation_startmonth =
GETPOSTINT(
'search_date_validation_startmonth');
95$search_date_validation_startday =
GETPOSTINT(
'search_date_validation_startday');
96$search_date_validation_endyear =
GETPOSTINT(
'search_date_validation_endyear');
97$search_date_validation_endmonth =
GETPOSTINT(
'search_date_validation_endmonth');
98$search_date_validation_endday =
GETPOSTINT(
'search_date_validation_endday');
99$search_date_validation_start =
dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear);
100$search_date_validation_end =
dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
101$search_import_key =
GETPOST(
"search_import_key",
'alpha');
103$search_account_category =
GETPOSTINT(
'search_account_category');
105$search_accountancy_code =
GETPOST(
"search_accountancy_code",
'alpha');
106$search_accountancy_code_start =
GETPOST(
'search_accountancy_code_start',
'alpha');
107if ($search_accountancy_code_start == - 1) {
108 $search_accountancy_code_start =
'';
110$search_accountancy_code_end =
GETPOST(
'search_accountancy_code_end',
'alpha');
111if ($search_accountancy_code_end == - 1) {
112 $search_accountancy_code_end =
'';
115$search_accountancy_aux_code =
GETPOST(
"search_accountancy_aux_code",
'alpha');
116$search_accountancy_aux_code_start =
GETPOST(
'search_accountancy_aux_code_start',
'alpha');
117if ($search_accountancy_aux_code_start == - 1) {
118 $search_accountancy_aux_code_start =
'';
120$search_accountancy_aux_code_end =
GETPOST(
'search_accountancy_aux_code_end',
'alpha');
121if ($search_accountancy_aux_code_end == - 1) {
122 $search_accountancy_aux_code_end =
'';
124$search_mvt_label =
GETPOST(
'search_mvt_label',
'alpha');
125$search_direction =
GETPOST(
'search_direction',
'alpha');
126$search_debit =
GETPOST(
'search_debit',
'alpha');
127$search_credit =
GETPOST(
'search_credit',
'alpha');
128$search_ledger_code =
GETPOST(
'search_ledger_code',
'array');
129$search_lettering_code =
GETPOST(
'search_lettering_code',
'alpha');
130$search_not_reconciled =
GETPOST(
'search_not_reconciled',
'alpha');
134$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
135$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
136$optioncss =
GETPOST(
'optioncss',
'alpha');
138if (empty($page) || $page < 0) {
141$offset = $limit * $page;
142$pageprev = $page - 1;
143$pagenext = $page + 1;
144if ($sortorder ==
"") {
147if ($sortfield ==
"") {
148 $sortfield =
"t.piece_num,t.rowid";
153$hookmanager->initHooks(array(
'bookkeepinglist'));
156$form =
new Form($db);
158if (!in_array($action, array(
'delmouv',
'delmouvconfirm')) && !GETPOSTISSET(
'begin') && !GETPOSTISSET(
'formfilteraction') &&
GETPOST(
'page',
'alpha') ==
'' && !
GETPOSTINT(
'noreset') && $user->hasRight(
'accounting',
'mouvements',
'export')) {
159 if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET(
'restore_lastsearch_values') && !
GETPOST(
'search_accountancy_code_start')) {
160 $query =
"SELECT date_start, date_end from ".MAIN_DB_PREFIX.
"accounting_fiscalyear ";
161 $query .=
" where date_start < '".$db->idate(
dol_now()).
"' and date_end > '".$db->idate(
dol_now()).
"' limit 1";
162 $res = $db->query($query);
164 if ($db->num_rows($res) > 0) {
165 $fiscalYear = $db->fetch_object($res);
166 $search_date_start = strtotime($fiscalYear->date_start);
167 $search_date_end = strtotime($fiscalYear->date_end);
174 $year_end = $year_start + 1;
175 $month_end = $month_start - 1;
176 if ($month_end < 1) {
180 $search_date_start =
dol_mktime(0, 0, 0, $month_start, 1, $year_start);
188 't.piece_num' => array(
'label' => $langs->trans(
"TransactionNumShort"),
'checked' => 1),
189 't.code_journal' => array(
'label' => $langs->trans(
"Codejournal"),
'checked' => 1),
190 't.doc_date' => array(
'label' => $langs->trans(
"Docdate"),
'checked' => 1),
191 't.doc_ref' => array(
'label' => $langs->trans(
"Piece"),
'checked' => 1),
192 't.numero_compte' => array(
'label' => $langs->trans(
"AccountAccountingShort"),
'checked' => 1),
193 't.subledger_account' => array(
'label' => $langs->trans(
"SubledgerAccount"),
'checked' => 1),
194 't.label_operation' => array(
'label' => $langs->trans(
"Label"),
'checked' => 1),
195 't.debit' => array(
'label' => $langs->trans(
"AccountingDebit"),
'checked' => 1),
196 't.credit' => array(
'label' => $langs->trans(
"AccountingCredit"),
'checked' => 1),
197 't.lettering_code' => array(
'label' => $langs->trans(
"LetteringCode"),
'checked' => 1),
198 't.date_creation' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' => 0),
199 't.tms' => array(
'label' => $langs->trans(
"DateModification"),
'checked' => 0),
200 't.date_export' => array(
'label' => $langs->trans(
"DateExport"),
'checked' => 0),
201 't.date_validated' => array(
'label' => $langs->trans(
"DateValidationAndLock"),
'checked' => 0,
'enabled' => !
getDolGlobalString(
"ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
202 't.import_key' => array(
'label' => $langs->trans(
"ImportId"),
'checked' => 0,
'position' => 1100),
206 unset($arrayfields[
't.lettering_code']);
211if (!isModEnabled(
'accounting')) {
214if ($user->socid > 0) {
217if (!$user->hasRight(
'accounting',
'mouvements',
'lire')) {
221$permissiontoadd = $user->hasRight(
'accounting',
'mouvements',
'creer');
230if (
GETPOST(
'cancel',
'alpha')) {
234if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'preunletteringauto' && $massaction !=
'preunletteringmanual' && $massaction !=
'predeletebookkeepingwriting') {
238$parameters = array(
'socid' => $socid);
239$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
244if (empty($reshook)) {
245 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
247 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
248 $search_mvt_num =
'';
249 $search_doc_type =
'';
250 $search_doc_ref =
'';
251 $search_doc_date =
'';
252 $search_account_category =
'';
253 $search_accountancy_code =
'';
254 $search_accountancy_code_start =
'';
255 $search_accountancy_code_end =
'';
256 $search_accountancy_aux_code =
'';
257 $search_accountancy_aux_code_start =
'';
258 $search_accountancy_aux_code_end =
'';
259 $search_mvt_label =
'';
260 $search_direction =
'';
261 $search_ledger_code = array();
262 $search_date_startyear =
'';
263 $search_date_startmonth =
'';
264 $search_date_startday =
'';
265 $search_date_endyear =
'';
266 $search_date_endmonth =
'';
267 $search_date_endday =
'';
268 $search_date_start =
'';
269 $search_date_end =
'';
270 $search_date_creation_startyear =
'';
271 $search_date_creation_startmonth =
'';
272 $search_date_creation_startday =
'';
273 $search_date_creation_endyear =
'';
274 $search_date_creation_endmonth =
'';
275 $search_date_creation_endday =
'';
276 $search_date_creation_start =
'';
277 $search_date_creation_end =
'';
278 $search_date_modification_startyear =
'';
279 $search_date_modification_startmonth =
'';
280 $search_date_modification_startday =
'';
281 $search_date_modification_endyear =
'';
282 $search_date_modification_endmonth =
'';
283 $search_date_modification_endday =
'';
284 $search_date_modification_start =
'';
285 $search_date_modification_end =
'';
286 $search_date_export_startyear =
'';
287 $search_date_export_startmonth =
'';
288 $search_date_export_startday =
'';
289 $search_date_export_endyear =
'';
290 $search_date_export_endmonth =
'';
291 $search_date_export_endday =
'';
292 $search_date_export_start =
'';
293 $search_date_export_end =
'';
294 $search_date_validation_startyear =
'';
295 $search_date_validation_startmonth =
'';
296 $search_date_validation_startday =
'';
297 $search_date_validation_endyear =
'';
298 $search_date_validation_endmonth =
'';
299 $search_date_validation_endday =
'';
300 $search_date_validation_start =
'';
301 $search_date_validation_end =
'';
304 $search_lettering_code =
'';
305 $search_not_reconciled =
'';
306 $search_import_key =
'';
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($tmpval[
'id']).
"'";
346 $filter[
't.search_accounting_code_in'] = implode(
',', $listofaccountsforgroup2);
347 $param .=
'&search_account_category='.urlencode((
string) ($search_account_category));
349 if (!empty($search_accountancy_code)) {
350 $filter[
't.numero_compte'] = $search_accountancy_code;
351 $param .=
'&search_accountancy_code='.urlencode($search_accountancy_code);
353 if (!empty($search_accountancy_code_start)) {
354 $filter[
't.numero_compte>='] = $search_accountancy_code_start;
355 $param .=
'&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
357 if (!empty($search_accountancy_code_end)) {
358 $filter[
't.numero_compte<='] = $search_accountancy_code_end;
359 $param .=
'&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
361 if (!empty($search_accountancy_aux_code)) {
362 $filter[
't.subledger_account'] = $search_accountancy_aux_code;
363 $param .=
'&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
365 if (!empty($search_accountancy_aux_code_start)) {
366 $filter[
't.subledger_account>='] = $search_accountancy_aux_code_start;
367 $param .=
'&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
369 if (!empty($search_accountancy_aux_code_end)) {
370 $filter[
't.subledger_account<='] = $search_accountancy_aux_code_end;
371 $param .=
'&search_accountancy_aux_code_end='.urlencode($search_accountancy_aux_code_end);
373 if (!empty($search_mvt_label)) {
374 $filter[
't.label_operation'] = $search_mvt_label;
375 $param .=
'&search_mvt_label='.urlencode($search_mvt_label);
377 if (!empty($search_direction)) {
378 $filter[
't.sens'] = $search_direction;
379 $param .=
'&search_direction='.urlencode($search_direction);
381 if (!empty($search_ledger_code)) {
382 $filter[
't.code_journal'] = $search_ledger_code;
383 foreach ($search_ledger_code as $code) {
384 $param .=
'&search_ledger_code[]='.urlencode($code);
387 if (!empty($search_mvt_num)) {
388 $filter[
't.piece_num'] = $search_mvt_num;
389 $param .=
'&search_mvt_num='.urlencode((
string) ($search_mvt_num));
391 if (!empty($search_date_creation_start)) {
392 $filter[
't.date_creation>='] = $search_date_creation_start;
394 $param .=
'&search_date_creation_startmonth='.((int) $tmp[
'mon']).
'&search_date_creation_startday='.((int) $tmp[
'mday']).
'&search_date_creation_startyear='.((int) $tmp[
'year']);
396 if (!empty($search_date_creation_end)) {
397 $filter[
't.date_creation<='] = $search_date_creation_end;
399 $param .=
'&search_date_creation_endmonth='.((int) $tmp[
'mon']).
'&search_date_creation_endday='.((int) $tmp[
'mday']).
'&search_date_creation_endyear='.((int) $tmp[
'year']);
401 if (!empty($search_date_modification_start)) {
402 $filter[
't.tms>='] = $search_date_modification_start;
403 $tmp =
dol_getdate($search_date_modification_start);
404 $param .=
'&search_date_modification_startmonth='.((int) $tmp[
'mon']).
'&search_date_modification_startday='.((int) $tmp[
'mday']).
'&search_date_modification_startyear='.((int) $tmp[
'year']);
406 if (!empty($search_date_modification_end)) {
407 $filter[
't.tms<='] = $search_date_modification_end;
409 $param .=
'&search_date_modification_endmonth='.((int) $tmp[
'mon']).
'&search_date_modification_endday='.((int) $tmp[
'mday']).
'&search_date_modification_endyear='.((int) $tmp[
'year']);
411 if (!empty($search_date_export_start)) {
412 $filter[
't.date_export>='] = $search_date_export_start;
414 $param .=
'&search_date_export_startmonth='.((int) $tmp[
'mon']).
'&search_date_export_startday='.((int) $tmp[
'mday']).
'&search_date_export_startyear='.((int) $tmp[
'year']);
416 if (!empty($search_date_export_end)) {
417 $filter[
't.date_export<='] = $search_date_export_end;
419 $param .=
'&search_date_export_endmonth='.((int) $tmp[
'mon']).
'&search_date_export_endday='.((int) $tmp[
'mday']).
'&search_date_export_endyear='.((int) $tmp[
'year']);
421 if (!empty($search_date_validation_start)) {
422 $filter[
't.date_validated>='] = $search_date_validation_start;
424 $param .=
'&search_date_validation_startmonth='.((int) $tmp[
'mon']).
'&search_date_validation_startday='.((int) $tmp[
'mday']).
'&search_date_validation_startyear='.((int) $tmp[
'year']);
426 if (!empty($search_date_validation_end)) {
427 $filter[
't.date_validated<='] = $search_date_validation_end;
429 $param .=
'&search_date_validation_endmonth='.((int) $tmp[
'mon']).
'&search_date_validation_endday='.((int) $tmp[
'mday']).
'&search_date_validation_endyear='.((int) $tmp[
'year']);
431 if (!empty($search_debit)) {
432 $filter[
't.debit'] = $search_debit;
433 $param .=
'&search_debit='.urlencode($search_debit);
435 if (!empty($search_credit)) {
436 $filter[
't.credit'] = $search_credit;
437 $param .=
'&search_credit='.urlencode($search_credit);
439 if (!empty($search_lettering_code)) {
440 $filter[
't.lettering_code'] = $search_lettering_code;
441 $param .=
'&search_lettering_code='.urlencode($search_lettering_code);
443 if (!empty($search_not_reconciled)) {
444 $filter[
't.reconciled_option'] = $search_not_reconciled;
445 $param .=
'&search_not_reconciled='.urlencode($search_not_reconciled);
447 if (!empty($search_import_key)) {
448 $filter[
't.import_key'] = $search_import_key;
449 $param .=
'&search_import_key='.urlencode($search_import_key);
453 $objectclass =
'Bookkeeping';
454 $objectlabel =
'Bookkeeping';
455 $permissiontoread = $user->hasRight(
'societe',
'lire');
456 $permissiontodelete = $user->hasRight(
'societe',
'supprimer');
457 $permissiontoadd = $user->hasRight(
'societe',
'creer');
458 $uploaddir = $conf->societe->dir_output;
459 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
461 if (!$error && $action ==
'deletebookkeepingwriting' && $confirm ==
"yes" && $user->hasRight(
'accounting',
'mouvements',
'supprimer')) {
466 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect,
true);
467 if ($nb_lettering < 0) {
476 foreach ($toselect as $toselectid) {
477 $result =
$object->fetch($toselectid);
478 if ($result > 0 && (!isset(
$object->date_validation) ||
$object->date_validation ===
'')) {
487 } elseif ($result < 0) {
491 } elseif (isset(
$object->date_validation) &&
$object->date_validation !=
'') {
492 setEventMessages($langs->trans(
"ValidatedRecordWhereFound"),
null,
'errors');
505 } elseif ($nbok > 0) {
511 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?noreset=1".($param ?
'&'.$param :
''));
520 if ($massaction ==
'letteringauto' && $permissiontoadd) {
522 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
523 if ($nb_lettering < 0) {
526 $nb_lettering = max(0, abs($nb_lettering) - 2);
527 } elseif ($nb_lettering == 0) {
529 setEventMessages($langs->trans(
'AccountancyNoLetteringModified'), array(),
'mesgs');
531 if ($nb_lettering == 1) {
532 setEventMessages($langs->trans(
'AccountancyOneLetteringModifiedSuccessfully'), array(),
'mesgs');
533 } elseif ($nb_lettering > 1) {
534 setEventMessages($langs->trans(
'AccountancyLetteringModifiedSuccessfully', $nb_lettering), array(),
'mesgs');
538 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
541 } elseif ($massaction ==
'letteringmanual' && $permissiontoadd) {
543 $result = $lettering->updateLettering($toselect);
547 setEventMessages($langs->trans(
'AccountancyOneLetteringModifiedSuccessfully'), array(),
'mesgs');
548 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
551 } elseif ($action ==
'unletteringauto' && $confirm ==
"yes" && $permissiontoadd) {
553 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect,
true);
554 if ($nb_lettering < 0) {
557 $nb_lettering = max(0, abs($nb_lettering) - 2);
558 } elseif ($nb_lettering == 0) {
560 setEventMessages($langs->trans(
'AccountancyNoUnletteringModified'), array(),
'mesgs');
562 if ($nb_lettering == 1) {
563 setEventMessages($langs->trans(
'AccountancyOneUnletteringModifiedSuccessfully'), array(),
'mesgs');
564 } elseif ($nb_lettering > 1) {
565 setEventMessages($langs->trans(
'AccountancyUnletteringModifiedSuccessfully', $nb_lettering), array(),
'mesgs');
569 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
572 } elseif ($action ==
'unletteringmanual' && $confirm ==
"yes" && $permissiontoadd) {
574 $nb_lettering = $lettering->deleteLettering($toselect);
578 setEventMessages($langs->trans(
'AccountancyOneUnletteringModifiedSuccessfully'), array(),
'mesgs');
579 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
592$sql .=
" t.doc_date,";
593$sql .=
" t.doc_type,";
594$sql .=
" t.doc_ref,";
596$sql .=
" t.fk_docdet,";
597$sql .=
" t.thirdparty_code,";
598$sql .=
" t.subledger_account,";
599$sql .=
" t.subledger_label,";
600$sql .=
" t.numero_compte,";
601$sql .=
" t.label_compte,";
602$sql .=
" t.label_operation,";
605$sql .=
" t.lettering_code,";
606$sql .=
" t.montant as amount,";
608$sql .=
" t.fk_user_author,";
609$sql .=
" t.import_key,";
610$sql .=
" t.code_journal,";
611$sql .=
" t.journal_label,";
612$sql .=
" t.piece_num,";
613$sql .=
" t.date_creation,";
614$sql .=
" t.tms as date_modification,";
615$sql .=
" t.date_export,";
616$sql .=
" t.date_validated as date_validation,";
617$sql .=
" t.import_key";
621$sql .=
' FROM '.MAIN_DB_PREFIX.$object->table_element.
' as t';
624if (count($filter) > 0) {
625 foreach ($filter as $key => $value) {
626 if ($key ==
't.doc_date') {
627 $sqlwhere[] = $db->sanitize($key).
" = '".$db->idate($value).
"'";
628 } elseif ($key ==
't.doc_date>=') {
629 $sqlwhere[] =
"t.doc_date >= '".$db->idate($value).
"'";
630 } elseif ($key ==
't.doc_date<=') {
631 $sqlwhere[] =
"t.doc_date <= '".$db->idate($value).
"'";
632 } elseif ($key ==
't.doc_date>') {
633 $sqlwhere[] =
"t.doc_date > '".$db->idate($value).
"'";
634 } elseif ($key ==
't.doc_date<') {
635 $sqlwhere[] =
"t.doc_date < '".$db->idate($value).
"'";
636 } elseif ($key ==
't.numero_compte>=') {
637 $sqlwhere[] =
"t.numero_compte >= '".$db->escape($value).
"'";
638 } elseif ($key ==
't.numero_compte<=') {
639 $sqlwhere[] =
"t.numero_compte <= '".$db->escape($value).
"'";
640 } elseif ($key ==
't.subledger_account>=') {
641 $sqlwhere[] =
"t.subledger_account >= '".$db->escape($value).
"'";
642 } elseif ($key ==
't.subledger_account<=') {
643 $sqlwhere[] =
"t.subledger_account <= '".$db->escape($value).
"'";
644 } elseif ($key ==
't.fk_doc' || $key ==
't.fk_docdet' || $key ==
't.piece_num') {
645 $sqlwhere[] = $db->sanitize($key).
' = '.((int) $value);
646 } elseif ($key ==
't.subledger_account' || $key ==
't.numero_compte') {
647 $sqlwhere[] = $db->sanitize($key).
" LIKE '".$db->escape($db->escapeforlike($value)).
"%'";
648 } elseif ($key ==
't.subledger_account') {
650 } elseif ($key ==
't.tms>=') {
651 $sqlwhere[] =
"t.tms >= '".$db->idate($value).
"'";
652 } elseif ($key ==
't.tms<=') {
653 $sqlwhere[] =
"t.tms <= '".$db->idate($value).
"'";
654 } elseif ($key ==
't.date_creation>=') {
655 $sqlwhere[] =
"t.date_creation >= '".$db->idate($value).
"'";
656 } elseif ($key ==
't.date_creation<=') {
657 $sqlwhere[] =
"t.date_creation <= '".$db->idate($value).
"'";
658 } elseif ($key ==
't.date_export>=') {
659 $sqlwhere[] =
"t.date_export >= '".$db->idate($value).
"'";
660 } elseif ($key ==
't.date_export<=') {
661 $sqlwhere[] =
"t.date_export <= '".$db->idate($value).
"'";
662 } elseif ($key ==
't.date_validated>=') {
663 $sqlwhere[] =
"t.date_validated >= '".$db->idate($value).
"'";
664 } elseif ($key ==
't.date_validated<=') {
665 $sqlwhere[] =
"t.date_validated <= '".$db->idate($value).
"'";
666 } elseif ($key ==
't.credit' || $key ==
't.debit') {
668 } elseif ($key ==
't.reconciled_option') {
669 $sqlwhere[] =
't.lettering_code IS NULL';
670 } elseif ($key ==
't.code_journal' && !empty($value)) {
671 if (is_array($value)) {
672 $sqlwhere[] =
natural_search(
"t.code_journal", implode(
',', $value), 3, 1);
676 } elseif ($key ==
't.search_accounting_code_in' && !empty($value)) {
677 $sqlwhere[] =
't.numero_compte IN ('.$db->sanitize($value, 1).
')';
683$sql .=
' WHERE t.entity IN ('.getEntity(
'accountancy').
')';
685if (count($sqlwhere) > 0) {
686 $sql .=
' AND '.implode(
' AND ', $sqlwhere);
697$title_page = $langs->trans(
"Operations").
' - '.$langs->trans(
"Journals");
700$nbtotalofrecords =
'';
703 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
704 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
705 $resql = $db->query($sqlforcount);
707 $objforcount = $db->fetch_object($resql);
708 $nbtotalofrecords = $objforcount->nbtotalofrecords;
713 if (($page * $limit) > $nbtotalofrecords) {
721$sql .= $db->order($sortfield, $sortorder);
723 $sql .= $db->plimit($limit + 1, $offset);
726$resql = $db->query($sql);
732$num = $db->num_rows($resql);
734$arrayofselected = is_array($toselect) ? $toselect : array();
738$help_url =
'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double';
739llxHeader(
'', $title_page, $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy accountancy-consultation page-journal');
747if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
748 $param .=
'&contextpage='.urlencode($contextpage);
750if ($limit > 0 && $limit != $conf->liste_limit) {
751 $param .=
'&limit='.((int) $limit);
755$arrayofmassactions = array();
756if (
getDolGlobalInt(
'ACCOUNTING_ENABLE_LETTERING') && $user->hasRight(
'accounting',
'mouvements',
'creer')) {
757 $arrayofmassactions[
'letteringauto'] =
img_picto(
'',
'check',
'class="pictofixedwidth"') . $langs->trans(
'LetteringAuto');
758 $arrayofmassactions[
'preunletteringauto'] =
img_picto(
'',
'uncheck',
'class="pictofixedwidth"') . $langs->trans(
'UnletteringAuto');
759 $arrayofmassactions[
'letteringmanual'] =
img_picto(
'',
'check',
'class="pictofixedwidth"') . $langs->trans(
'LetteringManual');
760 $arrayofmassactions[
'preunletteringmanual'] =
img_picto(
'',
'uncheck',
'class="pictofixedwidth"') . $langs->trans(
'UnletteringManual');
762if ($user->hasRight(
'accounting',
'mouvements',
'supprimer')) {
763 $arrayofmassactions[
'predeletebookkeepingwriting'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
765if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'preunletteringauto',
'preunletteringmanual',
'predeletebookkeepingwriting'))) {
766 $arrayofmassactions = array();
768$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
770print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
771print
'<input type="hidden" name="token" value="'.newToken().
'">';
772print
'<input type="hidden" name="action" value="list">';
773if ($optioncss !=
'') {
774 print
'<input type="hidden" name="optioncss" value="'.urlencode($optioncss).
'">';
776print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
777print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
778print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
779print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
782 $buttonLabel = $langs->trans(
"ExportFilteredList");
784 $buttonLabel = $langs->trans(
"ExportList");
787$parameters = array(
'param' => $param);
788$reshook = $hookmanager->executeHooks(
'addMoreActionsButtonsList', $parameters, $object, $action);
793$newcardbutton = empty($hookmanager->resPrint) ?
'' : $hookmanager->resPrint;
795if (empty($reshook)) {
796 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewFlatList'),
'',
'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.
'/accountancy/bookkeeping/list.php?'.$param,
'', 1, array(
'morecss' =>
'marginleftonly btnTitleSelected'));
797 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'GroupByAccountAccounting'),
'',
'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.
'/accountancy/bookkeeping/listbyaccount.php?'.$param,
'', 1, array(
'morecss' =>
'marginleftonly'));
798 $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'));
800 $url =
'./card.php?action=create';
801 if (!empty($socid)) {
802 $url .=
'&socid='.$socid;
805 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewAccountingMvt'),
'',
'fa fa-plus-circle paddingleft', $url,
'', $user->hasRight(
'accounting',
'mouvements',
'creer'));
808print_barre_liste($title_page, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'title_accountancy', 0, $newcardbutton,
'', $limit, 0, 0, 1);
810if ($massaction ==
'preunletteringauto') {
811 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassUnletteringAuto"), $langs->trans(
"ConfirmMassUnletteringQuestion", count($toselect)),
"unletteringauto",
null,
'', 0, 200, 500, 1);
812} elseif ($massaction ==
'preunletteringmanual') {
813 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassUnletteringManual"), $langs->trans(
"ConfirmMassUnletteringQuestion", count($toselect)),
"unletteringmanual",
null,
'', 0, 200, 500, 1);
814} elseif ($massaction ==
'predeletebookkeepingwriting') {
815 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDeleteBookkeepingWriting"), $langs->trans(
"ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)),
"deletebookkeepingwriting",
null,
'', 0, 200, 500, 1);
822include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
824$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
825$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
826if ($massactionbutton && $contextpage !=
'poslist') {
827 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
831$moreforfilter .=
'<div class="divsearchfield">';
832$moreforfilter .= $langs->trans(
'AccountingCategory').
': ';
833$moreforfilter .=
'<div class="nowrap inline-block">';
834$moreforfilter .= $formaccounting->select_accounting_category($search_account_category,
'search_account_category', 1, 0, 0, 0);
835$moreforfilter .=
'</div>';
836$moreforfilter .=
'</div>';
838$parameters = array();
839$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
840if (empty($reshook)) {
841 $moreforfilter .= $hookmanager->resPrint;
843 $moreforfilter = $hookmanager->resPrint;
846print
'<div class="liste_titre liste_titre_bydiv centpercent">';
850print
'<div class="div-table-responsive">';
851print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">';
854print
'<tr class="liste_titre_filter">';
857 print
'<td class="liste_titre center">';
858 $searchpicto = $form->showFilterButtons(
'left');
863if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
864 print
'<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).
'"></td>';
867if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
868 print
'<td class="liste_titre center">';
869 print $formaccounting->multi_select_journal($search_ledger_code,
'search_ledger_code', 0, 1, 1, 1,
'small maxwidth75');
873if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
874 print
'<td class="liste_titre center">';
875 print
'<div class="nowrapfordate">';
876 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
878 print
'<div class="nowrapfordate">';
879 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
884if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
885 print
'<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="'.dol_escape_htmltag($search_doc_ref).
'"></td>';
888if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
889 print
'<td class="liste_titre">';
890 print
'<div class="nowrap">';
891 print $formaccounting->select_account($search_accountancy_code_start,
'search_accountancy_code_start', $langs->trans(
'From'), array(), 1, 1,
'maxwidth150',
'account');
893 print
'<div class="nowrap">';
894 print $formaccounting->select_account($search_accountancy_code_end,
'search_accountancy_code_end', $langs->trans(
'to'), array(), 1, 1,
'maxwidth150',
'account');
899if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
900 print
'<td class="liste_titre">';
904 print
'<div class="nowrap">';
906 print $formaccounting->select_auxaccount($search_accountancy_aux_code_start,
'search_accountancy_aux_code_start', $langs->trans(
'From'),
'maxwidth250',
'subledgeraccount');
908 print
'<div class="nowrap">';
909 print $formaccounting->select_auxaccount($search_accountancy_aux_code_end,
'search_accountancy_aux_code_end', $langs->trans(
'to'),
'maxwidth250',
'subledgeraccount');
912 print
'<input type="text" class="maxwidth75" name="search_accountancy_aux_code" value="'.dol_escape_htmltag($search_accountancy_aux_code).
'">';
917if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
918 print
'<td class="liste_titre">';
919 print
'<input type="text" size="7" class="flat" name="search_mvt_label" value="'.dol_escape_htmltag($search_mvt_label).
'"/>';
923if (!empty($arrayfields[
't.debit'][
'checked'])) {
924 print
'<td class="liste_titre right">';
925 print
'<input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).
'">';
929if (!empty($arrayfields[
't.credit'][
'checked'])) {
930 print
'<td class="liste_titre right">';
931 print
'<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).
'">';
935if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
936 print
'<td class="liste_titre center">';
937 print
'<input type="text" size="3" class="flat" name="search_lettering_code" value="'.dol_escape_htmltag($search_lettering_code).
'"/>';
938 print
'<br><span class="nowrap"><input type="checkbox" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled ==
'notreconciled' ?
' checked' :
'').
'>'.$langs->trans(
"NotReconciled").
'</span>';
943$parameters = array(
'arrayfields' => $arrayfields);
944$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
945print $hookmanager->resPrint;
948if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
949 print
'<td class="liste_titre center">';
950 print
'<div class="nowrapfordate">';
951 print $form->selectDate($search_date_creation_start,
'search_date_creation_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
953 print
'<div class="nowrapfordate">';
954 print $form->selectDate($search_date_creation_end,
'search_date_creation_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
959if (!empty($arrayfields[
't.tms'][
'checked'])) {
960 print
'<td class="liste_titre center">';
961 print
'<div class="nowrapfordate">';
962 print $form->selectDate($search_date_modification_start,
'search_date_modification_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
964 print
'<div class="nowrapfordate">';
965 print $form->selectDate($search_date_modification_end,
'search_date_modification_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
970if (!empty($arrayfields[
't.date_export'][
'checked'])) {
971 print
'<td class="liste_titre center">';
972 print
'<div class="nowrapfordate">';
973 print $form->selectDate($search_date_export_start,
'search_date_export_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
975 print
'<div class="nowrapfordate">';
976 print $form->selectDate($search_date_export_end,
'search_date_export_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
981if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
982 print
'<td class="liste_titre center">';
983 print
'<div class="nowrapfordate">';
984 print $form->selectDate($search_date_validation_start,
'search_date_validation_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
986 print
'<div class="nowrapfordate">';
987 print $form->selectDate($search_date_validation_end,
'search_date_validation_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
991if (!empty($arrayfields[
't.import_key'][
'checked'])) {
992 print
'<td class="liste_titre center">';
993 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
998 print
'<td class="liste_titre center">';
999 $searchpicto = $form->showFilterButtons();
1005print
'<tr class="liste_titre">';
1007 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch actioncolumn ');
1009if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
1010 print_liste_field_titre($arrayfields[
't.piece_num'][
'label'], $_SERVER[
'PHP_SELF'],
"t.piece_num",
"", $param,
"", $sortfield, $sortorder);
1012if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
1013 print_liste_field_titre($arrayfields[
't.code_journal'][
'label'], $_SERVER[
'PHP_SELF'],
"t.code_journal",
"", $param,
'', $sortfield, $sortorder,
'center ');
1015if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1016 print_liste_field_titre($arrayfields[
't.doc_date'][
'label'], $_SERVER[
'PHP_SELF'],
"t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1018if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1019 print_liste_field_titre($arrayfields[
't.doc_ref'][
'label'], $_SERVER[
'PHP_SELF'],
"t.doc_ref",
"", $param,
"", $sortfield, $sortorder);
1021if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
1022 print_liste_field_titre($arrayfields[
't.numero_compte'][
'label'], $_SERVER[
'PHP_SELF'],
"t.numero_compte",
"", $param,
"", $sortfield, $sortorder);
1024if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
1025 print_liste_field_titre($arrayfields[
't.subledger_account'][
'label'], $_SERVER[
'PHP_SELF'],
"t.subledger_account",
"", $param,
"", $sortfield, $sortorder);
1027if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1028 print_liste_field_titre($arrayfields[
't.label_operation'][
'label'], $_SERVER[
'PHP_SELF'],
"t.label_operation",
"", $param,
"", $sortfield, $sortorder);
1030if (!empty($arrayfields[
't.debit'][
'checked'])) {
1031 print_liste_field_titre($arrayfields[
't.debit'][
'label'], $_SERVER[
'PHP_SELF'],
"t.debit",
"", $param,
'', $sortfield, $sortorder,
'right ');
1033if (!empty($arrayfields[
't.credit'][
'checked'])) {
1034 print_liste_field_titre($arrayfields[
't.credit'][
'label'], $_SERVER[
'PHP_SELF'],
"t.credit",
"", $param,
'', $sortfield, $sortorder,
'right ');
1036if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1037 print_liste_field_titre($arrayfields[
't.lettering_code'][
'label'], $_SERVER[
'PHP_SELF'],
"t.lettering_code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1040$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1041$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1042print $hookmanager->resPrint;
1043if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1044 print_liste_field_titre($arrayfields[
't.date_creation'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center ');
1046if (!empty($arrayfields[
't.tms'][
'checked'])) {
1047 print_liste_field_titre($arrayfields[
't.tms'][
'label'], $_SERVER[
'PHP_SELF'],
"t.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
1049if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1050 print_liste_field_titre($arrayfields[
't.date_export'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_export,t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1052if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1053 print_liste_field_titre($arrayfields[
't.date_validated'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_validated,t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1055if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1056 print_liste_field_titre($arrayfields[
't.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"t.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1059 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1069$totalarray = array();
1070$totalarray[
'nbfield'] = 0;
1071$totalarray[
'val'] = array();
1072$totalarray[
'val'][
'totaldebit'] = 0;
1073$totalarray[
'val'][
'totalcredit'] = 0;
1075while ($i < min($num, $limit)) {
1076 $obj = $db->fetch_object($resql);
1081 $line->id = $obj->rowid;
1082 $line->doc_date = $db->jdate($obj->doc_date);
1083 $line->doc_type = $obj->doc_type;
1084 $line->doc_ref = $obj->doc_ref;
1085 $line->fk_doc = $obj->fk_doc;
1086 $line->fk_docdet = $obj->fk_docdet;
1087 $line->thirdparty_code = $obj->thirdparty_code;
1088 $line->subledger_account = $obj->subledger_account;
1089 $line->subledger_label = $obj->subledger_label;
1090 $line->numero_compte = $obj->numero_compte;
1091 $line->label_compte = $obj->label_compte;
1092 $line->label_operation = $obj->label_operation;
1093 $line->debit = $obj->debit;
1094 $line->credit = $obj->credit;
1095 $line->montant = $obj->amount;
1096 $line->amount = $obj->amount;
1097 $line->sens = $obj->sens;
1098 $line->lettering_code = $obj->lettering_code;
1099 $line->fk_user_author = $obj->fk_user_author;
1100 $line->import_key = $obj->import_key;
1101 $line->code_journal = $obj->code_journal;
1102 $line->journal_label = $obj->journal_label;
1103 $line->piece_num = $obj->piece_num;
1104 $line->date_creation = $db->jdate($obj->date_creation);
1105 $line->date_modification = $db->jdate($obj->date_modification);
1106 $line->date_export = $db->jdate($obj->date_export);
1107 $line->date_validation = $db->jdate($obj->date_validation);
1109 print
'<tr class="oddeven">';
1112 print
'<td class="nowraponall center">';
1113 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
1115 if (in_array($line->id, $arrayofselected)) {
1118 print
'<input id="cb'.$line->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.
'"'.($selected ?
' checked="checked"' :
'').
' />';
1122 $totalarray[
'nbfield']++;
1127 if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
1130 $object->piece_num = $line->piece_num;
1131 print
$object->getNomUrl(1,
'', 0,
'', 1);
1134 $totalarray[
'nbfield']++;
1139 if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
1140 if (empty($conf->cache[
'accountingjournal'][$line->code_journal])) {
1142 $accountingjournal->fetch(0, $line->code_journal);
1143 $conf->cache[
'accountingjournal'][$line->code_journal] = $accountingjournal;
1145 $accountingjournal = $conf->cache[
'accountingjournal'][$line->code_journal];
1148 $journaltoshow = (($accountingjournal->id > 0) ? $accountingjournal->getNomUrl(0, 0, 0,
'', 0) : $line->code_journal);
1149 print
'<td class="center tdoverflowmax150">'.$journaltoshow.
'</td>';
1151 $totalarray[
'nbfield']++;
1156 if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1157 print
'<td class="center">'.dol_print_date($line->doc_date,
'day').
'</td>';
1159 $totalarray[
'nbfield']++;
1165 if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1166 if ($line->doc_type ==
'customer_invoice') {
1167 $langs->loadLangs(array(
'bills'));
1169 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
1170 $objectstatic =
new Facture($db);
1171 $objectstatic->fetch($line->fk_doc);
1176 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$objectstatic->id;
1177 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1178 } elseif ($line->doc_type ==
'supplier_invoice') {
1179 $langs->loadLangs(array(
'bills'));
1181 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
1183 $objectstatic->fetch($line->fk_doc);
1185 $modulepart =
'invoice_supplier';
1190 $filedir =
getMultidirOutput($objectstatic,
'', 1).dol_sanitizeFileName($line->doc_ref);
1191 $subdir =
getMultidirOutput($objectstatic,
'', 1,
'outputrel').dol_sanitizeFileName($line->doc_ref);
1194 if ($objectstatic->id > 0) {
1195 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
1197 $documentlink = $line->doc_ref;
1199 } elseif ($line->doc_type ==
'expense_report') {
1200 $langs->loadLangs(array(
'trips'));
1202 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
1204 $objectstatic->fetch($line->fk_doc);
1209 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$objectstatic->id;
1210 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1211 } elseif ($line->doc_type ==
'bank') {
1212 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
1214 $objectstatic->fetch($line->fk_doc);
1220 $labeltoshowalt =
'';
1221 $classforlabel =
'';
1222 if ($line->doc_type ==
'customer_invoice' || $line->doc_type ==
'supplier_invoice' || $line->doc_type ==
'expense_report') {
1223 $labeltoshow .= $objectstatic->getNomUrl(1,
'', 0, 0,
'', 0, -1, 1);
1224 $labeltoshow .= $documentlink;
1225 $labeltoshowalt .= $objectstatic->ref;
1226 } elseif ($line->doc_type ==
'bank') {
1227 $labeltoshow .= $objectstatic->getNomUrl(1);
1228 $labeltoshowalt .= $objectstatic->ref;
1229 $bank_ref = strstr($line->doc_ref,
'-');
1230 $labeltoshow .=
" " . $bank_ref;
1231 $labeltoshowalt .=
" " . $bank_ref;
1233 $labeltoshow .= $line->doc_ref;
1234 $labeltoshowalt .= $line->doc_ref;
1235 $classforlabel =
'tdoverflowmax250';
1238 print
'<td class="nowraponall'.($classforlabel ?
' '.$classforlabel :
'').
'" title="'.
dol_escape_htmltag($labeltoshowalt).
'">';
1242 $totalarray[
'nbfield']++;
1247 if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
1248 print
'<td>'.length_accountg($line->numero_compte).
'</td>';
1250 $totalarray[
'nbfield']++;
1255 if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
1256 print
'<td>'.length_accounta($line->subledger_account).
'</td>';
1258 $totalarray[
'nbfield']++;
1263 if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1264 print
'<td class="small tdoverflowmax200" title="'.dol_escape_htmltag($line->label_operation).
'">'.
dol_escape_htmltag($line->label_operation).
'</td>';
1266 $totalarray[
'nbfield']++;
1271 if (!empty($arrayfields[
't.debit'][
'checked'])) {
1272 print
'<td class="right nowraponall amount">'.($line->debit != 0 ?
price($line->debit) :
'').
'</td>';
1274 $totalarray[
'nbfield']++;
1277 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totaldebit';
1279 $totalarray[
'val'][
'totaldebit'] += $line->debit;
1283 if (!empty($arrayfields[
't.credit'][
'checked'])) {
1284 print
'<td class="right nowraponall amount">'.($line->credit != 0 ?
price($line->credit) :
'').
'</td>';
1286 $totalarray[
'nbfield']++;
1289 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalcredit';
1291 $totalarray[
'val'][
'totalcredit'] += $line->credit;
1295 if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1296 print
'<td class="center">'.$line->lettering_code.
'</td>';
1298 $totalarray[
'nbfield']++;
1303 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1304 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1305 print $hookmanager->resPrint;
1308 if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1309 print
'<td class="center">'.dol_print_date($line->date_creation,
'dayhour',
'tzuserrel').
'</td>';
1311 $totalarray[
'nbfield']++;
1316 if (!empty($arrayfields[
't.tms'][
'checked'])) {
1317 print
'<td class="center">'.dol_print_date($line->date_modification,
'dayhour',
'tzuserrel').
'</td>';
1319 $totalarray[
'nbfield']++;
1324 if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1325 print
'<td class="center nowraponall">'.dol_print_date($line->date_export,
'dayhour',
'tzuserrel').
'</td>';
1327 $totalarray[
'nbfield']++;
1332 if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1333 print
'<td class="center nowraponall">'.dol_print_date($line->date_validation,
'dayhour',
'tzuserrel').
'</td>';
1335 $totalarray[
'nbfield']++;
1339 if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1340 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($obj->import_key).
'">'.
dol_escape_htmltag($obj->import_key).
"</td>\n";
1342 $totalarray[
'nbfield']++;
1348 print
'<td class="nowraponall center">';
1349 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
1351 if (in_array($line->id, $arrayofselected)) {
1354 print
'<input id="cb'.$line->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.
'"'.($selected ?
' checked="checked"' :
'').
' />';
1358 $totalarray[
'nbfield']++;
1369include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1374 foreach ($arrayfields as $key => $val) {
1375 if (!empty($val[
'checked'])) {
1379 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1382$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1383$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1384print $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()
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...
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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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,...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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 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...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.