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'];
114 $stripeacc = $stripe->getStripeAccount($service);
116 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
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='.newToken().
'&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 } ?>
193 <?php
if (
getDolGlobalString(
'STRIPE_LOCATION')) { ?>, location:
'<?php echo dol_escape_js(getDolGlobalString('STRIPE_LOCATION
')); ?>'<?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);
291 print
"var received='';";
293 print
"var received=0;";
297 var alreadypayed = <?php echo $alreadypayed ?>;
298 var invoicetype = <?php echo $invoice->type ?>;
300 function addreceived(
price)
304 print
'received+=String(price);'.
"\n";
306 print
'received+=parseFloat(price);'.
"\n";
309 $(
'.change1').html(
pricejs(parseFloat(received),
'MT'));
310 $(
'.change1').val(parseFloat(received));
311 console.log(
"invoicetype="+invoicetype);
312 console.log(
"alreadyreceived="+alreadypayed);
313 console.log(
"received="+received);
314 if (invoicetype == 2) {
315 alreadypaydplusreceived =
price2numjs(alreadypayed - parseFloat(received));
317 alreadypaydplusreceived =
price2numjs(alreadypayed + parseFloat(received));
319 console.log(
"already+received = "+alreadypaydplusreceived);
321 if (Math.abs(alreadypaydplusreceived) > Math.abs(<?php echo ((
float) $invoice->total_ttc); ?>)) {
322 if (invoicetype == 2) {
323 var change = parseFloat(alreadypayed + parseFloat(received) + <?php echo (
float) $invoice->total_ttc; ?>);
325 var change = parseFloat(alreadypayed + parseFloat(received) - <?php echo (
float) $invoice->total_ttc; ?>);
327 $(
'.change2').html(
pricejs(change,
'MT'));
328 $(
'.change2').val(change);
329 $(
'.change1').removeClass(
'colorred');
330 $(
'.change1').addClass(
'colorgreen');
331 $(
'.change2').removeClass(
'colorwhite');
332 $(
'.change2').addClass(
'colorred');
334 $(
'.change2').html(
pricejs(0,
'MT'));
335 $(
'.change2').val(0);
336 if (alreadypaydplusreceived == <?php echo (
float) $invoice->total_ttc; ?>) {
337 $(
'.change1').removeClass(
'colorred');
338 $(
'.change1').addClass(
'colorgreen');
339 $(
'.change2').removeClass(
'colorred');
340 $(
'.change2').addClass(
'colorwhite');
342 $(
'.change1').removeClass(
'colorgreen');
343 $(
'.change1').addClass(
'colorred');
344 $(
'.change2').removeClass(
'colorred');
345 $(
'.change2').addClass(
'colorwhite');
355 $(
'.change1').html(
pricejs(received,
'MT'));
357 $(
'.change2').html(
pricejs(received,
'MT'));
359 $(
'.change1').removeClass(
'colorgreen');
360 $(
'.change1').addClass(
'colorred');
361 $(
'.change2').removeClass(
'colorred');
362 $(
'.change2').addClass(
'colorwhite');
367 console.log(
"Launch Validate");
369 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
370 var accountid = $(
"#selectaccountid").val();
371 var amountpayed = $(
"#change1").val();
372 var excess = $(
"#change2").val();
373 if (amountpayed > <?php echo (
float) $invoice->total_ttc; ?>) {
374 amountpayed = <?php echo (
float) $invoice->total_ttc; ?>;
376 console.log(
"We click on the payment mode to pay amount = "+amountpayed);
377 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() {
378 if (amountpayed > <?php echo (
float) $remaintopay; ?> || amountpayed == <?php echo (
float) $remaintopay; ?> || amountpayed == 0 ) {
379 console.log(
"Close popup");
380 parent.$(
'#invoiceid').val(
"");
381 parent.$.colorbox.close();
383 console.log(
"Amount is not complete, so we do NOT close popup and reload it.");
391 function fetchPaymentIntentClientSecret(
amount, invoiceid) {
392 const bodyContent = JSON.stringify({
amount :
amount, invoiceid : invoiceid });
394 $urlpaymentintent = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=createPaymentIntent&token='.newToken().
'&servicestatus='.urlencode((
string) $servicestatus);
395 if (!empty($stripeacc)) {
396 $urlpaymentintent .=
'&stripeacc='.$stripeacc;
399 return fetch(
'<?php echo $urlpaymentintent; ?>', {
402 'Content-Type':
'application/json'
406 .then(
function(response) {
407 return response.json();
409 .then(
function(data) {
410 return data.client_secret;
415 function capturePaymentIntent(paymentIntentId) {
416 const bodyContent = JSON.stringify({
"id": paymentIntentId})
418 $urlpaymentintent = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=capturePaymentIntent&token='.newToken().
'&servicestatus='.urlencode((
string) ($servicestatus));
419 if (!empty($stripeacc)) {
420 $urlpaymentintent .=
'&stripeacc='.urlencode($stripeacc);
423 return fetch(
'<?php echo $urlpaymentintent; ?>', {
426 'Content-Type':
'application/json'
430 .then(
function(response) {
431 return response.json();
433 .then(
function(data) {
434 return data.client_secret;
439 function ValidateStripeTerminal() {
440 console.log(
"Launch ValidateStripeTerminal");
441 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
442 var accountid = $(
"#selectaccountid").val();
443 var amountpayed = $(
"#change1").val();
444 var excess = $(
"#change2").val();
445 if (amountpayed > <?php echo (
float) $invoice->getRemainToPay(); ?>) {
446 amountpayed = <?php echo (
float) $invoice->getRemainToPay(); ?>;
448 if (amountpayed == 0) {
449 amountpayed = <?php echo (
float) $invoice->getRemainToPay(); ?>;
452 console.log(
"Pay with terminal ", amountpayed);
454 fetchPaymentIntentClientSecret(amountpayed, invoiceid).then(
function(client_secret) {
455 <?php
if (empty($servicestatus) &&
getDolGlobalString(
'STRIPE_TERMINAL_SIMULATED')) { ?>
456 terminal.setSimulatorConfiguration({testCardNumber:
'<?php echo dol_escape_js(getDolGlobalString('STRIPE_TERMINAL_SIMULATED
')); ?>'});
458 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentSendToStripeTerminal
'); ?></div>';
459 terminal.collectPaymentMethod(client_secret).then(
function(result) {
462 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
464 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentBeingProcessed
'); ?></div>';
465 console.log(
'terminal.collectPaymentMethod', result.paymentIntent);
466 terminal.processPayment(result.paymentIntent).then(function(result) {
468 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
469 console.log(result.error)
470 } else if (result.paymentIntent) {
471 paymentIntentId = result.paymentIntent.id;
472 console.log(
'terminal.processPayment', result.paymentIntent);
473 capturePaymentIntent(paymentIntentId).then(function(client_secret) {
476 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
477 console.log(
"error when capturing paymentIntent", result.error);
479 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentValidated
'); ?></div>';
480 console.log(
"Capture paymentIntent successful "+paymentIntentId);
481 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() {
482 if (amountpayed > <?php echo (float) $remaintopay; ?> || amountpayed == <?php echo (float) $remaintopay; ?> || amountpayed == 0 ) {
483 console.log(
"Close popup");
484 parent.$.colorbox.close();
487 console.log(
"Amount is not comple, so we do NOT close popup and reload it.");
501 function ValidateSumup() {
502 console.log(
"Launch ValidateSumup");
503 <?php $_SESSION[
'SMP_CURRENT_PAYMENT'] =
"NEW" ?>
504 var invoiceid = <?php echo ($invoiceid > 0 ? $invoiceid : 0); ?>;
505 var amountpayed = $(
"#change1").val();
506 if (amountpayed > <?php echo (
float) $invoice->total_ttc; ?>) {
507 amountpayed = <?php echo (
float) $invoice->total_ttc; ?>;
509 if (amountpayed == 0) {
510 amountpayed = <?php echo (
float) $invoice->total_ttc; ?>;
512 var currencycode =
"<?php echo $invoice->multicurrency_code; ?>";
515 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');
517 var loop = window.setInterval(
function () {
520 data: { token:
'<?php echo currentToken(); ?>' },
521 url:
'<?php echo DOL_URL_ROOT ?>/takepos/smpcb.php?status' }).done(
function (data) {
523 if (data ===
"SUCCESS") {
524 parent.$(
"#poslines").load(
"invoice.php?place=<?php echo urlencode($place); ?>&action=valid&token=<?php echo newToken(); ?>&pay=CB&amount=" + amountpayed +
"&invoiceid=" + invoiceid,
function () {
526 parent.$.colorbox.close();
530 }
else if (data ===
"FAILED") {
531 parent.$.colorbox.close();
540 echo
"var line1='".$langs->trans(
'TotalTTC').
"'.substring(0,20);";
541 echo
"line1=line1.padEnd(20);";
542 echo
"var line2='".price($invoice->total_ttc, 1,
'', 1, -1, -1).
"'.substring(0,20);";
543 echo
"line2=line2.padEnd(20);";
545 echo
'webSocketCustomerDisplay.onOpen(function() {';
546 echo
' webSocketCustomerDisplay.send(line1);';
547 echo
' webSocketCustomerDisplay.send(line2);';
552 data: { text: line1+line2 },
553 url: '".getDolGlobalString(
'TAKEPOS_PRINT_SERVER').
"/display/index.php',
561$sessioncurrency = $_SESSION[
"takeposcustomercurrency"] ??
'';
562print
'<!-- conf->currency = '.$conf->currency.
' - sessioncurrency = '.$sessioncurrency.
' -->'.
"\n";
563$multicurrency =
null;
564if (
isModEnabled(
'multicurrency') && $sessioncurrency !=
"" &&
$conf->currency != $sessioncurrency) {
566 include_once DOL_DOCUMENT_ROOT .
'/multicurrency/class/multicurrency.class.php';
568 $multicurrency->fetch(0, $sessioncurrency);
572<div style=
"position:relative; padding-top: 20px; left:5%; height:140px; width:90%;">
573 <div
class=
"paymentbordline paymentbordlinetotal center">
574 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
'TotalTTC'); ?>: <span
id=
"totaldisplay" class=
"colorwhite"><?php
575 echo
price($invoice->total_ttc, 1,
'', 1, -1, -1,
$conf->currency);
576 if ($multicurrency !==
null) {
577 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price($invoice->total_ht * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
581 <?php
if ($remaintopay != $invoice->total_ttc) { ?>
582 <div
class=
"paymentbordline paymentbordlineremain center">
583 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
'RemainToPay'); ?>: <span
id=
"remaintopaydisplay" class=
"colorwhite"><?php
584 echo
price($remaintopay, 1,
'', 1, -1, -1,
$conf->currency);
585 if ($multicurrency !==
null) {
586 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price($remaintopay * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
591 <div
class=
"paymentbordline paymentbordlinereceived center">
592 <span
class=
"takepospay colorwhite"><?php echo $invoice->type == $invoice::TYPE_CREDIT_NOTE ? $langs->trans(
"Refunded") : $langs->trans(
"Received"); ?>: <span
class=
"change1 colorred"><?php
593 echo
price(0, 1,
'', 1, -1, -1,
$conf->currency);
594 if ($multicurrency !==
null) {
595 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price(0 * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
597 ?></span><input
type=
"hidden" id=
"change1" class=
"change1" value=
"0"></span>
599 <div
class=
"paymentbordline paymentbordlinechange center">
600 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
"Change"); ?>: <span
class=
"change2 colorwhite"><?php
601 echo
price(0, 1,
'', 1, -1, -1,
$conf->currency);
602 if ($multicurrency !==
null) {
603 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price(0 * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
605 ?></span><input
type=
"hidden" id=
"change2" class=
"change2" value=
"0"></span>
609 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
610 print
'<div class="paymentbordline paddingtop paddingbottom center">';
613 print
'<span class="takepospay colorwhite">'.$langs->trans(
"BankAccount").
': </span>';
614 $form->select_comptes(0,
'accountid', 0, $filter, 1,
'');
620<div style=
"position:absolute; left:5%; height:52%; width:90%;">
622$action_buttons = array(
624"function" =>
"reset()",
625"span" =>
"style='font-size: 150%;'",
627"class" =>
"poscolorblue"
630"function" =>
"parent.$.colorbox.close();",
631"span" =>
"id='printtext' style='font-weight: bold; font-size: 18pt;'",
633"class" =>
"poscolordelete"
638 print
'<span id="card-present-alert">';
639 dol_htmloutput_mesg($langs->trans(
'ConnectingToStripeTerminal',
'Stripe'), [],
'warning', 1);
642print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'7' :
'10').
')">'.($numpad == 0 ?
'7' :
'10').
'</button>';
643print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'8' :
'20').
')">'.($numpad == 0 ?
'8' :
'20').
'</button>';
644print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'9' :
'50').
')">'.($numpad == 0 ?
'9' :
'50').
'</button>';
646<?php
if (count($arrayOfValidPaymentModes) > 0) {
647 $paycode = $arrayOfValidPaymentModes[0]->code;
649 if ($paycode ==
'LIQ') {
650 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
653 } elseif ($paycode ==
'CB') {
654 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
655 $payIcon =
'credit-card';
657 } elseif ($paycode ==
'CHQ') {
658 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
659 $payIcon =
'money-check';
663 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>';
665 print '<button type="button" class="calcbutton2
">'.$langs->trans("NoPaimementModesDefined
").'</button>';
668print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '4
' : '1
').')
">'.($numpad == 0 ? '4' : '1').'</button>';
669print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '5
' : '2
').')
">'.($numpad == 0 ? '5' : '2').'</button>';
670print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '6
' : '5
').')
">'.($numpad == 0 ? '6' : '5').'</button>';
672<?php if (count($arrayOfValidPaymentModes) > 1) {
673 $paycode = $arrayOfValidPaymentModes[1]->code;
675 if ($paycode == 'LIQ') {
676 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
679 } elseif ($paycode == 'CB') {
680 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
681 $payIcon = 'credit-card';
683 } elseif ($paycode == 'CHQ') {
684 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
685 $payIcon = 'money-check';
689 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>';
691 $button = array_pop($action_buttons);
692 print '<button type="button" class="calcbutton2
" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
695print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '1
' : '0.10
').')
">'.($numpad == 0 ? '1' : '0.10').'</button>';
696print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '2
' : '0.20
').')
">'.($numpad == 0 ? '2' : '0.20').'</button>';
697print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '3
' : '0.50
').')
">'.($numpad == 0 ? '3' : '0.50').'</button>';
699<?php if (count($arrayOfValidPaymentModes) > 2) {
700 $paycode = $arrayOfValidPaymentModes[2]->code;
702 if ($paycode == 'LIQ') {
703 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
706 } elseif ($paycode == 'CB') {
707 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
708 $payIcon = 'credit-card';
710 } elseif ($paycode == 'CHQ') {
711 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
712 $payIcon = 'money-check';
716 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>';
718 $button = array_pop($action_buttons);
719 print '<button type="button" class="calcbutton2
" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
722print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '0
' : '0.01
').')
">'.($numpad == 0 ? '0' : '0.01').'</button>';
723print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '\
'000\'' :
'0.02').
')">'.($numpad == 0 ?
'000' :
'0.02').
'</button>';
724print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'\'.\
'' :
'0.05').
')">'.($numpad == 0 ?
'.' :
'0.05').
'</button>';
727while ($i < count($arrayOfValidPaymentModes)) {
728 $paycode = $arrayOfValidPaymentModes[$i]->code;
730 if ($paycode ==
'LIQ') {
731 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
734 } elseif ($paycode ==
'CB') {
735 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
736 $payIcon =
'credit-card';
738 } elseif ($paycode ==
'CHQ') {
739 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
740 $payIcon =
'money-check';
744 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>';
748if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && getDolGlobalString('STRIPE_CARD_PRESENT')) {
749 $keyforstripeterminalbank = "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL
".$_SESSION["takeposterminal
"];
750 print '<span id="StripeTerminal
"></span>';
751 if (getDolGlobalString((string) $keyforstripeterminalbank)) {
754 $langs->loadLangs(array("errors
", "admin
"));
755 //print '<button type="button" class="calcbutton2
disabled" title="'.$langs->trans("SetupNotComplete").'">TerminalOff</button>';
759$keyforsumupbank = "CASHDESK_ID_BANKACCOUNT_SUMUP
".$_SESSION["takeposterminal
"];
760if (getDolGlobalInt("TAKEPOS_ENABLE_SUMUP
")) {
761 if (getDolGlobalString($keyforsumupbank)) {
762 print '<button type="button" class="calcbutton2
" onclick="ValidateSumup();
">Sumup</button>';
764 $langs->loadLangs(array("errors
", "admin
"));
765 print '<button type="button" class="calcbutton2
disabled" title="'.$langs->trans("SetupNotComplete").'">Sumup</button>';
769$parameters = array('action_buttons' => $action_buttons);
770$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $invoice, $action); // Note that $action and $invoice may have been modified by hook
772 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
773} elseif ($reshook == 0) {
774 $action_buttons = array_merge($action_buttons, $hookmanager->resArray);
775} elseif ($reshook > 0) {
776 $action_buttons = $hookmanager->resArray;
779$class = ($i == 3) ? "calcbutton3
" : "calcbutton2
";
780foreach ($action_buttons as $button) {
781 $newclass = $class.($button["class"] ? " ".$button["class"] : "");
782 print '<button type="button" class="'.$newclass.'" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
785if (getDolGlobalString('TAKEPOS_DELAYED_PAYMENT')) {
786 print '<button type="button" class="calcbutton2
" onclick="Validate(\
'delayed\')">'.$langs->trans(
"Reported").
'</button>';
792$parameters = array();
793$hookmanager->executeHooks(
'completePayment', $parameters, $invoice);
794print $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.
isALNERunningVersion($blockedlogtestalreadydone=0, $blockedlogmodulealreadydone=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.
pricejs(amount, mode='MT', currency_code='', force_locale='')
Function similar to PHP price()
price2numjs(amount)
Function similar to PHP price2num()
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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 formatted messages to output (Used to show messages on html output).
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
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
Abort invoice creation with a given error message.
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
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.