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);
198$title = $langs->trans(
"SocialContributions");
200llxHeader(
'', $title,
'',
'', 0, 0,
'',
'',
'',
'bodyforlist');
202$arrayofselected = is_array($toselect) ? $toselect : array();
204$sql =
"SELECT cs.rowid, cs.fk_type as type, cs.fk_user,";
205$sql .=
" cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode, cs.fk_account,";
206if (isModEnabled(
'project')) {
207 $sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
209$sql .=
" c.libelle as type_label, c.accountancy_code as type_accountancy_code,";
210$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,";
211$sql .=
" pay.code as payment_code";
214$sql .=
", SUM(pc.amount) as alreadypayed";
216$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_chargesociales as c,";
217$sql .=
" ".MAIN_DB_PREFIX.
"chargesociales as cs";
218$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account as ba ON (cs.fk_account = ba.rowid)";
219$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_paiement as pay ON (cs.fk_mode_reglement = pay.id)';
220if (isModEnabled(
'project')) {
221 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = cs.fk_projet";
223$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"paiementcharge as pc ON pc.fk_charge = cs.rowid";
224$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON (cs.fk_user = u.rowid)";
225$sql .=
" WHERE cs.fk_type = c.id";
226$sql .=
" AND cs.entity = ".((int) $conf->entity);
229 $sql .=
" AND cs.ref = '".$db->escape($search_ref).
"'";
234if (isModEnabled(
'project')) {
235 if ($search_project_ref !=
'') {
239if (!empty($search_users)) {
240 $sql .=
' AND cs.fk_user IN ('.$db->sanitize(implode(
', ', $search_users)).
')';
242if (!empty($search_type) && $search_type > 0) {
243 $sql .=
' AND cs.fk_mode_reglement='.((int) $search_type);
245if (!empty($search_account) && $search_account > 0) {
246 $sql .=
' AND cs.fk_account='.((int) $search_account);
251if ($search_status !=
'' && $search_status >= 0) {
252 $sql .=
" AND cs.paye = ".((int) $search_status);
254if ($search_date_start) {
255 $sql .=
" AND cs.date_ech >= '".$db->idate($search_date_start).
"'";
257if ($search_date_end) {
258 $sql .=
" AND cs.date_ech <= '".$db->idate($search_date_end).
"'";
260if ($search_date_limit_start) {
261 $sql .=
" AND cs.periode >= '".$db->idate($search_date_limit_start).
"'";
263if ($search_date_limit_end) {
264 $sql .=
" AND cs.periode <= '".$db->idate($search_date_limit_end).
"'";
266if ($search_typeid > 0) {
267 $sql .=
" AND cs.fk_type = ".((int) $search_typeid);
269$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";
270if (isModEnabled(
'project')) {
271 $sql .=
", p.rowid, p.ref, p.title";
275$nbtotalofrecords =
'';
278 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(DISTINCT cs.rowid) as nbtotalofrecords', $sql);
279 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
280 $resql = $db->query($sqlforcount);
282 $objforcount = $db->fetch_object($resql);
283 $nbtotalofrecords = $objforcount->nbtotalofrecords;
288 if (($page * $limit) > $nbtotalofrecords) {
296$sql .= $db->order($sortfield, $sortorder);
298 $sql .= $db->plimit($limit + 1, $offset);
301$resql = $db->query($sql);
309$num = $db->num_rows($resql);
314 $param .=
'&mode='.urlencode($mode);
316if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
317 $param .=
'&contextpage='.urlencode($contextpage);
319if ($limit > 0 && $limit != $conf->liste_limit) {
320 $param .=
'&limit='.((int) $limit);
323 $param .=
'&search_ref='.urlencode($search_ref);
326 $param .=
'&search_label='.urlencode($search_label);
328if ($search_project_ref >= 0) {
329 $param .=
"&search_project_ref=".urlencode($search_project_ref);
332 $param .=
'&search_amount='.urlencode($search_amount);
335 $param .=
'&search_typeid='.urlencode((
string) ($search_typeid));
338 foreach ($search_users as $id_user) {
339 $param .=
'&search_users[]='.urlencode($id_user);
343 $param .=
'&search_type='.urlencode((
string) ($search_type));
345if ($search_account) {
346 $param .=
'&search_account='.$search_account;
348if ($search_status !=
'' && $search_status !=
'-1') {
349 $param .=
'&search_status='.urlencode($search_status);
351if ($search_date_startday) {
352 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
354if ($search_date_startmonth) {
355 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
357if ($search_date_startyear) {
358 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
360if ($search_date_endday) {
361 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
363if ($search_date_endmonth) {
364 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
366if ($search_date_endyear) {
367 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
369if ($search_date_limit_startday) {
370 $param .=
'&search_date_limit_startday='.urlencode((
string) ($search_date_limit_startday));
372if ($search_date_limit_startmonth) {
373 $param .=
'&search_date_limit_startmonth='.urlencode((
string) ($search_date_limit_startmonth));
375if ($search_date_limit_startyear) {
376 $param .=
'&search_date_limit_startyear='.urlencode((
string) ($search_date_limit_startyear));
378if ($search_date_limit_endday) {
379 $param .=
'&search_date_limit_endday='.urlencode((
string) ($search_date_limit_endday));
381if ($search_date_limit_endmonth) {
382 $param .=
'&search_date_limit_endmonth='.urlencode((
string) ($search_date_limit_endmonth));
384if ($search_date_limit_endyear) {
385 $param .=
'&search_date_limit_endyear='.urlencode((
string) ($search_date_limit_endyear));
388$url = DOL_URL_ROOT.
'/compta/sociales/card.php?action=create';
391$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'));
392$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'));
394$newcardbutton .=
dolGetButtonTitle($langs->trans(
'MenuNewSocialContribution'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
397$arrayofmassactions = array();
398if (!empty($permissiontodelete)) {
399 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
401$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
404print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
405if ($optioncss !=
'') {
406 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
408print
'<input type="hidden" name="token" value="'.newToken().
'">';
409print
'<input type="hidden" name="action" value="list">';
410print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
411print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
412print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
413print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
414print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
415print
'<input type="hidden" name="mode" value="'.$mode.
'">';
419print_barre_liste($langs->trans(
"SocialContributions"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
421if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
422 print
'<div class="error">';
423 $langs->load(
"errors");
424 $countrynotdefined = $langs->trans(
"ErrorSetACountryFirst");
425 print $countrynotdefined;
434$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
435$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
436if ($massactionbutton) {
437 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
441$trackid =
'sc'.$object->id;
442include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
444print
'<div class="div-table-responsive">';
445print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
'').
'">'.
"\n";
447print
'<tr class="liste_titre_filter">';
451 print
'<td class="liste_titre maxwidthsearch">';
452 print $form->showFilterAndCheckAddButtons(0);
458 print
'<td class="liste_titre">';
463if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
464 print
'<td class="liste_titre">';
465 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
470if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
471 print
'<td class="liste_titre">';
472 print
'<input type="text" class="flat maxwidth100" name="search_label" value="'.dol_escape_htmltag($search_label).
'">';
477if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
478 print
'<td class="liste_titre">';
479 $formsocialcontrib->select_type_socialcontrib($search_typeid,
'search_typeid', 1, 0, 0,
'maxwidth150', 1);
484if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
485 print
'<td class="liste_titre center">';
486 print
'<div class="nowrapfordate">';
487 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
489 print
'<div class="nowrapfordate">';
490 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
496if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
497 print
'<td class="liste_titre center">';
498 print
'<div class="nowrapfordate">';
499 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'));
501 print
'<div class="nowrapfordate">';
502 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'));
508if (!empty($arrayfields[
'p.ref'][
'checked'])) {
509 print
'<td class="liste_titre">';
510 print
'<input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'">';
514if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
516 print
'<td class="liste_titre">';
517 print $form->select_dolusers($search_users,
'search_users', 1,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth150', 0, 0,
true);
522if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
523 print
'<td class="liste_titre">';
524 print $form->select_types_paiements($search_type,
'search_type',
'', 0, 1, 1, 0, 1,
'maxwidth150', 1);
529if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
530 print
'<td class="liste_titre">';
531 $form->select_comptes($search_account,
'search_account', 0,
'', 1,
'', 0,
'maxwidth150');
536if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
537 print
'<td class="liste_titre right">';
538 print
'<input class="flat maxwidth75" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).
'">';
543if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
544 print
'<td class="liste_titre right parentonrightofpage">';
545 $liststatus = array(
'0' => $langs->trans(
"Unpaid"),
'1' => $langs->trans(
"Paid"));
547 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
552$parameters = array(
'arrayfields' => $arrayfields);
553$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
554print $hookmanager->resPrint;
558 print
'<td class="liste_titre maxwidthsearch">';
559 print $form->showFilterAndCheckAddButtons(0);
565$totalarray = array();
566$totalarray[
'nbfield'] = 0;
570print
'<tr class="liste_titre">';
573 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch ');
574 $totalarray[
'nbfield']++;
579 $totalarray[
'nbfield']++;
581if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
583 print_liste_field_titre($arrayfields[
'cs.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.rowid",
'', $param,
'', $sortfield, $sortorder);
584 $totalarray[
'nbfield']++;
586if (!empty($arrayfields[
'cs.libelle'][
'checked'])) {
587 print_liste_field_titre($arrayfields[
'cs.libelle'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.libelle,cs.periode",
'', $param,
'', $sortfield, $sortorder);
588 $totalarray[
'nbfield']++;
590if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
591 print_liste_field_titre($arrayfields[
'cs.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_type,cs.periode",
'', $param,
'', $sortfield, $sortorder);
592 $totalarray[
'nbfield']++;
594if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
595 print_liste_field_titre($arrayfields[
'cs.date_ech'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.date_ech,cs.periode",
'', $param,
'', $sortfield, $sortorder,
'center ');
596 $totalarray[
'nbfield']++;
598if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
599 print_liste_field_titre($arrayfields[
'cs.periode'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.periode",
'', $param,
'', $sortfield, $sortorder,
'center ');
600 $totalarray[
'nbfield']++;
602if (!empty($arrayfields[
'p.ref'][
'checked'])) {
603 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
604 $totalarray[
'nbfield']++;
606if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
607 print_liste_field_titre(
"Employee", $_SERVER[
"PHP_SELF"],
"u.lastname,cs.periode",
"", $param,
'class="left"', $sortfield, $sortorder);
608 $totalarray[
'nbfield']++;
610if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
611 print_liste_field_titre($arrayfields[
'cs.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_mode_reglement,cs.periode",
'', $param,
'', $sortfield, $sortorder);
612 $totalarray[
'nbfield']++;
614if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
615 print_liste_field_titre($arrayfields[
'cs.fk_account'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_account,cs.periode",
'', $param,
'', $sortfield, $sortorder);
616 $totalarray[
'nbfield']++;
618if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
619 print_liste_field_titre($arrayfields[
'cs.amount'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.amount,cs.periode",
'', $param,
'class="right"', $sortfield, $sortorder);
620 $totalarray[
'nbfield']++;
622if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
623 print_liste_field_titre($arrayfields[
'cs.paye'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.paye,cs.periode",
'', $param,
'class="right"', $sortfield, $sortorder);
624 $totalarray[
'nbfield']++;
628$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
629$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
630print $hookmanager->resPrint;
633 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch ');
634 $totalarray[
'nbfield']++;
641$savnbfield = $totalarray[
'nbfield'];
642$totalarray = array();
643$totalarray[
'nbfield'] = 0;
644$totalarray[
'val'] = array(
'totalttcfield' => 0);
645$imaxinloop = ($limit ? min($num, $limit) : $num);
646if (!isset($TLoadedUsers) || !is_array($TLoadedUsers)) {
648 $TLoadedUsers = array();
650while ($i < $imaxinloop) {
651 $obj = $db->fetch_object($resql);
653 $chargesociale_static->id = $obj->rowid;
654 $chargesociale_static->ref = $obj->rowid;
655 $chargesociale_static->label = $obj->label;
656 $chargesociale_static->type_label = $obj->type_label;
657 $chargesociale_static->amount = $obj->amount;
658 $chargesociale_static->paye = $obj->paye;
659 $chargesociale_static->date_ech = $obj->date_ech;
661 if (isModEnabled(
'project')) {
662 $projectstatic->id = $obj->project_id;
663 $projectstatic->ref = $obj->project_ref;
664 $projectstatic->title = $obj->project_label;
667 if ($mode ==
'kanban') {
669 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
670 print
'<div class="box-flex-container kanban">';
673 print $chargesociale_static->getKanbanView(
'', array(
'project' => $projectstatic,
'selected' => in_array($chargesociale_static->id, $arrayofselected)));
674 if ($i == ($imaxinloop - 1)) {
679 print
'<tr class="oddeven">';
684 print
'<td class="center">';
685 if ($massactionbutton || $massaction) {
687 if (in_array($chargesociale_static->id, $arrayofselected)) {
690 print
'<input id="cb'.$chargesociale_static->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$chargesociale_static->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
694 $totalarray[
'nbfield']++;
700 print
'<td>'.(($offset * $limit) + $i).
'</td>';
702 $totalarray[
'nbfield']++;
707 if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
708 print
'<td>'.$chargesociale_static->getNomUrl(1,
'20').
'</td>';
710 $totalarray[
'nbfield']++;
715 if (!empty($arrayfields[
'cs.libelle'][
'checked'])) {
716 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).
'">'.
dol_escape_htmltag($obj->label).
'</td>';
718 $totalarray[
'nbfield']++;
723 if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
724 $typelabeltoshow = $obj->type_label;
725 $typelabelpopup = $obj->type_label;
726 if (isModEnabled(
'accounting')) {
727 $typelabelpopup .=
' - '.$langs->trans(
"AccountancyCode").
': '.$obj->type_accountancy_code;
729 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($typelabelpopup).
'">'.
dol_escape_htmltag($typelabeltoshow).
'</td>';
731 $totalarray[
'nbfield']++;
736 if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
737 print
'<td class="center nowraponall">'.dol_print_date($db->jdate($obj->date_ech),
'day').
'</td>';
739 $totalarray[
'nbfield']++;
744 if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
745 print
'<td class="center nowraponall">'.dol_print_date($db->jdate($obj->periode),
'day').
'</td>';
747 $totalarray[
'nbfield']++;
752 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
753 print
'<td class="nowraponall">';
754 if ($obj->project_id > 0) {
755 print $projectstatic->getNomUrl(1);
759 $totalarray[
'nbfield']++;
763 if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
765 print
'<td class="tdoverflowmax150">';
766 if (!empty($obj->fk_user)) {
767 if (!empty($TLoadedUsers[$obj->fk_user])) {
768 $ustatic = $TLoadedUsers[$obj->fk_user];
770 $ustatic =
new User($db);
771 $ustatic->fetch($obj->fk_user);
772 $TLoadedUsers[$obj->fk_user] = $ustatic;
774 print $ustatic->getNomUrl(-1);
778 $totalarray[
'nbfield']++;
783 if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
784 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans(
"PaymentTypeShort".$obj->payment_code)).
'">';
785 if (!empty($obj->payment_code)) {
786 print $langs->trans(
"PaymentTypeShort".$obj->payment_code);
790 $totalarray[
'nbfield']++;
795 if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
796 print
'<td class="toverflowmax150">';
797 if ($obj->fk_account > 0) {
798 $bankstatic->id = $obj->fk_account;
799 $bankstatic->ref = $obj->bref;
800 $bankstatic->number = $obj->bnumber;
801 $bankstatic->iban = $obj->iban;
802 $bankstatic->bic = $obj->bic;
803 $bankstatic->currency_code = $langs->trans(
"Currency".$obj->currency_code);
804 $bankstatic->account_number = $obj->account_number;
805 $bankstatic->clos = $obj->clos;
810 $bankstatic->label = $obj->blabel;
811 print $bankstatic->getNomUrl(1);
815 $totalarray[
'nbfield']++;
820 if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
821 print
'<td class="nowraponall amount right">'.price($obj->amount).
'</td>';
823 $totalarray[
'nbfield']++;
824 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalttcfield';
826 $totalarray[
'val'][
'totalttcfield'] += $obj->amount;
830 if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
831 print
'<td class="nowraponall right">'.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).
'</td>';
833 $totalarray[
'nbfield']++;
839 print
'<td class="center">';
840 if ($massactionbutton || $massaction) {
842 if (in_array($chargesociale_static->id, $arrayofselected)) {
845 print
'<input id="cb'.$chargesociale_static->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$chargesociale_static->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
849 $totalarray[
'nbfield']++;
859include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
864 foreach ($arrayfields as $key => $val) {
865 if (!empty($val[
'checked'])) {
869 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
874$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
875$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
876print $hookmanager->resPrint;
878print
'</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...
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.