ordersprinter/webapp/waiterdesktop.php

200 lines
68 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={VERSION}">
<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="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="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()})}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")}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(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();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"){startProductDisplay()}}}else{changeRoom(a);goPayDesk()}})}function discardChangeRoom(a){neworders=[];groupedNewOrders=null;showNewOrders();changeRoom(a)}function changeRoom(a){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);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(f,g){if((selectedtableindex!=null)&&(c[selectedtableindex].id==g.id)){a+='<div id="table_'+f+'" class="tableelement tableitemselected '+b+'">'}else{a+='<div id="table_'+f+'" class="tableelement tableitem '+b+'">'}a+=' <header class="tablename">'+g.name+"</header>";var h=g.pricesum;if(h!=0){var e=h.replace(".",decpoint)+" "+currency;a+='<div class="tableopen">'+e+"</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(){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"){$("#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){selectedtableindex=a;showRoomTableTextInfo();showTablesForRoomIndex()}function startProductDisplay(){selectedtypeid=null;selectedprodid=null;clearProductsSelection();requestProdInformation();requestOrderedInformation();$("#search").val("");$("#searchpanel").show();$("#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!="-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(e){var b="";if(e.option!=""){b="<p><i>"+toHtml(e.option)+"</i>"}var f="";var c=toHtml(e.longname);if(e.togo==1){f="To-Go: "}c='<div class="ordereditem-name">'+f+'<span class="ordereditem-bold">'+c+"</span></div>";if(e.pricechanged==1){c+=" - "+e.price.replace(".",decpoint)}var a="";if(e.isready=="1"){a+=" &#9758"}if(e.isCooking=="1"){a+=" &#9832"}if(e.isPaid=="1"){a+=" &#9745"}return c+'<div class="oredereditem-misc">'+b+a+createExtraParagraphForOrderedEl(e.extras)+"</div>"}function createListElOfAssignedProd(c){var b="";if("count" in c){if(c.count>1){b='<div class="ordereditem-count">'+c.count+"x </div>"}}var a="<div id='ordered_"+c.id+"' class='ordereditem-item-sent' >"+b+createTxtAssignedProd(c)+"</div>";return a}function createExtraParagraphForOrderedEl(b){if((b==null)||(b=="")){return""}var e="";var c=[];for(var a=0;a<b.length;a++){c[c.length]=toHtml(b[a]);e+="+ "+toHtml(b[a])+"<br>"}return"<p>"+c.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)})}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(e,a,f){var c=[];for(var b=0;b<a.length;b++){c[c.length]={id:a[b],name:f[b]}}$("#ordereditemdlg").dialog("close");addProductToNewOrders(e,"",c,"NO",0)}function requestProdInformation(){doAjax("GET","php/contenthandler.php?module=products&command=getAllTypesAndAvailProds",null,insertProductInformation,true)}function insertProductInformation(a){productInformation=a;updateProductInfoDisplay()}function updateProductInfoDisplay(){showAllTypesToChoose();showAllProdsToChoose();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(e,f){a+='<div id="prod_'+f.id+'" class="productitem '+b+'">'+f.name;if((f.amount!="null")&&(f.amount<11)){a+="<span class='warning'> ("+W_ONLY[lang]+" "+f.amount+")</span>"}a+="</div>"})}$("#productspanel").html(a);bindProduct();bindRemark()}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()})}function bindProduct(){$(".productitem").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();$("#search").val("");selectedprodid=parseInt(this.id.split("_")[1]);var c=$("#remark").val();var a=getProdEntry(selectedprodid);var b=a.extras;if((b!=null)&&(b.length>0)){showExtras(a,c)}else{addProductToNewOrders(selectedprodid,c,null,"NO",0)}})}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}}else{return"FEHLER!"}}function addProductToNewOrders(f,i,g,c,e){$("#remark").val("");var b=getProdProperties(f);var a=b.name;var h=b.price;var k={name:a,option:i,extras:g,prodid:f,price:h,changedPrice:c,togo:e};neworders[neworders.length]={name:k.name,option:k.option,extras:k.extras,prodid:k.prodid,price:k.price,changedPrice:k.changedPrice,togo:k.togo};showNewOrders();$("#remark").val("")}function group(h){var y=[];var e=[];var A=[];var t=[];var o=[];var g=[];var w=[];var x=[];var a=[];var m=[];var z={count:y,joinedvals:e,name:A,price:t,option:o,extras:g,prodids:w,origidxs:x,changedPrices:a,togos:m};var v=0;for(v=0;v<h.length;v++){var s=h[v];var A=s.name;var t=s.price;var o=s.option;var q=s.prodid;var f=s.changedPrice;var l=s.togo;var c=s.extras;var b="";var p=[];if(c!=null){for(var u=0;u<c.length;u++){p[p.length]="+"+toHtml(c[u].name)}}if(p.length>0){b+="<p>"+p.join("<br>")}else{b=""}var r=A+"-"+o+"-"+b;if(f!="NO"){r=A+"-"+o+"-"+b+f}if(l==1){r+=" - To-Go"}var k=z.joinedvals.indexOf(r);if(k>=0){z.count[k]=z.count[k]+1;idxarr=z.origidxs[k];idxarr[idxarr.length]=v;z.origidxs[k]=idxarr}else{var n=z.count.length;z.count[n]=1;z.joinedvals[n]=r;z.name[n]=A;z.price[n]=t;z.option[n]=o;z.extras[n]=b;z.prodids[n]=q;z.changedPrices[n]=f;z.togos[n]=l;z.origidxs[n]=[v]}}return z}function showNewOrders(){groupedNewOrders=group(neworders);var h="";var n=groupedNewOrders.count.length;for(var g=n-1;g>=0;g--){var m=toHtml(groupedNewOrders.name[g]);var l=groupedNewOrders.option[g];var k=groupedNewOrders.count[g];if(k>1){m="<span style='font-size: 23px;'>"+k.toString()+"x</span> "+m}var f=groupedNewOrders.prodids[g];if(l!=""){l="<p>"+toHtml(l)+"</p>"}var c=groupedNewOrders.changedPrices[g];var b=groupedNewOrders.togos[g];var o="";var e=groupedNewOrders.extras[g];if((e!=null)&&(e!="")){o="<span style='font-size: 14px;'><i>"+e+"</i></span>"}var a="";if(c!="NO"){if(b!=0){a="<br> ("+c.replace(".",decpoint)+" "+currency+" - To-Go)"}else{a="<br> ("+c.replace(".",decpoint)+" "+currency+")"}}else{if(b!=0){a="<br> (To-Go)"}}h+='<div id="neworder_'+f+"_"+g+'" class="ordereditem-item-new">'+m+l+o+a+"</div>"}$("#neworders").html(h);$("#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 decpoint=".";var currency="";var rightchangeprice=0;var rightpaydesk=false;var restaurantmode=1;var supplyright=0;var prominentsearch=0;var discount1=50;var discount2=20;var discount3=10;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 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."];$(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();intervalGetPrinterStatus(5);intervalGetGeneralCommentsAndTablePref(10);intervalGetWaiterMessage(20);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 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;decpoint=b.decpoint;currency=b.currency;rightchangeprice=c.rightchangeprice;supplyright=c.supplyright;prominentsearch=b.prominentsearch;waitergopayprint=b.waitergopayprint;discount1=b.discount1;discount2=b.discount2;discount3=b.discount3;cashenabled=b.cashenabled;rightpaydesk=c.rightpaydesk;restaurantmode=b.restaurantmode;returntoorder=b.returntoorder;if((b.cancelunpaidcode!=null)&&(b.cancelunpaidcode!="")){cancelunpaidcode=b.cancelunpaidcode}else{cancelunpaidcode=""}osroombtnsize=c.buttonsizes.roombtnsize;ostablebtnsize=c.buttonsizes.tablebtnsize;osprodbtnsize=c.buttonsizes.prodbtnsize;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)})})}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();$("#productspanel").show();$("#remarkpanel").show();$("#ordered").show();$("oben").html("");$("#oben").hide();$("#unten").html("");$("#unten").hide();$("#receiptpanel").hide();$("#paybuttonpanel").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();if(panelMode==="waiter"){if((rightpaydesk==1)&&(cashenabled==1)){$("#paydeskbtn").show()}$("#hostbutton").hide();$("#cashbutton").hide();$("#paydeskcash").hide();$("#paydeskprint").hide();$("#goorderbtn").hide();if(neworders.length>0){if((workflowconfig==WORKFLOW_DIGI_AND_WORK)||(workflowconfig==WORKFLOW_WORK)||(workflowconfig==WORKFLOW_WORK_TRANSFER)){$("#workbtn").show()}if((workflowconfig==WORKFLOW_DIGI_AND_WORK)||(workflowconfig==WORKFLOW_DIGI)||(workflowconfig==WORKFLOW_WORK_TRANSFER)){$("#sendNewOrders").show()}}if((selectedtableindex!=null)&&(neworders.length==0)){$("#changetablebtn").show()}}else{$("#paydeskbtn").hide();if(restaurantmode==1){$("#hostbutton").show()}$("#cashbutton").show();if(prodsaccounted.length>0){$("#paydeskcash").show();$("#paydeskprint").show();$("#goorderbtn").show()}$("#workbtn").hide();$("#sendNewOrders").hide()}}var e_extras=[];var e_extras_selection=[];var e_prod=null;var e_option=null;function showExtras(a,c){e_prod=a;e_option=c;e_extras=a.extras;e_extras_selection=[];for(var b=0;b<e_extras.length;b++){e_extras_selection[b]=false}$("#selectiondialog").dialog({autoOpen:false,modal:true,height:400,buttons:{Anwenden:function(){$(this).dialog("close");applyExtras()}}});displayExtras();$("#selectiondialog").dialog("open")}function displayExtras(){var a="<div><ul class='extraschoice'>";for(var e=0;e<e_extras.length;e++){var f=e_extras[e];var b=f.extraid;var c=f.name;if(e_extras_selection[e]){a+="<li id='extra_"+b+"_"+e+"' class='extraitemselected' >"+toHtml(c)+"</li>"}else{a+="<li id='extra_"+b+"_"+e+"' class='extraitem' >"+toHtml(c)+"</li>"}}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("_")[2]))});$(".extraitemselected").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();extraClicked(parseInt(this.id.split("_")[2]))})}function extraClicked(a){if(e_extras_selection[a]){e_extras_selection[a]=false}else{e_extras_selection[a]=true}displayExtras()}function applyExtras(){var b=[];for(var e=0;e<e_extras.length;e++){var f=e_extras[e];var a=f.extraid;var c=f.name;if(e_extras_selection[e]){b[b.length]={id:a,name:c}}}addProductToNewOrders(e_prod.id,e_option,b,"NO",0)}var actcount=0;var actprice=0;var actname="";var selectedEntry=null;var actchangedprice=false;var actoption="";var acttogo=0;var origprice=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]};acttogo=groupedNewOrders.togos[b];actcount=groupedNewOrders.count[b];actname=groupedNewOrders.name[b];actchangedprice=groupedNewOrders.changedPrices[b];actoption=groupedNewOrders.option[b];origprice=groupedNewOrders.price[b];if(actchangedprice==="NO"){actprice=origprice}else{actprice=actchangedprice}insertDataIntoActDialog();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");$("#actpricefield").val("")})}function insertDataIntoActDialog(){$("#actdiscount1btn").html(discount1+"%");$("#actdiscount2btn").html(discount2+"%");$("#actdiscount3btn").html(discount3+"%");$("#actcountno").html(actcount+"x");$("#actname").html(actname);var a=actprice.replace(".",decpoint);$("#actpriceinfo").html(a+" "+currency);$("#actremarkfield").val(actoption);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(){$(".actbtn").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();var b=this.id;if(b==="actminusbtn"){if(actcount>0){actcount--}}else{if(b==="actplusbtn"){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()})}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{actprice=g;$("#actpricefield").val("")}}}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 p=a[m];neworders[p].option=$("#actremarkfield").val();neworders[p].changedPrice=g;neworders[p].togo=acttogo}}$("#actremarkfield").val("");var s=c.count;var b=actcount;var o=b-s;if(o<0){var f=0-o;var a=c.origidxs;var m=0;for(m=0;m<f;m++){var r=a.pop();neworders.splice(r,1)}}if(o>0){var a=c.origidxs;var q=a[0];var l=neworders[q].prodid;var g=neworders[q].changedPrice;var e=neworders[q].togo;var n=neworders[q].option;var k=neworders[q].extras;for(m=0;m<o;m++){addProductToNewOrders(l,n,k,g,e)}}showNewOrders()}var taxtype="normal";var prodsToPayList=[];var prodsToPayListGrouping=[];var prodsOnReceiptList=[];var prodsOnReceiptListGrouping=[];var prodsaccounted=[];var doPrint=false;function startCashProcess(){prodsaccounted=[];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}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;if((a.msg.length==0)&&(returntoorder==1)){unZoomTableMap();goOrderDesk()}else{displayProdsToPayForTable();displayProdsOnReceipt()}}function displayProdsToPayForTable(){bindHostButton("#hostbutton");bindCashButton();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()});$("#paydeskcash").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();doPrint=false;displayPayments()});$("#paydeskprint").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();doPrint=true;displayPayments()})}function displayPayments(){var c="";var a=20;if(paymentconfig==1){a=2}var b=false;$.each(payments,function(g,f){if(g<a){c+='<div id="paym_'+f.id+'" class="paymentitem" >'+f.name+"</div>";if(!b){c+="<br><hr><br>";b=true}}});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 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).addClass("payallaccounted")}else{$("#"+c).removeClass("paystillopen");$("#"+c).removeClass("payallaccounted");$("#"+c).addClass("paystillopen")}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 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 createHashOfPayableItem(b){var a=b.longname;if(b.pricelevelname!="A"){a+=" ("+b.pricelevelname+")"}a+=" - "+(parseFloat(b.price).toFixed(2).replace(".",decpoint));if(b.togo==1){a="To-Go: "+a}var c=createExtraParagraphForOrderedEl(b.extras);return toHtml(a)+c}function createPayableItemListElement(g){var f="";var c=1;if("count" in g){if(g.count>1){f=g.count+"x ";c=g.count}}var b=false;var a=getProdAccountedEntry(g);var h="";if(a!==null){if(a.count!=0){h=a.count}if(a.count==c){b=true}}var e="";if(b){e='<div id="payable_'+g.id+'" class="payitem payable payallaccounted"><div class=\'payitemmain\'>'+f+createHashOfPayableItem(g)+"</div><div class='payitemaccounted'>"+h+"</div></div>"}else{e='<div id="payable_'+g.id+'" class="payitem payable paystillopen"><div class=\'payitemmain\'>'+f+createHashOfPayableItem(g)+"</div><div class='payitemaccounted'>"+h+"</div></div>"}return e}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(t,o,r,l){var n=getTableName();var f=0;if(selectedroomindex!=-1){if(selectedtableindex!=null){var k=roominfo.roomstables[selectedroomindex].tables[selectedtableindex];f=k.id}else{f=0}}var h=$("#info-page").data("usst");if($("#info-page").data("taxtype")=="togo"){h=$("#info-page").data("togotax")}checkForLogIn();var e=[];var s=prodsOnReceiptList;var q=prodsaccounted;var p=prodsOnReceiptListGrouping;for(var m=0;m<prodsaccounted.length;m++){var u=prodsaccounted[m];if(u.count!=0){$.merge(e,getQueueIdsDueToCountOfItem(u))}}e=e.join();var g=1;if(workflowconfig==1){g=digigopaysetready}$.ajax({type:"POST",dataType:"json",data:{ids:e,tableid:f,paymentid:t,declareready:g,host:(showHostTemplate?1:0),reservationid:o,guestinfo:r,intguestid:l},url:"php/contenthandler.php?module=queue&command=declarePaidCreateBillReturnBillId",async:false,success:function(i){showHostTemplate=false;var b=i.status;var c=i.msg;if(b!="ERROR"){billid=c.billid;billdate=c.date;if(billid<0){alert("Error! Bitte erneut versuchen. Error code: "+billid);window.location.reload(false)}else{requestRoomInformation();var w=$("#info-page").data("billlanguage");$("#billid").html(P_ID[w]+billid);$("#billdate").html(billdate);if(doPrint){var a=$("#info-page").data("payPrintType");if(a=="s"){printBill(billid)}else{$("#oben").hide();var v="<table>"+$(".receipttable").html()+"</table>";printContent(v)}}startCashProcess()}}else{alert("Fehler: "+c)}},error:function(a){alert("Sorry, there was a problem! "+a)}})}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_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 enthält die Bar-Bewirtungseinnahme durch den Kellner seit der letzten Tageslosung sowie als weiteren Wert den Kassenstand unter Berücksichtigung der eigenen Eingaben und Entnahmen.","This overview contains the cash 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 al contado por cobro para el camarero, y también el dinero incluido con acciones de insertar y sacar."];var P_CASH_SUM=["Bewirtungseinnahmen:","Cash by payment:","Cobro:"];var P_INCLUDE_OWN=["inkl. eigener Kassen-Eingaben/Entnahmen:","incl. own cash insert/take-outs:","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 showHostTemplate=false;var guests=[];var internalguests=[];var hotelinterface=0;var PAYMENT_HS3=7;var PAYMENT_GUEST=8;var currentPaymentId=7;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;$("#curtopay2").html(" "+a.currency);workflowconfig=a.workflowconfig;digigopaysetready=a.digigopaysetready;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,n,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(".",n);if(a!="A"){g+=" ("+a+")"}if(f==1){g="To-Go: "+g}var m=k*i;var l="<tr>";var e='style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;width: 60%;"';l+="<td "+h+' id="count">'+k+"<td colspan=3 "+e+">"+g;l=l+"<td "+b+">"+c;l+="<td "+b+">"+m.toFixed(2).replace(".",n)+"</tr>";return l}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:470,width:500,buttons:{Abbrechen:function(){$(this).dialog("close")},Einlegen:function(){cashOperation("in")},Entnehmen:function(){cashOperation("out")}}});$("#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(a){$("#cashbyguests").html((parseFloat(a.guestmoney).toFixed(2)).replace(".",decpoint));$("#cashtotal").html((parseFloat(a.total).toFixed(2)).replace(".",decpoint))}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){$("#hostbutton").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();if(showHostTemplate){showHostTemplate=false}else{showHostTemplate=true}if(a!=null){$(a).removeClass("btnswitchon");$(a).removeClass("btnswitchoff");if(showHostTemplate){$(a).addClass("btnswitchon")}else{$(a).addClass("btnswitchoff")}}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")}}; </script>
</head>
<style>
</style>
<body>
<div class="ospage">
<header class="header">Kellneransicht (<span id="panelmodetxt">Bestellung</span>) <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></header>
<aside class="aside aside1" id="tablepanel">
<div class="tablepanel" >
<header id="location" class="tablepanelheader">Raum: Raum xyz</header>
<div id="roompanel" class="roompanel"></div>
<div id="tablepanelcontent" class="tablepanelcontent"></div>
<div id=tablemapcontent style="position: relative;width:100%;display:none;">
<img id="mapimgpart" style="width:100%;position: relative;left: 0;top: 0;" src=img/empty-room.png />
<div id=tableoverlay></div>
</div>
<div id="receiptpanel" style="display:none;"></div>
</div>
</aside>
<article class="main">
<div id="groupchain" class="grouppanel"></div>
<div id="groupchoice" class="grouppanel"></div>
<div id="paybuttonpanel" style="display:none;">
<input id="payall" class="input50 inputwhite" type="submit" value="Alles" />
<div class="infoarea"><span id="priceinreceipt"></span></div>
</div>
<div id="oben" class="paypanel" style="display:none;"></div>
<hr>
<div id="unten" class="paypanel" style="display:none;"></div>
<!-- a hack: info-page is for compatibility to mobile view at which data is stored -->
<div id="info-page" style='display:none;'></div>
<div id="searchpanel" style="display:none;"><input id="search" class="input100 inputwhite" type="text" placeholder="Suchen..." /></div>
<div id="productspanel" class="productspanel" style="display:none;"></div>
<div id="remarkpanel" style="display:none;">
<input id="remark" class="input100 inputwhite" type="text" placeholder="Produktbemerkung" />
</div>
</article>
<aside class="aside aside2">
<div class="buttonarea">
<input id="mainmenubtn" class="input100 inputwhite"type="submit" value="Hauptmenü" />
<input id="paydeskbtn" class="input100 inputwhite"type="submit" value="Kasse" style="display:none;"/><br>
<input id="goorderbtn" class="input100 inputwhite"type="submit" value="Bestellung" style="display:none;"/>
<input id="cashbutton" class="input100 inputwhite"type="submit" style="display:none;" value="Ein-/Auslage" />
<input id="hostbutton" class="input100 inputwhite btnswitchoff"type="submit" style="display:none;" value="Bewirtungsbeleg" />
<input id="paydeskcash" class="input100 inputwhite"type="submit" style="display:none;" value="Zahlung" />
<input id="paydeskprint" class="input100 inputwhite"type="submit" style="display:none;" value="Bondruck" />
<input id="workbtn" class="input100 inputwhite" type="submit" value="Arbeitsbon" style="display:none;" />
<input id="sendNewOrders" class="input100 inputwhite" type="submit" value="Bestellung abschließen" style="display:none;" />
<input id="changetablebtn" class="input100 inputwhite" type="submit" value="Tischwechsel" style="display:none;" />
</div>
<div id="neworders" class="ordereditem-container"></div>
</aside>
<div id="ordered" class="ordereditem-sentcontainer"></div>
<div id="waitermessagearea" class="waitermsg">Waiter Message</div>
<footer class="footer">
<div id="loggedinuser" style="color:white;"></div>
<div id="versioninfo"></div>
</footer>
</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="actremark">
<div>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><i><span id="cashsum">Bewirtungseinnahmen:</span></i> <b><span id=cashbyguests></span></b></p>
<p><i><span id="includeowncash">inkl. eigener Kassen-Eingaben/Entnahmen:</span></i> <b><span id=cashtotal></span></b><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>
</body>
</html>