532 lines
31 KiB
HTML
532 lines
31 KiB
HTML
<html>
|
|
<head>
|
|
<title>Ansicht Kassenbons</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.2.19">
|
|
|
|
<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" />
|
|
|
|
<link rel="stylesheet" href="php/3rdparty/jquerymobiledatepicker/jquery.mobile.datepicker.css" />
|
|
<script src="php/3rdparty/jquerymobiledatepicker/jquery.mobile.datepicker.js"></script>
|
|
|
|
<script src="php/3rdparty/jquery-1.11.3.min.js"></script>
|
|
<script src="php/3rdparty/jquery.mobile-1.4.5.min.js"></script>
|
|
|
|
<link rel="stylesheet" href="php/3rdparty/jqueryui1-11-4/jquery-ui.min.css" />
|
|
<script src="php/3rdparty/jqueryui1-11-4/jquery-ui.min.js"></script>
|
|
<script src="php/3rdparty/jqueryui1-11-4/jquery-ui-i18n.min.js"></script>
|
|
<script src="utilities.js"></script>
|
|
<script src="receiptutils.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 P_GUESTS=["Gäste","Guests","Habitaciones"];var showHostTemplate=false;var guests=[];var hotelinterface=0;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 d=a.tax;var c=d.replace(".",decpoint);$("#info-page").data("usstGerVal",c);$("#info-page").data("usst",d);d=a.togotax;c=d.replace(".",decpoint);$("#info-page").data("togoTaxGerVal",c);$("#info-page").data("togotax",d);$("#info-page").data("companyinfo",a.companyinfo);$("#info-page").data("payPrintType",a.payprinttype);$("#info-page").data("currency",a.currency);$("#info-page").data("billlanguage",a.billlanguage);$("#info-page").data("userlanguage",a.userlanguage);receiptfontsize=parseInt(a.receiptfontsize);$("#receiptpart").css("font-size",receiptfontsize+"px");paymentconfig=a.paymentconfig;$("#curtopay2").html(" "+a.currency);workflowconfig=a.workflowconfig;digigopaysetready=a.digigopaysetready;setLanguage(a.userlanguage)}else{$("#contentpart").hide();setTimeout(function(){document.location.href="index.html"},250)}}function addEntryOrIncreaseCount(a,e){var c=0;var f=false;var d=e.prodid+"-"+e.extras.join("_")+e.price+"-"+e.pricelevelname+"#"+e.tax+"_"+e.togo;for(c=0;c<a.length;c++){var b=a[c];if(b[2]==d){b[0]+=1;f=true}}if(!f){a.push(new Array(1,e,d))}return a}function genCreateReceiptHeader(b,d,g,e,i,j){var a='style="border: solid black 0px;padding: 3px;text-align:right;vertical-align:bottom;"';var h=P_TABLE[b]+" "+g;var c=P_WAITER[b]+" "+e;var f="";f+="<tr><td colspan=6> </tr>";f+="<tr><td colspan=4>"+h+' <td id="billid" colspan=2 '+a+">ID:"+d+"</tr>";f+='<tr><td colspan=4> <td id="billdate" colspan=2 '+a+"></tr>";f+="<tr><td colspan=6>"+c+"</tr>";f+="<tr><td colspan=6> </tr>";if(j!=""){f+="<tr><td colspan=6>Gast: "+toHtml(j)+"</tr>";f+="<tr><td colspan=6> </tr>"}f+="<tr><td>"+P_NO[b]+"<td colspan=3>"+P_DESCR[b]+"<td "+a+">"+P_PRICE[b]+"<td "+a+">"+P_TOTAL[b]+"</tr>";return f}function genCreateReceiptFooterNoSum(c,d,b,a){return genCreateReceiptFooter(c,d,b,"","","",a)}function genCreateReceiptFooter(a,e,b,h,d,k,l){var c='style="border: solid black 0px;padding: 3px;text-align:right;vertical-align:bottom;"';var n='style="text-align:center;vertical-align:bottom;"';var g="<tr><td colspan=6> </tr>";var m=g;m+="<tr><td colspan=2>"+P_MWST[e]+"% <td "+c+">"+P_MWST[e]+"<td "+c+">"+P_NETTO[e]+"<td "+c+" colspan=2>"+P_BRUTTO[e]+"</tr>";for(var j=0;j<l.length;j++){var f=l[j];f=f.replace(",","-");m+='<tr><td id="taxval'+f+'" colspan=2><td id="mwst'+f+'" '+c+">"+h+'<td id="netto'+f+'" '+c+">"+d+'<td id="brutto'+f+'" '+c+" colspan=2>"+k+"</tr>"}m+=g;m+="<tr><td> <td colspan=3>"+P_SUM[e]+'<td id="priceinreceipt2" '+c+" colspan=2>"+k+"</td></tr>";m+=g;m+="<tr><td "+n+" colspan=6><center> <br>";m+=toHtml(b).replace(/(?:\r\n|\r|\n)/g,"<br />");m+="</center></tr>";return m}function generateOneProdLine(i,f,h,a,l,e){var b='style="border: solid black 0px;padding: 3px;text-align:right;vertical-align:bottom;"';var g='style="border: solid black 0px;padding: 3px;text-align:center;vertical-align:bottom;"';var c=(parseFloat(h)).toFixed(2).replace(".",l);if(a!="A"){f+=" ("+a+")"}if(e==1){f="To-Go: "+f}var k=i*h;var j="<tr>";var d='style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;width: 60%;"';j+="<td "+g+' id="count">'+i+"<td colspan=3 "+d+">"+f;j=j+"<td "+b+">"+c;j+="<td "+b+">"+k.toFixed(2).replace(".",l)+"</tr>";return j}function generateProdPartByDbContent(e,d){var c=0;tablecontent="";for(c=0;c<d.length;c++){var b=d[c];var g=b.count;var h=b.productname;var f=b.price;var a=b.pricelevel;tablecontent+=generateOneProdLine(g,h,f,a,e)}return tablecontent}function listTaxes(b,e){var a=[];for(var c=0;c<b.length;c++){var d=parseFloat(String(b[c]));d=d.toFixed(2).replace(".",e);if(a.indexOf(d)<0){a[a.length]=d}}return a}function listTaxesBasedOnUntenList(d){var b=[];for(var c=0;c<prodsOnReceiptList.length;c++){var a=prodsOnReceiptList[c];b.push(a.tax)}return listTaxes(b,d)}function calcSum(){var e=listTaxesBasedOnUntenList(decpoint);var m=prodsToPayList;var d=0;var g=[];var c=[];var l=[];for(var u=0;u<e.length;u++){g[u]=0;c[u]=0;l[u]=0}var q=0;var p=0;var h=0;for(var r=0;r<prodsOnReceiptList.length;r++){var v=prodsOnReceiptList[r];var n=parseFloat(v.price);var w=v.tax;var o=parseFloat(w);w=w.replace(".",decpoint);var f=n/(1+o/100);var t=n-f;var b=0;for(var u=0;u<e.length;u++){if(e[u]==w){b=u}}g[b]=g[b]+f;c[b]=c[b]+n;l[b]=l[b]+t;q+=f;p+=n;h+=t}for(var s=0;s<e.length;s++){var o=e[s];var a=o.replace(",","-");$("#taxval"+a).html(o+"%");$("#mwst"+a).html(l[s].toFixed(2).replace(".",decpoint));$("#netto"+a).html(g[s].toFixed(2).replace(".",decpoint));$("#brutto"+a).html(c[s].toFixed(2).replace(".",decpoint))}billbrutto=p;billnetto=q;$("#priceinreceipt").html(p.toFixed(2).replace(".",decpoint)+" "+currency);$("#priceinreceipt2").html(p.toFixed(2).replace(".",decpoint)+" "+currency)}function bindCashButton(){$("#cashbutton").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();$("#cashdlg").dialog({autoOpen:false,modal:true,height:470,width:500,buttons:{Abbrechen:function(){$(this).dialog("close")},Einlegen:function(){cashOperation("in")},Entnehmen:function(){cashOperation("out")}}});$("#cashmoney").val("");$("#cashremark").val("");$("#cashdlg").dialog("open");doAjax("POST","php/contenthandler.php?module=bill&command=getCashOverviewOfUser",null,insertCashValues,"Fehler Kassenaktion");$(".ui-dialog-buttonset .ui-button").css("font-weight","bold");$(".ui-dialog-buttonset .ui-button").css("color","black");$(".ui-dialog-buttonset .ui-button:nth-child(2)").css("background-color","#e0e0d1");$(".ui-dialog-buttonset .ui-button:nth-child(2)").css("background-color","#ccff99");$(".ui-dialog-buttonset .ui-button:nth-child(3)").css("background-color","#ffcc99")})}function insertCashValues(a){$("#cashbyguests").html((parseFloat(a.guestmoney).toFixed(2)).replace(".",decpoint));$("#cashtotal").html((parseFloat(a.total).toFixed(2)).replace(".",decpoint))}function cashOperation(b){var a=$("#cashmoney").val().replace(",",".");if(isNaN(a)){alert("Keine Zahl!")}else{$("#cashdlg").dialog("close");var c=$("#cashremark").val();if(b==="out"){a=0-parseFloat(a)}doAjax("POST","php/contenthandler.php?module=bill&command=doCashAction",{money:a,remark:c},handleCashActionResult,"Fehler Kassenaktion")}}function handleCashActionResult(a){if(a.status=="ERROR"){alert("Fehler "+a.code+": "+a.msg)}else{if(a.status=="OK"){alert(P_CASHACTION_OK[lang])}}}function bindHostButton(a){$("#hostbutton").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();if(showHostTemplate){showHostTemplate=false}else{showHostTemplate=true}if(a!=null){$(a).removeClass("btnswitchon");$(a).removeClass("btnswitchoff");if(showHostTemplate){$(a).addClass("btnswitchon")}else{$(a).addClass("btnswitchoff")}}var b=$("#info-page").data("billlanguage");if(b==0){createAllEntriesInReceipt()}else{if(lang==0){alert("Bewirtungsbeleg steht nur für deutsche Kassenbons zur Verfügung.")}else{if(lang==1){alert("Bewirtungsbeleg is only possible for German receipts.")}else{if(lang==2){alert("Bewirtungsbeleg se puedo usar solo para tiques alemanes.")}}}}})}function printBill(a){doAjax("POST","php/contenthandler.php?module=printqueue&command=queueReceiptPrintJob",{billid:a,useaddrecprinter:1},null,"Druckfehler")}function generateGuestResult(d,a){$("#hotelroomfoundguest").html("");d=d.trim().toLowerCase();if(d==""){$("#hotelroomselection").html("");if(a){$("#hotelroomselection").selectmenu("refresh")}return}var c="";var b=false;var f=0;var e="";$.each(guests,function(k,l){var g=l.object;var m=l.guest;var h=(g.toLowerCase().indexOf(d)>=0);var j=(m.toLowerCase().indexOf(d)>=0);if(h||j){f++;e=toHtml(g+" - "+m);if(!b){b=true;c+='<option value="'+k+'" selected>'+toHtml(g+" - "+m)+"</option>"}else{c+='<option value="'+k+'" >'+toHtml(g+" - "+m)+"</option>"}}});if(f===1){$("#hotelroomfoundguest").html(e);$("#hotelroomselection").html(c)}else{$("#hotelroomselection").html(c)}if(a){$("#hotelroomselection").selectmenu("refresh")}};</script>
|
|
|
|
<style>
|
|
@media handheld
|
|
{
|
|
.receipttable {width: 100%; background-color: #cccccc;}
|
|
}
|
|
@media all
|
|
{
|
|
.receipttable {width: 100%; background-color: #cccccc;}
|
|
}
|
|
@media all
|
|
{
|
|
#colWithBillOverview { vertical-align:top;}
|
|
}
|
|
@media all
|
|
{
|
|
#receiptbill {display: none;}
|
|
}
|
|
@media print
|
|
{
|
|
.receipttable {width: 100%;};
|
|
}
|
|
@media print
|
|
{
|
|
#receiptbill {width: 100%; display: block;};
|
|
}
|
|
@media print
|
|
{
|
|
#theheader,#modulemenu,#billlist,#thefooterr,#updatebtn,#datepickerarea {display: none;}
|
|
}
|
|
</style>
|
|
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<script>
|
|
|
|
var BILL_TABLE = ["Tisch","Table","Mesa"];
|
|
var BILL_UPDATE = ["Aktualisieren","Update","Actualizar"];
|
|
var BILL_PRINT = ["Drucken","Print","Imprimir"];
|
|
var BILL_STORNO = ["Storno","Cancel","Contrapartida"];
|
|
var BILL_STORNO_AND_DELETE = ["Storno und Produkte löschen","Cancel and Remove Products","Contrapartida y removar productos"];
|
|
var BILL_CLOSED = ["abgeschlossen","closed","cerrado"];
|
|
var BILL_DO_HOST = ["Bewirtungsbeleg","Guest receipt","Tique de invitados"];
|
|
var BILL_UNDO_HOST = ["Rückgängig Bewirtungsbeleg","Undo guest receipt","No tique de invitados"];
|
|
var BILL_TITLE = ["Kassenbons","Receipts","Tiques"];
|
|
var BILL_YES = ["Ja","Yes","Si"];
|
|
var BILL_NO = ["Nein","No","No"];
|
|
var BILL_STORNO_QUEST_TITLE = ["Storno?","Cancel?","Contrapartida?"];
|
|
var BILL_STORNO_DEL_QUEST_TITLE = ["Storno und Bestellung entfernen?","Cancel and remove products?","Contraüartida y removar productos?"];
|
|
var BILL_STORNO_QUEST_TEXT = ["Bon stornieren und Artikel als unbezahlt im System lassen?","Cancel the receipt and leave productis as unpaid in the queue?","Contrapartida del tique y quedar productis en el systema?"];
|
|
var BILL_STORNO_DEL_QUEST_TEXT = ["Bon stornieren und Bestellung entfernen?","Cancel the receipt and remove the orders?","Contrapartida del tique y removar las ordenes"];
|
|
var BILL_NO_CANCEL_POSS = ["Der Stornovorgang ist fehlgeschlagen. Die wahrscheinlichste Ursache ist ein Tagesabschluss, der den zu stornierenden Bon einschließt. In diesem Fall darf der Bon rückwirkend nicht mehr annuliert werden.",
|
|
"Cancelling was not possible. Probably the receipt to cancel is already part of a closing. In this case the receipt cannot be cancelled.",
|
|
"Contrapartida no fue posible. Probablemente el tique esta ya cerrado."];
|
|
var BILL_DATE = ["Datum","Date","Fecha"];
|
|
var BILL_STORNO_REASON = ["Stornogrund","Reason","Razón"];
|
|
var BILL_TOGGLE_HOST = ["Der ursprüngliche Bon wurde storniert und mit geänderter Bewirtungseigenschaft neu angelegt. Er befindet sich an erster Stelle in der Bonliste.",
|
|
"Der original receipt was discarded and recreated with the changed guest receipt property. The new receipt is on top of the list",
|
|
"El tique original esta descartado y iniciado de nuevo en la forma modificada"];;
|
|
var BILL_WRONG_FORMAT = ["Falsches Zahlenformat","Wrong number format","Formato de precio incorecto"];
|
|
var BILL_FIRST_JOB = ["Erste Bon-ID","First job id","Id primero"];
|
|
var BILL_LAST_JOB = ["Letzte Bon-ID","Last job id","Id último"];
|
|
var BILL_BATCH = ["Stapelverarbeitung","Batch processing","Accion con muchos elementos"];
|
|
|
|
var lang = 0;
|
|
|
|
var when = 0;
|
|
|
|
var decpoint = ".";
|
|
|
|
var jsonBills = "";
|
|
|
|
function setLanguage(language) {
|
|
lang = language;
|
|
$("#updatebtntxt").html(BILL_UPDATE[lang]);
|
|
$("#billtitletxt").html(BILL_TITLE[lang]);
|
|
$("#stornoyes").html(BILL_YES[lang]);
|
|
$("#stornono").html(BILL_NO[lang]);
|
|
$("#billnocancelposs").html(BILL_NO_CANCEL_POSS[lang]);
|
|
$("#datetxt").html(BILL_DATE[lang]);
|
|
$("#stornoreasontxt").html(BILL_STORNO_REASON[lang]);
|
|
|
|
$("#printjobstxt").html(BILL_PRINT[lang]);
|
|
$("#fromjobidtxt").html(BILL_FIRST_JOB[lang]);
|
|
$("#tojobidtxt").html(BILL_LAST_JOB[lang]);
|
|
$("#batchheadertxt").html(BILL_BATCH[lang]);
|
|
|
|
var langtxt = "de";
|
|
if (lang == 1) {
|
|
langtxt = "en";
|
|
} else if (lang == 2) {
|
|
langtxt = "es";
|
|
}
|
|
|
|
var currentYear = new Date().getFullYear();
|
|
var yearRangeTxt = (currentYear-5) + ":" + (currentYear);
|
|
|
|
$("#datepicker").datepicker($.datepicker.regional[langtxt]).datepicker("option", {
|
|
changeMonth: true,
|
|
changeYear: true,
|
|
yearRange: yearRangeTxt,
|
|
});
|
|
|
|
$('#datepicker').datepicker('setDate', new Date());
|
|
}
|
|
|
|
function updatelistener() {
|
|
$("#updatebtn").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
getLastBills();
|
|
});
|
|
}
|
|
|
|
function batchjoblistener() {
|
|
$("#printjobsbtn").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
var start = $("#fromjobidfield").val();
|
|
var end = $("#tojobidfield").val();
|
|
|
|
if (!isInt(start) || !isInt(end)) {
|
|
alert(BILL_WRONG_FORMAT[lang]);
|
|
return;
|
|
}
|
|
doAjax("POST","php/contenthandler.php?module=printqueue&command=batchReceiptPrintJob",{start : start, end:end }, handleBatchResult, null);
|
|
});
|
|
}
|
|
|
|
function handleBatchResult(answer) {
|
|
if (answer.status != "OK") {
|
|
alert("Fehler " + answer.code + ": " + answer.msg);
|
|
} else {
|
|
$("#fromjobidfield").val("");
|
|
$("#tojobidfield").val("");
|
|
}
|
|
}
|
|
|
|
function getLastBills() {
|
|
var date = $("#datepicker").datepicker("getDate");
|
|
var data = {
|
|
day: date.getDate(),
|
|
month: (date.getMonth() + 1),
|
|
year: date.getFullYear(),
|
|
};
|
|
doAjax("GET","php/contenthandler.php?module=bill&command=getLastBillsWithContent",data,displayBillsWithContent,"letzte Bons");
|
|
}
|
|
|
|
function doAjaxCancelBill(billid,stornocode,reason) {
|
|
var data = {
|
|
billid: billid,
|
|
stornocode: stornocode,
|
|
reason:reason.trim(),
|
|
removeproducts: 0
|
|
};
|
|
doAjax("POST","php/contenthandler.php?module=bill&command=cancelBill",data,cancelBill,"Bonstorno abgebrochen");
|
|
}
|
|
|
|
function doAjaxCancelDeleteBill(billid,stornocode,reason) {
|
|
var data = {
|
|
billid: billid,
|
|
stornocode: stornocode,
|
|
reason:reason.trim(),
|
|
removeproducts: 1
|
|
};
|
|
doAjax("POST","php/contenthandler.php?module=bill&command=cancelBill",data,cancelBill,"Bonstorno abgebrochen");
|
|
}
|
|
function cancelBill(jsonText) {
|
|
if (jsonText.status != "OK") {
|
|
alert("Fehler " + jsonText.code + ": " + jsonText.msg);
|
|
return;
|
|
}
|
|
setTimeout(function(){location.reload()},1000);
|
|
}
|
|
|
|
function changeHostBill(jsonText) {
|
|
if (jsonText.status != "OK") {
|
|
alert("Fehler " + jsonText.code + ": " + jsonText.msg);
|
|
return;
|
|
}
|
|
alert(BILL_TOGGLE_HOST[lang]);
|
|
setTimeout(function(){location.reload()},1000);
|
|
}
|
|
|
|
function displayBillsWithContent (jsonContent) {
|
|
if (jsonContent.status != "OK") {
|
|
$("#billlist").html("");
|
|
$('#billlist').trigger('create');
|
|
alert("Fehler " + jsonContent.code + ": " + jsonContent.msg);
|
|
return;
|
|
}
|
|
|
|
jsonBills = jsonContent;
|
|
$("#billlist").html("");
|
|
var currency = $("#bill-page").data("currency");
|
|
var txt = "";
|
|
jsonContent = jsonContent.msg;
|
|
for (var i=0;i<jsonContent.length;i++) {
|
|
var entry = jsonContent[i];
|
|
var id = entry.id;
|
|
var shortdate = entry.shortdate;
|
|
var longdate = entry.longdate;
|
|
var tablename = entry.tablename;
|
|
var brutto = (entry.brutto).replace(".",decpoint);
|
|
|
|
var collapse_elem_id = 'collapse_' + id;
|
|
var collapse_elem = '<div data-role="collapsible" data-content-theme="e" id="'+collapse_elem_id+'" data-collapsed="true" data-theme="c" class="billcollapsible">';
|
|
var header = '<h3>'+shortdate + ": " + BILL_TABLE[lang] + " <" + tablename + "> " + brutto + ' ' + currency + '</h3>';
|
|
if (entry.isClosed == 1) {
|
|
header = '<h3>'+shortdate + ": " + BILL_TABLE[lang] + " <" + tablename + "> " + brutto + ' ' + currency + ' -' + BILL_CLOSED[lang] + '-</h3>';
|
|
}
|
|
var waitTxt = '<p><img src=php/3rdparty/images/ajax-loader.gif /></p>';
|
|
txt += collapse_elem + header + waitTxt + "</div>";
|
|
}
|
|
|
|
$("#billlist").html(txt);
|
|
$('#billlist').trigger('create');
|
|
|
|
$(".billcollapsible").off("collapsibleexpand").on("collapsibleexpand", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
var billid = this.id.split("_")[1];
|
|
var bill = getBillWithId(billid);
|
|
$("#collapse_" + billid + " p").html(bill[0]);
|
|
var entry = bill[2];
|
|
var date_time = bill[1];
|
|
var longdate = entry.longdate;
|
|
|
|
var printbuttonid = 'print_' + billid;
|
|
var cancelbuttonid = 'cancel_' + billid;
|
|
var canceldeletebuttonid = 'cancelanddelete_' + billid;
|
|
|
|
$("#collapse_" + billid).find("#billdate").html(date_time);
|
|
var contentToPrint = new Array(id,longdate,bill[0]);
|
|
$("#" + printbuttonid).data("entrydata", contentToPrint);
|
|
if (entry.isClosed == 0) {
|
|
$("#" + cancelbuttonid).data("billid", id);
|
|
$("#" + canceldeletebuttonid).data("billid", id);
|
|
}
|
|
|
|
$("#collapse_" + billid).trigger("create");
|
|
|
|
$(".printbuttons").off("click").on("click", function (e) {
|
|
var billid = this.id.split("_")[1];
|
|
var contentToPrint = $("#print_" + billid).data("entrydata");
|
|
$("#receiptbill").html(contentToPrint[2]);
|
|
$("#receiptbill table").css('width', '100%');
|
|
|
|
$("#receiptbill").find("#billdate").html(contentToPrint[1]);
|
|
$("#receiptbill").find("#billid").html(contentToPrint[0]);
|
|
var payPrintType = $("#bill-page").data("payPrintType");
|
|
if (payPrintType == 's') {
|
|
printBill(billid);
|
|
} else {
|
|
window.print();
|
|
}
|
|
});
|
|
|
|
$(".cancelbuttons").off("click").on("click", function (e) {
|
|
var billid = this.id.split("_")[1];
|
|
$("#stornocode").val("");
|
|
$("#stornoreason").val("");
|
|
areYouSure(BILL_STORNO_QUEST_TITLE[lang], BILL_STORNO_QUEST_TEXT[lang], BILL_YES[lang], function() {
|
|
doAjaxCancelBill(billid,$("#stornocode").val(),$("#stornoreason").val());
|
|
});
|
|
});
|
|
|
|
$(".canceldeletebuttons").off("click").on("click", function (e) {
|
|
var billid = this.id.split("_")[1];
|
|
$("#stornocode").val("");
|
|
$("#stornoreason").val("");
|
|
areYouSure(BILL_STORNO_DEL_QUEST_TITLE[lang], BILL_STORNO_DEL_QUEST_TEXT[lang], BILL_YES[lang], function() {
|
|
doAjaxCancelDeleteBill(billid,$("#stornocode").val(),$("#stornoreason").val());
|
|
});
|
|
});
|
|
|
|
$(".changehostbuttons").off("click").on("click", function (e) {
|
|
var billid = this.id.split("_")[1];
|
|
var isNowHost = this.id.split("_")[2];
|
|
$("#stornocode").val("");
|
|
$("#stornoreason").val("");
|
|
|
|
var data = {
|
|
billid: billid,
|
|
isNowHost: isNowHost
|
|
};
|
|
doAjax("POST","php/contenthandler.php?module=bill&command=changeBillHost",data,changeHostBill,"Bonänderung abgebrochen");
|
|
});
|
|
});
|
|
}
|
|
|
|
|
|
function getBillWithId(id) {
|
|
var logoUrl = $("#bill-page").data("logourl");
|
|
var companyInfo = $("#bill-page").data("companyinfo");
|
|
var currency = $("#bill-page").data("currency");
|
|
|
|
var hosthtml = jsonBills.hosthtml;
|
|
var bills = jsonBills.msg;
|
|
|
|
// get entry with that billid
|
|
var entry = null;
|
|
for (var i=0;i<bills.length;i++) {
|
|
if (bills[i].id == id) {
|
|
entry = bills[i];
|
|
break
|
|
}
|
|
}
|
|
|
|
if (entry == null) {
|
|
alert("ERROR - Rechnung mit ID " + id + " konnte nicht gefunden werden");
|
|
return;
|
|
}
|
|
var content = generateHtmlBillFromScratch(lang,id,entry.billcontent,currency,decpoint,companyInfo,hosthtml,entry.billcontent.billoverallinfo.guestinfo);
|
|
|
|
var printbuttonid = 'print_' + id;
|
|
var cancelbuttonid = 'cancel_' + id;
|
|
var canceldeletebuttonid = 'cancelanddelete_' + id;
|
|
var changehostbuttonid = 'changehost_' + id + "_" + entry.host;
|
|
var collapse_elem_id = 'collapse_' + id;
|
|
|
|
var printbutton = '<a href="#" data-role="button" id="' + printbuttonid + '" data-theme="f" class="printbuttons">' + BILL_PRINT[lang] + '</a>';
|
|
var cancelButton = '<a href="#" data-role="button" id="' + cancelbuttonid + '" data-theme="f" class="cancelbuttons">' + BILL_STORNO[lang] + '</a>';
|
|
var cancelAndDeleteButton = '<a href="#" data-role="button" id="' + canceldeletebuttonid + '" data-theme="f" class="canceldeletebuttons">' + BILL_STORNO_AND_DELETE[lang] + '</a>';
|
|
var toggleHostTxt = BILL_DO_HOST[lang];
|
|
if (entry.host == 1) {
|
|
toggleHostTxt = BILL_UNDO_HOST[lang];
|
|
}
|
|
var changehostbutton = '<a href="#" data-role="button" id="' + changehostbuttonid + '" data-theme="f" class="changehostbuttons">' + toggleHostTxt + '</a>';
|
|
|
|
var bi = entry.billcontent.billoverallinfo;
|
|
var date_time = bi.billday + "." + bi.billmonth + "." + bi.billyear + " " + bi.billhour + ":" + bi.billmin;
|
|
|
|
var txt = '<center>' + printbutton;
|
|
if (entry.isClosed == 0) {
|
|
txt += cancelButton + cancelAndDeleteButton + changehostbutton + '<br>' + content + '</center>';
|
|
} else {
|
|
txt += '<p><center>' + '<br>' + content + '</center>';
|
|
}
|
|
|
|
return [txt,date_time,entry];
|
|
}
|
|
|
|
|
|
function printBill(billid) {
|
|
doAjax("POST","php/contenthandler.php?module=printqueue&command=queueReceiptPrintJob",
|
|
{billid : billid , useaddrecprinter: 0}, null, "Druckfehler");
|
|
}
|
|
|
|
function areYouSure(text1, text2, button, callback) {
|
|
$("#sure .sure-1").text(text1);
|
|
$("#sure .sure-2").text(text2);
|
|
$("#sure .sure-do").text(button).off("click.sure").on("click.sure", function(e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
$("#nocancelbtn").off("click");
|
|
$( "#sure" ).dialog( "close" );
|
|
$.mobile.changePage("#bill-page");
|
|
callback();
|
|
$(this).off("click.sure");
|
|
});
|
|
|
|
$("#nocancelbtn").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
$("#sure .sure-do").text(button).off("click.sure");
|
|
$( "#sure" ).dialog( "close" );
|
|
$.mobile.changePage("#bill-page");
|
|
});
|
|
|
|
$.mobile.changePage("#sure");
|
|
setTimeout(function(){
|
|
$("#stornocode").val("");
|
|
$("#stornoreason").val("");
|
|
},
|
|
1000);
|
|
}
|
|
|
|
function getGeneralConfigItems() {
|
|
doAjax("GET", "php/contenthandler.php?module=admin&command=getGeneralConfigItems", null, insertGenConfigStartRest, "Fehler Konfigurationsdaten");
|
|
}
|
|
|
|
function insertGenConfigStartRest(configResult) {
|
|
if (configResult.status == "OK") {
|
|
var values = configResult.msg;
|
|
$("#bill-page").data("payPrintType",values.payprinttype);
|
|
$("#bill-page").data("currency",values.currency);
|
|
$("#bill-page").data("billanguage",values.billlanguage);
|
|
$("#bill-page").data("logourl",values.logourl);
|
|
$("#bill-page").data("companyinfo",values.companyinfo);
|
|
decpoint = values.decpoint;
|
|
setLanguage(values.userlanguage);
|
|
getLastBills();
|
|
updatelistener();
|
|
batchjoblistener();
|
|
bindWhenSelection();
|
|
|
|
if (values.payprinttype == "s") {
|
|
$("#batchpanel").show();
|
|
}
|
|
} else {
|
|
setTimeout(function(){document.location.href = "index.html"},250); // not logged in
|
|
}
|
|
}
|
|
|
|
function bindWhenSelection() {
|
|
$("#datepicker").off("change").on("change", function (e) {
|
|
var date = $("#datepicker").datepicker("getDate");
|
|
getLastBills();
|
|
updatelistener();
|
|
bindWhenSelection();
|
|
});
|
|
}
|
|
|
|
//pageinit event for first page
|
|
//triggers only once
|
|
//write all your on-load functions and event handlers pertaining to page1
|
|
$(document).on("pageinit", "#bill-page", function () {
|
|
initializeMainMenu("#modulemenu");
|
|
hideMenu();
|
|
$.ajaxSetup({ cache: false });
|
|
getGeneralConfigItems();
|
|
$("#fromjobidfield").val("");
|
|
$("#tojobidfield").val("");
|
|
});
|
|
|
|
|
|
</script>
|
|
<div data-role="page" id="bill-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">Module</li>
|
|
</ul>
|
|
</div><!-- /panel -->
|
|
<div data-role="header" data-theme="b" data-position="fixed" id="theheader">
|
|
<h1><span id="billtitletxt">Kassenbons</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"><span id="modulstxt2">Module</span></a>
|
|
</div>
|
|
</div>
|
|
<div data-role="content">
|
|
|
|
<div data-role="fieldcontain" id="datepickerarea">
|
|
<label for="datepicker"><span id=datetxt>Datum</span>: </label>
|
|
<input data-role="date" data-inline="true" type="text" id="datepicker" data-theme="d">
|
|
</div>
|
|
|
|
<a href="#" data-role="button" data-theme="f" id="updatebtn"><span id="updatebtntxt">Aktualisieren</span></a>
|
|
<br><br>
|
|
<div id=billlist></div>
|
|
|
|
<div id="batchpanel" data-role="collapsible" data-collapsed="false" data-theme="e" data-content-theme="c" style="display:none;">
|
|
<h3><span id="batchheadertxt">Stapelverarbeitung</span></h3>
|
|
<p>
|
|
<form>
|
|
<span id="fromjobidtxt">Erste Bon-ID:</span><input type="text" id="fromjobidfield" style="background-color:white;"/><br>
|
|
<span id="tojobidtxt">Letzte Bon-ID:</span><input type="text" id="tojobidfield" style="background-color:white;" /><br>
|
|
<a href="#" data-role="button" data-icon="check" id="printjobsbtn" data-theme="f"><span id="printjobstxt">Drucken</span></a>
|
|
</form>
|
|
</div>
|
|
|
|
<div id=receiptbill></div>
|
|
</div>
|
|
<div data-role="footer" data-theme="b" id="thefooterr">
|
|
<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 data-role="popup" id="cancelfailed" data-overlay-theme="a" style="max-width:70%;" class="ui-corner-all">
|
|
<div data-role="header" class="ui-corner-top">
|
|
<h1>Storno fehlgeschlagen</h1>
|
|
</div>
|
|
<a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-right"></a>
|
|
<div data-role="content" class="ui-corner-bottom ui-content">
|
|
<p><span id="billnocancelposs">Der Stornovorgang ist fehlgeschlagen. Die wahrscheinlichste Ursache ist ein Tagesabschluss, der den zu
|
|
stornierenden Bon einschließt. In diesem Fall darf der Bon rückwirkend nicht mehr annuliert werden.</span></p>
|
|
</div>
|
|
</div> <!-- popup for reading sample queue data -->
|
|
|
|
</div>
|
|
|
|
<!-- Dialog page -->
|
|
<div data-role="dialog" id="sure" data-title="Entfernen?">
|
|
<div data-role="content">
|
|
<h3 class="sure-1">?</h3>
|
|
<p class="sure-2">?</p>
|
|
<form>
|
|
<label for="stornoreason"><span id="stornoreasontxt">Stornogrund:</span></label>
|
|
<input type="text" id="stornoreason" value="" data-mini="true /">
|
|
<label for="stornocode">Stornocode: </label>
|
|
<input type="password" id="stornocode" value="" data-mini="true">
|
|
<a href="#" class="sure-do" data-role="button" data-theme="b" data-rel="back"><span id="stornoyes">Ja</span></a>
|
|
<a href="#" data-role="button" data-theme="c" id="nocancelbtn"><span id="stornono">Nein</span></a>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html> |