223 lines
58 KiB
HTML
223 lines
58 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.3.23">
|
|
<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>
|
|
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 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;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)}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();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(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,""").replace(/</g,"<").replace(/>/g,">"))}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)}}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 getMillis(){var a=new Date();var b=a.getTime();return b}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,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> </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> <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> <br>";l+=toHtml(a).replace(/(?:\r\n|\r|\n)/g,"<br />");l+="</center></tr>";return l}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(t,e,r,g,p,n,q,s){var m='<table id="receiptpart" class="receipttable" border=1 style="table-layout: fixed;">';var i=r.billoverallinfo;var a=r.products;var f=i.username;var o=i.table;var l=genCreateReceiptHeader(t,e,o,f,g,s);var b=generateProdPartByDbContent(p,a);var c=parseFloat(i.brutto);var k=createReceiptFooterFromDbTaxes(t,n,c,r.taxes,p);var h=m+l+b+k;if(i.host==1){h+=q}h+="</table>";return h}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.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_ALL=["Alles","All","Todo"];var P_CONTENT_RECEIPT=["Inhalt Kassenbon","Content of receipt","Contenido del tique"];var P_ONLY_PAY=["Nur Zahlung","Only pay","Solo pagar"];var P_PAY_PRINT=["Bondruck","Pay+Print","Pagar+Imprimir"];var P_CHANGE_CALC=["Wechselgeldrechner:","Change Calculator:","Calculadora de Cambio:"];var P_CHOOSE_PAYWAY=["Auswahl der Zahlungsart:","Selection of method of payment:","Selección del modo de pago:"];var P_CANCEL=["Abbrechen","Cancel","Cancelar"];var P_CASHTAKEOUT=["Barentnahme aus der Kasse","Cash take-out","Sacar dinero"];var P_CASHTAKIN=["Bareinlage in die Kasse","Cash insert","Insertar dinero"];var P_AMOUNT=["Betrag:","Amount:","Valor:"];var P_OVERVIEW=["Übersicht Kellnerkasse","Overview waiter purse","Resumen cartera de bolsillo"];var P_PUT_IN=["Einlegen","Insert","Insertar"];var P_TAKE_OUT=["Entnehmen","Take out","Sacar"];var P_OVERV_DETAILS=["Diese Übersicht zeigt die Einnahmen durch den Kellner pro Zahlungsweg seit der letzten Tageslosung sowie als weiteren Wert den Kassenstand unter Berücksichtigung der eigenen Eingaben und Entnahmen.","This overview contains the amount of money of this waiter since the last closing as well as the total amount of money including the own cash insert and take-out actions.","Este resumen contiene todo el dinero del camarero, y también el dinero incluido con acciones de insertar y sacar."];var P_CASH_SUM=["Bewirtungseinnahmen (ohne Ein-/Auslagen):","Cash by payment (without inserts/take-outs):","Cobro (sin tomas/entradas):"];var P_INCLUDE_OWN=["<b>Bar</b>bestand inkl. eigener Kassen-Eingaben/Entnahmen:","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 showHostTemplate=false;var guests=[];var internalguests=[];var hotelinterface=0;var PAYMENT_HS3=7;var PAYMENT_GUEST=8;var currentPaymentId=7;var showpayment2=1;var showpayment3=1;var showpayment4=1;var showpayment5=1;var showpayment6=1;var showpayment7=1;var showpayment8=1;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;showpayment2=a.showpayment2;showpayment3=a.showpayment3;showpayment4=a.showpayment4;showpayment5=a.showpayment5;showpayment6=a.showpayment6;showpayment7=a.showpayment7;showpayment8=a.showpayment8;$("#curtopay2").html(" "+a.currency);workflowconfig=a.workflowconfig;digigopaysetready=a.digigopaysetready;setLanguage(a.userlanguage)}else{$("#contentpart").hide();setTimeout(function(){document.location.href="index.html"},250)}}function addEntryOrIncreaseCount(a,f){var c=0;var g=false;var e=f.prodid+"-"+f.extras.join("_")+f.price+"-"+f.pricelevelname+"#"+f.tax+"_"+f.togo;for(c=0;c<a.length;c++){var b=a[c];if(b[2]==e){b[0]+=1;g=true}}if(!g){a.push(new Array(1,f,e))}return a}function genCreateReceiptHeader(b,e,h,f,k,l){var a='style="border: solid black 0px;padding: 3px;text-align:right;vertical-align:bottom;"';var i=P_TABLE[b]+" "+h;var c=P_WAITER[b]+" "+f;var g="";g+="<tr><td colspan=6> </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,n,f){var b='style="border: solid black 0px;padding: 3px;text-align:right;vertical-align:bottom;"';var h='style="border: solid black 0px;padding: 3px;text-align:center;vertical-align:bottom;"';var c=(parseFloat(i)).toFixed(2).replace(".",n);if(a!="A"){g+=" ("+a+")"}if(f==1){g="To-Go: "+g}var m=k*i;var l="<tr>";var e='style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;width: 60%;"';l+="<td "+h+' id="count">'+k+"<td colspan=3 "+e+">"+g;l=l+"<td "+b+">"+c;l+="<td "+b+">"+m.toFixed(2).replace(".",n)+"</tr>";return l}function generateProdPartByDbContent(f,e){var c=0;tablecontent="";for(c=0;c<e.length;c++){var b=e[c];var h=b.count;var i=b.productname;var g=b.price;var a=b.pricelevel;tablecontent+=generateOneProdLine(h,i,g,a,f)}return tablecontent}function listTaxes(b,f){var a=[];for(var c=0;c<b.length;c++){var e=parseFloat(String(b[c]));e=e.toFixed(2).replace(".",f);if(a.indexOf(e)<0){a[a.length]=e}}return a}function listTaxesBasedOnUntenList(e){var b=[];for(var c=0;c<prodsOnReceiptList.length;c++){var a=prodsOnReceiptList[c];b.push(a.tax)}return listTaxes(b,e)}function calcSum(){var f=listTaxesBasedOnUntenList(decpoint);var n=prodsToPayList;var e=0;var h=[];var c=[];var m=[];for(var v=0;v<f.length;v++){h[v]=0;c[v]=0;m[v]=0}var r=0;var q=0;var l=0;for(var s=0;s<prodsOnReceiptList.length;s++){var w=prodsOnReceiptList[s];var o=parseFloat(w.price);var x=w.tax;var p=parseFloat(x);x=x.replace(".",decpoint);var g=o/(1+p/100);var u=o-g;var b=0;for(var v=0;v<f.length;v++){if(f[v]==x){b=v}}h[b]=h[b]+g;c[b]=c[b]+o;m[b]=m[b]+u;r+=g;q+=o;l+=u}for(var t=0;t<f.length;t++){var p=f[t];var a=p.replace(",","-");$("#taxval"+a).html(p+"%");$("#mwst"+a).html(m[t].toFixed(2).replace(".",decpoint));$("#netto"+a).html(h[t].toFixed(2).replace(".",decpoint));$("#brutto"+a).html(c[t].toFixed(2).replace(".",decpoint))}billbrutto=q;billnetto=r;$("#priceinreceipt").html(q.toFixed(2).replace(".",decpoint)+" "+currency);$("#priceinreceipt2").html(q.toFixed(2).replace(".",decpoint)+" "+currency)}function bindCashButton(){$("#cashbutton").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();$("#cashdlg").dialog({autoOpen:false,modal:true,height:520,width:500,buttons:{Abbrechen:function(){$(this).dialog("close")},Einlegen:function(){cashOperation("in")},Entnehmen:function(){cashOperation("out")}}});$("#includeowncash").html(P_INCLUDE_OWN[lang]);$("#cashmoney").val("");$("#cashremark").val("");$("#cashdlg").dialog("open");doAjax("POST","php/contenthandler.php?module=bill&command=getCashOverviewOfUser",null,insertCashValues,"Fehler Kassenaktion");$(".ui-dialog-buttonset .ui-button").css("font-weight","bold");$(".ui-dialog-buttonset .ui-button").css("color","black");$(".ui-dialog-buttonset .ui-button:nth-child(2)").css("background-color","#e0e0d1");$(".ui-dialog-buttonset .ui-button:nth-child(2)").css("background-color","#ccff99");$(".ui-dialog-buttonset .ui-button:nth-child(3)").css("background-color","#ffcc99")})}function insertCashValues(b){var a=generateCashOverviewOfUser(b.cashperpayments);$("#cashbyguests").html(a);$("#cashtotal").html((parseFloat(b.total).toFixed(2)).replace(".",decpoint))}function cashOperation(b){var a=$("#cashmoney").val().replace(",",".");if(isNaN(a)){alert("Keine Zahl!")}else{$("#cashdlg").dialog("close");var c=$("#cashremark").val();if(b==="out"){a=0-parseFloat(a)}doAjax("POST","php/contenthandler.php?module=bill&command=doCashAction",{money:a,remark:c},handleCashActionResult,"Fehler Kassenaktion")}}function handleCashActionResult(a){if(a.status=="ERROR"){alert("Fehler "+a.code+": "+a.msg)}else{if(a.status=="OK"){alert(P_CASHACTION_OK[lang])}}}function bindHostButton(a){$("#hostbutton").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();if(showHostTemplate){showHostTemplate=false}else{showHostTemplate=true}if(a!=null){$(a).removeClass("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><br>"}return a}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]);$("#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]);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;doAjax("GET","php/contenthandler.php?module=admin&command=getPreferimgmobile",null,fillPreferimgmobile,null)}function fillPreferimgmobile(a){preferimgmobile=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(){$("#payWithoutPrint").show();$("#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){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){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();prodsToPayList=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 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 generateProdListItem(e,g,a,f,b,c){var k=getProdSizeClass();var h='<li data-theme="'+e+'" data-icon="'+g+'">';h+='<a href="#" id="'+a+'" class="info-go '+k+" "+b+'">';if(preferimgmobile==1){var i="php/contenthandler.php?module=products&command=getprodimage&prodid="+c+"&size=l";h+='<img src="'+i+'" class="centermobileimg" />'}h+=f+"</a></li>";return h}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=generateProdListItem("c","plus","payable_"+b.id,a+createHashOfPayableItem(b),"payable",b.prodid);return c}function createOnReceiptItemListElement(b){var a="";if("count" in b){if(b.count>1){a=b.count+"x "}}var c=generateProdListItem("c","plus","payable_"+b.id,a+createHashOfPayableItem(b),"onreceipt",b.prodid);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> <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",async:false,success:function(i){$("#receiptpart").html(k+i);calcSum()},error:function(i){alert("Kommunikationsfehler zum Server: ")},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();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");$("#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 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()});$("#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("-> "+CALC_TIP_TXT[lang]);$("#tiptxt").html(P_TOTAL_INCL_TIP[lang])}else{$("#calcmodus").html("-> "+CALC_TOTAL_TXT[lang]);$("#tiptxt").html(P_TIP[lang])}}function startPayProcess(m,b,k,o,f,l,n,g){checkForLogIn();var a="";if(l==undefined){l=""}for(var h=0;h<prodsOnReceiptList.length;h++){var p=prodsOnReceiptList[h];var c=p.id;a+=c+","}var e=cameFromOrdering;if(cameFromOrdering==1){if(workflowconfig==1){e=digigopaysetready}}$.ajax({type:"POST",dataType:"json",data:{ids:a,tableid:b,paymentid:o,declareready:e,host:(showHostTemplate?1:0),reservationid:l,guestinfo:n,intguestid:g},url:"php/contenthandler.php?module=queue&command=declarePaidCreateBillReturnBillId",async:false,success:function(t){showHostTemplate=false;var r=t.status;var s=t.msg;if(r!="ERROR"){billid=s.billid;billdate=s.date;if(billid<0){alert("Error! Bitte erneut versuchen. Error code: "+billid);window.location.reload(false)}else{var v=$("#info-page").data("billlanguage");$("#billid").html(P_ID[v]+billid);$("#billdate").html(billdate);if(m){var w='<table width=100% style="table-layout: fixed;font-size:'+receiptfontsize+'px;">'+$("#receiptpart").html()+"</table>";var q=$("#info-page").data("payPrintType");if(q=="s"){printBill(billid)}else{$("#oben").hide();var u="<table>"+$(".receipttable").html()+"</table>";printContent(u)}}prodsOnReceiptList=[];getProdsToPayForTable(b,k);var i=$("#oben li").size()-2;if(i>0){}else{if(cameFromOrdering==1){goToUrl("waiter.html")}else{goToUrl("paydesk.html")}}}}else{alert("Fehler: "+s)}},error:function(i){alert("Sorry, there was a problem! "+i)}})}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=="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"),".");var b=$("#remarkin").val();if(isNaN(a)){alert("Keine Zahl!")}else{if((parseFloat(a)>=0)&&(parseFloat(a)<=10000)){doCashInsert(a,b)}else{alert("Betrag muss positiv und kleiner als 10000 sein!")}}});$.mobile.changePage("#cashinsertdialog");removeInputValsCashIn()}function removeInputValsCashOut(){setTimeout(function(){$("#moneyToTakeOut").val("");$("#remarkout").val("")},1000)}function removeInputValsCashIn(){setTimeout(function(){$("#moneyToInsert").val("");$("#remarkin").val("")},1000)}function startCashTakeOutProcess(){$("#cashtakeoutdialog .sure-do").off("click").on("click",function(){$.mobile.changePage("#info-page");var a=$("#moneyToTakeOut").val().replace(decpoint,".");var b=$("#remarkout").val();if(isNaN(a)){alert("Keine Zahl!")}else{if((parseFloat(a)>=0)&&(parseFloat(a)<=10000)){doCashTakeOut(a,b)}else{alert("Betrag muss positiv und kleiner als 10000 sein!")}}});$.mobile.changePage("#cashtakeoutdialog");removeInputValsCashOut()}function doCashInsert(a,b){doAjax("POST","php/contenthandler.php?module=bill&command=doCashAction",{money:a,remark:b},handleCashActionResult,"Fehler Kassenaktion")}function doCashTakeOut(a,b){a=0-parseFloat(a);doAjax("POST","php/contenthandler.php?module=bill&command=doCashAction",{money:a,remark: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.code+": "+a.msg)}else{if(a.status=="OK"){alert(P_CASHACTION_OK[lang])}}}function showCashOverview(b){var a=generateCashOverviewOfUser(b.cashperpayments);$("#cashbyguests").html(a);$("#cashtotal").html((parseFloat(b.total).toFixed(2)).replace(".",decpoint));$.mobile.changePage("#cashoverviewinfo")}function startDisplayProcess(){var 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)}})}}$(document).on("pageinit","#info-page",function(){initializeMainMenu("#modulemenu");hideMenu();getGeneralConfigItems();$("#info-page").data("taxtype","normal");getButtonSizes();getPayments(insertPayments);$("#hostingtablepart").hide();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,#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">Hauptmenü</li>
|
|
</ul>
|
|
</div><!-- /panel -->
|
|
<div data-role="header" data-theme="b" data-position="fixed" id="theheader">
|
|
<h1><span id="paydesktitle">Kasse</span> <img src="img/printerstatus.png" class="printerstatus" 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="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="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">
|
|
<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>
|
|
<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> <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> <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>
|
|
</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">
|
|
<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>
|
|
<input type="text" id="remarkout" value="" data-mini="true" placeholder="Bemerkung">
|
|
<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>
|
|
<p><span id=cashbyguests></span></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> |