31if (!defined(
'NOREQUIREMENU')) {
32 define(
'NOREQUIREMENU',
'1');
34if (!defined(
'NOREQUIREHTML')) {
35 define(
'NOREQUIREHTML',
'1');
37if (!defined(
'NOREQUIREAJAX')) {
38 define(
'NOREQUIREAJAX',
'1');
42require
'../main.inc.php';
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';
53$action =
GETPOST(
'action',
'aZ09');
54$setterminal =
GETPOST(
'setterminal',
'int');
55$setcurrency =
GETPOST(
'setcurrency',
'aZ09');
57$hookmanager->initHooks(array(
'takeposfrontend'));
58if (empty($_SESSION[
"takeposterminal"])) {
60 $_SESSION[
"takeposterminal"] = 1;
61 } elseif (!empty($_COOKIE[
"takeposterminal"])) {
62 $_SESSION[
"takeposterminal"] = preg_replace(
'/[^a-zA-Z0-9_\-]/',
'', $_COOKIE[
"takeposterminal"]);
66if ($setterminal > 0) {
67 $_SESSION[
"takeposterminal"] = $setterminal;
68 setcookie(
"takeposterminal", $setterminal, (time() + (86400 * 354)),
'/',
null, (empty($dolibarr_main_force_https) ?
false : true), true);
71if ($setcurrency !=
"") {
72 $_SESSION[
"takeposcustomercurrency"] = $setcurrency;
77$langs->loadLangs(array(
"bills",
"orders",
"commercial",
"cashdesk",
"receiptprinter",
"banks"));
81$maxcategbydefaultforthisdevice = 12;
82$maxproductbydefaultforthisdevice = 24;
83if ($conf->browser->layout ==
'phone') {
84 $maxcategbydefaultforthisdevice = 8;
85 $maxproductbydefaultforthisdevice = 16;
87 if ($_SESSION[
"takeposterminal"] !=
"" && $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1) {
88 $_SESSION[
"basiclayout"] = 1;
89 header(
"Location: phone.php?mobilepage=invoice");
93$MAXCATEG = (empty($conf->global->TAKEPOS_NB_MAXCATEG) ? $maxcategbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXCATEG);
94$MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT) ? $maxproductbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXPRODUCT);
112$form =
new Form($db);
116$arrayofjs = array(
'/takepos/js/jquery.colorbox-min.js');
117$arrayofcss = array(
'/takepos/css/pos.css.php',
'/takepos/css/colorbox.css');
120 $arrayofcss[] =
'/takepos/css/colorful.css';
125$title =
'TakePOS - Dolibarr '.DOL_VERSION;
126if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
127 $title =
'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
129$head =
'<meta name="apple-mobile-web-app-title" content="TakePOS"/>
130<meta name="apple-mobile-web-app-capable" content="yes">
131<meta name="mobile-web-app-capable" content="yes">
132<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
133top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
136$categories = $categorie->get_full_arbo(
'product', ((
getDolGlobalInt(
'TAKEPOS_ROOT_CATEGORY_ID') > 0) ?
getDolGlobalInt(
'TAKEPOS_ROOT_CATEGORY_ID') : 0), 1);
141$levelofrootcategory = 0;
143 foreach ($categories as $key => $categorycursor) {
144 if ($categorycursor[
'id'] ==
getDolGlobalInt(
'TAKEPOS_ROOT_CATEGORY_ID')) {
145 $levelofrootcategory = $categorycursor[
'level'];
151$levelofmaincategories = $levelofrootcategory + 1;
153$maincategories = array();
154$subcategories = array();
155foreach ($categories as $key => $categorycursor) {
156 if ($categorycursor[
'level'] == $levelofmaincategories) {
157 $maincategories[$key] = $categorycursor;
159 $subcategories[$key] = $categorycursor;
167<body
class=
"bodytakepos" style=
"overflow: hidden;">
170var categories = <?php echo json_encode($maincategories); ?>;
171var subcategories = <?php echo json_encode($subcategories); ?>;
177var place=
"<?php echo $place; ?>";
181var search2_timer=
null;
200function ClearSearch() {
201 console.log(
"ClearSearch");
202 $(
"#search").val(
'');
203 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
204 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
205 $(
"#reduction").html(
"<?php echo $langs->trans("ReductionShort
"); ?>").removeClass(
'clicked');
206 <?php
if ($conf->browser->layout ==
'classic') { ?>
207 setFocusOnSearchField();
212function setFocusOnSearchField() {
213 console.log(
"Call setFocusOnSearchField in page index.php");
214 <?php
if ($conf->browser->layout ==
'classic') { ?>
215 console.log(
"has keyboard from localStorage, so we can force focus on search field");
216 $(
"#search").focus();
220function PrintCategories(first) {
221 console.log(
"PrintCategories");
222 for (i = 0; i < <?php echo ($MAXCATEG - 2); ?>; i++) {
223 if (typeof (categories[parseInt(i)+parseInt(first)]) ==
"undefined")
225 $(
"#catdivdesc"+i).hide();
226 $(
"#catdesc"+i).text(
"");
227 $(
"#catimg"+i).attr(
"src",
"genimg/empty.png");
228 $(
"#catwatermark"+i).hide();
229 $(
"#catdiv"+i).attr(
'class',
'wrapper divempty');
232 $(
"#catdivdesc"+i).show();
235 $(
"#catdesc"+i).html(categories[parseInt(i)+parseInt(first)][
'label'].bold() +
' - ' + categories[parseInt(i)+parseInt(first)][
'description']);
237 $(
"#catdesc"+i).text(categories[parseInt(i)+parseInt(first)][
'label']);
239 $(
"#catimg"+i).attr(
"src",
"genimg/index.php?query=cat&id="+categories[parseInt(i)+parseInt(first)][
'rowid']);
240 $(
"#catdiv"+i).data(
"rowid",categories[parseInt(i)+parseInt(first)][
'rowid']);
241 $(
"#catdiv"+i).attr(
'class',
'wrapper');
242 $(
"#catwatermark"+i).show();
246function MoreCategories(moreorless) {
247 console.log(
"MoreCategories moreorless="+moreorless+
" pagecategories="+pagecategories);
248 if (moreorless ==
"more") {
249 $(
'#catimg15').animate({opacity:
'0.5'}, 1);
250 $(
'#catimg15').animate({opacity:
'1'}, 100);
251 pagecategories=pagecategories+1;
253 if (moreorless ==
"less") {
254 $(
'#catimg14').animate({opacity:
'0.5'}, 1);
255 $(
'#catimg14').animate({opacity:
'1'}, 100);
256 if (pagecategories==0)
return;
257 pagecategories=pagecategories-1;
259 if (typeof (categories[<?php echo ($MAXCATEG - 2); ?> * pagecategories] && moreorless ==
"more") ==
"undefined") {
260 pagecategories=pagecategories-1;
264 for (i = 0; i < <?php echo ($MAXCATEG - 2); ?>; i++) {
265 if (typeof (categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]) ==
"undefined") {
267 console.log(
"complete with empty record");
268 $(
"#catdivdesc"+i).hide();
269 $(
"#catdesc"+i).text(
"");
270 $(
"#catimg"+i).attr(
"src",
"genimg/empty.png");
271 $(
"#catwatermark"+i).hide();
274 $(
"#catdivdesc"+i).show();
277 $(
"#catdesc"+i).html(categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)][
'label'].bold() +
' - ' + categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)][
'description']);
279 $(
"#catdesc"+i).text(categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)][
'label']);
281 $(
"#catimg"+i).attr(
"src",
"genimg/index.php?query=cat&id="+categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)][
'rowid']);
282 $(
"#catdiv"+i).data(
"rowid",categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)][
'rowid']);
283 $(
"#catwatermark"+i).show();
290function LoadProducts(
position, issubcat) {
291 console.log(
"LoadProducts");
292 var maxproduct = <?php echo ($MAXPRODUCT - 2); ?>;
294 if (
position==
"supplements") currentcat=
"supplements";
297 $(
'#catimg'+
position).animate({opacity:
'0.5'}, 1);
298 $(
'#catimg'+
position).animate({opacity:
'1'}, 100);
299 if (issubcat==
true) currentcat=$(
'#prodiv'+
position).data(
'rowid');
300 else currentcat=$(
'#catdiv'+
position).data(
'rowid');
302 if (currentcat == undefined)
return;
306 jQuery.each(subcategories,
function(i, val) {
307 if (currentcat==val.fk_parent) {
308 $(
"#prodivdesc"+ishow).show();
309 <?php if (getDolGlobalString(
'TAKEPOS_SHOW_CATEGORY_DESCRIPTION') == 1) { ?>
310 $(
"#prodesc"+ishow).html(val.label.bold() +
' - ' + val.description);
311 $(
"#probutton"+ishow).html(val.label);
313 $(
"#prodesc"+ishow).text(val.label);
314 $(
"#probutton"+ishow).text(val.label);
316 $(
"#probutton"+ishow).show();
317 $(
"#proprice"+ishow).attr(
"class",
"hidden");
318 $(
"#proprice"+ishow).html(
"");
319 $(
"#proimg"+ishow).attr(
"src",
"genimg/index.php?query=cat&id="+val.rowid);
320 $(
"#prodiv"+ishow).data(
"rowid",val.rowid);
321 $(
"#prodiv"+ishow).data(
"iscat",1);
322 $(
"#prowatermark"+ishow).show();
329 if (maxproduct >= 1) {
330 limit = maxproduct-1;
333 $.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) {
334 console.log(
"Call ajax.php (in LoadProducts) to get Products of category "+currentcat+
" then loop on result to fill image thumbs");
336 while (ishow < maxproduct) {
338 console.log(data[idata]);
339 if (typeof (data[idata]) ==
"undefined") {
341 echo
'$("#prodivdesc"+ishow).hide();';
342 echo
'$("#prodesc"+ishow).text("");';
343 echo
'$("#proimg"+ishow).attr("title","");';
344 echo
'$("#proimg"+ishow).attr("src","genimg/empty.png");';
346 echo
'$("#probutton"+ishow).hide();';
347 echo
'$("#probutton"+ishow).text("");';
349 $(
"#proprice"+ishow).attr(
"class",
"hidden");
350 $(
"#proprice"+ishow).html(
"");
351 $(
"#prodiv"+ishow).data(
"rowid",
"");
352 $(
"#prodiv"+ishow).attr(
"class",
"wrapper2 divempty");
355 $titlestring =
"'".dol_escape_js($langs->transnoentities(
'Ref').
': ').
"' + data[idata]['ref']";
356 $titlestring .=
" + ' - ".dol_escape_js($langs->trans(
"Barcode").
': ').
"' + data[idata]['barcode']";
358 var titlestring = <?php echo $titlestring; ?>;
360 echo
'$("#prodivdesc"+ishow).show();';
362 echo
'$("#prodesc"+ishow).html(data[parseInt(idata)][\'ref\'].bold() + \' - \' + data[parseInt(idata)][\'label\']);';
364 echo
'$("#prodesc"+ishow).html(data[parseInt(idata)][\'label\']);';
366 echo
'$("#proimg"+ishow).attr("title", titlestring);';
367 echo
'$("#proimg"+ishow).attr("src", "genimg/index.php?query=pro&id="+data[idata][\'id\']);';
369 echo
'$("#probutton"+ishow).show();';
370 echo
'$("#probutton"+ishow).html(data[parseInt(idata)][\'label\']);';
373 if (data[parseInt(idata)][
'price_formated']) {
374 $(
"#proprice" + ishow).attr(
"class",
"productprice");
378 $(
"#proprice" + ishow).html(data[parseInt(idata)][
'price_formated']);
382 $(
"#proprice" + ishow).html(data[parseInt(idata)][
'price_ttc_formated']);
387 console.log(
"#prodiv"+ishow+
".data(rowid)="+data[idata][
'id']);
388 console.log($(
"#prodiv"+ishow));
390 $(
"#prodiv"+ishow).data(
"rowid", data[idata][
'id']);
391 console.log($(
'#prodiv4').data(
'rowid'));
392 $(
"#prodiv"+ishow).data(
"iscat", 0);
393 $(
"#prodiv"+ishow).attr(
"class",
"wrapper2");
398 $parameters[
'caller'] =
'loadProducts';
399 $hookmanager->executeHooks(
'completeJSProductDisplay', $parameters);
400 print $hookmanager->resPrint;
403 $(
"#prowatermark"+ishow).hide();
412function MoreProducts(moreorless) {
413 console.log(
"MoreProducts");
415 if ($(
'#search_pagination').val() !=
'') {
416 return Search2(
'<?php echo (isset($keyCodeForEnter) ? $keyCodeForEnter : ''); ?>', moreorless);
419 var maxproduct = <?php echo ($MAXPRODUCT - 2); ?>;
421 if (moreorless==
"more"){
422 $(
'#proimg31').animate({opacity:
'0.5'}, 1);
423 $(
'#proimg31').animate({opacity:
'1'}, 100);
424 pageproducts=pageproducts+1;
426 if (moreorless==
"less"){
427 $(
'#proimg30').animate({opacity:
'0.5'}, 1);
428 $(
'#proimg30').animate({opacity:
'1'}, 100);
429 if (pageproducts==0)
return;
430 pageproducts=pageproducts-1;
436 if (maxproduct >= 1) {
437 limit = maxproduct-1;
439 var offset = <?php echo ($MAXPRODUCT - 2); ?> * pageproducts;
441 $.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) {
442 console.log(
"Call ajax.php (in MoreProducts) to get Products of category "+currentcat);
444 if (typeof (data[0]) ==
"undefined" && moreorless==
"more"){
445 pageproducts=pageproducts-1;
449 while (ishow < maxproduct) {
450 if (typeof (data[idata]) ==
"undefined") {
451 $(
"#prodivdesc"+ishow).hide();
452 $(
"#prodesc"+ishow).text(
"");
453 $(
"#probutton"+ishow).text(
"");
454 $(
"#probutton"+ishow).hide();
455 $(
"#proprice"+ishow).attr(
"class",
"");
456 $(
"#proprice"+ishow).html(
"");
457 $(
"#proimg"+ishow).attr(
"src",
"genimg/empty.png");
458 $(
"#prodiv"+ishow).data(
"rowid",
"");
460 $(
"#prodivdesc"+ishow).show();
463 $(
"#prodesc"+ishow).html(data[parseInt(idata)][
'ref'].bold() +
' - ' + data[parseInt(idata)][
'label']);
465 $(
"#prodesc"+ishow).html(data[parseInt(idata)][
'label']);
467 $(
"#probutton"+ishow).html(data[parseInt(idata)][
'label']);
468 $(
"#probutton"+ishow).show();
469 if (data[parseInt(idata)][
'price_formated']) {
470 $(
"#proprice" + ishow).attr(
"class",
"productprice");
474 $(
"#proprice" + ishow).html(data[parseInt(idata)][
'price_formated']);
478 $(
"#proprice" + ishow).html(data[parseInt(idata)][
'price_ttc_formated']);
483 $(
"#proimg"+ishow).attr(
"src",
"genimg/index.php?query=pro&id="+data[idata][
'id']);
484 $(
"#prodiv"+ishow).data(
"rowid",data[idata][
'id']);
485 $(
"#prodiv"+ishow).data(
"iscat",0);
487 $(
"#prowatermark"+ishow).hide();
496function ClickProduct(
position, qty = 1) {
497 console.log(
"ClickProduct at position"+
position);
498 $(
'#proimg'+
position).animate({opacity:
'0.5'}, 1);
499 $(
'#proimg'+
position).animate({opacity:
'1'}, 100);
500 if ($(
'#prodiv'+
position).data(
'iscat')==1){
501 console.log(
"Click on a category at position "+
position);
505 console.log($(
'#prodiv4').data(
'rowid'));
506 invoiceid = $(
"#invoiceid").val();
507 idproduct=$(
'#prodiv'+
position).data(
'rowid');
508 console.log(
"Click on product at position "+
position+
" for idproduct "+idproduct+
", qty="+qty);
509 if (idproduct==
"")
return;
511 $(
"#poslines").load(
"invoice.php?action=addline&token=<?php echo newToken() ?>&place="+place+
"&idproduct="+idproduct+
"&selectedline="+selectedline+
"&qty="+qty+
"&invoiceid="+invoiceid,
function() {
512 <?php
if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) echo
"CustomerDisplay();";?>
519function ChangeThirdparty(idcustomer) {
520 console.log(
"ChangeThirdparty");
522 $(
"#poslines").load(
"../societe/list.php?action=change&token=<?php echo newToken();?>&type=t&contextpage=poslist&idcustomer="+idcustomer+
"&place="+place+
"",
function() {
528function deleteline() {
529 console.log(
"Delete line");
530 invoiceid = $(
"#invoiceid").val();
531 $(
"#poslines").load(
"invoice.php?action=deleteline&token=<?php echo newToken(); ?>&place="+place+
"&idline="+selectedline+
"&invoiceid="+invoiceid,
function() {
538 console.log(
"Open box to select the thirdparty place="+place);
539 $.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
"); ?>"});
544 console.log(
"Open box to select the history");
545 $.colorbox({href:
"../compta/facture/list.php?contextpage=poslist", width:
"90%", height:
"80%", transition:
"none", iframe:
"true", title:
"<?php echo $langs->trans("History
"); ?>"});
548function Reduction() {
549 invoiceid = $(
"#invoiceid").val();
550 console.log(
"Open popup to enter reduction on invoiceid="+invoiceid);
551 $.colorbox({href:
"reduction.php?place="+place+
"&invoiceid="+invoiceid, width:
"80%", height:
"90%", transition:
"none", iframe:
"true", title:
""});
554function CloseBill() {
555 invoiceid = $(
"#invoiceid").val();
556 console.log(
"Open popup to enter payment on invoiceid="+invoiceid);
557 $.colorbox({href:
"pay.php?place="+place+
"&invoiceid="+invoiceid, width:
"80%", height:
"90%", transition:
"none", iframe:
"true", title:
""});
561 invoiceid = $(
"#invoiceid").val();
562 console.log(
"Open popup to split on invoiceid="+invoiceid);
563 $.colorbox({href:
"split.php?place="+place+
"&invoiceid="+invoiceid, width:
"80%", height:
"90%", transition:
"none", iframe:
"true", title:
""});
567 console.log(
"Open box to select floor place="+place);
568 $.colorbox({href:
"floors.php?place="+place, width:
"90%", height:
"90%", transition:
"none", iframe:
"true", title:
"<?php echo $langs->trans("Floors
"); ?>"});
572 console.log(
"Open box to enter a free product");
573 $.colorbox({href:
"freezone.php?action=freezone&token=<?php echo newToken(); ?>&place="+place, width:
"80%", height:
"200px", transition:
"none", iframe:
"true", title:
"<?php echo $langs->trans("FreeZone
"); ?>"});
576function TakeposOrderNotes() {
577 console.log(
"Open box to order notes");
578 ModalBox(
'ModalNote');
579 $(
"#textinput").focus();
583 console.log(
"Refresh by reloading place="+place+
" invoiceid="+invoiceid);
584 $(
"#poslines").load(
"invoice.php?place="+place+
"&invoiceid="+invoiceid,
function() {
591 invoiceid = $(
"#invoiceid").val();
593 console.log(
"New with place = <?php echo $place; ?>, js place="+place+
", invoiceid="+invoiceid);
595 $.getJSON(
'<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getInvoice&token=<?php echo newToken();?>&id='+invoiceid,
function(data) {
598 if (parseInt(data[
'paye']) === 1) {
601 r = confirm(
'<?php echo ($place > 0 ? $langs->transnoentitiesnoconv("ConfirmDeletionOfThisPOSSale") : $langs->transnoentitiesnoconv("ConfirmDiscardOfThisPOSSale")); ?>');
606 $(
"#poslines").load(
"invoice.php?action=delete&token=<?php echo newToken(); ?>&place=" + place,
function () {
621function Search2(keyCodeForEnter, moreorless) {
622 var eventKeyCode = window.event.keyCode;
624 console.log(
"Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter+
", eventKeyCode="+eventKeyCode);
626 var search_term = $(
'#search').val();
627 var search_start = 0;
628 var search_limit = <?php echo $MAXPRODUCT - 2; ?>;
629 if (moreorless !=
null) {
630 search_term = $(
'#search_pagination').val();
631 search_start = $(
'#search_start_'+moreorless).val();
634 console.log(
"search_term="+search_term);
636 if (search_term ==
'') {
637 $(
"[id^=prowatermark]").html(
"");
638 $(
"[id^=prodesc]").text(
"");
639 $(
"[id^=probutton]").text(
"");
640 $(
"[id^=probutton]").hide();
641 $(
"[id^=proprice]").attr(
"class",
"hidden");
642 $(
"[id^=proprice]").html(
"");
643 $(
"[id^=proimg]").attr(
"src",
"genimg/empty.png");
644 $(
"[id^=prodiv]").data(
"rowid",
"");
649 if (keyCodeForEnter ==
'' || eventKeyCode == keyCodeForEnter) {
653 if (search ===
true) {
657 clearTimeout(search2_timer);
661 search2_timer = setTimeout(
function(){
663 jQuery(
".wrapper2 .catwatermark").hide();
664 var nbsearchresults = 0;
665 $.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) {
666 for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
667 if (typeof (data[i]) ==
"undefined") {
668 $(
"#prowatermark" + i).html(
"");
669 $(
"#prodesc" + i).text(
"");
670 $(
"#probutton" + i).text(
"");
671 $(
"#probutton" + i).hide();
672 $(
"#proprice" + i).attr(
"class",
"hidden");
673 $(
"#proprice" + i).html(
"");
674 $(
"#proimg" + i).attr(
"src",
"genimg/empty.png");
675 $(
"#prodiv" + i).data(
"rowid",
"");
679 $titlestring =
"'".dol_escape_js($langs->transnoentities(
'Ref').
': ').
"' + data[i]['ref']";
680 $titlestring .=
" + ' - ".dol_escape_js($langs->trans(
"Barcode").
': ').
"' + data[i]['barcode']";
682 var titlestring = <?php echo $titlestring; ?>;
685 $(
"#prodesc" + i).html(data[i][
'ref'].bold() +
' - ' + data[i][
'label']);
687 $(
"#prodesc" + i).html(data[i][
'label']);
689 $(
"#prodivdesc" + i).show();
690 $(
"#probutton" + i).html(data[i][
'label']);
691 $(
"#probutton" + i).show();
692 if (data[i][
'price_formated']) {
693 $(
"#proprice" + i).attr(
"class",
"productprice");
697 $(
"#proprice" + i).html(data[i][
'price_formated']);
701 $(
"#proprice" + i).html(data[i][
'price_ttc_formated']);
706 $(
"#proimg" + i).attr(
"title", titlestring);
707 if( undefined !== data[i][
'img']) {
708 $(
"#proimg" + i).attr(
"src", data[i][
'img']);
711 $(
"#proimg" + i).attr(
"src",
"genimg/index.php?query=pro&id=" + data[i][
'rowid']);
713 $(
"#prodiv" + i).data(
"rowid", data[i][
'rowid']);
714 $(
"#prodiv" + i).data(
"iscat", 0);
719 $parameters[
'caller'] =
'search2';
720 $hookmanager->executeHooks(
'completeJSProductDisplay', $parameters);
721 print $hookmanager->resPrint;
726 }).always(
function (data) {
728 if ($(
'#search').val().length > 0 && data.length == 1) {
729 console.log($(
'#search').val()+
' - '+data[0][
'barcode']);
730 if ($(
'#search').val() == data[0][
'barcode'] &&
'thirdparty' == data[0][
'object']) {
731 console.log(
"There is only 1 answer with barcode matching the search, so we change the thirdparty "+data[0][
'rowid']);
732 ChangeThirdparty(data[0][
'rowid']);
734 else if (
'product' == data[0][
'object'] && $(
'#search').val() == data[0][
'barcode']) {
735 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']);
736 ClickProduct(0, data[0][
'qty']);
739 if (eventKeyCode == keyCodeForEnter){
740 if (data.length == 0) {
741 $(
'#search').val(
'<?php
742 $langs->load('errors
');
743 echo dol_escape_js($langs->transnoentitiesnoconv("ErrorRecordNotFoundShort"));
744 ?> ('+search_term+
')');
745 $(
'#search').select();
750 $(
"#search_pagination").val($(
"#search").val());
751 if (search_start == 0) {
752 $(
"#prodiv<?php echo $MAXPRODUCT - 2; ?> span").hide();
755 $(
"#prodiv<?php echo $MAXPRODUCT - 2; ?> span").show();
756 var search_start_less = Math.max(0, parseInt(search_start) - parseInt(<?php echo $MAXPRODUCT - 2;?>));
757 $(
"#search_start_less").val(search_start_less);
759 if (nbsearchresults != <?php echo $MAXPRODUCT - 2; ?>) {
760 $(
"#prodiv<?php echo $MAXPRODUCT - 1; ?> span").hide();
763 $(
"#prodiv<?php echo $MAXPRODUCT - 1; ?> span").show();
764 var search_start_more = parseInt(search_start) + parseInt(<?php echo $MAXPRODUCT - 2;?>);
765 $(
"#search_start_more").val(search_start_more);
774function Edit(number) {
775 console.log(
"We click on PAD on key="+number);
777 if (typeof(selectedtext) ==
"undefined") {
781 var text=selectedtext+
"<br> ";
787 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
788 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
789 $(
"#reduction").html(
"<?php echo $langs->trans("ReductionShort
"); ?>").removeClass(
'clicked');
791 }
else if (number==
'qty') {
792 if (editaction==
'qty' && editnumber !=
'') {
793 $(
"#poslines").load(
"invoice.php?action=updateqty&token=<?php echo newToken(); ?>&place="+place+
"&idline="+selectedline+
"&number="+editnumber,
function() {
796 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
799 setFocusOnSearchField();
805 }
else if (number==
'p') {
806 if (editaction==
'p' && editnumber!=
"") {
807 $(
"#poslines").load(
"invoice.php?action=updateprice&token=<?php echo newToken(); ?>&place="+place+
"&idline="+selectedline+
"&number="+editnumber,
function() {
810 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
819 }
else if (number==
'r') {
820 if (editaction==
'r' && editnumber!=
"") {
821 $(
"#poslines").load(
"invoice.php?action=updatereduction&token=<?php echo newToken(); ?>&place="+place+
"&idline="+selectedline+
"&number="+editnumber,
function() {
824 $(
"#reduction").html(
"<?php echo $langs->trans("ReductionShort
"); ?>").removeClass(
'clicked');
835 editnumber=editnumber+number;
837 if (editaction==
'qty'){
838 text=text+
"<?php echo $langs->trans("Modify
")." ->
".$langs->trans("Qty
").":
"; ?>";
839 $(
"#qty").html(
"OK").addClass(
"clicked");
840 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
841 $(
"#reduction").html(
"<?php echo $langs->trans("ReductionShort
"); ?>").removeClass(
'clicked');
843 if (editaction==
'p'){
844 text=text+
"<?php echo $langs->trans("Modify
")." ->
".$langs->trans("Price
").":
"; ?>";
845 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
846 $(
"#price").html(
"OK").addClass(
"clicked");
847 $(
"#reduction").html(
"<?php echo $langs->trans("ReductionShort
"); ?>").removeClass(
'clicked');
849 if (editaction==
'r'){
850 text=text+
"<?php echo $langs->trans("Modify
")." ->
".$langs->trans("ReductionShort
").":
"; ?>";
851 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
852 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
853 $(
"#reduction").html(
"OK").addClass(
"clicked");
855 $(
'#'+selectedline).find(
"td:first").html(text+editnumber);
859function TakeposPrintingOrder(){
860 console.log(
"TakeposPrintingOrder");
861 $(
"#poslines").load(
"invoice.php?action=order&token=<?php echo newToken();?>&place="+place,
function() {
866function TakeposPrintingTemp(){
867 console.log(
"TakeposPrintingTemp");
868 $(
"#poslines").load(
"invoice.php?action=temp&token=<?php echo newToken();?>&place="+place,
function() {
873function OpenDrawer(){
874 console.log(
"OpenDrawer call ajax url http://<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER'); ?>:8111/print");
877 data: { token:
'notrequired' },
879 if (
getDolGlobalString(
'TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) ==
true) {
880 echo
"url: '".getDolGlobalString(
'TAKEPOS_PRINT_SERVER',
'localhost').
"/printer/drawer.php',";
882 echo
"url: 'http://".getDolGlobalString(
'TAKEPOS_PRINT_SERVER',
'localhost').
":8111/print',";
889function DolibarrOpenDrawer() {
890 console.log(
"DolibarrOpenDrawer call ajax url /takepos/ajax/ajax.php?action=opendrawer&token=<?php echo newToken();?>&term=<?php print urlencode($_SESSION["takeposterminal
"]); ?>");
893 data: { token:
'<?php echo currentToken(); ?>' },
894 url:
"<?php print DOL_URL_ROOT.'/takepos/ajax/ajax.php?action=opendrawer&token='.newToken().'&term='.urlencode($_SESSION["takeposterminal
"]); ?>",
898function MoreActions(totalactions){
901 for (i = 0; i <= totalactions; i++){
902 if (i<12) $(
"#action"+i).hide();
903 else $(
"#action"+i).show();
906 else if (pageactions==1){
908 for (i = 0; i <= totalactions; i++){
909 if (i<12) $(
"#action"+i).show();
910 else $(
"#action"+i).hide();
917function ControlCashOpening()
919 $.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
"); ?>"});
922function CloseCashFence(
rowid)
924 $.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
"); ?>"});
927function CashReport(
rowid)
929 $.colorbox({href:
"../compta/cashcontrol/report.php?id="+
rowid+
"&contextpage=takepos", width:
"60%", height:
"90%", transition:
"none", iframe:
"true", title:
"<?php echo $langs->trans("CashReport
"); ?>"});
933function ModalBox(ModalID)
935 var modal = document.getElementById(ModalID);
936 modal.style.display =
"block";
939function DirectPayment(){
940 console.log(
"DirectPayment");
941 $(
"#poslines").load(
"invoice.php?place="+place+
"&action=valid&token=<?php echo newToken(); ?>&pay=LIQ",
function() {
945function FullScreen() {
946 document.documentElement.requestFullscreen();
949function WeighingScale(){
950 console.log(
"Weighing Scale");
953 data: { token:
'notrequired' },
954 url:
'<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER
'); ?>/scale/index.php',
956 .done(
function( editnumber ) {
957 $(
"#poslines").load(
"invoice.php?&token=<?php echo newToken(); ?>&place="+place+
"&idline="+selectedline+
"&number="+editnumber,
function() {
963$( document ).ready(
function() {
969 if ($_SESSION[
"takeposterminal"] ==
"") {
970 print
"ModalBox('ModalTerminal');";
974 $sql =
"SELECT rowid, status FROM ".MAIN_DB_PREFIX.
"pos_cash_fence WHERE";
975 $sql .=
" entity = ".((int) $conf->entity).
" AND ";
976 $sql .=
" posnumber = ".((int) $_SESSION[
"takeposterminal"]).
" AND ";
978 $resql = $db->query($sql);
980 $obj = $db->fetch_object($resql);
982 if (!isset($obj->rowid) || is_null($obj->rowid)) {
983 print
"ControlCashOpening();";
990 var elem1 = $(
"#topnav-left")[0];
991 var elem2 = $(
"#topnav-right")[0];
992 var checkOverflow =
function() {
993 if (scrollBars().horizontal) $(
"#topnav").addClass(
"overflow");
994 else $(
"#topnav").removeClass(
"overflow");
997 var scrollBars =
function(){
998 var container= $(
'#topnav')[0];
1000 vertical:container.scrollHeight > container.clientHeight,
1001 horizontal:container.scrollWidth > container.clientWidth
1005 $(window).resize(
function(){
1009 let resizeObserver =
new ResizeObserver(() => {
1012 resizeObserver.observe(elem1);
1013 resizeObserver.observe(elem2);
1016 var pressTimer = [];
1020 $(
".indicator").mousedown(
function(){
1021 direction = $(
this).hasClass(
"left") ? -1 : 1;
1023 pressTimer.push(setInterval(scrollTo, 100));
1026 $(
".indicator").mouseup(
function(){
1027 pressTimer.forEach(clearInterval);
1030 $(
"body").mouseup(
function(){
1031 pressTimer.forEach(clearInterval);
1032 console.log(
"body");
1035 function scrollTo(){
1036 console.log(
"here");
1037 var pos = $(
"#topnav").scrollLeft();
1038 document.getElementById(
"topnav").scrollTo({ left: $(
"#topnav").scrollLeft() + direction * step, behavior:
'smooth' })
1041 $(
"#topnav").scroll(
function(){
1042 if (($(
"#topnav").offsetWidth + $(
"#topnav").scrollLeft >= $(
"#topnav").scrollWidth)) {
1051$keyCodeForEnter =
getDolGlobalInt(
'CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION[
'takeposterminal']) > 0 ?
getDolGlobalInt(
'CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION[
'takeposterminal']) :
'';
1053<div
class=
"container">
1056if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
1058 <div
class=
"header">
1059 <div
id=
"topnav" class=
"topnav">
1060 <div
id=
"topnav-left" class=
"topnav-left">
1061 <div
class=
"inline-block valignmiddle">
1062 <a
class=
"topnav-terminalhour" onclick=
"ModalBox('ModalTerminal')">
1063 <span
class=
"fa fa-cash-register"></span>
1064 <span
class=
"hideonsmartphone">
1065 <?php echo
getDolGlobalString(
"TAKEPOS_TERMINAL_NAME_".$_SESSION[
"takeposterminal"], $langs->trans(
"TerminalName", $_SESSION[
"takeposterminal"])); ?>
1068 echo
'<span class="hideonsmartphone"> - '.dol_print_date(
dol_now(),
"day").
'</span>';
1072 if (isModEnabled(
'multicurrency')) {
1073 print
'<a class="valignmiddle tdoverflowmax100" id="multicurrency" onclick="ModalBox(\'ModalCurrency\')" title=""><span class="fas fa-coins paddingrightonly"></span>';
1074 print
'<span class="hideonsmartphone">'.$langs->trans(
"Currency").
'</span>';
1079 <!-- section
for customer -->
1080 <div
class=
"inline-block valignmiddle" id=
"customerandsales"></div>
1081 <!-- section
for shopping carts -->
1082 <div
class=
"inline-block valignmiddle" id=
"shoppingcart"></div>
1083 <!-- More info about customer -->
1084 <div
class=
"inline-block valignmiddle tdoverflowmax150onsmartphone" id=
"moreinfo"></div>
1086 if (isModEnabled(
'stock')) {
1088 <!-- More info about warehouse -->
1089 <div
class=
"inline-block valignmiddle tdoverflowmax150onsmartphone" id=
"infowarehouse"></div>
1094 <div
id=
"topnav-right" class=
"topnav-right">
1096 $reshook = $hookmanager->executeHooks(
'takepos_login_block_other');
1097 if ($reshook == 0) {
1098 <div
class=
"login_block_other">
1099 <input
type=
"text" id=
"search" name=
"search" class=
"input-search-takepos" onkeyup=
"Search2('<?php echo dol_escape_js($keyCodeForEnter); ?>', null);" placeholder=
"<?php echo dol_escape_htmltag($langs->trans("Search
")); ?>" autofocus>
1100 <a onclick=
"ClearSearch();"><span
class=
"fa fa-backspace"></span></a>
1101 <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 -->
1102 <span
class=
"fas fa-home"></span></a>
1103 <?php
if (empty($conf->dol_use_jmobile)) {?>
1104 <a
class=
"hideonsmartphone" onclick=
"FullScreen();" title=
"<?php echo dol_escape_htmltag($langs->trans("ClickFullScreenEscapeToLeave
")); ?>"><span
class=
"fa fa-expand-arrows-alt"></span></a>
1109 <div
class=
"login_block_user">
1111 print
top_menu_user(1, DOL_URL_ROOT.
'/user/logout.php?token='.newtoken().
'&urlfrom='.urlencode(
'/takepos/?setterminal='.((
int) $term)));
1115 <div
class=
"arrows">
1116 <span
class=
"indicator left"><i
class=
"fa fa-arrow-left"></i></span>
1117 <span
class=
"indicator right"><i
class=
"fa fa-arrow-right"></i></span>
1125<!-- Modal terminal box -->
1126<div
id=
"ModalTerminal" class=
"modal">
1127 <div
class=
"modal-content">
1128 <div
class=
"modal-header">
1130 if (empty($conf->global->TAKEPOS_FORCE_TERMINAL_SELECT)) {
1132 <span
class=
"close" href=
"#" onclick=
"document.getElementById('ModalTerminal').style.display = 'none';">×</span>
1134 <h3><?php print $langs->trans(
"TerminalSelect"); ?></h3>
1136 <div
class=
"modal-body">
1137 <
button type=
"button" class=
"block" onclick=
"location.href='index.php?setterminal=1'"><?php print
getDolGlobalString(
"TAKEPOS_TERMINAL_NAME_1", $langs->trans(
"TerminalName", 1)); ?></
button>
1140 for ($i = 2; $i <= $nbloop; $i++) {
1141 print
'<button type="button" class="block" onclick="location.href=\'index.php?setterminal='.$i.
'\'">'.getDolGlobalString("TAKEPOS_TERMINAL_NAME_
".$i, $langs->trans("TerminalName
", $i)).'</button>';
1148<!-- Modal multicurrency box -->
1149<?php if (isModEnabled('multicurrency')) { ?>
1150<div id="ModalCurrency
" class="modal
">
1151 <div class="modal-content
">
1152 <div class="modal-header
">
1153 <span class="close
" href="#
" onclick="document.getElementById(
'ModalCurrency').style.display =
'none';
">×</span>
1154 <h3><?php print $langs->trans("SetMultiCurrencyCode
"); ?></h3>
1156 <div class="modal-body
">
1158 $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency';
1159 $sql .= " WHERE entity IN (
'".getEntity('multicurrency
')."')
";
1160 $resql = $db->query($sql);
1162 while ($obj = $db->fetch_object($resql)) {
1163 print '<button type="button" class="block
" onclick="location.href=\
'index.php?setcurrency='.$obj->code.
'\'">'.$obj->code.'</button>';
1172<!-- Modal terminal Credit Note -->
1173<div id="ModalCreditNote
" class="modal
">
1174 <div class="modal-content
">
1175 <div class="modal-header
">
1176 <span class="close
" href="#
" onclick="document.getElementById(
'ModalCreditNote').style.display =
'none';
">×</span>
1177 <h3><?php print $langs->trans("invoiceAvoirWithLines
"); ?></h3>
1179 <div class="modal-body
">
1180 <button type="button" class="block
" onclick="CreditNote(); document.getElementById(
'ModalCreditNote').style.display =
'none';
"><?php print $langs->trans("Yes
"); ?></button>
1181 <button type="button" class="block
" onclick="document.getElementById(
'ModalCreditNote').style.display =
'none';
"><?php print $langs->trans("No
"); ?></button>
1187<div id="ModalNote
" class="modal
">
1188 <div class="modal-content
">
1189 <div class="modal-header
">
1190 <span class="close
" href="#
" onclick="document.getElementById(
'ModalNote').style.display =
'none';
">×</span>
1191 <h3><?php print $langs->trans("Note
"); ?></h3>
1193 <div class="modal-body
">
1194 <input type="text
" class="block
" id="textinput
">
1195 <button type="button" class="block
" onclick="SetNote(); document.getElementById(
'ModalNote').style.display =
'none';
">OK</button>
1200 <div class="row1<?php
if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
1204 <div id="poslines
" class="div1
">
1208 <button type="button" class="calcbutton
" onclick="Edit(7);
">7</button>
1209 <button type="button" class="calcbutton
" onclick="Edit(8);
">8</button>
1210 <button type="button" class="calcbutton
" onclick="Edit(9);
">9</button>
1211 <button type="button" id="qty
" class="calcbutton2
" onclick="Edit(
'qty')
"><?php echo $langs->trans("Qty
"); ?></button>
1212 <button type="button" class="calcbutton
" onclick="Edit(4);
">4</button>
1213 <button type="button" class="calcbutton
" onclick="Edit(5);
">5</button>
1214 <button type="button" class="calcbutton
" onclick="Edit(6);
">6</button>
1215 <button type="button" id="price" class="calcbutton2
" onclick="Edit(
'p')
"><?php echo $langs->trans("Price
"); ?></button>
1216 <button type="button" class="calcbutton
" onclick="Edit(1);
">1</button>
1217 <button type="button" class="calcbutton
" onclick="Edit(2);
">2</button>
1218 <button type="button" class="calcbutton
" onclick="Edit(3);
">3</button>
1219 <button type="button" id="reduction
" class="calcbutton2
" onclick="Edit(
'r')
"><?php echo $langs->trans("ReductionShort
"); ?></button>
1220 <button type="button" class="calcbutton
" onclick="Edit(0);
">0</button>
1221 <button type="button" class="calcbutton
" onclick="Edit(
'.')
">.</button>
1222 <button type="button" class="calcbutton poscolorblue
" onclick="Edit(
'c')
">C</button>
1223 <button type="button" class="calcbutton2 poscolordelete
" id="delete" onclick="deleteline()
"><span class="fa fa-trash
"></span></button>
1228// TakePOS setup check
1229if (isset($_SESSION["takeposterminal
"]) && $_SESSION["takeposterminal
"]) {
1230 $sql = "SELECT code, libelle FROM
" . MAIN_DB_PREFIX . "c_paiement
";
1231 $sql .= " WHERE entity IN (
" . getEntity('c_paiement') . ")
";
1232 $sql .= " AND active = 1
";
1233 $sql .= " ORDER BY libelle
";
1235 $resql = $db->query($sql);
1236 $paiementsModes = array();
1238 while ( $obj = $db->fetch_object($resql) ) {
1239 $paycode = $obj->code;
1240 if ($paycode == 'LIQ') {
1243 if ($paycode == 'CHQ') {
1244 $paycode = 'CHEQUE';
1247 $constantforkey = "CASHDESK_ID_BANKACCOUNT_
" . $paycode . $_SESSION["takeposterminal
"];
1248 //var_dump($constantforkey.' '.$conf->global->$constantforkey);
1249 if ( !empty($conf->global->$constantforkey) && $conf->global->$constantforkey > 0) {
1250 array_push($paiementsModes, $obj);
1255 if (empty($paiementsModes) && isModEnabled("banque
")) {
1256 $langs->load('errors');
1257 setEventMessages($langs->trans("ErrorModuleSetupNotComplete
", $langs->transnoentitiesnoconv("TakePOS
")), null, 'errors');
1258 setEventMessages($langs->trans("ProblemIsInSetupOfTerminal
", $_SESSION["takeposterminal
"]), null, 'errors');
1262if (count($maincategories) == 0) {
1263 if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) {
1264 $tmpcategory = new Categorie($db);
1265 $tmpcategory->fetch($conf->global->TAKEPOS_ROOT_CATEGORY_ID);
1266 setEventMessages($langs->trans("TakeposNeedsAtLeastOnSubCategoryIntoParentCategory
", $tmpcategory->label), null, 'errors');
1268 setEventMessages($langs->trans("TakeposNeedsCategories
"), null, 'errors');
1271// User menu and external TakePOS modules
1275if (empty($conf->global->TAKEPOS_BAR_RESTAURANT)) {
1276 $menus[$r++] = array('title'=>'<span class="fa fa-layer-group paddingrightonly
"></span><div class="trunc
">'.$langs->trans("New
").'</div>', 'action'=>'New();');
1278 // BAR RESTAURANT specific menu
1279 $menus[$r++] = array('title'=>'<span class="fa fa-layer-group paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Place
").'</div>', 'action'=>'Floors();');
1282if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
1283 $menus[$r++] = array('title'=>'<span class="far fa-building paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Customer
").'</div>', 'action'=>'Customer();');
1285if ( ! getDolGlobalString('TAKEPOS_HIDE_HISTORY')) {
1286 $menus[$r++] = array('title'=>'<span class="fa fa-history paddingrightonly
"></span><div class="trunc
">'.$langs->trans("History
").'</div>', 'action'=>'History();');
1288$menus[$r++] = array('title'=>'<span class="fa fa-cube paddingrightonly
"></span><div class="trunc
">'.$langs->trans("FreeZone
").'</div>', 'action'=>'FreeZone();');
1289$menus[$r++] = array('title'=>'<span class="fa fa-percent paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Reduction
").'</div>', 'action'=>'Reduction();');
1290$menus[$r++] = array('title'=>'<span class="far fa-money-bill-alt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Payment
").'</div>', 'action'=>'CloseBill();');
1292if (getDolGlobalString('TAKEPOS_DIRECT_PAYMENT')) {
1293 $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();');
1296$menus[$r++] = array('title'=>'<span class="fas fa-cut paddingrightonly
"></span><div class="trunc
">'.$langs->trans("SplitSale
").'</div>', 'action'=>'Split();');
1298// BAR RESTAURANT specific menu
1299if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1300 if (getDolGlobalString('TAKEPOS_ORDER_PRINTERS')) {
1301 $menus[$r++] = array('title'=>'<span class="fa fa-blender-phone paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Order
").'</span>', 'action'=>'TakeposPrintingOrder();');
1303 //Button to print receipt before payment
1304 if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1305 if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector
") {
1306 if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
1307 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Receipt
").'</div>', 'action'=>'TakeposConnector(placeid);');
1309 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Receipt
").'</div>', 'action'=>'TakeposPrinting(placeid);');
1311 } elseif (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter
") {
1312 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Receipt
").'</div>', 'action'=>'DolibarrTakeposPrinting(placeid);');
1314 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Receipt
").'</div>', 'action'=>'Print(placeid);');
1317 if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector
" && getDolGlobalString('TAKEPOS_ORDER_NOTES') == 1) {
1318 $menus[$r++] = array('title'=>'<span class="fa fa-sticky-note paddingrightonly
"></span><div class="trunc
">'.$langs->trans("OrderNotes
").'</div>', 'action'=>'TakeposOrderNotes();');
1320 if (getDolGlobalString('TAKEPOS_SUPPLEMENTS')) {
1321 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("ProductSupplements
").'</div>', 'action'=>'LoadProducts(\'supplements\');');
1325if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector
") {
1326 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("DOL_OPEN_DRAWER
").'</div>', 'action'=>'OpenDrawer();');
1328if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter
") {
1329 $menus[$r++] = array(
1330 'title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("DOL_OPEN_DRAWER
").'</div>',
1331 'action' => 'DolibarrOpenDrawer();',
1335$sql = "SELECT
rowid, status, entity FROM
".MAIN_DB_PREFIX."pos_cash_fence WHERE
";
1336$sql .= " entity =
".((int) $conf->entity)." AND
";
1337$sql .= " posnumber =
".((int) $_SESSION["takeposterminal
"])." AND
";
1338$sql .= " date_creation >
'".$db->idate(dol_get_first_hour(dol_now()))."'";
1340$resql = $db->query($sql);
1342 $num = $db->num_rows($resql);
1344 $obj = $db->fetch_object($resql);
1345 $menus[$r++] = array('title'=>'<span class="fas fa-file-invoice-dollar paddingrightonly
"></span><div class="trunc
">'.$langs->trans("CashReport
").'</div>', 'action'=>'CashReport('.$obj->rowid.');');
1346 if ($obj->status == 0) {
1347 $menus[$r++] = array('title'=>'<span class="fas fa-cash-
register paddingrightonly
"></span><div class="trunc
">'.$langs->trans("CloseCashFence
").'</div>', 'action'=>'CloseCashFence('.$obj->rowid.');');
1352$parameters = array('menus'=>$menus);
1353$reshook = $hookmanager->executeHooks('ActionButtons', $parameters);
1354if ($reshook == 0) { //add buttons
1355 if (is_array($hookmanager->resArray) ) {
1356 foreach ($hookmanager->resArray as $resArray) {
1357 foreach ($resArray as $butmenu) {
1358 $menus[$r++] = $butmenu;
1361 } elseif ($reshook == 1) {
1362 $r = 0; //replace buttons
1363 if (is_array($hookmanager->resArray) ) {
1364 foreach ($hookmanager->resArray as $resArray) {
1365 foreach ($resArray as $butmenu) {
1366 $menus[$r++] = $butmenu;
1374 $menus[$r++] = array('title'=>'', 'style'=>'visibility: hidden;');
1377if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
1378 $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().'\';');
1381if (!empty($conf->global->TAKEPOS_WEIGHING_SCALE)) {
1382 $menus[$r++] = array('title'=>'<span class="fa fa-balance-scale paddingrightonly
"></span><div class="trunc
">'.$langs->trans("WeighingScale
").'</div>', 'action'=>'WeighingScale();');
1386 <!-- Show buttons -->
1390 foreach ($menus as $menu) {
1392 if (count($menus) > 12 and $i == 12) {
1393 echo '<button style="'.(empty($menu['style
']) ? '' : $menu['style
']).'" type="button" id="actionnext
" class="actionbutton
" onclick="MoreActions(
'.count($menus).')
">'.$langs->trans("Next
").'</button>';
1394 echo '<button style="display: none;
" type="button" id="action
'.$i.'" class="actionbutton
" onclick="'.(empty($menu['action
']) ? '' : $menu['action
']).'">'.$menu['title'].'</button>';
1395 } elseif ($i > 12) {
1396 echo '<button style="display: none;
" type="button" id="action
'.$i.'" class="actionbutton
" onclick="'.(empty($menu['action
']) ? '' : $menu['action
']).'">'.$menu['title'].'</button>';
1398 echo '<button style="'.(empty($menu['style
']) ? '' : $menu['style
']).'" type="button" id="action
'.$i.'" class="actionbutton
" onclick="'.(empty($menu['action
']) ? '' : $menu['action
']).'">'.$menu['title'].'</button>';
1402 if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
1403 print '<!-- Show the search input text -->'."\n
";
1404 print '<div class="margintoponly
">';
1405 print '<input type="text
" id="search
" class="input-search-takepos
" 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> ';
1406 print '<a class="marginleftonly hideonsmartphone
" onclick="ClearSearch();
">'.img_picto('', 'searchclear').'</a>';
1413 <div class="row2<?php
if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
1417 <!-- Show categories -->
1419 if (getDolGlobalInt('TAKEPOS_HIDE_CATEGORIES') == 1) {
1420 print '<div class="div4
" style= "display: none;
">';
1422 print '<div class="div4
">';
1426 while ($count < $MAXCATEG) {
1428 <div class="wrapper
" <?php if ($count == ($MAXCATEG - 2)) {
1429 echo 'onclick="MoreCategories(\
'less\')"';
1430 } elseif ($count == ($MAXCATEG - 1)) {
1431 echo
'onclick="MoreCategories(\'more\')"';
1433 echo
'onclick="LoadProducts('.$count.
')"';
1434 } ?>
id=
"catdiv<?php echo $count; ?>">
1436 if ($count == ($MAXCATEG - 2)) {
1438 echo
'<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1439 } elseif ($count == ($MAXCATEG - 1)) {
1441 echo
'<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1444 echo
'<img class="imgwrapper" id="catimg'.$count.
'" />';
1448 <?php
if ($count != ($MAXCATEG - 2) && $count != ($MAXCATEG - 1)) { ?>
1449 <div
class=
"description" id=
"catdivdesc<?php echo $count; ?>">
1450 <div
class=
"description_content" id=
"catdesc<?php echo $count; ?>"></div>
1453 <div
class=
"catwatermark" id=
'catwatermark<?php echo $count; ?>'>...</div>
1461 <!-- Show product -->
1462 <div
class=
"div5"<?php
if (
getDolGlobalInt(
'TAKEPOS_HIDE_CATEGORIES') == 1) {
1463 print
' style="width:100%;"';
1467 while ($count < $MAXPRODUCT) {
1468 print
'<div class="wrapper2 arrow" id="prodiv'.$count.
'" ';
1470 <?php
if ($count == ($MAXPRODUCT - 2)) {
1471 ?> onclick=
"MoreProducts('less')" <?php
1472 }
if ($count == ($MAXPRODUCT - 1)) {
1473 ?> onclick=
"MoreProducts('more')" <?php
1475 echo
'onclick="ClickProduct('.$count.
')"';
1478 if ($count == ($MAXPRODUCT - 2)) {
1480 print
'<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1481 } elseif ($count == ($MAXPRODUCT - 1)) {
1483 print
'<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1486 echo
'<button type="button" id="probutton'.$count.
'" class="productbutton" style="display: none;"></button>';
1488 print
'<div class="" id="proprice'.$count.
'"></div>';
1489 print
'<img class="imgwrapper" title="" id="proimg'.$count.
'">';
1493 <?php
if ($count != ($MAXPRODUCT - 2) && $count != ($MAXPRODUCT - 1) && !
getDolGlobalString(
'TAKEPOS_HIDE_PRODUCT_IMAGES')) { ?>
1494 <div
class=
"description" id=
"prodivdesc<?php echo $count; ?>">
1495 <div
class=
"description_content" id=
"prodesc<?php echo $count; ?>"></div>
1498 <div
class=
"catwatermark" id=
'prowatermark<?php echo $count; ?>'>...</div>
1504 <input
type=
"hidden" id=
"search_start_less" value=
"0">
1505 <input
type=
"hidden" id=
"search_start_more" value=
"0">
1506 <input
type=
"hidden" id=
"search_pagination" value=
"">
Class to manage categories.
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)
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 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.
publicphonebutton2 phonegreen basiclayout basiclayout TotalHT VATCode TotalVAT TotalLT1 TotalLT2 TotalTTC TotalHT clearboth nowraponall right right takeposterminal SELECT e rowid
top_menu_user($hideloginname=0, $urllogout='')
Build the tooltip on user login.
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
ui dialog ui datepicker calendar ui widget content ui state ui datepicker calendar ui widget header ui state ui datepicker calendar ui button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.
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.
Search2(keyCodeForEnter, moreorless)
Search products.