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 $toselect =
GETPOST(
'toselect',
'array');
49 $optioncss =
GETPOST(
'optioncss',
'alpha');
50 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'sclist';
51 $mode =
GETPOST(
'mode',
'alpha');
54 $search_ref =
GETPOST(
'search_ref',
'int');
55 $search_label =
GETPOST(
'search_label',
'alpha');
56 $search_typeid =
GETPOST(
'search_typeid',
'int');
57 $search_amount =
GETPOST(
'search_amount',
'alpha');
58 $search_status =
GETPOST(
'search_status',
'int');
59 $search_date_startday =
GETPOST(
'search_date_startday',
'int');
60 $search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
61 $search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
62 $search_date_endday =
GETPOST(
'search_date_endday',
'int');
63 $search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
64 $search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
65 $search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
66 $search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
67 $search_date_limit_startday =
GETPOST(
'search_date_limit_startday',
'int');
68 $search_date_limit_startmonth =
GETPOST(
'search_date_limit_startmonth',
'int');
69 $search_date_limit_startyear =
GETPOST(
'search_date_limit_startyear',
'int');
70 $search_date_limit_endday =
GETPOST(
'search_date_limit_endday',
'int');
71 $search_date_limit_endmonth =
GETPOST(
'search_date_limit_endmonth',
'int');
72 $search_date_limit_endyear =
GETPOST(
'search_date_limit_endyear',
'int');
73 $search_date_limit_start =
dol_mktime(0, 0, 0, $search_date_limit_startmonth, $search_date_limit_startday, $search_date_limit_startyear);
74 $search_date_limit_end =
dol_mktime(23, 59, 59, $search_date_limit_endmonth, $search_date_limit_endday, $search_date_limit_endyear);
75 $search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
76 $search_users =
GETPOST(
'search_users');
77 $search_type =
GETPOST(
'search_type',
'int');
78 $search_account =
GETPOST(
'search_account',
'int');
80 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
81 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
82 $sortorder =
GETPOST(
"sortorder",
'aZ09comma');
85 if (empty($page) || $page == -1) {
88 $offset = $limit * $page;
89 $pageprev = $page - 1;
90 $pagenext = $page + 1;
93 $sortfield =
"cs.date_ech";
99 $filtre =
GETPOST(
"filtre",
'int');
101 $arrayfields = array(
102 'cs.rowid' =>array(
'label'=>
"Ref",
'checked'=>1,
'position'=>10),
103 'cs.libelle' =>array(
'label'=>
"Label",
'checked'=>1,
'position'=>20),
104 'cs.fk_type' =>array(
'label'=>
"Type",
'checked'=>1,
'position'=>30),
105 'cs.date_ech' =>array(
'label'=>
"Date",
'checked'=>1,
'position'=>40),
106 'cs.periode' =>array(
'label'=>
"PeriodEndDate",
'checked'=>1,
'position'=>50),
107 'p.ref' =>array(
'label'=>
"ProjectRef",
'checked'=>1,
'position'=>60,
'enable'=>(
isModEnabled(
'project'))),
108 'cs.fk_user' =>array(
'label'=>
"Employee",
'checked'=>1,
'position'=>70),
109 'cs.fk_mode_reglement' =>array(
'checked'=>-1,
'position'=>80,
'label'=>
"DefaultPaymentMode"),
110 'cs.amount' =>array(
'label'=>
"Amount",
'checked'=>1,
'position'=>100),
111 'cs.paye' =>array(
'label'=>
"Status",
'checked'=>1,
'position'=>110),
115 $arrayfields[
'cs.fk_account'] = array(
'checked'=>-1,
'position'=>90,
'label'=>
"DefaultBankAccount");
121 $hookmanager->initHooks(array(
'sclist'));
125 $socid =
GETPOST(
"socid",
'int');
127 $socid = $user->socid;
129 $result =
restrictedArea($user,
'tax',
'',
'chargesociales',
'charges');
130 $permissiontodelete = $user->rights->tax->charges->supprimer;
137 $parameters = array(
'socid'=>$socid);
138 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
144 if (empty($reshook)) {
145 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
148 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
154 $search_date_startday =
'';
155 $search_date_startmonth =
'';
156 $search_date_startyear =
'';
157 $search_date_endday =
'';
158 $search_date_endmonth =
'';
159 $search_date_endyear =
'';
160 $search_date_start =
'';
161 $search_date_end =
'';
162 $search_date_limit_startday =
'';
163 $search_date_limit_startmonth =
'';
164 $search_date_limit_startyear =
'';
165 $search_date_limit_endday =
'';
166 $search_date_limit_endmonth =
'';
167 $search_date_limit_endyear =
'';
168 $search_date_limit_start =
'';
169 $search_date_limit_end =
'';
170 $search_project_ref =
'';
173 $search_account =
'';
174 $search_array_options = array();
179 $objectclass =
'ChargeSociales';
180 $objectlabel =
'ChargeSociales';
181 $uploaddir = $conf->tax->dir_output;
182 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
191 $bankstatic =
new Account($db);
195 $projectstatic =
new Project($db);
198 llxHeader(
'', $langs->trans(
"SocialContributions"));
200 $arrayofselected = is_array($toselect) ? $toselect : array();
202 $sql =
"SELECT cs.rowid, cs.fk_type as type, cs.fk_user,";
203 $sql .=
" cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode, cs.fk_account,";
205 $sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
207 $sql .=
" c.libelle as type_label, c.accountancy_code as type_accountancy_code,";
208 $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,";
209 $sql .=
" SUM(pc.amount) as alreadypayed, pay.code as payment_code";
213 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_chargesociales as c,";
214 $sql .=
" ".MAIN_DB_PREFIX.
"chargesociales as cs";
215 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account as ba ON (cs.fk_account = ba.rowid)";
216 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_paiement as pay ON (cs.fk_mode_reglement = pay.id)';
218 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = cs.fk_projet";
220 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"paiementcharge as pc ON pc.fk_charge = cs.rowid";
221 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON (cs.fk_user = u.rowid)";
222 $sql .=
" WHERE cs.fk_type = c.id";
223 $sql .=
" AND cs.entity = ".((int) $conf->entity);
226 $sql .=
" AND cs.ref = '".$db->escape($search_ref).
"'";
232 if ($search_project_ref !=
'') {
236 if (!empty($search_users)) {
237 $sql .=
' AND cs.fk_user IN ('.$db->sanitize(implode(
', ', $search_users)).
')';
239 if (!empty($search_type) && $search_type > 0) {
240 $sql .=
' AND cs.fk_mode_reglement='.((int) $search_type);
242 if (!empty($search_account) && $search_account > 0) {
243 $sql .=
' AND cs.fk_account='.((int) $search_account);
245 if ($search_amount) {
248 if ($search_status !=
'' && $search_status >= 0) {
249 $sql .=
" AND cs.paye = ".((int) $search_status);
251 if ($search_date_start) {
252 $sql .=
" AND cs.date_ech >= '".$db->idate($search_date_start).
"'";
254 if ($search_date_end) {
255 $sql .=
" AND cs.date_ech <= '".$db->idate($search_date_end).
"'";
257 if ($search_date_limit_start) {
258 $sql .=
" AND cs.periode >= '".$db->idate($search_date_limit_start).
"'";
260 if ($search_date_limit_end) {
261 $sql .=
" AND cs.periode <= '".$db->idate($search_date_limit_end).
"'";
263 if ($search_typeid > 0) {
264 $sql .=
" AND cs.fk_type = ".((int) $search_typeid);
266 $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";
268 $sql .=
", p.rowid, p.ref, p.title";
272 $nbtotalofrecords =
'';
275 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
276 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
277 $resql = $db->query($sqlforcount);
279 $objforcount = $db->fetch_object($resql);
280 $nbtotalofrecords = $objforcount->nbtotalofrecords;
285 if (($page * $limit) > $nbtotalofrecords) {
293 $sql .= $db->order($sortfield, $sortorder);
295 $sql .= $db->plimit($limit + 1, $offset);
298 $resql = $db->query(
$sql);
306 $num = $db->num_rows($resql);
311 $param .=
'&mode='.urlencode($mode);
313 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
314 $param .=
'&contextpage='.urlencode($contextpage);
316 if ($limit > 0 && $limit != $conf->liste_limit) {
317 $param .=
'&limit='.((int) $limit);
320 $param .=
'&search_ref='.urlencode($search_ref);
323 $param .=
'&search_label='.urlencode($search_label);
325 if ($search_project_ref >= 0) {
326 $param .=
"&search_project_ref=".urlencode($search_project_ref);
328 if ($search_amount) {
329 $param .=
'&search_amount='.urlencode($search_amount);
331 if ($search_typeid) {
332 $param .=
'&search_typeid='.urlencode($search_typeid);
335 foreach ($search_users as $id_user) {
336 $param .=
'&search_users[]='.urlencode($id_user);
340 $param .=
'&search_type='.urlencode($search_type);
342 if ($search_account) {
343 $param .=
'&search_account='.$search_account;
345 if ($search_status !=
'' && $search_status !=
'-1') {
346 $param .=
'&search_status='.urlencode($search_status);
348 if ($search_date_startday) {
349 $param .=
'&search_date_startday='.urlencode($search_date_startday);
351 if ($search_date_startmonth) {
352 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
354 if ($search_date_startyear) {
355 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
357 if ($search_date_endday) {
358 $param .=
'&search_date_endday='.urlencode($search_date_endday);
360 if ($search_date_endmonth) {
361 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
363 if ($search_date_endyear) {
364 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
366 if ($search_date_limit_startday) {
367 $param .=
'&search_date_limit_startday='.urlencode($search_date_limit_startday);
369 if ($search_date_limit_startmonth) {
370 $param .=
'&search_date_limit_startmonth='.urlencode($search_date_limit_startmonth);
372 if ($search_date_limit_startyear) {
373 $param .=
'&search_date_limit_startyear='.urlencode($search_date_limit_startyear);
375 if ($search_date_limit_endday) {
376 $param .=
'&search_date_limit_endday='.urlencode($search_date_limit_endday);
378 if ($search_date_limit_endmonth) {
379 $param .=
'&search_date_limit_endmonth='.urlencode($search_date_limit_endmonth);
381 if ($search_date_limit_endyear) {
382 $param .=
'&search_date_limit_endyear='.urlencode($search_date_limit_endyear);
386 $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'));
387 $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'));
388 if ($user->rights->tax->charges->creer) {
389 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'MenuNewSocialContribution'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/compta/sociales/card.php?action=create');
394 $arrayofmassactions = array();
395 if (!empty($permissiontodelete)) {
396 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
398 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
401 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
402 if ($optioncss !=
'') {
403 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
405 print
'<input type="hidden" name="token" value="'.newToken().
'">';
406 print
'<input type="hidden" name="action" value="list">';
407 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
408 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
409 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
410 print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
411 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
412 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
417 print_barre_liste($langs->trans(
"SocialContributions"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
419 if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
420 print
'<div class="error">';
421 $langs->load(
"errors");
422 $countrynotdefined = $langs->trans(
"ErrorSetACountryFirst");
423 print $countrynotdefined;
432 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
433 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
434 if ($massactionbutton) {
435 $selectedfields .=
$form->showCheckAddButtons(
'checkforselect', 1);
439 $trackid =
'sc'.$object->id;
440 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
442 print
'<div class="div-table-responsive">';
443 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
'').
'">'.
"\n";
445 print
'<tr class="liste_titre_filter">';
449 print
'<td class="liste_titre maxwidthsearch">';
450 print
$form->showFilterAndCheckAddButtons(0);
455 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
456 print
'<td class="liste_titre">';
461 if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
462 print
'<td class="liste_titre">';
463 print
'<input class="flat maxwidth75" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
468 if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
469 print
'<td class="liste_titre">';
470 print
'<input type="text" class="flat maxwidth100" name="search_label" value="'.dol_escape_htmltag($search_label).
'">';
475 if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
476 print
'<td class="liste_titre">';
477 $formsocialcontrib->select_type_socialcontrib($search_typeid,
'search_typeid', 1, 0, 0,
'maxwidth150', 1);
482 if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
483 print
'<td class="liste_titre center">';
484 print
'<div class="nowrap">';
485 print
$form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
487 print
'<div class="nowrap">';
488 print
$form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
494 if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
495 print
'<td class="liste_titre center">';
496 print
'<div class="nowrap">';
497 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'));
499 print
'<div class="nowrap">';
500 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'));
506 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
507 print
'<td class="liste_titre">';
508 print
'<input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'">';
512 if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
514 print
'<td class="liste_titre">';
515 print
$form->select_dolusers($search_users,
'search_users', 1,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth150', 0, 0,
true);
520 if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
521 print
'<td class="liste_titre">';
522 print
$form->select_types_paiements($search_type,
'search_type',
'', 0, 1, 1, 0, 1,
'maxwidth150', 1);
527 if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
528 print
'<td class="liste_titre">';
529 $form->select_comptes($search_account,
'search_account', 0,
'', 1,
'', 0,
'maxwidth150');
534 if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
535 print
'<td class="liste_titre right">';
536 print
'<input class="flat maxwidth75" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).
'">';
541 if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
542 print
'<td class="liste_titre right parentonrightofpage">';
543 $liststatus = array(
'0'=>$langs->trans(
"Unpaid"),
'1'=>$langs->trans(
"Paid"));
544 print
$form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
549 $parameters = array(
'arrayfields'=>$arrayfields);
550 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
551 print $hookmanager->resPrint;
555 print
'<td class="liste_titre maxwidthsearch">';
556 print
$form->showFilterAndCheckAddButtons(0);
562 print
'<tr class="liste_titre">';
565 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch ');
568 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
571 if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
572 print_liste_field_titre($arrayfields[
'cs.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.rowid",
'', $param,
'', $sortfield, $sortorder);
574 if (!empty($arrayfields[
'cs.libelle'][
'checked'])) {
575 print_liste_field_titre($arrayfields[
'cs.libelle'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.libelle,cs.periode",
'', $param,
'', $sortfield, $sortorder);
577 if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
578 print_liste_field_titre($arrayfields[
'cs.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_type,cs.periode",
'', $param,
'', $sortfield, $sortorder);
580 if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
581 print_liste_field_titre($arrayfields[
'cs.date_ech'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.date_ech,cs.periode",
'', $param,
'', $sortfield, $sortorder,
'center ');
583 if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
584 print_liste_field_titre($arrayfields[
'cs.periode'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.periode",
'', $param,
'', $sortfield, $sortorder,
'center ');
586 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
587 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
589 if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
590 print_liste_field_titre(
"Employee", $_SERVER[
"PHP_SELF"],
"u.lastname,cs.periode",
"", $param,
'class="left"', $sortfield, $sortorder);
592 if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
593 print_liste_field_titre($arrayfields[
'cs.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_mode_reglement,cs.periode",
'', $param,
'', $sortfield, $sortorder);
595 if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
596 print_liste_field_titre($arrayfields[
'cs.fk_account'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_account,cs.periode",
'', $param,
'', $sortfield, $sortorder);
598 if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
599 print_liste_field_titre($arrayfields[
'cs.amount'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.amount,cs.periode",
'', $param,
'class="right"', $sortfield, $sortorder);
601 if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
602 print_liste_field_titre($arrayfields[
'cs.paye'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.paye,cs.periode",
'', $param,
'class="right"', $sortfield, $sortorder);
606 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
607 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
608 print $hookmanager->resPrint;
611 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch ');
616 $totalarray = $TLoadedUsers = array();
617 $savnbfield = $totalarray[
'nbfield'];
618 $totalarray[
'nbfield'] = 0;
619 $totalarray[
'val'][
'totalttcfield'] = 0;
620 $imaxinloop = ($limit ? min($num, $limit) : $num);
621 while ($i < $imaxinloop) {
622 $obj = $db->fetch_object($resql);
624 $chargesociale_static->id = $obj->rowid;
625 $chargesociale_static->ref = $obj->rowid;
626 $chargesociale_static->label = $obj->label;
627 $chargesociale_static->type_label = $obj->type_label;
628 $chargesociale_static->amount = $obj->amount;
629 $chargesociale_static->paye = $obj->paye;
630 $chargesociale_static->date_ech = $obj->date_ech;
634 $projectstatic->id = $obj->project_id;
635 $projectstatic->ref = $obj->project_ref;
636 $projectstatic->title = $obj->project_label;
638 if ($mode ==
'kanban') {
640 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
641 print
'<div class="box-flex-container kanban">';
644 print $chargesociale_static->getKanbanView(
'', array(
'projectlink'=> $projectstatic->getNomUrl(1),
'selected' => in_array($chargesociale_static->id, $arrayofselected)));
645 if ($i == ($imaxinloop - 1)) {
650 print
'<tr class="oddeven">';
655 print
'<td class="center">';
656 if ($massactionbutton || $massaction) {
658 if (in_array($chargesociale_static->id, $arrayofselected)) {
661 print
'<input id="cb'.$chargesociale_static->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$chargesociale_static->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
667 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
668 print
'<td>'.(($offset * $limit) + $i).
'</td>';
670 $totalarray[
'nbfield']++;
675 if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
676 print
'<td>'.$chargesociale_static->getNomUrl(1,
'20').
'</td>';
678 $totalarray[
'nbfield']++;
683 if (!empty($arrayfields[
'cs.libelle'][
'checked'])) {
684 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).
'">'.
dol_escape_htmltag($obj->label).
'</td>';
686 $totalarray[
'nbfield']++;
691 if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
692 $typelabeltoshow = $obj->type_label;
693 $typelabelpopup = $obj->type_label;
695 $typelabelpopup .=
' - '.$langs->trans(
"AccountancyCode").
': '.$obj->type_accountancy_code;
697 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($typelabelpopup).
'">'.
dol_escape_htmltag($typelabeltoshow).
'</td>';
699 $totalarray[
'nbfield']++;
704 if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
705 print
'<td class="center nowraponall">'.dol_print_date($db->jdate($obj->date_ech),
'day').
'</td>';
707 $totalarray[
'nbfield']++;
712 if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
713 print
'<td class="center nowraponall">'.dol_print_date($db->jdate($obj->periode),
'day').
'</td>';
715 $totalarray[
'nbfield']++;
720 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
721 print
'<td class="nowraponall">';
722 if ($obj->project_id > 0) {
723 print $projectstatic->getNomUrl(1);
727 $totalarray[
'nbfield']++;
731 if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
733 print
'<td class="tdoverflowmax150">';
734 if (!empty($obj->fk_user)) {
735 if (!empty($TLoadedUsers[$obj->fk_user])) {
736 $ustatic = $TLoadedUsers[$obj->fk_user];
738 $ustatic =
new User($db);
739 $ustatic->fetch($obj->fk_user);
740 $TLoadedUsers[$obj->fk_user] = $ustatic;
742 print $ustatic->getNomUrl(-1);
746 $totalarray[
'nbfield']++;
751 if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
752 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans(
"PaymentTypeShort".$obj->payment_code)).
'">';
753 if (!empty($obj->payment_code)) {
754 print $langs->trans(
"PaymentTypeShort".$obj->payment_code);
758 $totalarray[
'nbfield']++;
763 if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
764 print
'<td class="toverflowmax150">';
765 if ($obj->fk_account > 0) {
766 $bankstatic->id = $obj->fk_account;
767 $bankstatic->ref = $obj->bref;
768 $bankstatic->number = $obj->bnumber;
769 $bankstatic->iban = $obj->iban;
770 $bankstatic->bic = $obj->bic;
771 $bankstatic->currency_code = $langs->trans(
"Currency".$obj->currency_code);
772 $bankstatic->account_number = $obj->account_number;
773 $bankstatic->clos = $obj->clos;
778 $bankstatic->label = $obj->blabel;
779 print $bankstatic->getNomUrl(1);
782 if (!$i) $totalarray[
'nbfield']++;
786 if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
787 print
'<td class="nowraponall amount right">'.price($obj->amount).
'</td>';
789 $totalarray[
'nbfield']++;
792 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalttcfield';
794 $totalarray[
'val'][
'totalttcfield'] += $obj->amount;
798 if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
799 print
'<td class="nowraponall right">'.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).
'</td>';
801 $totalarray[
'nbfield']++;
807 print
'<td class="center">';
808 if ($massactionbutton || $massaction) {
810 if (in_array($chargesociale_static->id, $arrayofselected)) {
813 print
'<input id="cb'.$chargesociale_static->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$chargesociale_static->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
818 $totalarray[
'nbfield']++;
827 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
832 foreach ($arrayfields as $key => $val) {
833 if (!empty($val[
'checked'])) {
837 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
842 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>
$sql);
843 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
844 print $hookmanager->resPrint;
846 print
'</table>'.
"\n";
849 print
'</form>'.
"\n";