30if (!defined(
'NOTOKENRENEWAL')) {
31 define(
'NOTOKENRENEWAL',
'1');
33if (!defined(
'NOREQUIREMENU')) {
34 define(
'NOREQUIREMENU',
'1');
36if (!defined(
'NOREQUIREHTML')) {
37 define(
'NOREQUIREHTML',
'1');
41require
'../main.inc.php';
42require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/stripe/class/stripe.class.php';
47$langs->loadLangs(array(
"main",
"bills",
"cashdesk",
"banks"));
49$place = (
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') :
'0');
51$invoiceid =
GETPOST(
'invoiceid',
'int');
53$hookmanager->initHooks(array(
'takepospay'));
55if (empty($user->rights->takepos->run)) {
64$arrayofcss = array(
'/takepos/css/pos.css.php');
72$head=
'<link rel="stylesheet" href="css/pos.css.php">';
74 $head .=
'<link rel="stylesheet" href="css/colorful.css">';
77top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
83$usestripeterminals = 0;
85if (isModEnabled(
'stripe')) {
86 $service =
'StripeTest';
88 if (!empty($conf->global->STRIPE_LIVE) && !
GETPOST(
'forcesandbox',
'alpha')) {
89 $service =
'StripeLive';
94 global $stripearrayofkeysbyenv;
95 $site_account = $stripearrayofkeysbyenv[$servicestatus][
'publishable_key'];
98 $stripeacc = $stripe->getStripeAccount($service);
99 $stripecu = $stripe->getStripeCustomerAccount($object->id, $servicestatus, $site_account);
100 $keyforstripeterminalbank =
"CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".$_SESSION[
"takeposterminal"];
104 if ($usestripeterminals) {
106<script src=
"https://js.stripe.com/terminal/v1/"></script>
108var terminal = StripeTerminal.create({
109 onFetchConnectionToken: fetchConnectionToken,
110 onUnexpectedReaderDisconnect: unexpectedDisconnect,
113function unexpectedDisconnect() {
116 console.log(
"Disconnected from reader")
119function fetchConnectionToken() {
121 $urlconnexiontoken = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=getConnexionToken&token='.newToken().
'&servicestatus='.urlencode($servicestatus);
122 if (!empty($conf->global->STRIPE_LOCATION)) {
123 $urlconnexiontoken .=
'&location='.urlencode($conf->global->STRIPE_LOCATION);
125 if (!empty($stripeacc)) {
126 $urlconnexiontoken .=
'&stripeacc='.urlencode($stripeacc);
130 return fetch(
'<?php echo $urlconnexiontoken; ?>', { method:
"POST" })
131 .then(
function(response) {
132 return response.json();
134 .then(
function(data) {
144if (isModEnabled(
'stripe') && isset($keyforstripeterminalbank) && (empty($conf->global->STRIPE_LIVE) ||
GETPOST(
'forcesandbox',
'alpha'))) {
145 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'),
'',
'warning', 1);
150 $invoice->fetch($invoiceid);
152 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture";
153 $sql .=
" WHERE entity IN (".getEntity(
'invoice').
")";
154 $sql .=
" AND ref='(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
155 $resql = $db->query($sql);
156 $obj = $db->fetch_object($resql);
158 $invoiceid = $obj->rowid;
163 $invoice->fetch($invoiceid);
170if ($usestripeterminals && $invoice->type != $invoice::TYPE_CREDIT_NOTE) {
171 if (empty($conf->global->$keyforstripeterminalbank)) { ?>
173 simulated: <?php
if (empty($servicestatus) && !empty($conf->global->STRIPE_TERMINAL_SIMULATED)) { ?>
true <?php }
else { ?> false <?php } ?>
174 <?php
if (!empty($conf->global->STRIPE_LOCATION)) { ?>, location:
'<?php echo $conf->global->STRIPE_LOCATION; ?>'<?php } ?>
176 terminal.discoverReaders(config).then(
function(discoverResult) {
177 if (discoverResult.error) {
178 console.log(
'Failed to discover: ', discoverResult.error);
179 }
else if (discoverResult.discoveredReaders.length === 0) {
180 console.log(
'No available readers.');
184 selectedReader = discoverResult.discoveredReaders[0];
187 terminal.connectReader(selectedReader).then(function(connectResult) {
188 if (connectResult.error) {
189 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error">'+connectResult.error.message+
'</div>';
190 console.log(
'Failed to connect: ', connectResult.error);
192 document.getElementById(
"card-present-alert").innerHTML =
'';
193 console.log(
'Connected to reader: ', connectResult.reader.label);
194 if (document.getElementById(
"StripeTerminal")) {
195 document.getElementById(
"StripeTerminal").innerHTML =
'<button type="button" class="calcbutton2" onclick="ValidateStripeTerminal();"><span class="fa fa-2x fa-credit-card iconwithlabel"></span><br>'+connectResult.reader.label+
'</button>';
203 terminal.connectReader(<?php echo json_encode($stripe->getSelectedReader($conf->global->$keyforstripeterminalbank, $stripeacc, $servicestatus)); ?>).then(
function(connectResult) {
204 if (connectResult.error) {
205 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+connectResult.error.message+
'</div>';
206 console.log(
'Failed to connect: ', connectResult.error);
208 document.getElementById(
"card-present-alert").innerHTML =
'';
209 console.log(
'Connected to reader: ', connectResult.reader.label);
210 if (document.getElementById(
"StripeTerminal")) {
211 document.getElementById(
"StripeTerminal").innerHTML =
'<button type="button" class="calcbutton2" onclick="ValidateStripeTerminal();"><span class="fa fa-2x fa-credit-card iconwithlabel"></span><br>'+connectResult.reader.label+
'</button>';
221$arrayOfValidPaymentModes = array();
222$arrayOfValidBankAccount = array();
224$sql =
"SELECT code, libelle as label FROM ".MAIN_DB_PREFIX.
"c_paiement";
225$sql .=
" WHERE entity IN (".getEntity(
'c_paiement').
")";
226$sql .=
" AND active = 1";
227$sql .=
" ORDER BY libelle";
228$resql = $db->query($sql);
231 while ($obj = $db->fetch_object($resql)) {
232 $paycode = $obj->code;
233 if ($paycode ==
'LIQ') {
236 if ($paycode ==
'CB') {
239 if ($paycode ==
'CHQ') {
243 $accountname =
"CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION[
"takeposterminal"];
244 if (!empty($conf->global->$accountname) && $conf->global->$accountname > 0) {
245 $arrayOfValidBankAccount[$conf->global->$accountname] = $conf->global->$accountname;
246 $arrayOfValidPaymentModes[] = $obj;
248 if (!isModEnabled(
'banque')) {
249 if ($paycode ==
'CASH' || $paycode ==
'CB') $arrayOfValidPaymentModes[] = $obj;
259if ($invoice->id > 0) {
260 $remaintopay = $invoice->getRemainToPay();
262$alreadypayed = (is_object($invoice) ? ($invoice->total_ttc - $remaintopay) : 0);
264if ($conf->global->TAKEPOS_NUMPAD == 0) {
265 print
"var received='';";
267 print
"var received=0;";
271 var alreadypayed = <?php echo $alreadypayed ?>;
273 function addreceived(
price)
276 if (empty($conf->global->TAKEPOS_NUMPAD)) {
277 print
'received+=String(price);'.
"\n";
279 print
'received+=parseFloat(price);'.
"\n";
282 $(
'.change1').html(
pricejs(parseFloat(received),
'MT'));
283 $(
'.change1').val(parseFloat(received));
284 alreadypaydplusreceived=
price2numjs(alreadypayed + parseFloat(received));
287 if (alreadypaydplusreceived > <?php echo $invoice->total_ttc; ?>)
289 var change=parseFloat(alreadypayed + parseFloat(received) - <?php echo $invoice->total_ttc; ?>);
290 $(
'.change2').html(
pricejs(change,
'MT'));
291 $(
'.change2').val(change);
292 $(
'.change1').removeClass(
'colorred');
293 $(
'.change1').addClass(
'colorgreen');
294 $(
'.change2').removeClass(
'colorwhite');
295 $(
'.change2').addClass(
'colorred');
299 $(
'.change2').html(
pricejs(0,
'MT'));
300 $(
'.change2').val(0);
301 if (alreadypaydplusreceived == <?php echo $invoice->total_ttc; ?>)
303 $(
'.change1').removeClass(
'colorred');
304 $(
'.change1').addClass(
'colorgreen');
305 $(
'.change2').removeClass(
'colorred');
306 $(
'.change2').addClass(
'colorwhite');
310 $(
'.change1').removeClass(
'colorgreen');
311 $(
'.change1').addClass(
'colorred');
312 $(
'.change2').removeClass(
'colorred');
313 $(
'.change2').addClass(
'colorwhite');
323 $(
'.change1').html(
pricejs(received,
'MT'));
325 $(
'.change2').html(
pricejs(received,
'MT'));
327 $(
'.change1').removeClass(
'colorgreen');
328 $(
'.change1').addClass(
'colorred');
329 $(
'.change2').removeClass(
'colorred');
330 $(
'.change2').addClass(
'colorwhite');
335 console.log(
"Launch Validate");
337 var invoiceid = <?php echo ($invoiceid > 0 ? $invoiceid : 0); ?>;
338 var accountid = $(
"#selectaccountid").val();
339 var amountpayed = $(
"#change1").val();
340 var excess = $(
"#change2").val();
341 if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
342 amountpayed = <?php echo $invoice->total_ttc; ?>;
344 console.log(
"We click on the payment mode to pay amount = "+amountpayed);
345 parent.$(
"#poslines").load(
"invoice.php?place=<?php echo $place; ?>&action=valid&token=<?php echo newToken(); ?>&pay="+payment+
"&amount="+amountpayed+
"&excess="+excess+
"&invoiceid="+invoiceid+
"&accountid="+accountid,
function() {
346 if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
347 console.log(
"Close popup");
348 parent.$.colorbox.close();
351 console.log(
"Amount is not comple, so we do NOT close popup and reload it.");
359 function fetchPaymentIntentClientSecret(amount, invoiceid) {
360 const bodyContent = JSON.stringify({ amount : amount, invoiceid : invoiceid });
362 $urlpaymentintent = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=createPaymentIntent&token='.newToken().
'&servicestatus='.$servicestatus;
363 if (!empty($stripeacc)) $urlpaymentintent .=
'&stripeacc='.$stripeacc;
365 return fetch(
'<?php echo $urlpaymentintent; ?>', {
368 'Content-Type':
'application/json'
372 .then(
function(response) {
373 return response.json();
375 .then(
function(data) {
376 return data.client_secret;
381 function capturePaymentIntent(paymentIntentId) {
382 const bodyContent = JSON.stringify({
"id": paymentIntentId})
384 $urlpaymentintent = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=capturePaymentIntent&token='.newToken().
'&servicestatus='.urlencode($servicestatus);
385 if (!empty($stripeacc)) {
386 $urlpaymentintent .=
'&stripeacc='.urlencode($stripeacc);
389 return fetch(
'<?php echo $urlpaymentintent; ?>', {
392 'Content-Type':
'application/json'
396 .then(
function(response) {
397 return response.json();
399 .then(
function(data) {
400 return data.client_secret;
405 function ValidateStripeTerminal() {
406 console.log(
"Launch ValidateStripeTerminal");
407 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
408 var accountid = $(
"#selectaccountid").val();
409 var amountpayed = $(
"#change1").val();
410 var excess = $(
"#change2").val();
411 if (amountpayed > <?php echo $invoice->getRemainToPay(); ?>) {
412 amountpayed = <?php echo $invoice->getRemainToPay(); ?>;
414 if (amountpayed == 0) {
415 amountpayed = <?php echo $invoice->getRemainToPay(); ?>;
418 console.log(
"Pay with terminal ", amountpayed);
420 fetchPaymentIntentClientSecret(amountpayed, invoiceid).then(
function(client_secret) {
421 <?php
if (empty($servicestatus) && !empty($conf->global->STRIPE_TERMINAL_SIMULATED)) { ?>
422 terminal.setSimulatorConfiguration({testCardNumber:
'<?php echo $conf->global->STRIPE_TERMINAL_SIMULATED; ?>'});
424 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentSendToStripeTerminal
'); ?></div>';
425 terminal.collectPaymentMethod(client_secret).then(
function(result) {
428 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
430 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentBeingProcessed
'); ?></div>';
431 console.log(
'terminal.collectPaymentMethod', result.paymentIntent);
432 terminal.processPayment(result.paymentIntent).then(function(result) {
434 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
435 console.log(result.error)
436 } else if (result.paymentIntent) {
437 paymentIntentId = result.paymentIntent.id;
438 console.log(
'terminal.processPayment', result.paymentIntent);
439 capturePaymentIntent(paymentIntentId).then(function(client_secret) {
442 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
443 console.log(
"error when capturing paymentIntent", result.error);
445 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentValidated
'); ?></div>';
446 console.log(
"Capture paymentIntent successfull "+paymentIntentId);
447 parent.$(
"#poslines").load(
"invoice.php?place=<?php echo $place; ?>&action=valid&token=<?php echo newToken(); ?>&pay=CB&amount="+amountpayed+
"&excess="+excess+
"&invoiceid="+invoiceid+
"&accountid="+accountid, function() {
448 if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
449 console.log(
"Close popup");
450 parent.$.colorbox.close();
453 console.log(
"Amount is not comple, so we do NOT close popup and reload it.");
467 function ValidateSumup() {
468 console.log(
"Launch ValidateSumup");
469 <?php $_SESSION[
'SMP_CURRENT_PAYMENT'] =
"NEW" ?>
470 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
471 var amountpayed = $(
"#change1").val();
472 if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
473 amountpayed = <?php echo $invoice->total_ttc; ?>;
477 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 +
'¤cy=EUR&title=' + invoiceid +
'&callback=<?php echo DOL_MAIN_URL_ROOT ?>/takepos/smpcb.php');
479 var loop = window.setInterval(
function () {
482 data: { token:
'<?php echo currentToken(); ?>' },
483 url:
'<?php echo DOL_URL_ROOT ?>/takepos/smpcb.php?status' }).done(
function (data) {
485 if (data ===
"SUCCESS") {
486 parent.$(
"#poslines").load(
"invoice.php?place=<?php echo $place; ?>&action=valid&token=<?php echo newToken(); ?>&pay=CB&amount=" + amountpayed +
"&invoiceid=" + invoiceid,
function () {
488 parent.$.colorbox.close();
492 }
else if (data ===
"FAILED") {
493 parent.$.colorbox.close();
501if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) {
502 echo
"var line1='".$langs->trans(
'TotalTTC').
"'.substring(0,20);";
503 echo
"line1=line1.padEnd(20);";
504 echo
"var line2='".price($invoice->total_ttc, 1,
'', 1, -1, -1).
"'.substring(0,20);";
505 echo
"line2=line2.padEnd(20);";
508 data: { text: line1+line2 },
509 url: '".getDolGlobalString(
'TAKEPOS_PRINT_SERVER').
"/display/index.php',
516$showothercurrency = 0;
517if (isModEnabled(
'multicurrency') && $_SESSION[
"takeposcustomercurrency"] !=
"" && $conf->currency != $_SESSION[
"takeposcustomercurrency"]) {
519 $showothercurrency = 1;
520 include_once DOL_DOCUMENT_ROOT .
'/multicurrency/class/multicurrency.class.php';
522 $multicurrency->fetch(0, $_SESSION[
"takeposcustomercurrency"]);
526<div style=
"position:relative; padding-top: 20px; left:5%; height:140px; width:90%;">
527 <div
class=
"paymentbordline paymentbordlinetotal center">
528 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
'TotalTTC'); ?>: <span
id=
"totaldisplay" class=
"colorwhite"><?php
529 echo
price($invoice->total_ttc, 1,
'', 1, -1, -1, $conf->currency);
530 if ($showothercurrency) {
531 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price($invoice->total_ht * $multicurrency->rate->rate) .
' ' . $_SESSION[
"takeposcustomercurrency"] .
')</span>';
535 <?php
if ($remaintopay != $invoice->total_ttc) { ?>
536 <div
class=
"paymentbordline paymentbordlineremain center">
537 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
'RemainToPay'); ?>: <span
id=
"remaintopaydisplay" class=
"colorwhite"><?php
538 echo
price($remaintopay, 1,
'', 1, -1, -1, $invoice->multicurrency_code);
539 if ($showothercurrency) {
540 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price($remaintopay * $multicurrency->rate->rate) .
' ' . $_SESSION[
"takeposcustomercurrency"] .
')</span>';
545 <div
class=
"paymentbordline paymentbordlinereceived center">
546 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
"Received"); ?>: <span
class=
"change1 colorred"><?php
547 echo
price(0, 1,
'', 1, -1, -1, $invoice->multicurrency_code);
548 if ($showothercurrency) {
549 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price(0 * $multicurrency->rate->rate) .
' ' . $_SESSION[
"takeposcustomercurrency"] .
')</span>';
551 ?></span><input
type=
"hidden" id=
"change1" class=
"change1" value=
"0"></span>
553 <div
class=
"paymentbordline paymentbordlinechange center">
554 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
"Change"); ?>: <span
class=
"change2 colorwhite"><?php
555 echo
price(0, 1,
'', 1, -1, -1, $invoice->multicurrency_code);
556 if ($showothercurrency) {
557 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price(0 * $multicurrency->rate->rate) .
' ' . $_SESSION[
"takeposcustomercurrency"] .
')</span>';
559 ?></span><input
type=
"hidden" id=
"change2" class=
"change2" value=
"0"></span>
562 if (!empty($conf->global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) {
563 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
564 print
'<div class="paymentbordline paddingtop paddingbottom center">';
566 $form =
new Form($db);
567 print
'<span class="takepospay colorwhite">'.$langs->trans(
"BankAccount").
': </span>';
568 $form->select_comptes(0,
'accountid', 0, $filter, 1,
'');
574<div style=
"position:absolute; left:5%; height:52%; width:90%;">
576$action_buttons = array(
578 "function" =>
"reset()",
579 "span" =>
"style='font-size: 150%;'",
581 "class" =>
"poscolorblue"
584 "function" =>
"parent.$.colorbox.close();",
585 "span" =>
"id='printtext' style='font-weight: bold; font-size: 18pt;'",
587 "class" =>
"poscolordelete"
590$numpad = $conf->global->TAKEPOS_NUMPAD;
591if (isModEnabled(
'stripe') && isset($keyforstripeterminalbank) && !empty($conf->global->STRIPE_CARD_PRESENT)) {
592 print
'<span id="card-present-alert">';
593 dol_htmloutput_mesg($langs->trans(
'ConnectingToStripeTerminal',
'Stripe'),
'',
'warning', 1);
596print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'7' :
'10').
')">'.($numpad == 0 ?
'7' :
'10').
'</button>';
597print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'8' :
'20').
')">'.($numpad == 0 ?
'8' :
'20').
'</button>';
598print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'9' :
'50').
')">'.($numpad == 0 ?
'9' :
'50').
'</button>';
600<?php
if (count($arrayOfValidPaymentModes) > 0) {
601 $paycode = $arrayOfValidPaymentModes[0]->code;
603 if ($paycode ==
'LIQ') {
604 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
607 } elseif ($paycode ==
'CB') {
608 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
609 $payIcon =
'credit-card';
611 } elseif ($paycode ==
'CHQ') {
612 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
613 $payIcon =
'money-check';
617 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>';
619 print '<button type="button" class="calcbutton2
">'.$langs->trans("NoPaimementModesDefined
").'</button>';
622print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '4
' : '1
').')
">'.($numpad == 0 ? '4' : '1').'</button>';
623print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '5
' : '2
').')
">'.($numpad == 0 ? '5' : '2').'</button>';
624print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '6
' : '5
').')
">'.($numpad == 0 ? '6' : '5').'</button>';
626<?php if (count($arrayOfValidPaymentModes) > 1) {
627 $paycode = $arrayOfValidPaymentModes[1]->code;
629 if ($paycode == 'LIQ') {
630 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
633 } elseif ($paycode == 'CB') {
634 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
635 $payIcon = 'credit-card';
637 } elseif ($paycode == 'CHQ') {
638 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
639 $payIcon = 'money-check';
643 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>';
645 $button = array_pop($action_buttons);
646 print '<button type="button" class="calcbutton2
" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
649print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '1
' : '0.10
').')
">'.($numpad == 0 ? '1' : '0.10').'</button>';
650print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '2
' : '0.20
').')
">'.($numpad == 0 ? '2' : '0.20').'</button>';
651print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '3
' : '0.50
').')
">'.($numpad == 0 ? '3' : '0.50').'</button>';
653<?php if (count($arrayOfValidPaymentModes) > 2) {
654 $paycode = $arrayOfValidPaymentModes[2]->code;
656 if ($paycode == 'LIQ') {
657 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
660 } elseif ($paycode == 'CB') {
661 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
662 $payIcon = 'credit-card';
664 } elseif ($paycode == 'CHQ') {
665 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
666 $payIcon = 'money-check';
670 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>';
672 $button = array_pop($action_buttons);
673 print '<button type="button" class="calcbutton2
" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
676print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '0
' : '0.01
').')
">'.($numpad == 0 ? '0' : '0.01').'</button>';
677print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '\
'000\'' :
'0.02').
')">'.($numpad == 0 ?
'000' :
'0.02').
'</button>';
678print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'\'.\
'' :
'0.05').
')">'.($numpad == 0 ?
'.' :
'0.05').
'</button>';
681while ($i < count($arrayOfValidPaymentModes)) {
682 $paycode = $arrayOfValidPaymentModes[$i]->code;
684 if ($paycode ==
'LIQ') {
685 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
688 } elseif ($paycode ==
'CB') {
689 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
690 $payIcon =
'credit-card';
692 } elseif ($paycode ==
'CHQ') {
693 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
694 $payIcon =
'money-check';
698 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>';
702if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && !empty($conf->global->STRIPE_CARD_PRESENT)) {
703 $keyforstripeterminalbank = "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL
".$_SESSION["takeposterminal
"];
704 print '<span id="StripeTerminal
"></span>';
705 if (!empty($conf->global->$keyforstripeterminalbank)) {
707 $langs->loadLangs(array("errors
", "admin
"));
708 //print '<button type="button" class="calcbutton2 disabled
" title="'.$langs->trans("SetupNotComplete").'">TerminalOff</button>';
712$keyforsumupbank = "CASHDESK_ID_BANKACCOUNT_SUMUP
".$_SESSION["takeposterminal
"];
713if (getDolGlobalInt('TAKEPOS_ENABLE_SUMUP')) {
714 if (!empty($conf->global->$keyforsumupbank)) {
715 print '<button type="button" class="calcbutton2
" onclick="ValidateSumup();
">Sumup</button>';
717 $langs->loadLangs(array("errors
", "admin
"));
718 print '<button type="button" class="calcbutton2 disabled
" title="'.$langs->trans("SetupNotComplete").'">Sumup</button>';
722$parameters = array();
723$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $invoice, $action); // Note that $action and $object may have been modified by hook
724if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
726$class = ($i == 3) ? "calcbutton3
" : "calcbutton2
";
727foreach ($action_buttons as $button) {
728 $newclass = $class.($button["class"] ? " ".$button["class"] : "");
729 print '<button type="button" class="'.$newclass.'" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
732if (getDolGlobalString('TAKEPOS_DELAYED_PAYMENT')) {
733 print '<button type="button" class="calcbutton2
" onclick="Validate(\
'delayed\')">'.$langs->trans(
"Reported").
'</button>';
740$hookmanager->executeHooks(
'completePayment', $parameters, $invoice);
741print $hookmanager->resPrint;
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
Class to manage invoices.
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.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formated messages to output (Used to show messages on html output).
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
pricejs(amount, mode='MT', currency_code='', force_locale='')
Function similar to PHP price()
price2numjs(amount)
Function similar to PHP price2num()
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
ui dialog ui datepicker calendar ui widget content ui state ui datepicker calendar ui widget header ui state ui datepicker calendar ui button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.