dolibarr 19.0.3
index.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.com>
3 * Copyright (C) 2019 Josep LluĂ­s Amador <joseplluis@lliuretic.cat>
4 * Copyright (C) 2020 Thibault FOUCART <support@ptibogxiv.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26// if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
27// if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
28// if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
29// if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
30
31if (!defined('NOREQUIREMENU')) {
32 define('NOREQUIREMENU', '1');
33}
34if (!defined('NOREQUIREHTML')) {
35 define('NOREQUIREHTML', '1');
36}
37if (!defined('NOREQUIREAJAX')) {
38 define('NOREQUIREAJAX', '1');
39}
40
41// Load Dolibarr environment
42require '../main.inc.php'; // Load $user and permissions
43require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
44require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
45require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
46require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
47require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
48require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
49require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
50
51
52$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant or multiple sales
53$action = GETPOST('action', 'aZ09');
54$setterminal = GETPOST('setterminal', 'int');
55$setcurrency = GETPOST('setcurrency', 'aZ09');
56
57$hookmanager->initHooks(array('takeposfrontend'));
58if (empty($_SESSION["takeposterminal"])) {
59 if (getDolGlobalInt('TAKEPOS_NUM_TERMINALS') == 1) {
60 $_SESSION["takeposterminal"] = 1; // Use terminal 1 if there is only 1 terminal
61 } elseif (!empty($_COOKIE["takeposterminal"])) {
62 $_SESSION["takeposterminal"] = preg_replace('/[^a-zA-Z0-9_\-]/', '', $_COOKIE["takeposterminal"]); // Restore takeposterminal from previous session
63 }
64}
65
66if ($setterminal > 0) {
67 $_SESSION["takeposterminal"] = $setterminal;
68 setcookie("takeposterminal", $setterminal, (time() + (86400 * 354)), '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Permanent takeposterminal var in a cookie
69}
70
71if ($setcurrency != "") {
72 $_SESSION["takeposcustomercurrency"] = $setcurrency;
73 // We will recalculate amount for foreign currency at next call of invoice.php when $_SESSION["takeposcustomercurrency"] differs from invoice->multicurrency_code.
74}
75
76
77$langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter", "banks"));
78
79$categorie = new Categorie($db);
80
81$maxcategbydefaultforthisdevice = 12;
82$maxproductbydefaultforthisdevice = 24;
83if ($conf->browser->layout == 'phone') {
84 $maxcategbydefaultforthisdevice = 8;
85 $maxproductbydefaultforthisdevice = 16;
86 //REDIRECT TO BASIC LAYOUT IF TERMINAL SELECTED AND BASIC MOBILE LAYOUT FORCED
87 if (!empty($_SESSION["takeposterminal"]) && getDolGlobalString('TAKEPOS_BAR_RESTAURANT') && getDolGlobalInt('TAKEPOS_PHONE_BASIC_LAYOUT') == 1) {
88 $_SESSION["basiclayout"] = 1;
89 header("Location: phone.php?mobilepage=invoice");
90 exit;
91 }
92} else {
93 unset($_SESSION["basiclayout"]);
94}
95$MAXCATEG = (!getDolGlobalString('TAKEPOS_NB_MAXCATEG') ? $maxcategbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXCATEG);
96$MAXPRODUCT = (!getDolGlobalString('TAKEPOS_NB_MAXPRODUCT') ? $maxproductbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXPRODUCT);
97
98$term = empty($_SESSION['takeposterminal']) ? 1: $_SESSION['takeposterminal'];
99
100/*
101 $constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
102 $soc = new Societe($db);
103 if ($invoice->socid > 0) $soc->fetch($invoice->socid);
104 else $soc->fetch(getDolGlobalInt($constforcompanyid));
105 */
106
107// Security check
108$result = restrictedArea($user, 'takepos', 0, '');
109
110
111
112/*
113 * View
114 */
115
116$form = new Form($db);
117
118$disablejs = 0;
119$disablehead = 0;
120$arrayofjs = array('/takepos/js/jquery.colorbox-min.js'); // TODO It seems we don't need this
121$arrayofcss = array('/takepos/css/pos.css.php', '/takepos/css/colorbox.css');
122
123if (getDolGlobalInt('TAKEPOS_COLOR_THEME') == 1) {
124 $arrayofcss[] = '/takepos/css/colorful.css';
125}
126
127
128// Title
129$title = 'TakePOS - Dolibarr '.DOL_VERSION;
130if (getDolGlobalString('MAIN_APPLICATION_TITLE')) {
131 $title = 'TakePOS - ' . getDolGlobalString('MAIN_APPLICATION_TITLE');
132}
133$head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/>
134<meta name="apple-mobile-web-app-capable" content="yes">
135<meta name="mobile-web-app-capable" content="yes">
136<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
137top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
138
139
140$categories = $categorie->get_full_arbo('product', ((getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID') > 0) ? getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID') : 0), 1);
141
142
143// Search root category to know its level
144//$conf->global->TAKEPOS_ROOT_CATEGORY_ID=0;
145$levelofrootcategory = 0;
146if (getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID') > 0) {
147 foreach ($categories as $key => $categorycursor) {
148 if ($categorycursor['id'] == getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID')) {
149 $levelofrootcategory = $categorycursor['level'];
150 break;
151 }
152 }
153}
154
155$levelofmaincategories = $levelofrootcategory + 1;
156
157$maincategories = array();
158$subcategories = array();
159foreach ($categories as $key => $categorycursor) {
160 if ($categorycursor['level'] == $levelofmaincategories) {
161 $maincategories[$key] = $categorycursor;
162 } else {
163 $subcategories[$key] = $categorycursor;
164 }
165}
166
167$maincategories = dol_sort_array($maincategories, 'label');
168$subcategories = dol_sort_array($subcategories, 'label');
169?>
170
171<body class="bodytakepos" style="overflow: hidden;">
172
173<script>
174var categories = <?php echo json_encode($maincategories); ?>;
175var subcategories = <?php echo json_encode($subcategories); ?>;
176
177var currentcat;
178var pageproducts=0;
179var pagecategories=0;
180var pageactions=0;
181var place="<?php echo $place; ?>";
182var editaction="qty";
183var editnumber="";
184var invoiceid=0;
185var search2_timer=null;
186
187/*
188var app = this;
189app.hasKeyboard = false;
190this.keyboardPress = function() {
191 app.hasKeyboard = true;
192 $(window).unbind("keyup", app.keyboardPress);
193 localStorage.hasKeyboard = true;
194 console.log("has keyboard!")
195}
196$(window).on("keyup", app.keyboardPress)
197if(localStorage.hasKeyboard) {
198 app.hasKeyboard = true;
199 $(window).unbind("keyup", app.keyboardPress);
200 console.log("has keyboard from localStorage")
201}
202*/
203
204function ClearSearch() {
205 console.log("ClearSearch");
206 $("#search").val('');
207 $("#qty").html("<?php echo $langs->trans("Qty"); ?>").removeClass('clicked');
208 $("#price").html("<?php echo $langs->trans("Price"); ?>").removeClass('clicked');
209 $("#reduction").html("<?php echo $langs->trans("LineDiscountShort"); ?>").removeClass('clicked');
210 <?php if ($conf->browser->layout == 'classic') { ?>
211 setFocusOnSearchField();
212 <?php } ?>
213}
214
215// Set the focus on search field but only on desktop. On tablet or smartphone, we don't to avoid to have the keyboard open automatically
216function setFocusOnSearchField() {
217 console.log("Call setFocusOnSearchField in page index.php");
218 <?php if ($conf->browser->layout == 'classic') { ?>
219 console.log("has keyboard from localStorage, so we can force focus on search field");
220 $("#search").focus();
221 <?php } ?>
222}
223
224function PrintCategories(first) {
225 console.log("PrintCategories");
226 for (i = 0; i < <?php echo($MAXCATEG - 2); ?>; i++) {
227 if (typeof (categories[parseInt(i)+parseInt(first)]) == "undefined")
228 {
229 $("#catdivdesc"+i).hide();
230 $("#catdesc"+i).text("");
231 $("#catimg"+i).attr("src","genimg/empty.png");
232 $("#catwatermark"+i).hide();
233 $("#catdiv"+i).attr('class', 'wrapper divempty');
234 continue;
235 }
236 $("#catdivdesc"+i).show();
237 <?php
238 if (getDolGlobalString('TAKEPOS_SHOW_CATEGORY_DESCRIPTION') == 1) { ?>
239 $("#catdesc"+i).html(categories[parseInt(i)+parseInt(first)]['label'].bold() + ' - ' + categories[parseInt(i)+parseInt(first)]['description']);
240 <?php } else { ?>
241 $("#catdesc"+i).text(categories[parseInt(i)+parseInt(first)]['label']);
242 <?php } ?>
243 $("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[parseInt(i)+parseInt(first)]['rowid']);
244 $("#catdiv"+i).data("rowid",categories[parseInt(i)+parseInt(first)]['rowid']);
245 $("#catdiv"+i).attr("data-rowid",categories[parseInt(i)+parseInt(first)]['rowid']);
246 $("#catdiv"+i).attr('class', 'wrapper');
247 $("#catwatermark"+i).show();
248 }
249}
250
251function MoreCategories(moreorless) {
252 console.log("MoreCategories moreorless="+moreorless+" pagecategories="+pagecategories);
253 if (moreorless == "more") {
254 $('#catimg15').animate({opacity: '0.5'}, 1);
255 $('#catimg15').animate({opacity: '1'}, 100);
256 pagecategories=pagecategories+1;
257 }
258 if (moreorless == "less") {
259 $('#catimg14').animate({opacity: '0.5'}, 1);
260 $('#catimg14').animate({opacity: '1'}, 100);
261 if (pagecategories==0) return; //Return if no less pages
262 pagecategories=pagecategories-1;
263 }
264 if (typeof (categories[<?php echo($MAXCATEG - 2); ?> * pagecategories] && moreorless == "more") == "undefined") { // Return if no more pages
265 pagecategories=pagecategories-1;
266 return;
267 }
268
269 for (i = 0; i < <?php echo($MAXCATEG - 2); ?>; i++) {
270 if (typeof (categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)]) == "undefined") {
271 // complete with empty record
272 console.log("complete with empty record");
273 $("#catdivdesc"+i).hide();
274 $("#catdesc"+i).text("");
275 $("#catimg"+i).attr("src","genimg/empty.png");
276 $("#catwatermark"+i).hide();
277 continue;
278 }
279 $("#catdivdesc"+i).show();
280 <?php
281 if (getDolGlobalString('TAKEPOS_SHOW_CATEGORY_DESCRIPTION') == 1) { ?>
282 $("#catdesc"+i).html(categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)]['label'].bold() + ' - ' + categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)]['description']);
283 <?php } else { ?>
284 $("#catdesc"+i).text(categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)]['label']);
285 <?php } ?>
286 $("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)]['rowid']);
287 $("#catdiv"+i).data("rowid",categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)]['rowid']);
288 $("#catdiv"+i).attr("data-rowid",categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)]['rowid']);
289 $("#catwatermark"+i).show();
290 }
291
292 ClearSearch();
293}
294
295// LoadProducts
296function LoadProducts(position, issubcat) {
297 console.log("LoadProducts position="+position+" issubcat="+issubcat);
298 var maxproduct = <?php echo($MAXPRODUCT - 2); ?>;
299
300 if (position=="supplements") {
301 currentcat="supplements";
302 } else {
303 $('#catimg'+position).animate({opacity: '0.5'}, 1);
304 $('#catimg'+position).animate({opacity: '1'}, 100);
305 if (issubcat == true) {
306 currentcat=$('#prodiv'+position).data('rowid');
307 } else {
308 console.log('#catdiv'+position);
309 currentcat=$('#catdiv'+position).data('rowid');
310 console.log("currentcat="+currentcat);
311 }
312 }
313 if (currentcat == undefined) {
314 return;
315 }
316 pageproducts=0;
317 ishow=0; //product to show counter
318
319 jQuery.each(subcategories, function(i, val) {
320 if (currentcat==val.fk_parent) {
321 $("#prodivdesc"+ishow).show();
322 <?php if (getDolGlobalString('TAKEPOS_SHOW_CATEGORY_DESCRIPTION') == 1) { ?>
323 $("#prodesc"+ishow).html(val.label.bold() + ' - ' + val.description);
324 $("#probutton"+ishow).html(val.label);
325 <?php } else { ?>
326 $("#prodesc"+ishow).text(val.label);
327 $("#probutton"+ishow).text(val.label);
328 <?php } ?>
329 $("#probutton"+ishow).show();
330 $("#proprice"+ishow).attr("class", "hidden");
331 $("#proprice"+ishow).html("");
332 $("#proimg"+ishow).attr("src","genimg/index.php?query=cat&id="+val.rowid);
333 $("#prodiv"+ishow).data("rowid",val.rowid);
334 $("#prodiv"+ishow).attr("data-rowid",val.rowid);
335 $("#prodiv"+ishow).data("iscat",1);
336 $("#prodiv"+ishow).attr("data-iscat",1);
337 $("#prowatermark"+ishow).show();
338 ishow++;
339 }
340 });
341
342 idata=0; //product data counter
343 var limit = 0;
344 if (maxproduct >= 1) {
345 limit = maxproduct-1;
346 }
347 // Only show products for sale (tosell=1)
348 $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset=0', function(data) {
349 console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat+" then loop on result to fill image thumbs");
350 console.log(data);
351
352 while (ishow < maxproduct) {
353 console.log("ishow"+ishow+" idata="+idata);
354 //console.log(data[idata]);
355
356 if (typeof (data[idata]) == "undefined") {
357 <?php if (!getDolGlobalString('TAKEPOS_HIDE_PRODUCT_IMAGES')) {
358 echo '$("#prodivdesc"+ishow).hide();';
359 echo '$("#prodesc"+ishow).text("");';
360 echo '$("#proimg"+ishow).attr("title","");';
361 echo '$("#proimg"+ishow).attr("src","genimg/empty.png");';
362 } else {
363 echo '$("#probutton"+ishow).hide();';
364 echo '$("#probutton"+ishow).text("");';
365 }?>
366 $("#proprice"+ishow).attr("class", "hidden");
367 $("#proprice"+ishow).html("");
368
369 $("#prodiv"+ishow).data("rowid","");
370 $("#prodiv"+ishow).attr("data-rowid","");
371
372 $("#prodiv"+ishow).attr("class","wrapper2 divempty");
373 } else {
374 <?php
375 $titlestring = "'".dol_escape_js($langs->transnoentities('Ref').': ')."' + data[idata]['ref']";
376 $titlestring .= " + ' - ".dol_escape_js($langs->trans("Barcode").': ')."' + data[idata]['barcode']";
377 ?>
378 var titlestring = <?php echo $titlestring; ?>;
379 <?php if (!getDolGlobalString('TAKEPOS_HIDE_PRODUCT_IMAGES')) {
380 echo '$("#prodivdesc"+ishow).show();';
381 if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) {
382 echo '$("#prodesc"+ishow).html(data[parseInt(idata)][\'ref\'].bold() + \' - \' + data[parseInt(idata)][\'label\']);';
383 } elseif (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 2) {
384 echo '$("#prodesc"+ishow).html(data[parseInt(idata)][\'ref\'].bold());';
385 } else {
386 echo '$("#prodesc"+ishow).html(data[parseInt(idata)][\'label\']);';
387 }
388 echo '$("#proimg"+ishow).attr("title", titlestring);';
389 echo '$("#proimg"+ishow).attr("src", "genimg/index.php?query=pro&id="+data[idata][\'id\']);';
390 } else {
391 echo '$("#probutton"+ishow).show();';
392 echo '$("#probutton"+ishow).html(data[parseInt(idata)][\'label\']);';
393 }
394 ?>
395 if (data[parseInt(idata)]['price_formated']) {
396 $("#proprice" + ishow).attr("class", "productprice");
397 <?php
398 if (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT')) {
399 ?>
400 $("#proprice" + ishow).html(data[parseInt(idata)]['price_formated']);
401 <?php
402 } else {
403 ?>
404 $("#proprice" + ishow).html(data[parseInt(idata)]['price_ttc_formated']);
405 <?php
406 }
407 ?>
408 }
409 console.log("#prodiv"+ishow+".data(rowid)="+data[idata]['id']);
410
411 $("#prodiv"+ishow).data("rowid", data[idata]['id']);
412 $("#prodiv"+ishow).attr("data-rowid", data[idata]['id']);
413 console.log($('#prodiv4').data('rowid'));
414
415 $("#prodiv"+ishow).data("iscat", 0);
416 $("#prodiv"+ishow).attr("data-iscat", 0);
417
418 $("#prodiv"+ishow).attr("class","wrapper2");
419
420 <?php
421 // Add js from hooks
422 $parameters=array();
423 $parameters['caller'] = 'loadProducts';
424 $hookmanager->executeHooks('completeJSProductDisplay', $parameters);
425 print $hookmanager->resPrint;
426 ?>
427 }
428 $("#prowatermark"+ishow).hide();
429 ishow++; //Next product to show after print data product
430 idata++; //Next data everytime
431 }
432 });
433
434 ClearSearch();
435}
436
437function MoreProducts(moreorless) {
438 console.log("MoreProducts");
439
440 if ($('#search_pagination').val() != '') {
441 return Search2('<?php echo(isset($keyCodeForEnter) ? $keyCodeForEnter : ''); ?>', moreorless);
442 }
443
444 var maxproduct = <?php echo($MAXPRODUCT - 2); ?>;
445
446 if (moreorless=="more"){
447 $('#proimg31').animate({opacity: '0.5'}, 1);
448 $('#proimg31').animate({opacity: '1'}, 100);
449 pageproducts=pageproducts+1;
450 }
451 if (moreorless=="less"){
452 $('#proimg30').animate({opacity: '0.5'}, 1);
453 $('#proimg30').animate({opacity: '1'}, 100);
454 if (pageproducts==0) return; //Return if no less pages
455 pageproducts=pageproducts-1;
456 }
457
458 ishow=0; //product to show counter
459 idata=0; //product data counter
460 var limit = 0;
461 if (maxproduct >= 1) {
462 limit = maxproduct-1;
463 }
464 var offset = <?php echo($MAXPRODUCT - 2); ?> * pageproducts;
465 // Only show products for sale (tosell=1)
466 $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&category='+currentcat+'&tosell=1&limit='+limit+'&offset='+offset, function(data) {
467 console.log("Call ajax.php (in MoreProducts) to get Products of category "+currentcat);
468
469 if (typeof (data[0]) == "undefined" && moreorless=="more"){ // Return if no more pages
470 pageproducts=pageproducts-1;
471 return;
472 }
473
474 while (ishow < maxproduct) {
475 if (typeof (data[idata]) == "undefined") {
476 $("#prodivdesc"+ishow).hide();
477 $("#prodesc"+ishow).text("");
478 $("#probutton"+ishow).text("");
479 $("#probutton"+ishow).hide();
480 $("#proprice"+ishow).attr("class", "");
481 $("#proprice"+ishow).html("");
482 $("#proimg"+ishow).attr("src","genimg/empty.png");
483 $("#prodiv"+ishow).data("rowid","");
484 $("#prodiv"+ishow).attr("data-rowid","");
485 } else {
486 $("#prodivdesc"+ishow).show();
487 <?php if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) { ?>
488 $("#prodesc"+ishow).html(data[parseInt(idata)]['ref'].bold() + ' - ' + data[parseInt(idata)]['label']);
489 <?php } elseif (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 2) { ?>
490 $("#prodesc"+ishow).html(data[parseInt(idata)]['ref'].bold());
491 <?php } else { ?>
492 $("#prodesc"+ishow).html(data[parseInt(idata)]['label']);
493 <?php } ?>
494 $("#probutton"+ishow).html(data[parseInt(idata)]['label']);
495 $("#probutton"+ishow).show();
496 if (data[parseInt(idata)]['price_formated']) {
497 $("#proprice" + ishow).attr("class", "productprice");
498 <?php
499 if (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT')) {
500 ?>
501 $("#proprice" + ishow).html(data[parseInt(idata)]['price_formated']);
502 <?php
503 } else {
504 ?>
505 $("#proprice" + ishow).html(data[parseInt(idata)]['price_ttc_formated']);
506 <?php
507 }
508 ?>
509 }
510 $("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']);
511 $("#prodiv"+ishow).data("rowid",data[idata]['id']);
512 $("#prodiv"+ishow).attr("data-rowid",data[idata]['id']);
513 $("#prodiv"+ishow).data("iscat",0);
514 }
515 $("#prowatermark"+ishow).hide();
516 ishow++; //Next product to show after print data product
517 idata++; //Next data everytime
518 }
519 });
520
521 ClearSearch();
522}
523
524function ClickProduct(position, qty = 1) {
525 console.log("ClickProduct at position"+position);
526 $('#proimg'+position).animate({opacity: '0.5'}, 1);
527 $('#proimg'+position).animate({opacity: '1'}, 100);
528 if ($('#prodiv'+position).data('iscat')==1){
529 console.log("Click on a category at position "+position);
530 LoadProducts(position, true);
531 }
532 else{
533 console.log($('#prodiv4').data('rowid'));
534 invoiceid = $("#invoiceid").val();
535 idproduct=$('#prodiv'+position).data('rowid');
536 console.log("Click on product at position "+position+" for idproduct "+idproduct+", qty="+qty+" invoicdeid="+invoiceid);
537 if (idproduct=="") return;
538 // Call page invoice.php to generate the section with product lines
539 $("#poslines").load("invoice.php?action=addline&token=<?php echo newToken() ?>&place="+place+"&idproduct="+idproduct+"&qty="+qty+"&invoiceid="+invoiceid, function() {
540 <?php if (getDolGlobalString('TAKEPOS_CUSTOMER_DISPLAY')) {
541 echo "CustomerDisplay();";
542 }?>
543 });
544 }
545
546 ClearSearch();
547}
548
549function ChangeThirdparty(idcustomer) {
550 console.log("ChangeThirdparty");
551 // Call page list.php to change customer
552 $("#poslines").load("<?php echo DOL_URL_ROOT ?>/societe/list.php?action=change&token=<?php echo newToken();?>&type=t&contextpage=poslist&idcustomer="+idcustomer+"&place="+place+"", function() {
553 });
554
555 ClearSearch();
556}
557
558function deleteline() {
559 invoiceid = $("#invoiceid").val();
560 console.log("Delete line invoiceid="+invoiceid);
561 $("#poslines").load("invoice.php?action=deleteline&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&invoiceid="+invoiceid, function() {
562 //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
563 });
564 ClearSearch();
565}
566
567function Customer() {
568 console.log("Open box to select the thirdparty place="+place);
569 $.colorbox({href:"../societe/list.php?type=t&contextpage=poslist&nomassaction=1&place="+place, width:"90%", height:"80%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Customer"); ?>"});
570}
571
572function Contact() {
573 console.log("Open box to select the contact place="+place);
574 $.colorbox({href:"../contact/list.php?type=c&contextpage=poslist&nomassaction=1&place="+place, width:"90%", height:"80%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Contact"); ?>"});
575}
576
577function History()
578{
579 console.log("Open box to select the history");
580 $.colorbox({href:"../compta/facture/list.php?contextpage=poslist", width:"90%", height:"80%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("History"); ?>"});
581}
582
583function Reduction() {
584 invoiceid = $("#invoiceid").val();
585 console.log("Open popup to enter reduction on invoiceid="+invoiceid);
586 $.colorbox({href:"reduction.php?place="+place+"&invoiceid="+invoiceid, width:"80%", height:"90%", transition:"none", iframe:"true", title:""});
587}
588
589function CloseBill() {
590 invoiceid = $("#invoiceid").val();
591 console.log("Open popup to enter payment on invoiceid="+invoiceid);
592 $.colorbox({href:"pay.php?place="+place+"&invoiceid="+invoiceid, width:"80%", height:"90%", transition:"none", iframe:"true", title:""});
593}
594
595function Split() {
596 invoiceid = $("#invoiceid").val();
597 console.log("Open popup to split on invoiceid="+invoiceid);
598 $.colorbox({href:"split.php?place="+place+"&invoiceid="+invoiceid, width:"80%", height:"90%", transition:"none", iframe:"true", title:""});
599}
600
601function Floors() {
602 console.log("Open box to select floor place="+place);
603 $.colorbox({href:"floors.php?place="+place, width:"90%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Floors"); ?>"});
604}
605
606function FreeZone() {
607 invoiceid = $("#invoiceid").val();
608 console.log("Open box to enter a free product on invoiceid="+invoiceid);
609 $.colorbox({href:"freezone.php?action=freezone&token=<?php echo newToken(); ?>&place="+place+"&invoiceid="+invoiceid, width:"80%", height:"40%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("FreeZone"); ?>"});
610}
611
612function TakeposOrderNotes() {
613 console.log("Open box to order notes");
614 ModalBox('ModalNote');
615 $("#textinput").focus();
616}
617
618function Refresh() {
619 console.log("Refresh by reloading place="+place+" invoiceid="+invoiceid);
620 $("#poslines").load("invoice.php?place="+place+"&invoiceid="+invoiceid, function() {
621 //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
622 });
623}
624
625function New() {
626 // If we go here,it means $conf->global->TAKEPOS_BAR_RESTAURANT is not defined
627 invoiceid = $("#invoiceid").val(); // This is a hidden field added by invoice.php
628
629 console.log("New with place = <?php echo $place; ?>, js place="+place+", invoiceid="+invoiceid);
630
631 $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getInvoice&token=<?php echo newToken();?>&id='+invoiceid, function(data) {
632 var r;
633
634 if (parseInt(data['paye']) === 1) {
635 r = true;
636 } else {
637 r = confirm('<?php echo($place > 0 ? $langs->transnoentitiesnoconv("ConfirmDeletionOfThisPOSSale") : $langs->transnoentitiesnoconv("ConfirmDiscardOfThisPOSSale")); ?>');
638 }
639
640 if (r == true) {
641 // Reload section with invoice lines
642 $("#poslines").load("invoice.php?action=delete&token=<?php echo newToken(); ?>&place=" + place, function () {
643 //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
644 });
645 ClearSearch();
646 }
647 });
648}
649
657function Search2(keyCodeForEnter, moreorless) {
658 var eventKeyCode = window.event.keyCode;
659
660 console.log("Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter+", eventKeyCode="+eventKeyCode);
661
662 var search_term = $('#search').val();
663 var search_start = 0;
664 var search_limit = <?php echo $MAXPRODUCT - 2; ?>;
665 if (moreorless != null) {
666 search_term = $('#search_pagination').val();
667 search_start = $('#search_start_'+moreorless).val();
668 }
669
670 console.log("search_term="+search_term);
671
672 if (search_term == '') {
673 $("[id^=prowatermark]").html("");
674 $("[id^=prodesc]").text("");
675 $("[id^=probutton]").text("");
676 $("[id^=probutton]").hide();
677 $("[id^=proprice]").attr("class", "hidden");
678 $("[id^=proprice]").html("");
679 $("[id^=proimg]").attr("src", "genimg/empty.png");
680 $("[id^=prodiv]").data("rowid", "");
681 $("[id^=prodiv]").attr("data-rowid", "");
682 return;
683 }
684
685 var search = false;
686 if (keyCodeForEnter == '' || eventKeyCode == keyCodeForEnter) {
687 search = true;
688 }
689
690 if (search === true) {
691 // if a timer has been already started (search2_timer is a global js variable), we cancel it now
692 // we click onto another key, we will restart another timer just after
693 if (search2_timer) {
694 clearTimeout(search2_timer);
695 }
696
697 // temporization time to give time to type
698 search2_timer = setTimeout(function(){
699 pageproducts = 0;
700 jQuery(".wrapper2 .catwatermark").hide();
701 var nbsearchresults = 0;
702 $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&token=<?php echo newToken();?>&term=' + search_term + '&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&search_start=' + search_start + '&search_limit=' + search_limit, function (data) {
703 for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
704 if (typeof (data[i]) == "undefined") {
705 $("#prowatermark" + i).html("");
706 $("#prodesc" + i).text("");
707 $("#probutton" + i).text("");
708 $("#probutton" + i).hide();
709 $("#proprice" + i).attr("class", "hidden");
710 $("#proprice" + i).html("");
711 $("#proimg" + i).attr("src", "genimg/empty.png");
712 $("#prodiv" + i).data("rowid", "");
713 $("#prodiv" + i).attr("data-rowid", "");
714 continue;
715 }
716 <?php
717 $titlestring = "'".dol_escape_js($langs->transnoentities('Ref').': ')."' + data[i]['ref']";
718 $titlestring .= " + ' - ".dol_escape_js($langs->trans("Barcode").': ')."' + data[i]['barcode']";
719 ?>
720 var titlestring = <?php echo $titlestring; ?>;
721 <?php if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) { ?>
722 $("#prodesc" + i).html(data[i]['ref'].bold() + ' - ' + data[i]['label']);
723 <?php } elseif (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 2) { ?>
724 $("#prodesc" + i).html(data[i]['ref'].bold());
725 <?php } else { ?>
726 $("#prodesc" + i).html(data[i]['label']);
727 <?php } ?>
728 $("#prodivdesc" + i).show();
729 $("#probutton" + i).html(data[i]['label']);
730 $("#probutton" + i).show();
731 if (data[i]['price_formated']) {
732 $("#proprice" + i).attr("class", "productprice");
733 <?php
734 if (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT')) {
735 ?>
736 $("#proprice" + i).html(data[i]['price_formated']);
737 <?php
738 } else {
739 ?>
740 $("#proprice" + i).html(data[i]['price_ttc_formated']);
741 <?php
742 }
743 ?>
744 }
745 $("#proimg" + i).attr("title", titlestring);
746 if( undefined !== data[i]['img']) {
747 $("#proimg" + i).attr("src", data[i]['img']);
748 }
749 else {
750 $("#proimg" + i).attr("src", "genimg/index.php?query=pro&id=" + data[i]['rowid']);
751 }
752 $("#prodiv" + i).data("rowid", data[i]['rowid']);
753 $("#prodiv" + i).attr("data-rowid", data[i]['rowid']);
754 $("#prodiv" + i).data("iscat", 0);
755 $("#prodiv" + i).attr("data-iscat", 0);
756
757 <?php
758 // Add js from hooks
759 $parameters=array();
760 $parameters['caller'] = 'search2';
761 $hookmanager->executeHooks('completeJSProductDisplay', $parameters);
762 print $hookmanager->resPrint;
763 ?>
764
765 nbsearchresults++;
766 }
767 }).always(function (data) {
768 // If there is only 1 answer
769 if ($('#search').val().length > 0 && data.length == 1) {
770 console.log($('#search').val()+' - '+data[0]['barcode']);
771 if ($('#search').val() == data[0]['barcode'] && 'thirdparty' == data[0]['object']) {
772 console.log("There is only 1 answer with barcode matching the search, so we change the thirdparty "+data[0]['rowid']);
773 ChangeThirdparty(data[0]['rowid']);
774 }
775 else if ($('#search').val() == data[0]['barcode'] && 'product' == data[0]['object']) {
776 console.log("There is only 1 answer and we found search on a barcode, so we add the product in basket, qty="+data[0]['qty']);
777 ClickProduct(0, data[0]['qty']);
778 }
779 }
780 if (eventKeyCode == keyCodeForEnter){
781 if (data.length == 0) {
782 $('#search').val('<?php
783 $langs->load('errors');
784 echo dol_escape_js($langs->transnoentitiesnoconv("ErrorRecordNotFoundShort"));
785 ?> ('+search_term+')');
786 $('#search').select();
787 }
788 else ClearSearch();
789 }
790 // memorize search_term and start for pagination
791 $("#search_pagination").val($("#search").val());
792 if (search_start == 0) {
793 $("#prodiv<?php echo $MAXPRODUCT - 2; ?> span").hide();
794 }
795 else {
796 $("#prodiv<?php echo $MAXPRODUCT - 2; ?> span").show();
797 var search_start_less = Math.max(0, parseInt(search_start) - parseInt(<?php echo $MAXPRODUCT - 2;?>));
798 $("#search_start_less").val(search_start_less);
799 }
800 if (nbsearchresults != <?php echo $MAXPRODUCT - 2; ?>) {
801 $("#prodiv<?php echo $MAXPRODUCT - 1; ?> span").hide();
802 }
803 else {
804 $("#prodiv<?php echo $MAXPRODUCT - 1; ?> span").show();
805 var search_start_more = parseInt(search_start) + parseInt(<?php echo $MAXPRODUCT - 2;?>);
806 $("#search_start_more").val(search_start_more);
807 }
808 });
809 }, 500); // 500ms delay
810 }
811
812}
813
814/* Function called on an action into the PAD */
815function Edit(number) {
816 console.log("We click on PAD on key="+number);
817
818 if (typeof(selectedtext) == "undefined") {
819 return; // We click on an action on the number pad but there is no line selected
820 }
821
822 var text=selectedtext+"<br> ";
823
824
825 if (number=='c') {
826 editnumber='';
827 Refresh();
828 $("#qty").html("<?php echo $langs->trans("Qty"); ?>").removeClass('clicked');
829 $("#price").html("<?php echo $langs->trans("Price"); ?>").removeClass('clicked');
830 $("#reduction").html("<?php echo $langs->trans("LineDiscountShort"); ?>").removeClass('clicked');
831 return;
832 } else if (number=='qty') {
833 if (editaction=='qty' && editnumber != '') {
834 $("#poslines").load("invoice.php?action=updateqty&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
835 editnumber="";
836 //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
837 $("#qty").html("<?php echo $langs->trans("Qty"); ?>").removeClass('clicked');
838 });
839
840 setFocusOnSearchField();
841 return;
842 }
843 else {
844 editaction="qty";
845 }
846 } else if (number=='p') {
847 if (editaction=='p' && editnumber!="") {
848 $("#poslines").load("invoice.php?action=updateprice&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
849 editnumber="";
850 //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
851 $("#price").html("<?php echo $langs->trans("Price"); ?>").removeClass('clicked');
852 });
853
854 ClearSearch();
855 return;
856 }
857 else {
858 editaction="p";
859 }
860 } else if (number=='r') {
861 if (editaction=='r' && editnumber!="") {
862 $("#poslines").load("invoice.php?action=updatereduction&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
863 editnumber="";
864 //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
865 $("#reduction").html("<?php echo $langs->trans("LineDiscountShort"); ?>").removeClass('clicked');
866 });
867
868 ClearSearch();
869 return;
870 }
871 else {
872 editaction="r";
873 }
874 }
875 else {
876 editnumber=editnumber+number;
877 }
878 if (editaction=='qty'){
879 text=text+"<?php echo $langs->trans("Modify")." -> ".$langs->trans("Qty").": "; ?>";
880 $("#qty").html("OK").addClass("clicked");
881 $("#price").html("<?php echo $langs->trans("Price"); ?>").removeClass('clicked');
882 $("#reduction").html("<?php echo $langs->trans("LineDiscountShort"); ?>").removeClass('clicked');
883 }
884 if (editaction=='p'){
885 text=text+"<?php echo $langs->trans("Modify")." -> ".$langs->trans("Price").": "; ?>";
886 $("#qty").html("<?php echo $langs->trans("Qty"); ?>").removeClass('clicked');
887 $("#price").html("OK").addClass("clicked");
888 $("#reduction").html("<?php echo $langs->trans("LineDiscountShort"); ?>").removeClass('clicked');
889 }
890 if (editaction=='r'){
891 text=text+"<?php echo $langs->trans("Modify")." -> ".$langs->trans("LineDiscountShort").": "; ?>";
892 $("#qty").html("<?php echo $langs->trans("Qty"); ?>").removeClass('clicked');
893 $("#price").html("<?php echo $langs->trans("Price"); ?>").removeClass('clicked');
894 $("#reduction").html("OK").addClass("clicked");
895 }
896 $('#'+selectedline).find("td:first").html(text+editnumber);
897}
898
899
900function TakeposPrintingOrder(){
901 console.log("TakeposPrintingOrder");
902 $("#poslines").load("invoice.php?action=order&token=<?php echo newToken();?>&place="+place, function() {
903 //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
904 });
905}
906
907function TakeposPrintingTemp(){
908 console.log("TakeposPrintingTemp");
909 $("#poslines").load("invoice.php?action=temp&token=<?php echo newToken();?>&place="+place, function() {
910 //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
911 });
912}
913
914function OpenDrawer(){
915 console.log("OpenDrawer call ajax url http://<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER'); ?>:8111/print");
916 $.ajax({
917 type: "POST",
918 data: { token: 'notrequired' },
919 <?php
920 if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
921 echo "url: '".getDolGlobalString('TAKEPOS_PRINT_SERVER', 'localhost')."/printer/drawer.php',";
922 } else {
923 echo "url: 'http://".getDolGlobalString('TAKEPOS_PRINT_SERVER', 'localhost').":8111/print',";
924 }
925 ?>
926 data: "opendrawer"
927 });
928}
929
930function DolibarrOpenDrawer() {
931 console.log("DolibarrOpenDrawer call ajax url /takepos/ajax/ajax.php?action=opendrawer&token=<?php echo newToken();?>&term=<?php print urlencode($_SESSION["takeposterminal"]); ?>");
932 $.ajax({
933 type: "GET",
934 data: { token: '<?php echo currentToken(); ?>' },
935 url: "<?php print DOL_URL_ROOT.'/takepos/ajax/ajax.php?action=opendrawer&token='.newToken().'&term='.urlencode($_SESSION["takeposterminal"]); ?>",
936 });
937}
938
939function MoreActions(totalactions){
940 if (pageactions==0){
941 pageactions=1;
942 for (i = 0; i <= totalactions; i++){
943 if (i<12) $("#action"+i).hide();
944 else $("#action"+i).show();
945 }
946 }
947 else if (pageactions==1){
948 pageactions=0;
949 for (i = 0; i <= totalactions; i++){
950 if (i<12) $("#action"+i).show();
951 else $("#action"+i).hide();
952 }
953 }
954
955 return true;
956}
957
958function ControlCashOpening()
959{
960 $.colorbox({href:"../compta/cashcontrol/cashcontrol_card.php?action=create&contextpage=takepos", width:"90%", height:"60%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("NewCashFence"); ?>"});
961}
962
963function CloseCashFence(rowid)
964{
965 $.colorbox({href:"../compta/cashcontrol/cashcontrol_card.php?id="+rowid+"&contextpage=takepos", width:"90%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("NewCashFence"); ?>"});
966}
967
968function CashReport(rowid)
969{
970 $.colorbox({href:"../compta/cashcontrol/report.php?id="+rowid+"&contextpage=takepos", width:"60%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("CashReport"); ?>"});
971}
972
973// TakePOS Popup
974function ModalBox(ModalID)
975{
976 var modal = document.getElementById(ModalID);
977 modal.style.display = "block";
978}
979
980function DirectPayment(){
981 console.log("DirectPayment");
982 $("#poslines").load("invoice.php?place="+place+"&action=valid&token=<?php echo newToken(); ?>&pay=LIQ", function() {
983 });
984}
985
986function FullScreen() {
987 document.documentElement.requestFullscreen();
988}
989
990function WeighingScale(){
991 console.log("Weighing Scale");
992 $.ajax({
993 type: "POST",
994 data: { token: 'notrequired' },
995 url: '<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER'); ?>/scale/index.php',
996 })
997 .done(function( editnumber ) {
998 $("#poslines").load("invoice.php?token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
999 editnumber="";
1000 });
1001 });
1002}
1003
1004$( document ).ready(function() {
1005 PrintCategories(0);
1006 LoadProducts(0);
1007 Refresh();
1008 <?php
1009 //IF NO TERMINAL SELECTED
1010 if ($_SESSION["takeposterminal"] == "") {
1011 print "ModalBox('ModalTerminal');";
1012 }
1013
1014 if (getDolGlobalString('TAKEPOS_CONTROL_CASH_OPENING')) {
1015 $sql = "SELECT rowid, status FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE";
1016 $sql .= " entity = ".((int) $conf->entity)." AND ";
1017 $sql .= " posnumber = ".((int) $_SESSION["takeposterminal"])." AND ";
1018 $sql .= " date_creation > '".$db->idate(dol_get_first_hour(dol_now()))."'";
1019 $resql = $db->query($sql);
1020 if ($resql) {
1021 $obj = $db->fetch_object($resql);
1022 // If there is no cash control from today open it
1023 if (!isset($obj->rowid) || is_null($obj->rowid)) {
1024 print "ControlCashOpening();";
1025 }
1026 }
1027 }
1028 ?>
1029
1030 /* For Header Scroll */
1031 var elem1 = $("#topnav-left")[0];
1032 var elem2 = $("#topnav-right")[0];
1033 var checkOverflow = function() {
1034 if (scrollBars().horizontal) $("#topnav").addClass("overflow");
1035 else $("#topnav").removeClass("overflow");
1036 }
1037
1038 var scrollBars = function(){
1039 var container= $('#topnav')[0];
1040 return {
1041 vertical:container.scrollHeight > container.clientHeight,
1042 horizontal:container.scrollWidth > container.clientWidth
1043 }
1044 }
1045
1046 $(window).resize(function(){
1047 checkOverflow();
1048 });
1049
1050 let resizeObserver = new ResizeObserver(() => {
1051 checkOverflow();
1052 });
1053 resizeObserver.observe(elem1);
1054 resizeObserver.observe(elem2);
1055 checkOverflow();
1056
1057 var pressTimer = [];
1058 var direction = 1;
1059 var step = 200;
1060
1061 $(".indicator").mousedown(function(){
1062 direction = $(this).hasClass("left") ? -1 : 1;
1063 scrollTo();
1064 pressTimer.push(setInterval(scrollTo, 100));
1065 });
1066
1067 $(".indicator").mouseup(function(){
1068 pressTimer.forEach(clearInterval);
1069 });
1070
1071 $("body").mouseup(function(){
1072 pressTimer.forEach(clearInterval);
1073 console.log("body");
1074 });
1075
1076 function scrollTo(){
1077 console.log("here");
1078 var pos = $("#topnav").scrollLeft();
1079 document.getElementById("topnav").scrollTo({ left: $("#topnav").scrollLeft() + direction * step, behavior: 'smooth' })
1080 }
1081
1082 $("#topnav").scroll(function(){
1083 if (($("#topnav").offsetWidth + $("#topnav").scrollLeft >= $("#topnav").scrollWidth)) {
1084 console.log("end");
1085 }
1086 });
1087 /* End Header Scroll */
1088});
1089</script>
1090
1091<?php
1092$keyCodeForEnter = getDolGlobalInt('CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION['takeposterminal']) > 0 ? getDolGlobalInt('CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION['takeposterminal']) : '';
1093?>
1094<div class="container">
1095
1096<?php
1097if (!getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) {
1098 ?>
1099 <div class="header">
1100 <div id="topnav" class="topnav">
1101 <div id="topnav-left" class="topnav-left">
1102 <div class="inline-block valignmiddle">
1103 <a class="topnav-terminalhour" onclick="ModalBox('ModalTerminal')">
1104 <span class="fa fa-cash-register"></span>
1105 <span class="hideonsmartphone">
1106 <?php echo getDolGlobalString("TAKEPOS_TERMINAL_NAME_".$_SESSION["takeposterminal"], $langs->trans("TerminalName", $_SESSION["takeposterminal"])); ?>
1107 </span>
1108 <?php
1109 echo '<span class="hideonsmartphone"> - '.dol_print_date(dol_now(), "day").'</span>'; ?>
1110 </a>
1111 <?php
1112 if (isModEnabled('multicurrency')) {
1113 print '<a class="valignmiddle tdoverflowmax100" id="multicurrency" onclick="ModalBox(\'ModalCurrency\')" title=""><span class="fas fa-coins paddingrightonly"></span>';
1114 print '<span class="hideonsmartphone">'.$langs->trans("Currency").'</span>';
1115 print '</a>';
1116 } ?>
1117 </div>
1118 <!-- section for customer -->
1119 <div class="inline-block valignmiddle" id="customerandsales"></div>
1120 <!-- section for shopping carts -->
1121 <div class="inline-block valignmiddle" id="shoppingcart"></div>
1122 <!-- More info about customer -->
1123 <div class="inline-block valignmiddle tdoverflowmax150onsmartphone" id="moreinfo"></div>
1124 <?php
1125 if (isModEnabled('stock')) {
1126 ?>
1127 <!-- More info about warehouse -->
1128 <div class="inline-block valignmiddle tdoverflowmax150onsmartphone" id="infowarehouse"></div>
1129 <?php
1130 } ?>
1131 </div>
1132 <div id="topnav-right" class="topnav-right">
1133 <?php
1134 $reshook = $hookmanager->executeHooks('takepos_login_block_other');
1135 if ($reshook == 0) { //Search method
1136 ?>
1137 <div class="login_block_other">
1138 <input type="text" id="search" name="search" class="input-nobottom" onkeyup="Search2('<?php echo dol_escape_js($keyCodeForEnter); ?>', null);" placeholder="<?php echo dol_escape_htmltag($langs->trans("Search")); ?>" autofocus>
1139 <a onclick="ClearSearch();" class="nohover"><span class="fa fa-backspace"></span></a>
1140 <a href="<?php echo DOL_URL_ROOT.'/'; ?>" target="backoffice" rel="opener"><!-- we need rel="opener" here, we are on same domain and we need to be able to reuse this tab several times -->
1141 <span class="fas fa-home"></span></a>
1142 <?php if (empty($conf->dol_use_jmobile)) { ?>
1143 <a class="hideonsmartphone" onclick="FullScreen();" title="<?php echo dol_escape_htmltag($langs->trans("ClickFullScreenEscapeToLeave")); ?>"><span class="fa fa-expand-arrows-alt"></span></a>
1144 <?php } ?>
1145 </div>
1146 <?php
1147 }
1148 ?>
1149 <div class="login_block_user">
1150 <?php
1151 print top_menu_user(1, DOL_URL_ROOT.'/user/logout.php?token='.newtoken().'&urlfrom='.urlencode('/takepos/?setterminal='.((int) $term)));
1152 ?>
1153 </div>
1154 </div>
1155 <div class="arrows">
1156 <span class="indicator left"><i class="fa fa-arrow-left"></i></span>
1157 <span class="indicator right"><i class="fa fa-arrow-right"></i></span>
1158 </div>
1159 </div>
1160 </div>
1161 <?php
1162}
1163?>
1164
1165<!-- Modal terminal box -->
1166<div id="ModalTerminal" class="modal">
1167 <div class="modal-content">
1168 <div class="modal-header">
1169 <?php
1170 if (!getDolGlobalString('TAKEPOS_FORCE_TERMINAL_SELECT')) {
1171 ?>
1172 <span class="close" href="#" onclick="document.getElementById('ModalTerminal').style.display = 'none';">&times;</span>
1173 <?php
1174 } ?>
1175 <h3><?php print $langs->trans("TerminalSelect"); ?></h3>
1176 </div>
1177 <div class="modal-body">
1178 <button type="button" class="block" onclick="location.href='index.php?setterminal=1'"><?php print getDolGlobalString("TAKEPOS_TERMINAL_NAME_1", $langs->trans("TerminalName", 1)); ?></button>
1179 <?php
1180 $nbloop = getDolGlobalInt('TAKEPOS_NUM_TERMINALS');
1181 for ($i = 2; $i <= $nbloop; $i++) {
1182 print '<button type="button" class="block" onclick="location.href=\'index.php?setterminal='.$i.'\'">'.getDolGlobalString("TAKEPOS_TERMINAL_NAME_".$i, $langs->trans("TerminalName", $i)).'</button>';
1183 }
1184 ?>
1185 </div>
1186</div>
1187</div>
1188
1189<!-- Modal multicurrency box -->
1190<?php if (isModEnabled('multicurrency')) { ?>
1191<div id="ModalCurrency" class="modal">
1192 <div class="modal-content">
1193 <div class="modal-header">
1194 <span class="close" href="#" onclick="document.getElementById('ModalCurrency').style.display = 'none';">&times;</span>
1195 <h3><?php print $langs->trans("SetMultiCurrencyCode"); ?></h3>
1196 </div>
1197 <div class="modal-body">
1198 <?php
1199 $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency';
1200 $sql .= " WHERE entity IN ('".getEntity('multicurrency')."')";
1201 $resql = $db->query($sql);
1202 if ($resql) {
1203 while ($obj = $db->fetch_object($resql)) {
1204 print '<button type="button" class="block" onclick="location.href=\'index.php?setcurrency='.$obj->code.'\'">'.$obj->code.'</button>';
1205 }
1206 }
1207 ?>
1208 </div>
1209 </div>
1210</div>
1211<?php } ?>
1212
1213<!-- Modal terminal Credit Note -->
1214<div id="ModalCreditNote" class="modal">
1215 <div class="modal-content">
1216 <div class="modal-header">
1217 <span class="close" href="#" onclick="document.getElementById('ModalCreditNote').style.display = 'none';">&times;</span>
1218 <h3><?php print $langs->trans("invoiceAvoirWithLines"); ?></h3>
1219 </div>
1220 <div class="modal-body">
1221 <button type="button" class="block" onclick="CreditNote(); document.getElementById('ModalCreditNote').style.display = 'none';"><?php print $langs->trans("Yes"); ?></button>
1222 <button type="button" class="block" onclick="document.getElementById('ModalCreditNote').style.display = 'none';"><?php print $langs->trans("No"); ?></button>
1223 </div>
1224</div>
1225</div>
1226
1227<!-- Modal Note -->
1228<div id="ModalNote" class="modal">
1229 <div class="modal-content">
1230 <div class="modal-header">
1231 <span class="close" href="#" onclick="document.getElementById('ModalNote').style.display = 'none';">&times;</span>
1232 <h3><?php print $langs->trans("Note"); ?></h3>
1233 </div>
1234 <div class="modal-body">
1235 <input type="text" class="block" id="textinput">
1236 <button type="button" class="block" onclick="SetNote(); document.getElementById('ModalNote').style.display = 'none';">OK</button>
1237 </div>
1238</div>
1239</div>
1240
1241 <div class="row1<?php if (!getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) {
1242 print 'withhead';
1243 } ?>">
1244
1245 <div id="poslines" class="div1">
1246 </div>
1247
1248 <div class="div2">
1249 <button type="button" class="calcbutton" onclick="Edit(7);">7</button>
1250 <button type="button" class="calcbutton" onclick="Edit(8);">8</button>
1251 <button type="button" class="calcbutton" onclick="Edit(9);">9</button>
1252 <button type="button" id="qty" class="calcbutton2" onclick="Edit('qty')"><?php echo $langs->trans("Qty"); ?></button>
1253 <button type="button" class="calcbutton" onclick="Edit(4);">4</button>
1254 <button type="button" class="calcbutton" onclick="Edit(5);">5</button>
1255 <button type="button" class="calcbutton" onclick="Edit(6);">6</button>
1256 <button type="button" id="price" class="calcbutton2" onclick="Edit('p')"><?php echo $langs->trans("Price"); ?></button>
1257 <button type="button" class="calcbutton" onclick="Edit(1);">1</button>
1258 <button type="button" class="calcbutton" onclick="Edit(2);">2</button>
1259 <button type="button" class="calcbutton" onclick="Edit(3);">3</button>
1260 <button type="button" id="reduction" class="calcbutton2" onclick="Edit('r')"><?php echo $langs->trans("LineDiscountShort"); ?></button>
1261 <button type="button" class="calcbutton" onclick="Edit(0);">0</button>
1262 <button type="button" class="calcbutton" onclick="Edit('.')">.</button>
1263 <button type="button" class="calcbutton poscolorblue" onclick="Edit('c')">C</button>
1264 <button type="button" class="calcbutton2 poscolordelete" id="delete" onclick="deleteline()"><span class="fa fa-trash"></span></button>
1265 </div>
1266
1267<?php
1268
1269// TakePOS setup check
1270if (isset($_SESSION["takeposterminal"]) && $_SESSION["takeposterminal"]) {
1271 $sql = "SELECT code, libelle FROM " . MAIN_DB_PREFIX . "c_paiement";
1272 $sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")";
1273 $sql .= " AND active = 1";
1274 $sql .= " ORDER BY libelle";
1275
1276 $resql = $db->query($sql);
1277 $paiementsModes = array();
1278 if ($resql) {
1279 while ($obj = $db->fetch_object($resql)) {
1280 $paycode = $obj->code;
1281 if ($paycode == 'LIQ') {
1282 $paycode = 'CASH';
1283 }
1284 if ($paycode == 'CHQ') {
1285 $paycode = 'CHEQUE';
1286 }
1287
1288 $constantforkey = "CASHDESK_ID_BANKACCOUNT_" . $paycode . $_SESSION["takeposterminal"];
1289 //var_dump($constantforkey.' '.getDolGlobalInt($constantforkey));
1290 if (getDolGlobalInt($constantforkey) > 0) {
1291 array_push($paiementsModes, $obj);
1292 }
1293 }
1294 }
1295
1296 if (empty($paiementsModes) && isModEnabled("banque")) {
1297 $langs->load('errors');
1298 setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("TakePOS")), null, 'errors');
1299 setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors');
1300 }
1301}
1302
1303if (count($maincategories) == 0) {
1304 if (getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID') > 0) {
1305 $tmpcategory = new Categorie($db);
1306 $tmpcategory->fetch($conf->global->TAKEPOS_ROOT_CATEGORY_ID);
1307 setEventMessages($langs->trans("TakeposNeedsAtLeastOnSubCategoryIntoParentCategory", $tmpcategory->label), null, 'errors');
1308 } else {
1309 setEventMessages($langs->trans("TakeposNeedsCategories"), null, 'errors');
1310 }
1311}
1312// User menu and external TakePOS modules
1313$menus = array();
1314$r = 0;
1315
1316if (!getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1317 $menus[$r++] = array('title'=>'<span class="fa fa-layer-group paddingrightonly"></span><div class="trunc">'.$langs->trans("New").'</div>', 'action'=>'New();');
1318} else {
1319 // BAR RESTAURANT specific menu
1320 $menus[$r++] = array('title'=>'<span class="fa fa-layer-group paddingrightonly"></span><div class="trunc">'.$langs->trans("Place").'</div>', 'action'=>'Floors();');
1321}
1322
1323if (getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) {
1324 if (getDolGlobalString('TAKEPOS_CHOOSE_CONTACT')) {
1325 $menus[$r++] = array('title'=>'<span class="far fa-building paddingrightonly"></span><div class="trunc">'.$langs->trans("Contact").'</div>', 'action'=>'Contact();');
1326 } else {
1327 $menus[$r++] = array('title'=>'<span class="far fa-building paddingrightonly"></span><div class="trunc">'.$langs->trans("Customer").'</div>', 'action'=>'Customer();');
1328 }
1329}
1330if (! getDolGlobalString('TAKEPOS_HIDE_HISTORY')) {
1331 $menus[$r++] = array('title'=>'<span class="fa fa-history paddingrightonly"></span><div class="trunc">'.$langs->trans("History").'</div>', 'action'=>'History();');
1332}
1333$menus[$r++] = array('title'=>'<span class="fa fa-cube paddingrightonly"></span><div class="trunc">'.$langs->trans("FreeZone").'</div>', 'action'=>'FreeZone();');
1334$menus[$r++] = array('title'=>'<span class="fa fa-percent paddingrightonly"></span><div class="trunc">'.$langs->trans("InvoiceDiscountShort").'</div>', 'action'=>'Reduction();');
1335$menus[$r++] = array('title'=>'<span class="far fa-money-bill-alt paddingrightonly"></span><div class="trunc">'.$langs->trans("Payment").'</div>', 'action'=>'CloseBill();');
1336
1337if (getDolGlobalString('TAKEPOS_DIRECT_PAYMENT')) {
1338 $menus[$r++] = array('title'=>'<span class="far fa-money-bill-alt paddingrightonly"></span><div class="trunc">'.$langs->trans("DirectPayment").' <span class="opacitymedium">('.$langs->trans("Cash").')</span></div>', 'action'=>'DirectPayment();');
1339}
1340
1341$menus[$r++] = array('title'=>'<span class="fas fa-cut paddingrightonly"></span><div class="trunc">'.$langs->trans("SplitSale").'</div>', 'action'=>'Split();');
1342
1343// BAR RESTAURANT specific menu
1344if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1345 if (getDolGlobalString('TAKEPOS_ORDER_PRINTERS')) {
1346 $menus[$r++] = array('title'=>'<span class="fa fa-blender-phone paddingrightonly"></span><div class="trunc">'.$langs->trans("Order").'</span>', 'action'=>'TakeposPrintingOrder();');
1347 }
1348 //Button to print receipt before payment
1349 if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1350 if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
1351 if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
1352 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("Receipt").'</div>', 'action'=>'TakeposConnector(placeid);');
1353 } else {
1354 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("Receipt").'</div>', 'action'=>'TakeposPrinting(placeid);');
1355 }
1356 } elseif ((isModEnabled('receiptprinter') && getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0) || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") {
1357 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("Receipt").'</div>', 'action'=>'DolibarrTakeposPrinting(placeid);');
1358 } else {
1359 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("Receipt").'</div>', 'action'=>'Print(placeid);');
1360 }
1361 }
1362 if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector" && getDolGlobalString('TAKEPOS_ORDER_NOTES') == 1) {
1363 $menus[$r++] = array('title'=>'<span class="fa fa-sticky-note paddingrightonly"></span><div class="trunc">'.$langs->trans("OrderNotes").'</div>', 'action'=>'TakeposOrderNotes();');
1364 }
1365 if (getDolGlobalString('TAKEPOS_SUPPLEMENTS')) {
1366 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("ProductSupplements").'</div>', 'action'=>'LoadProducts(\'supplements\');');
1367 }
1368}
1369
1370if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
1371 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("DOL_OPEN_DRAWER").'</div>', 'action'=>'OpenDrawer();');
1372}
1373if (getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0 || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") {
1374 $menus[$r++] = array(
1375 'title' => '<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("DOL_OPEN_DRAWER").'</div>',
1376 'action' => 'DolibarrOpenDrawer();',
1377 );
1378}
1379
1380$sql = "SELECT rowid, status, entity FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE";
1381$sql .= " entity = ".((int) $conf->entity)." AND ";
1382$sql .= " posnumber = ".((int) $_SESSION["takeposterminal"])." AND ";
1383$sql .= " date_creation > '".$db->idate(dol_get_first_hour(dol_now()))."'";
1384
1385$resql = $db->query($sql);
1386if ($resql) {
1387 $num = $db->num_rows($resql);
1388 if ($num) {
1389 $obj = $db->fetch_object($resql);
1390 $menus[$r++] = array('title'=>'<span class="fas fa-file-invoice-dollar paddingrightonly"></span><div class="trunc">'.$langs->trans("CashReport").'</div>', 'action'=>'CashReport('.$obj->rowid.');');
1391 if ($obj->status == 0) {
1392 $menus[$r++] = array('title'=>'<span class="fas fa-cash-register paddingrightonly"></span><div class="trunc">'.$langs->trans("CloseCashFence").'</div>', 'action'=>'CloseCashFence('.$obj->rowid.');');
1393 }
1394 }
1395}
1396
1397$parameters = array('menus'=>$menus);
1398$reshook = $hookmanager->executeHooks('ActionButtons', $parameters);
1399if ($reshook == 0) { //add buttons
1400 if (is_array($hookmanager->resArray)) {
1401 foreach ($hookmanager->resArray as $resArray) {
1402 foreach ($resArray as $butmenu) {
1403 $menus[$r++] = $butmenu;
1404 }
1405 }
1406 } elseif ($reshook == 1) {
1407 $r = 0; //replace buttons
1408 if (is_array($hookmanager->resArray)) {
1409 foreach ($hookmanager->resArray as $resArray) {
1410 foreach ($resArray as $butmenu) {
1411 $menus[$r++] = $butmenu;
1412 }
1413 }
1414 }
1415 }
1416}
1417
1418if ($r % 3 == 2) {
1419 $menus[$r++] = array('title'=>'', 'style'=>'visibility: hidden;');
1420}
1421
1422if (getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) {
1423 $menus[$r++] = array('title'=>'<span class="fa fa-sign-out-alt paddingrightonly"></span><div class="trunc">'.$langs->trans("Logout").'</div>', 'action'=>'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php?token='.newToken().'\';');
1424}
1425
1426if (getDolGlobalString('TAKEPOS_WEIGHING_SCALE')) {
1427 $menus[$r++] = array('title'=>'<span class="fa fa-balance-scale paddingrightonly"></span><div class="trunc">'.$langs->trans("WeighingScale").'</div>', 'action'=>'WeighingScale();');
1428}
1429
1430?>
1431 <!-- Show buttons -->
1432 <div class="div3">
1433 <?php
1434 $i = 0;
1435 foreach ($menus as $menu) {
1436 $i++;
1437 if (count($menus) > 12 and $i == 12) {
1438 echo '<button style="'.(empty($menu['style']) ? '' : $menu['style']).'" type="button" id="actionnext" class="actionbutton" onclick="MoreActions('.count($menus).')">'.$langs->trans("Next").'</button>';
1439 echo '<button style="display: none;" type="button" id="action'.$i.'" class="actionbutton" onclick="'.(empty($menu['action']) ? '' : $menu['action']).'">'.$menu['title'].'</button>';
1440 } elseif ($i > 12) {
1441 echo '<button style="display: none;" type="button" id="action'.$i.'" class="actionbutton" onclick="'.(empty($menu['action']) ? '' : $menu['action']).'">'.$menu['title'].'</button>';
1442 } else {
1443 echo '<button style="'.(empty($menu['style']) ? '' : $menu['style']).'" type="button" id="action'.$i.'" class="actionbutton" onclick="'.(empty($menu['action']) ? '' : $menu['action']).'">'.$menu['title'].'</button>';
1444 }
1445 }
1446
1447 if (getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR') && !getDolGlobalString('TAKEPOS_HIDE_SEARCH')) {
1448 print '<!-- Show the search input text -->'."\n";
1449 print '<div class="margintoponly">';
1450 print '<input type="text" id="search" class="input-nobottom" name="search" onkeyup="Search2(\''.dol_escape_js($keyCodeForEnter).'\', null);" style="width: 80%; width:calc(100% - 51px); font-size: 150%;" placeholder="'.dol_escape_htmltag($langs->trans("Search")).'" autofocus> ';
1451 print '<a class="marginleftonly hideonsmartphone" onclick="ClearSearch();">'.img_picto('', 'searchclear').'</a>';
1452 print '</div>';
1453 }
1454 ?>
1455 </div>
1456 </div>
1457
1458 <div class="row2<?php if (!getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) {
1459 print 'withhead';
1460 } ?>">
1461
1462 <!-- Show categories -->
1463 <?php
1464 if (getDolGlobalInt('TAKEPOS_HIDE_CATEGORIES') == 1) {
1465 print '<div class="div4" style= "display: none;">';
1466 } else {
1467 print '<div class="div4">';
1468 }
1469
1470 $count = 0;
1471 while ($count < $MAXCATEG) {
1472 ?>
1473 <div class="wrapper" <?php if ($count == ($MAXCATEG - 2)) {
1474 echo 'onclick="MoreCategories(\'less\')"';
1475 } elseif ($count == ($MAXCATEG - 1)) {
1476 echo 'onclick="MoreCategories(\'more\')"';
1477 } else {
1478 echo 'onclick="LoadProducts('.$count.')"';
1479 } ?> id="catdiv<?php echo $count; ?>">
1480 <?php
1481 if ($count == ($MAXCATEG - 2)) {
1482 //echo '<img class="imgwrapper" src="img/arrow-prev-top.png" height="100%" id="catimg'.$count.'" />';
1483 echo '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1484 } elseif ($count == ($MAXCATEG - 1)) {
1485 //echo '<img class="imgwrapper" src="img/arrow-next-top.png" height="100%" id="catimg'.$count.'" />';
1486 echo '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1487 } else {
1488 if (!getDolGlobalString('TAKEPOS_HIDE_CATEGORY_IMAGES')) {
1489 echo '<img class="imgwrapper" id="catimg'.$count.'" />';
1490 }
1491 } ?>
1492 <?php if ($count != $MAXCATEG - 2 && $count != $MAXCATEG - 1) { ?>
1493 <div class="description" id="catdivdesc<?php echo $count; ?>">
1494 <div class="description_content" id="catdesc<?php echo $count; ?>"></div>
1495 </div>
1496 <?php } ?>
1497 <div class="catwatermark" id='catwatermark<?php echo $count; ?>'>...</div>
1498 </div>
1499 <?php
1500 $count++;
1501 }
1502 ?>
1503 </div>
1504
1505 <!-- Show product -->
1506 <div class="div5<?php if (getDolGlobalInt('TAKEPOS_HIDE_CATEGORIES') == 1) {
1507 print ' centpercent';
1508 } ?>">
1509 <?php
1510 $count = 0;
1511 while ($count < $MAXPRODUCT) {
1512 print '<div class="wrapper2 arrow" id="prodiv'.$count.'" '; ?>
1513 <?php if ($count == ($MAXPRODUCT - 2)) {
1514 ?> onclick="MoreProducts('less')" <?php
1515 }
1516 if ($count == ($MAXPRODUCT - 1)) {
1517 ?> onclick="MoreProducts('more')" <?php
1518 } else {
1519 echo 'onclick="ClickProduct('.$count.')"';
1520 } ?>>
1521 <?php
1522 if ($count == ($MAXPRODUCT - 2)) {
1523 //echo '<img class="imgwrapper" src="img/arrow-prev-top.png" height="100%" id="proimg'.$count.'" />';
1524 print '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1525 } elseif ($count == ($MAXPRODUCT - 1)) {
1526 //echo '<img class="imgwrapper" src="img/arrow-next-top.png" height="100%" id="proimg'.$count.'" />';
1527 print '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1528 } else {
1529 if (!getDolGlobalString('TAKEPOS_HIDE_PRODUCT_PRICES')) {
1530 print '<div class="" id="proprice'.$count.'"></div>';
1531 }
1532 if (getDolGlobalString('TAKEPOS_HIDE_PRODUCT_IMAGES')) {
1533 print '<button type="button" id="probutton'.$count.'" class="productbutton" style="display: none;"></button>';
1534 } else {
1535 print '<img class="imgwrapper" title="" id="proimg'.$count.'">';
1536 }
1537 } ?>
1538 <?php if ($count != $MAXPRODUCT - 2 && $count != $MAXPRODUCT - 1 && !getDolGlobalString('TAKEPOS_HIDE_PRODUCT_IMAGES')) { ?>
1539 <div class="description" id="prodivdesc<?php echo $count; ?>">
1540 <div class="description_content" id="prodesc<?php echo $count; ?>"></div>
1541 </div>
1542 <?php } ?>
1543 <div class="catwatermark" id='prowatermark<?php echo $count; ?>'>...</div>
1544 </div>
1545 <?php
1546 $count++;
1547 }
1548 ?>
1549 <input type="hidden" id="search_start_less" value="0">
1550 <input type="hidden" id="search_start_more" value="0">
1551 <input type="hidden" id="search_pagination" value="">
1552 </div>
1553 </div>
1554</div>
1555</body>
1556<?php
1557
1558llxFooter();
1559
1560$db->close();
print $langs trans("AuditedSecurityEvents").'</strong >< span class="opacitymedium"></span >< br > status
Definition security.php:604
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage categories.
Class to manage contact/addresses.
Class to manage generation of HTML components Only common components must be here.
dol_get_first_hour($date, $gm='tzserver')
Return GMT time for first hour of a given GMT date (it removes hours, min and second part)
Definition date.lib.php:653
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.
dol_now($mode='auto')
Return date for now.
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.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
rtl background position
publicphonebutton2 phonegreen basiclayout basiclayout TotalHT VATCode TotalVAT TotalLT1 TotalLT2 TotalTTC TotalHT clearboth nowraponall right right takeposterminal SELECT e rowid
Definition invoice.php:1907
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
top_menu_user($hideloginname=0, $urllogout='')
Build the tooltip on user login.
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
Definition repair.php:121
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:124
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
Contact()
Old copy.
Definition index.php:572
Search2(keyCodeForEnter, moreorless)
Search products.
Definition index.php:657