29require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/salaries/class/paymentsalary.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
32if (isModEnabled(
'accounting')) {
33 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
37$langs->loadLangs(array(
"compta",
"salaries",
"bills",
"hrm"));
39$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
40$massaction =
GETPOST(
'massaction',
'alpha');
42$confirm =
GETPOST(
'confirm',
'alpha');
43$cancel =
GETPOST(
'cancel',
'alpha');
44$toselect =
GETPOST(
'toselect',
'array');
45$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
46$backtopage =
GETPOST(
'backtopage',
'alpha');
47$optioncss =
GETPOST(
'optioncss',
'aZ');
53$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
54$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
56if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
60$offset = $limit * $page;
64 $sortfield =
"s.datep,s.rowid";
67 $sortorder =
"DESC,DESC";
73$diroutputmassaction = $conf->user->dir_output.
'/temp/massgeneration/'.$user->id;
74$hookmanager->initHooks(array(
'salarieslist'));
77$extrafields->fetch_name_optionals_label(
$object->table_element);
79$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
82 $sortfield =
"s.datep,s.rowid";
85 $sortorder =
"DESC,DESC";
88$search_ref =
GETPOST(
'search_ref',
'alpha');
89$search_user =
GETPOST(
'search_user',
'alpha');
90$search_label =
GETPOST(
'search_label',
'alpha');
95$search_amount =
GETPOST(
'search_amount',
'alpha');
96$search_account =
GETPOST(
'search_account',
'alpha');
97$search_status =
GETPOST(
'search_status',
'intcomma');
98$search_type_id =
GETPOST(
'search_type_id',
'intcomma');
100$childids = $user->getAllChildIds(1);
103$search_all =
GETPOST(
"search_all",
'alpha');
105foreach (
$object->fields as $key => $val) {
106 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
107 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
109 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
116$fieldstosearchall = array();
117foreach (
$object->fields as $key => $val) {
118 if (!empty($val[
'searchall'])) {
119 $fieldstosearchall[
't.'.$key] = $val[
'label'];
124$arrayfields = array();
125foreach (
$object->fields as $key => $val) {
127 if (!empty($val[
'visible'])) {
128 $visible = (int)
dol_eval($val[
'visible'], 1);
129 $arrayfields[
't.'.$key] = array(
130 'label' => $val[
'label'],
131 'checked' => (($visible < 0) ? 0 : 1),
132 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
133 'position' => $val[
'position'],
134 'help' => isset($val[
'help']) ? $val[
'help'] :
''
139include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
144$permissiontoread = $user->hasRight(
'salaries',
'read');
145$permissiontoadd = $user->hasRight(
'salaries',
'write');
146$permissiontodelete = $user->hasRight(
'salaries',
'delete');
153 $socid = $user->socid;
162if (
GETPOST(
'cancel',
'alpha')) {
166if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
171if ($massaction ==
'withdrawrequest') {
172 $langs->load(
"withdrawals");
174 if (!$user->hasRight(
'paymentbybanktransfer',
'create')) {
180 $listofSalries = array();
181 $arrayofselected = is_array($toselect) ? $toselect : array();
182 foreach ($arrayofselected as $toselectid) {
183 $objecttmp =
new Salary($db);
184 $result = $objecttmp->fetch($toselectid);
186 $totalpaid = $objecttmp->getSommePaiement();
187 $objecttmp->resteapayer =
price2num($objecttmp->amount - $totalpaid,
'MT');
190 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
191 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
193 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
194 $objecttmp->resteapayer = $remaintopay;
196 } elseif ($reshook < 0) {
198 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
201 if ($objecttmp->status == Salary::STATUS_PAID || $objecttmp->resteapayer == 0) {
203 setEventMessages($langs->trans(
"Salary").
' '.$objecttmp->ref.
' : '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
204 } elseif ($resteapayer < 0) {
206 setEventMessages($langs->trans(
"Salary").
' '.$objecttmp->ref.
' : '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
209 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
210 $rsql .=
" , pfd.date_traite as date_traite";
211 $rsql .=
" , pfd.amount";
212 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
213 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
214 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
215 $rsql .=
" WHERE fk_salary = ".((int) $objecttmp->id);
216 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
217 $rsql .=
" AND pfd.traite = 0";
218 $rsql .=
" ORDER BY pfd.date_demande DESC";
220 $result_sql = $db->query($rsql);
222 $numprlv = $db->num_rows($result_sql);
227 setEventMessages($langs->trans(
"Salary").
' '.$objecttmp->ref.
' : '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
228 } elseif (!empty($objecttmp->type_payment_code) && $objecttmp->type_payment_code !=
'VIR') {
229 $langs->load(
"errors");
231 setEventMessages($langs->trans(
"Salary").
' '.$objecttmp->ref.
' : '.$langs->trans(
"ErrorThisPaymentModeIsNotCreditTransfer"), $objecttmp->errors,
'errors');
233 $listofSalries[] = $objecttmp;
239 if (!$error && !empty($listofSalries)) {
240 $nbwithdrawrequestok = 0;
241 foreach ($listofSalries as $salary) {
243 $result = $salary->demande_prelevement($user, (
float) $salary->resteapayer,
'salaire');
246 $nbwithdrawrequestok++;
252 if ($nbwithdrawrequestok > 0) {
253 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
259$parameters = array();
260$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
265if (empty($reshook)) {
267 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
270 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
274 $search_date_start_from =
'';
275 $search_date_start_to =
'';
276 $search_date_end_from =
'';
277 $search_date_end_to =
'';
278 $search_date_end =
'';
280 $search_account =
'';
282 $search_type_id =
"";
284 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
285 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
290 $objectclass =
'Salary';
291 $objectlabel =
'Salaries';
292 $uploaddir = $conf->salaries->dir_output;
293 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
296 if (!$error && $massaction ==
'buildsepa' && $permissiontoadd) {
297 $objecttmp =
new $objectclass($db);
307$form =
new Form($db);
308$salstatic =
new Salary($db);
309$userstatic =
new User($db);
310$accountstatic =
new Account($db);
314$title = $langs->trans(
'Salaries');
322$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,";
323$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, ";
324$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,";
325$sql .=
" pst.code as payment_code,";
326$sql .=
" SUM(ps.amount) as alreadypayed";
328if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
329 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
330 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
334$parameters = array();
335$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
336$sql .= $hookmanager->resPrint;
337$sql = preg_replace(
'/,\s*$/',
'', $sql);
342$sql .=
" FROM ".MAIN_DB_PREFIX.
"salary as s";
343if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
344 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (s.rowid = ef.fk_object)";
346$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"payment_salary as ps ON (ps.fk_salary = s.rowid) ";
347$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as pst ON (s.fk_typepayment = pst.id) ";
348$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account ba ON (ba.rowid = s.fk_account), ";
350$sql .=
" ".MAIN_DB_PREFIX.
"user as u";
351$sql .=
" WHERE u.rowid = s.fk_user";
352$sql .=
" AND s.entity IN (".getEntity(
'salaries').
")";
353if (!$user->hasRight(
'salaries',
'readall')) {
354 $sql .=
" AND s.fk_user IN (".$db->sanitize(implode(
',', $childids)).
")";
360 $sql .=
" AND s.rowid=".((int) $search_ref);
363 $sql .=
natural_search(array(
'u.login',
'u.lastname',
'u.firstname',
'u.email'), $search_user);
368if (!empty($search_date_start_from)) {
369 $sql .=
" AND s.datesp >= '".$db->idate($search_date_start_from).
"'";
371if (!empty($search_date_end_from)) {
372 $sql .=
" AND s.dateep >= '".$db->idate($search_date_end_from).
"'";
374if (!empty($search_date_start_to)) {
375 $sql .=
" AND s.datesp <= '".$db->idate($search_date_start_to).
"'";
377if (!empty($search_date_end_to)) {
378 $sql .=
" AND s.dateep <= '".$db->idate($search_date_end_to).
"'";
384if ($search_account > 0) {
385 $sql .=
" AND s.fk_account=".((int) $search_account);
387if ($search_status !=
'' && $search_status >= 0) {
388 $sql .=
" AND s.paye = ".((int) $search_status);
390if ($search_type_id) {
391 $sql .=
" AND s.fk_typepayment=".((int) $search_type_id);
394include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
395$sql .=
" GROUP BY u.rowid, u.lastname, u.firstname, u.login, u.email, u.admin, u.photo, u.salary, u.fk_soc, u.statut,";
396$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,";
397$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,";
401$nbtotalofrecords =
'';
404 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
405 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
406 $resql = $db->query($sqlforcount);
408 $objforcount = $db->fetch_object($resql);
409 $nbtotalofrecords = $objforcount->nbtotalofrecords;
414 if (($page * $limit) > $nbtotalofrecords) {
422$sql .= $db->order($sortfield, $sortorder);
424 $sql .= $db->plimit($limit + 1, $offset);
427$resql = $db->query($sql);
433$num = $db->num_rows($resql);
437if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
438 $obj = $db->fetch_object($resql);
440 header(
"Location: ".DOL_URL_ROOT.
'/salaries/card.php?id='.$id);
448llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
450$arrayofselected = is_array($toselect) ? $toselect : array();
454 $param .=
'&mode='.urlencode($mode);
456if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
457 $param .=
'&contextpage='.urlencode($contextpage);
459if ($limit > 0 && $limit != $conf->liste_limit) {
460 $param .=
'&limit='.((int) $limit);
462if ($search_type_id) {
463 $param .=
'&search_type_id='.urlencode($search_type_id);
465if ($optioncss !=
'') {
466 $param .=
'&optioncss='.urlencode($optioncss);
468if ($search_ref !=
'') {
469 $param .=
'&search_ref='.urlencode($search_ref);
471if ($search_user !=
'') {
472 $param .=
'&search_user='.urlencode($search_user);
475 $param .=
'&search_label='.urlencode($search_label);
477if ($search_account) {
478 $param .=
'&search_account='.urlencode((
string) ($search_account));
480if ($search_status !=
'' && $search_status !=
'-1') {
481 $param .=
'&search_status='.urlencode($search_status);
483if (!empty($search_date_start_from)) {
484 $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'));
486if (!empty($search_date_start_to)) {
487 $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'));
489if (!empty($search_date_end_from)) {
490 $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'));
492if (!empty($search_date_end_to)) {
493 $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'));
497include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
499$parameters = array(
'param' => &$param);
500$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
501$param .= $hookmanager->resPrint;
504$arrayofmassactions = array(
508if (!empty($permissiontodelete)) {
509 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
511if (isModEnabled(
'paymentbybanktransfer') && $user->hasRight(
'paymentbybanktransfer',
'create')) {
512 $langs->load(
"withdrawals");
513 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeBankTransferOrder");
515if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
516 $arrayofmassactions = array();
518$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
520print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
521if ($optioncss !=
'') {
522 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
524print
'<input type="hidden" name="token" value="'.newToken().
'">';
525print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
526print
'<input type="hidden" name="action" value="list">';
527print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
528print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
529print
'<input type="hidden" name="page" value="'.$page.
'">';
530print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
531print
'<input type="hidden" name="page_y" value="">';
532print
'<input type="hidden" name="mode" value="'.$mode.
'">';
535$url = DOL_URL_ROOT.
'/salaries/card.php?action=create';
537 $url .=
'&socid='.$socid;
541$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'));
542$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'));
544$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewSalary'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
546print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
549$topicmail =
"SendSalaryRef";
550$modelmail =
"salary";
551$objecttmp =
new Salary($db);
552$trackid =
'sal'.$object->id;
553include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
557$parameters = array();
558$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
559if (empty($reshook)) {
560 $moreforfilter .= $hookmanager->resPrint;
562 $moreforfilter = $hookmanager->resPrint;
565if (!empty($moreforfilter)) {
566 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
567 print $moreforfilter;
571$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
572$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
573$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
574$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
576print
'<div class="div-table-responsive">';
577print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
581print
'<tr class="liste_titre_filter">';
584 print
'<td class="liste_titre center maxwidthsearch">';
585 $searchpicto = $form->showFilterButtons(
'left');
590print
'<td class="liste_titre left">';
591print
'<input class="flat width50" type="text" name="search_ref" value="'.$db->escape($search_ref).
'">';
594print
'<td class="liste_titre"><input type="text" class="flat width100" name="search_label" value="'.$db->escape($search_label).
'"></td>';
597print
'<td class="liste_titre center">';
598print
'<div class="nowrapfordate">';
599print $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'));
601print
'<div class="nowrapfordate">';
602print $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'));
607print
'<td class="liste_titre center">';
608print
'<div class="nowrapfordate">';
609print $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'));
611print
'<div class="nowrapfordate">';
612print $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'));
617print
'<td class="liste_titre">';
618print
'<input class="flat" type="text" size="6" name="search_user" value="'.$db->escape($search_user).
'">';
622print
'<td class="liste_titre left">';
623print $form->select_types_paiements($search_type_id,
'search_type_id',
'', 0, 1, 1, 16, 1,
'maxwidth125', 1);
627if (isModEnabled(
"bank")) {
628 print
'<td class="liste_titre">';
629 print $form->select_comptes($search_account,
'search_account', 0,
'', 1,
'', 0,
'maxwidth125', 1);
634include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
637print
'<td class="liste_titre right"><input name="search_amount" class="flat" type="text" size="8" value="'.$db->escape($search_amount).
'"></td>';
640print
'<td class="liste_titre right parentonrightofpage">';
641$liststatus = array(
'0' => $langs->trans(
"Unpaid"),
'1' => $langs->trans(
"Paid"));
643print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage');
647$parameters = array(
'arrayfields' => $arrayfields);
648$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
649print $hookmanager->resPrint;
652 print
'<td class="liste_titre center maxwidthsearch">';
653 $searchpicto = $form->showFilterButtons();
659$totalarray = array();
660$totalarray[
'nbfield'] = 0;
664print
'<tr class="liste_titre">';
667 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
668 $totalarray[
'nbfield']++;
671$totalarray[
'nbfield']++;
673$totalarray[
'nbfield']++;
674print_liste_field_titre(
"DateStart", $_SERVER[
"PHP_SELF"],
"s.datesp,s.rowid",
"", $param,
'', $sortfield, $sortorder,
'center ');
675$totalarray[
'nbfield']++;
676print_liste_field_titre(
"DateEnd", $_SERVER[
"PHP_SELF"],
"s.dateep,s.rowid",
"", $param,
'', $sortfield, $sortorder,
'center ');
677$totalarray[
'nbfield']++;
678print_liste_field_titre(
"Employee", $_SERVER[
"PHP_SELF"],
"u.lastname",
"", $param,
"", $sortfield, $sortorder);
679$totalarray[
'nbfield']++;
680print_liste_field_titre(
"DefaultPaymentMode", $_SERVER[
"PHP_SELF"],
"type",
"", $param,
'', $sortfield, $sortorder);
681$totalarray[
'nbfield']++;
682if (isModEnabled(
"bank")) {
683 print_liste_field_titre(
"DefaultBankAccount", $_SERVER[
"PHP_SELF"],
"ba.label",
"", $param,
"", $sortfield, $sortorder);
684 $totalarray[
'nbfield']++;
688include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
690print_liste_field_titre(
"Amount", $_SERVER[
"PHP_SELF"],
"s.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
691$totalarray[
'nbfield']++;
692print_liste_field_titre(
'Status', $_SERVER[
"PHP_SELF"],
"s.paye",
'', $param,
'', $sortfield, $sortorder,
'center ');
693$totalarray[
'nbfield']++;
696$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
697$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
698print $hookmanager->resPrint;
701 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
702 $totalarray[
'nbfield']++;
708$needToFetchEachLine = 0;
709if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
710 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
711 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
712 $needToFetchEachLine++;
720$savnbfield = $totalarray[
'nbfield'];
721$totalarray = array();
722$totalarray[
'nbfield'] = 0;
723$totalarray[
'val'] = array();
724$totalarray[
'val'][
'totalttcfield'] = 0;
725$imaxinloop = ($limit ? min($num, $limit) : $num);
726while ($i < $imaxinloop) {
727 $obj = $db->fetch_object($resql);
733 $object->setVarsFromFetchObj($obj);
735 $userstatic->id = $obj->uid;
736 $userstatic->lastname = $obj->lastname;
737 $userstatic->firstname = $obj->firstname;
738 $userstatic->admin = $obj->admin;
739 $userstatic->login = $obj->login;
740 $userstatic->email = $obj->email;
741 $userstatic->socid = $obj->fk_soc;
742 $userstatic->statut = $obj->status;
743 $userstatic->status = $obj->status;
744 $userstatic->photo = $obj->photo;
746 $salstatic->id = $obj->rowid;
747 $salstatic->ref = $obj->rowid;
748 $salstatic->label = $obj->label;
749 $salstatic->paye = $obj->paye;
750 $salstatic->status = $obj->paye;
751 $salstatic->alreadypaid = $obj->alreadypayed;
752 $salstatic->totalpaid = $obj->alreadypayed;
753 $salstatic->datesp = $obj->datesp;
754 $salstatic->dateep = $obj->dateep;
755 $salstatic->amount = $obj->amount;
756 $salstatic->type_payment = $obj->payment_code;
758 if ($mode ==
'kanban') {
760 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
761 print
'<div class="box-flex-container kanban">';
764 if ($massactionbutton || $massaction) {
766 if (in_array(
$object->id, $arrayofselected)) {
770 print $salstatic->getKanbanView(
'', array(
'user' => $userstatic,
'selected' => $selected));
771 if ($i == ($imaxinloop - 1)) {
778 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
781 print
'<td class="nowrap center">';
782 if ($massactionbutton || $massaction) {
784 if (in_array(
$object->id, $arrayofselected)) {
787 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
791 $totalarray[
'nbfield']++;
796 print
"<td>".$salstatic->getNomUrl(1).
"</td>\n";
798 $totalarray[
'nbfield']++;
802 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).
'">'.
dol_escape_htmltag($obj->label).
"</td>\n";
804 $totalarray[
'nbfield']++;
808 print
'<td class="center">'.dol_print_date($db->jdate($obj->datesp),
'day').
"</td>\n";
810 $totalarray[
'nbfield']++;
814 print
'<td class="center">'.dol_print_date($db->jdate($obj->dateep),
'day').
"</td>\n";
816 $totalarray[
'nbfield']++;
820 print
'<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1).
"</td>\n";
822 $totalarray[
'nbfield']++;
826 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans(
"PaymentTypeShort".$obj->payment_code)).
'">';
827 if (!empty($obj->payment_code)) {
828 print $langs->trans(
"PaymentTypeShort".$obj->payment_code);
832 $totalarray[
'nbfield']++;
836 if (isModEnabled(
"bank")) {
838 if ($obj->fk_account > 0) {
840 $accountstatic->id = $obj->bid;
841 $accountstatic->ref = $obj->bref;
842 $accountstatic->label = $obj->blabel;
843 $accountstatic->number = $obj->bnumber;
844 $accountstatic->iban = $obj->iban;
845 $accountstatic->bic = $obj->bic;
846 $accountstatic->currency_code = $langs->trans(
"Currency".$obj->currency_code);
847 $accountstatic->account_number = $obj->account_number;
848 $accountstatic->clos = $obj->clos;
849 $accountstatic->status = $obj->clos;
851 if (isModEnabled(
'accounting')) {
852 $accountstatic->account_number = $obj->account_number;
855 $accountingjournal->fetch($obj->fk_accountancy_journal);
857 $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
860 print $accountstatic->getNomUrl(1);
866 $totalarray[
'nbfield']++;
873 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
876 print
'<td class="nowraponall right"><span class="amount">'.price($obj->amount).
'</span></td>';
878 $totalarray[
'nbfield']++;
881 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalttcfield';
883 $totalarray[
'val'][
'totalttcfield'] += $obj->amount;
886 print
'<td class="nowraponall center">'.$salstatic->getLibStatut(5, $obj->alreadypayed).
'</td>';
888 $totalarray[
'nbfield']++;
892 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
893 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
894 print $hookmanager->resPrint;
898 print
'<td class="nowrap center">';
899 if ($massactionbutton || $massaction) {
901 if (in_array(
$object->id, $arrayofselected)) {
904 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
908 $totalarray[
'nbfield']++;
918include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
930 if (isModEnabled(
"bank")) {
933 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
939$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
940$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
941print $hookmanager->resPrint;
943print
'</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 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_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.