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