2020-11-19 22:47:44 +01:00
|
|
|
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"];
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-19 23:14:48 +01:00
|
|
|
function createReceiptFooterFromDbTaxes(lang, billid, companyInfo,sum,taxes,decPoint,sn,uid,version,systemid) {
|
2020-11-19 22:47:44 +01:00
|
|
|
|
|
|
|
var priceStyle = 'style="border: solid black 0px;padding: 3px;text-align:right;vertical-align:bottom;"';
|
|
|
|
var infoStyle = 'style="text-align:center;vertical-align:bottom;"';
|
|
|
|
|
|
|
|
var emptyLine = '<tr><td colspan=6> </tr>';
|
|
|
|
var footer = emptyLine;
|
|
|
|
|
|
|
|
footer += '<tr><td colspan=2>' + P_MWST[lang] + '% <td ' + priceStyle + '>' + P_MWST[lang] + '<td ' + priceStyle + '>' + P_NETTO[lang] + '<td ' + priceStyle + ' colspan=2>' + P_BRUTTO[lang] + '</tr>';
|
|
|
|
|
|
|
|
for (var i=0;i<taxes.length;i++) {
|
|
|
|
var tax = taxes[i];
|
|
|
|
footer += "<tr><td colspan=2>" + tax.tax;
|
|
|
|
footer += "<td " + priceStyle + ">" + tax.mwst.replace(".",decPoint);
|
|
|
|
footer += "<td " + priceStyle + ">" + tax.netto.replace(".",decPoint);
|
|
|
|
footer += "<td colspan=2 " + priceStyle + ">" + tax.brutto.replace(".",decPoint);
|
|
|
|
footer += "</tr>";
|
|
|
|
}
|
|
|
|
|
|
|
|
footer += emptyLine;
|
|
|
|
footer += '<tr><td> <td colspan=3>' + P_SUM[lang] + '<td id="priceinreceipt2" ' + priceStyle + ' colspan=2>' + sum.toFixed(2).replace(".",decPoint) + '</td></tr>';
|
|
|
|
footer += emptyLine;
|
|
|
|
|
|
|
|
footer += '<tr><td ' + infoStyle + ' colspan=6><center> <br>';
|
|
|
|
footer += toHtml(companyInfo).replace(/(?:\r\n|\r|\n)/g, '<br />');
|
2020-11-19 23:14:10 +01:00
|
|
|
footer += '</center></tr><br>';
|
|
|
|
|
2020-11-19 23:14:48 +01:00
|
|
|
footer += "<tr><td colspan=6><center><img src='php/contenthandler.php?module=bill&command=billqrcode&billid=" + billid + "' /></center></tr>";
|
|
|
|
|
2020-11-19 23:14:10 +01:00
|
|
|
footer += "<tr><td colspan=6>Kassen-ID: " + toHtml(systemid).replace(/(?:\r\n|\r|\n)/g, '<br />') + "</tr>";
|
|
|
|
footer += "<tr><td colspan=6>Bonerstellung mit Version: " + toHtml(version).replace(/(?:\r\n|\r|\n)/g, '<br />') + "</tr>";
|
|
|
|
|
2020-11-19 22:47:44 +01:00
|
|
|
return footer;
|
|
|
|
}
|
|
|
|
|
2020-11-19 22:55:20 +01:00
|
|
|
|
2020-11-19 22:47:44 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Generate the product part of a receipt on base of html table array elements
|
|
|
|
*
|
|
|
|
* @param decPoint
|
|
|
|
* @param entryListForReceipt
|
|
|
|
* @returns {String}
|
|
|
|
*/
|
|
|
|
function generateProdPart(decPoint,entryListForReceipt) {
|
|
|
|
var index=0;
|
|
|
|
tablecontent = '';
|
|
|
|
for (index=0;index<entryListForReceipt.length;index++) {
|
|
|
|
var anEntry = entryListForReceipt[index];
|
|
|
|
|
|
|
|
var count = parseInt(anEntry[0]);
|
|
|
|
var prodEntry = anEntry[1];
|
|
|
|
var productname = prodEntry.longname;
|
|
|
|
var price = prodEntry.price;
|
2020-11-19 22:55:20 +01:00
|
|
|
var togo = prodEntry.togo;
|
2020-11-19 22:47:44 +01:00
|
|
|
var pricelevelname = prodEntry.pricelevelname;
|
|
|
|
|
2020-11-19 22:55:20 +01:00
|
|
|
tablecontent += generateOneProdLine(count,productname,price,pricelevelname,decPoint,togo);
|
2020-11-19 22:47:44 +01:00
|
|
|
}
|
|
|
|
return tablecontent;
|
|
|
|
}
|
|
|
|
|
2020-11-19 23:00:09 +01:00
|
|
|
|
2020-11-19 22:47:44 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Generate HTML output on base of db content
|
|
|
|
*/
|
2020-11-19 23:14:10 +01:00
|
|
|
function generateHtmlBillFromScratch(lang,billid,billcontent,currency,decPoint,hosthtml,guestinfo) {
|
2020-11-19 22:47:44 +01:00
|
|
|
var table = '<table id="receiptpart" class="receipttable" border=1 style="table-layout: fixed;">';
|
|
|
|
|
|
|
|
var overallinfo = billcontent.billoverallinfo;
|
2020-11-19 23:14:10 +01:00
|
|
|
var companyInfo = overallinfo.companyinfo;
|
|
|
|
var sn = overallinfo.sn;
|
|
|
|
var uid = overallinfo.uid;
|
|
|
|
var version = overallinfo.version;
|
|
|
|
var systemid = overallinfo.systemid;
|
2020-11-19 22:47:44 +01:00
|
|
|
var prods = billcontent.products;
|
|
|
|
|
|
|
|
var username = overallinfo.username;
|
|
|
|
var tablename = overallinfo.table;
|
|
|
|
|
2020-11-19 23:00:58 +01:00
|
|
|
var header = genCreateReceiptHeader(lang,billid,tablename,username,currency,guestinfo);
|
2020-11-19 22:47:44 +01:00
|
|
|
|
|
|
|
var products = generateProdPartByDbContent(decPoint,prods);
|
|
|
|
|
|
|
|
var sum = parseFloat(overallinfo.brutto);
|
|
|
|
|
2020-11-19 23:14:48 +01:00
|
|
|
var footer = createReceiptFooterFromDbTaxes(lang, billid, companyInfo,sum,billcontent.taxes,decPoint,sn,uid,version,systemid);
|
2020-11-19 22:47:44 +01:00
|
|
|
|
|
|
|
var receipt = table + header + products + footer;
|
|
|
|
if (overallinfo.host == 1) {
|
|
|
|
receipt += hosthtml;
|
|
|
|
}
|
|
|
|
|
|
|
|
receipt += "</table>";
|
|
|
|
return receipt;
|
|
|
|
}
|