223 lines
69 KiB
HTML
223 lines
69 KiB
HTML
<html>
|
|
<head>
|
|
<title>Ansicht Kasse</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=2.0.11">
|
|
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
|
|
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
|
|
|
<link rel="stylesheet" href="php/3rdparty/jquery.mobile-1.4.0.min.css" type="text/css" />
|
|
<script src="php/3rdparty/jquery-2.0.3.min.js"></script>
|
|
<script src="php/3rdparty/jquery.mobile-1.4.0.min.js"></script>
|
|
<script src="utilities.js?v=2.0.11"></script>
|
|
<script src="receiptutils.js?v=2.0.11"></script>
|
|
|
|
<script>
|
|
var CALC_NONE=0;var CALC_TOTAL=1;var CALC_TIP=2;var lang=0;var receiptfontsize=12;var paymentconfig=0;var decpoint=".";var currency="";var osroombtnsize=0;var ostablebtnsize=0;var osprodbtnsize=0;var preferimgmobile=0;var hasRooms=true;var cameFromOrdering=0;var billbrutto=0;var billnetto=0;var prodsToPayList=[];var prodsToPayListGrouping=[];var payTable="";var prodsOnReceiptList=[];var prodsOnReceiptListGrouping=[];var calcmodus=CALC_TOTAL;var workflowconfig=0;var digigopaysetready=1;var onlyReceiptShown=0;var prodsToPayList=null;var restaurantmode=1;var sumupforcard=0;var affiliatekey="";var appid="";var serverurl="";function initializeMainMenu(a){$.ajax({type:"GET",dataType:"json",url:"php/contenthandler.php?module=admin&command=getJsonMenuItemsAndVersion",async:false,success:function(c){$("#versioninfo").html(c.version+" ");if(c.loggedin==1){$("#loggedinuser").html(" "+c.user);var b='<li data-role="list-divider" data-theme="b" data-role="heading">Hauptmenü</li>';$.each(c.menu,function(g,f){var e=f.name;var h=f.link;if((e!="Abmelden")&&(e!="Log out")&&(e!="Adios")){b+='<li data-theme="e"><a href="'+h+'" target="_top" class="modulebutton">'+e+"</a></li>"}else{b+='<li data-theme="e"><a href="'+h+'" target="_top">'+e+"</a></li>"}});$(a).empty().append(b).promise().done(function(){$(a).listview("refresh")});$("#menuswitch").show()}else{$("#menuswitch").hide()}},error:function(b){alert("Kommunikationsproblem zum Server bei Modulabfrage!")}});$(".modulebutton").off("click").on("click",function(c){var b=$(this).attr("href");doAjax("POST","php/contenthandler.php?module=admin&command=setLastModuleOfUser",{view:b},null,"Problem Benutzerdatenpflege")});intervalGetPrinterStatus(5);intervalCheckConnection(2)}function intervalGetPrinterStatus(b){doAjax("GET","php/contenthandler.php?module=admin&command=isPrinterServerActive",null,setPrinterStatus,null,true);var a=setInterval(function(){doAjax("GET","php/contenthandler.php?module=admin&command=isPrinterServerActive",null,setPrinterStatus,null,true)},b*1000)}function setPrinterStatus(a){if(a.status==="OK"){if(a.msg===0){$(".printerstatus").show()}else{$(".printerstatus").hide()}if(a.tasksforme===1){$(".tasksstatus").show()}else{$(".tasksstatus").hide()}if(a.tsestatus===1){$(".tsestatus").hide()}else{$(".tsestatus").show()}return}$(".printerstatus").hide()}function hideMenu(){$("#modulepanel").panel("close");$("#menuswitch").off("click").on("click",function(a){$("#menuswitch").trigger("mouseout");a.stopImmediatePropagation();a.preventDefault();$("#modulepanel").panel("open")})}function refreshList(a){if($(a).hasClass("ui-listview")){$(a).listview("refresh")}else{$(a).trigger("create")}}function doAjax(a,b,f,e,c,g){if(typeof g==="undefined"){g=false}$.ajax({type:a,url:b,dataType:"json",data:f,async:g,success:function(h){if(e!=null){e(h)}},error:function(m,h,i){if(b!="php/debug.php"){var k={cmd:b,fct:e.name,xhr:m.responseText,errormsg:c,status:h};var o=getMillis();if(c!=null){if($(".connectionstatus").is(":visible")){alert("Kommunikation zum Server ist unterbrochen!")}else{var l=c+i+" ("+b+")";alert("Kommunikationsfehler zum Server: "+l+" - In der Feedbackansicht lässt sich ein Fehlerprotokoll an den Anbieter übermitteln.");doAjax("POST","php/debug.php?n="+o,k,null,true)}}}}})}function doAjaxAsync(a,b,e,c){$.ajax({type:a,url:b,dataType:"json",data:e,async:true,success:function(f){if(c!=null){c(f)}},error:function(k,f,g){if(b!="php/debug.php"){var h={cmd:b,fct:c.name,xhr:k.responseText,errormsg:errorMsg,status:f};var l=getMillis();if(errorMsg!=null){if($(".connectionstatus").is(":visible")){alert("Kommunikation zum Server ist unterbrochen!")}else{var i=errorMsg+g+" ("+b+")";alert("Kommunikationsfehler zum Server: "+i+" - In der Feedbackansicht lässt sich ein Fehlerprotokoll an den Anbieter übermitteln.");doAjax("POST","php/debug.php?n="+l,h,null,true)}}}}})}function doAjaxTransmitData(a,b,g,f,e,c){$.ajax({type:a,url:b,dataType:"json",data:g,async:false,success:function(h){if(f!=null){f(h,c)}},error:function(l,h,i){if(e!=null){var k=e+", Status: "+h+", Error:"+i+", Msg: "+l.responseText+" ("+b+")";alert("Kommunikationsfehler zum Server: "+k+" - In der Feedbackansicht lässt sich ein Fehlerprotokoll an den Anbieter übermitteln.")}}})}function doAjaxSuppressError(a,b,f,e,c){$.ajax({type:a,url:b,dataType:"json",data:f,async:false,success:function(g){if(e!=null){e(g)}},error:function(g){e("ERROR")}})}function doAjaxNonJsonNonCall(a,b,c){$.ajax({type:a,data:c,url:b,async:false,error:function(e){alert("Kommunikationsproblem zum Server")}})}function toHtml(a){if(typeof a==="string"){return(a.replace(/"/g,""").replace(/</g,"<").replace(/>/g,">"))}else{return a}}function createExtraParagraph(b,e){if((b==null)||(b=="")){return""}var c="";for(var a=0;a<b.length;a++){if(e==0){c+="<p>+ "+toHtml(b[a])+"</p>"}else{c+="<p style='font-size:"+e+"px;'>+ "+toHtml(b[a])+"</p>"}}return c}function checkForLogIn(){doAjax("GET","php/contenthandler.php?module=admin&command=isUserAlreadyLoggedIn",null,handleTestForLoggedIn,null)}function handleTestForLoggedIn(a){if(a!="YES"){setTimeout(function(){document.location.href="index.html"},250)}}function isInt(a){if(Math.floor(a)==a&&$.isNumeric(a)){return true}else{return false}}function isFloat(a){return Number(a)===a&&a%1!==0}function roundtodigits(c,b){c=parseFloat(c);if(!c){return 0}var a=Math.pow(10,b);return Math.round(c*a)/a}function getMillis(){var a=new Date();var b=a.getTime();return b}function intervalCheckConnection(b){checkConnection();var a=setInterval(function(){checkConnection()},b*1000)}function checkConnection(){var a=new Image();a.onerror=function(){$(".connectionstatus").show()};a.onload=function(){$(".connectionstatus").hide()};a.src="img/gray.png?t="+(+new Date)}function createLabelWithTextField(c,a,b){var e='<div class="ui-field-contain">';e+='<label for="'+c+'">'+a+"</label>";e+='<input type="text" id="'+c+'" value="" data-mini="true" placeholder="'+b+'" style="background-color:white;color:black;" />';e+="</div>";return e}function createLabelWithTextFieldWithContent(e,a,b,c){var f='<div class="ui-field-contain">';f+='<label for="'+e+'">'+a+"</label>";f+='<input type="text" id="'+e+'" value="'+toHtml(c)+'" data-mini="true" placeholder="'+b+'" style="background-color:white;color:black;" />';f+="</div>";return f}function createLabelWithTextFieldWithValue(c,a,b){var e='<div class="ui-field-contain">';e+='<label for="'+c+'">'+a+"</label>";e+='<input type="text" id="'+c+'" data-mini="true" value="'+b+'" style="background-color:white;color:black;" />';e+="</div>";return e}function createLabelWithTextArea(b,a){var c='<div class="ui-field-contain">';c+='<label for="'+b+'">'+a+"</label>";c+='<textarea id="'+b+'" name="'+b+'" cols="40" rows="8" style="background-color:white;color:black;"></textarea>';c+="</div>";return c}function createLabelWithTextAreaWithValue(c,a,b){var e='<div class="ui-field-contain">';e+='<label for="'+c+'">'+a+"</label>";e+='<textarea id="'+c+'" name="'+c+'" cols="40" rows="8" style="background-color:white;color:black;">';e+=b;e+="</textarea>";e+="</div>";return e}function createLabelWithOption(h,a,e,k,b,c){var m=a;if((h!="")||(e!="")){m=h+e+"_"+a}var l='<div class="ui-field-contain">';l+='<label for="'+m+'">'+k+"</label>";l+='<select name="'+m+'" id="'+m+'" data-theme="f">';for(var g=0;g<b.length;g++){var f=b[g];if(f.id==c){l+='<option value="'+f.id+'" selected>'+f.text+"</option>"}else{l+='<option value="'+f.id+'" >'+f.text+"</option>"}}l+="</select></div>";return l}function pad(a,b){var c="000000000"+a;return c.substr(c.length-b)}function getUrlGetParameter(b,c){var f="";var h=b.split(/&|\?/);for(var a=0;a<h.length;a++){var g=h[a];if(g.indexOf(c)==0){var e=g.split("=");f=e[1]}}return f}var g_units_arr=[{text:"Stück",value:0,id:"piece",longtext:"Stück"},{text:"Eingabe",value:1,id:"input",longtext:"Preiseingabe"},{text:"kg",value:2,id:"kg",longtext:"Gewicht (kg)"},{text:"gr",value:3,id:"gr",longtext:"Gewicht (gr)"},{text:"mg",value:4,id:"mg",longtext:"Gewicht (mg)"},{text:"l",value:5,id:"l",longtext:"Volumen (l)"},{text:"ml",value:6,id:"ml",longtext:"Volumen (ml)"},{text:"m",value:7,id:"m",longtext:"Länge (m)"},{text:"EinzweckgutscheinKauf",value:8,id:"EG",longtext:"EinzweckgutscheinKauf"},{text:"EinzweckgutscheinEinl",value:9,id:"MG",longtext:"EinzweckgutscheinEinl"}];var taxesDefs=[{key:1,value:null,name:"Allgemeiner Steuersatz (§ 12 Abs. 1 UStG)"},{key:2,value:null,name:"Ermäßigter Steuersatz (§ 12 Abs. 2 UStG)"},{key:5,value:0,name:"Nicht Steuerbar"},{key:11,value:19,name:"Historischer allgemeiner Steuersatz (§ 12 Abs. 1 UStG)"},{key:12,value:7,name:"Historischer ermäßigter Steuersatz (§ 12 Abs. 2 UStG)"},{key:21,value:16,name:"Historischer allgemeiner Steuersatz (§ 12 Abs. 1 UStG)"},{key:22,value:5,name:"Historischer ermäßigter Steuersatz (§ 12 Abs. 2 UStG)"}];function isSelected(a,b){if(a==b){return" selected"}else{return""}}function createPreferMobileThemePart(e,n,o,c){var h=["Active Colors","Active Colors","Active Colors"];var a=["Power Pale","Power Pale","Power Pale"];var m=["Dark Soul","Dark Soul","Dark Soul"];var f=["Stylish","Stylish","Stylish"];var k=["Blue Thunder","Blue Thunder","Blue Thunder"];var b=["Cool","Cool","Cool"];var i=["Pink Lady","Pink Lady","Pink Lady"];var p=["Green Field","Green Field","Green Field"];var g='<div class="ui-field-contain">';g+='<label for="'+n+'"><span id="'+n+'txt">'+o+"</span>:</label>";g+='<select name="'+n+'" id="'+n+'" data-theme="e">';g+='<option value="0"'+isSelected(0,e)+">"+h[c]+"</option>";g+='<option value="1"'+isSelected(1,e)+">"+a[c]+"</option>";g+='<option value="2"'+isSelected(2,e)+">"+m[c]+"</option>";g+='<option value="3"'+isSelected(3,e)+">"+f[c]+"</option>";g+='<option value="4"'+isSelected(4,e)+">"+k[c]+"</option>";g+='<option value="5"'+isSelected(5,e)+">"+b[c]+"</option>";g+='<option value="6"'+isSelected(6,e)+">"+i[c]+"</option>";g+='<option value="7"'+isSelected(7,e)+">"+p[c]+"</option>";g+='<option value="8"'+isSelected(8,e)+">Bright Energy</option>";g+="</select></div>";return g}var P_SUM=["Summe:","Sum:","Todo:"];var P_TOTAL=["Total","Total","Total"];var P_MWST=["MwSt","Tax","IVA"];var P_NETTO=["Netto","Net","Neto"];var P_BRUTTO=["Brutto","Gross","Bruto"];var P_ID=["Id:","Id:","Id:"];var P_TABLE=["Tisch:","Table:","Mesa:"];var P_WAITER=["Es bediente Sie:","Waiter:","Camarero:"];var P_NO=["Anz.","No.","Nú."];var P_DESCR=["Beschreibung","Description","Descripción"];var P_PRICE=["Preis","Price","Precio"];function createReceiptFooterFromDbTaxes(c,h,b,m,o,s,e,n,p,l,q){var a='style="border: solid black 0px;padding: 3px;text-align:right;vertical-align:bottom;"';var t='style="text-align:center;vertical-align:bottom;"';var g="<tr><td colspan=6> </tr>";var r=g;r+="<tr><td colspan=2>"+P_MWST[c]+"% <td "+a+">"+P_MWST[c]+"<td "+a+">"+P_NETTO[c]+"<td "+a+" colspan=2>"+P_BRUTTO[c]+"</tr>";for(var k=0;k<o.length;k++){var f=o[k];r+="<tr><td colspan=2>"+f.tax;r+="<td "+a+">"+f.mwst.replace(".",s);r+="<td "+a+">"+f.netto.replace(".",s);r+="<td colspan=2 "+a+">"+f.brutto.replace(".",s);r+="</tr>"}r+=g;r+="<tr><td> <td colspan=3>"+P_SUM[c]+'<td id="priceinreceipt2" '+a+" colspan=2>"+m.toFixed(2).replace(".",s)+"</td></tr>";r+=g;r+="<tr><td "+t+" colspan=6><center> <br>";r+=toHtml(b).replace(/(?:\r\n|\r|\n)/g,"<br />");r+="</center></tr><br>";r+="<tr><td colspan=6><center><img src='php/contenthandler.php?module=bill&command=billqrcode&billid="+h+"' /></center></tr>";r+=q;r+="<tr><td colspan=6>Kassen-ID: "+toHtml(l).replace(/(?:\r\n|\r|\n)/g,"<br />")+"</tr>";r+="<tr><td colspan=6>Bonerstellung mit Version: "+toHtml(p).replace(/(?:\r\n|\r|\n)/g,"<br />")+"</tr>";return r}function generateProdPart(k,b){var i=0;tablecontent="";for(i=0;i<b.length;i++){var l=b[i];var h=parseInt(l[0]);var e=l[1];var f=e.longname;var g=e.price;var c=e.togo;var a=e.pricelevelname;tablecontent+=generateOneProdLine(h,f,g,a,k,c)}return tablecontent}function generateHtmlBillFromScratch(z,v,h,x,w){var s='<table id="receiptpart" class="receipttable" border=1 style="table-layout: fixed;">';var e=v.id;var o=v.billuid;var m=v.billcontent.billoverallinfo;var t=m.companyinfo;var r=m.sn;var k=m.uid;var f=m.version;var i=m.systemid;var a=v.billcontent.products;var g=m.username;var u=m.table;var y=m.guestinfo;var p=genCreateReceiptHeader(z,o,u,g,h,y);var c=generateProdPartByDbContent(w,a);var b=parseFloat(m.brutto);var q="";if(m.tsestatus==1){q+="<tr><td colspan=6>TSE-Start: "+m.startlogtime+"</tr>";q+="<tr><td colspan=6>TSE-Ende: "+m.logtime+"</tr>";q+="<tr><td colspan=6>TSE-Trans.-Nr: "+m.transnumber+"</tr>";q+="<tr><td colspan=6>TSE-Sig.-Z.: "+m.sigcounter+"</tr>";q+="<tr><td colspan=6>TSE-Signatur: "+m.tsesignature+"</tr>";q+="<tr><td colspan=6>TSE-Seriennr.: "+m.tseserialno+"</tr>"}var n=createReceiptFooterFromDbTaxes(z,e,t,b,v.billcontent.taxes,w,r,k,f,i,q);var l=s+p+c+n;if(m.host==1){l+=x}l+="</table>";return l}var tminfo=null;function insertTMInfo(a){tminfo=a}function Tablemap(b,a,c){this.tables=a;this.roomid=b;this.elem=c;this.selectedTableId=-1;if((a!=null)&&(a.length>0)){this.selectedTableId=a[0].id}}Tablemap.prototype.renderContent=function(){doAjaxTransmitData("GET","php/tablemap.php?command=getTableMap&roomid="+this.roomid,null,this.renderTableList,null,this);d=new Date();$("#mapimgpart").attr("src","php/tablemap.php?command=getTableMapImgAsPng&roomid="+this.roomid+"&tableid="+this.selectedTableId+"&"+d.getTime())};Tablemap.prototype.renderTableList=function(b,a){a.tables=b;var c=a.createList(b,"table_","tablebtn","c",a);$(a.elem).html(c);tmRefreshList(a.elem);a.binding(a)};Tablemap.prototype.createList=function(n,a,g,h,p){var m='<form><fieldset data-role="controlgroup" data-type="horizontal">';for(var l=0;l<n.length;l++){var e=n[l];var b=e.name;var c=e.id;var k="d";var o="alert";var f=e.haspos;if(f==1){o="check";k=h}if(c==p.selectedTableId){k="f"}m+='<input id="'+a+c+'" class="'+g+'" type="submit" value="'+b+'" data-theme="'+k+'" data-icon="'+o+'" />'}m+="</fieldset></form>";return m};Tablemap.prototype.binding=function(a){$(".tablebtn").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();a.selectedTableId=this.id.split("_")[1];a.renderContent(a.elem)});$("#tmimgbtn").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();a.uploadImg(a)});$("#mapimgpart").off("click").on("click",function(k){k.stopImmediatePropagation();k.preventDefault();var c=$("#mapimgpart").width();var b=$("#mapimgpart").height();var l=$(this).offset().top-$(window).scrollTop();var g=$(this).offset().left-$(window).scrollLeft();var i=Math.round((k.clientX-g));var h=Math.round((k.clientY-l));var f={tableid:a.selectedTableId,x:(100*i)/c,y:(100*h)/b};doAjaxTransmitData("POST","php/tablemap.php?command=setPosition",f,a.renderIfOk,null,a)})};Tablemap.prototype.createOverlay=function(y,h,o,v,f,k,u,n){if(typeof n==="undefined"){n=null}var q=[];var g="";if(u==0){g="overlaysize-0"}else{if(u==1){g="overlaysize-1"}else{if(u==2){g="overlaysize-2"}}}for(var x=0;x<h.length;x++){var b=h[x];if(b.haspos==1){var m=b.pos;var p=b.id;var z=b.name;var w="0.00";for(j=0;j<k.length;j++){if(k[j].id==p){w=k[j].pricesum;break}}var e=m.x;var s=m.y;var c="overlay_"+p;var l=w.replace(".",v)+" "+f;var a="";if(n==p){a=" selectedtable "}var r='<span id="'+c+'" class="overlaytxt overlayempty '+a+g+'" style="z-index:100;position:absolute;left:'+e+"%;top:"+s+'%;">'+z;if(w!=0){r='<span id="'+c+'" class="overlaytxt overlayfull '+a+g+'" style="z-index:100;position:absolute;left:'+e+"%;top:"+s+'%;">'+z;if(o!=""){r+="<br>("+o+": "+l+")"}else{r+="<br>("+l+")"}}r+="</span>";q[q.length]=r}}return q};Tablemap.prototype.bindingForOverlaySelection=function(a,c,b,e){if(e!=null){$("#tablemapcontent:not(.overlaytxt)").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();e()})}$("#tablemapcontent .overlaytxt").off("click").on("click",function(m){m.stopImmediatePropagation();m.preventDefault();var g=this.id.split("_")[1];var h="?";for(var f=0;f<b.length;f++){var k=b[f];if(k.id==g){h=k.name}}var l={roomid:c,tableid:g,tablename:h,x:0,y:0};a(l)})};Tablemap.prototype.bindingForSelection=function(e,b,a,c){$(e).off("click").on("click",function(p){p.stopImmediatePropagation();p.preventDefault();var f=$(e).width();var v=$(e).height();var l=$(this).offset().top-$(window).scrollTop();var r=$(this).offset().left-$(window).scrollLeft();var g=100*Math.round((p.clientX-r))/f;var q=100*Math.round((p.clientY-l))/v;if((a!=null)&&(a.length>0)){var u=a[0].id;var n=a[0].name;var t=(100*100)+(100*100);for(var k=0;k<a.length;k++){var m=a[k];if(m.haspos==1){var s=m.pos;var o=(s.x-g)*(s.x-g)+((s.y-q)*(s.y-q));if(o<t){t=o;u=m.id;n=m.name}}}var h={roomid:c,tableid:u,tablename:n,x:g,y:q};b(h)}})};Tablemap.prototype.renderIfOk=function(b,a){if(b.status=="OK"){a.renderContent(a.elem)}else{alert("ERROR")}};Tablemap.prototype.tmCreateList=function(l,a,f,g){var k='<form><fieldset data-role="controlgroup" data-type="horizontal">';for(var h=0;h<l.length;h++){var e=l[h];var b=e.name;var c=e.id;k+='<input id="'+a+c+'" class="'+f+'" type="submit" value="'+b+'" data-theme="'+g+'" />'}k+="</fieldset></form>";return k};Tablemap.prototype.uploadImg=function(a){var b=new FormData($("#tablemapimgform")[0]);b.append("roomid",a.roomid);$.ajax({url:"php/tablemap.php?command=uploadimg",type:"POST",dataType:"json",xhr:function(){var c=$.ajaxSettings.xhr();if(c.upload){}return c},success:function(c){if(c.status!="OK"){a.imgNotUploaded(c)}else{a.imgUploaded(c,a)}},error:function(c){a.imgNotUploaded(c)},data:b,cache:false,contentType:false,processData:false})};Tablemap.prototype.imgUploaded=function(b,a){a.renderContent()};Tablemap.prototype.imgNotUploaded=function(a){alert("Bild konnte nicht hochgeladen werden. Ist es zu groß (> 1 MB)? Oder wurde der Dateiname nicht angegeben?")};function shallDisplayRoom(c){var a=tminfo;if(tminfo==null){return{show:false}}for(var b=0;b<tminfo.length;b++){if(tminfo[b].roomid==c){return{show:tminfo[b].displaymap==1?true:false,pos:tminfo[b].tablepositions}}}return{show:false}}function closePrint(){document.body.removeChild(this.__container__)}function setAndStartPrint(){this.contentWindow.__container__=this;this.contentWindow.onbeforeunload=closePrint;this.contentWindow.onafterprint=closePrint;this.contentWindow.focus();this.contentWindow.print()}function printContent(c){var b=document.createElement("iframe");b.setAttribute("id","printiframe");b.onload=setAndStartPrint;b.style.visibility="hidden";b.style.position="fixed";b.style.right="0";b.style.bottom="0";var a="<body>"+c+"</body>";b.src="data:text/html;charset=utf-8,"+encodeURI(a);document.body.appendChild(b)}function Grouping(b,a){this.set=b;this.sortedset=[];this.group=function(){this.sortedset=[];for(var g=0;g<this.set.length;g++){var e=this.set[g];if(this.sortedset.length==0){e.count=1;e.ids=[e.id];this.sortedset[this.sortedset.length]=e}else{var f=a(e);var k=false;for(j=0;j<this.sortedset.length;j++){var l=this.sortedset[j];var c=a(l);if(f==c){l.count=l.count+1;var h=l.ids;h[h.length]=e.id;k=true;break}}if(!k){e.count=1;e.ids=[e.id];this.sortedset[this.sortedset.length]=e}}}};this.outputList=function(e){var c="";for(var g=0;g<this.sortedset.length;g++){var f=this.sortedset[g];c+=e(f)}return c};this.outputListAdditionalParam=function(f,e){var c="";for(var h=0;h<this.sortedset.length;h++){var g=this.sortedset[h];c+=f(g,e)}return c};this.getItemsOfRow=function(m){var l=this.sortedset[m];var h=l.ids;var e=[];for(var f=0;f<h.length;f++){var k=h[f];for(var g=0;g<this.set.length;g++){var c=this.set[g];if(c.id==k){e[e.length]=c;break}}}return e};this.popSortedEntry=function(f){var c=this.sortedset[f];var e=c.ids;var h=e.pop();var g=this.popSetEntry(h);this.group();return g};this.popSetEntry=function(f){for(var e=0;e<this.set.length;e++){var c=this.set[e];if(c.id==f){this.set.splice(e,1);return c}}};this.getSourceSet=function(){return this.set};this.getGroupedList=function(){return this.sortedset}}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_TOTALSUM=["Summe","Sum","Total"];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/Entnehmen","Insert/Take out","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;var f=a.usetse;showpayments=a.showpayments;showpayment2=a.showpayment2;showpayment3=a.showpayment3;if(f==0){showpayment4=a.showpayment4;showpayment5=a.showpayment5;showpayment6=a.showpayment6;showpayment7=a.showpayment7;showpayment8=a.showpayment8}else{showpayment4=0;showpayment5=0;showpayment6=0;showpayment7=0;showpayment8=0}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> </tr>";g+="<tr><td colspan=4>"+i+' <td id="billid" colspan=2 '+a+">ID:"+e+"</tr>";g+='<tr><td colspan=4> <td id="billdate" colspan=2 '+a+"></tr>";g+="<tr><td colspan=6>"+c+"</tr>";g+="<tr><td colspan=6> </tr>";if(l!=""){g+="<tr><td colspan=6>Gast: "+toHtml(l)+"</tr>";g+="<tr><td colspan=6> </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> </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> <td colspan=3>"+P_SUM[f]+'<td id="priceinreceipt2" '+c+" colspan=2>"+m+"</td></tr>";o+=h;o+="<tr><td "+p+" colspan=6><center> <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/Entnehmen":function(){cashOperation("in")}}});$("#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(c){var a=$("#cashmoney").val().replace(",",".");if(isNaN(a)){alert("Keine Zahl!")}else{$("#cashdlg").dialog("close");var e=$("#cashremark").val();var b=$("#cashtype").val();doAjax("POST","php/contenthandler.php?module=bill&command=doCashAction",{money:a,remark:e,cashtype:b},handleCashActionResult,"Fehler Kassenaktion")}}function handleCashActionResult(a){if(a.status=="ERROR"){alert("Fehler "+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}}}}function setLanguage(b){$("#roomsel").html(P_ROOMSEL[b]);$("#opssel").html(P_OPS[b]);$("#oben").listview("refresh");lang=b;var a='<li data-role="list-divider" data-theme="b" data-role="heading">'+P_PAYDESK_ACTIONS[lang]+'</li><li data-theme="e"><a href="#" id="cashinsert" class="info-go cashaction">'+P_BAR_INPUT[lang]+'</a></li><li data-theme="e"><a href="#" id="cashoverview" class="info-go cashaction">'+P_BAR_SUM[lang]+"</a></li>";$("#cashactions").html(a);$("#cashactions").listview("refresh");$("#navtitle").html(P_NAV[lang]);$("#nav2order").html(P_ORDER_ACTION[lang]);$("#navactions").listview("refresh");$("#paydesktitle").html(P_TITLE[lang]);$("#OnlyPayTxt").html(P_ONLY_PAY[lang]);$("#payprinttxt").html(P_PAY_PRINT[lang]);$("#choosepayway").html(P_CHOOSE_PAYWAY[lang]);$("#canceltxt").html(P_CANCEL[lang]);$("#cancelroomselectiontxt").html(P_CANCEL[lang]);$("#cashtakeouttxt").html(P_CASHTAKEOUT[lang]);$("#amounttxt").html(P_AMOUNT[lang]);$("#amounttxt2").html(P_AMOUNT[lang]);$("#cashtakeintxt").html(P_CASHTAKIN[lang]);$("#cashoverviewtxt").html(P_OVERVIEW[lang]);$("#putinact").html(P_PUT_IN[lang]);$("#takeoutact").html(P_TAKE_OUT[lang]);$("#overviewdetails").html(P_OVERV_DETAILS[lang]);$("#cashsum").html(P_CASH_SUM[lang]);$("#includeowncash").html(P_INCLUDE_OWN[lang]);$("#noelementstxt").html(P_NO_ELEM[lang]);$("#noelementsdetailstxt").html(P_NO_ELEM_DETAILS[lang]);$("#topaytxt").html(P_TO_PAY[lang]);$("#rettxt").html(P_PAY_RETURN[lang]);$("#calcreturn").html(P_CALC_PAYBACK[lang]);$("#haspaidtxt").html(P_HAS_PAID[lang]);$("#tableselimmaptxt").html(P_TABLE_SEL[lang])}function getButtonSizes(){doAjax("GET","php/contenthandler.php?module=admin&command=getButtonSizes",null,fillButtonSizes,"Keine Buttongroesseninformation")}function fillButtonSizes(a){osroombtnsize=a.roombtnsize;ostablebtnsize=a.tablebtnsize;osprodbtnsize=a.prodbtnsize;doAjax("GET","php/contenthandler.php?module=admin&command=getPreferimgmobile",null,fillPreferimgmobile,null);doAjax("GET","php/contenthandler.php?module=admin&command=getPreferCalc",null,fillPreferCalc,null)}function fillPreferimgmobile(a){preferimgmobile=a}function fillPreferCalc(a){calcmodus=a}function getProdSizeClass(){if(osprodbtnsize==1){return("osprod-1")}else{if(osprodbtnsize==2){return("osprod-2")}else{return""}}}function getTableSizeClass(){if(ostablebtnsize==1){return("ostable-1")}else{if(ostablebtnsize==2){return("ostable-2")}else{return""}}}function getRoomSizeClass(){if(osroombtnsize==1){return("osroom-1")}else{if(osroombtnsize==2){return("osroom-2")}else{return""}}}function insertPayments(g){var f=g.payments;hotelinterface=g.hotelinterface;guests=g.guests;internalguests=g.internalguests;var c="";c+='<a href="#" class="sure-do" data-role="button" data-theme="f" data-rel="back" id="paym_1">'+f[0].name+"</a>";c+="<br><hr><br>";for(var b=0;b<f.length;b++){var h=f[b];var e=h.id;var a=h.name;if((e==2)&&(showpayment2==1)){c+='<a href="#" class="sure-do" data-role="button" data-theme="f" data-rel="back" id="paym_'+e+'">'+a+"</a>"}if((e==3)&&(showpayment3==1)){c+='<a href="#" class="sure-do" data-role="button" data-theme="f" data-rel="back" id="paym_'+e+'">'+a+"</a>"}if((e==4)&&(showpayment4==1)){c+='<a href="#" class="sure-do" data-role="button" data-theme="f" data-rel="back" id="paym_'+e+'">'+a+"</a>"}if((e==5)&&(showpayment5==1)){c+='<a href="#" class="sure-do" data-role="button" data-theme="f" data-rel="back" id="paym_'+e+'">'+a+"</a>"}if((e==6)&&(showpayment6==1)){c+='<a href="#" class="sure-do" data-role="button" data-theme="f" data-rel="back" id="paym_'+e+'">'+a+"</a>"}if((e==7)&&(showpayment7==1)){c+='<a href="#" class="sure-do" data-role="button" data-theme="f" data-rel="back" id="paym_'+e+'">'+a+"</a>"}if((e==8)&&(showpayment8==1)){c+='<a href="#" class="sure-do" data-role="button" data-theme="f" data-rel="back" id="paym_'+e+'">'+a+"</a>"}}c+='<a href="#" data-role="button" data-theme="d" data-rel="back" id="paym_cancel">'+P_CANCEL[lang]+"</a>";$("#paymentlist").html(c)}function hideReceiptPart(){$("#payWithoutPrint").hide();$("#payWithPrint").hide();$("#hostbutton").hide();$("#unten").hide()}function showReceiptPart(){if(forceprint==0){$("#payWithoutPrint").show()}else{$("#payWithoutPrint").hide()}$("#payWithPrint").show();$("#hostbutton").show();$("#unten").show();$("#tablemapcontent").hide();$("#togoarea").hide()}function getTableMapPreferences(){doAjax("GET","php/tablemap.php?command=getTableMapPreferences",null,insertTMInfoAndStartDisplayProc,"Keine TM-Information")}function insertTMInfoAndStartDisplayProc(a){tminfo=a;startDisplayProcess()}function handleClickInTablemap(a){checkForLogIn();$("#info-page").data("roomid",null);$("#info-page").data("tableviewactive",0);$("#info-page").data("tid",a.tableid);$("#info-page").data("tablename",a.tablename);$("#oben").show();getProdsToPayForTable(a.tableid,a.tablename)}function displayAllRooms(){checkForLogIn();$("#moneyToInsert").val("");$("#moneyToTakeOut").val("");$("#cashactions").show();$("#navactions").show();$("#remarkin").val("");$("#remarkout").val();hideReceiptPart();var a=$("#info-page").data("billlanguage");$("#prodlistinreceipt").empty().append('<td id="receiptprodheader" class="price">'+P_NO[a]+"<td>"+P_DESCR[a]+'<td class="price">'+P_PRICE[a]+'<td class="price">'+P_TOTAL[a]);$.getJSON("php/contenthandler.php?module=roomtables&command=getRooms",function(f){var g=f.roomstables;var c=f.takeawayprice;var h=g.length;if(h==1){$("#info-page").data("roomid",g[0]["id"]);displayTablesOfRoom(g[0],false);if(cameFromOrdering==1){$("#startpaypage").show()}else{$("#startpaypage").hide()}}else{var b="";var e=getRoomSizeClass();$.each(g,function(l,k){b+='<li data-theme="f"><a href="#" id="'+l+'" class="info-go '+e+'">'+k.name+"</a></li>"});if(c!="0.00"){b+='<li data-theme="c"><a href="#" class="togoorder '+e+'">'+P_TOGO[a]+" ("+c+" "+currency+")</a></li>"}$("#startpaypage").hide();$("#oben").append(b).promise().done(function(){bindTogoOrdering();$(this).off("click").on("click","a",function(k){k.stopImmediatePropagation();k.preventDefault();var i=g[this.id];$("#info-page").data("roomid",i.id);$("#startpaypage").show();displayTablesOfRoom(i,true)});refreshList(this)})}})}function bindTogoOrdering(){$(".togoorder").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();$("#info-page").data("roomid",null);$("#info-page").data("tableviewactive",0);$("#info-page").data("tid",0);$("#info-page").data("tablename",P_TOGO[lang]);$("#oben").show();getProdsToPayForTable(0,"")})}function displayTablesOfRoom(a,b){checkForLogIn();hasRooms=b;var c=$("#info-page").data("roomid");hideReceiptPart();displayUnpaidTables("Tischinfo nicht erhalten!")}$(document).ready(function(){checkForLogIn();var a=setInterval(function(){var b=$("#info-page").data("roomid");if(b!=null){displayUnpaidTables(null)}},10000);$.ajaxSetup({cache:false})});function displayUnpaidTables(a){doAjax("GET","php/contenthandler.php?module=roomtables&command=getUnpaidTables",{roomid:$("#info-page").data("roomid")},displayTables,a)}function displayTables(f){if(f.status!="OK"){return}var i=f.tables;var e=f.takeawayprice;$("#info-page").data("tableviewactive",1);var a=$("#info-page").data("roomid");var g=shallDisplayRoom(a);if(g.show){$("#oben").hide();$("#tablemapcontent").show();$("#togoarea").show();d=new Date();$("#mapimgpart").attr("src","php/tablemap.php?command=getUnpaidTablesMapImgAsPng&showBubbles=0&roomid="+a+"&"+d.getTime());var b=new Tablemap(a,null,"");var c=b.createOverlay("#mapimgpart",g.pos,"",decpoint,currency,i,ostablebtnsize);$("#tableoverlay").html(c);b.bindingForOverlaySelection(handleClickInTablemap.bind(this),a,i,null);if(!hasRooms){if(e!="0.00"){var h='<li data-theme="d"><a href="#" class="togoorder '+k+'">'+P_TOGO[lang]+"</a></li></ul>";$("#tables-list-togo").html(h);$("#togoarea").show()}refreshList("#tables-list-togo");bindTogoOrdering()}}else{$("#oben").show();$("#tablemapcontent").hide();$("#togoarea").hide();var h='<li data-role="list-divider" data-theme="b" data-role="heading">'+P_TABLE_SEL[lang]+"</li>";var k=getTableSizeClass();$.each(i,function(m,o){var n=o.pricesum.replace(".",decpoint);var l=o.name+" <small><i>("+n+" "+currency+")</i></small>";h+='<li data-theme="e"><a href="#" id="'+m+'" class="info-go '+k+'">'+l+"</a></li>"});if(!hasRooms){if(e!="0.00"){h+='<li data-theme="c"><a href="#" class="togoorder '+k+'">'+P_TOGO[lang]+"</a></li>"}}$("#oben").empty().append(h).promise().done(function(){bindTogoOrdering();$(this).off("click").on("click",".info-go",function(n){n.stopImmediatePropagation();n.preventDefault();$("#info-page").data("roomid",null);$("#info-page").data("tableviewactive",0);var l=i[this.id]["id"];var m=i[this.id]["name"];$("#info-page").data("tid",l);$("#info-page").data("tablename",m);getProdsToPayForTable(l,m)});refreshList(this)})}}function getProdsToPayForTable(a,b){$("#startpaypage").show();if(a==0){currentSelectedIsTogo=true;b=P_TOGO[lang];$("#info-page").data("taxtype","togo")}else{currentSelectedIsTogo=false;$("#info-page").data("taxtype","normal")}$("#cashactions").hide();$("#navactions").hide();$.ajax({type:"GET",dataType:"json",data:{tableid:a},url:"php/contenthandler.php?module=queue&command=getJsonProductsOfTableToPay",async:false,success:function(e){var c=e.status;var f=e.msg;if(c!="ERROR"){showReceiptPart();prodsToPayList=f;fillProdByPrintJobsList(f);$("#info-page").data("tableprods",f);bindPayButton(f,a,b);initiatePayableView(f,b)}else{alert("Fehler: "+f)}},error:function(c){alert("Sorry, there was a problem getting the products to pay for table!")}})}function initiatePayableView(a,b){$("#tableinreceipt").html(b+"<br> ");clearUntenAndReceipt();createAllEntriesInReceipt();calcSum();prodsToPayList=a;payTable=b;displayProdsToPayForTable();bindingPressReceipt()}function bindingPressReceipt(){$(".receipttable").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();if(onlyReceiptShown===1){$("#oben").show();$("#unten").show();$("#paybuttongroup").show();$("#hostbuttongroup").show();$(".receipttable").css("width","70%")}else{$("#oben").hide();$("#unten").hide();$("#paybuttongroup").hide();$("#hostbuttongroup").hide();$(".receipttable").css("width","100%")}onlyReceiptShown=1-onlyReceiptShown})}function hasListProdImagesToDisplay(a){if(preferimgmobile==1){for(var b=0;b<a.length;b++){var c=a[b];if(c.prodimageid!=0){return true}}}return false}function displayProdsToPayForTable(){var a=false;if((billprintjobs==1)||((billprintjobs==2)&¤tSelectedIsTogo)){a=true}var h='<li data-role="list-divider" data-theme="b" data-role="heading">'+P_OPS[lang]+"</li>";h+='<li data-theme="f" data-icon="check"><a href="#" id="payall" class="'+n+'">'+P_ALL[lang]+"</a></li>";if(a){var b=Object.keys(prodsByPrintjob);var k=b.length;for(var f=0;f<k;f++){var c=b[f];var l=prodsByPrintjob[c];if(l.length>0){var g=P_ALL[lang]+P_OF_WORK_RECEIPT[lang]+c;h+='<li id="listpayallofprintjob_'+c+'" data-theme="f" data-icon="check"><a href="#" id="payallofprintjob_'+c+'" class="payallofprintjob '+n+'">'+g+"</a></li>"}}}$("#ops").html(h);refreshList("#ops");prodsToPayListGrouping=new Grouping(prodsToPayList,createHashOfPayableItem);prodsToPayListGrouping.group();var n=getProdSizeClass();var e='<li data-role="list-divider" data-theme="b" data-role="heading">'+P_NOT_PAID[lang]+payTable+"</li>";var m=e+prodsToPayListGrouping.outputListAdditionalParam(createPayableItemListElement,hasListProdImagesToDisplay(prodsToPayListGrouping.sortedset));$("#oben").html(m);refreshList("#oben");$(".payable").off("click").on("click",function(p){p.stopImmediatePropagation();p.preventDefault();var o=$(this).closest("li");var q=$("#oben li").index(o)-1;var i=prodsToPayListGrouping.popSortedEntry(q);prodsOnReceiptList[prodsOnReceiptList.length]=i;displayProdsToPayForTable();displayProdsOnReceipt()});$("#payall").off("click").on("click",function(o){o.stopImmediatePropagation();o.preventDefault();for(var i=0;i<prodsToPayList.length;i++){prodsOnReceiptList[prodsOnReceiptList.length]=prodsToPayList[i]}prodsToPayList=[];displayProdsToPayForTable();displayProdsOnReceipt()});if(a){$(".payallofprintjob").off("click").on("click",function(q){q.stopImmediatePropagation();q.preventDefault();var o=this.id.split("_")[1];$("#listpayallofprintjob_"+o).hide();var p=prodsByPrintjob[o];for(var i=0;i<p.length;i++){prodsOnReceiptList[prodsOnReceiptList.length]=p[i];removeFromProdsToPayList(p[i])}prodsByPrintjob[o]=[];displayProdsToPayForTable();displayProdsOnReceipt()})}window.scrollTo(0,0)}function removeFromProdsToPayList(c){var a=c.id;for(var b=0;b<prodsToPayList.length;b++){var e=prodsToPayList[b]["id"];if(a==e){prodsToPayList.splice(b,1);return}}}function displayProdsOnReceipt(){prodsOnReceiptListGrouping=new Grouping(prodsOnReceiptList,createHashOfPayableItem);prodsOnReceiptListGrouping.group();var b=getProdSizeClass();var a='<li data-role="list-divider" data-theme="b" data-role="heading">';a+=P_CONTENT_RECEIPT[lang]+' <p id="priceinreceipt">0,00 '+currency+"</p></li>";var c=a+prodsOnReceiptListGrouping.outputListAdditionalParam(createOnReceiptItemListElement,hasListProdImagesToDisplay(prodsOnReceiptListGrouping.sortedset));$("#unten").html(c);refreshList("#unten");createAllEntriesInReceipt();$(".onreceipt").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();var g=$(this).closest("li");var i=$("#unten li").index(g)-1;var f=prodsOnReceiptListGrouping.popSortedEntry(i);prodsToPayList[prodsToPayList.length]=f;displayProdsToPayForTable();displayProdsOnReceipt()})}function generateListItem(g,c,h,e,f){var b=getProdSizeClass();var a='<li data-theme="'+g+'" data-icon="'+c+'">';a+='<a href="#" id="'+h+'" class="info-go '+b+" "+f+'">'+e+"</a></li>";return a}function generateProdListItem(f,h,b,g,c,e,a){var l=getProdSizeClass();var i='<li data-theme="'+f+'" data-icon="'+h+'">';i+='<a href="#" id="'+b+'" class="info-go '+l+" "+c+'">';if(a){var k="php/contenthandler.php?module=products&command=getprodimage&prodid="+e+"&size=l";i+='<img src="'+k+'" class="centermobileimg" />'}i+=g+"</a></li>";return i}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=createExtraParagraph(b.extras,0);return toHtml(a)+c}function createPayableItemListElement(c,a){var b="";if("count" in c){if(c.count>1){b=c.count+"x "}}var e=generateProdListItem("c","plus","payable_"+c.id,b+createHashOfPayableItem(c),"payable",c.prodid,a);return e}function createOnReceiptItemListElement(c,a){var b="";if("count" in c){if(c.count>1){b=c.count+"x "}}var e=generateProdListItem("c","plus","payable_"+c.id,b+createHashOfPayableItem(c),"onreceipt",c.prodid,a);return e}function clearUntenAndReceipt(){var a='<li data-role="list-divider" data-theme="b" data-role="heading">';a+=P_CONTENT_RECEIPT[lang]+' <p id="priceinreceipt">0,00 '+currency+"</p></li>";$("#unten").empty().append(a).promise().done(function(){refreshList("#unten")});$("#prodlistinreceipt tr").each(function(){$(this).remove()});$("#thedate").html("<br><br> <br>")}function createAllEntriesInReceipt(){var a=new Array();for(var e=0;e<prodsOnReceiptList.length;e++){var n=prodsOnReceiptList[e];var l={prodid:n.prodid,queueid:n.id,longname:n.longname,price:n.price,tax:n.tax,togo:n.togo,extras:n.extras,pricelevelname:n.pricelevelname};a=addEntryOrIncreaseCount(a,l)}var k=createReceiptHeader();var h=new Array();k+=generateProdPart(decpoint,a);var b=$("#info-page").data("usstGerVal");if($("#info-page").data("taxtype")=="togo"){b=$("#info-page").data("togoTaxGerVal")}var f=listTaxesBasedOnUntenList(decpoint);k+=createReceiptFooter(b,lang,f);$("#receiptpart").html(k);calcSum();var m=$("#receiptpart").html();$("#info-page").data("receipthtml",m);var g=new Array(b,h);$("#info-page").data("escposprods",g);var c="";if(showHostTemplate){$.ajax({url:"customer/bon-bewirtungsvorlage.html?v=2.0.11",async:false,success:function(i){$("#receiptpart").html(k+i);calcSum()},error:function(i){alert("Kommunikationsfehler zum Server. In der Feedbackansicht lässt sich ein Fehlerprotokoll an den Anbieter übermitteln.")},cache:false})}else{$("#receiptpart").html(k+c);calcSum()}}function createReceiptHeader(){var a=genCreateReceiptHeader($("#info-page").data("billlanguage"),"",$("#info-page").data("tablename"),$("#loggedinuser").html(),currency);return a}function createReceiptFooter(b,c,a){var e=genCreateReceiptFooterNoSum(b,$("#info-page").data("billlanguage"),$("#info-page").data("companyinfo"),a);return e}function bindPayButton(a,b,c){$("#payWithoutPrint").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();if(showpayments==1){selectPayment(b,c,false)}else{payWithoutPaymentDlg(b,c,false)}});$("#payWithPrint").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();if(showpayments==1){selectPayment(b,c,true)}else{payWithoutPaymentDlg(b,c,true)}})}function selectPayment(b,c,a){var f=prodsOnReceiptList.length;if(f==0){$.mobile.changePage("#nocashitems")}else{setCalcModusBtn();var e=$("#priceinreceipt2").html().replace(".",decpoint);$("#topayval").html(e);$("#totalpricearea").html(e);$("#haspaid").attr("placeholder",e);$("#haspaid").val("");$("#topayback").html("0"+decpoint+"00");$("#tipfield").attr("placeholder","0.00".replace(".",decpoint)+" "+currency);$("#tipfield").val("");$.mobile.changePage("#paymentdialog");$("#calcarea").show();$("#paymentarea").show();$("#hotelroomarea").hide();bindCalcReturn();calcChangeMoney();$("#paymentdialog .sure-do").off("click").on("click",function(m){var i=(($(this).attr("id")).split("_"))[1];if(i!="hotel"){currentPaymentId=i}if((i==PAYMENT_HS3)||(i==PAYMENT_GUEST)){m.stopImmediatePropagation();m.preventDefault();$("#calcarea").hide();$("#paymentarea").hide();$("#hotelroomarea").show();$("#roomguesttextfield").val("");bindhotelinterface(i);return}else{$(this).off("click")}var l=$("#info-page").data("usst");if($("#info-page").data("taxtype")=="togo"){l=$("#info-page").data("togotax")}if(i=="hotel"){var h=$("#hotelroomselection").find(":selected").val();if(h!=undefined){var g=guests[h];var k="";if(currentPaymentId==PAYMENT_GUEST){g=internalguests[h];k=g.id}startPayProcess(a,b,c,currentPaymentId,l,g.reservationid,g.object+" - "+g.guest,k)}else{alert("Kein Gast ausgewählt")}}else{startPayProcess(a,b,c,i,l,"","","")}})}}function payWithoutPaymentDlg(b,c,a){var e=$("#info-page").data("usst");if($("#info-page").data("taxtype")=="togo"){e=$("#info-page").data("togotax")}var f=prodsOnReceiptList.length;if(f==0){$.mobile.changePage("#nocashitems")}else{startPayProcess(a,b,c,1,e,"","","")}}function bindhotelinterface(a){generateGuestResult($("#roomguesttextfield").val(),true,a);$("#cancelhotelroomselection").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();$("#calcarea").show();$("#paymentarea").show();$("#hotelroomarea").hide()});$("#roomguesttextfield").off("keyup").on("keyup",function(b){generateGuestResult($("#roomguesttextfield").val(),true,a)})}function bindCalcReturn(){$("#calcreturnbtn").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();calcChangeMoney()})}function calcChangeMoney(){try{var b=$("#haspaid").val().trim();var f=parseFloat(b.replace(decpoint,"."));var i=$("#topayval").html();var a=parseFloat(i.replace(decpoint,"."));var h=0;if(calcmodus==CALC_TIP){var l=$("#tipfield").val().trim();if(l==""){l=0}else{l=parseFloat(l.replace(decpoint,"."))}h=f-(a+l)}else{var k=$("#tipfield").val().trim();if(k==""){if(b==""){h="NaN"}else{h=f-a;$("#tipfield").val(i)}}else{k=parseFloat(k.replace(decpoint,"."));h=f-k}}if($.isNumeric(parseFloat(h))){var c=h.toFixed(2).replace(".",decpoint);$("#topayback").html(c)}else{$("#topayback").html("?")}}catch(g){$("#topayback").html("?")}}function setCalcModusBtn(){if(calcmodus==CALC_TOTAL){$("#payway").html(P_CHANGE_CALC[lang]);$("#calculatorarea").show();$("#totalpricearea").hide();$("#calcmodus").html("-> "+CALC_TIP_TXT[lang]);$("#tiptxt").html(P_TOTAL_INCL_TIP[lang])}else{if(calcmodus==CALC_TIP){$("#payway").html(P_CHANGE_CALC[lang]);$("#calculatorarea").show();$("#totalpricearea").hide();$("#calcmodus").html("-> "+CALC_TOTAL_TXT[lang]);$("#tiptxt").html(P_TIP[lang])}else{$("#payway").html(P_TOTALSUM[lang]);$("#totalpricearea").show();$("#calculatorarea").hide()}}}function getIdsOfProductsToPay(){var c="";for(var b=0;b<prodsOnReceiptList.length;b++){var e=prodsOnReceiptList[b];var a=e.id;c+=a+","}return c}function handleAjaxPaymentAnswer(l,i){showHostTemplate=false;var h=l.status;var c=l.msg;if(h!="ERROR"){var f=c.billid;var g=c.date;if(f<0){alert("Error! Bitte erneut versuchen. Error code: "+f);window.location.reload(false)}else{var a=$("#info-page").data("billlanguage");$("#billid").html(P_ID[a]+f);$("#billdate").html(g);if(i.printoption){var b=$("#info-page").data("payPrintType");if(b=="s"){printBill(f)}else{$("#oben").hide();var e="<table>"+$(".receipttable").html()+"</table>";printContent(e)}}prodsOnReceiptList=[];getProdsToPayForTable(i.tableid,i.tablename);var k=$("#oben li").size()-1;if(k>0){if((sumupforcard==1)&&((i.paymentid==2)||(i.paymentid==3))){setSessionValueAndGoToSumup("p",f,c.brutto,i.tableid)}}else{if((sumupforcard==1)&&((i.paymentid==2)||(i.paymentid==3))){if(i.cameFromOrdering==1){setSessionValueAndGoToSumup("w",f,c.brutto,i.tableid)}else{setSessionValueAndGoToSumup("p",f,c.brutto,i.tableid)}}if(i.cameFromOrdering==1){goToUrl("waiter.html")}else{goToUrl("paydesk.html")}}}}else{alert("Fehler: "+c)}}function setSessionValueAndGoToSumup(a,g,c,e){if(serverurl==""){alert("Server-Adresse wurde nicht konfiguriert - Sumup-Anbindung nicht möglich");return}if(appid==""){alert("App-ID für SumUp wurde nicht konfiguriert - Sumup-Anbindung nicht möglich");return}if(affiliatekey==""){alert("Affiliate Key für SumUp wurde nicht konfiguriert - Sumup-Anbindung nicht möglich");return}var f={billid:g};var b={serverurl:serverurl,appid:appid,affiliatekey:affiliatekey,nextPage:a,billid:g,brutto:c,tableid:e};doAjaxTransmitData("POST","php/contenthandler.php?module=bill&command=initCardPayment",f,completeSumUpPayment,"Fehler bei der Zahlungsvorbereitung",b)}function completeSumUpPayment(b,f){if(b.status!="OK"){alert("Fehler: "+b.msg)}var h=b.msg;var e=f.billid+"-"+f.nextPage+"-"+f.tableid+"-"+h;var g=P_BILL_TITLE[lang]+" "+f.billid;var c="sumupmerchant://pay/1.0";c+="?affiliate-key="+affiliatekey;c+="&app-id="+appid;c+="&total="+f.brutto;var a=currency;if((currency=="Euro")||(currency=="Eur")||(currency=="€")){a="EUR"}c+="¤cy="+a;c+="&title="+g;c+="&callback="+serverurl+"/sumuphandler.php?billinformation="+e;setTimeout(function(){document.location.href=c},250)}function startPayProcess(k,b,h,n,e,i,l,g){checkForLogIn();if(i==undefined){i=""}var a=getIdsOfProductsToPay();var c=cameFromOrdering;if(cameFromOrdering==1){if(workflowconfig==1){c=digigopaysetready}}var m={ids:a,tableid:b,paymentid:n,declareready:c,host:(showHostTemplate?1:0),reservationid:i,guestinfo:l,intguestid:g};var f={tableid:b,printoption:k,tablename:h,cameFromOrdering:cameFromOrdering,paymentid:n};doAjaxTransmitData("POST","php/contenthandler.php?module=queue&command=declarePaidCreateBillReturnBillId",m,handleAjaxPaymentAnswer,"Fehler bei der Zahlung",f)}function goToUrl(a){setTimeout(function(){document.location.href=a},500)}function cashactions(){$(".cashaction").off("click").on("click",function(a){var b=$(this).attr("id");if(b=="cashinsert"){startCashInsertProcess()}else{if(b=="cashoverview"){startCashOverviewProcess()}}})}function startCashInsertProcess(){$("#cashinsertdialog .sure-do").off("click").on("click",function(){$.mobile.changePage("#info-page");var a=$("#moneyToInsert").val().replace($("#info-page").data("decpoint"),".");var c=$("#remarkin").val();var b=$("#cashtype").val();if(isNaN(a)){alert("Keine Zahl!")}else{if(Math.abs((parseFloat(a)<=100000))){doCashInsert(a,c,b)}else{alert("Betragabsolutwert muss kleiner als 100000 sein!")}}});$.mobile.changePage("#cashinsertdialog");removeInputValsCashIn()}function removeInputValsCashIn(){setTimeout(function(){$("#moneyToInsert").val("");$("#remarkin").val("")},1000)}function doCashInsert(a,c,b){doAjax("POST","php/contenthandler.php?module=bill&command=doCashAction",{money:a,remark:c,cashtype:b},handleCashActionResult,"Fehler Kassenaktion")}function startCashOverviewProcess(){doAjax("POST","php/contenthandler.php?module=bill&command=getCashOverviewOfUser",null,showCashOverview,"Fehler Kassenaktion")}function handleCashActionResult(a){if(a.status=="ERROR"){alert("Fehler "+a.msg)}else{if(a.status=="OK"){alert(P_CASHACTION_OK[lang])}}}function showCashOverview(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);$.mobile.changePage("#cashoverviewinfo")}function startDisplayProcess(){var b="";if(restaurantmode==0){b+="t=0";currentSelectedIsTogo=true}else{b=location.search}if(b.indexOf("t=")<0){displayAllRooms()}else{var e="";var g=b.split(/&|\?/);for(var a=0;a<g.length;a++){var f=g[a];if(f.indexOf("t=")==0){var c=f.split("=");e=c[1]}}if(e==""){cameFromOrdering=0;displayAllRooms();return}cameFromOrdering=1;$("#cashactions").hide();$("#navactions").hide();$.ajax({type:"GET",url:"php/contenthandler.php?module=queue&command=getJsonTableNameFromId",dataType:"json",data:{tableid:e},async:false,success:function(h){$("#info-page").data("tid",e);$("#info-page").data("tablename",h);getProdsToPayForTable(e,h)},error:function(h){alert("Kommunikationsfehler zum Server bei Tischnamenabfrage: "+errorMsg+" - In der Feedbackansicht lässt sich ein Fehlerprotokoll an den Anbieter übermitteln.")}})}}$(document).on("pageinit","#info-page",function(){initializeMainMenu("#modulemenu");hideMenu();getGeneralConfigItems();$("#info-page").data("taxtype","normal");getButtonSizes();getPayments(insertPayments);$("#hostingtablepart").hide();if(showhostprint==1){$("#hostbuttongroup").show();bindHostButton("#hostbutton")}cashactions();$("#startpaypage").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();if(cameFromOrdering==1){setTimeout(function(){document.location.href="waiter.html"},250)}else{window.location.reload(false)}});getTableMapPreferences()}); </script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<style>
|
|
@media screen
|
|
{
|
|
.receipttable {width: 70%; background-color: #cccccc;}
|
|
}
|
|
@media print
|
|
{
|
|
.receipttable,#partToPrint {width: 100%;};
|
|
}
|
|
@media print
|
|
{
|
|
#thefooter,#theheader,#modulemenu,#oben,#ops,#untenarea,#payWithoutPrint,#paybuttongroup,#hostbuttongroup {display: none;}
|
|
}
|
|
</style>
|
|
|
|
<div data-role="page" id="info-page" data-theme="c">
|
|
<div data-role="panel" id="modulepanel" data-position="right" data-display="overlay">
|
|
<ul data-role="listview" id="modulemenu" data-divider-theme="a" data-inset="true">
|
|
<li data-role="list-divider" data-theme="b" data-role="heading">Hauptmenü</li>
|
|
</ul>
|
|
</div><!-- /panel -->
|
|
<div data-role="header" data-theme="b" data-position="fixed" id="theheader" style="background-color:black;">
|
|
<h1><span id="paydesktitle">Kasse</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /> <img src="img/tsestatus.png" class="tsestatus" style="display:none;" /> <img src="img/tasksstatus.png" class="tasksstatus" style="display:none;" /></h1>
|
|
<div data-type="horizontal" style="top:0px;position:absolute;float:right;z-index:10;display:inline;" align="right" class="ui-btn-right">
|
|
<a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitch">Hauptmenü</a>
|
|
</div>
|
|
<div data-type="horizontal" style="top:10px;position:absolute;float:right;z-index:10;display:inline;" align="left" class="ui-btn-left">
|
|
<a href="#" data-role="button" data-icon="arrow-l" data-ajax="false" id="startpaypage"></a>
|
|
</div>
|
|
</div>
|
|
<div data-role="content" id="contentpart">
|
|
<ul data-role="listview" id="ops" data-divider-theme="a" data-inset="true">
|
|
<li data-role="list-divider" data-theme="b" data-role="heading" id="opssel">Ops</li>
|
|
</ul>
|
|
<ul data-role="listview" id="oben" data-divider-theme="a" data-inset="true">
|
|
<li data-role="list-divider" data-theme="b" data-role="heading" id="roomsel">Raumauswahl</li>
|
|
</ul>
|
|
|
|
<div id="tablemapcontent" style="display:none;">
|
|
<div style="background-color:black;"><span id=tableselimmaptxt style="font-weight:bold;font-size:20px;color:white;">Tischauswahl</span>:</div>
|
|
<div id=tablemapcontent style="position: relative;width:100%;">
|
|
<img id="mapimgpart" style="width:100%;position: relative;left: 0;top: 0;" src=img/empty-room.png />
|
|
<div id=tableoverlay></div>
|
|
</div>
|
|
</div>
|
|
<div id=togoarea>
|
|
<ul data-role="listview" id="tables-list-togo" data-divider-theme="a" data-inset="true">
|
|
</ul>
|
|
</div>
|
|
|
|
<ul data-role="listview" id="cashactions" data-divider-theme="a" data-inset="true">
|
|
</ul>
|
|
|
|
<ul data-role="listview" id="navactions" data-divider-theme="a" data-inset="true">
|
|
<li data-role="list-divider" data-theme="b" data-role="heading"><span id="navtitle">Navigation</span></li>
|
|
<li data-theme="e"><a href="waiter.html" id="navtoorder" target="_top"><span id="nav2order">Bestellansicht</span></a></li>
|
|
</ul>
|
|
|
|
<div id="untenarea">
|
|
<ul data-role="listview" id="unten" data-divider-theme="a" data-inset="true">
|
|
<li data-role="list-divider" data-theme="b" data-role="heading">
|
|
Inhalt Kassenbon: <p id="priceinreceipt">0,00 Euro</p>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div data-role="controlgroup" data-type="horizontal" id="paybuttongroup">
|
|
<a href="#" data-role="button" data-theme="b" data-icon="check" id="payWithoutPrint"><span id="OnlyPayTxt">Nur Zahlung</span></a>
|
|
<a href="#" data-role="button" data-theme="b" data-icon="grid" id="payWithPrint"><span id="payprinttxt">Bondruck</span></a>
|
|
</div>
|
|
|
|
<div data-role="controlgroup" data-type="horizontal" id="hostbuttongroup" style="display:none;">
|
|
<a href="#" data-role="button" data-theme="b" data-icon="delete" id="hostbutton">Bewirtungsbeleg</a>
|
|
</div>
|
|
|
|
<div id="partForSaveInBill"> <!-- This part will be saved into bill in db -->
|
|
<div id=partToPrint>
|
|
<table id="receiptpart" class="receipttable" border=0 style="table-layout: fixed;"></table>
|
|
</div>
|
|
</div> <!-- end of partForSaveInBill -->
|
|
|
|
</div>
|
|
|
|
<div data-role="footer" data-theme="b" id="thefooter" style="background-color:black;">
|
|
<div class="ui-grid-a">
|
|
<div class="ui-block-a userinfo" id="loggedinuser"></div>
|
|
<div class="ui-block-b grid_right" id="versioninfo"></div>
|
|
</div><!-- /grid-a -->
|
|
</div> <!-- footer -->
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Dialog page -->
|
|
<div data-role="dialog" id="paymentdialog" data-title="Zahlungsart">
|
|
<div data-role="content">
|
|
<div id='calcarea' style='display:none;'>
|
|
<h3><span id="payway">Zahlungsart</span></h3>
|
|
|
|
<p>
|
|
<div>
|
|
<form>
|
|
<div id="totalpricearea" style="display:none;height:70px;font-size:40px;text-align:center;vertical-align: middle;">Test</div>
|
|
<table id ="calculatorarea" style="border: 1px solid black;display:none;width:100%;">
|
|
<tr>
|
|
<td><span id=topaytxt>Zahlen: </span><td><i><b><span id=topayval>0,00</span></b></i>
|
|
<td> <td><span id=haspaidtxt>Bezahlt: </span><td style="width:100px;color:yellow;"><input type="text" id="haspaid" value="" data-mini="true" placeholder="" />
|
|
</tr><tr>
|
|
<td><span id="rettxt">Zurück: </span><td><i><b><span id="topayback" style="background-color:#ffff99;">0,00</span></b></i><span id=curtopay2></span></td>
|
|
<td> <td><span id=tiptxt>Trinkg.: </span><td style="width:100px;color:yellow;"><input type="text" id="tipfield" value="" data-mini="true" placeholder="" />
|
|
</tr>
|
|
<tr>
|
|
<td colspan=5><button id="calcreturnbtn" type="submit" data-theme="b"><span id="calcreturn">Berechne</span></button>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div id='paymentarea' style='display:none;'>
|
|
<p><b><span id="choosepayway">Auswahl der Zahlungsart</span></b></p>
|
|
<div id=paymentlist>
|
|
<a href="#" class="sure-do" data-role="button" data-theme="b" data-rel="back">Ja</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id='hotelroomarea' style='display:none;'>
|
|
<p>
|
|
<div data-role="content">
|
|
<h3><span id="hotelroomtitle">Hotelzimmer / Gast wählen</span></h3>
|
|
<p>
|
|
<form>
|
|
<div id='hotelroomfoundguest'></div><br>
|
|
<div id='roomselectionarea'><select id='hotelroomselection'></select><br></div>
|
|
<input id='roomguesttextfield' type="text" placeholder='Zimmer oder Gast' /><br>
|
|
<a href="#" class="sure-do" data-role="button" data-theme="f" data-rel="back" id="paym_hotel">Auf Zimmer schreiben</a>
|
|
<button id='cancelhotelroomselection' type='submit' data-theme='d'><span id='cancelroomselectiontxt'>Abbrechen</span></button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- Dialog page -->
|
|
<div data-role="dialog" id="sure" data-title="Entfernen?">
|
|
<div data-role="content">
|
|
<h3>Zahlungsart</h3>
|
|
<a href="#" class="sure-do" data-role="button" data-theme="b" data-rel="back">Ja</a>
|
|
<a href="#" class="sure-do" data-role="button" data-theme="b" data-rel="back">Wert2</a>
|
|
<a href="#" data-role="button" data-theme="c" data-rel="back">Nein</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Dialog page for cash insert -->
|
|
<div data-role="dialog" id="cashinsertdialog" data-title="Kassenaktion">
|
|
<div data-role="content">
|
|
<h3><span id="cashtakeintxt">Bareinlage in die Kasse</span></h3>
|
|
<input type="text" id="remarkin" value="" data-mini="true" placeholder="Bemerkung">
|
|
<label for="moneyToInsert"><span id="amounttxt">Betrag:</span></label>
|
|
<input type="text" id="moneyToInsert" value="" data-mini="true">
|
|
<select id="cashtype" data-theme="c">
|
|
<option value="1">Privateinlage-/entnahme</option>
|
|
<option value="3">Geldtransit</option>
|
|
<!--<option value="4">Lohnzahlung</option> -->
|
|
<option value="5">Ein-/Auszahlung</option>
|
|
<option value="7">Trinkgeld an Arb.nehmer</option>
|
|
<option value="8">Trinkgeld an Arb.geber</option>
|
|
</select>
|
|
<div id=paymentlistcash>
|
|
<a href="#" class="sure-do" data-role="button" data-theme="b" data-rel="back"><span id="putinact">Einlage/Entnahme</span></a>
|
|
<a href="#" data-role="button" data-theme="d" data-rel="back" id="cash_insert_cancel"><span id="canceltxt">Abbruch</span></a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div data-role="dialog" id="cashoverviewinfo" name="cashoverviewinfo" data-overlay-theme="a" style="max-width:70%;" class="ui-corner-all">
|
|
<div data-role="content">
|
|
<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>
|
|
<p><span id=cashbyguests></span></p>
|
|
<p><i>Ein-/Auslagen:</i> <b><span id="onlycashsum"></span></b> <span class="currencyplaceholder"></span>
|
|
<p><i><span id="includeowncash">inkl. eigener Kassen-Eingaben/Entnahmen:</span></i> <b><span id=cashtotal></span></b> <span class="currencyplaceholder"></span><p>
|
|
<a href="#" data-role="button" data-theme="d" data-rel="back" id="cash_overview_ok">OK</a>
|
|
</div>
|
|
</div> <!-- popup -->
|
|
|
|
<div data-role="dialog" id="nocashitems" name="nocashitems" data-overlay-theme="a" style="max-width:70%;" class="ui-corner-all">
|
|
<div data-role="content">
|
|
<h3><span id="noelementstxt">Keine Rechnungselemente</span></h3>
|
|
|
|
<p><span id="noelementsdetailstxt">Es wurden keine abrechenbaren Produkte festgelegt (der Bon ist leer!).</span><p>
|
|
<a href="#" data-role="button" data-theme="d" data-rel="back" id="nocashitems_ok">OK</a>
|
|
</div>
|
|
</div> <!-- popup nocashitems -->
|
|
|
|
</body>
|
|
</html> |