index.php 53 KB

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