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 (!$user->hasRight(
'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';
89 $service =
'StripeLive';
94 global $stripearrayofkeysbyenv;
95 $site_account = $stripearrayofkeysbyenv[$servicestatus][
'publishable_key'];
98 $stripeacc = $stripe->getStripeAccount($service);
100 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
101 $invoicetmp =
new Facture($db);
102 $invoicetmp->fetch($invoiceid);
103 $stripecu = $stripe->getStripeCustomerAccount($invoicetmp->socid, $servicestatus, $site_account);
104 $keyforstripeterminalbank =
"CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".(empty($_SESSION[
'takeposterminal']) ?
'' : $_SESSION[
'takeposterminal']);
108 if ($usestripeterminals) {
110<script src=
"https://js.stripe.com/terminal/v1/"></script>
112var terminal = StripeTerminal.create({
113 onFetchConnectionToken: fetchConnectionToken,
114 onUnexpectedReaderDisconnect: unexpectedDisconnect,
117function unexpectedDisconnect() {
120 console.log(
"Disconnected from reader")
123function fetchConnectionToken() {
125 $urlconnexiontoken = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=getConnexionToken&token='.newToken().
'&servicestatus='.urlencode($servicestatus);
127 $urlconnexiontoken .=
'&location='.urlencode($conf->global->STRIPE_LOCATION);
129 if (!empty($stripeacc)) {
130 $urlconnexiontoken .=
'&stripeacc='.urlencode($stripeacc);
133 return fetch(
'<?php echo $urlconnexiontoken; ?>', { method:
"POST" })
134 .then(
function(response) {
135 return response.json();
137 .then(
function(data) {
147if (isModEnabled(
'stripe') && isset($keyforstripeterminalbank) && (!
getDolGlobalString(
'STRIPE_LIVE') ||
GETPOST(
'forcesandbox',
'alpha'))) {
148 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'),
'',
'warning', 1);
153 $invoice->fetch($invoiceid);
155 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture";
156 $sql .=
" WHERE entity IN (".getEntity(
'invoice').
")";
157 $sql .=
" AND ref = '(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
158 $resql = $db->query($sql);
159 $obj = $db->fetch_object($resql);
161 $invoiceid = $obj->rowid;
166 $invoice->fetch($invoiceid);
173if ($usestripeterminals && $invoice->type != $invoice::TYPE_CREDIT_NOTE) {
176 simulated: <?php
if (empty($servicestatus) &&
getDolGlobalString(
'STRIPE_TERMINAL_SIMULATED')) { ?>
true <?php }
else { ?> false <?php } ?>
177 <?php
if (
getDolGlobalString(
'STRIPE_LOCATION')) { ?>, location:
'<?php echo $conf->global->STRIPE_LOCATION; ?>'<?php } ?>
179 terminal.discoverReaders(config).then(
function(discoverResult) {
180 if (discoverResult.error) {
181 console.log(
'Failed to discover: ', discoverResult.error);
182 }
else if (discoverResult.discoveredReaders.length === 0) {
183 console.log(
'No available readers.');
187 selectedReader = discoverResult.discoveredReaders[0];
190 terminal.connectReader(selectedReader).then(function(connectResult) {
191 if (connectResult.error) {
192 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error">'+connectResult.error.message+
'</div>';
193 console.log(
'Failed to connect: ', connectResult.error);
195 document.getElementById(
"card-present-alert").innerHTML =
'';
196 console.log(
'Connected to reader: ', connectResult.reader.label);
197 if (document.getElementById(
"StripeTerminal")) {
198 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>';
205 terminal.connectReader(<?php echo json_encode($stripe->getSelectedReader(
getDolGlobalString($keyforstripeterminalbank), $stripeacc, $servicestatus)); ?>).then(
function(connectResult) {
206 if (connectResult.error) {
207 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+connectResult.error.message+
'</div>';
208 console.log(
'Failed to connect: ', connectResult.error);
210 document.getElementById(
"card-present-alert").innerHTML =
'';
211 console.log(
'Connected to reader: ', connectResult.reader.label);
212 if (document.getElementById(
"StripeTerminal")) {
213 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>';
224$arrayOfValidPaymentModes = array();
225$arrayOfValidBankAccount = array();
227$sql =
"SELECT code, libelle as label FROM ".MAIN_DB_PREFIX.
"c_paiement";
228$sql .=
" WHERE entity IN (".getEntity(
'c_paiement').
")";
229$sql .=
" AND active = 1";
230$sql .=
" ORDER BY libelle";
231$resql = $db->query($sql);
234 while ($obj = $db->fetch_object($resql)) {
235 $paycode = $obj->code;
236 if ($paycode ==
'LIQ') {
239 if ($paycode ==
'CB') {
242 if ($paycode ==
'CHQ') {
246 $accountname =
"CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION[
"takeposterminal"];
249 $arrayOfValidPaymentModes[] = $obj;
251 if (!isModEnabled(
'banque')) {
252 if ($paycode ==
'CASH' || $paycode ==
'CB') {
253 $arrayOfValidPaymentModes[] = $obj;
264if ($invoice->id > 0) {
265 $remaintopay = $invoice->getRemainToPay();
267$alreadypayed = (is_object($invoice) ? ($invoice->total_ttc - $remaintopay) : 0);
270 print
"var received='';";
272 print
"var received=0;";
276 var alreadypayed = <?php echo $alreadypayed ?>;
278 function addreceived(
price)
282 print
'received+=String(price);'.
"\n";
284 print
'received+=parseFloat(price);'.
"\n";
287 $(
'.change1').html(
pricejs(parseFloat(received),
'MT'));
288 $(
'.change1').val(parseFloat(received));
289 alreadypaydplusreceived=
price2numjs(alreadypayed + parseFloat(received));
292 if (alreadypaydplusreceived > <?php echo $invoice->total_ttc; ?>)
294 var change=parseFloat(alreadypayed + parseFloat(received) - <?php echo $invoice->total_ttc; ?>);
295 $(
'.change2').html(
pricejs(change,
'MT'));
296 $(
'.change2').val(change);
297 $(
'.change1').removeClass(
'colorred');
298 $(
'.change1').addClass(
'colorgreen');
299 $(
'.change2').removeClass(
'colorwhite');
300 $(
'.change2').addClass(
'colorred');
304 $(
'.change2').html(
pricejs(0,
'MT'));
305 $(
'.change2').val(0);
306 if (alreadypaydplusreceived == <?php echo $invoice->total_ttc; ?>)
308 $(
'.change1').removeClass(
'colorred');
309 $(
'.change1').addClass(
'colorgreen');
310 $(
'.change2').removeClass(
'colorred');
311 $(
'.change2').addClass(
'colorwhite');
315 $(
'.change1').removeClass(
'colorgreen');
316 $(
'.change1').addClass(
'colorred');
317 $(
'.change2').removeClass(
'colorred');
318 $(
'.change2').addClass(
'colorwhite');
328 $(
'.change1').html(
pricejs(received,
'MT'));
330 $(
'.change2').html(
pricejs(received,
'MT'));
332 $(
'.change1').removeClass(
'colorgreen');
333 $(
'.change1').addClass(
'colorred');
334 $(
'.change2').removeClass(
'colorred');
335 $(
'.change2').addClass(
'colorwhite');
340 console.log(
"Launch Validate");
342 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
343 var accountid = $(
"#selectaccountid").val();
344 var amountpayed = $(
"#change1").val();
345 var excess = $(
"#change2").val();
346 if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
347 amountpayed = <?php echo $invoice->total_ttc; ?>;
349 console.log(
"We click on the payment mode to pay amount = "+amountpayed);
350 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() {
351 if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
352 console.log(
"Close popup");
353 parent.$.colorbox.close();
356 console.log(
"Amount is not complete, so we do NOT close popup and reload it.");
364 function fetchPaymentIntentClientSecret(amount, invoiceid) {
365 const bodyContent = JSON.stringify({ amount : amount, invoiceid : invoiceid });
367 $urlpaymentintent = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=createPaymentIntent&token='.newToken().
'&servicestatus='.$servicestatus;
368 if (!empty($stripeacc)) {
369 $urlpaymentintent .=
'&stripeacc='.$stripeacc;
372 return fetch(
'<?php echo $urlpaymentintent; ?>', {
375 'Content-Type':
'application/json'
379 .then(
function(response) {
380 return response.json();
382 .then(
function(data) {
383 return data.client_secret;
388 function capturePaymentIntent(paymentIntentId) {
389 const bodyContent = JSON.stringify({
"id": paymentIntentId})
391 $urlpaymentintent = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=capturePaymentIntent&token='.newToken().
'&servicestatus='.urlencode($servicestatus);
392 if (!empty($stripeacc)) {
393 $urlpaymentintent .=
'&stripeacc='.urlencode($stripeacc);
396 return fetch(
'<?php echo $urlpaymentintent; ?>', {
399 'Content-Type':
'application/json'
403 .then(
function(response) {
404 return response.json();
406 .then(
function(data) {
407 return data.client_secret;
412 function ValidateStripeTerminal() {
413 console.log(
"Launch ValidateStripeTerminal");
414 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
415 var accountid = $(
"#selectaccountid").val();
416 var amountpayed = $(
"#change1").val();
417 var excess = $(
"#change2").val();
418 if (amountpayed > <?php echo $invoice->getRemainToPay(); ?>) {
419 amountpayed = <?php echo $invoice->getRemainToPay(); ?>;
421 if (amountpayed == 0) {
422 amountpayed = <?php echo $invoice->getRemainToPay(); ?>;
425 console.log(
"Pay with terminal ", amountpayed);
427 fetchPaymentIntentClientSecret(amountpayed, invoiceid).then(
function(client_secret) {
428 <?php
if (empty($servicestatus) &&
getDolGlobalString(
'STRIPE_TERMINAL_SIMULATED')) { ?>
429 terminal.setSimulatorConfiguration({testCardNumber:
'<?php echo $conf->global->STRIPE_TERMINAL_SIMULATED; ?>'});
431 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentSendToStripeTerminal
'); ?></div>';
432 terminal.collectPaymentMethod(client_secret).then(
function(result) {
435 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
437 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentBeingProcessed
'); ?></div>';
438 console.log(
'terminal.collectPaymentMethod', result.paymentIntent);
439 terminal.processPayment(result.paymentIntent).then(function(result) {
441 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
442 console.log(result.error)
443 } else if (result.paymentIntent) {
444 paymentIntentId = result.paymentIntent.id;
445 console.log(
'terminal.processPayment', result.paymentIntent);
446 capturePaymentIntent(paymentIntentId).then(function(client_secret) {
449 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
450 console.log(
"error when capturing paymentIntent", result.error);
452 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentValidated
'); ?></div>';
453 console.log(
"Capture paymentIntent successfull "+paymentIntentId);
454 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() {
455 if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
456 console.log(
"Close popup");
457 parent.$.colorbox.close();
460 console.log(
"Amount is not comple, so we do NOT close popup and reload it.");
474 function ValidateSumup() {
475 console.log(
"Launch ValidateSumup");
476 <?php $_SESSION[
'SMP_CURRENT_PAYMENT'] =
"NEW" ?>
477 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
478 var amountpayed = $(
"#change1").val();
479 if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
480 amountpayed = <?php echo $invoice->total_ttc; ?>;
482 if (amountpayed == 0) {
483 amountpayed = <?php echo $invoice->total_ttc; ?>;
485 var currencycode =
"<?php echo $invoice->multicurrency_code; ?>";
488 window.open(
'sumupmerchant://pay/1.0?affiliate-key=<?php echo urlencode(getDolGlobalString('TAKEPOS_SUMUP_AFFILIATE
')) ?>&app-id=<?php echo urlencode(getDolGlobalString('TAKEPOS_SUMUP_APPID
')) ?>&amount=' + amountpayed +
'¤cy=' + currencycode +
'&title=' + invoiceid +
'&callback=<?php echo DOL_MAIN_URL_ROOT ?>/takepos/smpcb.php');
490 var loop = window.setInterval(
function () {
493 data: { token:
'<?php echo currentToken(); ?>' },
494 url:
'<?php echo DOL_URL_ROOT ?>/takepos/smpcb.php?status' }).done(
function (data) {
496 if (data ===
"SUCCESS") {
497 parent.$(
"#poslines").load(
"invoice.php?place=<?php echo urlencode($place); ?>&action=valid&token=<?php echo newToken(); ?>&pay=CB&amount=" + amountpayed +
"&invoiceid=" + invoiceid,
function () {
499 parent.$.colorbox.close();
503 }
else if (data ===
"FAILED") {
504 parent.$.colorbox.close();
513 echo
"var line1='".$langs->trans(
'TotalTTC').
"'.substring(0,20);";
514 echo
"line1=line1.padEnd(20);";
515 echo
"var line2='".price($invoice->total_ttc, 1,
'', 1, -1, -1).
"'.substring(0,20);";
516 echo
"line2=line2.padEnd(20);";
519 data: { text: line1+line2 },
520 url: '".getDolGlobalString(
'TAKEPOS_PRINT_SERVER').
"/display/index.php',
527$showothercurrency = 0;
528if (isModEnabled(
'multicurrency') && !empty($_SESSION[
"takeposcustomercurrency"]) && $_SESSION[
"takeposcustomercurrency"] !=
"" && $conf->currency != $_SESSION[
"takeposcustomercurrency"]) {
530 $showothercurrency = 1;
531 include_once DOL_DOCUMENT_ROOT .
'/multicurrency/class/multicurrency.class.php';
533 $multicurrency->fetch(0, $_SESSION[
"takeposcustomercurrency"]);
537<div style=
"position:relative; padding-top: 20px; left:5%; height:140px; width:90%;">
538 <div
class=
"paymentbordline paymentbordlinetotal center">
539 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
'TotalTTC'); ?>: <span
id=
"totaldisplay" class=
"colorwhite"><?php
540 echo
price($invoice->total_ttc, 1,
'', 1, -1, -1, $conf->currency);
541 if ($showothercurrency) {
542 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>';
546 <?php
if ($remaintopay != $invoice->total_ttc) { ?>
547 <div
class=
"paymentbordline paymentbordlineremain center">
548 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
'RemainToPay'); ?>: <span
id=
"remaintopaydisplay" class=
"colorwhite"><?php
549 echo
price($remaintopay, 1,
'', 1, -1, -1, $invoice->multicurrency_code);
550 if ($showothercurrency) {
551 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price($remaintopay * $multicurrency->rate->rate) .
' ' . $_SESSION[
"takeposcustomercurrency"] .
')</span>';
556 <div
class=
"paymentbordline paymentbordlinereceived center">
557 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
"Received"); ?>: <span
class=
"change1 colorred"><?php
558 echo
price(0, 1,
'', 1, -1, -1, $invoice->multicurrency_code);
559 if ($showothercurrency) {
560 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price(0 * $multicurrency->rate->rate) .
' ' . $_SESSION[
"takeposcustomercurrency"] .
')</span>';
562 ?></span><input
type=
"hidden" id=
"change1" class=
"change1" value=
"0"></span>
564 <div
class=
"paymentbordline paymentbordlinechange center">
565 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
"Change"); ?>: <span
class=
"change2 colorwhite"><?php
566 echo
price(0, 1,
'', 1, -1, -1, $invoice->multicurrency_code);
567 if ($showothercurrency) {
568 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price(0 * $multicurrency->rate->rate) .
' ' . $_SESSION[
"takeposcustomercurrency"] .
')</span>';
570 ?></span><input
type=
"hidden" id=
"change2" class=
"change2" value=
"0"></span>
574 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
575 print
'<div class="paymentbordline paddingtop paddingbottom center">';
577 $form =
new Form($db);
578 print
'<span class="takepospay colorwhite">'.$langs->trans(
"BankAccount").
': </span>';
579 $form->select_comptes(0,
'accountid', 0, $filter, 1,
'');
585<div style=
"position:absolute; left:5%; height:52%; width:90%;">
587$action_buttons = array(
589 "function" =>
"reset()",
590 "span" =>
"style='font-size: 150%;'",
592 "class" =>
"poscolorblue"
595 "function" =>
"parent.$.colorbox.close();",
596 "span" =>
"id='printtext' style='font-weight: bold; font-size: 18pt;'",
598 "class" =>
"poscolordelete"
601$numpad = $conf->global->TAKEPOS_NUMPAD;
602if (isModEnabled(
'stripe') && isset($keyforstripeterminalbank) &&
getDolGlobalString(
'STRIPE_CARD_PRESENT')) {
603 print
'<span id="card-present-alert">';
604 dol_htmloutput_mesg($langs->trans(
'ConnectingToStripeTerminal',
'Stripe'),
'',
'warning', 1);
607print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'7' :
'10').
')">'.($numpad == 0 ?
'7' :
'10').
'</button>';
608print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'8' :
'20').
')">'.($numpad == 0 ?
'8' :
'20').
'</button>';
609print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'9' :
'50').
')">'.($numpad == 0 ?
'9' :
'50').
'</button>';
611<?php
if (count($arrayOfValidPaymentModes) > 0) {
612 $paycode = $arrayOfValidPaymentModes[0]->code;
614 if ($paycode ==
'LIQ') {
615 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
618 } elseif ($paycode ==
'CB') {
619 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
620 $payIcon =
'credit-card';
622 } elseif ($paycode ==
'CHQ') {
623 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
624 $payIcon =
'money-check';
628 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>';
630 print '<button type="button" class="calcbutton2
">'.$langs->trans("NoPaimementModesDefined
").'</button>';
633print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '4
' : '1
').')
">'.($numpad == 0 ? '4' : '1').'</button>';
634print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '5
' : '2
').')
">'.($numpad == 0 ? '5' : '2').'</button>';
635print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '6
' : '5
').')
">'.($numpad == 0 ? '6' : '5').'</button>';
637<?php if (count($arrayOfValidPaymentModes) > 1) {
638 $paycode = $arrayOfValidPaymentModes[1]->code;
640 if ($paycode == 'LIQ') {
641 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
644 } elseif ($paycode == 'CB') {
645 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
646 $payIcon = 'credit-card';
648 } elseif ($paycode == 'CHQ') {
649 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
650 $payIcon = 'money-check';
654 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>';
656 $button = array_pop($action_buttons);
657 print '<button type="button" class="calcbutton2
" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
660print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '1
' : '0.10
').')
">'.($numpad == 0 ? '1' : '0.10').'</button>';
661print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '2
' : '0.20
').')
">'.($numpad == 0 ? '2' : '0.20').'</button>';
662print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '3
' : '0.50
').')
">'.($numpad == 0 ? '3' : '0.50').'</button>';
664<?php if (count($arrayOfValidPaymentModes) > 2) {
665 $paycode = $arrayOfValidPaymentModes[2]->code;
667 if ($paycode == 'LIQ') {
668 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
671 } elseif ($paycode == 'CB') {
672 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
673 $payIcon = 'credit-card';
675 } elseif ($paycode == 'CHQ') {
676 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
677 $payIcon = 'money-check';
681 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>';
683 $button = array_pop($action_buttons);
684 print '<button type="button" class="calcbutton2
" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
687print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '0
' : '0.01
').')
">'.($numpad == 0 ? '0' : '0.01').'</button>';
688print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '\
'000\'' :
'0.02').
')">'.($numpad == 0 ?
'000' :
'0.02').
'</button>';
689print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'\'.\
'' :
'0.05').
')">'.($numpad == 0 ?
'.' :
'0.05').
'</button>';
692while ($i < count($arrayOfValidPaymentModes)) {
693 $paycode = $arrayOfValidPaymentModes[$i]->code;
695 if ($paycode ==
'LIQ') {
696 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
699 } elseif ($paycode ==
'CB') {
700 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
701 $payIcon =
'credit-card';
703 } elseif ($paycode ==
'CHQ') {
704 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
705 $payIcon =
'money-check';
709 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>';
713if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && getDolGlobalString('STRIPE_CARD_PRESENT')) {
714 $keyforstripeterminalbank = "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL
".$_SESSION["takeposterminal
"];
715 print '<span id="StripeTerminal
"></span>';
716 if (getDolGlobalString($keyforstripeterminalbank)) {
719 $langs->loadLangs(array("errors
", "admin
"));
720 //print '<button type="button" class="calcbutton2 disabled
" title="'.$langs->trans("SetupNotComplete").'">TerminalOff</button>';
724$keyforsumupbank = "CASHDESK_ID_BANKACCOUNT_SUMUP
".$_SESSION["takeposterminal
"];
725if (getDolGlobalInt("TAKEPOS_ENABLE_SUMUP
")) {
726 if (getDolGlobalString($keyforsumupbank)) {
727 print '<button type="button" class="calcbutton2
" onclick="ValidateSumup();
">Sumup</button>';
729 $langs->loadLangs(array("errors
", "admin
"));
730 print '<button type="button" class="calcbutton2 disabled
" title="'.$langs->trans("SetupNotComplete").'">Sumup</button>';
734$parameters = array();
735$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $invoice, $action); // Note that $action and $object may have been modified by hook
737 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
740$class = ($i == 3) ? "calcbutton3
" : "calcbutton2
";
741foreach ($action_buttons as $button) {
742 $newclass = $class.($button["class"] ? " ".$button["class"] : "");
743 print '<button type="button" class="'.$newclass.'" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
746if (getDolGlobalString('TAKEPOS_DELAYED_PAYMENT')) {
747 print '<button type="button" class="calcbutton2
" onclick="Validate(\
'delayed\')">'.$langs->trans(
"Reported").
'</button>';
754$hookmanager->executeHooks(
'completePayment', $parameters, $invoice);
755print $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 a 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=array(), $arrayofcss=array(), $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.