32if (!defined(
'NOREQUIREMENU')) {
33 define(
'NOREQUIREMENU',
'1');
35if (!defined(
'NOREQUIREHTML')) {
36 define(
'NOREQUIREHTML',
'1');
38if (!defined(
'NOREQUIREAJAX')) {
39 define(
'NOREQUIREAJAX',
'1');
43require
'../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
54$action =
GETPOST(
'action',
'aZ09');
56$setcurrency =
GETPOST(
'setcurrency',
'aZ09');
58$hookmanager->initHooks(array(
'takeposfrontend'));
59if (empty($_SESSION[
"takeposterminal"])) {
61 $_SESSION[
"takeposterminal"] = 1;
62 } elseif (!empty($_COOKIE[
"takeposterminal"])) {
63 $_SESSION[
"takeposterminal"] = preg_replace(
'/[^a-zA-Z0-9_\-]/',
'', $_COOKIE[
"takeposterminal"]);
67if ($setterminal > 0) {
68 $_SESSION[
"takeposterminal"] = $setterminal;
69 setcookie(
"takeposterminal", (
string) $setterminal, (time() + (86400 * 354)),
'/',
'', (empty($dolibarr_main_force_https) ?
false : true), true);
72if ($setcurrency !=
"") {
73 $_SESSION[
"takeposcustomercurrency"] = $setcurrency;
78$langs->loadLangs(array(
"bills",
"orders",
"commercial",
"cashdesk",
"receiptprinter",
"banks"));
82$maxcategbydefaultforthisdevice = 12;
83$maxproductbydefaultforthisdevice = 24;
84if ($conf->browser->layout ==
'phone') {
85 $maxcategbydefaultforthisdevice = 8;
86 $maxproductbydefaultforthisdevice = 16;
89 $_SESSION[
"basiclayout"] = 1;
90 header(
"Location: phone.php?mobilepage=invoice");
94 unset($_SESSION[
"basiclayout"]);
96$MAXCATEG = (!
getDolGlobalString(
'TAKEPOS_NB_MAXCATEG') ? $maxcategbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXCATEG);
97$MAXPRODUCT = (!
getDolGlobalString(
'TAKEPOS_NB_MAXPRODUCT') ? $maxproductbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXPRODUCT);
99$term = empty($_SESSION[
'takeposterminal']) ? 1 : $_SESSION[
'takeposterminal'];
117$form =
new Form($db);
121$arrayofjs = array(
'/takepos/js/jquery.colorbox-min.js');
122$arrayofcss = array(
'/takepos/css/pos.css.php',
'/takepos/css/colorbox.css');
125 $arrayofcss[] =
'/takepos/css/colorful.css';
130$title =
'TakePOS - Dolibarr '.DOL_VERSION;
134$head =
'<meta name="apple-mobile-web-app-title" content="TakePOS"/>
135<meta name="apple-mobile-web-app-capable" content="yes">
136<meta name="mobile-web-app-capable" content="yes">
137<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
138top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
141$categories = $categorie->get_full_arbo(
'product', ((
getDolGlobalInt(
'TAKEPOS_ROOT_CATEGORY_ID') > 0) ?
getDolGlobalInt(
'TAKEPOS_ROOT_CATEGORY_ID') : 0), 1);
146$levelofrootcategory = 0;
148 foreach ($categories as $key => $categorycursor) {
149 if ($categorycursor[
'id'] ==
getDolGlobalInt(
'TAKEPOS_ROOT_CATEGORY_ID')) {
150 $levelofrootcategory = $categorycursor[
'level'];
156$levelofmaincategories = $levelofrootcategory + 1;
158$maincategories = array();
159$subcategories = array();
160foreach ($categories as $key => $categorycursor) {
161 if ($categorycursor[
'level'] == $levelofmaincategories) {
162 $maincategories[$key] = $categorycursor;
164 $subcategories[$key] = $categorycursor;
172<body
class=
"bodytakepos" style=
"overflow: hidden;">
175var categories = <?php echo json_encode($maincategories); ?>;
176var subcategories = <?php echo json_encode($subcategories); ?>;
182var place=
"<?php echo $place; ?>";
186var search2_timer=
null;
205function ClearSearch(clearSearchResults) {
206 console.log(
"ClearSearch");
207 $(
"#search").val(
'');
208 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
209 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
210 $(
"#reduction").html(
"<?php echo $langs->trans("LineDiscountShort
"); ?>").removeClass(
'clicked');
211 <?php
if ($conf->browser->layout ==
'classic') { ?>
212 setFocusOnSearchField();
214 if (clearSearchResults) {
215 $(
"#search").trigger(
'keyup');
220function setFocusOnSearchField() {
221 console.log(
"Call setFocusOnSearchField in page index.php");
222 <?php
if ($conf->browser->layout ==
'classic') { ?>
223 console.log(
"has keyboard from localStorage, so we can force focus on search field");
224 $(
"#search").focus();
228function PrintCategories(first) {
229 console.log(
"PrintCategories");
230 for (i = 0; i < <?php echo($MAXCATEG - 2); ?>; i++) {
231 if (typeof (categories[parseInt(i)+parseInt(first)]) ==
"undefined")
233 $(
"#catdivdesc"+i).hide();
234 $(
"#catdesc"+i).text(
"");
235 $(
"#catimg"+i).attr(
"src",
"genimg/empty.png");
236 $(
"#catwatermark"+i).hide();
237 $(
"#catdiv"+i).attr(
'class',
'wrapper divempty');
240 $(
"#catdivdesc"+i).show();
243 $(
"#catdesc"+i).html(categories[parseInt(i)+parseInt(first)][
'label'].bold() +
' - ' + categories[parseInt(i)+parseInt(first)][
'description']);
245 $(
"#catdesc"+i).text(categories[parseInt(i)+parseInt(first)][
'label']);
247 $(
"#catimg"+i).attr(
"src",
"genimg/index.php?query=cat&id="+categories[parseInt(i)+parseInt(first)][
'rowid']);
248 $(
"#catdiv"+i).data(
"rowid",categories[parseInt(i)+parseInt(first)][
'rowid']);
249 $(
"#catdiv"+i).attr(
"data-rowid",categories[parseInt(i)+parseInt(first)][
'rowid']);
250 $(
"#catdiv"+i).attr(
'class',
'wrapper');
251 $(
"#catwatermark"+i).show();
255function MoreCategories(moreorless) {
256 console.log(
"MoreCategories moreorless="+moreorless+
" pagecategories="+pagecategories);
257 if (moreorless ==
"more") {
258 $(
'#catimg15').animate({opacity:
'0.5'}, 1);
259 $(
'#catimg15').animate({opacity:
'1'}, 100);
260 pagecategories=pagecategories+1;
262 if (moreorless ==
"less") {
263 $(
'#catimg14').animate({opacity:
'0.5'}, 1);
264 $(
'#catimg14').animate({opacity:
'1'}, 100);
265 if (pagecategories==0)
return;
266 pagecategories=pagecategories-1;
268 if (typeof (categories[<?php echo($MAXCATEG - 2); ?> * pagecategories] && moreorless ==
"more") ==
"undefined") {
269 pagecategories=pagecategories-1;
273 for (i = 0; i < <?php echo($MAXCATEG - 2); ?>; i++) {
274 if (typeof (categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)]) ==
"undefined") {
276 console.log(
"complete with empty record");
277 $(
"#catdivdesc"+i).hide();
278 $(
"#catdesc"+i).text(
"");
279 $(
"#catimg"+i).attr(
"src",
"genimg/empty.png");
280 $(
"#catwatermark"+i).hide();
283 $(
"#catdivdesc"+i).show();
286 $(
"#catdesc"+i).html(categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)][
'label'].bold() +
' - ' + categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)][
'description']);
288 $(
"#catdesc"+i).text(categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)][
'label']);
290 $(
"#catimg"+i).attr(
"src",
"genimg/index.php?query=cat&id="+categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)][
'rowid']);
291 $(
"#catdiv"+i).data(
"rowid",categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)][
'rowid']);
292 $(
"#catdiv"+i).attr(
"data-rowid",categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)][
'rowid']);
293 $(
"#catwatermark"+i).show();
300function LoadProducts(
position, issubcat) {
301 console.log(
"LoadProducts position="+
position+
" issubcat="+issubcat);
302 var maxproduct = <?php echo($MAXPRODUCT - 2); ?>;
305 currentcat=
"supplements";
307 $(
'#catimg'+
position).animate({opacity:
'0.5'}, 1);
308 $(
'#catimg'+
position).animate({opacity:
'1'}, 100);
309 if (issubcat ==
true) {
310 currentcat=$(
'#prodiv'+
position).data(
'rowid');
313 currentcat=$(
'#catdiv'+
position).data(
'rowid');
314 console.log(
"currentcat="+currentcat);
317 if (currentcat == undefined) {
323 jQuery.each(subcategories,
function(i, val) {
324 if (currentcat==val.fk_parent) {
325 $(
"#prodivdesc"+ishow).show();
326 <?php if (getDolGlobalString(
'TAKEPOS_SHOW_CATEGORY_DESCRIPTION') == 1) { ?>
327 $(
"#prodesc"+ishow).html(val.label.bold() +
' - ' + val.description);
328 $(
"#probutton"+ishow).html(val.label);
330 $(
"#prodesc"+ishow).text(val.label);
331 $(
"#probutton"+ishow).text(val.label);
333 $(
"#probutton"+ishow).show();
334 $(
"#proprice"+ishow).attr(
"class",
"hidden");
335 $(
"#proprice"+ishow).html(
"");
336 $(
"#proimg"+ishow).attr(
"src",
"genimg/index.php?query=cat&id="+val.rowid);
337 $(
"#prodiv"+ishow).data(
"rowid",val.rowid);
338 $(
"#prodiv"+ishow).attr(
"data-rowid",val.rowid);
339 $(
"#prodiv"+ishow).data(
"iscat",1);
340 $(
"#prodiv"+ishow).attr(
"data-iscat",1);
341 $(
"#prowatermark"+ishow).show();
348 if (maxproduct >= 1) {
349 limit = maxproduct-1;
352 $.getJSON(
'<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&thirdpartyid=' + jQuery(
'#thirdpartyid').val() +
'&category='+currentcat+
'&tosell=1&limit='+limit+
'&offset=0',
function(data) {
353 console.log(
"Call ajax.php (in LoadProducts) to get Products of category "+currentcat+
" then loop on result to fill image thumbs");
356 while (ishow < maxproduct) {
357 console.log(
"ishow"+ishow+
" idata="+idata);
360 if (typeof (data[idata]) ==
"undefined") {
362 echo
'$("#prodivdesc"+ishow).hide();';
363 echo
'$("#prodesc"+ishow).text("");';
364 echo
'$("#proimg"+ishow).attr("title","");';
365 echo
'$("#proimg"+ishow).attr("src","genimg/empty.png");';
367 echo
'$("#probutton"+ishow).hide();';
368 echo
'$("#probutton"+ishow).text("");';
370 $(
"#proprice"+ishow).attr(
"class",
"hidden");
371 $(
"#proprice"+ishow).html(
"");
373 $(
"#prodiv"+ishow).data(
"rowid",
"");
374 $(
"#prodiv"+ishow).attr(
"data-rowid",
"");
376 $(
"#prodiv"+ishow).attr(
"class",
"wrapper2 divempty");
379 $titlestring =
"'".dol_escape_js($langs->transnoentities(
'Ref').
': ').
"' + data[idata]['ref']";
380 $titlestring .=
" + ' - ".dol_escape_js($langs->trans(
"Barcode").
': ').
"' + data[idata]['barcode']";
382 var titlestring = <?php echo $titlestring; ?>;
384 echo
'$("#prodivdesc"+ishow).show();';
386 echo
'$("#prodesc"+ishow).html(data[parseInt(idata)][\'ref\'].bold() + \' - \' + data[parseInt(idata)][\'label\']);';
388 echo
'$("#prodesc"+ishow).html(data[parseInt(idata)][\'ref\'].bold());';
390 echo
'$("#prodesc"+ishow).html(data[parseInt(idata)][\'label\']);';
392 echo
'$("#proimg"+ishow).attr("title", titlestring);';
393 echo
'$("#proimg"+ishow).attr("src", "genimg/index.php?query=pro&id="+data[idata][\'id\']);';
395 echo
'$("#probutton"+ishow).show();';
396 echo
'$("#probutton"+ishow).html(data[parseInt(idata)][\'label\']);';
399 if (data[parseInt(idata)][
'price_formated']) {
400 $(
"#proprice" + ishow).attr(
"class",
"productprice");
404 $(
"#proprice" + ishow).html(data[parseInt(idata)][
'price_formated']);
408 $(
"#proprice" + ishow).html(data[parseInt(idata)][
'price_ttc_formated']);
413 console.log(
"#prodiv"+ishow+
".data(rowid)="+data[idata][
'id']);
415 $(
"#prodiv"+ishow).data(
"rowid", data[idata][
'id']);
416 $(
"#prodiv"+ishow).attr(
"data-rowid", data[idata][
'id']);
417 console.log($(
'#prodiv4').data(
'rowid'));
419 $(
"#prodiv"+ishow).data(
"iscat", 0);
420 $(
"#prodiv"+ishow).attr(
"data-iscat", 0);
422 $(
"#prodiv"+ishow).attr(
"class",
"wrapper2");
426 $parameters = array();
427 $parameters[
'caller'] =
'loadProducts';
428 $hookmanager->executeHooks(
'completeJSProductDisplay', $parameters);
429 print $hookmanager->resPrint;
432 $(
"#prowatermark"+ishow).hide();
441function MoreProducts(moreorless) {
442 console.log(
"MoreProducts");
444 if ($(
'#search_pagination').val() !=
'') {
445 return Search2(
'<?php echo(isset($keyCodeForEnter) ? $keyCodeForEnter : ''); ?>', moreorless);
448 var maxproduct = <?php echo($MAXPRODUCT - 2); ?>;
450 if (moreorless==
"more"){
451 $(
'#proimg31').animate({opacity:
'0.5'}, 1);
452 $(
'#proimg31').animate({opacity:
'1'}, 100);
453 pageproducts=pageproducts+1;
455 if (moreorless==
"less"){
456 $(
'#proimg30').animate({opacity:
'0.5'}, 1);
457 $(
'#proimg30').animate({opacity:
'1'}, 100);
458 if (pageproducts==0)
return;
459 pageproducts=pageproducts-1;
465 if (maxproduct >= 1) {
466 limit = maxproduct-1;
468 var offset = <?php echo($MAXPRODUCT - 2); ?> * pageproducts;
470 $.getJSON(
'<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&category='+currentcat+
'&tosell=1&limit='+limit+
'&offset='+offset,
function(data) {
471 console.log(
"Call ajax.php (in MoreProducts) to get Products of category "+currentcat);
473 if (typeof (data[0]) ==
"undefined" && moreorless==
"more"){
474 pageproducts=pageproducts-1;
478 while (ishow < maxproduct) {
479 if (typeof (data[idata]) ==
"undefined") {
480 $(
"#prodivdesc"+ishow).hide();
481 $(
"#prodesc"+ishow).text(
"");
482 $(
"#probutton"+ishow).text(
"");
483 $(
"#probutton"+ishow).hide();
484 $(
"#proprice"+ishow).attr(
"class",
"");
485 $(
"#proprice"+ishow).html(
"");
486 $(
"#proimg"+ishow).attr(
"src",
"genimg/empty.png");
487 $(
"#prodiv"+ishow).data(
"rowid",
"");
488 $(
"#prodiv"+ishow).attr(
"data-rowid",
"");
490 $(
"#prodivdesc"+ishow).show();
492 $(
"#prodesc"+ishow).html(data[parseInt(idata)][
'ref'].bold() +
' - ' + data[parseInt(idata)][
'label']);
493 <?php } elseif (
getDolGlobalInt(
'TAKEPOS_SHOW_PRODUCT_REFERENCE') == 2) { ?>
494 $(
"#prodesc"+ishow).html(data[parseInt(idata)][
'ref'].bold());
496 $(
"#prodesc"+ishow).html(data[parseInt(idata)][
'label']);
498 $(
"#probutton"+ishow).html(data[parseInt(idata)][
'label']);
499 $(
"#probutton"+ishow).show();
500 if (data[parseInt(idata)][
'price_formated']) {
501 $(
"#proprice" + ishow).attr(
"class",
"productprice");
505 $(
"#proprice" + ishow).html(data[parseInt(idata)][
'price_formated']);
509 $(
"#proprice" + ishow).html(data[parseInt(idata)][
'price_ttc_formated']);
514 $(
"#proimg"+ishow).attr(
"src",
"genimg/index.php?query=pro&id="+data[idata][
'id']);
515 $(
"#prodiv"+ishow).data(
"rowid",data[idata][
'id']);
516 $(
"#prodiv"+ishow).attr(
"data-rowid",data[idata][
'id']);
517 $(
"#prodiv"+ishow).data(
"iscat",0);
519 $(
"#prowatermark"+ishow).hide();
528function ClickProduct(
position, qty = 1) {
529 console.log(
"ClickProduct at position"+
position);
530 $(
'#proimg'+
position).animate({opacity:
'0.5'}, 1);
531 $(
'#proimg'+
position).animate({opacity:
'1'}, 100);
532 if ($(
'#prodiv'+
position).data(
'iscat')==1){
533 console.log(
"Click on a category at position "+
position);
537 console.log($(
'#prodiv4').data(
'rowid'));
538 invoiceid = $(
"#invoiceid").val();
539 idproduct=$(
'#prodiv'+
position).data(
'rowid');
540 console.log(
"Click on product at position "+
position+
" for idproduct "+idproduct+
", qty="+qty+
" invoiceid="+invoiceid);
541 if (idproduct ==
"") {
545 $(
"#poslines").load(
"invoice.php?action=addline&token=<?php echo newToken(); ?>&place="+place+
"&idproduct="+idproduct+
"&qty="+qty+
"&invoiceid="+invoiceid,
function() {
547 echo
"CustomerDisplay();";
555function ChangeThirdparty(idcustomer) {
556 console.log(
"ChangeThirdparty");
558 $(
"#poslines").load(
"<?php echo DOL_URL_ROOT ?>/societe/list.php?action=change&token=<?php echo newToken();?>&type=t&contextpage=poslist&idcustomer="+idcustomer+
"&place="+place+
"",
function() {
564function deleteline() {
565 invoiceid = $(
"#invoiceid").val();
566 console.log(
"Delete line invoiceid="+invoiceid);
567 $(
"#poslines").load(
"invoice.php?action=deleteline&token=<?php echo newToken(); ?>&place="+place+
"&idline="+selectedline+
"&invoiceid="+invoiceid,
function() {
574 console.log(
"Open box to select the thirdparty place="+place);
575 $.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
"); ?>"});
579 console.log(
"Open box to select the contact place="+place);
580 $.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"); ?>"});
585 console.log(
"Open box to select the history");
586 $.colorbox({href:
"../compta/facture/list.php?contextpage=poslist", width:
"90%", height:
"80%", transition:
"none", iframe:
"true", title:
"<?php echo $langs->trans("History
"); ?>"});
589function Reduction() {
590 invoiceid = $(
"#invoiceid").val();
591 console.log(
"Open popup to enter reduction on invoiceid="+invoiceid);
592 $.colorbox({href:
"reduction.php?place="+place+
"&invoiceid="+invoiceid, width:
"80%", height:
"90%", transition:
"none", iframe:
"true", title:
""});
595function CloseBill() {
597 if (!empty($conf->global->TAKEPOS_FORBID_SALES_TO_DEFAULT_CUSTOMER)) {
598 echo
"customerAnchorTag = document.querySelector('a[id=\"customer\"]'); ";
599 echo
"if (customerAnchorTag && customerAnchorTag.innerText.trim() === '".$langs->trans(
"Customer").
"') { ";
600 echo
"alert('".dol_escape_js($langs->trans(
"NoClientErrorMessage")).
"'); ";
604 invoiceid = $(
"#invoiceid").val();
605 console.log(
"Open popup to enter payment on invoiceid="+invoiceid);
607 if ($(
"#idcustomer").val() ==
"") {
608 alert(
"<?php echo $langs->trans('TakePosCustomerMandatory'); ?>");
619 if (empty($alternative_payurl)) {
625 $.colorbox({href:
"<?php echo $payurl; ?>?place="+place+
"&invoiceid="+invoiceid, width:
"80%", height:
"90%", transition:
"none", iframe:
"true", title:
""});
629 invoiceid = $(
"#invoiceid").val();
630 console.log(
"Open popup to split on invoiceid="+invoiceid);
631 $.colorbox({href:
"split.php?place="+place+
"&invoiceid="+invoiceid, width:
"80%", height:
"90%", transition:
"none", iframe:
"true", title:
""});
635 console.log(
"Open box to select floor place="+place);
636 $.colorbox({href:
"floors.php?place="+place, width:
"90%", height:
"90%", transition:
"none", iframe:
"true", title:
"<?php echo $langs->trans("Floors
"); ?>"});
640 invoiceid = $(
"#invoiceid").val();
641 console.log(
"Open box to enter a free product on invoiceid="+invoiceid);
642 $.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
"); ?>"});
645function TakeposOrderNotes() {
646 console.log(
"Open box to order notes");
647 ModalBox(
'ModalNote');
648 $(
"#textinput").focus();
652 console.log(
"Refresh by reloading place="+place+
" invoiceid="+invoiceid);
653 $(
"#poslines").load(
"invoice.php?place="+place+
"&invoiceid="+invoiceid,
function() {
660 invoiceid = $(
"#invoiceid").val();
662 console.log(
"New with place = <?php echo $place; ?>, js place="+place+
", invoiceid="+invoiceid);
664 $.getJSON(
'<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getInvoice&token=<?php echo newToken();?>&id='+invoiceid,
function(data) {
667 if (parseInt(data[
'paye']) === 1) {
670 r = confirm(
'<?php echo($place > 0 ? $langs->transnoentitiesnoconv("ConfirmDeletionOfThisPOSSale") : $langs->transnoentitiesnoconv("ConfirmDiscardOfThisPOSSale")); ?>');
675 $(
"#poslines").load(
"invoice.php?action=delete&token=<?php echo newToken(); ?>&place=" + place,
function () {
680 $(
"#idcustomer").val(
"");
692function Search2(keyCodeForEnter, moreorless) {
693 var eventKeyCode = window.event.keyCode;
695 console.log(
"Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter+
", eventKeyCode="+eventKeyCode);
697 var search_term = $(
'#search').val();
698 var search_start = 0;
699 var search_limit = <?php echo $MAXPRODUCT - 2; ?>;
700 if (moreorless !=
null) {
701 search_term = $(
'#search_pagination').val();
702 search_start = $(
'#search_start_'+moreorless).val();
705 console.log(
"search_term="+search_term);
707 if (search_term ==
'') {
708 $(
"[id^=prowatermark]").html(
"");
709 $(
"[id^=prodesc]").text(
"");
710 $(
"[id^=probutton]").text(
"");
711 $(
"[id^=probutton]").hide();
712 $(
"[id^=proprice]").attr(
"class",
"hidden");
713 $(
"[id^=proprice]").html(
"");
714 $(
"[id^=proimg]").attr(
"src",
"genimg/empty.png");
715 $(
"[id^=prodiv]").data(
"rowid",
"");
716 $(
"[id^=prodiv]").attr(
"data-rowid",
"");
721 if (keyCodeForEnter ==
'' || eventKeyCode == keyCodeForEnter) {
725 if (search ===
true) {
729 clearTimeout(search2_timer);
733 search2_timer = setTimeout(
function(){
735 jQuery(
".wrapper2 .catwatermark").hide();
736 var nbsearchresults = 0;
737 $.getJSON(
'<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&token=<?php echo newToken();?>&term=' + search_term +
'&thirdpartyid=' + jQuery(
'#thirdpartyid').val() +
'&search_start=' + search_start +
'&search_limit=' + search_limit,
function (data) {
738 for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
739 if (typeof (data[i]) ==
"undefined") {
740 $(
"#prowatermark" + i).html(
"");
741 $(
"#prodesc" + i).text(
"");
742 $(
"#probutton" + i).text(
"");
743 $(
"#probutton" + i).hide();
744 $(
"#proprice" + i).attr(
"class",
"hidden");
745 $(
"#proprice" + i).html(
"");
746 $(
"#proimg" + i).attr(
"src",
"genimg/empty.png");
747 $(
"#prodiv" + i).data(
"rowid",
"");
748 $(
"#prodiv" + i).attr(
"data-rowid",
"");
752 $titlestring =
"'".dol_escape_js($langs->transnoentities(
'Ref').
': ').
"' + data[i]['ref']";
753 $titlestring .=
" + ' - ".dol_escape_js($langs->trans(
"Barcode").
': ').
"' + data[i]['barcode']";
755 var titlestring = <?php echo $titlestring; ?>;
757 $(
"#prodesc" + i).html(data[i][
'ref'].bold() +
' - ' + data[i][
'label']);
758 <?php } elseif (
getDolGlobalInt(
'TAKEPOS_SHOW_PRODUCT_REFERENCE') == 2) { ?>
759 $(
"#prodesc" + i).html(data[i][
'ref'].bold());
761 $(
"#prodesc" + i).html(data[i][
'label']);
763 $(
"#prodivdesc" + i).show();
764 $(
"#probutton" + i).html(data[i][
'label']);
765 $(
"#probutton" + i).show();
766 if (data[i][
'price_formated']) {
767 $(
"#proprice" + i).attr(
"class",
"productprice");
771 $(
"#proprice" + i).html(data[i][
'price_formated']);
775 $(
"#proprice" + i).html(data[i][
'price_ttc_formated']);
780 $(
"#proimg" + i).attr(
"title", titlestring);
781 if( undefined !== data[i][
'img']) {
782 $(
"#proimg" + i).attr(
"src", data[i][
'img']);
785 $(
"#proimg" + i).attr(
"src",
"genimg/index.php?query=pro&id=" + data[i][
'rowid']);
787 $(
"#prodiv" + i).data(
"rowid", data[i][
'rowid']);
788 $(
"#prodiv" + i).attr(
"data-rowid", data[i][
'rowid']);
789 $(
"#prodiv" + i).data(
"iscat", 0);
790 $(
"#prodiv" + i).attr(
"data-iscat", 0);
794 $parameters = array();
795 $parameters[
'caller'] =
'search2';
796 $hookmanager->executeHooks(
'completeJSProductDisplay', $parameters);
797 print $hookmanager->resPrint;
802 }).always(
function (data) {
804 if ($(
'#search').val().length > 0 && data.length == 1) {
805 console.log($(
'#search').val()+
' - '+data[0][
'barcode']);
806 if ($(
'#search').val() == data[0][
'barcode'] &&
'thirdparty' == data[0][
'object']) {
807 console.log(
"There is only 1 answer with barcode matching the search, so we change the thirdparty "+data[0][
'rowid']);
808 ChangeThirdparty(data[0][
'rowid']);
810 else if (
'product' == data[0][
'object'] && $(
'#search').val() == data[0][
'barcode']) {
811 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']);
812 ClickProduct(0, data[0][
'qty']);
815 if (eventKeyCode == keyCodeForEnter){
816 if (data.length == 0) {
817 $(
'#search').val(
'<?php
818 $langs->load('errors
');
819 echo dol_escape_js($langs->transnoentitiesnoconv("ErrorRecordNotFoundShort"));
820 ?> ('+search_term+
')');
821 $(
'#search').select();
823 else ClearSearch(
false);
826 $(
"#search_pagination").val($(
"#search").val());
827 if (search_start == 0) {
828 $(
"#prodiv<?php echo $MAXPRODUCT - 2; ?> span").hide();
831 $(
"#prodiv<?php echo $MAXPRODUCT - 2; ?> span").show();
832 var search_start_less = Math.max(0, parseInt(search_start) - parseInt(<?php echo $MAXPRODUCT - 2;?>));
833 $(
"#search_start_less").val(search_start_less);
835 if (nbsearchresults != <?php echo $MAXPRODUCT - 2; ?>) {
836 $(
"#prodiv<?php echo $MAXPRODUCT - 1; ?> span").hide();
839 $(
"#prodiv<?php echo $MAXPRODUCT - 1; ?> span").show();
840 var search_start_more = parseInt(search_start) + parseInt(<?php echo $MAXPRODUCT - 2;?>);
841 $(
"#search_start_more").val(search_start_more);
850function Edit(number) {
851 console.log(
"We click on PAD on key="+number);
853 if (typeof(selectedtext) ==
"undefined") {
857 var text=selectedtext+
"<br> ";
863 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
864 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
865 $(
"#reduction").html(
"<?php echo $langs->trans("LineDiscountShort
"); ?>").removeClass(
'clicked');
867 }
else if (number==
'qty') {
868 if (editaction==
'qty' && editnumber !=
'') {
869 $(
"#poslines").load(
"invoice.php?action=updateqty&token=<?php echo newToken(); ?>&place="+place+
"&idline="+selectedline+
"&number="+editnumber,
function() {
872 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
875 setFocusOnSearchField();
881 }
else if (number==
'p') {
882 if (editaction==
'p' && editnumber!=
"") {
883 $(
"#poslines").load(
"invoice.php?action=updateprice&token=<?php echo newToken(); ?>&place="+place+
"&idline="+selectedline+
"&number="+editnumber,
function() {
886 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
895 }
else if (number==
'r') {
896 if (editaction==
'r' && editnumber!=
"") {
897 $(
"#poslines").load(
"invoice.php?action=updatereduction&token=<?php echo newToken(); ?>&place="+place+
"&idline="+selectedline+
"&number="+editnumber,
function() {
900 $(
"#reduction").html(
"<?php echo $langs->trans("LineDiscountShort
"); ?>").removeClass(
'clicked');
911 editnumber=editnumber+number;
913 if (editaction==
'qty'){
914 text=text+
"<?php echo $langs->trans("Modify
")." ->
".$langs->trans("Qty
").":
"; ?>";
915 $(
"#qty").html(
"OK").addClass(
"clicked");
916 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
917 $(
"#reduction").html(
"<?php echo $langs->trans("LineDiscountShort
"); ?>").removeClass(
'clicked');
919 if (editaction==
'p'){
920 text=text+
"<?php echo $langs->trans("Modify
")." ->
".$langs->trans("Price
").":
"; ?>";
921 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
922 $(
"#price").html(
"OK").addClass(
"clicked");
923 $(
"#reduction").html(
"<?php echo $langs->trans("LineDiscountShort
"); ?>").removeClass(
'clicked');
925 if (editaction==
'r'){
926 text=text+
"<?php echo $langs->trans("Modify
")." ->
".$langs->trans("LineDiscountShort
").":
"; ?>";
927 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
928 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
929 $(
"#reduction").html(
"OK").addClass(
"clicked");
931 $(
'#'+selectedline).find(
"td:first").html(text+editnumber);
935function TakeposPrintingOrder(){
936 console.log(
"TakeposPrintingOrder");
937 $(
"#poslines").load(
"invoice.php?action=order&token=<?php echo newToken();?>&place="+place,
function() {
942function TakeposPrintingTemp(){
943 console.log(
"TakeposPrintingTemp");
944 $(
"#poslines").load(
"invoice.php?action=temp&token=<?php echo newToken();?>&place="+place,
function() {
949function OpenDrawer(){
950 console.log(
"OpenDrawer call ajax url http://<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER'); ?>:8111/print");
953 data: { token:
'notrequired' },
955 if (
getDolGlobalString(
'TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) ==
true) {
956 echo
"url: '".getDolGlobalString(
'TAKEPOS_PRINT_SERVER',
'localhost').
"/printer/drawer.php',";
958 echo
"url: 'http://".getDolGlobalString(
'TAKEPOS_PRINT_SERVER',
'localhost').
":8111/print',";
965function DolibarrOpenDrawer() {
966 console.log(
"DolibarrOpenDrawer call ajax url /takepos/ajax/ajax.php?action=opendrawer&token=<?php echo newToken();?>&term=<?php print urlencode(empty($_SESSION["takeposterminal
"]) ? '' : $_SESSION["takeposterminal
"]); ?>");
969 data: { token:
'<?php echo currentToken(); ?>' },
970 url:
"<?php print DOL_URL_ROOT.'/takepos/ajax/ajax.php?action=opendrawer&token='.newToken().'&term='.urlencode(empty($_SESSION["takeposterminal
"]) ? '' : $_SESSION["takeposterminal
"]); ?>",
974function MoreActions(totalactions){
977 for (i = 0; i <= totalactions; i++){
978 if (i<12) $(
"#action"+i).hide();
979 else $(
"#action"+i).show();
982 else if (pageactions==1){
984 for (i = 0; i <= totalactions; i++){
985 if (i<12) $(
"#action"+i).show();
986 else $(
"#action"+i).hide();
993function ControlCashOpening()
995 $.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
"); ?>"});
998function CloseCashFence(
rowid)
1000 $.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
"); ?>"});
1003function CashReport(
rowid)
1005 $.colorbox({href:
"../compta/cashcontrol/report.php?id="+
rowid+
"&contextpage=takepos", width:
"60%", height:
"90%", transition:
"none", iframe:
"true", title:
"<?php echo $langs->trans("CashReport
"); ?>"});
1009function ModalBox(ModalID)
1011 var modal = document.getElementById(ModalID);
1012 modal.style.display =
"block";
1015function DirectPayment(){
1016 console.log(
"DirectPayment");
1017 $(
"#poslines").load(
"invoice.php?place="+place+
"&action=valid&token=<?php echo newToken(); ?>&pay=LIQ",
function() {
1021function FullScreen() {
1022 document.documentElement.requestFullscreen();
1025function WeighingScale(){
1026 console.log(
"Weighing Scale");
1029 data: { token:
'notrequired' },
1030 url:
'<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER
'); ?>/scale/index.php',
1032 .done(
function( editnumber ) {
1033 $(
"#poslines").load(
"invoice.php?token=<?php echo newToken(); ?>&place="+place+
"&idline="+selectedline+
"&number="+editnumber,
function() {
1039$( document ).ready(
function() {
1045 if (empty($_SESSION[
"takeposterminal"]) || $_SESSION[
"takeposterminal"] ==
"") {
1046 print
"ModalBox('ModalTerminal');";
1050 $sql =
"SELECT rowid, status FROM ".MAIN_DB_PREFIX.
"pos_cash_fence WHERE";
1051 $sql .=
" entity = ".((int) $conf->entity).
" AND ";
1052 $sql .=
" posnumber = ".((int) $_SESSION[
"takeposterminal"]).
" AND ";
1054 $resql = $db->query($sql);
1056 $obj = $db->fetch_object($resql);
1058 if (!isset($obj->rowid) || is_null($obj->rowid)) {
1059 print
"ControlCashOpening();";
1066 var elem1 = $(
"#topnav-left")[0];
1067 var elem2 = $(
"#topnav-right")[0];
1068 var checkOverflow =
function() {
1069 if (scrollBars().horizontal) $(
"#topnav").addClass(
"overflow");
1070 else $(
"#topnav").removeClass(
"overflow");
1073 var scrollBars =
function(){
1074 var container= $(
'#topnav')[0];
1076 vertical:container.scrollHeight > container.clientHeight,
1077 horizontal:container.scrollWidth > container.clientWidth
1081 $(window).resize(
function(){
1085 let resizeObserver =
new ResizeObserver(() => {
1088 resizeObserver.observe(elem1);
1089 resizeObserver.observe(elem2);
1092 var pressTimer = [];
1096 $(
".indicator").mousedown(
function(){
1097 direction = $(
this).hasClass(
"left") ? -1 : 1;
1099 pressTimer.push(setInterval(scrollTo, 100));
1102 $(
".indicator").mouseup(
function(){
1103 pressTimer.forEach(clearInterval);
1106 $(
"body").mouseup(
function(){
1107 pressTimer.forEach(clearInterval);
1108 console.log(
"body mouseup");
1111 function scrollTo(){
1112 console.log(
"here");
1113 var pos = $(
"#topnav").scrollLeft();
1114 document.getElementById(
"topnav").scrollTo({ left: $(
"#topnav").scrollLeft() + direction * step, behavior:
'smooth' })
1117 $(
"#topnav").scroll(
function(){
1118 if (($(
"#topnav").offsetWidth + $(
"#topnav").scrollLeft >= $(
"#topnav").scrollWidth)) {
1127$keyCodeForEnter =
'';
1128if (!empty($_SESSION[
'takeposterminal'])) {
1129 $keyCodeForEnter =
getDolGlobalInt(
'CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION[
'takeposterminal']) > 0 ?
getDolGlobalString(
'CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION[
'takeposterminal']) :
'';
1132<div
class=
"container">
1137 <div
class=
"header">
1138 <div
id=
"topnav" class=
"topnav">
1139 <div
id=
"topnav-left" class=
"topnav-left">
1140 <div
class=
"inline-block valignmiddle">
1141 <a
class=
"topnav-terminalhour" onclick=
"ModalBox('ModalTerminal')">
1142 <span
class=
"fa fa-cash-register"></span>
1143 <span
class=
"hideonsmartphone">
1145 if (!empty($_SESSION[
"takeposterminal"])) {
1146 echo
getDolGlobalString(
"TAKEPOS_TERMINAL_NAME_".$_SESSION[
"takeposterminal"], $langs->trans(
"TerminalName", $_SESSION[
"takeposterminal"]));
1151 echo
'<span class="hideonsmartphone"> - '.dol_print_date(
dol_now(),
"day").
'</span>'; ?>
1154 if (isModEnabled(
'multicurrency')) {
1155 print
'<a class="valignmiddle tdoverflowmax100" id="multicurrency" onclick="ModalBox(\'ModalCurrency\')" title=""><span class="fas fa-coins paddingrightonly"></span>';
1156 print
'<span class="hideonsmartphone">'.$langs->trans(
"Currency").
'</span>';
1160 <!-- section
for customer -->
1161 <div
class=
"inline-block valignmiddle" id=
"customerandsales"></div>
1162 <input
type=
"hidden" id=
"idcustomer" value=
"">
1163 <!-- section
for shopping carts -->
1164 <div
class=
"inline-block valignmiddle" id=
"shoppingcart"></div>
1165 <!-- More info about customer -->
1166 <div
class=
"inline-block valignmiddle tdoverflowmax150onsmartphone" id=
"moreinfo"></div>
1168 if (isModEnabled(
'stock')) {
1170 <!-- More info about warehouse -->
1171 <div
class=
"inline-block valignmiddle tdoverflowmax150onsmartphone" id=
"infowarehouse"></div>
1175 <div
id=
"topnav-right" class=
"topnav-right">
1177 $reshook = $hookmanager->executeHooks(
'takepos_login_block_other');
1178 if ($reshook == 0) {
1180 <div
class=
"login_block_other takepos">
1181 <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>
1182 <a onclick=
"ClearSearch(false);" class=
"nohover"><span
class=
"fa fa-backspace"></span></a>
1183 <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 -->
1184 <span
class=
"fas fa-home"></span></a>
1185 <?php
if (empty($conf->dol_use_jmobile)) { ?>
1186 <a
class=
"hideonsmartphone" onclick=
"FullScreen();" title=
"<?php echo dol_escape_htmltag($langs->trans("ClickFullScreenEscapeToLeave
")); ?>"><span
class=
"fa fa-expand-arrows-alt"></span></a>
1192 <div
class=
"login_block_user">
1194 print
top_menu_user(1, DOL_URL_ROOT.
'/user/logout.php?token='.
newToken().
'&urlfrom='.urlencode(
'/takepos/?setterminal='.((
int) $term)));
1198 <div
class=
"arrows">
1199 <span
class=
"indicator left"><i
class=
"fa fa-arrow-left"></i></span>
1200 <span
class=
"indicator right"><i
class=
"fa fa-arrow-right"></i></span>
1208<!-- Modal terminal box -->
1209<div
id=
"ModalTerminal" class=
"modal">
1210 <div
class=
"modal-content">
1211 <div
class=
"modal-header">
1215 <span
class=
"close" href=
"#" onclick=
"document.getElementById('ModalTerminal').style.display = 'none';">×</span>
1218 <h3><?php print $langs->trans(
"TerminalSelect"); ?></h3>
1220 <div
class=
"modal-body">
1221 <
button type=
"button" class=
"block" onclick=
"location.href='index.php?setterminal=1'"><?php print
getDolGlobalString(
"TAKEPOS_TERMINAL_NAME_1", $langs->trans(
"TerminalName", 1)); ?></
button>
1224 for ($i = 2; $i <= $nbloop; $i++) {
1225 print
'<button type="button" class="block" onclick="location.href=\'index.php?setterminal='.$i.
'\'">'.getDolGlobalString("TAKEPOS_TERMINAL_NAME_
".$i, $langs->trans("TerminalName
", $i)).'</button>';
1232<!-- Modal multicurrency box -->
1233<?php if (isModEnabled('multicurrency')) { ?>
1234<div id="ModalCurrency
" class="modal
">
1235 <div class="modal-content
">
1236 <div class="modal-header
">
1237 <span class="close
" href="#
" onclick="document.getElementById(
'ModalCurrency').style.display =
'none';
">×</span>
1238 <h3><?php print $langs->trans("SetMultiCurrencyCode
"); ?></h3>
1240 <div class="modal-body
">
1242 $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency';
1243 $sql .= " WHERE entity IN (
'".getEntity('multicurrency
')."')
";
1244 $resql = $db->query($sql);
1246 while ($obj = $db->fetch_object($resql)) {
1247 print '<button type="button" class="block
" onclick="location.href=\
'index.php?setcurrency='.$obj->code.
'\'">'.$obj->code.'</button>';
1256<!-- Modal terminal Credit Note -->
1257<div id="ModalCreditNote
" class="modal
">
1258 <div class="modal-content
">
1259 <div class="modal-header
">
1260 <span class="close
" href="#
" onclick="document.getElementById(
'ModalCreditNote').style.display =
'none';
">×</span>
1261 <h3><?php print $langs->trans("invoiceAvoirWithLines
"); ?></h3>
1263 <div class="modal-body
">
1264 <button type="button" class="block
" onclick="CreditNote(); document.getElementById(
'ModalCreditNote').style.display =
'none';
"><?php print $langs->trans("Yes
"); ?></button>
1265 <button type="button" class="block
" onclick="document.getElementById(
'ModalCreditNote').style.display =
'none';
"><?php print $langs->trans("No
"); ?></button>
1271<div id="ModalNote
" class="modal
">
1272 <div class="modal-content
">
1273 <div class="modal-header
">
1274 <span class="close
" href="#
" onclick="document.getElementById(
'ModalNote').style.display =
'none';
">×</span>
1275 <h3><?php print $langs->trans("Note
"); ?></h3>
1277 <div class="modal-body
">
1278 <input type="text
" class="block
" id="textinput
">
1279 <button type="button" class="block
" onclick="SetNote(); document.getElementById(
'ModalNote').style.display =
'none';
">OK</button>
1288 <div id="poslines
" class="div1
">
1292 <button type="button" class="calcbutton
" onclick="Edit(7);
">7</button>
1293 <button type="button" class="calcbutton
" onclick="Edit(8);
">8</button>
1294 <button type="button" class="calcbutton
" onclick="Edit(9);
">9</button>
1295 <button type="button" id="qty
" class="calcbutton2
" onclick="Edit(
'qty')
"><?php echo $langs->trans("Qty
"); ?></button>
1296 <button type="button" class="calcbutton
" onclick="Edit(4);
">4</button>
1297 <button type="button" class="calcbutton
" onclick="Edit(5);
">5</button>
1298 <button type="button" class="calcbutton
" onclick="Edit(6);
">6</button>
1299 <button type="button" id="price" class="calcbutton2
" onclick="Edit(
'p')
"><?php echo $langs->trans("Price
"); ?></button>
1300 <button type="button" class="calcbutton
" onclick="Edit(1);
">1</button>
1301 <button type="button" class="calcbutton
" onclick="Edit(2);
">2</button>
1302 <button type="button" class="calcbutton
" onclick="Edit(3);
">3</button>
1303 <button type="button" id="reduction
" class="calcbutton2
" onclick="Edit(
'r')
"><?php echo $langs->trans("LineDiscountShort
"); ?></button>
1304 <button type="button" class="calcbutton
" onclick="Edit(0);
">0</button>
1305 <button type="button" class="calcbutton
" onclick="Edit(
'.')
">.</button>
1306 <button type="button" class="calcbutton poscolorblue
" onclick="Edit(
'c')
">C</button>
1307 <button type="button" class="calcbutton2 poscolordelete
" id="delete" onclick="deleteline()
"><span class="fa fa-trash
"></span></button>
1312// TakePOS setup check
1313if (isset($_SESSION["takeposterminal
"]) && $_SESSION["takeposterminal
"]) {
1314 $sql = "SELECT code, libelle FROM
" . MAIN_DB_PREFIX . "c_paiement
";
1315 $sql .= " WHERE entity IN (
" . getEntity('c_paiement') . ")
";
1316 $sql .= " AND active = 1
";
1317 $sql .= " ORDER BY libelle
";
1319 $resql = $db->query($sql);
1320 $paiementsModes = array();
1322 while ($obj = $db->fetch_object($resql)) {
1323 $paycode = $obj->code;
1324 if ($paycode == 'LIQ') {
1327 if ($paycode == 'CHQ') {
1328 $paycode = 'CHEQUE';
1331 $constantforkey = "CASHDESK_ID_BANKACCOUNT_
" . $paycode . $_SESSION["takeposterminal
"];
1332 //var_dump($constantforkey.' '.getDolGlobalInt($constantforkey));
1333 if (getDolGlobalInt($constantforkey) > 0) {
1334 array_push($paiementsModes, $obj);
1339 if (empty($paiementsModes) && isModEnabled("bank
")) {
1340 $langs->load('errors');
1341 setEventMessages($langs->trans("ErrorModuleSetupNotComplete
", $langs->transnoentitiesnoconv("TakePOS
")), null, 'errors');
1342 setEventMessages($langs->trans("ProblemIsInSetupOfTerminal
", $_SESSION["takeposterminal
"]), null, 'errors');
1346if (count($maincategories) == 0) {
1347 if (getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID') > 0) {
1348 $tmpcategory = new Categorie($db);
1349 $tmpcategory->fetch(getDolGlobalString('TAKEPOS_ROOT_CATEGORY_ID'));
1350 setEventMessages($langs->trans("TakeposNeedsAtLeastOnSubCategoryIntoParentCategory
", $tmpcategory->label), null, 'errors');
1352 setEventMessages($langs->trans("TakeposNeedsCategories
"), null, 'errors');
1355// User menu and external TakePOS modules
1359if (!getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1360 $menus[$r++] = array('title' => '<span class="fa fa-layer-group paddingrightonly
"></span><div class="trunc
">'.$langs->trans("New
").'</div>', 'action' => 'New();');
1362 // BAR RESTAURANT specific menu
1363 $menus[$r++] = array('title' => '<span class="fa fa-layer-group paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Place
").'</div>', 'action' => 'Floors();');
1366if (getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) {
1367 if (getDolGlobalString('TAKEPOS_CHOOSE_CONTACT')) {
1368 $menus[$r++] = array('title' => '<span class="far fa-building paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Contact").'</div>', 'action' => 'Contact();');
1370 $menus[$r++] = array('title' => '<span class="far fa-building paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Customer
").'</div>', 'action' => 'Customer();');
1373if (! getDolGlobalString('TAKEPOS_HIDE_HISTORY')) {
1374 $menus[$r++] = array('title' => '<span class="fa fa-history paddingrightonly
"></span><div class="trunc
">'.$langs->trans("History
").'</div>', 'action' => 'History();');
1376$menus[$r++] = array('title' => '<span class="fa fa-cube paddingrightonly
"></span><div class="trunc
">'.$langs->trans("FreeZone
").'</div>', 'action' => 'FreeZone();');
1377$menus[$r++] = array('title' => '<span class="fa fa-percent paddingrightonly
"></span><div class="trunc
">'.$langs->trans("InvoiceDiscountShort
").'</div>', 'action' => 'Reduction();');
1379if (!getDolGlobalString('TAKEPOS_NO_SPLIT_SALE')) {
1380 $menus[$r++] = array('title' => '<span class="fas fa-cut paddingrightonly
"></span><div class="trunc
">'.$langs->trans("SplitSale
").'</div>', 'action' => 'Split();');
1383// BAR RESTAURANT specific menu
1384if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1385 if (getDolGlobalString('TAKEPOS_ORDER_PRINTERS')) {
1386 $menus[$r++] = array('title' => '<span class="fa fa-blender-phone paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Order
").'</span>', 'action' => 'TakeposPrintingOrder();');
1390// Last action that close the sell (payments)
1391$menus[$r++] = array('title' => '<span class="far fa-money-bill-alt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Payment
").'</div>', 'action' => 'CloseBill();');
1392if (getDolGlobalString('TAKEPOS_DIRECT_PAYMENT')) {
1393 $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();');
1396// BAR RESTAURANT specific menu
1397if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1398 //Button to print receipt before payment
1399 if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1400 if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector
") {
1401 if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
1402 $menus[$r++] = array('title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Receipt
").'</div>', 'action' => 'TakeposConnector(placeid);');
1404 $menus[$r++] = array('title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Receipt
").'</div>', 'action' => 'TakeposPrinting(placeid);');
1406 } elseif ((isModEnabled('receiptprinter') && getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0) || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter
") {
1407 $menus[$r++] = array('title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Receipt
").'</div>', 'action' => 'DolibarrTakeposPrinting(placeid);');
1409 $menus[$r++] = array('title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Receipt
").'</div>', 'action' => 'Print(placeid);');
1412 if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector
" && getDolGlobalString('TAKEPOS_ORDER_NOTES') == 1) {
1413 $menus[$r++] = array('title' => '<span class="fa fa-sticky-note paddingrightonly
"></span><div class="trunc
">'.$langs->trans("OrderNotes
").'</div>', 'action' => 'TakeposOrderNotes();');
1415 if (getDolGlobalString('TAKEPOS_SUPPLEMENTS')) {
1416 $menus[$r++] = array('title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("ProductSupplements
").'</div>', 'action' => 'LoadProducts(\'supplements\');');
1420if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector
") {
1421 $menus[$r++] = array('title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("DOL_OPEN_DRAWER
").'</div>', 'action' => 'OpenDrawer();');
1423if (getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0 || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter
") {
1424 $menus[$r++] = array(
1425 'title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("DOL_OPEN_DRAWER
").'</div>',
1426 'action' => 'DolibarrOpenDrawer();',
1430$sql = "SELECT
rowid,
status, entity FROM
".MAIN_DB_PREFIX."pos_cash_fence WHERE
";
1431$sql .= " entity =
".((int) $conf->entity)." AND
";
1432$sql .= " posnumber =
".((int) empty($_SESSION["takeposterminal
"]) ? 0 : $_SESSION["takeposterminal
"])." AND
";
1433$sql .= " date_creation >
'".$db->idate(dol_get_first_hour(dol_now()))."'";
1435$resql = $db->query($sql);
1437 $num = $db->num_rows($resql);
1439 $obj = $db->fetch_object($resql);
1440 $menus[$r++] = array('title' => '<span class="fas fa-file-invoice-dollar paddingrightonly
"></span><div class="trunc
">'.$langs->trans("CashReport
").'</div>', 'action' => 'CashReport('.$obj->rowid.');');
1441 if ($obj->status == 0) {
1442 $menus[$r++] = array('title' => '<span class="fas fa-cash-
register paddingrightonly
"></span><div class="trunc
">'.$langs->trans("CloseCashFence
").'</div>', 'action' => 'CloseCashFence('.$obj->rowid.');');
1447$parameters = array('menus' => $menus);
1448$reshook = $hookmanager->executeHooks('ActionButtons', $parameters);
1449if ($reshook == 0) { //add buttons
1450 if (is_array($hookmanager->resArray)) {
1451 foreach ($hookmanager->resArray as $resArray) {
1452 foreach ($resArray as $butmenu) {
1453 $menus[$r++] = $butmenu;
1456 } elseif ($reshook == 1) {
1457 $r = 0; //replace buttons
1458 if (is_array($hookmanager->resArray)) {
1459 foreach ($hookmanager->resArray as $resArray) {
1460 foreach ($resArray as $butmenu) {
1461 $menus[$r++] = $butmenu;
1469 $menus[$r++] = array('title' => '', 'style' => 'visibility: hidden;');
1472if (getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) {
1473 $menus[$r++] = array('title' => '<span class="fa fa-sign-out-alt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Logout
").'</div>', 'action' => 'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php?token='.newToken().'\';');
1476if (getDolGlobalString('TAKEPOS_WEIGHING_SCALE')) {
1477 $menus[$r++] = array('title' => '<span class="fa fa-balance-scale paddingrightonly
"></span><div class="trunc
">'.$langs->trans("WeighingScale
").'</div>', 'action' => 'WeighingScale();');
1481 <!-- Show buttons -->
1485 foreach ($menus as $menu) {
1487 if (count($menus) > 12 and $i == 12) {
1488 echo '<button style="'.(empty($menu['style
']) ? '' : $menu['style
']).'" type="button" id="actionnext
" class="actionbutton
" onclick="MoreActions(
'.count($menus).')
">'.$langs->trans("Next
").'</button>';
1489 echo '<button style="display: none;
" type="button" id="action
'.$i.'" class="actionbutton
" onclick="'.(empty($menu['action
']) ? '' : $menu['action
']).'">'.$menu['title'].'</button>';
1490 } elseif ($i > 12) {
1491 echo '<button style="display: none;
" type="button" id="action
'.$i.'" class="actionbutton
" onclick="'.(empty($menu['action
']) ? '' : $menu['action
']).'">'.$menu['title'].'</button>';
1493 echo '<button style="'.(empty($menu['style
']) ? '' : $menu['style
']).'" type="button" id="action
'.$i.'" class="actionbutton
" onclick="'.(empty($menu['action
']) ? '' : $menu['action
']).'">'.$menu['title'].'</button>';
1497 if (getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR') && !getDolGlobalString('TAKEPOS_HIDE_SEARCH')) {
1498 print '<!-- Show the search input text -->'."\n
";
1499 print '<div class="margintoponly
">';
1500 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> ';
1501 print '<a class="marginleftonly hideonsmartphone
" onclick="ClearSearch(
false);
">'.img_picto('', 'searchclear').'</a>';
1512 <!-- Show categories -->
1514 if (getDolGlobalInt('TAKEPOS_HIDE_CATEGORIES') == 1) {
1515 print '<div class="div4
" style= "display: none;
">';
1517 print '<div class="div4
">';
1521 while ($count < $MAXCATEG) {
1523 <div class="wrapper
" <?php if ($count == ($MAXCATEG - 2)) {
1524 echo 'onclick="MoreCategories(\
'less\')"';
1525 } elseif ($count == ($MAXCATEG - 1)) {
1526 echo
'onclick="MoreCategories(\'more\')"';
1528 echo
'onclick="LoadProducts('.$count.
')"';
1529 } ?>
id=
"catdiv<?php echo $count; ?>">
1531 if ($count == ($MAXCATEG - 2)) {
1533 echo
'<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1534 } elseif ($count == ($MAXCATEG - 1)) {
1536 echo
'<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1539 echo
'<img class="imgwrapper" id="catimg'.$count.
'" />';
1542 <?php
if ($count != $MAXCATEG - 2 && $count != $MAXCATEG - 1) { ?>
1543 <div
class=
"description" id=
"catdivdesc<?php echo $count; ?>">
1544 <div
class=
"description_content" id=
"catdesc<?php echo $count; ?>"></div>
1547 <div
class=
"catwatermark" id=
'catwatermark<?php echo $count; ?>'>...</div>
1555 <!-- Show product -->
1556 <div
class=
"div5<?php if (getDolGlobalInt('TAKEPOS_HIDE_CATEGORIES') == 1) {
1557 print ' centpercent';
1561 while ($count < $MAXPRODUCT) {
1562 print
'<div class="wrapper2 arrow" id="prodiv'.$count.
'" '; ?>
1563 <?php
if ($count == ($MAXPRODUCT - 2)) {
1564 ?> onclick=
"MoreProducts('less')" <?php
1566 if ($count == ($MAXPRODUCT - 1)) {
1567 ?> onclick=
"MoreProducts('more')" <?php
1569 echo
'onclick="ClickProduct('.$count.
')"';
1572 if ($count == ($MAXPRODUCT - 2)) {
1574 print
'<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1575 } elseif ($count == ($MAXPRODUCT - 1)) {
1577 print
'<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1580 print
'<div class="" id="proprice'.$count.
'"></div>';
1583 print
'<button type="button" id="probutton'.$count.
'" class="productbutton" style="display: none;"></button>';
1585 print
'<img class="imgwrapper" title="" id="proimg'.$count.
'">';
1588 <?php
if ($count != $MAXPRODUCT - 2 && $count != $MAXPRODUCT - 1 && !
getDolGlobalString(
'TAKEPOS_HIDE_PRODUCT_IMAGES')) { ?>
1589 <div
class=
"description" id=
"prodivdesc<?php echo $count; ?>">
1590 <div
class=
"description_content" id=
"prodesc<?php echo $count; ?>"></div>
1593 <div
class=
"catwatermark" id=
'prowatermark<?php echo $count; ?>'>...</div>
1599 <input
type=
"hidden" id=
"search_start_less" value=
"0">
1600 <input
type=
"hidden" id=
"search_start_more" value=
"0">
1601 <input
type=
"hidden" id=
"search_pagination" value=
"">
print $langs trans("AuditedSecurityEvents").'</strong >< span class="opacitymedium"></span >< br > status
Or an array listing all the potential status of the object: array: int of the status => translated la...
Class to manage categories.
dol_get_first_hour($date, $gm='tzserver')
Return GMT time for first hour of a given GMT date (it removes hours, min and second part)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by 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)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
ui state ui widget content ui state ui widget header ui state a ui 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.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
publicphonebutton2 phonegreen basiclayout basiclayout TotalHT VATCode TotalVAT TotalLT1 TotalLT2 TotalTTC TotalHT clearboth nowraponall TAKEPOS_SHOW_SUBPRICE right right right takeposterminal SELECT e rowid