dolibarr  16.0.5
list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2011-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
6  * Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
7  * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  */
22 
29 require '../../main.inc.php';
30 
31 require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
36 require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
37 
38 // Load translation files required by the page
39 $langs->loadLangs(array('compta', 'bills'));
40 
41 $action = GETPOST('action', 'alpha');
42 $massaction = GETPOST('massaction', 'alpha');
43 $confirm = GETPOST('confirm', 'alpha');
44 $optioncss = GETPOST('optioncss', 'alpha');
45 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'salestaxeslist';
46 
47 $search_ref = GETPOST('search_ref', 'alpha');
48 $search_label = GETPOST('search_label', 'alpha');
49 $search_dateend_start = dol_mktime(0, 0, 0, GETPOST('search_dateend_startmonth', 'int'), GETPOST('search_dateend_startday', 'int'), GETPOST('search_dateend_startyear', 'int'));
50 $search_dateend_end = dol_mktime(23, 59, 59, GETPOST('search_dateend_endmonth', 'int'), GETPOST('search_dateend_endday', 'int'), GETPOST('search_dateend_endyear', 'int'));
51 $search_datepayment_start = dol_mktime(0, 0, 0, GETPOST('search_datepayment_startmonth', 'int'), GETPOST('search_datepayment_startday', 'int'), GETPOST('search_datepayment_startyear', 'int'));
52 $search_datepayment_end = dol_mktime(23, 59, 59, GETPOST('search_datepayment_endmonth', 'int'), GETPOST('search_datepayment_endday', 'int'), GETPOST('search_datepayment_endyear', 'int'));
53 $search_type = GETPOST('search_type', 'int');
54 $search_account = GETPOST('search_account', 'int');
55 $search_amount = GETPOST('search_amount', 'alpha');
56 $search_status = GETPOST('search_status', 'int');
57 
58 $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
59 $sortfield = GETPOST('sortfield', 'aZ09comma');
60 $sortorder = GETPOST('sortorder', 'aZ09comma');
61 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST('page', 'int');
62 
63 if (empty($page) || $page == -1) {
64  $page = 0; // If $page is not defined, or '' or -1
65 }
66 $offset = $limit * $page;
67 $pageprev = $page - 1;
68 $pagenext = $page + 1;
69 
70 if (!$sortfield) {
71  $sortfield = 't.datev';
72 }
73 if (!$sortorder) {
74  $sortorder = 'DESC';
75 }
76 
77 $arrayfields = array(
78  't.rowid' =>array('checked'=>1, 'position'=>10, 'label'=>"Ref",),
79  't.label' =>array('checked'=>1, 'position'=>20, 'label'=>"Label"),
80  't.datev' =>array('checked'=>1, 'position'=>30, 'label'=>"PeriodEndDate"),
81  't.fk_typepayment' =>array('checked'=>1, 'position'=>50, 'label'=>"DefaultPaymentMode"),
82  't.amount' =>array('checked'=>1, 'position'=>90, 'label'=>"Amount"),
83  't.status' =>array('checked'=>1, 'position'=>90, 'label'=>"Status"),
84 );
85 
86 if (isModEnabled('banque')) {
87  $arrayfields['t.fk_account'] = array('checked'=>1, 'position'=>60, 'label'=>"DefaultBankAccount");
88 }
89 
90 $arrayfields = dol_sort_array($arrayfields, 'position');
91 
92 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
93 $hookmanager->initHooks(array('salestaxeslist'));
94 $object = new Tva($db);
95 
96 // Security check
97 $socid = GETPOST('socid', 'int');
98 if ($user->socid) {
99  $socid = $user->socid;
100 }
101 $result = restrictedArea($user, 'tax', '', 'tva', 'charges');
102 
103 
104 /*
105  * Actions
106  */
107 
108 $parameters = array('socid'=>$socid);
109 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
110 if ($reshook < 0) {
111  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
112 }
113 
114 
115 if (empty($reshook)) {
116  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
117 
118  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // Both test are required to be compatible with all browsers
119  $search_ref = '';
120  $search_label = '';
121  $search_dateend_start = '';
122  $search_dateend_end = '';
123  $search_datepayment_start = '';
124  $search_datepayment_end = '';
125  $search_type = '';
126  $search_account = '';
127  $search_amount = '';
128  $search_status = '';
129  }
130 }
131 
132 
133 /*
134  * View
135  */
136 
137 $form = new Form($db);
138 $formother = new FormOther($db);
139 $formfile = new FormFile($db);
140 $tva_static = new Tva($db);
141 $bankstatic = new Account($db);
142 $accountingjournal = new AccountingJournal($db);
143 $bankline = new AccountLine($db);
144 
145 llxHeader('', $langs->trans("VATDeclarations"));
146 
147 $sql = 'SELECT t.rowid, t.amount, t.label, t.datev, t.datep, t.paye, t.fk_typepayment as type, t.fk_account,';
148 $sql.= ' ba.label as blabel, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,';
149 $sql.= ' t.num_payment, pst.code as payment_code,';
150 $sql .= ' SUM(ptva.amount) as alreadypayed';
151 $sql .= ' FROM '.MAIN_DB_PREFIX.'tva as t';
152 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pst ON (t.fk_typepayment = pst.id)';
153 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON (t.fk_account = ba.rowid)';
154 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_vat as ptva ON (ptva.fk_tva = t.rowid)";
155 $sql .= ' WHERE t.entity IN ('.getEntity($object->element).')';
156 
157 if (!empty($search_ref)) {
158  $sql .= natural_search('t.rowid', $search_ref);
159 }
160 if (!empty($search_label)) {
161  $sql .= natural_search('t.label', $search_label);
162 }
163 if (!empty($search_dateend_start)) {
164  $sql .= " AND t.datev >= '".$db->idate($search_dateend_start)."'";
165 }
166 if (!empty($search_dateend_end)) {
167  $sql .= " AND t.datev <= '".$db->idate($search_dateend_end)."'";
168 }
169 if (!empty($search_datepayment_start)) {
170  $sql .= " AND t.datep >= '".$db->idate($search_datepayment_start)."'";
171 }
172 if (!empty($search_datepayment_end)) {
173  $sql .= " AND t.datep <= '".$db->idate($search_datepayment_end)."'";
174 }
175 if (!empty($search_type) && $search_type > 0) {
176  $sql .= ' AND t.fk_typepayment = '.((int) $search_type);
177 }
178 if (!empty($search_account) && $search_account > 0) {
179  $sql .= ' AND t.fk_account = '.((int) $search_account);
180 }
181 if (!empty($search_amount)) {
182  $sql .= natural_search('t.amount', price2num(trim($search_amount)), 1);
183 }
184 if ($search_status != '' && $search_status >= 0) {
185  $sql .= " AND t.paye = ".((int) $search_status);
186 }
187 
188 $sql .= " GROUP BY t.rowid, t.amount, t.label, t.datev, t.datep, t.paye, t.fk_typepayment, t.fk_account, ba.label, ba.ref, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos, t.num_payment, pst.code";
189 $sql .= $db->order($sortfield, $sortorder);
190 
191 $nbtotalofrecords = '';
192 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
193  $resql = $db->query($sql);
194  $nbtotalofrecords = $db->num_rows($resql);
195 
196  // if total resultset is smaller then paging size (filtering), goto and load page 0
197  if (($page * $limit) > $nbtotalofrecords) {
198  $page = 0;
199  $offset = 0;
200  }
201 }
202 
203 $sql .= $db->plimit($limit + 1, $offset);
204 
205 $resql = $db->query($sql);
206 if (!$resql) {
207  dol_print_error($db);
208  llxFooter();
209  $db->close();
210  exit;
211 }
212 
213 $num = $db->num_rows($resql);
214 
215 $param = '';
216 if (!empty($contextpage) && $contextpage != $_SERVER['PHP_SELF']) {
217  $param .= '&contextpage='.$contextpage;
218 }
219 if ($limit > 0 && $limit != $conf->liste_limit) {
220  $param .= '&limit='.$limit;
221 }
222 if ($optioncss != '') {
223  $param .= '&optioncss='.urlencode($optioncss);
224 }
225 
226 if (!empty($search_ref)) {
227  $param .= '&search_ref="'.$search_ref.'"';
228 }
229 if (!empty($search_label)) {
230  $param .= '&search_label="'.$search_label.'"';
231 }
232 if (!empty($search_dateend_start)) {
233  $param .= '&search_dateend_startyear='.GETPOST('search_dateend_startyear', 'int');
234 }
235 if (!empty($search_dateend_start)) {
236  $param .= '&search_dateend_startmonth='.GETPOST('search_dateend_startmonth', 'int');
237 }
238 if (!empty($search_dateend_start)) {
239  $param .= '&search_dateend_startday='.GETPOST('search_dateend_startday', 'int');
240 }
241 if (!empty($search_dateend_end)) {
242  $param .= '&search_dateend_endyear='.GETPOST('search_dateend_endyear', 'int');
243 }
244 if (!empty($search_dateend_end)) {
245  $param .= '&search_dateend_endmonth='.GETPOST('search_dateend_endmonth', 'int');
246 }
247 if (!empty($search_dateend_end)) {
248  $param .= '&search_dateend_endday='.GETPOST('search_dateend_endday', 'int');
249 }
250 if (!empty($search_datepayment_start)) {
251  $param .= '&search_datepayment_startyear='.GETPOST('search_datepayment_startyear', 'int');
252 }
253 if (!empty($search_datepayment_start)) {
254  $param .= '&search_datepayment_startmonth='.GETPOST('search_datepayment_startmonth', 'int');
255 }
256 if (!empty($search_datepayment_start)) {
257  $param .= '&search_datepayment_startday='.GETPOST('search_datepayment_startday', 'int');
258 }
259 if (!empty($search_datepayment_end)) {
260  $param .= '&search_datepayment_endyear='.GETPOST('search_datepayment_endyear', 'int');
261 }
262 if (!empty($search_datepayment_end)) {
263  $param .= '&search_datepayment_endmonth='.GETPOST('search_datepayment_endmonth', 'int');
264 }
265 if (!empty($search_datepayment_end)) {
266  $param .= '&search_datepayment_endday='.GETPOST('search_datepayment_endday', 'int');
267 }
268 if (!empty($search_type) && $search_type > 0) {
269  $param .= '&search_type='.$search_type;
270 }
271 if (!empty($search_account) && $search_account > 0) {
272  $param .= '&search_account='.$search_account;
273 }
274 if (!empty($search_amount)) {
275  $param .= '&search_amount="'.$search_amount.'"';
276 }
277 if ($search_status != '' && $search_status != '-1') {
278  $param .= '&search_status='.urlencode($search_status);
279 }
280 
281 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
282 if ($optioncss != '') {
283  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
284 }
285 print '<input type="hidden" name="token" value="'.newToken().'">';
286 print '<input type="hidden" name="action" value="list">';
287 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
288 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
289 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
290 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
291 
292 $url = DOL_URL_ROOT.'/compta/tva/card.php?action=create';
293 if (!empty($socid)) {
294  $url .= '&socid='.$socid;
295 }
296 $newcardbutton = dolGetButtonTitle($langs->trans('NewVATPayment', ($ltt + 1)), '', 'fa fa-plus-circle', $url, '', $user->rights->tax->charges->creer);
297 print_barre_liste($langs->trans("VATDeclarations"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
298 
299 $varpage = empty($contextpage) ? $_SERVER['PHP_SELF'] : $contextpage;
300 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
301 if ($massactionbutton) {
302  $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
303 }
304 
305 print '<div class="div-table-responsive">';
306 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : '').'">';
307 
308 print '<tr class="liste_titre_filter">';
309 
310 // Filters: Lines (placeholder)
311 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
312  print '<td class="liste_titre">';
313  print '</td>';
314 }
315 
316 // Filter: Ref
317 if (!empty($arrayfields['t.rowid']['checked'])) {
318  print '<td class="liste_titre">';
319  print '<input type="text" class="flat" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
320  print '</td>';
321 }
322 
323 // Filter: Label
324 if (!empty($arrayfields['t.label']['checked'])) {
325  print '<td class="liste_titre">';
326  print '<input type="text" class="flat" size="10" name="search_label" value="'.dol_escape_htmltag($search_label).'">';
327  print '</td>';
328 }
329 
330 // Filter: Date end period
331 if (!empty($arrayfields['t.datev']['checked'])) {
332  print '<td class="liste_titre center">';
333  print '<div class="nowrap">';
334  print $form->selectDate($search_dateend_start ? $search_dateend_start : -1, 'search_dateend_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
335  print '</div>';
336  print '<div class="nowrap">';
337  print $form->selectDate($search_dateend_end ? $search_dateend_end : -1, 'search_dateend_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
338  print '</div>';
339  print '</td>';
340 }
341 
342 // Filter: Date payment
343 /*if (!empty($arrayfields['t.datep']['checked'])) {
344  print '<td class="liste_titre center">';
345  print '<div class="nowrap">';
346  print $form->selectDate($search_datepayment_start ? $search_datepayment_start : -1, 'search_datepayment_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
347  print '</div>';
348  print '<div class="nowrap">';
349  print $form->selectDate($search_datepayment_end ? $search_datepayment_end : -1, 'search_datepayment_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
350  print '</div>';
351  print '</td>';
352 }*/
353 
354 // Filter: Type
355 if (!empty($arrayfields['t.fk_typepayment']['checked'])) {
356  print '<td class="liste_titre left">';
357  $form->select_types_paiements($search_type, 'search_type', '', 0, 1, 1, 16);
358  print '</td>';
359 }
360 
361 // Filter: Bank Account
362 if (!empty($arrayfields['t.fk_account']['checked'])) {
363  print '<td class="liste_titre left">';
364  $form->select_comptes($search_account, 'search_account', 0, '', 1);
365  print '</td>';
366 }
367 
368 // Filter: Amount
369 if (!empty($arrayfields['t.amount']['checked'])) {
370  print '<td class="liste_titre right">';
371  print '<input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'">';
372  print '</td>';
373 }
374 
375 // Status
376 if (!empty($arrayfields['t.status']['checked'])) {
377  print '<td class="liste_titre maxwidthonsmartphone right">';
378  $liststatus = array('0' => $langs->trans("Unpaid"), '1' => $langs->trans("Paid"));
379  print $form->selectarray('search_status', $liststatus, $search_status, 1);
380  print '</td>';
381 }
382 
383 // Fields from hook
384 $parameters = array('arrayfields'=>$arrayfields);
385 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
386 print $hookmanager->resPrint;
387 
388 // Filter: Buttons
389 print '<td class="liste_titre maxwidthsearch">';
390 print $form->showFilterAndCheckAddButtons(0);
391 print '</td>';
392 
393 print '</tr>';
394 
395 print '<tr class="liste_titre">';
396 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
397  print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
398 }
399 if (!empty($arrayfields['t.rowid']['checked'])) {
400  print_liste_field_titre($arrayfields['t.rowid']['label'], $_SERVER['PHP_SELF'], 't.rowid', '', $param, '', $sortfield, $sortorder);
401 }
402 if (!empty($arrayfields['t.label']['checked'])) {
403  print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER['PHP_SELF'], 't.label', '', $param, 'align="left"', $sortfield, $sortorder);
404 }
405 if (!empty($arrayfields['t.datev']['checked'])) {
406  print_liste_field_titre($arrayfields['t.datev']['label'], $_SERVER['PHP_SELF'], 't.datev', '', $param, 'align="center"', $sortfield, $sortorder);
407 }
408 if (!empty($arrayfields['t.fk_typepayment']['checked'])) {
409  print_liste_field_titre($arrayfields['t.fk_typepayment']['label'], $_SERVER['PHP_SELF'], 't.fk_typepayment', '', $param, '', $sortfield, $sortorder, 'left ');
410 }
411 if (!empty($arrayfields['t.fk_account']['checked'])) {
412  print_liste_field_titre($arrayfields['t.fk_account']['label'], $_SERVER['PHP_SELF'], 't.fk_account', '', $param, '', $sortfield, $sortorder, 'left ');
413 }
414 if (!empty($arrayfields['t.amount']['checked'])) {
415  print_liste_field_titre($arrayfields['t.amount']['label'], $_SERVER['PHP_SELF'], 't.amount', '', $param, '', $sortfield, $sortorder, 'right ');
416 }
417 if (!empty($arrayfields['t.status']['checked'])) {
418  print_liste_field_titre($arrayfields['t.status']['label'], $_SERVER["PHP_SELF"], "t.paye", "", $param, 'class="right"', $sortfield, $sortorder);
419 }
420 
421 // Hook fields
422 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
423 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
424 print $hookmanager->resPrint;
425 
426 print_liste_field_titre($selectedfields, $_SERVER['PHP_SELF'], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
427 print '</tr>';
428 
429 $i = 0;
430 $totalarray = array();
431 while ($i < min($num, $limit)) {
432  $obj = $db->fetch_object($resql);
433 
434  $tva_static->id = $obj->rowid;
435  $tva_static->ref = $obj->rowid;
436  $tva_static->label = $obj->label;
437 
438  print '<tr class="oddeven">';
439 
440  // No
441  if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
442  print '<td>'.(($offset * $limit) + $i).'</td>';
443  if (!$i) {
444  $totalarray['nbfield']++;
445  }
446  }
447 
448  // Ref
449  if (!empty($arrayfields['t.rowid']['checked'])) {
450  print '<td>';
451  print $tva_static->getNomUrl(1);
452  $filename = dol_sanitizeFileName($tva_static->ref);
453  $filedir = $conf->tax->dir_output.'/vat/'.dol_sanitizeFileName($tva_static->ref);
454  $urlsource = $_SERVER['PHP_SELF'].'?id='.$tva_static->id;
455  print $formfile->getDocumentsLink($tva_static->element, $filename, $filedir, '', 'valignmiddle paddingleft2imp');
456  print '</td>';
457  if (!$i) {
458  $totalarray['nbfield']++;
459  }
460  }
461 
462  // Label
463  if (!empty($arrayfields['t.label']['checked'])) {
464  print '<td>'.dol_trunc($obj->label, 40).'</td>';
465  if (!$i) {
466  $totalarray['nbfield']++;
467  }
468  }
469 
470  // Date end period
471  if (!empty($arrayfields['t.datev']['checked'])) {
472  print '<td class="center">'.dol_print_date($db->jdate($obj->datev), 'day').'</td>';
473  if (!$i) {
474  $totalarray['nbfield']++;
475  }
476  }
477 
478  // Date payment
479  /*if (!empty($arrayfields['t.datep']['checked'])) {
480  print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day').'</td>';
481  if (!$i) $totalarray['nbfield']++;
482  }*/
483 
484  // Type
485  if (!empty($arrayfields['t.fk_typepayment']['checked'])) {
486  print '<td>';
487  if (!empty($obj->payment_code)) print $langs->trans("PaymentTypeShort".$obj->payment_code);
488  print '</td>';
489  if (!$i) {
490  $totalarray['nbfield']++;
491  }
492  }
493 
494  // Account
495  if (!empty($arrayfields['t.fk_account']['checked'])) {
496  print '<td>';
497  if ($obj->fk_account > 0) {
498  $bankstatic->id = $obj->fk_account;
499  $bankstatic->ref = $obj->bref;
500  $bankstatic->number = $obj->bnumber;
501  $bankstatic->iban = $obj->iban;
502  $bankstatic->bic = $obj->bic;
503  $bankstatic->currency_code = $langs->trans("Currency".$obj->currency_code);
504  $bankstatic->account_number = $obj->account_number;
505  $bankstatic->clos = $obj->clos;
506 
507  //$accountingjournal->fetch($obj->fk_accountancy_journal);
508  //$bankstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
509 
510  $bankstatic->label = $obj->blabel;
511  print $bankstatic->getNomUrl(1);
512  }
513  print '</td>';
514  if (!$i) $totalarray['nbfield']++;
515  }
516 
517  // Amount
518  if (!empty($arrayfields['t.amount']['checked'])) {
519  $total = $total + $obj->amount;
520  print '<td class="nowrap right"><span class="amount">' . price($obj->amount) . '</span></td>';
521  if (!$i) {
522  $totalarray['nbfield']++;
523  }
524  $totalarray['pos'][$totalarray['nbfield']] = 'amount';
525  $totalarray['val']['amount'] += $obj->amount;
526  }
527 
528  if (!empty($arrayfields['t.status']['checked'])) {
529  print '<td class="nowrap right">' . $tva_static->LibStatut($obj->paye, 5, $obj->alreadypayed) . '</td>';
530  if (!$i) {
531  $totalarray['nbfield']++;
532  }
533  if (!empty($arrayfields['t.amount']['checked'])) {
534  $totalarray['pos'][$totalarray['nbfield']] = '';
535  }
536  }
537 
538  // Buttons
539  print '<td></td>';
540 
541  print '</tr>';
542 
543  $i++;
544 }
545 
546 // Add a buttons placeholder for the total line
547 $totalarray['nbfield']++;
548 
549 // Show total line
550 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
551 
552 // If no record found
553 if ($num == 0) {
554  $colspan = 1;
555  foreach ($arrayfields as $key => $val) {
556  if (!empty($val['checked'])) {
557  $colspan++;
558  }
559  }
560  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
561 }
562 
563 $db->free($resql);
564 
565 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
566 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
567 print $hookmanager->resPrint;
568 
569 print '</table>'."\n";
570 print '</div>'."\n";
571 
572 print '</form>'."\n";
573 
574 // End of page
575 llxFooter();
576 $db->close();
dol_sanitizeFileName
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
Definition: functions.lib.php:1212
restrictedArea
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
Definition: security.lib.php:234
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4830
dol_sort_array
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
Definition: functions.lib.php:8371
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
FormOther
Classe permettant la generation de composants html autre Only common components are here.
Definition: html.formother.class.php:39
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5647
FormFile
Class to offer components to list and upload files.
Definition: html.formfile.class.php:36
AccountingJournal
Class to manage accounting accounts.
Definition: accountingjournal.class.php:27
dolGetButtonTitle
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
Definition: functions.lib.php:10591
print_barre_liste
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
Definition: functions.lib.php:5243
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:105
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:386
print_liste_field_titre
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Definition: functions.lib.php:5012
natural_search
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
Definition: functions.lib.php:9406
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
AccountLine
Class to manage bank transaction lines.
Definition: account.class.php:1757
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:742
price
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.
Definition: functions.lib.php:5527
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8123
dol_mktime
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
Definition: functions.lib.php:2743
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59
Account
Class to manage bank accounts.
Definition: account.class.php:38
Tva
Put here description of your class.
Definition: tva.class.php:35