dolibarr  16.0.5
prelevement.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
4  * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
5  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
6  * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
7  * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
8  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
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 require '../../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
36 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
37 require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
38 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
39 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
40 
41 // Load translation files required by the page
42 $langs->loadLangs(array('bills', 'banks', 'withdrawals', 'companies'));
43 
44 $id = (GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
45 $ref = GETPOST('ref', 'alpha');
46 $socid = GETPOST('socid', 'int');
47 $action = GETPOST('action', 'aZ09');
48 $type = GETPOST('type', 'aZ09');
49 
50 $fieldid = (!empty($ref) ? 'ref' : 'rowid');
51 if ($user->socid) {
52  $socid = $user->socid;
53 }
54 
55 $moreparam = '';
56 if ($type == 'bank-transfer') {
57  $object = new FactureFournisseur($db);
58  $moreparam = '&type='.$type;
59 } else {
60  $object = new Facture($db);
61 }
62 
63 // Load object
64 if ($id > 0 || !empty($ref)) {
65  $ret = $object->fetch($id, $ref);
66  $isdraft = (($object->statut == FactureFournisseur::STATUS_DRAFT) ? 1 : 0);
67  if ($ret > 0) {
68  $object->fetch_thirdparty();
69  }
70 }
71 
72 $hookmanager->initHooks(array('directdebitcard', 'globalcard'));
73 
74 if ($type == 'bank-transfer') {
75  $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture', 'fk_soc', $fieldid, $isdraft);
76  if (empty($user->rights->fournisseur->facture->lire)) {
78  }
79 } else {
80  $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
81  if (!$user->rights->facture->lire) {
83  }
84 }
85 
86 if ($type == 'bank-transfer') {
87  $usercancreate = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer);
88 } else {
89  $usercancreate = $user->rights->facture->creer;
90 }
91 
92 
93 /*
94  * Actions
95  */
96 
97 $parameters = array('socid' => $socid);
98 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
99 if ($reshook < 0) {
100  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
101 }
102 
103 if (empty($reshook)) {
104  if ($action == "new" && $usercancreate) {
105  if ($object->id > 0) {
106  $db->begin();
107 
108  $newtype = $type;
109  $sourcetype = 'facture';
110  if ($type == 'bank-transfer') {
111  $sourcetype = 'supplier_invoice';
112  $newtype = 'bank-transfer';
113  }
114 
115  $result = $object->demande_prelevement($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $sourcetype);
116  if ($result > 0) {
117  $db->commit();
118 
119  setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
120  } else {
121  $db->rollback();
122  setEventMessages($object->error, $object->errors, 'errors');
123  }
124  }
125  $action = '';
126  }
127 
128  if ($action == "delete" && $usercancreate) {
129  if ($object->id > 0) {
130  $result = $object->demande_prelevement_delete($user, GETPOST('did', 'int'));
131  if ($result == 0) {
132  header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id.'&type='.$type);
133  exit;
134  }
135  }
136  }
137 
138  // payments conditions
139  if ($action == 'setconditions' && $usercancreate) {
140  $object->fetch($id);
141  $object->cond_reglement_code = 0; // To clean property
142  $object->cond_reglement_id = 0; // To clean property
143 
144  $error = 0;
145 
146  $db->begin();
147 
148  if (!$error) {
149  $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
150  if ($result < 0) {
151  $error++;
152  setEventMessages($object->error, $object->errors, 'errors');
153  }
154  }
155 
156  if (!$error) {
157  $old_date_echeance = $object->date_echeance;
158  $new_date_echeance = $object->calculate_date_lim_reglement();
159  if ($new_date_echeance > $old_date_echeance) {
160  $object->date_echeance = $new_date_echeance;
161  }
162  if ($object->date_echeance < $object->date) {
163  $object->date_echeance = $object->date;
164  }
165  $result = $object->update($user);
166  if ($result < 0) {
167  $error++;
168  setEventMessages($object->error, $object->errors, 'errors');
169  }
170  }
171 
172  if ($error) {
173  $db->rollback();
174  } else {
175  $db->commit();
176  }
177  } elseif ($action == 'setmode' && $usercancreate) {
178  // payment mode
179  $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
180  } elseif ($action == 'setdatef' && $usercancreate) {
181  $newdate = dol_mktime(0, 0, 0, GETPOST('datefmonth', 'int'), GETPOST('datefday', 'int'), GETPOST('datefyear', 'int'), 'tzserver');
182  if ($newdate > (dol_now('tzuserrel') + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
183  if (empty($conf->global->INVOICE_MAX_FUTURE_DELAY)) {
184  setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings');
185  } else {
186  setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings');
187  }
188  }
189 
190  $object->date = $newdate;
191  $date_echence_calc = $object->calculate_date_lim_reglement();
192  if (!empty($object->date_echeance) && $object->date_echeance < $date_echence_calc) {
193  $object->date_echeance = $date_echence_calc;
194  }
195  if ($object->date_echeance && $object->date_echeance < $object->date) {
196  $object->date_echeance = $object->date;
197  }
198 
199  $result = $object->update($user);
200  if ($result < 0) {
201  dol_print_error($db, $object->error);
202  }
203  } elseif ($action == 'setdate_lim_reglement' && $usercancreate) {
204  $object->date_echeance = dol_mktime(12, 0, 0, GETPOST('date_lim_reglementmonth', 'int'), GETPOST('date_lim_reglementday', 'int'), GETPOST('date_lim_reglementyear', 'int'));
205  if (!empty($object->date_echeance) && $object->date_echeance < $object->date) {
206  $object->date_echeance = $object->date;
207  setEventMessages($langs->trans("DatePaymentTermCantBeLowerThanObjectDate"), null, 'warnings');
208  }
209  $result = $object->update($user);
210  if ($result < 0) {
211  dol_print_error($db, $object->error);
212  }
213  }
214 }
215 
216 
217 /*
218  * View
219  */
220 
221 $form = new Form($db);
222 
223 $now = dol_now();
224 
225 if ($type == 'bank-transfer') {
226  $title = $langs->trans('SupplierInvoice')." - ".$langs->trans('CreditTransfer');
227  $helpurl = "";
228 } else {
229  $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('StandingOrders');
230  $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
231 }
232 
233 llxHeader('', $title, $helpurl);
234 
235 
236 if ($object->id > 0) {
237  $selleruserevenustamp = $mysoc->useRevenueStamp();
238 
239  $totalpaid = $object->getSommePaiement();
240  $totalcreditnotes = $object->getSumCreditNotesUsed();
241  $totaldeposits = $object->getSumDepositsUsed();
242  //print "totalpaid=".$totalpaid." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
243 
244  // We can also use bcadd to avoid pb with floating points
245  // For example print 239.2 - 229.3 - 9.9; does not return 0.
246  //$resteapayer=bcadd($object->total_ttc,$totalpaid,$conf->global->MAIN_MAX_DECIMALS_TOT);
247  //$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
248  $resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
249 
250  if ($object->paye) {
251  $resteapayer = 0;
252  }
253  $resteapayeraffiche = $resteapayer;
254 
255  if ($type == 'bank-transfer') {
256  if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { // Not recommended
257  $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
258  $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
259  } else {
260  $filterabsolutediscount = "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')";
261  $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS PAID)%')";
262  }
263 
264  $absolute_discount = $object->thirdparty->getAvailableDiscounts('', $filterabsolutediscount, 0, 1);
265  $absolute_creditnote = $object->thirdparty->getAvailableDiscounts('', $filtercreditnote, 0, 1);
266  $absolute_discount = price2num($absolute_discount, 'MT');
267  $absolute_creditnote = price2num($absolute_creditnote, 'MT');
268  } else {
269  if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Not recommended
270  $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
271  $filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
272  } else {
273  $filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')";
274  $filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
275  }
276 
277  $absolute_discount = $object->thirdparty->getAvailableDiscounts('', $filterabsolutediscount);
278  $absolute_creditnote = $object->thirdparty->getAvailableDiscounts('', $filtercreditnote);
279  $absolute_discount = price2num($absolute_discount, 'MT');
280  $absolute_creditnote = price2num($absolute_creditnote, 'MT');
281  }
282 
283  $author = new User($db);
284  if ($object->fk_user_author) {
285  $author->fetch($object->fk_user_author);
286  }
287 
288  if ($type == 'bank-transfer') {
289  $head = facturefourn_prepare_head($object);
290  } else {
291  $head = facture_prepare_head($object);
292  }
293 
294  $numopen = 0;
295  $pending = 0;
296  $numclosed = 0;
297 
298  // How many Direct debit or Credit transfer open requests ?
299 
300  $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
301  $sql .= " , pfd.date_traite as date_traite";
302  $sql .= " , pfd.amount";
303  $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
304  if ($type == 'bank-transfer') {
305  $sql .= " WHERE fk_facture_fourn = ".((int) $object->id);
306  } else {
307  $sql .= " WHERE fk_facture = ".((int) $object->id);
308  }
309  $sql .= " AND pfd.traite = 0";
310  $sql .= " AND pfd.ext_payment_id IS NULL";
311  $sql .= " ORDER BY pfd.date_demande DESC";
312 
313  $resql = $db->query($sql);
314  if ($resql) {
315  $num = $db->num_rows($resql);
316  $numopen = $num;
317  } else {
318  dol_print_error($db);
319  }
320 
321 
322  print dol_get_fiche_head($head, 'standingorders', $title, -1, ($type == 'bank-transfer' ? 'supplier_invoice' : 'bill'));
323 
324  // Invoice content
325  if ($type == 'bank-transfer') {
326  $linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
327  } else {
328  $linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
329  }
330 
331  $morehtmlref = '<div class="refidno">';
332  // Ref customer
333  if ($type == 'bank-transfer') {
334  $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
335  $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
336  } else {
337  $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
338  $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
339  }
340  // Thirdparty
341  $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
342  if ($type == 'bank-transfer') {
343  if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
344  $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->thirdparty->id.'&search_company='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)';
345  }
346  } else {
347  if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
348  $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->thirdparty->id.'&search_company='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)';
349  }
350  }
351  // Project
352  if (isModEnabled('project')) {
353  $langs->load("projects");
354  $morehtmlref .= '<br>'.$langs->trans('Project').' ';
355  if ($usercancreate) {
356  if ($action != 'classify') {
357  //$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
358  $morehtmlref .= ' : ';
359  }
360  if ($action == 'classify') {
361  //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
362  $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
363  $morehtmlref .= '<input type="hidden" name="action" value="classin">';
364  $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
365  $morehtmlref .= '<input type="hidden" name="type" value="'.$type.'">';
366  $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
367  $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
368  $morehtmlref .= '</form>';
369  } else {
370  $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
371  }
372  } else {
373  if (!empty($object->fk_project)) {
374  $proj = new Project($db);
375  $proj->fetch($object->fk_project);
376  $morehtmlref .= ' : '.$proj->getNomUrl(1);
377  if ($proj->title) {
378  $morehtmlref .= ' - '.$proj->title;
379  }
380  } else {
381  $morehtmlref .= '';
382  }
383  }
384  }
385  $morehtmlref .= '</div>';
386 
387  $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
388 
389  dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $moreparam, 0, '', '');
390 
391  print '<div class="fichecenter">';
392  print '<div class="fichehalfleft">';
393  print '<div class="underbanner clearboth"></div>';
394 
395  print '<table class="border centpercent tableforfield">';
396 
397  // Type
398  print '<tr><td class="titlefield fieldname_type">'.$langs->trans('Type').'</td><td colspan="3">';
399  print '<span class="badgeneutral">';
400  print $object->getLibType();
401  print '</span>';
402  if ($object->module_source) {
403  print ' <span class="opacitymediumbycolor paddingleft">('.$langs->trans("POS").' '.$object->module_source.' - '.$langs->trans("Terminal").' '.$object->pos_source.')</span>';
404  }
405  if ($object->type == $object::TYPE_REPLACEMENT) {
406  if ($type == 'bank-transfer') {
407  $facreplaced = new FactureFournisseur($db);
408  } else {
409  $facreplaced = new Facture($db);
410  }
411  $facreplaced->fetch($object->fk_facture_source);
412  print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)).'</span>';
413  }
414  if ($object->type == $object::TYPE_CREDIT_NOTE && !empty($object->fk_facture_source)) {
415  if ($type == 'bank-transfer') {
416  $facusing = new FactureFournisseur($db);
417  } else {
418  $facusing = new Facture($db);
419  }
420  $facusing->fetch($object->fk_facture_source);
421  print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).'</span>';
422  }
423 
424  $facidavoir = $object->getListIdAvoirFromInvoice();
425  if (count($facidavoir) > 0) {
426  $invoicecredits = array();
427  foreach ($facidavoir as $facid) {
428  if ($type == 'bank-transfer') {
429  $facavoir = new FactureFournisseur($db);
430  } else {
431  $facavoir = new Facture($db);
432  }
433  $facavoir->fetch($facid);
434  $invoicecredits[] = $facavoir->getNomUrl(1);
435  }
436  print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("InvoiceHasAvoir");
437  print ' '. (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits);
438  print '</span>';
439  }
440  /*
441  if ($objectidnext > 0) {
442  $facthatreplace=new Facture($db);
443  $facthatreplace->fetch($objectidnext);
444  print ' <span class="opacitymediumbycolor paddingleft">'.str_replace('{s1}', $facthatreplace->getNomUrl(1), $langs->transnoentities("ReplacedByInvoice", '{s1}')).'</span>';
445  }
446  */
447  print '</td></tr>';
448 
449  // Relative and absolute discounts
450  print '<!-- Discounts -->'."\n";
451  print '<tr><td>'.$langs->trans('DiscountStillRemaining').'</td><td colspan="3">';
452 
453  if ($type == 'bank-transfer') {
454  //$societe = new Fournisseur($db);
455  //$result = $societe->fetch($object->socid);
456  $thirdparty = $object->thirdparty;
457  $discount_type = 1;
458  } else {
459  $thirdparty = $object->thirdparty;
460  $discount_type = 0;
461  }
462  $backtopage = urlencode($_SERVER["PHP_SELF"].'?facid='.$object->id);
463  $cannotApplyDiscount = 1;
464  include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
465 
466  print '</td></tr>';
467 
468  // Label
469  if ($type == 'bank-transfer') {
470  print '<tr>';
471  print '<td>'.$form->editfieldkey("Label", 'label', $object->label, $object, 0).'</td>';
472  print '<td>'.$form->editfieldval("Label", 'label', $object->label, $object, 0).'</td>';
473  print '</tr>';
474  }
475 
476  // Date invoice
477  print '<tr><td>';
478  print '<table class="nobordernopadding centpercent"><tr><td>';
479  print $langs->trans('DateInvoice');
480  print '</td>';
481  if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) {
482  print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&token='.newToken().'&id='.$object->id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
483  }
484  print '</tr></table>';
485  print '</td><td colspan="3">';
486 
487  if ($object->type != $object::TYPE_CREDIT_NOTE) {
488  if ($action == 'editinvoicedate') {
489  print $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $object->date, 'invoicedate', 0, 0, 1, $type);
490  } else {
491  print dol_print_date($object->date, 'day');
492  }
493  } else {
494  print dol_print_date($object->date, 'day');
495  }
496  print '</td>';
497  print '</tr>';
498 
499  // Payment condition
500  print '<tr><td>';
501  print '<table class="nobordernopadding centpercent"><tr><td>';
502  print $langs->trans('PaymentConditionsShort');
503  print '</td>';
504  if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) {
505  print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&id='.$object->id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
506  }
507  print '</tr></table>';
508  print '</td><td colspan="3">';
509  if ($object->type != $object::TYPE_CREDIT_NOTE) {
510  if ($action == 'editconditions') {
511  $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 0, $type);
512  } else {
513  $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none');
514  }
515  } else {
516  print '&nbsp;';
517  }
518  print '</td></tr>';
519 
520  // Date payment term
521  print '<tr><td>';
522  print '<table class="nobordernopadding centpercent"><tr><td>';
523  print $langs->trans('DateMaxPayment');
524  print '</td>';
525  if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) {
526  print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&token='.newToken().'&id='.$object->id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
527  }
528  print '</tr></table>';
529  print '</td><td colspan="3">';
530  if ($object->type != $object::TYPE_CREDIT_NOTE) {
531  $duedate = $object->date_lim_reglement;
532  if ($type == 'bank-transfer') {
533  $duedate = $object->date_echeance;
534  }
535 
536  if ($action == 'editpaymentterm') {
537  print $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $duedate, 'paymentterm', 0, 0, 1, $type);
538  } else {
539  print dol_print_date($duedate, 'day');
540  if ($object->hasDelay()) {
541  print img_warning($langs->trans('Late'));
542  }
543  }
544  } else {
545  print '&nbsp;';
546  }
547  print '</td></tr>';
548 
549  // Payment mode
550  print '<tr><td>';
551  print '<table class="nobordernopadding centpercent"><tr><td>';
552  print $langs->trans('PaymentMode');
553  print '</td>';
554  if ($action != 'editmode' && !empty($object->brouillon) && $user->rights->facture->creer) {
555  print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
556  }
557  print '</tr></table>';
558  print '</td><td colspan="3">';
559  $filtertype = 'CRDT';
560  if ($type == 'bank-transfer') {
561  $filtertype = 'DBIT';
562  }
563  if ($action == 'editmode') {
564  $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', $filtertype, 1, 0, $type);
565  } else {
566  $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none');
567  }
568  print '</td></tr>';
569 
570  // Bank Account
571  print '<tr><td class="nowrap">';
572  print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
573  print $langs->trans('BankAccount');
574  print '<td>';
575  if (($action != 'editbankaccount') && $user->rights->commande->creer && !empty($object->brouillon)) {
576  print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&id='.$object->id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
577  }
578  print '</tr></table>';
579  print '</td><td colspan="3">';
580  if ($action == 'editbankaccount') {
581  $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
582  } else {
583  $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
584  }
585  print "</td>";
586  print '</tr>';
587 
588  // IBAN of seller or supplier
589  $title = 'CustomerIBAN';
590  if ($type == 'bank-transfer') {
591  $title = 'SupplierIBAN';
592  }
593  print '<tr><td>'.$langs->trans($title).'</td><td colspan="3">';
594 
595  $bac = new CompanyBankAccount($db);
596  $bac->fetch(0, $object->thirdparty->id);
597 
598  print $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
599  if (!empty($bac->iban)) {
600  if ($bac->verif() <= 0) {
601  print img_warning('Error on default bank number for IBAN : '.$bac->error_message);
602  }
603  } else {
604  if ($numopen || ($type != 'bank-transfer' && $object->mode_reglement_code == 'PRE') || ($type == 'bank-transfer' && $object->mode_reglement_code == 'VIR')) {
605  print img_warning($langs->trans("NoDefaultIBANFound"));
606  }
607  }
608 
609  print '</td></tr>';
610 
611  print '</table>';
612 
613  print '</div>';
614  print '<div class="fichehalfright">';
615  print '<div class="underbanner clearboth"></div>';
616 
617  print '<table class="border centpercent tableforfield">';
618 
619  if (isModEnabled('multicurrency') && ($object->multicurrency_code != $conf->currency)) {
620  // Multicurrency Amount HT
621  print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
622  print '<td class="nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
623  print '</tr>';
624 
625  // Multicurrency Amount VAT
626  print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>';
627  print '<td class="nowrap">'.price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
628  print '</tr>';
629 
630  // Multicurrency Amount TTC
631  print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
632  print '<td class="nowrap">'.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
633  print '</tr>';
634  }
635 
636  // Amount
637  print '<tr><td class="titlefield">'.$langs->trans('AmountHT').'</td>';
638  print '<td class="nowrap">'.price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
639 
640  // Vat
641  print '<tr><td>'.$langs->trans('AmountVAT').'</td><td colspan="3" class="nowrap">'.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
642  print '</tr>';
643 
644  // Amount Local Taxes
645  if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) { // Localtax1
646  print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
647  print '<td class="nowrap">'.price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
648  }
649  if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) { // Localtax2
650  print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
651  print '<td class=nowrap">'.price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
652  }
653 
654  // Revenue stamp
655  if ($selleruserevenustamp) { // Test company use revenue stamp
656  print '<tr><td>';
657  print '<table class="nobordernopadding" width="100%"><tr><td>';
658  print $langs->trans('RevenueStamp');
659  print '</td>';
660  if ($action != 'editrevenuestamp' && !empty($object->brouillon) && $user->rights->facture->creer) {
661  print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editrevenuestamp&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).'</a></td>';
662  }
663  print '</tr></table>';
664  print '</td><td>';
665  print price($object->revenuestamp, 1, '', 1, - 1, - 1, $conf->currency);
666  print '</td></tr>';
667  }
668 
669  // Total with tax
670  print '<tr><td>'.$langs->trans('AmountTTC').'</td><td class="nowrap">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
671 
672  $resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
673 
674  // TODO Replace this by an include with same code to show already done payment visible in invoice card
675  print '<tr><td>'.$langs->trans('RemainderToPay').'</td><td class="nowrap">'.price($resteapayer, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
676 
677  print '</table>';
678 
679  print '</div>';
680  print '</div>';
681 
682  print '<div class="clearboth"></div>';
683 
684 
685  print dol_get_fiche_end();
686 
687 
688  // For which amount ?
689 
690  $sql = "SELECT SUM(pfd.amount) as amount";
691  $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
692  if ($type == 'bank-transfer') {
693  $sql .= " WHERE fk_facture_fourn = ".((int) $object->id);
694  } else {
695  $sql .= " WHERE fk_facture = ".((int) $object->id);
696  }
697  $sql .= " AND pfd.traite = 0";
698  $sql .= " AND pfd.ext_payment_id IS NULL";
699 
700  $resql = $db->query($sql);
701  if ($resql) {
702  $obj = $db->fetch_object($resql);
703  if ($obj) {
704  $pending = $obj->amount;
705  }
706  } else {
707  dol_print_error($db);
708  }
709 
710 
711  /*
712  * Buttons
713  */
714 
715  print "\n<div class=\"tabsAction\">\n";
716 
717  $buttonlabel = $langs->trans("MakeWithdrawRequest");
718  $user_perms = $user->rights->prelevement->bons->creer;
719  if ($type == 'bank-transfer') {
720  $buttonlabel = $langs->trans("MakeBankTransferOrder");
721  $user_perms = $user->rights->paymentbybanktransfer->create;
722  }
723 
724  // Add a transfer request
725  if ($object->statut > $object::STATUS_DRAFT && $object->paye == 0 && $num == 0) {
726  if ($resteapayer > 0) {
727  if ($user_perms) {
728  $remaintopaylesspendingdebit = $resteapayer - $pending;
729 
730  print '<form method="POST" action="">';
731  print '<input type="hidden" name="token" value="'.newToken().'" />';
732  print '<input type="hidden" name="id" value="'.$object->id.'" />';
733  print '<input type="hidden" name="type" value="'.$type.'" />';
734  print '<input type="hidden" name="action" value="new" />';
735  print '<label for="withdraw_request_amount">'.$langs->trans('BankTransferAmount').' </label>';
736  print '<input type="text" id="withdraw_request_amount" name="withdraw_request_amount" value="'.$remaintopaylesspendingdebit.'" size="9" />';
737  print '<input type="submit" class="butAction" value="'.$buttonlabel.'" />';
738  print '</form>';
739  } else {
740  print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$buttonlabel.'</a>';
741  }
742  } else {
743  print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AmountMustBePositive")).'">'.$buttonlabel.'</a>';
744  }
745  } else {
746  if ($num == 0) {
747  if ($object->statut > $object::STATUS_DRAFT) {
748  print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AlreadyPaid")).'">'.$buttonlabel.'</a>';
749  } else {
750  print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("Draft")).'">'.$buttonlabel.'</a>';
751  }
752  } else {
753  print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("RequestAlreadyDone")).'">'.$buttonlabel.'</a>';
754  }
755  }
756 
757  print "</div><br>\n";
758 
759 
760  if ($type == 'bank-transfer') {
761  print '<div class="opacitymedium">'.$langs->trans("DoCreditTransferBeforePayments").'</div><br>';
762  } else {
763  print '<div class="opacitymedium">'.$langs->trans("DoStandingOrdersBeforePayments").'</div><br>';
764  }
765 
766  /*
767  * Withdrawals
768  */
769 
770  print '<div class="div-table-responsive-no-min">';
771  print '<table class="noborder centpercent">';
772 
773  print '<tr class="liste_titre">';
774  print '<td class="left">'.$langs->trans("DateRequest").'</td>';
775  print '<td class="center">'.$langs->trans("User").'</td>';
776  print '<td class="center">'.$langs->trans("Amount").'</td>';
777  if ($type == 'bank-transfer') {
778  print '<td class="center">'.$langs->trans("BankTransferReceipt").'</td>';
779  } else {
780  print '<td class="center">'.$langs->trans("WithdrawalReceipt").'</td>';
781  }
782  print '<td>&nbsp;</td>';
783  print '<td class="center">'.$langs->trans("DateProcess").'</td>';
784  print '<td>&nbsp;</td>';
785  print '</tr>';
786 
787  $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,";
788  $sql .= " pfd.date_traite as date_traite, pfd.amount,";
789  $sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status";
790  $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
791  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
792  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
793  if ($type == 'bank-transfer') {
794  $sql .= " WHERE fk_facture_fourn = ".((int) $object->id);
795  } else {
796  $sql .= " WHERE fk_facture = ".((int) $object->id);
797  }
798  $sql .= " AND pfd.traite = 0";
799  $sql .= " AND pfd.ext_payment_id IS NULL";
800  $sql .= " ORDER BY pfd.date_demande DESC";
801 
802  $resql = $db->query($sql);
803 
804  $num = 0;
805  if ($resql) {
806  $i = 0;
807 
808  $tmpuser = new User($db);
809 
810  $num = $db->num_rows($result);
811  while ($i < $num) {
812  $obj = $db->fetch_object($resql);
813 
814  $tmpuser->id = $obj->user_id;
815  $tmpuser->login = $obj->login;
816  $tmpuser->ref = $obj->login;
817  $tmpuser->email = $obj->email;
818  $tmpuser->lastname = $obj->lastname;
819  $tmpuser->firstname = $obj->firstname;
820  $tmpuser->statut = $obj->user_status;
821 
822  print '<tr class="oddeven">';
823 
824  print '<td class="left">'.dol_print_date($db->jdate($obj->date_demande), 'dayhour')."</td>\n";
825 
826  print '<td align="center">';
827  print $tmpuser->getNomUrl(1, '', 0, 0, 0, 0, 'login');
828  print '</td>';
829 
830  print '<td class="center">'.price($obj->amount).'</td>';
831  print '<td align="center">-</td>';
832  print '<td>&nbsp;</td>';
833 
834  print '<td class="center">'.$langs->trans("OrderWaiting").'</td>';
835 
836  print '<td class="right">';
837  print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken().'&did='.$obj->rowid.'&type='.$type.'">';
838  print img_delete();
839  print '</a></td>';
840 
841  print "</tr>\n";
842  $i++;
843  }
844 
845  $db->free($resql);
846  } else {
847  dol_print_error($db);
848  }
849 
850 
851  // Past requests
852 
853  $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande, pfd.date_traite, pfd.fk_prelevement_bons, pfd.amount,";
854  $sql .= " pb.ref,";
855  $sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status";
856  $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
857  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
858  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
859  if ($type == 'bank-transfer') {
860  $sql .= " WHERE fk_facture_fourn = ".((int) $object->id);
861  } else {
862  $sql .= " WHERE fk_facture = ".((int) $object->id);
863  }
864  $sql .= " AND pfd.traite = 1";
865  $sql .= " AND pfd.ext_payment_id IS NULL";
866  $sql .= " ORDER BY pfd.date_demande DESC";
867 
868  $result = $db->query($sql);
869  if ($result) {
870  $num = $db->num_rows($result);
871  $numclosed = $num;
872  $i = 0;
873 
874  $tmpuser = new User($db);
875 
876  while ($i < $num) {
877  $obj = $db->fetch_object($result);
878 
879  $tmpuser->id = $obj->user_id;
880  $tmpuser->login = $obj->login;
881  $tmpuser->ref = $obj->login;
882  $tmpuser->email = $obj->email;
883  $tmpuser->lastname = $obj->lastname;
884  $tmpuser->firstname = $obj->firstname;
885  $tmpuser->statut = $obj->user_status;
886 
887  print '<tr class="oddeven">';
888 
889  print '<td class="left">'.dol_print_date($db->jdate($obj->date_demande), 'day')."</td>\n";
890 
891  print '<td align="center">';
892  print $tmpuser->getNomUrl(1, '', 0, 0, 0, 0, 'login');
893  print '</td>';
894 
895  print '<td class="center">'.price($obj->amount).'</td>';
896 
897  print '<td class="center">';
898  if ($obj->fk_prelevement_bons > 0) {
899  $withdrawreceipt = new BonPrelevement($db);
900  $withdrawreceipt->id = $obj->fk_prelevement_bons;
901  $withdrawreceipt->ref = $obj->ref;
902  print $withdrawreceipt->getNomUrl(1);
903  }
904  print "</td>\n";
905 
906  print '<td>&nbsp;</td>';
907 
908  print '<td class="center">'.dol_print_date($db->jdate($obj->date_traite), 'day')."</td>\n";
909 
910  print '<td>&nbsp;</td>';
911 
912  print "</tr>\n";
913  $i++;
914  }
915 
916  if (!$numopen && !$numclosed) {
917  print '<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
918  }
919 
920  $db->free($result);
921  } else {
922  dol_print_error($db);
923  }
924 
925  print "</table>";
926  print '</div>';
927 }
928 
929 // End of page
930 llxFooter();
931 $db->close();
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
Project
Class to manage projects.
Definition: project.class.php:35
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
FactureFournisseur
Class to manage suppliers invoices.
Definition: fournisseur.facture.class.php:53
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:4844
img_warning
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
Definition: functions.lib.php:4521
facture_prepare_head
facture_prepare_head($object)
Initialize the array of tabs for customer invoice.
Definition: invoice.lib.php:36
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
Facture
Class to manage invoices.
Definition: facture.class.php:60
img_edit
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
Definition: functions.lib.php:4389
CompanyBankAccount
Class to manage bank accounts description of third parties.
Definition: companybankaccount.class.php:34
facturefourn_prepare_head
facturefourn_prepare_head($object)
Prepare array with list of tabs.
Definition: fourn.lib.php:34
dol_banner_tab
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.
Definition: functions.lib.php:2046
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5661
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:2514
BonPrelevement
Class to manage withdrawal receipts.
Definition: bonprelevement.class.php:43
img_delete
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
Definition: functions.lib.php:4429
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:1822
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:10878
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2018
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:105
User
Class to manage Dolibarr users.
Definition: user.class.php:44
FactureFournisseur\STATUS_DRAFT
const STATUS_DRAFT
Draft.
Definition: fournisseur.facture.class.php:348
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:2845
$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:5541
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
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:2757
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