dolibarr  19.0.0-dev
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-2023 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 != getDolGlobalInt($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(getDolGlobalInt($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  // getDolGlobalString('PRELEVEMENT_CODE_BANQUE') and getDolGlobalString('PRELEVEMENT_CODE_GUICHET') should be empty (we don't use them anymore)
130  $result = $bprev->create(getDolGlobalString('PRELEVEMENT_CODE_BANQUE'), getDolGlobalString('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 if (prelevement_check_config($type) < 0) {
189  $langs->load("errors");
190  $modulenametoshow = "Withdraw";
191  if ($type == 'bank-transfer') {
192  $modulenametoshow = "PaymentByBankTransfer";
193  }
194  setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv($modulenametoshow)), null, 'errors');
195 }
196 
197 
198 $title = $langs->trans("NewStandingOrder");
199 if ($type == 'bank-transfer') {
200  $title = $langs->trans("NewPaymentByBankTransfer");
201 }
202 
203 llxHeader('', $title);
204 
205 print load_fiche_titre($title);
206 
207 print dol_get_fiche_head();
208 
209 $nb = $bprev->nbOfInvoiceToPay($type);
210 $pricetowithdraw = $bprev->SommeAPrelever($type);
211 if ($nb < 0) {
212  dol_print_error($bprev->error);
213 }
214 print '<table class="border centpercent tableforfield">';
215 
216 $labeltoshow = $langs->trans("NbOfInvoiceToWithdraw");
217 if ($type == 'bank-transfer') {
218  $labeltoshow = $langs->trans("NbOfInvoiceToPayByBankTransfer");
219 }
220 
221 print '<tr><td class="titlefield">'.$labeltoshow.'</td>';
222 print '<td class="nowraponall">';
223 print dol_escape_htmltag($nb);
224 print '</td></tr>';
225 
226 print '<tr><td>'.$langs->trans("AmountTotal").'</td>';
227 print '<td class="amount nowraponall">';
228 print price($pricetowithdraw, 0, $langs, 1, -1, -1, $conf->currency);
229 print '</td>';
230 print '</tr>';
231 
232 print '</table>';
233 print '</div>';
234 
235 if ($mesg) {
236  print $mesg;
237 }
238 
239 print '<div class="tabsAction">'."\n";
240 
241 print '<form action="'.$_SERVER['PHP_SELF'].'?action=create" method="POST">';
242 print '<input type="hidden" name="token" value="'.newToken().'">';
243 print '<input type="hidden" name="type" value="'.$type.'">';
244 if ($nb) {
245  if ($pricetowithdraw) {
246  $title = $langs->trans('BankToReceiveWithdraw').': ';
247  if ($type == 'bank-transfer') {
248  $title = $langs->trans('BankToPayCreditTransfer').': ';
249  }
250  print '<span class="hideonsmartphone">'.$title.'</span>';
251  print img_picto('', 'bank_account');
252 
253  $default_account = ($type == 'bank-transfer' ? 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT' : 'PRELEVEMENT_ID_BANKACCOUNT');
254 
255  print $form->select_comptes(getDolGlobalInt($default_account), 'id_bankaccount', 0, "courant=1", 0, '', 0, 'widthcentpercentminusx maxwidth300', 1);
256  print ' &nbsp; &nbsp; ';
257 
258  if (empty($executiondate)) {
259  $delayindays = 0;
260  if ($type != 'bank-transfer') {
261  $delayindays = getDolGlobalInt('PRELEVEMENT_ADDDAYS');
262  } else {
263  $delayindays = getDolGlobalInt('PAYMENTBYBANKTRANSFER_ADDDAYS');
264  }
265 
266  $executiondate = dol_time_plus_duree(dol_now(), $delayindays, 'd');
267  }
268 
269  print $langs->trans('ExecutionDate').' ';
270  $datere = $executiondate;
271  print $form->selectDate($datere, 're');
272 
273 
274  if ($mysoc->isInEEC()) {
275  $title = $langs->trans("CreateForSepa");
276  if ($type == 'bank-transfer') {
277  $title = $langs->trans("CreateSepaFileForPaymentByBankTransfer");
278  }
279 
280  if ($type != 'bank-transfer') {
281  print '<select name="format">';
282  print '<option value="FRST"'.($format == 'FRST' ? ' selected="selected"' : '').'>'.$langs->trans('SEPAFRST').'</option>';
283  print '<option value="RCUR"'.($format == 'RCUR' ? ' selected="selected"' : '').'>'.$langs->trans('SEPARCUR').'</option>';
284  print '</select>';
285  }
286  print '<input type="submit" class="butAction margintoponly maringbottomonly" value="'.$title.'"/>';
287  } else {
288  $title = $langs->trans("CreateAll");
289  if ($type == 'bank-transfer') {
290  $title = $langs->trans("CreateFileForPaymentByBankTransfer");
291  }
292  print '<input type="hidden" name="format" value="ALL">'."\n";
293  print '<input type="submit" class="butAction margintoponly maringbottomonly" value="'.$title.'">'."\n";
294  }
295  } else {
296  if ($mysoc->isInEEC()) {
297  $title = $langs->trans("CreateForSepaFRST");
298  if ($type == 'bank-transfer') {
299  $title = $langs->trans("CreateSepaFileForPaymentByBankTransfer");
300  }
301  print '<a class="butActionRefused classfortooltip margintoponly maringbottomonly" href="#" title="'.$langs->trans("AmountMustBePositive").'">'.$title."</a>\n";
302 
303  if ($type != 'bank-transfer') {
304  $title = $langs->trans("CreateForSepaRCUR");
305  print '<a class="butActionRefused classfortooltip margintoponly maringbottomonly" href="#" title="'.$langs->trans("AmountMustBePositive").'">'.$title."</a>\n";
306  }
307  } else {
308  $title = $langs->trans("CreateAll");
309  if ($type == 'bank-transfer') {
310  $title = $langs->trans("CreateFileForPaymentByBankTransfer");
311  }
312  print '<a class="butActionRefused classfortooltip margintoponly maringbottomonly" href="#">'.$title."</a>\n";
313  }
314  }
315 } else {
316  $titlefortab = $langs->transnoentitiesnoconv("StandingOrders");
317  $title = $langs->trans("CreateAll");
318  if ($type == 'bank-transfer') {
319  $titlefortab = $langs->transnoentitiesnoconv("PaymentByBankTransfers");
320  $title = $langs->trans("CreateFileForPaymentByBankTransfer");
321  }
322  print '<a class="butActionRefused classfortooltip margintoponly maringbottomonly" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoInvoiceToWithdraw", $titlefortab, $titlefortab)).'">';
323  print $title;
324  print "</a>\n";
325 }
326 
327 print "</form>\n";
328 
329 print "</div>\n";
330 print '</form>';
331 print '<br>';
332 
333 
334 /*
335  * Invoices waiting for withdraw
336  */
337 
338 $sql = "SELECT f.ref, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,";
339 if ($type == 'bank-transfer') {
340  $sql .= " f.ref_supplier,";
341 }
342 $sql .= " pfd.rowid as request_row_id, pfd.date_demande, pfd.amount";
343 if ($type == 'bank-transfer') {
344  $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
345 } else {
346  $sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
347 }
348 $sql .= " ".MAIN_DB_PREFIX."societe as s,";
349 $sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pfd";
350 $sql .= " WHERE s.rowid = f.fk_soc";
351 $sql .= " AND f.entity IN (".getEntity('invoice').")";
352 if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) {
353  $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
354 }
355 //$sql .= " AND pfd.amount > 0";
356 $sql .= " AND f.total_ttc > 0"; // Avoid credit notes
357 $sql .= " AND pfd.traite = 0";
358 $sql .= " AND pfd.ext_payment_id IS NULL";
359 if ($type == 'bank-transfer') {
360  $sql .= " AND pfd.fk_facture_fourn = f.rowid";
361 } else {
362  $sql .= " AND pfd.fk_facture = f.rowid";
363 }
364 if ($socid > 0) {
365  $sql .= " AND f.fk_soc = ".((int) $socid);
366 }
367 
368 $nbtotalofrecords = '';
369 if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
370  $result = $db->query($sql);
371  $nbtotalofrecords = $db->num_rows($result);
372  if (($page * $limit) > $nbtotalofrecords) {
373  // if total resultset is smaller then paging size (filtering), goto and load page 0
374  $page = 0;
375  $offset = 0;
376  }
377 }
378 
379 $sql .= $db->plimit($limit + 1, $offset);
380 
381 $resql = $db->query($sql);
382 if ($resql) {
383  $num = $db->num_rows($resql);
384  $i = 0;
385 
386  $param = '';
387  if ($limit > 0 && $limit != $conf->liste_limit) {
388  $param .= '&limit='.((int) $limit);
389  }
390  if ($socid) {
391  $param .= '&socid='.urlencode($socid);
392  }
393  if ($option) {
394  $param .= "&option=".urlencode($option);
395  }
396 
397  print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
398  print '<input type="hidden" name="token" value="'.newToken().'">';
399  print '<input type="hidden" name="page" value="'.$page.'">';
400  if (!empty($limit)) {
401  print '<input type="hidden" name="limit" value="'.$limit.'"/>';
402  }
403  if ($type != '') {
404  print '<input type="hidden" name="type" value="'.$type.'">';
405  }
406 
407  $title = $langs->trans("InvoiceWaitingWithdraw");
408  if ($type == 'bank-transfer') {
409  $title = $langs->trans("InvoiceWaitingPaymentByBankTransfer");
410  }
411  print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, '', '', $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, '', '', $limit);
412 
413  $tradinvoice = "Invoice";
414  if ($type == 'bank-transfer') {
415  $tradinvoice = "SupplierInvoice";
416  }
417 
418  print '<div class="div-table-responsive-no-min">';
419  print '<table class="noborder centpercent">';
420  print '<tr class="liste_titre">';
421  print '<td>'.$langs->trans($tradinvoice).'</td>';
422  if ($type == 'bank-transfer') {
423  print '<td>'.$langs->trans("RefSupplier").'</td>';
424  }
425  print '<td>'.$langs->trans("ThirdParty").'</td>';
426  print '<td>'.$langs->trans("RIB").'</td>';
427  print '<td>'.$langs->trans("RUM").'</td>';
428  print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
429  print '<td class="right">'.$langs->trans("DateRequest").'</td>';
430  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
431  print '<td align="center">'.$form->showCheckAddButtons('checkforselect', 1).'</td>';
432  }
433  print '</tr>';
434 
435  if ($num) {
436  require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
437 
438  while ($i < $num && $i < $limit) {
439  $obj = $db->fetch_object($resql);
440 
441  $bac = new CompanyBankAccount($db); // Must include the new in loop so the fetch is clean
442  $bac->fetch(0, $obj->socid);
443 
444  $invoicestatic->id = $obj->rowid;
445  $invoicestatic->ref = $obj->ref;
446  $invoicestatic->ref_supplier = $obj->ref_supplier;
447 
448  print '<tr class="oddeven">';
449 
450  // Ref invoice
451  print '<td class="tdoverflowmax150">';
452  print $invoicestatic->getNomUrl(1, 'withdraw');
453  print '</td>';
454 
455  if ($type == 'bank-transfer') {
456  print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($invoicestatic->ref_supplier).'">';
457  print dol_escape_htmltag($invoicestatic->ref_supplier);
458  print '</td>';
459  }
460 
461  // Thirdparty
462  print '<td class="tdoverflowmax100">';
463  $thirdpartystatic->fetch($obj->socid);
464  print $thirdpartystatic->getNomUrl(1, 'ban');
465  print '</td>';
466 
467  // RIB
468  print '<td>';
469  if ($bac->id > 0) {
470  if (!empty($bac->iban) || !empty($bac->bic)) {
471  print $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
472  if ($bac->verif() <= 0) {
473  print img_warning('Error on default bank number for IBAN : '.$langs->trans($bac->error_message));
474  }
475  } else {
476  print img_warning($langs->trans("IBANNotDefined"));
477  }
478  } else {
479  print img_warning($langs->trans("NoBankAccountDefined"));
480  }
481  print '</td>';
482 
483  // RUM
484  print '<td>';
485  $rumtoshow = $thirdpartystatic->display_rib('rum');
486  if ($rumtoshow) {
487  print $rumtoshow;
488  $format = $thirdpartystatic->display_rib('format');
489  if ($type != 'bank-transfer') {
490  if ($format) {
491  print ' ('.$format.')';
492  }
493  }
494  } else {
495  print img_warning($langs->trans("NoBankAccountDefined"));
496  }
497  print '</td>';
498  // Amount
499  print '<td class="right amount">';
500  print price($obj->amount, 0, $langs, 0, 0, -1, $conf->currency);
501  print '</td>';
502  // Date
503  print '<td class="right">';
504  print dol_print_date($db->jdate($obj->date_demande), 'day');
505  print '</td>';
506  // Action column
507  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
508  print '<td class="nowrap center">';
509  $selected = 0;
510  if (in_array($obj->request_row_id, $arrayofselected)) {
511  $selected = 1;
512  }
513  print '<input id="cb'.$obj->request_row_id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->request_row_id.'"'.($selected ? ' checked="checked"' : '').'>';
514  print '</td>';
515  }
516  print '</tr>';
517  $i++;
518  }
519  } else {
520  print '<tr class="oddeven"><td colspan="6"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
521  }
522  print "</table>";
523  print "</div>";
524 
525  print "</form>";
526  print "<br>\n";
527 } else {
528  dol_print_error($db);
529 }
530 
531 
532 /*
533  * List of latest withdraws
534  */
535 /*
536 $limit=5;
537 
538 print load_fiche_titre($langs->trans("LastWithdrawalReceipts",$limit),'','');
539 
540 $sql = "SELECT p.rowid, p.ref, p.amount, p.statut";
541 $sql.= ", p.datec";
542 $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
543 $sql.= " WHERE p.entity IN (".getEntity('invoice').")";
544 $sql.= " ORDER BY datec DESC";
545 $sql.=$db->plimit($limit);
546 
547 $result = $db->query($sql);
548 if ($result)
549 {
550  $num = $db->num_rows($result);
551  $i = 0;
552 
553  print"\n<!-- debut table -->\n";
554  print '<table class="noborder centpercent">';
555  print '<tr class="liste_titre"><td>'.$langs->trans("Ref").'</td>';
556  print '<td class="center">'.$langs->trans("Date").'</td><td class="right">'.$langs->trans("Amount").'</td>';
557  print '</tr>';
558 
559  while ($i < min($num,$limit))
560  {
561  $obj = $db->fetch_object($result);
562 
563 
564  print '<tr class="oddeven">';
565 
566  print "<td>";
567  $bprev->id=$obj->rowid;
568  $bprev->ref=$obj->ref;
569  print $bprev->getNomUrl(1);
570  print "</td>\n";
571 
572  print '<td class="center">'.dol_print_date($db->jdate($obj->datec),'day')."</td>\n";
573 
574  print '<td class="right"><span class="amount">'.price($obj->amount,0,$langs,0,0,-1,$conf->currency)."</span></td>\n";
575 
576  print "</tr>\n";
577  $i++;
578  }
579  print "</table><br>";
580  $db->free($result);
581 }
582 else
583 {
584  dol_print_error($db);
585 }
586 */
587 
588 // End of page
589 llxFooter();
590 $db->close();
Societe
Class to manage third parties objects (customers, suppliers, prospects...)
Definition: societe.class.php:51
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:70
dol_escape_htmltag
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
Definition: functions.lib.php:1600
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5477
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:609
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:5107
img_warning
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
Definition: functions.lib.php:4784
$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:2675
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:4135
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:5530
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
Definition: functions.lib.php:8673
$sql
if(isModEnabled('facture') && $user->hasRight('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') && $user->hasRight('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:746
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:353
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
Definition: functions.lib.php:1979
getDolGlobalString
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
Definition: functions.lib.php:142
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:638
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:509
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:53
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:3056
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:5829
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:2968
getDolGlobalInt
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
Definition: functions.lib.php:156
Account
Class to manage bank accounts.
Definition: account.class.php:40
prelevement_check_config
prelevement_check_config($type='direct-debit')
Check need data to create standigns orders receipt file.
Definition: prelevement.lib.php:85