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