dolibarr  7.0.0-beta
bankentries_list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
5  * Copyright (C) 2012 Vinícius Nogueira <viniciusvgn@gmail.com>
6  * Copyright (C) 2014 Florian Henry <florian.henry@open-cooncept.pro>
7  * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
8  * Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
9  * Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23  */
24 
31 require('../../main.inc.php');
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
36 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
38 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
39 
40 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
41 require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
42 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
43 require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
44 require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
45 require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
46 require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php';
47 require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
48 require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
49 
50 $langs->loadLangs(array("banks","bills","categories","companies","margins","salaries","loan","donations","trips","members","compta","accountancy"));
51 
52 $id = GETPOST('id','int');
53 $ref = GETPOST('ref','alpha');
54 $action=GETPOST('action','alpha');
55 $cancel=GETPOST('cancel','alpha');
56 $confirm=GETPOST('confirm','alpha');
57 
58 // Security check
59 $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :''));
60 $fieldtype = (! empty($ref) ? 'ref' :'rowid');
61 if ($fielvalue)
62 {
63  if ($user->societe_id) $socid=$user->societe_id;
64  $result=restrictedArea($user,'banque',$fieldvalue,'bank_account&bank_account','','',$fieldtype);
65 }
66 else
67 {
68  if ($user->societe_id) $socid=$user->societe_id;
69  $result=restrictedArea($user,'banque');
70 }
71 
72 $description=GETPOST("description",'alpha');
73 $dateop = dol_mktime(12,0,0,GETPOST("opmonth",'int'),GETPOST("opday",'int'),GETPOST("opyear",'int'));
74 $debit=GETPOST("debit",'alpha');
75 $credit=GETPOST("credit",'alpha');
76 $type=GETPOST("type",'alpha');
77 $account=GETPOST("account",'int');
78 $accountancy_code=GETPOST('accountancy_code', 'alpha');
79 $bid=GETPOST("bid","int");
80 $search_ref=GETPOST('search_ref','alpha');
81 $search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), GETPOST('search_start_dtday', 'int'), GETPOST('search_start_dtyear', 'int'));
82 $search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
83 $search_dv_start = dol_mktime(0, 0, 0, GETPOST('search_start_dvmonth', 'int'), GETPOST('search_start_dvday', 'int'), GETPOST('search_start_dvyear', 'int'));
84 $search_dv_end = dol_mktime(0, 0, 0, GETPOST('search_end_dvmonth', 'int'), GETPOST('search_end_dvday', 'int'), GETPOST('search_end_dvyear', 'int'));
85 $search_thirdparty=GETPOST("thirdparty",'alpha');
86 $search_req_nb=GETPOST("req_nb",'alpha');
87 $search_num_releve=GETPOST("search_num_releve",'alpha');
88 $search_conciliated=GETPOST("search_conciliated",'int');
89 $num_releve=GETPOST("num_releve","alpha");
90 $cat=GETPOST("cat");
91 if (empty($dateop)) $dateop=-1;
92 
93 $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
94 $sortfield = GETPOST("sortfield",'alpha');
95 $sortorder = GETPOST("sortorder",'alpha');
96 $page = GETPOST("page",'int');
97 $pageplusone = GETPOST("pageplusone",'int');
98 if ($pageplusone) $page = $pageplusone - 1;
99 if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
100 $offset = $limit * $page;
101 $pageprev = $page - 1;
102 $pagenext = $page + 1;
103 if (! $sortorder) $sortorder='ASC';
104 if (! $sortfield) $sortfield='b.datev,b.dateo,b.rowid';
105 
106 $mode_balance_ok=false;
107 //if (($sortfield == 'b.datev' || $sortfield == 'b.datev,b.dateo,b.rowid')) // TODO Manage balance when account not selected
108 if (($sortfield == 'b.datev' || $sortfield == 'b.datev,b.dateo,b.rowid'))
109 {
110  $sortfield = 'b.datev,b.dateo,b.rowid';
111  if ($id > 0 || ! empty($ref) || $account > 0) $mode_balance_ok = true;
112 }
113 if (strtolower($sortorder) == 'desc') $mode_balance_ok = false;
114 
115 $object = new Account($db);
116 if ($id > 0 || ! empty($ref))
117 {
118  $result=$object->fetch($id, $ref);
119  $account = $object->id; // Force the search field on id of account
120 }
121 
122 
123 // Initialize technical object to manage context to save list fields
124 $contextpage='banktransactionlist'.(empty($object->ref)?'':'-'.$object->id);
125 //var_dump($contextpage);
126 
127 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
128 $hookmanager->initHooks(array('banktransactionlist', $contextpage));
129 $extrafields = new ExtraFields($db);
130 
131 // fetch optionals attributes and labels
132 $extralabels = $extrafields->fetch_name_optionals_label('banktransaction');
133 $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
134 
135 $arrayfields=array(
136  'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
137  'description'=>array('label'=>$langs->trans("Description"), 'checked'=>1),
138  'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1),
139  'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1),
140  'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
141  'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1),
142  'bu.label'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>500),
143  'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || ! empty($ref))?0:1), 'position'=>1000),
144  'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
145  'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
146  'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>1000),
147  'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1001),
148  'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010),
149  'b.conciliated'=>array('label'=>$langs->trans("Conciliated"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile'?1:0), 'position'=>1020),
150 );
151 // Extra fields
152 if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
153 {
154  foreach($extrafields->attribute_label as $key => $val)
155  {
156  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]));
157  }
158 }
159 
160 
161 
162 /*
163  * Actions
164  */
165 
166 if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
167 if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
168 
169 $parameters=array();
170 $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
171 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
172 
173 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
174 
175 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
176 {
177  $search_dt_start='';
178  $search_dt_end='';
179  $search_dv_start='';
180  $search_dv_end='';
181  $description="";
182  $type="";
183  $debit="";
184  $credit="";
185  $bid="";
186  $search_ref="";
187  $search_req_nb='';
188  $search_thirdparty='';
189  $search_num_releve='';
190  $search_conciliated='';
191  $thirdparty='';
192 
193  $account="";
194  if ($id > 0 || ! empty($ref)) $account=$object->id;
195 }
196 
197 if (empty($reshook))
198 {
199  $objectclass='Account';
200  $objectlabel='BankTransaction';
201  $permtoread = $user->rights->banque->lire;
202  $permtodelete = $user->rights->banque->supprimer;
203  $uploaddir = $conf->bank->dir_output;
204  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
205 }
206 
207 // Conciliation
208 if (GETPOST('confirm_reconcile') && $user->rights->banque->consolidate)
209 {
210  $error=0;
211 
212  // Definition, nettoyage parametres
213  $num_releve=trim(GETPOST("num_releve"));
214 
215  if ($num_releve)
216  {
217  $bankline=new AccountLine($db);
218  if (isset($_POST['rowid']) && is_array($_POST['rowid']))
219  {
220  foreach($_POST['rowid'] as $row)
221  {
222  if ($row > 0)
223  {
224  $result=$bankline->fetch($row);
225  $bankline->num_releve=$num_releve; //$_POST["num_releve"];
226  $result=$bankline->update_conciliation($user, GETPOST("cat"));
227  if ($result < 0)
228  {
229  setEventMessages($bankline->error, $bankline->errors, 'errors');
230  $error++;
231  break;
232  }
233  }
234  }
235  }
236  else
237  {
238  $error++;
239  $langs->load("errors");
240  setEventMessages($langs->trans("NoRecordSelected"), null, 'errors');
241  }
242  }
243  else
244  {
245  $error++;
246  $langs->load("errors");
247  setEventMessages($langs->trans("ErrorPleaseTypeBankTransactionReportName"), null, 'errors');
248  }
249 
250  if (! $error)
251  {
252  header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); // To avoid to submit twice and allow back
253  exit;
254  }
255 }
256 
257 
258 if (GETPOST('save') && ! $cancel && $user->rights->banque->modifier)
259 {
260  $error = 0;
261 
262  if (price2num($_POST["addcredit"]) > 0)
263  {
264  $amount = price2num($_POST["addcredit"]);
265  }
266  else
267  {
268  $amount = - price2num($_POST["adddebit"]);
269  }
270 
271  $operation = GETPOST("operation",'alpha');
272  $num_chq = GETPOST("num_chq",'alpha');
273  $label = GETPOST("label",'alpha');
274  $cat1 = GETPOST("cat1",'alpha');
275 
276  $bankaccountid = $id;
277  if (GETPOST('add_account','int') > 0) $bankaccountid = GETPOST('add_account','int');
278 
279  if (! $dateop) {
280  $error++;
281  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
282  }
283  if (! $operation) {
284  $error++;
285  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
286  }
287  if (! $label) {
288  $error++;
289  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
290  }
291  if (! $amount) {
292  $error++;
293  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
294  }
295  if (! $bankaccountid > 0)
296  {
297  $error++;
298  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
299  }
300  /*if (! empty($conf->accounting->enabled) && (empty($accountancy_code) || $accountancy_code == '-1'))
301  {
302  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors');
303  $error++;
304  }*/
305 
306  if (! $error)
307  {
308  $objecttmp = new Account($db);
309  $objecttmp->fetch($bankaccountid);
310  $insertid = $objecttmp->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user, '', '', $accountancy_code);
311  if ($insertid > 0)
312  {
313  setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
314  header("Location: ".$_SERVER['PHP_SELF'].($id ? "?id=".$id : ''));
315  exit;
316  }
317  else
318  {
319  setEventMessages($object->error, $object->errors, 'errors');
320  }
321  }
322  else
323  {
324  $action='addline';
325  }
326 }
327 
328 if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->modifier)
329 {
330  $accline=new AccountLine($db);
331  $result=$accline->fetch(GETPOST("rowid"));
332  $result=$accline->delete($user);
333 }
334 
335 
336 
337 /*
338  * View
339  */
340 
341 $form = new Form($db);
342 $formother = new FormOther($db);
343 $formaccounting = new FormAccounting($db);
344 
345 $companystatic=new Societe($db);
346 $bankaccountstatic=new Account($db);
347 
348 $societestatic=new Societe($db);
349 $userstatic=new User($db);
350 $chargestatic=new ChargeSociales($db);
351 $loanstatic=new Loan($db);
352 $memberstatic=new Adherent($db);
353 $paymentstatic=new Paiement($db);
354 $paymentsupplierstatic=new PaiementFourn($db);
355 $paymentvatstatic=new TVA($db);
356 $paymentsalstatic=new PaymentSalary($db);
357 $donstatic=new Don($db);
358 $paymentexpensereportstatic=new PaymentExpenseReport($db);
359 $bankstatic=new Account($db);
360 $banklinestatic=new AccountLine($db);
361 
362 $now = dol_now();
363 
364 
365 // Must be before button action
366 $param='';
367 if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
368 if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
369 if ($id > 0) $param.='&id='.urlencode($id);
370 if (!empty($ref)) $param.='&ref='.urlencode($ref);
371 if (!empty($search_ref)) $param.='&search_ref='.urlencode($search_ref);
372 if (!empty($description)) $param.='&description='.urlencode($description);
373 if (!empty($type)) $param.='&type='.urlencode($type);
374 if (!empty($debit)) $param.='&debit='.$debit;
375 if (!empty($credit)) $param.='&credit='.$credit;
376 if (!empty($account)) $param.='&account='.$account;
377 if (!empty($search_num_releve)) $param.='&search_num_releve='.urlencode($search_num_releve);
378 if ($search_conciliated != '' && $search_conciliated != '-1') $param.='&search_conciliated='.urlencode($search_conciliated);
379 if (!empty($bid)) $param.='&bid='.$bid;
380 if (dol_strlen($search_dt_start) > 0) $param .= '&search_start_dtmonth=' . GETPOST('search_start_dtmonth', 'int') . '&search_start_dtday=' . GETPOST('search_start_dtday', 'int') . '&search_start_dtyear=' . GETPOST('search_start_dtyear', 'int');
381 if (dol_strlen($search_dt_end) > 0) $param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int');
382 if (dol_strlen($search_dv_start) > 0) $param .= '&search_start_dvmonth=' . GETPOST('search_start_dvmonth', 'int') . '&search_start_dvday=' . GETPOST('search_start_dvday', 'int') . '&search_start_dvyear=' . GETPOST('search_start_dvyear', 'int');
383 if (dol_strlen($search_dv_end) > 0) $param .= '&search_end_dvmonth=' . GETPOST('search_end_dvmonth', 'int') . '&search_end_dvday=' . GETPOST('search_end_dvday', 'int') . '&search_end_dvyear=' . GETPOST('search_end_dvyear', 'int');
384 if ($search_req_nb) $param.='&amp;req_nb='.urlencode($search_req_nb);
385 if (GETPOST("thirdparty")) $param.='&amp;thirdparty='.urlencode(GETPOST("thirdparty"));
386 if ($optioncss != '') $param.='&optioncss='.$optioncss;
387 // Add $param from extra fields
388 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
389 
390 
391 
392 if ($id > 0 || ! empty($ref))
393 {
394  $title = $langs->trans("FinancialAccount").' - '.$langs->trans("Transactions");
395  $helpurl = "";
396  llxHeader('',$title,$helpurl);
397 
398  // Load bank groups
399  require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
400  $bankcateg = new BankCateg($db);
401  $options = array();
402 
403  foreach ($bankcateg->fetchAll() as $bankcategory) {
404  $options[$bankcategory->id] = $bankcategory->label;
405  }
406 
407  // Bank card
408  $head=bank_prepare_head($object);
409  dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account');
410 
411  $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
412 
413  dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
414 
415  dol_fiche_end();
416 
417 
418  /*
419  * Buttons actions
420  */
421 
422  if ($action != 'reconcile')
423  {
424  print '<div class="tabsAction">';
425 
426  if ($object->canBeConciliated() > 0) {
427  // If not cash account and can be reconciliate
428  if ($user->rights->banque->consolidate) {
429  print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&search_conciliated=0'.$param.'">'.$langs->trans("Conciliate").'</a>';
430  } else {
431  print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
432  }
433  }
434 
435  print '</div>';
436  }
437 }
438 else
439 {
440  llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param);
441 }
442 
443 $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,";
444 $sql.= " b.fk_account, b.fk_type,";
445 $sql.= " ba.rowid as bankid, ba.ref as bankref,";
446 $sql.= " bu.url_id,";
447 $sql.= " s.nom, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
448 // Add fields from extrafields
449 foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
450 // Add fields from hooks
451 $parameters=array();
452 $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
453 $sql.=$hookmanager->resPrint;
454 $sql.= " FROM ";
455 if ($bid) $sql.= MAIN_DB_PREFIX."bank_class as l,";
456 $sql.= " ".MAIN_DB_PREFIX."bank_account as ba,";
457 $sql.= " ".MAIN_DB_PREFIX."bank as b";
458 if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_extrafields as ef on (b.rowid = ef.fk_object)";
459 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND type = 'company'";
460 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid";
461 $sql.= " WHERE b.fk_account = ba.rowid";
462 $sql.= " AND ba.entity IN (".getEntity('bank_account').")";
463 if ($account > 0) $sql.=" AND b.fk_account = ".$account;
464 // Search period criteria
465 if (dol_strlen($search_dt_start)>0) $sql .= " AND b.dateo >= '" . $db->idate($search_dt_start) . "'";
466 if (dol_strlen($search_dt_end)>0) $sql .= " AND b.dateo <= '" . $db->idate($search_dt_end) . "'";
467 // Search period criteria
468 if (dol_strlen($search_dv_start)>0) $sql .= " AND b.datev >= '" . $db->idate($search_dv_start) . "'";
469 if (dol_strlen($search_dv_end)>0) $sql .= " AND b.datev <= '" . $db->idate($search_dv_end) . "'";
470 if ($search_ref) $sql.=natural_search("b.rowid", $search_ref);
471 if ($search_req_nb) $sql.= natural_search("b.num_chq", $search_req_nb);
472 if ($search_num_releve) $sql.= natural_search("b.num_releve", $search_num_releve);
473 if ($search_conciliated != '' && $search_conciliated != '-1') $sql.= " AND b.rappro = ".$search_conciliated;
474 if ($search_thirdparty) $sql.= natural_search("s.nom", $search_thirdparty);
475 if ($description) $sql.= natural_search("b.label", $description); // Warning some text are just translation keys, not translated strings
476 if ($bid) $sql.= " AND b.rowid=l.lineid AND l.fk_categ=".$bid;
477 if (! empty($type)) $sql.= " AND b.fk_type = '".$db->escape($type)."' ";
478 // Search criteria amount
479 $debit = price2num(str_replace('-','',$debit));
480 $credit = price2num(str_replace('-','',$credit));
481 if ($debit) $sql.= natural_search('- b.amount', $debit, 1);
482 if ($credit) $sql.= natural_search('b.amount', $credit, 1);
483 // Add where from extra fields
484 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
485 
486 // Add where from hooks
487 $parameters=array();
488 $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
489 $sql.=$hookmanager->resPrint;
490 
491 $sql.= $db->order($sortfield,$sortorder);
492 
493 $nbtotalofrecords = '';
494 $nbtotalofpages = 0;
495 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
496 {
497  $result = $db->query($sql);
498  $nbtotalofrecords = $db->num_rows($result);
499  $nbtotalofpages = ceil($nbtotalofrecords/$limit);
500 }
501 
502 if (($id > 0 || ! empty($ref)) && ((string) $page == ''))
503 {
504  // We open a list of transaction of a dedicated account and no page was set by defaut
505  // We force on last page.
506  $page = ($nbtotalofpages - 1);
507  $offset = $limit * $page;
508  if ($page < 0) $page = 0;
509 }
510 if ($page >= $nbtotalofpages)
511 {
512  // If we made a search and result has low page than the page number we were on
513  $page = ($nbtotalofpages -1);
514  $offset = $limit * $page;
515  if ($page < 0) $page = 0;
516 }
517 
518 // If not account defined $mode_balance_ok=false
519 if (empty($account)) $mode_balance_ok=false;
520 // If a search is done $mode_balance_ok=false
521 if (! empty($search_ref)) $mode_balance_ok=false;
522 if (! empty($req_nb)) $mode_balance_ok=false;
523 if (! empty($type)) $mode_balance_ok=false;
524 if (! empty($debit)) $mode_balance_ok=false;
525 if (! empty($credit)) $mode_balance_ok=false;
526 if (! empty($thirdparty)) $mode_balance_ok=false;
527 
528 $sql.= $db->plimit($limit+1,$offset);
529 
530 dol_syslog('compta/bank/bankentries_list.php', LOG_DEBUG);
531 $resql = $db->query($sql);
532 if ($resql)
533 {
534  $var=True;
535  $num = $db->num_rows($resql);
536 
537  $arrayofselected=is_array($toselect)?$toselect:array();
538 
539  // List of mass actions available
540  $arrayofmassactions = array(
541  //'presend'=>$langs->trans("SendByMail"),
542  //'builddoc'=>$langs->trans("PDFMerge"),
543  );
544  //if ($user->rights->bank->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
545  if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
546  $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
547 
548  // Confirmation delete
549  if ($action == 'delete')
550  {
551  $text=$langs->trans('ConfirmDeleteTransaction');
552  print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid"), $langs->trans('DeleteTransaction'), $text, 'confirm_delete', null, '', 1);
553  }
554 
555  // Lines of title fields
556  print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="search_form">'."\n";
557  if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
558  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
559  print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
560  print '<input type="hidden" name="action" value="'.($action?$action:'search').'">';
561  print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
562  print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
563  print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
564  print '<input type="hidden" name="page" value="'.$page.'">';
565  print '<input type="hidden" name="id" value="'.$id.'">';
566  print '<input type="hidden" name="ref" value="'.$ref.'">';
567  if (GETPOST('bid')) print '<input type="hidden" name="bid" value="'.GETPOST("bid").'">';
568 
569  // Form to reconcile
570  if ($user->rights->banque->consolidate && $action == 'reconcile')
571  {
572 // print '<table class="noborder" width="100%">';
573 // print '<tr '.$bcnd[false].'>';
574 // print '<td>';
575  print '<div class="valignmiddle inline-block" style="padding-right: 20px;">';
576  print '<strong>'.$langs->trans("InputReceiptNumber").'</strong>: ';
577  print '<input class="flat" id="num_releve" name="num_releve" type="text" value="'.(GETPOST('num_releve')?GETPOST('num_releve'):'').'" size="10">'; // The only default value is value we just entered
578  print '</div>';
579  if ($options) {
580  print $langs->trans("EventualyAddCategory").': ';
581  print Form::selectarray('cat', $options, GETPOST('cat'), 1);
582  }
583  print '<br>'.$langs->trans("ThenCheckLinesAndConciliate").' ';
584  print '<input class="button" name="confirm_reconcile" type="submit" value="'.$langs->trans("Conciliate").'">';
585  print ' '.$langs->trans("or").' ';
586  print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
587 
588  // Show last bank statements
589  $nbmax=15; // We accept to show last 15 receipts (so we can have more than one year)
590  $liste="";
591  $sql = "SELECT DISTINCT num_releve FROM ".MAIN_DB_PREFIX."bank";
592  $sql.= " WHERE fk_account=".$id." AND num_releve IS NOT NULL";
593  $sql.= $db->order("num_releve","DESC");
594  $sql.= $db->plimit($nbmax+1);
595  print '<br><br>';
596  print $langs->trans("LastAccountStatements").' : ';
597  $resqlr=$db->query($sql);
598  if ($resqlr)
599  {
600  $numr=$db->num_rows($resqlr);
601  $i=0;
602  $last_ok=0;
603  while (($i < $numr) && ($i < $nbmax))
604  {
605  $objr = $db->fetch_object($resqlr);
606  if (! $last_ok) {
607  $last_releve = $objr->num_releve;
608  $last_ok=1;
609  }
610  $i++;
611  $liste='<a href="'.DOL_URL_ROOT.'/compta/bank/releve.php?account='.$id.'&amp;num='.$objr->num_releve.'">'.$objr->num_releve.'</a> &nbsp; '.$liste;
612  }
613  if ($numr >= $nbmax) $liste="... &nbsp; ".$liste;
614  print $liste;
615  if ($numr <= 0) print '<b>'.$langs->trans("None").'</b>';
616  }
617  else
618  {
619  dol_print_error($db);
620  }
624  if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE == 1) {
625  print '
626  <script type="text/javascript">
627  $("#num_releve").val("' . $last_releve . '");
628  </script>
629  ';
630  }
631  print '<br><br>';
632 // print '</td></tr></table>';
633  }
634 
635  // Form to add a transaction with no invoice
636  if ($user->rights->banque->modifier && $action == 'addline')
637  {
638  print load_fiche_titre($langs->trans("AddBankRecordLong"),'','');
639 
640  print '<table class="noborder" width="100%">';
641 
642  print '<tr class="liste_titre">';
643  print '<td>'.$langs->trans("Description").'</td>';
644  print '<td>'.$langs->trans("Date").'</td>';
645  print '<td>&nbsp;</td>';
646  print '<td>'.$langs->trans("Type").'</td>';
647  print '<td>'.$langs->trans("Numero").'</td>';
648  //if (! $account > 0)
649  //{
650  print '<td align=right>'.$langs->trans("BankAccount").'</td>';
651  //}
652  print '<td align=right>'.$langs->trans("Debit").'</td>';
653  print '<td align=right>'.$langs->trans("Credit").'</td>';
654  /*if (! empty($conf->accounting->enabled))
655  {
656  print '<td align="center">';
657  print $langs->trans("AccountAccounting");
658  print '</td>';
659  }*/
660  print '<td align="center">&nbsp;</td>';
661  print '</tr>';
662 
663  print '<tr>';
664  print '<td>';
665  print '<input name="label" class="flat minwidth200" type="text" value="'.GETPOST("label","alpha").'">';
666  if (is_array($options) && count($options)) {
667  print '<br>'.$langs->trans("Rubrique").': ';
668  print Form::selectarray('cat1', $options, GETPOST('cat1'), 1);
669  }
670  print '</td>';
671  print '<td class="nowrap">';
672  $form->select_date(empty($dateop)?-1:$dateop,'op',0,0,0,'transaction');
673  print '</td>';
674  print '<td>&nbsp;</td>';
675  print '<td class="nowrap">';
676  $form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')),'operation','1,2',2,1);
677  print '</td>';
678  print '<td>';
679  print '<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST("num_chq","alpha").'">';
680  print '</td>';
681  //if (! $account > 0)
682  //{
683  print '<td align=right>';
684  $form->select_comptes(GETPOST('add_account','int')?GETPOST('add_account','int'):$account,'add_account',0,'',1, ($id > 0 || ! empty($ref)?' disabled="disabled"':''));
685  print '</td>';
686  //}
687  print '<td align="right"><input name="adddebit" class="flat" type="text" size="4" value="'.GETPOST("adddebit","alpha").'"></td>';
688  print '<td align="right"><input name="addcredit" class="flat" type="text" size="4" value="'.GETPOST("addcredit","alpha").'"></td>';
689  /*if (! empty($conf->accounting->enabled))
690  {
691  print '<td align="center">';
692  print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, '');
693  print '</td>';
694  }*/
695  print '<td align="center">';
696  print '<input type="submit" name="save" class="button" value="'.$langs->trans("Add").'"><br>';
697  print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
698  print '</td></tr>';
699 
700  print '</table>';
701  print '<br>';
702  }
703 
705  print '
706  <script type="text/javascript">
707  $(function() {
708  $("a.ajax").each(function(){
709  var current = $(this);
710  current.click(function()
711  {
712  $.get("'.DOL_URL_ROOT.'/core/ajax/bankconciliate.php?"+current.attr("href").split("?")[1], function(data)
713  {
714  console.log(data)
715  current.parent().prev().replaceWith(data);
716  });
717  return false;
718  });
719  });
720  });
721  </script>
722  ';
723 
724  $i = 0;
725 
726  // Title
727  $bankcateg=new BankCateg($db);
728  $morehtml='<div class="inline-block">';
729  $morehtml.= '<label for="pageplusone">'.$langs->trans("Page")."</label> "; // ' Page ';
730  $morehtml.='<input type="text" name="pageplusone" id="pageplusone" class="flat right width25" value="'.($page+1).'">';
731  $morehtml.='/'.$nbtotalofpages.' ';
732  $morehtml.='</div>';
733 
734  $addbutton = '';
735  if ($action != 'addline' && $action != 'reconcile')
736  {
737  if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT))
738  {
739  if (! empty($conf->global->BANK_USE_VARIOUS_PAYMENT)) // If direct entries is done using miscellaneous payments
740  {
741  if ($user->rights->banque->modifier) {
742  $addbutton = '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$account).'">'.$langs->trans("AddBankRecord").'</a>';
743  } else {
744  $addbutton = '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
745  }
746  }
747  else // If direct entries is not done using miscellaneous payments
748  {
749  if ($user->rights->banque->modifier) {
750  $addbutton = '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param.'">'.$langs->trans("AddBankRecord").'</a>';
751  } else {
752  $addbutton = '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
753  }
754  }
755  }
756  else
757  {
758  $addbutton = '<a class="butActionRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
759  }
760  }
761  $morehtml.=$addbutton;
762 
763  $picto='title_bank';
764  if ($id > 0 || ! empty($ref)) $picto='';
765  if (GETPOST("bid"))
766  {
767  $result=$bankcateg->fetch(GETPOST("bid"));
768  print_barre_liste($langs->trans("BankTransactionForCategory",$bankcateg->label).' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit);
769  }
770  else
771  {
772  print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit);
773  }
774 
775  // We can add page now to param
776  if ($page != '') $param.='&page='.urlencode($page);
777 
778  $moreforfilter = '';
779 
780  $moreforfilter.='<div class="divsearchfield">';
781  $moreforfilter .= $langs->trans('DateOperationShort').' : ';
782  $moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('From') . ' ';
783  $moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
784  //$moreforfilter .= ' - ';
785  $moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('to') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
786  $moreforfilter .= '</div>';
787 
788  $moreforfilter.='<div class="divsearchfield">';
789  $moreforfilter .= $langs->trans('DateValueShort').' : ';
790  $moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('From') . ' ';
791  $moreforfilter .= $form->select_date($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
792  //$moreforfilter .= ' - ';
793  $moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('to') . ' ' . $form->select_date($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
794  $moreforfilter .= '</div>';
795 
796  $parameters=array();
797  $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
798  if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
799  else $moreforfilter = $hookmanager->resPrint;
800 
801  if ($moreforfilter)
802  {
803  print '<div class="liste_titre liste_titre_bydiv centpercent">';
804  print $moreforfilter;
805  print '</div>'."\n";
806  }
807 
808  $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
809  $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
810 
811  print '<div class="div-table-responsive">';
812  print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
813 
814 
815  print '<tr class="liste_titre_filter">';
816  if (! empty($arrayfields['b.rowid']['checked']))
817  {
818  print '<td class="liste_titre">';
819  print '<input type="text" class="flat" name="search_ref" size="2" value="'.dol_escape_htmltag($search_ref).'">';
820  print '</td>';
821  }
822  if (! empty($arrayfields['description']['checked']))
823  {
824  print '<td class="liste_titre">';
825  //print '<input type="text" class="flat" name="description" size="10" value="'.dol_escape_htmltag($description).'">';
826  print '</td>';
827  }
828  if (! empty($arrayfields['b.dateo']['checked']))
829  {
830  print '<td class="liste_titre">&nbsp;</td>';
831  }
832  if (! empty($arrayfields['b.datev']['checked']))
833  {
834  print '<td class="liste_titre">&nbsp;</td>';
835  }
836  if (! empty($arrayfields['type']['checked']))
837  {
838  print '<td class="liste_titre" align="center">';
839  $form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1, 0, 1, 'maxwidth100');
840  print '</td>';
841  }
842  if (! empty($arrayfields['b.num_chq']['checked']))
843  {
844  // Numero
845  print '<td class="liste_titre" align="center"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).'" size="2"></td>';
846  }
847  if (! empty($arrayfields['bu.label']['checked']))
848  {
849  print '<td class="liste_titre"><input type="text" class="flat" name="thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'" size="10"></td>';
850  }
851  if (! empty($arrayfields['ba.ref']['checked']))
852  {
853  print '<td class="liste_titre" align="right">';
854  $form->select_comptes($account,'account',0,'',1, ($id > 0 || ! empty($ref)?' disabled="disabled"':''));
855  print '</td>';
856  }
857  if (! empty($arrayfields['b.debit']['checked']))
858  {
859  print '<td class="liste_titre" align="right">';
860  print '<input type="text" class="flat" name="debit" size="4" value="'.dol_escape_htmltag($debit).'">';
861  print '</td>';
862  }
863  if (! empty($arrayfields['b.credit']['checked']))
864  {
865  print '<td class="liste_titre" align="right">';
866  print '<input type="text" class="flat" name="credit" size="4" value="'.dol_escape_htmltag($credit).'">';
867  print '</td>';
868  }
869  if (! empty($arrayfields['balancebefore']['checked']))
870  {
871  print '<td class="liste_titre" align="right">';
872  $htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
873  print $form->textwithpicto('', $htmltext, 1);
874  print '</td>';
875  }
876  if (! empty($arrayfields['balance']['checked']))
877  {
878  print '<td class="liste_titre" align="right">';
879  $htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
880  print $form->textwithpicto('', $htmltext, 1);
881  print '</td>';
882  }
883  // Numero statement
884  if (! empty($arrayfields['b.num_releve']['checked']))
885  {
886  print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_num_releve" value="'.dol_escape_htmltag($search_num_releve).'" size="3"></td>';
887  }
888  // Conciliated
889  if (! empty($arrayfields['b.conciliated']['checked']))
890  {
891  print '<td class="liste_titre" align="center">';
892  print $form->selectyesno('search_conciliated', $search_conciliated, 1, False, 1);
893  print '</td>';
894  }
895  print '<td class="liste_titre" align="middle">';
896  print '</td>';
897  print '<td class="liste_titre" align="middle">';
898  $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
899  print $searchpicto;
900  print '</td>';
901  print "</tr>\n";
902 
903  // Fields title
904  print '<tr class="liste_titre">';
905  if (! empty($arrayfields['b.rowid']['checked'])) print_liste_field_titre($arrayfields['b.rowid']['label'],$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder);
906  if (! empty($arrayfields['description']['checked'])) print_liste_field_titre($arrayfields['description']['label'],$_SERVER['PHP_SELF'],'','',$param,'',$sortfield,$sortorder);
907  if (! empty($arrayfields['b.dateo']['checked'])) print_liste_field_titre($arrayfields['b.dateo']['label'],$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="center"',$sortfield,$sortorder);
908  if (! empty($arrayfields['b.datev']['checked'])) print_liste_field_titre($arrayfields['b.datev']['label'],$_SERVER['PHP_SELF'],'b.datev,b.dateo,b.rowid','',$param,'align="center"',$sortfield,$sortorder);
909  if (! empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="center"',$sortfield,$sortorder);
910  if (! empty($arrayfields['b.num_chq']['checked'])) print_liste_field_titre($arrayfields['b.num_chq']['label'],$_SERVER['PHP_SELF'],'b.num_chq','',$param,'align="center"',$sortfield,$sortorder);
911  if (! empty($arrayfields['bu.label']['checked'])) print_liste_field_titre($arrayfields['bu.label']['label'],$_SERVER['PHP_SELF'],'bu.label','',$param,'',$sortfield,$sortorder);
912  if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'],$_SERVER['PHP_SELF'],'ba.ref','',$param,'align="right"',$sortfield,$sortorder);
913  if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
914  if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
915  if (! empty($arrayfields['balancebefore']['checked'])) print_liste_field_titre($arrayfields['balancebefore']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
916  if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
917  if (! empty($arrayfields['b.num_releve']['checked'])) print_liste_field_titre($arrayfields['b.num_releve']['label'],$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder);
918  if (! empty($arrayfields['b.conciliated']['checked'])) print_liste_field_titre($arrayfields['b.conciliated']['label'],$_SERVER['PHP_SELF'],'b.rappro','',$param,'align="center"',$sortfield,$sortorder);
919  // Extra fields
920  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
921  // Hook fields
922  $parameters=array('arrayfields'=>$arrayfields);
923  $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
924  print $hookmanager->resPrint;
925  print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
926  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
927  print "</tr>\n";
928 
929  $balance = 0; // For balance
930  $balancecalculated = false;
931 
932  // Loop on each record
933  $sign = 1;
934 
935  $totalarray=array();
936  while ($i < min($num,$limit))
937  {
938  $objp = $db->fetch_object($resql);
939 
940  // If we are in a situation where we need/can show balance, we calculate the start of balance
941  if (! $balancecalculated && (! empty($arrayfields['balancebefore']['checked']) || ! empty($arrayfields['balance']['checked'])) && $mode_balance_ok)
942  {
943  if (! $account)
944  {
945  dol_print_error('', 'account is not defined but $mode_balance_ok is true');
946  exit;
947  }
948 
949  // Loop on each record before
950  $sign = 1;
951  $i = 0;
952  $sqlforbalance='SELECT SUM(b.amount) as balance';
953  $sqlforbalance.= " FROM ";
954  $sqlforbalance.= " ".MAIN_DB_PREFIX."bank_account as ba,";
955  $sqlforbalance.= " ".MAIN_DB_PREFIX."bank as b";
956  $sqlforbalance.= " WHERE b.fk_account = ba.rowid";
957  $sqlforbalance.= " AND ba.entity IN (".getEntity('bank_account').")";
958  $sqlforbalance.= " AND b.fk_account = ".$account;
959  $sqlforbalance.= " AND (b.datev < '" . $db->idate($db->jdate($objp->dv)) . "' OR (b.datev = '" . $db->idate($db->jdate($objp->dv)) . "' AND (b.dateo < '".$db->idate($db->jdate($objp->do))."' OR (b.dateo = '".$db->idate($db->jdate($objp->do))."' AND b.rowid < ".$objp->rowid."))))";
960  $resqlforbalance = $db->query($sqlforbalance);
961  //print $sqlforbalance;
962  if ($resqlforbalance)
963  {
964  $objforbalance = $db->fetch_object($resqlforbalance);
965  if ($objforbalance)
966  {
967  $balance = $objforbalance->balance;
968  }
969  }
970  else dol_print_error($db);
971 
972  $balancecalculated=true;
973 
974  // Output a line with start balance
975  if ($user->rights->banque->consolidate && $action == 'reconcile')
976  {
977  $tmpnbfieldbeforebalance=0;
978  $tmpnbfieldafterbalance=0;
979  $balancefieldfound=false;
980  foreach($arrayfields as $key => $val)
981  {
982  if ($key == 'balancebefore' || $key == 'balance')
983  {
984  $balancefieldfound=true;
985  continue;
986  }
987  if (! empty($arrayfields[$key]['checked']))
988  {
989  if (! $balancefieldfound) $tmpnbfieldbeforebalance++;
990  else $tmpnbfieldafterbalance++;
991  }
992  }
993  // Extra fields
994  if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
995  {
996  foreach($extrafields->attribute_label as $key => $val)
997  {
998  if (! empty($arrayfields["ef.".$key]['checked']))
999  {
1000  if (! empty($arrayfields[$key]['checked']))
1001  {
1002  if (! $balancefieldfound) $tmpnbfieldbeforebalance++;
1003  else $tmpnbfieldafterbalance++;
1004  }
1005  }
1006  }
1007  }
1008 
1009  print '<tr class="oddeven trforbreak">';
1010  if ($tmpnbfieldbeforebalance)
1011  {
1012  print '<td colspan="'.$tmpnbfieldbeforebalance.'">';
1013  print '</td>';
1014  }
1015  print '<td align="right">';
1016  print price(price2num($balance, 'MT'), 1, $langs);
1017  print '</td>';
1018  print '<td colspan="'.($tmpnbfieldafterbalance+2).'">';
1019  print '</td>';
1020  print '</tr>';
1021  }
1022  }
1023 
1024  $balance = price2num($balance + ($sign * $objp->amount),'MT');
1025 
1026  if (empty($cachebankaccount[$objp->bankid]))
1027  {
1028  $bankaccounttmp = new Account($db);
1029  $bankaccounttmp->fetch($objp->bankid);
1030  $cachebankaccount[$objp->bankid]=$bankaccounttmp;
1031  $bankaccount = $bankaccounttmp;
1032  }
1033  else
1034  {
1035  $bankaccount = $cachebankaccount[$objp->bankid];
1036  }
1037 
1038  print '<tr class="oddeven">';
1039 
1040  // Ref
1041  if (! empty($arrayfields['b.rowid']['checked']))
1042  {
1043  print '<td align="left" class="nowrap">';
1044  print "<a href=\"ligne.php?rowid=".$objp->rowid.'">'.img_object($langs->trans("ShowPayment").': '.$objp->rowid, 'account', 'class="classfortooltip"').' '.$objp->rowid."</a> &nbsp; ";
1045  print '</td>';
1046  if (! $i) $totalarray['nbfield']++;
1047  }
1048 
1049  // Description
1050  if (! empty($arrayfields['description']['checked']))
1051  {
1052  print "<td>";
1053 
1054  //print "<a href=\"ligne.php?rowid=".$objp->rowid."&amp;account=".$objp->fk_account."\">";
1055  $reg=array();
1056  preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction
1057  if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);
1058  else print dol_trunc($objp->label,40);
1059  //print "</a>&nbsp;";
1060 
1061  // Add links after description
1062  $links = $bankaccountstatic->get_url($objp->rowid);
1063  $cachebankaccount=array();
1064  foreach($links as $key=>$val)
1065  {
1066  if ($links[$key]['type']=='payment')
1067  {
1068  $paymentstatic->id=$links[$key]['url_id'];
1069  $paymentstatic->ref=$links[$key]['url_id'];
1070  print ' '.$paymentstatic->getNomUrl(2);
1071  }
1072  elseif ($links[$key]['type']=='payment_supplier')
1073  {
1074  $paymentsupplierstatic->id=$links[$key]['url_id'];
1075  $paymentsupplierstatic->ref=$links[$key]['url_id'];
1076  print ' '.$paymentsupplierstatic->getNomUrl(2);
1077  }
1078  elseif ($links[$key]['type']=='payment_sc')
1079  {
1080  print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$links[$key]['url_id'].'">';
1081  print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
1082  //print $langs->trans("SocialContributionPayment");
1083  print '</a>';
1084  }
1085  elseif ($links[$key]['type']=='payment_vat')
1086  {
1087  $paymentvatstatic->id=$links[$key]['url_id'];
1088  $paymentvatstatic->ref=$links[$key]['url_id'];
1089  print ' '.$paymentvatstatic->getNomUrl(2);
1090  }
1091  elseif ($links[$key]['type']=='payment_salary')
1092  {
1093  $paymentsalstatic->id=$links[$key]['url_id'];
1094  $paymentsalstatic->ref=$links[$key]['url_id'];
1095  print ' '.$paymentsalstatic->getNomUrl(2);
1096  }
1097  elseif ($links[$key]['type']=='payment_loan')
1098  {
1099  print '<a href="'.DOL_URL_ROOT.'/loan/payment/card.php?id='.$links[$key]['url_id'].'">';
1100  print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
1101  print '</a>';
1102  }
1103  elseif ($links[$key]['type']=='payment_donation')
1104  {
1105  print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$links[$key]['url_id'].'">';
1106  print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
1107  print '</a>';
1108  }
1109  elseif ($links[$key]['type']=='payment_expensereport')
1110  {
1111  $paymentexpensereportstatic->id=$links[$key]['url_id'];
1112  $paymentexpensereportstatic->ref=$links[$key]['url_id'];
1113  print ' '.$paymentexpensereportstatic->getNomUrl(2);
1114  }
1115  elseif ($links[$key]['type']=='banktransfert')
1116  {
1117  // Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail.
1118  if ($objp->amount > 0)
1119  {
1120  $banklinestatic->fetch($links[$key]['url_id']);
1121  $bankstatic->id=$banklinestatic->fk_account;
1122  $bankstatic->label=$banklinestatic->bank_account_ref;
1123  print ' ('.$langs->trans("TransferFrom").' ';
1124  print $bankstatic->getNomUrl(1,'transactions');
1125  print ' '.$langs->trans("toward").' ';
1126  $bankstatic->id=$objp->bankid;
1127  $bankstatic->label=$objp->bankref;
1128  print $bankstatic->getNomUrl(1,'');
1129  print ')';
1130  }
1131  else
1132  {
1133  $bankstatic->id=$objp->bankid;
1134  $bankstatic->label=$objp->bankref;
1135  print ' ('.$langs->trans("TransferFrom").' ';
1136  print $bankstatic->getNomUrl(1,'');
1137  print ' '.$langs->trans("toward").' ';
1138  $banklinestatic->fetch($links[$key]['url_id']);
1139  $bankstatic->id=$banklinestatic->fk_account;
1140  $bankstatic->label=$banklinestatic->bank_account_ref;
1141  print $bankstatic->getNomUrl(1,'transactions');
1142  print ')';
1143  }
1144  //var_dump($links);
1145  }
1146  elseif ($links[$key]['type']=='company')
1147  {
1148 
1149  }
1150  elseif ($links[$key]['type']=='user')
1151  {
1152 
1153  }
1154  elseif ($links[$key]['type']=='member')
1155  {
1156 
1157  }
1158  elseif ($links[$key]['type']=='sc')
1159  {
1160 
1161  }
1162  else
1163  {
1164  // Show link with label $links[$key]['label']
1165  if (! empty($objp->label) && ! empty($links[$key]['label'])) print ' - ';
1166  print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
1167  if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg))
1168  {
1169  // Label generique car entre parentheses. On l'affiche en le traduisant
1170  if ($reg[1]=='paiement') $reg[1]='Payment';
1171  print ' '.$langs->trans($reg[1]);
1172  }
1173  else
1174  {
1175  print ' '.$links[$key]['label'];
1176  }
1177  print '</a>';
1178  }
1179  }
1180  print '</td>';
1181  if (! $i) $totalarray['nbfield']++;
1182  }
1183 
1184  // Date ope
1185  if (! empty($arrayfields['b.dateo']['checked']))
1186  {
1187  print '<td align="center" class="nowrap">';
1188  print '<span id="dateoperation_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->do),"day")."</span>";
1189  print '&nbsp;';
1190  print '<span class="inline-block">';
1191  print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=doprev&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
1192  print img_edit_remove() . "</a> ";
1193  print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=donext&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
1194  print img_edit_add() ."</a>";
1195  print '</span>';
1196  print "</td>\n";
1197  if (! $i) $totalarray['nbfield']++;
1198  }
1199 
1200  // Date value
1201  if (! empty($arrayfields['b.datev']['checked']))
1202  {
1203  print '<td align="center" class="nowrap">';
1204  print '<span id="datevalue_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->dv),"day")."</span>";
1205  print '&nbsp;';
1206  print '<span class="inline-block">';
1207  print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
1208  print img_edit_remove() . "</a> ";
1209  print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
1210  print img_edit_add() ."</a>";
1211  print '</span>';
1212  print "</td>\n";
1213  if (! $i) $totalarray['nbfield']++;
1214  }
1215 
1216  // Payment type
1217  if (! empty($arrayfields['type']['checked']))
1218  {
1219  print '<td align="center" class="nowrap">';
1220  $labeltype=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle','',1);
1221  if ($labeltype == 'SOLD') print '&nbsp;'; //$langs->trans("InitialBankBalance");
1222  else print $labeltype;
1223  print "</td>\n";
1224  if (! $i) $totalarray['nbfield']++;
1225  }
1226 
1227  // Num cheque
1228  if (! empty($arrayfields['b.num_chq']['checked']))
1229  {
1230  print '<td class="nowrap" align="center">'.($objp->num_chq?$objp->num_chq:"")."</td>\n";
1231  if (! $i) $totalarray['nbfield']++;
1232  }
1233 
1234  // Third party
1235  if (! empty($arrayfields['bu.label']['checked']))
1236  {
1237  print "<td>";
1238  if ($objp->url_id)
1239  {
1240  $companystatic->id=$objp->url_id;
1241  $companystatic->name=$objp->nom;
1242  $companystatic->name_alias=$objp->name_alias;
1243  $companystatic->client=$objp->client;
1244  $companystatic->fournisseur=$objp->fournisseur;
1245  $companystatic->code_client=$objp->code_client;
1246  $companystatic->code_fournisseur=$objp->code_fournisseur;
1247  $companystatic->code_compta=$objp->code_compta;
1248  $companystatic->code_compta_fournisseur=$objp->code_compta_fournisseur;
1249  print $companystatic->getNomUrl(1);
1250  }
1251  else
1252  {
1253  print '&nbsp;';
1254  }
1255  print '</td>';
1256  if (! $i) $totalarray['nbfield']++;
1257  }
1258 
1259  // Bank account
1260  if (! empty($arrayfields['ba.ref']['checked']))
1261  {
1262  print '<td align="right" class="nowrap">';
1263  print $bankaccount->getNomUrl(1);
1264  print "</td>\n";
1265  if (! $i) $totalarray['nbfield']++;
1266  }
1267 
1268  // Debit
1269  if (! empty($arrayfields['b.debit']['checked']))
1270  {
1271  print '<td align="right">';
1272  if ($objp->amount < 0)
1273  {
1274  print price($objp->amount * -1);
1275  $totalarray['totaldeb'] += $objp->amount;
1276  }
1277  print "</td>\n";
1278  if (! $i) $totalarray['nbfield']++;
1279  if (! $i) $totalarray['totaldebfield']=$totalarray['nbfield'];
1280  }
1281 
1282  // Credit
1283  if (! empty($arrayfields['b.credit']['checked']))
1284  {
1285  print '<td align="right">';
1286  if ($objp->amount > 0)
1287  {
1288  print price($objp->amount);
1289  $totalarray['totalcred'] += $objp->amount;
1290  }
1291  print "</td>\n";
1292  if (! $i) $totalarray['nbfield']++;
1293  if (! $i) $totalarray['totalcredfield']=$totalarray['nbfield'];
1294  }
1295 
1296  // Balance before
1297  if (! empty($arrayfields['balancebefore']['checked']))
1298  {
1299  if ($mode_balance_ok)
1300  {
1301  $balancebefore = price2num($balance - ($sign * $objp->amount),'MT');
1302  if ($balancebefore >= 0)
1303  {
1304  print '<td align="right" class="nowrap">&nbsp;'.price($balancebefore).'</td>';
1305  }
1306  else
1307  {
1308  print '<td align="right" class="error nowrap">&nbsp;'.price($balancebefore).'</td>';
1309  }
1310  }
1311  else
1312  {
1313  print '<td align="right">-</td>';
1314  }
1315  if (! $i) $totalarray['nbfield']++;
1316  }
1317  // Balance
1318  if (! empty($arrayfields['balance']['checked']))
1319  {
1320  if ($mode_balance_ok)
1321  {
1322  if ($balance >= 0)
1323  {
1324  print '<td align="right" class="nowrap">&nbsp;'.price($balance).'</td>';
1325  }
1326  else
1327  {
1328  print '<td align="right" class="error nowrap">&nbsp;'.price($balance).'</td>';
1329  }
1330  }
1331  else
1332  {
1333  print '<td align="right">-</td>';
1334  }
1335  if (! $i) $totalarray['nbfield']++;
1336  }
1337 
1338  if (! empty($arrayfields['b.num_releve']['checked']))
1339  {
1340  print '<td class="nowrap" align="center">';
1341  // Transaction reconciliated or edit link
1342  if ($bankaccount->canBeConciliated() > 0)
1343  {
1344  if ($objp->conciliated) // If line not conciliated and account can be conciliated
1345  {
1346  print '<a href="releve.php?num='.$objp->num_releve.'&amp;account='.$objp->bankid.'">'.$objp->num_releve.'</a>';
1347  }
1348  else if ($action == 'reconcile')
1349  {
1350  print '<input class="flat" name="rowid['.$objp->rowid.']" type="checkbox" value="'.$objp->rowid.'" size="1"'.(! empty($_POST['rowid'][$objp->rowid])?' checked':'').'>';
1351  }
1352  }
1353  print '</td>';
1354  if (! $i) $totalarray['nbfield']++;
1355  }
1356 
1357  if (! empty($arrayfields['b.conciliated']['checked']))
1358  {
1359  print '<td class="nowrap" align="center">';
1360  print $objp->conciliated?$langs->trans("Yes"):$langs->trans("No");
1361  print '</td>';
1362  if (! $i) $totalarray['nbfield']++;
1363  }
1364 
1365  // Action edit/delete
1366  print '<td class="nowrap" align="center">';
1367  // Transaction reconciliated or edit link
1368  if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) // If line not conciliated and account can be conciliated
1369  {
1370  print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$objp->bankid.'&amp;page='.$page.'">';
1371  print img_edit();
1372  print '</a>';
1373  }
1374  else
1375  {
1376  if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
1377  {
1378  print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$objp->bankid.'&amp;page='.$page.'">';
1379  print img_edit();
1380  print '</a>';
1381  }
1382  else
1383  {
1384  print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$objp->bankid.'&amp;page='.$page.'">';
1385  print img_view();
1386  print '</a>';
1387  }
1388  if ($bankaccount->canBeConciliated() > 0 && empty($objp->conciliated))
1389  {
1390  if ($db->jdate($objp->dv) < ($now - $conf->bank->rappro->warning_delay))
1391  {
1392  print ' '.img_warning($langs->trans("ReconciliationLate"));
1393  }
1394  }
1395  print '&nbsp;';
1396  if ($user->rights->banque->modifier)
1397  {
1398  print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&amp;rowid='.$objp->rowid.'&amp;id='.$objp->bankid.'&amp;page='.$page.'">';
1399  print img_delete();
1400  print '</a>';
1401  }
1402  }
1403  print '</td>';
1404  if (! $i) $totalarray['nbfield']++;
1405 
1406  // Action column
1407  print '<td class="nowrap" align="center">';
1408  if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1409  {
1410  $selected=0;
1411  if (in_array($obj->rowid, $arrayofselected)) $selected=1;
1412  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
1413  }
1414  print '</td>';
1415  if (! $i) $totalarray['nbfield']++;
1416 
1417  print "</tr>";
1418 
1419  $i++;
1420  }
1421 
1422  // Show total line
1423  if (isset($totalarray['totaldebfield']) || isset($totalarray['totalcredfield']))
1424  {
1425  print '<tr class="liste_total">';
1426  $i=0;
1427  while ($i < $totalarray['nbfield'])
1428  {
1429  $i++;
1430  if ($i == 1)
1431  {
1432  if ($num < $limit && empty($offset)) print '<td align="left">'.$langs->trans("Total").'</td>';
1433  else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
1434  }
1435  elseif ($totalarray['totaldebfield'] == $i) print '<td align="right">'.price(-1 * $totalarray['totaldeb']).'</td>';
1436  elseif ($totalarray['totalcredfield'] == $i) print '<td align="right">'.price($totalarray['totalcred']).'</td>';
1437  else print '<td></td>';
1438  }
1439  print '</tr>';
1440  }
1441 
1442  print "</table>";
1443  print "</div>";
1444 
1445  print '</form>';
1446  $db->free($resql);
1447 }
1448 else
1449 {
1450  dol_print_error($db);
1451 }
1452 
1453 // If no data to display after a search
1454 if ($_POST["action"] == "search" && ! $num)
1455 {
1456  print '<div class="opacitymedium">'.$langs->trans("NoRecordFound").'</div>';
1457 }
1458 
1459 llxFooter();
1460 
1461 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
Loan.
Definition: loan.class.php:30
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
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.
Class to manage salary payments.
if(!GETPOST('transkey')&&!GETPOST('transphrase')) else
View.
Definition: notice.php:43
bank_prepare_head(Account $object)
Prepare array with list of tabs.
Definition: bank.lib.php:34
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm=false, $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='')
Show tab header of a card.
if(GETPOST('cancel','alpha')) if(!GETPOST('confirmmassaction','alpha')&&$massaction!= 'presend'&&$massaction!= 'confirm_presend')
Draft customers invoices.
Definition: list.php:147
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
Class to manage Dolibarr users.
Definition: user.class.php:39
Class to manage bank transaction lines.
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.
static selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0, $moreparamonempty='', $disablebademail=0, $nohtmlescape=0)
Return a HTML select string, built from an array of key+value.
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.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
Class to manage third parties objects (customers, suppliers, prospects...)
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
dol_fiche_end($notab=0)
Show tab footer of a card.
Classe permettant la generation de composants html autre Only common components are here...
Class to manage payments of customer invoices.
Class to manage bank categories.
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Class to manage members of a foundation.
llxHeader()
Empty header.
Definition: wrapper.php:46
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
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...
dol_now($mode='gmt')
Return date for now.
img_delete($titlealt= 'default', $other= 'class="pictodelete"')
Show delete logo.
const TYPE_CASH
Cash account.
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).
img_edit_add($titlealt= 'default', $other= '')
Show logo +.
print
Draft customers invoices.
Definition: index.php:91
Class to manage donations.
Definition: don.class.php:35
Class to manage generation of HTML components for accounting management.
Class to manage payments of expense report.
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
img_view($titlealt= 'default', $float=0, $other= '')
Show logo view card.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="")
Show title line of an array.
Class to manage payments for supplier invoices.
Classe permettant la gestion des paiements des charges La tva collectee n'est calculee que sur les fa...
img_edit($titlealt= 'default', $float=0, $other= 'class="pictoedit"')
Show logo editer/modifier fiche.
price2num($amount, $rounding='', $alreadysqlnb=0)
Function that return a number with universal decimal format (decimal separator is '...
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
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.
img_edit_remove($titlealt= 'default', $other='')
Show logo -.