231 lines
7.7 KiB
HTML
231 lines
7.7 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=ISO-8859-1">
|
|||
|
|
|||
|
<link rel="stylesheet" type="text/css" href="css/bestformat.css">
|
|||
|
|
|||
|
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
|
|||
|
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
|||
|
|
|||
|
<link rel="stylesheet" href="php/3rdparty/jquery.mobile-1.4.0.min.css" type="text/css" />
|
|||
|
<script src="php/3rdparty/jquery-2.0.3.min.js"></script>
|
|||
|
<script src="php/3rdparty/jquery.mobile-1.4.0.min.js"></script>
|
|||
|
<script src="utilities.js"></script>
|
|||
|
|
|||
|
<style>
|
|||
|
@media all
|
|||
|
{
|
|||
|
.receipttable {width: 30%; 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 {display: none;}
|
|||
|
}
|
|||
|
</style>
|
|||
|
|
|||
|
|
|||
|
</head>
|
|||
|
|
|||
|
<body>
|
|||
|
|
|||
|
<script>
|
|||
|
|
|||
|
|
|||
|
// refreshing the content
|
|||
|
$(document).ready(function() {
|
|||
|
var refreshId = setInterval(function() {
|
|||
|
getAndDisplayAllEntries();
|
|||
|
}, 10000);
|
|||
|
$.ajaxSetup({ cache: false });
|
|||
|
});
|
|||
|
|
|||
|
function getPayPrintType() {
|
|||
|
doAjax("GET", "php/contenthandler.php?module=admin&command=getPayPrintType", null, insertPayPrintType, "Fehler Druckkonfiguration");
|
|||
|
}
|
|||
|
function insertPayPrintType(payPrintType) {
|
|||
|
$("#bill-page").data("payPrintType",payPrintType);
|
|||
|
}
|
|||
|
|
|||
|
function getLastBills() {
|
|||
|
doAjax("GET","php/contenthandler.php?module=bill&command=getLastBillsWithContent",null,displayBillsWithContent,"letzte Bons");
|
|||
|
}
|
|||
|
|
|||
|
function doAjaxCancelBill(billid,stornocode) {
|
|||
|
var data = {
|
|||
|
billid: billid,
|
|||
|
stornocode: stornocode
|
|||
|
};
|
|||
|
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);
|
|||
|
}
|
|||
|
setTimeout(function(){location.reload()},1000);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
function displayBillsWithContent (jsonContent) {
|
|||
|
if (jsonContent.status != "OK") {
|
|||
|
return;
|
|||
|
}
|
|||
|
jsonContent = jsonContent.msg;
|
|||
|
|
|||
|
$.each(jsonContent, function (i, entry) {
|
|||
|
var id = entry.id;
|
|||
|
var shortdate = entry.shortdate;
|
|||
|
var longdate = entry.longdate;
|
|||
|
var tablename = entry.tablename;
|
|||
|
var brutto = entry.brutto;
|
|||
|
var content = entry.billcontent;
|
|||
|
var printbuttonid = 'print' + id;
|
|||
|
var cancelbuttonid = 'cancel' + id;
|
|||
|
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">';
|
|||
|
var header = '<h3>'+shortdate + ": Tisch <" + tablename + "> " + brutto + ' Euro</h3>';
|
|||
|
if (entry.isClosed == 1) {
|
|||
|
header = '<h3>'+shortdate + ": Tisch <" + tablename + "> " + brutto + ' Euro -abgeschlossen-</h3>';
|
|||
|
}
|
|||
|
var printbutton = '<a href="#" data-role="button" id="' + printbuttonid + '" data-theme="f" class="printbuttons">Drucken</a>';
|
|||
|
var cancelButton = '<a href="#" data-role="button" id="' + cancelbuttonid + '" data-theme="f" class="cancelbuttons">Storno</a>';
|
|||
|
|
|||
|
if (entry.isClosed == 0) {
|
|||
|
// bill is not closed - so can be printed AND cancelled
|
|||
|
$(collapse_elem + header + '<p><center>' + printbutton + cancelButton + '<br>' + content + '</center></p>').appendTo('#billlist');
|
|||
|
} else {
|
|||
|
// bill is closed - only printing possible, no cancelling
|
|||
|
$(collapse_elem + header + '<p><center>' + printbutton + '<br>' + content + '</center></p>').appendTo('#billlist');
|
|||
|
}
|
|||
|
|
|||
|
$("#" + collapse_elem_id).find("#billdate").html(longdate);
|
|||
|
$("#" + collapse_elem_id).find("#billid").html("Bon-Nr:" + id);
|
|||
|
var contentToPrint = new Array(id,longdate,content);
|
|||
|
$("#" + printbuttonid).data("entrydata", contentToPrint);
|
|||
|
if (entry.isClosed == 0) {
|
|||
|
$("#" + cancelbuttonid).data("billid", id);
|
|||
|
}
|
|||
|
});
|
|||
|
|
|||
|
$('#billlist').trigger('create');
|
|||
|
|
|||
|
$(".printbuttons").off("click").on("click", function (e) {
|
|||
|
var contentToPrint = $(this).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($("#receiptbill").html());
|
|||
|
} else {
|
|||
|
window.print();
|
|||
|
}
|
|||
|
});
|
|||
|
|
|||
|
$(".cancelbuttons").off("click").on("click", function (e) {
|
|||
|
var billid=$(this).data("billid");
|
|||
|
areYouSure("Storno?", "Bon stornieren?", "Ja", function() {
|
|||
|
doAjaxCancelBill(billid,$("#stornocode").val());
|
|||
|
});
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
function printBill(htmlText) {
|
|||
|
doAjax("POST","php/contenthandler.php?module=printqueue&command=queuePrintJob",
|
|||
|
{content : htmlText, type: 3 }, 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() {
|
|||
|
callback();
|
|||
|
$(this).off("click.sure");
|
|||
|
});
|
|||
|
$.mobile.changePage("#sure");
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//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();
|
|||
|
getPayPrintType();
|
|||
|
getLastBills();
|
|||
|
});
|
|||
|
|
|||
|
|
|||
|
</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" data-role="heading">Module</li>
|
|||
|
</ul>
|
|||
|
</div><!-- /panel -->
|
|||
|
<div data-role="header" data-theme="b" data-position="fixed" id="theheader">
|
|||
|
<h1>Kassenbons</h1>
|
|||
|
<div data-type="horizontal" style="top:0px;position:absolute;float:right;z-index:10;display:inline;" align="right" class="ui-btn-right">
|
|||
|
<a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitch">Module</a>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div data-role="content">
|
|||
|
<div id=billlist></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" name="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>Der Stornovorgang ist fehlgeschlagen. Die wahrscheinlichste Ursache ist ein Tagesabschluss, der den zu
|
|||
|
stornierenden Bon einschlie<69>t. In diesem Fall darf der Bon r<>ckwirkend nicht mehr annuliert werden.</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="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">Ja</a>
|
|||
|
<a href="#" data-role="button" data-theme="c" data-rel="back">Nein</a>
|
|||
|
</form>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
</body>
|
|||
|
</html>
|