dolibarr  9.0.0
list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2015 Jean-Fran├žois Ferry <jfefe@aternatik.fr>
6  * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
28 require '../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
33 if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
34 if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
35 
36 // Load translation files required by the page
37 $langs->loadLangs(array('banks', 'categories', 'accountancy', 'compta'));
38 
39 $action=GETPOST('action','alpha');
40 $massaction=GETPOST('massaction','alpha');
41 $show_files=GETPOST('show_files','int');
42 $confirm=GETPOST('confirm','alpha');
43 $toselect = GETPOST('toselect', 'array');
44 $contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'bankaccountlist'; // To manage different context of search
45 
46 $search_ref=GETPOST('search_ref','alpha');
47 $search_label=GETPOST('search_label','alpha');
48 $search_number=GETPOST('search_number','alpha');
49 $search_status=GETPOST('search_status')?GETPOST('search_status', 'alpha'):'opened'; // 'all' or ''='opened'
50 $optioncss = GETPOST('optioncss','alpha');
51 
52 // Security check
53 if ($user->societe_id) $socid=$user->societe_id;
54 if (! empty($user->rights->accounting->chartofaccount)) $allowed=1; // Dictionary with list of banks accounting account allowed to manager of chart account
55 if (! $allowed) $result=restrictedArea($user,'banque');
56 
57 $diroutputmassaction=$conf->bank->dir_output . '/temp/massgeneration/'.$user->id;
58 
59 $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
60 $sortfield = GETPOST("sortfield",'alpha');
61 $sortorder = GETPOST("sortorder",'alpha');
62 $page = GETPOST("page",'int');
63 if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
64 $offset = $limit * $page;
65 $pageprev = $page - 1;
66 $pagenext = $page + 1;
67 if (! $sortfield) $sortfield='b.label';
68 if (! $sortorder) $sortorder='ASC';
69 
70 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
71 $object = new Account($db);
72 $hookmanager->initHooks(array('bankaccountlist'));
73 $extrafields = new ExtraFields($db);
74 
75 // fetch optionals attributes and labels
76 $extralabels = $extrafields->fetch_name_optionals_label('bank_account');
77 $search_array_options=$extrafields->getOptionalsFromPost($object->table_element,'','search_');
78 
79 // List of fields to search into when doing a "search in all"
80 $fieldstosearchall = array(
81  'b.ref'=>'Ref',
82  'b.label'=>'Label',
83 );
84 
85 $checkedtypetiers=0;
86 $arrayfields=array(
87  'b.ref'=>array('label'=>$langs->trans("BankAccounts"), 'checked'=>1),
88  'accountype'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
89  'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
90  'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1),
91  'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>(! empty($conf->accounting->enabled) || ! empty($conf->accounting->enabled))),
92  'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>(! empty($conf->accounting->enabled) || ! empty($conf->accounting->enabled))),
93  'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1),
94  'b.currency_code'=>array('label'=>$langs->trans("Currency"), 'checked'=>0),
95  'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
96  'b.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
97  'b.clos'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
98  'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1010),
99 );
100 // Extra fields
101 if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
102 {
103  foreach($extrafields->attribute_label as $key => $val)
104  {
105  if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
106  }
107 }
108 
109 
110 /*
111  * Actions
112  */
113 
114 if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
115 if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
116 
117 $parameters=array('socid'=>$socid);
118 $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
119 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
120 
121 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
122 
123 // Purge search criteria
124 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
125 {
126  $search_ref='';
127  $search_label='';
128  $search_number='';
129  $search_status='';
130 }
131 
132 
133 
134 /*
135  * View
136  */
137 
138 $form=new Form($db);
139 
140 $title=$langs->trans('BankAccounts');
141 
142 // Load array of financial accounts (opened by default)
143 $accounts = array();
144 
145 $sql = "SELECT b.rowid, b.label, b.courant, b.rappro, b.account_number, b.fk_accountancy_journal, b.currency_code, b.datec as date_creation, b.tms as date_update";
146 // Add fields from extrafields
147 foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
148 // Add fields from hooks
149 $parameters=array();
150 $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
151 $sql.=$hookmanager->resPrint;
152 $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as b";
153 if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account_extrafields as ef on (b.rowid = ef.fk_object)";
154 $sql.= " WHERE b.entity IN (".getEntity('bank_account').")";
155 if ($search_status == 'opened') $sql.= " AND clos = 0";
156 if ($search_status == 'closed') $sql.= " AND clos = 1";
157 if ($search_ref != '') $sql.=natural_search('b.ref', $search_ref);
158 if ($search_label != '') $sql.=natural_search('b.label', $search_label);
159 if ($search_number != '') $sql.=natural_search('b.number', $search_number);
160 // Add where from extra fields
161 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
162 // Add where from hooks
163 $parameters=array();
164 $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
165 $sql.=$hookmanager->resPrint;
166 
167 $sql.= $db->order($sortfield,$sortorder);
168 
169 // Count total nb of records
170 $nbtotalofrecords = '';
171 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
172 {
173  $result = $db->query($sql);
174  $nbtotalofrecords = $db->num_rows($result);
175 }
176 
177 $sql.= $db->plimit($limit + 1,$offset);
178 
179 $resql = $db->query($sql);
180 if ($resql)
181 {
182  $num = $db->num_rows($resql);
183  $i = 0;
184  while ($i < $num)
185  {
186  $objp = $db->fetch_object($resql);
187  $accounts[$objp->rowid] = $objp->courant;
188  $i++;
189  }
190  $db->free($resql);
191 }
192 else dol_print_error($db);
193 
194 
195 
196 $help_url='EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:M&oacute;dulo_Bancos_y_Cajas';
197 llxHeader('',$title,$help_url);
198 
199 $link='';
200 
201 
202 $num_rows = count($accounts);
203 
204 $arrayofselected=is_array($toselect)?$toselect:array();
205 
206 $param='';
207 if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
208 if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
209 if ($search_ref != '') $param.='&search_ref='.$search_ref;
210 if ($search_label != '') $param.='&search_label='.$search_label;
211 if ($search_number != '') $param.='&search_number='.$search_number;
212 if ($search_status != '') $param.='&search_status='.$search_status;
213 if ($show_files) $param.='&show_files=' .$show_files;
214 if ($optioncss != '') $param.='&optioncss='.$optioncss;
215 // Add $param from extra fields
216 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
217 
218 // List of mass actions available
219 $arrayofmassactions = array(
220 // 'presend'=>$langs->trans("SendByMail"),
221 // 'builddoc'=>$langs->trans("PDFMerge"),
222 );
223 if ($user->rights->banque->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
224 if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
225 $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
226 
227 $newcardbutton='';
228 if ($user->rights->banque->configurer)
229 {
230  $newcardbutton.='<a class="butActionNew" href="card.php?action=create"><span class="valignmiddle">'.$langs->trans("NewFinancialAccount").'</span>';
231  $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
232  $newcardbutton.= '</a>';
233 }
234 
235 
236 // Lines of title fields
237 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
238 if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
239 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
240 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
241 print '<input type="hidden" name="action" value="list">';
242 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
243 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
244 print '<input type="hidden" name="page" value="'.$page.'">';
245 print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
246 
247 print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_bank.png',0,$newcardbutton,'',$limit, 1);
248 
249 $topicmail="Information";
250 //$modelmail="subscription";
251 $objecttmp=new Account($db);
252 //$trackid='sub'.$object->id;
253 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
254 
255 if ($sall)
256 {
257  foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
258  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
259 }
260 
261 $moreforfilter='';
262 
263 
264 // Bank accounts
265 $parameters=array();
266 $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
267 if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
268 else $moreforfilter = $hookmanager->resPrint;
269 
270 if (! empty($moreforfilter))
271 {
272  print '<div class="liste_titre liste_titre_bydiv centpercent">';
273  print $moreforfilter;
274  print '</div>';
275 }
276 
277 $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
278 $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
279 
280 print '<div class="div-table-responsive">';
281 print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
282 
283 print '<tr class="liste_titre_filter">';
284 
285 // Ref
286 if (! empty($arrayfields['b.ref']['checked']))
287 {
288  print '<td class="liste_titre">';
289  print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
290  print '</td>';
291 }
292 // Label
293 if (! empty($arrayfields['b.label']['checked']))
294 {
295  print '<td class="liste_titre">';
296  print '<input class="flat" size="6" type="text" name="search_label" value="'.$search_label.'">';
297  print '</td>';
298 }
299 // Account type
300 if (! empty($arrayfields['accountype']['checked']))
301 {
302  print '<td class="liste_titre">';
303  print '</td>';
304 }
305 // Bank number
306 if (! empty($arrayfields['b.number']['checked']))
307 {
308  print '<td class="liste_titre">';
309  print '<input class="flat" size="6" type="text" name="search_number" value="'.$search_number.'">';
310  print '</td>';
311 }
312 // Account number
313 if (! empty($arrayfields['b.account_number']['checked']))
314 {
315  print '<td class="liste_titre">';
316  print '</td>';
317 }
318 // Accountancy journal
319 if (! empty($arrayfields['b.fk_accountancy_journal']['checked']))
320 {
321  print '<td class="liste_titre">';
322  print '</td>';
323 }
324 // Transactions to reconcile
325 if (! empty($arrayfields['toreconcile']['checked']))
326 {
327  print '<td class="liste_titre">';
328  print '</td>';
329 }
330 // Currency
331 if (! empty($arrayfields['b.currency_code']['checked']))
332 {
333  print '<td class="liste_titre">';
334  print '</td>';
335 }
336 // Extra fields
337 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
338 
339 // Fields from hook
340 $parameters=array('arrayfields'=>$arrayfields);
341 $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
342 print $hookmanager->resPrint;
343 // Date creation
344 if (! empty($arrayfields['b.datec']['checked']))
345 {
346  print '<td class="liste_titre">';
347  print '</td>';
348 }
349 // Date modification
350 if (! empty($arrayfields['b.tms']['checked']))
351 {
352  print '<td class="liste_titre">';
353  print '</td>';
354 }
355 // Status
356 if (! empty($arrayfields['b.clos']['checked']))
357 {
358  print '<td class="liste_titre center">';
359  $array=array(
360  'opened'=>$langs->trans("Opened"),
361  'closed'=>$langs->trans("Closed")
362  );
363  print $form->selectarray("search_status", $array, $search_status, 1);
364  print '</td>';
365 }
366 // Balance
367 if (! empty($arrayfields['balance']['checked']))
368 {
369  print '<td class="liste_titre"></td>';
370 }
371 // Action column
372 print '<td class="liste_titre" align="middle">';
373 $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
374 print $searchpicto;
375 print '</td>';
376 print '</tr>';
377 
378 // Fields title
379 print '<tr class="liste_titre">';
380 if (! empty($arrayfields['b.ref']['checked'])) print_liste_field_titre($arrayfields['b.ref']['label'],$_SERVER["PHP_SELF"],'b.ref','',$param,'',$sortfield,$sortorder);
381 if (! empty($arrayfields['b.label']['checked'])) print_liste_field_titre($arrayfields['b.label']['label'],$_SERVER["PHP_SELF"],'b.label','',$param,'',$sortfield,$sortorder);
382 if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titre($arrayfields['accountype']['label'],$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder);
383 if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'],$_SERVER["PHP_SELF"],'b.number','',$param,'',$sortfield,$sortorder);
384 if (! empty($arrayfields['b.account_number']['checked'])) print_liste_field_titre($arrayfields['b.account_number']['label'],$_SERVER["PHP_SELF"],'b.account_number','',$param,'',$sortfield,$sortorder);
385 if (! empty($arrayfields['b.fk_accountancy_journal']['checked'])) print_liste_field_titre($arrayfields['b.fk_accountancy_journal']['label'],$_SERVER["PHP_SELF"],'b.fk_accountancy_journal','',$param,'',$sortfield,$sortorder);
386 if (! empty($arrayfields['b.currency_code']['checked'])) print_liste_field_titre($arrayfields['b.currency_code']['label'],$_SERVER["PHP_SELF"],'b.currency_code','',$param,'align="center"',$sortfield,$sortorder);
387 if (! empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder);
388 // Extra fields
389 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
390 // Hook fields
391 $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
392 $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
393 print $hookmanager->resPrint;
394 if (! empty($arrayfields['b.datec']['checked'])) print_liste_field_titre($arrayfields['b.datec']['label'],$_SERVER["PHP_SELF"],"b.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
395 if (! empty($arrayfields['b.tms']['checked'])) print_liste_field_titre($arrayfields['b.tms']['label'],$_SERVER["PHP_SELF"],"b.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
396 if (! empty($arrayfields['b.clos']['checked'])) print_liste_field_titre($arrayfields['b.clos']['label'],$_SERVER["PHP_SELF"],'b.clos','',$param,'align="center"',$sortfield,$sortorder);
397 if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder);
398 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
399 print "</tr>\n";
400 
401 
402 $total = array(); $found = 0; $i=0; $lastcurrencycode='';
403 
404 foreach ($accounts as $key=>$type)
405 {
406  if ($i >= $limit) break;
407 
408  $found++;
409 
410  $obj = new Account($db);
411  $obj->fetch($key);
412 
413  $solde = $obj->solde(1);
414 
415  if (! empty($lastcurrencycode) && $lastcurrencycode != $obj->currency_code)
416  {
417  $lastcurrencycode='various'; // We found several different currencies
418  }
419  if ($lastcurrencycode != 'various')
420  {
421  $lastcurrencycode=$obj->currency_code;
422  }
423 
424  print '<tr class="oddeven">';
425 
426  // Ref
427  if (! empty($arrayfields['b.ref']['checked']))
428  {
429  print '<td class="nowrap">'.$obj->getNomUrl(1).'</td>';
430  if (! $i) $totalarray['nbfield']++;
431  }
432 
433  // Label
434  if (! empty($arrayfields['b.label']['checked']))
435  {
436  print '<td>'.$obj->label.'</td>';
437  if (! $i) $totalarray['nbfield']++;
438  }
439 
440  // Account type
441  if (! empty($arrayfields['accountype']['checked']))
442  {
443  print '<td>';
444  print $obj->type_lib[$obj->type];
445  print '</td>';
446  if (! $i) $totalarray['nbfield']++;
447  }
448 
449  // Number
450  if (! empty($arrayfields['b.number']['checked']))
451  {
452  print '<td>'.$obj->number.'</td>';
453  if (! $i) $totalarray['nbfield']++;
454  }
455 
456  // Account number
457  if (! empty($arrayfields['b.account_number']['checked']))
458  {
459  print '<td>';
460  if (! empty($conf->accounting->enabled))
461  {
462  $accountingaccount = new AccountingAccount($db);
463  $accountingaccount->fetch('',$obj->account_number, 1);
464  print $accountingaccount->getNomUrl(0,1,1,'',1);
465  }
466  else
467  {
468  print $obj->account_number;
469  }
470  print '</td>';
471  if (! $i) $totalarray['nbfield']++;
472  }
473 
474  // Accountancy journal
475  if (! empty($arrayfields['b.fk_accountancy_journal']['checked']))
476  {
477  print '<td>';
478  if (! empty($conf->accounting->enabled))
479  {
480  $accountingjournal = new AccountingJournal($db);
481  $accountingjournal->fetch($obj->fk_accountancy_journal);
482  print $accountingjournal->getNomUrl(0,1,1,'',1);
483  }
484  else
485  {
486  print '';
487  }
488  print '</td>';
489  if (! $i) $totalarray['nbfield']++;
490  }
491 
492  // Currency
493  if (! empty($arrayfields['b.currency_code']['checked']))
494  {
495  print '<td align="center">';
496  print $obj->currency_code;
497  print '</td>';
498  if (! $i) $totalarray['nbfield']++;
499  }
500 
501  // Transactions to reconcile
502  if (! empty($arrayfields['toreconcile']['checked']))
503  {
504  print '<td align="center">';
505  if ($obj->rappro)
506  {
507  $result=$obj->load_board($user,$obj->id);
508  if ($result<0) {
509  setEventMessages($obj->error, $obj->errors, 'errors');
510  } else {
511  print $result->nbtodo;
512  if ($result->nbtodolate) print ' &nbsp; ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
513  }
514  }
515  else print $langs->trans("FeatureDisabled");
516  print '</td>';
517  if (! $i) $totalarray['nbfield']++;
518  }
519 
520  // Extra fields
521  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
522  // Fields from hook
523  $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
524  $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
525  print $hookmanager->resPrint;
526  // Date creation
527  if (! empty($arrayfields['b.datec']['checked']))
528  {
529  print '<td align="center">';
530  print dol_print_date($obj->date_creation, 'dayhour');
531  print '</td>';
532  if (! $i) $totalarray['nbfield']++;
533  }
534  // Date modification
535  if (! empty($arrayfields['b.tms']['checked']))
536  {
537  print '<td align="center">';
538  print dol_print_date($obj->date_update, 'dayhour');
539  print '</td>';
540  if (! $i) $totalarray['nbfield']++;
541  }
542 
543  // Status
544  if (! empty($arrayfields['b.clos']['checked']))
545  {
546  print '<td align="center">'.$obj->getLibStatut(5).'</td>';
547  if (! $i) $totalarray['nbfield']++;
548  }
549 
550  // Balance
551  if (! empty($arrayfields['balance']['checked']))
552  {
553  print '<td align="right" class="nowraponall">';
554  print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$obj->id.'">'.price($solde, 0, $langs, 0, -1, -1, $obj->currency_code).'</a>';
555  print '</td>';
556  if (! $i) $totalarray['nbfield']++;
557  if (! $i) $totalarray['totalbalancefield']=$totalarray['nbfield'];
558  $totalarray['totalbalance'] += $solde;
559  }
560 
561  // Action column
562  print '<td class="nowrap" align="center">';
563  if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
564  {
565  $selected=0;
566  if (in_array($obj->rowid, $arrayofselected)) $selected=1;
567  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
568  }
569  print '</td>';
570  if (! $i) $totalarray['nbfield']++;
571 
572  print '</tr>';
573 
574  $total[$obj->currency_code] += $solde;
575 
576  $i++;
577 }
578 
579 if (! $found) print '<tr class="oddeven"><td colspan="'.$totalarray['nbfield'].'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
580 
581 // Show total line
582 if (isset($totalarray['totalbalancefield']) && $lastcurrencycode != 'various') // If there is several currency, $lastcurrencycode is set to 'various' before
583 {
584  print '<tr class="liste_total">';
585  $i=0;
586  while ($i < $totalarray['nbfield'])
587  {
588  $i++;
589  if ($i == 1)
590  {
591  if ($num < $limit && empty($offset)) print '<td align="left">'.$langs->trans("Total").'</td>';
592  else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
593  }
594  elseif ($totalarray['totalbalancefield'] == $i) print '<td align="right">'.price($totalarray['totalbalance'], 0, $langs, 0, 0, -1, $lastcurrencycode).'</td>';
595  else print '<td></td>';
596  }
597  print '</tr>';
598 }
599 
600 print '</table>';
601 print "</div>";
602 
603 print "</form>";
604 
605 // End of page
606 llxFooter();
607 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:56
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) if(! empty($conf->don->enabled) && $user->rights->societe->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) && $user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1053
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
Class to manage bank accounts.
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='title_generic.png', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0)
Print a title with navigation controls for pagination.
llxHeader()
Empty header.
Definition: wrapper.php:44
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...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
dol_print_date($time, $format='', $tzoutput='tzserver', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="")
Show title line of an array.
Class to manage accounting accounts.
Class to manage accounting accounts.