30require
'../../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/lettering.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeeping.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
50$langs->loadLangs(array(
"accountancy",
"compta"));
52$action =
GETPOST(
'action',
'aZ09');
54$massaction =
GETPOST(
'massaction',
'alpha');
55$confirm =
GETPOST(
'confirm',
'alpha');
56$toselect =
GETPOST(
'toselect',
'array');
57$type =
GETPOST(
'type',
'alpha');
59 $context_default =
'bookkeepingbysubaccountlist';
61 $context_default =
'bookkeepingbyaccountlist';
63$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : $context_default;
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_export_startyear =
GETPOSTINT(
'search_date_export_startyear');
74$search_date_export_startmonth =
GETPOSTINT(
'search_date_export_startmonth');
75$search_date_export_startday =
GETPOSTINT(
'search_date_export_startday');
76$search_date_export_endyear =
GETPOSTINT(
'search_date_export_endyear');
77$search_date_export_endmonth =
GETPOSTINT(
'search_date_export_endmonth');
78$search_date_export_endday =
GETPOSTINT(
'search_date_export_endday');
79$search_date_export_start =
dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
80$search_date_export_end =
dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
81$search_date_validation_startyear =
GETPOSTINT(
'search_date_validation_startyear');
82$search_date_validation_startmonth =
GETPOSTINT(
'search_date_validation_startmonth');
83$search_date_validation_startday =
GETPOSTINT(
'search_date_validation_startday');
84$search_date_validation_endyear =
GETPOSTINT(
'search_date_validation_endyear');
85$search_date_validation_endmonth =
GETPOSTINT(
'search_date_validation_endmonth');
86$search_date_validation_endday =
GETPOSTINT(
'search_date_validation_endday');
87$search_date_validation_start =
dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear);
88$search_date_validation_end =
dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
90$search_date_due_start_day =
GETPOSTINT(
'search_date_due_start_day');
91$search_date_due_start_month =
GETPOSTINT(
'search_date_due_start_month');
92$search_date_due_start_year =
GETPOSTINT(
'search_date_due_start_year');
93$search_date_due_start =
dol_mktime(0, 0, 0, $search_date_due_start_month, $search_date_due_start_day, $search_date_due_start_year);
95$search_date_due_end_day =
GETPOSTINT(
'search_date_due_end_day');
96$search_date_due_end_month =
GETPOSTINT(
'search_date_due_end_month');
97$search_date_due_end_year =
GETPOSTINT(
'search_date_due_end_year');
98$search_date_due_end =
dol_mktime(23, 59, 59, $search_date_due_end_month, $search_date_due_end_day, $search_date_due_end_year);
99$search_import_key =
GETPOST(
"search_import_key",
'alpha');
101$search_account_category =
GETPOSTINT(
'search_account_category');
103$search_accountancy_code_start =
GETPOST(
'search_accountancy_code_start',
'alpha');
104if ($search_accountancy_code_start == - 1) {
105 $search_accountancy_code_start =
'';
107$search_accountancy_code_end =
GETPOST(
'search_accountancy_code_end',
'alpha');
108if ($search_accountancy_code_end == - 1) {
109 $search_accountancy_code_end =
'';
111$search_doc_ref =
GETPOST(
'search_doc_ref',
'alpha');
112$search_label_operation =
GETPOST(
'search_label_operation',
'alpha');
113$search_mvt_num =
GETPOST(
'search_mvt_num',
'alpha');
114$search_direction =
GETPOST(
'search_direction',
'alpha');
115$search_ledger_code =
GETPOST(
'search_ledger_code',
'array');
116$search_debit =
GETPOST(
'search_debit',
'alpha');
117$search_credit =
GETPOST(
'search_credit',
'alpha');
118$search_lettering_code =
GETPOST(
'search_lettering_code',
'alpha');
119$search_not_reconciled =
GETPOST(
'search_not_reconciled',
'alpha');
122 $action =
'delbookkeepingyear';
127$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
128$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
129$optioncss =
GETPOST(
'optioncss',
'alpha');
131if (empty($page) || $page < 0) {
134$offset = $limit * $page;
135$pageprev = $page - 1;
136$pagenext = $page + 1;
137if ($sortorder ==
"") {
140if ($sortfield ==
"") {
141 $sortfield =
"t.doc_date,t.rowid";
147$hookmanager->initHooks(array($context_default));
150$form =
new Form($db);
152if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET(
'search_date_startday') && !GETPOSTISSET(
'search_date_startmonth') && !GETPOSTISSET(
'search_date_starthour')) {
153 $sql =
"SELECT date_start, date_end from ".MAIN_DB_PREFIX.
"accounting_fiscalyear ";
154 $sql .=
" where date_start < '".$db->idate(
dol_now()).
"' and date_end > '".$db->idate(
dol_now()).
"'";
155 $sql .= $db->plimit(1);
156 $res = $db->query($sql);
158 if ($res !==
false && $db->num_rows($res) > 0) {
159 $fiscalYear = $db->fetch_object($res);
160 $search_date_start = strtotime($fiscalYear->date_start);
161 $search_date_end = strtotime($fiscalYear->date_end);
168 $year_end = $year_start + 1;
169 $month_end = $month_start - 1;
170 if ($month_end < 1) {
174 $search_date_start =
dol_mktime(0, 0, 0, $month_start, 1, $year_start);
181 't.piece_num' => array(
'label' => $langs->trans(
"TransactionNumShort"),
'checked' => 1),
182 't.code_journal' => array(
'label' => $langs->trans(
"Codejournal"),
'checked' => 1),
183 't.doc_date' => array(
'label' => $langs->trans(
"Docdate"),
'checked' => 1),
184 't.doc_ref' => array(
'label' => $langs->trans(
"Piece"),
'checked' => 1),
185 't.label_operation' => array(
'label' => $langs->trans(
"Label"),
'checked' => 1),
186 't.lettering_code' => array(
'label' => $langs->trans(
"Lettering"),
'checked' => 1),
187 't.debit' => array(
'label' => $langs->trans(
"AccountingDebit"),
'checked' => 1),
188 't.credit' => array(
'label' => $langs->trans(
"AccountingCredit"),
'checked' => 1),
189 't.balance' => array(
'label' => $langs->trans(
"Balance"),
'checked' => 1),
190 't.date_export' => array(
'label' => $langs->trans(
"DateExport"),
'checked' => -1),
191 't.date_validated' => array(
'label' => $langs->trans(
"DateValidation"),
'checked' => -1,
'enabled' => !
getDolGlobalString(
"ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
192 't.date_lim_reglement' => array(
'label' => $langs->trans(
"DateDue"),
'checked' => 0),
193 't.import_key' => array(
'label' => $langs->trans(
"ImportId"),
'checked' => -1,
'position' => 1100),
197 unset($arrayfields[
't.lettering_code']);
200if ($search_date_start && empty($search_date_startyear)) {
202 $search_date_startyear = $tmparray[
'year'];
203 $search_date_startmonth = $tmparray[
'mon'];
204 $search_date_startday = $tmparray[
'mday'];
206if ($search_date_end && empty($search_date_endyear)) {
208 $search_date_endyear = $tmparray[
'year'];
209 $search_date_endmonth = $tmparray[
'mon'];
210 $search_date_endday = $tmparray[
'mday'];
213if (!isModEnabled(
'accounting')) {
216if ($user->socid > 0) {
219if (!$user->hasRight(
'accounting',
'mouvements',
'lire')) {
227$permissiontoadd = $user->hasRight(
'accounting',
'mouvements',
'creer');
238if (
GETPOST(
'cancel',
'alpha')) {
242if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'preunletteringauto' && $massaction !=
'preunletteringmanual' && $massaction !=
'predeletebookkeepingwriting') {
246$parameters = array(
'socid' => $socid);
247$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
252if (empty($reshook)) {
253 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
255 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
256 $search_doc_date =
'';
257 $search_account_category =
'';
258 $search_accountancy_code_start =
'';
259 $search_accountancy_code_end =
'';
260 $search_label_account =
'';
261 $search_doc_ref =
'';
262 $search_label_operation =
'';
263 $search_mvt_num =
'';
264 $search_direction =
'';
265 $search_ledger_code = array();
266 $search_date_start =
'';
267 $search_date_end =
'';
268 $search_date_startyear =
'';
269 $search_date_startmonth =
'';
270 $search_date_startday =
'';
271 $search_date_endyear =
'';
272 $search_date_endmonth =
'';
273 $search_date_endday =
'';
274 $search_date_export_start =
'';
275 $search_date_export_end =
'';
276 $search_date_export_startyear =
'';
277 $search_date_export_startmonth =
'';
278 $search_date_export_startday =
'';
279 $search_date_export_endyear =
'';
280 $search_date_export_endmonth =
'';
281 $search_date_export_endday =
'';
282 $search_date_validation_start =
'';
283 $search_date_validation_end =
'';
284 $search_date_validation_startyear =
'';
285 $search_date_validation_startmonth =
'';
286 $search_date_validation_startday =
'';
287 $search_date_validation_endyear =
'';
288 $search_date_validation_endmonth =
'';
289 $search_date_validation_endday =
'';
291 $search_date_due_start_day =
'';
292 $search_date_due_start_month =
'';
293 $search_date_due_start_year =
'';
294 $search_date_due_start =
'';
296 $search_date_due_end_day =
'';
297 $search_date_due_end_month =
'';
298 $search_date_due_end_year =
'';
299 $search_date_due_end =
'';
300 $search_lettering_code =
'';
303 $search_not_reconciled =
'';
304 $search_import_key =
'';
308 if (!empty($search_date_start)) {
309 $filter[
't.doc_date>='] = $search_date_start;
310 $param .=
'&search_date_startmonth='.$search_date_startmonth.
'&search_date_startday='.$search_date_startday.
'&search_date_startyear='.$search_date_startyear;
312 if (!empty($search_date_end)) {
313 $filter[
't.doc_date<='] = $search_date_end;
314 $param .=
'&search_date_endmonth='.$search_date_endmonth.
'&search_date_endday='.$search_date_endday.
'&search_date_endyear='.$search_date_endyear;
316 if (!empty($search_doc_date)) {
317 $filter[
't.doc_date'] = $search_doc_date;
318 $param .=
'&doc_datemonth='.GETPOSTINT(
'doc_datemonth').
'&doc_dateday='.
GETPOSTINT(
'doc_dateday').
'&doc_dateyear='.
GETPOSTINT(
'doc_dateyear');
320 if ($search_account_category !=
'-1' && !empty($search_account_category)) {
321 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountancycategory.class.php';
324 $listofaccountsforgroup = $accountingcategory->getCptsCat(0,
'fk_accounting_category = '.((
int) $search_account_category));
325 $listofaccountsforgroup2 = array();
326 if (is_array($listofaccountsforgroup)) {
327 foreach ($listofaccountsforgroup as $tmpval) {
328 $listofaccountsforgroup2[] =
"'".$db->escape($tmpval[
'account_number']).
"'";
331 $filter[
't.search_accounting_code_in'] = implode(
',', $listofaccountsforgroup2);
332 $param .=
'&search_account_category='.urlencode((
string) ($search_account_category));
334 if (!empty($search_accountancy_code_start)) {
335 if ($type ==
'sub') {
336 $filter[
't.subledger_account>='] = $search_accountancy_code_start;
338 $filter[
't.numero_compte>='] = $search_accountancy_code_start;
340 $param .=
'&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
342 if (!empty($search_accountancy_code_end)) {
343 if ($type ==
'sub') {
344 $filter[
't.subledger_account<='] = $search_accountancy_code_end;
346 $filter[
't.numero_compte<='] = $search_accountancy_code_end;
348 $param .=
'&search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
350 if (!empty($search_label_account)) {
351 $filter[
't.label_compte'] = $search_label_account;
352 $param .=
'&search_label_compte='.urlencode($search_label_account);
354 if (!empty($search_mvt_num)) {
355 $filter[
't.piece_num'] = $search_mvt_num;
356 $param .=
'&search_mvt_num='.urlencode((
string) ($search_mvt_num));
358 if (!empty($search_doc_ref)) {
359 $filter[
't.doc_ref'] = $search_doc_ref;
360 $param .=
'&search_doc_ref='.urlencode($search_doc_ref);
362 if (!empty($search_label_operation)) {
363 $filter[
't.label_operation'] = $search_label_operation;
364 $param .=
'&search_label_operation='.urlencode($search_label_operation);
366 if (!empty($search_direction)) {
367 $filter[
't.sens'] = $search_direction;
368 $param .=
'&search_direction='.urlencode($search_direction);
370 if (!empty($search_ledger_code)) {
371 $filter[
't.code_journal'] = $search_ledger_code;
372 foreach ($search_ledger_code as $code) {
373 $param .=
'&search_ledger_code[]='.urlencode($code);
376 if (!empty($search_lettering_code)) {
377 $filter[
't.lettering_code'] = $search_lettering_code;
378 $param .=
'&search_lettering_code='.urlencode($search_lettering_code);
380 if (!empty($search_debit)) {
381 $filter[
't.debit'] = $search_debit;
382 $param .=
'&search_debit='.urlencode($search_debit);
384 if (!empty($search_credit)) {
385 $filter[
't.credit'] = $search_credit;
386 $param .=
'&search_credit='.urlencode($search_credit);
388 if (!empty($search_not_reconciled)) {
389 $filter[
't.reconciled_option'] = $search_not_reconciled;
390 $param .=
'&search_not_reconciled='.urlencode($search_not_reconciled);
392 if (!empty($search_date_export_start)) {
393 $filter[
't.date_export>='] = $search_date_export_start;
394 $param .=
'&search_date_export_startmonth='.$search_date_export_startmonth.
'&search_date_export_startday='.$search_date_export_startday.
'&search_date_export_startyear='.$search_date_export_startyear;
396 if (!empty($search_date_export_end)) {
397 $filter[
't.date_export<='] = $search_date_export_end;
398 $param .=
'&search_date_export_endmonth='.$search_date_export_endmonth.
'&search_date_export_endday='.$search_date_export_endday.
'&search_date_export_endyear='.$search_date_export_endyear;
400 if (!empty($search_date_validation_start)) {
401 $filter[
't.date_validated>='] = $search_date_validation_start;
402 $param .=
'&search_date_validation_startmonth='.$search_date_validation_startmonth.
'&search_date_validation_startday='.$search_date_validation_startday.
'&search_date_validation_startyear='.$search_date_validation_startyear;
404 if (!empty($search_date_validation_end)) {
405 $filter[
't.date_validated<='] = $search_date_validation_end;
406 $param .=
'&search_date_validation_endmonth='.$search_date_validation_endmonth.
'&search_date_validation_endday='.$search_date_validation_endday.
'&search_date_validation_endyear='.$search_date_validation_endyear;
409 if (!empty($search_date_due_start)) {
410 $filter[
't.date_lim_reglement>='] = $search_date_due_start;
411 $param .=
'&search_date_due_start_day='.$search_date_due_start_day.
'&search_date_due_start_month='.$search_date_due_start_month.
'&search_date_due_start_year='.$search_date_due_start_year;
414 if (!empty($search_date_due_end)) {
415 $filter[
't.date_lim_reglement<='] = $search_date_due_end;
416 $param .=
'&search_date_due_end_day='.$search_date_due_end_day.
'&search_date_due_end_month='.$search_date_due_end_month.
'&search_date_due_end_year='.$search_date_due_end_year;
418 if (!empty($search_import_key)) {
419 $filter[
't.import_key'] = $search_import_key;
420 $param .=
'&search_import_key='.urlencode($search_import_key);
423 $url_param = substr($param, 1);
425 $param =
'&type='.$type.$param;
456 $objectclass =
'Bookkeeping';
457 $objectlabel =
'Bookkeeping';
458 $permissiontoread = $user->hasRight(
'societe',
'lire');
459 $permissiontodelete = $user->hasRight(
'societe',
'supprimer');
460 $permissiontoadd = $user->hasRight(
'societe',
'creer');
461 $uploaddir =
$conf->societe->dir_output;
464 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
466 if (!$error && $action ==
'deletebookkeepingwriting' && $confirm ==
"yes" && $user->hasRight(
'accounting',
'mouvements',
'supprimer')) {
471 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect,
true);
472 if ($nb_lettering < 0) {
480 foreach ($toselect as $toselectid) {
481 $result =
$object->fetch($toselectid);
482 if ($result > 0 && (!isset(
$object->date_validation) ||
$object->date_validation ===
'')) {
491 } elseif ($result < 0) {
495 } elseif (isset(
$object->date_validation) &&
$object->date_validation !=
'') {
496 setEventMessages($langs->trans(
"ValidatedRecordWhereFound"),
null,
'errors');
509 } elseif ($nbok > 0) {
515 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?noreset=1".($param ?
'&'.$param :
''));
524 if ($massaction ==
'letteringauto' && $permissiontoadd) {
526 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
527 if ($nb_lettering < 0) {
530 $nb_lettering = max(0, abs($nb_lettering) - 2);
531 } elseif ($nb_lettering == 0) {
533 setEventMessages($langs->trans(
'AccountancyNoLetteringModified'), array(),
'mesgs');
535 if ($nb_lettering == 1) {
536 setEventMessages($langs->trans(
'AccountancyOneLetteringModifiedSuccessfully'), array(),
'mesgs');
537 } elseif ($nb_lettering > 1) {
538 setEventMessages($langs->trans(
'AccountancyLetteringModifiedSuccessfully', $nb_lettering), array(),
'mesgs');
542 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
545 } elseif ($massaction ==
'letteringmanual' && $permissiontoadd) {
547 $result = $lettering->updateLettering($toselect);
551 setEventMessages($langs->trans($result == 0 ?
'AccountancyNoLetteringModified' :
'AccountancyOneLetteringModifiedSuccessfully'), array(),
'mesgs');
552 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
555 } elseif ($type ==
'sub' && $massaction ==
'letteringpartial') {
557 $result = $lettering->updateLettering($toselect,
false,
true);
561 setEventMessages($langs->trans($result == 0 ?
'AccountancyNoLetteringModified' :
'AccountancyOneLetteringModifiedSuccessfully'), array(),
'mesgs');
562 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
565 } elseif ($action ==
'unletteringauto' && $confirm ==
"yes" && $permissiontoadd) {
567 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect,
true);
568 if ($nb_lettering < 0) {
571 $nb_lettering = max(0, abs($nb_lettering) - 2);
572 } elseif ($nb_lettering == 0) {
574 setEventMessages($langs->trans(
'AccountancyNoUnletteringModified'), array(),
'mesgs');
576 if ($nb_lettering == 1) {
577 setEventMessages($langs->trans(
'AccountancyOneUnletteringModifiedSuccessfully'), array(),
'mesgs');
578 } elseif ($nb_lettering > 1) {
579 setEventMessages($langs->trans(
'AccountancyUnletteringModifiedSuccessfully', $nb_lettering), array(),
'mesgs');
583 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
586 } elseif ($action ==
'unletteringmanual' && $confirm ==
"yes" && $permissiontoadd) {
588 $nb_lettering = $lettering->deleteLettering($toselect);
592 setEventMessages($langs->trans($result == 0 ?
'AccountancyNoUnletteringModified' :
'AccountancyOneUnletteringModifiedSuccessfully'), array(),
'mesgs');
593 header(
'Location: ' . $_SERVER[
'PHP_SELF'] .
'?noreset=1' . $param);
608$form =
new Form($db);
610$title_page = $langs->trans(
"Operations").
' - '.$langs->trans(
"VueByAccountAccounting").
' (';
612 $title_page .= $langs->trans(
"BookkeepingSubAccount");
614 $title_page .= $langs->trans(
"Bookkeeping");
617$help_url =
'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double';
618llxHeader(
'', $title_page, $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy accountancy-consultation page-'.(($type ==
'sub') ?
'sub' :
'').
'ledger');
621$nbtotalofrecords =
'';
624 if ($type ==
'sub') {
625 $nbtotalofrecords =
$object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter,
'AND', 1, 1);
627 $nbtotalofrecords =
$object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter,
'AND', 0, 1);
630 if ($nbtotalofrecords < 0) {
638 if ($type ==
'sub') {
639 $result =
$object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter,
'AND', 1);
641 $result =
$object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter,
'AND', 0);
651$arrayofselected = is_array($toselect) ? $toselect : array();
699$arrayofmassactions = array();
700if (
getDolGlobalInt(
'ACCOUNTING_ENABLE_LETTERING') && $user->hasRight(
'accounting',
'mouvements',
'creer')) {
701 $arrayofmassactions[
'letteringauto'] =
img_picto(
'',
'check',
'class="pictofixedwidth"') . $langs->trans(
'LetteringAuto');
702 $arrayofmassactions[
'preunletteringauto'] =
img_picto(
'',
'uncheck',
'class="pictofixedwidth"') . $langs->trans(
'UnletteringAuto');
703 $arrayofmassactions[
'letteringmanual'] =
img_picto(
'',
'check',
'class="pictofixedwidth"') . $langs->trans(
'LetteringManual');
704 if ($type ==
'sub') {
705 $arrayofmassactions[
'letteringpartial'] =
img_picto(
'',
'check',
'class="pictofixedwidth"') . $langs->trans(
'LetteringPartial');
707 $arrayofmassactions[
'preunletteringmanual'] =
img_picto(
'',
'uncheck',
'class="pictofixedwidth"') . $langs->trans(
'UnletteringManual');
709if ($user->hasRight(
'accounting',
'mouvements',
'supprimer')) {
710 $arrayofmassactions[
'predeletebookkeepingwriting'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
712if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'preunletteringauto',
'preunletteringmanual',
'predeletebookkeepingwriting'))) {
713 $arrayofmassactions = array();
715$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
717print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
718print
'<input type="hidden" name="token" value="'.newToken().
'">';
719print
'<input type="hidden" name="action" value="list">';
720if ($optioncss !=
'') {
721 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
723print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
724print
'<input type="hidden" name="type" value="'.$type.
'">';
725print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
726print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
727print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
729$parameters = array(
'param' => $param);
730$reshook = $hookmanager->executeHooks(
'addMoreActionsButtonsList', $parameters, $object, $action);
735$newcardbutton = empty($hookmanager->resPrint) ?
'' : $hookmanager->resPrint;
737if (empty($reshook)) {
738 $newcardbutton =
dolGetButtonTitle($langs->trans(
'ViewFlatList'),
'',
'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.
'/accountancy/bookkeeping/list.php?'.$param);
739 if ($type ==
'sub') {
740 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'GroupByAccountAccounting'),
'',
'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT .
'/accountancy/bookkeeping/listbyaccount.php?' . $url_param,
'', 1, array(
'morecss' =>
'marginleftonly'));
741 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'GroupBySubAccountAccounting'),
'',
'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT .
'/accountancy/bookkeeping/listbyaccount.php?type=sub&' . $url_param,
'', 1, array(
'morecss' =>
'marginleftonly btnTitleSelected'));
743 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'GroupByAccountAccounting'),
'',
'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT .
'/accountancy/bookkeeping/listbyaccount.php?' . $url_param,
'', 1, array(
'morecss' =>
'marginleftonly btnTitleSelected'));
744 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'GroupBySubAccountAccounting'),
'',
'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT .
'/accountancy/bookkeeping/listbyaccount.php?type=sub&' . $url_param,
'', 1, array(
'morecss' =>
'marginleftonly'));
747 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewAccountingMvt'),
'',
'fa fa-plus-circle paddingleft', DOL_URL_ROOT.
'/accountancy/bookkeeping/card.php?action=create');
750if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
751 $param .=
'&contextpage='.urlencode($contextpage);
753if ($limit > 0 && $limit !=
$conf->liste_limit) {
754 $param .=
'&limit='.((int) $limit);
757print_barre_liste($title_page, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'title_accountancy', 0, $newcardbutton,
'', $limit, 0, 0, 1);
759if ($massaction ==
'preunletteringauto') {
760 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassUnletteringAuto"), $langs->trans(
"ConfirmMassUnletteringQuestion", count($toselect)),
"unletteringauto",
null,
'', 0, 200, 500, 1);
761} elseif ($massaction ==
'preunletteringmanual') {
762 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassUnletteringManual"), $langs->trans(
"ConfirmMassUnletteringQuestion", count($toselect)),
"unletteringmanual",
null,
'', 0, 200, 500, 1);
763} elseif ($massaction ==
'predeletebookkeepingwriting') {
764 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDeleteBookkeepingWriting"), $langs->trans(
"ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)),
"deletebookkeepingwriting",
null,
'', 0, 200, 500, 1);
777include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
779$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
780$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
781if ($massactionbutton && $contextpage !=
'poslist') {
782 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
786if (preg_match(
'/^asc/i', $sortorder)) {
794 print
info_admin($langs->trans(
"WarningRecordWithoutSubledgerAreExcluded"));
800$moreforfilter .=
'<div class="divsearchfield">';
801$moreforfilter .= $langs->trans(
'AccountAccounting').
': ';
802$moreforfilter .=
'<div class="nowrap inline-block">';
805 $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start,
'search_accountancy_code_start', $langs->trans(
'From'),
'maxwidth200');
807 $moreforfilter .=
'<input type="text" class="maxwidth150" name="search_accountancy_code_start" value="'.dol_escape_htmltag($search_accountancy_code_start).
'" placeholder="'.$langs->trans(
'From').
'">';
810 $moreforfilter .= $formaccounting->select_account($search_accountancy_code_start,
'search_accountancy_code_start', $langs->trans(
'From'), array(), 1, 1,
'maxwidth200');
812$moreforfilter .=
' ';
815 $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end,
'search_accountancy_code_end', $langs->trans(
'to'),
'maxwidth200');
817 $moreforfilter .=
'<input type="text" class="maxwidth150" name="search_accountancy_code_end" value="'.dol_escape_htmltag($search_accountancy_code_end).
'" placeholder="'.$langs->trans(
'to').
'">';
820 $moreforfilter .= $formaccounting->select_account($search_accountancy_code_end,
'search_accountancy_code_end', $langs->trans(
'to'), array(), 1, 1,
'maxwidth200');
822$stringforfirstkey = $langs->trans(
"KeyboardShortcut");
823if (
$conf->browser->name ==
'chrome') {
824 $stringforfirstkey .=
' ALT +';
825} elseif (
$conf->browser->name ==
'firefox') {
826 $stringforfirstkey .=
' ALT + SHIFT +';
828 $stringforfirstkey .=
' CTL +';
830$moreforfilter .=
' <a id="previous_account" accesskey="p" title="' . $stringforfirstkey .
' p" class="classfortooltip" href="#"><i class="fa fa-chevron-left"></i></a>';
831$moreforfilter .=
' <a id="next_account" accesskey="n" title="' . $stringforfirstkey .
' n" class="classfortooltip" href="#"><i class="fa fa-chevron-right"></i></a>';
832$moreforfilter .= <<<SCRIPT
833<script
type=
"text/javascript">
834 jQuery(document).ready(
function() {
835 var searchFormList = $(
'#searchFormList');
836 var searchAccountancyCodeStart = $(
'#search_accountancy_code_start');
837 var searchAccountancyCodeEnd = $(
'#search_accountancy_code_end');
838 jQuery(
'#previous_account').on(
'click',
function() {
839 var previousOption = searchAccountancyCodeStart.find(
'option:selected').prev(
'option');
840 if (previousOption.length == 1) searchAccountancyCodeStart.val(previousOption.attr(
'value'));
841 searchAccountancyCodeEnd.val(searchAccountancyCodeStart.val());
842 searchFormList.submit();
844 jQuery(
'#next_account').on(
'click',
function() {
845 var nextOption = searchAccountancyCodeStart.find(
'option:selected').next(
'option');
846 if (nextOption.length == 1) searchAccountancyCodeStart.val(nextOption.attr(
'value'));
847 searchAccountancyCodeEnd.val(searchAccountancyCodeStart.val());
848 searchFormList.submit();
850 jQuery(
'input[name="search_mvt_num"]').on(
"keypress",
function(event) {
856$moreforfilter .=
'</div>';
857$moreforfilter .=
'</div>';
859$moreforfilter .=
'<div class="divsearchfield">';
860$moreforfilter .= $langs->trans(
'AccountingCategory').
': ';
861$moreforfilter .=
'<div class="nowrap inline-block">';
862$moreforfilter .= $formaccounting->select_accounting_category($search_account_category,
'search_account_category', 1, 0, 0, 0);
863$moreforfilter .=
'</div>';
864$moreforfilter .=
'</div>';
866$parameters = array();
867$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
868if (empty($reshook)) {
869 $moreforfilter .= $hookmanager->resPrint;
871 $moreforfilter = $hookmanager->resPrint;
874print
'<div class="liste_titre liste_titre_bydiv centpercent">';
878print
'<div class="div-table-responsive">';
879print
'<table class="tagtable liste centpercent listwithfilterbefore">';
882print
'<tr class="liste_titre_filter">';
885 print
'<td class="liste_titre center">';
886 $searchpicto = $form->showFilterButtons(
'left');
891if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
892 print
'<td class="liste_titre"><input type="text" name="search_mvt_num" class="width50" value="'.dol_escape_htmltag($search_mvt_num).
'"></td>';
895if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
896 print
'<td class="liste_titre center">';
897 print $formaccounting->multi_select_journal($search_ledger_code,
'search_ledger_code', 0, 1, 1, 1,
'maxwidth75');
901if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
902 print
'<td class="liste_titre center">';
903 print
'<div class="nowrapfordate">';
904 print $form->selectDate($search_date_start,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
906 print
'<div class="nowrapfordate">';
907 print $form->selectDate($search_date_end,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
912if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
913 print
'<td class="liste_titre"><input type="text" size="7" class="flat" name="search_doc_ref" value="'.dol_escape_htmltag($search_doc_ref).
'"/></td>';
916if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
917 print
'<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_operation" value="'.dol_escape_htmltag($search_label_operation).
'"/></td>';
920if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
921 print
'<td class="liste_titre center">';
922 print
'<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.
'"/>';
923 print
'<br><span class="nowrap"><input type="checkbox" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled ==
'notreconciled' ?
' checked' :
'').
'>'.$langs->trans(
"NotReconciled").
'</span>';
927if (!empty($arrayfields[
't.debit'][
'checked'])) {
928 print
'<td class="liste_titre right"><input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).
'"></td>';
931if (!empty($arrayfields[
't.credit'][
'checked'])) {
932 print
'<td class="liste_titre right"><input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).
'"></td>';
935if (!empty($arrayfields[
't.balance'][
'checked'])) {
939if (!empty($arrayfields[
't.date_export'][
'checked'])) {
940 print
'<td class="liste_titre center">';
941 print
'<div class="nowrapfordate">';
942 print $form->selectDate($search_date_export_start,
'search_date_export_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
944 print
'<div class="nowrapfordate">';
945 print $form->selectDate($search_date_export_end,
'search_date_export_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
950if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
951 print
'<td class="liste_titre center">';
952 print
'<div class="nowrapfordate">';
953 print $form->selectDate($search_date_validation_start,
'search_date_validation_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
955 print
'<div class="nowrapfordate">';
956 print $form->selectDate($search_date_validation_end,
'search_date_validation_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
961if (!empty($arrayfields[
't.date_lim_reglement'][
'checked'])) {
962 print
'<td class="liste_titre center">';
963 print
'<div class="nowrapfordate">';
964 print $form->selectDate($search_date_due_start,
'search_date_due_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
966 print
'<div class="nowrapfordate">';
967 print $form->selectDate($search_date_due_end,
'search_date_due_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
971if (!empty($arrayfields[
't.import_key'][
'checked'])) {
972 print
'<td class="liste_titre center">';
973 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
978$parameters = array(
'arrayfields' => $arrayfields);
979$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
980print $hookmanager->resPrint;
984 print
'<td class="liste_titre center">';
985 $searchpicto = $form->showFilterButtons();
991print
'<tr class="liste_titre">';
993 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
995if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
996 print_liste_field_titre($arrayfields[
't.piece_num'][
'label'], $_SERVER[
'PHP_SELF'],
"t.piece_num",
"", $param,
'', $sortfield, $sortorder,
'tdoverflowmax80imp ');
998if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
999 print_liste_field_titre($arrayfields[
't.code_journal'][
'label'], $_SERVER[
'PHP_SELF'],
"t.code_journal",
"", $param,
'', $sortfield, $sortorder,
'center ');
1001if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1002 print_liste_field_titre($arrayfields[
't.doc_date'][
'label'], $_SERVER[
'PHP_SELF'],
"t.doc_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1004if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1005 print_liste_field_titre($arrayfields[
't.doc_ref'][
'label'], $_SERVER[
'PHP_SELF'],
"t.doc_ref",
"", $param,
"", $sortfield, $sortorder);
1007if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1008 print_liste_field_titre($arrayfields[
't.label_operation'][
'label'], $_SERVER[
'PHP_SELF'],
"t.label_operation",
"", $param,
"", $sortfield, $sortorder);
1010if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1011 print_liste_field_titre($arrayfields[
't.lettering_code'][
'label'], $_SERVER[
'PHP_SELF'],
"t.lettering_code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1013if (!empty($arrayfields[
't.debit'][
'checked'])) {
1014 print_liste_field_titre($arrayfields[
't.debit'][
'label'], $_SERVER[
'PHP_SELF'],
"t.debit",
"", $param,
'', $sortfield, $sortorder,
'right ');
1016if (!empty($arrayfields[
't.credit'][
'checked'])) {
1017 print_liste_field_titre($arrayfields[
't.credit'][
'label'], $_SERVER[
'PHP_SELF'],
"t.credit",
"", $param,
'', $sortfield, $sortorder,
'right ');
1019if (!empty($arrayfields[
't.balance'][
'checked'])) {
1020 print_liste_field_titre($arrayfields[
't.balance'][
'label'],
"",
"",
"", $param,
'', $sortfield, $sortorder,
'right ');
1022if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1023 print_liste_field_titre($arrayfields[
't.date_export'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_export",
"", $param,
'', $sortfield, $sortorder,
'center ');
1025if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1026 print_liste_field_titre($arrayfields[
't.date_validated'][
'label'], $_SERVER[
'PHP_SELF'],
"t.date_validated",
"", $param,
'', $sortfield, $sortorder,
'center ');
1029if (!empty($arrayfields[
't.date_lim_reglement'][
'checked'])) {
1030 print_liste_field_titre($arrayfields[
't.date_lim_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
't.date_lim_reglement',
'', $param,
'', $sortfield, $sortorder,
'center ');
1032if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1033 print_liste_field_titre($arrayfields[
't.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"t.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1036$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1037$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1038print $hookmanager->resPrint;
1040 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1044$displayed_account_number =
null;
1046$objectstatic =
null;
1054$totalarray = array();
1055$totalarray[
'nbfield'] = 0;
1056$sous_total_debit = 0;
1057$sous_total_credit = 0;
1058$totalarray[
'val'] = array();
1059$totalarray[
'val'][
'totaldebit'] = 0;
1060$totalarray[
'val'][
'totalcredit'] = 0;
1061$totalarray[
'val'][
'totalbalance'] = 0;
1070if (!empty($arrayfields[
't.piece_num'][
'checked'])) { $colspan++; }
1071if (!empty($arrayfields[
't.code_journal'][
'checked'])) { $colspan++; }
1072if (!empty($arrayfields[
't.doc_date'][
'checked'])) { $colspan++; }
1073if (!empty($arrayfields[
't.doc_ref'][
'checked'])) { $colspan++; }
1074if (!empty($arrayfields[
't.label_operation'][
'checked'])) { $colspan++; }
1075if (!empty($arrayfields[
't.date_export'][
'checked'])) { $colspanend++; }
1076if (!empty($arrayfields[
't.date_validated'][
'checked'])) { $colspanend++; }
1077if (!empty($arrayfields[
't.lettering_code'][
'checked'])) { $colspanend++; }
1083while ($i < min($num, $limit)) {
1086 if ($type ==
'sub') {
1098 if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
1101 if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
1104 if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1107 if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1110 if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1113 if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1117 if (!empty($arrayfields[
't.balance'][
'checked'])) {
1120 if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1123 if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1127 if (!empty($arrayfields[
't.date_lim_reglement'][
'checked'])) {
1130 if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1133 if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1142 if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
1144 if (isset($displayed_account_number)) {
1145 print
'<tr class="liste_total">';
1146 if ($type ==
'sub') {
1147 print
'<td class="right" colspan="' . $colspan .
'">' . $langs->trans(
"TotalForAccount") .
' ' .
length_accounta($displayed_account_number) .
':</td>';
1149 print
'<td class="right" colspan="' . $colspan .
'">' . $langs->trans(
"TotalForAccount") .
' ' .
length_accountg($displayed_account_number) .
':</td>';
1151 print
'<td class="nowrap right">'.price(
price2num($sous_total_debit,
'MT')).
'</td>';
1152 print
'<td class="nowrap right">'.price(
price2num($sous_total_credit,
'MT')).
'</td>';
1153 if ($colspanend > 0) {
1154 print
'<td colspan="'.$colspanend.
'"></td>';
1158 $balance = $sous_total_debit - $sous_total_credit;
1159 print
'<tr class="liste_total">';
1160 print
'<td class="right" colspan="'.$colspan.
'">'.$langs->trans(
"Balance").
':</td>';
1162 print
'<td class="nowraponall right">';
1163 print
price(
price2num($sous_total_debit - $sous_total_credit,
'MT'));
1168 print
'<td class="nowraponall right">';
1169 print
price(
price2num($sous_total_credit - $sous_total_debit,
'MT'));
1172 if ($colspanend > 0) {
1173 print
'<td colspan="'.$colspanend.
'"></td>';
1179 print
'<tr class="trforbreak">';
1180 print
'<td colspan="'.($totalarray[
'nbfield'] ? $totalarray[
'nbfield'] : count($arrayfields) + 1).
'" class="tdforbreak">';
1181 if ($type ==
'sub') {
1182 if ($line->subledger_account !=
"" && $line->subledger_account !=
'-1') {
1183 print empty($line->subledger_label) ?
'<span class="error">'.$langs->trans(
"Unknown").
'</span>' : $line->subledger_label;
1188 print
'<span class="error">' . $langs->trans(
"Unknown");
1189 if ($line->subledger_label) {
1190 print
' (' . $line->subledger_label .
')';
1191 $htmltext =
'EmptyStringForSubledgerAccountButSubledgerLabelDefined';
1193 $htmltext =
'EmptyStringForSubledgerAccountAndSubledgerLabel';
1195 print $form->textwithpicto(
'', $htmltext);
1199 if ($line->numero_compte !=
"" && $line->numero_compte !=
'-1') {
1202 print
'<span class="error">' . $langs->trans(
"Unknown") .
'</span>';
1208 $displayed_account_number = $accountg;
1210 $sous_total_debit = 0;
1211 $sous_total_credit = 0;
1214 print
'<tr class="oddeven">';
1217 print
'<td class="nowraponall center">';
1218 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
1220 if (in_array($line->id, $arrayofselected)) {
1223 print
'<input id="cb' . $line->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id .
'"' . ($selected ?
' checked="checked"' :
'') .
' />';
1227 $totalarray[
'nbfield']++;
1231 if (!empty($arrayfields[
't.piece_num'][
'checked'])) {
1234 $object->piece_num = $line->piece_num;
1235 print
$object->getNomUrl(1,
'', 0,
'', 1);
1238 $totalarray[
'nbfield']++;
1243 if (!empty($arrayfields[
't.code_journal'][
'checked'])) {
1245 $result = $accountingjournal->fetch(0, $line->code_journal);
1246 $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0,
'', 0) : $line->code_journal);
1247 print
'<td class="center tdoverflowmax80">'.$journaltoshow.
'</td>';
1249 $totalarray[
'nbfield']++;
1254 if (!empty($arrayfields[
't.doc_date'][
'checked'])) {
1255 print
'<td class="center">'.dol_print_date($line->doc_date,
'day').
'</td>';
1257 $totalarray[
'nbfield']++;
1263 if (!empty($arrayfields[
't.doc_ref'][
'checked'])) {
1264 if ($line->doc_type ==
'customer_invoice') {
1265 $langs->loadLangs(array(
'bills'));
1267 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
1268 $objectstatic =
new Facture($db);
1269 $objectstatic->fetch($line->fk_doc);
1274 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$objectstatic->id;
1275 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1276 } elseif ($line->doc_type ==
'supplier_invoice') {
1277 $langs->loadLangs(array(
'bills'));
1279 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
1281 $objectstatic->fetch($line->fk_doc);
1283 $modulepart =
'invoice_supplier';
1285 $filedir =
$conf->fournisseur->facture->dir_output.
'/'.
get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
1286 $subdir =
get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
1287 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
1288 } elseif ($line->doc_type ==
'expense_report') {
1289 $langs->loadLangs(array(
'trips'));
1291 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
1293 $objectstatic->fetch($line->fk_doc);
1298 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$objectstatic->id;
1299 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1300 } elseif ($line->doc_type ==
'bank') {
1301 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
1303 $objectstatic->fetch($line->fk_doc);
1308 print
'<td class="tdoverflowmax250">';
1311 if ($line->doc_type ==
'customer_invoice' || $line->doc_type ==
'supplier_invoice' || $line->doc_type ==
'expense_report') {
1312 print $objectstatic->getNomUrl(1,
'', 0, 0,
'', 0, -1, 1);
1313 print $documentlink;
1314 } elseif ($line->doc_type ==
'bank') {
1315 print $objectstatic->getNomUrl(1);
1316 $bank_ref = strstr($line->doc_ref,
'-');
1317 print
" " . $bank_ref;
1319 print $line->doc_ref;
1324 $totalarray[
'nbfield']++;
1329 if (!empty($arrayfields[
't.label_operation'][
'checked'])) {
1331 $doc_ref = preg_replace(
'/\(.*\)/',
'', $line->doc_ref);
1333 print
'<td class="small tdoverflowmax350 classfortooltip" title="'.dol_escape_htmltag($line->label_operation).
'">'.
dol_escape_htmltag($line->label_operation).
'</td>';
1335 print
'<td class="small tdoverflowmax350 classfortooltip" title="'.dol_escape_htmltag($line->label_operation.($line->label_operation ?
'<br>' :
'').
'<span style="font-size:0.8em">('.
length_accounta($line->subledger_account).
')').
'">'.
dol_escape_htmltag($line->label_operation).($line->label_operation ?
'<br>' :
'').
'<span style="font-size:0.8em">('.
dol_escape_htmltag(
length_accounta($line->subledger_account)).
')</span></td>';
1338 $totalarray[
'nbfield']++;
1343 if (!empty($arrayfields[
't.lettering_code'][
'checked'])) {
1344 print
'<td class="center">'.dol_escape_htmltag($line->lettering_code).
'</td>';
1346 $totalarray[
'nbfield']++;
1351 if (!empty($arrayfields[
't.debit'][
'checked'])) {
1352 print
'<td class="right nowraponall amount">'.($line->debit != 0 ?
price($line->debit) :
'').
'</td>';
1354 $totalarray[
'nbfield']++;
1357 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totaldebit';
1359 $totalarray[
'val'][
'totaldebit'] += (float) $line->debit;
1363 if (!empty($arrayfields[
't.credit'][
'checked'])) {
1364 print
'<td class="right nowraponall amount">'.($line->credit != 0 ?
price($line->credit) :
'').
'</td>';
1366 $totalarray[
'nbfield']++;
1369 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalcredit';
1371 $totalarray[
'val'][
'totalcredit'] += (float) $line->credit;
1375 if (!empty($arrayfields[
't.balance'][
'checked'])) {
1376 print
'<td class="right nowraponall amount">'.price(
price2num($sous_total_debit + $line->debit - $sous_total_credit - $line->credit,
'MT')).
'</td>';
1378 $totalarray[
'nbfield']++;
1381 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalbalance';
1383 $totalarray[
'val'][
'totalbalance'] += $line->debit - $line->credit;
1387 if (!empty($arrayfields[
't.date_export'][
'checked'])) {
1388 print
'<td class="center">'.dol_print_date($line->date_export,
'dayhour').
'</td>';
1390 $totalarray[
'nbfield']++;
1395 if (!empty($arrayfields[
't.date_validated'][
'checked'])) {
1396 print
'<td class="center">'.dol_print_date($line->date_validation,
'dayhour').
'</td>';
1398 $totalarray[
'nbfield']++;
1403 if (!empty($arrayfields[
't.date_lim_reglement'][
'checked'])) {
1404 print
'<td class="center">'.dol_print_date($line->date_lim_reglement,
'day').
'</td>';
1406 $totalarray[
'nbfield']++;
1410 if (!empty($arrayfields[
't.import_key'][
'checked'])) {
1411 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($line->import_key).
'">'.
dol_escape_htmltag($line->import_key).
"</td>\n";
1413 $totalarray[
'nbfield']++;
1418 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $line);
1419 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1420 print $hookmanager->resPrint;
1424 print
'<td class="nowraponall center">';
1425 if (($massactionbutton || $massaction) && $contextpage !=
'poslist') {
1427 if (in_array($line->id, $arrayofselected)) {
1430 print
'<input id="cb' . $line->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id .
'"' . ($selected ?
' checked="checked"' :
'') .
' />';
1434 $totalarray[
'nbfield']++;
1439 $sous_total_debit += $line->debit;
1440 $sous_total_credit += $line->credit;
1447if ($num > 0 && $colspan > 0) {
1448 print
'<tr class="liste_total">';
1449 print
'<td class="right" colspan="'.$colspan.
'">'.$langs->trans(
"TotalForAccount").
' '.$accountg.
':</td>';
1450 print
'<td class="nowrap right">'.price(
price2num($sous_total_debit,
'MT')).
'</td>';
1451 print
'<td class="nowrap right">'.price(
price2num($sous_total_credit,
'MT')).
'</td>';
1452 if ($colspanend > 0) {
1453 print
'<td colspan="'.$colspanend.
'"></td>';
1457 $balance = $sous_total_debit - $sous_total_credit;
1458 print
'<tr class="liste_total">';
1459 print
'<td class="right" colspan="'.$colspan.
'">'.$langs->trans(
"Balance").
':</td>';
1461 print
'<td class="nowraponall right">';
1462 print
price(
price2num($sous_total_debit - $sous_total_credit,
'MT'));
1467 print
'<td class="nowraponall right">';
1468 print
price(
price2num($sous_total_credit - $sous_total_debit,
'MT'));
1471 if ($colspanend > 0) {
1472 print
'<td colspan="'.$colspanend.
'"></td>';
1479if (!empty($totalarray[
'val'][
'totaldebit'])) {
1480 $totalarray[
'val'][
'totaldebit'] = (float)
price2num($totalarray[
'val'][
'totaldebit'],
'MT');
1482if (!empty($totalarray[
'val'][
'totalcredit'])) {
1483 $totalarray[
'val'][
'totalcredit'] = (float)
price2num($totalarray[
'val'][
'totalcredit'],
'MT');
1485if (!empty($totalarray[
'val'][
'totalbalance'])) {
1486 $totalarray[
'val'][
'totalbalance'] = (float)
price2num($totalarray[
'val'][
'totaldebit'] - $totalarray[
'val'][
'totalcredit'],
'MT');
1490include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1495 foreach ($arrayfields as $key => $val) {
1496 if (!empty($val[
'checked'])) {
1500 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1503$parameters = array(
'arrayfields' => $arrayfields);
1504$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1505print $hookmanager->resPrint;
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
length_accounta($accounta)
Return Auxiliary accounting account of thirdparties with defined length.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage bank transaction lines.
Class to manage categories of an accounting account.
Class to manage accounting journals.
Class to manage Ledger (General Ledger and Subledger)
Class to manage Trips and Expenses.
Class to manage suppliers invoices.
Class to manage invoices.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $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.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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_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...
$formconfirm
if ($action == 'delbookkeepingyear') {
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.