33require
'../../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formsocialcontrib.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
39require_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$toselect =
GETPOST(
'toselect',
'array');
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',
'alpha');
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',
'intcomma');
58$search_date_startday =
GETPOSTINT(
'search_date_startday');
59$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
60$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
61$search_date_endday =
GETPOSTINT(
'search_date_endday');
62$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
63$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
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 =
GETPOSTINT(
'search_date_limit_startday');
67$search_date_limit_startmonth =
GETPOSTINT(
'search_date_limit_startmonth');
68$search_date_limit_startyear =
GETPOSTINT(
'search_date_limit_startyear');
69$search_date_limit_endday =
GETPOSTINT(
'search_date_limit_endday');
70$search_date_limit_endmonth =
GETPOSTINT(
'search_date_limit_endmonth');
71$search_date_limit_endyear =
GETPOSTINT(
'search_date_limit_endyear');
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',
'intcomma');
76$search_type =
GETPOST(
'search_type',
'alpha');
77$search_account =
GETPOST(
'search_account',
'alpha');
80$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
81$sortorder =
GETPOST(
"sortorder",
'aZ09comma');
84if (empty($page) || $page == -1) {
87$offset = $limit * $page;
92 $sortfield =
"cs.date_ech";
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,
'enabled' => (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),
113if (isModEnabled(
"bank")) {
114 $arrayfields[
'cs.fk_account'] = array(
'checked' => -1,
'position' => 90,
'label' =>
"DefaultBankAccount");
118'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
121$hookmanager->initHooks(array(
'sclist'));
124$permissiontoadd = $user->hasRight(
'tax',
'charges',
'creer');
125$permissiontodelete = $user->hasRight(
'tax',
'charges',
'supprimer');
130 $socid = $user->socid;
132$result =
restrictedArea($user,
'tax',
'',
'chargesociales',
'charges');
139$parameters = array(
'socid' => $socid);
140$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
146if (empty($reshook)) {
147 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
150 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
156 $search_date_startday =
'';
157 $search_date_startmonth =
'';
158 $search_date_startyear =
'';
159 $search_date_endday =
'';
160 $search_date_endmonth =
'';
161 $search_date_endyear =
'';
162 $search_date_start =
'';
163 $search_date_end =
'';
164 $search_date_limit_startday =
'';
165 $search_date_limit_startmonth =
'';
166 $search_date_limit_startyear =
'';
167 $search_date_limit_endday =
'';
168 $search_date_limit_endmonth =
'';
169 $search_date_limit_endyear =
'';
170 $search_date_limit_start =
'';
171 $search_date_limit_end =
'';
172 $search_project_ref =
'';
175 $search_account =
'';
176 $search_array_options = array();
181 $objectclass =
'ChargeSociales';
182 $objectlabel =
'ChargeSociales';
183 $uploaddir = $conf->tax->dir_output;
184 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
191$form =
new Form($db);
196$projectstatic =
new Project($db);
198llxHeader(
'', $langs->trans(
"SocialContributions"),
'', 0, 0,
'',
'',
'',
'bodyforlist');
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,";
204if (isModEnabled(
'project')) {
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 .=
" pay.code as payment_code";
212$sql .=
", SUM(pc.amount) as alreadypayed";
214$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_chargesociales as c,";
215$sql .=
" ".MAIN_DB_PREFIX.
"chargesociales as cs";
216$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account as ba ON (cs.fk_account = ba.rowid)";
217$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_paiement as pay ON (cs.fk_mode_reglement = pay.id)';
218if (isModEnabled(
'project')) {
219 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = cs.fk_projet";
221$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"paiementcharge as pc ON pc.fk_charge = cs.rowid";
222$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON (cs.fk_user = u.rowid)";
223$sql .=
" WHERE cs.fk_type = c.id";
224$sql .=
" AND cs.entity = ".((int) $conf->entity);
227 $sql .=
" AND cs.ref = '".$db->escape($search_ref).
"'";
232if (isModEnabled(
'project')) {
233 if ($search_project_ref !=
'') {
237if (!empty($search_users)) {
238 $sql .=
' AND cs.fk_user IN ('.$db->sanitize(implode(
', ', $search_users)).
')';
240if (!empty($search_type) && $search_type > 0) {
241 $sql .=
' AND cs.fk_mode_reglement='.((int) $search_type);
243if (!empty($search_account) && $search_account > 0) {
244 $sql .=
' AND cs.fk_account='.((int) $search_account);
249if ($search_status !=
'' && $search_status >= 0) {
250 $sql .=
" AND cs.paye = ".((int) $search_status);
252if ($search_date_start) {
253 $sql .=
" AND cs.date_ech >= '".$db->idate($search_date_start).
"'";
255if ($search_date_end) {
256 $sql .=
" AND cs.date_ech <= '".$db->idate($search_date_end).
"'";
258if ($search_date_limit_start) {
259 $sql .=
" AND cs.periode >= '".$db->idate($search_date_limit_start).
"'";
261if ($search_date_limit_end) {
262 $sql .=
" AND cs.periode <= '".$db->idate($search_date_limit_end).
"'";
264if ($search_typeid > 0) {
265 $sql .=
" AND cs.fk_type = ".((int) $search_typeid);
267$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";
268if (isModEnabled(
'project')) {
269 $sql .=
", p.rowid, p.ref, p.title";
273$nbtotalofrecords =
'';
276 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(DISTINCT cs.rowid) as nbtotalofrecords', $sql);
277 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
278 $resql = $db->query($sqlforcount);
280 $objforcount = $db->fetch_object($resql);
281 $nbtotalofrecords = $objforcount->nbtotalofrecords;
286 if (($page * $limit) > $nbtotalofrecords) {
294$sql .= $db->order($sortfield, $sortorder);
296 $sql .= $db->plimit($limit + 1, $offset);
299$resql = $db->query($sql);
307$num = $db->num_rows($resql);
312 $param .=
'&mode='.urlencode($mode);
314if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
315 $param .=
'&contextpage='.urlencode($contextpage);
317if ($limit > 0 && $limit != $conf->liste_limit) {
318 $param .=
'&limit='.((int) $limit);
321 $param .=
'&search_ref='.urlencode($search_ref);
324 $param .=
'&search_label='.urlencode($search_label);
326if ($search_project_ref >= 0) {
327 $param .=
"&search_project_ref=".urlencode($search_project_ref);
330 $param .=
'&search_amount='.urlencode($search_amount);
333 $param .=
'&search_typeid='.urlencode((
string) ($search_typeid));
336 foreach ($search_users as $id_user) {
337 $param .=
'&search_users[]='.urlencode($id_user);
341 $param .=
'&search_type='.urlencode((
string) ($search_type));
343if ($search_account) {
344 $param .=
'&search_account='.$search_account;
346if ($search_status !=
'' && $search_status !=
'-1') {
347 $param .=
'&search_status='.urlencode($search_status);
349if ($search_date_startday) {
350 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
352if ($search_date_startmonth) {
353 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
355if ($search_date_startyear) {
356 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
358if ($search_date_endday) {
359 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
361if ($search_date_endmonth) {
362 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
364if ($search_date_endyear) {
365 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
367if ($search_date_limit_startday) {
368 $param .=
'&search_date_limit_startday='.urlencode((
string) ($search_date_limit_startday));
370if ($search_date_limit_startmonth) {
371 $param .=
'&search_date_limit_startmonth='.urlencode((
string) ($search_date_limit_startmonth));
373if ($search_date_limit_startyear) {
374 $param .=
'&search_date_limit_startyear='.urlencode((
string) ($search_date_limit_startyear));
376if ($search_date_limit_endday) {
377 $param .=
'&search_date_limit_endday='.urlencode((
string) ($search_date_limit_endday));
379if ($search_date_limit_endmonth) {
380 $param .=
'&search_date_limit_endmonth='.urlencode((
string) ($search_date_limit_endmonth));
382if ($search_date_limit_endyear) {
383 $param .=
'&search_date_limit_endyear='.urlencode((
string) ($search_date_limit_endyear));
386$url = DOL_URL_ROOT.
'/compta/sociales/card.php?action=create';
389$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'));
390$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'));
392$newcardbutton .=
dolGetButtonTitle($langs->trans(
'MenuNewSocialContribution'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
395$arrayofmassactions = array();
396if (!empty($permissiontodelete)) {
397 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
399$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
402print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
403if ($optioncss !=
'') {
404 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
406print
'<input type="hidden" name="token" value="'.newToken().
'">';
407print
'<input type="hidden" name="action" value="list">';
408print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
409print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
410print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
411print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
412print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
413print
'<input type="hidden" name="mode" value="'.$mode.
'">';
417print_barre_liste($langs->trans(
"SocialContributions"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
419if (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'));
434if ($massactionbutton) {
435 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
439$trackid =
'sc'.$object->id;
440include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
442print
'<div class="div-table-responsive">';
443print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
'').
'">'.
"\n";
445print
'<tr class="liste_titre_filter">';
449 print
'<td class="liste_titre maxwidthsearch">';
450 print $form->showFilterAndCheckAddButtons(0);
456 print
'<td class="liste_titre">';
461if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
462 print
'<td class="liste_titre">';
463 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
468if (!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).
'">';
475if (!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);
482if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
483 print
'<td class="liste_titre center">';
484 print
'<div class="nowrapfordate">';
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="nowrapfordate">';
488 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
494if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
495 print
'<td class="liste_titre center">';
496 print
'<div class="nowrapfordate">';
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="nowrapfordate">';
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'));
506if (!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).
'">';
512if (!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);
520if (!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);
527if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
528 print
'<td class="liste_titre">';
529 $form->select_comptes($search_account,
'search_account', 0,
'', 1,
'', 0,
'maxwidth150');
534if (!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).
'">';
541if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
542 print
'<td class="liste_titre right parentonrightofpage">';
543 $liststatus = array(
'0' => $langs->trans(
"Unpaid"),
'1' => $langs->trans(
"Paid"));
545 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
550$parameters = array(
'arrayfields' => $arrayfields);
551$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
552print $hookmanager->resPrint;
556 print
'<td class="liste_titre maxwidthsearch">';
557 print $form->showFilterAndCheckAddButtons(0);
563$totalarray = array();
564$totalarray[
'nbfield'] = 0;
568print
'<tr class="liste_titre">';
571 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch ');
572 $totalarray[
'nbfield']++;
577 $totalarray[
'nbfield']++;
579if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
580 print_liste_field_titre($arrayfields[
'cs.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.rowid",
'', $param,
'', $sortfield, $sortorder);
581 $totalarray[
'nbfield']++;
583if (!empty($arrayfields[
'cs.libelle'][
'checked'])) {
584 print_liste_field_titre($arrayfields[
'cs.libelle'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.libelle,cs.periode",
'', $param,
'', $sortfield, $sortorder);
585 $totalarray[
'nbfield']++;
587if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
588 print_liste_field_titre($arrayfields[
'cs.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_type,cs.periode",
'', $param,
'', $sortfield, $sortorder);
589 $totalarray[
'nbfield']++;
591if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
592 print_liste_field_titre($arrayfields[
'cs.date_ech'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.date_ech,cs.periode",
'', $param,
'', $sortfield, $sortorder,
'center ');
593 $totalarray[
'nbfield']++;
595if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
596 print_liste_field_titre($arrayfields[
'cs.periode'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.periode",
'', $param,
'', $sortfield, $sortorder,
'center ');
597 $totalarray[
'nbfield']++;
599if (!empty($arrayfields[
'p.ref'][
'checked'])) {
600 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
601 $totalarray[
'nbfield']++;
603if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
604 print_liste_field_titre(
"Employee", $_SERVER[
"PHP_SELF"],
"u.lastname,cs.periode",
"", $param,
'class="left"', $sortfield, $sortorder);
605 $totalarray[
'nbfield']++;
607if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
608 print_liste_field_titre($arrayfields[
'cs.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_mode_reglement,cs.periode",
'', $param,
'', $sortfield, $sortorder);
609 $totalarray[
'nbfield']++;
611if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
612 print_liste_field_titre($arrayfields[
'cs.fk_account'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_account,cs.periode",
'', $param,
'', $sortfield, $sortorder);
613 $totalarray[
'nbfield']++;
615if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
616 print_liste_field_titre($arrayfields[
'cs.amount'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.amount,cs.periode",
'', $param,
'class="right"', $sortfield, $sortorder);
617 $totalarray[
'nbfield']++;
619if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
620 print_liste_field_titre($arrayfields[
'cs.paye'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.paye,cs.periode",
'', $param,
'class="right"', $sortfield, $sortorder);
621 $totalarray[
'nbfield']++;
625$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
626$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
627print $hookmanager->resPrint;
630 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch ');
631 $totalarray[
'nbfield']++;
638$savnbfield = $totalarray[
'nbfield'];
639$totalarray = array();
640$totalarray[
'nbfield'] = 0;
641$totalarray[
'val'] = array(
'totalttcfield' => 0);
642$imaxinloop = ($limit ? min($num, $limit) : $num);
643if (!isset($TLoadedUsers) || !is_array($TLoadedUsers)) {
645 $TLoadedUsers = array();
647while ($i < $imaxinloop) {
648 $obj = $db->fetch_object($resql);
650 $chargesociale_static->id = $obj->rowid;
651 $chargesociale_static->ref = $obj->rowid;
652 $chargesociale_static->label = $obj->label;
653 $chargesociale_static->type_label = $obj->type_label;
654 $chargesociale_static->amount = $obj->amount;
655 $chargesociale_static->paye = $obj->paye;
656 $chargesociale_static->date_ech = $obj->date_ech;
658 if (isModEnabled(
'project')) {
659 $projectstatic->id = $obj->project_id;
660 $projectstatic->ref = $obj->project_ref;
661 $projectstatic->title = $obj->project_label;
664 if ($mode ==
'kanban') {
666 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
667 print
'<div class="box-flex-container kanban">';
670 print $chargesociale_static->getKanbanView(
'', array(
'project' => $projectstatic,
'selected' => in_array($chargesociale_static->id, $arrayofselected)));
671 if ($i == ($imaxinloop - 1)) {
676 print
'<tr class="oddeven">';
681 print
'<td class="center">';
682 if ($massactionbutton || $massaction) {
684 if (in_array($chargesociale_static->id, $arrayofselected)) {
687 print
'<input id="cb'.$chargesociale_static->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$chargesociale_static->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
691 $totalarray[
'nbfield']++;
697 print
'<td>'.(($offset * $limit) + $i).
'</td>';
699 $totalarray[
'nbfield']++;
704 if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
705 print
'<td>'.$chargesociale_static->getNomUrl(1,
'20').
'</td>';
707 $totalarray[
'nbfield']++;
712 if (!empty($arrayfields[
'cs.libelle'][
'checked'])) {
713 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).
'">'.
dol_escape_htmltag($obj->label).
'</td>';
715 $totalarray[
'nbfield']++;
720 if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
721 $typelabeltoshow = $obj->type_label;
722 $typelabelpopup = $obj->type_label;
723 if (isModEnabled(
'accounting')) {
724 $typelabelpopup .=
' - '.$langs->trans(
"AccountancyCode").
': '.$obj->type_accountancy_code;
726 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($typelabelpopup).
'">'.
dol_escape_htmltag($typelabeltoshow).
'</td>';
728 $totalarray[
'nbfield']++;
733 if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
734 print
'<td class="center nowraponall">'.dol_print_date($db->jdate($obj->date_ech),
'day').
'</td>';
736 $totalarray[
'nbfield']++;
741 if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
742 print
'<td class="center nowraponall">'.dol_print_date($db->jdate($obj->periode),
'day').
'</td>';
744 $totalarray[
'nbfield']++;
749 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
750 print
'<td class="nowraponall">';
751 if ($obj->project_id > 0) {
752 print $projectstatic->getNomUrl(1);
756 $totalarray[
'nbfield']++;
760 if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
762 print
'<td class="tdoverflowmax150">';
763 if (!empty($obj->fk_user)) {
764 if (!empty($TLoadedUsers[$obj->fk_user])) {
765 $ustatic = $TLoadedUsers[$obj->fk_user];
767 $ustatic =
new User($db);
768 $ustatic->fetch($obj->fk_user);
769 $TLoadedUsers[$obj->fk_user] = $ustatic;
771 print $ustatic->getNomUrl(-1);
775 $totalarray[
'nbfield']++;
780 if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
781 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans(
"PaymentTypeShort".$obj->payment_code)).
'">';
782 if (!empty($obj->payment_code)) {
783 print $langs->trans(
"PaymentTypeShort".$obj->payment_code);
787 $totalarray[
'nbfield']++;
792 if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
793 print
'<td class="toverflowmax150">';
794 if ($obj->fk_account > 0) {
795 $bankstatic->id = $obj->fk_account;
796 $bankstatic->ref = $obj->bref;
797 $bankstatic->number = $obj->bnumber;
798 $bankstatic->iban = $obj->iban;
799 $bankstatic->bic = $obj->bic;
800 $bankstatic->currency_code = $langs->trans(
"Currency".$obj->currency_code);
801 $bankstatic->account_number = $obj->account_number;
802 $bankstatic->clos = $obj->clos;
807 $bankstatic->label = $obj->blabel;
808 print $bankstatic->getNomUrl(1);
812 $totalarray[
'nbfield']++;
817 if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
818 print
'<td class="nowraponall amount right">'.price($obj->amount).
'</td>';
820 $totalarray[
'nbfield']++;
821 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalttcfield';
823 $totalarray[
'val'][
'totalttcfield'] += $obj->amount;
827 if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
828 print
'<td class="nowraponall right">'.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).
'</td>';
830 $totalarray[
'nbfield']++;
836 print
'<td class="center">';
837 if ($massactionbutton || $massaction) {
839 if (in_array($chargesociale_static->id, $arrayofselected)) {
842 print
'<input id="cb'.$chargesociale_static->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$chargesociale_static->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
846 $totalarray[
'nbfield']++;
856include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
861 foreach ($arrayfields as $key => $val) {
862 if (!empty($val[
'checked'])) {
866 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
871$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
872$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
873print $hookmanager->resPrint;
875print
'</table>'.
"\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage bank accounts.
Class for managing the social charges.
Class to manage projects.
Class to manage Dolibarr users.
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...
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
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.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.