index.php 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403
  1. <?php
  2. /* Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.com>
  3. * Copyright (C) 2019 Josep Lluís Amador <joseplluis@lliuretic.cat>
  4. * Copyright (C) 2020 Thibault FOUCART <support@ptibogxiv.net>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \file htdocs/takepos/index.php
  21. * \ingroup takepos
  22. * \brief Main TakePOS screen
  23. */
  24. //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
  25. //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
  26. //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
  27. //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
  28. if (!defined('NOCSRFCHECK')) {
  29. define('NOCSRFCHECK', '1');
  30. }
  31. if (!defined('NOTOKENRENEWAL')) {
  32. define('NOTOKENRENEWAL', '1');
  33. }
  34. if (!defined('NOREQUIREMENU')) {
  35. define('NOREQUIREMENU', '1');
  36. }
  37. if (!defined('NOREQUIREHTML')) {
  38. define('NOREQUIREHTML', '1');
  39. }
  40. if (!defined('NOREQUIREAJAX')) {
  41. define('NOREQUIREAJAX', '1');
  42. }
  43. require '../main.inc.php'; // Load $user and permissions
  44. require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
  45. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
  46. require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
  47. require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
  48. require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
  49. require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
  50. require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
  51. $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant or multiple sales
  52. $action = GETPOST('action', 'aZ09');
  53. $setterminal = GETPOST('setterminal', 'int');
  54. $setcurrency = GETPOST('setcurrency', 'aZ09');
  55. if (empty($_SESSION["takeposterminal"])) {
  56. if (getDolGlobalInt('TAKEPOS_NUM_TERMINALS') == 1) {
  57. $_SESSION["takeposterminal"] = 1; // Use terminal 1 if there is only 1 terminal
  58. } elseif (!empty($_COOKIE["takeposterminal"])) {
  59. $_SESSION["takeposterminal"] = preg_replace('/[^a-zA-Z0-9_\-]/', '', $_COOKIE["takeposterminal"]); // Restore takeposterminal from previous session
  60. }
  61. }
  62. if ($setterminal > 0) {
  63. $_SESSION["takeposterminal"] = $setterminal;
  64. setcookie("takeposterminal", $setterminal, (time() + (86400 * 354)), '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Permanent takeposterminal var in a cookie
  65. }
  66. if ($setcurrency != "") {
  67. $_SESSION["takeposcustomercurrency"] = $setcurrency;
  68. // We will recalculate amount for foreign currency at next call of invoice.php when $_SESSION["takeposcustomercurrency"] differs from invoice->multicurrency_code.
  69. }
  70. $_SESSION["urlfrom"] = '/takepos/index.php';
  71. $langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter", "banks"));
  72. $categorie = new Categorie($db);
  73. $maxcategbydefaultforthisdevice = 12;
  74. $maxproductbydefaultforthisdevice = 24;
  75. if ($conf->browser->layout == 'phone') {
  76. $maxcategbydefaultforthisdevice = 8;
  77. $maxproductbydefaultforthisdevice = 16;
  78. //REDIRECT TO BASIC LAYOUT IF TERMINAL SELECTED AND BASIC MOBILE LAYOUT ENABLED
  79. if ($_SESSION["takeposterminal"] != "" && $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1) {
  80. $_SESSION["basiclayout"] = 1;
  81. header("Location: phone.php?mobilepage=invoice");
  82. exit;
  83. }
  84. }
  85. $MAXCATEG = (empty($conf->global->TAKEPOS_NB_MAXCATEG) ? $maxcategbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXCATEG);
  86. $MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT) ? $maxproductbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXPRODUCT);
  87. /*
  88. $constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
  89. $soc = new Societe($db);
  90. if ($invoice->socid > 0) $soc->fetch($invoice->socid);
  91. else $soc->fetch($conf->global->$constforcompanyid);
  92. */
  93. // Security check
  94. $result = restrictedArea($user, 'takepos', 0, '');
  95. /*
  96. * View
  97. */
  98. $form = new Form($db);
  99. $disablejs = 0;
  100. $disablehead = 0;
  101. $arrayofjs = array();
  102. $arrayofcss = array();
  103. // Title
  104. $title = 'TakePOS - Dolibarr '.DOL_VERSION;
  105. if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
  106. $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
  107. }
  108. $head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/>
  109. <meta name="apple-mobile-web-app-capable" content="yes">
  110. <meta name="mobile-web-app-capable" content="yes">
  111. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
  112. top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
  113. ?>
  114. <link rel="stylesheet" href="css/pos.css.php">
  115. <link rel="stylesheet" href="css/colorbox.css" type="text/css" media="screen" />
  116. <?php
  117. if (getDolGlobalInt('TAKEPOS_COLOR_THEME') == 1) {
  118. print '<link rel="stylesheet" href="css/colorful.css">';
  119. }
  120. ?>
  121. <script type="text/javascript" src="js/jquery.colorbox-min.js"></script> <!-- TODO It seems we don't need this -->
  122. <script type="text/javascript">
  123. <?php
  124. $categories = $categorie->get_full_arbo('product', ((getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID') > 0) ? getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID') : 0), 1);
  125. // Search root category to know its level
  126. //$conf->global->TAKEPOS_ROOT_CATEGORY_ID=0;
  127. $levelofrootcategory = 0;
  128. if (getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID') > 0) {
  129. foreach ($categories as $key => $categorycursor) {
  130. if ($categorycursor['id'] == getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID')) {
  131. $levelofrootcategory = $categorycursor['level'];
  132. break;
  133. }
  134. }
  135. }
  136. $levelofmaincategories = $levelofrootcategory + 1;
  137. $maincategories = array();
  138. $subcategories = array();
  139. foreach ($categories as $key => $categorycursor) {
  140. if ($categorycursor['level'] == $levelofmaincategories) {
  141. $maincategories[$key] = $categorycursor;
  142. } else {
  143. $subcategories[$key] = $categorycursor;
  144. }
  145. }
  146. $maincategories = dol_sort_array($maincategories, 'label');
  147. $subcategories = dol_sort_array($subcategories, 'label');
  148. ?>
  149. var categories = <?php echo json_encode($maincategories); ?>;
  150. var subcategories = <?php echo json_encode($subcategories); ?>;
  151. var currentcat;
  152. var pageproducts=0;
  153. var pagecategories=0;
  154. var pageactions=0;
  155. var place="<?php echo $place; ?>";
  156. var editaction="qty";
  157. var editnumber="";
  158. var invoiceid=0;
  159. var search2_timer=null;
  160. /*
  161. var app = this;
  162. app.hasKeyboard = false;
  163. this.keyboardPress = function() {
  164. app.hasKeyboard = true;
  165. $(window).unbind("keyup", app.keyboardPress);
  166. localStorage.hasKeyboard = true;
  167. console.log("has keyboard!")
  168. }
  169. $(window).on("keyup", app.keyboardPress)
  170. if(localStorage.hasKeyboard) {
  171. app.hasKeyboard = true;
  172. $(window).unbind("keyup", app.keyboardPress);
  173. console.log("has keyboard from localStorage")
  174. }
  175. */
  176. function ClearSearch() {
  177. console.log("ClearSearch");
  178. $("#search").val('');
  179. $("#qty").html("<?php echo $langs->trans("Qty"); ?>").removeClass('clicked');
  180. $("#price").html("<?php echo $langs->trans("Price"); ?>").removeClass('clicked');
  181. $("#reduction").html("<?php echo $langs->trans("ReductionShort"); ?>").removeClass('clicked');
  182. <?php if ($conf->browser->layout == 'classic') { ?>
  183. setFocusOnSearchField();
  184. <?php } ?>
  185. }
  186. // 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
  187. function setFocusOnSearchField() {
  188. console.log("Call setFocusOnSearchField in page index.php");
  189. <?php if ($conf->browser->layout == 'classic') { ?>
  190. console.log("has keyboard from localStorage, so we can force focus on search field");
  191. $("#search").focus();
  192. <?php } ?>
  193. }
  194. function PrintCategories(first) {
  195. console.log("PrintCategories");
  196. for (i = 0; i < <?php echo ($MAXCATEG - 2); ?>; i++) {
  197. if (typeof (categories[parseInt(i)+parseInt(first)]) == "undefined")
  198. {
  199. $("#catdivdesc"+i).hide();
  200. $("#catdesc"+i).text("");
  201. $("#catimg"+i).attr("src","genimg/empty.png");
  202. $("#catwatermark"+i).hide();
  203. $("#catdiv"+i).attr('class', 'wrapper divempty');
  204. continue;
  205. }
  206. $("#catdivdesc"+i).show();
  207. <?php
  208. if (getDolGlobalString('TAKEPOS_SHOW_CATEGORY_DESCRIPTION') == 1) { ?>
  209. $("#catdesc"+i).html(categories[parseInt(i)+parseInt(first)]['label'].bold() + ' - ' + categories[parseInt(i)+parseInt(first)]['description']);
  210. <?php } else { ?>
  211. $("#catdesc"+i).text(categories[parseInt(i)+parseInt(first)]['label']);
  212. <?php } ?>
  213. $("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[parseInt(i)+parseInt(first)]['rowid']);
  214. $("#catdiv"+i).data("rowid",categories[parseInt(i)+parseInt(first)]['rowid']);
  215. $("#catdiv"+i).attr('class', 'wrapper');
  216. $("#catwatermark"+i).show();
  217. }
  218. }
  219. function MoreCategories(moreorless) {
  220. console.log("MoreCategories moreorless="+moreorless+" pagecategories="+pagecategories);
  221. if (moreorless=="more") {
  222. $('#catimg15').animate({opacity: '0.5'}, 1);
  223. $('#catimg15').animate({opacity: '1'}, 100);
  224. pagecategories=pagecategories+1;
  225. }
  226. if (moreorless=="less") {
  227. $('#catimg14').animate({opacity: '0.5'}, 1);
  228. $('#catimg14').animate({opacity: '1'}, 100);
  229. if (pagecategories==0) return; //Return if no less pages
  230. pagecategories=pagecategories-1;
  231. }
  232. if (typeof (categories[<?php echo ($MAXCATEG - 2); ?> * pagecategories] && moreorless=="more") == "undefined"){ // Return if no more pages
  233. pagecategories=pagecategories-1;
  234. return;
  235. }
  236. for (i = 0; i < <?php echo ($MAXCATEG - 2); ?>; i++) {
  237. if (typeof (categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]) == "undefined") {
  238. $("#catdivdesc"+i).hide();
  239. $("#catdesc"+i).text("");
  240. $("#catimg"+i).attr("src","genimg/empty.png");
  241. $("#catwatermark"+i).hide();
  242. continue;
  243. }
  244. $("#catdivdesc"+i).show();
  245. <?php
  246. if (getDolGlobalString('TAKEPOS_SHOW_CATEGORY_DESCRIPTION') == 1) { ?>
  247. $("#catdesc"+i).html(categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]['label'].bold() + ' - ' + categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]['description']);
  248. <?php } else { ?>
  249. $("#catdesc"+i).text(categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]['label']);
  250. <?php } ?>
  251. $("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]['rowid']);
  252. $("#catdiv"+i).data("rowid",categories[i+(<?php echo ($MAXCATEG - 2); ?> * pagecategories)]['rowid']);
  253. $("#catwatermark"+i).show();
  254. }
  255. ClearSearch();
  256. }
  257. // LoadProducts
  258. function LoadProducts(position, issubcat) {
  259. console.log("LoadProducts");
  260. var maxproduct = <?php echo ($MAXPRODUCT - 2); ?>;
  261. if (position=="supplements") currentcat="supplements";
  262. else
  263. {
  264. $('#catimg'+position).animate({opacity: '0.5'}, 1);
  265. $('#catimg'+position).animate({opacity: '1'}, 100);
  266. if (issubcat==true) currentcat=$('#prodiv'+position).data('rowid');
  267. else currentcat=$('#catdiv'+position).data('rowid');
  268. }
  269. if (currentcat == undefined) return;
  270. pageproducts=0;
  271. ishow=0; //product to show counter
  272. jQuery.each(subcategories, function(i, val) {
  273. if (currentcat==val.fk_parent) {
  274. $("#prodivdesc"+ishow).show();
  275. <?php if (getDolGlobalString('TAKEPOS_SHOW_CATEGORY_DESCRIPTION') == 1) { ?>
  276. $("#prodesc"+ishow).html(val.label.bold() + ' - ' + val.description);
  277. $("#probutton"+ishow).html(val.label);
  278. <?php } else { ?>
  279. $("#prodesc"+ishow).text(val.label);
  280. $("#probutton"+ishow).text(val.label);
  281. <?php } ?>
  282. $("#probutton"+ishow).show();
  283. $("#proprice"+ishow).attr("class", "hidden");
  284. $("#proprice"+ishow).html("");
  285. $("#proimg"+ishow).attr("src","genimg/index.php?query=cat&id="+val.rowid);
  286. $("#prodiv"+ishow).data("rowid",val.rowid);
  287. $("#prodiv"+ishow).data("iscat",1);
  288. $("#prowatermark"+ishow).show();
  289. ishow++;
  290. }
  291. });
  292. idata=0; //product data counter
  293. $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&category='+currentcat, function(data) {
  294. console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat+" then loop on result to fill image thumbs");
  295. console.log(data);
  296. while (ishow < maxproduct) {
  297. //console.log("ishow"+ishow+" idata="+idata);
  298. console.log(data[idata]);
  299. if (typeof (data[idata]) == "undefined") {
  300. <?php if (!getDolGlobalString('TAKEPOS_HIDE_PRODUCT_IMAGES')) {
  301. echo '$("#prodivdesc"+ishow).hide();';
  302. echo '$("#prodesc"+ishow).text("");';
  303. echo '$("#proimg"+ishow).attr("title","");';
  304. echo '$("#proimg"+ishow).attr("src","genimg/empty.png");';
  305. } else {
  306. echo '$("#probutton"+ishow).hide();';
  307. echo '$("#probutton"+ishow).text("");';
  308. }?>
  309. $("#proprice"+ishow).attr("class", "hidden");
  310. $("#proprice"+ishow).html("");
  311. $("#prodiv"+ishow).data("rowid","");
  312. $("#prodiv"+ishow).attr("class","wrapper2 divempty");
  313. $("#prowatermark"+ishow).hide();
  314. ishow++; //Next product to show after print data product
  315. }
  316. else if ((data[idata]['status']) == "1") { // Only show products with status=1 (for sell)
  317. <?php
  318. $titlestring = "'".dol_escape_js($langs->transnoentities('Ref').': ')."' + data[idata]['ref']";
  319. $titlestring .= " + ' - ".dol_escape_js($langs->trans("Barcode").': ')."' + data[idata]['barcode']";
  320. ?>
  321. var titlestring = <?php echo $titlestring; ?>;
  322. <?php if (!getDolGlobalString('TAKEPOS_HIDE_PRODUCT_IMAGES')) {
  323. echo '$("#prodivdesc"+ishow).show();';
  324. if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) {
  325. echo '$("#prodesc"+ishow).html(data[parseInt(idata)][\'ref\'].bold() + \' - \' + data[parseInt(idata)][\'label\']);';
  326. } else {
  327. echo '$("#prodesc"+ishow).html(data[parseInt(idata)][\'label\']);';
  328. }
  329. echo '$("#proimg"+ishow).attr("title", titlestring);';
  330. echo '$("#proimg"+ishow).attr("src", "genimg/index.php?query=pro&id="+data[idata][\'id\']);';
  331. } else {
  332. echo '$("#probutton"+ishow).show();';
  333. echo '$("#probutton"+ishow).html(data[parseInt(idata)][\'label\']);';
  334. }
  335. ?>
  336. if (data[parseInt(idata)]['price_formated']) {
  337. $("#proprice"+ishow).attr("class", "productprice");
  338. $("#proprice"+ishow).html(data[parseInt(idata)]['price_formated']);
  339. }
  340. $("#prodiv"+ishow).data("rowid", data[idata]['id']);
  341. $("#prodiv"+ishow).data("iscat", 0);
  342. $("#prodiv"+ishow).attr("class","wrapper2");
  343. $("#prowatermark"+ishow).hide();
  344. ishow++; //Next product to show after print data product
  345. <?php
  346. // Add js from hooks
  347. $parameters=array();
  348. $parameters['caller'] = 'loadProducts';
  349. $hookmanager->executeHooks('completeJSProductDisplay', $parameters);
  350. print $hookmanager->resPrint;
  351. ?>
  352. }
  353. //console.log("Hide the prowatermark for ishow="+ishow);
  354. idata++; //Next data everytime
  355. }
  356. });
  357. ClearSearch();
  358. }
  359. function MoreProducts(moreorless) {
  360. console.log("MoreProducts");
  361. if ($('#search_pagination').val() != '') return Search2('<?php echo $keyCodeForEnter; ?>', moreorless);
  362. var maxproduct = <?php echo ($MAXPRODUCT - 2); ?>;
  363. if (moreorless=="more"){
  364. $('#proimg31').animate({opacity: '0.5'}, 1);
  365. $('#proimg31').animate({opacity: '1'}, 100);
  366. pageproducts=pageproducts+1;
  367. }
  368. if (moreorless=="less"){
  369. $('#proimg30').animate({opacity: '0.5'}, 1);
  370. $('#proimg30').animate({opacity: '1'}, 100);
  371. if (pageproducts==0) return; //Return if no less pages
  372. pageproducts=pageproducts-1;
  373. }
  374. $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&category='+currentcat, function(data) {
  375. console.log("Call ajax.php (in MoreProducts) to get Products of category "+currentcat);
  376. if (typeof (data[(maxproduct * pageproducts)]) == "undefined" && moreorless=="more"){ // Return if no more pages
  377. pageproducts=pageproducts-1;
  378. return;
  379. }
  380. idata=<?php echo ($MAXPRODUCT - 2); ?> * pageproducts; //product data counter
  381. ishow=0; //product to show counter
  382. while (ishow < maxproduct) {
  383. if (typeof (data[idata]) == "undefined") {
  384. $("#prodivdesc"+ishow).hide();
  385. $("#prodesc"+ishow).text("");
  386. $("#probutton"+ishow).text("");
  387. $("#probutton"+ishow).hide();
  388. $("#proprice"+ishow).attr("class", "");
  389. $("#proprice"+ishow).html("");
  390. $("#proimg"+ishow).attr("src","genimg/empty.png");
  391. $("#prodiv"+ishow).data("rowid","");
  392. ishow++; //Next product to show after print data product
  393. }
  394. else if ((data[idata]['status']) == "1") {
  395. //Only show products with status=1 (for sell)
  396. $("#prodivdesc"+ishow).show();
  397. <?php
  398. if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) { ?>
  399. $("#prodesc"+ishow).html(data[parseInt(idata)]['ref'].bold() + ' - ' + data[parseInt(idata)]['label']);
  400. <?php } else { ?>
  401. $("#prodesc"+ishow).html(data[parseInt(idata)]['label']);
  402. <?php } ?>
  403. $("#probutton"+ishow).html(data[parseInt(idata)]['label']);
  404. $("#probutton"+ishow).show();
  405. if (data[parseInt(idata)]['price_formated']) {
  406. $("#proprice"+ishow).attr("class", "productprice");
  407. $("#proprice"+ishow).html(data[parseInt(idata)]['price_formated']);
  408. }
  409. $("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']);
  410. $("#prodiv"+ishow).data("rowid",data[idata]['id']);
  411. $("#prodiv"+ishow).data("iscat",0);
  412. ishow++; //Next product to show after print data product
  413. }
  414. $("#prowatermark"+ishow).hide();
  415. idata++; //Next data everytime
  416. }
  417. });
  418. ClearSearch();
  419. }
  420. function ClickProduct(position, qty = 1) {
  421. console.log("ClickProduct");
  422. $('#proimg'+position).animate({opacity: '0.5'}, 1);
  423. $('#proimg'+position).animate({opacity: '1'}, 100);
  424. if ($('#prodiv'+position).data('iscat')==1){
  425. console.log("Click on a category at position "+position);
  426. LoadProducts(position, true);
  427. }
  428. else{
  429. idproduct=$('#prodiv'+position).data('rowid');
  430. console.log("Click on product at position "+position+" for idproduct "+idproduct+", qty="+qty);
  431. if (idproduct=="") return;
  432. // Call page invoice.php to generate the section with product lines
  433. $("#poslines").load("invoice.php?action=addline&token=<?php echo newToken() ?>&place="+place+"&idproduct="+idproduct+"&selectedline="+selectedline+"&qty="+qty, function() {
  434. <?php if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) echo "CustomerDisplay();";?>
  435. });
  436. }
  437. ClearSearch();
  438. }
  439. function ChangeThirdparty(idcustomer) {
  440. console.log("ChangeThirdparty");
  441. // Call page list.php to change customer
  442. $("#poslines").load("../societe/list.php?action=change&type=t&contextpage=poslist&idcustomer="+idcustomer+"&place="+place+"", function() {
  443. });
  444. ClearSearch();
  445. }
  446. function deleteline() {
  447. console.log("Delete line");
  448. $("#poslines").load("invoice.php?action=deleteline&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline, function() {
  449. //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
  450. });
  451. ClearSearch();
  452. }
  453. function Customer() {
  454. console.log("Open box to select the thirdparty place="+place);
  455. $.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"); ?>"});
  456. }
  457. function History()
  458. {
  459. console.log("Open box to select the history");
  460. $.colorbox({href:"../compta/facture/list.php?contextpage=poslist", width:"90%", height:"80%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("History"); ?>"});
  461. }
  462. function Reduction() {
  463. invoiceid = $("#invoiceid").val();
  464. console.log("Open popup to enter reduction on invoiceid="+invoiceid);
  465. $.colorbox({href:"reduction.php?place="+place+"&invoiceid="+invoiceid, width:"80%", height:"90%", transition:"none", iframe:"true", title:""});
  466. }
  467. function CloseBill() {
  468. invoiceid = $("#invoiceid").val();
  469. console.log("Open popup to enter payment on invoiceid="+invoiceid);
  470. $.colorbox({href:"pay.php?place="+place+"&invoiceid="+invoiceid, width:"80%", height:"90%", transition:"none", iframe:"true", title:""});
  471. }
  472. function Split() {
  473. invoiceid = $("#invoiceid").val();
  474. console.log("Open popup to split on invoiceid="+invoiceid);
  475. $.colorbox({href:"split.php?place="+place+"&invoiceid="+invoiceid, width:"80%", height:"90%", transition:"none", iframe:"true", title:""});
  476. }
  477. function Floors() {
  478. console.log("Open box to select floor place="+place);
  479. $.colorbox({href:"floors.php?place="+place, width:"90%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Floors"); ?>"});
  480. }
  481. function FreeZone() {
  482. console.log("Open box to enter a free product");
  483. $.colorbox({href:"freezone.php?action=freezone&place="+place, width:"80%", height:"200px", transition:"none", iframe:"true", title:"<?php echo $langs->trans("FreeZone"); ?>"});
  484. }
  485. function TakeposOrderNotes() {
  486. console.log("Open box to order notes");
  487. ModalBox('ModalNote');
  488. $("#textinput").focus();
  489. }
  490. function Refresh() {
  491. console.log("Refresh by reloading place="+place+" invoiceid="+invoiceid);
  492. $("#poslines").load("invoice.php?place="+place+"&invoiceid="+invoiceid, function() {
  493. //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
  494. });
  495. }
  496. function New() {
  497. // If we go here,it means $conf->global->TAKEPOS_BAR_RESTAURANT is not defined
  498. invoiceid = $("#invoiceid").val();
  499. console.log("New with place = <?php echo $place; ?>, js place="+place+", invoiceid="+invoiceid);
  500. $.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getInvoice&id='+invoiceid, function(data) {
  501. var r;
  502. if (parseInt(data['paye']) === 1) {
  503. r = true;
  504. } else {
  505. r = confirm('<?php echo ($place > 0 ? $langs->transnoentitiesnoconv("ConfirmDeletionOfThisPOSSale") : $langs->transnoentitiesnoconv("ConfirmDiscardOfThisPOSSale")); ?>');
  506. }
  507. if (r == true) {
  508. // Reload section with invoice lines
  509. $("#poslines").load("invoice.php?action=delete&token=<?php echo newToken(); ?>&place=" + place, function () {
  510. //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
  511. });
  512. ClearSearch();
  513. }
  514. });
  515. }
  516. /**
  517. * Search products
  518. *
  519. * @param string keyCodeForEnter Key code for "enter" or '' if not
  520. * @param int moreorless ??
  521. * return void
  522. */
  523. function Search2(keyCodeForEnter, moreorless) {
  524. var eventKeyCode = window.event.keyCode;
  525. console.log("Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter+", eventKeyCode="+eventKeyCode);
  526. var search_term = $('#search').val();
  527. var search_start = 0;
  528. var search_limit = <?php echo $MAXPRODUCT - 2; ?>;
  529. if (moreorless != null) {
  530. search_term = $('#search_pagination').val();
  531. search_start = $('#search_start_'+moreorless).val();
  532. }
  533. console.log("search_term="+search_term);
  534. if (search_term == '') {
  535. $("[id^=prowatermark]").html("");
  536. $("[id^=prodesc]").text("");
  537. $("[id^=probutton]").text("");
  538. $("[id^=probutton]").hide();
  539. $("[id^=proprice]").attr("class", "hidden");
  540. $("[id^=proprice]").html("");
  541. $("[id^=proimg]").attr("src", "genimg/empty.png");
  542. $("[id^=prodiv]").data("rowid", "");
  543. return;
  544. }
  545. var search = false;
  546. if (keyCodeForEnter == '' || eventKeyCode == keyCodeForEnter) {
  547. search = true;
  548. }
  549. if (search === true) {
  550. // if a timer has been already started (search2_timer is a global js variable), we cancel it now
  551. // we click onto another key, we will restart another timer just after
  552. if (search2_timer) {
  553. clearTimeout(search2_timer);
  554. }
  555. // temporization time to give time to type
  556. search2_timer = setTimeout(function(){
  557. pageproducts = 0;
  558. jQuery(".wrapper2 .catwatermark").hide();
  559. var nbsearchresults = 0;
  560. $.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) {
  561. for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
  562. if (typeof (data[i]) == "undefined") {
  563. $("#prowatermark" + i).html("");
  564. $("#prodesc" + i).text("");
  565. $("#probutton" + i).text("");
  566. $("#probutton" + i).hide();
  567. $("#proprice" + i).attr("class", "hidden");
  568. $("#proprice" + i).html("");
  569. $("#proimg" + i).attr("src", "genimg/empty.png");
  570. $("#prodiv" + i).data("rowid", "");
  571. continue;
  572. }
  573. <?php
  574. $titlestring = "'".dol_escape_js($langs->transnoentities('Ref').': ')."' + data[i]['ref']";
  575. $titlestring .= " + ' - ".dol_escape_js($langs->trans("Barcode").': ')."' + data[i]['barcode']";
  576. ?>
  577. var titlestring = <?php echo $titlestring; ?>;
  578. <?php
  579. if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) { ?>
  580. $("#prodesc" + i).html(data[i]['ref'].bold() + ' - ' + data[i]['label']);
  581. <?php } else { ?>
  582. $("#prodesc" + i).html(data[i]['label']);
  583. <?php } ?>
  584. $("#prodivdesc" + i).show();
  585. $("#probutton" + i).html(data[i]['label']);
  586. $("#probutton" + i).show();
  587. if (data[i]['price_formated']) {
  588. $("#proprice" + i).attr("class", "productprice");
  589. $("#proprice" + i).html(data[i]['price_formated']);
  590. }
  591. $("#proimg" + i).attr("title", titlestring);
  592. if( undefined !== data[i]['img']) {
  593. $("#proimg" + i).attr("src", data[i]['img']);
  594. }
  595. else {
  596. $("#proimg" + i).attr("src", "genimg/index.php?query=pro&id=" + data[i]['rowid']);
  597. }
  598. $("#prodiv" + i).data("rowid", data[i]['rowid']);
  599. $("#prodiv" + i).data("iscat", 0);
  600. <?php
  601. // Add js from hooks
  602. $parameters=array();
  603. $parameters['caller'] = 'search2';
  604. $hookmanager->executeHooks('completeJSProductDisplay', $parameters);
  605. print $hookmanager->resPrint;
  606. ?>
  607. nbsearchresults++;
  608. }
  609. }).always(function (data) {
  610. // If there is only 1 answer
  611. if ($('#search').val().length > 0 && data.length == 1) {
  612. console.log($('#search').val()+' - '+data[0]['barcode']);
  613. if ($('#search').val() == data[0]['barcode'] && 'thirdparty' == data[0]['object']) {
  614. console.log("There is only 1 answer with barcode matching the search, so we change the thirdparty "+data[0]['rowid']);
  615. ChangeThirdparty(data[0]['rowid']);
  616. }
  617. else if ($('#search').val() == data[0]['barcode'] && 'product' == data[0]['object']) {
  618. 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']);
  619. ClickProduct(0, data[0]['qty']);
  620. }
  621. }
  622. if (eventKeyCode == keyCodeForEnter){
  623. if (data.length == 0) {
  624. $('#search').val('<?php
  625. $langs->load('errors');
  626. echo dol_escape_js($langs->transnoentitiesnoconv("ErrorRecordNotFoundShort"));
  627. ?> ('+search_term+')');
  628. $('#search').select();
  629. }
  630. else ClearSearch();
  631. }
  632. // memorize search_term and start for pagination
  633. $("#search_pagination").val($("#search").val());
  634. if (search_start == 0) {
  635. $("#prodiv<?php echo $MAXPRODUCT - 2; ?> span").hide();
  636. }
  637. else {
  638. $("#prodiv<?php echo $MAXPRODUCT - 2; ?> span").show();
  639. var search_start_less = Math.max(0, parseInt(search_start) - parseInt(<?php echo $MAXPRODUCT - 2;?>));
  640. $("#search_start_less").val(search_start_less);
  641. }
  642. if (nbsearchresults != <?php echo $MAXPRODUCT - 2; ?>) {
  643. $("#prodiv<?php echo $MAXPRODUCT - 1; ?> span").hide();
  644. }
  645. else {
  646. $("#prodiv<?php echo $MAXPRODUCT - 1; ?> span").show();
  647. var search_start_more = parseInt(search_start) + parseInt(<?php echo $MAXPRODUCT - 2;?>);
  648. $("#search_start_more").val(search_start_more);
  649. }
  650. });
  651. }, 500); // 500ms delay
  652. }
  653. }
  654. /* Function called on an action into the PAD */
  655. function Edit(number) {
  656. console.log("We click on PAD on key="+number);
  657. if (typeof(selectedtext) == "undefined") {
  658. return; // We click on an action on the number pad but there is no line selected
  659. }
  660. var text=selectedtext+"<br> ";
  661. if (number=='c') {
  662. editnumber='';
  663. Refresh();
  664. $("#qty").html("<?php echo $langs->trans("Qty"); ?>").removeClass('clicked');
  665. $("#price").html("<?php echo $langs->trans("Price"); ?>").removeClass('clicked');
  666. $("#reduction").html("<?php echo $langs->trans("ReductionShort"); ?>").removeClass('clicked');
  667. return;
  668. } else if (number=='qty') {
  669. if (editaction=='qty' && editnumber != '') {
  670. $("#poslines").load("invoice.php?action=updateqty&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
  671. editnumber="";
  672. //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
  673. $("#qty").html("<?php echo $langs->trans("Qty"); ?>").removeClass('clicked');
  674. });
  675. setFocusOnSearchField();
  676. return;
  677. }
  678. else {
  679. editaction="qty";
  680. }
  681. } else if (number=='p') {
  682. if (editaction=='p' && editnumber!="") {
  683. $("#poslines").load("invoice.php?action=updateprice&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
  684. editnumber="";
  685. //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
  686. $("#price").html("<?php echo $langs->trans("Price"); ?>").removeClass('clicked');
  687. });
  688. ClearSearch();
  689. return;
  690. }
  691. else {
  692. editaction="p";
  693. }
  694. } else if (number=='r') {
  695. if (editaction=='r' && editnumber!="") {
  696. $("#poslines").load("invoice.php?action=updatereduction&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
  697. editnumber="";
  698. //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
  699. $("#reduction").html("<?php echo $langs->trans("ReductionShort"); ?>").removeClass('clicked');
  700. });
  701. ClearSearch();
  702. return;
  703. }
  704. else {
  705. editaction="r";
  706. }
  707. }
  708. else {
  709. editnumber=editnumber+number;
  710. }
  711. if (editaction=='qty'){
  712. text=text+"<?php echo $langs->trans("Modify")." -> ".$langs->trans("Qty").": "; ?>";
  713. $("#qty").html("OK").addClass("clicked");
  714. $("#price").html("<?php echo $langs->trans("Price"); ?>").removeClass('clicked');
  715. $("#reduction").html("<?php echo $langs->trans("ReductionShort"); ?>").removeClass('clicked');
  716. }
  717. if (editaction=='p'){
  718. text=text+"<?php echo $langs->trans("Modify")." -> ".$langs->trans("Price").": "; ?>";
  719. $("#qty").html("<?php echo $langs->trans("Qty"); ?>").removeClass('clicked');
  720. $("#price").html("OK").addClass("clicked");
  721. $("#reduction").html("<?php echo $langs->trans("ReductionShort"); ?>").removeClass('clicked');
  722. }
  723. if (editaction=='r'){
  724. text=text+"<?php echo $langs->trans("Modify")." -> ".$langs->trans("ReductionShort").": "; ?>";
  725. $("#qty").html("<?php echo $langs->trans("Qty"); ?>").removeClass('clicked');
  726. $("#price").html("<?php echo $langs->trans("Price"); ?>").removeClass('clicked');
  727. $("#reduction").html("OK").addClass("clicked");
  728. }
  729. $('#'+selectedline).find("td:first").html(text+editnumber);
  730. }
  731. function TakeposPrintingOrder(){
  732. console.log("TakeposPrintingOrder");
  733. $("#poslines").load("invoice.php?action=order&place="+place, function() {
  734. //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
  735. });
  736. }
  737. function TakeposPrintingTemp(){
  738. console.log("TakeposPrintingTemp");
  739. $("#poslines").load("invoice.php?action=temp&place="+place, function() {
  740. //$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
  741. });
  742. }
  743. function OpenDrawer(){
  744. console.log("OpenDrawer call ajax url http://<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER'); ?>:8111/print");
  745. $.ajax({
  746. type: "POST",
  747. data: { token: 'notrequired' },
  748. <?php
  749. if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
  750. echo "url: '".getDolGlobalString('TAKEPOS_PRINT_SERVER', 'localhost')."/printer/drawer.php',";
  751. } else {
  752. echo "url: 'http://".getDolGlobalString('TAKEPOS_PRINT_SERVER', 'localhost').":8111/print',";
  753. }
  754. ?>
  755. data: "opendrawer"
  756. });
  757. }
  758. function DolibarrOpenDrawer() {
  759. console.log("DolibarrOpenDrawer call ajax url /takepos/ajax/ajax.php?action=opendrawer&term=<?php print urlencode($_SESSION["takeposterminal"]); ?>");
  760. $.ajax({
  761. type: "GET",
  762. data: { token: '<?php echo currentToken(); ?>' },
  763. url: "<?php print DOL_URL_ROOT.'/takepos/ajax/ajax.php?action=opendrawer&term='.urlencode($_SESSION["takeposterminal"]); ?>",
  764. });
  765. }
  766. function MoreActions(totalactions){
  767. if (pageactions==0){
  768. pageactions=1;
  769. for (i = 0; i <= totalactions; i++){
  770. if (i<12) $("#action"+i).hide();
  771. else $("#action"+i).show();
  772. }
  773. }
  774. else if (pageactions==1){
  775. pageactions=0;
  776. for (i = 0; i <= totalactions; i++){
  777. if (i<12) $("#action"+i).show();
  778. else $("#action"+i).hide();
  779. }
  780. }
  781. }
  782. function ControlCashOpening()
  783. {
  784. $.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"); ?>"});
  785. }
  786. function CloseCashFence(rowid)
  787. {
  788. $.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"); ?>"});
  789. }
  790. function CashReport(rowid)
  791. {
  792. $.colorbox({href:"../compta/cashcontrol/report.php?id="+rowid+"&contextpage=takepos", width:"60%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("CashReport"); ?>"});
  793. }
  794. // TakePOS Popup
  795. function ModalBox(ModalID)
  796. {
  797. var modal = document.getElementById(ModalID);
  798. modal.style.display = "block";
  799. }
  800. function DirectPayment(){
  801. console.log("DirectPayment");
  802. $("#poslines").load("invoice.php?place="+place+"&action=valid&pay=LIQ", function() {
  803. });
  804. }
  805. function FullScreen() {
  806. document.documentElement.requestFullscreen();
  807. }
  808. function WeighingScale(){
  809. console.log("Weighing Scale");
  810. $.ajax({
  811. type: "POST",
  812. data: { token: 'notrequired' },
  813. url: '<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER'); ?>/scale/index.php',
  814. })
  815. .done(function( editnumber ) {
  816. $("#poslines").load("invoice.php?action=updateqty&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
  817. editnumber="";
  818. });
  819. });
  820. }
  821. $( document ).ready(function() {
  822. PrintCategories(0);
  823. LoadProducts(0);
  824. Refresh();
  825. <?php
  826. //IF NO TERMINAL SELECTED
  827. if ($_SESSION["takeposterminal"] == "") {
  828. print "ModalBox('ModalTerminal');";
  829. }
  830. if (getDolGlobalString('TAKEPOS_CONTROL_CASH_OPENING')) {
  831. $sql = "SELECT rowid, status FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE";
  832. $sql .= " entity = ".((int) $conf->entity)." AND ";
  833. $sql .= " posnumber = ".((int) $_SESSION["takeposterminal"])." AND ";
  834. $sql .= " date_creation > '".$db->idate(dol_get_first_hour(dol_now()))."'";
  835. $resql = $db->query($sql);
  836. if ($resql) {
  837. $obj = $db->fetch_object($resql);
  838. // If there is no cash control from today open it
  839. if ($obj->rowid == null) {
  840. print "ControlCashOpening();";
  841. }
  842. }
  843. }
  844. ?>
  845. });
  846. </script>
  847. <body class="bodytakepos" style="overflow: hidden;">
  848. <?php
  849. $keyCodeForEnter = getDolGlobalInt('CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION['takeposterminal']) > 0 ? getDolGlobalInt('CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION['takeposterminal']) : '';
  850. ?>
  851. <div class="container">
  852. <?php
  853. if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
  854. ?>
  855. <div class="header">
  856. <div class="topnav">
  857. <div class="topnav-left">
  858. <div class="inline-block valignmiddle">
  859. <a class="topnav-terminalhour" onclick="ModalBox('ModalTerminal');">
  860. <span class="fa fa-cash-register"></span>
  861. <span class="hideonsmartphone">
  862. <?php echo $langs->trans("Terminal"); ?>
  863. </span>
  864. <?php echo " ";
  865. if ($_SESSION["takeposterminal"] == "") {
  866. echo "1";
  867. } else {
  868. echo $_SESSION["takeposterminal"];
  869. }
  870. echo '<span class="hideonsmartphone"> - '.dol_print_date(dol_now(), "day").'</span>';
  871. ?>
  872. </a>
  873. <?php
  874. if (isModEnabled('multicurrency')) {
  875. print '<a class="valignmiddle tdoverflowmax100" id="multicurrency" onclick="ModalBox(\'ModalCurrency\');" title=""><span class="fas fa-coins paddingrightonly"></span>';
  876. print '<span class="hideonsmartphone">'.$langs->trans("Currency").'</span>';
  877. print '</a>';
  878. }
  879. ?>
  880. </div>
  881. <!-- section for customer -->
  882. <div class="inline-block valignmiddle" id="customerandsales"></div>
  883. <!-- section for shopping carts -->
  884. <div class="inline-block valignmiddle" id="shoppingcart"></div>
  885. <!-- More info about customer -->
  886. <div class="inline-block valignmiddle tdoverflowmax150onsmartphone" id="moreinfo"></div>
  887. <?php
  888. if (isModEnabled('stock')) {
  889. ?>
  890. <!-- More info about warehouse -->
  891. <div class="inline-block valignmiddle tdoverflowmax150onsmartphone" id="infowarehouse"></div>
  892. <?php
  893. }
  894. ?>
  895. </div>
  896. <div class="topnav-right">
  897. <div class="login_block_other">
  898. <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>
  899. <a onclick="ClearSearch();"><span class="fa fa-backspace"></span></a>
  900. <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 -->
  901. <span class="fas fa-home"></span></a>
  902. <?php if (empty($conf->dol_use_jmobile)) { ?>
  903. <a class="hideonsmartphone" onclick="FullScreen();"><span class="fa fa-expand-arrows-alt"></span></a>
  904. <?php } ?>
  905. </div>
  906. <div class="login_block_user">
  907. <?php
  908. print top_menu_user(1);
  909. ?>
  910. </div>
  911. </div>
  912. </div>
  913. </div>
  914. <?php
  915. }
  916. ?>
  917. <!-- Modal terminal box -->
  918. <div id="ModalTerminal" class="modal">
  919. <div class="modal-content">
  920. <div class="modal-header">
  921. <span class="close" href="#" onclick="document.getElementById('ModalTerminal').style.display = 'none';">&times;</span>
  922. <h3><?php print $langs->trans("TerminalSelect"); ?></h3>
  923. </div>
  924. <div class="modal-body">
  925. <button type="button" class="block" onclick="location.href='index.php?setterminal=1'"><?php print $langs->trans("Terminal"); ?> 1</button>
  926. <?php
  927. $nbloop = getDolGlobalInt('TAKEPOS_NUM_TERMINALS');
  928. for ($i = 2; $i <= $nbloop; $i++) {
  929. print '<button type="button" class="block" onclick="location.href=\'index.php?setterminal='.$i.'\'">'.$langs->trans("Terminal").' '.$i.'</button>';
  930. }
  931. ?>
  932. </div>
  933. </div>
  934. </div>
  935. <!-- Modal multicurrency box -->
  936. <?php if (isModEnabled('multicurrency')) { ?>
  937. <div id="ModalCurrency" class="modal">
  938. <div class="modal-content">
  939. <div class="modal-header">
  940. <span class="close" href="#" onclick="document.getElementById('ModalCurrency').style.display = 'none';">&times;</span>
  941. <h3><?php print $langs->trans("SetMultiCurrencyCode"); ?></h3>
  942. </div>
  943. <div class="modal-body">
  944. <?php
  945. $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency';
  946. $sql .= " WHERE entity IN ('".getEntity('multicurrency')."')";
  947. $resql = $db->query($sql);
  948. if ($resql) {
  949. while ($obj = $db->fetch_object($resql)) {
  950. print '<button type="button" class="block" onclick="location.href=\'index.php?setcurrency='.$obj->code.'\'">'.$obj->code.'</button>';
  951. }
  952. }
  953. ?>
  954. </div>
  955. </div>
  956. </div>
  957. <?php } ?>
  958. <!-- Modal terminal Credit Note -->
  959. <div id="ModalCreditNote" class="modal">
  960. <div class="modal-content">
  961. <div class="modal-header">
  962. <span class="close" href="#" onclick="document.getElementById('ModalCreditNote').style.display = 'none';">&times;</span>
  963. <h3><?php print $langs->trans("invoiceAvoirWithLines"); ?></h3>
  964. </div>
  965. <div class="modal-body">
  966. <button type="button" class="block" onclick="CreditNote(); document.getElementById('ModalCreditNote').style.display = 'none';"><?php print $langs->trans("Yes"); ?></button>
  967. <button type="button" class="block" onclick="document.getElementById('ModalCreditNote').style.display = 'none';"><?php print $langs->trans("No"); ?></button>
  968. </div>
  969. </div>
  970. </div>
  971. <!-- Modal Note -->
  972. <div id="ModalNote" class="modal">
  973. <div class="modal-content">
  974. <div class="modal-header">
  975. <span class="close" href="#" onclick="document.getElementById('ModalNote').style.display = 'none';">&times;</span>
  976. <h3><?php print $langs->trans("Note"); ?></h3>
  977. </div>
  978. <div class="modal-body">
  979. <input type="text" class="block" id="textinput">
  980. <button type="button" class="block" onclick="SetNote(); document.getElementById('ModalNote').style.display = 'none';">OK</button>
  981. </div>
  982. </div>
  983. </div>
  984. <div class="row1<?php if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
  985. print 'withhead';
  986. } ?>">
  987. <div id="poslines" class="div1">
  988. </div>
  989. <div class="div2">
  990. <button type="button" class="calcbutton" onclick="Edit(7);">7</button>
  991. <button type="button" class="calcbutton" onclick="Edit(8);">8</button>
  992. <button type="button" class="calcbutton" onclick="Edit(9);">9</button>
  993. <button type="button" id="qty" class="calcbutton2" onclick="Edit('qty');"><?php echo $langs->trans("Qty"); ?></button>
  994. <button type="button" class="calcbutton" onclick="Edit(4);">4</button>
  995. <button type="button" class="calcbutton" onclick="Edit(5);">5</button>
  996. <button type="button" class="calcbutton" onclick="Edit(6);">6</button>
  997. <button type="button" id="price" class="calcbutton2" onclick="Edit('p');"><?php echo $langs->trans("Price"); ?></button>
  998. <button type="button" class="calcbutton" onclick="Edit(1);">1</button>
  999. <button type="button" class="calcbutton" onclick="Edit(2);">2</button>
  1000. <button type="button" class="calcbutton" onclick="Edit(3);">3</button>
  1001. <button type="button" id="reduction" class="calcbutton2" onclick="Edit('r');"><?php echo $langs->trans("ReductionShort"); ?></button>
  1002. <button type="button" class="calcbutton" onclick="Edit(0);">0</button>
  1003. <button type="button" class="calcbutton" onclick="Edit('.');">.</button>
  1004. <button type="button" class="calcbutton poscolorblue" onclick="Edit('c');">C</button>
  1005. <button type="button" class="calcbutton2 poscolordelete" id="delete" onclick="deleteline();"><span class="fa fa-trash"></span></button>
  1006. </div>
  1007. <?php
  1008. // TakePOS setup check
  1009. if (isset($_SESSION["takeposterminal"]) && $_SESSION["takeposterminal"]) {
  1010. $sql = "SELECT code, libelle FROM " . MAIN_DB_PREFIX . "c_paiement";
  1011. $sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")";
  1012. $sql .= " AND active = 1";
  1013. $sql .= " ORDER BY libelle";
  1014. $resql = $db->query($sql);
  1015. $paiementsModes = array();
  1016. if ($resql) {
  1017. while ( $obj = $db->fetch_object($resql) ) {
  1018. $paycode = $obj->code;
  1019. if ($paycode == 'LIQ') {
  1020. $paycode = 'CASH';
  1021. }
  1022. if ($paycode == 'CHQ') {
  1023. $paycode = 'CHEQUE';
  1024. }
  1025. $constantforkey = "CASHDESK_ID_BANKACCOUNT_" . $paycode . $_SESSION["takeposterminal"];
  1026. //var_dump($constantforkey.' '.$conf->global->$constantforkey);
  1027. if ( ! empty($conf->global->$constantforkey) && $conf->global->$constantforkey > 0) {
  1028. array_push($paiementsModes, $obj);
  1029. }
  1030. }
  1031. }
  1032. if (empty($paiementsModes) && isModEnabled('banque')) {
  1033. $langs->load('errors');
  1034. setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("TakePOS")), null, 'errors');
  1035. setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors');
  1036. }
  1037. }
  1038. if (count($maincategories) == 0) {
  1039. if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) {
  1040. $tmpcategory = new Categorie($db);
  1041. $tmpcategory->fetch($conf->global->TAKEPOS_ROOT_CATEGORY_ID);
  1042. setEventMessages($langs->trans("TakeposNeedsAtLeastOnSubCategoryIntoParentCategory", $tmpcategory->label), null, 'errors');
  1043. } else {
  1044. setEventMessages($langs->trans("TakeposNeedsCategories"), null, 'errors');
  1045. }
  1046. }
  1047. // User menu and external TakePOS modules
  1048. $menus = array();
  1049. $r = 0;
  1050. if (empty($conf->global->TAKEPOS_BAR_RESTAURANT)) {
  1051. $menus[$r++] = array('title'=>'<span class="fa fa-layer-group paddingrightonly"></span><div class="trunc">'.$langs->trans("New").'</div>', 'action'=>'New();');
  1052. } else {
  1053. // BAR RESTAURANT specific menu
  1054. $menus[$r++] = array('title'=>'<span class="fa fa-layer-group paddingrightonly"></span><div class="trunc">'.$langs->trans("Place").'</div>', 'action'=>'Floors();');
  1055. }
  1056. if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
  1057. $menus[$r++] = array('title'=>'<span class="far fa-building paddingrightonly"></span><div class="trunc">'.$langs->trans("Customer").'</div>', 'action'=>'Customer();');
  1058. }
  1059. $menus[$r++] = array('title'=>'<span class="fa fa-history paddingrightonly"></span><div class="trunc">'.$langs->trans("History").'</div>', 'action'=>'History();');
  1060. $menus[$r++] = array('title'=>'<span class="fa fa-cube paddingrightonly"></span><div class="trunc">'.$langs->trans("FreeZone").'</div>', 'action'=>'FreeZone();');
  1061. $menus[$r++] = array('title'=>'<span class="fa fa-percent paddingrightonly"></span><div class="trunc">'.$langs->trans("Reduction").'</div>', 'action'=>'Reduction();');
  1062. $menus[$r++] = array('title'=>'<span class="far fa-money-bill-alt paddingrightonly"></span><div class="trunc">'.$langs->trans("Payment").'</div>', 'action'=>'CloseBill();');
  1063. if (getDolGlobalString('TAKEPOS_DIRECT_PAYMENT')) {
  1064. $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();');
  1065. }
  1066. $menus[$r++] = array('title'=>'<span class="fas fa-cut paddingrightonly"></span><div class="trunc">'.$langs->trans("SplitSale").'</div>', 'action'=>'Split();');
  1067. // BAR RESTAURANT specific menu
  1068. if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
  1069. if (getDolGlobalString('TAKEPOS_ORDER_PRINTERS')) {
  1070. $menus[$r++] = array('title'=>'<span class="fa fa-blender-phone paddingrightonly"></span><div class="trunc">'.$langs->trans("Order").'</span>', 'action'=>'TakeposPrintingOrder();');
  1071. }
  1072. //Button to print receipt before payment
  1073. if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
  1074. if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
  1075. if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
  1076. $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("Receipt").'</div>', 'action'=>'TakeposConnector(placeid);');
  1077. } else {
  1078. $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("Receipt").'</div>', 'action'=>'TakeposPrinting(placeid);');
  1079. }
  1080. } elseif (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") {
  1081. $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("Receipt").'</div>', 'action'=>'DolibarrTakeposPrinting(placeid);');
  1082. } else {
  1083. $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("Receipt").'</div>', 'action'=>'Print(placeid);');
  1084. }
  1085. }
  1086. if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector" && getDolGlobalString('TAKEPOS_ORDER_NOTES') == 1) {
  1087. $menus[$r++] = array('title'=>'<span class="fa fa-sticky-note paddingrightonly"></span><div class="trunc">'.$langs->trans("OrderNotes").'</div>', 'action'=>'TakeposOrderNotes();');
  1088. }
  1089. if (getDolGlobalString('TAKEPOS_SUPPLEMENTS')) {
  1090. $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("ProductSupplements").'</div>', 'action'=>'LoadProducts(\'supplements\');');
  1091. }
  1092. }
  1093. if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
  1094. $menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("DOL_OPEN_DRAWER").'</div>', 'action'=>'OpenDrawer();');
  1095. }
  1096. if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") {
  1097. $menus[$r++] = array(
  1098. 'title' => '<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("DOL_OPEN_DRAWER").'</div>',
  1099. 'action' => 'DolibarrOpenDrawer();',
  1100. );
  1101. }
  1102. $sql = "SELECT rowid, status, entity FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE";
  1103. $sql .= " entity = ".((int) $conf->entity)." AND ";
  1104. $sql .= " posnumber = ".((int) $_SESSION["takeposterminal"])." AND ";
  1105. $sql .= " date_creation > '".$db->idate(dol_get_first_hour(dol_now()))."'";
  1106. $resql = $db->query($sql);
  1107. if ($resql) {
  1108. $num = $db->num_rows($resql);
  1109. if ($num) {
  1110. $obj = $db->fetch_object($resql);
  1111. $menus[$r++] = array('title'=>'<span class="fas fa-file-invoice-dollar paddingrightonly"></span><div class="trunc">'.$langs->trans("CashReport").'</div>', 'action'=>'CashReport('.$obj->rowid.');');
  1112. if ($obj->status == 0) {
  1113. $menus[$r++] = array('title'=>'<span class="fas fa-cash-register paddingrightonly"></span><div class="trunc">'.$langs->trans("CloseCashFence").'</div>', 'action'=>'CloseCashFence('.$obj->rowid.');');
  1114. }
  1115. }
  1116. }
  1117. $hookmanager->initHooks(array('takeposfrontend'));
  1118. $parameters = array('menus'=>$menus);
  1119. $reshook = $hookmanager->executeHooks('ActionButtons', $parameters);
  1120. if ($reshook == 0) { //add buttons
  1121. if (is_array($hookmanager->resArray) ) {
  1122. foreach ($hookmanager->resArray as $resArray) {
  1123. foreach ($resArray as $butmenu) {
  1124. $menus[$r++] = $butmenu;
  1125. }
  1126. }
  1127. } elseif ($reshook == 1) {
  1128. $r = 0; //replace buttons
  1129. if (is_array($hookmanager->resArray) ) {
  1130. foreach ($hookmanager->resArray as $resArray) {
  1131. foreach ($resArray as $butmenu) {
  1132. $menus[$r++] = $butmenu;
  1133. }
  1134. }
  1135. }
  1136. }
  1137. }
  1138. if ($r % 3 == 2) {
  1139. $menus[$r++] = array('title'=>'', 'style'=>'visibility: hidden;');
  1140. }
  1141. if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
  1142. $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().'\';');
  1143. }
  1144. if (!empty($conf->global->TAKEPOS_WEIGHING_SCALE)) {
  1145. $menus[$r++] = array('title'=>'<span class="fa fa-balance-scale paddingrightonly"></span><div class="trunc">'.$langs->trans("WeighingScale").'</div>', 'action'=>'WeighingScale();');
  1146. }
  1147. ?>
  1148. <!-- Show buttons -->
  1149. <div class="div3">
  1150. <?php
  1151. $i = 0;
  1152. foreach ($menus as $menu) {
  1153. $i++;
  1154. if (count($menus) > 12 and $i == 12) {
  1155. echo '<button style="'.(empty($menu['style']) ? '' : $menu['style']).'" type="button" id="actionnext" class="actionbutton" onclick="MoreActions('.count($menus).');">'.$langs->trans("Next").'</button>';
  1156. echo '<button style="display: none;" type="button" id="action'.$i.'" class="actionbutton" onclick="'.(empty($menu['action']) ? '' : $menu['action']).'">'.$menu['title'].'</button>';
  1157. } elseif ($i > 12) {
  1158. echo '<button style="display: none;" type="button" id="action'.$i.'" class="actionbutton" onclick="'.(empty($menu['action']) ? '' : $menu['action']).'">'.$menu['title'].'</button>';
  1159. } else {
  1160. echo '<button style="'.(empty($menu['style']) ? '' : $menu['style']).'" type="button" id="action'.$i.'" class="actionbutton" onclick="'.(empty($menu['action']) ? '' : $menu['action']).'">'.$menu['title'].'</button>';
  1161. }
  1162. }
  1163. if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
  1164. print '<!-- Show the search input text -->'."\n";
  1165. print '<div class="margintoponly">';
  1166. 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> ';
  1167. print '<a class="marginleftonly hideonsmartphone" onclick="ClearSearch();">'.img_picto('', 'searchclear').'</a>';
  1168. print '</div>';
  1169. }
  1170. ?>
  1171. </div>
  1172. </div>
  1173. <div class="row2<?php if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
  1174. print 'withhead';
  1175. } ?>">
  1176. <!-- Show categories -->
  1177. <?php
  1178. if (getDolGlobalInt('TAKEPOS_HIDE_CATEGORIES') == 1) {
  1179. print '<div class="div4" style= "display: none;">';
  1180. } else {
  1181. print '<div class="div4">';
  1182. }
  1183. $count = 0;
  1184. while ($count < $MAXCATEG) {
  1185. ?>
  1186. <div class="wrapper" <?php if ($count == ($MAXCATEG - 2)) {
  1187. echo 'onclick="MoreCategories(\'less\');"';
  1188. } elseif ($count == ($MAXCATEG - 1)) {
  1189. echo 'onclick="MoreCategories(\'more\');"';
  1190. } else {
  1191. echo 'onclick="LoadProducts('.$count.');"';
  1192. } ?> id="catdiv<?php echo $count; ?>">
  1193. <?php
  1194. if ($count == ($MAXCATEG - 2)) {
  1195. //echo '<img class="imgwrapper" src="img/arrow-prev-top.png" height="100%" id="catimg'.$count.'" />';
  1196. echo '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
  1197. } elseif ($count == ($MAXCATEG - 1)) {
  1198. //echo '<img class="imgwrapper" src="img/arrow-next-top.png" height="100%" id="catimg'.$count.'" />';
  1199. echo '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
  1200. } else {
  1201. if (!getDolGlobalString('TAKEPOS_HIDE_CATEGORY_IMAGES')) {
  1202. echo '<img class="imgwrapper" height="100%" id="catimg'.$count.'" />';
  1203. }
  1204. }
  1205. ?>
  1206. <?php if ($count != ($MAXCATEG - 2) && $count != ($MAXCATEG - 1)) { ?>
  1207. <div class="description" id="catdivdesc<?php echo $count; ?>">
  1208. <div class="description_content" id="catdesc<?php echo $count; ?>"></div>
  1209. </div>
  1210. <?php } ?>
  1211. <div class="catwatermark" id='catwatermark<?php echo $count; ?>'>...</div>
  1212. </div>
  1213. <?php
  1214. $count++;
  1215. }
  1216. ?>
  1217. </div>
  1218. <!-- Show product -->
  1219. <div class="div5"<?php if (getDolGlobalInt('TAKEPOS_HIDE_CATEGORIES') == 1) {
  1220. print ' style="width:100%;"';
  1221. } ?>>
  1222. <?php
  1223. $count = 0;
  1224. while ($count < $MAXPRODUCT) {
  1225. print '<div class="wrapper2" id="prodiv'.$count.'" ';
  1226. ?>
  1227. <?php if ($count == ($MAXPRODUCT - 2)) {
  1228. ?> onclick="MoreProducts('less');" <?php
  1229. } if ($count == ($MAXPRODUCT - 1)) {
  1230. ?> onclick="MoreProducts('more');" <?php
  1231. } else {
  1232. echo 'onclick="ClickProduct('.$count.');"';
  1233. } ?>>
  1234. <?php
  1235. if ($count == ($MAXPRODUCT - 2)) {
  1236. //echo '<img class="imgwrapper" src="img/arrow-prev-top.png" height="100%" id="proimg'.$count.'" />';
  1237. print '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
  1238. } elseif ($count == ($MAXPRODUCT - 1)) {
  1239. //echo '<img class="imgwrapper" src="img/arrow-next-top.png" height="100%" id="proimg'.$count.'" />';
  1240. print '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>';
  1241. } else {
  1242. if (getDolGlobalString('TAKEPOS_HIDE_PRODUCT_IMAGES')) {
  1243. echo '<button type="button" id="probutton'.$count.'" class="productbutton" style="display: none;"></button>';
  1244. } else {
  1245. print '<div class="" id="proprice'.$count.'"></div>';
  1246. print '<img class="imgwrapper" height="100%" title="" id="proimg'.$count.'">';
  1247. }
  1248. }
  1249. ?>
  1250. <?php if ($count != ($MAXPRODUCT - 2) && $count != ($MAXPRODUCT - 1) && !getDolGlobalString('TAKEPOS_HIDE_PRODUCT_IMAGES')) { ?>
  1251. <div class="description" id="prodivdesc<?php echo $count; ?>">
  1252. <div class="description_content" id="prodesc<?php echo $count; ?>"></div>
  1253. </div>
  1254. <?php } ?>
  1255. <div class="catwatermark" id='prowatermark<?php echo $count; ?>'>...</div>
  1256. </div>
  1257. <?php
  1258. $count++;
  1259. }
  1260. ?>
  1261. <input type="hidden" id="search_start_less" value="0">
  1262. <input type="hidden" id="search_start_more" value="0">
  1263. <input type="hidden" id="search_pagination" value="">
  1264. </div>
  1265. </div>
  1266. </div>
  1267. </body>
  1268. <?php
  1269. llxFooter();
  1270. $db->close();