32require
'../../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formsocialcontrib.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
41$langs->loadLangs(array(
'compta',
'banks',
'bills',
'hrm',
'projects'));
43$action =
GETPOST(
'action',
'aZ09');
44$massaction =
GETPOST(
'massaction',
'alpha');
45$confirm =
GETPOST(
'confirm',
'alpha');
46$toselect =
GETPOST(
'toselect',
'array');
47$optioncss =
GETPOST(
'optioncss',
'alpha');
48$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'sclist';
49$mode =
GETPOST(
'mode',
'alpha');
52$search_ref =
GETPOST(
'search_ref',
'int');
53$search_label =
GETPOST(
'search_label',
'alpha');
54$search_typeid =
GETPOST(
'search_typeid',
'int');
55$search_amount =
GETPOST(
'search_amount',
'alpha');
56$search_status =
GETPOST(
'search_status',
'int');
57$search_date_startday =
GETPOST(
'search_date_startday',
'int');
58$search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
59$search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
60$search_date_endday =
GETPOST(
'search_date_endday',
'int');
61$search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
62$search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
63$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
64$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
65$search_date_limit_startday =
GETPOST(
'search_date_limit_startday',
'int');
66$search_date_limit_startmonth =
GETPOST(
'search_date_limit_startmonth',
'int');
67$search_date_limit_startyear =
GETPOST(
'search_date_limit_startyear',
'int');
68$search_date_limit_endday =
GETPOST(
'search_date_limit_endday',
'int');
69$search_date_limit_endmonth =
GETPOST(
'search_date_limit_endmonth',
'int');
70$search_date_limit_endyear =
GETPOST(
'search_date_limit_endyear',
'int');
71$search_date_limit_start =
dol_mktime(0, 0, 0, $search_date_limit_startmonth, $search_date_limit_startday, $search_date_limit_startyear);
72$search_date_limit_end =
dol_mktime(23, 59, 59, $search_date_limit_endmonth, $search_date_limit_endday, $search_date_limit_endyear);
73$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
74$search_users =
GETPOST(
'search_users');
75$search_type =
GETPOST(
'search_type',
'int');
76$search_account =
GETPOST(
'search_account',
'int');
78$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
79$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
80$sortorder =
GETPOST(
"sortorder",
'aZ09comma');
81$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
83if (empty($page) || $page == -1) {
86$offset = $limit * $page;
91 $sortfield =
"cs.date_ech";
97$filtre =
GETPOST(
"filtre",
'int');
100 'cs.rowid' =>array(
'label'=>
"Ref",
'checked'=>1,
'position'=>10),
101 'cs.libelle' =>array(
'label'=>
"Label",
'checked'=>1,
'position'=>20),
102 'cs.fk_type' =>array(
'label'=>
"Type",
'checked'=>1,
'position'=>30),
103 'cs.date_ech' =>array(
'label'=>
"Date",
'checked'=>1,
'position'=>40),
104 'cs.periode' =>array(
'label'=>
"PeriodEndDate",
'checked'=>1,
'position'=>50),
105 'p.ref' =>array(
'label'=>
"ProjectRef",
'checked'=>1,
'position'=>60,
'enabled'=>(isModEnabled(
'project'))),
106 'cs.fk_user' =>array(
'label'=>
"Employee",
'checked'=>1,
'position'=>70),
107 'cs.fk_mode_reglement' =>array(
'checked'=>-1,
'position'=>80,
'label'=>
"DefaultPaymentMode"),
108 'cs.amount' =>array(
'label'=>
"Amount",
'checked'=>1,
'position'=>100),
109 'cs.paye' =>array(
'label'=>
"Status",
'checked'=>1,
'position'=>110),
112if (isModEnabled(
"banque")) {
113 $arrayfields[
'cs.fk_account'] = array(
'checked'=>-1,
'position'=>90,
'label'=>
"DefaultBankAccount");
119$hookmanager->initHooks(array(
'sclist'));
122$permissiontoadd = $user->hasRight(
'tax',
'charges',
'creer');
123$permissiontodelete = $user->hasRight(
'tax',
'charges',
'supprimer');
126$socid =
GETPOST(
"socid",
'int');
128 $socid = $user->socid;
130$result =
restrictedArea($user,
'tax',
'',
'chargesociales',
'charges');
137$parameters = array(
'socid'=>$socid);
138$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
144if (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';
189$form =
new Form($db);
194$projectstatic =
new Project($db);
196llxHeader(
'', $langs->trans(
"SocialContributions"));
198$arrayofselected = is_array($toselect) ? $toselect : array();
200$sql =
"SELECT cs.rowid, cs.fk_type as type, cs.fk_user,";
201$sql .=
" cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode, cs.fk_account,";
202if (isModEnabled(
'project')) {
203 $sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
205$sql .=
" c.libelle as type_label, c.accountancy_code as type_accountancy_code,";
206$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,";
207$sql .=
" pay.code as payment_code";
210$sql .=
", SUM(pc.amount) as alreadypayed";
212$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_chargesociales as c,";
213$sql .=
" ".MAIN_DB_PREFIX.
"chargesociales as cs";
214$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account as ba ON (cs.fk_account = ba.rowid)";
215$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_paiement as pay ON (cs.fk_mode_reglement = pay.id)';
216if (isModEnabled(
'project')) {
217 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = cs.fk_projet";
219$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"paiementcharge as pc ON pc.fk_charge = cs.rowid";
220$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON (cs.fk_user = u.rowid)";
221$sql .=
" WHERE cs.fk_type = c.id";
222$sql .=
" AND cs.entity = ".((int) $conf->entity);
225 $sql .=
" AND cs.ref = '".$db->escape($search_ref).
"'";
230if (isModEnabled(
'project')) {
231 if ($search_project_ref !=
'') {
235if (!empty($search_users)) {
236 $sql .=
' AND cs.fk_user IN ('.$db->sanitize(implode(
', ', $search_users)).
')';
238if (!empty($search_type) && $search_type > 0) {
239 $sql .=
' AND cs.fk_mode_reglement='.((int) $search_type);
241if (!empty($search_account) && $search_account > 0) {
242 $sql .=
' AND cs.fk_account='.((int) $search_account);
247if ($search_status !=
'' && $search_status >= 0) {
248 $sql .=
" AND cs.paye = ".((int) $search_status);
250if ($search_date_start) {
251 $sql .=
" AND cs.date_ech >= '".$db->idate($search_date_start).
"'";
253if ($search_date_end) {
254 $sql .=
" AND cs.date_ech <= '".$db->idate($search_date_end).
"'";
256if ($search_date_limit_start) {
257 $sql .=
" AND cs.periode >= '".$db->idate($search_date_limit_start).
"'";
259if ($search_date_limit_end) {
260 $sql .=
" AND cs.periode <= '".$db->idate($search_date_limit_end).
"'";
262if ($search_typeid > 0) {
263 $sql .=
" AND cs.fk_type = ".((int) $search_typeid);
265$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";
266if (isModEnabled(
'project')) {
267 $sql .=
", p.rowid, p.ref, p.title";
271$nbtotalofrecords =
'';
274 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(DISTINCT cs.rowid) as nbtotalofrecords', $sql);
275 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
276 $resql = $db->query($sqlforcount);
278 $objforcount = $db->fetch_object($resql);
279 $nbtotalofrecords = $objforcount->nbtotalofrecords;
284 if (($page * $limit) > $nbtotalofrecords) {
292$sql .= $db->order($sortfield, $sortorder);
294 $sql .= $db->plimit($limit + 1, $offset);
297$resql = $db->query($sql);
305$num = $db->num_rows($resql);
310 $param .=
'&mode='.urlencode($mode);
312if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
313 $param .=
'&contextpage='.urlencode($contextpage);
315if ($limit > 0 && $limit != $conf->liste_limit) {
316 $param .=
'&limit='.((int) $limit);
319 $param .=
'&search_ref='.urlencode($search_ref);
322 $param .=
'&search_label='.urlencode($search_label);
324if ($search_project_ref >= 0) {
325 $param .=
"&search_project_ref=".urlencode($search_project_ref);
328 $param .=
'&search_amount='.urlencode($search_amount);
331 $param .=
'&search_typeid='.urlencode($search_typeid);
334 foreach ($search_users as $id_user) {
335 $param .=
'&search_users[]='.urlencode($id_user);
339 $param .=
'&search_type='.urlencode($search_type);
341if ($search_account) {
342 $param .=
'&search_account='.$search_account;
344if ($search_status !=
'' && $search_status !=
'-1') {
345 $param .=
'&search_status='.urlencode($search_status);
347if ($search_date_startday) {
348 $param .=
'&search_date_startday='.urlencode($search_date_startday);
350if ($search_date_startmonth) {
351 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
353if ($search_date_startyear) {
354 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
356if ($search_date_endday) {
357 $param .=
'&search_date_endday='.urlencode($search_date_endday);
359if ($search_date_endmonth) {
360 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
362if ($search_date_endyear) {
363 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
365if ($search_date_limit_startday) {
366 $param .=
'&search_date_limit_startday='.urlencode($search_date_limit_startday);
368if ($search_date_limit_startmonth) {
369 $param .=
'&search_date_limit_startmonth='.urlencode($search_date_limit_startmonth);
371if ($search_date_limit_startyear) {
372 $param .=
'&search_date_limit_startyear='.urlencode($search_date_limit_startyear);
374if ($search_date_limit_endday) {
375 $param .=
'&search_date_limit_endday='.urlencode($search_date_limit_endday);
377if ($search_date_limit_endmonth) {
378 $param .=
'&search_date_limit_endmonth='.urlencode($search_date_limit_endmonth);
380if ($search_date_limit_endyear) {
381 $param .=
'&search_date_limit_endyear='.urlencode($search_date_limit_endyear);
384$url = DOL_URL_ROOT.
'/compta/sociales/card.php?action=create';
387$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'));
388$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'));
390$newcardbutton .=
dolGetButtonTitle($langs->trans(
'MenuNewSocialContribution'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
393$arrayofmassactions = array();
394if (!empty($permissiontodelete)) {
395 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
397$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
400print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
401if ($optioncss !=
'') {
402 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
404print
'<input type="hidden" name="token" value="'.newToken().
'">';
405print
'<input type="hidden" name="action" value="list">';
406print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
407print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
408print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
409print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
410print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
411print
'<input type="hidden" name="mode" value="'.$mode.
'">';
414print_barre_liste($langs->trans(
"SocialContributions"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0, $newcardbutton,
'', $limit, 0, 0, 1);
416if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
417 print
'<div class="error">';
418 $langs->load(
"errors");
419 $countrynotdefined = $langs->trans(
"ErrorSetACountryFirst");
420 print $countrynotdefined;
429$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
430$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
431if ($massactionbutton) {
432 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
436$trackid =
'sc'.$object->id;
437include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
439print
'<div class="div-table-responsive">';
440print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
'').
'">'.
"\n";
442print
'<tr class="liste_titre_filter">';
446 print
'<td class="liste_titre maxwidthsearch">';
447 print $form->showFilterAndCheckAddButtons(0);
453 print
'<td class="liste_titre">';
458if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
459 print
'<td class="liste_titre">';
460 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
465if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
466 print
'<td class="liste_titre">';
467 print
'<input type="text" class="flat maxwidth100" name="search_label" value="'.dol_escape_htmltag($search_label).
'">';
472if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
473 print
'<td class="liste_titre">';
474 $formsocialcontrib->select_type_socialcontrib($search_typeid,
'search_typeid', 1, 0, 0,
'maxwidth150', 1);
479if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
480 print
'<td class="liste_titre center">';
481 print
'<div class="nowrapfordate">';
482 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
484 print
'<div class="nowrapfordate">';
485 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
491if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
492 print
'<td class="liste_titre center">';
493 print
'<div class="nowrapfordate">';
494 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'));
496 print
'<div class="nowrapfordate">';
497 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'));
503if (!empty($arrayfields[
'p.ref'][
'checked'])) {
504 print
'<td class="liste_titre">';
505 print
'<input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'">';
509if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
511 print
'<td class="liste_titre">';
512 print $form->select_dolusers($search_users,
'search_users', 1,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth150', 0, 0,
true);
517if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
518 print
'<td class="liste_titre">';
519 print $form->select_types_paiements($search_type,
'search_type',
'', 0, 1, 1, 0, 1,
'maxwidth150', 1);
524if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
525 print
'<td class="liste_titre">';
526 $form->select_comptes($search_account,
'search_account', 0,
'', 1,
'', 0,
'maxwidth150');
531if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
532 print
'<td class="liste_titre right">';
533 print
'<input class="flat maxwidth75" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).
'">';
538if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
539 print
'<td class="liste_titre right parentonrightofpage">';
540 $liststatus = array(
'0'=>$langs->trans(
"Unpaid"),
'1'=>$langs->trans(
"Paid"));
541 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
546$parameters = array(
'arrayfields'=>$arrayfields);
547$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
548print $hookmanager->resPrint;
552 print
'<td class="liste_titre maxwidthsearch">';
553 print $form->showFilterAndCheckAddButtons(0);
559$totalarray = array();
560$totalarray[
'nbfield'] = 0;
564print
'<tr class="liste_titre">';
567 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch ');
568 $totalarray[
'nbfield']++;
573 $totalarray[
'nbfield']++;
575if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
576 print_liste_field_titre($arrayfields[
'cs.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.rowid",
'', $param,
'', $sortfield, $sortorder);
577 $totalarray[
'nbfield']++;
579if (!empty($arrayfields[
'cs.libelle'][
'checked'])) {
580 print_liste_field_titre($arrayfields[
'cs.libelle'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.libelle,cs.periode",
'', $param,
'', $sortfield, $sortorder);
581 $totalarray[
'nbfield']++;
583if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
584 print_liste_field_titre($arrayfields[
'cs.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_type,cs.periode",
'', $param,
'', $sortfield, $sortorder);
585 $totalarray[
'nbfield']++;
587if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
588 print_liste_field_titre($arrayfields[
'cs.date_ech'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.date_ech,cs.periode",
'', $param,
'', $sortfield, $sortorder,
'center ');
589 $totalarray[
'nbfield']++;
591if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
592 print_liste_field_titre($arrayfields[
'cs.periode'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.periode",
'', $param,
'', $sortfield, $sortorder,
'center ');
593 $totalarray[
'nbfield']++;
595if (!empty($arrayfields[
'p.ref'][
'checked'])) {
596 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
'', $param,
'', $sortfield, $sortorder);
597 $totalarray[
'nbfield']++;
599if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
600 print_liste_field_titre(
"Employee", $_SERVER[
"PHP_SELF"],
"u.lastname,cs.periode",
"", $param,
'class="left"', $sortfield, $sortorder);
601 $totalarray[
'nbfield']++;
603if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
604 print_liste_field_titre($arrayfields[
'cs.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_mode_reglement,cs.periode",
'', $param,
'', $sortfield, $sortorder);
605 $totalarray[
'nbfield']++;
607if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
608 print_liste_field_titre($arrayfields[
'cs.fk_account'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.fk_account,cs.periode",
'', $param,
'', $sortfield, $sortorder);
609 $totalarray[
'nbfield']++;
611if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
612 print_liste_field_titre($arrayfields[
'cs.amount'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.amount,cs.periode",
'', $param,
'class="right"', $sortfield, $sortorder);
613 $totalarray[
'nbfield']++;
615if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
616 print_liste_field_titre($arrayfields[
'cs.paye'][
'label'], $_SERVER[
"PHP_SELF"],
"cs.paye,cs.periode",
'', $param,
'class="right"', $sortfield, $sortorder);
617 $totalarray[
'nbfield']++;
621$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
622$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
623print $hookmanager->resPrint;
626 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch ');
627 $totalarray[
'nbfield']++;
634$savnbfield = $totalarray[
'nbfield'];
635$totalarray = array();
636$totalarray[
'nbfield'] = 0;
637$totalarray[
'val'] = array(
'totalttcfield'=>0);
638$imaxinloop = ($limit ? min($num, $limit) : $num);
639while ($i < $imaxinloop) {
640 $obj = $db->fetch_object($resql);
642 $chargesociale_static->id = $obj->rowid;
643 $chargesociale_static->ref = $obj->rowid;
644 $chargesociale_static->label = $obj->label;
645 $chargesociale_static->type_label = $obj->type_label;
646 $chargesociale_static->amount = $obj->amount;
647 $chargesociale_static->paye = $obj->paye;
648 $chargesociale_static->date_ech = $obj->date_ech;
650 if (isModEnabled(
'project')) {
651 $projectstatic->id = $obj->project_id;
652 $projectstatic->ref = $obj->project_ref;
653 $projectstatic->title = $obj->project_label;
656 if ($mode ==
'kanban') {
658 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
659 print
'<div class="box-flex-container kanban">';
662 print $chargesociale_static->getKanbanView(
'', array(
'project'=> $projectstatic,
'selected' => in_array($chargesociale_static->id, $arrayofselected)));
663 if ($i == ($imaxinloop - 1)) {
668 print
'<tr class="oddeven">';
673 print
'<td class="center">';
674 if ($massactionbutton || $massaction) {
676 if (in_array($chargesociale_static->id, $arrayofselected)) {
679 print
'<input id="cb'.$chargesociale_static->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$chargesociale_static->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
683 $totalarray[
'nbfield']++;
689 print
'<td>'.(($offset * $limit) + $i).
'</td>';
691 $totalarray[
'nbfield']++;
696 if (!empty($arrayfields[
'cs.rowid'][
'checked'])) {
697 print
'<td>'.$chargesociale_static->getNomUrl(1,
'20').
'</td>';
699 $totalarray[
'nbfield']++;
704 if (!empty($arrayfields[
'cs.libelle'][
'checked'])) {
705 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).
'">'.
dol_escape_htmltag($obj->label).
'</td>';
707 $totalarray[
'nbfield']++;
712 if (!empty($arrayfields[
'cs.fk_type'][
'checked'])) {
713 $typelabeltoshow = $obj->type_label;
714 $typelabelpopup = $obj->type_label;
715 if (isModEnabled(
'accounting')) {
716 $typelabelpopup .=
' - '.$langs->trans(
"AccountancyCode").
': '.$obj->type_accountancy_code;
718 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($typelabelpopup).
'">'.
dol_escape_htmltag($typelabeltoshow).
'</td>';
720 $totalarray[
'nbfield']++;
725 if (!empty($arrayfields[
'cs.date_ech'][
'checked'])) {
726 print
'<td class="center nowraponall">'.dol_print_date($db->jdate($obj->date_ech),
'day').
'</td>';
728 $totalarray[
'nbfield']++;
733 if (!empty($arrayfields[
'cs.periode'][
'checked'])) {
734 print
'<td class="center nowraponall">'.dol_print_date($db->jdate($obj->periode),
'day').
'</td>';
736 $totalarray[
'nbfield']++;
741 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
742 print
'<td class="nowraponall">';
743 if ($obj->project_id > 0) {
744 print $projectstatic->getNomUrl(1);
748 $totalarray[
'nbfield']++;
752 if (!empty($arrayfields[
'cs.fk_user'][
'checked'])) {
754 print
'<td class="tdoverflowmax150">';
755 if (!empty($obj->fk_user)) {
756 if (!empty($TLoadedUsers[$obj->fk_user])) {
757 $ustatic = $TLoadedUsers[$obj->fk_user];
759 $ustatic =
new User($db);
760 $ustatic->fetch($obj->fk_user);
761 $TLoadedUsers[$obj->fk_user] = $ustatic;
763 print $ustatic->getNomUrl(-1);
767 $totalarray[
'nbfield']++;
772 if (!empty($arrayfields[
'cs.fk_mode_reglement'][
'checked'])) {
773 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans(
"PaymentTypeShort".$obj->payment_code)).
'">';
774 if (!empty($obj->payment_code)) {
775 print $langs->trans(
"PaymentTypeShort".$obj->payment_code);
779 $totalarray[
'nbfield']++;
784 if (!empty($arrayfields[
'cs.fk_account'][
'checked'])) {
785 print
'<td class="toverflowmax150">';
786 if ($obj->fk_account > 0) {
787 $bankstatic->id = $obj->fk_account;
788 $bankstatic->ref = $obj->bref;
789 $bankstatic->number = $obj->bnumber;
790 $bankstatic->iban = $obj->iban;
791 $bankstatic->bic = $obj->bic;
792 $bankstatic->currency_code = $langs->trans(
"Currency".$obj->currency_code);
793 $bankstatic->account_number = $obj->account_number;
794 $bankstatic->clos = $obj->clos;
799 $bankstatic->label = $obj->blabel;
800 print $bankstatic->getNomUrl(1);
804 $totalarray[
'nbfield']++;
809 if (!empty($arrayfields[
'cs.amount'][
'checked'])) {
810 print
'<td class="nowraponall amount right">'.price($obj->amount).
'</td>';
812 $totalarray[
'nbfield']++;
813 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalttcfield';
815 $totalarray[
'val'][
'totalttcfield'] += $obj->amount;
819 if (!empty($arrayfields[
'cs.paye'][
'checked'])) {
820 print
'<td class="nowraponall right">'.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).
'</td>';
822 $totalarray[
'nbfield']++;
828 print
'<td class="center">';
829 if ($massactionbutton || $massaction) {
831 if (in_array($chargesociale_static->id, $arrayofselected)) {
834 print
'<input id="cb'.$chargesociale_static->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$chargesociale_static->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
838 $totalarray[
'nbfield']++;
848include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
853 foreach ($arrayfields as $key => $val) {
854 if (!empty($val[
'checked'])) {
858 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
863$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
864$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
865print $hookmanager->resPrint;
867print
'</table>'.
"\n";
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.
Classe permettant la gestion des paiements des charges La tva collectee n'est calculee que sur les fa...
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 informations (by default a local PHP server timestamp) Re...
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $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.
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.