28if (!defined(
'NOREQUIREMENU')) {
 
   29  define(
'NOREQUIREMENU', 
'1');
 
   31if (!defined(
'NOREQUIREHTML')) {
 
   32  define(
'NOREQUIREHTML', 
'1');
 
   34if (!defined(
'NOREQUIREAJAX')) {
 
   35  define(
'NOREQUIREAJAX', 
'1');
 
   39require 
'../main.inc.php'; 
 
   40require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
 
   42$langs->loadLangs(array(
"bills", 
"orders", 
"commercial", 
"cashdesk"));
 
   44$floor = 
GETPOST(
'floor', 
'int');
 
   49$action = 
GETPOST(
'action', 
'aZ09');
 
   50$left = 
GETPOST(
'left', 
'alpha');
 
   55$newname = 
GETPOST(
'newname', 
'alpha');
 
   56$mode = 
GETPOST(
'mode', 
'alpha');
 
   58if (empty($user->rights->takepos->run)) {
 
   67if ($action == 
"getTables") {
 
   68  $sql = 
"SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX.
"takepos_floor_tables where floor = ".((int) $floor);
 
   69  $resql = $db->query($sql);
 
   71  while ($row = $db->fetch_array($resql)) {
 
   73    $result = $invoice->fetch(
'', 
'(PROV-POS'.$_SESSION[
'takeposterminal'].
'-'.$row[
'rowid'].
')');
 
   75      $row[
'occupied'] = 
"red";
 
   81  echo json_encode($rows);
 
   85if ($action == 
"update") {
 
   92  if ($left > 3 or $top > 4) {
 
   93    $db->query(
"UPDATE ".MAIN_DB_PREFIX.
"takepos_floor_tables set leftpos = ".((
int) $left).
", toppos = ".((
int) $top).
" WHERE rowid = ".((
int) $place));
 
   95    $db->query(
"DELETE from ".MAIN_DB_PREFIX.
"takepos_floor_tables where rowid = ".((
int) $place));
 
   99if ($action == 
"updatename") {
 
  100  $newname = preg_replace(
"/[^a-zA-Z0-9\s]/", 
"", $newname); 
 
  101  if (strlen($newname) > 3) {
 
  102    $newname = substr($newname, 0, 3); 
 
  104  $resql = $db->query(
"UPDATE ".MAIN_DB_PREFIX.
"takepos_floor_tables set label='".$db->escape($newname).
"' WHERE rowid = ".((
int) $place));
 
  107if ($action == 
"add") {
 
  108  $sql = 
"INSERT INTO ".MAIN_DB_PREFIX.
"takepos_floor_tables(entity, label, leftpos, toppos, floor) VALUES (".$conf->entity.
", '', '45', '45', ".((int) $floor).
")";
 
  109  $asdf = $db->query($sql);
 
  110  $db->query(
"update ".MAIN_DB_PREFIX.
"takepos_floor_tables set label=rowid where label=''"); 
 
  120$title = 
'TakePOS - Dolibarr '.DOL_VERSION;
 
  121if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
 
  122  $title = 
'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
 
  124$arrayofcss = array(
'/takepos/css/pos.css.php?a=xxx');
 
  129<body style=
"overflow: hidden">
 
  131<style 
type=
"text/css">
 
  133  background-image:url(img/table.gif);
 
  134  -moz-background-size:100% 100%;
 
  135  -webkit-background-size:100% 100%;
 
  136  background-size:100% 100%;
 
  151var DragDrop=
'<?php echo $langs->trans("DragDrop"); ?>';
 
  153function updateplace(idplace, left, top) {
 
  154  console.log(
"updateplace idplace="+idplace+
" left="+left+
" top="+top);
 
  157    url: 
"<?php echo DOL_URL_ROOT.'/takepos/floors.php'; ?>",
 
  158    data: { action: 
"update", left: left, top: top, place: idplace, token: 
'<?php echo currentToken(); ?>' }
 
  159  }).done(
function( msg ) {
 
  160    window.location.href=
'floors.php?mode=edit&floor=<?php echo urlencode($floor); ?>';
 
  164function updatename(
rowid) {
 
  165  var after=$(
"#tablename"+
rowid).text();
 
  166  console.log(
"updatename rowid="+
rowid+
" after="+after);
 
  169    url: 
"<?php echo DOL_URL_ROOT.'/takepos/floors.php'; ?>",
 
  170    data: { action: 
"updatename", place: 
rowid, newname: after, token: 
'<?php echo currentToken(); ?>' }
 
  171  }).done(
function( msg ) {
 
  172    window.location.href=
'floors.php?mode=edit&floor=<?php echo urlencode($floor); ?>';
 
  176function LoadPlace(place){
 
  177  parent.location.href=
'index.php?place='+place;
 
  181$( document ).ready(
function() {
 
  182  $.getJSON(
'./floors.php?action=getTables&token=<?php echo newToken();?>&floor=<?php echo $floor; ?>', 
function(data) {
 
  183    $.each(data, 
function(key, val) {
 
  184      <?php 
if ($mode == 
"edit") {?>
 
  185      $(
'body').append(
'<div class="tablediv" contenteditable onblur="updatename('+val.rowid+
');" style="position: absolute; left: '+val.leftpos+
'%; top: '+val.toppos+
'%;" id="tablename'+val.rowid+
'">'+val.label+
'</div>');
 
  186      $( 
"#tablename"+val.rowid ).draggable(
 
  189          $(
"#add").html(
"<?php echo $langs->trans("Delete
"); ?>");
 
  192          var left=$(
this).offset().left*100/$(window).width();
 
  193          var top=$(
this).offset().top*100/$(window).height();
 
  194          updateplace($(
this).attr(
'id').substr(9), left, top);
 
  199      $(
'#'+val.label).draggable().bind(
'click', 
function(){
 
  203      $(
'body').append(
'<div class="tablediv '+val.occupied+
'" onclick="LoadPlace('+val.rowid+
');" style="position: absolute; left: '+val.leftpos+
'%; top: '+val.toppos+
'%;" id="tablename'+val.rowid+
'">'+val.label+
'</div>');
 
  211<?php 
if ($user->admin) {?>
 
  212<div style=
"position: absolute; left: 0.1%; top: 0.8%; width:8%; height:11%;">
 
  213  <?php 
if ($mode == 
"edit") {?>
 
  214<a 
id=
"add" onclick=
"window.location.href='floors.php?mode=edit&action=add&token=<?php echo newToken() ?>&floor=<?php echo $floor; ?>';"><?php echo $langs->trans(
"AddTable"); ?></a>
 
  216<a onclick=
"window.location.href='floors.php?mode=edit&token=<?php echo newToken() ?>&floor=<?php echo $floor; ?>';"><?php echo $langs->trans(
"Edit"); ?></a>
 
  222<div style=
"position: absolute; left: 25%; bottom: 8%; width:50%; height:3%;">
 
  225  <?php 
if ($floor > 1) { ?>
 
  226  <img 
class=
"valignmiddle" src=
"./img/arrow-prev.png" width=
"5%" onclick=
"location.href='floors.php?floor=<?php if ($floor > 1) { 
  227    $floor--; echo $floor; $floor++; 
  232  <span 
class=
"valignmiddle"><?php echo $langs->trans(
"Floor").
" ".$floor; ?></span>
 
  233  <img src=
"./img/arrow-next.png" class=
"valignmiddle" width=
"5%" onclick=
"location.href='floors.php?floor=<?php $floor++; echo $floor; ?>';">
 
Class to manage invoices.
 
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
 
publicphonebutton2 phonegreen basiclayout basiclayout TotalHT VATCode TotalVAT TotalLT1 TotalLT2 TotalTTC TotalHT clearboth nowraponall right right takeposterminal SELECT e rowid
 
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
 
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
 
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
 
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.