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.'/fourn/class/paiementfourn.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('companies', '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_company = GETPOST('search_company', '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 = "p.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  'p.ref'=>"RefPayment",
96  's.nom'=>"ThirdParty",
97  'p.num_paiement'=>"Numero",
98  'p.amount'=>"Amount",
99 );
100 
101 $arrayfields = array(
102  'p.ref' =>array('label'=>"RefPayment", 'checked'=>1, 'position'=>10),
103  'p.datep' =>array('label'=>"Date", 'checked'=>1, 'position'=>20),
104  's.nom' =>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>30),
105  'c.libelle' =>array('label'=>"Type", 'checked'=>1, 'position'=>40),
106  'p.num_paiement' =>array('label'=>"Numero", 'checked'=>1, 'position'=>50, 'tooltip'=>"ChequeOrTransferNumber"),
107  'ba.label' =>array('label'=>"Account", 'checked'=>1, 'position'=>60, 'enable'=>(isModEnabled("banque"))),
108  'p.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('paymentsupplierlist'));
114 $object = new PaiementFourn($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 ((!isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD))
128  || (!isModEnabled('supplier_invoice') && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD))) {
129  accessforbidden();
130 }
131 if ((empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD))
132  || (empty($user->rights->supplier_invoice->lire) && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD))) {
133  accessforbidden();
134 }
135 
136 
137 /*
138  * Actions
139  */
140 
141 $parameters = array('socid'=>$socid);
142 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
143 if ($reshook < 0) {
144  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
145 }
146 
147 if (empty($reshook)) {
148  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
149 
150  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
151  $search_ref = '';
152  $search_date_startday = '';
153  $search_date_startmonth = '';
154  $search_date_startyear = '';
155  $search_date_endday = '';
156  $search_date_endmonth = '';
157  $search_date_endyear = '';
158  $search_date_start = '';
159  $search_date_end = '';
160  $search_company = '';
161  $search_payment_type = '';
162  $search_cheque_num = '';
163  $search_bank_account = '';
164  $search_amount = '';
165  }
166 }
167 
168 /*
169  * View
170  */
171 
172 llxHeader('', $langs->trans('ListPayment'));
173 
174 $form = new Form($db);
175 $formother = new FormOther($db);
176 $accountstatic = new Account($db);
177 $companystatic = new Societe($db);
178 $paymentfournstatic = new PaiementFourn($db);
179 
180 $sql = 'SELECT p.rowid, p.ref, p.datep, p.amount as pamount, p.num_paiement';
181 $sql .= ', s.rowid as socid, s.nom as name, s.email';
182 $sql .= ', c.code as paiement_type, c.libelle as paiement_libelle';
183 $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';
184 if (empty($user->rights->societe->client->voir)) {
185  $sql .= ', sc.fk_soc, sc.fk_user';
186 }
187 $sql .= ', SUM(pf.amount)';
188 
189 $sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn AS p';
190 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn';
191 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn AS f ON f.rowid=pf.fk_facturefourn';
192 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON p.fk_paiement = c.id';
193 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON s.rowid = f.fk_soc';
194 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
195 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
196 if (empty($user->rights->societe->client->voir)) {
197  $sql .= ', '.MAIN_DB_PREFIX.'societe_commerciaux as sc';
198 }
199 
200 $sql .= ' WHERE f.entity = '.$conf->entity;
201 if (empty($user->rights->societe->client->voir)) {
202  $sql .= ' AND s.rowid = sc.fk_soc AND sc.fk_user = '.((int) $user->id);
203 }
204 if ($socid > 0) {
205  $sql .= ' AND f.fk_soc = '.((int) $socid);
206 }
207 if ($search_ref) {
208  $sql .= natural_search('p.ref', $search_ref);
209 }
210 if ($search_date_start) {
211  $sql .= " AND p.datep >= '" . $db->idate($search_date_start) . "'";
212 }
213 if ($search_date_end) {
214  $sql .=" AND p.datep <= '" . $db->idate($search_date_end) . "'";
215 }
216 
217 if ($search_company) {
218  $sql .= natural_search('s.nom', $search_company);
219 }
220 if ($search_payment_type != '') {
221  $sql .= " AND c.code='".$db->escape($search_payment_type)."'";
222 }
223 if ($search_cheque_num != '') {
224  $sql .= natural_search('p.num_paiement', $search_cheque_num);
225 }
226 if ($search_amount) {
227  $sql .= natural_search('p.amount', $search_amount, 1);
228 }
229 if ($search_bank_account > 0) {
230  $sql .= ' AND b.fk_account = '.((int) $search_bank_account);
231 }
232 if ($search_all) {
233  $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
234 }
235 
236 // Add where from extra fields
237 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
238 
239 $sql .= ' GROUP BY p.rowid, p.ref, p.datep, p.amount, p.num_paiement, s.rowid, s.nom, s.email, c.code, c.libelle,';
240 $sql .= ' ba.rowid, ba.ref, ba.label, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.fk_accountancy_journal';
241 if (empty($user->rights->societe->client->voir)) {
242  $sql .= ', sc.fk_soc, sc.fk_user';
243 }
244 
245 $sql .= $db->order($sortfield, $sortorder);
246 
247 $nbtotalofrecords = '';
248 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
249  $result = $db->query($sql);
250  $nbtotalofrecords = $db->num_rows($result);
251  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
252  $page = 0;
253  $offset = 0;
254  }
255 }
256 
257 $sql .= $db->plimit($limit + 1, $offset);
258 
259 $resql = $db->query($sql);
260 if (!$resql) {
261  dol_print_error($db);
262  llxFooter();
263  $db->close();
264  exit;
265 }
266 
267 $num = $db->num_rows($resql);
268 $i = 0;
269 
270 $param = '';
271 if (!empty($contextpage) && $contextpage != $_SERVER['PHP_SELF']) {
272  $param .= '&contextpage='.urlencode($contextpage);
273 }
274 if ($limit > 0 && $limit != $conf->liste_limit) {
275  $param .= '&limit='.urlencode($limit);
276 }
277 if ($optioncss != '') {
278  $param .= '&optioncss='.urlencode($optioncss);
279 }
280 
281 if ($search_ref) {
282  $param .= '&search_ref='.urlencode($search_ref);
283 }
284 if ($search_date_startday) {
285  $param .= '&search_date_startday='.urlencode($search_date_startday);
286 }
287 if ($search_date_startmonth) {
288  $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
289 }
290 if ($search_date_startyear) {
291  $param .= '&search_date_startyear='.urlencode($search_date_startyear);
292 }
293 if ($search_date_endday) {
294  $param .= '&search_date_endday='.urlencode($search_date_endday);
295 }
296 if ($search_date_endmonth) {
297  $param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
298 }
299 if ($search_date_endyear) {
300  $param .= '&search_date_endyear='.urlencode($search_date_endyear);
301 }
302 if ($search_company) {
303  $param .= '&search_company='.urlencode($search_company);
304 }
305 if ($search_payment_type) {
306  $param .= '&search_company='.urlencode($search_payment_type);
307 }
308 if ($search_cheque_num) {
309  $param .= '&search_cheque_num='.urlencode($search_cheque_num);
310 }
311 if ($search_amount) {
312  $param .= '&search_amount='.urlencode($search_amount);
313 }
314 
315 // Add $param from extra fields
316 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
317 
318 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
319 if ($optioncss != '') {
320  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
321 }
322 print '<input type="hidden" name="token" value="'.newToken().'">';
323 print '<input type="hidden" name="action" value="list">';
324 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
325 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
326 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
327 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
328 
329 print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'supplier_invoice', 0, '', '', $limit, 0, 0, 1);
330 
331 if ($search_all) {
332  foreach ($fieldstosearchall as $key => $val) {
333  $fieldstosearchall[$key] = $langs->trans($val);
334  }
335  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
336 }
337 
338 $moreforfilter = '';
339 
340 $parameters = array();
341 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
342 if (empty($reshook)) {
343  $moreforfilter .= $hookmanager->resPrint;
344 } else {
345  $moreforfilter = $hookmanager->resPrint;
346 }
347 
348 if ($moreforfilter) {
349  print '<div class="liste_titre liste_titre_bydiv centpercent">';
350  print $moreforfilter;
351  print '</div>';
352 }
353 
354 $varpage = empty($contextpage) ? $_SERVER['PHP_SELF'] : $contextpage;
355 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
356 if (!empty($massactionbutton)) {
357  $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
358 }
359 
360 print '<div class="div-table-responsive">';
361 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : '').'">';
362 
363 print '<tr class="liste_titre_filter">';
364 
365 // Filter: Ref
366 if (!empty($arrayfields['p.ref']['checked'])) {
367  print '<td class="liste_titre left">';
368  print '<input class="flat" type="text" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
369  print '</td>';
370 }
371 
372 // Filter: Date
373 if (!empty($arrayfields['p.datep']['checked'])) {
374  print '<td class="liste_titre center">';
375  print '<div class="nowrap">';
376  print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
377  print '</div>';
378  print '<div class="nowrap">';
379  print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
380  print '</div>';
381  print '</td>';
382 }
383 
384 // Filter: Thirdparty
385 if (!empty($arrayfields['s.nom']['checked'])) {
386  print '<td class="liste_titre">';
387  print '<input class="flat" type="text" size="6" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
388  print '</td>';
389 }
390 
391 // Filter: Payment type
392 if (!empty($arrayfields['c.libelle']['checked'])) {
393  print '<td class="liste_titre">';
394  $form->select_types_paiements($search_payment_type, 'search_payment_type', '', 2, 1, 1);
395  print '</td>';
396 }
397 
398 // Filter: Cheque number (fund transfer)
399 if (!empty($arrayfields['p.num_paiement']['checked'])) {
400  print '<td class="liste_titre">';
401  print '<input class="flat" type="text" size="4" name="search_cheque_num" value="'.dol_escape_htmltag($search_cheque_num).'">';
402  print '</td>';
403 }
404 
405 // Filter: Bank account
406 if (!empty($arrayfields['ba.label']['checked'])) {
407  print '<td class="liste_titre">';
408  $form->select_comptes($search_bank_account, 'search_bank_account', 0, '', 1);
409  print '</td>';
410 }
411 
412 // Filter: Amount
413 if (!empty($arrayfields['p.amount']['checked'])) {
414  print '<td class="liste_titre right">';
415  print '<input class="flat" type="text" size="4" name="search_amount" value="'.dol_escape_htmltag($search_amount).'">';
416  print '</td>';
417 }
418 
419 // Fields from hook
420 $parameters = array('arrayfields'=>$arrayfields);
421 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
422 print $hookmanager->resPrint;
423 
424 // Buttons
425 print '<td class="liste_titre maxwidthsearch">';
426 print $form->showFilterAndCheckAddButtons(0);
427 print '</td>';
428 
429 print '</tr>';
430 
431 print '<tr class="liste_titre">';
432 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
433  print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
434 }
435 if (!empty($arrayfields['p.ref']['checked'])) {
436  print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.rowid', '', $param, '', $sortfield, $sortorder);
437 }
438 if (!empty($arrayfields['p.datep']['checked'])) {
439  print_liste_field_titre($arrayfields['p.datep']['label'], $_SERVER["PHP_SELF"], 'p.datep', '', $param, '', $sortfield, $sortorder, 'center ');
440 }
441 if (!empty($arrayfields['s.nom']['checked'])) {
442  print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder);
443 }
444 if (!empty($arrayfields['c.libelle']['checked'])) {
445  print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], 'c.libelle', '', $param, '', $sortfield, $sortorder);
446 }
447 if (!empty($arrayfields['p.num_paiement']['checked'])) {
448  print_liste_field_titre($arrayfields['p.num_paiement']['label'], $_SERVER["PHP_SELF"], "p.num_paiement", '', $param, '', $sortfield, $sortorder, '', $arrayfields['p.num_paiement']['tooltip']);
449 }
450 if (!empty($arrayfields['ba.label']['checked'])) {
451  print_liste_field_titre($arrayfields['ba.label']['label'], $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder);
452 }
453 if (!empty($arrayfields['p.amount']['checked'])) {
454  print_liste_field_titre($arrayfields['p.amount']['label'], $_SERVER["PHP_SELF"], 'p.amount', '', $param, '', $sortfield, $sortorder, 'right ');
455 }
456 
457 // Hook fields
458 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
459 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
460 print $hookmanager->resPrint;
461 
462 print_liste_field_titre($selectedfields, $_SERVER['PHP_SELF'], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
463 print '</tr>';
464 
465 $checkedCount = 0;
466 foreach ($arrayfields as $column) {
467  if ($column['checked']) {
468  $checkedCount++;
469  }
470 }
471 
472 $i = 0;
473 $totalarray = array();
474 while ($i < min($num, $limit)) {
475  $objp = $db->fetch_object($resql);
476 
477  $paymentfournstatic->id = $objp->rowid;
478  $paymentfournstatic->ref = $objp->ref;
479  $paymentfournstatic->datepaye = $objp->datep;
480 
481  $companystatic->id = $objp->socid;
482  $companystatic->name = $objp->name;
483  $companystatic->email = $objp->email;
484 
485  print '<tr class="oddeven">';
486 
487  // No
488  if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
489  print '<td class="nowraponall">'.(($offset * $limit) + $i).'</td>';
490  if (!$i) {
491  $totalarray['nbfield']++;
492  }
493  }
494 
495  // Ref
496  if (!empty($arrayfields['p.ref']['checked'])) {
497  print '<td class="nowraponall">'.$paymentfournstatic->getNomUrl(1).'</td>';
498  if (!$i) {
499  $totalarray['nbfield']++;
500  }
501  }
502 
503  // Date
504  if (!empty($arrayfields['p.datep']['checked'])) {
505  $dateformatforpayment = 'dayhour';
506  print '<td class="nowrap center">'.dol_print_date($db->jdate($objp->datep), $dateformatforpayment).'</td>';
507  if (!$i) {
508  $totalarray['nbfield']++;
509  }
510  }
511 
512  // Thirdparty
513  if (!empty($arrayfields['s.nom']['checked'])) {
514  print '<td class="tdoverflowmax125">';
515  if ($objp->socid > 0) {
516  print $companystatic->getNomUrl(1, '', 24);
517  }
518  print '</td>';
519  if (!$i) {
520  $totalarray['nbfield']++;
521  }
522  }
523 
524  // Pyament type
525  if (!empty($arrayfields['c.libelle']['checked'])) {
526  $payment_type = $langs->trans("PaymentType".$objp->paiement_type) != ("PaymentType".$objp->paiement_type) ? $langs->trans("PaymentType".$objp->paiement_type) : $objp->paiement_libelle;
527  print '<td>'.$payment_type.' '.dol_trunc($objp->num_paiement, 32).'</td>';
528  if (!$i) {
529  $totalarray['nbfield']++;
530  }
531  }
532 
533  // Cheque number (fund transfer)
534  if (!empty($arrayfields['p.num_paiement']['checked'])) {
535  print '<td>'.$objp->num_paiement.'</td>';
536  if (!$i) {
537  $totalarray['nbfield']++;
538  }
539  }
540 
541  // Bank account
542  if (!empty($arrayfields['ba.label']['checked'])) {
543  print '<td class="tdoverflowmax125">';
544  if ($objp->bid) {
545  $accountstatic->id = $objp->bid;
546  $accountstatic->ref = $objp->bref;
547  $accountstatic->label = $objp->blabel;
548  $accountstatic->number = $objp->number;
549  $accountstatic->iban = $objp->iban_prefix;
550  $accountstatic->bic = $objp->bic;
551  $accountstatic->currency_code = $objp->currency_code;
552  $accountstatic->account_number = $objp->account_number;
553 
554  $accountingjournal = new AccountingJournal($db);
555  $accountingjournal->fetch($objp->accountancy_journal);
556  $accountstatic->accountancy_journal = $accountingjournal->code;
557 
558  print $accountstatic->getNomUrl(1);
559  } else {
560  print '&nbsp;';
561  }
562  print '</td>';
563  if (!$i) {
564  $totalarray['nbfield']++;
565  }
566  }
567 
568  // Amount
569  if (!empty($arrayfields['p.amount']['checked'])) {
570  print '<td class="right"><span class="amount">'.price($objp->pamount).'</span></td>';
571  if (!$i) {
572  $totalarray['nbfield']++;
573  }
574  $totalarray['pos'][$checkedCount] = 'amount';
575  $totalarray['val']['amount'] += $objp->pamount;
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();
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 for supplier invoices.
Class to manage third parties objects (customers, suppliers, prospects...)
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.