dolibarr  18.0.0-alpha
create.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2010-2020 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
6  * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
7  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
8  * Copyright (C) 2019 Markus Welters <markus@welters.de>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <https://www.gnu.org/licenses/>.
22  */
23 
30 // Load Dolibarr environment
31 require '../../main.inc.php';
32 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
38 require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
39 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
40 
41 // Load translation files required by the page
42 $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies', 'bills'));
43 
44 $type = GETPOST('type', 'aZ09');
45 
46 // Get supervariables
47 $action = GETPOST('action', 'aZ09');
48 $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
49 $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
50 
51 $mode = GETPOST('mode', 'alpha') ?GETPOST('mode', 'alpha') : 'real';
52 $format = GETPOST('format', 'aZ09');
53 $id_bankaccount = GETPOST('id_bankaccount', 'int');
54 $executiondate = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
55 
56 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
57 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
58 if (empty($page) || $page == -1) {
59  $page = 0;
60 } // If $page is not defined, or '' or -1
61 $offset = $limit * $page;
62 
63 $hookmanager->initHooks(array('directdebitcreatecard', 'globalcard'));
64 
65 // Security check
66 $socid = GETPOST('socid', 'int');
67 if ($user->socid) {
68  $socid = $user->socid;
69 }
70 if ($type == 'bank-transfer') {
71  $result = restrictedArea($user, 'paymentbybanktransfer', '', '', '');
72 } else {
73  $result = restrictedArea($user, 'prelevement', '', '', 'bons');
74 }
75 
76 $error = 0;
77 $option = "";
78 $mesg = '';
79 
80 
81 /*
82  * Actions
83  */
84 
85 if (GETPOST('cancel', 'alpha')) {
86  $massaction = '';
87 }
88 
89 $parameters = array('mode' => $mode, 'format' => $format, 'limit' => $limit, 'page' => $page, 'offset' => $offset);
90 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
91 if ($reshook < 0) {
92  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
93 }
94 
95 if (empty($reshook)) {
96  // Change customer bank information to withdraw
97  if ($action == 'modify') {
98  for ($i = 1; $i < 9; $i++) {
99  dolibarr_set_const($db, GETPOST("nom$i"), GETPOST("value$i"), 'chaine', 0, '', $conf->entity);
100  }
101  }
102  if ($action == 'create') {
103  $default_account = ($type == 'bank-transfer' ? 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT' : 'PRELEVEMENT_ID_BANKACCOUNT');
104 
105  //var_dump($default_account);var_dump($conf->global->$default_account);var_dump($id_bankaccount);exit;
106 
107  if ($id_bankaccount != $conf->global->$default_account) {
108  $res = dolibarr_set_const($db, $default_account, $id_bankaccount, 'chaine', 0, '', $conf->entity); // Set as default
109  }
110 
111  require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
112  $bank = new Account($db);
113  $bank->fetch($conf->global->{$default_account});
114  // ICS is not mandatory with payment by bank transfer
115  /*if ((empty($bank->ics) && $type !== 'bank-transfer')
116  || (empty($bank->ics_transfer) && $type === 'bank-transfer')
117  ) {*/
118  if (empty($bank->ics) && $type !== 'bank-transfer') {
119  $errormessage = str_replace('{url}', $bank->getNomUrl(1, '', '', -1, 1), $langs->trans("ErrorICSmissing", '{url}'));
120  setEventMessages($errormessage, null, 'errors');
121  $action = '';
122  $error++;
123  }
124 
125 
126  $bprev = new BonPrelevement($db);
127 
128  if (!$error) {
129  // $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty (we don't use them anymore)
130  $result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate, 0, $type);
131  if ($result < 0) {
132  setEventMessages($bprev->error, $bprev->errors, 'errors');
133  } elseif ($result == 0) {
134  $mesg = $langs->trans("NoInvoiceCouldBeWithdrawed", $format);
135  setEventMessages($mesg, null, 'errors');
136  $mesg .= '<br>'."\n";
137  foreach ($bprev->invoice_in_error as $key => $val) {
138  $mesg .= '<span class="warning">'.$val."</span><br>\n";
139  }
140  } else {
141  if ($type != 'bank-transfer') {
142  $texttoshow = $langs->trans("DirectDebitOrderCreated", '{s}');
143  $texttoshow = str_replace('{s}', $bprev->getNomUrl(1), $texttoshow);
144  setEventMessages($texttoshow, null);
145  } else {
146  $texttoshow = $langs->trans("CreditTransferOrderCreated", '{s}');
147  $texttoshow = str_replace('{s}', $bprev->getNomUrl(1), $texttoshow);
148  setEventMessages($texttoshow, null);
149  }
150 
151  header("Location: ".DOL_URL_ROOT.'/compta/prelevement/card.php?id='.urlencode($bprev->id).'&type='.urlencode($type));
152  exit;
153  }
154  }
155  }
156  $objectclass = "BonPrelevement";
157  if ($type == 'bank-transfer') {
158  $uploaddir = $conf->paymentbybanktransfer->dir_output;
159  } else {
160  $uploaddir = $conf->prelevement->dir_output;
161  }
162  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
163 }
164 
165 
166 /*
167  * View
168  */
169 
170 $form = new Form($db);
171 
172 $thirdpartystatic = new Societe($db);
173 if ($type != 'bank-transfer') {
174  $invoicestatic = new Facture($db);
175 } else {
176  $invoicestatic = new FactureFournisseur($db);
177 }
178 $bprev = new BonPrelevement($db);
179 $arrayofselected = is_array($toselect) ? $toselect : array();
180 // List of mass actions available
181 $arrayofmassactions = array(
182 );
183 if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
184  $arrayofmassactions = array();
185 }
186 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
187 
188 llxHeader('', $langs->trans("NewStandingOrder"));
189 
190 if (prelevement_check_config($type) < 0) {
191  $langs->load("errors");
192  $modulenametoshow = "Withdraw";
193  if ($type == 'bank-transfer') {
194  $modulenametoshow = "PaymentByBankTransfer";
195  }
196  setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv($modulenametoshow)), null, 'errors');
197 }
198 
199 
200 /*$h=0;
201 $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/create.php';
202 $head[$h][1] = $langs->trans("NewStandingOrder");
203 $head[$h][2] = 'payment';
204 $hselected = 'payment';
205 $h++;
206 
207 print dol_get_fiche_head($head, $hselected, $langs->trans("StandingOrders"), 0, 'payment');
208 */
209 
210 $title = $langs->trans("NewStandingOrder");
211 if ($type == 'bank-transfer') {
212  $title = $langs->trans("NewPaymentByBankTransfer");
213 }
214 
215 print load_fiche_titre($title);
216 
217 print dol_get_fiche_head();
218 
219 $nb = $bprev->nbOfInvoiceToPay($type);
220 $pricetowithdraw = $bprev->SommeAPrelever($type);
221 if ($nb < 0) {
222  dol_print_error($bprev->error);
223 }
224 print '<table class="border centpercent tableforfield">';
225 
226 $title = $langs->trans("NbOfInvoiceToWithdraw");
227 if ($type == 'bank-transfer') {
228  $title = $langs->trans("NbOfInvoiceToPayByBankTransfer");
229 }
230 
231 print '<tr><td class="titlefield">'.$title.'</td>';
232 print '<td class="nowraponall">';
233 print dol_escape_htmltag($nb);
234 print '</td></tr>';
235 
236 print '<tr><td>'.$langs->trans("AmountTotal").'</td>';
237 print '<td class="amount nowraponall">';
238 print price($pricetowithdraw, 0, $langs, 1, -1, -1, $conf->currency);
239 print '</td>';
240 print '</tr>';
241 
242 print '</table>';
243 print '</div>';
244 
245 if ($mesg) {
246  print $mesg;
247 }
248 
249 print '<div class="tabsAction">'."\n";
250 
251 print '<form action="'.$_SERVER['PHP_SELF'].'?action=create" method="POST">';
252 print '<input type="hidden" name="token" value="'.newToken().'">';
253 print '<input type="hidden" name="type" value="'.$type.'">';
254 if ($nb) {
255  if ($pricetowithdraw) {
256  $title = $langs->trans('BankToReceiveWithdraw').': ';
257  if ($type == 'bank-transfer') {
258  $title = $langs->trans('BankToPayCreditTransfer').': ';
259  }
260  print '<span class="hideonsmartphone">'.$title.'</span>';
261  print img_picto('', 'bank_account');
262 
263  $default_account = ($type == 'bank-transfer' ? 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT' : 'PRELEVEMENT_ID_BANKACCOUNT');
264 
265  print $form->select_comptes(getDolGlobalInt($default_account), 'id_bankaccount', 0, "courant=1", 0, '', 0, 'widthcentpercentminusx maxwidth300', 1);
266  print ' &nbsp; &nbsp; ';
267 
268  if (empty($executiondate)) {
269  $delayindays = 0;
270  if ($type != 'bank-transfer') {
271  $delayindays = getDolGlobalInt('PRELEVEMENT_ADDDAYS');
272  } else {
273  $delayindays = getDolGlobalInt('PAYMENTBYBANKTRANSFER_ADDDAYS');
274  }
275 
276  $executiondate = dol_time_plus_duree(dol_now(), $delayindays, 'd');
277  }
278 
279  print $langs->trans('ExecutionDate').' ';
280  $datere = $executiondate;
281  print $form->selectDate($datere, 're');
282 
283 
284  if ($mysoc->isInEEC()) {
285  $title = $langs->trans("CreateForSepa");
286  if ($type == 'bank-transfer') {
287  $title = $langs->trans("CreateSepaFileForPaymentByBankTransfer");
288  }
289 
290  if ($type != 'bank-transfer') {
291  print '<select name="format">';
292  print '<option value="FRST"'.($format == 'FRST' ? ' selected="selected"' : '').'>'.$langs->trans('SEPAFRST').'</option>';
293  print '<option value="RCUR"'.($format == 'RCUR' ? ' selected="selected"' : '').'>'.$langs->trans('SEPARCUR').'</option>';
294  print '</select>';
295  }
296  print '<input type="submit" class="butAction margintoponly maringbottomonly" value="'.$title.'"/>';
297  } else {
298  $title = $langs->trans("CreateAll");
299  if ($type == 'bank-transfer') {
300  $title = $langs->trans("CreateFileForPaymentByBankTransfer");
301  }
302  print '<input type="hidden" name="format" value="ALL">'."\n";
303  print '<input type="submit" class="butAction margintoponly maringbottomonly" value="'.$title.'">'."\n";
304  }
305  } else {
306  if ($mysoc->isInEEC()) {
307  $title = $langs->trans("CreateForSepaFRST");
308  if ($type == 'bank-transfer') {
309  $title = $langs->trans("CreateSepaFileForPaymentByBankTransfer");
310  }
311  print '<a class="butActionRefused classfortooltip margintoponly maringbottomonly" href="#" title="'.$langs->trans("AmountMustBePositive").'">'.$title."</a>\n";
312 
313  if ($type != 'bank-transfer') {
314  $title = $langs->trans("CreateForSepaRCUR");
315  print '<a class="butActionRefused classfortooltip margintoponly maringbottomonly" href="#" title="'.$langs->trans("AmountMustBePositive").'">'.$title."</a>\n";
316  }
317  } else {
318  $title = $langs->trans("CreateAll");
319  if ($type == 'bank-transfer') {
320  $title = $langs->trans("CreateFileForPaymentByBankTransfer");
321  }
322  print '<a class="butActionRefused classfortooltip margintoponly maringbottomonly" href="#">'.$title."</a>\n";
323  }
324  }
325 } else {
326  $titlefortab = $langs->transnoentitiesnoconv("StandingOrders");
327  $title = $langs->trans("CreateAll");
328  if ($type == 'bank-transfer') {
329  $titlefortab = $langs->transnoentitiesnoconv("PaymentByBankTransfers");
330  $title = $langs->trans("CreateFileForPaymentByBankTransfer");
331  }
332  print '<a class="butActionRefused classfortooltip margintoponly maringbottomonly" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoInvoiceToWithdraw", $titlefortab, $titlefortab)).'">';
333  print $title;
334  print "</a>\n";
335 }
336 
337 print "</form>\n";
338 
339 print "</div>\n";
340 print '</form>';
341 print '<br>';
342 
343 
344 /*
345  * Invoices waiting for withdraw
346  */
347 
348 $sql = "SELECT f.ref, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,";
349 if ($type == 'bank-transfer') {
350  $sql .= " f.ref_supplier,";
351 }
352 $sql .= " pfd.rowid as request_row_id, pfd.date_demande, pfd.amount";
353 if ($type == 'bank-transfer') {
354  $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
355 } else {
356  $sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
357 }
358 $sql .= " ".MAIN_DB_PREFIX."societe as s,";
359 $sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pfd";
360 $sql .= " WHERE s.rowid = f.fk_soc";
361 $sql .= " AND f.entity IN (".getEntity('invoice').")";
362 if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) {
363  $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
364 }
365 //$sql .= " AND pfd.amount > 0";
366 $sql .= " AND f.total_ttc > 0"; // Avoid credit notes
367 $sql .= " AND pfd.traite = 0";
368 $sql .= " AND pfd.ext_payment_id IS NULL";
369 if ($type == 'bank-transfer') {
370  $sql .= " AND pfd.fk_facture_fourn = f.rowid";
371 } else {
372  $sql .= " AND pfd.fk_facture = f.rowid";
373 }
374 if ($socid > 0) {
375  $sql .= " AND f.fk_soc = ".((int) $socid);
376 }
377 
378 $nbtotalofrecords = '';
379 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
380  $result = $db->query($sql);
381  $nbtotalofrecords = $db->num_rows($result);
382  if (($page * $limit) > $nbtotalofrecords) {
383  // if total resultset is smaller then paging size (filtering), goto and load page 0
384  $page = 0;
385  $offset = 0;
386  }
387 }
388 
389 $sql .= $db->plimit($limit + 1, $offset);
390 
391 $resql = $db->query($sql);
392 if ($resql) {
393  $num = $db->num_rows($resql);
394  $i = 0;
395 
396  $param = '';
397  if ($limit > 0 && $limit != $conf->liste_limit) {
398  $param .= '&limit='.urlencode($limit);
399  }
400  if ($socid) {
401  $param .= '&socid='.urlencode($socid);
402  }
403  if ($option) {
404  $param .= "&option=".urlencode($option);
405  }
406 
407  print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
408  print '<input type="hidden" name="token" value="'.newToken().'">';
409  print '<input type="hidden" name="page" value="'.$page.'">';
410  if (!empty($limit)) {
411  print '<input type="hidden" name="limit" value="'.$limit.'"/>';
412  }
413  if ($type != '') {
414  print '<input type="hidden" name="type" value="'.$type.'">';
415  }
416 
417  $title = $langs->trans("InvoiceWaitingWithdraw");
418  if ($type == 'bank-transfer') {
419  $title = $langs->trans("InvoiceWaitingPaymentByBankTransfer");
420  }
421  print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, '', '', $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, '', '', $limit);
422 
423  $tradinvoice = "Invoice";
424  if ($type == 'bank-transfer') {
425  $tradinvoice = "SupplierInvoice";
426  }
427 
428  print '<div class="div-table-responsive-no-min">';
429  print '<table class="noborder centpercent">';
430  print '<tr class="liste_titre">';
431  print '<td>'.$langs->trans($tradinvoice).'</td>';
432  if ($type == 'bank-transfer') {
433  print '<td>'.$langs->trans("RefSupplier").'</td>';
434  }
435  print '<td>'.$langs->trans("ThirdParty").'</td>';
436  print '<td>'.$langs->trans("RIB").'</td>';
437  print '<td>'.$langs->trans("RUM").'</td>';
438  print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
439  print '<td class="right">'.$langs->trans("DateRequest").'</td>';
440  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
441  print '<td align="center">'.$form->showCheckAddButtons('checkforselect', 1).'</td>';
442  }
443  print '</tr>';
444 
445  if ($num) {
446  require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
447  $bac = new CompanyBankAccount($db);
448 
449  while ($i < $num && $i < $limit) {
450  $obj = $db->fetch_object($resql);
451 
452  $bac->fetch(0, $obj->socid);
453 
454  $invoicestatic->id = $obj->rowid;
455  $invoicestatic->ref = $obj->ref;
456  $invoicestatic->ref_supplier = $obj->ref_supplier;
457 
458  print '<tr class="oddeven">';
459 
460  // Ref invoice
461  print '<td class="tdoverflowmax150">';
462  print $invoicestatic->getNomUrl(1, 'withdraw');
463  print '</td>';
464 
465  if ($type == 'bank-transfer') {
466  print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($invoicestatic->ref_supplier).'">';
467  print dol_escape_htmltag($invoicestatic->ref_supplier);
468  print '</td>';
469  }
470 
471  // Thirdparty
472  print '<td class="tdoverflowmax100">';
473  $thirdpartystatic->fetch($obj->socid);
474  print $thirdpartystatic->getNomUrl(1, 'ban');
475  print '</td>';
476 
477  // RIB
478  print '<td>';
479  if ($bac->id > 0) {
480  if (!empty($bac->iban) || !empty($bac->bic)) {
481  print $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
482  if ($bac->verif() <= 0) {
483  print img_warning('Error on default bank number for IBAN : '.$langs->trans($bac->error_message));
484  }
485  } else {
486  print img_warning($langs->trans("IBANNotDefined"));
487  }
488  } else {
489  print img_warning($langs->trans("NoBankAccountDefined"));
490  }
491  print '</td>';
492 
493  // RUM
494  print '<td>';
495  $rumtoshow = $thirdpartystatic->display_rib('rum');
496  if ($rumtoshow) {
497  print $rumtoshow;
498  $format = $thirdpartystatic->display_rib('format');
499  if ($type != 'bank-transfer') {
500  if ($format) {
501  print ' ('.$format.')';
502  }
503  }
504  } else {
505  print img_warning($langs->trans("NoBankAccountDefined"));
506  }
507  print '</td>';
508  // Amount
509  print '<td class="right amount">';
510  print price($obj->amount, 0, $langs, 0, 0, -1, $conf->currency);
511  print '</td>';
512  // Date
513  print '<td class="right">';
514  print dol_print_date($db->jdate($obj->date_demande), 'day');
515  print '</td>';
516  // Action column
517  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
518  print '<td class="nowrap center">';
519  $selected = 0;
520  if (in_array($obj->request_row_id, $arrayofselected)) {
521  $selected = 1;
522  }
523  print '<input id="cb'.$obj->request_row_id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->request_row_id.'"'.($selected ? ' checked="checked"' : '').'>';
524  print '</td>';
525  }
526  print '</tr>';
527  $i++;
528  }
529  } else {
530  print '<tr class="oddeven"><td colspan="6"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
531  }
532  print "</table>";
533  print "</div>";
534 
535  print "</form>";
536  print "<br>\n";
537 } else {
538  dol_print_error($db);
539 }
540 
541 
542 /*
543  * List of latest withdraws
544  */
545 /*
546 $limit=5;
547 
548 print load_fiche_titre($langs->trans("LastWithdrawalReceipts",$limit),'','');
549 
550 $sql = "SELECT p.rowid, p.ref, p.amount, p.statut";
551 $sql.= ", p.datec";
552 $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
553 $sql.= " WHERE p.entity IN (".getEntity('invoice').")";
554 $sql.= " ORDER BY datec DESC";
555 $sql.=$db->plimit($limit);
556 
557 $result = $db->query($sql);
558 if ($result)
559 {
560  $num = $db->num_rows($result);
561  $i = 0;
562 
563  print"\n<!-- debut table -->\n";
564  print '<table class="noborder centpercent">';
565  print '<tr class="liste_titre"><td>'.$langs->trans("Ref").'</td>';
566  print '<td class="center">'.$langs->trans("Date").'</td><td class="right">'.$langs->trans("Amount").'</td>';
567  print '</tr>';
568 
569  while ($i < min($num,$limit))
570  {
571  $obj = $db->fetch_object($result);
572 
573 
574  print '<tr class="oddeven">';
575 
576  print "<td>";
577  $bprev->id=$obj->rowid;
578  $bprev->ref=$obj->ref;
579  print $bprev->getNomUrl(1);
580  print "</td>\n";
581 
582  print '<td class="center">'.dol_print_date($db->jdate($obj->datec),'day')."</td>\n";
583 
584  print '<td class="right"><span class="amount">'.price($obj->amount,0,$langs,0,0,-1,$conf->currency)."</span></td>\n";
585 
586  print "</tr>\n";
587  $i++;
588  }
589  print "</table><br>";
590  $db->free($result);
591 }
592 else
593 {
594  dol_print_error($db);
595 }
596 */
597 
598 // End of page
599 llxFooter();
600 $db->close();
Societe
Class to manage third parties objects (customers, suppliers, prospects...)
Definition: societe.class.php:50
dol_escape_htmltag
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
Definition: functions.lib.php:1504
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:70
$sql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("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->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
Definition: index.php:745
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5363
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:530
FactureFournisseur
Class to manage suppliers invoices.
Definition: fournisseur.facture.class.php:51
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:4994
img_warning
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
Definition: functions.lib.php:4671
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
Facture
Class to manage invoices.
Definition: facture.class.php:60
CompanyBankAccount
Class to manage bank accounts description of third parties.
Definition: companybankaccount.class.php:34
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2566
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:4025
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
BonPrelevement
Class to manage withdrawal receipts.
Definition: bonprelevement.class.php:43
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:5416
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1873
restrictedArea
restrictedArea(User $user, $features, $object=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:341
dolibarr_set_const
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Definition: admin.lib.php:633
dol_time_plus_duree
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
Definition: date.lib.php:122
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:431
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2947
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:5708
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8509
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:2859
getDolGlobalInt
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
Definition: functions.lib.php:96
$nbtotalofrecords
$nbtotalofrecords
Count total nb of records.
Definition: list.php:329
Account
Class to manage bank accounts.
Definition: account.class.php:39
prelevement_check_config
prelevement_check_config($type='direct-debit')
Check need data to create standigns orders receipt file.
Definition: prelevement.lib.php:85