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); ?>;
192var currentsubcategories=[];
195var place=
"<?php echo $place; ?>";
199var search2_timer=
null;
218function ClearSearch(clearSearchResults) {
219 console.log(
"ClearSearch");
220 $(
"#search").val(
'');
221 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
222 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
223 $(
"#reduction").html(
"<?php echo $langs->trans("LineDiscountShort
"); ?>").removeClass(
'clicked');
224 <?php
if (
$conf->browser->layout ==
'classic') { ?>
225 setFocusOnSearchField();
227 if (clearSearchResults) {
228 $(
"#search").trigger(
'keyup');
233function setFocusOnSearchField() {
234 console.log(
"Call setFocusOnSearchField in page index.php");
235 <?php
if (
$conf->browser->layout ==
'classic') { ?>
236 console.log(
"has keyboard from localStorage, so we can force focus on search field");
237 $(
"#search").focus();
241function PrintCategories(first) {
242 console.log(
"PrintCategories");
243 for (i = 0; i < <?php echo($MAXCATEG - 2); ?>; i++) {
244 if (typeof (categories[parseInt(i)+parseInt(first)]) ==
"undefined")
246 $(
"#catdivdesc"+i).hide();
247 $(
"#catdesc"+i).text(
"");
248 $(
"#catimg"+i).attr(
"src",
"genimg/empty.png");
249 $(
"#catwatermark"+i).hide();
250 $(
"#catdiv"+i).attr(
'class',
'wrapper divempty');
253 $(
"#catdivdesc"+i).show();
256 $(
"#catdesc"+i).html(categories[parseInt(i)+parseInt(first)][
'label'].bold() +
' - ' + categories[parseInt(i)+parseInt(first)][
'description']);
258 $(
"#catdesc"+i).text(categories[parseInt(i)+parseInt(first)][
'label']);
260 $(
"#catimg"+i).attr(
"src",
"genimg/index.php?query=cat&id="+categories[parseInt(i)+parseInt(first)][
'rowid']);
261 $(
"#catdiv"+i).data(
"rowid",categories[parseInt(i)+parseInt(first)][
'rowid']);
262 $(
"#catdiv"+i).attr(
"data-rowid",categories[parseInt(i)+parseInt(first)][
'rowid']);
263 $(
"#catdiv"+i).attr(
'class',
'wrapper');
264 $(
"#catwatermark"+i).show();
268function MoreCategories(moreorless) {
269 console.log(
"MoreCategories moreorless="+moreorless+
" pagecategories="+pagecategories);
270 if (moreorless ==
"more") {
271 $(
'#catimg15').animate({opacity:
'0.5'}, 1);
272 $(
'#catimg15').animate({opacity:
'1'}, 100);
273 pagecategories=pagecategories+1;
275 if (moreorless ==
"less") {
276 $(
'#catimg14').animate({opacity:
'0.5'}, 1);
277 $(
'#catimg14').animate({opacity:
'1'}, 100);
278 if (pagecategories==0)
return;
279 pagecategories=pagecategories-1;
281 if (typeof (categories[<?php echo($MAXCATEG - 2); ?> * pagecategories] && moreorless ==
"more") ==
"undefined") {
282 pagecategories=pagecategories-1;
286 for (i = 0; i < <?php echo($MAXCATEG - 2); ?>; i++) {
287 if (typeof (categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)]) ==
"undefined") {
289 console.log(
"complete with empty record");
290 $(
"#catdivdesc"+i).hide();
291 $(
"#catdesc"+i).text(
"");
292 $(
"#catimg"+i).attr(
"src",
"genimg/empty.png");
293 $(
"#catwatermark"+i).hide();
296 $(
"#catdivdesc"+i).show();
299 $(
"#catdesc"+i).html(categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)][
'label'].bold() +
' - ' + categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)][
'description']);
301 $(
"#catdesc"+i).text(categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)][
'label']);
303 $(
"#catimg"+i).attr(
"src",
"genimg/index.php?query=cat&id="+categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)][
'rowid']);
304 $(
"#catdiv"+i).data(
"rowid",categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)][
'rowid']);
305 $(
"#catdiv"+i).attr(
"data-rowid",categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)][
'rowid']);
306 $(
"#catwatermark"+i).show();
313function PrintSubCategory(ishow, val) {
314 $(
"#prodivdesc"+ishow).show();
316 $(
"#prodesc"+ishow).html(val.label.bold() +
' - ' + val.description);
317 $(
"#probutton"+ishow).html(val.label);
319 $(
"#prodesc"+ishow).text(val.label);
320 $(
"#probutton"+ishow).text(val.label);
322 $(
"#probutton"+ishow).show();
323 $(
"#proprice"+ishow).attr(
"class",
"hidden");
324 $(
"#proprice"+ishow).html(
"");
325 $(
"#proimg"+ishow).attr(
"src",
"genimg/index.php?query=cat&id="+val.rowid);
326 $(
"#prodiv"+ishow).data(
"rowid",val.rowid);
327 $(
"#prodiv"+ishow).attr(
"data-rowid",val.rowid);
328 $(
"#prodiv"+ishow).data(
"iscat", 1);
329 $(
"#prodiv"+ishow).attr(
"data-iscat", 1);
330 $(
"#prodiv"+ishow).removeClass(
"divempty");
331 $(
"#prowatermark"+ishow).show();
335function LoadProducts(
position, issubcat) {
336 console.log(
"LoadProducts position="+
position+
" issubcat="+issubcat);
337 var maxproduct = <?php echo (
int) ($MAXPRODUCT - 2); ?>;
340 currentcat =
"supplements";
342 if (subcategories.count == 0) {
343 alert(
"No product found into categories level 2 or more");
346 $(
'#catimg'+
position).animate({opacity:
'0.5'}, 1);
347 $(
'#catimg'+
position).animate({opacity:
'1'}, 100);
348 if (issubcat ==
true) {
349 currentcat = $(
'#prodiv'+
position).data(
'rowid');
352 currentcat = $(
'#catdiv'+
position).data(
'rowid');
353 console.log(
"currentcat="+currentcat);
356 if (currentcat == undefined) {
363 var parent_cat_label = <?php echo
"'".dol_escape_js($langs->trans(
'GoBack')).
"'" ; ?>;
364 currentsubcategories = [];
365 if (currentcat !=
"supplements") {
366 jQuery.each(subcategories,
function(i, val) {
367 if (val.rowid == currentcat) {
368 parent_cat = val.fk_parent;
373 if (parent_cat > 0) {
375 jQuery.each(categories,
function(i, val) {
376 if (val.rowid == parent_cat) {
377 parent_cat_label = val.label;
383 jQuery.each(subcategories,
function(i, val) {
384 if (val.rowid == parent_cat) {
385 parent_cat_label = val.label;
391 $(
"#prodivdesc"+ishow).show();
392 var back_html =
'<span class="fa fa-chevron-left paddingright"></span> ' + parent_cat_label;
395 $(
"#prodesc"+ishow).html(
'<strong>' + back_html +
'</strong>');
397 $(
"#prodesc"+ishow).html(back_html);
399 $(
"#probutton"+ishow).html(back_html);
401 $(
"#probutton"+ishow).show();
402 $(
"#proprice"+ishow).attr(
"class",
"hidden");
403 $(
"#proprice"+ishow).html(
"");
405 $(
"#proimg"+ishow).attr(
"src",
"img/back.png");
407 $(
"#prodiv"+ishow).data(
"rowid", parent_cat);
408 $(
"#prodiv"+ishow).attr(
"data-rowid", parent_cat);
409 $(
"#prodiv"+ishow).data(
"iscat", 1);
410 $(
"#prodiv"+ishow).attr(
"data-iscat", 1);
411 $(
"#prodiv"+ishow).removeClass(
"divempty");
412 $(
"#prowatermark"+ishow).hide();
416 console.log(
"Loop on each category level 2 or more");
417 jQuery.each(subcategories,
function(i, val) {
418 if (currentcat == val.fk_parent) {
419 currentsubcategories.push(val);
425 while (isubcat < currentsubcategories.length && ishow < maxproduct) {
426 PrintSubCategory(ishow, currentsubcategories[isubcat]);
433 if (maxproduct >= 1) {
434 limit = maxproduct - 1;
438 let socid = jQuery(
'#thirdpartyid').val();
439 if ((socid === undefined || socid ===
"") && parseInt(<?php echo
"'".
dol_escape_js($socid).
"'"; ?>) > 0) {
440 socid = parseInt(<?php echo
"'".
dol_escape_js($socid).
"'" ; ?>);
444 $.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) {
446 console.log(
"Call ajax.php (in LoadProducts) to get Products of category "+currentcat+
" then loop on result to fill image thumbs");
447 console.log(
"Found "+data.length+
" record");
449 if (data.length == 0 && currentcat ==
"supplements") {
450 alert(
"No supplements found into the supplement category. Check the module setup and your product categories.");
453 while (ishow < maxproduct) {
454 console.log(
"ishow"+ishow+
" idata="+idata);
455 console.log(data[idata]);
457 if (typeof (data[idata]) ==
"undefined") {
459 echo
'$("#prodivdesc"+ishow).hide();';
460 echo
'$("#prodesc"+ishow).text("");';
461 echo
'$("#proimg"+ishow).attr("title","");';
462 echo
'$("#proimg"+ishow).attr("src","genimg/empty.png");';
464 echo
'$("#probutton"+ishow).hide();';
465 echo
'$("#probutton"+ishow).text("");';
467 $(
"#proprice"+ishow).attr(
"class",
"hidden");
468 $(
"#proprice"+ishow).html(
"");
470 $(
"#prodiv"+ishow).data(
"rowid",
"");
471 $(
"#prodiv"+ishow).attr(
"data-rowid",
"");
473 $(
"#prodiv"+ishow).data(
"iscat",
"0");
474 $(
"#prodiv"+ishow).attr(
"data-iscat",
"0");
476 $(
"#prodiv"+ishow).attr(
"class",
"wrapper2 divempty");
479 $titlestring =
"'".dol_escape_js($langs->transnoentities(
'Ref').
': ').
"' + data[idata]['ref']";
480 $titlestring .=
" + ' - ".dol_escape_js($langs->trans(
"Barcode").
': ').
"' + data[idata]['barcode']";
482 var titlestring = <?php echo $titlestring; ?>;
484 echo
'$("#prodivdesc"+ishow).show();';
486 echo
'$("#prodesc"+ishow).html(data[parseInt(idata)][\'ref\'].bold() + \' - \' + data[parseInt(idata)][\'label\']);';
488 echo
'$("#prodesc"+ishow).html(data[parseInt(idata)][\'ref\'].bold());';
490 echo
'$("#prodesc"+ishow).html(data[parseInt(idata)][\'label\']);';
492 echo
'$("#proimg"+ishow).attr("title", titlestring);';
493 echo
'$("#proimg"+ishow).attr("src", "genimg/index.php?query=pro&id="+data[idata][\'id\']);';
495 echo
'$("#probutton"+ishow).show();';
496 echo
'$("#probutton"+ishow).html(data[parseInt(idata)][\'label\']);';
499 if (data[parseInt(idata)][
'price_formated']) {
500 $(
"#proprice" + ishow).attr(
"class",
"productprice");
504 $(
"#proprice" + ishow).html(data[parseInt(idata)][
'price_formated']);
508 $(
"#proprice" + ishow).html(data[parseInt(idata)][
'price_ttc_formated']);
513 console.log(
"#prodiv"+ishow+
".data(rowid)="+data[idata][
'id']);
515 $(
"#prodiv"+ishow).data(
"rowid", data[idata][
'id']);
516 $(
"#prodiv"+ishow).attr(
"data-rowid", data[idata][
'id']);
517 console.log($(
'#prodiv4').data(
'rowid'));
519 $(
"#prodiv"+ishow).data(
"iscat", 0);
520 $(
"#prodiv"+ishow).attr(
"data-iscat", 0);
522 $(
"#prodiv"+ishow).attr(
"class",
"wrapper2");
526 $parameters = array();
527 $parameters[
'caller'] =
'loadProducts';
528 $hookmanager->executeHooks(
'completeJSProductDisplay', $parameters);
529 print $hookmanager->resPrint;
532 $(
"#prowatermark"+ishow).hide();
541function MoreProducts(moreorless) {
542 console.log(
"MoreProducts");
544 if ($(
'#search_pagination').val() !=
'') {
545 return Search2(
'<?php echo(isset($keyCodeForEnter) ? $keyCodeForEnter : ''); ?>', moreorless);
548 var maxproduct = <?php echo($MAXPRODUCT - 2); ?>;
550 if (moreorless==
"more"){
551 $(
'#proimg31').animate({opacity:
'0.5'}, 1);
552 $(
'#proimg31').animate({opacity:
'1'}, 100);
553 pageproducts=pageproducts+1;
555 if (moreorless==
"less"){
556 $(
'#proimg30').animate({opacity:
'0.5'}, 1);
557 $(
'#proimg30').animate({opacity:
'1'}, 100);
558 if (pageproducts==0)
return;
559 pageproducts=pageproducts-1;
565 if (maxproduct >= 1) {
566 limit = maxproduct-1;
570 var first = maxproduct * pageproducts;
571 var offset = Math.max(0, first - currentsubcategories.length);
574 let socid = jQuery(
'#thirdpartyid').val();
575 if ((socid === undefined || socid ===
"") && parseInt(<?php echo
"'".
dol_escape_js($socid).
"'"; ?>) > 0) {
576 socid = parseInt(<?php echo
"'".
dol_escape_js($socid).
"'" ; ?>);
580 $.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) {
581 console.log(
"Call ajax.php (in MoreProducts) to get Products of category "+currentcat);
583 if (typeof (data[0]) ==
"undefined" && first >= currentsubcategories.length && moreorless==
"more"){
584 pageproducts=pageproducts-1;
588 while (ishow < maxproduct && first + ishow < currentsubcategories.length) {
589 PrintSubCategory(ishow, currentsubcategories[first + ishow]);
593 while (ishow < maxproduct) {
594 if (typeof (data[idata]) ==
"undefined") {
595 $(
"#prodivdesc"+ishow).hide();
596 $(
"#prodesc"+ishow).text(
"");
597 $(
"#probutton"+ishow).text(
"");
598 $(
"#probutton"+ishow).hide();
599 $(
"#proprice"+ishow).attr(
"class",
"");
600 $(
"#proprice"+ishow).html(
"");
601 $(
"#proimg"+ishow).attr(
"src",
"genimg/empty.png");
602 $(
"#prodiv"+ishow).data(
"rowid",
"");
603 $(
"#prodiv"+ishow).attr(
"data-rowid",
"");
604 $(
"#prodiv"+ishow).addClass(
"divempty");
605 $(
"#prodiv"+ishow).data(
"iscat",0);
606 $(
"#prodiv"+ishow).attr(
"data-iscat",0);
608 $(
"#prodivdesc"+ishow).show();
609 $(
"#prodiv"+ishow).removeClass(
"divempty");
611 $(
"#prodesc"+ishow).html(data[parseInt(idata)][
'ref'].bold() +
' - ' + data[parseInt(idata)][
'label']);
612 <?php } elseif (
getDolGlobalInt(
'TAKEPOS_SHOW_PRODUCT_REFERENCE') == 2) { ?>
613 $(
"#prodesc"+ishow).html(data[parseInt(idata)][
'ref'].bold());
615 $(
"#prodesc"+ishow).html(data[parseInt(idata)][
'label']);
617 $(
"#probutton"+ishow).html(data[parseInt(idata)][
'label']);
618 $(
"#probutton"+ishow).show();
619 if (data[parseInt(idata)][
'price_formated']) {
620 $(
"#proprice" + ishow).attr(
"class",
"productprice");
624 $(
"#proprice" + ishow).html(data[parseInt(idata)][
'price_formated']);
628 $(
"#proprice" + ishow).html(data[parseInt(idata)][
'price_ttc_formated']);
633 $(
"#proimg"+ishow).attr(
"src",
"genimg/index.php?query=pro&id="+data[idata][
'id']);
634 $(
"#prodiv"+ishow).data(
"rowid",data[idata][
'id']);
635 $(
"#prodiv"+ishow).attr(
"data-rowid",data[idata][
'id']);
636 $(
"#prodiv"+ishow).data(
"iscat",0);
637 $(
"#prodiv"+ishow).attr(
"data-iscat",0);
639 $(
"#prowatermark"+ishow).hide();
648function ClickProduct(
position, qty = 1, qty_std = 0) {
649 console.log(
"ClickProduct at position"+
position);
650 if ($(
'#invoiceid').val() ==
"") {
651 invoiceid = $(
'#invoiceid').val();
654 $(
'#proimg'+
position).animate({opacity:
'0.5'}, 1);
655 $(
'#proimg'+
position).animate({opacity:
'1'}, 100);
656 if ($(
'#prodiv'+
position).data(
'iscat') == 1){
657 console.log(
"Click on a category at position "+
position);
661 invoiceid = $(
"#invoiceid").val();
662 idproduct=$(
'#prodiv'+
position).data(
'rowid');
663 console.log(
"Click on product at position "+
position+
" for idproduct "+idproduct+
", qty="+qty+
" invoiceid="+invoiceid);
664 if (idproduct ==
"") {
668 addInvoiceLine =
function(qty, qty_std_inner = 0) {
670 $(
"#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() {
673 echo
"CustomerDisplay();";
680 if ($(
'#prodiv'+
position).data(
'unit') == 2) {
681 WeighingScale(addInvoiceLine);
683 addInvoiceLine(qty, qty_std);
686 addInvoiceLine(qty, qty_std);
693function ChangeThirdparty(idcustomer) {
694 console.log(
"ChangeThirdparty");
696 $(
"#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() {
702function deleteline() {
703 if (selectedline == 0)
return;
704 invoiceid = $(
"#invoiceid").val();
705 console.log(
"Delete line invoiceid="+invoiceid);
706 $(
"#poslines").load(
"invoice.php?action=deleteline&token=<?php echo currentToken(); ?>&place="+place+
"&idline="+selectedline+
"&invoiceid="+invoiceid,
function() {
712function editbatch(lineid, idproduct, clonebatch) {
713 $(
"#poslines").load(
"invoice.php?action=editbatch_popup&token=<?php echo newToken(); ?>&place="+place+
"&idline="+lineid+
"&idproduct="+idproduct+
"&invoiceid="+invoiceid+(clonebatch ?
'&clonebatch=1' :
''), function() {});
716function updatebatch(batch, warehouseid, lineid, clonebatch) {
717 $(
"#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() {});
721 console.log(
"Open box to select the thirdparty place="+place);
722 $.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
"); ?>"});
726 console.log(
"Open box to select the contact place="+place);
727 $.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"); ?>"});
732 console.log(
"Open box to select the history");
733 $.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
"); ?>"});
736function CloneTicket(sourceinvoiceid) {
737 if (!sourceinvoiceid) {
738 sourceinvoiceid = invoiceid;
740 if (!sourceinvoiceid) {
743 $.getJSON(
"<?php print DOL_URL_ROOT; ?>/takepos/invoice.php?action=cloneticket&format=json&token=<?php echo currentToken(); ?>&sourceinvoiceid="+sourceinvoiceid)
744 .done(
function(data) {
746 alert(data.message || <?php echo
"'".dol_escape_js($langs->trans(
'ErrorFailedToCloneTicket')).
"'"; ?>);
751 invoiceid = data.invoiceid;
752 if (data.batchlineid > 0) {
753 editbatch(data.batchlineid, data.batchproductid, 1);
755 $(
"#poslines").load(
"invoice.php?place="+place+
"&invoiceid="+invoiceid,
function() {});
759 alert(<?php echo
"'".
dol_escape_js($langs->trans(
'ErrorFailedToCloneTicket')).
"'"; ?>);
764function Reduction() {
765 invoiceid = $(
"#invoiceid").val();
766 console.log(
"Open popup to enter reduction on invoiceid="+invoiceid);
767 $.colorbox({href:
"reduction.php?place="+place+
"&invoiceid="+invoiceid, width:
"80%", height:
"90%", transition:
"none", iframe:
"true", title:
""});
770function CreditList() {
771 invoiceid = $(
"#invoiceid").val();
772 console.log(
"Open popup to manage customer credits for invoiceid="+invoiceid);
774 href:
"creditnote_apply.php?place="+place+
"&invoiceid="+invoiceid+
"&token=<?php echo currentToken(); ?>",
779 title: <?php echo
"'".dol_escape_js($langs->trans(
'TakeposManageCredits')).
"'"; ?>
783var closeBillParams=
"";
784function CloseBill() {
786 $parameters = array();
787 $reshook = $hookmanager->executeHooks(
'paramsForCloseBill', $parameters, $obj, $action);
789 echo
"customerAnchorTag = document.querySelector('a[id=\"customer\"]'); ";
790 echo
"if (customerAnchorTag && customerAnchorTag.innerText.trim() === '".$langs->trans(
"Customer").
"') { ";
791 echo
"alert('".dol_escape_js($langs->trans(
"NoClientErrorMessage")).
"'); ";
795 invoiceid = $(
"#invoiceid").val();
796 console.log(
"Open popup to enter payment on invoiceid="+invoiceid);
798 if ($(
"#idcustomer").val() ==
"") {
799 alert(
"<?php echo $langs->trans('TakePosCustomerMandatory'); ?>");
810 if (empty($alternative_payurl)) {
816 $.colorbox({href:
"<?php echo $payurl; ?>?place="+place+
"&invoiceid="+invoiceid+closeBillParams, width:
"80%", height:
"90%", transition:
"none", iframe:
"true", title:
""});
820 invoiceid = $(
"#invoiceid").val();
821 console.log(
"Open popup to split on invoiceid="+invoiceid);
822 $.colorbox({href:
"split.php?place="+place+
"&invoiceid="+invoiceid, width:
"80%", height:
"90%", transition:
"none", iframe:
"true", title:
""});
826 console.log(
"Open box to select floor place="+place);
827 $.colorbox({href:
"floors.php?place="+place, width:
"90%", height:
"90%", transition:
"none", iframe:
"true", title:
"<?php echo $langs->trans("Floors
"); ?>"});
831 invoiceid = $(
"#invoiceid").val();
832 console.log(
"Open box to enter a free product on invoiceid="+invoiceid);
833 $.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
"); ?>"});
836function TakeposOrderNotes() {
837 console.log(
"Open box to order notes");
838 ModalBox(
'ModalNote');
839 $(
"#textinput").focus();
843 console.log(
"Refresh by reloading place="+place+
" invoiceid="+invoiceid);
844 $(
"#poslines").load(
"invoice.php?place="+place+
"&invoiceid="+invoiceid,
function() {
851 invoiceid = $(
"#invoiceid").val();
853 console.log(
"New with place = <?php echo $place; ?>, js place="+place+
", invoiceid="+invoiceid);
855 if (invoiceid ==
'') {
856 $(
"#poslines").load(
"invoice.php?action=delete&token=<?php echo currentToken(); ?>&place=" + place,
function () {
861 $(
"#idcustomer").val(
"");
865 $.getJSON(
'<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getInvoice&token=<?php echo currentToken();?>&id='+invoiceid,
function(data) {
868 if (parseInt(data[
'paye']) === 1) {
871 r = confirm(
'<?php echo($place > 0 ? $langs->transnoentitiesnoconv("ConfirmDeletionOfThisPOSSale") : $langs->transnoentitiesnoconv("ConfirmDiscardOfThisPOSSale")); ?>');
876 $(
"#poslines").load(
"invoice.php?action=delete&token=<?php echo currentToken(); ?>&place=" + place,
function () {
881 $(
"#idcustomer").val(
"");
890function DeleteSale() {
891 if (typeof place ===
'undefined') {
894 if (confirm(<?php echo
"'".
dol_escape_js($langs->transnoentitiesnoconv(
"ConfirmDeletionOfThisPOSSale")).
"'" ; ?>)) {
896 $(
"#poslines").load(
"invoice.php?action=discardsale&token=<?php echo newToken(); ?>&place=" + place,
function () {
900 $(
"#idcustomer").val(
"");
913function Search2(keyCodeForEnter, moreorless) {
914 var eventKeyCode =
null;
916 if (window.event && window.event.keyCode) {
917 eventKeyCode = window.event.keyCode;
919 if (eventKeyCode ===
null && keyCodeForEnter !==
'') {
924 console.log(
"Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter+
", eventKeyCode="+eventKeyCode);
926 var search_term = $(
'#search').val();
927 var search_start = 0;
928 var search_limit = <?php echo $MAXPRODUCT - 2; ?>;
929 if (moreorless !=
null) {
930 search_term = $(
'#search_pagination').val();
931 search_start = $(
'#search_start_'+moreorless).val();
934 console.log(
"search_term="+search_term);
936 if (search_term ==
'') {
937 $(
"[id^=prowatermark]").html(
"");
938 $(
"[id^=prodesc]").text(
"");
939 $(
"[id^=probutton]").text(
"");
940 $(
"[id^=probutton]").hide();
941 $(
"[id^=proprice]").attr(
"class",
"hidden");
942 $(
"[id^=proprice]").html(
"");
943 $(
"[id^=proimg]").attr(
"src",
"genimg/empty.png");
944 $(
"[id^=prodiv]").data(
"rowid",
"");
945 $(
"[id^=prodiv]").attr(
"data-rowid",
"");
946 $(
"[id^=prodiv]").addClass(
"divempty");
951 if (keyCodeForEnter ==
'' || eventKeyCode == keyCodeForEnter) {
955 if (search ===
true) {
959 clearTimeout(search2_timer);
963 search2_timer = setTimeout(
function(){
965 jQuery(
".wrapper2 .catwatermark").hide();
966 var nbsearchresults = 0;
969 let socid = jQuery(
'#thirdpartyid').val();
970 if ((socid === undefined || socid ===
"") && parseInt(<?php echo
"'".
dol_escape_js($socid).
"'"; ?>) > 0) {
971 socid = parseInt(<?php echo
"'".
dol_escape_js($socid).
"'" ; ?>);
974 $.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) {
975 for (i = 0; i < <?php echo ($MAXPRODUCT - 2); ?>; i++) {
976 if (typeof (data[i]) ==
"undefined") {
977 $(
"#prowatermark" + i).html(
"");
978 $(
"#prodesc" + i).text(
"");
979 $(
"#probutton" + i).text(
"");
980 $(
"#probutton" + i).hide();
981 $(
"#proprice" + i).attr(
"class",
"hidden");
982 $(
"#proprice" + i).html(
"");
983 $(
"#proimg" + i).attr(
"src",
"genimg/empty.png");
984 $(
"#prodiv" + i).data(
"rowid",
"");
985 $(
"#prodiv" + i).attr(
"data-rowid",
"");
989 $titlestring =
"'".dol_escape_js($langs->transnoentities(
'Ref').
': ').
"' + data[i]['ref']";
990 $titlestring .=
" + ' - ".dol_escape_js($langs->trans(
"Barcode").
': ').
"' + data[i]['barcode']";
992 var titlestring = <?php echo $titlestring; ?>;
994 $(
"#prodesc" + i).html(data[i][
'ref'].bold() +
' - ' + data[i][
'label']);
995 <?php } elseif (
getDolGlobalInt(
'TAKEPOS_SHOW_PRODUCT_REFERENCE') == 2) { ?>
996 $(
"#prodesc" + i).html(data[i][
'ref'].bold());
998 $(
"#prodesc" + i).html(data[i][
'label']);
1000 $(
"#prodivdesc" + i).show();
1001 $(
"#prodiv" + i).removeClass(
"divempty");
1002 $(
"#probutton" + i).html(data[i][
'label']);
1003 $(
"#probutton" + i).show();
1004 if (data[i][
'price_formated']) {
1005 $(
"#proprice" + i).attr(
"class",
"productprice");
1009 $(
"#proprice" + i).html(data[i][
'price_formated']);
1013 $(
"#proprice" + i).html(data[i][
'price_ttc_formated']);
1018 $(
"#proimg" + i).attr(
"title", titlestring);
1019 if( undefined !== data[i][
'img']) {
1020 $(
"#proimg" + i).attr(
"src", data[i][
'img']);
1023 $(
"#proimg" + i).attr(
"src",
"genimg/index.php?query=pro&id=" + data[i][
'rowid']);
1025 $(
"#prodiv" + i).data(
"rowid", data[i][
'rowid']);
1026 $(
"#prodiv" + i).attr(
"data-rowid", data[i][
'rowid']);
1027 $(
"#prodiv" + i).data(
"iscat", 0);
1028 $(
"#prodiv" + i).attr(
"data-iscat", 0);
1032 $parameters = array();
1033 $parameters[
'caller'] =
'search2';
1034 $hookmanager->executeHooks(
'completeJSProductDisplay', $parameters);
1035 print $hookmanager->resPrint;
1040 }).always(
function (data) {
1042 if ($(
'#search').val().length > 0 && data.length == 1) {
1043 console.log($(
'#search').val()+
' - '+data[0][
'barcode']);
1044 if ($(
'#search').val() == data[0][
'barcode'] &&
'thirdparty' == data[0][
'object']) {
1045 console.log(
"There is only 1 answer with barcode matching the search, so we change the thirdparty "+data[0][
'rowid']);
1046 ChangeThirdparty(data[0][
'rowid']);
1048 else if (
'product' == data[0][
'object'] && $(
'#search').val() == data[0][
'barcode']) {
1049 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']);
1050 ClickProduct(0, data[0][
'qty'], 1);
1053 if (eventKeyCode == keyCodeForEnter){
1054 if (data.length == 0) {
1055 $(
'#search').val(<?php
1056 $langs->load(
'errors');
1057 echo
"'".dol_escape_js($langs->transnoentitiesnoconv(
"ErrorRecordNotFoundShort")).
" ('";
1058 ?>+search_term+
')');
1059 $(
'#search').select();
1061 else ClearSearch(
false);
1064 $(
"#search_pagination").val($(
"#search").val());
1065 if (search_start == 0) {
1066 $(
"#prodiv<?php echo $MAXPRODUCT - 2; ?> span").hide();
1069 $(
"#prodiv<?php echo $MAXPRODUCT - 2; ?> span").show();
1070 var search_start_less = Math.max(0, parseInt(search_start) - parseInt(<?php echo $MAXPRODUCT - 2;?>));
1071 $(
"#search_start_less").val(search_start_less);
1073 if (nbsearchresults != <?php echo $MAXPRODUCT - 2; ?>) {
1074 $(
"#prodiv<?php echo $MAXPRODUCT - 1; ?> span").hide();
1077 $(
"#prodiv<?php echo $MAXPRODUCT - 1; ?> span").show();
1078 var search_start_more = parseInt(search_start) + parseInt(<?php echo $MAXPRODUCT - 2;?>);
1079 $(
"#search_start_more").val(search_start_more);
1088function Edit(number) {
1089 console.log(
"We click on PAD on key="+number);
1091 invoiceid = $(
"#invoiceid").val();
1093 if (typeof(selectedtext) ==
"undefined") {
1097 var text=selectedtext+
"<br> ";
1103 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
1104 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
1105 $(
"#reduction").html(
"<?php echo $langs->trans("LineDiscountShort
"); ?>").removeClass(
'clicked');
1107 }
else if (number==
'qty') {
1108 if (editaction==
'qty' && editnumber !=
'') {
1109 $(
"#poslines").load(
"invoice.php?action=updateqty&token=<?php echo currentToken(); ?>&place="+place+
"&idline="+selectedline+
"&number="+editnumber+
"&invoiceid="+invoiceid,
function() {
1112 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
1115 setFocusOnSearchField();
1121 }
else if (number==
'p') {
1122 if (editaction==
'p' && editnumber!=
"") {
1123 $(
"#poslines").load(
"invoice.php?action=updateprice&token=<?php echo currentToken(); ?>&place="+place+
"&idline="+selectedline+
"&number="+editnumber+
"&invoiceid="+invoiceid,
function() {
1126 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
1135 }
else if (number==
'r') {
1136 if (editaction==
'r' && editnumber!=
"") {
1137 $(
"#poslines").load(
"invoice.php?action=updatereduction&token=<?php echo currentToken(); ?>&place="+place+
"&idline="+selectedline+
"&number="+editnumber+
"&invoiceid="+invoiceid,
function() {
1140 $(
"#reduction").html(
"<?php echo $langs->trans("LineDiscountShort
"); ?>").removeClass(
'clicked');
1151 editnumber=editnumber+number;
1153 if (editaction==
'qty'){
1154 text=text+
"<?php echo $langs->trans("Modify
")." ->
".$langs->trans("Qty
").":
"; ?>";
1155 $(
"#qty").html(
"OK").addClass(
"clicked");
1156 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
1157 $(
"#reduction").html(
"<?php echo $langs->trans("LineDiscountShort
"); ?>").removeClass(
'clicked');
1159 if (editaction==
'p'){
1160 text=text+
"<?php echo $langs->trans("Modify
")." ->
".$langs->trans("Price
").":
"; ?>";
1161 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
1162 $(
"#price").html(
"OK").addClass(
"clicked");
1163 $(
"#reduction").html(
"<?php echo $langs->trans("LineDiscountShort
"); ?>").removeClass(
'clicked');
1165 if (editaction==
'r'){
1166 text=text+
"<?php echo $langs->trans("Modify
")." ->
".$langs->trans("LineDiscountShort
").":
"; ?>";
1167 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
1168 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
1169 $(
"#reduction").html(
"OK").addClass(
"clicked");
1171 $(
'#'+selectedline).find(
"td:first").html(text+editnumber);
1175function TakeposPrintingOrder(){
1176 console.log(
"TakeposPrintingOrder output invoice to print order");
1177 $(
"#poslines").load(
"invoice.php?action=order&token=<?php echo currentToken();?>&place="+place,
function() {
1182function OpenDrawer(){
1183 console.log(
"OpenDrawer call ajax url http://<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER'); ?>:8111/print");
1186 data: { token:
'notrequired' },
1188 if (
getDolGlobalString(
'TAKEPOS_PRINT_SERVER') && filter_var(
$conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) ==
true) {
1189 echo
"url: '".getDolGlobalString(
'TAKEPOS_PRINT_SERVER',
'localhost').
"/printer/drawer.php',";
1191 echo
"url: 'http://".getDolGlobalString(
'TAKEPOS_PRINT_SERVER',
'localhost').
":8111/print',";
1199function DolibarrOpenDrawer() {
1200 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
"]); ?>");
1203 data: { token:
'<?php echo currentToken(); ?>' },
1204 url:
"<?php print DOL_URL_ROOT.'/takepos/ajax/ajax.php?action=opendrawer&token='.currentToken().'&term='.urlencode(empty($_SESSION["takeposterminal
"]) ? '' : $_SESSION["takeposterminal
"]); ?>",
1208function MoreActions(totalactions) {
1209 for (i = 0; i <= totalactions; i++) {
1210 $(
"#action" + i).toggle();
1212 $(
"#actionnext").toggle();
1213 $(
"#actionprevious").toggle();
1216function ControlCashOpening()
1218 $.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
"); ?>"});
1221function CloseCashFence(rowid)
1223 $.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
"); ?>"});
1226function CashReport(rowid)
1228 $.colorbox({href:
"../compta/cashcontrol/report.php?id="+rowid+
"&contextpage=takepos", width:
"60%", height:
"90%", transition:
"none", iframe:
"true", title:
"<?php echo $langs->trans("CashReport
"); ?>"});
1235function ModalBox(ModalID)
1237 var modal = document.getElementById(ModalID);
1238 modal.style.display =
"block";
1241function DirectPayment(){
1242 console.log(
"DirectPayment");
1243 $(
"#poslines").load(
"invoice.php?place="+place+
"&action=valid&token=<?php echo currentToken(); ?>&pay=LIQ",
function() {
1244 $(
'#invoiceid').val(
"");
1248function FullScreen() {
1249 document.documentElement.requestFullscreen();
1252function WeighingScale(callback) {
1253 console.log(
"Weighing Scale: invoiceid = " + placeid +
", lineid = " + selectedline);
1258 if (idproduct ==
"" && selectedline > 0) {
1259 urlProduct =
"<?php echo DOL_URL_ROOT; ?>/api/index.php/takeposconnector/invoices/" + placeid +
"/lines/" + selectedline +
"/product";
1261 urlProduct =
"<?php echo DOL_URL_ROOT; ?>/api/index.php/products/" + idproduct;
1265 headers: {
"DOLAPIKEY":
'<?php echo $user->api_key; ?>' },
1268 .done(
function(product) {
1269 if (callback === undefined) {
1270 callback =
function(qty) {
1271 $(
"#poslines").load(
"invoice.php?token=<?php echo currentToken(); ?>&action=updateqty&place="+place+
"&idline="+selectedline+
"&number="+qty);
1274 if (product.fk_unit ==
"2") {
1275 askForWeight(product.multiprices_ttc[1], callback, function (errorMessage) {
1276 console.log(
"Erreur: " + errorMessage);
1282 editnumber = globalWeight;
1283 $(
"#poslines").load(
"invoice.php?token=<?php echo currentToken(); ?>&action=updateqty&place="+place+
"&idline="+selectedline+
"&number="+editnumber,
function() {
1290 data: { token:
'notrequired' },
1291 url:
'<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER
'); ?>/scale/index.php',
1293 .done(
function( editnumber ) {
1294 $(
"#poslines").load(
"invoice.php?token=<?php echo currentToken(); ?>&action=updateqty&place="+place+
"&idline="+selectedline+
"&number="+editnumber,
function() {
1301$( document ).ready(
function() {
1307 if (empty($_SESSION[
"takeposterminal"]) || $_SESSION[
"takeposterminal"] ==
"") {
1308 print
"ModalBox('ModalTerminal');";
1311 if (
getDolGlobalString(
'TAKEPOS_CONTROL_CASH_OPENING') && !empty($_SESSION[
"takeposterminal"])) {
1316 $sql =
"SELECT rowid, status FROM ".MAIN_DB_PREFIX.
"pos_cash_fence WHERE";
1317 $sql .=
" entity = ".((int)
$conf->entity).
" AND ";
1318 $sql .=
" posnumber = ".((int) $_SESSION[
"takeposterminal"]).
" AND ";
1320 $resql = $db->query($sql);
1322 $obj = $db->fetch_object($resql);
1324 if (!isset($obj->rowid) || is_null($obj->rowid)) {
1325 print
"ControlCashOpening();";
1332 var elem1 = $(
"#topnav-left")[0];
1333 var elem2 = $(
"#topnav-right")[0];
1334 var checkOverflow =
function() {
1335 if (scrollBars().horizontal) $(
"#topnav").addClass(
"overflow");
1336 else $(
"#topnav").removeClass(
"overflow");
1339 var scrollBars =
function(){
1340 var container= $(
'#topnav')[0];
1342 vertical:container.scrollHeight > container.clientHeight,
1343 horizontal:container.scrollWidth > container.clientWidth
1347 $(window).resize(
function(){
1351 let resizeObserver =
new ResizeObserver(() => {
1354 resizeObserver.observe(elem1);
1355 resizeObserver.observe(elem2);
1358 var pressTimer = [];
1362 $(
".indicator").mousedown(
function(){
1363 direction = $(
this).hasClass(
"left") ? -1 : 1;
1365 pressTimer.push(setInterval(scrollTo, 100));
1368 $(
".indicator").mouseup(
function(){
1369 pressTimer.forEach(clearInterval);
1372 $(
"body").mouseup(
function(){
1373 pressTimer.forEach(clearInterval);
1374 console.log(
"body mouseup");
1377 function scrollTo(){
1378 console.log(
"here");
1379 var pos = $(
"#topnav").scrollLeft();
1380 document.getElementById(
"topnav").scrollTo({ left: $(
"#topnav").scrollLeft() + direction * step, behavior:
'smooth' })
1383 $(
"#topnav").scroll(
function(){
1384 if (($(
"#topnav").offsetWidth + $(
"#topnav").scrollLeft >= $(
"#topnav").scrollWidth)) {
1392<div
class=
"container">
1397 <div
class=
"header">
1398 <div
id=
"topnav" class=
"topnav">
1399 <div
id=
"topnav-left" class=
"topnav-left">
1400 <div
class=
"inline-block valignmiddle">
1401 <a
class=
"topnav-terminalhour" onclick=
"ModalBox('ModalTerminal')">
1402 <span
class=
"fa fa-cash-register"></span>
1403 <span
class=
"hideonsmartphone">
1405 if (!empty($_SESSION[
"takeposterminal"])) {
1406 echo
getDolGlobalString(
"TAKEPOS_TERMINAL_NAME_".$_SESSION[
"takeposterminal"], $langs->trans(
"TerminalName", $_SESSION[
"takeposterminal"]));
1411 echo
'<span class="hideonsmartphone"> - '.dol_print_date(
dol_now(),
"day").
'</span>'; ?>
1415 print
'<a class="valignmiddle tdoverflowmax100" id="multicurrency" onclick="ModalBox(\'ModalCurrency\')" title=""><span class="fas fa-coins paddingrightonly"></span>';
1416 print
'<span class="hideonsmartphone">'.$langs->trans(
"Currency").
'</span>';
1420 <!-- section
for customer -->
1421 <div
class=
"inline-block valignmiddle" id=
"customerandsales"></div>
1422 <input
type=
"hidden" id=
"idcustomer" value=
"">
1423 <!-- section
for shopping carts -->
1424 <div
class=
"inline-block valignmiddle" id=
"shoppingcart"></div>
1425 <!-- More info about customer -->
1426 <div
class=
"inline-block valignmiddle tdoverflowmax150onsmartphone" id=
"moreinfo"></div>
1430 <!-- More info about warehouse -->
1431 <div
class=
"inline-block valignmiddle tdoverflowmax150onsmartphone" id=
"infowarehouse"></div>
1435 <div
id=
"topnav-right" class=
"topnav-right">
1437 $reshook = $hookmanager->executeHooks(
'takepos_login_block_other');
1438 if ($reshook == 0) {
1440 <div
class=
"login_block_other takepos">
1441 <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>
1442 <a onclick=
"ClearSearch(false);" class=
"nohover"><span
class=
"fa fa-backspace"></span></a>
1443 <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 -->
1444 <span
class=
"fas fa-home"></span></a>
1445 <?php
if (empty(
$conf->dol_use_jmobile)) { ?>
1446 <a
class=
"hideonsmartphone" onclick=
"FullScreen();" title=
"<?php echo dol_escape_htmltag($langs->trans("ClickFullScreenEscapeToLeave
")); ?>"><span
class=
"fa fa-expand-arrows-alt"></span></a>
1452 <div
class=
"login_block_user">
1454 print
top_menu_user(1, DOL_URL_ROOT.
'/user/logout.php?token='.
newToken().
'&urlfrom='.urlencode(
'/takepos/?setterminal='.((
int) $term)));
1458 <div
class=
"arrows">
1459 <span
class=
"indicator left"><i
class=
"fa fa-arrow-left"></i></span>
1460 <span
class=
"indicator right"><i
class=
"fa fa-arrow-right"></i></span>
1468<!-- Modal terminal box -->
1469<div
id=
"ModalTerminal" class=
"modal">
1470 <div
class=
"modal-content">
1471 <div
class=
"modal-header">
1475 <span
class=
"close" href=
"#" onclick=
"document.getElementById('ModalTerminal').style.display = 'none';">×</span>
1478 <h3><?php print $langs->trans(
"TerminalSelect"); ?></h3>
1480 <div
class=
"modal-body">
1483 print
'<button type="button" class="block" onclick="location.href=\'index.php?setterminal='.$i.
'\'">'.getDolGlobalString("TAKEPOS_TERMINAL_NAME_
".$i, $langs->trans("TerminalName
", $i)).'</button>';
1490<!-- Modal multicurrency box -->
1491<?php if (isModEnabled('multicurrency')) { ?>
1492<div id="ModalCurrency
" class="modal
">
1493 <div class="modal-content
">
1494 <div class="modal-header
">
1495 <span class="close
" href="#
" onclick="document.getElementById(
'ModalCurrency').style.display =
'none';
">×</span>
1496 <h3><?php print $langs->trans("SetMultiCurrencyCode
"); ?></h3>
1498 <div class="modal-body
">
1500 $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency';
1501 $sql .= " WHERE entity IN (
'".getEntity('multicurrency
')."')
";
1502 $resql = $db->query($sql);
1504 while ($obj = $db->fetch_object($resql)) {
1505 print '<button type="button" class="block
" onclick="location.href=\
'index.php?setcurrency='.urlencode($obj->code).
'\'">'.$obj->code.'</button>';
1514<!-- Modal popup to create a Credit Note -->
1515<div id="ModalCreditNote
" class="modal
">
1516 <div class="modal-content
">
1517 <div class="modal-header
">
1518 <span class="close
" href="#
" onclick="document.getElementById(
'ModalCreditNote').style.display =
'none';
">×</span>
1519 <h3><?php print $langs->trans("invoiceAvoirWithLines
"); ?></h3>
1521 <div class="modal-body
">
1522 <button type="button" class="block
" onclick="CreditNote(); document.getElementById(
'ModalCreditNote').style.display =
'none';
"><?php print $langs->trans("Yes
"); ?></button>
1523 <button type="button" class="block
" onclick="document.getElementById(
'ModalCreditNote').style.display =
'none';
"><?php print $langs->trans("No
"); ?></button>
1529<div id="ModalNote
" class="modal
">
1530 <div class="modal-content
">
1531 <div class="modal-header
">
1532 <span class="close
" href="#
" onclick="document.getElementById(
'ModalNote').style.display =
'none';
">×</span>
1533 <h3><?php print $langs->trans("Note
"); ?></h3>
1535 <div class="modal-body
">
1536 <input type="text
" class="block
" id="textinput
">
1537 <button type="button" class="block
" onclick="SetNote(); document.getElementById(
'ModalNote').style.display =
'none';
">OK</button>
1546 <div id="poslines
" class="div1
">
1550 <button type="button" class="calcbutton
" onclick="Edit(7);
">7</button>
1551 <button type="button" class="calcbutton
" onclick="Edit(8);
">8</button>
1552 <button type="button" class="calcbutton
" onclick="Edit(9);
">9</button>
1553 <button type="button" id="qty
" class="calcbutton2
" onclick="Edit(
'qty')
"><?php echo $langs->trans("Qty
"); ?></button>
1554 <button type="button" class="calcbutton
" onclick="Edit(4);
">4</button>
1555 <button type="button" class="calcbutton
" onclick="Edit(5);
">5</button>
1556 <button type="button" class="calcbutton
" onclick="Edit(6);
">6</button>
1557 <button type="button" id="price" class="calcbutton2
" onclick="Edit(
'p')
"><?php echo $langs->trans("Price
"); ?></button>
1558 <button type="button" class="calcbutton
" onclick="Edit(1);
">1</button>
1559 <button type="button" class="calcbutton
" onclick="Edit(2);
">2</button>
1560 <button type="button" class="calcbutton
" onclick="Edit(3);
">3</button>
1561 <button type="button" id="reduction
" class="calcbutton2
" onclick="Edit(
'r')
"><?php echo $langs->trans("LineDiscountShort
"); ?></button>
1562 <button type="button" class="calcbutton
" onclick="Edit(0);
">0</button>
1563 <button type="button" class="calcbutton
" onclick="Edit(
'.')
">.</button>
1564 <button type="button" class="calcbutton poscolorblue
" onclick="Edit(
'c')
">C</button>
1565 <?php if ($user->hasRight('takepos', 'editlines')) { ?>
1566 <button type="button" class="calcbutton2 poscolordelete
" id="delete" onclick="deleteline()
"><span class="fa fa-trash
"></span></button>
1572// Dependency modulecheck
1573if (!isModEnabled('invoice')) {
1574 setEventMessages($langs->trans("ErrorModuleSetupNotComplete
", $langs->transnoentitiesnoconv("Invoice
")), null, 'errors');
1577// TakePOS setup check
1578if (isset($_SESSION["takeposterminal
"]) && $_SESSION["takeposterminal
"]) {
1579 $sql = "SELECT code, libelle FROM
" . MAIN_DB_PREFIX . "c_paiement
";
1580 $sql .= " WHERE entity IN (
" . getEntity('c_paiement') . ")
";
1581 $sql .= " AND
active = 1
";
1582 $sql .= " ORDER BY libelle
";
1584 $resql = $db->query($sql);
1585 $paiementsModes = array();
1587 while ($obj = $db->fetch_object($resql)) {
1588 $paycode = $obj->code;
1589 if ($paycode == 'LIQ') {
1592 if ($paycode == 'CHQ') {
1593 $paycode = 'CHEQUE';
1596 $constantforkey = "CASHDESK_ID_BANKACCOUNT_
" . $paycode . $_SESSION["takeposterminal
"];
1597 //var_dump($constantforkey.' '.getDolGlobalInt($constantforkey));
1598 if (getDolGlobalInt($constantforkey) > 0) {
1599 array_push($paiementsModes, $obj);
1604 if (empty($paiementsModes) && isModEnabled("bank
")) {
1605 $langs->load('errors');
1606 setEventMessages($langs->trans("ErrorModuleSetupNotComplete
", $langs->transnoentitiesnoconv("TakePOS
")), null, 'errors');
1607 setEventMessages($langs->trans("ProblemIsInSetupOfTerminal
", $_SESSION["takeposterminal
"]), null, 'errors');
1611if (count($maincategories) == 0) {
1612 if (getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID') > 0) {
1613 $tmpcategory = new Categorie($db);
1614 $tmpcategory->fetch(getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID'));
1615 setEventMessages($langs->trans("TakeposNeedsAtLeastOnSubCategoryIntoParentCategory
", $tmpcategory->label), null, 'errors');
1617 setEventMessages($langs->trans("TakeposNeedsCategories
"), null, 'errors');
1620// User menu and external TakePOS modules
1624if (! getDolGlobalString('TAKEPOS_HIDE_HISTORY')) {
1625 $menus[$r++] = array('title' => '<span class="fa fa-history paddingrightonly
"></span><div class="trunc
">'.$langs->trans("History
").'</div>', 'action' => 'History();');
1628if (getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) {
1629 if (getDolGlobalString('TAKEPOS_CHOOSE_CONTACT')) {
1630 $menus[$r++] = array('title' => '<span class="far fa-building paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Contact").'</div>', 'action' => 'Contact();');
1632 $menus[$r++] = array('title' => '<span class="far fa-building paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Customer
").'</div>', 'action' => 'Customer();');
1636if (!getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1637 $menus[$r++] = array('title' => '<span class="fa fa-layer-group paddingrightonly
"></span><div class="trunc
">'.$langs->trans("New
").'</div>', 'action' => 'New();');
1639 // BAR RESTAURANT specific menu
1640 $menus[$r++] = array('title' => '<span class="fa fa-layer-group paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Place
").'</div>', 'action' => 'Floors();');
1643// Add a non predefined product
1644if (!getDolGlobalString('TAKEPOS_NO_FREE_ZONE_PRODUCT')) {
1645 $menus[$r++] = array('title' => '<span class="fa fa-cube paddingrightonly
"></span><div class="trunc
">'.$langs->trans("FreeZone
").'</div>', 'action' => 'FreeZone();');
1648// BAR RESTAURANT specific menu "Print on kitchen/order printer
"
1649if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1650 if (getDolGlobalString('TAKEPOS_SUPPLEMENTS')) {
1651 $menus[$r++] = array('title' => '<span class="fa fa-cube paddingrightonly
"></span><div class="trunc
">'.$langs->trans("ProductSupplements
").'</div>', 'action' => 'LoadProducts(\'supplements\');');
1654 if (getDolGlobalString('TAKEPOS_ORDER_PRINTERS')) {
1655 $menus[$r++] = array('title' => '<span class="fa fa-blender-phone paddingrightonly
"></span><div class="trunc
">'.$langs->trans("SentOrderToKitchen
").'</span>', 'action' => 'TakeposPrintingOrder();');
1660$menus[$r++] = array('title' => '<span class="fa fa-percent paddingrightonly
"></span><div class="trunc
">'.$langs->trans("InvoiceDiscountShort
").'</div>', 'action' => 'Reduction();');
1662// Manage available customer credits (credit notes converted to credit, deposits, etc.)
1663$menus[$r++] = array('title' => '<span class="fa fa-wallet paddingrightonly
"></span><div class="trunc
">'.$langs->trans("TakeposAvailableCredits
").'</div>', 'action' => 'CreditList();');
1665if (!getDolGlobalString('TAKEPOS_NO_SPLIT_SALE')) {
1666 $menus[$r++] = array('title' => '<span class="fas fa-cut paddingrightonly
"></span><div class="trunc
">'.$langs->trans("SplitSale
").'</div>', 'action' => 'Split();');
1669// Last action that close the sell (payments)
1670$menus[$r++] = array('title' => '<span class="far fa-money-bill-alt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Payment
").'</div>', 'action' => 'CloseBill();');
1671if (getDolGlobalString('TAKEPOS_DIRECT_PAYMENT')) {
1672 $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();');
1675$customprinterallowed = false;
1676$customprinttemplateallowed = true;
1678// BAR RESTAURANT specific menu
1679if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1680 // Button to print receipt before payment
1681 $customprinterallowed = true;
1682 $customprinttemplateallowed = true;
1685include_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
1686if (isALNERunningVersion()) {
1687 // Custom printer may be allowed if mandatory information in template are guaranteed. For the moment, we prefer not allow this.
1688 $customprinttemplateallowed = false;
1691// Button to print receipt
1692// This section should be same than into invoice.php
1693if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector
") { // deprecated method
1694 if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) {
1695 // If TAKEPOS_PRINT_SERVER is an URL
1696 $menus[$r++] = array('title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("PrintTicket
").'</div>', 'action' => 'PrintByESCPOSOld(placeid);');
1698 // If TAKEPOS_PRINT_SERVER is an IP
1699 // Print by calling the receipt.php to get HTML content and send the HTML content to TAKEPOS_PRINT_SERVER:8111/print
1700 $menus[$r++] = array('title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("PrintTicket
").'</div>', 'action' => 'PrintHTMLToSlashPrint(placeid);');
1702} elseif ($customprinterallowed && $customprinttemplateallowed && (isModEnabled('receiptprinter') && getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0) || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter
") { // @phpstan-ignore-line
1703 // Button Print Receipt on special custom printer using custom template
1704 $nameOfPrinter = dol_getIdFromCode($db, getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term), 'printer_receipt', 'rowid', 'name', 1);
1705 $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);');
1707 // Button Print Receipt on browser
1708 $menus[$r++] = array('title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("PrintTicket
").'</div>', 'action' => 'PrintByBrowser(placeid);');
1711if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector
" && getDolGlobalString('TAKEPOS_ORDER_NOTES') == 1) {
1712 $menus[$r++] = array('title' => '<span class="fa fa-sticky-note paddingrightonly
"></span><div class="trunc
">'.$langs->trans("OrderNotes
").'</div>', 'action' => 'TakeposOrderNotes();');
1716if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector
") {
1717 $menus[$r++] = array('title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("DOL_OPEN_DRAWER
").'</div>', 'action' => 'OpenDrawer();');
1719if (getDolGlobalInt('TAKEPOS_ADD_BUTTON_OPEN_DRAWER'.$term) > 0) {
1720 $menus[$r++] = array(
1721 'title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("DOL_OPEN_DRAWER
").'</div>',
1722 'action' => 'DolibarrOpenDrawer();',
1726// If there is an open cash control started
1727$sql = "SELECT rowid,
status, entity FROM
".MAIN_DB_PREFIX."pos_cash_fence WHERE
";
1728$sql .= " entity =
".((int) $conf->entity)." AND
";
1729$sql .= " posnumber =
".((int) empty($_SESSION["takeposterminal
"]) ? 0 : $_SESSION["takeposterminal
"])." AND
";
1730$sql .= " date_creation >
'".$db->idate(dol_get_first_hour(dol_now()))."'";
1731$sql .= " AND
status = 0
";
1733$resql = $db->query($sql);
1735 $num = $db->num_rows($resql);
1737 $obj = $db->fetch_object($resql);
1738 $menus[$r++] = array('title' => '<span class="fas fa-file-invoice-dollar paddingrightonly
"></span><div class="trunc
">'.$langs->trans("CashReport
").'</div>', 'action' => 'CashReport('.$obj->rowid.');');
1739 if ($obj->status == 0) {
1740 $menus[$r++] = array('title' => '<span class="fas fa-cash-
register paddingrightonly
"></span><div class="trunc
">'.$langs->trans("CloseCashFence
").'</div>', 'action' => 'CloseCashFence('.$obj->rowid.');');
1745if (getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) {
1746 $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().'\';');
1749if (getDolGlobalString('TAKEPOS_WEIGHING_SCALE')) {
1750 $menus[$r++] = array('title' => '<span class="fa fa-balance-scale pictofixedwidth
"></span><div class="trunc
">'.$langs->trans("WeighingScale
").'</div>', 'action' => 'WeighingScale();');
1753// Button to delete (discard) the current sale
1754/* Hide this. This button must appear only if is_erasable() is true. So it must depend on open invoice. For this reason,
1755 * the button could not be in this panel but must be on the left side inside the invoice.php file.
1756$menus[$r++] = array('title' => '<span class="fa fa-trash-alt paddingrightonly
"></span><div class="trunc truncdeletesale
">'.$langs->trans("DeleteSale
").'</div>', 'action' => 'DeleteSale();', 'class' => 'actionbuttondelete');
1759$parameters = array('menus' => $menus);
1760$reshook = $hookmanager->executeHooks('ActionButtons', $parameters);
1761if ($reshook == 0) { //add buttons
1762 if (is_array($hookmanager->resArray)) {
1763 foreach ($hookmanager->resArray as $resArray) {
1764 foreach ($resArray as $butmenu) {
1765 $menus[$r++] = $butmenu;
1769} elseif ($reshook == 1) {
1770 $r = 0; //replace buttons
1771 if (is_array($hookmanager->resArray)) {
1772 foreach ($hookmanager->resArray as $resArray) {
1773 foreach ($resArray as $butmenu) {
1774 $menus[$r++] = $butmenu;
1781 <!-- Show buttons -->
1782 <div id="dialogforpopuptakepos
"></div>
1784 /* Style de la popup */
1785 #dialogforpopuptakepos {
1794 box-shadow: 0 0 10px rgba(0,0,0,0.3);
1796 font-family: sans-serif;
1803 foreach ($menus as $menu) {
1805 if (count($menus) > 12 and $i == 12) {
1806 echo '<button style="'.(empty($menu['style
']) ? '' : $menu['style
']).'" type="button" id="actionnext
" class="actionbutton
" onclick="MoreActions(
'.count($menus).')
">'.$langs->trans("Next
").'</button>';
1807 echo '<button style="display: none;
" type="button" id="actionprevious
" class="actionbutton
" onclick="MoreActions(
'.count($menus).')
">'.$langs->trans("Previous
").'</button>';
1808 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>';
1809 } elseif ($i > 12) {
1810 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>';
1811 // TODO keep style but hide button
1813 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>';
1817 if (getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR') && !getDolGlobalString('TAKEPOS_HIDE_SEARCH')) {
1818 print '<!-- Show the search input text -->'."\n
";
1819 print '<div class="margintoponly
">';
1820 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> ';
1821 print '<a class="marginleftonly hideonsmartphone
" onclick="ClearSearch(
false);
">'.img_picto('', 'searchclear.png').'</a>';
1832 <!-- Show categories -->
1834 if (getDolGlobalInt('TAKEPOS_HIDE_CATEGORIES') == 1) {
1835 print '<div class="div4
" style= "display: none;
">';
1837 print '<div class="div4
">';
1841 while ($count < $MAXCATEG) {
1843 <div class="wrapper
" <?php if ($count == ($MAXCATEG - 2)) {
1844 echo 'onclick="MoreCategories(\
'less\')"';
1845 } elseif ($count == ($MAXCATEG - 1)) {
1846 echo
'onclick="MoreCategories(\'more\')"';
1848 echo
'onclick="LoadProducts('.$count.
')"';
1849 } ?>
id=
"catdiv<?php echo $count; ?>">
1851 if ($count == ($MAXCATEG - 2)) {
1853 echo
'<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1854 } elseif ($count == ($MAXCATEG - 1)) {
1856 echo
'<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1859 echo
'<img class="imgwrapper" id="catimg'.$count.
'" />';
1862 <?php
if ($count != $MAXCATEG - 2 && $count != $MAXCATEG - 1) { ?>
1863 <div
class=
"description" id=
"catdivdesc<?php echo $count; ?>">
1864 <div
class=
"description_content" id=
"catdesc<?php echo $count; ?>"></div>
1867 <div
class=
"catwatermark" id=
'catwatermark<?php echo $count; ?>'>...</div>
1875 <!-- Show product -->
1876 <div
class=
"div5<?php if (getDolGlobalInt('TAKEPOS_HIDE_CATEGORIES') == 1) {
1877 print ' centpercent';
1882 while ($count < $MAXPRODUCT) {
1883 print
'<div class="wrapper2'.(($count >= ($MAXPRODUCT - 2)) ?
' arrow' :
'').
'" id="prodiv'.$count.
'" '; ?>
1884 <?php
if ($count == ($MAXPRODUCT - 2)) {
1885 ?> onclick=
"MoreProducts('less')" <?php
1887 if ($count == ($MAXPRODUCT - 1)) {
1888 ?> onclick=
"MoreProducts('more')" <?php
1890 echo
'onclick="ClickProduct('.((int) $count).
')"';
1893 if ($count == ($MAXPRODUCT - 2)) {
1895 print
'<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1896 } elseif ($count == ($MAXPRODUCT - 1)) {
1898 print
'<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1901 print
'<div class="" id="proprice'.$count.
'"></div>';
1904 print
'<button type="button" id="probutton'.$count.
'" class="productbutton" style="display: none;"></button>';
1906 print
'<img class="imgwrapper" title="" id="proimg'.$count.
'">';
1909 <?php
if ($count != $MAXPRODUCT - 2 && $count != $MAXPRODUCT - 1 && !
getDolGlobalString(
'TAKEPOS_HIDE_PRODUCT_IMAGES')) { ?>
1910 <div
class=
"description" id=
"prodivdesc<?php echo $count; ?>">
1911 <div
class=
"description_content" id=
"prodesc<?php echo $count; ?>"></div>
1914 <div
class=
"catwatermark" id=
'prowatermark<?php echo $count; ?>'>...</div>
1920 <input
type=
"hidden" id=
"search_start_less" value=
"0">
1921 <input
type=
"hidden" id=
"search_start_more" value=
"0">
1922 <input
type=
"hidden" id=
"search_pagination" value=
"">
while( $i< $imaxinloop)
The main.inc.php has been included so the following variable are now defined:
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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.
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.
multi select button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button