30 if (!defined(
'NOCSRFCHECK')) {
31 define(
'NOCSRFCHECK',
'1');
33 if (!defined(
'NOTOKENRENEWAL')) {
34 define(
'NOTOKENRENEWAL',
'1');
36 if (!defined(
'NOREQUIREMENU')) {
37 define(
'NOREQUIREMENU',
'1');
39 if (!defined(
'NOREQUIREHTML')) {
40 define(
'NOREQUIREHTML',
'1');
42 if (!defined(
'NOREQUIREAJAX')) {
43 define(
'NOREQUIREAJAX',
'1');
46 require
'../main.inc.php';
47 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
51 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
52 require_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
53 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
55 $place = (
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') : 0);
56 $action =
GETPOST(
'action',
'aZ09');
57 $setterminal =
GETPOST(
'setterminal',
'int');
58 $setcurrency =
GETPOST(
'setcurrency',
'aZ09');
60 if (empty($_SESSION[
"takeposterminal"])) {
62 $_SESSION[
"takeposterminal"] = 1;
63 } elseif (!empty($_COOKIE[
"takeposterminal"])) {
64 $_SESSION[
"takeposterminal"] = preg_replace(
'/[^a-zA-Z0-9_\-]/',
'', $_COOKIE[
"takeposterminal"]);
68 if ($setterminal > 0) {
69 $_SESSION[
"takeposterminal"] = $setterminal;
70 setcookie(
"takeposterminal", $setterminal, (time() + (86400 * 354)),
'/', null, (empty($dolibarr_main_force_https) ?
false :
true),
true);
73 if ($setcurrency !=
"") {
74 $_SESSION[
"takeposcustomercurrency"] = $setcurrency;
78 $_SESSION[
"urlfrom"] =
'/takepos/index.php';
80 $langs->loadLangs(array(
"bills",
"orders",
"commercial",
"cashdesk",
"receiptprinter",
"banks"));
84 $maxcategbydefaultforthisdevice = 12;
85 $maxproductbydefaultforthisdevice = 24;
86 if ($conf->browser->layout ==
'phone') {
87 $maxcategbydefaultforthisdevice = 8;
88 $maxproductbydefaultforthisdevice = 16;
90 if ($_SESSION[
"takeposterminal"] !=
"" && $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1) {
91 $_SESSION[
"basiclayout"] = 1;
92 header(
"Location: phone.php?mobilepage=invoice");
96 $MAXCATEG = (empty($conf->global->TAKEPOS_NB_MAXCATEG) ? $maxcategbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXCATEG);
97 $MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT) ? $maxproductbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXPRODUCT);
119 $arrayofjs = array();
120 $arrayofcss = array();
123 $title =
'TakePOS - Dolibarr '.DOL_VERSION;
124 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
125 $title =
'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
127 $head =
'<meta name="apple-mobile-web-app-title" content="TakePOS"/>
128 <meta name="apple-mobile-web-app-capable" content="yes">
129 <meta name="mobile-web-app-capable" content="yes">
130 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
131 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
134 <link rel=
"stylesheet" href=
"css/pos.css.php">
135 <link rel=
"stylesheet" href=
"css/colorbox.css" type=
"text/css" media=
"screen" />
138 print
'<link rel="stylesheet" href="css/colorful.css">';
141 <script
type=
"text/javascript" src=
"js/jquery.colorbox-min.js"></script> <!-- TODO It seems we don
't need this -->
142 <script type="text/javascript">
144 $categories = $categorie->get_full_arbo('product
', ((getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID
') > 0) ? getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID
') : 0), 1);
147 // Search root category to know its level
148 //$conf->global->TAKEPOS_ROOT_CATEGORY_ID=0;
149 $levelofrootcategory = 0;
150 if (getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID
') > 0) {
151 foreach ($categories as $key => $categorycursor) {
152 if ($categorycursor['id'] == getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID
')) {
153 $levelofrootcategory = $categorycursor['level
'];
159 $levelofmaincategories = $levelofrootcategory + 1;
161 $maincategories = array();
162 $subcategories = array();
163 foreach ($categories as $key => $categorycursor) {
164 if ($categorycursor['level
'] == $levelofmaincategories) {
165 $maincategories[$key] = $categorycursor;
167 $subcategories[$key] = $categorycursor;
171 $maincategories = dol_sort_array($maincategories, 'label
');
172 $subcategories = dol_sort_array($subcategories, 'label
');
175 var categories = <?php echo json_encode($maincategories); ?>;
176 var subcategories = <?php echo json_encode($subcategories); ?>;
180 var pagecategories=0;
182 var place="<?php echo $place; ?>";
183 var editaction="qty";
186 var search2_timer=null;
190 app.hasKeyboard = false;
191 this.keyboardPress = function() {
192 app.hasKeyboard = true;
193 $(window).unbind("keyup", app.keyboardPress);
194 localStorage.hasKeyboard = true;
195 console.log("has keyboard!")
197 $(window).on("keyup", app.keyboardPress)
198 if(localStorage.hasKeyboard) {
199 app.hasKeyboard = true;
200 $(window).unbind("keyup", app.keyboardPress);
201 console.log("has keyboard from localStorage")
205 function ClearSearch() {
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("ReductionShort"); ?>").removeClass('clicked
');
211 <?php if ($conf->browser->layout == 'classic
') { ?>
212 setFocusOnSearchField();
216 // Set the focus on search field but only on desktop. On tablet or smartphone, we don't to avoid to have the keyboard open automatically
217 function setFocusOnSearchField() {
218 console.log(
"Call setFocusOnSearchField in page index.php");
219 <?php
if ($conf->browser->layout ==
'classic') { ?>
220 console.log(
"has keyboard from localStorage, so we can force focus on search field");
221 $(
"#search").focus();
225 function PrintCategories(first) {
226 console.log(
"PrintCategories");
227 for (i = 0; i < <?php echo ($MAXCATEG - 2); ?>; i++) {
228 if (typeof (categories[parseInt(i)+parseInt(first)]) ==
"undefined")
230 $(
"#catdivdesc"+i).hide();
231 $(
"#catdesc"+i).text(
"");
232 $(
"#catimg"+i).attr(
"src",
"genimg/empty.png");
233 $(
"#catwatermark"+i).hide();
234 $(
"#catdiv"+i).attr(
'class',
'wrapper divempty');
237 $(
"#catdivdesc"+i).show();
240 $(
"#catdesc"+i).html(categories[parseInt(i)+parseInt(first)][
'label'].bold() +
' - ' + categories[parseInt(i)+parseInt(first)][
'description']);
242 $(
"#catdesc"+i).text(categories[parseInt(i)+parseInt(first)][
'label']);
244 $(
"#catimg"+i).attr(
"src",
"genimg/index.php?query=cat&id="+categories[parseInt(i)+parseInt(first)][
'rowid']);
245 $(
"#catdiv"+i).data(
"rowid",categories[parseInt(i)+parseInt(first)][
'rowid']);
246 $(
"#catdiv"+i).attr(
'class',
'wrapper');
247 $(
"#catwatermark"+i).show();
251 function MoreCategories(moreorless) {
252 console.log(
"MoreCategories moreorless="+moreorless+
" pagecategories="+pagecategories);
253 if (moreorless==
"more") {
254 $(
'#catimg15').animate({opacity:
'0.5'}, 1);
255 $(
'#catimg15').animate({opacity:
'1'}, 100);
256 pagecategories=pagecategories+1;
258 if (moreorless==
"less") {
259 $(
'#catimg14').animate({opacity:
'0.5'}, 1);
260 $(
'#catimg14').animate({opacity:
'1'}, 100);
261 if (pagecategories==0)
return;
262 pagecategories=pagecategories-1;
264 if (typeof (categories[<?php echo ($MAXCATEG - 2); ?> * pagecategories] && moreorless==
"more") ==
"undefined"){
265 pagecategories=pagecategories-1;
268 for (i = 0; i < <?php echo ($MAXCATEG - 2); ?>; i++) {
269 if (typeof (categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]) ==
"undefined") {
270 $(
"#catdivdesc"+i).hide();
271 $(
"#catdesc"+i).text(
"");
272 $(
"#catimg"+i).attr(
"src",
"genimg/empty.png");
273 $(
"#catwatermark"+i).hide();
276 $(
"#catdivdesc"+i).show();
279 $(
"#catdesc"+i).html(categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)][
'label'].bold() +
' - ' + categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)][
'description']);
281 $(
"#catdesc"+i).text(categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)][
'label']);
283 $(
"#catimg"+i).attr(
"src",
"genimg/index.php?query=cat&id="+categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)][
'rowid']);
284 $(
"#catdiv"+i).data(
"rowid",categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)][
'rowid']);
285 $(
"#catwatermark"+i).show();
292 function LoadProducts(position, issubcat) {
293 console.log(
"LoadProducts");
294 var maxproduct = <?php echo ($MAXPRODUCT - 2); ?>;
296 if (position==
"supplements") currentcat=
"supplements";
299 $(
'#catimg'+position).animate({opacity:
'0.5'}, 1);
300 $(
'#catimg'+position).animate({opacity:
'1'}, 100);
301 if (issubcat==
true) currentcat=$(
'#prodiv'+position).data(
'rowid');
302 else currentcat=$(
'#catdiv'+position).data(
'rowid');
304 if (currentcat == undefined)
return;
308 jQuery.each(subcategories,
function(i, val) {
309 if (currentcat==val.fk_parent) {
310 $(
"#prodivdesc"+ishow).show();
312 $(
"#prodesc"+ishow).html(val.label.bold() +
' - ' + val.description);
313 $(
"#probutton"+ishow).html(val.label);
315 $(
"#prodesc"+ishow).text(val.label);
316 $(
"#probutton"+ishow).text(val.label);
318 $(
"#probutton"+ishow).show();
319 $(
"#proprice"+ishow).attr(
"class",
"hidden");
320 $(
"#proprice"+ishow).html(
"");
321 $(
"#proimg"+ishow).attr(
"src",
"genimg/index.php?query=cat&id="+val.rowid);
322 $(
"#prodiv"+ishow).data(
"rowid",val.rowid);
323 $(
"#prodiv"+ishow).data(
"iscat",1);
324 $(
"#prowatermark"+ishow).show();
330 $.getJSON(
'<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&category='+currentcat,
function(data) {
331 console.log(
"Call ajax.php (in LoadProducts) to get Products of category "+currentcat+
" then loop on result to fill image thumbs");
333 while (ishow < maxproduct) {
335 console.log(data[idata]);
336 if (typeof (data[idata]) ==
"undefined") {
338 echo
'$("#prodivdesc"+ishow).hide();';
339 echo
'$("#prodesc"+ishow).text("");';
340 echo
'$("#proimg"+ishow).attr("title","");';
341 echo
'$("#proimg"+ishow).attr("src","genimg/empty.png");';
343 echo
'$("#probutton"+ishow).hide();';
344 echo
'$("#probutton"+ishow).text("");';
346 $(
"#proprice"+ishow).attr(
"class",
"hidden");
347 $(
"#proprice"+ishow).html(
"");
348 $(
"#prodiv"+ishow).data(
"rowid",
"");
349 $(
"#prodiv"+ishow).attr(
"class",
"wrapper2 divempty");
350 $(
"#prowatermark"+ishow).hide();
353 else if ((data[idata][
'status']) ==
"1") {
355 $titlestring =
"'".dol_escape_js($langs->transnoentities(
'Ref').
': ').
"' + data[idata]['ref']";
356 $titlestring .=
" + ' - ".dol_escape_js($langs->trans(
"Barcode").
': ').
"' + data[idata]['barcode']";
358 var titlestring = <?php echo $titlestring; ?>;
360 echo
'$("#prodivdesc"+ishow).show();';
362 echo
'$("#prodesc"+ishow).html(data[parseInt(idata)][\'ref\'].bold() + \' - \' + data[parseInt(idata)][\'label\']);';
364 echo
'$("#prodesc"+ishow).html(data[parseInt(idata)][\'label\']);';
366 echo
'$("#proimg"+ishow).attr("title", titlestring);';
367 echo
'$("#proimg"+ishow).attr("src", "genimg/index.php?query=pro&id="+data[idata][\'id\']);';
369 echo
'$("#probutton"+ishow).show();';
370 echo
'$("#probutton"+ishow).html(data[parseInt(idata)][\'label\']);';
373 if (data[parseInt(idata)][
'price_formated']) {
374 $(
"#proprice"+ishow).attr(
"class",
"productprice");
375 $(
"#proprice"+ishow).html(data[parseInt(idata)][
'price_formated']);
377 $(
"#prodiv"+ishow).data(
"rowid", data[idata][
'id']);
378 $(
"#prodiv"+ishow).data(
"iscat", 0);
379 $(
"#prodiv"+ishow).attr(
"class",
"wrapper2");
380 $(
"#prowatermark"+ishow).hide();
385 $parameters[
'caller'] =
'loadProducts';
386 $hookmanager->executeHooks(
'completeJSProductDisplay', $parameters);
387 print $hookmanager->resPrint;
398 function MoreProducts(moreorless) {
399 console.log(
"MoreProducts");
401 if ($(
'#search_pagination').val() !=
'')
return Search2(
'<?php echo $keyCodeForEnter; ?>', moreorless);
403 var maxproduct = <?php echo ($MAXPRODUCT - 2); ?>;
405 if (moreorless==
"more"){
406 $(
'#proimg31').animate({opacity:
'0.5'}, 1);
407 $(
'#proimg31').animate({opacity:
'1'}, 100);
408 pageproducts=pageproducts+1;
410 if (moreorless==
"less"){
411 $(
'#proimg30').animate({opacity:
'0.5'}, 1);
412 $(
'#proimg30').animate({opacity:
'1'}, 100);
413 if (pageproducts==0)
return;
414 pageproducts=pageproducts-1;
416 $.getJSON(
'<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&category='+currentcat,
function(data) {
417 console.log(
"Call ajax.php (in MoreProducts) to get Products of category "+currentcat);
419 if (typeof (data[(maxproduct * pageproducts)]) ==
"undefined" && moreorless==
"more"){
420 pageproducts=pageproducts-1;
423 idata=<?php echo ($MAXPRODUCT - 2); ?> * pageproducts;
426 while (ishow < maxproduct) {
427 if (typeof (data[idata]) ==
"undefined") {
428 $(
"#prodivdesc"+ishow).hide();
429 $(
"#prodesc"+ishow).text(
"");
430 $(
"#probutton"+ishow).text(
"");
431 $(
"#probutton"+ishow).hide();
432 $(
"#proprice"+ishow).attr(
"class",
"");
433 $(
"#proprice"+ishow).html(
"");
434 $(
"#proimg"+ishow).attr(
"src",
"genimg/empty.png");
435 $(
"#prodiv"+ishow).data(
"rowid",
"");
438 else if ((data[idata][
'status']) ==
"1") {
440 $(
"#prodivdesc"+ishow).show();
443 $(
"#prodesc"+ishow).html(data[parseInt(idata)][
'ref'].bold() +
' - ' + data[parseInt(idata)][
'label']);
445 $(
"#prodesc"+ishow).html(data[parseInt(idata)][
'label']);
447 $(
"#probutton"+ishow).html(data[parseInt(idata)][
'label']);
448 $(
"#probutton"+ishow).show();
449 if (data[parseInt(idata)][
'price_formated']) {
450 $(
"#proprice"+ishow).attr(
"class",
"productprice");
451 $(
"#proprice"+ishow).html(data[parseInt(idata)][
'price_formated']);
453 $(
"#proimg"+ishow).attr(
"src",
"genimg/index.php?query=pro&id="+data[idata][
'id']);
454 $(
"#prodiv"+ishow).data(
"rowid",data[idata][
'id']);
455 $(
"#prodiv"+ishow).data(
"iscat",0);
458 $(
"#prowatermark"+ishow).hide();
466 function ClickProduct(position, qty = 1) {
467 console.log(
"ClickProduct");
468 $(
'#proimg'+position).animate({opacity:
'0.5'}, 1);
469 $(
'#proimg'+position).animate({opacity:
'1'}, 100);
470 if ($(
'#prodiv'+position).data(
'iscat')==1){
471 console.log(
"Click on a category at position "+position);
472 LoadProducts(position,
true);
475 idproduct=$(
'#prodiv'+position).data(
'rowid');
476 console.log(
"Click on product at position "+position+
" for idproduct "+idproduct+
", qty="+qty);
477 if (idproduct==
"")
return;
479 $(
"#poslines").load(
"invoice.php?action=addline&token=<?php echo newToken() ?>&place="+place+
"&idproduct="+idproduct+
"&selectedline="+selectedline+
"&qty="+qty,
function() {
480 <?php
if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) echo
"CustomerDisplay();";?>
487 function ChangeThirdparty(idcustomer) {
488 console.log(
"ChangeThirdparty");
490 $(
"#poslines").load(
"../societe/list.php?action=change&type=t&contextpage=poslist&idcustomer="+idcustomer+
"&place="+place+
"",
function() {
496 function deleteline() {
497 console.log(
"Delete line");
498 $(
"#poslines").load(
"invoice.php?action=deleteline&token=<?php echo newToken(); ?>&place="+place+
"&idline="+selectedline,
function() {
504 function Customer() {
505 console.log(
"Open box to select the thirdparty place="+place);
506 $.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
"); ?>"});
511 console.log(
"Open box to select the history");
512 $.colorbox({href:
"../compta/facture/list.php?contextpage=poslist", width:
"90%", height:
"80%", transition:
"none", iframe:
"true", title:
"<?php echo $langs->trans("History
"); ?>"});
515 function Reduction() {
516 invoiceid = $(
"#invoiceid").val();
517 console.log(
"Open popup to enter reduction on invoiceid="+invoiceid);
518 $.colorbox({href:
"reduction.php?place="+place+
"&invoiceid="+invoiceid, width:
"80%", height:
"90%", transition:
"none", iframe:
"true", title:
""});
521 function CloseBill() {
522 invoiceid = $(
"#invoiceid").val();
523 console.log(
"Open popup to enter payment on invoiceid="+invoiceid);
524 $.colorbox({href:
"pay.php?place="+place+
"&invoiceid="+invoiceid, width:
"80%", height:
"90%", transition:
"none", iframe:
"true", title:
""});
528 invoiceid = $(
"#invoiceid").val();
529 console.log(
"Open popup to split on invoiceid="+invoiceid);
530 $.colorbox({href:
"split.php?place="+place+
"&invoiceid="+invoiceid, width:
"80%", height:
"90%", transition:
"none", iframe:
"true", title:
""});
534 console.log(
"Open box to select floor place="+place);
535 $.colorbox({href:
"floors.php?place="+place, width:
"90%", height:
"90%", transition:
"none", iframe:
"true", title:
"<?php echo $langs->trans("Floors
"); ?>"});
538 function FreeZone() {
539 console.log(
"Open box to enter a free product");
540 $.colorbox({href:
"freezone.php?action=freezone&place="+place, width:
"80%", height:
"200px", transition:
"none", iframe:
"true", title:
"<?php echo $langs->trans("FreeZone
"); ?>"});
543 function TakeposOrderNotes() {
544 console.log(
"Open box to order notes");
545 ModalBox(
'ModalNote');
546 $(
"#textinput").focus();
550 console.log(
"Refresh by reloading place="+place+
" invoiceid="+invoiceid);
551 $(
"#poslines").load(
"invoice.php?place="+place+
"&invoiceid="+invoiceid,
function() {
558 invoiceid = $(
"#invoiceid").val();
560 console.log(
"New with place = <?php echo $place; ?>, js place="+place+
", invoiceid="+invoiceid);
562 $.getJSON(
'<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getInvoice&id='+invoiceid,
function(data) {
565 if (parseInt(data[
'paye']) === 1) {
568 r = confirm(
'<?php echo ($place > 0 ? $langs->transnoentitiesnoconv("ConfirmDeletionOfThisPOSSale") : $langs->transnoentitiesnoconv("ConfirmDiscardOfThisPOSSale")); ?>');
573 $(
"#poslines").load(
"invoice.php?action=delete&token=<?php echo newToken(); ?>&place=" + place,
function () {
587 function Search2(keyCodeForEnter, moreorless) {
588 console.log(
"Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter);
590 var search_term = $(
'#search').val();
591 var search_start = 0;
592 var search_limit = <?php echo $MAXPRODUCT - 2; ?>;
593 if (moreorless != null) {
594 search_term = $(
'#search_pagination').val();
595 search_start = $(
'#search_start_'+moreorless).val();
598 if (search_term ==
'') {
599 $(
"[id^=prowatermark]").html(
"");
600 $(
"[id^=prodesc]").text(
"");
601 $(
"[id^=probutton]").text(
"");
602 $(
"[id^=probutton]").hide();
603 $(
"[id^=proprice]").attr(
"class",
"hidden");
604 $(
"[id^=proprice]").html(
"");
605 $(
"[id^=proimg]").attr(
"src",
"genimg/empty.png");
606 $(
"[id^=prodiv]").data(
"rowid",
"");
611 var eventKeyCode = window.event.keyCode;
612 if (keyCodeForEnter ==
'' || eventKeyCode == keyCodeForEnter) {
616 if (search ===
true) {
620 clearTimeout(search2_timer);
623 search2_timer = setTimeout(
function(){
626 jQuery(
".wrapper2 .catwatermark").hide();
627 var nbsearchresults = 0;
628 $.getJSON(
'<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&term=' + search_term +
'&search_start=' + search_start +
'&search_limit=' + search_limit,
function (data) {
629 for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
630 if (typeof (data[i]) ==
"undefined") {
631 $(
"#prowatermark" + i).html(
"");
632 $(
"#prodesc" + i).text(
"");
633 $(
"#probutton" + i).text(
"");
634 $(
"#probutton" + i).hide();
635 $(
"#proprice" + i).attr(
"class",
"hidden");
636 $(
"#proprice" + i).html(
"");
637 $(
"#proimg" + i).attr(
"src",
"genimg/empty.png");
638 $(
"#prodiv" + i).data(
"rowid",
"");
642 $titlestring =
"'".dol_escape_js($langs->transnoentities(
'Ref').
': ').
"' + data[i]['ref']";
643 $titlestring .=
" + ' - ".dol_escape_js($langs->trans(
"Barcode").
': ').
"' + data[i]['barcode']";
645 var titlestring = <?php echo $titlestring; ?>;
648 $(
"#prodesc" + i).html(data[i][
'ref'].bold() +
' - ' + data[i][
'label']);
650 $(
"#prodesc" + i).html(data[i][
'label']);
652 $(
"#prodivdesc" + i).show();
653 $(
"#probutton" + i).html(data[i][
'label']);
654 $(
"#probutton" + i).show();
655 if (data[i][
'price_formated']) {
656 $(
"#proprice" + i).attr(
"class",
"productprice");
657 $(
"#proprice" + i).html(data[i][
'price_formated']);
659 $(
"#proimg" + i).attr(
"title", titlestring);
660 if( undefined !== data[i][
'img']) {
661 $(
"#proimg" + i).attr(
"src", data[i][
'img']);
664 $(
"#proimg" + i).attr(
"src",
"genimg/index.php?query=pro&id=" + data[i][
'rowid']);
666 $(
"#prodiv" + i).data(
"rowid", data[i][
'rowid']);
667 $(
"#prodiv" + i).data(
"iscat", 0);
672 $parameters[
'caller'] =
'search2';
673 $hookmanager->executeHooks(
'completeJSProductDisplay', $parameters);
674 print $hookmanager->resPrint;
679 }).always(
function (data) {
681 if ($(
'#search').val().length > 0 && data.length == 1) {
682 console.log($(
'#search').val()+
' - '+data[0][
'barcode']);
683 if ($(
'#search').val() == data[0][
'barcode'] &&
'thirdparty' == data[0][
'object']) {
684 console.log(
"There is only 1 answer with barcode matching the search, so we change the thirdparty "+data[0][
'rowid']);
685 ChangeThirdparty(data[0][
'rowid']);
687 else if ($(
'#search').val() == data[0][
'barcode'] &&
'product' == data[0][
'object']) {
688 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']);
689 ClickProduct(0, data[0][
'qty']);
692 if (eventKeyCode == keyCodeForEnter){
693 if (data.length == 0) {
694 $(
'#search').val(
'<?php
695 $langs->load('errors
');
696 echo dol_escape_js($langs->trans("ErrorRecordNotFound"));
698 $(
'#search').select();
703 $(
"#search_pagination").val($(
"#search").val());
704 if (search_start == 0) {
705 $(
"#prodiv<?php echo $MAXPRODUCT - 2; ?> span").hide();
708 $(
"#prodiv<?php echo $MAXPRODUCT - 2; ?> span").show();
709 var search_start_less = Math.max(0, parseInt(search_start) - parseInt(<?php echo $MAXPRODUCT - 2;?>));
710 $(
"#search_start_less").val(search_start_less);
712 if (nbsearchresults != <?php echo $MAXPRODUCT - 2; ?>) {
713 $(
"#prodiv<?php echo $MAXPRODUCT - 1; ?> span").hide();
716 $(
"#prodiv<?php echo $MAXPRODUCT - 1; ?> span").show();
717 var search_start_more = parseInt(search_start) + parseInt(<?php echo $MAXPRODUCT - 2;?>);
718 $(
"#search_start_more").val(search_start_more);
727 function Edit(number) {
728 console.log(
"We click on PAD on key="+number);
730 if (typeof(selectedtext) ==
"undefined") {
734 var text=selectedtext+
"<br> ";
740 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
741 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
742 $(
"#reduction").html(
"<?php echo $langs->trans("ReductionShort
"); ?>").removeClass(
'clicked');
744 }
else if (number==
'qty') {
745 if (editaction==
'qty' && editnumber !=
'') {
746 $(
"#poslines").load(
"invoice.php?action=updateqty&place="+place+
"&idline="+selectedline+
"&number="+editnumber,
function() {
749 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
752 setFocusOnSearchField();
758 }
else if (number==
'p') {
759 if (editaction==
'p' && editnumber!=
"") {
760 $(
"#poslines").load(
"invoice.php?action=updateprice&place="+place+
"&idline="+selectedline+
"&number="+editnumber,
function() {
763 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
772 }
else if (number==
'r') {
773 if (editaction==
'r' && editnumber!=
"") {
774 $(
"#poslines").load(
"invoice.php?action=updatereduction&place="+place+
"&idline="+selectedline+
"&number="+editnumber,
function() {
777 $(
"#reduction").html(
"<?php echo $langs->trans("ReductionShort
"); ?>").removeClass(
'clicked');
788 editnumber=editnumber+number;
790 if (editaction==
'qty'){
791 text=text+
"<?php echo $langs->trans("Modify
")." ->
".$langs->trans("Qty
").":
"; ?>";
792 $(
"#qty").html(
"OK").addClass(
"clicked");
793 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
794 $(
"#reduction").html(
"<?php echo $langs->trans("ReductionShort
"); ?>").removeClass(
'clicked');
796 if (editaction==
'p'){
797 text=text+
"<?php echo $langs->trans("Modify
")." ->
".$langs->trans("Price
").":
"; ?>";
798 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
799 $(
"#price").html(
"OK").addClass(
"clicked");
800 $(
"#reduction").html(
"<?php echo $langs->trans("ReductionShort
"); ?>").removeClass(
'clicked');
802 if (editaction==
'r'){
803 text=text+
"<?php echo $langs->trans("Modify
")." ->
".$langs->trans("ReductionShort
").":
"; ?>";
804 $(
"#qty").html(
"<?php echo $langs->trans("Qty
"); ?>").removeClass(
'clicked');
805 $(
"#price").html(
"<?php echo $langs->trans("Price
"); ?>").removeClass(
'clicked');
806 $(
"#reduction").html(
"OK").addClass(
"clicked");
808 $(
'#'+selectedline).find(
"td:first").html(text+editnumber);
812 function TakeposPrintingOrder(){
813 console.log(
"TakeposPrintingOrder");
814 $(
"#poslines").load(
"invoice.php?action=order&place="+place,
function() {
819 function TakeposPrintingTemp(){
820 console.log(
"TakeposPrintingTemp");
821 $(
"#poslines").load(
"invoice.php?action=temp&place="+place,
function() {
826 function OpenDrawer(){
827 console.log(
"OpenDrawer call ajax url http://<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER'); ?>:8111/print");
830 data: { token:
'notrequired' },
832 if (
getDolGlobalString(
'TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) ==
true) {
833 echo
"url: '".getDolGlobalString(
'TAKEPOS_PRINT_SERVER',
'localhost').
"/printer/drawer.php',";
835 echo
"url: 'http://".getDolGlobalString(
'TAKEPOS_PRINT_SERVER',
'localhost').
":8111/print',";
842 function DolibarrOpenDrawer() {
843 console.log(
"DolibarrOpenDrawer call ajax url /takepos/ajax/ajax.php?action=opendrawer&term=<?php print urlencode($_SESSION["takeposterminal
"]); ?>");
846 data: { token:
'<?php echo currentToken(); ?>' },
847 url:
"<?php print DOL_URL_ROOT.'/takepos/ajax/ajax.php?action=opendrawer&term='.urlencode($_SESSION["takeposterminal
"]); ?>",
851 function MoreActions(totalactions){
854 for (i = 0; i <= totalactions; i++){
855 if (i<12) $(
"#action"+i).hide();
856 else $(
"#action"+i).show();
859 else if (pageactions==1){
861 for (i = 0; i <= totalactions; i++){
862 if (i<12) $(
"#action"+i).show();
863 else $(
"#action"+i).hide();
868 function ControlCashOpening()
870 $.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
"); ?>"});
873 function CloseCashFence(
rowid)
875 $.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
"); ?>"});
878 function CashReport(
rowid)
880 $.colorbox({href:
"../compta/cashcontrol/report.php?id="+
rowid+
"&contextpage=takepos", width:
"60%", height:
"90%", transition:
"none", iframe:
"true", title:
"<?php echo $langs->trans("CashReport
"); ?>"});
884 function ModalBox(ModalID)
886 var modal = document.getElementById(ModalID);
887 modal.style.display =
"block";
890 function DirectPayment(){
891 console.log(
"DirectPayment");
892 $(
"#poslines").load(
"invoice.php?place="+place+
"&action=valid&pay=LIQ",
function() {
896 function FullScreen() {
897 document.documentElement.requestFullscreen();
900 function WeighingScale(){
901 console.log(
"Weighing Scale");
904 data: { token:
'notrequired' },
905 url:
'<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER
'); ?>/scale/index.php',
907 .done(
function( editnumber ) {
908 $(
"#poslines").load(
"invoice.php?action=updateqty&place="+place+
"&idline="+selectedline+
"&number="+editnumber,
function() {
914 $( document ).ready(
function() {
920 if ($_SESSION[
"takeposterminal"] ==
"") {
921 print
"ModalBox('ModalTerminal');";
925 $sql =
"SELECT rowid, status FROM ".MAIN_DB_PREFIX.
"pos_cash_fence WHERE";
926 $sql .=
" entity = ".((int) $conf->entity).
" AND ";
927 $sql .=
" posnumber = ".((int) $_SESSION[
"takeposterminal"]).
" AND ";
929 $resql = $db->query($sql);
931 $obj = $db->fetch_object(
$resql);
933 if ($obj->rowid == null) {
934 print
"ControlCashOpening();";
942 <body
class=
"bodytakepos" style=
"overflow: hidden;">
944 $keyCodeForEnter =
getDolGlobalInt(
'CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION[
'takeposterminal']) > 0 ?
getDolGlobalInt(
'CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION[
'takeposterminal']) :
'';
946 <div
class=
"container">
949 if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
953 <div
class=
"topnav-left">
954 <div
class=
"inline-block valignmiddle">
955 <a
class=
"topnav-terminalhour" onclick=
"ModalBox('ModalTerminal');">
956 <span
class=
"fa fa-cash-register"></span>
957 <span
class=
"hideonsmartphone">
958 <?php echo $langs->trans(
"Terminal"); ?>
961 if ($_SESSION[
"takeposterminal"] ==
"") {
964 echo $_SESSION[
"takeposterminal"];
966 echo
'<span class="hideonsmartphone"> - '.dol_print_date(
dol_now(),
"day").
'</span>';
971 print
'<a class="valignmiddle tdoverflowmax100" id="multicurrency" onclick="ModalBox(\'ModalCurrency\');" title=""><span class="fas fa-coins paddingrightonly"></span>';
972 print
'<span class="hideonsmartphone">'.$langs->trans(
"Currency").
'</span>';
977 <!-- section
for customer -->
978 <div
class=
"inline-block valignmiddle" id=
"customerandsales"></div>
979 <!-- section
for shopping carts -->
980 <div
class=
"inline-block valignmiddle" id=
"shoppingcart"></div>
981 <!-- More info about customer -->
982 <div
class=
"inline-block valignmiddle tdoverflowmax150onsmartphone" id=
"moreinfo"></div>
986 <!-- More info about warehouse -->
987 <div
class=
"inline-block valignmiddle tdoverflowmax150onsmartphone" id=
"infowarehouse"></div>
992 <div
class=
"topnav-right">
993 <div
class=
"login_block_other">
994 <input type=
"text" id=
"search" name=
"search" class=
"input-search-takepos" onkeyup=
"Search2('<?php echo dol_escape_js($keyCodeForEnter); ?>', null);" placeholder=
"<?php echo dol_escape_htmltag($langs->trans("Search
")); ?>" autofocus>
995 <a onclick=
"ClearSearch();"><span
class=
"fa fa-backspace"></span></a>
996 <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 -->
997 <span
class=
"fas fa-home"></span></a>
998 <?php
if (empty($conf->dol_use_jmobile)) { ?>
999 <a
class=
"hideonsmartphone" onclick=
"FullScreen();"><span
class=
"fa fa-expand-arrows-alt"></span></a>
1002 <div
class=
"login_block_user">
1014 <!-- Modal terminal box -->
1015 <div
id=
"ModalTerminal" class=
"modal">
1016 <div
class=
"modal-content">
1017 <div
class=
"modal-header">
1018 <span
class=
"close" href=
"#" onclick=
"document.getElementById('ModalTerminal').style.display = 'none';">×</span>
1019 <h3><?php print $langs->trans(
"TerminalSelect"); ?></h3>
1021 <div
class=
"modal-body">
1022 <button type=
"button" class=
"block" onclick=
"location.href='index.php?setterminal=1'"><?php print $langs->trans(
"Terminal"); ?> 1</button>
1025 for ($i = 2; $i <= $nbloop; $i++) {
1026 print
'<button type="button" class="block" onclick="location.href=\'index.php?setterminal='.$i.
'\'">'.$langs->trans("Terminal
").' '.$i.'</button>';
1033 <!-- Modal multicurrency box -->
1034 <?php if (isModEnabled('multicurrency')) { ?>
1035 <div id="ModalCurrency
" class="modal
">
1036 <div class="modal-content
">
1037 <div class="modal-header
">
1038 <span class="close
" href="#
" onclick="document.getElementById(
'ModalCurrency').style.display =
'none';
">×</span>
1039 <h3><?php print $langs->trans("SetMultiCurrencyCode
"); ?></h3>
1041 <div class="modal-body
">
1043 $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency';
1044 $sql .= " WHERE entity IN (
'".getEntity('multicurrency
')."')
";
1045 $resql = $db->query($sql);
1047 while ($obj = $db->fetch_object($resql)) {
1048 print '<button type="button
" class="block
" onclick="location.href=\
'index.php?setcurrency='.$obj->code.
'\'">'.$obj->code.'</button>';
1057 <!-- Modal terminal Credit Note -->
1058 <div id="ModalCreditNote
" class="modal
">
1059 <div class="modal-content
">
1060 <div class="modal-header
">
1061 <span class="close
" href="#
" onclick="document.getElementById(
'ModalCreditNote').style.display =
'none';
">×</span>
1062 <h3><?php print $langs->trans("invoiceAvoirWithLines
"); ?></h3>
1064 <div class="modal-body
">
1065 <button type="button
" class="block
" onclick="CreditNote(); document.getElementById(
'ModalCreditNote').style.display =
'none';
"><?php print $langs->trans("Yes
"); ?></button>
1066 <button type="button
" class="block
" onclick="document.getElementById(
'ModalCreditNote').style.display =
'none';
"><?php print $langs->trans("No
"); ?></button>
1072 <div id="ModalNote
" class="modal
">
1073 <div class="modal-content
">
1074 <div class="modal-header
">
1075 <span class="close
" href="#
" onclick="document.getElementById(
'ModalNote').style.display =
'none';
">×</span>
1076 <h3><?php print $langs->trans("Note
"); ?></h3>
1078 <div class="modal-body
">
1079 <input type="text
" class="block
" id="textinput
">
1080 <button type="button
" class="block
" onclick="SetNote(); document.getElementById(
'ModalNote').style.display =
'none';
">OK</button>
1085 <div class="row1<?php
if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
1089 <div id="poslines
" class="div1
">
1093 <button type="button
" class="calcbutton
" onclick="Edit(7);
">7</button>
1094 <button type="button
" class="calcbutton
" onclick="Edit(8);
">8</button>
1095 <button type="button
" class="calcbutton
" onclick="Edit(9);
">9</button>
1096 <button type="button
" id="qty
" class="calcbutton2
" onclick="Edit(
'qty');
"><?php echo $langs->trans("Qty
"); ?></button>
1097 <button type="button
" class="calcbutton
" onclick="Edit(4);
">4</button>
1098 <button type="button
" class="calcbutton
" onclick="Edit(5);
">5</button>
1099 <button type="button
" class="calcbutton
" onclick="Edit(6);
">6</button>
1100 <button type="button
" id="price" class="calcbutton2
" onclick="Edit(
'p');
"><?php echo $langs->trans("Price
"); ?></button>
1101 <button type="button
" class="calcbutton
" onclick="Edit(1);
">1</button>
1102 <button type="button
" class="calcbutton
" onclick="Edit(2);
">2</button>
1103 <button type="button
" class="calcbutton
" onclick="Edit(3);
">3</button>
1104 <button type="button
" id="reduction
" class="calcbutton2
" onclick="Edit(
'r');
"><?php echo $langs->trans("ReductionShort
"); ?></button>
1105 <button type="button
" class="calcbutton
" onclick="Edit(0);
">0</button>
1106 <button type="button
" class="calcbutton
" onclick="Edit(
'.');
">.</button>
1107 <button type="button
" class="calcbutton poscolorblue
" onclick="Edit(
'c');
">C</button>
1108 <button type="button
" class="calcbutton2 poscolordelete
" id="delete" onclick="deleteline();
"><span class="fa fa-trash
"></span></button>
1113 // TakePOS setup check
1114 if (isset($_SESSION["takeposterminal
"]) && $_SESSION["takeposterminal
"]) {
1115 $sql = "SELECT
code, libelle FROM
" . MAIN_DB_PREFIX . "c_paiement
";
1116 $sql .= " WHERE entity IN (
" . getEntity('c_paiement') . ")
";
1117 $sql .= " AND active = 1
";
1118 $sql .= " ORDER BY libelle
";
1120 $resql = $db->query($sql);
1121 $paiementsModes = array();
1123 while ( $obj = $db->fetch_object($resql) ) {
1124 $paycode = $obj->code;
1125 if ($paycode == 'LIQ') {
1128 if ($paycode == 'CHQ') {
1129 $paycode = 'CHEQUE';
1132 $constantforkey = "CASHDESK_ID_BANKACCOUNT_
" . $paycode . $_SESSION["takeposterminal
"];
1133 //var_dump($constantforkey.' '.$conf->global->$constantforkey);
1134 if ( ! empty($conf->global->$constantforkey) && $conf->global->$constantforkey > 0) {
1135 array_push($paiementsModes, $obj);
1140 if (empty($paiementsModes) && isModEnabled('banque')) {
1141 $langs->load('errors');
1142 setEventMessages($langs->trans("ErrorModuleSetupNotComplete
", $langs->transnoentitiesnoconv("TakePOS
")), null, 'errors');
1143 setEventMessages($langs->trans("ProblemIsInSetupOfTerminal
", $_SESSION["takeposterminal
"]), null, 'errors');
1147 if (count($maincategories) == 0) {
1148 if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) {
1149 $tmpcategory = new Categorie($db);
1150 $tmpcategory->fetch($conf->global->TAKEPOS_ROOT_CATEGORY_ID);
1151 setEventMessages($langs->trans("TakeposNeedsAtLeastOnSubCategoryIntoParentCategory
", $tmpcategory->label), null, 'errors');
1153 setEventMessages($langs->trans("TakeposNeedsCategories
"), null, 'errors');
1156 // User menu and external TakePOS modules
1160 if (empty($conf->global->TAKEPOS_BAR_RESTAURANT)) {
1161 $menus[$r++] = array('title'=>'<span class="fa fa-layer-group paddingrightonly
"></span><div class="trunc
">'.$langs->trans("New
").'</div>', 'action'=>'New();');
1163 // BAR RESTAURANT specific menu
1164 $menus[$r++] = array('title'=>'<span class="fa fa-layer-group paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Place
").'</div>', 'action'=>'Floors();');
1167 if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
1168 $menus[$r++] = array('title'=>'<span class="far fa-building paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Customer
").'</div>', 'action'=>'Customer();');
1170 $menus[$r++] = array('title'=>'<span class="fa fa-history paddingrightonly
"></span><div class="trunc
">'.$langs->trans("History
").'</div>', 'action'=>'History();');
1171 $menus[$r++] = array('title'=>'<span class="fa fa-cube paddingrightonly
"></span><div class="trunc
">'.$langs->trans("FreeZone
").'</div>', 'action'=>'FreeZone();');
1172 $menus[$r++] = array('title'=>'<span class="fa fa-percent paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Reduction
").'</div>', 'action'=>'Reduction();');
1173 $menus[$r++] = array('title'=>'<span class="far fa-money-bill-alt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Payment
").'</div>', 'action'=>'CloseBill();');
1175 if (getDolGlobalString('TAKEPOS_DIRECT_PAYMENT')) {
1176 $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();');
1179 $menus[$r++] = array('title'=>'<span class="fas fa-cut paddingrightonly
"></span><div class="trunc
">'.$langs->trans("SplitSale
").'</div>', 'action'=>'Split();');
1181 // BAR RESTAURANT specific menu
1182 if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1183 if (getDolGlobalString('TAKEPOS_ORDER_PRINTERS')) {
1184 $menus[$r++] = array('title'=>'<span class="fa fa-blender-phone paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Order
").'</span>', 'action'=>'TakeposPrintingOrder();');
1186 //Button to print receipt before payment
1187 if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
1188 if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector
") {
1189 if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
1190 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Receipt
").'</div>', 'action'=>'TakeposConnector(placeid);');
1192 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Receipt
").'</div>', 'action'=>'TakeposPrinting(placeid);');
1194 } elseif (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter
") {
1195 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Receipt
").'</div>', 'action'=>'DolibarrTakeposPrinting(placeid);');
1197 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("Receipt
").'</div>', 'action'=>'Print(placeid);');
1200 if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector
" && getDolGlobalString('TAKEPOS_ORDER_NOTES') == 1) {
1201 $menus[$r++] = array('title'=>'<span class="fa fa-sticky-note paddingrightonly
"></span><div class="trunc
">'.$langs->trans("OrderNotes
").'</div>', 'action'=>'TakeposOrderNotes();');
1203 if (getDolGlobalString('TAKEPOS_SUPPLEMENTS')) {
1204 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("ProductSupplements
").'</div>', 'action'=>'LoadProducts(\'supplements\');');
1208 if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector
") {
1209 $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("DOL_OPEN_DRAWER
").'</div>', 'action'=>'OpenDrawer();');
1211 if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter
") {
1212 $menus[$r++] = array(
1213 'title' => '<span class="fa fa-receipt paddingrightonly
"></span><div class="trunc
">'.$langs->trans("DOL_OPEN_DRAWER
").'</div>',
1214 'action' => 'DolibarrOpenDrawer();',
1218 $sql = "SELECT
rowid, status, entity FROM
".MAIN_DB_PREFIX."pos_cash_fence WHERE
";
1219 $sql .= " entity =
".((int) $conf->entity)." AND
";
1220 $sql .= " posnumber =
".((int) $_SESSION["takeposterminal
"])." AND
";
1221 $sql .= " date_creation >
'".$db->idate(dol_get_first_hour(dol_now()))."'";
1223 $resql = $db->query($sql);
1225 $num = $db->num_rows($resql);
1227 $obj = $db->fetch_object($resql);
1228 $menus[$r++] = array('title'=>'<span class="fas fa-file-invoice-dollar paddingrightonly
"></span><div class="trunc
">'.$langs->trans("CashReport
").'</div>', 'action'=>'CashReport('.$obj->rowid.');');
1229 if ($obj->status == 0) {
1230 $menus[$r++] = array('title'=>'<span class="fas fa-cash-
register paddingrightonly
"></span><div class="trunc
">'.$langs->trans("CloseCashFence
").'</div>', 'action'=>'CloseCashFence('.$obj->rowid.');');
1235 $hookmanager->initHooks(array('takeposfrontend'));
1236 $parameters = array('menus'=>$menus);
1237 $reshook = $hookmanager->executeHooks('ActionButtons', $parameters);
1238 if ($reshook == 0) { //add buttons
1239 if (is_array($hookmanager->resArray) ) {
1240 foreach ($hookmanager->resArray as $resArray) {
1241 foreach ($resArray as $butmenu) {
1242 $menus[$r++] = $butmenu;
1245 } elseif ($reshook == 1) {
1246 $r = 0; //replace buttons
1247 if (is_array($hookmanager->resArray) ) {
1248 foreach ($hookmanager->resArray as $resArray) {
1249 foreach ($resArray as $butmenu) {
1250 $menus[$r++] = $butmenu;
1258 $menus[$r++] = array('title'=>'', 'style'=>'visibility: hidden;');
1261 if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
1262 $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().'\';');
1265 if (!empty($conf->global->TAKEPOS_WEIGHING_SCALE)) {
1266 $menus[$r++] = array('title'=>'<span class="fa fa-balance-scale paddingrightonly
"></span><div class="trunc
">'.$langs->trans("WeighingScale
").'</div>', 'action'=>'WeighingScale();');
1270 <!-- Show buttons -->
1274 foreach ($menus as $menu) {
1276 if (count($menus) > 12 and $i == 12) {
1277 echo '<button style="'.(empty($menu['style
']) ? '' : $menu['style
']).'" type="button
" id="actionnext
" class="actionbutton
" onclick="MoreActions(
'.count($menus).');
">'.$langs->trans("Next
").'</button>';
1278 echo '<button style="display: none;
" type="button
" id="action
'.$i.'" class="actionbutton
" onclick="'.(empty($menu['action
']) ? '' : $menu['action
']).'">'.$menu['title'].'</button>';
1279 } elseif ($i > 12) {
1280 echo '<button style="display: none;
" type="button
" id="action
'.$i.'" class="actionbutton
" onclick="'.(empty($menu['action
']) ? '' : $menu['action
']).'">'.$menu['title'].'</button>';
1282 echo '<button style="'.(empty($menu['style
']) ? '' : $menu['style
']).'" type="button
" id="action
'.$i.'" class="actionbutton
" onclick="'.(empty($menu['action
']) ? '' : $menu['action
']).'">'.$menu['title'].'</button>';
1286 if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
1287 print '<!-- Show the search input text -->'."\n
";
1288 print '<div class="margintoponly
">';
1289 print '<input type="text
" id="search
" class="input-search-takepos
" name="search
" onkeyup="Search2(\
''.
dol_escape_js($keyCodeForEnter).
'\', null);
" style="width: 80%; width:calc(100% - 51px); font-size: 150%;
" placeholder="'.dol_escape_htmltag($langs->trans("Search")).'" autofocus> ';
1290 print '<a class="marginleftonly hideonsmartphone
" onclick="ClearSearch();
">'.img_picto('', 'searchclear').'</a>';
1297 <div class="row2<?php
if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
1301 <!-- Show categories -->
1303 if (getDolGlobalInt('TAKEPOS_HIDE_CATEGORIES') == 1) {
1304 print '<div class="div4
" style= "display: none;
">';
1306 print '<div class="div4
">';
1310 while ($count < $MAXCATEG) {
1312 <div class="wrapper
" <?php if ($count == ($MAXCATEG - 2)) {
1313 echo 'onclick="MoreCategories(\
'less\');"';
1314 } elseif ($count == ($MAXCATEG - 1)) {
1315 echo
'onclick="MoreCategories(\'more\');"';
1317 echo
'onclick="LoadProducts('.$count.
');"';
1318 } ?>
id=
"catdiv<?php echo $count; ?>">
1320 if ($count == ($MAXCATEG - 2)) {
1322 echo
'<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1323 } elseif ($count == ($MAXCATEG - 1)) {
1325 echo
'<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1328 echo
'<img class="imgwrapper" height="100%" id="catimg'.$count.
'" />';
1332 <?php
if ($count != ($MAXCATEG - 2) && $count != ($MAXCATEG - 1)) { ?>
1333 <div
class=
"description" id=
"catdivdesc<?php echo $count; ?>">
1334 <div
class=
"description_content" id=
"catdesc<?php echo $count; ?>"></div>
1337 <div
class=
"catwatermark" id=
'catwatermark<?php echo $count; ?>'>...</div>
1345 <!-- Show product -->
1346 <div
class=
"div5"<?php
if (
getDolGlobalInt(
'TAKEPOS_HIDE_CATEGORIES') == 1) {
1347 print
' style="width:100%;"';
1351 while ($count < $MAXPRODUCT) {
1352 print
'<div class="wrapper2" id="prodiv'.$count.
'" ';
1354 <?php
if ($count == ($MAXPRODUCT - 2)) {
1355 ?> onclick=
"MoreProducts('less');" <?php
1356 }
if ($count == ($MAXPRODUCT - 1)) {
1357 ?> onclick=
"MoreProducts('more');" <?php
1359 echo
'onclick="ClickProduct('.$count.
');"';
1362 if ($count == ($MAXPRODUCT - 2)) {
1364 print
'<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1365 } elseif ($count == ($MAXPRODUCT - 1)) {
1367 print
'<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
1370 echo
'<button type="button" id="probutton'.$count.
'" class="productbutton" style="display: none;"></button>';
1372 print
'<div class="" id="proprice'.$count.
'"></div>';
1373 print
'<img class="imgwrapper" height="100%" title="" id="proimg'.$count.
'">';
1377 <?php
if ($count != ($MAXPRODUCT - 2) && $count != ($MAXPRODUCT - 1) && !
getDolGlobalString(
'TAKEPOS_HIDE_PRODUCT_IMAGES')) { ?>
1378 <div
class=
"description" id=
"prodivdesc<?php echo $count; ?>">
1379 <div
class=
"description_content" id=
"prodesc<?php echo $count; ?>"></div>
1382 <div
class=
"catwatermark" id=
'prowatermark<?php echo $count; ?>'>...</div>
1388 <input type=
"hidden" id=
"search_start_less" value=
"0">
1389 <input type=
"hidden" id=
"search_start_more" value=
"0">
1390 <input type=
"hidden" id=
"search_pagination" value=
"">
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_now($mode= 'auto')
Return date for now.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default= '')
Return dolibarr global constant string value.
$conf db name
Only used if Module[ID]Name translation string is not found.
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...
Class to manage categories.
print *****$script_file(".$version.") pid code
! Closing after partial payment: discount_vat, badcustomer or badsupplier, bankcharge, other ! Closing when no payment: replaced, abandoned
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) ...
restrictedArea($user, $features, $objectid=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.
if(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->supplier_invoice->lire)) if(isModEnabled('don')&&!empty($user->rights->don->lire)) if(isModEnabled('tax')&&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture')&&isModEnabled('commande')&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
top_menu_user($hideloginname=0, $urllogout= '')
Build the tooltip on user login.
top_htmlhead($head, $title= '', $disablejs=0, $disablehead=0, $arrayofjs= '', $arrayofcss= '', $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
isModEnabled($module)
Is Dolibarr module enabled.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
print *****$script_file(".$version.") pid c cd cd cd description as p label as s rowid