2020-11-19 22:47:44 +01:00
< 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" >
2020-11-19 22:48:24 +01:00
< meta name = "author" content = "Stefan Pichel" >
2020-11-19 22:47:44 +01:00
2020-11-19 23:15:14 +01:00
< link rel = "stylesheet" type = "text/css" href = "css/bestformat.css?v=2.0.8" >
2020-11-19 22:47:44 +01:00
2020-11-19 23:02:42 +01:00
< link rel = "stylesheet" href = "php/contenthandler.php?module=admin&command=getmobilecss" / >
2020-11-19 22:47:44 +01:00
< 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 >
2020-11-19 22:52:25 +01:00
< 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 >
2020-11-19 23:15:14 +01:00
< script src = "utilities.js?v=2.0.8" > < / script >
< script src = "receiptutils.js?v=2.0.8" > < / script >
2020-11-19 22:47:44 +01:00
2020-11-19 23:00:09 +01:00
< script >
2020-11-19 23:14:48 +01:00
var P_DESCR=["Beschreibung","Description","Descripción"];var P_PRICE=["Preis","Price","Precio"];var P_TOTAL=["Total","Total","Total"];var P_ID=["Id:","Id:","Id:"];var P_ROOMSEL=["Raumauswahl","Room selection","Selección de espacio"];var P_PAYDESK_ACTIONS=["Kassenaktionen","Paydesk actions","Acciones de caja"];var P_BAR_INPUT=["Bareinlage","Input money","Insertar dinero"];var P_BAR_GET=["Barentnahme","Take money","Sacar dinero"];var P_BAR_SUM=["Einnahmen","Revenue","Cobro"];var P_TITLE=["Kasse","Paydesk","Caja"];var P_TABLE=["Tisch","Table","Mesa"];var P_TABLE_SEL=["Tischauswahl","Select table","Qué mesa?"];var P_NOT_PAID=["Ausstehend für ","Not paid for ","Impagado para "];var P_OPS=["Operationen","Operations","Operaciones"];var P_ALL=["Alles","All","Todo"];var P_CONTENT_RECEIPT=["Inhalt Kassenbon","Content of receipt","Contenido del tique"];var P_ONLY_PAY=["Nur Zahlung","Only pay","Solo pagar"];var P_PAY_PRINT=["Bondruck","Pay+Print","Pagar+Imprimir"];var P_CHANGE_CALC=["Wechselgeldrechner:","Change Calculator:","Calculadora de Cambio:"];var P_TOTALSUM=["Summe","Sum","Total"];var P_CHOOSE_PAYWAY=["Auswahl der Zahlungsart:","Selection of method of payment:","Selección del modo de pago:"];var P_CANCEL=["Abbrechen","Cancel","Cancelar"];var P_CASHTAKEOUT=["Barentnahme aus der Kasse","Cash take-out","Sacar dinero"];var P_CASHTAKIN=["Bareinlage in die Kasse","Cash insert","Insertar dinero"];var P_AMOUNT=["Betrag:","Amount:","Valor:"];var P_OVERVIEW=["Übersicht Kellnerkasse","Overview waiter purse","Resumen cartera de bolsillo"];var P_PUT_IN=["Einlegen/Entnehmen","Insert/Take out","Insertar"];var P_TAKE_OUT=["Entnehmen","Take out","Sacar"];var P_OVERV_DETAILS=["Diese Übersicht zeigt die Einnahmen durch den Kellner pro Zahlungsweg seit der letzten Tageslosung sowie als weiteren Wert den Kassenstand unter Berücksichtigung der eigenen Eingaben und Entnahmen.","This overview contains the amount of money of this waiter since the last closing as well as the total amount of money including the own cash insert and take-out actions.","Este resumen contiene todo el dinero del camarero, y también el dinero incluido con acciones de insertar y sacar."];var P_CASH_SUM=["Bewirtungseinnahmen (ohne Ein-/Auslagen):","Cash by payment (without inserts/take-outs):","Cobro (sin tomas/entradas):"];var P_INCLUDE_OWN=["< b > Bar< / b > bestand inkl. eigener Kassenein-/auslagen:","Cash incl. own cash insert/take-outs:","Cash incl. tomas y entradas proprias:"];var P_NO_ELEM=["Keine Rechnungselemente","No items selected","Ningún producto selecionado"];var P_NO_ELEM_DETAILS=["Es wurden keine abrechenbaren Produkte festgelegt (der Bon ist leer!).","There are no selected items. The receipt is empty!","No hay ningún elemento seleccionado para pagar."];var P_CASHACTION_OK=["Kassenaktion abgeschlossen.","Action completed.","Acción terminado."];var P_NAV=["Navigation","Navigation","Navigación"];var P_ORDER_ACTION=["-> Bestellansicht","-> Order view","-> Vista de Orden"];var P_TO_PAY=["Zu zahlen: ","To pay: ","Pagar total: "];var P_PAY_RETURN=["Zurück: ","Return: ","Torna: "];var P_CALC_PAYBACK=["Berechne","Calculate","Calcular"];var P_HAS_PAID=["Bezahlt: ","Paid: ","Pagado: "];var P_TOGO=["Außer-Haus-Verkauf","Sale with Tax No 2","Venta IVA 2"];var P_TIP=["nur Trinkg.: ","Only tip: ","Solo prop.: "];var P_TOTAL_INCL_TIP=["Zielbetrag:","Target pay:","Quiere pagar:"];var CALC_TIP_TXT=["Angabe extra Trinkg.","Do Tip separate","Propina individual"];var CALC_TOTAL_TXT=["Angabe inkl.Trinkg.","Do Tip incl.","Propina incl."];var P_GUESTS=["Gäste","Guests","Habitaciones"];var P_OF_WORK_RECEIPT=[" von Arbeitsbon ","of work receipt "," del ticket de trabajo "];var P_BILL_TITLE=["Rechnung","Bill","Factura"];var showHostTemplate=false;var guests=[];var internalguests=[];var hotelinterface=0;var PAYMENT_CARD=2;var PAYMENT_HS3=7;var PAYMENT_GUEST=8;var currentPaymentId=7;var showpayments=1;var showpayment2=1;var showpayment3=1;var showpayment4=1;var showpayment5=1;var showpayment6=1;var showpayment7=1;var showpayment8=1;var forceprint=0;var showhostprint=1;var bill
2020-11-19 23:00:09 +01:00
2020-11-19 22:47:44 +01:00
< 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
{
2020-11-19 23:14:55 +01:00
#theheader,#modulemenu,#billlist,#thefooterr,#updatebtn,#datepickerarea,#vouchersarea {display: none;}
2020-11-19 22:47:44 +01:00
}
< / 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"];
2020-11-19 23:00:55 +01:00
var BILL_STORNO_AND_DELETE = ["Storno und Produkte löschen","Cancel and Remove Products","Contrapartida y removar productos"];
2020-11-19 22:47:44 +01:00
var BILL_CLOSED = ["abgeschlossen","closed","cerrado"];
2020-11-19 22:55:20 +01:00
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"];
2020-11-19 22:47:44 +01:00
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?"];
2020-11-19 23:00:55 +01:00
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"];
2020-11-19 22:47:44 +01:00
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"];
2020-11-19 22:52:25 +01:00
var BILL_STORNO_REASON = ["Stornogrund","Reason","Razón"];
2020-11-19 22:55:20 +01:00
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"];;
2020-11-19 22:59:47 +01:00
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"];
2020-11-19 23:14:55 +01:00
var BILL_VOUCHERS_HEADER = ["Ausgestellte Gutscheine","Issued vouchers","Vales emitidos"];
2020-11-19 22:47:44 +01:00
var lang = 0;
var when = 0;
var decpoint = ".";
var jsonBills = "";
2020-11-19 23:14:55 +01:00
var vouchersAreaOpened = false;
var vouchers = [];
2020-11-19 22:47:44 +01:00
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]);
2020-11-19 22:52:25 +01:00
$("#stornoreasontxt").html(BILL_STORNO_REASON[lang]);
2020-11-19 22:59:47 +01:00
$("#printjobstxt").html(BILL_PRINT[lang]);
$("#fromjobidtxt").html(BILL_FIRST_JOB[lang]);
$("#tojobidtxt").html(BILL_LAST_JOB[lang]);
$("#batchheadertxt").html(BILL_BATCH[lang]);
2020-11-19 23:14:55 +01:00
$("#vouchersheadertxt").html(BILL_VOUCHERS_HEADER[lang]);
2020-11-19 22:47:44 +01:00
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();
});
}
2020-11-19 22:59:47 +01:00
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);
});
}
2020-11-19 23:14:55 +01:00
function vouchersBinding() {
$("#vouchersarea").off("collapsibleexpand").on("collapsibleexpand", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
if (!vouchersAreaOpened) {
vouchersAreaOpened = true;
getVouchers();
}
});
}
function getVouchers() {
if (vouchersAreaOpened) {
doAjax("GET","php/contenthandler.php?module=vouchers&command=getvouchers",null,showVouchers,null,true);
}
}
function showVouchers(answer) {
if (answer.status != "OK") {
return;
}
vouchers = answer.msg;
var text = "";
vouchers.forEach(function(aVoucher) {
var voucherStatus = "e";
if (aVoucher.removed == 1) {
voucherStatus = "b";
}
text += '< div id = "voucher_' + aVoucher.id + '" data-role = "collapsible" data-collapsed = "true" data-theme = "' + voucherStatus + '" data-content-theme = "c" class = "voucher" > ';
text += '< p / > < h3 > ' + aVoucher.creationdate + ' ' + toHtml(aVoucher.name) + ' ' + aVoucher.price + '< / h3 > ';
text += '< div id = "vouchercontent_' + aVoucher.id + '" > < / div > ';
text += '< / div > ';
});
$("#voucherslistarea").html(text);
$("#voucherslistarea").trigger("create");
bindSingleVoucherExpand();
}
function bindSingleVoucherExpand() {
$(".voucher").off("collapsibleexpand").on("collapsibleexpand", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var voucherid = this.id.split("_")[1];
var voucher = findVoucher(voucherid);
if (voucher != null) {
var txt = "Ausgestellt: " + voucher.creationdate + "< br > ";
txt += "Aussteller: " + voucher.creatoruser + "< br > ";
txt += "Eingelöst am: " + voucher.redeemdate + "< br > ";
txt += "Einlösender Bediener: " + voucher.redeemeruser + "< br > ";
txt += "Preis: " + voucher.price;
if (voucher.removed == 1) {
txt += "< br > Status: gelöscht";
}
$("#vouchercontent_" + voucherid).html(txt);
}
});
}
function findVoucher(voucherid) {
var foundVoucher = null;
vouchers.forEach(function(aVoucher) {
if (aVoucher.id == voucherid) {
foundVoucher = aVoucher;
}
});
return foundVoucher;
}
2020-11-19 22:59:47 +01:00
function handleBatchResult(answer) {
if (answer.status != "OK") {
alert("Fehler " + answer.code + ": " + answer.msg);
} else {
$("#fromjobidfield").val("");
$("#tojobidfield").val("");
}
}
2020-11-19 22:47:44 +01:00
function getLastBills() {
var date = $("#datepicker").datepicker("getDate");
var data = {
day: date.getDate(),
month: (date.getMonth() + 1),
2020-11-19 23:14:55 +01:00
year: date.getFullYear()
2020-11-19 22:47:44 +01:00
};
doAjax("GET","php/contenthandler.php?module=bill& command=getLastBillsWithContent",data,displayBillsWithContent,"letzte Bons");
}
2020-11-19 22:52:25 +01:00
function doAjaxCancelBill(billid,stornocode,reason) {
2020-11-19 22:47:44 +01:00
var data = {
billid: billid,
2020-11-19 23:00:55 +01:00
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
2020-11-19 22:47:44 +01:00
};
doAjax("POST","php/contenthandler.php?module=bill& command=cancelBill",data,cancelBill,"Bonstorno abgebrochen");
}
function cancelBill(jsonText) {
if (jsonText.status != "OK") {
2020-11-19 23:14:48 +01:00
alert("Fehler: " + jsonText.msg);
2020-11-19 22:52:25 +01:00
return;
2020-11-19 22:47:44 +01:00
}
2020-11-19 23:14:55 +01:00
setTimeout(function(){location.reload();},1000);
2020-11-19 22:47:44 +01:00
}
2020-11-19 22:55:20 +01:00
function changeHostBill(jsonText) {
if (jsonText.status != "OK") {
alert("Fehler " + jsonText.code + ": " + jsonText.msg);
return;
}
alert(BILL_TOGGLE_HOST[lang]);
2020-11-19 23:14:55 +01:00
setTimeout(function(){location.reload();},1000);
2020-11-19 22:55:20 +01:00
}
2020-11-19 22:47:44 +01:00
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];
2020-11-19 23:14:48 +01:00
var id = entry.id;
var billuid = entry.billuid;
2020-11-19 22:47:44 +01:00
var shortdate = entry.shortdate;
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" > ';
2020-11-19 23:14:48 +01:00
var idPart = "(" + billuid + ") ";
2020-11-19 23:14:10 +01:00
var header = '< h3 > ' + idPart +shortdate + ": " + BILL_TABLE[lang] + " < " + tablename + "> " + brutto + ' ' + currency;
2020-11-19 22:47:44 +01:00
if (entry.isClosed == 1) {
2020-11-19 23:14:10 +01:00
header += ' -' + BILL_CLOSED[lang] + '-';
2020-11-19 22:47:44 +01:00
}
2020-11-19 23:14:10 +01:00
header += '< / h3 > ';
2020-11-19 22:47:44 +01:00
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;
2020-11-19 23:00:55 +01:00
var canceldeletebuttonid = 'cancelanddelete_' + billid;
2020-11-19 22:47:44 +01:00
$("#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);
2020-11-19 23:00:55 +01:00
$("#" + canceldeletebuttonid).data("billid", id);
2020-11-19 22:47:44 +01:00
}
$("#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];
2020-11-19 22:52:25 +01:00
$("#stornocode").val("");
$("#stornoreason").val("");
2020-11-19 22:47:44 +01:00
areYouSure(BILL_STORNO_QUEST_TITLE[lang], BILL_STORNO_QUEST_TEXT[lang], BILL_YES[lang], function() {
2020-11-19 22:52:25 +01:00
doAjaxCancelBill(billid,$("#stornocode").val(),$("#stornoreason").val());
2020-11-19 22:47:44 +01:00
});
});
2020-11-19 22:55:20 +01:00
2020-11-19 23:00:55 +01:00
$(".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());
});
});
2020-11-19 22:55:20 +01:00
$(".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");
});
2020-11-19 22:47:44 +01:00
});
}
function getBillWithId(id) {
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];
2020-11-19 23:10:09 +01:00
break;
2020-11-19 22:47:44 +01:00
}
}
if (entry == null) {
alert("ERROR - Rechnung mit ID " + id + " konnte nicht gefunden werden");
return;
}
2020-11-19 23:15:07 +01:00
//var content = generateHtmlBillFromScratch(lang,id,entry.billuid,entry.billcontent,currency,decpoint,hosthtml,entry.billcontent.billoverallinfo.guestinfo);
var content = generateHtmlBillFromScratch(lang,entry,currency,hosthtml,decpoint);
2020-11-19 22:47:44 +01:00
var printbuttonid = 'print_' + id;
var cancelbuttonid = 'cancel_' + id;
2020-11-19 23:00:55 +01:00
var canceldeletebuttonid = 'cancelanddelete_' + id;
2020-11-19 22:55:20 +01:00
var changehostbuttonid = 'changehost_' + id + "_" + entry.host;
2020-11-19 22:47:44 +01:00
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 > ';
2020-11-19 23:00:55 +01:00
var cancelAndDeleteButton = '< a href = "#" data-role = "button" id = "' + canceldeletebuttonid + '" data-theme = "f" class = "canceldeletebuttons" > ' + BILL_STORNO_AND_DELETE[lang] + '< / a > ';
2020-11-19 22:55:20 +01:00
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 > ';
2020-11-19 22:47:44 +01:00
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) {
2020-11-19 23:00:55 +01:00
txt += cancelButton + cancelAndDeleteButton + changehostbutton + '< br > ' + content + '< / center > ';
2020-11-19 22:47:44 +01:00
} else {
txt += '< p > < center > ' + '< br > ' + content + '< / center > ';
}
return [txt,date_time,entry];
}
function printBill(billid) {
doAjax("POST","php/contenthandler.php?module=printqueue& command=queueReceiptPrintJob",
2020-11-19 22:59:50 +01:00
{billid : billid , useaddrecprinter: 0}, null, "Druckfehler");
2020-11-19 22:47:44 +01:00
}
function areYouSure(text1, text2, button, callback) {
$("#sure .sure-1").text(text1);
$("#sure .sure-2").text(text2);
2020-11-19 22:52:25 +01:00
$("#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");
2020-11-19 22:47:44 +01:00
callback();
$(this).off("click.sure");
});
2020-11-19 22:52:25 +01:00
$("#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");
});
2020-11-19 22:47:44 +01:00
$.mobile.changePage("#sure");
2020-11-19 23:00:18 +01:00
setTimeout(function(){
$("#stornocode").val("");
$("#stornoreason").val("");
},
1000);
2020-11-19 22:47:44 +01:00
}
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();
2020-11-19 22:59:47 +01:00
batchjoblistener();
2020-11-19 23:14:55 +01:00
vouchersBinding();
2020-11-19 22:47:44 +01:00
bindWhenSelection();
2020-11-19 22:59:47 +01:00
if (values.payprinttype == "s") {
$("#batchpanel").show();
2020-11-19 23:14:55 +01:00
$("#vouchersarea").show();
2020-11-19 22:59:47 +01:00
}
2020-11-19 22:47:44 +01:00
} 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();
2020-11-19 22:59:47 +01:00
$("#fromjobidfield").val("");
$("#tojobidfield").val("");
2020-11-19 22:47:44 +01:00
});
< / script >
2020-11-19 23:11:29 +01:00
< div data-role = "page" id = "bill-page" data-theme = "c" >
2020-11-19 22:47:44 +01:00
< 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" >
2020-11-19 23:02:16 +01:00
< li data-role = "list-divider" data-theme = "b" > Hauptmenü< / li >
2020-11-19 22:47:44 +01:00
< / ul >
< / div > <!-- /panel -->
2020-11-19 23:11:29 +01:00
< div data-role = "header" data-theme = "b" data-position = "fixed" id = "theheader" style = "background-color:black;" >
2020-11-19 23:14:48 +01:00
< h1 > < span id = "billtitletxt" > Kassenbons< / span > < img src = "img/connection.png" class = "connectionstatus" style = "display:none;" / > < img src = "img/printerstatus.png" class = "printerstatus" style = "display:none;" / > < img src = "img/tsestatus.png" class = "tsestatus" style = "display:none;" / > < img src = "img/tasksstatus.png" class = "tasksstatus" style = "display:none;" / > < / h1 >
2020-11-19 22:47:44 +01:00
< div data-type = "horizontal" style = "top:0px;position:absolute;float:right;z-index:10;display:inline;" align = "right" class = "ui-btn-right" >
2020-11-19 23:02:16 +01:00
< a href = "#" data-role = "button" data-icon = "arrow-d" data-ajax = "false" id = "menuswitch" > < span id = "modulstxt2" > Hauptmenü< / span > < / a >
2020-11-19 22:47:44 +01:00
< / 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 >
2020-11-19 22:59:47 +01:00
< 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 >
2020-11-19 23:12:00 +01:00
< span id = "fromjobidtxt" > Erste Bon-ID:< / span > < input type = "number" id = "fromjobidfield" style = "background-color:white;color:black;" / > < br >
< span id = "tojobidtxt" > Letzte Bon-ID:< / span > < input type = "number" id = "tojobidfield" style = "background-color:white;color:black;" / > < br >
2020-11-19 22:59:47 +01:00
< a href = "#" data-role = "button" data-icon = "check" id = "printjobsbtn" data-theme = "f" > < span id = "printjobstxt" > Drucken< / span > < / a >
< / form >
< / div >
2020-11-19 23:14:55 +01:00
< div id = "vouchersarea" data-role = "collapsible" data-collapsed = "true" data-theme = "f" data-content-theme = "c" style = "display:none;" >
< h3 > < span id = "vouchersheadertxt" > Gutscheine< / span > < / h3 >
< p >
< div id = "voucherslistarea" > < / div >
< / div >
2020-11-19 22:59:47 +01:00
2020-11-19 22:47:44 +01:00
< div id = receiptbill > < / div >
< / div >
2020-11-19 23:11:29 +01:00
< div data-role = "footer" data-theme = "b" id = "thefooterr" style = "background-color:black;" >
2020-11-19 22:47:44 +01:00
< 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 -->
2020-11-19 22:59:47 +01:00
< div data-role = "popup" id = "cancelfailed" data-overlay-theme = "a" style = "max-width:70%;" class = "ui-corner-all" >
2020-11-19 22:47:44 +01:00
< 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 >
2020-11-19 22:52:25 +01:00
< 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 >
2020-11-19 22:47:44 +01:00
< / form >
< / div >
< / div >
< / body >
< / html >