ordersprinter/webapp/paydesk.html

199 lines
49 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=1.1.26">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<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>
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 CALC_TIP=0;var CALC_TOTAL=1;var lang=0;var receiptfontsize=12;var paymentconfig=0;var decpoint=".";var currency="";var osroombtnsize=0;var ostablebtnsize=0;var osprodbtnsize=0;var tminfo=null;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;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+"&nbsp;");if(c.loggedin==1){$("#loggedinuser").html("&nbsp;"+c.user);var b='<li data-role="list-divider" data-theme="b" data-role="heading">Module</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")})}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(l,h,i){if(c!=null){var k=c+", Status: "+h+", Error:"+i+", Msg: "+l.responseText+" ("+b+")";alert("Kommunikationsfehler zum Server: "+k)}}})}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(h,f,g){}})}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)}}})}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,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"))}else{return a}}function createExtraParagraph(b){if((b==null)||(b=="")){return""}var c="";for(var a=0;a<b.length;a++){c+="<p>+ "+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)}}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 genCreateReceiptHeader(b,e,h,f,k){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>";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 createReceiptFooterFromDbTaxes(c,a,h,k,m){var b='style="border: solid black 0px;padding: 3px;text-align:right;vertical-align:bottom;"';var n='style="text-align:center;vertical-align:bottom;"';var f="<tr><td colspan=6>&nbsp</tr>";var l=f;l+="<tr><td colspan=2>"+P_MWST[c]+"% <td "+b+">"+P_MWST[c]+"<td "+b+">"+P_NETTO[c]+"<td "+b+" colspan=2>"+P_BRUTTO[c]+"</tr>";for(var g=0;g<k.length;g++){var e=k[g];l+="<tr><td colspan=2>"+e.tax;l+="<td "+b+">"+e.mwst.replace(".",m);l+="<td "+b+">"+e.netto.replace(".",m);l+="<td colspan=2 "+b+">"+e.brutto.replace(".",m);l+="</tr>"}l+=f;l+="<tr><td> &nbsp; <td colspan=3>"+P_SUM[c]+'<td id="priceinreceipt2" '+b+" colspan=2>"+h.toFixed(2).replace(".",m)+"</td></tr>";l+=f;l+="<tr><td "+n+" colspan=6><center>&nbsp;<br>";l+=toHtml(a).replace(/(?:\r\n|\r|\n)/g,"<br />");l+="</center></tr>";return l}function generateOneProdLine(l,h,k,a,o,f){var b='style="border: solid black 0px;padding: 3px;text-align:right;vertical-align:bottom;"';var i='style="border: solid black 0px;padding: 3px;text-align:center;vertical-align:bottom;"';var c=(parseFloat(k)).toFixed(2).replace(".",o);if(a!="A"){h+=" ("+a+")"}if(f==1){h="To-Go: "+h}var n=l*k;var g=n.toFixed(2).replace(".",o);var m="<tr>";var e='style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;width: 60%;"';m+="<td "+i+' id="count">'+l+"<td colspan=3 "+e+">"+h;m=m+"<td "+b+">"+c;m+="<td "+b+">"+n.toFixed(2).replace(".",o)+"</tr>";return m}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 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 generateHtmlBillFromScratch(c,f,g,n,r,a,b){var s='<table id="receiptpart" class="receipttable" border=1 style="table-layout: fixed;">';var e=g.billoverallinfo;var q=g.products;var h=e.username;var k=e.table;var i=genCreateReceiptHeader(c,f,k,h,n);var o=generateProdPartByDbContent(r,q);var l=parseFloat(e.brutto);var p=createReceiptFooterFromDbTaxes(c,a,l,g.taxes,r);var m=s+i+o+p;if(e.host==1){m+=b}m+="</table>";return m}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(w,g,m,s,e,h,r){var o=[];var f="";if(r==0){f="overlaysize-0"}else{if(r==1){f="overlaysize-1"}else{if(r==2){f="overlaysize-2"}}}for(var v=0;v<g.length;v++){var a=g[v];if(a.haspos==1){var l=a.pos;var n=a.id;var x=a.name;var u="0.00";for(j=0;j<h.length;j++){if(h[j].id==n){u=h[j].pricesum;break}}var c=l.x;var q=l.y;var b="overlay_"+n;var k=u.replace(".",s)+" "+e;var p='<span id="'+b+'" class="overlaytxt overlayempty '+f+'" style="z-index:100;position:absolute;left:'+c+"%;top:"+q+'%;">'+x;if(u!=0){p='<span id="'+b+'" class="overlaytxt overlayfull '+f+'" style="z-index:100;position:absolute;left:'+c+"%;top:"+q+'%;">'+x;if(m!=""){p+="<br>("+m+": "+k+")"}else{p+="<br>("+k+")"}}p+="</span>";o[o.length]=p}}return o};Tablemap.prototype.bindingForOverlaySelection=function(a,c,b){$(".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 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.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}}function getGeneralConfigItems(){doAjax("GET","php/contenthandler.php?module=admin&command=getGeneralConfigItems",null,insertGeneralConfigItems,"Fehler Konfigurationsdaten")}function getPayments(){doAjax("GET","php/contenthandler.php?module=admin&command=getPayments",null,insertPayments,"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);setLanguage(a.userlanguage)}else{$("#contentpart").hide();setTimeout(function(){document.location.href="index.html"},250)}}function setLanguage(b){$("#roomsel").html(P_ROOMSEL[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="cashtakeout" class="info-go cashaction">'+P_BAR_GET[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]);$("#payway").html(P_CHANGE_CALC[lang]);$("#choosepayway").html(P_CHOOSE_PAYWAY[lang]);$("#canceltxt").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]);setCalcModusBtn()}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}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(e){var c="";var a=20;if(paymentconfig==1){a=2}var b=false;$.each(e,function(g,f){if(g<a){c+='<a href="#" class="sure-do" data-role="button" data-theme="f" data-rel="back" id="paym_'+f.id+'">'+f.name+"</a>";if(!b){c+="<br><hr><br>";b=true}}});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(){$("#payWithoutPrint").show();$("#payWithPrint").show();$("#hostbutton").show();$("#unten").show();$("#tablemapcontent").hide();$("#togoarea").hide()}function getTableMapPreferences(){doAjax("GET","php/tablemap.php?command=getTableMapPreferences",null,insertTMInfo,"Keine TM-Information")}function insertTMInfo(a){tminfo=a;startDisplayProcess()}function shallDisplayRoom(b){for(var a=0;a<tminfo.length;a++){if(tminfo[a].roomid==b){return{show:tminfo[a].displaymap==1?true:false,pos:tminfo[a].tablepositions}}}return{show:false}}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();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){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);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+"&nbsp;&nbsp;&nbsp;&nbsp;<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){b=P_TOGO[lang];$("#info-page").data("taxtype","togo")}else{$("#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();$("#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>&nbsp;");clearUntenAndReceipt();createAllEntriesInReceipt();calcSum();prodsToPayList=a;payTable=b;displayProdsToPayForTable()}function displayProdsToPayForTable(){prodsToPayListGrouping=new Grouping(prodsToPayList,createHashOfPayableItem);prodsToPayListGrouping.group();var b=getProdSizeClass();var a='<li data-role="list-divider" data-theme="b" data-role="heading">'+P_NOT_PAID[lang]+payTable+"</li>";a+='<li data-theme="f" data-icon="check"><a href="#" id="payall" class="'+b+'">'+P_ALL[lang]+"</a></li>";var c=a+prodsToPayListGrouping.outputList(createPayableItemListElement);$("#oben").html(c);refreshList("#oben");$(".payable").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();var g=$(this).closest("li");var i=$("#oben li").index(g)-2;var f=prodsToPayListGrouping.popSortedEntry(i);prodsOnReceiptList[prodsOnReceiptList.length]=f;displayProdsToPayForTable();displayProdsOnReceipt()});$("#payall").off("click").on("click",function(g){g.stopImmediatePropagation();g.preventDefault();for(var f=0;f<prodsToPayList.length;f++){prodsOnReceiptList[prodsOnReceiptList.length]=prodsToPayList[f]}prodsToPayList=[];displayProdsToPayForTable();displayProdsOnReceipt()});window.scrollTo(0,0)}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.outputList(createOnReceiptItemListElement);$("#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 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);return toHtml(a)+c}function createPayableItemListElement(b){var a="";if("count" in b){if(b.count>1){a=b.count+"x "}}var c=generateListItem("c","plus","payable_"+b.id,a+createHashOfPayableItem(b),"payable");return c}function createOnReceiptItemListElement(b){var a="";if("count" in b){if(b.count>1){a=b.count+"x "}}var c=generateListItem("c","plus","payable_"+b.id,a+createHashOfPayableItem(b),"onreceipt");return c}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>&nbsp;<br>")}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 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(f){var b=[];var e=0;for(var c=0;c<prodsOnReceiptList.length;c++){var a=prodsOnReceiptList[c];b.push(a.tax)}return listTaxes(b,decpoint)}function calcSum(){var f=listTaxesBasedOnUntenList(decpoint);var n=$("#info-page").data("tableprods");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 createAllEntriesInReceipt(){var f=$("#info-page").data("tablename");var a=new Array();for(var e=0;e<prodsOnReceiptList.length;e++){var p=prodsOnReceiptList[e];var n={prodid:p.prodid,queueid:p.id,longname:p.longname,price:p.price,tax:p.tax,togo:p.togo,extras:p.extras,pricelevelname:p.pricelevelname};a=addEntryOrIncreaseCount(a,n)}var m=createReceiptHeader();var l=new Array();m+=generateProdPart(decpoint,a);var b=$("#info-page").data("usstGerVal");if($("#info-page").data("taxtype")=="togo"){b=$("#info-page").data("togoTaxGerVal")}var g=listTaxesBasedOnUntenList(decpoint);m+=createReceiptFooter(b,lang,g);$("#receiptpart").html(m);calcSum();var o=$("#receiptpart").html();$("#info-page").data("receipthtml",o);var k=new Array(b,l);$("#info-page").data("escposprods",k);var h=$("#info-page").data("hosting");var c="";if(h==1){$.ajax({url:"customer/bon-bewirtungsvorlage.html",async:false,success:function(i){$("#receiptpart").html(m+i);calcSum()},error:function(i){alert("Kommunikationsfehler zum Server: ")},cache:false})}else{$("#receiptpart").html(m+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();selectPayment(b,c,false)});$("#payWithPrint").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();selectPayment(b,c,true)})}function selectPayment(b,c,a){var f=prodsOnReceiptList.length;if(f==0){$.mobile.changePage("#nocashitems")}else{var e=$("#priceinreceipt2").html().replace(".",decpoint);$("#topayval").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");bindCalcReturn();calcChangeMoney();$("#paymentdialog .sure-do").off("click").on("click",function(){var g=(($(this).attr("id")).split("_"))[1];$(this).off("click");$.mobile.changePage("#info-page");var h=$("#info-page").data("usst");if($("#info-page").data("taxtype")=="togo"){h=$("#info-page").data("togotax")}startPayProcess(a,b,c,g,h)})}}function bindCalcReturn(){$("#calcreturnbtn").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();calcChangeMoney()});$("#calcmodusbtn").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();if(calcmodus==CALC_TIP){calcmodus=CALC_TOTAL}else{calcmodus=CALC_TIP}$("#tipfield").val("");setCalcModusBtn();calcChangeMoney()})}function calcChangeMoney(){try{var f=parseFloat($("#haspaid").val().replace(decpoint,"."));var b=parseFloat($("#topayval").html().replace(decpoint,"."));var i=0;if(calcmodus==CALC_TIP){var c=$("#tipfield").val().trim();if(c==""){c=0}else{c=parseFloat(c.replace(decpoint,"."))}i=f-(b+c)}else{var a=$("#tipfield").val().trim();if(a==""){i="NaN"}else{a=parseFloat(a.replace(decpoint,"."));i=f-a}}if($.isNumeric(parseFloat(i))){var h=i.toFixed(2).replace(".",decpoint);$("#topayback").html(h)}else{$("#topayback").html("?")}}catch(g){$("#topayback").html("?")}}function setCalcModusBtn(){if(calcmodus==CALC_TOTAL){$("#calcmodus").html("-&gt; "+CALC_TIP_TXT[lang]);$("#tiptxt").html(P_TOTAL_INCL_TIP[lang])}else{$("#calcmodus").html("-&gt; "+CALC_TOTAL_TXT[lang]);$("#tiptxt").html(P_TIP[lang])}}function startPayProcess(n,c,l,p,g){checkForLogIn();var a="";for(var k=0;k<prodsOnReceiptList.length;k++){var r=prodsOnReceiptList[k];var f=r.id;a+=f+","}var b=' style="table-layout: fixed; width: 70%; background-color: #cccccc;" ';var h="<table "+b+">"+$("#info-page").data("receipthtml")+"</table>";var e=$("#info-page").data("escposheader");var o=$("#info-page").data("escposprods");var m=$("#info-page").data("escposfooter");var q=new Array(e,o,m,$("#info-page").data("hosting"));$.ajax({type:"POST",dataType:"json",data:{ids:a,brutto:billbrutto,netto:billnetto,tableid:c,paymentid:p,tax:g,decpoint:decpoint,declareready:cameFromOrdering,host:$("#info-page").data("hosting")},url:"php/contenthandler.php?module=queue&command=declarePaidCreateBillReturnBillId",async:false,success:function(v){var t=v.status;var u=v.msg;if(t!="ERROR"){billid=u.billid;billdate=u.date;if(billid<0){alert("Error! Bitte erneut versuchen. Error code: "+billid);window.location.reload(false)}else{var x=$("#info-page").data("billlanguage");$("#billid").html(P_ID[x]+billid);$("#billdate").html(billdate);if(n){var y='<table width=100% style="table-layout: fixed;font-size:'+receiptfontsize+'px;">'+$("#receiptpart").html()+"</table>";var s=$("#info-page").data("payPrintType");if(s=="s"){printBill(billid)}else{$("#oben").hide();var w="<table>"+$(".receipttable").html()+"</table>";printContent(w)}}prodsOnReceiptList=[];getProdsToPayForTable(c,l);var i=$("#oben li").size()-2;if(i>0){}else{setTimeout(function(){document.location.href="paydesk.html"},500)}}}else{alert("Fehler: "+u)}},error:function(i){alert("Sorry, there was a problem! "+i)}})}function printBill(a){doAjax("POST","php/contenthandler.php?module=printqueue&command=queueReceiptPrintJob",{billid:a},null,"Druckfehler")}function bindHostButton(){$("#hostbutton").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();var a=$("#info-page").data("billlanguage");if(a==0){var c=$("#info-page").data("hosting");if(c=="0"){$("#info-page").data("hosting","1")}else{$("#info-page").data("hosting","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 cashactions(){$(".cashaction").off("click").on("click",function(a){var b=$(this).attr("id");if(b=="cashtakeout"){startCashTakeOutProcess()}else{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"),".");if(isNaN(a)){alert("Keine Zahl!")}else{if((parseFloat(a)>=0)&&(parseFloat(a)<=10000)){doCashInsert(a)}else{alert("Betrag muss positiv und kleiner als 10000 sein!")}}});$.mobile.changePage("#cashinsertdialog")}function startCashTakeOutProcess(){$("#cashtakeoutdialog .sure-do").off("click").on("click",function(){$.mobile.changePage("#info-page");var a=$("#moneyToTakeOut").val().replace(decpoint,".");if(isNaN(a)){alert("Keine Zahl!")}else{if((parseFloat(a)>=0)&&(parseFloat(a)<=10000)){doCashTakeOut(a)}else{alert("Betrag muss positiv und kleiner als 10000 sein!")}}});$.mobile.changePage("#cashtakeoutdialog")}function doCashInsert(a){doAjax("POST","php/contenthandler.php?module=bill&command=doCashAction",{money:a},handleCashActionResult,"Fehler Kassenaktion")}function doCashTakeOut(a){a=0-parseFloat(a);doAjax("POST","php/contenthandler.php?module=bill&command=doCashAction",{money:a},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.code+": "+a.msg)}else{if(a.status=="OK"){alert(P_CASHACTION_OK[lang])}}}function showCashOverview(a){$("#cashbyguests").html((parseFloat(a.guestmoney).toFixed(2)).replace(".",decpoint));$("#cashtotal").html((parseFloat(a.total).toFixed(2)).replace(".",decpoint));$.mobile.changePage("#cashoverviewinfo")}function startDisplayProcess(){var b=location.search;if(b.length==0){displayAllRooms()}else{var a=b.slice(1);var e=a.split("=");if(e.length!=2){displayAllRooms()}var c=e[1];cameFromOrdering=1;$("#cashactions").hide();$("#navactions").hide();$.ajax({type:"GET",url:"php/contenthandler.php?module=queue&command=getJsonTableNameFromId",dataType:"json",data:{tableid:c},async:false,success:function(f){$("#info-page").data("tid",c);$("#info-page").data("tablename",f);getProdsToPayForTable(c,f)},error:function(f){alert("Kommunikationsfehler zum Server bei Tischnamenabfrage: "+errorMsg)}})}}$(document).on("pageinit","#info-page",function(){initializeMainMenu("#modulemenu");hideMenu();getGeneralConfigItems();$("#info-page").data("taxtype","normal");getButtonSizes();getPayments();$("#hostingtablepart").hide();$("#info-page").data("hosting","0");bindHostButton();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,#untenarea,#payWithoutPrint,#paybuttongroup,#hostbuttongroup {display: none;}
}
</style>
<div data-role="page" id="info-page">
<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">Module</li>
</ul>
</div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="theheader">
<h1><span id="paydesktitle">Kasse</span></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">Module</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="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">
<a href="#" data-role="button" data-theme="b" data-icon="check" 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">
<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">
<h3><span id="payway">Zahlungsart</span></h3>
<p>
<div>
<form>
<table style="border: 1px solid black;">
<tr>
<td><span id=topaytxt>Zahlen: </span><td><i><b><span id=topayval>0,00</span></b></i>
<td>&nbsp;<td><span id=haspaidtxt>Bezahlt: </span><td style="width:30px;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>&nbsp;<td><span id=tiptxt>Trinkg.: </span><td style="width:30px;color:yellow;"><input type="text" id="tipfield" value="" data-mini="true" placeholder="" />
</tr>
<tr>
<td colspan=4><button id="calcreturnbtn" type="submit" data-theme="b"><span id="calcreturn">Berechne</span></button>
<td><button id="calcmodusbtn" type="submit" data-theme="c" style="width:200px;"><span id="calcmodus">Trinkgeld</span></button>
</tr>
</table>
</form>
</div>
</p>
<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>
<!-- 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>
<label for="moneyToInsert"><span id="amounttxt">Betrag:</span></label>
<input type="text" id="moneyToInsert" value="" data-mini="true">
<div id=paymentlistcash>
<a href="#" class="sure-do" data-role="button" data-theme="b" data-rel="back"><span id="putinact">Einlegen</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>
<!-- Dialog page for cash insert -->
<div data-role="dialog" id="cashtakeoutdialog" data-title="Kassenaktion">
<div data-role="content">
<h3><span id="cashtakeouttxt">Barentnahme aus der Kasse</span></h3>
<label for="moneyToTakeOut"><span id="amounttxt2">Betrag:</span></label>
<input type="text" id="moneyToTakeOut" value="" data-mini="true">
<div id=paymentlist>
<a href="#" class="sure-do" data-role="button" data-theme="b" data-rel="back"><span id="takeoutact">Entnehmen</span></a>
<a href="#" data-role="button" data-theme="d" data-rel="back" id="cash_takeout_cancel">Abbruch</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> <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>
<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>