dolibarr  16.0.1
pay.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
24 //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Not disabled cause need to load personalized language
25 //if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Not disabled cause need to load personalized language
26 //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
27 //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
28 if (!defined('NOCSRFCHECK')) {
29  define('NOCSRFCHECK', '1');
30 }
31 if (!defined('NOTOKENRENEWAL')) {
32  define('NOTOKENRENEWAL', '1');
33 }
34 if (!defined('NOREQUIREMENU')) {
35  define('NOREQUIREMENU', '1');
36 }
37 if (!defined('NOREQUIREHTML')) {
38  define('NOREQUIREHTML', '1');
39 }
40 
41 require '../main.inc.php'; // Load $user and permissions
42 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
43 
44 $langs->loadLangs(array("main", "bills", "cashdesk", "banks"));
45 
46 $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : '0'); // $place is id of table for Bar or Restaurant
47 
48 $invoiceid = GETPOST('invoiceid', 'int');
49 
50 if (empty($user->rights->takepos->run)) {
52 }
53 
54 
55 /*
56  * View
57  */
58 
59 $invoice = new Facture($db);
60 if ($invoiceid > 0) {
61  $invoice->fetch($invoiceid);
62 } else {
63  $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
64  $resql = $db->query($sql);
65  $obj = $db->fetch_object($resql);
66  if ($obj) {
67  $invoiceid = $obj->rowid;
68  }
69  if (!$invoiceid) {
70  $invoiceid = 0; // Invoice does not exist yet
71  } else {
72  $invoice->fetch($invoiceid);
73  }
74 }
75 
76 $arrayofcss = array('/takepos/css/pos.css.php');
77 $arrayofjs = array();
78 
79 $head = '';
80 $title = '';
81 $disablejs = 0;
82 $disablehead = 0;
83 
84 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
85 
86 // Define list of possible payments
87 $arrayOfValidPaymentModes = array();
88 $arrayOfValidBankAccount = array();
89 
90 $sql = "SELECT code, libelle as label FROM ".MAIN_DB_PREFIX."c_paiement";
91 $sql .= " WHERE entity IN (".getEntity('c_paiement').")";
92 $sql .= " AND active = 1";
93 $sql .= " ORDER BY libelle";
94 $resql = $db->query($sql);
95 
96 if ($resql) {
97  while ($obj = $db->fetch_object($resql)) {
98  $paycode = $obj->code;
99  if ($paycode == 'LIQ') {
100  $paycode = 'CASH';
101  }
102  if ($paycode == 'CB') {
103  $paycode = 'CB';
104  }
105  if ($paycode == 'CHQ') {
106  $paycode = 'CHEQUE';
107  }
108 
109  $accountname = "CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION["takeposterminal"];
110  if (!empty($conf->global->$accountname) && $conf->global->$accountname > 0) {
111  $arrayOfValidBankAccount[$conf->global->$accountname] = $conf->global->$accountname;
112  $arrayOfValidPaymentModes[] = $obj;
113  }
114  if (!isModEnabled('banque')) {
115  if ($paycode == 'CASH' || $paycode == 'CB') $arrayOfValidPaymentModes[] = $obj;
116  }
117  }
118 }
119 ?>
120 <link rel="stylesheet" href="css/pos.css.php">
121 <?php
122 if ($conf->global->TAKEPOS_COLOR_THEME == 1) {
123  print '<link rel="stylesheet" href="css/colorful.css">';
124 }
125 ?>
126 </head>
127 <body>
128 
129 <script>
130 <?php
131 $remaintopay = 0;
132 if ($invoice->id > 0) {
133  $remaintopay = $invoice->getRemainToPay();
134 }
135 $alreadypayed = (is_object($invoice) ? ($invoice->total_ttc - $remaintopay) : 0);
136 
137 if ($conf->global->TAKEPOS_NUMPAD == 0) {
138  print "var received='';";
139 } else {
140  print "var received=0;";
141 }
142 
143 ?>
144  var alreadypayed = <?php echo $alreadypayed ?>;
145 
146  function addreceived(price)
147  {
148  <?php
149  if (empty($conf->global->TAKEPOS_NUMPAD)) {
150  print 'received+=String(price);'."\n";
151  } else {
152  print 'received+=parseFloat(price);'."\n";
153  }
154  ?>
155  $('.change1').html(pricejs(parseFloat(received), 'MT'));
156  $('.change1').val(parseFloat(received));
157  alreadypaydplusreceived=price2numjs(alreadypayed + parseFloat(received));
158  //console.log("already+received = "+alreadypaydplusreceived);
159  //console.log("total_ttc = "+<?php echo $invoice->total_ttc; ?>);
160  if (alreadypaydplusreceived > <?php echo $invoice->total_ttc; ?>)
161  {
162  var change=parseFloat(alreadypayed + parseFloat(received) - <?php echo $invoice->total_ttc; ?>);
163  $('.change2').html(pricejs(change, 'MT'));
164  $('.change2').val(change);
165  $('.change1').removeClass('colorred');
166  $('.change1').addClass('colorgreen');
167  $('.change2').removeClass('colorwhite');
168  $('.change2').addClass('colorred');
169  }
170  else
171  {
172  $('.change2').html(pricejs(0, 'MT'));
173  $('.change2').val(0);
174  if (alreadypaydplusreceived == <?php echo $invoice->total_ttc; ?>)
175  {
176  $('.change1').removeClass('colorred');
177  $('.change1').addClass('colorgreen');
178  $('.change2').removeClass('colorred');
179  $('.change2').addClass('colorwhite');
180  }
181  else
182  {
183  $('.change1').removeClass('colorgreen');
184  $('.change1').addClass('colorred');
185  $('.change2').removeClass('colorred');
186  $('.change2').addClass('colorwhite');
187  }
188  }
189  }
190 
191  function reset()
192  {
193  received=0;
194  $('.change1').html(pricejs(received, 'MT'));
195  $('.change1').val(price2numjs(received));
196  $('.change2').html(pricejs(received, 'MT'));
197  $('.change2').val(price2numjs(received));
198  $('.change1').removeClass('colorgreen');
199  $('.change1').addClass('colorred');
200  $('.change2').removeClass('colorred');
201  $('.change2').addClass('colorwhite');
202  }
203 
204  function Validate(payment)
205  {
206  var invoiceid = <?php echo ($invoiceid > 0 ? $invoiceid : 0); ?>;
207  var accountid = $("#selectaccountid").val();
208  var amountpayed = $("#change1").val();
209  var excess = $("#change2").val();
210  if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
211  amountpayed = <?php echo $invoice->total_ttc; ?>;
212  }
213  console.log("We click on the payment mode to pay amount = "+amountpayed);
214  parent.$("#poslines").load("invoice.php?place=<?php echo $place; ?>&action=valid&pay="+payment+"&amount="+amountpayed+"&excess="+excess+"&invoiceid="+invoiceid+"&accountid="+accountid, function() {
215  if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
216  console.log("Close popup");
217  parent.$.colorbox.close();
218  }
219  else {
220  console.log("Amount is not comple, so we do NOT close popup and reload it.");
221  location.reload();
222  }
223  });
224  }
225 
226  function ValidateSumup() {
227  console.log("Launch ValidateSumup");
228  <?php $_SESSION['SMP_CURRENT_PAYMENT'] = "NEW" ?>
229  var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
230  var amountpayed = $("#change1").val();
231  if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
232  amountpayed = <?php echo $invoice->total_ttc; ?>;
233  }
234 
235  // Starting sumup app
236  window.open('sumupmerchant://pay/1.0?affiliate-key=<?php echo $conf->global->TAKEPOS_SUMUP_AFFILIATE ?>&app-id=<?php echo $conf->global->TAKEPOS_SUMUP_APPID ?>&total=' + amountpayed + '&currency=EUR&title=' + invoiceid + '&callback=<?php echo DOL_MAIN_URL_ROOT ?>/takepos/smpcb.php');
237 
238  var loop = window.setInterval(function () {
239  $.ajax({
240  method: 'POST',
241  data: { token: '<?php echo currentToken(); ?>' },
242  url: '<?php echo DOL_URL_ROOT ?>/takepos/smpcb.php?status' }).done(function (data) {
243  console.log(data);
244  if (data === "SUCCESS") {
245  parent.$("#poslines").load("invoice.php?place=<?php echo $place; ?>&action=valid&pay=CB&amount=" + amountpayed + "&invoiceid=" + invoiceid, function () {
246  //parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight);
247  parent.$.colorbox.close();
248  //parent.setFocusOnSearchField(); // This does not have effect
249  });
250  clearInterval(loop);
251  } else if (data === "FAILED") {
252  parent.$.colorbox.close();
253  clearInterval(loop);
254  }
255  });
256  }, 2500);
257  }
258 
259 <?php
260 if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) {
261  echo "var line1='".$langs->trans('TotalTTC')."'.substring(0,20);";
262  echo "line1=line1.padEnd(20);";
263  echo "var line2='".price($invoice->total_ttc, 1, '', 1, -1, -1)."'.substring(0,20);";
264  echo "line2=line2.padEnd(20);";
265  echo "$.ajax({
266  type: 'GET',
267  data: { text: line1+line2 },
268  url: '".getDolGlobalString('TAKEPOS_PRINT_SERVER')."/display/index.php',
269  });";
270 }
271 ?>
272 </script>
273 
274 <div style="position:relative; padding-top: 20px; left:5%; height:150px; width:90%;">
275  <div class="paymentbordline paymentbordlinetotal center">
276  <span class="takepospay colorwhite"><?php echo $langs->trans('TotalTTC'); ?>: <span id="totaldisplay" class="colorwhite"><?php echo price($invoice->total_ttc, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span></span>
277  </div>
278  <?php if ($remaintopay != $invoice->total_ttc) { ?>
279  <div class="paymentbordline paymentbordlineremain center">
280  <span class="takepospay colorwhite"><?php echo $langs->trans('RemainToPay'); ?>: <span id="remaintopaydisplay" class="colorwhite"><?php echo price($remaintopay, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span></span>
281  </div>
282  <?php } ?>
283  <div class="paymentbordline paymentbordlinereceived center">
284  <span class="takepospay colorwhite"><?php echo $langs->trans("Received"); ?>: <span class="change1 colorred"><?php echo price(0, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span><input type="hidden" id="change1" class="change1" value="0"></span>
285  </div>
286  <div class="paymentbordline paymentbordlinechange center">
287  <span class="takepospay colorwhite"><?php echo $langs->trans("Change"); ?>: <span class="change2 colorwhite"><?php echo price(0, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span><input type="hidden" id="change2" class="change2" value="0"></span>
288  </div>
289  <?php
290  if (!empty($conf->global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) {
291  require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
292  print '<div class="paymentbordline paddingtop paddingbottom center">';
293  $filter = '';
294  $form = new Form($db);
295  print '<span class="takepospay colorwhite">'.$langs->trans("BankAccount").': </span>';
296  $form->select_comptes(0, 'accountid', 0, $filter, 1, '');
297  print ajax_combobox('selectaccountid');
298  print '</div>';
299  }
300  ?>
301 </div>
302 
303 <div style="position:absolute; left:5%; height:52%; width:90%;">
304 <?php
305 $action_buttons = array(
306  array(
307  "function" =>"reset()",
308  "span" => "style='font-size: 150%;'",
309  "text" => "C",
310  "class" => "poscolorblue"
311  ),
312  array(
313  "function" => "parent.$.colorbox.close();",
314  "span" => "id='printtext' style='font-weight: bold; font-size: 18pt;'",
315  "text" => "X",
316  "class" => "poscolordelete"
317  ),
318 );
319 $numpad = $conf->global->TAKEPOS_NUMPAD;
320 
321 print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '7' : '10').');">'.($numpad == 0 ? '7' : '10').'</button>';
322 print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '8' : '20').');">'.($numpad == 0 ? '8' : '20').'</button>';
323 print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '9' : '50').');">'.($numpad == 0 ? '9' : '50').'</button>';
324 ?>
325 <?php if (count($arrayOfValidPaymentModes) > 0) {
326  $paycode = $arrayOfValidPaymentModes[0]->code;
327  $payIcon = '';
328  if ($paycode == 'LIQ') {
329  if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
330  $payIcon = 'coins';
331  }
332  } elseif ($paycode == 'CB') {
333  if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
334  $payIcon = 'credit-card';
335  }
336  } elseif ($paycode == 'CHQ') {
337  if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
338  $payIcon = 'money-check';
339  }
340  }
341 
342  print '<button type="button" class="calcbutton2" onclick="Validate(\''.dol_escape_js($paycode).'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span><span class="hideonsmartphone"><br>'.$langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[0]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[0]->code)).'</span></button>';
343 } else {
344  print '<button type="button" class="calcbutton2">'.$langs->trans("NoPaimementModesDefined").'</button>';
345 }
346 
347 print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '4' : '1').');">'.($numpad == 0 ? '4' : '1').'</button>';
348 print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '5' : '2').');">'.($numpad == 0 ? '5' : '2').'</button>';
349 print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '6' : '5').');">'.($numpad == 0 ? '6' : '5').'</button>';
350 ?>
351 <?php if (count($arrayOfValidPaymentModes) > 1) {
352  $paycode = $arrayOfValidPaymentModes[1]->code;
353  $payIcon = '';
354  if ($paycode == 'LIQ') {
355  if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
356  $payIcon = 'coins';
357  }
358  } elseif ($paycode == 'CB') {
359  if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
360  $payIcon = 'credit-card';
361  }
362  } elseif ($paycode == 'CHQ') {
363  if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
364  $payIcon = 'money-check';
365  }
366  }
367 
368  print '<button type="button" class="calcbutton2" onclick="Validate(\''.dol_escape_js($paycode).'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span><br> '.$langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[1]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[1]->code)).'</button>';
369 } else {
370  $button = array_pop($action_buttons);
371  print '<button type="button" class="calcbutton2" onclick="'.$button["function"].'"><span '.$button["span"].'>'.$button["text"].'</span></button>';
372 }
373 
374 print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '1' : '0.10').');">'.($numpad == 0 ? '1' : '0.10').'</button>';
375 print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '2' : '0.20').');">'.($numpad == 0 ? '2' : '0.20').'</button>';
376 print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '3' : '0.50').');">'.($numpad == 0 ? '3' : '0.50').'</button>';
377 ?>
378 <?php if (count($arrayOfValidPaymentModes) > 2) {
379  $paycode = $arrayOfValidPaymentModes[2]->code;
380  $payIcon = '';
381  if ($paycode == 'LIQ') {
382  if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
383  $payIcon = 'coins';
384  }
385  } elseif ($paycode == 'CB') {
386  if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
387  $payIcon = 'credit-card';
388  }
389  } elseif ($paycode == 'CHQ') {
390  if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
391  $payIcon = 'money-check';
392  }
393  }
394 
395  print '<button type="button" class="calcbutton2" onclick="Validate(\''.dol_escape_js($paycode).'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span><br>'.$langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[2]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[2]->code)).'</button>';
396 } else {
397  $button = array_pop($action_buttons);
398  print '<button type="button" class="calcbutton2" onclick="'.$button["function"].'"><span '.$button["span"].'>'.$button["text"].'</span></button>';
399 }
400 
401 print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '0' : '0.01').');">'.($numpad == 0 ? '0' : '0.01').'</button>';
402 print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '\'000\'' : '0.02').');">'.($numpad == 0 ? '000' : '0.02').'</button>';
403 print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '\'.\'' : '0.05').');">'.($numpad == 0 ? '.' : '0.05').'</button>';
404 
405 $i = 3;
406 while ($i < count($arrayOfValidPaymentModes)) {
407  $paycode = $arrayOfValidPaymentModes[$i]->code;
408  $payIcon = '';
409  if ($paycode == 'LIQ') {
410  if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
411  $payIcon = 'coins';
412  }
413  } elseif ($paycode == 'CB') {
414  if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
415  $payIcon = 'credit-card';
416  }
417  } elseif ($paycode == 'CHQ') {
418  if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
419  $payIcon = 'money-check';
420  }
421  }
422 
423  print '<button type="button" class="calcbutton2" onclick="Validate(\''.dol_escape_js($paycode).'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span><br>'.$langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[$i]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[$i]->code)).'</button>';
424  $i = $i + 1;
425 }
426 
427 $keyforsumupbank = "CASHDESK_ID_BANKACCOUNT_SUMUP".$_SESSION["takeposterminal"];
428 if (getDolGlobalInt('TAKEPOS_ENABLE_SUMUP')) {
429  if (!empty($conf->global->$keyforsumupbank)) {
430  print '<button type="button" class="calcbutton2" onclick="ValidateSumup();">Sumup</button>';
431  } else {
432  $langs->loadLangs(array("errors", "admin"));
433  print '<button type="button" class="calcbutton2 disabled" title="'.$langs->trans("SetupNotComplete").'">Sumup</button>';
434  }
435 }
436 
437 $class = ($i == 3) ? "calcbutton3" : "calcbutton2";
438 foreach ($action_buttons as $button) {
439  $newclass = $class.($button["class"] ? " ".$button["class"] : "");
440  print '<button type="button" class="'.$newclass.'" onclick="'.$button["function"].'"><span '.$button["span"].'>'.$button["text"].'</span></button>';
441 }
442 
443 if ($conf->global->TAKEPOS_DELAYED_PAYMENT) {
444  print '<button type="button" class="calcbutton2" onclick="Validate(\'delayed\');">'.$langs->trans("Reported").'</button>';
445 }
446 ?>
447 </div>
448 
449 </body>
450 </html>
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
Definition: card.php:142
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
Class toolbox to validate values.
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...
price2numjs(amount)
Function similar to PHP price2num()
Class to manage generation of HTML components Only common components must be here.
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 ...
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete= 'resolve', $idforemptyvalue= '-1')
Convert a html select field into an ajax combobox.
Definition: ajax.lib.php:429
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
pricejs(amount, mode= 'MT', currency_code= '', force_locale= '')
Function similar to PHP price()
top_htmlhead($head, $title= '', $disablejs=0, $disablehead=0, $arrayofjs= '', $arrayofcss= '', $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
Definition: main.inc.php:1478
isModEnabled($module)
Is Dolibarr module enabled.
Class to manage invoices.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:119