31 require
'../../main.inc.php';
32 require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formsocialcontrib.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
42 $langs->loadLangs(array(
'compta',
'banks',
'bills',
'hrm',
'projects'));
44 $action =
GETPOST(
'action',
'aZ09');
45 $massaction =
GETPOST(
'massaction',
'alpha');
46 $confirm =
GETPOST(
'confirm',
'alpha');
47 $optioncss =
GETPOST(
'optioncss',
'alpha');
48 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'sclist';
50 $search_ref =
GETPOST(
'search_ref',
'int');
51 $search_label =
GETPOST(
'search_label',
'alpha');
52 $search_typeid =
GETPOST(
'search_typeid',
'int');
53 $search_amount =
GETPOST(
'search_amount',
'alpha');
54 $search_status =
GETPOST(
'search_status',
'int');
55 $search_date_startday =
GETPOST(
'search_date_startday',
'int');
56 $search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
57 $search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
58 $search_date_endday =
GETPOST(
'search_date_endday',
'int');
59 $search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
60 $search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
61 $search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
62 $search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
63 $search_date_limit_startday =
GETPOST(
'search_date_limit_startday',
'int');
64 $search_date_limit_startmonth =
GETPOST(
'search_date_limit_startmonth',
'int');
65 $search_date_limit_startyear =
GETPOST(
'search_date_limit_startyear',
'int');
66 $search_date_limit_endday =
GETPOST(
'search_date_limit_endday',
'int');
67 $search_date_limit_endmonth =
GETPOST(
'search_date_limit_endmonth',
'int');
68 $search_date_limit_endyear =
GETPOST(
'search_date_limit_endyear',
'int');
69 $search_date_limit_start =
dol_mktime(0, 0, 0, $search_date_limit_startmonth, $search_date_limit_startday, $search_date_limit_startyear);
70 $search_date_limit_end =
dol_mktime(23, 59, 59, $search_date_limit_endmonth, $search_date_limit_endday, $search_date_limit_endyear);
71 $search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
72 $search_users =
GETPOST(
'search_users');
73 $search_type =
GETPOST(
'search_type',
'int');
74 $search_account =
GETPOST(
'search_account',
'int');
76 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
77 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
78 $sortorder =
GETPOST(
"sortorder",
'aZ09comma');
81 if (empty($page) || $page == -1) {
84 $offset = $limit * $page;
85 $pageprev = $page - 1;
86 $pagenext = $page + 1;
89 $sortfield =
"cs.date_ech";
95 $filtre =
GETPOST(
"filtre",
'int');
98 'cs.rowid' =>array(
'label'=>
"Ref",
'checked'=>1,
'position'=>10),
99 'cs.libelle' =>array(
'label'=>
"Label",
'checked'=>1,
'position'=>20),
100 'cs.fk_type' =>array(
'label'=>
"Type",
'checked'=>1,
'position'=>30),
101 'cs.date_ech' =>array(
'label'=>
"Date",
'checked'=>1,
'position'=>40),
102 'cs.periode' =>array(
'label'=>
"PeriodEndDate",
'checked'=>1,
'position'=>50),
103 'p.ref' =>array(
'label'=>
"ProjectRef",
'checked'=>1,
'position'=>60,
'enable'=>(!empty($conf->project->enabled))),
104 'cs.fk_user' =>array(
'label'=>
"Employee",
'checked'=>1,
'position'=>70),
105 'cs.fk_mode_reglement' =>array(
'checked'=>-1,
'position'=>80,
'label'=>
"DefaultPaymentMode"),
106 'cs.amount' =>array(
'label'=>
"Amount",
'checked'=>1,
'position'=>100),
107 'cs.paye' =>array(
'label'=>
"Status",
'checked'=>1,
'position'=>110),
111 $arrayfields[
'cs.fk_account'] = array(
'checked'=>-1,
'position'=>90,
'label'=>
"DefaultBankAccount");
117 $hookmanager->initHooks(array(
'sclist'));
121 $socid =
GETPOST(
"socid",
'int');
123 $socid = $user->socid;
125 $result =
restrictedArea($user,
'tax',
'',
'chargesociales',
'charges');
132 $parameters = array(
'socid'=>$socid);
133 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
139 if (empty($reshook)) {
140 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
143 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
149 $search_date_startday =
'';
150 $search_date_startmonth =
'';
151 $search_date_startyear =
'';
152 $search_date_endday =
'';
153 $search_date_endmonth =
'';
154 $search_date_endyear =
'';
155 $search_date_start =
'';
156 $search_date_end =
'';
157 $search_date_limit_startday =
'';
158 $search_date_limit_startmonth =
'';
159 $search_date_limit_startyear =
'';
160 $search_date_limit_endday =
'';
161 $search_date_limit_endmonth =
'';
162 $search_date_limit_endyear =
'';
163 $search_date_limit_start =
'';
164 $search_date_limit_end =
'';
165 $search_project_ref =
'';
168 $search_account =
'';
169 $search_array_options = array();
179 $bankstatic =
new Account($db);
183 $projectstatic =
new Project($db);
186 llxHeader(
'', $langs->trans(
"SocialContributions"));
188 $sql =
"SELECT cs.rowid, cs.fk_type as type, cs.fk_user,";
189 $sql .=
" cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode, cs.fk_account,";
191 $sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
193 $sql .=
" c.libelle as type_label, c.accountancy_code as type_accountancy_code,";
194 $sql .=
" ba.label as blabel, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,";
195 $sql .=
" SUM(pc.amount) as alreadypayed, pay.code as payment_code";
196 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_chargesociales as c,";
197 $sql .=
" ".MAIN_DB_PREFIX.
"chargesociales as cs";
198 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account as ba ON (cs.fk_account = ba.rowid)";
199 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_paiement as pay ON (cs.fk_mode_reglement = pay.id)';
201 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = cs.fk_projet";
203 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"paiementcharge as pc ON pc.fk_charge = cs.rowid";
204 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON (cs.fk_user = u.rowid)";
205 $sql .=
" WHERE cs.fk_type = c.id";
206 $sql .=
" AND cs.entity = ".((int) $conf->entity);
209 $sql .=
" AND cs.ref = '".$db->escape($search_ref).
"'";
215 if ($search_project_ref !=
'') {
219 if (!empty($search_users)) {
220 $sql .=
' AND cs.fk_user IN ('.$db->sanitize(implode(
', ', $search_users)).
')';
222 if (!empty($search_type) && $search_type > 0) {
223 $sql .=
' AND cs.fk_mode_reglement='.((int) $search_type);
225 if (!empty($search_account) && $search_account > 0) {
226 $sql .=
' AND cs.fk_account='.((int) $search_account);
228 if ($search_amount) {
231 if ($search_status !=
'' && $search_status >= 0) {
232 $sql .=
" AND cs.paye = ".((int) $search_status);
234 if ($search_date_start) {
235 $sql .=
" AND cs.date_ech >= '".$db->idate($search_date_start).
"'";
237 if ($search_date_end) {
238 $sql .=
" AND cs.date_ech <= '".$db->idate($search_date_end).
"'";
240 if ($search_date_limit_start) {
241 $sql .=
" AND cs.periode >= '".$db->idate($search_date_limit_start).
"'";
243 if ($search_date_limit_end) {
244 $sql .=
" AND cs.periode <= '".$db->idate($search_date_limit_end).
"'";
246 if ($search_typeid > 0) {
247 $sql .=
" AND cs.fk_type = ".((int) $search_typeid);
249 $sql .=
" GROUP BY cs.rowid, cs.fk_type, cs.fk_user, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, cs.fk_account, c.libelle, c.accountancy_code, ba.label, ba.ref, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos, pay.code, u.lastname";
251 $sql .=
", p.rowid, p.ref, p.title";
253 $sql .= $db->order($sortfield, $sortorder);
256 $result = $db->query($sql);
258 $totalnboflines = $db->num_rows($result);
260 $sql .= $db->plimit($limit + 1, $offset);
262 $resql = $db->query($sql);
270 $num = $db->num_rows(
$resql);
274 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
275 $param .=
'&contextpage='.urlencode($contextpage);
277 if ($limit > 0 && $limit != $conf->liste_limit) {
278 $param .=
'&limit='.urlencode($limit);
281 $param .=
'&search_ref='.urlencode($search_ref);
284 $param .=
'&search_label='.urlencode($search_label);
286 if ($search_project_ref >= 0) {
287 $param .=
"&search_project_ref=".urlencode($search_project_ref);
289 if ($search_amount) {
290 $param .=
'&search_amount='.urlencode($search_amount);
292 if ($search_typeid) {
293 $param .=
'&search_typeid='.urlencode($search_typeid);
296 foreach ($search_users as $id_user) {
297 $param .=
'&search_users[]='.urlencode($id_user);
301 $param .=
'&search_type='.urlencode($search_type);
303 if ($search_account) {
304 $param .=
'&search_account='.$search_account;
306 if ($search_status !=
'' && $search_status !=
'-1') {
307 $param .=
'&search_status='.urlencode($search_status);
309 if ($search_date_startday) {
310 $param .=
'&search_date_startday='.urlencode($search_date_startday);
312 if ($search_date_startmonth) {
313 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
315 if ($search_date_startyear) {
316 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
318 if ($search_date_endday) {
319 $param .=
'&search_date_endday='.urlencode($search_date_endday);
321 if ($search_date_endmonth) {
322 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
324 if ($search_date_endyear) {
325 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
327 if ($search_date_limit_startday) {
328 $param .=
'&search_date_limit_startday='.urlencode($search_date_limit_startday);
330 if ($search_date_limit_startmonth) {
331 $param .=
'&search_date_limit_startmonth='.urlencode($search_date_limit_startmonth);
333 if ($search_date_limit_startyear) {
334 $param .=
'&search_date_limit_startyear='.urlencode($search_date_limit_startyear);
336 if ($search_date_limit_endday) {
337 $param .=
'&search_date_limit_endday='.urlencode($search_date_limit_endday);
339 if ($search_date_limit_endmonth) {
340 $param .=
'&search_date_limit_endmonth='.urlencode($search_date_limit_endmonth);
342 if ($search_date_limit_endyear) {
343 $param .=
'&search_date_limit_endyear='.urlencode($search_date_limit_endyear);
347 if ($user->rights->tax->charges->creer) {
348 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'MenuNewSocialContribution'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/compta/sociales/card.php?action=create');
351 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
352 if ($optioncss !=
'') {
353 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
355 print
'<input type="hidden" name="token" value="'.newToken().
'">';
356 print
'<input type="hidden" name="action" value="list">';
357 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
358 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
359 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
360 print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
361 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
365 print_barre_liste($langs->trans(
"SocialContributions"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
367 if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
368 print
'<div class="error">';
369 $langs->load(
"errors");
370 $countrynotdefined = $langs->trans(
"ErrorSetACountryFirst");
371 print $countrynotdefined;
380 $massactionbutton =
'';
382 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
383 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
384 if ($massactionbutton) {
385 $selectedfields .=
$form->showCheckAddButtons(
'checkforselect', 1);
388 print
'<div class="div-table-responsive">';
389 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
'').
'">'.
"\n";
391 print
'<tr class="liste_titre_filter">';
394 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
395 print
'<td class="liste_titre">';
400 if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
401 print
'<td class="liste_titre">';
402 print
'<input class="flat maxwidth75" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
407 if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
408 print
'<td class="liste_titre">';
409 print
'<input type="text" class="flat maxwidth100" name="search_label" value="'.dol_escape_htmltag($search_label).
'">';
414 if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
415 print
'<td class="liste_titre">';
416 $formsocialcontrib->select_type_socialcontrib($search_typeid,
'search_typeid', 1, 0, 0,
'maxwidth150', 1);
421 if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
422 print
'<td class="liste_titre center">';
423 print
'<div class="nowrap">';
424 print
$form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
426 print
'<div class="nowrap">';
427 print
$form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
433 if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
434 print
'<td class="liste_titre center">';
435 print
'<div class="nowrap">';
436 print
$form->selectDate($search_date_limit_start ? $search_date_limit_start : -1,
'search_date_limit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
438 print
'<div class="nowrap">';
439 print
$form->selectDate($search_date_limit_end ? $search_date_limit_end : -1,
'search_date_limit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
445 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
446 print
'<td class="liste_titre">';
447 print
'<input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'">';
451 if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
453 print
'<td class="liste_titre">';
454 print
$form->select_dolusers($search_users,
'search_users', 1,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth150', 0, 0,
true);
459 if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
460 print
'<td class="liste_titre">';
461 $form->select_types_paiements($search_type,
'search_type',
'', 0, 1, 1, 0, 1,
'maxwidth150');
466 if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
467 print
'<td class="liste_titre">';
468 $form->select_comptes($search_account,
'search_account', 0,
'', 1,
'', 0,
'maxwidth150');
473 if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
474 print
'<td class="liste_titre right">';
475 print
'<input class="flat maxwidth75" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).
'">';
480 if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
481 print
'<td class="liste_titre maxwidthonsmartphone right">';
482 $liststatus = array(
'0'=>$langs->trans(
"Unpaid"),
'1'=>$langs->trans(
"Paid"));
483 print
$form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100', 1);
488 $parameters = array(
'arrayfields'=>$arrayfields);
489 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
490 print $hookmanager->resPrint;
493 print
'<td class="liste_titre maxwidthsearch">';
494 print
$form->showFilterAndCheckAddButtons(0);
499 print
'<tr class="liste_titre">';
500 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
503 if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
504 print_liste_field_titre($arrayfields[
'cs.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.rowid",
'', $param,
'', $sortfield, $sortorder);
506 if (!empty($arrayfields[
'cs.libelle'][
'checked'])) {
507 print_liste_field_titre($arrayfields[
'cs.libelle'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.libelle,cs.periode",
'', $param,
'', $sortfield, $sortorder);
509 if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
510 print_liste_field_titre($arrayfields[
'cs.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_type,cs.periode",
'', $param,
'', $sortfield, $sortorder);
512 if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
513 print_liste_field_titre($arrayfields[
'cs.date_ech'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.date_ech,cs.periode",
'', $param,
'', $sortfield, $sortorder,
'center ');
515 if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
516 print_liste_field_titre($arrayfields[
'cs.periode'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.periode",
'', $param,
'', $sortfield, $sortorder,
'center ');
518 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
519 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
521 if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
522 print_liste_field_titre(
"Employee", $_SERVER[
"PHP_SELF"],
"u.lastname,cs.periode",
"", $param,
'class="left"', $sortfield, $sortorder);
524 if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
525 print_liste_field_titre($arrayfields[
'cs.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_mode_reglement,cs.periode",
'', $param,
'', $sortfield, $sortorder);
527 if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
528 print_liste_field_titre($arrayfields[
'cs.fk_account'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_account,cs.periode",
'', $param,
'', $sortfield, $sortorder);
530 if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
531 print_liste_field_titre($arrayfields[
'cs.amount'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.amount,cs.periode",
'', $param,
'class="right"', $sortfield, $sortorder);
533 if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
534 print_liste_field_titre($arrayfields[
'cs.paye'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.paye,cs.periode",
'', $param,
'class="right"', $sortfield, $sortorder);
538 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
539 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
540 print $hookmanager->resPrint;
542 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch ');
546 $totalarray = $TLoadedUsers = array();
547 $totalarray[
'nbfield'] = 0;
548 $totalarray[
'val'][
'totalttcfield'] = 0;
549 while ($i < min($num, $limit)) {
550 $obj = $db->fetch_object(
$resql);
552 $chargesociale_static->id = $obj->rowid;
553 $chargesociale_static->ref = $obj->rowid;
554 $chargesociale_static->label = $obj->label;
555 $chargesociale_static->type_label = $obj->type_label;
558 $projectstatic->id = $obj->project_id;
559 $projectstatic->ref = $obj->project_ref;
560 $projectstatic->title = $obj->project_label;
563 print
'<tr class="oddeven">';
566 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
567 print
'<td>'.(($offset * $limit) + $i).
'</td>';
569 $totalarray[
'nbfield']++;
574 if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
575 print
'<td>'.$chargesociale_static->getNomUrl(1,
'20').
'</td>';
577 $totalarray[
'nbfield']++;
582 if (!empty($arrayfields[
'cs.libelle'][
'checked'])) {
583 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).
'">'.
dol_escape_htmltag($obj->label).
'</td>';
585 $totalarray[
'nbfield']++;
590 if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
591 $typelabeltoshow = $obj->type_label;
592 $typelabelpopup = $obj->type_label;
594 $typelabelpopup .=
' - '.$langs->trans(
"AccountancyCode").
': '.$obj->type_accountancy_code;
596 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($typelabelpopup).
'">'.
dol_escape_htmltag($typelabeltoshow).
'</td>';
598 $totalarray[
'nbfield']++;
603 if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
604 print
'<td class="center nowraponall">'.dol_print_date($db->jdate($obj->date_ech),
'day').
'</td>';
606 $totalarray[
'nbfield']++;
611 if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
612 print
'<td class="center nowraponall">'.dol_print_date($db->jdate($obj->periode),
'day').
'</td>';
614 $totalarray[
'nbfield']++;
619 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
620 print
'<td class="nowraponall">';
621 if ($obj->project_id > 0) {
622 print $projectstatic->getNomUrl(1);
626 $totalarray[
'nbfield']++;
630 if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
632 print
'<td class="tdoverflowmax150">';
633 if (!empty($obj->fk_user)) {
634 if (!empty($TLoadedUsers[$obj->fk_user])) {
635 $ustatic = $TLoadedUsers[$obj->fk_user];
637 $ustatic =
new User($db);
638 $ustatic->fetch($obj->fk_user);
639 $TLoadedUsers[$obj->fk_user] = $ustatic;
641 print $ustatic->getNomUrl(-1);
645 $totalarray[
'nbfield']++;
650 if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
651 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans(
"PaymentTypeShort".$obj->payment_code)).
'">';
652 if (!empty($obj->payment_code)) {
653 print $langs->trans(
"PaymentTypeShort".$obj->payment_code);
657 $totalarray[
'nbfield']++;
662 if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
663 print
'<td class="toverflowmax150">';
664 if ($obj->fk_account > 0) {
665 $bankstatic->id = $obj->fk_account;
666 $bankstatic->ref = $obj->bref;
667 $bankstatic->number = $obj->bnumber;
668 $bankstatic->iban = $obj->iban;
669 $bankstatic->bic = $obj->bic;
670 $bankstatic->currency_code = $langs->trans(
"Currency".$obj->currency_code);
671 $bankstatic->account_number = $obj->account_number;
672 $bankstatic->clos = $obj->clos;
677 $bankstatic->label = $obj->blabel;
678 print $bankstatic->getNomUrl(1);
681 if (!$i) $totalarray[
'nbfield']++;
685 if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
686 print
'<td class="nowraponall amount right">'.price($obj->amount).
'</td>';
688 $totalarray[
'nbfield']++;
691 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalttcfield';
693 $totalarray[
'val'][
'totalttcfield'] += $obj->amount;
697 if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
698 print
'<td class="nowraponall right">'.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).
'</td>';
700 $totalarray[
'nbfield']++;
707 $totalarray[
'nbfield']++;
716 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
721 foreach ($arrayfields as $key => $val) {
722 if (!empty($val[
'checked'])) {
726 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
731 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
732 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
733 print $hookmanager->resPrint;
735 print
'</table>'.
"\n";
738 print
'</form>'.
"\n";