34if (!defined(
'NOREQUIREMENU')) {
35 define(
'NOREQUIREMENU',
'1');
37if (!defined(
'NOREQUIREHTML')) {
38 define(
'NOREQUIREHTML',
'1');
40if (!defined(
'NOREQUIREAJAX')) {
41 define(
'NOREQUIREAJAX',
'1');
45require
'../main.inc.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
58require_once DOL_DOCUMENT_ROOT.
'/core/lib/takepos.lib.php';
59require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
61require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
64$langs->loadLangs(array(
"bills",
"orders",
"commercial",
"cashdesk",
"receiptprinter",
"banks"));
67$action =
GETPOST(
'action',
'aZ09');
69$setcurrency =
GETPOST(
'setcurrency',
'aZ09');
71$hookmanager->initHooks(array(
'takeposfrontend'));
72if (empty($_SESSION[
"takeposterminal"])) {
74 if (count($enabledterminals) == 1) {
75 $_SESSION[
"takeposterminal"] = (int) $enabledterminals[0];
76 } elseif (!empty($_COOKIE[
"takeposterminal"])) {
77 $_SESSION[
"takeposterminal"] = preg_replace(
'/[^a-zA-Z0-9_\-]/',
'', $_COOKIE[
"takeposterminal"]);
81if ($setterminal > 0) {
82 $_SESSION[
"takeposterminal"] = (int) $setterminal;
83 dolSetCookie(
"takeposterminal", (
string) $setterminal, -1);
86if ($setcurrency !=
"") {
87 $_SESSION[
"takeposcustomercurrency"] = $setcurrency;
94$maxcategbydefaultforthisdevice = 12;
95$maxproductbydefaultforthisdevice = 24;
97$MAXCATEG =
getDolGlobalInt(
'TAKEPOS_NB_MAXCATEG', $maxcategbydefaultforthisdevice);
98$MAXPRODUCT =
getDolGlobalInt(
'TAKEPOS_NB_MAXPRODUCT', $maxproductbydefaultforthisdevice);
100$term = empty($_SESSION[
'takeposterminal']) ? 1 : $_SESSION[
'takeposterminal'];
121$form =
new Form($db);
125$arrayofjs = array(
'/takepos/js/jquery.colorbox-min.js');
126$arrayofcss = array(
'/takepos/css/pos.css.php',
'/takepos/css/colorbox.css');
129 $arrayofcss[] =
'/takepos/css/colorful.css';
134$title =
'TakePOS - Dolibarr '.DOL_VERSION;
138$head =
'<meta name="apple-mobile-web-app-title" content="TakePOS"/>
139<meta name="apple-mobile-web-app-capable" content="yes">
140<meta name="mobile-web-app-capable" content="yes">
141<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
143top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
146$categories = $categorie->get_full_arbo(
'product',
getDolGlobalInt(
'TAKEPOS_ROOT_CATEGORY_ID'), 1);
151$levelofrootcategory = 0;
153 foreach ($categories as $key => $categorycursor) {
155 if ($categorycursor[
'id'] ==
getDolGlobalInt(
'TAKEPOS_ROOT_CATEGORY_ID')) {
156 $levelofrootcategory = $categorycursor[
'level'];
162$levelofmaincategories = $levelofrootcategory + 1;
164$maincategories = array();
165$subcategories = array();
166foreach ($categories as $key => $categorycursor) {
167 if ($categorycursor[
'level'] == $levelofmaincategories) {
168 $maincategories[$key] = $categorycursor;
169 } elseif ($categorycursor[
'level'] > $levelofmaincategories) {
170 $subcategories[$key] = $categorycursor;
178$keyCodeForEnter =
'';
179if (!empty($_SESSION[
'takeposterminal'])) {
180 $keyCodeForEnter =
getDolGlobalInt(
'CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION[
'takeposterminal']) > 0 ?
getDolGlobalString(
'CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION[
'takeposterminal']) :
'';
184<body
class=
"bodytakepos" style=
"overflow: hidden;">
187var categories = <?php echo json_encode($maincategories); ?>;
188var subcategories = <?php echo json_encode($subcategories); ?>;
194var place=
"<?php echo $place; ?>";
198var search2_timer=
null;
217function ClearSearch(clearSearchResults) {
218 console.log(
"ClearSearch");
219 $(
"#search").val(
'');
220 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
221 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
222 $(
"#reduction").html(
"<?php echo $langs->trans("LineDiscountShort
"); ?>").removeClass(
'clicked');
223 <?php
if (
$conf->browser->layout ==
'classic') { ?>
224 setFocusOnSearchField();
226 if (clearSearchResults) {
227 $(
"#search").trigger(
'keyup');
232function setFocusOnSearchField() {
233 console.log(
"Call setFocusOnSearchField in page index.php");
234 <?php
if (
$conf->browser->layout ==
'classic') { ?>
235 console.log(
"has keyboard from localStorage, so we can force focus on search field");
236 $(
"#search").focus();
240function PrintCategories(first) {
241 console.log(
"PrintCategories");
242 for (i = 0; i < <?php echo($MAXCATEG - 2); ?>; i++) {
243 if (typeof (categories[parseInt(i)+parseInt(first)]) ==
"undefined")
245 $(
"#catdivdesc"+i).hide();
246 $(
"#catdesc"+i).text(
"");
247 $(
"#catimg"+i).attr(
"src",
"genimg/empty.png");
248 $(
"#catwatermark"+i).hide();
249 $(
"#catdiv"+i).attr(
'class',
'wrapper divempty');
252 $(
"#catdivdesc"+i).show();
255 $(
"#catdesc"+i).html(categories[parseInt(i)+parseInt(first)][
'label'].bold() +
' - ' + categories[parseInt(i)+parseInt(first)][
'description']);
257 $(
"#catdesc"+i).text(categories[parseInt(i)+parseInt(first)][
'label']);
259 $(
"#catimg"+i).attr(
"src",
"genimg/index.php?query=cat&id="+categories[parseInt(i)+parseInt(first)][
'rowid']);
260 $(
"#catdiv"+i).data(
"rowid",categories[parseInt(i)+parseInt(first)][
'rowid']);
261 $(
"#catdiv"+i).attr(
"data-rowid",categories[parseInt(i)+parseInt(first)][
'rowid']);
262 $(
"#catdiv"+i).attr(
'class',
'wrapper');
263 $(
"#catwatermark"+i).show();
267function MoreCategories(moreorless) {
268 console.log(
"MoreCategories moreorless="+moreorless+
" pagecategories="+pagecategories);
269 if (moreorless ==
"more") {
270 $(
'#catimg15').animate({opacity:
'0.5'}, 1);
271 $(
'#catimg15').animate({opacity:
'1'}, 100);
272 pagecategories=pagecategories+1;
274 if (moreorless ==
"less") {
275 $(
'#catimg14').animate({opacity:
'0.5'}, 1);
276 $(
'#catimg14').animate({opacity:
'1'}, 100);
277 if (pagecategories==0)
return;
278 pagecategories=pagecategories-1;
280 if (typeof (categories[<?php echo($MAXCATEG - 2); ?> * pagecategories] && moreorless ==
"more") ==
"undefined") {
281 pagecategories=pagecategories-1;
285 for (i = 0; i < <?php echo($MAXCATEG - 2); ?>; i++) {
286 if (typeof (categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)]) ==
"undefined") {
288 console.log(
"complete with empty record");
289 $(
"#catdivdesc"+i).hide();
290 $(
"#catdesc"+i).text(
"");
291 $(
"#catimg"+i).attr(
"src",
"genimg/empty.png");
292 $(
"#catwatermark"+i).hide();
295 $(
"#catdivdesc"+i).show();
298 $(
"#catdesc"+i).html(categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)][
'label'].bold() +
' - ' + categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)][
'description']);
300 $(
"#catdesc"+i).text(categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)][
'label']);
302 $(
"#catimg"+i).attr(
"src",
"genimg/index.php?query=cat&id="+categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)][
'rowid']);
303 $(
"#catdiv"+i).data(
"rowid",categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)][
'rowid']);
304 $(
"#catdiv"+i).attr(
"data-rowid",categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)][
'rowid']);
305 $(
"#catwatermark"+i).show();
312function LoadProducts(
position, issubcat) {
313 console.log(
"LoadProducts position="+
position+
" issubcat="+issubcat);
314 var maxproduct = <?php echo (
int) ($MAXPRODUCT - 2); ?>;
317 currentcat =
"supplements";
319 if (subcategories.count == 0) {
320 alert(
"No product found into categories level 2 or more");
323 $(
'#catimg'+
position).animate({opacity:
'0.5'}, 1);
324 $(
'#catimg'+
position).animate({opacity:
'1'}, 100);
325 if (issubcat ==
true) {
326 currentcat = $(
'#prodiv'+
position).data(
'rowid');
329 currentcat = $(
'#catdiv'+
position).data(
'rowid');
330 console.log(
"currentcat="+currentcat);
333 if (currentcat == undefined) {
340 var parent_cat_label = <?php echo
"'".dol_escape_js($langs->trans(
'GoBack')).
"'" ; ?>;
341 if (currentcat !=
"supplements") {
342 jQuery.each(subcategories,
function(i, val) {
343 if (val.rowid == currentcat) {
344 parent_cat = val.fk_parent;
349 if (parent_cat > 0) {
351 jQuery.each(categories,
function(i, val) {
352 if (val.rowid == parent_cat) {
353 parent_cat_label = val.label;
359 jQuery.each(subcategories,
function(i, val) {
360 if (val.rowid == parent_cat) {
361 parent_cat_label = val.label;
367 $(
"#prodivdesc"+ishow).show();
368 var back_html =
'<span class="fa fa-chevron-left paddingright"></span> ' + parent_cat_label;
371 $(
"#prodesc"+ishow).html(
'<strong>' + back_html +
'</strong>');
373 $(
"#prodesc"+ishow).html(back_html);
375 $(
"#probutton"+ishow).html(back_html);
377 $(
"#probutton"+ishow).show();
378 $(
"#proprice"+ishow).attr(
"class",
"hidden");
379 $(
"#proprice"+ishow).html(
"");
381 $(
"#proimg"+ishow).attr(
"src",
"img/back.png");
383 $(
"#prodiv"+ishow).data(
"rowid", parent_cat);
384 $(
"#prodiv"+ishow).attr(
"data-rowid", parent_cat);
385 $(
"#prodiv"+ishow).data(
"iscat", 1);
386 $(
"#prodiv"+ishow).attr(
"data-iscat", 1);
387 $(
"#prodiv"+ishow).removeClass(
"divempty");
388 $(
"#prowatermark"+ishow).hide();
392 console.log(
"Loop on each category level 2 or more");
393 jQuery.each(subcategories,
function(i, val) {
394 if (currentcat == val.fk_parent) {
395 $(
"#prodivdesc"+ishow).show();
396 <?php if (getDolGlobalString(
'TAKEPOS_SHOW_CATEGORY_DESCRIPTION') == 1) { ?>
397 $(
"#prodesc"+ishow).html(val.label.bold() +
' - ' + val.description);
398 $(
"#probutton"+ishow).html(val.label);
400 $(
"#prodesc"+ishow).text(val.label);
401 $(
"#probutton"+ishow).text(val.label);
403 $(
"#probutton"+ishow).show();
404 $(
"#proprice"+ishow).attr(
"class",
"hidden");
405 $(
"#proprice"+ishow).html(
"");
406 $(
"#proimg"+ishow).attr(
"src",
"genimg/index.php?query=cat&id="+val.rowid);
407 $(
"#prodiv"+ishow).data(
"rowid",val.rowid);
408 $(
"#prodiv"+ishow).attr(
"data-rowid",val.rowid);
409 $(
"#prodiv"+ishow).data(
"iscat", 1);
410 $(
"#prodiv"+ishow).attr(
"data-iscat", 1);
411 $(
"#prodiv"+ishow).removeClass(
"divempty");
412 $(
"#prowatermark"+ishow).show();
420 if (maxproduct >= 1) {
421 limit = maxproduct - 1;
425 let socid = jQuery(
'#thirdpartyid').val();
426 if ((socid === undefined || socid ===
"") && parseInt(<?php echo
"'".
dol_escape_js($socid).
"'"; ?>) > 0) {
427 socid = parseInt(<?php echo
"'".
dol_escape_js($socid).
"'" ; ?>);
431 $.getJSON(
'<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo currentToken();?>&thirdpartyid=' + socid +
'&category='+currentcat+
'&tosell=1&limit='+limit+
'&offset=0',
function(data) {
433 console.log(
"Call ajax.php (in LoadProducts) to get Products of category "+currentcat+
" then loop on result to fill image thumbs");
434 console.log(
"Found "+data.length+
" record");
436 if (data.length == 0 && currentcat ==
"supplements") {
437 alert(
"No supplements found into the supplement category. Check the module setup and your product categories.");
440 while (ishow < maxproduct) {
441 console.log(
"ishow"+ishow+
" idata="+idata);
442 console.log(data[idata]);
444 if (typeof (data[idata]) ==
"undefined") {
446 echo
'$("#prodivdesc"+ishow).hide();';
447 echo
'$("#prodesc"+ishow).text("");';
448 echo
'$("#proimg"+ishow).attr("title","");';
449 echo
'$("#proimg"+ishow).attr("src","genimg/empty.png");';
451 echo
'$("#probutton"+ishow).hide();';
452 echo
'$("#probutton"+ishow).text("");';
454 $(
"#proprice"+ishow).attr(
"class",
"hidden");
455 $(
"#proprice"+ishow).html(
"");
457 $(
"#prodiv"+ishow).data(
"rowid",
"");
458 $(
"#prodiv"+ishow).attr(
"data-rowid",
"");
460 $(
"#prodiv"+ishow).data(
"iscat",
"0");
461 $(
"#prodiv"+ishow).attr(
"data-iscat",
"0");
463 $(
"#prodiv"+ishow).attr(
"class",
"wrapper2 divempty");
466 $titlestring =
"'".dol_escape_js($langs->transnoentities(
'Ref').
': ').
"' + data[idata]['ref']";
467 $titlestring .=
" + ' - ".dol_escape_js($langs->trans(
"Barcode").
': ').
"' + data[idata]['barcode']";
469 var titlestring = <?php echo $titlestring; ?>;
471 echo
'$("#prodivdesc"+ishow).show();';
473 echo
'$("#prodesc"+ishow).html(data[parseInt(idata)][\'ref\'].bold() + \' - \' + data[parseInt(idata)][\'label\']);';
475 echo
'$("#prodesc"+ishow).html(data[parseInt(idata)][\'ref\'].bold());';
477 echo
'$("#prodesc"+ishow).html(data[parseInt(idata)][\'label\']);';
479 echo
'$("#proimg"+ishow).attr("title", titlestring);';
480 echo
'$("#proimg"+ishow).attr("src", "genimg/index.php?query=pro&id="+data[idata][\'id\']);';
482 echo
'$("#probutton"+ishow).show();';
483 echo
'$("#probutton"+ishow).html(data[parseInt(idata)][\'label\']);';
486 if (data[parseInt(idata)][
'price_formated']) {
487 $(
"#proprice" + ishow).attr(
"class",
"productprice");
491 $(
"#proprice" + ishow).html(data[parseInt(idata)][
'price_formated']);
495 $(
"#proprice" + ishow).html(data[parseInt(idata)][
'price_ttc_formated']);
500 console.log(
"#prodiv"+ishow+
".data(rowid)="+data[idata][
'id']);
502 $(
"#prodiv"+ishow).data(
"rowid", data[idata][
'id']);
503 $(
"#prodiv"+ishow).attr(
"data-rowid", data[idata][
'id']);
504 console.log($(
'#prodiv4').data(
'rowid'));
506 $(
"#prodiv"+ishow).data(
"iscat", 0);
507 $(
"#prodiv"+ishow).attr(
"data-iscat", 0);
509 $(
"#prodiv"+ishow).attr(
"class",
"wrapper2");
513 $parameters = array();
514 $parameters[
'caller'] =
'loadProducts';
515 $hookmanager->executeHooks(
'completeJSProductDisplay', $parameters);
516 print $hookmanager->resPrint;
519 $(
"#prowatermark"+ishow).hide();
528function MoreProducts(moreorless) {
529 console.log(
"MoreProducts");
531 if ($(
'#search_pagination').val() !=
'') {
532 return Search2(
'<?php echo(isset($keyCodeForEnter) ? $keyCodeForEnter : ''); ?>', moreorless);
535 var maxproduct = <?php echo($MAXPRODUCT - 2); ?>;
537 if (moreorless==
"more"){
538 $(
'#proimg31').animate({opacity:
'0.5'}, 1);
539 $(
'#proimg31').animate({opacity:
'1'}, 100);
540 pageproducts=pageproducts+1;
542 if (moreorless==
"less"){
543 $(
'#proimg30').animate({opacity:
'0.5'}, 1);
544 $(
'#proimg30').animate({opacity:
'1'}, 100);
545 if (pageproducts==0)
return;
546 pageproducts=pageproducts-1;
552 if (maxproduct >= 1) {
553 limit = maxproduct-1;
556 var nb_cat_shown = $(
'.div5 div.wrapper2[data-iscat=1]').length;
557 var offset = <?php echo($MAXPRODUCT - 2); ?> * pageproducts - nb_cat_shown;
560 let socid = jQuery(
'#thirdpartyid').val();
561 if ((socid === undefined || socid ===
"") && parseInt(<?php echo
"'".
dol_escape_js($socid).
"'"; ?>) > 0) {
562 socid = parseInt(<?php echo
"'".
dol_escape_js($socid).
"'" ; ?>);
566 $.getJSON(
'<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo currentToken();?>&thirdpartyid=' + socid +
'&category='+currentcat+
'&tosell=1&limit='+limit+
'&offset='+offset,
function(data) {
567 console.log(
"Call ajax.php (in MoreProducts) to get Products of category "+currentcat);
569 if (typeof (data[0]) ==
"undefined" && moreorless==
"more"){
570 pageproducts=pageproducts-1;
574 while (ishow < maxproduct) {
575 if (typeof (data[idata]) ==
"undefined") {
576 $(
"#prodivdesc"+ishow).hide();
577 $(
"#prodesc"+ishow).text(
"");
578 $(
"#probutton"+ishow).text(
"");
579 $(
"#probutton"+ishow).hide();
580 $(
"#proprice"+ishow).attr(
"class",
"");
581 $(
"#proprice"+ishow).html(
"");
582 $(
"#proimg"+ishow).attr(
"src",
"genimg/empty.png");
583 $(
"#prodiv"+ishow).data(
"rowid",
"");
584 $(
"#prodiv"+ishow).attr(
"data-rowid",
"");
585 $(
"#prodiv"+ishow).addClass(
"divempty");
587 $(
"#prodivdesc"+ishow).show();
588 $(
"#prodiv"+ishow).removeClass(
"divempty");
590 $(
"#prodesc"+ishow).html(data[parseInt(idata)][
'ref'].bold() +
' - ' + data[parseInt(idata)][
'label']);
591 <?php } elseif (
getDolGlobalInt(
'TAKEPOS_SHOW_PRODUCT_REFERENCE') == 2) { ?>
592 $(
"#prodesc"+ishow).html(data[parseInt(idata)][
'ref'].bold());
594 $(
"#prodesc"+ishow).html(data[parseInt(idata)][
'label']);
596 $(
"#probutton"+ishow).html(data[parseInt(idata)][
'label']);
597 $(
"#probutton"+ishow).show();
598 if (data[parseInt(idata)][
'price_formated']) {
599 $(
"#proprice" + ishow).attr(
"class",
"productprice");
603 $(
"#proprice" + ishow).html(data[parseInt(idata)][
'price_formated']);
607 $(
"#proprice" + ishow).html(data[parseInt(idata)][
'price_ttc_formated']);
612 $(
"#proimg"+ishow).attr(
"src",
"genimg/index.php?query=pro&id="+data[idata][
'id']);
613 $(
"#prodiv"+ishow).data(
"rowid",data[idata][
'id']);
614 $(
"#prodiv"+ishow).attr(
"data-rowid",data[idata][
'id']);
615 $(
"#prodiv"+ishow).data(
"iscat",0);
617 $(
"#prowatermark"+ishow).hide();
626function ClickProduct(
position, qty = 1, qty_std = 0) {
627 console.log(
"ClickProduct at position"+
position);
628 if ($(
'#invoiceid').val() ==
"") {
629 invoiceid = $(
'#invoiceid').val();
632 $(
'#proimg'+
position).animate({opacity:
'0.5'}, 1);
633 $(
'#proimg'+
position).animate({opacity:
'1'}, 100);
634 if ($(
'#prodiv'+
position).data(
'iscat') == 1){
635 console.log(
"Click on a category at position "+
position);
639 invoiceid = $(
"#invoiceid").val();
640 idproduct=$(
'#prodiv'+
position).data(
'rowid');
641 console.log(
"Click on product at position "+
position+
" for idproduct "+idproduct+
", qty="+qty+
" invoiceid="+invoiceid);
642 if (idproduct ==
"") {
646 addInvoiceLine =
function(qty, qty_std_inner = 0) {
648 $(
"#poslines").load(
"invoice.php?action=addline&token=<?php echo currentToken(); ?>&place="+place+
"&idproduct="+idproduct+
"&selectedline="+selectedline+
"&qty="+qty+
"&invoiceid="+invoiceid+(qty_std_inner ?
'&qty_std=1' :
''), function() {
651 echo
"CustomerDisplay();";
658 if ($(
'#prodiv'+
position).data(
'unit') == 2) {
659 WeighingScale(addInvoiceLine);
661 addInvoiceLine(qty, qty_std);
664 addInvoiceLine(qty, qty_std);
671function ChangeThirdparty(idcustomer) {
672 console.log(
"ChangeThirdparty");
674 $(
"#poslines").load(
"<?php echo DOL_URL_ROOT ?>/societe/list.php?action=change&token=<?php echo currentToken();?>&type=t&contextpage=poslist&idcustomer="+idcustomer+
"&place="+place+
"",
function() {
680function deleteline() {
681 if (selectedline == 0)
return;
682 invoiceid = $(
"#invoiceid").val();
683 console.log(
"Delete line invoiceid="+invoiceid);
684 $(
"#poslines").load(
"invoice.php?action=deleteline&token=<?php echo currentToken(); ?>&place="+place+
"&idline="+selectedline+
"&invoiceid="+invoiceid,
function() {
690function editbatch(lineid, idproduct, clonebatch) {
691 $(
"#poslines").load(
"invoice.php?action=editbatch_popup&token=<?php echo newToken(); ?>&place="+place+
"&idline="+lineid+
"&idproduct="+idproduct+
"&invoiceid="+invoiceid+(clonebatch ?
'&clonebatch=1' :
''), function() {});
694function updatebatch(batch, warehouseid, lineid, clonebatch) {
695 $(
"#poslines").load(
"invoice.php?action=setbatch&token=<?php echo newToken(); ?>&place="+place+
"&idline="+lineid+
"&batch="+encodeURIComponent(batch)+
"&warehouseid="+warehouseid+
"&invoiceid="+invoiceid+(clonebatch ?
'&clonebatch=1' :
''), function() {});
699 console.log(
"Open box to select the thirdparty place="+place);
700 $.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
"); ?>"});
704 console.log(
"Open box to select the contact place="+place);
705 $.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"); ?>"});
710 console.log(
"Open box to select the history");
711 $.colorbox({href:
"../compta/facture/list.php?contextpage=poslist&search_module_source=takepos", width:
"90%", height:
"80%", transition:
"none", iframe:
"true", title:
"<?php echo $langs->trans("History
"); ?>"});
714function CloneTicket(sourceinvoiceid) {
715 if (!sourceinvoiceid) {
716 sourceinvoiceid = invoiceid;
718 if (!sourceinvoiceid) {
721 $.getJSON(
"<?php print DOL_URL_ROOT; ?>/takepos/invoice.php?action=cloneticket&format=json&token=<?php echo currentToken(); ?>&sourceinvoiceid="+sourceinvoiceid)
722 .done(
function(data) {
724 alert(data.message || <?php echo
"'".dol_escape_js($langs->trans(
'ErrorFailedToCloneTicket')).
"'"; ?>);
729 invoiceid = data.invoiceid;
730 if (data.batchlineid > 0) {
731 editbatch(data.batchlineid, data.batchproductid, 1);
733 $(
"#poslines").load(
"invoice.php?place="+place+
"&invoiceid="+invoiceid,
function() {});
737 alert(<?php echo
"'".
dol_escape_js($langs->trans(
'ErrorFailedToCloneTicket')).
"'"; ?>);
742function Reduction() {
743 invoiceid = $(
"#invoiceid").val();
744 console.log(
"Open popup to enter reduction on invoiceid="+invoiceid);
745 $.colorbox({href:
"reduction.php?place="+place+
"&invoiceid="+invoiceid, width:
"80%", height:
"90%", transition:
"none", iframe:
"true", title:
""});
748var closeBillParams=
"";
749function CloseBill() {
751 $parameters = array();
752 $reshook = $hookmanager->executeHooks(
'paramsForCloseBill', $parameters, $obj, $action);
754 echo
"customerAnchorTag = document.querySelector('a[id=\"customer\"]'); ";
755 echo
"if (customerAnchorTag && customerAnchorTag.innerText.trim() === '".$langs->trans(
"Customer").
"') { ";
756 echo
"alert('".dol_escape_js($langs->trans(
"NoClientErrorMessage")).
"'); ";
760 invoiceid = $(
"#invoiceid").val();
761 console.log(
"Open popup to enter payment on invoiceid="+invoiceid);
763 if ($(
"#idcustomer").val() ==
"") {
764 alert(
"<?php echo $langs->trans('TakePosCustomerMandatory'); ?>");
775 if (empty($alternative_payurl)) {
781 $.colorbox({href:
"<?php echo $payurl; ?>?place="+place+
"&invoiceid="+invoiceid+closeBillParams, width:
"80%", height:
"90%", transition:
"none", iframe:
"true", title:
""});
785 invoiceid = $(
"#invoiceid").val();
786 console.log(
"Open popup to split on invoiceid="+invoiceid);
787 $.colorbox({href:
"split.php?place="+place+
"&invoiceid="+invoiceid, width:
"80%", height:
"90%", transition:
"none", iframe:
"true", title:
""});
791 console.log(
"Open box to select floor place="+place);
792 $.colorbox({href:
"floors.php?place="+place, width:
"90%", height:
"90%", transition:
"none", iframe:
"true", title:
"<?php echo $langs->trans("Floors
"); ?>"});
796 invoiceid = $(
"#invoiceid").val();
797 console.log(
"Open box to enter a free product on invoiceid="+invoiceid);
798 $.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
"); ?>"});
801function TakeposOrderNotes() {
802 console.log(
"Open box to order notes");
803 ModalBox(
'ModalNote');
804 $(
"#textinput").focus();
808 console.log(
"Refresh by reloading place="+place+
" invoiceid="+invoiceid);
809 $(
"#poslines").load(
"invoice.php?place="+place+
"&invoiceid="+invoiceid,
function() {
816 invoiceid = $(
"#invoiceid").val();
818 console.log(
"New with place = <?php echo $place; ?>, js place="+place+
", invoiceid="+invoiceid);
820 if (invoiceid ==
'') {
821 $(
"#poslines").load(
"invoice.php?action=delete&token=<?php echo currentToken(); ?>&place=" + place,
function () {
826 $(
"#idcustomer").val(
"");
830 $.getJSON(
'<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getInvoice&token=<?php echo currentToken();?>&id='+invoiceid,
function(data) {
833 if (parseInt(data[
'paye']) === 1) {
836 r = confirm(
'<?php echo($place > 0 ? $langs->transnoentitiesnoconv("ConfirmDeletionOfThisPOSSale") : $langs->transnoentitiesnoconv("ConfirmDiscardOfThisPOSSale")); ?>');
841 $(
"#poslines").load(
"invoice.php?action=delete&token=<?php echo currentToken(); ?>&place=" + place,
function () {
846 $(
"#idcustomer").val(
"");
855function DeleteSale() {
856 if (typeof place ===
'undefined') {
859 if (confirm(<?php echo
"'".
dol_escape_js($langs->transnoentitiesnoconv(
"ConfirmDeletionOfThisPOSSale")).
"'" ; ?>)) {
861 $(
"#poslines").load(
"invoice.php?action=discardsale&token=<?php echo newToken(); ?>&place=" + place,
function () {
865 $(
"#idcustomer").val(
"");
878function Search2(keyCodeForEnter, moreorless) {
879 var eventKeyCode =
null;
881 if (window.event && window.event.keyCode) {
882 eventKeyCode = window.event.keyCode;
884 if (eventKeyCode ===
null && keyCodeForEnter !==
'') {
889 console.log(
"Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter+
", eventKeyCode="+eventKeyCode);
891 var search_term = $(
'#search').val();
892 var search_start = 0;
893 var search_limit = <?php echo $MAXPRODUCT - 2; ?>;
894 if (moreorless !=
null) {
895 search_term = $(
'#search_pagination').val();
896 search_start = $(
'#search_start_'+moreorless).val();
899 console.log(
"search_term="+search_term);
901 if (search_term ==
'') {
902 $(
"[id^=prowatermark]").html(
"");
903 $(
"[id^=prodesc]").text(
"");
904 $(
"[id^=probutton]").text(
"");
905 $(
"[id^=probutton]").hide();
906 $(
"[id^=proprice]").attr(
"class",
"hidden");
907 $(
"[id^=proprice]").html(
"");
908 $(
"[id^=proimg]").attr(
"src",
"genimg/empty.png");
909 $(
"[id^=prodiv]").data(
"rowid",
"");
910 $(
"[id^=prodiv]").attr(
"data-rowid",
"");
911 $(
"[id^=prodiv]").addClass(
"divempty");
916 if (keyCodeForEnter ==
'' || eventKeyCode == keyCodeForEnter) {
920 if (search ===
true) {
924 clearTimeout(search2_timer);
928 search2_timer = setTimeout(
function(){
930 jQuery(
".wrapper2 .catwatermark").hide();
931 var nbsearchresults = 0;
934 let socid = jQuery(
'#thirdpartyid').val();
935 if ((socid === undefined || socid ===
"") && parseInt(<?php echo
"'".
dol_escape_js($socid).
"'"; ?>) > 0) {
936 socid = parseInt(<?php echo
"'".
dol_escape_js($socid).
"'" ; ?>);
939 $.getJSON(
'<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&token=<?php echo currentToken();?>&search_term=' + search_term +
'&thirdpartyid=' + socid +
'&search_start=' + search_start +
'&search_limit=' + search_limit,
function (data) {
940 for (i = 0; i < <?php echo ($MAXPRODUCT - 2); ?>; i++) {
941 if (typeof (data[i]) ==
"undefined") {
942 $(
"#prowatermark" + i).html(
"");
943 $(
"#prodesc" + i).text(
"");
944 $(
"#probutton" + i).text(
"");
945 $(
"#probutton" + i).hide();
946 $(
"#proprice" + i).attr(
"class",
"hidden");
947 $(
"#proprice" + i).html(
"");
948 $(
"#proimg" + i).attr(
"src",
"genimg/empty.png");
949 $(
"#prodiv" + i).data(
"rowid",
"");
950 $(
"#prodiv" + i).attr(
"data-rowid",
"");
954 $titlestring =
"'".dol_escape_js($langs->transnoentities(
'Ref').
': ').
"' + data[i]['ref']";
955 $titlestring .=
" + ' - ".dol_escape_js($langs->trans(
"Barcode").
': ').
"' + data[i]['barcode']";
957 var titlestring = <?php echo $titlestring; ?>;
959 $(
"#prodesc" + i).html(data[i][
'ref'].bold() +
' - ' + data[i][
'label']);
960 <?php } elseif (
getDolGlobalInt(
'TAKEPOS_SHOW_PRODUCT_REFERENCE') == 2) { ?>
961 $(
"#prodesc" + i).html(data[i][
'ref'].bold());
963 $(
"#prodesc" + i).html(data[i][
'label']);
965 $(
"#prodivdesc" + i).show();
966 $(
"#prodiv" + i).removeClass(
"divempty");
967 $(
"#probutton" + i).html(data[i][
'label']);
968 $(
"#probutton" + i).show();
969 if (data[i][
'price_formated']) {
970 $(
"#proprice" + i).attr(
"class",
"productprice");
974 $(
"#proprice" + i).html(data[i][
'price_formated']);
978 $(
"#proprice" + i).html(data[i][
'price_ttc_formated']);
983 $(
"#proimg" + i).attr(
"title", titlestring);
984 if( undefined !== data[i][
'img']) {
985 $(
"#proimg" + i).attr(
"src", data[i][
'img']);
988 $(
"#proimg" + i).attr(
"src",
"genimg/index.php?query=pro&id=" + data[i][
'rowid']);
990 $(
"#prodiv" + i).data(
"rowid", data[i][
'rowid']);
991 $(
"#prodiv" + i).attr(
"data-rowid", data[i][
'rowid']);
992 $(
"#prodiv" + i).data(
"iscat", 0);
993 $(
"#prodiv" + i).attr(
"data-iscat", 0);
997 $parameters = array();
998 $parameters[
'caller'] =
'search2';
999 $hookmanager->executeHooks(
'completeJSProductDisplay', $parameters);
1000 print $hookmanager->resPrint;
1005 }).always(
function (data) {
1007 if ($(
'#search').val().length > 0 && data.length == 1) {
1008 console.log($(
'#search').val()+
' - '+data[0][
'barcode']);
1009 if ($(
'#search').val() == data[0][
'barcode'] &&
'thirdparty' == data[0][
'object']) {
1010 console.log(
"There is only 1 answer with barcode matching the search, so we change the thirdparty "+data[0][
'rowid']);
1011 ChangeThirdparty(data[0][
'rowid']);
1013 else if (
'product' == data[0][
'object'] && $(
'#search').val() == data[0][
'barcode']) {
1014 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']);
1015 ClickProduct(0, data[0][
'qty'], 1);
1018 if (eventKeyCode == keyCodeForEnter){
1019 if (data.length == 0) {
1020 $(
'#search').val(<?php
1021 $langs->load(
'errors');
1022 echo
"'".dol_escape_js($langs->transnoentitiesnoconv(
"ErrorRecordNotFoundShort")).
" ('";
1023 ?>+search_term+
')');
1024 $(
'#search').select();
1026 else ClearSearch(
false);
1029 $(
"#search_pagination").val($(
"#search").val());
1030 if (search_start == 0) {
1031 $(
"#prodiv<?php echo $MAXPRODUCT - 2; ?> span").hide();
1034 $(
"#prodiv<?php echo $MAXPRODUCT - 2; ?> span").show();
1035 var search_start_less = Math.max(0, parseInt(search_start) - parseInt(<?php echo $MAXPRODUCT - 2;?>));
1036 $(
"#search_start_less").val(search_start_less);
1038 if (nbsearchresults != <?php echo $MAXPRODUCT - 2; ?>) {
1039 $(
"#prodiv<?php echo $MAXPRODUCT - 1; ?> span").hide();
1042 $(
"#prodiv<?php echo $MAXPRODUCT - 1; ?> span").show();
1043 var search_start_more = parseInt(search_start) + parseInt(<?php echo $MAXPRODUCT - 2;?>);
1044 $(
"#search_start_more").val(search_start_more);
1053function Edit(number) {
1054 console.log(
"We click on PAD on key="+number);
1056 invoiceid = $(
"#invoiceid").val();
1058 if (typeof(selectedtext) ==
"undefined") {
1062 var text=selectedtext+
"<br> ";
1068 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
1069 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
1070 $(
"#reduction").html(
"<?php echo $langs->trans("LineDiscountShort
"); ?>").removeClass(
'clicked');
1072 }
else if (number==
'qty') {
1073 if (editaction==
'qty' && editnumber !=
'') {
1074 $(
"#poslines").load(
"invoice.php?action=updateqty&token=<?php echo currentToken(); ?>&place="+place+
"&idline="+selectedline+
"&number="+editnumber+
"&invoiceid="+invoiceid,
function() {
1077 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
1080 setFocusOnSearchField();
1086 }
else if (number==
'p') {
1087 if (editaction==
'p' && editnumber!=
"") {
1088 $(
"#poslines").load(
"invoice.php?action=updateprice&token=<?php echo currentToken(); ?>&place="+place+
"&idline="+selectedline+
"&number="+editnumber+
"&invoiceid="+invoiceid,
function() {
1091 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
1100 }
else if (number==
'r') {
1101 if (editaction==
'r' && editnumber!=
"") {
1102 $(
"#poslines").load(
"invoice.php?action=updatereduction&token=<?php echo currentToken(); ?>&place="+place+
"&idline="+selectedline+
"&number="+editnumber+
"&invoiceid="+invoiceid,
function() {
1105 $(
"#reduction").html(
"<?php echo $langs->trans("LineDiscountShort
"); ?>").removeClass(
'clicked');
1116 editnumber=editnumber+number;
1118 if (editaction==
'qty'){
1119 text=text+
"<?php echo $langs->trans("Modify
")." ->
".$langs->trans("Qty
").":
"; ?>";
1120 $(
"#qty").html(
"OK").addClass(
"clicked");
1121 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
1122 $(
"#reduction").html(
"<?php echo $langs->trans("LineDiscountShort
"); ?>").removeClass(
'clicked');
1124 if (editaction==
'p'){
1125 text=text+
"<?php echo $langs->trans("Modify
")." ->
".$langs->trans("Price
").":
"; ?>";
1126 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
1127 $(
"#price").html(
"OK").addClass(
"clicked");
1128 $(
"#reduction").html(
"<?php echo $langs->trans("LineDiscountShort
"); ?>").removeClass(
'clicked');
1130 if (editaction==
'r'){
1131 text=text+
"<?php echo $langs->trans("Modify
")." ->
".$langs->trans("LineDiscountShort
").":
"; ?>";
1132 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
1133 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
1134 $(
"#reduction").html(
"OK").addClass(
"clicked");
1136 $(
'#'+selectedline).find(
"td:first").html(text+editnumber);
1140function TakeposPrintingOrder(){
1141 console.log(
"TakeposPrintingOrder output invoice to print order");
1142 $(
"#poslines").load(
"invoice.php?action=order&token=<?php echo currentToken();?>&place="+place,
function() {
1147function OpenDrawer(){
1148 console.log(
"OpenDrawer call ajax url http://<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER'); ?>:8111/print");
1151 data: { token:
'notrequired' },
1153 if (
getDolGlobalString(
'TAKEPOS_PRINT_SERVER') && filter_var(
$conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) ==
true) {
1154 echo
"url: '".getDolGlobalString(
'TAKEPOS_PRINT_SERVER',
'localhost').
"/printer/drawer.php',";
1156 echo
"url: 'http://".getDolGlobalString(
'TAKEPOS_PRINT_SERVER',
'localhost').
":8111/print',";
1164function DolibarrOpenDrawer() {
1165 console.log(
"DolibarrOpenDrawer call ajax url /takepos/ajax/ajax.php?action=opendrawer&token=<?php echo currentToken();?>&term=<?php print urlencode(empty($_SESSION["takeposterminal
"]) ? '' : $_SESSION["takeposterminal
"]); ?>");
1168 data: { token:
'<?php echo currentToken(); ?>' },
1169 url:
"<?php print DOL_URL_ROOT.'/takepos/ajax/ajax.php?action=opendrawer&token='.currentToken().'&term='.urlencode(empty($_SESSION["takeposterminal
"]) ? '' : $_SESSION["takeposterminal
"]); ?>",
1173function MoreActions(totalactions) {
1174 for (i = 0; i <= totalactions; i++) {
1175 $(
"#action" + i).toggle();
1177 $(
"#actionnext").toggle();
1178 $(
"#actionprevious").toggle();
1181function ControlCashOpening()
1183 $.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
"); ?>"});
1186function CloseCashFence(rowid)
1188 $.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
"); ?>"});
1191function CashReport(rowid)
1193 $.colorbox({href:
"../compta/cashcontrol/report.php?id="+rowid+
"&contextpage=takepos", width:
"60%", height:
"90%", transition:
"none", iframe:
"true", title:
"<?php echo $langs->trans("CashReport
"); ?>"});
1200function ModalBox(ModalID)
1202 var modal = document.getElementById(ModalID);
1203 modal.style.display =
"block";
1206function DirectPayment(){
1207 console.log(
"DirectPayment");
1208 $(
"#poslines").load(
"invoice.php?place="+place+
"&action=valid&token=<?php echo currentToken(); ?>&pay=LIQ",
function() {
1209 $(
'#invoiceid').val(
"");
1213function FullScreen() {
1214 document.documentElement.requestFullscreen();
1217function WeighingScale(callback) {
1218 console.log(
"Weighing Scale: invoiceid = " + placeid +
", lineid = " + selectedline);
1223 if (idproduct ==
"" && selectedline > 0) {
1224 urlProduct =
"<?php echo DOL_URL_ROOT; ?>/api/index.php/takeposconnector/invoices/" + placeid +
"/lines/" + selectedline +
"/product";
1226 urlProduct =
"<?php echo DOL_URL_ROOT; ?>/api/index.php/products/" + idproduct;
1230 headers: {
"DOLAPIKEY":
'<?php echo $user->api_key; ?>' },
1233 .done(
function(product) {
1234 if (callback === undefined) {
1235 callback =
function(qty) {
1236 $(
"#poslines").load(
"invoice.php?token=<?php echo currentToken(); ?>&action=updateqty&place="+place+
"&idline="+selectedline+
"&number="+qty);
1239 if (product.fk_unit ==
"2") {
1240 askForWeight(product.multiprices_ttc[1], callback, function (errorMessage) {
1241 console.log(
"Erreur: " + errorMessage);
1247 editnumber = globalWeight;
1248 $(
"#poslines").load(
"invoice.php?token=<?php echo currentToken(); ?>&action=updateqty&place="+place+
"&idline="+selectedline+
"&number="+editnumber,
function() {
1255 data: { token:
'notrequired' },
1256 url:
'<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER
'); ?>/scale/index.php',
1258 .done(
function( editnumber ) {
1259 $(
"#poslines").load(
"invoice.php?token=<?php echo currentToken(); ?>&action=updateqty&place="+place+
"&idline="+selectedline+
"&number="+editnumber,
function() {
1266$( document ).ready(
function() {
1272 if (empty($_SESSION[
"takeposterminal"]) || $_SESSION[
"takeposterminal"] ==
"") {
1273 print
"ModalBox('ModalTerminal');";
1281 $sql =
"SELECT rowid, status FROM ".MAIN_DB_PREFIX.
"pos_cash_fence WHERE";
1282 $sql .=
" entity = ".((int)
$conf->entity).
" AND ";
1283 $sql .=
" posnumber = ".((int) $_SESSION[
"takeposterminal"]).
" AND ";
1285 $resql = $db->query($sql);
1287 $obj = $db->fetch_object($resql);
1289 if (!isset($obj->rowid) || is_null($obj->rowid)) {
1290 print
"ControlCashOpening();";
1297 var elem1 = $(
"#topnav-left")[0];
1298 var elem2 = $(
"#topnav-right")[0];
1299 var checkOverflow =
function() {
1300 if (scrollBars().horizontal) $(
"#topnav").addClass(
"overflow");
1301 else $(
"#topnav").removeClass(
"overflow");
1304 var scrollBars =
function(){
1305 var container= $(
'#topnav')[0];
1307 vertical:container.scrollHeight > container.clientHeight,
1308 horizontal:container.scrollWidth > container.clientWidth
1312 $(window).resize(
function(){
1316 let resizeObserver =
new ResizeObserver(() => {
1319 resizeObserver.observe(elem1);
1320 resizeObserver.observe(elem2);
1323 var pressTimer = [];
1327 $(
".indicator").mousedown(
function(){
1328 direction = $(
this).hasClass(
"left") ? -1 : 1;
1330 pressTimer.push(setInterval(scrollTo, 100));
1333 $(
".indicator").mouseup(
function(){
1334 pressTimer.forEach(clearInterval);
1337 $(
"body").mouseup(
function(){
1338 pressTimer.forEach(clearInterval);
1339 console.log(
"body mouseup");
1342 function scrollTo(){
1343 console.log(
"here");
1344 var pos = $(
"#topnav").scrollLeft();
1345 document.getElementById(
"topnav").scrollTo({ left: $(
"#topnav").scrollLeft() + direction * step, behavior:
'smooth' })
1348 $(
"#topnav").scroll(
function(){
1349 if (($(
"#topnav").offsetWidth + $(
"#topnav").scrollLeft >= $(
"#topnav").scrollWidth)) {
1357<div
class=
"container">
1362 <div
class=
"header">
1363 <div
id=
"topnav" class=
"topnav">
1364 <div
id=
"topnav-left" class=
"topnav-left">
1365 <div
class=
"inline-block valignmiddle">
1366 <a
class=
"topnav-terminalhour" onclick=
"ModalBox('ModalTerminal')">
1367 <span
class=
"fa fa-cash-register"></span>
1368 <span
class=
"hideonsmartphone">
1370 if (!empty($_SESSION[
"takeposterminal"])) {
1371 echo
getDolGlobalString(
"TAKEPOS_TERMINAL_NAME_".$_SESSION[
"takeposterminal"], $langs->trans(
"TerminalName", $_SESSION[
"takeposterminal"]));
1376 echo
'<span class="hideonsmartphone"> - '.dol_print_date(
dol_now(),
"day").
'</span>'; ?>
1380 print
'<a class="valignmiddle tdoverflowmax100" id="multicurrency" onclick="ModalBox(\'ModalCurrency\')" title=""><span class="fas fa-coins paddingrightonly"></span>';
1381 print
'<span class="hideonsmartphone">'.$langs->trans(
"Currency").
'</span>';
1385 <!-- section
for customer -->
1386 <div
class=
"inline-block valignmiddle" id=
"customerandsales"></div>
1387 <input
type=
"hidden" id=
"idcustomer" value=
"">
1388 <!-- section
for shopping carts -->
1389 <div
class=
"inline-block valignmiddle" id=
"shoppingcart"></div>
1390 <!-- More info about customer -->
1391 <div
class=
"inline-block valignmiddle tdoverflowmax150onsmartphone" id=
"moreinfo"></div>
1395 <!-- More info about warehouse -->
1396 <div
class=
"inline-block valignmiddle tdoverflowmax150onsmartphone" id=
"infowarehouse"></div>
1400 <div
id=
"topnav-right" class=
"topnav-right">
1402 $reshook = $hookmanager->executeHooks(
'takepos_login_block_other');
1403 if ($reshook == 0) {
1405 <div
class=
"login_block_other takepos">
1406 <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>
1407 <a onclick=
"ClearSearch(false);" class=
"nohover"><span
class=
"fa fa-backspace"></span></a>
1408 <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 -->
1409 <span
class=
"fas fa-home"></span></a>
1410 <?php
if (empty(
$conf->dol_use_jmobile)) { ?>
1411 <a
class=
"hideonsmartphone" onclick=
"FullScreen();" title=
"<?php echo dol_escape_htmltag($langs->trans("ClickFullScreenEscapeToLeave
")); ?>"><span
class=
"fa fa-expand-arrows-alt"></span></a>
1417 <div
class=
"login_block_user">
1419 print
top_menu_user(1, DOL_URL_ROOT.
'/user/logout.php?token='.
newToken().
'&urlfrom='.urlencode(
'/takepos/?setterminal='.((
int) $term)));
1423 <div
class=
"arrows">
1424 <span
class=
"indicator left"><i
class=
"fa fa-arrow-left"></i></span>
1425 <span
class=
"indicator right"><i
class=
"fa fa-arrow-right"></i></span>
1433<!-- Modal terminal box -->
1434<div
id=
"ModalTerminal" class=
"modal">
1435 <div
class=
"modal-content">
1436 <div
class=
"modal-header">
1440 <span
class=
"close" href=
"#" onclick=
"document.getElementById('ModalTerminal').style.display = 'none';">×</span>
1443 <h3><?php print $langs->trans(
"TerminalSelect"); ?></h3>
1445 <div
class=
"modal-body">
1448 print
'<button type="button" class="block" onclick="location.href=\'index.php?setterminal='.$i.
'\'">'.getDolGlobalString("TAKEPOS_TERMINAL_NAME_
".$i, $langs->trans("TerminalName
", $i)).'</button>';
1455<!-- Modal multicurrency box -->
1456<?php if (isModEnabled('multicurrency')) { ?>
1457<div id="ModalCurrency
" class="modal
">
1458 <div class="modal-content
">
1459 <div class="modal-header
">
1460 <span class="close
" href="#
" onclick="document.getElementById(
'ModalCurrency').style.display =
'none';
">×</span>
1461 <h3><?php print $langs->trans("SetMultiCurrencyCode
"); ?></h3>
1463 <div class="modal-body
">
1465 $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency';
1466 $sql .= " WHERE entity IN (
'".getEntity('multicurrency
')."')
";
1467 $resql = $db->query($sql);
1469 while ($obj = $db->fetch_object($resql)) {
1470 print '<button type="button" class="block
" onclick="location.href=\
'index.php?setcurrency='.urlencode($obj->code).
'\'">'.$obj->code.'</button>';
1479<!-- Modal popup to create a Credit Note -->
1480<div id="ModalCreditNote
" class="modal
">
1481 <div class="modal-content
">
1482 <div class="modal-header
">
1483 <span class="close
" href="#
" onclick="document.getElementById(
'ModalCreditNote').style.display =
'none';
">×</span>
1484 <h3><?php print $langs->trans("invoiceAvoirWithLines
"); ?></h3>
1486 <div class="modal-body
">
1487 <button type="button" class="block
" onclick="CreditNote(); document.getElementById(
'ModalCreditNote').style.display =
'none';
"><?php print $langs->trans("Yes
"); ?></button>
1488 <button type="button" class="block
" onclick="document.getElementById(
'ModalCreditNote').style.display =
'none';
"><?php print $langs->trans("No
"); ?></button>
1494<div id="ModalNote
" class="modal
">
1495 <div class="modal-content
">
1496 <div class="modal-header
">
1497 <span class="close
" href="#
" onclick="document.getElementById(
'ModalNote').style.display =
'none';
">×</span>
1498 <h3><?php print $langs->trans("Note
"); ?></h3>
1500 <div class="modal-body
">
1501 <input type="text
" class="block
" id="textinput
">
1502 <button type="button" class="block
" onclick="SetNote(); document.getElementById(
'ModalNote').style.display =
'none';
">OK</button>
1511 <div id="poslines
" class="div1
">
1515 <button type="button" class="calcbutton
" onclick="Edit(7);
">7</button>
1516 <button type="button" class="calcbutton
" onclick="Edit(8);
">8</button>
1517 <button type="button" class="calcbutton
" onclick="Edit(9);
">9</button>
1518 <button type="button" id="qty
" class="calcbutton2
" onclick="Edit(
'qty')
"><?php echo $langs->trans("Qty
"); ?></button>
1519 <button type="button" class="calcbutton
" onclick="Edit(4);
">4</button>
1520 <button type="button" class="calcbutton
" onclick="Edit(5);
">5</button>
1521 <button type="button" class="calcbutton
" onclick="Edit(6);
">6</button>
1522 <button type="button" id="price" class="calcbutton2
" onclick="Edit(
'p')
"><?php echo $langs->trans("Price
"); ?></button>
1523 <button type="button" class="calcbutton
" onclick="Edit(1);
">1</button>
1524 <button type="button" class="calcbutton
" onclick="Edit(2);
">2</button>
1525 <button type="button" class="calcbutton
" onclick="Edit(3);
">3</button>
1526 <button type="button" id="reduction
" class="calcbutton2
" onclick="Edit(
'r')
"><?php echo $langs->trans("LineDiscountShort
"); ?></button>
1527 <button type="button" class="calcbutton
" onclick="Edit(0);
">0</button>
1528 <button type="button" class="calcbutton
" onclick="Edit(
'.')
">.</button>
1529 <button type="button" class="calcbutton poscolorblue
" onclick="Edit(
'c')
">C</button>
1530 <?php if ($user->hasRight('takepos', 'editlines')) { ?>
1531 <button type="button" class="calcbutton2 poscolordelete
" id="delete" onclick="deleteline()
"><span class="fa fa-trash
"></span></button>
1537// Dependency modulecheck
1538if (!isModEnabled('invoice')) {
1539 setEventMessages($langs->trans("ErrorModuleSetupNotComplete
", $langs->transnoentitiesnoconv("Invoice
")), null, 'errors');
1542// TakePOS setup check
1543if (isset($_SESSION["takeposterminal
"]) && $_SESSION["takeposterminal
"]) {
1544 $sql = "SELECT code, libelle FROM
" . MAIN_DB_PREFIX . "c_paiement
";
1545 $sql .= " WHERE entity IN (
" . getEntity('c_paiement') . ")
";
1546 $sql .= " AND
active = 1
";
1547 $sql .= " ORDER BY libelle
";
1549 $resql = $db->query($sql);
1550 $paiementsModes = array();
1552 while ($obj = $db->fetch_object($resql)) {
1553 $paycode = $obj->code;
1554 if ($paycode == 'LIQ') {
1557 if ($paycode == 'CHQ') {
1558 $paycode = 'CHEQUE';
1561 $constantforkey = "CASHDESK_ID_BANKACCOUNT_
" . $paycode . $_SESSION["takeposterminal
"];
1562 //var_dump($constantforkey.' '.getDolGlobalInt($constantforkey));
1563 if (getDolGlobalInt($constantforkey) > 0) {
1564 array_push($paiementsModes, $obj);
1569 if (empty($paiementsModes) && isModEnabled("bank
")) {
1570 $langs->load('errors');
1571 setEventMessages($langs->trans("ErrorModuleSetupNotComplete
", $langs->transnoentitiesnoconv("TakePOS
")), null, 'errors');
1572 setEventMessages($langs->trans("ProblemIsInSetupOfTerminal
", $_SESSION["takeposterminal
"]), null, 'errors');
1576if (count($maincategories) == 0) {
1577 if (getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID') > 0) {
1578 $tmpcategory = new Categorie($db);
1579 $tmpcategory->fetch(getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID'));
1580 setEventMessages($langs->trans("TakeposNeedsAtLeastOnSubCategoryIntoParentCategory
", $tmpcategory->label), null, 'errors');
1582 setEventMessages($langs->trans("TakeposNeedsCategories
"), null, 'errors');
1585// User menu and external TakePOS modules
1589if (! getDolGlobalString('TAKEPOS_HIDE_HISTORY')) {
1590 $menus[$r++] = array('title' => '<span class="fa fa-history paddingrightonly
"></span><div class="trunc
">'.$langs->trans("History
").'</div>', 'action' => 'History();');
1593if (getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) {
1594 if (getDolGlobalString('TAKEPOS_CHOOSE_CONTACT')) {
1595 $menus[$r++] = array('title' => '<span class="far fa-building paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Contact").'</div>', 'action' => 'Contact();');
1597 $menus[$r++] = array('title' => '<span class="far fa-building paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Customer
").'</div>', 'action' => 'Customer();');
1601if (!getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1602 $menus[$r++] = array('title' => '<span class="fa fa-layer-group paddingrightonly
"></span><div class="trunc
">'.$langs->trans("New
").'</div>', 'action' => 'New();');
1604 // BAR RESTAURANT specific menu
1605 $menus[$r++] = array('title' => '<span class="fa fa-layer-group paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Place
").'</div>', 'action' => 'Floors();');
1608// Add a non predefined product
1609if (!getDolGlobalString('TAKEPOS_NO_FREE_ZONE_PRODUCT')) {
1610 $menus[$r++] = array('title' => '<span class="fa fa-cube paddingrightonly
"></span><div class="trunc
">'.$langs->trans("FreeZone
").'</div>', 'action' => 'FreeZone();');
1613// BAR RESTAURANT specific menu "Print on kitchen/order printer
"
1614if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1615 if (getDolGlobalString('TAKEPOS_SUPPLEMENTS')) {
1616 $menus[$r++] = array('title' => '<span class="fa fa-cube paddingrightonly
"></span><div class="trunc
">'.$langs->trans("ProductSupplements
").'</div>', 'action' => 'LoadProducts(\'supplements\');');
1619 if (getDolGlobalString('TAKEPOS_ORDER_PRINTERS')) {
1620 $menus[$r++] = array('title' => '<span class="fa fa-blender-phone paddingrightonly
"></span><div class="trunc
">'.$langs->trans("SentOrderToKitchen
").'</span>', 'action' => 'TakeposPrintingOrder();');
1625$menus[$r++] = array('title' => '<span class="fa fa-percent paddingrightonly
"></span><div class="trunc
">'.$langs->trans("InvoiceDiscountShort
").'</div>', 'action' => 'Reduction();');
1627if (!getDolGlobalString('TAKEPOS_NO_SPLIT_SALE')) {
1628 $menus[$r++] = array('title' => '<span class="fas fa-cut paddingrightonly
"></span><div class="trunc
">'.$langs->trans("SplitSale
").'</div>', 'action' => 'Split();');
1631// Last action that close the sell (payments)
1632$menus[$r++] = array('title' => '<span class="far fa-money-bill-alt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Payment
").'</div>', 'action' => 'CloseBill();');
1633if (getDolGlobalString('TAKEPOS_DIRECT_PAYMENT')) {
1634 $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();');
1637$customprinterallowed = false;
1638$customprinttemplateallowed = true;
1640// BAR RESTAURANT specific menu
1641if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1642 // Button to print receipt before payment
1643 $customprinterallowed = true;
1644 $customprinttemplateallowed = true;
1647include_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
1648if (isALNERunningVersion()) {
1649 // Custom printer may be allowed if mandatory information in template are guaranteed. For the moment, we prefer not allow this.
1650 $customprinttemplateallowed = false;
1653// Button to print receipt
1654// This section should be same than into invoice.php
1655if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector
") { // deprecated method
1656 if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) {
1657 // If TAKEPOS_PRINT_SERVER is an URL
1658 $menus[$r++] = array('title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("PrintTicket
").'</div>', 'action' => 'PrintByESCPOSOld(placeid);');
1660 // If TAKEPOS_PRINT_SERVER is an IP
1661 // Print by calling the receipt.php to get HTML content and send the HTML content to TAKEPOS_PRINT_SERVER:8111/print
1662 $menus[$r++] = array('title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("PrintTicket
").'</div>', 'action' => 'PrintHTMLToSlashPrint(placeid);');
1664} elseif ($customprinterallowed && $customprinttemplateallowed && (isModEnabled('receiptprinter') && getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0) || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter
") { // @phpstan-ignore-line
1665 // Button Print Receipt on special custom printer using custom template
1666 $nameOfPrinter = dol_getIdFromCode($db, getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term), 'printer_receipt', 'rowid', 'name', 1);
1667 $menus[$r++] = array('title' => '<div title="'.dolPrintHTMLForAttribute($langs->trans("PrintOn", $nameOfPrinter)).'"><span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("PrintTicket
").'</div></div>', 'action' => 'PrintByESCPOS(placeid);');
1669 // Button Print Receipt on browser
1670 $menus[$r++] = array('title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("PrintTicket
").'</div>', 'action' => 'PrintByBrowser(placeid);');
1673if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector
" && getDolGlobalString('TAKEPOS_ORDER_NOTES') == 1) {
1674 $menus[$r++] = array('title' => '<span class="fa fa-sticky-note paddingrightonly
"></span><div class="trunc
">'.$langs->trans("OrderNotes
").'</div>', 'action' => 'TakeposOrderNotes();');
1678if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector
") {
1679 $menus[$r++] = array('title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("DOL_OPEN_DRAWER
").'</div>', 'action' => 'OpenDrawer();');
1681if (getDolGlobalInt('TAKEPOS_ADD_BUTTON_OPEN_DRAWER'.$term) > 0) {
1682 $menus[$r++] = array(
1683 'title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("DOL_OPEN_DRAWER
").'</div>',
1684 'action' => 'DolibarrOpenDrawer();',
1688// If there is an open cash control started
1689$sql = "SELECT rowid,
status, entity FROM
".MAIN_DB_PREFIX."pos_cash_fence WHERE
";
1690$sql .= " entity =
".((int) $conf->entity)." AND
";
1691$sql .= " posnumber =
".((int) empty($_SESSION["takeposterminal
"]) ? 0 : $_SESSION["takeposterminal
"])." AND
";
1692$sql .= " date_creation >
'".$db->idate(dol_get_first_hour(dol_now()))."'";
1693$sql .= " AND
status = 0
";
1695$resql = $db->query($sql);
1697 $num = $db->num_rows($resql);
1699 $obj = $db->fetch_object($resql);
1700 $menus[$r++] = array('title' => '<span class="fas fa-file-invoice-dollar paddingrightonly
"></span><div class="trunc
">'.$langs->trans("CashReport
").'</div>', 'action' => 'CashReport('.$obj->rowid.');');
1701 if ($obj->status == 0) {
1702 $menus[$r++] = array('title' => '<span class="fas fa-cash-
register paddingrightonly
"></span><div class="trunc
">'.$langs->trans("CloseCashFence
").'</div>', 'action' => 'CloseCashFence('.$obj->rowid.');');
1707if (getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) {
1708 $menus[$r++] = array('title' => '<span class="fa fa-sign-out-alt pictofixedwidth
"></span><div class="trunc
">'.$langs->trans("Logout
").'</div>', 'action' => 'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php?token='.newToken().'\';');
1711if (getDolGlobalString('TAKEPOS_WEIGHING_SCALE')) {
1712 $menus[$r++] = array('title' => '<span class="fa fa-balance-scale pictofixedwidth
"></span><div class="trunc
">'.$langs->trans("WeighingScale
").'</div>', 'action' => 'WeighingScale();');
1715// Button to delete (discard) the current sale
1716/* Hide this. This button must appear only if is_erasable() is true. So it must depend on open invoice. For this reason,
1717 * the button could not be in this panel but must be on the left side inside the invoice.php file.
1718$menus[$r++] = array('title' => '<span class="fa fa-trash-alt paddingrightonly
"></span><div class="trunc truncdeletesale
">'.$langs->trans("DeleteSale
").'</div>', 'action' => 'DeleteSale();', 'class' => 'actionbuttondelete');
1721$parameters = array('menus' => $menus);
1722$reshook = $hookmanager->executeHooks('ActionButtons', $parameters);
1723if ($reshook == 0) { //add buttons
1724 if (is_array($hookmanager->resArray)) {
1725 foreach ($hookmanager->resArray as $resArray) {
1726 foreach ($resArray as $butmenu) {
1727 $menus[$r++] = $butmenu;
1731} elseif ($reshook == 1) {
1732 $r = 0; //replace buttons
1733 if (is_array($hookmanager->resArray)) {
1734 foreach ($hookmanager->resArray as $resArray) {
1735 foreach ($resArray as $butmenu) {
1736 $menus[$r++] = $butmenu;
1743 <!-- Show buttons -->
1744 <div id="dialogforpopuptakepos
"></div>
1746 /* Style de la popup */
1747 #dialogforpopuptakepos {
1756 box-shadow: 0 0 10px rgba(0,0,0,0.3);
1758 font-family: sans-serif;
1765 foreach ($menus as $menu) {
1767 if (count($menus) > 12 and $i == 12) {
1768 echo '<button style="'.(empty($menu['style
']) ? '' : $menu['style
']).'" type="button" id="actionnext
" class="actionbutton
" onclick="MoreActions(
'.count($menus).')
">'.$langs->trans("Next
").'</button>';
1769 echo '<button style="display: none;
" type="button" id="actionprevious
" class="actionbutton
" onclick="MoreActions(
'.count($menus).')
">'.$langs->trans("Previous
").'</button>';
1770 echo '<button style="display: none;
" type="button" id="action
'.$i.'" class="actionbutton
'.(empty($menu['class']) ? '' : ' '.dol_escape_htmltag($menu['class'])).'" onclick="'.(empty($menu['action
']) ? '' : $menu['action
']).'">'.$menu['title'].'</button>';
1771 } elseif ($i > 12) {
1772 echo '<button style="display: none;
" type="button" id="action
'.$i.'" class="actionbutton
'.(empty($menu['class']) ? '' : ' '.dol_escape_htmltag($menu['class'])).'" onclick="'.(empty($menu['action
']) ? '' : $menu['action
']).'">'.$menu['title'].'</button>';
1773 // TODO keep style but hide button
1775 echo '<button style="'.(empty($menu['style
']) ? '' : $menu['style
']).'" type="button" id="action
'.$i.'" class="actionbutton
'.(empty($menu['class']) ? '' : ' '.dol_escape_htmltag($menu['class'])).'" onclick="'.(empty($menu['action
']) ? '' : $menu['action
']).'">'.$menu['title'].'</button>';
1779 if (getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR') && !getDolGlobalString('TAKEPOS_HIDE_SEARCH')) {
1780 print '<!-- Show the search input text -->'."\n
";
1781 print '<div class="margintoponly
">';
1782 print '<input type="text
" id="search
" class="input-search-takepos 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> ';
1783 print '<a class="marginleftonly hideonsmartphone
" onclick="ClearSearch(
false);
">'.img_picto('', 'searchclear.png').'</a>';
1794 <!-- Show categories -->
1796 if (getDolGlobalInt('TAKEPOS_HIDE_CATEGORIES') == 1) {
1797 print '<div class="div4
" style= "display: none;
">';
1799 print '<div class="div4
">';
1803 while ($count < $MAXCATEG) {
1805 <div class="wrapper
" <?php if ($count == ($MAXCATEG - 2)) {
1806 echo 'onclick="MoreCategories(\
'less\')"';
1807 } elseif ($count == ($MAXCATEG - 1)) {
1808 echo
'onclick="MoreCategories(\'more\')"';
1810 echo
'onclick="LoadProducts('.$count.
')"';
1811 } ?>
id=
"catdiv<?php echo $count; ?>">
1813 if ($count == ($MAXCATEG - 2)) {
1815 echo
'<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1816 } elseif ($count == ($MAXCATEG - 1)) {
1818 echo
'<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1821 echo
'<img class="imgwrapper" id="catimg'.$count.
'" />';
1824 <?php
if ($count != $MAXCATEG - 2 && $count != $MAXCATEG - 1) { ?>
1825 <div
class=
"description" id=
"catdivdesc<?php echo $count; ?>">
1826 <div
class=
"description_content" id=
"catdesc<?php echo $count; ?>"></div>
1829 <div
class=
"catwatermark" id=
'catwatermark<?php echo $count; ?>'>...</div>
1837 <!-- Show product -->
1838 <div
class=
"div5<?php if (getDolGlobalInt('TAKEPOS_HIDE_CATEGORIES') == 1) {
1839 print ' centpercent';
1844 while ($count < $MAXPRODUCT) {
1845 print
'<div class="wrapper2'.(($count >= ($MAXPRODUCT - 2)) ?
' arrow' :
'').
'" id="prodiv'.$count.
'" '; ?>
1846 <?php
if ($count == ($MAXPRODUCT - 2)) {
1847 ?> onclick=
"MoreProducts('less')" <?php
1849 if ($count == ($MAXPRODUCT - 1)) {
1850 ?> onclick=
"MoreProducts('more')" <?php
1852 echo
'onclick="ClickProduct('.((int) $count).
')"';
1855 if ($count == ($MAXPRODUCT - 2)) {
1857 print
'<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1858 } elseif ($count == ($MAXPRODUCT - 1)) {
1860 print
'<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1863 print
'<div class="" id="proprice'.$count.
'"></div>';
1866 print
'<button type="button" id="probutton'.$count.
'" class="productbutton" style="display: none;"></button>';
1868 print
'<img class="imgwrapper" title="" id="proimg'.$count.
'">';
1871 <?php
if ($count != $MAXPRODUCT - 2 && $count != $MAXPRODUCT - 1 && !
getDolGlobalString(
'TAKEPOS_HIDE_PRODUCT_IMAGES')) { ?>
1872 <div
class=
"description" id=
"prodivdesc<?php echo $count; ?>">
1873 <div
class=
"description_content" id=
"prodesc<?php echo $count; ?>"></div>
1876 <div
class=
"catwatermark" id=
'prowatermark<?php echo $count; ?>'>...</div>
1882 <input
type=
"hidden" id=
"search_start_less" value=
"0">
1883 <input
type=
"hidden" id=
"search_start_more" value=
"0">
1884 <input
type=
"hidden" id=
"search_pagination" value=
"">
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Class to manage categories.
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
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)
dol_now($mode='gmt')
Return date for now.
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.
dolSetCookie(string $cookiename, string $cookievalue, int $expire=-1)
Set a cookie.
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 the value of a given key, which produces ascending (default) or descending out...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
multi select button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.
top_menu_user($hideloginname=0, $urllogout='')
Build the tooltip on user login.
$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, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.
if(empty( $takeposterminal)) fail($message)
Abort invoice creation with a given error message.
takeposEnabledTerminals()
Return the list of the TakePOS terminals that can be used.