28 require
'../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountancyexport.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/lettering.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeeping.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
41 $langs->loadLangs(array(
"accountancy",
"compta"));
43 $socid =
GETPOST(
'socid',
'int');
45 $action =
GETPOST(
'action',
'aZ09');
46 $massaction =
GETPOST(
'massaction',
'alpha');
47 $confirm =
GETPOST(
'confirm',
'alpha');
48 $toselect =
GETPOST(
'toselect',
'array');
49 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'bookkeepinglist';
50 $search_mvt_num =
GETPOST(
'search_mvt_num',
'int');
51 $search_doc_type =
GETPOST(
"search_doc_type",
'alpha');
52 $search_doc_ref =
GETPOST(
"search_doc_ref",
'alpha');
53 $search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
54 $search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
55 $search_date_startday =
GETPOST(
'search_date_startday',
'int');
56 $search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
57 $search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
58 $search_date_endday =
GETPOST(
'search_date_endday',
'int');
59 $search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
60 $search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
62 $search_date_creation_startyear =
GETPOST(
'search_date_creation_startyear',
'int');
63 $search_date_creation_startmonth =
GETPOST(
'search_date_creation_startmonth',
'int');
64 $search_date_creation_startday =
GETPOST(
'search_date_creation_startday',
'int');
65 $search_date_creation_endyear =
GETPOST(
'search_date_creation_endyear',
'int');
66 $search_date_creation_endmonth =
GETPOST(
'search_date_creation_endmonth',
'int');
67 $search_date_creation_endday =
GETPOST(
'search_date_creation_endday',
'int');
68 $search_date_creation_start =
dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear);
69 $search_date_creation_end =
dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear);
70 $search_date_modification_startyear =
GETPOST(
'search_date_modification_startyear',
'int');
71 $search_date_modification_startmonth =
GETPOST(
'search_date_modification_startmonth',
'int');
72 $search_date_modification_startday =
GETPOST(
'search_date_modification_startday',
'int');
73 $search_date_modification_endyear =
GETPOST(
'search_date_modification_endyear',
'int');
74 $search_date_modification_endmonth =
GETPOST(
'search_date_modification_endmonth',
'int');
75 $search_date_modification_endday =
GETPOST(
'search_date_modification_endday',
'int');
76 $search_date_modification_start =
dol_mktime(0, 0, 0, $search_date_modification_startmonth, $search_date_modification_startday, $search_date_modification_startyear);
77 $search_date_modification_end =
dol_mktime(23, 59, 59, $search_date_modification_endmonth, $search_date_modification_endday, $search_date_modification_endyear);
78 $search_date_export_startyear =
GETPOST(
'search_date_export_startyear',
'int');
79 $search_date_export_startmonth =
GETPOST(
'search_date_export_startmonth',
'int');
80 $search_date_export_startday =
GETPOST(
'search_date_export_startday',
'int');
81 $search_date_export_endyear =
GETPOST(
'search_date_export_endyear',
'int');
82 $search_date_export_endmonth =
GETPOST(
'search_date_export_endmonth',
'int');
83 $search_date_export_endday =
GETPOST(
'search_date_export_endday',
'int');
84 $search_date_export_start =
dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
85 $search_date_export_end =
dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
86 $search_date_validation_startyear =
GETPOST(
'search_date_validation_startyear',
'int');
87 $search_date_validation_startmonth =
GETPOST(
'search_date_validation_startmonth',
'int');
88 $search_date_validation_startday =
GETPOST(
'search_date_validation_startday',
'int');
89 $search_date_validation_endyear =
GETPOST(
'search_date_validation_endyear',
'int');
90 $search_date_validation_endmonth =
GETPOST(
'search_date_validation_endmonth',
'int');
91 $search_date_validation_endday =
GETPOST(
'search_date_validation_endday',
'int');
92 $search_date_validation_start =
dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear);
93 $search_date_validation_end =
dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
94 $search_import_key =
GETPOST(
"search_import_key",
'alpha');
98 $action =
'delbookkeepingyear';
100 if (
GETPOST(
"button_export_file_x") ||
GETPOST(
"button_export_file.x") ||
GETPOST(
"button_export_file")) {
101 $action =
'export_file';
104 $search_accountancy_code =
GETPOST(
"search_accountancy_code");
105 $search_accountancy_code_start =
GETPOST(
'search_accountancy_code_start',
'alpha');
106 if ($search_accountancy_code_start == - 1) {
107 $search_accountancy_code_start =
'';
109 $search_accountancy_code_end =
GETPOST(
'search_accountancy_code_end',
'alpha');
110 if ($search_accountancy_code_end == - 1) {
111 $search_accountancy_code_end =
'';
114 $search_accountancy_aux_code =
GETPOST(
"search_accountancy_aux_code",
'alpha');
115 $search_accountancy_aux_code_start =
GETPOST(
'search_accountancy_aux_code_start',
'alpha');
116 if ($search_accountancy_aux_code_start == - 1) {
117 $search_accountancy_aux_code_start =
'';
119 $search_accountancy_aux_code_end =
GETPOST(
'search_accountancy_aux_code_end',
'alpha');
120 if ($search_accountancy_aux_code_end == - 1) {
121 $search_accountancy_aux_code_end =
'';
123 $search_mvt_label =
GETPOST(
'search_mvt_label',
'alpha');
124 $search_direction =
GETPOST(
'search_direction',
'alpha');
125 $search_debit =
GETPOST(
'search_debit',
'alpha');
126 $search_credit =
GETPOST(
'search_credit',
'alpha');
127 $search_ledger_code =
GETPOST(
'search_ledger_code',
'array');
128 $search_lettering_code =
GETPOST(
'search_lettering_code',
'alpha');
129 $search_not_reconciled =
GETPOST(
'search_not_reconciled',
'alpha');
132 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
133 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
134 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
135 $optioncss =
GETPOST(
'optioncss',
'alpha');
137 if (empty($page) || $page < 0) {
140 $offset = $limit * $page;
141 $pageprev = $page - 1;
142 $pagenext = $page + 1;
143 if ($sortorder ==
"") {
146 if ($sortfield ==
"") {
147 $sortfield =
"t.piece_num,t.rowid";
152 $hookmanager->initHooks(array(
'bookkeepinglist'));
157 if (!in_array($action, array(
'export_file',
'delmouv',
'delmouvconfirm')) && !
GETPOSTISSET(
'begin') && !
GETPOSTISSET(
'formfilteraction') &&
GETPOST(
'page',
'int') ==
'' && !
GETPOST(
'noreset',
'int') && $user->rights->accounting->mouvements->export) {
158 if (empty($search_date_start) && empty($search_date_end) && !
GETPOSTISSET(
'restore_lastsearch_values') && !
GETPOST(
'search_accountancy_code_start')) {
159 $query =
"SELECT date_start, date_end from ".MAIN_DB_PREFIX.
"accounting_fiscalyear ";
160 $query .=
" where date_start < '".$db->idate(
dol_now()).
"' and date_end > '".$db->idate(
dol_now()).
"' limit 1";
161 $res = $db->query($query);
163 if ($res->num_rows > 0) {
164 $fiscalYear = $db->fetch_object($res);
165 $search_date_start = strtotime($fiscalYear->date_start);
166 $search_date_end = strtotime($fiscalYear->date_end);
168 $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
173 $year_end = $year_start + 1;
174 $month_end = $month_start - 1;
175 if ($month_end < 1) {
179 $search_date_start =
dol_mktime(0, 0, 0, $month_start, 1, $year_start);
186 $arrayfields = array(
187 't.piece_num'=>array(
'label'=>$langs->trans(
"TransactionNumShort"),
'checked'=>1),
188 't.code_journal'=>array(
'label'=>$langs->trans(
"Codejournal"),
'checked'=>1),
189 't.doc_date'=>array(
'label'=>$langs->trans(
"Docdate"),
'checked'=>1),
190 't.doc_ref'=>array(
'label'=>$langs->trans(
"Piece"),
'checked'=>1),
191 't.numero_compte'=>array(
'label'=>$langs->trans(
"AccountAccountingShort"),
'checked'=>1),
192 't.subledger_account'=>array(
'label'=>$langs->trans(
"SubledgerAccount"),
'checked'=>1),
193 't.label_operation'=>array(
'label'=>$langs->trans(
"Label"),
'checked'=>1),
194 't.debit'=>array(
'label'=>$langs->trans(
"Debit"),
'checked'=>1),
195 't.credit'=>array(
'label'=>$langs->trans(
"Credit"),
'checked'=>1),
196 't.lettering_code'=>array(
'label'=>$langs->trans(
"LetteringCode"),
'checked'=>1),
197 't.date_creation'=>array(
'label'=>$langs->trans(
"DateCreation"),
'checked'=>0),
198 't.tms'=>array(
'label'=>$langs->trans(
"DateModification"),
'checked'=>0),
199 't.date_export'=>array(
'label'=>$langs->trans(
"DateExport"),
'checked'=>1),
200 't.date_validated'=>array(
'label'=>$langs->trans(
"DateValidationAndLock"),
'checked'=>1,
'enabled'=>!
getDolGlobalString(
"ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
201 't.import_key'=>array(
'label'=>$langs->trans(
"ImportId"),
'checked'=>0,
'position'=>1100),
204 if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
205 unset($arrayfields[
't.lettering_code']);
209 $listofformat = $accountancyexport->getType();
211 if (empty($listofformat[$formatexportset])) {
212 $formatexportset = 1;
220 if ($user->socid > 0) {
223 if (empty($user->rights->accounting->mouvements->lire)) {
234 if (
GETPOST(
'cancel',
'alpha')) {
235 $action =
'list'; $massaction =
'';
237 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'preunlettering' && $massaction !=
'predeletebookkeepingwriting') {
241 $parameters = array(
'socid'=>$socid);
242 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
247 if (empty($reshook)) {
248 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
250 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
251 $search_mvt_num =
'';
252 $search_doc_type =
'';
253 $search_doc_ref =
'';
254 $search_doc_date =
'';
255 $search_accountancy_code =
'';
256 $search_accountancy_code_start =
'';
257 $search_accountancy_code_end =
'';
258 $search_accountancy_aux_code =
'';
259 $search_accountancy_aux_code_start =
'';
260 $search_accountancy_aux_code_end =
'';
261 $search_mvt_label =
'';
262 $search_direction =
'';
263 $search_ledger_code = array();
264 $search_date_startyear =
'';
265 $search_date_startmonth =
'';
266 $search_date_startday =
'';
267 $search_date_endyear =
'';
268 $search_date_endmonth =
'';
269 $search_date_endday =
'';
270 $search_date_start =
'';
271 $search_date_end =
'';
272 $search_date_creation_startyear =
'';
273 $search_date_creation_startmonth =
'';
274 $search_date_creation_startday =
'';
275 $search_date_creation_endyear =
'';
276 $search_date_creation_endmonth =
'';
277 $search_date_creation_endday =
'';
278 $search_date_creation_start =
'';
279 $search_date_creation_end =
'';
280 $search_date_modification_startyear =
'';
281 $search_date_modification_startmonth =
'';
282 $search_date_modification_startday =
'';
283 $search_date_modification_endyear =
'';
284 $search_date_modification_endmonth =
'';
285 $search_date_modification_endday =
'';
286 $search_date_modification_start =
'';
287 $search_date_modification_end =
'';
288 $search_date_export_startyear =
'';
289 $search_date_export_startmonth =
'';
290 $search_date_export_startday =
'';
291 $search_date_export_endyear =
'';
292 $search_date_export_endmonth =
'';
293 $search_date_export_endday =
'';
294 $search_date_export_start =
'';
295 $search_date_export_end =
'';
296 $search_date_validation_startyear =
'';
297 $search_date_validation_startmonth =
'';
298 $search_date_validation_startday =
'';
299 $search_date_validation_endyear =
'';
300 $search_date_validation_endmonth =
'';
301 $search_date_validation_endday =
'';
302 $search_date_validation_start =
'';
303 $search_date_validation_end =
'';
306 $search_lettering_code =
'';
307 $search_not_reconciled =
'';
308 $search_import_key =
'';
314 if (!empty($search_date_start)) {
315 $filter[
't.doc_date>='] = $search_date_start;
317 $param .=
'&search_date_startmonth='.urlencode($tmp[
'mon']).
'&search_date_startday='.urlencode($tmp[
'mday']).
'&search_date_startyear='.urlencode($tmp[
'year']);
319 if (!empty($search_date_end)) {
320 $filter[
't.doc_date<='] = $search_date_end;
322 $param .=
'&search_date_endmonth='.urlencode($tmp[
'mon']).
'&search_date_endday='.urlencode($tmp[
'mday']).
'&search_date_endyear='.urlencode($tmp[
'year']);
324 if (!empty($search_doc_date)) {
325 $filter[
't.doc_date'] = $search_doc_date;
327 $param .=
'&doc_datemonth='.urlencode($tmp[
'mon']).
'&doc_dateday='.urlencode($tmp[
'mday']).
'&doc_dateyear='.urlencode($tmp[
'year']);
329 if (!empty($search_doc_type)) {
330 $filter[
't.doc_type'] = $search_doc_type;
331 $param .=
'&search_doc_type='.urlencode($search_doc_type);
333 if (!empty($search_doc_ref)) {
334 $filter[
't.doc_ref'] = $search_doc_ref;
335 $param .=
'&search_doc_ref='.urlencode($search_doc_ref);
337 if (!empty($search_accountancy_code)) {
338 $filter[
't.numero_compte'] = $search_accountancy_code;
339 $param .=
'&search_accountancy_code='.urlencode($search_accountancy_code);
341 if (!empty($search_accountancy_code_start)) {
342 $filter[
't.numero_compte>='] = $search_accountancy_code_start;
343 $param .=
'&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
345 if (!empty($search_accountancy_code_end)) {
346 $filter[
't.numero_compte<='] = $search_accountancy_code_end;
347 $param .=
'&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
349 if (!empty($search_accountancy_aux_code_start)) {
350 $filter[
't.subledger_account>='] = $search_accountancy_aux_code_start;
351 $param .=
'&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
353 if (!empty($search_accountancy_aux_code_end)) {
354 $filter[
't.subledger_account<='] = $search_accountancy_aux_code_end;
355 $param .=
'&search_accountancy_aux_code_end='.urlencode($search_accountancy_aux_code_end);
357 if (!empty($search_mvt_label)) {
358 $filter[
't.label_operation'] = $search_mvt_label;
359 $param .=
'&search_mvt_label='.urlencode($search_mvt_label);
361 if (!empty($search_direction)) {
362 $filter[
't.sens'] = $search_direction;
363 $param .=
'&search_direction='.urlencode($search_direction);
365 if (!empty($search_ledger_code)) {
366 $filter[
't.code_journal'] = $search_ledger_code;
367 foreach ($search_ledger_code as $code) {
368 $param .=
'&search_ledger_code[]='.urlencode($code);
371 if (!empty($search_mvt_num)) {
372 $filter[
't.piece_num'] = $search_mvt_num;
373 $param .=
'&search_mvt_num='.urlencode($search_mvt_num);
375 if (!empty($search_date_creation_start)) {
376 $filter[
't.date_creation>='] = $search_date_creation_start;
378 $param .=
'&search_date_creation_startmonth='.urlencode($tmp[
'mon']).
'&search_date_creation_startday='.urlencode($tmp[
'mday']).
'&search_date_creation_startyear='.urlencode($tmp[
'year']);
380 if (!empty($search_date_creation_end)) {
381 $filter[
't.date_creation<='] = $search_date_creation_end;
383 $param .=
'&search_date_creation_endmonth='.urlencode($tmp[
'mon']).
'&search_date_creation_endday='.urlencode($tmp[
'mday']).
'&search_date_creation_endyear='.urlencode($tmp[
'year']);
385 if (!empty($search_date_modification_start)) {
386 $filter[
't.tms>='] = $search_date_modification_start;
387 $tmp =
dol_getdate($search_date_modification_start);
388 $param .=
'&search_date_modification_startmonth='.urlencode($tmp[
'mon']).
'&search_date_modification_startday='.urlencode($tmp[
'mday']).
'&search_date_modification_startyear='.urlencode($tmp[
'year']);
390 if (!empty($search_date_modification_end)) {
391 $filter[
't.tms<='] = $search_date_modification_end;
393 $param .=
'&search_date_modification_endmonth='.urlencode($tmp[
'mon']).
'&search_date_modification_endday='.urlencode($tmp[
'mday']).
'&search_date_modification_endyear='.urlencode($tmp[
'year']);
395 if (!empty($search_date_export_start)) {
396 $filter[
't.date_export>='] = $search_date_export_start;
398 $param .=
'&search_date_export_startmonth='.urlencode($tmp[
'mon']).
'&search_date_export_startday='.urlencode($tmp[
'mday']).
'&search_date_export_startyear='.urlencode($tmp[
'year']);
400 if (!empty($search_date_export_end)) {
401 $filter[
't.date_export<='] = $search_date_export_end;
403 $param .=
'&search_date_export_endmonth='.urlencode($tmp[
'mon']).
'&search_date_export_endday='.urlencode($tmp[
'mday']).
'&search_date_export_endyear='.urlencode($tmp[
'year']);
405 if (!empty($search_date_validation_start)) {
406 $filter[
't.date_validated>='] = $search_date_validation_start;
408 $param .=
'&search_date_validation_startmonth='.urlencode($tmp[
'mon']).
'&search_date_validation_startday='.urlencode($tmp[
'mday']).
'&search_date_validation_startyear='.urlencode($tmp[
'year']);
410 if (!empty($search_date_validation_end)) {
411 $filter[
't.date_validated<='] = $search_date_validation_end;
413 $param .=
'&search_date_validation_endmonth='.urlencode($tmp[
'mon']).
'&search_date_validation_endday='.urlencode($tmp[
'mday']).
'&search_date_validation_endyear='.urlencode($tmp[
'year']);
415 if (!empty($search_debit)) {
416 $filter[
't.debit'] = $search_debit;
417 $param .=
'&search_debit='.urlencode($search_debit);
419 if (!empty($search_credit)) {
420 $filter[
't.credit'] = $search_credit;
421 $param .=
'&search_credit='.urlencode($search_credit);
423 if (!empty($search_lettering_code)) {
424 $filter[
't.lettering_code'] = $search_lettering_code;
425 $param .=
'&search_lettering_code='.urlencode($search_lettering_code);
427 if (!empty($search_not_reconciled)) {
428 $filter[
't.reconciled_option'] = $search_not_reconciled;
429 $param .=
'&search_not_reconciled='.urlencode($search_not_reconciled);
431 if (!empty($search_import_key)) {
432 $filter[
't.import_key'] = $search_import_key;
433 $param .=
'&search_import_key='.urlencode($search_import_key);
462 if ($action ==
'setreexport') {
463 $setreexport =
GETPOST(
'value',
'int');
464 if (!
dolibarr_set_const($db,
"ACCOUNTING_REEXPORT", $setreexport,
'yesno', 0,
'', $conf->entity)) {
469 if ($conf->global->ACCOUNTING_REEXPORT == 1) {
470 setEventMessages($langs->trans(
"ExportOfPiecesAlreadyExportedIsEnable"), null,
'mesgs');
472 setEventMessages($langs->trans(
"ExportOfPiecesAlreadyExportedIsDisable"), null,
'mesgs');
480 $objectclass =
'Bookkeeping';
481 $objectlabel =
'Bookkeeping';
482 $permissiontoread = $user->rights->societe->lire;
483 $permissiontodelete = $user->rights->societe->supprimer;
484 $permissiontoadd = $user->rights->societe->creer;
485 $uploaddir = $conf->societe->dir_output;
486 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
488 if (!$error && $action ==
'deletebookkeepingwriting' && $confirm ==
"yes" && $user->rights->accounting->mouvements->supprimer) {
490 foreach ($toselect as $toselectid) {
491 $result = $object->fetch($toselectid);
492 if ($result > 0 && (!isset($object->date_validation) || $object->date_validation ===
'')) {
493 $result = $object->deleteMvtNum($object->piece_num);
501 } elseif ($result < 0) {
511 } elseif ($nbok > 0) {
518 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?noreset=1".($param ?
'&'.$param :
''));
524 if (!$error &&
getDolGlobalInt(
'ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) {
525 if ($massaction ==
'lettering') {
527 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
528 if ($nb_lettering < 0) {
531 $nb_lettering = max(0, abs($nb_lettering) - 2);
532 } elseif ($nb_lettering == 0) {
534 setEventMessages($langs->trans(
'AccountancyNoLetteringModified'), array(),
'mesgs');
536 if ($nb_lettering == 1) {
537 setEventMessages($langs->trans(
'AccountancyOneLetteringModifiedSuccessfully'), array(),
'mesgs');
538 } elseif ($nb_lettering > 1) {
539 setEventMessages($langs->trans(
'AccountancyLetteringModifiedSuccessfully', $nb_lettering), array(),
'mesgs');
543 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
546 } elseif ($action ==
'unlettering' && $confirm ==
"yes") {
548 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect,
true);
549 if ($nb_lettering < 0) {
552 $nb_lettering = max(0, abs($nb_lettering) - 2);
553 } elseif ($nb_lettering == 0) {
555 setEventMessages($langs->trans(
'AccountancyNoUnletteringModified'), array(),
'mesgs');
557 if ($nb_lettering == 1) {
558 setEventMessages($langs->trans(
'AccountancyOneUnletteringModifiedSuccessfully'), array(),
'mesgs');
559 } elseif ($nb_lettering > 1) {
560 setEventMessages($langs->trans(
'AccountancyUnletteringModifiedSuccessfully', $nb_lettering), array(),
'mesgs');
564 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
577 $sql .=
" t.doc_date,";
578 $sql .=
" t.doc_type,";
579 $sql .=
" t.doc_ref,";
580 $sql .=
" t.fk_doc,";
581 $sql .=
" t.fk_docdet,";
582 $sql .=
" t.thirdparty_code,";
583 $sql .=
" t.subledger_account,";
584 $sql .=
" t.subledger_label,";
585 $sql .=
" t.numero_compte,";
586 $sql .=
" t.label_compte,";
587 $sql .=
" t.label_operation,";
589 $sql .=
" t.credit,";
590 $sql .=
" t.lettering_code,";
591 $sql .=
" t.montant as amount,";
593 $sql .=
" t.fk_user_author,";
594 $sql .=
" t.import_key,";
595 $sql .=
" t.code_journal,";
596 $sql .=
" t.journal_label,";
597 $sql .=
" t.piece_num,";
598 $sql .=
" t.date_creation,";
599 $sql .=
" t.tms as date_modification,";
600 $sql .=
" t.date_export,";
601 $sql .=
" t.date_validated as date_validation,";
602 $sql .=
" t.import_key";
603 $sql .=
' FROM '.MAIN_DB_PREFIX.$object->table_element.
' as t';
606 if (count($filter) > 0) {
607 foreach ($filter as $key => $value) {
608 if ($key ==
't.doc_date') {
609 $sqlwhere[] = $key.
"='".$db->idate($value).
"'";
610 } elseif ($key ==
't.doc_date>=' || $key ==
't.doc_date<=') {
611 $sqlwhere[] = $key.
"'".$db->idate($value).
"'";
612 } elseif ($key ==
't.numero_compte>=' || $key ==
't.numero_compte<=' || $key ==
't.subledger_account>=' || $key ==
't.subledger_account<=') {
613 $sqlwhere[] = $key.
"'".$db->escape($value).
"'";
614 } elseif ($key ==
't.fk_doc' || $key ==
't.fk_docdet' || $key ==
't.piece_num') {
615 $sqlwhere[] = $key.
'='.((int) $value);
616 } elseif ($key ==
't.subledger_account' || $key ==
't.numero_compte') {
617 $sqlwhere[] = $key.
" LIKE '".$db->escape($value).
"%'";
618 } elseif ($key ==
't.subledger_account') {
620 } elseif ($key ==
't.date_creation>=' || $key ==
't.date_creation<=') {
621 $sqlwhere[] = $key.
"'".$db->idate($value).
"'";
622 } elseif ($key ==
't.tms>=' || $key ==
't.tms<=') {
623 $sqlwhere[] = $key.
"'".$db->idate($value).
"'";
624 } elseif ($key ==
't.date_export>=' || $key ==
't.date_export<=') {
625 $sqlwhere[] = $key.
"'".$db->idate($value).
"'";
626 } elseif ($key ==
't.date_validated>=' || $key ==
't.date_validated<=') {
627 $sqlwhere[] = $key.
"'".$db->idate($value).
"'";
628 } elseif ($key ==
't.credit' || $key ==
't.debit') {
630 } elseif ($key ==
't.reconciled_option') {
631 $sqlwhere[] =
't.lettering_code IS NULL';
632 } elseif ($key ==
't.code_journal' && !empty($value)) {
633 $sqlwhere[] =
natural_search(
"t.code_journal", join(
',', $value), 3, 1);
639 $sql .=
' WHERE t.entity IN ('.getEntity(
'accountancy').
')';
640 if (empty($conf->global->ACCOUNTING_REEXPORT)) {
641 $sql .=
" AND t.date_export IS NULL";
643 if (count($sqlwhere) > 0) {
644 $sql .=
' AND '.implode(
' AND ', $sqlwhere);
646 if (!empty($sortfield)) {
647 $sql .= $db->order($sortfield, $sortorder);
654 if ($action ==
'export_fileconfirm' && $user->rights->accounting->mouvements->export) {
656 $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter,
'AND', (empty($conf->global->ACCOUNTING_REEXPORT) ? 0 : 1));
663 $accountancyexport->export($object->lines, $formatexportset);
665 $notifiedexportdate =
GETPOST(
'notifiedexportdate',
'alpha');
666 $notifiedvalidationdate =
GETPOST(
'notifiedvalidationdate',
'alpha');
668 if (!empty($accountancyexport->errors)) {
670 } elseif (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
675 if (is_array($object->lines)) {
676 foreach ($object->lines as $movement) {
679 $sql =
" UPDATE ".MAIN_DB_PREFIX.
"accounting_bookkeeping";
681 if (!empty($notifiedexportdate) && !empty($notifiedvalidationdate)) {
682 $sql .=
" date_export = '".$db->idate($now).
"'";
683 $sql .=
", date_validated = '".$db->idate($now).
"'";
684 } elseif (!empty($notifiedexportdate)) {
685 $sql .=
" date_export = '".$db->idate($now).
"'";
686 } elseif (!empty($notifiedvalidationdate)) {
687 $sql .=
" date_validated = '".$db->idate($now).
"'";
689 $sql .=
" WHERE rowid = ".((int) $movement->id);
691 dol_syslog(
"/accountancy/bookkeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG);
693 $result = $db->query($sql);
707 setEventMessages($langs->trans(
"NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated"), null,
'errors');
722 $title_page = $langs->trans(
"Operations").
' - '.$langs->trans(
"Journals");
725 $nbtotalofrecords =
'';
726 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
727 $resql = $db->query($sql);
728 $nbtotalofrecords = $db->num_rows(
$resql);
729 if (($page * $limit) > $nbtotalofrecords) {
735 if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) {
736 $num = $nbtotalofrecords;
738 $sql .= $db->plimit($limit + 1, $offset);
740 $resql = $db->query($sql);
746 $num = $db->num_rows(
$resql);
749 $arrayofselected = is_array($toselect) ? $toselect : array();
758 if ($action ==
'export_file') {
759 $form_question = array();
762 $checked = (!isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE));
763 $form_question[
'notifiedexportdate'] = array(
764 'name' =>
'notifiedexportdate',
765 'type' =>
'checkbox',
766 'label' => $langs->trans(
'NotifiedExportDate'),
767 'value' => (!empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) ?
'false' :
'true'),
770 $form_question[
'separator'] = array(
'name'=>
'separator',
'type'=>
'separator');
774 $checked = (isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE));
775 $form_question[
'notifiedvalidationdate'] = array(
776 'name' =>
'notifiedvalidationdate',
777 'type' =>
'checkbox',
778 'label' => $langs->trans(
'NotifiedValidationDate', $langs->transnoentitiesnoconv(
"MenuAccountancyClosure")),
782 $form_question[
'separator2'] = array(
'name'=>
'separator2',
'type'=>
'separator');
785 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?'.$param, $langs->trans(
"ExportFilteredList").
' ('.$listofformat[$formatexportset].
')', $langs->trans(
'ConfirmExportFile'),
'export_fileconfirm', $form_question,
'', 1, 300, 600);
833 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
834 $param .=
'&contextpage='.urlencode($contextpage);
836 if ($limit > 0 && $limit != $conf->liste_limit) {
837 $param .=
'&limit='.urlencode($limit);
841 $arrayofmassactions = array();
848 if ($user->rights->accounting->mouvements->supprimer) {
849 $arrayofmassactions[
'predeletebookkeepingwriting'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
851 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'preunlettering',
'predeletebookkeepingwriting'))) {
852 $arrayofmassactions = array();
854 $massactionbutton =
$form->selectMassAction($massaction, $arrayofmassactions);
856 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
857 print
'<input type="hidden" name="token" value="'.newToken().
'">';
858 print
'<input type="hidden" name="action" value="list">';
859 if ($optioncss !=
'') {
860 print
'<input type="hidden" name="optioncss" value="'.urlencode($optioncss).
'">';
862 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
863 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
864 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
865 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
867 if (count($filter)) {
868 $buttonLabel = $langs->trans(
"ExportFilteredList");
870 $buttonLabel = $langs->trans(
"ExportList");
873 $parameters = array();
874 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtonsList', $parameters, $object, $action);
875 if (empty($reshook)) {
877 if (!empty($conf->global->ACCOUNTING_REEXPORT)) {
878 $newcardbutton =
'<a class="valignmiddle" href="'.$_SERVER[
'PHP_SELF'].
'?action=setreexport&token='.
newToken().
'&value=0'.($param ?
'&'.$param :
'').
'">'.
img_picto($langs->trans(
"Activated"),
'switch_on').
'</a> ';
880 $newcardbutton =
'<a class="valignmiddle" href="'.$_SERVER[
'PHP_SELF'].
'?action=setreexport&token='.
newToken().
'&value=1'.($param ?
'&'.$param :
'').
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a> ';
882 $newcardbutton .=
'<span class="valignmiddle marginrightonly">'.$langs->trans(
"IncludeDocsAlreadyExported").
'</span>';
884 if (!empty($user->rights->accounting->mouvements->export)) {
885 $newcardbutton .=
dolGetButtonTitle($buttonLabel, $langs->trans(
"ExportFilteredList").
' ('.$listofformat[$formatexportset].
')',
'fa fa-file-export paddingleft', $_SERVER[
"PHP_SELF"].
'?action=export_file'.($param ?
'&'.$param :
''), $user->rights->accounting->mouvements->export);
888 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewFlatList'),
'',
'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.
'/accountancy/bookkeeping/list.php?'.$param,
'', 1, array(
'morecss' =>
'marginleftonly btnTitleSelected'));
889 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'GroupByAccountAccounting'),
'',
'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.
'/accountancy/bookkeeping/listbyaccount.php?'.$param,
'', 1, array(
'morecss' =>
'marginleftonly'));
890 $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'));
892 $url =
'./card.php?action=create';
893 if (!empty($socid)) {
894 $url .=
'&socid='.$socid;
896 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewAccountingMvt'),
'',
'fa fa-plus-circle paddingleft', $url,
'', $user->rights->accounting->mouvements->creer);
899 print_barre_liste($title_page, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'title_accountancy', 0, $newcardbutton,
'', $limit, 0, 0, 1);
901 if ($massaction ==
'preunlettering') {
902 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassUnlettering"), $langs->trans(
"ConfirmMassUnletteringQuestion", count($toselect)),
"unlettering", null,
'', 0, 200, 500, 1);
903 } elseif ($massaction ==
'predeletebookkeepingwriting') {
904 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDeleteBookkeepingWriting"), $langs->trans(
"ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)),
"deletebookkeepingwriting", null,
'', 0, 200, 500, 1);
911 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
913 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
914 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
915 if ($massactionbutton && $contextpage !=
'poslist') {
916 $selectedfields .=
$form->showCheckAddButtons(
'checkforselect', 1);
921 $parameters = array();
922 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
923 if (empty($reshook)) {
924 $moreforfilter .= $hookmanager->resPrint;
926 $moreforfilter = $hookmanager->resPrint;
929 print
'<div class="div-table-responsive">';
930 print
'<table class="tagtable liste centpercent">';
933 print
'<tr class="liste_titre_filter">';
936 if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
937 print
'<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).
'"></td>';
940 if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
941 print
'<td class="liste_titre center">';
942 print $formaccounting->multi_select_journal($search_ledger_code,
'search_ledger_code', 0, 1, 1, 1,
'small maxwidth150');
946 if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
947 print
'<td class="liste_titre center">';
948 print
'<div class="nowrap">';
949 print
$form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
951 print
'<div class="nowrap">';
952 print
$form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
957 if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
958 print
'<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="'.dol_escape_htmltag($search_doc_ref).
'"></td>';
961 if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
962 print
'<td class="liste_titre">';
963 print
'<div class="nowrap">';
964 print $formaccounting->select_account($search_accountancy_code_start,
'search_accountancy_code_start', $langs->trans(
'From'), array(), 1, 1,
'maxwidth150',
'account');
966 print
'<div class="nowrap">';
967 print $formaccounting->select_account($search_accountancy_code_end,
'search_accountancy_code_end', $langs->trans(
'to'), array(), 1, 1,
'maxwidth150',
'account');
972 if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
973 print
'<td class="liste_titre">';
976 if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
977 print
'<div class="nowrap">';
979 print $formaccounting->select_auxaccount($search_accountancy_aux_code_start,
'search_accountancy_aux_code_start', $langs->trans(
'From'),
'maxwidth250',
'subledgeraccount');
981 print
'<div class="nowrap">';
982 print $formaccounting->select_auxaccount($search_accountancy_aux_code_end,
'search_accountancy_aux_code_end', $langs->trans(
'to'),
'maxwidth250',
'subledgeraccount');
985 print
'<input type="text" class="maxwidth75" name="search_accountancy_aux_code" value="'.$search_accountancy_aux_code.
'">';
990 if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
991 print
'<td class="liste_titre">';
992 print
'<input type="text" size="7" class="flat" name="search_mvt_label" value="'.$search_mvt_label.
'"/>';
996 if (!empty($arrayfields[
't.debit'][
'checked'])) {
997 print
'<td class="liste_titre right">';
998 print
'<input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).
'">';
1002 if (!empty($arrayfields[
't.credit'][
'checked'])) {
1003 print
'<td class="liste_titre right">';
1004 print
'<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).
'">';
1008 if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1009 print
'<td class="liste_titre center">';
1010 print
'<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.
'"/>';
1011 print
'<br><span class="nowrap"><input type="checkbox" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled ==
'notreconciled' ?
' checked' :
'').
'>'.$langs->trans(
"NotReconciled").
'</span>';
1016 $parameters = array(
'arrayfields'=>$arrayfields);
1017 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1018 print $hookmanager->resPrint;
1021 if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1022 print
'<td class="liste_titre center">';
1023 print
'<div class="nowrap">';
1024 print
$form->selectDate($search_date_creation_start,
'search_date_creation_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1026 print
'<div class="nowrap">';
1027 print
$form->selectDate($search_date_creation_end,
'search_date_creation_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1032 if (!empty($arrayfields[
't.tms'][
'checked'])) {
1033 print
'<td class="liste_titre center">';
1034 print
'<div class="nowrap">';
1035 print
$form->selectDate($search_date_modification_start,
'search_date_modification_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1037 print
'<div class="nowrap">';
1038 print
$form->selectDate($search_date_modification_end,
'search_date_modification_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1043 if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1044 print
'<td class="liste_titre center">';
1045 print
'<div class="nowrap">';
1046 print
$form->selectDate($search_date_export_start,
'search_date_export_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1048 print
'<div class="nowrap">';
1049 print
$form->selectDate($search_date_export_end,
'search_date_export_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1054 if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1055 print
'<td class="liste_titre center">';
1056 print
'<div class="nowrap">';
1057 print
$form->selectDate($search_date_validation_start,
'search_date_validation_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
1059 print
'<div class="nowrap">';
1060 print
$form->selectDate($search_date_validation_end,
'search_date_validation_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1064 if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1065 print
'<td class="liste_titre center">';
1066 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
1070 print
'<td class="liste_titre center">';
1071 $searchpicto =
$form->showFilterButtons();
1076 print
'<tr class="liste_titre">';
1077 if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
1078 print_liste_field_titre($arrayfields[
't.piece_num'][
'label'], $_SERVER[
'PHP_SELF'],
"t.piece_num",
"", $param,
"", $sortfield, $sortorder);
1080 if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
1081 print_liste_field_titre($arrayfields[
't.code_journal'][
'label'], $_SERVER[
'PHP_SELF'],
"t.code_journal",
"", $param,
'', $sortfield, $sortorder,
'center ');
1083 if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1084 print_liste_field_titre($arrayfields[
't.doc_date'][
'label'], $_SERVER[
'PHP_SELF'],
"t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1086 if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1087 print_liste_field_titre($arrayfields[
't.doc_ref'][
'label'], $_SERVER[
'PHP_SELF'],
"t.doc_ref",
"", $param,
"", $sortfield, $sortorder);
1089 if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
1090 print_liste_field_titre($arrayfields[
't.numero_compte'][
'label'], $_SERVER[
'PHP_SELF'],
"t.numero_compte",
"", $param,
"", $sortfield, $sortorder);
1092 if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
1093 print_liste_field_titre($arrayfields[
't.subledger_account'][
'label'], $_SERVER[
'PHP_SELF'],
"t.subledger_account",
"", $param,
"", $sortfield, $sortorder);
1095 if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1096 print_liste_field_titre($arrayfields[
't.label_operation'][
'label'], $_SERVER[
'PHP_SELF'],
"t.label_operation",
"", $param,
"", $sortfield, $sortorder);
1098 if (!empty($arrayfields[
't.debit'][
'checked'])) {
1099 print_liste_field_titre($arrayfields[
't.debit'][
'label'], $_SERVER[
'PHP_SELF'],
"t.debit",
"", $param,
'', $sortfield, $sortorder,
'right ');
1101 if (!empty($arrayfields[
't.credit'][
'checked'])) {
1102 print_liste_field_titre($arrayfields[
't.credit'][
'label'], $_SERVER[
'PHP_SELF'],
"t.credit",
"", $param,
'', $sortfield, $sortorder,
'right ');
1104 if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1105 print_liste_field_titre($arrayfields[
't.lettering_code'][
'label'], $_SERVER[
'PHP_SELF'],
"t.lettering_code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1108 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
1109 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1110 print $hookmanager->resPrint;
1111 if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1112 print_liste_field_titre($arrayfields[
't.date_creation'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center ');
1114 if (!empty($arrayfields[
't.tms'][
'checked'])) {
1115 print_liste_field_titre($arrayfields[
't.tms'][
'label'], $_SERVER[
'PHP_SELF'],
"t.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
1117 if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1118 print_liste_field_titre($arrayfields[
't.date_export'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_export",
"", $param,
'', $sortfield, $sortorder,
'center ');
1120 if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1121 print_liste_field_titre($arrayfields[
't.date_validated'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_validated",
"", $param,
'', $sortfield, $sortorder,
'center ');
1123 if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1124 print_liste_field_titre($arrayfields[
't.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"t.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1126 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1135 $totalarray = array();
1136 $totalarray[
'val'] = array ();
1137 $totalarray[
'nbfield'] = 0;
1140 $totalarray[
'val'][
'totaldebit'] = 0;
1141 $totalarray[
'val'][
'totalcredit'] = 0;
1143 while ($i < min($num, $limit)) {
1144 $obj = $db->fetch_object(
$resql);
1149 $line->id = $obj->rowid;
1150 $line->doc_date = $db->jdate($obj->doc_date);
1151 $line->doc_type = $obj->doc_type;
1152 $line->doc_ref = $obj->doc_ref;
1153 $line->fk_doc = $obj->fk_doc;
1154 $line->fk_docdet = $obj->fk_docdet;
1155 $line->thirdparty_code = $obj->thirdparty_code;
1156 $line->subledger_account = $obj->subledger_account;
1157 $line->subledger_label = $obj->subledger_label;
1158 $line->numero_compte = $obj->numero_compte;
1159 $line->label_compte = $obj->label_compte;
1160 $line->label_operation = $obj->label_operation;
1161 $line->debit = $obj->debit;
1162 $line->credit = $obj->credit;
1163 $line->montant = $obj->amount;
1164 $line->amount = $obj->amount;
1165 $line->sens = $obj->sens;
1166 $line->lettering_code = $obj->lettering_code;
1167 $line->fk_user_author = $obj->fk_user_author;
1168 $line->import_key = $obj->import_key;
1169 $line->code_journal = $obj->code_journal;
1170 $line->journal_label = $obj->journal_label;
1171 $line->piece_num = $obj->piece_num;
1172 $line->date_creation = $db->jdate($obj->date_creation);
1173 $line->date_modification = $db->jdate($obj->date_modification);
1174 $line->date_export = $db->jdate($obj->date_export);
1175 $line->date_validation = $db->jdate($obj->date_validation);
1177 $total_debit += $line->debit;
1178 $total_credit += $line->credit;
1180 print
'<tr class="oddeven">';
1183 if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
1185 $object->id = $line->id;
1186 $object->piece_num = $line->piece_num;
1187 print $object->getNomUrl(1,
'', 0,
'', 1);
1190 $totalarray[
'nbfield']++;
1195 if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
1197 $result = $accountingjournal->fetch(
'', $line->code_journal);
1198 $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0,
'', 0) : $line->code_journal);
1199 print
'<td class="center">'.$journaltoshow.
'</td>';
1201 $totalarray[
'nbfield']++;
1206 if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1207 print
'<td class="center">'.dol_print_date($line->doc_date,
'day').
'</td>';
1209 $totalarray[
'nbfield']++;
1214 if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1215 if ($line->doc_type ==
'customer_invoice') {
1216 $langs->loadLangs(array(
'bills'));
1218 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
1219 $objectstatic =
new Facture($db);
1220 $objectstatic->fetch($line->fk_doc);
1225 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$objectstatic->id;
1226 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1227 } elseif ($line->doc_type ==
'supplier_invoice') {
1228 $langs->loadLangs(array(
'bills'));
1230 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
1232 $objectstatic->fetch($line->fk_doc);
1236 $filedir = $conf->fournisseur->facture->dir_output.
'/'.
get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
1237 $subdir =
get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
1238 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
1239 } elseif ($line->doc_type ==
'expense_report') {
1240 $langs->loadLangs(array(
'trips'));
1242 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
1244 $objectstatic->fetch($line->fk_doc);
1249 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$objectstatic->id;
1250 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1251 } elseif ($line->doc_type ==
'bank') {
1252 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
1254 $objectstatic->fetch($line->fk_doc);
1260 $labeltoshowalt =
'';
1261 if ($line->doc_type ==
'customer_invoice' || $line->doc_type ==
'supplier_invoice' || $line->doc_type ==
'expense_report') {
1262 $labeltoshow .= $objectstatic->getNomUrl(1,
'', 0, 0,
'', 0, -1, 1);
1263 $labeltoshow .= $documentlink;
1264 $labeltoshowalt .= $objectstatic->ref;
1265 } elseif ($line->doc_type ==
'bank') {
1266 $labeltoshow .= $objectstatic->getNomUrl(1);
1267 $labeltoshowalt .= $objectstatic->ref;
1268 $bank_ref = strstr($line->doc_ref,
'-');
1269 $labeltoshow .=
" " . $bank_ref;
1270 $labeltoshowalt .=
" " . $bank_ref;
1272 $labeltoshow .= $line->doc_ref;
1273 $labeltoshowalt .= $line->doc_ref;
1276 print
'<td class="nowraponall tdoverflowmax200" title="'.dol_escape_htmltag($labeltoshowalt).
'">';
1280 $totalarray[
'nbfield']++;
1285 if (!empty($arrayfields[
't.numero_compte'][
'checked'])) {
1286 print
'<td>'.length_accountg($line->numero_compte).
'</td>';
1288 $totalarray[
'nbfield']++;
1293 if (!empty($arrayfields[
't.subledger_account'][
'checked'])) {
1294 print
'<td>'.length_accounta($line->subledger_account).
'</td>';
1296 $totalarray[
'nbfield']++;
1301 if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1302 print
'<td class="small tdoverflowmax200" title="'.dol_escape_htmltag($line->label_operation).
'">'.
dol_escape_htmltag($line->label_operation).
'</td>';
1304 $totalarray[
'nbfield']++;
1309 if (!empty($arrayfields[
't.debit'][
'checked'])) {
1310 print
'<td class="right nowraponall amount">'.($line->debit != 0 ?
price($line->debit) :
'').
'</td>';
1312 $totalarray[
'nbfield']++;
1315 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totaldebit';
1317 $totalarray[
'val'][
'totaldebit'] += $line->debit;
1321 if (!empty($arrayfields[
't.credit'][
'checked'])) {
1322 print
'<td class="right nowraponall amount">'.($line->credit != 0 ?
price($line->credit) :
'').
'</td>';
1324 $totalarray[
'nbfield']++;
1327 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalcredit';
1329 $totalarray[
'val'][
'totalcredit'] += $line->credit;
1333 if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1334 print
'<td class="center">'.$line->lettering_code.
'</td>';
1336 $totalarray[
'nbfield']++;
1341 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1342 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1343 print $hookmanager->resPrint;
1346 if (!empty($arrayfields[
't.date_creation'][
'checked'])) {
1347 print
'<td class="center">'.dol_print_date($line->date_creation,
'dayhour').
'</td>';
1349 $totalarray[
'nbfield']++;
1354 if (!empty($arrayfields[
't.tms'][
'checked'])) {
1355 print
'<td class="center">'.dol_print_date($line->date_modification,
'dayhour').
'</td>';
1357 $totalarray[
'nbfield']++;
1362 if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1363 print
'<td class="center nowraponall">'.dol_print_date($line->date_export,
'dayhour').
'</td>';
1365 $totalarray[
'nbfield']++;
1370 if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1371 print
'<td class="center nowraponall">'.dol_print_date($line->date_validation,
'dayhour').
'</td>';
1373 $totalarray[
'nbfield']++;
1377 if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1378 print
'<td class="tdoverflowmax100">'.$obj->import_key.
"</td>\n";
1380 $totalarray[
'nbfield']++;
1385 print
'<td class="nowraponall center">';
1386 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
1388 if (in_array($line->id, $arrayofselected)) {
1391 print
'<input id="cb'.$line->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.
'"'.($selected ?
' checked="checked"' :
'').
' />';
1396 $totalarray[
'nbfield']++;
1405 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
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_now($mode= 'auto')
Return date for now.
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).
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default= '')
Return dolibarr global constant string value.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage bank transaction lines.
Class to manage suppliers invoices.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
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...
Class to manage Ledger (General Ledger and Subledger)
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart= '')
Return a path to have a the directory according to object where files are stored. ...
dol_getdate($timestamp, $fast=false, $forcetimezone= '')
Return an array with locale date info.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
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...
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
Class to manage Trips and Expenses.
if(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->supplier_invoice->lire)) if(isModEnabled('don')&&!empty($user->rights->don->lire)) if(isModEnabled('tax')&&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture')&&isModEnabled('commande')&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Manage the different format accountancy export.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
isModEnabled($module)
Is Dolibarr module enabled.
Class to manage accounting accounts.
Class to manage invoices.
$formconfirm
if ($action == 'delbookkeepingyear') {