Go to the documentation of this file.
28 require
'../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/tva.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/compta/deplacement/class/deplacement.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
35 $langs->loadLangs(array(
'companies',
'users',
'trips'));
38 $socid =
GETPOST(
'socid',
'int');
40 $socid = $user->socid;
44 $search_ref =
GETPOST(
'search_ref',
'int');
45 $search_name =
GETPOST(
'search_name',
'alpha');
46 $search_company =
GETPOST(
'search_company',
'alpha');
48 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
49 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
51 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
52 if (empty($page) || $page == -1) {
55 $offset = $limit * $page;
56 $pageprev = $page - 1;
57 $pagenext = $page + 1;
62 $sortfield =
"d.dated";
69 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
85 $userstatic =
new User($db);
87 $childids = $user->getAllChildIds();
88 $childids[] = $user->id;
92 $sql =
"SELECT s.nom, d.fk_user, s.rowid as socid,";
93 $sql .=
" d.rowid, d.type, d.dated as dd, d.km,";
94 $sql .=
" d.fk_statut,";
95 $sql .=
" u.lastname, u.firstname";
96 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u";
97 $sql .=
", ".MAIN_DB_PREFIX.
"deplacement as d";
98 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON d.fk_soc = s.rowid";
99 if (empty($user->rights->societe->client->voir) && !$socid) {
100 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON s.rowid = sc.fk_soc";
102 $sql .=
" WHERE d.fk_user = u.rowid";
103 $sql .=
" AND d.entity = ".$conf->entity;
104 if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) {
105 $sql .=
' AND d.fk_user IN ('.$db->sanitize(join(
',', $childids)).
')';
107 if (empty($user->rights->societe->client->voir) && !$socid) {
108 $sql .=
" AND (sc.fk_user = ".((int) $user->id).
" OR d.fk_soc IS NULL) ";
111 $sql .=
" AND s.rowid = ".((int) $socid);
115 $sql .=
" AND d.rowid = ".((int) $search_ref);
120 if ($search_company) {
125 $sql .= $db->order($sortfield, $sortorder);
126 $sql .= $db->plimit($limit + 1, $offset);
129 $resql = $db->query($sql);
131 $num = $db->num_rows(
$resql);
133 print_barre_liste($langs->trans(
"ListOfFees"), $page, $_SERVER[
"PHP_SELF"],
"&socid=$socid", $sortfield, $sortorder,
'', $num);
136 print
'<form method="get" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
137 print
'<table class="noborder centpercent">';
138 print
"<tr class=\"liste_titre\">";
139 print_liste_field_titre(
"Ref", $_SERVER[
"PHP_SELF"],
"d.rowid",
"",
"&socid=$socid",
'', $sortfield, $sortorder);
140 print_liste_field_titre(
"Type", $_SERVER[
"PHP_SELF"],
"d.type",
"",
"&socid=$socid",
'', $sortfield, $sortorder);
141 print_liste_field_titre(
"Date", $_SERVER[
"PHP_SELF"],
"d.dated",
"",
"&socid=$socid",
'align="center"', $sortfield, $sortorder);
142 print_liste_field_titre(
"Person", $_SERVER[
"PHP_SELF"],
"u.lastname",
"",
"&socid=$socid",
'', $sortfield, $sortorder);
143 print_liste_field_titre(
"Company", $_SERVER[
"PHP_SELF"],
"s.nom",
"",
"&socid=$socid",
'', $sortfield, $sortorder);
144 print_liste_field_titre(
"FeesKilometersOrAmout", $_SERVER[
"PHP_SELF"],
"d.km",
"",
"&socid=$socid",
'class="right"', $sortfield, $sortorder);
149 print
'<tr class="liste_titre">';
150 print
'<td class="liste_titre">';
151 print
'<input class="flat" size="4" type="text" name="search_ref" value="'.$search_ref.
'">';
153 print
'<td class="liste_titre">';
156 print
'<td class="liste_titre" align="center">';
157 if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
158 print
'<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.
'">';
160 print
'<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.
'">';
161 print $formother->selectyear($year ? $year : -1,
'year', 1, 20, 5);
163 print
'<td class="liste_titre">';
164 print
'<input class="flat" size="10" type="text" name="search_name" value="'.$search_name.
'">';
166 print
'<td class="liste_titre">';
167 print
'<input class="flat" size="10" type="text" name="search_company" value="'.$search_company.
'">';
169 print
'<td class="liste_titre right">';
172 print
'<td class="liste_titre maxwidthsearch">';
173 $searchpicto =
$form->showFilterAndCheckAddButtons(0);
178 while ($i < min($num, $limit)) {
179 $obj = $db->fetch_object(
$resql);
183 $soc->fetch($obj->socid);
186 print
'<tr class="oddeven">';
188 print
'<td><a href="card.php?id='.$obj->rowid.
'">'.
img_object($langs->trans(
"ShowTrip"),
"trip").
' '.$obj->rowid.
'</a></td>';
190 print
'<td>'.$langs->trans($obj->type).
'</td>';
192 print
'<td class="center">'.dol_print_date($db->jdate($obj->dd),
'day').
'</td>';
195 $userstatic->id = $obj->fk_user;
196 $userstatic->lastname = $obj->lastname;
197 $userstatic->firstname = $obj->firstname;
198 print $userstatic->getNomUrl(1);
202 print
'<td>'.$soc->getNomUrl(1).
'</td>';
204 print
'<td> </td>';
207 print
'<td class="right">'.$obj->km.
'</td>';
209 $tripandexpense_static->statut = $obj->fk_statut;
210 print
'<td class="right">'.$tripandexpense_static->getLibStatut(5).
'</td>';
Class to manage third parties objects (customers, suppliers, prospects...)
restrictedArea($user, $features, $objectid=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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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.
Class to manage Dolibarr users.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
Class to manage trips and working credit notes.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0, $gm=false)
Generate a SQL string to make a filter into a range (for second of date until last second of date).
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.