dolibarr  17.0.4
list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
4  * Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
5  * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
6  * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
7  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
8  * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
9  * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
10  * Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
11  * Copyright (C) 2017-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
12  * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
13  * Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
14  * Copyright (C) 2021 Ferran Marcet <fmarcet@2byte.es>
15  *
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program. If not, see <https://www.gnu.org/licenses/>.
28  */
29 
36 // Load Dolibarr environment
37 require '../../main.inc.php';
38 require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php';
39 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
40 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
41 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
42 require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
43 
44 // Load translation files required by the page
45 $langs->loadLangs(array('expensereports', 'bills', 'banks', 'compta'));
46 
47 $action = GETPOST('action', 'alpha');
48 $massaction = GETPOST('massaction', 'alpha');
49 $optioncss = GETPOST('optioncss', 'alpha');
50 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'vendorpaymentlist';
51 
52 $socid = GETPOST('socid', 'int');
53 
54 // Security check
55 if ($user->socid) $socid = $user->socid;
56 
57 $search_ref = GETPOST('search_ref', 'alpha');
58 $search_date_startday = GETPOST('search_date_startday', 'int');
59 $search_date_startmonth = GETPOST('search_date_startmonth', 'int');
60 $search_date_startyear = GETPOST('search_date_startyear', 'int');
61 $search_date_endday = GETPOST('search_date_endday', 'int');
62 $search_date_endmonth = GETPOST('search_date_endmonth', 'int');
63 $search_date_endyear = GETPOST('search_date_endyear', 'int');
64 $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
65 $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
66 $search_user = GETPOST('search_user', 'alpha');
67 $search_payment_type = GETPOST('search_payment_type');
68 $search_cheque_num = GETPOST('search_cheque_num', 'alpha');
69 $search_bank_account = GETPOST('search_bank_account', 'int');
70 $search_amount = GETPOST('search_amount', 'alpha'); // alpha because we must be able to search on '< x'
71 
72 $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
73 $sortfield = GETPOST('sortfield', 'aZ09comma');
74 $sortorder = GETPOST('sortorder', 'aZ09comma');
75 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST('page', 'int');
76 
77 if (empty($page) || $page == -1) {
78  $page = 0; // If $page is not defined, or '' or -1
79 }
80 $offset = $limit * $page;
81 $pageprev = $page - 1;
82 $pagenext = $page + 1;
83 
84 if (!$sortorder) {
85  $sortorder = "DESC";
86 }
87 if (!$sortfield) {
88  $sortfield = "pndf.datep";
89 }
90 
91 $search_all = trim(GETPOSTISSET("search_all") ? GETPOST("search_all", 'alpha') : GETPOST('sall'));
92 
93 // List of fields to search into when doing a "search in all"
94 $fieldstosearchall = array(
95  'pndf.rowid'=>"RefPayment",
96  'u.login'=>"User",
97  'pndf.num_payment'=>"Numero",
98  'pndf.amount'=>"Amount",
99 );
100 
101 $arrayfields = array(
102  'pndf.rowid' =>array('label'=>"RefPayment", 'checked'=>1, 'position'=>10),
103  'pndf.datep' =>array('label'=>"Date", 'checked'=>1, 'position'=>20),
104  'u.login' =>array('label'=>"User", 'checked'=>1, 'position'=>30),
105  'c.libelle' =>array('label'=>"Type", 'checked'=>1, 'position'=>40),
106  'pndf.num_payment' =>array('label'=>"Numero", 'checked'=>1, 'position'=>50, 'tooltip'=>"ChequeOrTransferNumber"),
107  'ba.label' =>array('label'=>"Account", 'checked'=>1, 'position'=>60, 'enable'=>(isModEnabled("banque"))),
108  'pndf.amount' =>array('label'=>"Amount", 'checked'=>1, 'position'=>70),
109 );
110 $arrayfields = dol_sort_array($arrayfields, 'position');
111 
112 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
113 $hookmanager->initHooks(array('paymentexpensereportlist'));
114 $object = new PaymentExpenseReport($db);
115 
116 // Security check
117 if ($user->socid) {
118  $socid = $user->socid;
119 }
120 
121 // doesn't work :-(
122 // restrictedArea($user, 'fournisseur');
123 // doesn't work :-(
124 // require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
125 // $object = new PaiementFourn($db);
126 // restrictedArea($user, $object->element);
127 if (empty($user->rights->expensereport->lire)) {
128  accessforbidden();
129 }
130 
131 
132 /*
133  * Actions
134  */
135 
136 $childids = $user->getAllChildIds(1);
137 
138 $parameters = array('socid'=>$socid);
139 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
140 if ($reshook < 0) {
141  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
142 }
143 
144 if (empty($reshook)) {
145  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
146 
147  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
148  $search_ref = '';
149  $search_date_startday = '';
150  $search_date_startmonth = '';
151  $search_date_startyear = '';
152  $search_date_endday = '';
153  $search_date_endmonth = '';
154  $search_date_endyear = '';
155  $search_date_start = '';
156  $search_date_end = '';
157  $search_user = '';
158  $search_payment_type = '';
159  $search_cheque_num = '';
160  $search_bank_account = '';
161  $search_amount = '';
162  }
163 }
164 
165 /*
166  * View
167  */
168 
169 llxHeader('', $langs->trans('ListPayment'));
170 
171 $form = new Form($db);
172 $formother = new FormOther($db);
173 $accountstatic = new Account($db);
174 $userstatic = new User($db);
175 $paymentexpensereportstatic = new PaymentExpenseReport($db);
176 
177 $sql = 'SELECT pndf.rowid, pndf.rowid as ref, pndf.datep, pndf.amount as pamount, pndf.num_payment';
178 $sql .= ', u.rowid as userid, u.login, u.lastname, u.firstname';
179 $sql .= ', c.code as paiement_type, c.libelle as paiement_libelle';
180 $sql .= ', ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.fk_accountancy_journal as accountancy_journal';
181 $sql .= ', SUM(pndf.amount)';
182 $sql .= ' FROM '.MAIN_DB_PREFIX.'payment_expensereport AS pndf';
183 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'expensereport AS ndf ON ndf.rowid=pndf.fk_expensereport';
184 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON pndf.fk_typepayment = c.id';
185 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON u.rowid = ndf.fk_user_author';
186 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON pndf.fk_bank = b.rowid';
187 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
188 $sql .= ' WHERE ndf.entity IN ('.getEntity("expensereport").')';
189 
190 // RESTRICT RIGHTS
191 if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)
192  && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance))) {
193  $sql .= " AND ndf.fk_user_author IN (".$db->sanitize(join(',', $childids)).")\n";
194 }
195 
196 if ($search_ref) {
197  $sql .= natural_search('pndf.rowid', $search_ref);
198 }
199 if ($search_date_start) {
200  $sql .= " AND pndf.datep >= '" . $db->idate($search_date_start) . "'";
201 }
202 if ($search_date_end) {
203  $sql .=" AND pndf.datep <= '" . $db->idate($search_date_end) . "'";
204 }
205 
206 if ($search_user) {
207  $sql .= natural_search(array('u.login', 'u.lastname', 'u.firstname'), $search_user);
208 }
209 if ($search_payment_type != '') {
210  $sql .= " AND c.code='".$db->escape($search_payment_type)."'";
211 }
212 if ($search_cheque_num != '') {
213  $sql .= natural_search('pndf.num_payment', $search_cheque_num);
214 }
215 if ($search_amount) {
216  $sql .= natural_search('pndf.amount', $search_amount, 1);
217 }
218 if ($search_bank_account > 0) {
219  $sql .= ' AND b.fk_account = '.((int) $search_bank_account);
220 }
221 if ($search_all) {
222  $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
223 }
224 
225 // Add where from extra fields
226 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
227 
228 $sql .= ' GROUP BY pndf.rowid, pndf.datep, pndf.amount, pndf.num_payment, u.rowid, u.login, u.lastname, u.firstname, c.code, c.libelle,';
229 $sql .= ' ba.rowid, ba.ref, ba.label, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.fk_accountancy_journal';
230 
231 $sql .= $db->order($sortfield, $sortorder);
232 
233 $nbtotalofrecords = '';
234 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
235  $result = $db->query($sql);
236  $nbtotalofrecords = $db->num_rows($result);
237  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
238  $page = 0;
239  $offset = 0;
240  }
241 }
242 
243 $sql .= $db->plimit($limit + 1, $offset);
244 
245 $resql = $db->query($sql);
246 if (!$resql) {
247  dol_print_error($db);
248  llxFooter();
249  $db->close();
250  exit;
251 }
252 
253 $num = $db->num_rows($resql);
254 $i = 0;
255 
256 $param = '';
257 if (!empty($contextpage) && $contextpage != $_SERVER['PHP_SELF']) {
258  $param .= '&contextpage='.urlencode($contextpage);
259 }
260 if ($limit > 0 && $limit != $conf->liste_limit) {
261  $param .= '&limit='.urlencode($limit);
262 }
263 if ($optioncss != '') {
264  $param .= '&optioncss='.urlencode($optioncss);
265 }
266 
267 if ($search_ref) {
268  $param .= '&search_ref='.urlencode($search_ref);
269 }
270 if ($search_date_startday) {
271  $param .= '&search_date_startday='.urlencode($search_date_startday);
272 }
273 if ($search_date_startmonth) {
274  $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
275 }
276 if ($search_date_startyear) {
277  $param .= '&search_date_startyear='.urlencode($search_date_startyear);
278 }
279 if ($search_date_endday) {
280  $param .= '&search_date_endday='.urlencode($search_date_endday);
281 }
282 if ($search_date_endmonth) {
283  $param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
284 }
285 if ($search_date_endyear) {
286  $param .= '&search_date_endyear='.urlencode($search_date_endyear);
287 }
288 if ($search_user) {
289  $param .= '&search_user='.urlencode($search_user);
290 }
291 if ($search_payment_type) {
292  $param .= '&search_payment_type='.urlencode($search_payment_type);
293 }
294 if ($search_cheque_num) {
295  $param .= '&search_cheque_num='.urlencode($search_cheque_num);
296 }
297 if ($search_amount) {
298  $param .= '&search_amount='.urlencode($search_amount);
299 }
300 
301 if ($search_bank_account) {
302  $param .= '&search_bank_account='.urlencode($search_bank_account);
303 }
304 
305 // Add $param from extra fields
306 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
307 
308 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
309 if ($optioncss != '') {
310  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
311 }
312 print '<input type="hidden" name="token" value="'.newToken().'">';
313 print '<input type="hidden" name="action" value="list">';
314 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
315 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
316 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
317 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
318 
319 print_barre_liste($langs->trans('ExpenseReportPayments'), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'expensereport', 0, '', '', $limit, 0, 0, 1);
320 
321 if ($search_all) {
322  foreach ($fieldstosearchall as $key => $val) {
323  $fieldstosearchall[$key] = $langs->trans($val);
324  }
325  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
326 }
327 
328 $moreforfilter = '';
329 
330 $parameters = array();
331 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
332 if (empty($reshook)) {
333  $moreforfilter .= $hookmanager->resPrint;
334 } else {
335  $moreforfilter = $hookmanager->resPrint;
336 }
337 
338 if ($moreforfilter) {
339  print '<div class="liste_titre liste_titre_bydiv centpercent">';
340  print $moreforfilter;
341  print '</div>';
342 }
343 
344 $varpage = empty($contextpage) ? $_SERVER['PHP_SELF'] : $contextpage;
345 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
346 if (!empty($massactionbutton)) {
347  $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
348 }
349 
350 print '<div class="div-table-responsive">';
351 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : '').'">';
352 
353 print '<tr class="liste_titre_filter">';
354 
355 // Filter: Ref
356 if (!empty($arrayfields['pndf.rowid']['checked'])) {
357  print '<td class="liste_titre left">';
358  print '<input class="flat" type="text" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
359  print '</td>';
360 }
361 
362 // Filter: Date
363 if (!empty($arrayfields['pndf.datep']['checked'])) {
364  print '<td class="liste_titre center">';
365  print '<div class="nowrap">';
366  print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
367  print '</div>';
368  print '<div class="nowrap">';
369  print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
370  print '</div>';
371  print '</td>';
372 }
373 
374 // Filter: Thirdparty
375 if (!empty($arrayfields['u.login']['checked'])) {
376  print '<td class="liste_titre">';
377  print '<input class="flat" type="text" size="6" name="search_user" value="'.dol_escape_htmltag($search_user).'">';
378  print '</td>';
379 }
380 
381 // Filter: Payment type
382 if (!empty($arrayfields['c.libelle']['checked'])) {
383  print '<td class="liste_titre">';
384  $form->select_types_paiements($search_payment_type, 'search_payment_type', '', 2, 1, 1);
385  print '</td>';
386 }
387 
388 // Filter: Cheque number (fund transfer)
389 if (!empty($arrayfields['pndf.num_payment']['checked'])) {
390  print '<td class="liste_titre">';
391  print '<input class="flat" type="text" size="4" name="search_cheque_num" value="'.dol_escape_htmltag($search_cheque_num).'">';
392  print '</td>';
393 }
394 
395 // Filter: Bank account
396 if (!empty($arrayfields['ba.label']['checked'])) {
397  print '<td class="liste_titre">';
398  $form->select_comptes($search_bank_account, 'search_bank_account', 0, '', 1);
399  print '</td>';
400 }
401 
402 // Filter: Amount
403 if (!empty($arrayfields['pndf.amount']['checked'])) {
404  print '<td class="liste_titre right">';
405  print '<input class="flat" type="text" size="4" name="search_amount" value="'.dol_escape_htmltag($search_amount).'">';
406  print '</td>';
407 }
408 
409 // Fields from hook
410 $parameters = array('arrayfields'=>$arrayfields);
411 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
412 print $hookmanager->resPrint;
413 
414 // Buttons
415 print '<td class="liste_titre maxwidthsearch">';
416 print $form->showFilterAndCheckAddButtons(0);
417 print '</td>';
418 
419 print '</tr>';
420 
421 $totalarray = array();
422 $totalarray['nbfield'] = 0;
423 
424 print '<tr class="liste_titre">';
425 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
426  print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
427 }
428 if (!empty($arrayfields['pndf.rowid']['checked'])) {
429  print_liste_field_titre($arrayfields['pndf.rowid']['label'], $_SERVER["PHP_SELF"], 'pndf.rowid', '', $param, '', $sortfield, $sortorder);
430 }
431 if (!empty($arrayfields['pndf.datep']['checked'])) {
432  print_liste_field_titre($arrayfields['pndf.datep']['label'], $_SERVER["PHP_SELF"], 'pndf.datep', '', $param, '', $sortfield, $sortorder, 'center ');
433 }
434 if (!empty($arrayfields['u.login']['checked'])) {
435  print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.lastname', '', $param, '', $sortfield, $sortorder);
436 }
437 if (!empty($arrayfields['c.libelle']['checked'])) {
438  print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], 'c.libelle', '', $param, '', $sortfield, $sortorder);
439 }
440 if (!empty($arrayfields['pndf.num_payment']['checked'])) {
441  print_liste_field_titre($arrayfields['pndf.num_payment']['label'], $_SERVER["PHP_SELF"], "pndf.num_payment", '', $param, '', $sortfield, $sortorder, '', $arrayfields['pndf.num_payment']['tooltip']);
442 }
443 if (!empty($arrayfields['ba.label']['checked'])) {
444  print_liste_field_titre($arrayfields['ba.label']['label'], $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder);
445 }
446 if (!empty($arrayfields['pndf.amount']['checked'])) {
447  print_liste_field_titre($arrayfields['pndf.amount']['label'], $_SERVER["PHP_SELF"], 'pndf.amount', '', $param, '', $sortfield, $sortorder, 'right ');
448 }
449 
450 // Hook fields
451 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
452 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
453 print $hookmanager->resPrint;
454 
455 print_liste_field_titre($selectedfields, $_SERVER['PHP_SELF'], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
456 print '</tr>';
457 
458 $checkedCount = 0;
459 foreach ($arrayfields as $column) {
460  if ($column['checked']) {
461  $checkedCount++;
462  }
463 }
464 
465 // Loop on record
466 // --------------------------------------------------------------------
467 $i = 0;
468 $savnbfield = $totalarray['nbfield'];
469 $totalarray = array();
470 $totalarray['nbfield'] = 0;
471 while ($i < min($num, $limit)) {
472  $objp = $db->fetch_object($resql);
473 
474  $paymentexpensereportstatic->id = $objp->rowid;
475  $paymentexpensereportstatic->ref = $objp->ref;
476  $paymentexpensereportstatic->datepaye = $objp->datep;
477 
478  $userstatic->id = $objp->userid;
479  $userstatic->lastname = $objp->lastname;
480  $userstatic->firstname = $objp->firstname;
481 
482  print '<tr class="oddeven">';
483 
484  // No
485  if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
486  print '<td>'.(($offset * $limit) + $i).'</td>';
487  if (!$i) {
488  $totalarray['nbfield']++;
489  }
490  }
491 
492  // Ref
493  if (!empty($arrayfields['pndf.rowid']['checked'])) {
494  print '<td class="nowrap">'.$paymentexpensereportstatic->getNomUrl(1).'</td>';
495  if (!$i) {
496  $totalarray['nbfield']++;
497  }
498  }
499 
500  // Date
501  if (!empty($arrayfields['pndf.datep']['checked'])) {
502  $dateformatforpayment = 'dayhour';
503  print '<td class="nowrap center">'.dol_print_date($db->jdate($objp->datep), $dateformatforpayment).'</td>';
504  if (!$i) {
505  $totalarray['nbfield']++;
506  }
507  }
508 
509  // Thirdparty
510  if (!empty($arrayfields['u.login']['checked'])) {
511  print '<td>';
512  if ($userstatic->id > 0) {
513  print $userstatic->getNomUrl(1);
514  }
515  print '</td>';
516  if (!$i) {
517  $totalarray['nbfield']++;
518  }
519  }
520 
521  // Pyament type
522  if (!empty($arrayfields['c.libelle']['checked'])) {
523  $payment_type = $langs->trans("PaymentType".$objp->paiement_type) != ("PaymentType".$objp->paiement_type) ? $langs->trans("PaymentType".$objp->paiement_type) : $objp->paiement_libelle;
524  print '<td>'.$payment_type.' '.dol_trunc($objp->num_payment, 32).'</td>';
525  if (!$i) {
526  $totalarray['nbfield']++;
527  }
528  }
529 
530  // Cheque number (fund transfer)
531  if (!empty($arrayfields['pndf.num_payment']['checked'])) {
532  print '<td>'.$objp->num_payment.'</td>';
533  if (!$i) {
534  $totalarray['nbfield']++;
535  }
536  }
537 
538  // Bank account
539  if (!empty($arrayfields['ba.label']['checked'])) {
540  print '<td>';
541  if ($objp->bid) {
542  $accountstatic->id = $objp->bid;
543  $accountstatic->ref = $objp->bref;
544  $accountstatic->label = $objp->blabel;
545  $accountstatic->number = $objp->number;
546  $accountstatic->iban = $objp->iban_prefix;
547  $accountstatic->bic = $objp->bic;
548  $accountstatic->currency_code = $objp->currency_code;
549  $accountstatic->account_number = $objp->account_number;
550 
551  $accountingjournal = new AccountingJournal($db);
552  $accountingjournal->fetch($objp->accountancy_journal);
553  $accountstatic->accountancy_journal = $accountingjournal->code;
554 
555  print $accountstatic->getNomUrl(1);
556  } else {
557  print '&nbsp;';
558  }
559  print '</td>';
560  if (!$i) {
561  $totalarray['nbfield']++;
562  }
563  }
564 
565  // Amount
566  if (!empty($arrayfields['pndf.amount']['checked'])) {
567  print '<td class="right"><span class="amount">'.price($objp->pamount).'</span></td>';
568  if (!$i) {
569  $totalarray['nbfield']++;
570  }
571  $totalarray['pos'][$checkedCount] = 'amount';
572  if (empty($totalarray['val']['amount'])) {
573  $totalarray['val']['amount'] = $objp->pamount;
574  } else {
575  $totalarray['val']['amount'] += $objp->pamount;
576  }
577  }
578 
579  // Buttons
580  print '<td></td>';
581  if (!$i) {
582  $totalarray['nbfield']++;
583  }
584 
585  print '</tr>';
586  $i++;
587 }
588 
589 // Show total line
590 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
591 
592 print '</table>';
593 print '</div>';
594 print '</form>';
595 
596 // End of page
597 llxFooter();
598 $db->close();
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class to manage bank accounts.
Class to manage accounting accounts.
Class to manage generation of HTML components Only common components must be here.
Classe permettant la generation de composants html autre Only common components are here.
Class to manage payments of expense report.
Class to manage Dolibarr users.
Definition: user.class.php:47
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("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->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
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...
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
$nbtotalofrecords
Count total nb of records.
Definition: list.php:329
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.