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';
50$langs->loadLangs(array(
'compta',
'banks',
'bills',
'hrm',
'projects'));
52$action =
GETPOST(
'action',
'aZ09');
53$massaction =
GETPOST(
'massaction',
'alpha');
54$confirm =
GETPOST(
'confirm',
'alpha');
55$toselect =
GETPOST(
'toselect',
'array');
56$optioncss =
GETPOST(
'optioncss',
'alpha');
57$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'sclist';
58$mode =
GETPOST(
'mode',
'alpha');
61$search_ref =
GETPOST(
'search_ref',
'alpha');
62$search_label =
GETPOST(
'search_label',
'alpha');
63$search_typeid =
GETPOST(
'search_typeid',
'int');
64$search_amount =
GETPOST(
'search_amount',
'alpha');
65$search_status =
GETPOST(
'search_status',
'intcomma');
66$search_date_startday =
GETPOSTINT(
'search_date_startday');
67$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
68$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
69$search_date_endday =
GETPOSTINT(
'search_date_endday');
70$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
71$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
72$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
73$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
74$search_date_limit_startday =
GETPOSTINT(
'search_date_limit_startday');
75$search_date_limit_startmonth =
GETPOSTINT(
'search_date_limit_startmonth');
76$search_date_limit_startyear =
GETPOSTINT(
'search_date_limit_startyear');
77$search_date_limit_endday =
GETPOSTINT(
'search_date_limit_endday');
78$search_date_limit_endmonth =
GETPOSTINT(
'search_date_limit_endmonth');
79$search_date_limit_endyear =
GETPOSTINT(
'search_date_limit_endyear');
80$search_date_limit_start =
dol_mktime(0, 0, 0, $search_date_limit_startmonth, $search_date_limit_startday, $search_date_limit_startyear);
81$search_date_limit_end =
dol_mktime(23, 59, 59, $search_date_limit_endmonth, $search_date_limit_endday, $search_date_limit_endyear);
82$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
83$search_users =
GETPOST(
'search_users',
'intcomma');
84$search_type =
GETPOST(
'search_type',
'alpha');
85$search_account =
GETPOST(
'search_account',
'alpha');
88$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
89$sortorder =
GETPOST(
"sortorder",
'aZ09comma');
92if (empty($page) || $page == -1) {
95$offset = $limit * $page;
100 $sortfield =
"cs.date_ech";
109 'cs.rowid' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 10),
110 'cs.libelle' => array(
'label' =>
"Label",
'checked' => 1,
'position' => 20),
111 'cs.fk_type' => array(
'label' =>
"Type",
'checked' => 1,
'position' => 30),
112 'cs.date_ech' => array(
'label' =>
"Date",
'checked' => 1,
'position' => 40),
113 'cs.periode' => array(
'label' =>
"PeriodEndDate",
'checked' => 1,
'position' => 50),
114 'p.ref' => array(
'label' =>
"ProjectRef",
'checked' => 1,
'position' => 60,
'enabled' => (isModEnabled(
'project'))),
115 'cs.fk_user' => array(
'label' =>
"Employee",
'checked' => 1,
'position' => 70),
116 'cs.fk_mode_reglement' => array(
'checked' => -1,
'position' => 80,
'label' =>
"DefaultPaymentMode"),
117 'cs.amount' => array(
'label' =>
"Amount",
'checked' => 1,
'position' => 100),
118 'cs.paye' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 110),
121if (isModEnabled(
"bank")) {
122 $arrayfields[
'cs.fk_account'] = array(
'checked' => -1,
'position' => 90,
'label' =>
"DefaultBankAccount");
126'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
129$hookmanager->initHooks(array(
'sclist'));
132$permissiontoadd = $user->hasRight(
'tax',
'charges',
'creer');
133$permissiontodelete = $user->hasRight(
'tax',
'charges',
'supprimer');
138 $socid = $user->socid;
140$result =
restrictedArea($user,
'tax',
'',
'chargesociales',
'charges');
147$parameters = array(
'socid' => $socid);
148$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
154if (empty($reshook)) {
155 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
158 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
164 $search_date_startday =
'';
165 $search_date_startmonth =
'';
166 $search_date_startyear =
'';
167 $search_date_endday =
'';
168 $search_date_endmonth =
'';
169 $search_date_endyear =
'';
170 $search_date_start =
'';
171 $search_date_end =
'';
172 $search_date_limit_startday =
'';
173 $search_date_limit_startmonth =
'';
174 $search_date_limit_startyear =
'';
175 $search_date_limit_endday =
'';
176 $search_date_limit_endmonth =
'';
177 $search_date_limit_endyear =
'';
178 $search_date_limit_start =
'';
179 $search_date_limit_end =
'';
180 $search_project_ref =
'';
183 $search_account =
'';
184 $search_array_options = array();
189 $objectclass =
'ChargeSociales';
190 $objectlabel =
'ChargeSociales';
191 $uploaddir =
$conf->tax->dir_output;
192 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
199$form =
new Form($db);
204$projectstatic =
new Project($db);
206$title = $langs->trans(
"SocialContributions");
208llxHeader(
'', $title,
'',
'', 0, 0,
'',
'',
'',
'bodyforlist');
210$arrayofselected = is_array($toselect) ? $toselect : array();
212$sql =
"SELECT cs.rowid, cs.fk_type as type, cs.fk_user,";
213$sql .=
" cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode, cs.fk_account,";
214if (isModEnabled(
'project')) {
215 $sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
217$sql .=
" c.libelle as type_label, c.accountancy_code as type_accountancy_code,";
218$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,";
219$sql .=
" pay.code as payment_code";
222$sql .=
", SUM(pc.amount) as alreadypayed";
224$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_chargesociales as c,";
225$sql .=
" ".MAIN_DB_PREFIX.
"chargesociales as cs";
226$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account as ba ON (cs.fk_account = ba.rowid)";
227$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_paiement as pay ON (cs.fk_mode_reglement = pay.id)';
228if (isModEnabled(
'project')) {
229 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = cs.fk_projet";
231$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"paiementcharge as pc ON pc.fk_charge = cs.rowid";
232$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON (cs.fk_user = u.rowid)";
233$sql .=
" WHERE cs.fk_type = c.id";
234$sql .=
" AND cs.entity = ".((int)
$conf->entity);
237 $sql .=
" AND cs.ref = '".$db->escape($search_ref).
"'";
242if (isModEnabled(
'project')) {
243 if ($search_project_ref !=
'') {
247if (!empty($search_users)) {
248 $sql .=
' AND cs.fk_user IN ('.$db->sanitize(implode(
', ', $search_users)).
')';
250if (!empty($search_type) && $search_type > 0) {
251 $sql .=
' AND cs.fk_mode_reglement='.((int) $search_type);
253if (!empty($search_account) && $search_account > 0) {
254 $sql .=
' AND cs.fk_account='.((int) $search_account);
259if ($search_status !=
'' && $search_status >= 0) {
260 $sql .=
" AND cs.paye = ".((int) $search_status);
262if ($search_date_start) {
263 $sql .=
" AND cs.date_ech >= '".$db->idate($search_date_start).
"'";
265if ($search_date_end) {
266 $sql .=
" AND cs.date_ech <= '".$db->idate($search_date_end).
"'";
268if ($search_date_limit_start) {
269 $sql .=
" AND cs.periode >= '".$db->idate($search_date_limit_start).
"'";
271if ($search_date_limit_end) {
272 $sql .=
" AND cs.periode <= '".$db->idate($search_date_limit_end).
"'";
274if ($search_typeid > 0) {
275 $sql .=
" AND cs.fk_type = ".((int) $search_typeid);
277$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";
278if (isModEnabled(
'project')) {
279 $sql .=
", p.rowid, p.ref, p.title";
283$nbtotalofrecords =
'';
286 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(DISTINCT cs.rowid) as nbtotalofrecords', $sql);
287 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
288 $resql = $db->query($sqlforcount);
290 $objforcount = $db->fetch_object($resql);
291 $nbtotalofrecords = $objforcount->nbtotalofrecords;
296 if (($page * $limit) > $nbtotalofrecords) {
304$sql .= $db->order($sortfield, $sortorder);
306 $sql .= $db->plimit($limit + 1, $offset);
309$resql = $db->query($sql);
317$num = $db->num_rows($resql);
322 $param .=
'&mode='.urlencode($mode);
324if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
325 $param .=
'&contextpage='.urlencode($contextpage);
327if ($limit > 0 && $limit !=
$conf->liste_limit) {
328 $param .=
'&limit='.((int) $limit);
331 $param .=
'&search_ref='.urlencode($search_ref);
334 $param .=
'&search_label='.urlencode($search_label);
336if ($search_project_ref >= 0) {
337 $param .=
"&search_project_ref=".urlencode($search_project_ref);
340 $param .=
'&search_amount='.urlencode($search_amount);
343 $param .=
'&search_typeid='.urlencode((
string) ($search_typeid));
346 foreach ($search_users as $id_user) {
347 $param .=
'&search_users[]='.urlencode($id_user);
351 $param .=
'&search_type='.urlencode((
string) ($search_type));
353if ($search_account) {
354 $param .=
'&search_account='.$search_account;
356if ($search_status !=
'' && $search_status !=
'-1') {
357 $param .=
'&search_status='.urlencode($search_status);
359if ($search_date_startday) {
360 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
362if ($search_date_startmonth) {
363 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
365if ($search_date_startyear) {
366 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
368if ($search_date_endday) {
369 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
371if ($search_date_endmonth) {
372 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
374if ($search_date_endyear) {
375 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
377if ($search_date_limit_startday) {
378 $param .=
'&search_date_limit_startday='.urlencode((
string) ($search_date_limit_startday));
380if ($search_date_limit_startmonth) {
381 $param .=
'&search_date_limit_startmonth='.urlencode((
string) ($search_date_limit_startmonth));
383if ($search_date_limit_startyear) {
384 $param .=
'&search_date_limit_startyear='.urlencode((
string) ($search_date_limit_startyear));
386if ($search_date_limit_endday) {
387 $param .=
'&search_date_limit_endday='.urlencode((
string) ($search_date_limit_endday));
389if ($search_date_limit_endmonth) {
390 $param .=
'&search_date_limit_endmonth='.urlencode((
string) ($search_date_limit_endmonth));
392if ($search_date_limit_endyear) {
393 $param .=
'&search_date_limit_endyear='.urlencode((
string) ($search_date_limit_endyear));
396$url = DOL_URL_ROOT.
'/compta/sociales/card.php?action=create';
399$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'));
400$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'));
402$newcardbutton .=
dolGetButtonTitle($langs->trans(
'MenuNewSocialContribution'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
405$arrayofmassactions = array();
406if (!empty($permissiontodelete)) {
407 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
409$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
412print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
413if ($optioncss !=
'') {
414 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
416print
'<input type="hidden" name="token" value="'.newToken().
'">';
417print
'<input type="hidden" name="action" value="list">';
418print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
419print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
420print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
421print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
422print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
423print
'<input type="hidden" name="mode" value="'.$mode.
'">';
427print_barre_liste($langs->trans(
"SocialContributions"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
429if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
430 print
'<div class="error">';
431 $langs->load(
"errors");
432 $countrynotdefined = $langs->trans(
"ErrorSetACountryFirst");
433 print $countrynotdefined;
442$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
443$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
444if ($massactionbutton) {
445 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
449$trackid =
'sc'.$object->id;
450include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
452print
'<div class="div-table-responsive">';
453print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
'').
'">'.
"\n";
455print
'<tr class="liste_titre_filter">';
459 print
'<td class="liste_titre maxwidthsearch">';
460 print $form->showFilterAndCheckAddButtons(0);
466 print
'<td class="liste_titre">';
471if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
472 print
'<td class="liste_titre">';
473 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
478if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
479 print
'<td class="liste_titre">';
480 print
'<input type="text" class="flat maxwidth100" name="search_label" value="'.dol_escape_htmltag($search_label).
'">';
485if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
486 print
'<td class="liste_titre">';
487 $formsocialcontrib->select_type_socialcontrib($search_typeid,
'search_typeid', 1, 0, 0,
'maxwidth150', 1);
492if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
493 print
'<td class="liste_titre center">';
494 print
'<div class="nowrapfordate">';
495 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
497 print
'<div class="nowrapfordate">';
498 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
504if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
505 print
'<td class="liste_titre center">';
506 print
'<div class="nowrapfordate">';
507 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'));
509 print
'<div class="nowrapfordate">';
510 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'));
516if (!empty($arrayfields[
'p.ref'][
'checked'])) {
517 print
'<td class="liste_titre">';
518 print
'<input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'">';
522if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
524 print
'<td class="liste_titre">';
525 print $form->select_dolusers($search_users,
'search_users', 1,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth150', 0, 0,
true);
530if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
531 print
'<td class="liste_titre">';
532 print $form->select_types_paiements($search_type,
'search_type',
'', 0, 1, 1, 0, 1,
'maxwidth150', 1);
537if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
538 print
'<td class="liste_titre">';
539 $form->select_comptes($search_account,
'search_account', 0,
'', 1,
'', 0,
'maxwidth150');
544if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
545 print
'<td class="liste_titre right">';
546 print
'<input class="flat maxwidth75" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).
'">';
551if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
552 print
'<td class="liste_titre right parentonrightofpage">';
553 $liststatus = array(
'0' => $langs->trans(
"Unpaid"),
'1' => $langs->trans(
"Paid"));
555 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
560$parameters = array(
'arrayfields' => $arrayfields);
561$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
562print $hookmanager->resPrint;
566 print
'<td class="liste_titre maxwidthsearch">';
567 print $form->showFilterAndCheckAddButtons(0);
573$totalarray = array();
574$totalarray[
'nbfield'] = 0;
578print
'<tr class="liste_titre">';
581 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch ');
582 $totalarray[
'nbfield']++;
587 $totalarray[
'nbfield']++;
589if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
591 print_liste_field_titre($arrayfields[
'cs.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.rowid",
'', $param,
'', $sortfield, $sortorder);
592 $totalarray[
'nbfield']++;
594if (!empty($arrayfields[
'cs.libelle'][
'checked'])) {
595 print_liste_field_titre($arrayfields[
'cs.libelle'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.libelle,cs.periode",
'', $param,
'', $sortfield, $sortorder);
596 $totalarray[
'nbfield']++;
598if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
599 print_liste_field_titre($arrayfields[
'cs.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_type,cs.periode",
'', $param,
'', $sortfield, $sortorder);
600 $totalarray[
'nbfield']++;
602if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
603 print_liste_field_titre($arrayfields[
'cs.date_ech'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.date_ech,cs.periode",
'', $param,
'', $sortfield, $sortorder,
'center ');
604 $totalarray[
'nbfield']++;
606if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
607 print_liste_field_titre($arrayfields[
'cs.periode'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.periode",
'', $param,
'', $sortfield, $sortorder,
'center ');
608 $totalarray[
'nbfield']++;
610if (!empty($arrayfields[
'p.ref'][
'checked'])) {
611 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
612 $totalarray[
'nbfield']++;
614if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
615 print_liste_field_titre(
"Employee", $_SERVER[
"PHP_SELF"],
"u.lastname,cs.periode",
"", $param,
'class="left"', $sortfield, $sortorder);
616 $totalarray[
'nbfield']++;
618if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
619 print_liste_field_titre($arrayfields[
'cs.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_mode_reglement,cs.periode",
'', $param,
'', $sortfield, $sortorder);
620 $totalarray[
'nbfield']++;
622if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
623 print_liste_field_titre($arrayfields[
'cs.fk_account'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_account,cs.periode",
'', $param,
'', $sortfield, $sortorder);
624 $totalarray[
'nbfield']++;
626if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
627 print_liste_field_titre($arrayfields[
'cs.amount'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.amount,cs.periode",
'', $param,
'class="right"', $sortfield, $sortorder);
628 $totalarray[
'nbfield']++;
630if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
631 print_liste_field_titre($arrayfields[
'cs.paye'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.paye,cs.periode",
'', $param,
'class="right"', $sortfield, $sortorder);
632 $totalarray[
'nbfield']++;
636$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
637$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
638print $hookmanager->resPrint;
641 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch ');
642 $totalarray[
'nbfield']++;
649$savnbfield = $totalarray[
'nbfield'];
650$totalarray = array();
651$totalarray[
'nbfield'] = 0;
652$totalarray[
'val'] = array(
'totalttcfield' => 0);
653$imaxinloop = ($limit ? min($num, $limit) : $num);
654$TLoadedUsers = array();
656while ($i < $imaxinloop) {
657 $obj = $db->fetch_object($resql);
659 $chargesociale_static->id = $obj->rowid;
660 $chargesociale_static->ref = $obj->rowid;
661 $chargesociale_static->label = $obj->label;
662 $chargesociale_static->type_label = $obj->type_label;
663 $chargesociale_static->amount = $obj->amount;
664 $chargesociale_static->paye = $obj->paye;
665 $chargesociale_static->date_ech = $obj->date_ech;
667 if (isModEnabled(
'project')) {
668 $projectstatic->id = $obj->project_id;
669 $projectstatic->ref = $obj->project_ref;
670 $projectstatic->title = $obj->project_label;
673 if ($mode ==
'kanban') {
675 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
676 print
'<div class="box-flex-container kanban">';
679 print $chargesociale_static->getKanbanView(
'', array(
'project' => $projectstatic,
'selected' => in_array($chargesociale_static->id, $arrayofselected)));
680 if ($i == ($imaxinloop - 1)) {
685 print
'<tr class="oddeven">';
690 print
'<td class="center">';
691 if ($massactionbutton || $massaction) {
693 if (in_array($chargesociale_static->id, $arrayofselected)) {
696 print
'<input id="cb'.$chargesociale_static->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$chargesociale_static->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
700 $totalarray[
'nbfield']++;
706 print
'<td>'.(($offset * $limit) + $i).
'</td>';
708 $totalarray[
'nbfield']++;
713 if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
714 print
'<td>'.$chargesociale_static->getNomUrl(1,
'20').
'</td>';
716 $totalarray[
'nbfield']++;
721 if (!empty($arrayfields[
'cs.libelle'][
'checked'])) {
722 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).
'">'.
dol_escape_htmltag($obj->label).
'</td>';
724 $totalarray[
'nbfield']++;
729 if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
730 $typelabeltoshow = $obj->type_label;
731 $typelabelpopup = $obj->type_label;
732 if (isModEnabled(
'accounting')) {
733 $typelabelpopup .=
' - '.$langs->trans(
"AccountancyCode").
': '.$obj->type_accountancy_code;
735 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($typelabelpopup).
'">'.
dol_escape_htmltag($typelabeltoshow).
'</td>';
737 $totalarray[
'nbfield']++;
742 if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
743 print
'<td class="center nowraponall">'.dol_print_date($db->jdate($obj->date_ech),
'day').
'</td>';
745 $totalarray[
'nbfield']++;
750 if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
751 print
'<td class="center nowraponall">'.dol_print_date($db->jdate($obj->periode),
'day').
'</td>';
753 $totalarray[
'nbfield']++;
758 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
759 print
'<td class="nowraponall">';
760 if ($obj->project_id > 0) {
761 print $projectstatic->getNomUrl(1);
765 $totalarray[
'nbfield']++;
769 if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
771 print
'<td class="tdoverflowmax150">';
772 if (!empty($obj->fk_user)) {
773 if (!empty($TLoadedUsers[$obj->fk_user])) {
774 $ustatic = $TLoadedUsers[$obj->fk_user];
776 $ustatic =
new User($db);
777 $ustatic->fetch($obj->fk_user);
778 $TLoadedUsers[$obj->fk_user] = $ustatic;
780 print $ustatic->getNomUrl(-1);
784 $totalarray[
'nbfield']++;
789 if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
790 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans(
"PaymentTypeShort".$obj->payment_code)).
'">';
791 if (!empty($obj->payment_code)) {
792 print $langs->trans(
"PaymentTypeShort".$obj->payment_code);
796 $totalarray[
'nbfield']++;
801 if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
802 print
'<td class="toverflowmax150">';
803 if ($obj->fk_account > 0) {
804 $bankstatic->id = $obj->fk_account;
805 $bankstatic->ref = $obj->bref;
806 $bankstatic->number = $obj->bnumber;
807 $bankstatic->iban = $obj->iban;
808 $bankstatic->bic = $obj->bic;
809 $bankstatic->currency_code = $langs->trans(
"Currency".$obj->currency_code);
810 $bankstatic->account_number = $obj->account_number;
811 $bankstatic->clos = $obj->clos;
816 $bankstatic->label = $obj->blabel;
817 print $bankstatic->getNomUrl(1);
821 $totalarray[
'nbfield']++;
826 if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
827 print
'<td class="nowraponall amount right">'.price($obj->amount).
'</td>';
829 $totalarray[
'nbfield']++;
830 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalttcfield';
832 $totalarray[
'val'][
'totalttcfield'] += $obj->amount;
836 if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
837 print
'<td class="nowraponall right">'.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).
'</td>';
839 $totalarray[
'nbfield']++;
845 print
'<td class="center">';
846 if ($massactionbutton || $massaction) {
848 if (in_array($chargesociale_static->id, $arrayofselected)) {
851 print
'<input id="cb'.$chargesociale_static->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$chargesociale_static->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
855 $totalarray[
'nbfield']++;
865include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
870 foreach ($arrayfields as $key => $val) {
871 if (!empty($val[
'checked'])) {
875 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
880$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
881$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
882print $hookmanager->resPrint;
884print
'</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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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 a 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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.