28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/salaries/class/paymentsalary.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
31if (isModEnabled(
'accounting')) {
32 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
36$langs->loadLangs(array(
"compta",
"salaries",
"bills",
"hrm"));
38$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
39$massaction =
GETPOST(
'massaction',
'alpha');
41$confirm =
GETPOST(
'confirm',
'alpha');
42$cancel =
GETPOST(
'cancel',
'alpha');
43$toselect =
GETPOST(
'toselect',
'array');
44$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
45$backtopage =
GETPOST(
'backtopage',
'alpha');
46$optioncss =
GETPOST(
'optioncss',
'aZ');
52$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
53$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
55if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
59$offset = $limit * $page;
63 $sortfield =
"s.datep,s.rowid";
66 $sortorder =
"DESC,DESC";
72$diroutputmassaction = $conf->user->dir_output.
'/temp/massgeneration/'.$user->id;
73$hookmanager->initHooks(array(
'salarieslist'));
76$extrafields->fetch_name_optionals_label(
$object->table_element);
78$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
81 $sortfield =
"s.datep,s.rowid";
84 $sortorder =
"DESC,DESC";
87$search_ref =
GETPOST(
'search_ref',
'alpha');
88$search_user =
GETPOST(
'search_user',
'alpha');
89$search_label =
GETPOST(
'search_label',
'alpha');
94$search_amount =
GETPOST(
'search_amount',
'alpha');
95$search_account =
GETPOST(
'search_account',
'alpha');
96$search_status =
GETPOST(
'search_status',
'intcomma');
97$search_type_id =
GETPOST(
'search_type_id',
'intcomma');
99$childids = $user->getAllChildIds(1);
102$search_all =
GETPOST(
"search_all",
'alpha');
104foreach (
$object->fields as $key => $val) {
105 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
106 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
108 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
115$fieldstosearchall = array();
116foreach (
$object->fields as $key => $val) {
117 if (!empty($val[
'searchall'])) {
118 $fieldstosearchall[
't.'.$key] = $val[
'label'];
123$arrayfields = array();
124foreach (
$object->fields as $key => $val) {
126 if (!empty($val[
'visible'])) {
127 $visible = (int)
dol_eval($val[
'visible'], 1);
128 $arrayfields[
't.'.$key] = array(
129 'label' => $val[
'label'],
130 'checked' => (($visible < 0) ? 0 : 1),
131 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
132 'position' => $val[
'position'],
133 'help' => isset($val[
'help']) ? $val[
'help'] :
''
138include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
143$permissiontoread = $user->hasRight(
'salaries',
'read');
144$permissiontoadd = $user->hasRight(
'salaries',
'write');
145$permissiontodelete = $user->hasRight(
'salaries',
'delete');
152 $socid = $user->socid;
161if (
GETPOST(
'cancel',
'alpha')) {
165if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
170if ($massaction ==
'withdrawrequest') {
171 $langs->load(
"withdrawals");
173 if (!$user->hasRight(
'paymentbybanktransfer',
'create')) {
179 $listofSalries = array();
180 $arrayofselected = is_array($toselect) ? $toselect : array();
181 foreach ($arrayofselected as $toselectid) {
182 $objecttmp =
new Salary($db);
183 $result = $objecttmp->fetch($toselectid);
185 $totalpaid = $objecttmp->getSommePaiement();
186 $objecttmp->resteapayer =
price2num($objecttmp->amount - $totalpaid,
'MT');
189 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
190 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
192 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
193 $objecttmp->resteapayer = $remaintopay;
195 } elseif ($reshook < 0) {
197 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
200 if ($objecttmp->status == Salary::STATUS_PAID || $objecttmp->resteapayer == 0) {
202 setEventMessages($langs->trans(
"Salary").
' '.$objecttmp->ref.
' : '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
203 } elseif ($resteapayer < 0) {
205 setEventMessages($langs->trans(
"Salary").
' '.$objecttmp->ref.
' : '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
208 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
209 $rsql .=
" , pfd.date_traite as date_traite";
210 $rsql .=
" , pfd.amount";
211 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
212 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
213 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
214 $rsql .=
" WHERE fk_salary = ".((int) $objecttmp->id);
215 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
216 $rsql .=
" AND pfd.traite = 0";
217 $rsql .=
" ORDER BY pfd.date_demande DESC";
219 $result_sql = $db->query($rsql);
221 $numprlv = $db->num_rows($result_sql);
226 setEventMessages($langs->trans(
"Salary").
' '.$objecttmp->ref.
' : '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
227 } elseif (!empty($objecttmp->type_payment_code) && $objecttmp->type_payment_code !=
'VIR') {
228 $langs->load(
"errors");
230 setEventMessages($langs->trans(
"Salary").
' '.$objecttmp->ref.
' : '.$langs->trans(
"ErrorThisPaymentModeIsNotCreditTransfer"), $objecttmp->errors,
'errors');
232 $listofSalries[] = $objecttmp;
238 if (!$error && !empty($listofSalries)) {
239 $nbwithdrawrequestok = 0;
240 foreach ($listofSalries as $salary) {
242 $result = $salary->demande_prelevement($user, (
float) $salary->resteapayer,
'salaire');
245 $nbwithdrawrequestok++;
251 if ($nbwithdrawrequestok > 0) {
252 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
258$parameters = array();
259$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
264if (empty($reshook)) {
266 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
269 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
273 $search_date_start_from =
'';
274 $search_date_start_to =
'';
275 $search_date_end_from =
'';
276 $search_date_end_to =
'';
277 $search_date_end =
'';
279 $search_account =
'';
281 $search_type_id =
"";
283 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
284 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
289 $objectclass =
'Salary';
290 $objectlabel =
'Salaries';
291 $uploaddir = $conf->salaries->dir_output;
292 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
295 if (!$error && $massaction ==
'buildsepa' && $permissiontoadd) {
296 $objecttmp =
new $objectclass($db);
306$form =
new Form($db);
307$salstatic =
new Salary($db);
308$userstatic =
new User($db);
309$accountstatic =
new Account($db);
313$title = $langs->trans(
'Salaries');
321$sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.photo, u.salary as current_salary, u.fk_soc as fk_soc, u.statut as status,";
322$sql .=
" s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, s.fk_typepayment as paymenttype, ";
323$sql .=
" ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,";
324$sql .=
" pst.code as payment_code,";
325$sql .=
" SUM(ps.amount) as alreadypayed";
327if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
328 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
329 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
333$parameters = array();
334$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
335$sql .= $hookmanager->resPrint;
336$sql = preg_replace(
'/,\s*$/',
'', $sql);
341$sql .=
" FROM ".MAIN_DB_PREFIX.
"salary as s";
342$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"payment_salary as ps ON (ps.fk_salary = s.rowid) ";
343$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as pst ON (s.fk_typepayment = pst.id) ";
344$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account ba ON (ba.rowid = s.fk_account), ";
346$sql .=
" ".MAIN_DB_PREFIX.
"user as u";
347$sql .=
" WHERE u.rowid = s.fk_user";
348$sql .=
" AND s.entity IN (".getEntity(
'salaries').
")";
349if (!$user->hasRight(
'salaries',
'readall')) {
350 $sql .=
" AND s.fk_user IN (".$db->sanitize(implode(
',', $childids)).
")";
356 $sql .=
" AND s.rowid=".((int) $search_ref);
359 $sql .=
natural_search(array(
'u.login',
'u.lastname',
'u.firstname',
'u.email'), $search_user);
364if (!empty($search_date_start_from)) {
365 $sql .=
" AND s.datesp >= '".$db->idate($search_date_start_from).
"'";
367if (!empty($search_date_end_from)) {
368 $sql .=
" AND s.dateep >= '".$db->idate($search_date_end_from).
"'";
370if (!empty($search_date_start_to)) {
371 $sql .=
" AND s.datesp <= '".$db->idate($search_date_start_to).
"'";
373if (!empty($search_date_end_to)) {
374 $sql .=
" AND s.dateep <= '".$db->idate($search_date_end_to).
"'";
380if ($search_account > 0) {
381 $sql .=
" AND s.fk_account=".((int) $search_account);
383if ($search_status !=
'' && $search_status >= 0) {
384 $sql .=
" AND s.paye = ".((int) $search_status);
386if ($search_type_id) {
387 $sql .=
" AND s.fk_typepayment=".((int) $search_type_id);
389$sql .=
" GROUP BY u.rowid, u.lastname, u.firstname, u.login, u.email, u.admin, u.photo, u.salary, u.fk_soc, u.statut,";
390$sql .=
" s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, s.fk_typepayment, s.fk_bank,";
391$sql .=
" ba.rowid, ba.ref, ba.number, ba.account_number, ba.fk_accountancy_journal, ba.label, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos,";
395$nbtotalofrecords =
'';
398 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
399 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
400 $resql = $db->query($sqlforcount);
402 $objforcount = $db->fetch_object($resql);
403 $nbtotalofrecords = $objforcount->nbtotalofrecords;
408 if (($page * $limit) > $nbtotalofrecords) {
416$sql .= $db->order($sortfield, $sortorder);
418 $sql .= $db->plimit($limit + 1, $offset);
421$resql = $db->query($sql);
427$num = $db->num_rows($resql);
431if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
432 $obj = $db->fetch_object($resql);
434 header(
"Location: ".
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?id='.$id);
442llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
444$arrayofselected = is_array($toselect) ? $toselect : array();
448 $param .=
'&mode='.urlencode($mode);
450if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
451 $param .=
'&contextpage='.urlencode($contextpage);
453if ($limit > 0 && $limit != $conf->liste_limit) {
454 $param .=
'&limit='.((int) $limit);
456if ($search_type_id) {
457 $param .=
'&search_type_id='.urlencode($search_type_id);
459if ($optioncss !=
'') {
460 $param .=
'&optioncss='.urlencode($optioncss);
462if ($search_ref !=
'') {
463 $param .=
'&search_ref='.urlencode($search_ref);
465if ($search_user !=
'') {
466 $param .=
'&search_user='.urlencode($search_user);
469 $param .=
'&search_label='.urlencode($search_label);
471if ($search_account) {
472 $param .=
'&search_account='.urlencode((
string) ($search_account));
474if ($search_status !=
'' && $search_status !=
'-1') {
475 $param .=
'&search_status='.urlencode($search_status);
477if (!empty($search_date_start_from)) {
478 $param .=
'&search_date_start_fromday='.urlencode(
GETPOST(
'search_date_start_fromday')).
'&search_date_start_frommonth='.urlencode(
GETPOST(
'search_date_start_frommonth')).
'&search_date_start_fromyear='.urlencode(
GETPOST(
'search_date_start_fromyear'));
480if (!empty($search_date_start_to)) {
481 $param .=
"&search_date_start_today=".urlencode(
GETPOST(
'search_date_start_today')).
"&search_date_start_tomonth=".urlencode(
GETPOST(
'search_date_start_tomonth')).
"&search_date_start_toyear=".urlencode(
GETPOST(
'search_date_start_toyear'));
483if (!empty($search_date_end_from)) {
484 $param .=
'&search_date_end_fromday='.urlencode(
GETPOST(
'search_date_end_fromday')).
'&search_date_end_frommonth='.urlencode(
GETPOST(
'search_date_end_frommonth')).
'&search_date_end_fromyear='.urlencode(
GETPOST(
'search_date_end_fromyear'));
486if (!empty($search_date_end_to)) {
487 $param .=
"&search_date_end_today=".urlencode(
GETPOST(
'search_date_end_today')).
"&search_date_end_tomonth=".urlencode(
GETPOST(
'search_date_end_tomonth')).
"&search_date_end_toyear=".urlencode(
GETPOST(
'search_date_end_toyear'));
491include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
493$parameters = array(
'param' => &$param);
494$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
495$param .= $hookmanager->resPrint;
498$arrayofmassactions = array(
502if (!empty($permissiontodelete)) {
503 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
505if (isModEnabled(
'paymentbybanktransfer') && $user->hasRight(
'paymentbybanktransfer',
'create')) {
506 $langs->load(
"withdrawals");
507 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeBankTransferOrder");
509if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
510 $arrayofmassactions = array();
512$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
514print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
515if ($optioncss !=
'') {
516 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
518print
'<input type="hidden" name="token" value="'.newToken().
'">';
519print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
520print
'<input type="hidden" name="action" value="list">';
521print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
522print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
523print
'<input type="hidden" name="page" value="'.$page.
'">';
524print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
525print
'<input type="hidden" name="page_y" value="">';
526print
'<input type="hidden" name="mode" value="'.$mode.
'">';
529$url = DOL_URL_ROOT.
'/salaries/card.php?action=create';
531 $url .=
'&socid='.$socid;
535$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'));
536$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'));
538$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewSalary'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
540print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
543$topicmail =
"SendSalaryRef";
544$modelmail =
"salary";
545$objecttmp =
new Salary($db);
546$trackid =
'sal'.$object->id;
547include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
551$parameters = array();
552$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
553if (empty($reshook)) {
554 $moreforfilter .= $hookmanager->resPrint;
556 $moreforfilter = $hookmanager->resPrint;
559if (!empty($moreforfilter)) {
560 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
561 print $moreforfilter;
562 $parameters = array();
563 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
564 print $hookmanager->resPrint;
568$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
569$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
570$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
571$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
573print
'<div class="div-table-responsive">';
574print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
578print
'<tr class="liste_titre_filter">';
581 print
'<td class="liste_titre center maxwidthsearch">';
582 $searchpicto = $form->showFilterButtons(
'left');
587print
'<td class="liste_titre left">';
588print
'<input class="flat width50" type="text" name="search_ref" value="'.$db->escape($search_ref).
'">';
591print
'<td class="liste_titre"><input type="text" class="flat width100" name="search_label" value="'.$db->escape($search_label).
'"></td>';
594print
'<td class="liste_titre center">';
595print
'<div class="nowrapfordate">';
596print $form->selectDate($search_date_start_from ? $search_date_start_from : -1,
'search_date_start_from', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
598print
'<div class="nowrapfordate">';
599print $form->selectDate($search_date_start_to ? $search_date_start_to : -1,
'search_date_start_to', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
604print
'<td class="liste_titre center">';
605print
'<div class="nowrapfordate">';
606print $form->selectDate($search_date_end_from ? $search_date_end_from : -1,
'search_date_end_from', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
608print
'<div class="nowrapfordate">';
609print $form->selectDate($search_date_end_to ? $search_date_end_to : -1,
'search_date_end_to', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
614print
'<td class="liste_titre">';
615print
'<input class="flat" type="text" size="6" name="search_user" value="'.$db->escape($search_user).
'">';
619print
'<td class="liste_titre left">';
620print $form->select_types_paiements($search_type_id,
'search_type_id',
'', 0, 1, 1, 16, 1,
'maxwidth125', 1);
624if (isModEnabled(
"bank")) {
625 print
'<td class="liste_titre">';
626 print $form->select_comptes($search_account,
'search_account', 0,
'', 1,
'', 0,
'maxwidth125', 1);
631print
'<td class="liste_titre right"><input name="search_amount" class="flat" type="text" size="8" value="'.$db->escape($search_amount).
'"></td>';
634print
'<td class="liste_titre right parentonrightofpage">';
635$liststatus = array(
'0' => $langs->trans(
"Unpaid"),
'1' => $langs->trans(
"Paid"));
637print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage');
641include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
644$parameters = array(
'arrayfields' => $arrayfields);
645$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
646print $hookmanager->resPrint;
649 print
'<td class="liste_titre center maxwidthsearch">';
650 $searchpicto = $form->showFilterButtons();
656$totalarray = array();
657$totalarray[
'nbfield'] = 0;
661print
'<tr class="liste_titre">';
664 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
665 $totalarray[
'nbfield']++;
668$totalarray[
'nbfield']++;
670$totalarray[
'nbfield']++;
671print_liste_field_titre(
"DateStart", $_SERVER[
"PHP_SELF"],
"s.datesp,s.rowid",
"", $param,
'', $sortfield, $sortorder,
'center ');
672$totalarray[
'nbfield']++;
673print_liste_field_titre(
"DateEnd", $_SERVER[
"PHP_SELF"],
"s.dateep,s.rowid",
"", $param,
'', $sortfield, $sortorder,
'center ');
674$totalarray[
'nbfield']++;
675print_liste_field_titre(
"Employee", $_SERVER[
"PHP_SELF"],
"u.lastname",
"", $param,
"", $sortfield, $sortorder);
676$totalarray[
'nbfield']++;
677print_liste_field_titre(
"DefaultPaymentMode", $_SERVER[
"PHP_SELF"],
"type",
"", $param,
'', $sortfield, $sortorder);
678$totalarray[
'nbfield']++;
679if (isModEnabled(
"bank")) {
680 print_liste_field_titre(
"DefaultBankAccount", $_SERVER[
"PHP_SELF"],
"ba.label",
"", $param,
"", $sortfield, $sortorder);
681 $totalarray[
'nbfield']++;
683print_liste_field_titre(
"Amount", $_SERVER[
"PHP_SELF"],
"s.amount",
"", $param,
'', $sortfield, $sortorder,
'right ');
684$totalarray[
'nbfield']++;
685print_liste_field_titre(
'Status', $_SERVER[
"PHP_SELF"],
"s.paye",
'', $param,
'', $sortfield, $sortorder,
'center ');
686$totalarray[
'nbfield']++;
688include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
690$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
691$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
692print $hookmanager->resPrint;
695 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
696 $totalarray[
'nbfield']++;
702$needToFetchEachLine = 0;
703if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
704 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
705 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
706 $needToFetchEachLine++;
714$savnbfield = $totalarray[
'nbfield'];
715$totalarray = array();
716$totalarray[
'nbfield'] = 0;
717$totalarray[
'val'] = array();
718$totalarray[
'val'][
'totalttcfield'] = 0;
719$imaxinloop = ($limit ? min($num, $limit) : $num);
720while ($i < $imaxinloop) {
721 $obj = $db->fetch_object($resql);
727 $object->setVarsFromFetchObj($obj);
729 $userstatic->id = $obj->uid;
730 $userstatic->lastname = $obj->lastname;
731 $userstatic->firstname = $obj->firstname;
732 $userstatic->admin = $obj->admin;
733 $userstatic->login = $obj->login;
734 $userstatic->email = $obj->email;
735 $userstatic->socid = $obj->fk_soc;
736 $userstatic->statut = $obj->status;
737 $userstatic->status = $obj->status;
738 $userstatic->photo = $obj->photo;
740 $salstatic->id = $obj->rowid;
741 $salstatic->ref = $obj->rowid;
742 $salstatic->label = $obj->label;
743 $salstatic->paye = $obj->paye;
744 $salstatic->status = $obj->paye;
745 $salstatic->alreadypaid = $obj->alreadypayed;
746 $salstatic->totalpaid = $obj->alreadypayed;
747 $salstatic->datesp = $obj->datesp;
748 $salstatic->dateep = $obj->dateep;
749 $salstatic->amount = $obj->amount;
750 $salstatic->type_payment = $obj->payment_code;
752 if ($mode ==
'kanban') {
754 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
755 print
'<div class="box-flex-container kanban">';
758 if ($massactionbutton || $massaction) {
760 if (in_array(
$object->id, $arrayofselected)) {
764 print $salstatic->getKanbanView(
'', array(
'user' => $userstatic,
'selected' => $selected));
765 if ($i == ($imaxinloop - 1)) {
772 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
775 print
'<td class="nowrap center">';
776 if ($massactionbutton || $massaction) {
778 if (in_array(
$object->id, $arrayofselected)) {
781 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
785 $totalarray[
'nbfield']++;
790 print
"<td>".$salstatic->getNomUrl(1).
"</td>\n";
792 $totalarray[
'nbfield']++;
796 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).
'">'.
dol_escape_htmltag($obj->label).
"</td>\n";
798 $totalarray[
'nbfield']++;
802 print
'<td class="center">'.dol_print_date($db->jdate($obj->datesp),
'day').
"</td>\n";
804 $totalarray[
'nbfield']++;
808 print
'<td class="center">'.dol_print_date($db->jdate($obj->dateep),
'day').
"</td>\n";
810 $totalarray[
'nbfield']++;
814 print
'<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1).
"</td>\n";
816 $totalarray[
'nbfield']++;
820 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans(
"PaymentTypeShort".$obj->payment_code)).
'">';
821 if (!empty($obj->payment_code)) {
822 print $langs->trans(
"PaymentTypeShort".$obj->payment_code);
826 $totalarray[
'nbfield']++;
830 if (isModEnabled(
"bank")) {
832 if ($obj->fk_account > 0) {
834 $accountstatic->id = $obj->bid;
835 $accountstatic->ref = $obj->bref;
836 $accountstatic->label = $obj->blabel;
837 $accountstatic->number = $obj->bnumber;
838 $accountstatic->iban = $obj->iban;
839 $accountstatic->bic = $obj->bic;
840 $accountstatic->currency_code = $langs->trans(
"Currency".$obj->currency_code);
841 $accountstatic->account_number = $obj->account_number;
842 $accountstatic->clos = $obj->clos;
843 $accountstatic->status = $obj->clos;
845 if (isModEnabled(
'accounting')) {
846 $accountstatic->account_number = $obj->account_number;
849 $accountingjournal->fetch($obj->fk_accountancy_journal);
851 $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
854 print $accountstatic->getNomUrl(1);
860 $totalarray[
'nbfield']++;
867 print
'<td class="nowraponall right"><span class="amount">'.price($obj->amount).
'</span></td>';
869 $totalarray[
'nbfield']++;
872 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalttcfield';
874 $totalarray[
'val'][
'totalttcfield'] += $obj->amount;
877 print
'<td class="nowraponall center">'.$salstatic->getLibStatut(5, $obj->alreadypayed).
'</td>';
879 $totalarray[
'nbfield']++;
883 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
885 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
886 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
887 print $hookmanager->resPrint;
891 print
'<td class="nowrap center">';
892 if ($massactionbutton || $massaction) {
894 if (in_array(
$object->id, $arrayofselected)) {
897 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
901 $totalarray[
'nbfield']++;
911include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
923 if (isModEnabled(
"bank")) {
926 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
932$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
933$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
934print $hookmanager->resPrint;
936print
'</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 to manage accounting journals.
Class to manage payments of salaries.
Class to manage salary payments.
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.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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...
dol_now($mode='auto')
Return date for now.
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.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get 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_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.