dolibarr  13.0.2
list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
6  * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
7  * Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
8  * Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
9  * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
10  * Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
11  * Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program. If not, see <https://www.gnu.org/licenses/>.
25  */
26 
33 require '../../main.inc.php';
34 
35 // Security check
36 if ($user->socid) $socid = $user->socid;
37 $result = restrictedArea($user, 'facture', $facid, '');
38 
39 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
40 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
41 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
42 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
43 require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
44 
45 // Load translation files required by the page
46 $langs->loadLangs(array('bills', 'banks', 'compta', 'companies'));
47 
48 $action = GETPOST('action', 'alpha');
49 $massaction = GETPOST('massaction', 'alpha');
50 $confirm = GETPOST('confirm', 'alpha');
51 $optioncss = GETPOST('optioncss', 'alpha');
52 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'paymentlist';
53 
54 $facid = GETPOST('facid', 'int');
55 $socid = GETPOST('socid', 'int');
56 $userid = GETPOST('userid', 'int');
57 $day = GETPOST('day', 'int');
58 $month = GETPOST('month', 'int');
59 $year = GETPOST('year', 'int');
60 
61 $search_ref = GETPOST("search_ref", "alpha");
62 $search_company = GETPOST("search_company", 'alpha');
63 $search_paymenttype = GETPOST("search_paymenttype");
64 $search_account = GETPOST("search_account", "int");
65 $search_payment_num = GETPOST('search_payment_num', 'alpha');
66 $search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x"
67 
68 $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
69 $sortfield = GETPOST("sortfield", 'alpha');
70 $sortorder = GETPOST("sortorder", 'alpha');
71 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
72 
73 if (empty($page) || $page == -1) $page = 0; // If $page is not defined, or '' or -1
74 $offset = $limit * $page;
75 $pageprev = $page - 1;
76 $pagenext = $page + 1;
77 
78 if (!$sortorder) $sortorder = "DESC";
79 if (!$sortfield) $sortfield = "p.ref";
80 
81 $search_all = trim(GETPOSTISSET("search_all") ? GETPOST("search_all", 'alpha') : GETPOST('sall'));
82 
83 // List of fields to search into when doing a "search in all"
84 $fieldstosearchall = array(
85  'p.ref'=>"RefPayment",
86  's.nom'=>"ThirdParty",
87  'p.num_paiement'=>"Numero",
88  'p.amount'=>"Amount",
89 );
90 
91 $arrayfields = array(
92  'p.ref' => array('label'=>"RefPayment", 'checked'=>1, 'position'=>10),
93  'p.datep' => array('label'=>"Date", 'checked'=>1, 'position'=>20),
94  's.nom' => array('label'=>"ThirdParty", 'checked'=>1, 'position'=>30),
95  'c.libelle' => array('label'=>"Type", 'checked'=>1, 'position'=>40),
96  'transaction' => array('label'=>"BankTransactionLine", 'checked'=>1, 'position'=>50, 'enabled'=>(!empty($conf->banque->enabled))),
97  'ba.label' => array('label'=>"Account", 'checked'=>1, 'position'=>60, 'enabled'=>(!empty($conf->banque->enabled))),
98  'p.num_paiement' => array('label'=>"Numero", 'checked'=>1, 'position'=>70, 'tooltip'=>"ChequeOrTransferNumber"),
99  'p.amount' => array('label'=>"Amount", 'checked'=>1, 'position'=>80),
100  'p.statut' => array('label'=>"Status", 'checked'=>1, 'position'=>90, 'enabled'=>(!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))),
101 );
102 $arrayfields = dol_sort_array($arrayfields, 'position');
103 
104 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
105 $hookmanager->initHooks(array('paymentlist'));
106 $object = new Paiement($db);
107 
108 /*
109  * Actions
110  */
111 
112 $parameters = array('socid'=>$socid);
113 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
114 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
115 
116 
117 if (empty($reshook)) {
118  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
119 
120  // All tests are required to be compatible with all browsers
121  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
122  $search_ref = '';
123  $search_account = '';
124  $search_amount = '';
125  $search_paymenttype = '';
126  $search_payment_num = '';
127  $search_company = '';
128  $day = '';
129  $year = '';
130  $month = '';
131  $option = '';
132  $toselect = '';
133  $search_array_options = array();
134  }
135 }
136 
137 /*
138  * View
139  */
140 
141 $form = new Form($db);
142 $formother = new FormOther($db);
143 $accountstatic = new Account($db);
144 $companystatic = new Societe($db);
145 $bankline = new AccountLine($db);
146 
147 llxHeader('', $langs->trans('ListPayment'));
148 
149 if (GETPOST("orphelins", "alpha")) {
150  // Payments not linked to an invoice. Should not happend. For debug only.
151  $sql = "SELECT p.rowid, p.ref, p.datep, p.amount, p.statut, p.num_paiement";
152  $sql .= ", c.code as paiement_code";
153 
154  // Add fields from hooks
155  $parameters = array();
156  $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
157  $sql .= $hookmanager->resPrint;
158  $sql .= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
159  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
160  $sql .= " WHERE p.entity IN (".getEntity('invoice').")";
161  $sql .= " AND pf.fk_facture IS NULL";
162 
163  // Add where from hooks
164  $parameters = array();
165  $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
166  $sql .= $hookmanager->resPrint;
167 } else {
168  // DISTINCT is to avoid duplicate when there is a link to sales representatives
169  $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep, p.fk_bank, p.amount, p.statut, p.num_paiement";
170  $sql .= ", c.code as paiement_code";
171  $sql .= ", ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal";
172  $sql .= ", s.rowid as socid, s.nom as name, s.email";
173 
174  // Add fields from hooks
175  $parameters = array();
176  $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
177  $sql .= $hookmanager->resPrint;
178  $sql .= " FROM ".MAIN_DB_PREFIX."paiement as p";
179  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
180  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid";
181  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
182  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
183  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid";
184  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
185  if (!$user->rights->societe->client->voir && !$socid) {
186  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
187  }
188  $sql .= " WHERE p.entity IN (".getEntity('invoice').")";
189  if (!$user->rights->societe->client->voir && !$socid) {
190  $sql .= " AND sc.fk_user = ".$user->id;
191  }
192  if ($socid > 0) {
193  $sql .= " AND f.fk_soc = ".$socid;
194  }
195  if ($userid) {
196  if ($userid == -1) $sql .= " AND f.fk_user_author IS NULL";
197  else $sql .= " AND f.fk_user_author = ".$userid;
198  }
199 
200  // Search criteria
201  $sql .= dolSqlDateFilter("p.datep", $day, $month, $year);
202  if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
203  if ($search_account > 0) $sql .= " AND b.fk_account=".$search_account;
204  if ($search_paymenttype != '') $sql .= " AND c.code='".$db->escape($search_paymenttype)."'";
205  if ($search_payment_num != '') $sql .= natural_search('p.num_paiement', $search_payment_num);
206  if ($search_amount) $sql .= natural_search('p.amount', $search_amount, 1);
207  if ($search_company) $sql .= natural_search('s.nom', $search_company);
208 
209  if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
210 
211  // Add where from hooks
212  $parameters = array();
213  $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
214  $sql .= $hookmanager->resPrint;
215 }
216 $sql .= $db->order($sortfield, $sortorder);
217 
218 $nbtotalofrecords = '';
219 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
220  $result = $db->query($sql);
221  $nbtotalofrecords = $db->num_rows($result);
222 
223  // if total resultset is smaller then paging size (filtering), goto and load page 0
224  if (($page * $limit) > $nbtotalofrecords) {
225  $page = 0;
226  $offset = 0;
227  }
228 }
229 
230 $sql .= $db->plimit($limit + 1, $offset);
231 
232 $resql = $db->query($sql);
233 if (!$resql) {
234  dol_print_error($db);
235  llxFooter();
236  $db->close();
237  exit;
238 }
239 
240 $num = $db->num_rows($resql);
241 
242 $param = '';
243 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
244 if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
245 $param .= (GETPOST("orphelins") ? "&orphelins=1" : '');
246 $param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : '');
247 $param .= ($search_company ? "&search_company=".urlencode($search_company) : '');
248 $param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : '');
249 $param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : '');
250 if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
251 
252 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
253 if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
254 print '<input type="hidden" name="token" value="'.newToken().'">';
255 print '<input type="hidden" name="action" value="list">';
256 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
257 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
258 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
259 print '<input type="hidden" name="search_status" value="'.$search_status.'">';
260 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
261 
262 print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1);
263 
264 if ($search_all)
265 {
266  foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
267  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
268 }
269 
270 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
271 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
272 if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
273 
274 print '<div class="div-table-responsive">';
275 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : '').'">';
276 
277 print '<tr class="liste_titre_filter">';
278 
279 // Filters: Lines (placeholder)
280 print '<tr class="liste_titre_filter">';
281 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
282  print '<td class="liste_titre">';
283  print '</td>';
284 }
285 
286 // Filter: Ref
287 if (!empty($arrayfields['p.ref']['checked'])) {
288  print '<td class="liste_titre left">';
289  print '<input class="flat" type="text" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
290  print '</td>';
291 }
292 
293 // Filter: Date
294 if (!empty($arrayfields['p.datep']['checked'])) {
295  print '<td class="liste_titre center">';
296  if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="day" value="'.dol_escape_htmltag($day).'">';
297  print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="month" value="'.dol_escape_htmltag($month).'">';
298  $formother->select_year($year ? $year : -1, 'year', 1, 20, 5);
299  print '</td>';
300 }
301 
302 // Filter: Thirdparty
303 if (!empty($arrayfields['s.nom']['checked'])) {
304  print '<td class="liste_titre">';
305  print '<input class="flat" type="text" size="6" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
306  print '</td>';
307 }
308 
309 // Filter: Payment type
310 if (!empty($arrayfields['c.libelle']['checked'])) {
311  print '<td class="liste_titre">';
312  $form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1);
313  print '</td>';
314 }
315 
316 // Filter: Bank transaction number
317 if (!empty($arrayfields['transaction']['checked'])) {
318  print '<td class="liste_titre">';
319  print '<input class="flat" type="text" size="4" name="search_payment_num" value="'.dol_escape_htmltag($search_payment_num).'">';
320  print '</td>';
321 }
322 
323 // Filter: Cheque number (fund transfer)
324 if (!empty($arrayfields['p.num_paiement']['checked'])) {
325  print '<td class="liste_titre">';
326  print '</td>';
327 }
328 
329 // Filter: Bank account
330 if (!empty($arrayfields['ba.label']['checked'])) {
331  print '<td class="liste_titre">';
332  $form->select_comptes($search_account, 'search_account', 0, '', 1);
333  print '</td>';
334 }
335 
336 // Filter: Amount
337 if (!empty($arrayfields['p.amount']['checked'])) {
338  print '<td class="liste_titre right">';
339  print '<input class="flat" type="text" size="4" name="search_amount" value="'.dol_escape_htmltag($search_amount).'">';
340  print '</td>';
341 }
342 
343 // Filter: Status (only placeholder)
344 if (!empty($arrayfields['p.statut']['checked'])) {
345  print '<td class="liste_titre right">';
346  print '</td>';
347 }
348 
349 // Fields from hook
350 $parameters = array('arrayfields'=>$arrayfields);
351 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
352 print $hookmanager->resPrint;
353 
354 print '<td class="liste_titre maxwidthsearch">';
355 print $form->showFilterAndCheckAddButtons(0);
356 print '</td>';
357 
358 print "</tr>";
359 
360 print '<tr class="liste_titre">';
361 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
362 if (!empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder);
363 if (!empty($arrayfields['p.datep']['checked'])) print_liste_field_titre($arrayfields['p.datep']['label'], $_SERVER["PHP_SELF"], "p.datep", '', $param, '', $sortfield, $sortorder, 'center ');
364 if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder);
365 if (!empty($arrayfields['c.libelle']['checked'])) print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", '', $param, '', $sortfield, $sortorder);
366 if (!empty($arrayfields['p.num_paiement']['checked'])) print_liste_field_titre($arrayfields['p.num_paiement']['label'], $_SERVER["PHP_SELF"], "p.num_paiement", '', $param, '', $sortfield, $sortorder, '', $arrayfields['p.num_paiement']['tooltip']);
367 if (!empty($arrayfields['transaction']['checked'])) print_liste_field_titre($arrayfields['transaction']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
368 if (!empty($arrayfields['ba.label']['checked'])) print_liste_field_titre($arrayfields['ba.label']['label'], $_SERVER["PHP_SELF"], "ba.label", '', $param, '', $sortfield, $sortorder);
369 if (!empty($arrayfields['p.amount']['checked'])) print_liste_field_titre($arrayfields['p.amount']['label'], $_SERVER["PHP_SELF"], "p.amount", '', $param, 'class="right"', $sortfield, $sortorder);
370 if (!empty($arrayfields['p.statut']['checked'])) print_liste_field_titre($arrayfields['p.statut']['label'], $_SERVER["PHP_SELF"], "p.statut", '', $param, 'class="right"', $sortfield, $sortorder);
371 
372 // Hook fields
373 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
374 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
375 print $hookmanager->resPrint;
376 
377 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
378 print "</tr>";
379 
380 $checkedCount = 0;
381 foreach ($arrayfields as $column) {
382  if ($column['checked']) {
383  $checkedCount++;
384  }
385 }
386 
387 $i = 0;
388 $totalarray = array();
389 while ($i < min($num, $limit)) {
390  $objp = $db->fetch_object($resql);
391 
392  $object->id = $objp->rowid;
393  $object->ref = ($objp->ref ? $objp->ref : $objp->rowid);
394 
395  $companystatic->id = $objp->socid;
396  $companystatic->name = $objp->name;
397  $companystatic->email = $objp->email;
398 
399  print '<tr class="oddeven">';
400 
401  // No
402  if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
403  print '<td>'.(($offset * $limit) + $i).'</td>';
404  if (!$i) $totalarray['nbfield']++;
405  }
406 
407  // Ref
408  if (!empty($arrayfields['p.ref']['checked'])) {
409  print '<td>'.$object->getNomUrl(1).'</td>';
410  if (!$i) $totalarray['nbfield']++;
411  }
412 
413  // Date
414  if (!empty($arrayfields['p.datep']['checked'])) {
415  $dateformatforpayment = 'day';
416  if (!empty($conf->global->INVOICE_USE_HOURS_FOR_PAYMENT)) $dateformatforpayment = 'dayhour';
417  print '<td class="center">'.dol_print_date($db->jdate($objp->datep), $dateformatforpayment).'</td>';
418  if (!$i) $totalarray['nbfield']++;
419  }
420 
421  // Thirdparty
422  if (!empty($arrayfields['s.nom']['checked'])) {
423  print '<td>';
424  if ($objp->socid > 0) {
425  print $companystatic->getNomUrl(1, '', 24);
426  }
427  print '</td>';
428  if (!$i) $totalarray['nbfield']++;
429  }
430 
431  // Payment type
432  if (!empty($arrayfields['c.libelle']['checked'])) {
433  print '<td>'.$langs->trans("PaymentTypeShort".$objp->paiement_code).'</td>';
434  if (!$i) $totalarray['nbfield']++;
435  }
436 
437  // Filter: Cheque number (fund transfer)
438  if (!empty($arrayfields['p.num_paiement']['checked'])) {
439  print '<td>'.$objp->num_paiement.'</td>';
440  if (!$i) $totalarray['nbfield']++;
441  }
442 
443  // Bank transaction
444  if (!empty($arrayfields['transaction']['checked'])) {
445  $bankline->fetch($objp->fk_bank);
446  print '<td>'.$bankline->getNomUrl(1, 0).'</td>';
447  if (!$i) $totalarray['nbfield']++;
448  }
449 
450  // Bank account
451  if (!empty($arrayfields['ba.label']['checked'])) {
452  print '<td>';
453  if ($objp->bid > 0) {
454  $accountstatic->id = $objp->bid;
455  $accountstatic->ref = $objp->bref;
456  $accountstatic->label = $objp->blabel;
457  $accountstatic->number = $objp->number;
458  $accountstatic->account_number = $objp->account_number;
459 
460  $accountingjournal = new AccountingJournal($db);
461  $accountingjournal->fetch($objp->accountancy_journal);
462  $accountstatic->accountancy_journal = $accountingjournal->code;
463 
464  print $accountstatic->getNomUrl(1);
465  }
466  print '</td>';
467  if (!$i) $totalarray['nbfield']++;
468  }
469 
470  // Amount
471  if (!empty($arrayfields['p.amount']['checked'])) {
472  print '<td class="right">'.price($objp->amount).'</td>';
473  if (!$i) $totalarray['nbfield']++;
474  $totalarray['pos'][$checkedCount] = 'amount';
475  $totalarray['val']['amount'] += $objp->amount;
476  }
477 
478  // Status
479  if (!empty($arrayfields['p.statut']['checked'])) {
480  print '<td class="right">';
481  if ($objp->statut == 0) print '<a href="card.php?id='.$objp->rowid.'&amp;action=valide">';
482  print $object->LibStatut($objp->statut, 5);
483  if ($objp->statut == 0) print '</a>';
484  print '</td>';
485  if (!$i) $totalarray['nbfield']++;
486  }
487 
488  // Buttons
489  print '<td></td>';
490  if (!$i) $totalarray['nbfield']++;
491 
492  print '</tr>';
493 
494  $i++;
495 }
496 
497 // Show total line
498 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
499 
500 // If no record found
501 if ($num == 0)
502 {
503  $colspan = 1;
504  foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
505  print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
506 }
507 
508 print "</table>";
509 print "</div>";
510 print "</form>";
511 
512 // End of page
513 llxFooter();
514 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage bank transaction lines.
Class to manage bank accounts.
llxHeader()
Empty header.
Definition: wrapper.php:45
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
Class to manage generation of HTML components Only common components must be here.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Classe permettant la generation de composants html autre Only common components are here...
Class to manage payments of customer invoices.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
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...
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0)
Generate a SQL string to make a filter into a range (for second of date until last second of date) ...
Definition: date.lib.php:281
print $_SERVER["PHP_SELF"]
Edit parameters.
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
Draft customers invoices.
Definition: index.php:89
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1232
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Class to manage accounting accounts.
llxFooter()
Empty footer.
Definition: wrapper.php:59