32require
'../../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountancyexport.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/lettering.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeeping.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
52$langs->loadLangs(array(
"accountancy",
"compta"));
54$action =
GETPOST(
'action',
'aZ09');
55$massaction =
GETPOST(
'massaction',
'alpha');
56$confirm =
GETPOST(
'confirm',
'alpha');
57$toselect =
GETPOST(
'toselect',
'array:int');
58$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'bookkeepinglist';
61$search_mvt_num =
GETPOST(
'search_mvt_num',
'alpha');
62$search_doc_type =
GETPOST(
"search_doc_type",
'alpha');
63$search_doc_ref =
GETPOST(
"search_doc_ref",
'alpha');
64$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
65$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
66$search_date_startday =
GETPOSTINT(
'search_date_startday');
67$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
68$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
69$search_date_endday =
GETPOSTINT(
'search_date_endday');
70$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
71$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
73$search_date_creation_startyear =
GETPOSTINT(
'search_date_creation_startyear');
74$search_date_creation_startmonth =
GETPOSTINT(
'search_date_creation_startmonth');
75$search_date_creation_startday =
GETPOSTINT(
'search_date_creation_startday');
76$search_date_creation_endyear =
GETPOSTINT(
'search_date_creation_endyear');
77$search_date_creation_endmonth =
GETPOSTINT(
'search_date_creation_endmonth');
78$search_date_creation_endday =
GETPOSTINT(
'search_date_creation_endday');
79$search_date_creation_start =
dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear);
80$search_date_creation_end =
dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear);
81$search_date_modification_startyear =
GETPOSTINT(
'search_date_modification_startyear');
82$search_date_modification_startmonth =
GETPOSTINT(
'search_date_modification_startmonth');
83$search_date_modification_startday =
GETPOSTINT(
'search_date_modification_startday');
84$search_date_modification_endyear =
GETPOSTINT(
'search_date_modification_endyear');
85$search_date_modification_endmonth =
GETPOSTINT(
'search_date_modification_endmonth');
86$search_date_modification_endday =
GETPOSTINT(
'search_date_modification_endday');
87$search_date_modification_start =
dol_mktime(0, 0, 0, $search_date_modification_startmonth, $search_date_modification_startday, $search_date_modification_startyear);
88$search_date_modification_end =
dol_mktime(23, 59, 59, $search_date_modification_endmonth, $search_date_modification_endday, $search_date_modification_endyear);
89$search_date_export_startyear =
GETPOSTINT(
'search_date_export_startyear');
90$search_date_export_startmonth =
GETPOSTINT(
'search_date_export_startmonth');
91$search_date_export_startday =
GETPOSTINT(
'search_date_export_startday');
92$search_date_export_endyear =
GETPOSTINT(
'search_date_export_endyear');
93$search_date_export_endmonth =
GETPOSTINT(
'search_date_export_endmonth');
94$search_date_export_endday =
GETPOSTINT(
'search_date_export_endday');
95$search_date_export_start =
dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
96$search_date_export_end =
dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
97$search_date_validation_startyear =
GETPOSTINT(
'search_date_validation_startyear');
98$search_date_validation_startmonth =
GETPOSTINT(
'search_date_validation_startmonth');
99$search_date_validation_startday =
GETPOSTINT(
'search_date_validation_startday');
100$search_date_validation_endyear =
GETPOSTINT(
'search_date_validation_endyear');
101$search_date_validation_endmonth =
GETPOSTINT(
'search_date_validation_endmonth');
102$search_date_validation_endday =
GETPOSTINT(
'search_date_validation_endday');
103$search_date_validation_start =
dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear);
104$search_date_validation_end =
dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
105$search_import_key =
GETPOST(
"search_import_key",
'alpha');
109 $action =
'delbookkeepingyear';
111if (
GETPOST(
"button_export_file_x") ||
GETPOST(
"button_export_file.x") ||
GETPOST(
"button_export_file")) {
112 $action =
'export_file';
115$search_account_category =
GETPOSTINT(
'search_account_category');
117$search_accountancy_code =
GETPOST(
"search_accountancy_code",
'alpha');
118$search_accountancy_code_start =
GETPOST(
'search_accountancy_code_start',
'alpha');
119if ($search_accountancy_code_start == - 1) {
120 $search_accountancy_code_start =
'';
122$search_accountancy_code_end =
GETPOST(
'search_accountancy_code_end',
'alpha');
123if ($search_accountancy_code_end == - 1) {
124 $search_accountancy_code_end =
'';
127$search_accountancy_aux_code =
GETPOST(
"search_accountancy_aux_code",
'alpha');
128$search_accountancy_aux_code_start =
GETPOST(
'search_accountancy_aux_code_start',
'alpha');
129if ($search_accountancy_aux_code_start == - 1) {
130 $search_accountancy_aux_code_start =
'';
132$search_accountancy_aux_code_end =
GETPOST(
'search_accountancy_aux_code_end',
'alpha');
133if ($search_accountancy_aux_code_end == - 1) {
134 $search_accountancy_aux_code_end =
'';
136$search_mvt_label =
GETPOST(
'search_mvt_label',
'alpha');
137$search_direction =
GETPOST(
'search_direction',
'alpha');
138$search_debit =
GETPOST(
'search_debit',
'alpha');
139$search_credit =
GETPOST(
'search_credit',
'alpha');
140$search_ledger_code =
GETPOST(
'search_ledger_code',
'array');
141$search_lettering_code =
GETPOST(
'search_lettering_code',
'alpha');
142$search_not_reconciled =
GETPOST(
'search_not_reconciled',
'alpha');
146$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
147$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
148$optioncss =
GETPOST(
'optioncss',
'alpha');
150if (empty($page) || $page < 0) {
153$offset = $limit * $page;
154$pageprev = $page - 1;
155$pagenext = $page + 1;
156if ($sortorder ==
"") {
159if ($sortfield ==
"") {
160 $sortfield =
"t.piece_num,t.rowid";
165$hookmanager->initHooks(array(
'bookkeepingexport'));
168$form =
new Form($db);
170if (!in_array($action, array(
'export_file',
'delmouv',
'delmouvconfirm')) && !GETPOSTISSET(
'begin') && !GETPOSTISSET(
'formfilteraction') &&
GETPOSTINT(
'page') == 0 && !
GETPOSTINT(
'noreset') && $user->hasRight(
'accounting',
'mouvements',
'export')) {
171 if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET(
'restore_lastsearch_values') && !
GETPOST(
'search_accountancy_code_start')) {
172 $sql =
"SELECT date_start, date_end";
173 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_fiscalyear ";
175 $sql .=
" WHERE rowid = " .
getDolGlobalInt(
'ACCOUNTANCY_FISCALYEAR_DEFAULT');
177 $sql .=
" WHERE date_start < '" . $db->idate(
dol_now()) .
"' and date_end > '" . $db->idate(
dol_now()) .
"'";
179 $sql .= $db->plimit(1);
180 $res = $db->query($sql);
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' =>
'1'),
219 't.date_validated' => array(
'label' => $langs->trans(
"DateValidationAndLock"),
'checked' =>
'-1',
'enabled' => (
string) (
int) !
getDolGlobalString(
"ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
220 't.import_key' => array(
'label' => $langs->trans(
"ImportId"),
'checked' =>
'0',
'position' => 1100),
224 unset($arrayfields[
't.lettering_code']);
228$listofformat = $accountancyexport->getType();
230if (empty($listofformat[$formatexportset])) {
231 $formatexportset = 1;
239if ($user->socid > 0) {
242if (!$user->hasRight(
'accounting',
'mouvements',
'lire')) {
247$permissiontoread = $user->hasRight(
'accounting',
'mouvements',
'lire');
248$permissiontoadd = $user->hasRight(
'accounting',
'mouvements',
'creer');
249$permissiontodelete = $user->hasRight(
'accounting',
'mouvements',
'supprimer');
250$permissiontoexport = $user->hasRight(
'accounting',
'mouvements',
'export');
259if (
GETPOST(
'cancel',
'alpha')) {
263if (!
GETPOST(
'confirmmassaction',
'alpha')) {
267$parameters = array(
'socid' => $socid);
268$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
273if (empty($reshook)) {
274 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
276 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
277 $search_mvt_num =
'';
278 $search_doc_type =
'';
279 $search_doc_ref =
'';
280 $search_doc_date =
'';
281 $search_account_category =
'';
282 $search_accountancy_code =
'';
283 $search_accountancy_code_start =
'';
284 $search_accountancy_code_end =
'';
285 $search_accountancy_aux_code =
'';
286 $search_accountancy_aux_code_start =
'';
287 $search_accountancy_aux_code_end =
'';
288 $search_mvt_label =
'';
289 $search_direction =
'';
290 $search_ledger_code = array();
291 $search_date_startyear =
'';
292 $search_date_startmonth =
'';
293 $search_date_startday =
'';
294 $search_date_endyear =
'';
295 $search_date_endmonth =
'';
296 $search_date_endday =
'';
297 $search_date_start =
'';
298 $search_date_end =
'';
299 $search_date_creation_startyear =
'';
300 $search_date_creation_startmonth =
'';
301 $search_date_creation_startday =
'';
302 $search_date_creation_endyear =
'';
303 $search_date_creation_endmonth =
'';
304 $search_date_creation_endday =
'';
305 $search_date_creation_start =
'';
306 $search_date_creation_end =
'';
307 $search_date_modification_startyear =
'';
308 $search_date_modification_startmonth =
'';
309 $search_date_modification_startday =
'';
310 $search_date_modification_endyear =
'';
311 $search_date_modification_endmonth =
'';
312 $search_date_modification_endday =
'';
313 $search_date_modification_start =
'';
314 $search_date_modification_end =
'';
315 $search_date_export_startyear =
'';
316 $search_date_export_startmonth =
'';
317 $search_date_export_startday =
'';
318 $search_date_export_endyear =
'';
319 $search_date_export_endmonth =
'';
320 $search_date_export_endday =
'';
321 $search_date_export_start =
'';
322 $search_date_export_end =
'';
323 $search_date_validation_startyear =
'';
324 $search_date_validation_startmonth =
'';
325 $search_date_validation_startday =
'';
326 $search_date_validation_endyear =
'';
327 $search_date_validation_endmonth =
'';
328 $search_date_validation_endday =
'';
329 $search_date_validation_start =
'';
330 $search_date_validation_end =
'';
333 $search_lettering_code =
'';
334 $search_not_reconciled =
'';
335 $search_import_key =
'';
340 if (!empty($search_date_start)) {
341 $filter[
't.doc_date>='] = $search_date_start;
343 $param .=
'&search_date_startmonth='.((int) $tmp[
'mon']).
'&search_date_startday='.((int) $tmp[
'mday']).
'&search_date_startyear='.((int) $tmp[
'year']);
345 if (!empty($search_date_end)) {
346 $filter[
't.doc_date<='] = $search_date_end;
348 $param .=
'&search_date_endmonth='.((int) $tmp[
'mon']).
'&search_date_endday='.((int) $tmp[
'mday']).
'&search_date_endyear='.((int) $tmp[
'year']);
350 if (!empty($search_doc_date)) {
351 $filter[
't.doc_date'] = $search_doc_date;
353 $param .=
'&doc_datemonth='.((int) $tmp[
'mon']).
'&doc_dateday='.((int) $tmp[
'mday']).
'&doc_dateyear='.((int) $tmp[
'year']);
355 if (!empty($search_doc_type)) {
356 $filter[
't.doc_type'] = $search_doc_type;
357 $param .=
'&search_doc_type='.urlencode($search_doc_type);
359 if (!empty($search_doc_ref)) {
360 $filter[
't.doc_ref'] = $search_doc_ref;
361 $param .=
'&search_doc_ref='.urlencode($search_doc_ref);
363 if ($search_account_category !=
'-1' && !empty($search_account_category)) {
364 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountancycategory.class.php';
367 $listofaccountsforgroup = $accountingcategory->getCptsCat(0,
'fk_accounting_category = '.((
int) $search_account_category));
368 $listofaccountsforgroup2 = array();
369 if (is_array($listofaccountsforgroup)) {
370 foreach ($listofaccountsforgroup as $tmpval) {
371 $listofaccountsforgroup2[] =
"'".$db->escape((
string) $tmpval[
'account_number']).
"'";
374 $filter[
't.search_accounting_code_in'] = implode(
',', $listofaccountsforgroup2);
375 $param .=
'&search_account_category='.urlencode((
string) ($search_account_category));
377 if (!empty($search_accountancy_code)) {
378 $filter[
't.numero_compte'] = $search_accountancy_code;
379 $param .=
'&search_accountancy_code='.urlencode($search_accountancy_code);
381 if (!empty($search_accountancy_code_start)) {
382 $filter[
't.numero_compte>='] = $search_accountancy_code_start;
383 $param .=
'&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
385 if (!empty($search_accountancy_code_end)) {
386 $filter[
't.numero_compte<='] = $search_accountancy_code_end;
387 $param .=
'&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
389 if (!empty($search_accountancy_aux_code)) {
390 $filter[
't.subledger_account'] = $search_accountancy_aux_code;
391 $param .=
'&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
393 if (!empty($search_accountancy_aux_code_start)) {
394 $filter[
't.subledger_account>='] = $search_accountancy_aux_code_start;
395 $param .=
'&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
397 if (!empty($search_accountancy_aux_code_end)) {
398 $filter[
't.subledger_account<='] = $search_accountancy_aux_code_end;
399 $param .=
'&search_accountancy_aux_code_end='.urlencode($search_accountancy_aux_code_end);
401 if (!empty($search_mvt_label)) {
402 $filter[
't.label_operation'] = $search_mvt_label;
403 $param .=
'&search_mvt_label='.urlencode($search_mvt_label);
405 if (!empty($search_direction)) {
406 $filter[
't.sens'] = $search_direction;
407 $param .=
'&search_direction='.urlencode($search_direction);
409 if (!empty($search_ledger_code)) {
410 $filter[
't.code_journal'] = $search_ledger_code;
411 foreach ($search_ledger_code as $code) {
412 $param .=
'&search_ledger_code[]='.urlencode($code);
415 if (!empty($search_mvt_num)) {
416 $filter[
't.piece_num'] = $search_mvt_num;
417 $param .=
'&search_mvt_num='.urlencode((
string) ($search_mvt_num));
419 if (!empty($search_date_creation_start)) {
420 $filter[
't.date_creation>='] = $search_date_creation_start;
422 $param .=
'&search_date_creation_startmonth='.((int) $tmp[
'mon']).
'&search_date_creation_startday='.((int) $tmp[
'mday']).
'&search_date_creation_startyear='.((int) $tmp[
'year']);
424 if (!empty($search_date_creation_end)) {
425 $filter[
't.date_creation<='] = $search_date_creation_end;
427 $param .=
'&search_date_creation_endmonth='.((int) $tmp[
'mon']).
'&search_date_creation_endday='.((int) $tmp[
'mday']).
'&search_date_creation_endyear='.((int) $tmp[
'year']);
429 if (!empty($search_date_modification_start)) {
430 $filter[
't.tms>='] = $search_date_modification_start;
431 $tmp =
dol_getdate($search_date_modification_start);
432 $param .=
'&search_date_modification_startmonth='.((int) $tmp[
'mon']).
'&search_date_modification_startday='.((int) $tmp[
'mday']).
'&search_date_modification_startyear='.((int) $tmp[
'year']);
434 if (!empty($search_date_modification_end)) {
435 $filter[
't.tms<='] = $search_date_modification_end;
437 $param .=
'&search_date_modification_endmonth='.((int) $tmp[
'mon']).
'&search_date_modification_endday='.((int) $tmp[
'mday']).
'&search_date_modification_endyear='.((int) $tmp[
'year']);
439 if (!empty($search_date_export_start)) {
440 $filter[
't.date_export>='] = $search_date_export_start;
442 $param .=
'&search_date_export_startmonth='.((int) $tmp[
'mon']).
'&search_date_export_startday='.((int) $tmp[
'mday']).
'&search_date_export_startyear='.((int) $tmp[
'year']);
444 if (!empty($search_date_export_end)) {
445 $filter[
't.date_export<='] = $search_date_export_end;
447 $param .=
'&search_date_export_endmonth='.((int) $tmp[
'mon']).
'&search_date_export_endday='.((int) $tmp[
'mday']).
'&search_date_export_endyear='.((int) $tmp[
'year']);
449 if (!empty($search_date_validation_start)) {
450 $filter[
't.date_validated>='] = $search_date_validation_start;
452 $param .=
'&search_date_validation_startmonth='.((int) $tmp[
'mon']).
'&search_date_validation_startday='.((int) $tmp[
'mday']).
'&search_date_validation_startyear='.((int) $tmp[
'year']);
454 if (!empty($search_date_validation_end)) {
455 $filter[
't.date_validated<='] = $search_date_validation_end;
457 $param .=
'&search_date_validation_endmonth='.((int) $tmp[
'mon']).
'&search_date_validation_endday='.((int) $tmp[
'mday']).
'&search_date_validation_endyear='.((int) $tmp[
'year']);
459 if (!empty($search_debit)) {
460 $filter[
't.debit'] = $search_debit;
461 $param .=
'&search_debit='.urlencode($search_debit);
463 if (!empty($search_credit)) {
464 $filter[
't.credit'] = $search_credit;
465 $param .=
'&search_credit='.urlencode($search_credit);
467 if (!empty($search_lettering_code)) {
468 $filter[
't.lettering_code'] = $search_lettering_code;
469 $param .=
'&search_lettering_code='.urlencode($search_lettering_code);
471 if (!empty($search_not_reconciled)) {
472 $filter[
't.reconciled_option'] = $search_not_reconciled;
473 $param .=
'&search_not_reconciled='.urlencode($search_not_reconciled);
475 if (!empty($search_import_key)) {
476 $filter[
't.import_key'] = $search_import_key;
477 $param .=
'&search_import_key='.urlencode($search_import_key);
480 if ($action ==
'setreexport' && $user->hasRight(
'accounting',
'mouvements',
'export')) {
482 if (!
dolibarr_set_const($db,
"ACCOUNTING_REEXPORT", $setreexport,
'yesno', 0,
'', $conf->entity)) {
488 setEventMessages($langs->trans(
"ExportOfPiecesAlreadyExportedIsDisable"),
null,
'mesgs');
490 setEventMessages($langs->trans(
"ExportOfPiecesAlreadyExportedIsEnable"),
null,
'warnings');
498 $objectclass =
'Bookkeeping';
499 $objectlabel =
'Bookkeeping';
500 $uploaddir = $conf->societe->dir_output;
501 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
510$sql .=
" t.doc_date,";
511$sql .=
" t.doc_type,";
512$sql .=
" t.doc_ref,";
514$sql .=
" t.fk_docdet,";
515$sql .=
" t.thirdparty_code,";
516$sql .=
" t.subledger_account,";
517$sql .=
" t.subledger_label,";
518$sql .=
" t.numero_compte,";
519$sql .=
" t.label_compte,";
520$sql .=
" t.label_operation,";
523$sql .=
" t.lettering_code,";
524$sql .=
" t.date_lettering,";
525$sql .=
" t.montant as amount,";
527$sql .=
" t.fk_user_author,";
528$sql .=
" t.import_key,";
529$sql .=
" t.code_journal,";
530$sql .=
" t.journal_label,";
531$sql .=
" t.piece_num,";
532$sql .=
" t.date_creation,";
533$sql .=
" t.date_lim_reglement,";
534$sql .=
" t.tms as date_modification,";
535$sql .=
" t.date_export,";
536$sql .=
" t.date_validated as date_validation,";
537$sql .=
" t.import_key";
541$sql .=
' FROM '.MAIN_DB_PREFIX.$object->table_element.
' as t';
544if (count($filter) > 0) {
545 foreach ($filter as $key => $value) {
546 if ($key ==
't.doc_date') {
547 $sqlwhere[] = $db->sanitize($key).
" = '".$db->idate($value).
"'";
548 } elseif ($key ==
't.doc_date>=') {
549 $sqlwhere[] =
"t.doc_date >= '".$db->idate($value).
"'";
550 } elseif ($key ==
't.doc_date<=') {
551 $sqlwhere[] =
"t.doc_date <= '".$db->idate($value).
"'";
552 } elseif ($key ==
't.numero_compte>=') {
553 $sqlwhere[] =
"t.numero_compte >= '".$db->escape($value).
"'";
554 } elseif ($key ==
't.numero_compte<=') {
555 $sqlwhere[] =
"t.numero_compte <= '".$db->escape($value).
"'";
556 } elseif ($key ==
't.subledger_account>=') {
557 $sqlwhere[] =
"t.subledger_account >= '".$db->escape($value).
"'";
558 } elseif ($key ==
't.subledger_account<=') {
559 $sqlwhere[] =
"t.subledger_account <= '".$db->escape($value).
"'";
562 } elseif ($key ==
't.subledger_account' || $key ==
't.numero_compte') {
563 $sqlwhere[] = $db->sanitize($key).
" LIKE '".$db->escape($db->escapeforlike($value)).
"%'";
566 } elseif ($key ==
't.tms>=') {
567 $sqlwhere[] =
"t.tms >= '".$db->idate($value).
"'";
568 } elseif ($key ==
't.tms<=') {
569 $sqlwhere[] =
"t.tms <= '".$db->idate($value).
"'";
570 } elseif ($key ==
't.date_creation>=') {
571 $sqlwhere[] =
"t.date_creation >= '".$db->idate($value).
"'";
572 } elseif ($key ==
't.date_creation<=') {
573 $sqlwhere[] =
"t.date_creation <= '".$db->idate($value).
"'";
574 } elseif ($key ==
't.date_export>=') {
575 $sqlwhere[] =
"t.date_export >= '".$db->idate($value).
"'";
576 } elseif ($key ==
't.date_export<=') {
577 $sqlwhere[] =
"t.date_export <= '".$db->idate($value).
"'";
578 } elseif ($key ==
't.date_validated>=') {
579 $sqlwhere[] =
"t.date_validated >= '".$db->idate($value).
"'";
580 } elseif ($key ==
't.date_validated<=') {
581 $sqlwhere[] =
"t.date_validated <= '".$db->idate($value).
"'";
582 } elseif ($key ==
't.credit' || $key ==
't.debit') {
584 } elseif ($key ==
't.reconciled_option') {
585 $sqlwhere[] =
't.lettering_code IS NULL';
586 } elseif ($key ==
't.code_journal' && !empty($value)) {
587 if (is_array($value)) {
588 $sqlwhere[] =
natural_search(
"t.code_journal", implode(
',', $value), 3, 1);
592 } elseif ($key ==
't.search_accounting_code_in' && !empty($value)) {
593 $sqlwhere[] =
't.numero_compte IN ('.$db->sanitize($value, 1).
')';
599$sql .=
' WHERE t.entity IN ('.getEntity(
'accountancy').
')';
601 $sql .=
" AND t.date_export IS NULL";
603if (count($sqlwhere) > 0) {
604 $sql .=
' AND '.implode(
' AND ', $sqlwhere);
611if ($action ==
'export_fileconfirm' && $user->hasRight(
'accounting',
'mouvements',
'export')) {
616 $nbtotalofrecords = 0;
622 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
623 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
624 $resql = $db->query($sqlforcount);
626 $objforcount = $db->fetch_object($resql);
627 $nbtotalofrecords = $objforcount->nbtotalofrecords;
643 $result =
$object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter,
'AND', (
getDolGlobalString(
'ACCOUNTING_REEXPORT') ? 1 : 0));
650 $notexportlettering =
GETPOST(
'notexportlettering',
'alpha');
653 if (!empty($notexportlettering)) {
654 if (is_array(
$object->lines)) {
655 foreach (
$object->lines as $k => $movement) {
656 unset(
$object->lines[$k]->lettering_code);
657 unset(
$object->lines[$k]->date_lettering);
662 $notifiedexportdate =
GETPOST(
'notifiedexportdate',
'alpha');
663 $notifiedvalidationdate =
GETPOST(
'notifiedvalidationdate',
'alpha');
664 $withAttachment = !empty(trim(
GETPOST(
'notifiedexportfull',
'alphanohtml'))) ? 1 : 0;
668 $result = $accountancyexport->export(
$object->lines, $formatexport, $withAttachment, 1, 1, 1);
673 if (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
674 if (is_array(
$object->lines)) {
675 dol_syslog(
"/accountancy/bookkeeping/list.php Function export_file set movements as exported", LOG_DEBUG);
678 foreach (
$object->lines as $movement) {
683 if (!empty($notifiedexportdate) && empty($movement->date_export)) {
684 $setfields .= ($setfields ?
"," :
"").
" date_export = '".$db->idate($now).
"'";
686 if (!empty($notifiedvalidationdate) && empty($movement->date_validation)) {
687 $setfields .= ($setfields ?
"," :
"").
" date_validated = '".$db->idate($now).
"'";
691 $sql =
" UPDATE ".MAIN_DB_PREFIX.
"accounting_bookkeeping";
692 $sql .=
" SET ".$setfields;
693 $sql .=
" WHERE rowid = ".((int) $movement->id);
695 $result = $db->query($sql);
704 $accountancyexport->errors[] = $langs->trans(
'NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated');
714 $downloadFilePath = $accountancyexport->generatedfiledata[
'downloadFilePath'];
715 $downloadFileMimeType = $accountancyexport->generatedfiledata[
'downloadFileMimeType'];
716 $downloadFileFullName = $accountancyexport->generatedfiledata[
'downloadFileFullName'];
721 header(
'Content-Description: File Transfer');
725 header(
'Content-Disposition: attachment; filename="'.$downloadFileFullName.
'"');
727 header(
'Content-Disposition: inline; filename="'.$downloadFileFullName.
'"');
730 header(
'Cache-Control: Public, must-revalidate');
731 header(
'Pragma: public');
732 header(
'Content-Length: ' .
dol_filesize($downloadFilePath));
739 header(
'Location: '.$_SERVER[
'PHP_SELF']);
752$title_page = $langs->trans(
"Operations").
' - '.$langs->trans(
"ExportAccountancy");
755$nbtotalofrecords =
'';
758 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
759 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
760 $resql = $db->query($sqlforcount);
762 $objforcount = $db->fetch_object($resql);
763 $nbtotalofrecords = $objforcount->nbtotalofrecords;
768 if (($page * $limit) > (
int) $nbtotalofrecords) {
776$sql .= $db->order($sortfield, $sortorder);
778 $sql .= $db->plimit($limit + 1, $offset);
781$resql = $db->query($sql);
787$num = $db->num_rows($resql);
789$arrayofselected = is_array($toselect) ? $toselect : array();
793$help_url =
'EN:Module_Double_Entry_Accounting#Exports|FR:Module_Comptabilité_en_Partie_Double#Exports';
795llxHeader(
'', $title_page, $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy accountancy-consultation page-export');
799if ($action ==
'export_file') {
800 $form_question = array();
802 $form_question[
'formatexport'] = array(
803 'name' =>
'formatexport',
805 'label' => $langs->trans(
'Modelcsv'),
806 'values' => $listofformat,
807 'default' => $formatexportset,
808 'morecss' =>
'minwidth200 maxwidth200'
811 $form_question[
'separator0'] = array(
'name' =>
'separator0',
'type' =>
'separator');
815 $checked =
getDolGlobalString(
'ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING') ?
'true' :
'false';
816 $form_question[
'notexportlettering'] = array(
817 'name' =>
'notexportlettering',
818 'type' =>
'checkbox',
819 'label' => $langs->trans(
'NotExportLettering'),
823 $form_question[
'separator1'] = array(
'name' =>
'separator1',
'type' =>
'separator');
827 $checked = (!isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) ||
getDolGlobalString(
'ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE'));
828 $form_question[
'notifiedexportdate'] = array(
829 'name' =>
'notifiedexportdate',
830 'type' =>
'checkbox',
831 'label' => $langs->trans(
'NotifiedExportDate'),
832 'value' => (
getDolGlobalString(
'ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE') ?
'false' :
'true'),
835 $form_question[
'separator2'] = array(
'name' =>
'separator2',
'type' =>
'separator');
840 $form_question[
'notifiedvalidationdate'] = array(
841 'name' =>
'notifiedvalidationdate',
842 'type' =>
'checkbox',
843 'label' => $langs->trans(
'NotifiedValidationDate', $langs->transnoentitiesnoconv(
"MenuAccountancyClosure")),
847 $form_question[
'separator3'] = array(
'name' =>
'separator3',
'type' =>
'separator');
851 $exportTypesWithDocs = array(
852 AccountancyExport::$EXPORT_TYPE_QUADRATUS,
853 AccountancyExport::$EXPORT_TYPE_FEC,
854 AccountancyExport::$EXPORT_TYPE_FEC2
859 $except[] = $langs->trans(
'Invoice');
861 if (
getDolGlobalInt(
'ACCOUNTING_EXPORT_REMOVE_EXPENSEREPORT_SOURCE_FILE')) {
862 $except[] = $langs->trans(
'ExpenseReport');
864 if (
getDolGlobalInt(
'ACCOUNTING_EXPORT_REMOVE_SUPPLIERINVOICE_SOURCE_FILE')) {
865 $except[] = $langs->trans(
'SupplierInvoice');
868 $form_question[
'notifiedexportfull'] = array(
869 'name' =>
'notifiedexportfull',
870 'type' =>
'checkbox',
871 'label' => $langs->trans(
'NotifiedExportFull').(empty($except) ?
'' :
' <spanc class="opacitymedium">('.$langs->trans(
"except").
' '.implode(
', ', $except).
')</span>'),
875 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?'.$param, $langs->trans(
"ExportFilteredList").
'...', $langs->trans(
'ConfirmExportFile'),
'export_fileconfirm', $form_question,
'', 1, 500, 700);
877 $formconfirm .=
'<script>
878 jQuery(document).ready(function() {
879 const exportTypesWithDocs = ['.implode(
',', $exportTypesWithDocs).
'];
880 const $formatExport = jQuery("#formatexport");
882 function toggleExportFull() {
883 const $checkbox = jQuery("#notifiedexportfull");
884 const show = exportTypesWithDocs.indexOf(parseInt($formatExport.val())) !== -1;
885 $checkbox.closest(".tagtr").toggle(show);
887 $checkbox.prop("checked", false); // remove checked if hidden
891 $formatExport.on("change", toggleExportFull);
901if ($contextpage != $_SERVER[
"PHP_SELF"]) {
902 $param .=
'&contextpage='.urlencode($contextpage);
904if ($limit > 0 && $limit != $conf->liste_limit) {
905 $param .=
'&limit='.urlencode($limit);
909$arrayofmassactions = array();
910$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
912print
'<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
913print
'<input type="hidden" name="token" value="'.newToken().
'">';
914print
'<input type="hidden" name="action" value="list">';
915if ($optioncss !=
'') {
916 print
'<input type="hidden" name="optioncss" value="'.urlencode($optioncss).
'">';
918print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
919print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
920print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
921print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
924 $buttonLabel = $langs->trans(
"ExportFilteredList");
926 $buttonLabel = $langs->trans(
"ExportList");
929$parameters = array(
'param' => $param);
930$reshook = $hookmanager->executeHooks(
'addMoreActionsButtonsList', $parameters, $object, $action);
935$newcardbutton = empty($hookmanager->resPrint) ?
'' : $hookmanager->resPrint;
936if (empty($reshook)) {
939 $newcardbutton .=
'<a class="valignmiddle" href="'.$_SERVER[
'PHP_SELF'].
'?action=setreexport&token='.
newToken().
'&value=1'.($param ?
'&'.$param :
'').
'&sortfield='.urlencode($sortfield).
'&sortorder='.urlencode($sortorder).
'">'.
img_picto($langs->trans(
"ClickToShowAlreadyExportedLines"),
'switch_off',
'class="small size15x valignmiddle"');
940 $newcardbutton .=
'<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans(
"ClickToShowAlreadyExportedLines").
'</span>';
941 $newcardbutton .=
'</a>';
943 $newcardbutton .=
'<a class="valignmiddle" href="'.$_SERVER[
'PHP_SELF'].
'?action=setreexport&token='.
newToken().
'&value=0'.($param ?
'&'.$param :
'').
'&sortfield='.urlencode($sortfield).
'&sortorder='.urlencode($sortorder).
'">'.
img_picto($langs->trans(
"DocsAlreadyExportedAreIncluded"),
'switch_on',
'class="warning size15x valignmiddle"');
944 $newcardbutton .=
'<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans(
"DocsAlreadyExportedAreIncluded").
'</span>';
945 $newcardbutton .=
'</a>';
948 if ($user->hasRight(
'accounting',
'mouvements',
'export')) {
949 $newcardbutton .=
dolGetButtonTitle($buttonLabel, $langs->trans(
"ExportFilteredList"),
'fa fa-file-export paddingleft', $_SERVER[
"PHP_SELF"].
'?action=export_file&token='.
newToken().($param ?
'&'.$param :
'').
'&sortfield='.urlencode($sortfield).
'&sortorder='.urlencode($sortorder),
'', $permissiontoexport);
953print_barre_liste($title_page, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'title_accountancy', 0, $newcardbutton,
'', $limit, 0, 0, 1);
957 print
info_admin($langs->trans(
"WarningDataDisappearsWhenDataIsExported"), 0, 0,
'0',
'hideonsmartphone info');
964include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
966$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
967$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
968if ($massactionbutton && $contextpage !=
'poslist') {
969 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
974if (!empty($search_account_category)) {
975 $moreforfilter .=
'<div class="divsearchfield">';
976 $moreforfilter .= $langs->trans(
'AccountingCategory').
': ';
977 $moreforfilter .=
'<div class="nowrap inline-block">';
978 $moreforfilter .= $formaccounting->select_accounting_category($search_account_category,
'search_account_category', 1, 0, 0, 0);
979 $moreforfilter .=
'</div>';
980 $moreforfilter .=
'</div>';
983$parameters = array();
984$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
985if (empty($reshook)) {
986 $moreforfilter .= $hookmanager->resPrint;
988 $moreforfilter = $hookmanager->resPrint;
992 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
993 print $moreforfilter;
997print
'<div class="div-table-responsive">';
998print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">';
1001print
'<tr class="liste_titre_filter">';
1004 print
'<td class="liste_titre center">';
1005 $searchpicto = $form->showFilterButtons(
'left');
1010if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
1011 print
'<td class="liste_titre"><input type="text" class="width50" name="search_mvt_num" value="'.dol_escape_htmltag($search_mvt_num).
'"></td>';
1014if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
1015 print
'<td class="liste_titre center">';
1016 print $formaccounting->multi_select_journal($search_ledger_code,
'search_ledger_code', 0, 1, 1, 1,
'small maxwidth75');
1020if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1021 print
'<td class="liste_titre center">';
1022 print
'<div class="nowrapfordate">';
1023 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1025 print
'<div class="nowrapfordate">';
1026 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1031if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1032 print
'<td class="liste_titre"><input type="text" name="search_doc_ref" class="width75" value="'.dol_escape_htmltag($search_doc_ref).
'"></td>';
1035if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
1036 print
'<td class="liste_titre">';
1037 print
'<div class="nowrap">';
1038 print $formaccounting->select_account($search_accountancy_code_start,
'search_accountancy_code_start', $langs->trans(
'From'), array(), 1, 1,
'maxwidth150',
'account');
1040 print
'<div class="nowrap">';
1041 print $formaccounting->select_account($search_accountancy_code_end,
'search_accountancy_code_end', $langs->trans(
'to'), array(), 1, 1,
'maxwidth150',
'account');
1046if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
1047 print
'<td class="liste_titre">';
1051 print
'<div class="nowrap">';
1053 print $formaccounting->select_auxaccount($search_accountancy_aux_code_start,
'search_accountancy_aux_code_start', $langs->trans(
'From'),
'maxwidth150',
'subledgeraccount');
1055 print
'<div class="nowrap">';
1056 print $formaccounting->select_auxaccount($search_accountancy_aux_code_end,
'search_accountancy_aux_code_end', $langs->trans(
'to'),
'maxwidth150',
'subledgeraccount');
1059 print
'<input type="text" class="maxwidth75" name="search_accountancy_aux_code" value="'.dol_escape_htmltag($search_accountancy_aux_code).
'">';
1064if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1065 print
'<td class="liste_titre">';
1066 print
'<input type="text" size="7" class="flat" name="search_mvt_label" value="'.dol_escape_htmltag($search_mvt_label).
'"/>';
1070if (!empty($arrayfields[
't.debit'][
'checked'])) {
1071 print
'<td class="liste_titre right">';
1072 print
'<input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).
'">';
1076if (!empty($arrayfields[
't.credit'][
'checked'])) {
1077 print
'<td class="liste_titre right">';
1078 print
'<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).
'">';
1082if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1083 print
'<td class="liste_titre center">';
1084 print
'<input type="text" size="3" class="flat" name="search_lettering_code" value="'.dol_escape_htmltag($search_lettering_code).
'"/>';
1085 print
'<br><span class="nowrap"><input type="checkbox" id="search_not_reconciled" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled ==
'notreconciled' ?
' checked' :
'').
'><label for="search_not_reconciled">'.$langs->trans(
"NotReconciled").
'</label></span>';
1090$parameters = array(
'arrayfields' => $arrayfields);
1091$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1092print $hookmanager->resPrint;
1095if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1096 print
'<td class="liste_titre center">';
1097 print
'<div class="nowrapfordate">';
1098 print $form->selectDate($search_date_creation_start,
'search_date_creation_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1100 print
'<div class="nowrapfordate">';
1101 print $form->selectDate($search_date_creation_end,
'search_date_creation_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1106if (!empty($arrayfields[
't.tms'][
'checked'])) {
1107 print
'<td class="liste_titre center">';
1108 print
'<div class="nowrapfordate">';
1109 print $form->selectDate($search_date_modification_start,
'search_date_modification_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1111 print
'<div class="nowrapfordate">';
1112 print $form->selectDate($search_date_modification_end,
'search_date_modification_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1117if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1118 print
'<td class="liste_titre center">';
1119 print
'<div class="nowrapfordate">';
1120 print $form->selectDate($search_date_export_start,
'search_date_export_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1122 print
'<div class="nowrapfordate">';
1123 print $form->selectDate($search_date_export_end,
'search_date_export_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1128if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1129 print
'<td class="liste_titre center">';
1130 print
'<div class="nowrapfordate">';
1131 print $form->selectDate($search_date_validation_start,
'search_date_validation_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1133 print
'<div class="nowrapfordate">';
1134 print $form->selectDate($search_date_validation_end,
'search_date_validation_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1138if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1139 print
'<td class="liste_titre center">';
1140 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1145 print
'<td class="liste_titre center">';
1146 $searchpicto = $form->showFilterButtons();
1152print
'<tr class="liste_titre">';
1154 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch actioncolumn ');
1156if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
1157 print_liste_field_titre($arrayfields[
't.piece_num'][
'label'], $_SERVER[
'PHP_SELF'],
"t.piece_num",
"", $param,
"", $sortfield, $sortorder);
1159if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
1160 print_liste_field_titre($arrayfields[
't.code_journal'][
'label'], $_SERVER[
'PHP_SELF'],
"t.code_journal",
"", $param,
'', $sortfield, $sortorder,
'center ');
1162if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1163 print_liste_field_titre($arrayfields[
't.doc_date'][
'label'], $_SERVER[
'PHP_SELF'],
"t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1165if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1166 print_liste_field_titre($arrayfields[
't.doc_ref'][
'label'], $_SERVER[
'PHP_SELF'],
"t.doc_ref",
"", $param,
"", $sortfield, $sortorder);
1168if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
1169 print_liste_field_titre($arrayfields[
't.numero_compte'][
'label'], $_SERVER[
'PHP_SELF'],
"t.numero_compte",
"", $param,
"", $sortfield, $sortorder);
1171if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
1172 print_liste_field_titre($arrayfields[
't.subledger_account'][
'label'], $_SERVER[
'PHP_SELF'],
"t.subledger_account",
"", $param,
"", $sortfield, $sortorder);
1174if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1175 print_liste_field_titre($arrayfields[
't.label_operation'][
'label'], $_SERVER[
'PHP_SELF'],
"t.label_operation",
"", $param,
"", $sortfield, $sortorder);
1177if (!empty($arrayfields[
't.debit'][
'checked'])) {
1178 print_liste_field_titre($arrayfields[
't.debit'][
'label'], $_SERVER[
'PHP_SELF'],
"t.debit",
"", $param,
'', $sortfield, $sortorder,
'right ');
1180if (!empty($arrayfields[
't.credit'][
'checked'])) {
1181 print_liste_field_titre($arrayfields[
't.credit'][
'label'], $_SERVER[
'PHP_SELF'],
"t.credit",
"", $param,
'', $sortfield, $sortorder,
'right ');
1183if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1184 print_liste_field_titre($arrayfields[
't.lettering_code'][
'label'], $_SERVER[
'PHP_SELF'],
"t.lettering_code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1187$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1188$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1189print $hookmanager->resPrint;
1190if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1191 print_liste_field_titre($arrayfields[
't.date_creation'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center ');
1193if (!empty($arrayfields[
't.tms'][
'checked'])) {
1194 print_liste_field_titre($arrayfields[
't.tms'][
'label'], $_SERVER[
'PHP_SELF'],
"t.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
1196if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1197 print_liste_field_titre($arrayfields[
't.date_export'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_export,t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1199if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1200 print_liste_field_titre($arrayfields[
't.date_validated'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_validated,t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1202if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1203 print_liste_field_titre($arrayfields[
't.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"t.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1206 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1222while ($i < min($num, $limit)) {
1223 $obj = $db->fetch_object($resql);
1228 $line->id = $obj->rowid;
1229 $line->doc_date = $db->jdate($obj->doc_date);
1230 $line->doc_type = $obj->doc_type;
1231 $line->doc_ref = $obj->doc_ref;
1232 $line->fk_doc = $obj->fk_doc;
1233 $line->fk_docdet = $obj->fk_docdet;
1234 $line->thirdparty_code = $obj->thirdparty_code;
1235 $line->subledger_account = $obj->subledger_account;
1236 $line->subledger_label = $obj->subledger_label;
1237 $line->numero_compte = $obj->numero_compte;
1238 $line->label_compte = $obj->label_compte;
1239 $line->label_operation = $obj->label_operation;
1240 $line->debit = $obj->debit;
1241 $line->credit = $obj->credit;
1242 $line->montant = $obj->amount;
1243 $line->amount = $obj->amount;
1244 $line->sens = $obj->sens;
1245 $line->lettering_code = $obj->lettering_code;
1246 $line->fk_user_author = $obj->fk_user_author;
1247 $line->import_key = $obj->import_key;
1248 $line->code_journal = $obj->code_journal;
1249 $line->journal_label = $obj->journal_label;
1250 $line->piece_num = $obj->piece_num;
1251 $line->date_creation = $db->jdate($obj->date_creation);
1252 $line->date_modification = $db->jdate($obj->date_modification);
1253 $line->date_export = $db->jdate($obj->date_export);
1254 $line->date_validation = $db->jdate($obj->date_validation);
1256 print
'<tr class="oddeven">';
1259 print
'<td class="nowraponall center">';
1260 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
1262 if (in_array($line->id, $arrayofselected)) {
1265 print
'<input id="cb'.$line->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.
'"'.($selected ?
' checked="checked"' :
'').
' />';
1274 if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
1277 $object->piece_num = $line->piece_num;
1278 print
$object->getNomUrl(1,
'', 0,
'', 1);
1286 if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
1288 $result = $accountingjournal->fetch(0, $line->code_journal);
1289 $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0,
'', 0) : $line->code_journal);
1290 print
'<td class="center tdoverflowmax150">'.$journaltoshow.
'</td>';
1297 if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1298 print
'<td class="center">'.dol_print_date($line->doc_date,
'day').
'</td>';
1306 if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1308 $objectstatic =
null;
1309 if ($line->doc_type ==
'customer_invoice') {
1310 $langs->loadLangs(array(
'bills'));
1312 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
1313 $objectstatic =
new Facture($db);
1314 $objectstatic->fetch($line->fk_doc);
1316 if ($objectstatic->id > 0) {
1319 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$objectstatic->id;
1320 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1322 } elseif ($line->doc_type ==
'supplier_invoice') {
1323 $langs->loadLangs(array(
'bills'));
1325 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
1327 $objectstatic->fetch($line->fk_doc);
1329 if ($objectstatic->id > 0) {
1330 $modulepart =
'invoice_supplier';
1332 $filedir = $conf->fournisseur->facture->dir_output.
'/'.
get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $objectstatic->element).dol_sanitizeFileName($line->doc_ref);
1333 $subdir =
get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $objectstatic->element).dol_sanitizeFileName($line->doc_ref);
1334 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
1336 } elseif ($line->doc_type ==
'expense_report') {
1337 $langs->loadLangs(array(
'trips'));
1339 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
1341 $objectstatic->fetch($line->fk_doc);
1343 if ($objectstatic->id > 0) {
1346 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$objectstatic->id;
1347 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1349 } elseif ($line->doc_type ==
'bank') {
1350 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
1352 $objectstatic->fetch($line->fk_doc);
1357 $labeltoshowhtml =
'';
1358 $labeltoshowalt =
'';
1359 if (($objectstatic instanceof
CommonObject) && in_array($line->doc_type, array(
'customer_invoice',
'supplier_invoice',
'expense_report'))) {
1360 if ($objectstatic->id > 0) {
1361 $labeltoshowhtml .= $objectstatic->getNomUrl(1,
'', 0, 0,
'', 0, -1, 1);
1362 $labeltoshowhtml .= $documentlink;
1363 $labeltoshowalt .= $objectstatic->ref;
1365 $labeltoshowhtml =
'<span class="opacitymedium">'.$langs->trans(
"Deleted").
'</span>';
1367 } elseif ($line->doc_type ==
'bank') {
1368 $labeltoshowhtml .= $objectstatic->getNomUrl(1);
1369 $labeltoshowalt .= $objectstatic->ref;
1370 $bank_ref = strstr($line->doc_ref,
'-');
1371 $labeltoshowhtml .=
" " . $bank_ref;
1372 $labeltoshowalt .=
" " . $bank_ref;
1374 $labeltoshowhtml .= $line->doc_ref;
1375 $labeltoshowalt .= $line->doc_ref;
1378 print
'<td class="nowraponall tdoverflowmax150" title="'.dolPrintHTMLForAttribute($labeltoshowalt).
'">';
1379 print $labeltoshowhtml;
1387 if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
1388 print
'<td>'.length_accountg($line->numero_compte).
'</td>';
1395 if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
1396 print
'<td>'.length_accounta($line->subledger_account).
'</td>';
1403 if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1404 print
'<td class="small tdoverflowmax200" title="'.dol_escape_htmltag($line->label_operation).
'">'.
dol_escape_htmltag($line->label_operation).
'</td>';
1411 if (!empty($arrayfields[
't.debit'][
'checked'])) {
1412 print
'<td class="right nowraponall amount">'.($line->debit != 0 ?
price($line->debit) :
'').
'</td>';
1423 if (!empty($arrayfields[
't.credit'][
'checked'])) {
1424 print
'<td class="right nowraponall amount">'.($line->credit != 0 ?
price($line->credit) :
'').
'</td>';
1431 $totalarray[
'val'][
'totalcredit'] += $line->credit;
1435 if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1436 print
'<td class="center">'.$line->lettering_code.
'</td>';
1443 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &
$totalarray);
1444 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1445 print $hookmanager->resPrint;
1448 if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1449 print
'<td class="center">'.dol_print_date($line->date_creation,
'dayhour',
'tzuserrel').
'</td>';
1456 if (!empty($arrayfields[
't.tms'][
'checked'])) {
1457 print
'<td class="center">'.dol_print_date($line->date_modification,
'dayhour',
'tzuserrel').
'</td>';
1464 if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1465 print
'<td class="center nowraponall">'.dol_print_date($line->date_export,
'dayhour',
'tzuserrel').
'</td>';
1472 if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1473 print
'<td class="center nowraponall">'.dol_print_date($line->date_validation,
'dayhour',
'tzuserrel').
'</td>';
1479 if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1480 print
'<td class="tdoverflowmax100">'.$obj->import_key.
"</td>\n";
1488 print
'<td class="nowraponall center">';
1489 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
1491 if (in_array($line->id, $arrayofselected)) {
1494 print
'<input id="cb'.$line->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.
'"'.($selected ?
' checked="checked"' :
'').
' />';
1509include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1514 foreach ($arrayfields as $key => $val) {
1515 if (!empty($val[
'checked'])) {
1519 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1522$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1523$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1524print $hookmanager->resPrint;
if(! $sortfield) if(! $sortorder) $object
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage bank transaction lines.
Class to manage categories of an accounting account.
Manage the different format accountancy export.
Class to manage accounting journals.
Class to manage Ledger (General Ledger and Subledger)
Parent class of all other business classes (invoices, contracts, proposals, orders,...
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_filesize($pathoffile)
Return size of a file.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
readfileLowMemory($fullpath_original_file_osencoded, $method=-1)
Return a file on output using a low memory.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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.
isModEnabled($module)
Is Dolibarr module enabled.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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...
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.