pay.php 18 KB

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