32 require
'../../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formsocialcontrib.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
39 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
43 $langs->loadLangs(array(
'compta',
'banks',
'bills',
'hrm',
'projects'));
45 $action =
GETPOST(
'action',
'aZ09');
46 $massaction =
GETPOST(
'massaction',
'alpha');
47 $confirm =
GETPOST(
'confirm',
'alpha');
48 $optioncss =
GETPOST(
'optioncss',
'alpha');
49 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'sclist';
50 $mode =
GETPOST(
'mode',
'alpha');
53 $search_ref =
GETPOST(
'search_ref',
'int');
54 $search_label =
GETPOST(
'search_label',
'alpha');
55 $search_typeid =
GETPOST(
'search_typeid',
'int');
56 $search_amount =
GETPOST(
'search_amount',
'alpha');
57 $search_status =
GETPOST(
'search_status',
'int');
58 $search_date_startday =
GETPOST(
'search_date_startday',
'int');
59 $search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
60 $search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
61 $search_date_endday =
GETPOST(
'search_date_endday',
'int');
62 $search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
63 $search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
64 $search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
65 $search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
66 $search_date_limit_startday =
GETPOST(
'search_date_limit_startday',
'int');
67 $search_date_limit_startmonth =
GETPOST(
'search_date_limit_startmonth',
'int');
68 $search_date_limit_startyear =
GETPOST(
'search_date_limit_startyear',
'int');
69 $search_date_limit_endday =
GETPOST(
'search_date_limit_endday',
'int');
70 $search_date_limit_endmonth =
GETPOST(
'search_date_limit_endmonth',
'int');
71 $search_date_limit_endyear =
GETPOST(
'search_date_limit_endyear',
'int');
72 $search_date_limit_start =
dol_mktime(0, 0, 0, $search_date_limit_startmonth, $search_date_limit_startday, $search_date_limit_startyear);
73 $search_date_limit_end =
dol_mktime(23, 59, 59, $search_date_limit_endmonth, $search_date_limit_endday, $search_date_limit_endyear);
74 $search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
75 $search_users =
GETPOST(
'search_users');
76 $search_type =
GETPOST(
'search_type',
'int');
77 $search_account =
GETPOST(
'search_account',
'int');
79 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
80 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
81 $sortorder =
GETPOST(
"sortorder",
'aZ09comma');
84 if (empty($page) || $page == -1) {
87 $offset = $limit * $page;
88 $pageprev = $page - 1;
89 $pagenext = $page + 1;
92 $sortfield =
"cs.date_ech";
98 $filtre =
GETPOST(
"filtre",
'int');
100 $arrayfields = array(
101 'cs.rowid' =>array(
'label'=>
"Ref",
'checked'=>1,
'position'=>10),
102 'cs.libelle' =>array(
'label'=>
"Label",
'checked'=>1,
'position'=>20),
103 'cs.fk_type' =>array(
'label'=>
"Type",
'checked'=>1,
'position'=>30),
104 'cs.date_ech' =>array(
'label'=>
"Date",
'checked'=>1,
'position'=>40),
105 'cs.periode' =>array(
'label'=>
"PeriodEndDate",
'checked'=>1,
'position'=>50),
106 'p.ref' =>array(
'label'=>
"ProjectRef",
'checked'=>1,
'position'=>60,
'enable'=>(
isModEnabled(
'project'))),
107 'cs.fk_user' =>array(
'label'=>
"Employee",
'checked'=>1,
'position'=>70),
108 'cs.fk_mode_reglement' =>array(
'checked'=>-1,
'position'=>80,
'label'=>
"DefaultPaymentMode"),
109 'cs.amount' =>array(
'label'=>
"Amount",
'checked'=>1,
'position'=>100),
110 'cs.paye' =>array(
'label'=>
"Status",
'checked'=>1,
'position'=>110),
114 $arrayfields[
'cs.fk_account'] = array(
'checked'=>-1,
'position'=>90,
'label'=>
"DefaultBankAccount");
120 $hookmanager->initHooks(array(
'sclist'));
124 $socid =
GETPOST(
"socid",
'int');
126 $socid = $user->socid;
128 $result =
restrictedArea($user,
'tax',
'',
'chargesociales',
'charges');
135 $parameters = array(
'socid'=>$socid);
136 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
142 if (empty($reshook)) {
143 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
146 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
152 $search_date_startday =
'';
153 $search_date_startmonth =
'';
154 $search_date_startyear =
'';
155 $search_date_endday =
'';
156 $search_date_endmonth =
'';
157 $search_date_endyear =
'';
158 $search_date_start =
'';
159 $search_date_end =
'';
160 $search_date_limit_startday =
'';
161 $search_date_limit_startmonth =
'';
162 $search_date_limit_startyear =
'';
163 $search_date_limit_endday =
'';
164 $search_date_limit_endmonth =
'';
165 $search_date_limit_endyear =
'';
166 $search_date_limit_start =
'';
167 $search_date_limit_end =
'';
168 $search_project_ref =
'';
171 $search_account =
'';
172 $search_array_options = array();
182 $bankstatic =
new Account($db);
186 $projectstatic =
new Project($db);
189 llxHeader(
'', $langs->trans(
"SocialContributions"));
191 $sql =
"SELECT cs.rowid, cs.fk_type as type, cs.fk_user,";
192 $sql .=
" cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode, cs.fk_account,";
194 $sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
196 $sql .=
" c.libelle as type_label, c.accountancy_code as type_accountancy_code,";
197 $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,";
198 $sql .=
" SUM(pc.amount) as alreadypayed, pay.code as payment_code";
202 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_chargesociales as c,";
203 $sql .=
" ".MAIN_DB_PREFIX.
"chargesociales as cs";
204 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account as ba ON (cs.fk_account = ba.rowid)";
205 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_paiement as pay ON (cs.fk_mode_reglement = pay.id)';
207 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = cs.fk_projet";
209 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"paiementcharge as pc ON pc.fk_charge = cs.rowid";
210 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON (cs.fk_user = u.rowid)";
211 $sql .=
" WHERE cs.fk_type = c.id";
212 $sql .=
" AND cs.entity = ".((int) $conf->entity);
215 $sql .=
" AND cs.ref = '".$db->escape($search_ref).
"'";
221 if ($search_project_ref !=
'') {
225 if (!empty($search_users)) {
226 $sql .=
' AND cs.fk_user IN ('.$db->sanitize(implode(
', ', $search_users)).
')';
228 if (!empty($search_type) && $search_type > 0) {
229 $sql .=
' AND cs.fk_mode_reglement='.((int) $search_type);
231 if (!empty($search_account) && $search_account > 0) {
232 $sql .=
' AND cs.fk_account='.((int) $search_account);
234 if ($search_amount) {
237 if ($search_status !=
'' && $search_status >= 0) {
238 $sql .=
" AND cs.paye = ".((int) $search_status);
240 if ($search_date_start) {
241 $sql .=
" AND cs.date_ech >= '".$db->idate($search_date_start).
"'";
243 if ($search_date_end) {
244 $sql .=
" AND cs.date_ech <= '".$db->idate($search_date_end).
"'";
246 if ($search_date_limit_start) {
247 $sql .=
" AND cs.periode >= '".$db->idate($search_date_limit_start).
"'";
249 if ($search_date_limit_end) {
250 $sql .=
" AND cs.periode <= '".$db->idate($search_date_limit_end).
"'";
252 if ($search_typeid > 0) {
253 $sql .=
" AND cs.fk_type = ".((int) $search_typeid);
255 $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";
257 $sql .=
", p.rowid, p.ref, p.title";
262 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
264 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
265 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
266 $resql = $db->query($sqlforcount);
268 $objforcount = $db->fetch_object($resql);
282 $sql .= $db->order($sortfield, $sortorder);
284 $sql .= $db->plimit($limit + 1, $offset);
287 $resql = $db->query(
$sql);
295 $num = $db->num_rows($resql);
300 $param .=
'&mode='.urlencode($mode);
302 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
303 $param .=
'&contextpage='.urlencode($contextpage);
305 if ($limit > 0 && $limit != $conf->liste_limit) {
306 $param .=
'&limit='.urlencode($limit);
309 $param .=
'&search_ref='.urlencode($search_ref);
312 $param .=
'&search_label='.urlencode($search_label);
314 if ($search_project_ref >= 0) {
315 $param .=
"&search_project_ref=".urlencode($search_project_ref);
317 if ($search_amount) {
318 $param .=
'&search_amount='.urlencode($search_amount);
320 if ($search_typeid) {
321 $param .=
'&search_typeid='.urlencode($search_typeid);
324 foreach ($search_users as $id_user) {
325 $param .=
'&search_users[]='.urlencode($id_user);
329 $param .=
'&search_type='.urlencode($search_type);
331 if ($search_account) {
332 $param .=
'&search_account='.$search_account;
334 if ($search_status !=
'' && $search_status !=
'-1') {
335 $param .=
'&search_status='.urlencode($search_status);
337 if ($search_date_startday) {
338 $param .=
'&search_date_startday='.urlencode($search_date_startday);
340 if ($search_date_startmonth) {
341 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
343 if ($search_date_startyear) {
344 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
346 if ($search_date_endday) {
347 $param .=
'&search_date_endday='.urlencode($search_date_endday);
349 if ($search_date_endmonth) {
350 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
352 if ($search_date_endyear) {
353 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
355 if ($search_date_limit_startday) {
356 $param .=
'&search_date_limit_startday='.urlencode($search_date_limit_startday);
358 if ($search_date_limit_startmonth) {
359 $param .=
'&search_date_limit_startmonth='.urlencode($search_date_limit_startmonth);
361 if ($search_date_limit_startyear) {
362 $param .=
'&search_date_limit_startyear='.urlencode($search_date_limit_startyear);
364 if ($search_date_limit_endday) {
365 $param .=
'&search_date_limit_endday='.urlencode($search_date_limit_endday);
367 if ($search_date_limit_endmonth) {
368 $param .=
'&search_date_limit_endmonth='.urlencode($search_date_limit_endmonth);
370 if ($search_date_limit_endyear) {
371 $param .=
'&search_date_limit_endyear='.urlencode($search_date_limit_endyear);
375 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss'=>
'reposition'));
376 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
377 if ($user->rights->tax->charges->creer) {
378 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'MenuNewSocialContribution'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/compta/sociales/card.php?action=create');
381 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
382 if ($optioncss !=
'') {
383 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
385 print
'<input type="hidden" name="token" value="'.newToken().
'">';
386 print
'<input type="hidden" name="action" value="list">';
387 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
388 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
389 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
390 print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
391 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
392 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
397 print_barre_liste($langs->trans(
"SocialContributions"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $center, $num,
$nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
399 if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
400 print
'<div class="error">';
401 $langs->load(
"errors");
402 $countrynotdefined = $langs->trans(
"ErrorSetACountryFirst");
403 print $countrynotdefined;
412 $massactionbutton =
'';
414 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
415 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
416 if ($massactionbutton) {
417 $selectedfields .=
$form->showCheckAddButtons(
'checkforselect', 1);
420 print
'<div class="div-table-responsive">';
421 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
'').
'">'.
"\n";
423 print
'<tr class="liste_titre_filter">';
427 print
'<td class="liste_titre maxwidthsearch">';
428 print
$form->showFilterAndCheckAddButtons(0);
433 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
434 print
'<td class="liste_titre">';
439 if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
440 print
'<td class="liste_titre">';
441 print
'<input class="flat maxwidth75" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
446 if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
447 print
'<td class="liste_titre">';
448 print
'<input type="text" class="flat maxwidth100" name="search_label" value="'.dol_escape_htmltag($search_label).
'">';
453 if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
454 print
'<td class="liste_titre">';
455 $formsocialcontrib->select_type_socialcontrib($search_typeid,
'search_typeid', 1, 0, 0,
'maxwidth150', 1);
460 if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
461 print
'<td class="liste_titre center">';
462 print
'<div class="nowrap">';
463 print
$form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
465 print
'<div class="nowrap">';
466 print
$form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
472 if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
473 print
'<td class="liste_titre center">';
474 print
'<div class="nowrap">';
475 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'));
477 print
'<div class="nowrap">';
478 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'));
484 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
485 print
'<td class="liste_titre">';
486 print
'<input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'">';
490 if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
492 print
'<td class="liste_titre">';
493 print
$form->select_dolusers($search_users,
'search_users', 1,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth150', 0, 0,
true);
498 if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
499 print
'<td class="liste_titre">';
500 print
$form->select_types_paiements($search_type,
'search_type',
'', 0, 1, 1, 0, 1,
'maxwidth150', 1);
505 if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
506 print
'<td class="liste_titre">';
507 $form->select_comptes($search_account,
'search_account', 0,
'', 1,
'', 0,
'maxwidth150');
512 if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
513 print
'<td class="liste_titre right">';
514 print
'<input class="flat maxwidth75" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).
'">';
519 if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
520 print
'<td class="liste_titre right parentonrightofpage">';
521 $liststatus = array(
'0'=>$langs->trans(
"Unpaid"),
'1'=>$langs->trans(
"Paid"));
522 print
$form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
527 $parameters = array(
'arrayfields'=>$arrayfields);
528 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
529 print $hookmanager->resPrint;
533 print
'<td class="liste_titre maxwidthsearch">';
534 print
$form->showFilterAndCheckAddButtons(0);
540 print
'<tr class="liste_titre">';
543 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch ');
546 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
549 if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
550 print_liste_field_titre($arrayfields[
'cs.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.rowid",
'', $param,
'', $sortfield, $sortorder);
552 if (!empty($arrayfields[
'cs.libelle'][
'checked'])) {
553 print_liste_field_titre($arrayfields[
'cs.libelle'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.libelle,cs.periode",
'', $param,
'', $sortfield, $sortorder);
555 if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
556 print_liste_field_titre($arrayfields[
'cs.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_type,cs.periode",
'', $param,
'', $sortfield, $sortorder);
558 if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
559 print_liste_field_titre($arrayfields[
'cs.date_ech'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.date_ech,cs.periode",
'', $param,
'', $sortfield, $sortorder,
'center ');
561 if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
562 print_liste_field_titre($arrayfields[
'cs.periode'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.periode",
'', $param,
'', $sortfield, $sortorder,
'center ');
564 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
565 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
567 if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
568 print_liste_field_titre(
"Employee", $_SERVER[
"PHP_SELF"],
"u.lastname,cs.periode",
"", $param,
'class="left"', $sortfield, $sortorder);
570 if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
571 print_liste_field_titre($arrayfields[
'cs.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_mode_reglement,cs.periode",
'', $param,
'', $sortfield, $sortorder);
573 if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
574 print_liste_field_titre($arrayfields[
'cs.fk_account'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_account,cs.periode",
'', $param,
'', $sortfield, $sortorder);
576 if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
577 print_liste_field_titre($arrayfields[
'cs.amount'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.amount,cs.periode",
'', $param,
'class="right"', $sortfield, $sortorder);
579 if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
580 print_liste_field_titre($arrayfields[
'cs.paye'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.paye,cs.periode",
'', $param,
'class="right"', $sortfield, $sortorder);
584 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
585 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
586 print $hookmanager->resPrint;
589 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch ');
594 $totalarray = $TLoadedUsers = array();
595 $totalarray[
'nbfield'] = 0;
596 $totalarray[
'val'][
'totalttcfield'] = 0;
597 while ($i < min($num, $limit)) {
598 $obj = $db->fetch_object($resql);
600 $chargesociale_static->id = $obj->rowid;
601 $chargesociale_static->ref = $obj->rowid;
602 $chargesociale_static->label = $obj->label;
603 $chargesociale_static->type_label = $obj->type_label;
604 $chargesociale_static->amount = $obj->amount;
605 $chargesociale_static->paye = $obj->paye;
606 $chargesociale_static->date_ech = $obj->date_ech;
610 $projectstatic->id = $obj->project_id;
611 $projectstatic->ref = $obj->project_ref;
612 $projectstatic->title = $obj->project_label;
614 if ($mode ==
'kanban') {
616 print
'<tr><td colspan="12">';
617 print
'<div class="box-flex-container kanban">';
621 $chargesociale_static->fk_project = $projectstatic->getNomUrl();
622 print $chargesociale_static->getKanbanView(
'');
623 if ($i == (min($num, $limit) - 1)) {
628 print
'<tr class="oddeven">';
637 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
638 print
'<td>'.(($offset * $limit) + $i).
'</td>';
640 $totalarray[
'nbfield']++;
645 if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
646 print
'<td>'.$chargesociale_static->getNomUrl(1,
'20').
'</td>';
648 $totalarray[
'nbfield']++;
653 if (!empty($arrayfields[
'cs.libelle'][
'checked'])) {
654 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).
'">'.
dol_escape_htmltag($obj->label).
'</td>';
656 $totalarray[
'nbfield']++;
661 if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
662 $typelabeltoshow = $obj->type_label;
663 $typelabelpopup = $obj->type_label;
665 $typelabelpopup .=
' - '.$langs->trans(
"AccountancyCode").
': '.$obj->type_accountancy_code;
667 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($typelabelpopup).
'">'.
dol_escape_htmltag($typelabeltoshow).
'</td>';
669 $totalarray[
'nbfield']++;
674 if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
675 print
'<td class="center nowraponall">'.dol_print_date($db->jdate($obj->date_ech),
'day').
'</td>';
677 $totalarray[
'nbfield']++;
682 if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
683 print
'<td class="center nowraponall">'.dol_print_date($db->jdate($obj->periode),
'day').
'</td>';
685 $totalarray[
'nbfield']++;
690 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
691 print
'<td class="nowraponall">';
692 if ($obj->project_id > 0) {
693 print $projectstatic->getNomUrl(1);
697 $totalarray[
'nbfield']++;
701 if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
703 print
'<td class="tdoverflowmax150">';
704 if (!empty($obj->fk_user)) {
705 if (!empty($TLoadedUsers[$obj->fk_user])) {
706 $ustatic = $TLoadedUsers[$obj->fk_user];
708 $ustatic =
new User($db);
709 $ustatic->fetch($obj->fk_user);
710 $TLoadedUsers[$obj->fk_user] = $ustatic;
712 print $ustatic->getNomUrl(-1);
716 $totalarray[
'nbfield']++;
721 if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
722 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans(
"PaymentTypeShort".$obj->payment_code)).
'">';
723 if (!empty($obj->payment_code)) {
724 print $langs->trans(
"PaymentTypeShort".$obj->payment_code);
728 $totalarray[
'nbfield']++;
733 if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
734 print
'<td class="toverflowmax150">';
735 if ($obj->fk_account > 0) {
736 $bankstatic->id = $obj->fk_account;
737 $bankstatic->ref = $obj->bref;
738 $bankstatic->number = $obj->bnumber;
739 $bankstatic->iban = $obj->iban;
740 $bankstatic->bic = $obj->bic;
741 $bankstatic->currency_code = $langs->trans(
"Currency".$obj->currency_code);
742 $bankstatic->account_number = $obj->account_number;
743 $bankstatic->clos = $obj->clos;
748 $bankstatic->label = $obj->blabel;
749 print $bankstatic->getNomUrl(1);
752 if (!$i) $totalarray[
'nbfield']++;
756 if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
757 print
'<td class="nowraponall amount right">'.price($obj->amount).
'</td>';
759 $totalarray[
'nbfield']++;
762 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalttcfield';
764 $totalarray[
'val'][
'totalttcfield'] += $obj->amount;
768 if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
769 print
'<td class="nowraponall right">'.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).
'</td>';
771 $totalarray[
'nbfield']++;
780 $totalarray[
'nbfield']++;
789 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
794 foreach ($arrayfields as $key => $val) {
795 if (!empty($val[
'checked'])) {
799 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
804 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>
$sql);
805 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
806 print $hookmanager->resPrint;
808 print
'</table>'.
"\n";
811 print
'</form>'.
"\n";