dolibarr  7.0.0-beta
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@capnetworks.com>
5  * Copyright (C) 2015 Jean-Fran├žois Ferry <jfefe@aternatik.fr>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
27 require('../../main.inc.php');
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
32 if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
33 if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
34 
35 $langs->load("banks");
36 $langs->load("categories");
37 $langs->load("accountancy");
38 $langs->load("compta");
39 
40 $action=GETPOST('action','alpha');
41 $massaction=GETPOST('massaction','alpha');
42 $show_files=GETPOST('show_files','int');
43 $confirm=GETPOST('confirm','alpha');
44 $toselect = GETPOST('toselect', 'array');
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 $result=restrictedArea($user,'banque');
55 
56 $diroutputmassaction=$conf->bank->dir_output . '/temp/massgeneration/'.$user->id;
57 
58 $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
59 $sortfield = GETPOST("sortfield",'alpha');
60 $sortorder = GETPOST("sortorder",'alpha');
61 $page = GETPOST("page",'int');
62 if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
63 $offset = $limit * $page;
64 $pageprev = $page - 1;
65 $pagenext = $page + 1;
66 if (! $sortfield) $sortfield='b.label';
67 if (! $sortorder) $sortorder='ASC';
68 
69 // Initialize technical object to manage context to save list fields
70 $contextpage='bankaccountlist';
71 
72 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
73 $hookmanager->initHooks(array($contextpage));
74 $extrafields = new ExtraFields($db);
75 
76 // fetch optionals attributes and labels
77 $extralabels = $extrafields->fetch_name_optionals_label('bank_account');
78 $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
79 
80 // List of fields to search into when doing a "search in all"
81 $fieldstosearchall = array(
82  'b.ref'=>'Ref',
83  'b.label'=>'Label',
84 );
85 
86 $checkedtypetiers=0;
87 $arrayfields=array(
88  'b.ref'=>array('label'=>$langs->trans("BankAccounts"), 'checked'=>1),
89  'accountype'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
90  'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
91  'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1),
92  'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>$conf->accountancy->enabled),
93  'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>$conf->accountancy->enabled),
94  'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1),
95  'b.currency_code'=>array('label'=>$langs->trans("Currency"), 'checked'=>0),
96  'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
97  'b.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
98  'b.clos'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
99  'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1010),
100 );
101 // Extra fields
102 if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
103 {
104  foreach($extrafields->attribute_label as $key => $val)
105  {
106  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]));
107  }
108 }
109 
110 
111 /*
112  * Actions
113  */
114 
115 if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
116 if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
117 
118 $parameters=array('socid'=>$socid);
119 $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
120 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
121 
122 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
123 
124 // Purge search criteria
125 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
126 {
127  $search_ref='';
128  $search_label='';
129  $search_number='';
130  $search_status='';
131 }
132 
133 
134 
135 /*
136  * View
137  */
138 
139 $form=new Form($db);
140 
141 $title=$langs->trans('BankAccounts');
142 
143 // Load array of financial accounts (opened by default)
144 $accounts = array();
145 
146 $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";
147 // Add fields from extrafields
148 foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
149 // Add fields from hooks
150 $parameters=array();
151 $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
152 $sql.=$hookmanager->resPrint;
153 $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as b";
154 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)";
155 $sql.= " WHERE b.entity IN (".getEntity('bank_account').")";
156 if ($search_status == 'opened') $sql.= " AND clos = 0";
157 if ($search_status == 'closed') $sql.= " AND clos = 1";
158 if ($search_ref != '') $sql.=natural_search('b.ref', $search_ref);
159 if ($search_label != '') $sql.=natural_search('b.label', $search_label);
160 if ($search_number != '') $sql.=natural_search('b.number', $search_number);
161 // Add where from extra fields
162 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
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 
168 $sql.= $db->order($sortfield,$sortorder);
169 
170 // Count total nb of records
171 $nbtotalofrecords = '';
172 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
173 {
174  $result = $db->query($sql);
175  $nbtotalofrecords = $db->num_rows($result);
176 }
177 
178 $sql.= $db->plimit($limit + 1,$offset);
179 
180 $resql = $db->query($sql);
181 if ($resql)
182 {
183  $num = $db->num_rows($resql);
184  $i = 0;
185  while ($i < $num)
186  {
187  $objp = $db->fetch_object($resql);
188  $accounts[$objp->rowid] = $objp->courant;
189  $i++;
190  }
191  $db->free($resql);
192 }
193 else dol_print_error($db);
194 
195 
196 
197 $help_url='EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:M&oacute;dulo_Bancos_y_Cajas';
198 llxHeader('',$title,$help_url);
199 
200 $link='';
201 
202 
203 $num_rows = count($accounts);
204 
205 $arrayofselected=is_array($toselect)?$toselect:array();
206 
207 $param='';
208 if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
209 if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
210 if ($search_ref != '') $param.='&search_ref='.$search_ref;
211 if ($search_label != '') $param.='&search_label='.$search_label;
212 if ($search_number != '') $param.='&search_number='.$search_number;
213 if ($search_status != '') $param.='&search_status='.$search_status;
214 if ($show_files) $param.='&show_files=' .$show_files;
215 if ($optioncss != '') $param.='&optioncss='.$optioncss;
216 // Add $param from extra fields
217 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
218 
219 // List of mass actions available
220 $arrayofmassactions = array(
221 // 'presend'=>$langs->trans("SendByMail"),
222 // 'builddoc'=>$langs->trans("PDFMerge"),
223 );
224 if ($user->rights->banque->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
225 if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
226 $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
227 
228 $newcardbutton='';
229 if ($user->rights->banque->configurer)
230 {
231  $newcardbutton.='<a class="butAction" href="card.php?action=create">'.$langs->trans("NewFinancialAccount").'</a>';
232 }
233 
234 
235 // Lines of title fields
236 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
237 if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
238 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
239 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
240 print '<input type="hidden" name="action" value="list">';
241 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
242 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
243 print '<input type="hidden" name="page" value="'.$page.'">';
244 print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
245 
246 print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_bank.png',0,$newcardbutton,'',$limit, 1);
247 
248 $topicmail="Information";
249 //$modelmail="subscription";
250 $objecttmp=new Account($db);
251 //$trackid='sub'.$object->id;
252 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
253 
254 if ($sall)
255 {
256  foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
257  print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
258 }
259 
260 $moreforfilter='';
261 
262 
263 // Bank accounts
264 $parameters=array();
265 $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
266 if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
267 else $moreforfilter = $hookmanager->resPrint;
268 
269 if (! empty($moreforfilter))
270 {
271  print '<div class="liste_titre liste_titre_bydiv centpercent">';
272  print $moreforfilter;
273  print '</div>';
274 }
275 
276 $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
277 $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
278 
279 print '<div class="div-table-responsive">';
280 print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
281 
282 print '<tr class="liste_titre_filter">';
283 
284 // Ref
285 if (! empty($arrayfields['b.ref']['checked']))
286 {
287  print '<td class="liste_titre">';
288  print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
289  print '</td>';
290 }
291 // Label
292 if (! empty($arrayfields['b.label']['checked']))
293 {
294  print '<td class="liste_titre">';
295  print '<input class="flat" size="6" type="text" name="search_label" value="'.$search_label.'">';
296  print '</td>';
297 }
298 // Account type
299 if (! empty($arrayfields['accountype']['checked']))
300 {
301  print '<td class="liste_titre">';
302  print '</td>';
303 }
304 // Bank number
305 if (! empty($arrayfields['b.number']['checked']))
306 {
307  print '<td class="liste_titre">';
308  print '<input class="flat" size="6" type="text" name="search_number" value="'.$search_number.'">';
309  print '</td>';
310 }
311 // Account number
312 if (! empty($arrayfields['b.account_number']['checked']))
313 {
314  print '<td class="liste_titre">';
315  print '</td>';
316 }
317 // Accountancy journal
318 if (! empty($arrayfields['b.fk_accountancy_journal']['checked']))
319 {
320  print '<td class="liste_titre">';
321  print '</td>';
322 }
323 // Transactions to reconcile
324 if (! empty($arrayfields['toreconcile']['checked']))
325 {
326  print '<td class="liste_titre">';
327  print '</td>';
328 }
329 // Currency
330 if (! empty($arrayfields['b.currency_code']['checked']))
331 {
332  print '<td class="liste_titre">';
333  print '</td>';
334 }
335 // Extra fields
336 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
337 
338 // Fields from hook
339 $parameters=array('arrayfields'=>$arrayfields);
340 $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
341 print $hookmanager->resPrint;
342 // Date creation
343 if (! empty($arrayfields['b.datec']['checked']))
344 {
345  print '<td class="liste_titre">';
346  print '</td>';
347 }
348 // Date modification
349 if (! empty($arrayfields['b.tms']['checked']))
350 {
351  print '<td class="liste_titre">';
352  print '</td>';
353 }
354 // Status
355 if (! empty($arrayfields['b.clos']['checked']))
356 {
357  print '<td class="liste_titre center">';
358  $array=array(
359  'opened'=>$langs->trans("Opened"),
360  'closed'=>$langs->trans("Closed")
361  );
362  print $form->selectarray("search_status", $array, $search_status, 1);
363  print '</td>';
364 }
365 // Balance
366 if (! empty($arrayfields['balance']['checked']))
367 {
368  print '<td class="liste_titre"></td>';
369 }
370 // Action column
371 print '<td class="liste_titre" align="middle">';
372 $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
373 print $searchpicto;
374 print '</td>';
375 print '</tr>';
376 
377 // Fields title
378 print '<tr class="liste_titre">';
379 if (! empty($arrayfields['b.ref']['checked'])) print_liste_field_titre($arrayfields['b.ref']['label'],$_SERVER["PHP_SELF"],'b.ref','',$param,'',$sortfield,$sortorder);
380 if (! empty($arrayfields['b.label']['checked'])) print_liste_field_titre($arrayfields['b.label']['label'],$_SERVER["PHP_SELF"],'b.label','',$param,'',$sortfield,$sortorder);
381 if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titre($arrayfields['accountype']['label'],$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder);
382 if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'],$_SERVER["PHP_SELF"],'b.number','',$param,'',$sortfield,$sortorder);
383 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);
384 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);
385 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);
386 if (! empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder);
387 // Extra fields
388 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
389 // Hook fields
390 $parameters=array('arrayfields'=>$arrayfields);
391 $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
392 print $hookmanager->resPrint;
393 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);
394 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);
395 if (! empty($arrayfields['b.clos']['checked'])) print_liste_field_titre($arrayfields['b.clos']['label'],$_SERVER["PHP_SELF"],'b.clos','',$param,'align="center"',$sortfield,$sortorder);
396 if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder);
397 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
398 print "</tr>\n";
399 
400 
401 $total = array(); $found = 0; $i=0; $lastcurrencycode='';
402 $var=true;
403 foreach ($accounts as $key=>$type)
404 {
405  if ($i >= $limit) break;
406 
407  $found++;
408 
409  $obj = new Account($db);
410  $obj->fetch($key);
411 
412  $var = !$var;
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>'.$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">';
554  print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$obj->id.'">'.price($solde, 0, $langs, 0, 0, -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 
606 llxFooter();
607 
608 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
if(!GETPOST('transkey')&&!GETPOST('transphrase')) else
View.
Definition: notice.php:43
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
if(empty($reshook)) $form
View.
Definition: perms.php:103
Class to manage bank accounts.
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
if($_POST["cancel"]==$langs->trans("Cancel")&&!$id) if($action== 'setdatev'&&$user->rights->tax->charges->creer) if($action== 'add'&&$_POST["cancel"]<> $langs->trans("Cancel")) if($action== 'delete') $title
Actions.
Definition: card.php:183
llxHeader()
Empty header.
Definition: wrapper.php:46
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).
print
Draft customers invoices.
Definition: index.php:91
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:1013
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.
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $objcanvas=null)
Check permissions of a user to show a page and an object.