32if (!defined(
'NOTOKENRENEWAL')) {
33 define(
'NOTOKENRENEWAL',
'1');
35if (!defined(
'NOREQUIREMENU')) {
36 define(
'NOREQUIREMENU',
'1');
38if (!defined(
'NOREQUIREHTML')) {
39 define(
'NOREQUIREHTML',
'1');
43require
'../main.inc.php';
52require_once DOL_DOCUMENT_ROOT.
'/blockedlog/lib/blockedlog.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/stripe/class/stripe.class.php';
57$langs->loadLangs(array(
"main",
"bills",
"cashdesk",
"banks"));
59$action =
GETPOST(
'action',
'aZ09');
61$place = (
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') :
'0');
65$hookmanager->initHooks(array(
'takepospay'));
67if (!$user->hasRight(
'takepos',
'run')) {
76$arrayofcss = array(
'/takepos/css/pos.css.php');
84$head =
'<link rel="stylesheet" href="css/pos.css.php">';
86 $head .=
'<link rel="stylesheet" href="css/colorful.css">';
89top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
95$usestripeterminals = 0;
96$keyforstripeterminalbank =
'';
102 $service =
'StripeTest';
105 $service =
'StripeLive';
110 global $stripearrayofkeysbyenv;
111 $site_account = $stripearrayofkeysbyenv[$servicestatus][
'publishable_key'];
113 $stripe =
new Stripe($db);
114 $stripeacc = $stripe->getStripeAccount($service);
116 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
117 $invoicetmp =
new Facture($db);
118 $invoicetmp->fetch($invoiceid);
119 $stripecu = $stripe->getStripeCustomerAccount($invoicetmp->socid, $servicestatus, $site_account);
120 $keyforstripeterminalbank =
"CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".(empty($_SESSION[
'takeposterminal']) ?
'' : $_SESSION[
'takeposterminal']);
124 if ($usestripeterminals) {
126<script src=
"https://js.stripe.com/terminal/v1/"></script>
128var terminal = StripeTerminal.create({
129 onFetchConnectionToken: fetchConnectionToken,
130 onUnexpectedReaderDisconnect: unexpectedDisconnect,
133function unexpectedDisconnect() {
136 console.log(
"Disconnected from reader")
139function fetchConnectionToken() {
141 $urlconnexiontoken = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=getConnexionToken&token='.
currentToken().
'&servicestatus='.urlencode((
string) ($servicestatus));
145 if (!empty($stripeacc)) {
146 $urlconnexiontoken .=
'&stripeacc='.urlencode($stripeacc);
149 return fetch(
'<?php echo $urlconnexiontoken; ?>', { method:
"POST" })
150 .then(
function(response) {
151 return response.json();
153 .then(
function(data) {
164 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'), [],
'warning', 1);
169 $invoice->fetch($invoiceid);
171 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture";
172 $sql .=
" WHERE entity IN (".getEntity(
'invoice').
")";
173 $sql .=
" AND ref = '(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
174 $resql = $db->query($sql);
175 $obj = $db->fetch_object($resql);
177 $invoiceid = $obj->rowid;
182 $invoice->fetch($invoiceid);
189if ($usestripeterminals && $invoice->type != $invoice::TYPE_CREDIT_NOTE) {
190 if (!
getDolGlobalString((
string) $keyforstripeterminalbank) || $stripeacc ===
null) { ?>
192 simulated: <?php
if (empty($servicestatus) &&
getDolGlobalString(
'STRIPE_TERMINAL_SIMULATED')) { ?>
true <?php }
else { ?> false <?php } ?>
195 terminal.discoverReaders(config).then(
function(discoverResult) {
196 if (discoverResult.error) {
197 console.log(
'Failed to discover: ', discoverResult.error);
198 }
else if (discoverResult.discoveredReaders.length === 0) {
199 console.log(
'No available readers.');
203 selectedReader = discoverResult.discoveredReaders[0];
206 terminal.connectReader(selectedReader).then(function(connectResult) {
207 if (connectResult.error) {
208 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error">'+connectResult.error.message+
'</div>';
209 console.log(
'Failed to connect: ', connectResult.error);
211 document.getElementById(
"card-present-alert").innerHTML =
'';
212 console.log(
'Connected to reader: ', connectResult.reader.label);
213 if (document.getElementById(
"StripeTerminal")) {
214 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 terminal.connectReader(<?php echo json_encode($stripe->getSelectedReader(
getDolGlobalString((
string) $keyforstripeterminalbank), $stripeacc, $servicestatus)); ?>).then(
function(connectResult) {
222 if (connectResult.error) {
223 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+connectResult.error.message+
'</div>';
224 console.log(
'Failed to connect: ', connectResult.error);
226 document.getElementById(
"card-present-alert").innerHTML =
'';
227 console.log(
'Connected to reader: ', connectResult.reader.label);
228 if (document.getElementById(
"StripeTerminal")) {
229 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>';
240$arrayOfValidPaymentModes = array();
241$arrayOfValidBankAccount = array();
243$sql =
"SELECT code, libelle as label FROM ".MAIN_DB_PREFIX.
"c_paiement";
244$sql .=
" WHERE entity IN (".getEntity(
'c_paiement').
")";
245$sql .=
" AND active = 1";
249 $sql .=
" AND code IN ('LIQ', 'CB', 'CHQ')";
251$sql .=
" ORDER BY libelle";
252$resql = $db->query($sql);
255 while ($obj = $db->fetch_object($resql)) {
256 $paycode = $obj->code;
257 if ($paycode ==
'LIQ') {
260 if ($paycode ==
'CB') {
263 if ($paycode ==
'CHQ') {
267 $accountname =
"CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION[
"takeposterminal"];
270 $arrayOfValidPaymentModes[] = $obj;
273 if ($paycode ==
'CASH' || $paycode ==
'CB') {
274 $arrayOfValidPaymentModes[] = $obj;
285if ($invoice->id > 0) {
286 $remaintopay = $invoice->getRemainToPay();
288$alreadypayed = (is_object($invoice) ? ($invoice->total_ttc - $remaintopay) : 0);
290$parameters = array();
291$reshook = $hookmanager->executeHooks(
'takeposPayActions', $parameters, $invoice, $action);
295 print
"var received='';";
297 print
"var received=0;";
301 var alreadypayed = <?php echo $alreadypayed ?>;
302 var invoicetype = <?php echo $invoice->type ?>;
304 function addreceived(
price)
308 print
'received+=String(price);'.
"\n";
310 print
'received+=parseFloat(price);'.
"\n";
313 $(
'.change1').html(pricejs(parseFloat(received),
'MT'));
314 $(
'.change1').val(parseFloat(received));
315 console.log(
"invoicetype="+invoicetype);
316 console.log(
"alreadyreceived="+alreadypayed);
317 console.log(
"received="+received);
318 if (invoicetype == 2) {
319 alreadypaydplusreceived = price2numjs(alreadypayed - parseFloat(received));
321 alreadypaydplusreceived = price2numjs(alreadypayed + parseFloat(received));
323 console.log(
"already+received = "+alreadypaydplusreceived);
325 if (Math.abs(alreadypaydplusreceived) > Math.abs(<?php echo ((
float) $invoice->total_ttc); ?>)) {
326 if (invoicetype == 2) {
327 var change = parseFloat(alreadypayed + parseFloat(received) + <?php echo (
float) $invoice->total_ttc; ?>);
329 var change = parseFloat(alreadypayed + parseFloat(received) - <?php echo (
float) $invoice->total_ttc; ?>);
331 $(
'.change2').html(pricejs(change,
'MT'));
332 $(
'.change2').val(change);
333 $(
'.change1').removeClass(
'colorred');
334 $(
'.change1').addClass(
'colorgreen');
335 $(
'.change2').removeClass(
'colorwhite');
336 $(
'.change2').addClass(
'colorred');
338 $(
'.change2').html(pricejs(0,
'MT'));
339 $(
'.change2').val(0);
340 if (alreadypaydplusreceived == <?php echo (
float) $invoice->total_ttc; ?>) {
341 $(
'.change1').removeClass(
'colorred');
342 $(
'.change1').addClass(
'colorgreen');
343 $(
'.change2').removeClass(
'colorred');
344 $(
'.change2').addClass(
'colorwhite');
346 $(
'.change1').removeClass(
'colorgreen');
347 $(
'.change1').addClass(
'colorred');
348 $(
'.change2').removeClass(
'colorred');
349 $(
'.change2').addClass(
'colorwhite');
359 $(
'.change1').html(pricejs(received,
'MT'));
360 $(
'.change1').val(price2numjs(received));
361 $(
'.change2').html(pricejs(received,
'MT'));
362 $(
'.change2').val(price2numjs(received));
363 $(
'.change1').removeClass(
'colorgreen');
364 $(
'.change1').addClass(
'colorred');
365 $(
'.change2').removeClass(
'colorred');
366 $(
'.change2').addClass(
'colorwhite');
371 console.log(
"Launch Validate");
373 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
374 var accountid = $(
"#selectaccountid").val();
375 var amountpayed = $(
"#change1").val();
376 var excess = $(
"#change2").val();
377 if (amountpayed > <?php echo (
float) $invoice->total_ttc; ?>) {
378 amountpayed = <?php echo (
float) $invoice->total_ttc; ?>;
380 console.log(
"We click on the payment mode to pay amount = "+amountpayed);
381 parent.$(
"#poslines").load(
"invoice.php?place=<?php echo $place; ?>&action=valid&token=<?php echo currentToken(); ?>&pay="+payment+
"&amount="+amountpayed+
"&excess="+excess+
"&invoiceid="+invoiceid+
"&accountid="+accountid,
function() {
382 if (amountpayed > <?php echo (
float) $remaintopay; ?> || amountpayed == <?php echo (
float) $remaintopay; ?> || amountpayed == 0 ) {
383 console.log(
"Close popup");
384 parent.$(
'#invoiceid').val(
"");
385 parent.$.colorbox.close();
387 console.log(
"Amount is not complete, so we do NOT close popup and reload it.");
395 function fetchPaymentIntentClientSecret(
amount, invoiceid) {
396 const bodyContent = JSON.stringify({
amount :
amount, invoiceid : invoiceid });
398 $urlpaymentintent = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=createPaymentIntent&token='.
currentToken().
'&servicestatus='.urlencode((
string) $servicestatus);
399 if (!empty($stripeacc)) {
400 $urlpaymentintent .=
'&stripeacc='.$stripeacc;
403 return fetch(
'<?php echo $urlpaymentintent; ?>', {
406 'Content-Type':
'application/json'
410 .then(
function(response) {
411 return response.json();
413 .then(
function(data) {
414 return data.client_secret;
419 function capturePaymentIntent(paymentIntentId) {
420 const bodyContent = JSON.stringify({
"id": paymentIntentId})
422 $urlpaymentintent = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=capturePaymentIntent&token='.
currentToken().
'&servicestatus='.urlencode((
string) ($servicestatus));
423 if (!empty($stripeacc)) {
424 $urlpaymentintent .=
'&stripeacc='.urlencode($stripeacc);
427 return fetch(
'<?php echo $urlpaymentintent; ?>', {
430 'Content-Type':
'application/json'
434 .then(
function(response) {
435 return response.json();
437 .then(
function(data) {
438 return data.client_secret;
443 function ValidateStripeTerminal() {
444 console.log(
"Launch ValidateStripeTerminal");
445 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
446 var accountid = $(
"#selectaccountid").val();
447 var amountpayed = $(
"#change1").val();
448 var excess = $(
"#change2").val();
449 if (amountpayed > <?php echo (
float) $invoice->getRemainToPay(); ?>) {
450 amountpayed = <?php echo (
float) $invoice->getRemainToPay(); ?>;
452 if (amountpayed == 0) {
453 amountpayed = <?php echo (
float) $invoice->getRemainToPay(); ?>;
456 console.log(
"Pay with terminal ", amountpayed);
458 fetchPaymentIntentClientSecret(amountpayed, invoiceid).then(
function(client_secret) {
459 <?php
if (empty($servicestatus) &&
getDolGlobalString(
'STRIPE_TERMINAL_SIMULATED')) { ?>
460 terminal.setSimulatorConfiguration({testCardNumber: <?php echo
"'".dol_escape_js(
getDolGlobalString(
'STRIPE_TERMINAL_SIMULATED')).
"'" ; ?>});
462 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentSendToStripeTerminal
'); ?></div>';
463 terminal.collectPaymentMethod(client_secret).then(
function(result) {
466 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
468 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentBeingProcessed
'); ?></div>';
469 console.log(
'terminal.collectPaymentMethod', result.paymentIntent);
470 terminal.processPayment(result.paymentIntent).then(function(result) {
472 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
473 console.log(result.error)
474 } else if (result.paymentIntent) {
475 paymentIntentId = result.paymentIntent.id;
476 console.log(
'terminal.processPayment', result.paymentIntent);
477 capturePaymentIntent(paymentIntentId).then(function(client_secret) {
480 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
481 console.log(
"error when capturing paymentIntent", result.error);
483 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentValidated
'); ?></div>';
484 console.log(
"Capture paymentIntent successful "+paymentIntentId);
485 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() {
486 if (amountpayed > <?php echo (float) $remaintopay; ?> || amountpayed == <?php echo (float) $remaintopay; ?> || amountpayed == 0 ) {
487 console.log(
"Close popup");
488 parent.$.colorbox.close();
491 console.log(
"Amount is not comple, so we do NOT close popup and reload it.");
505 function ValidateSumup() {
506 console.log(
"Launch ValidateSumup");
507 <?php $_SESSION[
'SMP_CURRENT_PAYMENT'] =
"NEW" ?>
508 var invoiceid = <?php echo ($invoiceid > 0 ? $invoiceid : 0); ?>;
509 var amountpayed = $(
"#change1").val();
510 if (amountpayed > <?php echo (
float) $invoice->total_ttc; ?>) {
511 amountpayed = <?php echo (
float) $invoice->total_ttc; ?>;
513 if (amountpayed == 0) {
514 amountpayed = <?php echo (
float) $invoice->total_ttc; ?>;
516 var currencycode =
"<?php echo $invoice->multicurrency_code; ?>";
519 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');
521 var loop = window.setInterval(
function () {
524 data: { token:
'<?php echo currentToken(); ?>' },
525 url:
'<?php echo DOL_URL_ROOT ?>/takepos/smpcb.php?status' }).done(
function (data) {
527 if (data ===
"SUCCESS") {
528 parent.$(
"#poslines").load(
"invoice.php?place=<?php echo urlencode($place); ?>&action=valid&token=<?php echo newToken(); ?>&pay=CB&amount=" + amountpayed +
"&invoiceid=" + invoiceid,
function () {
530 parent.$.colorbox.close();
534 }
else if (data ===
"FAILED") {
535 parent.$.colorbox.close();
544 echo
"var line1='".$langs->trans(
'TotalTTC').
"'.substring(0,20);";
545 echo
"line1=line1.padEnd(20);";
546 echo
"var line2='".price($invoice->total_ttc, 1,
'', 1, -1, -1).
"'.substring(0,20);";
547 echo
"line2=line2.padEnd(20);";
549 echo
'webSocketCustomerDisplay.onOpen(function() {';
550 echo
' webSocketCustomerDisplay.send(line1);';
551 echo
' webSocketCustomerDisplay.send(line2);';
556 data: { text: line1+line2 },
557 url: '".getDolGlobalString(
'TAKEPOS_PRINT_SERVER').
"/display/index.php',
565$sessioncurrency = $_SESSION[
"takeposcustomercurrency"] ??
'';
566print
'<!-- conf->currency = '.$conf->currency.
' - sessioncurrency = '.$sessioncurrency.
' -->'.
"\n";
567$multicurrency =
null;
568if (
isModEnabled(
'multicurrency') && $sessioncurrency !=
"" &&
$conf->currency != $sessioncurrency) {
570 include_once DOL_DOCUMENT_ROOT .
'/multicurrency/class/multicurrency.class.php';
572 $multicurrency->fetch(0, $sessioncurrency);
576<div style=
"position:relative; padding-top: 20px; left:5%; height:140px; width:90%;">
577 <div
class=
"paymentbordline paymentbordlinetotal center">
578 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
'TotalTTC'); ?>: <span
id=
"totaldisplay" class=
"colorwhite"><?php
579 echo
price($invoice->total_ttc, 1,
'', 1, -1, -1,
$conf->currency);
580 if ($multicurrency !==
null) {
581 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price($invoice->total_ht * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
585 <?php
if ($remaintopay != $invoice->total_ttc) { ?>
586 <div
class=
"paymentbordline paymentbordlineremain center">
587 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
'RemainToPay'); ?>: <span
id=
"remaintopaydisplay" class=
"colorwhite"><?php
588 echo
price($remaintopay, 1,
'', 1, -1, -1,
$conf->currency);
589 if ($multicurrency !==
null) {
590 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price($remaintopay * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
595 <div
class=
"paymentbordline paymentbordlinereceived center">
596 <span
class=
"takepospay colorwhite"><?php echo $invoice->type == $invoice::TYPE_CREDIT_NOTE ? $langs->trans(
"Refunded") : $langs->trans(
"Received"); ?>: <span
class=
"change1 colorred"><?php
597 echo
price(0, 1,
'', 1, -1, -1,
$conf->currency);
598 if ($multicurrency !==
null) {
599 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price(0 * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
601 ?></span><input
type=
"hidden" id=
"change1" class=
"change1" value=
"0"></span>
603 <div
class=
"paymentbordline paymentbordlinechange center">
604 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
"Change"); ?>: <span
class=
"change2 colorwhite"><?php
605 echo
price(0, 1,
'', 1, -1, -1,
$conf->currency);
606 if ($multicurrency !==
null) {
607 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price(0 * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
609 ?></span><input
type=
"hidden" id=
"change2" class=
"change2" value=
"0"></span>
613 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
614 print
'<div class="paymentbordline paddingtop paddingbottom center">';
616 $form =
new Form($db);
617 print
'<span class="takepospay colorwhite">'.$langs->trans(
"BankAccount").
': </span>';
618 $form->select_comptes(0,
'accountid', 0, $filter, 1,
'');
624<div style=
"position:absolute; left:5%; height:52%; width:90%;">
626$action_buttons = array(
628"function" =>
"reset()",
629"span" =>
"style='font-size: 150%;'",
631"class" =>
"poscolorblue"
634"function" =>
"parent.$.colorbox.close();",
635"span" =>
"id='printtext' style='font-weight: bold; font-size: 18pt;'",
637"class" =>
"poscolordelete"
642 print
'<span id="card-present-alert">';
643 dol_htmloutput_mesg($langs->trans(
'ConnectingToStripeTerminal',
'Stripe'), [],
'warning', 1);
646print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'7' :
'10').
')">'.($numpad == 0 ?
'7' :
'10').
'</button>';
647print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'8' :
'20').
')">'.($numpad == 0 ?
'8' :
'20').
'</button>';
648print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'9' :
'50').
')">'.($numpad == 0 ?
'9' :
'50').
'</button>';
650<?php
if (count($arrayOfValidPaymentModes) > 0) {
651 $paycode = $arrayOfValidPaymentModes[0]->code;
653 if ($paycode ==
'LIQ') {
654 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
657 } elseif ($paycode ==
'CB') {
658 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
659 $payIcon =
'credit-card';
661 } elseif ($paycode ==
'CHQ') {
662 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
663 $payIcon =
'money-check';
667 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>';
669 print '<button type="button" class="calcbutton2
">'.$langs->trans("NoPaimementModesDefined
").'</button>';
672print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '4
' : '1
').')
">'.($numpad == 0 ? '4' : '1').'</button>';
673print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '5
' : '2
').')
">'.($numpad == 0 ? '5' : '2').'</button>';
674print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '6
' : '5
').')
">'.($numpad == 0 ? '6' : '5').'</button>';
676<?php if (count($arrayOfValidPaymentModes) > 1) {
677 $paycode = $arrayOfValidPaymentModes[1]->code;
679 if ($paycode == 'LIQ') {
680 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
683 } elseif ($paycode == 'CB') {
684 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
685 $payIcon = 'credit-card';
687 } elseif ($paycode == 'CHQ') {
688 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
689 $payIcon = 'money-check';
693 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>';
695 $button = array_pop($action_buttons);
696 print '<button type="button" class="calcbutton2
" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
699print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '1
' : '0.10
').')
">'.($numpad == 0 ? '1' : '0.10').'</button>';
700print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '2
' : '0.20
').')
">'.($numpad == 0 ? '2' : '0.20').'</button>';
701print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '3
' : '0.50
').')
">'.($numpad == 0 ? '3' : '0.50').'</button>';
703<?php if (count($arrayOfValidPaymentModes) > 2) {
704 $paycode = $arrayOfValidPaymentModes[2]->code;
706 if ($paycode == 'LIQ') {
707 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
710 } elseif ($paycode == 'CB') {
711 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
712 $payIcon = 'credit-card';
714 } elseif ($paycode == 'CHQ') {
715 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
716 $payIcon = 'money-check';
720 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>';
722 $button = array_pop($action_buttons);
723 print '<button type="button" class="calcbutton2
" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
726print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '0
' : '0.01
').')
">'.($numpad == 0 ? '0' : '0.01').'</button>';
727print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '\
'000\'' :
'0.02').
')">'.($numpad == 0 ?
'000' :
'0.02').
'</button>';
728print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'\'.\
'' :
'0.05').
')">'.($numpad == 0 ?
'.' :
'0.05').
'</button>';
731while ($i < count($arrayOfValidPaymentModes)) {
732 $paycode = $arrayOfValidPaymentModes[$i]->code;
734 if ($paycode ==
'LIQ') {
735 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
738 } elseif ($paycode ==
'CB') {
739 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
740 $payIcon =
'credit-card';
742 } elseif ($paycode ==
'CHQ') {
743 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
744 $payIcon =
'money-check';
748 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>';
752if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && getDolGlobalString('STRIPE_CARD_PRESENT')) {
753 $keyforstripeterminalbank = "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL
".$_SESSION["takeposterminal
"];
754 print '<span id="StripeTerminal
"></span>';
755 if (getDolGlobalString((string) $keyforstripeterminalbank)) {
758 $langs->loadLangs(array("errors
", "admin
"));
759 //print '<button type="button" class="calcbutton2
disabled" title="'.$langs->trans("SetupNotComplete").'">TerminalOff</button>';
763$keyforsumupbank = "CASHDESK_ID_BANKACCOUNT_SUMUP
".$_SESSION["takeposterminal
"];
764if (getDolGlobalInt("TAKEPOS_ENABLE_SUMUP
")) {
765 if (getDolGlobalString($keyforsumupbank)) {
766 print '<button type="button" class="calcbutton2
" onclick="ValidateSumup();
">Sumup</button>';
768 $langs->loadLangs(array("errors
", "admin
"));
769 print '<button type="button" class="calcbutton2
disabled" title="'.$langs->trans("SetupNotComplete").'">Sumup</button>';
773$parameters = array('action_buttons' => $action_buttons);
774$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $invoice, $action); // Note that $action and $invoice may have been modified by hook
776 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
777} elseif ($reshook == 0) {
778 $action_buttons = array_merge($action_buttons, $hookmanager->resArray);
779} elseif ($reshook > 0) {
780 $action_buttons = $hookmanager->resArray;
783$class = ($i == 3) ? "calcbutton3
" : "calcbutton2
";
784foreach ($action_buttons as $button) {
785 $newclass = $class.($button["class"] ? " ".$button["class"] : "");
786 print '<button type="button" class="'.$newclass.'" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
789if (getDolGlobalString('TAKEPOS_DELAYED_PAYMENT')) {
790 print '<button type="button" class="calcbutton2
" onclick="Validate(\
'delayed\')">'.$langs->trans(
"Reported").
'</button>';
796$parameters = array();
797$hookmanager->executeHooks(
'completePayment', $parameters, $invoice);
798print $hookmanager->resPrint;
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='', $placeholder='')
Convert a html select field into an ajax combobox.
isALNERunningVersion($blockedlogusagealreadychecked=0, $blockedlogmoduleonalreadychecked=0)
Return if the application is executed with the LNE requirements on.
Class to manage invoices.
Stripe class @TODO No reason to extend CommonObject.
Class toolbox to validate values.
currentToken()
Return the value of token currently saved into session with name 'token'.
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, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
multi select button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formatted messages to output (Used to show messages on html output).
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as p p num_paiement as f pf amount as amount
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.