ordersprinter/webapp/waiterdesktop.php

178 lines
84 KiB
PHP

<html>
<head>
<title>Ansicht Kellner</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.32">
<link rel="stylesheet" href="css/ospage.css" />
<link rel="stylesheet" href="css/tablepanel.css" />
<link rel="stylesheet" href="css/productpanel.css" />
<link rel="stylesheet" href="css/grouppanel.css" />
<link rel="stylesheet" href="css/groupitem.css" />
<link rel="stylesheet" href="css/ordereditem.css" />
<link rel="stylesheet" href="css/roompanel.css" />
<link rel="stylesheet" href="css/extraspanel.css" />
<link rel="stylesheet" href="css/actpanel.css" />
<link rel="stylesheet" href="css/paypanel.css" />
<link rel="stylesheet" href="css/numfield.css?v=1.5.32" />
<link rel="stylesheet" href="php/3rdparty/jqueryui1-12-0/jquery-ui.min.css" />
<script src="php/3rdparty/jquery-2.2.4.min.js"></script>
<script src="php/3rdparty/jqueryui1-12-0/jquery-ui.min.js"></script>
<script src="elements/tablemap.js"></script>
<script src="elements/grouping.js"></script>
<script src="elements/extra.js"></script>
<script src="utilities.js"></script>
<script src="receiptutils.js"></script>
<script>
function sendNewOrders(b){var a=getTableid();if(neworders.length!=0){var c={tableid:a,prods:neworders,print:(b?1:0),payprinttype:"s"};doAjax("POST","php/contenthandler.php?module=queue&command=addProductListToQueue",c,handleSentNewOrders,"Fehler bei Produktversand",false)}else{alert("Es sind keine Produkte ausgewählt worden.")}}function handleSentNewOrders(a){if(a.status!="OK"){alert("Es ist ein Fehler beim Versenden der Bestellung aufgetreten")}else{neworders=[];$("#search").val("");refreshGui()}}function refreshGui(){requestRoomInformation();clearProductsSelection();requestProdInformation();requestOrderedInformation();displayPanels();allowPrintAndOrderBtn=true}function getTableid(){if(selectedroomindex!==null){if(selectedroomindex<0){return 0}else{if(selectedtableindex!==null){var a=roominfo.roomstables[selectedroomindex].tables[selectedtableindex];return a.id}else{return 0}}}}function enableSendButton(){}function disableSendButton(){}function moveItems(){$("#selectiondialog").dialog({autoOpen:false,modal:true,height:400,buttons:{Abbrechen:function(){$(this).dialog("close")}}});var a=getRoomsForDialog();$("#selectiondialog").html(a);$("#selectiondialog").dialog("open");$(".ui-dialog-buttonset .ui-button").css("background-color","#44ff44");$(".ui-widget-header").css("background-color","#ff4400");bindMoveItemsRoom()}function bindMoveItemsRoom(){$(".roomchangeitem").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();var b=parseInt(this.id.split("_")[1]);var a=getTablesForDialog(b);$("#selectiondialog").dialog("open");$("#selectiondialog").html(a);bindMoveItemsTable(b)})}function bindRightButtons(){$("#sendNewOrders").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();if(allowPrintAndOrderBtn){allowPrintAndOrderBtn=false;unZoomTableMap();updateChangeTableBtnIfTableIsSelected();sendNewOrders(false)}});$("#paydeskbtn").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();if(allowPrintAndOrderBtn){allowPrintAndOrderBtn=false;unZoomTableMap();if(neworders.length>0){if(waitergopayprint==1){sendNewOrders(true)}else{sendNewOrders(false)}}goPayDesk()}});$("#workbtn").off("click").on("click",function(a){if(allowPrintAndOrderBtn){allowPrintAndOrderBtn=false;unZoomTableMap();updateChangeTableBtnIfTableIsSelected();if(neworders.length>0){sendNewOrders(true)}}});$("#goorderbtn").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();unZoomTableMap();goOrderDesk()});$("#mainmenudlg").dialog({autoOpen:false,modal:true});$("#changetablebtn").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();unZoomTableMap();moveItems()});$("#tablerecordsbtn").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();var a=getTableid();doAjax("GET","php/contenthandler.php?module=queue&command=getRecords&tableid="+a,null,showRecords,true)})}function showRecords(b){if(b.status!="OK"){alert("Fehler aufgetreten: "+b.msg)}else{var a=createTableRecords(b);$("#recordsdlg").dialog({autoOpen:false,modal:true,height:570,width:600,buttons:{Abbrechen:function(){$(this).dialog("close")}}});$("#recordsdlg").dialog("open");$("#recordsdlg").html(a)}}function createTableRecords(f){var e=["Tischprotokoll","Records of table","Historia de la mesa"];var c=[["Bestellung","Ordering","Ordenar"],["Rechnung","Bill","Pagar"],["Produktstorno","Discard product","Descartar producto"],["Rechnungsstorno","Discard bill","Descartar pago"],["Rechnungs- und Produktstorno","Discard bill and product","Descrtar pago y producto"],["Tischwechsel Produktentfernung","Move products to other table","Productos a otra mesa"],["Tischwechsel Produktbuchung","Received moved products","Recibo productos de otra mesa"]];var b=f.msg;var a="<h2>"+e[0]+"</h2>";if(b.length==0){a+="keine Einträge";return a}a+="<ul>";b.forEach(function(k,i){var m=toHtml(k.time);var n=toHtml(k.username);var l=toHtml(k.action);var g=c[l][0];a+="<li>"+m+" "+n+" - <b>"+g+"</b>:<br>";var h=k.prods;a+="<ul>";h.forEach(function(o,q){var p=toHtml(o.name);var r=toHtml(o.extras);a+="<li>"+p;if(r!=""){a+=" ("+r+")"}});a+="</ul>"});a+="</ul>";return a}function bindMoveItemsTable(a){$(".tablechangeitem").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();moveToRoomIndex=a;var b=parseInt(this.id.split("_")[1]);var f=roominfo.roomstables[a].tables[b];moveToTableId=f.id;if(selectedroomindex!="-1"){var f=roominfo.roomstables[selectedroomindex].tables[selectedtableindex];moveFromTableId=f.id;$("#selectiondialog").dialog("close");doAjax("GET","php/contenthandler.php?module=queue&command=getProdsForTableChange",{tableId:moveFromTableId},insertProductsToChangeTableDlg,null,true)}else{$("#selectiondialog").dialog("close")}})}function insertProductsToChangeTableDlg(a){if(a.status!="OK"){alert("Fehler");return}prodsToMove=a.msg;allselected=1;updateProdToMoveList();$("#selectallnothing").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();allselected=1-allselected;for(var c=0;c<prodsToMove.length;c++){var b=prodsToMove[c];if(allselected===1){b["class"]="selecteditem"}else{b["class"]="unselecteditem"}}updateProdToMoveList()})}function updateProdToMoveList(){if(allselected===1){$("#selectallnothing_txt").val(W_UNSELALL[lang])}else{$("#selectallnothing_txt").val(W_SELALL[lang])}var a="";for(var f=0;f<prodsToMove.length;f++){var c=prodsToMove[f];var k="prodToMove_"+f;var b=" (unbezahlt)";var h="proditemselected";if(c["class"]===undefined){c["class"]="selecteditem"}var e=c["class"];if(e=="unselecteditem"){h="proditemunselected"}if(c.status==="unpaid_undelivered"){b=" (unbezahlt, nicht serviert)"}if((workflowconfig==WORKFLOW_WORK)||(workflowconfig==WORKFLOW_WORK_TRANSFER)){b=""}var g="<span class='"+e+"'>"+c.productname+b+"</span>";a+="<li class='prodToMoveEl "+h+"' id='"+k+"' >"+g+"</li>"}$("#productsToMoveList").html(a);$("#moveItemdslg").dialog({autoOpen:false,modal:true,height:600,width:800,buttons:{Abbrechen:function(){$(this).dialog("close")},Verschieben:function(){$(this).dialog("close");doMoveItems()}}});$("#moveItemdslg").dialog("open");handleClickOnMoveableProd()}function handleClickOnMoveableProd(){$(".prodToMoveEl").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();var b=this.id.split("_")[1];var a=prodsToMove[b];var c=a["class"];if(c=="unselecteditem"){a["class"]="selecteditem"}else{a["class"]="unselecteditem"}updateProdToMoveList()})}function doMoveItems(){$("#moveItemdslg").dialog("close");var a=[];for(var f=0;f<prodsToMove.length;f++){var c=prodsToMove[f];var e=c["class"];if(e=="selecteditem"){a[a.length]=c.queueid}}if(a.length===0){alert(W_NO_PRODS_SELECTED[lang])}else{var b=a.join();var g={fromTableId:moveFromTableId,toTableId:moveToTableId,queueids:b};doAjax("POST","php/contenthandler.php?module=queue&command=changeTable",g,resultOfChangeTable,"Fehler Tischwechsel",true)}}function resultOfChangeTable(a){if(a.status!="OK"){alert("Fehler "+a.code+": "+a.msg+"\n\nMöglicherweise hat ein Kollege\nin der Zwischenzeit Produkte zugestellt.")}else{alert("Tischwechsel durchgeführt!")}refreshGui()}function requestRoomInformation(){if(restaurantmode==1){doAjax("GET","php/contenthandler.php?module=roomtables&command=showAllRooms",null,insertRoomInfo,null,true)}}function insertRoomInfo(a){roominfo=a;showRooms()}function getTableMapPreferences(){doAjax("GET","php/tablemap.php?command=getTableMapPreferences",null,insertTMInfo,"Keine TM-Information",true)}function showRooms(){var b=roominfo.roomstables;var c="osroom-desk-0";var f="osroom-desk-sel-0";if(osroombtnsize==1){c="osroom-desk-1";f="osroom-desk-sel-1"}else{if(osroombtnsize==2){c="osroom-desk-2";f="osroom-desk-sel-2"}}var a="";$.each(b,function(h,g){if(selectedroomindex===h){a+='<div id="room_'+h+'" class="roomitemselected '+f+'">'+g.name+"</div>"}else{a+='<div id="room_'+h+'" class="roomitem '+c+'">'+g.name+"</div>"}});var e=roominfo.takeawayprice.replace(".",decpoint)+" "+currency;if(e!=""){e='<div class="roomtogoaccounted">'+e+"</div>"}if(showtogo==1){if(selectedroomindex<0){a+='<div id="room_-1" class="roomitemselected roomtogo '+f+'">';a+='<div class="roomname">Zum Mitnehmen</div>';a+=e;a+="</div>"}else{a+='<div id="room_-1" class="roomitem roomtogo '+c+'">';a+='<div class="roomname">Zum Mitnehmen</div>';a+=e;a+="</div>"}}$("#roompanel").html(a);$("#tablepanelcontent").html("");showRoomTableTextInfo();showTablesForRoomIndex();bindingRoom()}function getRoomsForDialog(){var b=roominfo.roomstables;var a="";$.each(b,function(e,c){a+='<div id="changeroom_'+e+'" class="roomchangeitem">'+c.name+"</div>"});return a}function bindingRoom(){$(".roomitem").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();var a=parseInt(this.id.split("_")[1]);$("#changetablebtn").hide();$("#tablerecordsbtn").hide();if(panelMode=="waiter"){if(neworders.length>0){$("#unsentorderdlg").dialog({autoOpen:false,modal:true,height:400,buttons:{Nein:function(){$(this).dialog("close")},Ja:function(){$(this).dialog("close");discardChangeRoom(a)}}});$("#unsentorderdlg").dialog("open")}else{changeRoom(a);if(selectedroomindex=="-1"){$("#tablerecordsbtn").show();startProductDisplay()}}}else{changeRoom(a);goPayDesk()}})}function clearSearchResult(){$("#search").val("");productFilter=null;$("#barcode").val("");showAllProdsToChoose()}function discardChangeRoom(a){clearSearchResult();neworders=[];groupedNewOrders=null;showNewOrders();changeRoom(a)}function changeRoom(a){clearSearchResult();clearProductsSelection();selectedtableindex=null;selectedroomindex=a;if(restaurantmode==1){showRooms()}}function showRoomTableTextInfo(){var a="Keine Auswahl";if(selectedroomindex!==null){if(selectedroomindex<0){a="Zum Mitnehmen"}else{a="Raum: "+roominfo.roomstables[selectedroomindex].name;if(selectedtableindex!==null){var b=roominfo.roomstables[selectedroomindex].tables[selectedtableindex];a+=" - Tisch: "+b.name}}}$("#location").html(a)}function showTablesForRoomIndex(){if((selectedroomindex>=0)&&(selectedroomindex!==null)){var f=roominfo.roomstables[selectedroomindex].id;var g=shallDisplayRoom(f);if(g.show){$("#tablepanelcontent").hide();d=new Date();$("#mapimgpart").attr("src","php/tablemap.php?command=getTableMapImgAsPng&showBubbles=0&roomid="+f+"&"+d.getTime());$("#tablemapcontent").show();var c=new Tablemap(selectedroomindex,null,"");var e=roominfo.roomstables[selectedroomindex]["tables"];var a=null;if(selectedtableindex!=null){a=roominfo.roomstables[selectedroomindex].tables[selectedtableindex].id}var b=c.createOverlay("#mapimgpart",g.pos,W_TO_PAY[lang],decpoint,currency,e,ostablebtnsize,a);$("#tableoverlay").html(b);c.bindingForOverlaySelection(handleClickInTablemap.bind(this),f,e,switchZoomView)}else{showTablesListForRoomIndex()}}else{showTablesListForRoomIndex()}}function switchZoomView(){if(tableMapIsZoomed){$(".main").show();$("#roompanel").show();tableMapIsZoomed=false}else{$(".main").hide();$("#roompanel").hide();tableMapIsZoomed=true}}function unZoomTableMap(){tableMapIsZoomed=true;switchZoomView()}function handleClickInTablemap(b){selectedtableindex=null;var c=roominfo.roomstables[selectedroomindex].tables;for(var a=0;a<c.length;a++){if(c[a].id==b.tableid){selectedtableindex=a;break}}unZoomTableMap();changeTable(selectedtableindex);$("#tablerecordsbtn").show();if(panelMode=="waiter"){$("#changetablebtn").show();startProductDisplay()}else{$("#changetablebtn").hide();goPayDesk()}}function showTablesListForRoomIndex(){$("#tablemapcontent").hide();var b="ostable-desk-0";if(ostablebtnsize==1){b="ostable-desk-1"}else{if(ostablebtnsize==2){b="ostable-desk-2"}}if((selectedroomindex>=0)&&(selectedroomindex!==null)){var c=roominfo.roomstables[selectedroomindex].tables;var a="";$.each(c,function(g,k){if((selectedtableindex!=null)&&(c[selectedtableindex].id==k.id)){a+='<div id="table_'+g+'" class="tableelement tableitemselected '+b+'">'}else{a+='<div id="table_'+g+'" class="tableelement tableitem '+b+'">'}var h=k.name;var e=k.reservations;if(e!=""){var n=e.split(",");var m=n.join("<br>");h+="<br><span class='tablereservations'>("+m+")</span>"}a+=' <header class="tablename">'+h+"</header>";var l=k.pricesum;if(l!=0){var f=l.replace(".",decpoint)+" "+currency;a+='<div class="tableopen">'+f+"</div>"}a+="</div>"});$("#tablepanelcontent").html(a)}else{$("#tablepanelcontent").html("")}$("#tablepanelcontent").show();bindingTable()}function getTablesForDialog(b){var c=roominfo.roomstables[b].tables;var a="";$.each(c,function(e,f){a+='<div id="changetable_'+e+'" class="tablechangeitem">'+f.name+"</div>"});return a}function updateChangeTableBtnIfTableIsSelected(){$("#tablerecordsbtn").show();if(panelMode=="waiter"){$("#changetablebtn").show()}else{$("#changetablebtn").hide()}}function bindingTable(){$(".tableitem").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();var a=parseInt(this.id.split("_")[1]);if(panelMode=="waiter"){$("#tablerecordsbtn").show();$("#changetablebtn").show();if(neworders.length>0){$("#unsentorderdlg").dialog({autoOpen:false,modal:true,height:400,buttons:{Nein:function(){$(this).dialog("close")},Ja:function(){$(this).dialog("close");discardChangeTable(a)}}});$("#unsentorderdlg").dialog("open")}else{changeTable(a);startProductDisplay()}}else{changeTable(a);goPayDesk()}})}function discardChangeTable(a){neworders=[];groupedNewOrders=null;showNewOrders();changeTable(a)}function changeTable(a){clearSearchResult();selectedtableindex=a;showRoomTableTextInfo();showTablesForRoomIndex()}function startProductDisplay(){selectedtypeid=null;selectedprodid=null;clearProductsSelection();requestProdInformation();requestOrderedInformation();clearSearchResult();$("#searchpanel").show();if(usebarcode==1){document.getElementById("barcode").focus()}$("#remarkpanel").show()}function clearProductsSelection(){neworders=[];groupedNewOrders=[];selectedtypeid=null;$("#groupchain").html("");$("#groupchoice").html("");$("#productspanel").html("");$("#remark").val("");$("#neworders").html("");$("#ordered").html("");$("#searchpanel").hide();$("#remarkpanel").hide()}var allOrderdItems=[];function requestOrderedInformation(){if(panelMode!="waiter"){return}var a=0;if((selectedroomindex==null)&&(selectedtableindex==null)){return}if((selectedroomindex!=null)&&(selectedroomindex!="-1")){var b=roominfo.roomstables[selectedroomindex].tables[selectedtableindex];a=b.id}doAjax("GET","php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&tableid="+a,null,insertOrderedInformation,true)}function insertOrderedInformation(b){allOrderdItems=b;var c=new Grouping(b,createTxtAssignedProd);c.group();var a="";a+=c.outputList(createListElOfAssignedProd);$("#ordered").html(a);bindOrderedItem()}function createTxtAssignedProd(g,b){if(b==undefined){b=""}var c="";if(g.option!=""){c="<p><i>"+toHtml(g.option)+"</i>"}var h="";var e=toHtml(g.longname);if(g.togo==1){h="To-Go: "}e='<div class="ordereditem-name '+b+'">'+h+'<span class="ordereditem-bold '+b+'">'+e+"</span></div>";if(g.pricechanged==1){e+=" - "+g.price.replace(".",decpoint)+" "+currency}if(g.unit>1){var i=g_units_arr[g.unit].text;var f=g.unitamount.replace(".",decpoint);e+=" ("+f+" "+i+")"}var a="";if(g.isready=="1"){a+=" &#9758"}if(g.isCooking=="1"){a+=" &#9832"}if(g.isPaid=="1"){a+=" &#9745"}return e+'<div class="oredereditem-misc">'+c+a+createExtraParagraphForOrderedEl(g.extras,g.extrasamounts)+"</div>"}function createListElOfAssignedProd(e){var c="";if("count" in e){if(e.count>1){if(preferimgdesk==0){c='<div class="ordereditem-count">'+e.count+"x </div>"}else{c='<div class="ordereditem-count whitebackground">'+e.count+"x </div>"}}}var a="";if(preferimgdesk==0){a+="<div id='ordered_"+e.id+"' class='ordereditem-item-sent' >"+c+createTxtAssignedProd(e)+"</div>"}else{var b="php/contenthandler.php?module=products&command=getprodimage&prodid="+e.prodid+"&size=m";var f="<span>"+c+createTxtAssignedProd(e,"whitebackground")+"</span>";a+='<div id="ordered_'+e.id+'" class="ordereditem-item-sent" '+createImageStyle(b)+" >"+f+"</div>"}return a}function createExtraParagraphForOrderedEl(c,b){if((c==null)||(c=="")){return""}var e=[];for(var a=0;a<c.length;a++){e[e.length]=b[a]+"x "+toHtml(c[a])}return"<p>"+e.join("<br>")}function bindOrderedItem(){$(".ordereditem-item-sent").off("click").on("click",function(g){g.stopImmediatePropagation();g.preventDefault();var b=this.id.split("_")[1];var h=allOrderdItems;for(var c=0;c<allOrderdItems.length;c++){var f=allOrderdItems[c];var a=f.id;if(b==a){handleClickOnOrderedItem(f,b);break}}})}function handleClickOnOrderedItem(e,a){var g=e.isready;var c=e.isPaid;var f=e.isCooking;var b="Das Produkt ist diesem Tisch zugewiesen.";if((c=="1")&&(g=="1")){b="Produkt wurde schon zubereitet und bezahlt."}else{if(g=="1"){b="Produkt wurde schon zubereitet."}else{if(c=="1"){b="Produkt wurde schon bezahlt."}else{if(f=="1"){b="Produkt wird soeben zubereitet."}}}}$("#ordereditem-info").html(b);$("#ordereditemdlg").dialog({autoOpen:false,modal:true,height:400,width:600,position:{my:"center top",at:"center top",of:"body"}});if(cancelunpaidcode!=""){$("#orderedcancelpanel").show();$("#cancelcode").val("")}else{$("#orderedcancelpanel").hide()}$("#ordereditemdlg").dialog("open");bindOrderItemAction(e)}function bindOrderItemAction(c){var f=c.isready;var b=c.isPaid;var e=c.isCooking;var a=c.id;$("#ordereditemcancel").off("click").on("click",function(g){g.stopImmediatePropagation();g.preventDefault();$("#ordereditemdlg").dialog("close")});$("#ordereditemremove").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();if(cancelunpaidcode!=""){var g=$("#cancelcode").val();if(cancelunpaidcode!=g){alert("Falscher Stornocode!");return}}removeProductFromQueue(a,b,e,f,true);$("#cancelcode").val("")});$("#deleteallordereditems").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();if(cancelunpaidcode!=""){var g=$("#cancelcode").val();if(cancelunpaidcode!=g){alert("Falscher Stornocode!");return}}removeAllAssignedProds();$("#cancelcode").val("")});$("#ordereditemreorder").off("click").on("click",function(g){g.stopImmediatePropagation();g.preventDefault();reorderProduct(c.prodid,c.extrasids,c.extras,c.extrasamounts)})}function removeAllAssignedProds(){for(var b=0;b<allOrderdItems.length;b++){var e=allOrderdItems[b].isready;var a=allOrderdItems[b].isPaid;var c=allOrderdItems[b].isCooking;var f=allOrderdItems[b].id;removeProductFromQueue(f,a,c,e,false)}requestOrderedInformation();$("#ordereditemdlg").dialog("close")}function removeProductFromQueue(b,c,f,e,a){$.ajax({type:"POST",dataType:"json",url:"php/contenthandler.php?module=queue&command=removeProductFromQueue",data:{queueid:b,isPaid:c,isCooking:f,isReady:e},async:false,success:function(g){if(a){requestOrderedInformation();$("#ordereditemdlg").dialog("close")}},error:function(g){alert("Sorry, Fehler bei Produktentfernung!")}})}function reorderProduct(f,b,h,g){var a=getProdProperties(f);if(a.unit!=0){alert(W_NO_REORDER_VAR_PRICE[lang]);return}var e=[];for(var c=0;c<b.length;c++){e[e.length]={id:b[c],name:h[c],amount:g[c]}}$("#ordereditemdlg").dialog("close");addProductToNewOrders(f,"",e,"NO",0)}function requestProdInformation(){doAjax("GET","php/contenthandler.php?module=products&command=getAllTypesAndAvailProds",null,insertProductInformation,true)}function insertProductInformation(a){productInformation=a;updateProductInfoDisplay()}function updateProductInfoDisplay(){if(panelMode=="waiter"){showAllTypesToChoose();showAllProdsToChoose();$("#searchpanel").show();if(usebarcode==1){document.getElementById("barcode").focus()}$("#remarkpanel").show();disableSendButton();allowPrintAndOrderBtn=true}}function getType(e){var c=productInformation.types;for(var b=0;b<c.length;b++){var a=c[b];if(a.id==e){return a}}return null}function getSubTypes(){var f=productInformation.types;var e=[];if(selectedtypeid!=null){var b=getType(selectedtypeid);for(var c=0;c<f.length;c++){var a=f[c];if((a!=null)&&(a.ref==b.id)){e[e.length]={id:a.id,name:a.name}}}}else{for(var c=0;c<f.length;c++){var a=f[c];if((a.ref==null)||(a.ref==0)){e[e.length]={id:a.id,name:a.name}}}}return e}function getAllProds(f){var g=productInformation.prods;var c=[];if(f!=null){f=f.trim().toLowerCase();for(var e=0;e<g.length;e++){var h=g[e];var b=h.longname;if(b.toLowerCase().indexOf(f)>=0){c[c.length]={id:h.id,name:h.name,amount:h.amount}}}}else{if(selectedtypeid!=null){var a=getType(selectedtypeid);for(var e=0;e<g.length;e++){var h=g[e];if((h.ref==a.id)){c[c.length]={id:h.id,name:h.name,amount:h.amount}}}}else{for(var e=0;e<g.length;e++){var h=g[e];if((h.ref==null)||(h.ref==0)){c[c.length]={id:h.id,name:h.name,amount:h.amount}}}}}return c}function showAllTypesToChoose(){var a="";if((selectedroomindex=="-1")||(selectedtableindex!=null)){var b=getSubTypes();$.each(b,function(e,c){if(selectedtypeid==c.id){a+='<div id="type_'+c.id+'" class="groupitemchoiceselected">'+c.name+"</div>"}else{a+='<div id="type_'+c.id+'" class="groupitemchoice">'+c.name+"</div>"}})}$("#groupchoice").html(a);showChain();bindType()}function bindType(){$(".groupitemchoice").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();$("#search").val("");productFilter=null;showAllProdsToChoose();selectedtypeid=parseInt(this.id.split("_")[1]);updateProductInfoDisplay()})}function showAllProdsToChoose(){var b="osprod-desk-0";if(osprodbtnsize==1){b="osprod-desk-1"}else{if(osprodbtnsize==2){b="osprod-desk-2"}}var a="";if((selectedroomindex=="-1")||(selectedtableindex!=null)){var c=getAllProds(productFilter);$.each(c,function(f,g){if(preferimgdesk==0){a+='<div id="prod_'+g.id+'" class="productitem '+b+'">'+g.name}else{var e="php/contenthandler.php?module=products&command=getprodimage&prodid="+g.id+"&size=m";var h="<span class='whitebackground'>"+g.name+"</span>";a+='<div id="prod_'+g.id+'" class="productitem '+b+'" '+createImageStyle(e)+" >"+h}if((g.amount!="null")&&(g.amount<11)){a+="<span class='warning'> ("+W_ONLY[lang]+" "+g.amount+")</span>"}a+="</div>"})}$("#productspanel").html(a);bindProduct();bindRemark()}function findProdWithBarcode(b){if((selectedroomindex=="-1")||(selectedtableindex!=null)){var e=productInformation.prods;for(var c=0;c<e.length;c++){var f=e[c];var a=f.barcode;a=a.split("-").join("");a=a.split(" ").join("");if(a==b){return f}}}return null}function createImageStyle(b){var a=" style=\"background-image: url('"+b+"'); background-size: cover; background-repeat: no-repeat; background-position: center center; \" ";return a}function getTypeChain(){var b=getType(selectedtypeid);if(b==null){return[]}var e=[b];var c=false;while(!c){var a=b.ref;if((a==null)||(a==0)){c=true;break}else{b=getType(a);e[e.length]=b}}return e}function showChain(){var a="";if((selectedroomindex=="-1")||(selectedtableindex!=null)){var e=getTypeChain();a+='<div id="groupchainitem_-1" class="groupitem">Auswahl</div>';for(var c=e.length-1;c>=0;c--){var b=e[c];a+='<div id="groupchainitem_'+b.id+'" class="groupitem">'+b.name+"</div>"}}$("#groupchain").html(a);bindChain();bindSearch()}function bindChain(){$(".groupitem").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();selectedtypeid=parseInt(this.id.split("_")[1]);if(selectedtypeid=="-1"){selectedtypeid=null}updateProductInfoDisplay();$("#search").val("");productFilter=null;showAllProdsToChoose()})}function bindSearch(){$("#search").off("keyup").on("keyup",function(a){a.stopImmediatePropagation();a.preventDefault();productFilter=($("#search").val().trim().toLowerCase()).trim();if(productFilter==""){productFilter=null}showAllProdsToChoose()});if(usebarcode==1){$("#barcode").off("keyup").on("keyup",function(f){f.stopImmediatePropagation();f.preventDefault();var c=$("#barcode").val();c=c.split("-").join("");c=c.split(" ").join("");if(c!=""){var a=findProdWithBarcode(c);if(a!=null){$("#search").val("");$("#barcode").val("");var b=a.id;beepBarcodeBooking();completeProductClicked(b)}}})}}function bindProduct(){$(".productitem").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();var a=parseInt(this.id.split("_")[1]);completeProductClicked(a)})}function beepBarcodeBooking(){var a=new Audio("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI2cBoCFvfTDAo7eoOQInqDPBtvrDEZBNYN5xwNwxQRfw8ZQ5wQVLvO8OYU+mHvFLlDh05Mdg7BT6YrRPpCBznMB2r//xKJjyyOh+cImr2/4doscwD6neZjuZR4AgAABYAAAABy1xcdQtxYBYYZdifkUDgzzXaXn98Z0oi9ILU5mBjFANmRwlVJ3/6jYDAmxaiDG3/6xjQQCCKkRb/6kg/wW+kSJ5//rLobkLSiKmqP/0ikJuDaSaSf/6JiLYLEYnW/+kXg1WRVJL/9EmQ1YZIsv/6Qzwy5qk7/+tEU0nkls3/zIUMPKNX/6yZLf+kFgAfgGyLFAUwY//uQZAUABcd5UiNPVXAAAApAAAAAE0VZQKw9ISAAACgAAAAAVQIygIElVrFkBS+Jhi+EAuu+lKAkYUEIsmEAEoMeDmCETMvfSHTGkF5RWH7kz/ESHWPAq/kcCRhqBtMdokPdM7vil7RG98A2sc7zO6ZvTdM7pmOUAZTnJW+NXxqmd41dqJ6mLTXxrPpnV8avaIf5SvL7pndPvPpndJR9Kuu8fePvuiuhorgWjp7Mf/PRjxcFCPDkW31srioCExivv9lcwKEaHsf/7ow2Fl1T/9RkXgEhYElAoCLFtMArxwivDJJ+bR1HTKJdlEoTELCIqgEwVGSQ+hIm0NbK8WXcTEI0UPoa2NbG4y2K00JEWbZavJXkYaqo9CRHS55FcZTjKEk3NKoCYUnSQ0rWxrZbFKbKIhOKPZe1cJKzZSaQrIyULHDZmV5K4xySsDRKWOruanGtjLJXFEmwaIbDLX0hIPBUQPVFVkQkDoUNfSoDgQGKPekoxeGzA4DUvnn4bxzcZrtJyipKfPNy5w+9lnXwgqsiyHNeSVpemw4bWb9psYeq//uQZBoABQt4yMVxYAIAAAkQoAAAHvYpL5m6AAgAACXDAAAAD59jblTirQe9upFsmZbpMudy7Lz1X1DYsxOOSWpfPqNX2WqktK0DMvuGwlbNj44TleLPQ+Gsfb+GOWOKJoIrWb3cIMeeON6lz2umTqMXV8Mj30yWPpjoSa9ujK8SyeJP5y5mOW1D6hvLepeveEAEDo0mgCRClOEgANv3B9a6fikgUSu/DmAMATrGx7nng5p5iimPNZsfQLYB2sDLIkzRKZOHGAaUyDcpFBSLG9MCQALgAIgQs2YunOszLSAyQYPVC2YdGGeHD2dTdJk1pAHGAWDjnkcLKFymS3RQZTInzySoBwMG0QueC3gMsCEYxUqlrcxK6k1LQQcsmyYeQPdC2YfuGPASCBkcVMQQqpVJshui1tkXQJQV0OXGAZMXSOEEBRirXbVRQW7ugq7IM7rPWSZyDlM3IuNEkxzCOJ0ny2ThNkyRai1b6ev//3dzNGzNb//4uAvHT5sURcZCFcuKLhOFs8mLAAEAt4UWAAIABAAAAAB4qbHo0tIjVkUU//uQZAwABfSFz3ZqQAAAAAngwAAAE1HjMp2qAAAAACZDgAAAD5UkTE1UgZEUExqYynN1qZvqIOREEFmBcJQkwdxiFtw0qEOkGYfRDifBui9MQg4QAHAqWtAWHoCxu1Yf4VfWLPIM2mHDFsbQEVGwyqQoQcwnfHeIkNt9YnkiaS1oizycqJrx4KOQjahZxWbcZgztj2c49nKmkId44S71j0c8eV9yDK6uPRzx5X18eDvjvQ6yKo9ZSS6l//8elePK/Lf//IInrOF/FvDoADYAGBMGb7FtErm5MXMlmPAJQVgWta7Zx2go+8xJ0UiCb8LHHdftWyLJE0QIAIsI+UbXu67dZMjmgDGCGl1H+vpF4NSDckSIkk7Vd+sxEhBQMRU8j/12UIRhzSaUdQ+rQU5kGeFxm+hb1oh6pWWmv3uvmReDl0UnvtapVaIzo1jZbf/pD6ElLqSX+rUmOQNpJFa/r+sa4e/pBlAABoAAAAA3CUgShLdGIxsY7AUABPRrgCABdDuQ5GC7DqPQCgbbJUAoRSUj+NIEig0YfyWUho1VBBBA//uQZB4ABZx5zfMakeAAAAmwAAAAF5F3P0w9GtAAACfAAAAAwLhMDmAYWMgVEG1U0FIGCBgXBXAtfMH10000EEEEEECUBYln03TTTdNBDZopopYvrTTdNa325mImNg3TTPV9q3pmY0xoO6bv3r00y+IDGid/9aaaZTGMuj9mpu9Mpio1dXrr5HERTZSmqU36A3CumzN/9Robv/Xx4v9ijkSRSNLQhAWumap82WRSBUqXStV/YcS+XVLnSS+WLDroqArFkMEsAS+eWmrUzrO0oEmE40RlMZ5+ODIkAyKAGUwZ3mVKmcamcJnMW26MRPgUw6j+LkhyHGVGYjSUUKNpuJUQoOIAyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU=");a.play()}function completeProductClicked(e){$("#search").val("");$("#barcode").val("");if(usebarcode==1){$("#barcode").focus()}selectedprodid=e;var c=$("#remark").val();var a=getProdEntry(e);var b=a.extras;var f=a.unit;if((b!=null)&&(b.length>0)&&(f<2)){if(a.unit==1){requestPriceInExtras=true;presetPriceInExtras=""}else{requestPriceInExtras=false}showExtras(a,c)}else{if(a.unit!=0){enterpricedlgshown=true;$("#enterpricedlg").data("prodid",e);$("#enterpricedlg").data("option",c);$("#enterpricedlg").data("unit",a.unit);$("#enterpricefield").val("");var g="Preiseingabe";if(a.unit>1){g="Eingabe "+g_units_arr[a.unit]["longtext"]}$("#entervalueunit").html(g);$("#enterpricedlg").dialog({autoOpen:false,modal:true,height:570,width:400,buttons:{Abbrechen:function(){$(this).dialog("close")}}});$("#enterpricedlg").dialog("open");bindEnterPriceNumbers()}else{addProductToNewOrders(e,c,null,"NO",0,null,0,1)}}}function bindEnterPriceNumbers(){$(".numfield td").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();var f=$(this).html();var a=$(this).attr("class");if(a=="keyboardapply"){applyPriceEnter()}else{var c=String($("#enterpricefield").val());$("#enterpricefield").val(c+f)}})}function applyPriceEnter(){var b=$("#enterpricedlg").data("prodid");var e=$("#enterpricefield").val();var a=$("#enterpricedlg").data("option");var c=$("#enterpricedlg").data("unit");e=e.trim();e=e.replace(decpoint,".");if((e!="")&&($.isNumeric(e))){$("#enterpricedlg").dialog("close");if(c==1){addProductToNewOrders(b,a,null,e,0,e,0,1)}else{addProductToNewOrders(b,a,null,"NO",0,null,c,e)}}else{alert(W_NO_VALID_PRICE[lang])}}function bindRemark(){$("#remark").off("click").on("click",function(c){if(genComments!=null){if(genComments.length>0){c.stopImmediatePropagation();c.preventDefault();var a="";for(var b=0;b<genComments.length;b++){a+="<li class='commentitem'>"+toHtml(genComments[b].comment)+"</li>"}$("#commentschoice").html(a);$("#gencommentsdlg").dialog({autoOpen:false,modal:true,height:600,buttons:{Abbrechen:function(){$(this).dialog("close")},Anwenden:function(){$(this).dialog("close");applyComment()}}});$("#gencommentsdlg").dialog("open");$("#gencommentsdlg").css("height",genComments.length*52+150);$("#generalcommentfield").val("");$(".ui-dialog-buttonset .ui-button:nth-child(1)").css("background-color","#eeeeee");$(".ui-dialog-buttonset .ui-button:nth-child(1)").css("color","#ff0000");$(".ui-dialog-buttonset .ui-button:nth-child(2)").css("background-color","#00ff00");$(".ui-dialog-buttonset .ui-button:nth-child(2)").css("color","#000000");$(".ui-widget-header").css("background-color","#ff4400");bindCommentClick()}}})}function bindCommentClick(){$(".commentitem").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();$("#gencommentsdlg").dialog("close");$("#remark").val($(this).text())})}function applyComment(){$("#remark").val($("#generalcommentfield").val())}function getProdEntry(c){var a=productInformation.prods;for(var b=0;b<a.length;b++){var e=a[b];if(parseInt(e.id)==c){return e}}return null}function getProdProperties(a){var b=getProdEntry(a);if(b!=null){return{name:b.longname,price:b.price,unit:b.unit}}else{return"FEHLER!"}}function addProductToNewOrders(f,l,h,c,e,k,n,g){$("#remark").val("");if(typeof g==="undefined"){g=1}if(typeof n==="undefined"){n=0}var b=getProdProperties(f);var a=b.name;var i=calcTotalPriceOfProdAndExtras(b.price,h);if(k!=undefined){k=parseFloat(k).toFixed(2).replace(",",".");i=k;c=i}var m={name:a,option:l,extras:h,prodid:f,price:i,changedPrice:c,togo:e,unit:n,unitamount:g};neworders[neworders.length]={name:m.name,option:m.option,extras:m.extras,prodid:m.prodid,price:m.price,changedPrice:m.changedPrice,togo:m.togo,unit:m.unit,unitamount:m.unitamount};showNewOrders();$("#remark").val("");enterpricedlgshown=false}function group(h){var C=[];var e=[];var E=[];var x=[];var p=[];var g=[];var A=[];var B=[];var a=[];var m=[];var v=[];var w=[];var D={count:C,joinedvals:e,name:E,price:x,option:p,extras:g,prodids:A,origidxs:B,changedPrices:a,togos:m,units:v,unitamounts:w};var z=0;for(z=0;z<h.length;z++){var u=h[z];var E=u.name;var x=u.price;var p=u.option;var s=u.prodid;var f=u.changedPrice;var l=u.togo;var r=u.unit;var o=u.unitamount;var c=u.extras;var b="";var q=[];if(c!=null){for(var y=0;y<c.length;y++){q[q.length]="+"+c[y].amount+"x "+toHtml(c[y].name)}}if(q.length>0){b+="<p>"+q.join("<br>")}else{b=""}var t=E+"-"+p+"-"+b+"-"+r+"-"+o;if(f!="NO"){t=E+"-"+p+"-"+b+f}if(l==1){t+=" - To-Go"}var k=D.joinedvals.indexOf(t);if(k>=0){D.count[k]=D.count[k]+1;idxarr=D.origidxs[k];idxarr[idxarr.length]=z;D.origidxs[k]=idxarr}else{var n=D.count.length;D.count[n]=1;D.joinedvals[n]=t;D.name[n]=E;D.price[n]=x;D.option[n]=p;D.extras[n]=b;D.prodids[n]=s;D.changedPrices[n]=f;D.togos[n]=l;D.units[n]=r;D.unitamounts[n]=o;D.origidxs[n]=[z]}}return D}function showNewOrders(){groupedNewOrders=group(neworders);var k="";var q=groupedNewOrders.count.length;for(var h=q-1;h>=0;h--){var r=groupedNewOrders.units[h];var e=groupedNewOrders.unitamounts[h];var o="";if(r>1){o=e+g_units_arr[r].text+" "}var p=toHtml(groupedNewOrders.name[h]);var n=groupedNewOrders.option[h];var m=groupedNewOrders.count[h];if(m>1){p="<span style='font-size: 23px;'>"+m.toString()+"x</span> "+o+p}else{p=o+p}var g=groupedNewOrders.prodids[h];if(n!=""){n="<p>"+toHtml(n)+"</p>"}var c=groupedNewOrders.changedPrices[h];var b=groupedNewOrders.togos[h];var s="";var f=groupedNewOrders.extras[h];if((f!=null)&&(f!="")){s="<span style='font-size: 14px;'><i>"+f+"</i></span>"}var a="";if(c!="NO"){var l=c.replace(".",decpoint)+" "+currency;if(r>1){l+="/"+g_units_arr[r].text}if(b!=0){a="<br> ("+l+" - To-Go)"}else{a="<br> ("+l+")"}}else{if(b!=0){a="<br> (To-Go)"}}k+='<div id="neworder_'+g+"_"+h+'" class="ordereditem-item-new">'+p+n+s+a+"</div>"}$("#neworders").html(k);$("#remark").val("");if(neworders.length>0){enableSendButton()}else{disableSendButton()}bindNewOrderItem();displayRightButtons()}var roominfo=null;var selectedroomindex=null;var selectedtableindex=null;var productInformation=null;var selectedtypeid=null;var selectedprodid=null;var neworders=[];var groupedNewOrders={count:[],joinedvals:[],name:[],prodids:[],extras:[],origidxs:[],changedPrices:[],togos:[]};var workflowconfig=0;var showtransferbtns=1;var decpoint=".";var currency="";var rightchangeprice=0;var rightpaydesk=false;var restaurantmode=1;var sumupforcard=0;var affiliatekey="";var appid="";var serverurl="";var supplyright=0;var preferimgdesk=0;var prominentsearch=0;var discount1=50;var discount2=20;var discount3=10;var discountname1="";var discountname2="";var discountname3="";var osroombtnsize=0;var ostablebtnsize=0;var osprodbtnsize=0;var tableMapIsZoomed=false;var waitergopayprint=0;var mainmenu=[];var version="";var loggedinUser="";var lang=0;var payments="";var hostTemplate="";var cancelunpaidcode="";var WORKFLOW_DIGI_AND_WORK=0;var WORKFLOW_DIGI=1;var WORKFLOW_WORK=2;var WORKFLOW_WORK_TRANSFER=3;var productFilter=null;var prodsToMove=[];var allselected=0;var moveFromTableId=null;var moveToRoomIndex=null;var moveToTableId=null;var panelMode="waiter";var cashenabled=1;var returntoorder=1;var genComments=null;var allowPrintAndOrderBtn=false;var showtogo=1;var enterpricedlgshown=false;var requestPriceInExtras=false;var presetPriceInExtras="";var usebarcode=0;var dailycode="";var W_SELALL=["Alles auswählen","Select all","Elegir todo"];var W_UNSELALL=["Alles abwählen","Unselect all","No elegir nada"];var W_NO_PRODS_SELECTED=["Es wurden keine Produkte ausgewählt!","You have not chosen any products!","No ha seleccionado ningún producto!"];var W_ONLY=["noch","only","sólo"];var W_TO_PAY=["offen","to pay","a pagar"];var P_CASHACTION_OK=["Kassenaktion abgeschlossen.","Action completed.","Acción terminado."];var W_NO_VALID_PRICE=["Keine gültige Zahl","No valid value","No es un número valido"];var W_NO_REORDER_VAR_PRICE=["Nur Produkte mit der Einheit 'Stück' könne auf diese Weise nachbestellt werden.","Only products of unit 'Piece' can be reordered this way.","Un producto de esta unidad no se puede reordenado asi."];function setLanguage(a){}$(document).ready(function(){selectedroomindex=null;productFilter=null;doAjax("GET","php/contenthandler.php?module=admin&command=getWaiterSettings",null,insertWaiterConfig,"Fehler Konfigurationsdaten",true);doAjax("GET","php/contenthandler.php?module=admin&command=getJsonMenuItemsAndVersion",null,saveMenuInfo,null,true);getGeneralConfigItems();getTableMapPreferences();intervalGetItemsToPayAndRoomInfo(10);getMenuInBackground(60);getPayments(savePayments);getHostTemplate();intervalCheckConnection(2);intervalGetPrinterStatus(5);intervalGetGeneralCommentsAndTablePref(10);intervalGetWaiterMessage(20);intervalFetchDaycode(10);if(restaurantmode==0){changeRoom(-1);startProductDisplay()}});function savePayments(a){payments=a.payments;hotelinterface=a.hotelinterface;guests=a.guests;internalguests=a.internalguests}function intervalGetItemsToPayAndRoomInfo(b){var a=setInterval(function(){getAndShowPayItems();requestRoomInformation();requestOrderedInformation()},b*1000)}function intervalGetGeneralCommentsAndTablePref(b){doAjax("GET","php/contenthandler.php?module=products&command=getAllGeneralComments",null,fillGenCommentsList,null,true);var a=setInterval(function(){doAjax("GET","php/contenthandler.php?module=products&command=getAllGeneralComments",null,fillGenCommentsList,null,true);getTableMapPreferences()},b*1000)}function intervalGetWaiterMessage(b){doAjax("GET","php/contenthandler.php?module=admin&command=getWaiterMessage",null,fillWaiterMessage,null,true);var a=setInterval(function(){doAjax("GET","php/contenthandler.php?module=admin&command=getWaiterMessage",null,fillWaiterMessage,null,true)},b*1000)}function intervalFetchDaycode(b){var a=setInterval(function(){doAjax("GET","php/contenthandler.php?module=admin&command=getDailycode",null,updateDailycode,true)},b*1000)}function updateDailycode(a){if(a.status=="OK"){dailycode=a.msg;$(".daycodefield").html(toHtml(dailycode))}}function getMenuInBackground(b){var a=setInterval(function(){requestProdInformation()},b*1000)}function insertWaiterConfig(c){var a=c.isUserLoggedIn;if(a!=1){setTimeout(function(){document.location.href="index.html"},250)}else{var b=c.config;workflowconfig=b.workflowconfig;showtransferbtns=b.showtransferbtns;decpoint=b.decpoint;currency=b.currency;rightchangeprice=c.rightchangeprice;supplyright=c.supplyright;preferimgdesk=c.preferimgdesk;prominentsearch=b.prominentsearch;waitergopayprint=b.waitergopayprint;discount1=b.discount1;discount2=b.discount2;discount3=b.discount3;discountname1=b.discountname1;discountname2=b.discountname2;discountname3=b.discountname3;cashenabled=b.cashenabled;rightpaydesk=c.rightpaydesk;restaurantmode=b.restaurantmode;returntoorder=b.returntoorder;showtogo=b.showtogo;billprintjobs=b.billprintjobs;if((b.cancelunpaidcode!=null)&&(b.cancelunpaidcode!="")){cancelunpaidcode=b.cancelunpaidcode}else{cancelunpaidcode=""}osroombtnsize=c.buttonsizes.roombtnsize;ostablebtnsize=c.buttonsizes.tablebtnsize;osprodbtnsize=c.buttonsizes.prodbtnsize;dailycode=b.dailycode;if(b.showdaycode==1){$(".daycodeareamobile").show();$(".daycodefield").html(toHtml(dailycode))}else{$(".daycodeareamobile").hide()}usebarcode=b.usebarcode;if(usebarcode==1){$("#barcode").show();$("#barcode").val("");document.getElementById("barcode").focus()}initializeOrderView()}}function fillGenCommentsList(a){if(a.status!="OK"){alert("Fehler "+a.code+": "+a.msg);return}genComments=a.msg}function fillWaiterMessage(a){if(a.status=="OK"){var b=a.msg.trim();if(b!=""){$("#waitermessagearea").html("<b>Nachricht: </b>"+toHtml(b));$("#waitermessagearea").show()}else{$("#waitermessagearea").html("");$("#waitermessagearea").hide()}}}function initializeOrderView(){panelMode="waiter";initGui();clearProductsSelection();requestRoomInformation();requestProdInformation();bindMainMenuButton();bindRightButtons();if(restaurantmode==0){$("#tablepanel").hide()}}function getHostTemplate(){$.ajax({url:"customer/bon-bewirtungsvorlage.html",async:false,success:function(a){hostTemplate=a},error:function(a){},cache:false})}function saveMenuInfo(a){if(a.loggedin==1){loggedinUser=a.user;$("#loggedinuser").html("&nbsp;"+loggedinUser);$("#versioninfo").html(a.version);version=a.version;$.each(a.menu,function(e,c){var b=c.name;var f=c.link;mainmenu[mainmenu.length]={name:b,link:f}});$("#mainmenubtn").show()}else{$("#mainmenubtn").hide()}}function bindMainMenuButton(){$("#selectiondialog").dialog({autoOpen:false,modal:true,height:400,buttons:{Anwenden:function(){$(this).dialog("close");applyExtras()}}});$("#unsentorderdlg").dialog({autoOpen:false,modal:true,height:400,buttons:{Nein:function(){$(this).dialog("close")},Ja:function(){$(this).dialog("close")}}});$("#actmenudlg").dialog({autoOpen:false,modal:true,height:400});$("#mainmenudlg").dialog({autoOpen:false,modal:true,height:400,width:200,position:{my:"right top",at:"right top",of:"body"},buttons:{Abbrechen:function(){$(this).dialog("close")}}});$("#ordereditemdlg").dialog({autoOpen:false,modal:true,height:400,width:200});$("#moveItemdslg").dialog({autoOpen:false,modal:true,height:400,width:200});$("#mainmenubtn").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();var b="<div><ul class='mainmenuchoice'>";for(var c=0;c<mainmenu.length;c++){b+="<li id='mainmenu_"+c+"' class='mainmenuitem' >"+toHtml(mainmenu[c].name)+"</li>"}b+="</ul></div>";$("#mainmenudlg").html(b);var a=280+mainmenu.length*40;$("#mainmenudlg").dialog({autoOpen:false,modal:true,height:a,width:200,position:{my:"right top",at:"right top",of:"body"},buttons:{Abbrechen:function(){$(this).dialog("close")}}});$("#mainmenudlg").dialog("open");$(".mainmenuitem").off("click").on("click",function(i){i.stopImmediatePropagation();i.preventDefault();var h=parseInt(this.id.split("_")[1]);var g=mainmenu[h].link;$("#mainmenudlg").dialog("close");setTimeout(function(){document.location.href=g},250)})});bindCashButton()}function goOrderDesk(){panelMode="waiter";initGui();clearProductsSelection();requestProdInformation();requestOrderedInformation()}function goPayDesk(){panelMode="paydesk";initGui();startCashProcess()}function initGui(){displayPanels();displayRightButtons()}function displayPanels(){if(panelMode==="waiter"){$("#panelmodetxt").html("Bestellung");$("#groupchain").show();$("#groupchoice").show();$("#searchpanel").show();if(usebarcode==1){document.getElementById("barcode").focus()}$("#productspanel").show();$("#remarkpanel").show();$("#ordered").show();$("oben").html("");$("#oben").hide();$("#unten").html("");$("#unten").hide();$("#receiptpanel").hide();$("#paybuttonpanel").hide();$("#billprintjobspanel").hide();$("#receiptpanel").hide()}else{$("#panelmodetxt").html("Kasse");$("#groupchain").hide();$("#groupchoice").hide();$("#searchpanel").hide();$("#productspanel").hide();$("#remarkpanel").hide();$("#ordered").hide();$("oben").html("");$("#oben").show();$("#unten").html("");$("#unten").show();$("#goorderbtn").show();$("#receiptpanel").show();$("#paybuttonpanel").show();$("#receiptpanel").show()}}function displayRightButtons(){$("#changetablebtn").hide();$("#tablerecordsbtn").hide();if(panelMode==="waiter"){if((rightpaydesk==1)&&(cashenabled==1)){$("#paydeskbtn").show()}$("#hostbutton").hide();$("#paydeskcash").hide();$("#paydeskprint").hide();$("#goorderbtn").hide();if(neworders.length>0){if((workflowconfig==WORKFLOW_DIGI_AND_WORK)||(workflowconfig==WORKFLOW_WORK)||(workflowconfig==WORKFLOW_WORK_TRANSFER)){if(showtransferbtns==1){$("#workbtn").show()}}if((workflowconfig==WORKFLOW_DIGI_AND_WORK)||(workflowconfig==WORKFLOW_DIGI)||(workflowconfig==WORKFLOW_WORK_TRANSFER)){if(showtransferbtns==1){$("#sendNewOrders").show()}}}if((selectedtableindex!=null)&&(neworders.length==0)){$("#changetablebtn").show();$("#tablerecordsbtn").show()}}else{$("#paydeskbtn").hide();if((restaurantmode==1)&&(showhostprint==1)){$("#hostbutton").show()}if(prodsaccounted.length>0){if(forceprint==0){$("#paydeskcash").show()}$("#paydeskprint").show();$("#goorderbtn").show()}else{$("#paydeskcash").hide();$("#paydeskprint").hide()}$("#workbtn").hide();$("#sendNewOrders").hide()}}var e_prod=null;var e_option=null;var extrasManagement=new ExtrasManagement();function showExtras(a,b){e_prod=a;e_option=b;extrasManagement.setAllExtras(a.extras);$("#selectiondialog").dialog({autoOpen:false,modal:true,height:400,buttons:{Anwenden:function(){$(this).dialog("close");applyExtras()}}});displayExtras();$("#selectiondialog").dialog("open")}function displayExtras(){var a="";a+="<div><ul class='extraschoice'>";if(requestPriceInExtras!=false){a+='<li><input id="enterpriceextrasfield" type="text" placeholder="Preis" value="'+toHtml(presetPriceInExtras)+'" /></li>'}a+=extrasManagement.renderExtras(null,null,false);a+="</ul></div>";$("#selectiondialog").html(a);$(".ui-dialog-buttonset .ui-button").css("background-color","#44ff44");$(".ui-widget-header").css("background-color","#ff4400");bindExtra()}function bindExtra(){$(".extraitem").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();extraClicked(parseInt(this.id.split("_")[1]))});$(".extraitemselected").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();extraClicked(parseInt(this.id.split("_")[1]))})}function extraClicked(a){if(requestPriceInExtras!==false){presetPriceInExtras=$("#enterpriceextrasfield").val()}extrasManagement.extraClicked(a);displayExtras()}function applyExtras(){var a=extrasManagement.getAssignedExtras();if(requestPriceInExtras){var b=$("#enterpriceextrasfield").val();b=b.trim();b=b.replace(decpoint,".");if((b!="")&&($.isNumeric(b))){requestPriceInExtras=false;presetPriceInExtras="";addProductToNewOrders(e_prod.id,e_option,a,b,0,b)}else{alert(W_NO_VALID_PRICE[lang])}}else{addProductToNewOrders(e_prod.id,e_option,a,"NO",0)}}function calcTotalPriceOfProdAndExtras(b,c){var e=parseFloat(b);var a=extrasManagement.calcPriceOfAssignedExtras(c);totalPrice=(parseFloat(e+a)).toFixed(2);return totalPrice}var actcount=0;var actprice=0;var actname="";var selectedEntry=null;var actchangedprice=false;var actoption="";var acttogo=0;var actunit=0;var actunitamount=1;var origprice=0;var countatdialogstart=0;var CHANGE_ALL=0;var CHANGE_ONE=1;function bindNewOrderItem(){$(".ordereditem-item-new").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();var b=parseInt(this.id.split("_")[2]);selectedEntry={count:groupedNewOrders.count[b],name:groupedNewOrders.name[b],price:groupedNewOrders.price[b],option:groupedNewOrders.option[b],extras:groupedNewOrders.extras[b],prodid:groupedNewOrders.prodids[b],origidxs:groupedNewOrders.origidxs[b],changedPrices:groupedNewOrders.changedPrices[b],togos:groupedNewOrders.togos[b],unit:groupedNewOrders.units[b],unitamount:groupedNewOrders.unitamounts[b]};acttogo=groupedNewOrders.togos[b];actcount=groupedNewOrders.count[b];countatdialogstart=actcount;actname=groupedNewOrders.name[b];actchangedprice=groupedNewOrders.changedPrices[b];actoption=groupedNewOrders.option[b];actunit=groupedNewOrders.units[b];actunitamount=groupedNewOrders.unitamounts[b];origprice=groupedNewOrders.price[b];if(actchangedprice==="NO"){actprice=origprice}else{actprice=actchangedprice}insertDataIntoActDialog(true);var a=400;if(rightchangeprice==1){a=600}$("#actmenudlg").dialog({autoOpen:false,modal:true,height:a,width:600,buttons:{Abbrechen:function(){$(this).dialog("close")},"Löschen":function(){$(this).dialog("close");delNewOrderItem()},"Alle ändern":function(){$(this).dialog("close");changeAllNewOrders()},"Einen Artikel ändern":function(){$(this).dialog("close");changeOneNewOrder()}}});$(".ui-dialog-buttonset .ui-button").css("font-weight","bold");$(".ui-dialog-buttonset .ui-button").css("color","black");$(".ui-dialog-buttonset .ui-button:nth-child(2)").css("background-color","#ff0000");$("#actmenudlg").dialog("open")})}function getDiscountButton(c,a){var b=c+"%";if(a.trim()!=""){b=toHtml(a)}return b}function insertDataIntoActDialog(c){$("#actdiscount1btn").html(getDiscountButton(discount1,discountname1));$("#actdiscount2btn").html(getDiscountButton(discount2,discountname2));$("#actdiscount3btn").html(getDiscountButton(discount3,discountname3));$("#actcountno").html(actcount+"x");$("#actname").html(actname);var b=actprice.replace(".",decpoint);var a=b+" "+currency;if(actunit>1){a+="/"+g_units_arr[actunit].text}$("#actpriceinfo").html(a);$("#actpricefield").val(b);$("#actremarkfield").val(actoption);if(c){$("#actnumberentryfield").val(actcount)}if(acttogo==0){$("#togoicon").hide();$("#notogoicon").show()}else{$("#togoicon").show();$("#notogoicon").hide()}if(rightchangeprice==1){$("#actdiscount").show();$("#actprice").show()}else{$("#actdiscount").hide();$("#actprice").hide()}bindActBtn()}function bindActBtn(){$("#actnumberentryfield").off("keyup").on("keyup",function(b){var a=$("#actnumberentryfield").val().trim();if((a!="")&&($.isNumeric(a))){if((a>=0)&&(a<=1000)){actcount=a;insertDataIntoActDialog(false)}else{insertDataIntoActDialog(true)}}else{actcount=countatdialogstart;insertDataIntoActDialog(false)}});$(".actbtn").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();var b=this.id;if(b==="actminusbtn"){if(actcount>0){actcount--}$("#actnumberentryfield").val(actcount)}else{if(b==="actplusbtn"){actcount++;$("#actnumberentryfield").val(actcount)}else{if(b==="actdiscount1btn"){actprice=origprice-origprice*discount1/100;var a=actprice.toFixed(2).replace(".",decpoint);$("#actpricefield").val(a);$("#actpriceinfo").html(a+" "+currency)}else{if(b==="actdiscount2btn"){actprice=origprice-origprice*discount2/100;var a=actprice.toFixed(2).replace(".",decpoint);$("#actpricefield").val(a);$("#actpriceinfo").html(a+" "+currency)}else{if(b==="actdiscount3btn"){actprice=origprice-origprice*discount3/100;var a=actprice.toFixed(2).replace(".",decpoint);$("#actpricefield").val(a);$("#actpriceinfo").html(a+" "+currency)}else{if(b==="acttogobtn"){acttogo=1-acttogo}}}}}}insertDataIntoActDialog(true)})}function changeAllNewOrders(){actionNewOrderConfirm(CHANGE_ALL)}function changeOneNewOrder(){actionNewOrderConfirm(CHANGE_ONE)}function delNewOrderItem(){actcount=0;actionNewOrderConfirm(CHANGE_ALL)}function actionNewOrderConfirm(h){var c=selectedEntry;if(rightchangeprice==1){var g=$("#actpricefield").val().trim();g=g.replace(",",".");if(g>999.99){alert("Maximaler Preis für das Produkt überschritten");return}if(g==""){g="NO"}else{if(!$.isNumeric(g)){alert("Es wurde ein falsches Zahlenformat angegeben");return}else{g=roundtodigits(g,2).toString();actprice=g;$("#actpricefield").val("")}}}else{var o=getProdEntry(c.prodid);if(o.unit==1){var g=$("#actpricefield").val().trim();g=g.replace(",",".")}else{g="NO"}}if(h==CHANGE_ONE){var a=c.origidxs;neworders[a[0]].option=$("#actremarkfield").val();neworders[a[0]].changedPrice=g;neworders[a[0]].togo=acttogo}else{var a=c.origidxs;for(m=0;m<a.length;m++){var q=a[m];neworders[q].option=$("#actremarkfield").val();neworders[q].changedPrice=g;neworders[q].togo=acttogo}}$("#actremarkfield").val("");$("#actnumberentryfield").val("");var t=c.count;var b=actcount;var p=b-t;if(p<0){var f=0-p;var a=c.origidxs;var m=0;for(m=0;m<f;m++){var s=a.pop();neworders.splice(s,1)}}if(p>0){var a=c.origidxs;var r=a[0];var l=neworders[r].prodid;var g=neworders[r].changedPrice;var e=neworders[r].togo;var n=neworders[r].option;var k=neworders[r].extras;for(m=0;m<p;m++){addProductToNewOrders(l,n,k,g,e)}}showNewOrders()}var taxtype="normal";var prodsToPayList=[];var prodsToPayListGrouping=[];var prodsOnReceiptList=[];var prodsOnReceiptListGrouping=[];var prodsaccounted=[];var doPrint=false;var showItemsPerPrintJob=false;function startCashProcess(){prodsaccounted=[];displayRightButtons();getAndShowPayItems()}function getAndShowPayItems(){if(panelMode==="paydesk"){var a=0;if(selectedroomindex!=null){if(selectedroomindex>=0){if(selectedtableindex!=null){var b=roominfo.roomstables[selectedroomindex].tables[selectedtableindex];a=b.id;taxtype="normal"}else{a=null}}else{tabeid=0;taxtype="togo"}}else{a=null}showItemsPerPrintJob=false;if((billprintjobs==1)||((billprintjobs==2)&&(a==0))){showItemsPerPrintJob=true;$("#billprintjobspanel").show()}else{$("#billprintjobspanel").hide()}if(a!=null){doAjax("GET","php/contenthandler.php?module=queue&command=getJsonProductsOfTableToPay",{tableid:a},showProductsToPay,"Fehler bei der Datenübermittlung",true)}else{prodsToPayList=[];displayProdsToPayForTable();displayProdsOnReceipt()}}}function showProductsToPay(a){if(a.status!="OK"){alert("Fehler: "+a.msg);if(a.code==4){setTimeout(function(){document.location.href="index.html"},250)}}prodsToPayList=a.msg;fillProdByPrintJobsList(prodsToPayList);if((a.msg.length==0)&&(returntoorder==1)){unZoomTableMap();goOrderDesk()}else{displayProdsToPayForTable();displayProdsOnReceipt()}}function putItemInSortedListToReceipt(b){for(var e=0;e<prodsToPayListGrouping.sortedset.length;e++){var h=prodsToPayListGrouping.sortedset[e];var g=h.ids;for(var c=0;c<g.length;c++){var a=g[c];if(a==b){var f=h.count;increaseAccountedNumber(h);return}}}}function displayProdsToPayForTable(){bindHostButton("#hostbutton");if(prodsToPayList.length==0){$("#oben").html("Keine weiteren Artikel vorhanden.")}else{prodsToPayListGrouping=new Grouping(prodsToPayList,createHashOfPayableItem);prodsToPayListGrouping.group();var a=prodsToPayListGrouping.outputList(createPayableItemListElement);$("#oben").html(a)}$(".payable").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();var h=this.id;var g=$(".payable").index(this);var f=prodsToPayListGrouping.sortedset[g];var b=aProdToPayIsClicked(f);updateAccounted(h,b,f.count);displayProdsOnReceipt()});$("#payall").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();for(var b=0;b<prodsToPayListGrouping.sortedset.length;b++){var f=prodsToPayListGrouping.sortedset[b];var c=f.count;var g=createHashOfPayableItem(f);setAccountedNumber(f,c)}displayProdsToPayForTable();displayProdsOnReceipt()});if(showItemsPerPrintJob){$(".payallofprintjob").off("click").on("click",function(g){g.stopImmediatePropagation();g.preventDefault();var c=this.id.split("_")[1];var f=prodsByPrintjob[c];for(var b=0;b<f.length;b++){putItemInSortedListToReceipt(f[b]["id"])}displayProdsToPayForTable();displayProdsOnReceipt()})}$("#paydeskcash").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();doPrint=false;if(showpayments==1){displayPayments()}else{payWithoutPaymentDlg()}});$("#paydeskprint").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();doPrint=true;if(showpayments==1){displayPayments()}else{payWithoutPaymentDlg()}})}function displayPayments(){var c="";c+='<div id="paym_1" class="paymentitem" >'+payments[0].name+"</div>";c+="<br><hr><br>";for(var b=0;b<payments.length;b++){var g=payments[b];var f=g.id;var a=g.name;if((f==2)&&(showpayment2==1)){c+='<div id="paym_'+f+'" class="paymentitem" >'+a+"</div>"}if((f==3)&&(showpayment3==1)){c+='<div id="paym_'+f+'" class="paymentitem" >'+a+"</div>"}if((f==4)&&(showpayment4==1)){c+='<div id="paym_'+f+'" class="paymentitem" >'+a+"</div>"}if((f==5)&&(showpayment5==1)){c+='<div id="paym_'+f+'" class="paymentitem" >'+a+"</div>"}if((f==6)&&(showpayment6==1)){c+='<div id="paym_'+f+'" class="paymentitem" >'+a+"</div>"}if((f==7)&&(showpayment7==1)){c+='<div id="paym_'+f+'" class="paymentitem" >'+a+"</div>"}if((f==8)&&(showpayment8==1)){c+='<div id="paym_'+f+'" class="paymentitem" >'+a+"</div>"}}c+='<div id="paym_cancel" class="paymentcancel" >'+P_CANCEL[lang]+"</div>";$("#selectiondialog").html(c);var e=600;if(paymentconfig==1){e=380}$("#selectiondialog").dialog({autoOpen:false,modal:true,height:e,buttons:{Abbrechen:function(){$(this).dialog("close")}}});$("#selectiondialog").dialog("open");bindPayment()}function payWithoutPaymentDlg(){startPayProcess(1,"","","")}function bindPayment(){$(".paymentcancel").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();$("#selectiondialog").dialog("close")});$(".paymentitem").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();var b=this.id.split("_")[1];currentPaymentId=b;$("#selectiondialog").dialog("close");if((currentPaymentId==PAYMENT_HS3)||(currentPaymentId==PAYMENT_GUEST)){$("#hoteldialog").dialog({autoOpen:false,modal:true,height:400,width:500,buttons:{Abbrechen:function(){$(this).dialog("close")}}});$("#hoteldialog").dialog("open");$("#roomguesttextfield").val("");bindhotelinterface(currentPaymentId);return}else{startPayProcess(b,"","","")}})}function bindhotelinterface(a){generateGuestResult($("#roomguesttextfield").val(),false,a);$("#roomguesttextfield").off("keyup").on("keyup",function(b){generateGuestResult($("#roomguesttextfield").val(),false,a)});$("#paym_hotel").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();var f=$("#hotelroomfoundguest").data("reservation");var c=$("#hotelroomfoundguest").data("guest");var b=$("#hotelroomselection").find(":selected").val();if(b!=undefined){var c=guests[b];var g="";if(currentPaymentId==PAYMENT_GUEST){c=internalguests[b];g=c.id}startPayProcess(currentPaymentId,c.reservationid,c.object+" - "+c.guest,g);$("#hoteldialog").dialog("close")}else{alert("Kein Gast ausgewählt")}})}function generateGuestResult(c){c=c.trim().toLowerCase();if(c==""){$("#hotelroomselection").html("");return}var b="";var a=false;$.each(guests,function(h,k){var e=k.object;var l=k.guest;var f=(e.toLowerCase().indexOf(c)>=0);var g=(l.toLowerCase().indexOf(c)>=0);if(f||g){if(!a){a=true;b+='<option value="'+h+'" selected>'+toHtml(e+" - "+l)+"</option>"}else{b+='<option value="'+h+'" >'+toHtml(e+" - "+l)+"</option>"}}});$("#hotelroomselection").html(b)}function updateAccounted(c,a,b){if(a===b){$("#"+c).removeClass("paystillopen");$("#"+c).removeClass("payallaccounted");$("#"+c).removeClass("payitemnormborder");$("#"+c).addClass("payallaccounted");$("#"+c).addClass("payitemoffborder")}else{$("#"+c).removeClass("paystillopen");$("#"+c).removeClass("payallaccounted");$("#"+c).removeClass("payitemoffborder");$("#"+c).addClass("paystillopen");$("#"+c).addClass("payitemnormborder")}if(a===0){$("#"+c+" .payitemaccounted").html("")}else{$("#"+c+" .payitemaccounted").html(a)}}function getProdAccountedEntry(c){var f=createHashOfPayableItem(c);for(var a=0;a<prodsaccounted.length;a++){var e=prodsaccounted[a];var b=e.hash;if(f===b){return e}}return null}function increaseAccountedNumber(b){var a=getProdAccountedEntry(b);if(a!==null){a.count=a.count+1}else{var c={hash:createHashOfPayableItem(b),count:1};prodsaccounted[prodsaccounted.length]=c}}function setAccountedNumber(b,c){var a=getProdAccountedEntry(b);if(a!==null){a.count=c}else{var e={hash:createHashOfPayableItem(b),count:c};prodsaccounted[prodsaccounted.length]=e}}function aProdToPayIsClicked(b){var a=getProdAccountedEntry(b);if(a!==null){if(a.count<b.count){a.count=a.count+1;return a.count}else{a.count=0;return 0}}else{var c={hash:createHashOfPayableItem(b),count:1};prodsaccounted[prodsaccounted.length]=c;return 1}}function displayProdsOnReceipt(){createProdsOnReceiptList();prodsOnReceiptListGrouping=new Grouping(prodsOnReceiptList,createHashOfPayableItem);prodsOnReceiptListGrouping.group();createAllEntriesInReceipt()}function createHashOfPayableItemWithoutTax(f){var c=f.longname;if(f.pricelevelname!="A"){c+=" ("+f.pricelevelname+")"}c+=" - "+(parseFloat(f.price).toFixed(2).replace(".",decpoint));if(f.togo==1){c="To-Go: "+c}var h=[];var b=f.extras;for(var a=0;a<b.length;a++){var e=b[a];h[h.length]="+ "+toHtml(e)}var g="<p>"+h.join("<br>");return toHtml(c)+g}function createHashOfPayableItem(b){var a="{{"+(parseFloat(b.tax).toFixed(2).replace(".",decpoint))+"}}";return createHashOfPayableItemWithoutTax(b)+toHtml(a)}function createPayableItemListElement(e){var f="";var h=1;if("count" in e){if(e.count>1){f=e.count+"x ";h=e.count}}var a=false;var g=getProdAccountedEntry(e);var i="";if(g!==null){if(g.count!=0){i=g.count}if(g.count==h){a=true}}var l="";if(a){if(preferimgdesk==0){l='<div id="payable_'+e.id+'" class="payitem payitemoffborder payable payallaccounted"><div class=\'payitemmain\'>'+f+createHashOfPayableItemWithoutTax(e)+"</div><div class='payitemaccounted'>"+i+"</div></div>"}else{var m="php/contenthandler.php?module=products&command=getprodimage&prodid="+e.prodid+"&size=m";var b=" style=\"background-image: url('"+m+"'); background-size: cover; background-repeat: no-repeat; background-position: center center; \" ";var c="<span class='whitebackground'>"+f+createHashOfPayableItemWithoutTax(e)+"</span>";l='<div id="payable_'+e.id+'" class="payitem payitemoffborder payable payallaccounted" '+b+"><div class='payitemmain'>"+c+"</div><div class='payitemaccounted'>"+i+"</div></div>"}}else{if(preferimgdesk==0){l='<div id="payable_'+e.id+'" class="payitem payitemnormborder payable paystillopen"><div class=\'payitemmain\'>'+f+createHashOfPayableItemWithoutTax(e)+"</div><div class='payitemaccounted'>"+i+"</div></div>"}else{var m="php/contenthandler.php?module=products&command=getprodimage&prodid="+e.prodid+"&size=m";var k=" style=\"background-image: url('"+m+"'); background-size: cover; background-repeat: no-repeat; background-position: center center; \" ";var n="<span class='whitebackground'>"+f+createHashOfPayableItemWithoutTax(e)+"</span>";l='<div id="payable_'+e.id+'" class="payitem payitemnormborder payable paystillopen" '+k+"><div class='payitemmain'>"+n+"</div><div class='payitemaccounted'>"+i+"</div></div>"}}return l}function createOnReceiptItemListElement(c){var b="";if("count" in c){if(c.count>1){b=c.count+"x "}}var a='<div id="payable_'+c.id+'" class="payitem onreceipt">'+b+createHashOfPayableItem(c)+"</div>";return a}function getProdOfAllProdsWithHash(e){var b=prodsToPayListGrouping.sortedset;for(var a=0;a<b.length;a++){var c=b[a];if(createHashOfPayableItem(c)===e){return c}}return null}function createProdsOnReceiptList(){prodsOnReceiptList=[];for(var b=0;b<prodsaccounted.length;b++){var c=prodsaccounted[b];var e=c.hash;var a=getProdOfAllProdsWithHash(e);for(j=0;j<c.count;j++){prodsOnReceiptList[prodsOnReceiptList.length]=clonePayableItem(a)}}}function clonePayableItem(b){var a={extras:b.extras,id:b.id,ids:b.ids,longname:b.longname,price:b.price,pricelevelname:b.pricelevelname,prodid:b.prodid,tax:b.tax,togo:b.togo};return a}function createAllEntriesInReceipt(){var a=new Array();for(var e=0;e<prodsOnReceiptList.length;e++){var l=prodsOnReceiptList[e];var h={prodid:l.prodid,queueid:l.id,longname:l.longname,price:l.price,tax:l.tax,togo:l.togo,extras:l.extras,pricelevelname:l.pricelevelname};a=addEntryOrIncreaseCount(a,h)}var g=createReceiptHeader();g+=generateProdPart(decpoint,a);var b=$("#info-page").data("usstGerVal");if($("#info-page").data("taxtype")=="togo"){b=$("#info-page").data("togoTaxGerVal")}var f=listTaxesBasedOnUntenList(decpoint);g+=createReceiptFooter(b,lang,f);if(showHostTemplate){g+=hostTemplate}var c="<table><br>"+g+"</table>";$("#receiptpanel").html(c);calcSum();var k=$("#receiptpart").html();$("#info-page").data("receipthtml",k);displayRightButtons()}function getTableName(){if(selectedtableindex!=null){var a=roominfo.roomstables[selectedroomindex].tables[selectedtableindex];return a.name}else{if(selectedroomindex=="-1"){return"Zum Mitnehmen"}else{return null}}}function createReceiptHeader(){var a=genCreateReceiptHeader(0,"",getTableName(),loggedinUser,currency);return a}function createReceiptFooter(b,c,a){var e=genCreateReceiptFooterNoSum(b,0,"",a);return e}function getQueueIdsDueToCountOfItem(g){var e=[];var h=g.hash;var f=g.count;for(var b=0;b<prodsToPayList.length;b++){var c=prodsToPayList[b];var a=createHashOfPayableItem(c);if(a===h){e[e.length]=c.id;if(e.length>=f){break}}}return e}function startPayProcess(n,l,m,g){var k=getTableName();var b=0;if(selectedroomindex!=-1){if(selectedtableindex!=null){var f=roominfo.roomstables[selectedroomindex].tables[selectedtableindex];b=f.id}else{b=0}}var e=$("#info-page").data("usst");if($("#info-page").data("taxtype")=="togo"){e=$("#info-page").data("togotax")}checkForLogIn();var a=[];for(var h=0;h<prodsaccounted.length;h++){var o=prodsaccounted[h];if(o.count!=0){$.merge(a,getQueueIdsDueToCountOfItem(o))}}a=a.join();var c=1;if(workflowconfig==1){c=digigopaysetready}$.ajax({type:"POST",dataType:"json",data:{ids:a,tableid:b,paymentid:n,declareready:c,host:(showHostTemplate?1:0),reservationid:l,guestinfo:m,intguestid:g},url:"php/contenthandler.php?module=queue&command=declarePaidCreateBillReturnBillId",async:false,success:function(r){showHostTemplate=false;var p=r.status;var q=r.msg;if(p!="ERROR"){billid=q.billid;billdate=q.date;if(billid<0){alert("Fehler! Wurden Produkte ausgewählt? Bitte erneut versuchen. Error code: "+billid)}else{requestRoomInformation();var t=$("#info-page").data("billlanguage");$("#billid").html(P_ID[t]+billid);$("#billdate").html(billdate);if(doPrint){var i=$("#info-page").data("payPrintType");if(i=="s"){printBill(billid)}else{$("#oben").hide();var s="<table>"+$(".receipttable").html()+"</table>";printContent(s)}}startCashProcess()}}else{alert("Fehler: "+q)}},error:function(i){alert("Sorry, there was a problem! "+i)}})}var P_DESCR=["Beschreibung","Description","Descripción"];var P_PRICE=["Preis","Price","Precio"];var P_TOTAL=["Total","Total","Total"];var P_ID=["Id:","Id:","Id:"];var P_ROOMSEL=["Raumauswahl","Room selection","Selección de espacio"];var P_PAYDESK_ACTIONS=["Kassenaktionen","Paydesk actions","Acciones de caja"];var P_BAR_INPUT=["Bareinlage","Input money","Insertar dinero"];var P_BAR_GET=["Barentnahme","Take money","Sacar dinero"];var P_BAR_SUM=["Einnahmen","Revenue","Cobro"];var P_TITLE=["Kasse","Paydesk","Caja"];var P_TABLE=["Tisch","Table","Mesa"];var P_TABLE_SEL=["Tischauswahl","Select table","Qué mesa?"];var P_NOT_PAID=["Ausstehend für ","Not paid for ","Impagado para "];var P_OPS=["Operationen","Operations","Operaciones"];var P_ALL=["Alles","All","Todo"];var P_CONTENT_RECEIPT=["Inhalt Kassenbon","Content of receipt","Contenido del tique"];var P_ONLY_PAY=["Nur Zahlung","Only pay","Solo pagar"];var P_PAY_PRINT=["Bondruck","Pay+Print","Pagar+Imprimir"];var P_CHANGE_CALC=["Wechselgeldrechner:","Change Calculator:","Calculadora de Cambio:"];var P_CHOOSE_PAYWAY=["Auswahl der Zahlungsart:","Selection of method of payment:","Selección del modo de pago:"];var P_CANCEL=["Abbrechen","Cancel","Cancelar"];var P_CASHTAKEOUT=["Barentnahme aus der Kasse","Cash take-out","Sacar dinero"];var P_CASHTAKIN=["Bareinlage in die Kasse","Cash insert","Insertar dinero"];var P_AMOUNT=["Betrag:","Amount:","Valor:"];var P_OVERVIEW=["Übersicht Kellnerkasse","Overview waiter purse","Resumen cartera de bolsillo"];var P_PUT_IN=["Einlegen","Insert","Insertar"];var P_TAKE_OUT=["Entnehmen","Take out","Sacar"];var P_OVERV_DETAILS=["Diese Übersicht zeigt die Einnahmen durch den Kellner pro Zahlungsweg seit der letzten Tageslosung sowie als weiteren Wert den Kassenstand unter Berücksichtigung der eigenen Eingaben und Entnahmen.","This overview contains the amount of money of this waiter since the last closing as well as the total amount of money including the own cash insert and take-out actions.","Este resumen contiene todo el dinero del camarero, y también el dinero incluido con acciones de insertar y sacar."];var P_CASH_SUM=["Bewirtungseinnahmen (ohne Ein-/Auslagen):","Cash by payment (without inserts/take-outs):","Cobro (sin tomas/entradas):"];var P_INCLUDE_OWN=["<b>Bar</b>bestand inkl. eigener Kassenein-/auslagen:","Cash incl. own cash insert/take-outs:","Cash incl. tomas y entradas proprias:"];var P_NO_ELEM=["Keine Rechnungselemente","No items selected","Ningún producto selecionado"];var P_NO_ELEM_DETAILS=["Es wurden keine abrechenbaren Produkte festgelegt (der Bon ist leer!).","There are no selected items. The receipt is empty!","No hay ningún elemento seleccionado para pagar."];var P_CASHACTION_OK=["Kassenaktion abgeschlossen.","Action completed.","Acción terminado."];var P_NAV=["Navigation","Navigation","Navigación"];var P_ORDER_ACTION=["-> Bestellansicht","-> Order view","-> Vista de Orden"];var P_TO_PAY=["Zu zahlen: ","To pay: ","Pagar total: "];var P_PAY_RETURN=["Zurück: ","Return: ","Torna: "];var P_CALC_PAYBACK=["Berechne","Calculate","Calcular"];var P_HAS_PAID=["Bezahlt: ","Paid: ","Pagado: "];var P_TOGO=["Außer-Haus-Verkauf","Sale with Tax No 2","Venta IVA 2"];var P_TIP=["nur Trinkg.: ","Only tip: ","Solo prop.: "];var P_TOTAL_INCL_TIP=["Zielbetrag:","Target pay:","Quiere pagar:"];var CALC_TIP_TXT=["Angabe extra Trinkg.","Do Tip separate","Propina individual"];var CALC_TOTAL_TXT=["Angabe inkl.Trinkg.","Do Tip incl.","Propina incl."];var P_GUESTS=["Gäste","Guests","Habitaciones"];var P_OF_WORK_RECEIPT=[" von Arbeitsbon ","of work receipt "," del ticket de trabajo "];var P_BILL_TITLE=["Rechnung","Bill","Factura"];var showHostTemplate=false;var guests=[];var internalguests=[];var hotelinterface=0;var PAYMENT_CARD=2;var PAYMENT_HS3=7;var PAYMENT_GUEST=8;var currentPaymentId=7;var showpayments=1;var showpayment2=1;var showpayment3=1;var showpayment4=1;var showpayment5=1;var showpayment6=1;var showpayment7=1;var showpayment8=1;var forceprint=0;var showhostprint=1;var billprintjobs=0;var prodsByPrintjob=[];var currentSelectedIsTogo=false;function getGeneralConfigItems(){doAjax("GET","php/contenthandler.php?module=admin&command=getGeneralConfigItems",null,insertGeneralConfigItems,"Fehler Konfigurationsdaten")}function getPayments(a){doAjax("GET","php/contenthandler.php?module=admin&command=getPayments",null,a,"Fehler Zahlungswege")}function insertGeneralConfigItems(b){if(b.status=="OK"){var a=b.msg;decpoint=a.decpoint;$("#info-page").data("decpoint",a.decpoint);currency=a.currency;var e=a.tax;var c=e.replace(".",decpoint);$("#info-page").data("usstGerVal",c);$("#info-page").data("usst",e);e=a.togotax;c=e.replace(".",decpoint);$("#info-page").data("togoTaxGerVal",c);$("#info-page").data("togotax",e);$("#info-page").data("companyinfo",a.companyinfo);$("#info-page").data("payPrintType",a.payprinttype);$("#info-page").data("currency",a.currency);$("#info-page").data("billlanguage",a.billlanguage);$("#info-page").data("userlanguage",a.userlanguage);receiptfontsize=parseInt(a.receiptfontsize);$("#receiptpart").css("font-size",receiptfontsize+"px");paymentconfig=a.paymentconfig;showpayments=a.showpayments;showpayment2=a.showpayment2;showpayment3=a.showpayment3;showpayment4=a.showpayment4;showpayment5=a.showpayment5;showpayment6=a.showpayment6;showpayment7=a.showpayment7;showpayment8=a.showpayment8;forceprint=a.forceprint;$("#curtopay2").html(" "+a.currency);workflowconfig=a.workflowconfig;digigopaysetready=a.digigopaysetready;showhostprint=a.showhostprint;restaurantmode=a.restaurantmode;billprintjobs=a.billprintjobs;sumupforcard=a.sumupforcard;affiliatekey=a.affiliatekey;appid=a.appid;serverurl=a.serverurl;if(serverurl.endsWith("/")){serverurl=serverurl.substr(0,serverurl.length-1)}setLanguage(a.userlanguage)}else{$("#contentpart").hide();setTimeout(function(){document.location.href="index.html"},250)}}function addEntryOrIncreaseCount(a,f){var c=0;var g=false;var e=f.prodid+"-"+f.extras.join("_")+f.price+"-"+f.pricelevelname+"#"+f.tax+"_"+f.togo;for(c=0;c<a.length;c++){var b=a[c];if(b[2]==e){b[0]+=1;g=true}}if(!g){a.push(new Array(1,f,e))}return a}function genCreateReceiptHeader(b,e,h,f,k,l){var a='style="border: solid black 0px;padding: 3px;text-align:right;vertical-align:bottom;"';var i=P_TABLE[b]+" "+h;var c=P_WAITER[b]+" "+f;var g="";g+="<tr><td colspan=6>&nbsp;</tr>";g+="<tr><td colspan=4>"+i+' <td id="billid" colspan=2 '+a+">ID:"+e+"</tr>";g+='<tr><td colspan=4>&nbsp;<td id="billdate" colspan=2 '+a+"></tr>";g+="<tr><td colspan=6>"+c+"</tr>";g+="<tr><td colspan=6>&nbsp</tr>";if(l!=""){g+="<tr><td colspan=6>Gast: "+toHtml(l)+"</tr>";g+="<tr><td colspan=6>&nbsp</tr>"}g+="<tr><td>"+P_NO[b]+"<td colspan=3>"+P_DESCR[b]+"<td "+a+">"+P_PRICE[b]+"<td "+a+">"+P_TOTAL[b]+"</tr>";return g}function genCreateReceiptFooterNoSum(c,e,b,a){return genCreateReceiptFooter(c,e,b,"","","",a)}function genCreateReceiptFooter(a,f,b,k,e,m,n){var c='style="border: solid black 0px;padding: 3px;text-align:right;vertical-align:bottom;"';var p='style="text-align:center;vertical-align:bottom;"';var h="<tr><td colspan=6>&nbsp</tr>";var o=h;o+="<tr><td colspan=2>"+P_MWST[f]+"% <td "+c+">"+P_MWST[f]+"<td "+c+">"+P_NETTO[f]+"<td "+c+" colspan=2>"+P_BRUTTO[f]+"</tr>";for(var l=0;l<n.length;l++){var g=n[l];g=g.replace(",","-");o+='<tr><td id="taxval'+g+'" colspan=2><td id="mwst'+g+'" '+c+">"+k+'<td id="netto'+g+'" '+c+">"+e+'<td id="brutto'+g+'" '+c+" colspan=2>"+m+"</tr>"}o+=h;o+="<tr><td> &nbsp; <td colspan=3>"+P_SUM[f]+'<td id="priceinreceipt2" '+c+" colspan=2>"+m+"</td></tr>";o+=h;o+="<tr><td "+p+" colspan=6><center>&nbsp;<br>";o+=toHtml(b).replace(/(?:\r\n|\r|\n)/g,"<br />");o+="</center></tr>";return o}function generateOneProdLine(k,g,i,a,o,f){var b='style="border: solid black 0px;padding: 3px;text-align:right;vertical-align:bottom;"';var h='style="border: solid black 0px;padding: 3px;text-align:center;vertical-align:bottom;"';var c=(parseFloat(i)).toFixed(2).replace(".",o);if(a!="A"){g+=" ("+a+")"}if(f==1){g="To-Go: "+g}var n=k*i;var m="<tr>";var e='style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;width: 60%;"';var l=n.toFixed(2).replace(".",o);if(k==0){k="";c="";l=""}m+="<td "+h+' id="count">'+k+"<td colspan=3 "+e+">"+g;m=m+"<td "+b+">"+c;m+="<td "+b+">"+l+"</tr>";return m}function generateProdPartByDbContent(f,e){var c=0;tablecontent="";for(c=0;c<e.length;c++){var b=e[c];var h=b.count;var i=b.productname;var g=b.price;var a=b.pricelevel;tablecontent+=generateOneProdLine(h,i,g,a,f)}return tablecontent}function listTaxes(b,f){var a=[];for(var c=0;c<b.length;c++){var e=parseFloat(String(b[c]));e=e.toFixed(2).replace(".",f);if(a.indexOf(e)<0){a[a.length]=e}}return a}function listTaxesBasedOnUntenList(e){var b=[];for(var c=0;c<prodsOnReceiptList.length;c++){var a=prodsOnReceiptList[c];b.push(a.tax)}return listTaxes(b,e)}function calcSum(){var f=listTaxesBasedOnUntenList(decpoint);var n=prodsToPayList;var e=0;var h=[];var c=[];var m=[];for(var v=0;v<f.length;v++){h[v]=0;c[v]=0;m[v]=0}var r=0;var q=0;var l=0;for(var s=0;s<prodsOnReceiptList.length;s++){var w=prodsOnReceiptList[s];var o=parseFloat(w.price);var x=w.tax;var p=parseFloat(x);x=x.replace(".",decpoint);var g=o/(1+p/100);var u=o-g;var b=0;for(var v=0;v<f.length;v++){if(f[v]==x){b=v}}h[b]=h[b]+g;c[b]=c[b]+o;m[b]=m[b]+u;r+=g;q+=o;l+=u}for(var t=0;t<f.length;t++){var p=f[t];var a=p.replace(",","-");$("#taxval"+a).html(p+"%");$("#mwst"+a).html(m[t].toFixed(2).replace(".",decpoint));$("#netto"+a).html(h[t].toFixed(2).replace(".",decpoint));$("#brutto"+a).html(c[t].toFixed(2).replace(".",decpoint))}billbrutto=q;billnetto=r;$("#priceinreceipt").html(q.toFixed(2).replace(".",decpoint)+" "+currency);$("#priceinreceipt2").html(q.toFixed(2).replace(".",decpoint)+" "+currency)}function bindCashButton(){$("#cashbutton").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();$("#cashdlg").dialog({autoOpen:false,modal:true,height:520,width:500,buttons:{Abbrechen:function(){$(this).dialog("close")},Einlegen:function(){cashOperation("in")},Entnehmen:function(){cashOperation("out")}}});$("#includeowncash").html(P_INCLUDE_OWN[lang]);$("#cashmoney").val("");$("#cashremark").val("");$("#cashdlg").dialog("open");doAjax("POST","php/contenthandler.php?module=bill&command=getCashOverviewOfUser",null,insertCashValues,"Fehler Kassenaktion");$(".ui-dialog-buttonset .ui-button").css("font-weight","bold");$(".ui-dialog-buttonset .ui-button").css("color","black");$(".ui-dialog-buttonset .ui-button:nth-child(2)").css("background-color","#e0e0d1");$(".ui-dialog-buttonset .ui-button:nth-child(2)").css("background-color","#ccff99");$(".ui-dialog-buttonset .ui-button:nth-child(3)").css("background-color","#ffcc99")})}function insertCashValues(c){var a=generateCashOverviewOfUser(c.cashperpayments);$("#cashbyguests").html(a);var b=parseFloat(c.onlycash);$("#onlycashsum").html((b.toFixed(2)).replace(".",decpoint));$("#cashtotal").html((parseFloat(c.total).toFixed(2)).replace(".",decpoint));$(".currencyplaceholder").html(currency)}function cashOperation(b){var a=$("#cashmoney").val().replace(",",".");if(isNaN(a)){alert("Keine Zahl!")}else{$("#cashdlg").dialog("close");var c=$("#cashremark").val();if(b==="out"){a=0-parseFloat(a)}doAjax("POST","php/contenthandler.php?module=bill&command=doCashAction",{money:a,remark:c},handleCashActionResult,"Fehler Kassenaktion")}}function handleCashActionResult(a){if(a.status=="ERROR"){alert("Fehler "+a.code+": "+a.msg)}else{if(a.status=="OK"){alert(P_CASHACTION_OK[lang])}}}function bindHostButton(a){if(showhostprint==1){$("#hostbutton").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();if(showHostTemplate){showHostTemplate=false}else{showHostTemplate=true}if(a!=null){$(a).removeClass("ui-icon-check");$(a).removeClass("ui-icon-delete");if(showHostTemplate){$(a).addClass("ui-icon-check")}else{$(a).addClass("ui-icon-delete")}}var b=$("#info-page").data("billlanguage");if(b==0){createAllEntriesInReceipt()}else{if(lang==0){alert("Bewirtungsbeleg steht nur für deutsche Kassenbons zur Verfügung.")}else{if(lang==1){alert("Bewirtungsbeleg is only possible for German receipts.")}else{if(lang==2){alert("Bewirtungsbeleg se puedo usar solo para tiques alemanes.")}}}}})}}function printBill(a){doAjax("POST","php/contenthandler.php?module=printqueue&command=queueReceiptPrintJob",{billid:a,useaddrecprinter:1},null,"Druckfehler")}function generateGuestResult(g,b,a){$("#hotelroomfoundguest").html("");g=g.trim().toLowerCase();if(g==""){$("#hotelroomselection").html("");if(b){$("#hotelroomselection").selectmenu("refresh")}return}var f="";var c=false;var i=0;var h="";var e=guests;if(a==PAYMENT_GUEST){e=internalguests}$.each(e,function(n,o){var k=o.object;var p=o.guest;var l=(k.toLowerCase().indexOf(g)>=0);var m=(p.toLowerCase().indexOf(g)>=0);if(l||m){i++;h=toHtml(k+" - "+p);if(!c){c=true;f+='<option value="'+n+'" selected>'+toHtml(k+" - "+p)+"</option>"}else{f+='<option value="'+n+'" >'+toHtml(k+" - "+p)+"</option>"}}});if(i===1){$("#hotelroomfoundguest").html(h);$("#hotelroomselection").html(f)}else{$("#hotelroomselection").html(f)}if(b){$("#hotelroomselection").selectmenu("refresh")}}function generateCashOverviewOfUser(e){var a="";for(var b=0;b<e.length;b++){var c=e[b];a+=c.payment+": <b>"+(parseFloat(c.value).toFixed(2)).replace(".",decpoint)+"</b> "+currency+"<br>"}return a}function fillProdByPrintJobsList(g){prodsByPrintjob=[];var a=g.length;for(var b=0;b<a;b++){var f=g[b];var c=f.printjobid;if(c!=0){if(!(c in prodsByPrintjob)){prodsByPrintjob[c]=[f]}else{var e=prodsByPrintjob[c];e[e.length]=f}}}}; </script>
</head>
<style>
</style>
<body>
<div class="tableospage">
<span class="header">Kellneransicht (<span id="panelmodetxt">Bestellung</span>) <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /> <img src="img/tasksstatus.png" class="tasksstatus" style="display:none;" /></span>
</div>
<?php
if (file_exists("customer/mywaiterdesktop.txt")) {
readfile("customer/mywaiterdesktop.txt");
} else {
readfile("waiterdesktopdefault.txt");
}
?>
<div class="tablefooter">
<span id="loggedinuser"></span>
<span id="versioninfo"></span>
</div>
</div>
<div id="selectiondialog" title="Auswahl">Extras to select...</div>
<div id="hoteldialog" title="Auswahl" style='display:none;'>
<h3><span id="hotelroomtitle">Hotelzimmer / Gast wählen</span></h3>
<p>
<form>
<div id='hotelroomfoundguest'></div><br>
<div id='roomselectionarea'><select id='hotelroomselection' class='guestselectionlist'></select><br></div>
<input id='roomguesttextfield' type="text" placeholder='Zimmer oder Gast' class='input100 inputwhite' /><br><br>
<input id='paym_hotel' type='submit' value='Auf Zimmer schreiben' class='guestselectionbutton'/>
</form>
</div>
<div id="unsentorderdlg" title="Achtung">
Die Bestellung würde noch nicht abgeschlossen. Wollen Sie die Bestellung verwerfen?
</div>
<div id="mainmenudlg" title="Hauptmenü">Hauptmenü</div>
<div id="actmenudlg" title="Aktion auswählen">
<header id="actprodinfo"><span id=actcountno>3x</span> <span id="actname">Warsteiner</span> (<span id="actpriceinfo">(1,00 Euro)</span>)</header>
<div id="actcounttogo">
<div id="actminusbtn" class="actbtn">-1</div>
<div id="actplusbtn" class="actbtn">+1</div>
<div id="acttogobtn" class="actbtn"><img id="togoicon" src="img/ok.png" style="display:none;"/><img id="notogoicon" src="img/notavailable.png" style="display:none;"/> &nbsp; To-Go</div>
</div>
<div id="actnumberarea">
<div class="actlabel">Anzahl:&nbsp;</div>
<div>
<input id="actnumberentryfield" class="input100 inputwhite" type="number" placeholder="Anzahl" />
</div>
</div>
<div id="actremark">
<div class="actlabel">Bemerkung:&nbsp;</div>
<div>
<input id="actremarkfield" class="input100 inputwhite" type="text" placeholder="Notiz" />
</div>
</div>
<div id="actdiscount">
<div id="actdiscount1btn" class="actbtn">-1</div>
<div id="actdiscount2btn" class="actbtn">-1</div>
<div id="actdiscount3btn" class="actbtn">-1</div>
</div>
<div id="actprice">
<div>Neuer Preis:&nbsp;</div>
<div>
<input id="actpricefield" class="input100 inputwhite" type="text" placeholder="Neuer Preis" />
</div>
</div>
</div>
<div id="ordereditemdlg" title="Aktion">
<div id="ordereditem-info"></div>
<div id="orderedcancelpanel">
<input id="cancelcode" class="input100 inputwhite" type="password" placeholder="Stornierungscode" />
</div>
<div id="ordereditemremove" class="actbtn">Entfernen</div>
<div id="ordereditemreorder" class="actbtn">Nachbestellen</div>
<div id="ordereditemcancel" class="actbtn">Abbrechen</div>
<div id="deleteallordereditems" class="actbtnlarge">ALLE entfernen</div>
</div>
<div id="moveItemdslg" title="Auswahl der Orderelemente">
<div>Welche Orderelemente sollen dem neuen Tisch zugewiesen werden?</div>
<div id="selectallnothing">
<input id="selectallnothing_txt" class="input100 inputblue" type="submit" />
</div>
<ul id="productsToMoveList" class="extraschoice"></ul>
</div>
<div id="cashdlg" title="Ein-/Auslage" style="display:none;">
<h3><span id="cashoverviewtxt">Übersicht Kellnerkasse</span></h3>
<p><span id="overviewdetails">Diese Übersicht enthält die Bewirtungseinnahme durch den Kellner seit der letzten Tageslosung sowie
als weiteren Wert den Kassenstand unter Berücksichtigung der eigenen Eingaben und Entnahmen.</span><p>
<p><br><i><span id="cashsum">Bewirtungseinnahmen:</span></i>
<div style="padding-left: 50px;padding-right: 50px;">
<span id=cashbyguests></span></p>
</div>
<div>
<br><i>Barein-/auslagen:</i> <b><span id=onlycashsum></span></b> <span class="currencyplaceholder"></span><p>
<br><i><span id="includeowncash">inkl. eigener Kassenein-/Auslagen:</span></i> <b><span id=cashtotal></span></b> <span class="currencyplaceholder"></span><p>
</div><br>
<p><div>
<input id="cashmoney" class="input100 inputblue" type="text" placeholder="0,00"/>
</div>
<div>
<input id="cashremark" class="input100 inputblue" type="text" placeholder="Bemerkung"/>
</div>
</div>
<div id="gencommentsdlg" title="Vordefinierte Kommentare" style="display:none;">
<input id="generalcommentfield" class="input100" placeholder="Kommentar" />
<ul id="commentschoice" class="extraschoice"></ul>
</div>
<div id="enterpricedlg" title="Benutzereingabe" style="display:none;">
<span id="entervalueunit">Eingabe...</span>
<input id="enterpricefield" class="input100" /><br><br>
<table class=numfield id="numfield_num">
<tr><td>7<td>8<td>9</tr>
<tr><td>4<td>5<td>6</tr>
<tr><td>1<td>2<td>3</tr>
<tr><td>0<td colspan="2">,</tr>
<tr><td colspan="3" class="keyboardapply">Anwenden</tr>
</table>
</div>
<div id="recordsdlg" title="Tischprotokoll" style="display:none;">
</div>
</body>
</html>