OrderSprinter 1.1.0

This commit is contained in:
Geno 2020-11-19 22:47:44 +01:00
parent 26184b7751
commit 453427da71
355 changed files with 66875 additions and 9667 deletions

231
bill.html
View File

@ -1,231 +0,0 @@
<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 &lt;" + tablename + "&gt; " + brutto + ' Euro</h3>';
if (entry.isClosed == 1) {
header = '<h3>'+shortdate + ": Tisch &lt;" + tablename + "&gt; " + 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ß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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

View File

@ -1,72 +0,0 @@
# ***** Es wurde noch keine Speisekarte festgelegt ****
# ***** Daher wird hier nun eine Beispielkarte angezeigt, ****
# ***** die als Vorlage dienen soll ****
#
# Einrückungen bauen die Produktpalette hierarchisch auf
# Die tiefsten Einrückungen stellen die Produkte dar, alle
# Ebenen darüber die Kategorien
#
# Ein Produkteintrag hat folgendes Format:
# Kurzname ; NormalPreis (Stufe A); Langname # Preis (Stufe B); Preis (Stufe C)
# dabei ist der Kurzname nur in der Kellneransicht zu sehen
# Nur Kurzname und Preis (A) sind erforderlich, die anderen Teile werden bei
# Auslassung automatisch gefüllt (Preis B=C=A und Langname = Kurzname)
#
# Bei Kategorien:
# Wird ein K und B mitgegeben, so werden diese Produkte über die Küchen-
# und Bereitstellungsansicht geführt. Die Einstellung wird auf die Unterkategorien
# vererbt, wenn die darunter liegenden Kategorien keine Angabe dazu machen.
#
# Wenn ein D da steht, wird als Typ "Getränk" angenommen, bei einem F "Speise".
# Auch hier wird der übergeordnete Eintrag genommen, wenn Angabe fehlt.
#
#
# Reservierte Buchstaben: = ; #
# (Diese werden als Trenner verwendet!)
#
Speisen = KBF
Vom Grill
El Greco 2P; 26.90; EL Greco 2 Personen # 20.90; 13.80
El Greco 1P; 14.80; EL Greco 1 Person
Fleisch-Gerichte
Lammkotelett; 13.50; Lammkotelett # 11.30; 6.00
Zigeuner/Jägerschnitzel; 10.50 # 9.80; 3.50
Suzukakia 4H; 10.50; Suzukakia 4 Hacksteaks
Suzukakia 2H; 10.50; Suzukakia 2 Hacksteaks
Souvlaki; 10.50
Italienische Küche
Pizza
Siciliana
klein; 7.50; Pizza Siciliana klein
groß; 7.50; Pizza Siciliana groß
Salami
klein; 6,20; Pizza Salami klein
groß; 7.80; Pizza Salami groß
Special; 6.90; Ital. Tagesspecial
Getränke = KBD
Biere
Holsten; 1.60 # 1.00; 0.80
Warsteiner; 1.80 # 1.20
Becks Gold; 1.80
Alsterwasser; 1.50
Softdrinks
Coca-Cola; 2.50
Fanta; 2.50
Ohne Zucker = B
Cola Zero; 2.21
Sprite; 2.50
Eistee; 1.60
Wasser
Apollinaris; 2.20
still; 1.20; Stilles Wasser
Kategorie Selbstbedienung =
Frühstücksbuffet; 8.90
Frühstücksbuffet + Kaffe; 12.20
Kategorie vorbereitet = B
Deserts; 2.20
Fertigprodukte; 1.20
Kategorie Nur Küche = K
Tischzubereitung Fisch; 2.20
Tischzubereitung Fleischmenü; 1.20
Weine
Lambrusco; 7.00; Wein Lambrusco

View File

@ -1,190 +0,0 @@
<html>
<head>
<title>Ansicht Feedback</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>
<script src="kitchenbar.js"></script>
<style>
#tableWithEntriesToCook,#tableWithCookedEntries,#headertableToCook
{
width:100%;
}
#declareready,#declarenotcooked {
text-align:center;
vertical-align:middle;
}
#readybutton,#notreadybutton {
width:90%;
}
#optiontext
{
font-family:sans-serif;
font-size:10pt;
color:black;
}
#tableWithCookedEntries td {
background:#b4b4ec
}
.dividerline {
height: 10px;
}
</style>
</head>
<body>
<script>
function binding() {
$("#sendMail").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var role = $('#role option:selected').text();
var topic = $('#topic option:selected').text();
var email = $("#emailaddr").val();
var tel = $("#tel").val();
var content = $("#content").val();
var rights = $("#rights").val();
if (email == '') {
alert("Email-Adresse angeben!");
return;
}
if (content == '') {
alert("Nachrichtenfeld ist leer");
return;
}
var data = {
role : role,
topic : topic,
email : email,
tel : tel,
allowSendRights : (rights == 1 ? 1 : 0),
content : content
};
doAjax("POST","php/contenthandler.php?module=feedback&command=sendMail",data,mailWasSent,"Fehler Nachrichtenversand");
});
}
function mailWasSent(jsonText) {
if (jsonText == "OK") {
alert ("Wenn eine Kopie der Nachricht an die angegebene Emailadresse gesendet wurde, scheint der Mailversand an den Entwickler erfolgreich gewesen zu sein.");
} else {
alert ("Fehler beim Nachrichtenversand: " + jsonText);
}
$("#emailaddr").val("");
$("#tel").val("");
$("#content").val("");
location.reload();
}
//pageinit event for first page
//triggers only once
//write all your on-load functions and event handlers pertaining to page1
$(document).on("pageinit", "#feedback-page", function () {
initializeMainMenu("#modulemenu");
hideMenu();
binding();
});
</script>
<!--first page -->
<div data-role="page" id="feedback-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">
<h1>Feedback</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" id="allpagecontent">
<p>Diese Seite dient zur Übermittlung von Feedback an den Entwickler. Die Email wird das Mailkonto
des Betreibers versendet.</p>
<form>
<div class="ui-field-contain">
<label for="role">Rolle:</label>
<select name="role" id="role" data-theme="e">
<option value="1" selected>Kellner</option>
<option value="2">Küchenpersonal</option>
<option value="3">Gastwirt</option>
<option value="4">Betriebsprüfer</option>
<option value="5">Tester</option>
</select>
</div> <!-- ui-field-contain -->
<div class="ui-field-contain">
<label for="topic">Thema:</label>
<select name="topic" id="topic" data-theme="e">
<option value="1" selected>Problem</option>
<option value="2">Frage</option>
<option value="3">Allg. Rückmeldung</option>
</select>
</div> <!-- ui-field-contain -->
<div class="ui-field-contain">
<label for="rights">Übermittlung:</label>
<select name="rights" id="rights" data-theme="e">
<option value="1" selected>mit DB-Info und Benutzerrechten</option>
<option value="2">nur Nachricht</option>
</select>
</div> <!-- ui-field-contain -->
<div class="ui-field-contain">
<label for="emailaddr">Email:</label>
<input type="text" id="emailaddr" value="" data-mini="true" placeholder="Email-Adresse" data-theme="e" />
</div> <!-- ui-field-contain -->
<div class="ui-field-contain">
<label for="tel">Telefon:</label>
<input type="text" id="tel" value="" data-mini="true" placeholder="0123-456789" data-theme="e"/>
</div> <!-- ui-field-contain -->
<div class="ui-field-contain">
<label for="content">Nachricht:</label>
<textarea cols="40" rows="8" name="content" id="content" data-theme="c"></textarea>
</div> <!-- ui-field-contain -->
<p>Bitte <i>Telefonnummer</i> angeben, wenn eine <b>Antwort</b> per Telefon gewünscht wird.
<br>Eine Antwort des Entwicklers
kann nicht garantiert werden! Informationen über den verwendeten Internetbrowser wird an den Entwickler gesendet, damit mögliche Fragen
oder Probleme leichter identifiziert werden können.</p>
<button type="submit" data-theme="f" data-icon="check" id="sendMail">Absenden</button>
</form>
</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 -->
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 478 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

View File

@ -1,238 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Setup</title>
<link rel="stylesheet" type="text/css" href="css/bestformat.css">
<script src="php/3rdparty/jquery-2.0.3.min.js"></script>
<script src="utilities.js"></script>
<script>
function testdb() {
var dbhost = $("#db_host").val();
var dbname = $("#db_name").val();
var dbuser = $("#dbuser").val();
var dbpass = $("#dbpass").val();
var data = {
host:dbhost,
dbname:dbname,
user:dbuser,
pass:dbpass
};
doAjaxSuppressError("POST",
"install/installer.php?command=testDbConnection",
data,answerOfTestDb,
"Kommunikation zum Server fehlerhaft");
}
function getDbVals() {
doAjax("GET",
"install/installer.php?command=getConfig",
null,fillDbVals,
"Kommunikation zum Server fehlerhaft");
}
function fillDbVals(dbVals) {
if (dbVals.status == "OK") {
var db = dbVals.result;
$("#db_host").val(db.host);
$("#db_name").val(db.db);
$("#dbuser").val(db.user);
$("#dbpass").val(db.password);
$("#table_prefix").val(db.tabprefix);
testdb();
}
}
function answerOfTestDb(jsonText) {
if (jsonText.toLowerCase() == 'error') {
$("#testdbstatus").html("<b style='color:red;'>Fehlerhaft</b>");
$("#testdbstatus").data("status",false);
} else {
$("#testdbstatus").html("<b style='color:green;'>OK</b>");
$("#testdbstatus").data("status",true);
}
}
function checkWriteAccess() {
doAjax("GET",
"install/installer.php?command=checkWriteAccess",
null,
insertWriteAccessVals,
"Kommunikation mit Webserver fehlerhaft");
}
function insertBoolVal(id,boolval) {
if (boolval) {
$(id).html("<b style='color:green;'>OK</b>");
$(id).data("status",true);
} else {
$(id).html("<b style='color:red;'>Nicht beschreibbar</b>");
$(id).data("status",false);
}
}
function insertWriteAccessVals(writestatus) {
insertBoolVal("#writeaccessconfigfolder",writestatus.configfolder);
insertBoolVal("#writeaccessconfigfile",writestatus.configfile);
if (
$("#writeaccessconfigfolder").data("status") &&
$("#writeaccessconfigfile").data("status")) {
$("#writestatus").html("<b style='color:green;'>OK</b>");
$("#writestatus").data("status",true);
} else {
$("#writestatus").html("<b style='color:red;'>Fehlerhaft</b>");
$("#writestatus").data("status",false);
}
}
function startinstall() {
if ($("#adminpass").val().length == 0) {
alert("Administratorpasswort ist nicht gesetzt");
return;
}
if ($("#adminpass").val() != $("#adminpass2").val()) {
alert("Administratorpasswort uneinheitlich eingegeben");
return;
}
if ( $("#testdbstatus").data("status") &&
$("#writestatus").data("status")
) {
var data = {
host: $("#db_host").val(),
db: $("#db_name").val(),
user: $("#dbuser").val(),
password: $("#dbpass").val(),
prefix: $("#table_prefix").val(),
adminpass: $("#adminpass").val()
}
$("#progress").html("<b style='color:red;'>Arbeitet...</b>");
//$("#startinstall").attr("disabled", "disabled");
doAjax("POST",
"install/installer.php?command=install",
data,
resultOfInstall,
"Fehler bei der Installation");
} else {
alert("Installation nicht möglich");
}
}
function resultOfInstall(jsonAnswer) {
if (jsonAnswer == "OK") {
$("#progress").html("<b style='color:green;'>Abgeschlossen</b>");
alert("Die Installation ist nun abgeschlossen. Sie werden nun zur Einstiegsseite "
+ "umgeleitet. Wenn Sie sich mit dem soeben vergebenen Password einloggen "
+ "können, war die Installation erfolgreich. Löschen Sie in diesem Fall "
+ "das Verzeichnis 'install', damit die Installation nicht zu einem späteren "
+ "Zeitpunkt versehentlich überschrieben wird!");
window.location.href = "index.html";
}
}
function binding() {
$("#testdb").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
testdb();
});
checkWriteAccess();
$("#testwriteaccess").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
checkWriteAccess();
});
$("#startinstall").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
startinstall();
});
}
$(document).ready(function() {
binding();
checkWriteAccess();
getDbVals();
$("#startinstall").css({ width: '300px', 'padding-top': '10px', 'padding-bottom': '10px' });
});
</script>
</head>
<body style="background-color:SaddleBrown ;">
<center><img src=img/bannerwithphone.png width=800px></img></center>
<form>
<center>
<table border="0" cellpadding="5" cellspacing="0" class="viewtable">
<tr><th width=200px>Kategorie<th width=200px;>Einstellung<th width=200px>Wert</tr>
<tr>
<td rowspan=7>Datenbank
<td align="right">Datenbank-Server: </td>
<td><input id="db_host" type="text" size="30" maxlength="30" placeholder="localhost"></td>
</tr>
<tr>
<td align="right">Datenbank-Name: </td>
<td><input id="db_name" type="text" size="30" maxlength="30"></td>
<tr>
<tr>
<td align="right">Datenbank-Benutzer: </td>
<td><input id="dbuser" type="text" size="30" maxlength="30"></td>
</tr>
<tr>
<td align="right">Datenbank-Passwort: </td>
<td><input id="dbpass" type="password" size="30" maxlength="30"></td>
</tr>
<tr>
<td align="right">Präfix für die Tabellen: </td>
<td><input id="table_prefix" type="text" size="30" maxlength="30"></td>
</tr>
<tr>
<td id=testdbbutton><button type="submit" id="testdb">Teste DB-Zugriff</button>
<td align=center id=testdbstatus>
</tr>
<tr><td rowspan=3>Schreibberechtigungen
<td align="right">php-Verzeichnis
<td align=center id=writeaccessconfigfolder>&nbsp;
</tr>
<tr>
<td align="right">config.php
<td align=center id=writeaccessconfigfile>&nbsp;
</tr>
<tr>
<td><button type="submit" id="testwriteaccess" onclick="checkWriteAccess();">Teste Schreibberechtigungen</button>
<td align=center id=writestatus>
</tr>
<tr>
<td rowspan=2>Applikation
<td align="right">Administrator-Passwort: </td>
<td><input id="adminpass" type="password" size="30" maxlength="30"></td>
</tr>
<tr>
<td align="right">Administrator-Passwort (Wdh.): </td>
<td><input id="adminpass2" type="password" size="30" maxlength="30"></td>
</tr>
<tr>
<td>&nbsp;
<td align=center><button type="submit" id="startinstall" onclick="startinstall();">Starte Installation</button>
<td><div id=progress>&nbsp;</div>
</tr>
</table>
</center>
</form>
</body>
</html>

View File

@ -1,624 +0,0 @@
<?php
error_reporting(E_ALL);
class Installer {
private function checkwriteaccessconfigfolder() {
return (is_writable("../php"));
}
private function checkwriteaccessconfigfile() {
if (file_exists("../php/config.php")) {
return (is_writable("../php/config.php"));
} else {
return (is_writable("../php"));
}
}
private function checkwritecustomerfolder() {
return (is_writable("../customer"));
}
private function checkwritespeisekarte() {
if (file_exists("../customer/speisekarte.txt")) {
return (is_writable("../customer/speisekarte.txt"));
} else {
return (is_writable("../customer"));
}
}
function checkWriteAccess() {
$retArray = array(
"configfolder" => $this->checkwriteaccessconfigfolder(),
"configfile" => $this->checkwriteaccessconfigfile(),
"customerfolder" => $this->checkwritecustomerfolder(),
"speisekarte" => $this->checkwritespeisekarte()
);
echo json_encode($retArray);
}
}
class ConfigWriter {
function getConfigVals() {
if (is_readable("../php/config.php")) {
include( "../php/config.php" );
$retArray = array(
"host" => MYSQL_HOST,
"db" => MYSQL_DB,
"user" => MYSQL_USER,
"password" => MYSQL_PASSWORD,
"tabprefix" => TAB_PREFIX);
echo json_encode(array("status" => "OK","result" => $retArray));
} else {
echo json_encode(array("status" => "Failed"));
}
}
}
class Admin {
var $prefix = "";
var $pdo;
function setPrefix($pre) {
$this->prefix = $pre;
}
function setPdo($pdo) {
$this->pdo = $pdo;
}
function openDbAndReturnPdo ($host,$db,$user,$password) {
$dsn = 'mysql:host=' . $host . ';dbname=' . $db;
$pdo = null;
try {
$pdo = new PDO($dsn, $user, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch (PDOException $e) {
echo 'Verbindungsproblem: ' . $e->getMessage();
$pdo = null;
}
return $pdo;
}
function createTables()
{
$pdo = $this->pdo;
$this->doSQLcatch($pdo, "DROP TABLE `%hist%`");
$this->doSQLcatch($pdo, "DROP TABLE `%histprod%`");
$this->doSQLcatch($pdo, "DROP TABLE `%histconfig%`");
$this->doSQLcatch($pdo, "DROP TABLE `%histuser%`");
$this->doSQLcatch($pdo, "DROP TABLE `%histactions%`");
$this->doSQLcatch($pdo, "drop TABLE `%billproducts%`");
$this->doSQLcatch($pdo, "drop TABLE `%queue%`");
$this->doSQLcatch($pdo, "drop TABLE `%printjobs%`");
$this->doSQLcatch($pdo, "drop TABLE `%bill%`");
$this->doSQLcatch($pdo, "drop TABLE `%user%`");
$this->doSQLcatch($pdo, "drop TABLE `%closing%`");
$this->doSQLcatch($pdo, "drop TABLE `%config%`");
$this->doSQLcatch($pdo, "drop TABLE `%products%`");
$this->doSQLcatch($pdo, "drop TABLE `%prodtype%`");
$this->doSQLcatch($pdo, "drop TABLE `%pricelevel%`");
$this->doSQLcatch($pdo, "drop TABLE `%resttables%`");
$this->doSQLcatch($pdo, "drop TABLE `%room%`");
$this->doSQLcatch($pdo, "drop TABLE `%payment%`");
$this->createPaymentTable($pdo);
$this->createUserTable($pdo);
$this->createRoomTable($pdo);
$this->createRestTables($pdo);
$this->createConfigTable($pdo);
$this->createProdTypeTable($pdo);
$this->createProductTable($pdo);
$this->createPriceLevelTable($pdo);
$this->createClosingTable($pdo);
$this->createBillTable($pdo);
$this->createQueueTable($pdo);
$this->createBillProductsTable($pdo);
$this->createHistTables($pdo);
$this->createPrintJobsTable($pdo);
$this->doSQL($pdo,"INSERT INTO `%pricelevel%` (`id` , `name`,`info`) VALUES ('1', 'A', 'Normale Preisstufe')");
$this->doSQL($pdo,"INSERT INTO `%pricelevel%` (`id` , `name`,`info`) VALUES ('2', 'B', 'Wochenendtarif')");
$this->doSQL($pdo,"INSERT INTO `%pricelevel%` (`id` , `name`,`info`) VALUES ('3', 'C', 'Happy Hour')");
$this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'pricelevel', '1')");
$this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'tax', '19,0')");
$this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'togotax', '7,0')");
$this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'stornocode', '123')");
$this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'printpass', 'printen')");
$this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'companyinfo', 'Musterrestaurant\nBeispielstrasse 123\n12345 Musterort')");
$this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'serverurl', '')");
$this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'email', '')");
$this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'logourl', 'customer/logo.png')");
$this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'payprinttype', 'l')");
$this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.0')");
$this->readConfigTableAndSendToHist($pdo);
return;
}
function doSQL($pdo,$sql) {
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute();
}
function doSQLcatch($pdo,$sql) {
try {
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute();
} catch (Exception $e) {
// nothing - table not present or whatever...
}
}
function readConfigTableAndSendToHist($pdo) {
$sql_query = "SELECT * FROM %config%";
$sql_insert_histconfig = "INSERT INTO %histconfig% (id,configid,setting) VALUES (
NULL,?,?)";
$stmt_query = $pdo->prepare($this->resolveTablenamesInSqlString($sql_query));
$stmt_insert_histconfig = $pdo->prepare($this->resolveTablenamesInSqlString($sql_insert_histconfig));
$stmt_query->execute();
$result = $stmt_query->fetchAll();
foreach($result as $row){
$stmt_insert_histconfig->execute(array($row['id'],$row['setting']));
$newRefIdForHist = $pdo->lastInsertId();
$this->insertIntoHist($pdo, '2', $newRefIdForHist);
}
}
private function insertIntoHist($pdo,$action,$refIdForHist) {
date_default_timezone_set('Europe/Berlin');
$currentTime = date('Y-m-d H:i:s');
$sql_insert_hist = "INSERT INTO %hist% (id,date,action,refid) VALUES (NULL,?,?,?)";
$stmt_insert_hist = $pdo->prepare($this->resolveTablenamesInSqlString($sql_insert_hist));
$stmt_insert_hist->execute(array($currentTime, $action, $refIdForHist));
}
function insertAdminUser($adminpass) {
$md5adminpass = md5($adminpass);
$pdo = $this->pdo;
$userInsertSql = "INSERT INTO `%user%` (`id` , `username` , `userpassword`, `is_admin`, `right_waiter`,`right_kitchen`,`right_bar`,`right_supply`,`right_paydesk`,`right_statistics`,`right_bill`,`right_products`,`right_manager`,`active`) VALUES (NULL,?,?,?,?,?,?,?,?,?,?,?,?,'1')";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($userInsertSql));
$stmt->execute(array('admin',$md5adminpass,1,0,0,0,0,0,0,0,0,1));
$newUserIdForHist = $pdo->lastInsertId();
// now insert into hist
$sql_insert_histuser = "INSERT INTO %histuser% (`id` , `userid`, `username` ,
`is_admin`, `right_waiter`,`right_kitchen`,`right_bar`,`right_supply`,`right_paydesk`,
`right_statistics`,`right_bill`,`right_products`,`right_manager`,`active`) VALUES (
NULL,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$stmt_insert_histuser = $pdo->prepare($this->resolveTablenamesInSqlString($sql_insert_histuser));
$stmt_insert_histuser->execute(array($newUserIdForHist,'admin',1,0,0,0,0,0,0,0,0,1,1));
$newRefIdForHist = $pdo->lastInsertId();
$this->insertIntoHist($pdo, '3', $newRefIdForHist);
}
function createBillProductsTable($pdo) {
$sql = "
CREATE TABLE `%billproducts%` (
`queueid` INT( 10 ) NOT NULL,
`billid` INT(10) NOT NULL,
FOREIGN KEY (queueid) REFERENCES %queue%(id),
FOREIGN KEY (billid) REFERENCES %bill%(id)
) ENGINE = InnoDb ;
";
$this->doSQL($pdo,$sql);
}
/*
* Create the queue table:
* action: P=Pay, S=Storno
*/
function createQueueTable($pdo)
{
$sql = "
CREATE TABLE `%queue%` (
`id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`tablenr` INT( 3 ) NOT NULL ,
`productid` INT( 10 ) NULL ,
`pricelevel` INT( 3 ) NOT NULL ,
`price` DECIMAL (5,2) NOT NULL,
`productname` VARCHAR( 150 ) NULL,
`ordertime` DATETIME NULL ,
`anoption` VARCHAR( 150 ) NULL ,
`readytime` DATETIME NOT NULL,
`delivertime` DATETIME NULL,
`payinprogress` INT(3) NOT NULL,
`paidtime` DATETIME NULL,
`billid` INT(10),
`toremove` INT(3) NOT NULL,
`cooking` INT(10) NULL,
`workprinted` INT(2) NOT NULL,
`action` VARCHAR(3) NOT NULL,
FOREIGN KEY (tablenr) REFERENCES %resttables%(id),
FOREIGN KEY (pricelevel) REFERENCES %pricelevel%(id),
FOREIGN KEY (productid) REFERENCES %products%(id),
FOREIGN KEY (billid) REFERENCES %bill%(id),
FOREIGN KEY (cooking) REFERENCES %user%(id)
) ENGINE = InnoDb ;
";
$this->doSQL($pdo,$sql);
}
function createProdTypeTable($pdo)
{
$sql = "
CREATE TABLE `%prodtype%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` VARCHAR ( 150 ) NOT NULL,
`usekitchen` INT(1) NOT NULL,
`usesupplydesk` INT(1) NOT NULL,
`kind` INT(2) NOT NULL,
`sorting` INT(2) NULL,
`reference` INT (10) NULL,
`removed` INT(1) NULL,
FOREIGN KEY (reference) REFERENCES %prodtype%(id)
) ENGINE = InnoDb ;
";
$this->doSQL($pdo,$sql);
}
function createProductTable($pdo)
{
$sql = "
CREATE TABLE `%products%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`shortname` VARCHAR ( 150 ) NOT NULL,
`longname` VARCHAR ( 150 ) NOT NULL,
`priceA` DECIMAL (5,2) NULL,
`priceB` DECIMAL (5,2) NULL,
`priceC` DECIMAL (5,2) NULL,
`category` INT(3) NULL,
`sorting` INT(2) NULL,
`available` INT(2) NOT NULL,
`audio` VARCHAR ( 150 ) NULL,
`removed` INT(1) NULL,
FOREIGN KEY (category) REFERENCES %prodtype%(id)
) ENGINE = InnoDb ;
";
$this->doSQL($pdo,$sql);
}
function createUserTable($pdo)
{
$sql = "
CREATE TABLE `%user%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`username` VARCHAR ( 150 ) NOT NULL,
`userpassword` VARCHAR ( 150 ) NOT NULL,
`is_admin` INT (2) NOT NULL,
`right_waiter` INT (2) NOT NULL,
`right_kitchen` INT (2) NOT NULL,
`right_bar` INT (2) NOT NULL,
`right_supply` INT (2) NOT NULL,
`right_paydesk` INT (2) NOT NULL,
`right_statistics` INT (2) NOT NULL,
`right_bill` INT (2) NOT NULL,
`right_products` INT (2) NOT NULL,
`right_manager` INT (2) NOT NULL,
`lastmodule` VARCHAR ( 30 ) NULL,
`ordervolume` INT (2) NULL,
`active` INT (2) NOT NULL
) ENGINE = InnoDb ;
";
$this->doSQL($pdo,$sql);
}
function createPaymentTable($pdo) {
$sql = "
CREATE TABLE `%payment%` (
`id` INT (3) NOT NULL UNIQUE,
`name` VARCHAR ( 20 ) NOT NULL
) ENGINE = InnoDb
";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute();
$sql = "INSERT INTO %payment% (id,name) VALUES (?,?)";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute(array('1', 'Barzahlung'));
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute(array('2', 'EC-Kartenzahlung'));
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute(array('3', 'Kreditkartenzahlung'));
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute(array('4', 'Rechnung'));
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute(array('5', 'Ueberweisung'));
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute(array('6', 'Lastschrift'));
}
function createHistTables($pdo) {
$sql = "
CREATE TABLE `%hist%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`date` DATETIME NOT NULL ,
`action` INT ( 2 ) NOT NULL,
`refid` INT (10) NOT NULL
) ENGINE = InnoDb
";
$this->doSQL($pdo,$sql);
$sql = "
CREATE TABLE `%histprod%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`prodid` INT (10) NOT NULL,
`shortname` VARCHAR ( 150 ) NOT NULL,
`longname` VARCHAR ( 150 ) NOT NULL,
`priceA` DECIMAL (5,2) NULL,
`priceB` DECIMAL (5,2) NULL,
`priceC` DECIMAL (5,2) NULL,
`sorting` INT(2) NULL,
`available` INT(2) NOT NULL,
`audio` VARCHAR ( 150 ) NULL,
FOREIGN KEY (prodid) REFERENCES %products%(id)
) ENGINE = InnoDb
";
$this->doSQL($pdo,$sql);
$sql = "
CREATE TABLE `%histconfig%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`configid` INT (10) ,
`setting` VARCHAR ( 10000 ),
FOREIGN KEY (configid) REFERENCES %config%(id)
) ENGINE = InnoDb
";
$this->doSQL($pdo,$sql);
$sql = "
CREATE TABLE `%histuser%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`userid` INT (10) ,
`username` VARCHAR ( 150 ) NOT NULL,
`is_admin` INT (2) NOT NULL,
`right_waiter` INT (2) NOT NULL,
`right_kitchen` INT (2) NOT NULL,
`right_bar` INT (2) NOT NULL,
`right_supply` INT (2) NOT NULL,
`right_paydesk` INT (2) NOT NULL,
`right_statistics` INT (2) NOT NULL,
`right_bill` INT (2) NOT NULL,
`right_products` INT (2) NOT NULL,
`right_manager` INT (2) NOT NULL,
`active` INT (2) NOT NULL,
FOREIGN KEY (userid) REFERENCES %user%(id)
) ENGINE = InnoDb
";
$this->doSQL($pdo,$sql);
$sql = "
CREATE TABLE `%histactions%` (
`id` INT (3) NOT NULL,
`name` VARCHAR ( 20 ) NOT NULL,
`description` VARCHAR ( 150 ) NULL
) ENGINE = InnoDb
";
$this->doSQL($pdo,$sql);
$this->defineHistActions($pdo);
}
public function defineHistActions ($pdo) {
$sql = "INSERT INTO %histactions% (id,name,description) VALUES (?,?,?)";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute(array('1', 'ProdInit', 'Initiales Befuellen der Produkttabelle'));
$stmt->execute(array('2', 'ConfigInit', 'Initiales Befuellen der Konfigurationstabelle'));
$stmt->execute(array('3', 'UserInit', 'Initiales Befuellen der Benutzertabelle'));
$stmt->execute(array('4', 'ProdChange', 'Modifikation der Produktdaten'));
$stmt->execute(array('5', 'ProdCreation', 'Neues Produkt'));
$stmt->execute(array('6', 'ConfigChange', 'Modifikation der Konfiguration'));
$stmt->execute(array('7', 'UserCreation', 'Neuer Benutzer'));
$stmt->execute(array('8', 'UserChange', 'Modifikation eines Benutzers'));
}
function createRoomTable($pdo)
{
$sql = "
CREATE TABLE `%room%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`roomname` VARCHAR ( 150 ) NOT NULL,
`removed` INT(2) NULL,
`sorting` INT(2) NULL
) ENGINE = InnoDb ;
";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute();
}
function createRestTables($pdo)
{
$sql = "
CREATE TABLE `%resttables%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`tableno` VARCHAR ( 150 ) NOT NULL,
`roomid` INT ( 10 ) NOT NULL,
`removed` INT(2) NULL,
`sorting` INT(2) NULL,
FOREIGN KEY (roomid) REFERENCES %room%(id)
) ENGINE = InnoDb ;
";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute();
$sql = "INSERT INTO `%room%` (`id`, `roomname`) VALUES (NULL,?)";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute(array('Raum 1'));
$roomId = $pdo->lastInsertId();
$sql = "INSERT INTO `%resttables%` (`id` , `tableno`, `roomid`) VALUES (NULL ,?,?)";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute(array('Tisch 1',$roomId));
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute(array('Tisch 2',$roomId));
}
function createBillTable($pdo)
{
$sql = "
CREATE TABLE `%bill%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`billdate` DATETIME NOT NULL ,
`content` VARCHAR ( 50000 ) ,
`brutto` DECIMAL (5,2) NULL,
`netto` DECIMAL (5,2) NULL,
`tableid` VARCHAR ( 150 ) NOT NULL,
`closingid` INT(4) NULL,
`status` VARCHAR(2) NULL,
`paymentid` INT(2) NULL,
`userid` INT(3) NULL,
`ref` INT(10) NULL,
`tax` DECIMAL (5,2) NOT NULL,
FOREIGN KEY (closingid) REFERENCES %closing%(id),
FOREIGN KEY (paymentid) REFERENCES %payment%(id),
FOREIGN KEY (userid) REFERENCES %user%(id),
FOREIGN KEY (ref) REFERENCES %bill%(id)
) ENGINE = InnoDb ;
";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute();
// insert dummy entry so that select query with closing works
date_default_timezone_set('Europe/Berlin');
$currentTime = date('Y-m-d H:i:s');
$billInsertSql = "INSERT INTO `%bill%` (`id` , `billdate`,`content`,`brutto`,`tableid`,`paymentid`,`tax`) VALUES ( '0', '$currentTime' , '', '', '-1', NULL, '0.00')";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($billInsertSql));
$stmt->execute();
}
function createPriceLevelTable($pdo) {
$sql = "
CREATE TABLE `%pricelevel%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` VARCHAR ( 10000 ) ,
`info` VARCHAR ( 10000 )
) ENGINE = InnoDb ;
";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute();
}
function createConfigTable($pdo) {
$sql = "
CREATE TABLE `%config%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` VARCHAR ( 1000 ) ,
`setting` VARCHAR ( 10000 )
) ENGINE = InnoDb ;
";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute();
}
function createClosingTable($pdo) {
$sql = "
CREATE TABLE `%closing%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`closingdate` DATETIME NOT NULL ,
`remark` VARCHAR ( 10000 )
) ENGINE = InnoDb ;
";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute();
}
function createPrintJobsTable($pdo) {
$sql = "
CREATE TABLE `%printjobs%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`content` VARCHAR ( 50000 ) NOT NULL ,
`type` INT (2) NOT NULL
) ENGINE = InnoDb ;
";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute();
}
function resolveTablenamesInSqlString($sqlString) {
$out = str_replace("%queue%",$this->prefix . "queue",$sqlString);
$out = str_replace("%products%",$this->prefix . "products",$out);
$out = str_replace("%user%",$this->prefix . "user",$out);
$out = str_replace("%room%",$this->prefix . "room",$out);
$out = str_replace("%resttables%",$this->prefix . "resttables",$out);
$out = str_replace("%bill%",$this->prefix . "bill",$out);
$out = str_replace("%pricelevel%",$this->prefix . "pricelevel",$out);
$out = str_replace("%config%",$this->prefix . "config",$out);
$out = str_replace("%closing%",$this->prefix . "closing",$out);
$out = str_replace("%printjobs%",$this->prefix . "printjob",$out);
$out = str_replace("%hist%",$this->prefix . "hist",$out);
$out = str_replace("%histprod%",$this->prefix . "histprod",$out);
$out = str_replace("%histconfig%",$this->prefix . "histconfig",$out);
$out = str_replace("%histuser%",$this->prefix . "histuser",$out);
$out = str_replace("%histactions%",$this->prefix . "histactions",$out);
$out = str_replace("%payment%",$this->prefix . "payment",$out);
$out = str_replace("%billproducts%",$this->prefix . "billproducts",$out);
return (str_replace("%prodtype%",$this->prefix . "prodtype",$out));
}
function testDbConnection($host,$dbname,$user,$pass) {
$pdo = $this->openDbAndReturnPdo($host,$dbname,$user,$pass);
if (!is_null($pdo)) {
echo json_encode("OK");
} else {
echo json_encode("ERROR");
}
}
function writeConfigFile($host,$db,$user,$password,$prefix) {
$errorlevel = "<?php\nerror_reporting(E_ERROR);\n\n"; // development: E_ALL
$hostlines = "// Zum Aufbau der Verbindung zur Datenbank\n";
$hostlines .= "// die Daten erhalten Sie von Ihrem Provider\n";
$hostlines .= "define ( 'MYSQL_HOST','$host' );";
$userlines = "define ( 'MYSQL_USER', '$user' );";
$dbpasslines = "define ( 'MYSQL_PASSWORD', '$password' );";
$dblines = "define ( 'MYSQL_DB', '$db' );";
$prefixlines = "define ('TAB_PREFIX', '$prefix');";
$configText = "$errorlevel\n$hostlines\n$userlines\n$dbpasslines\n$dblines\n$prefixlines\n?>";
file_put_contents("../php/config.php", $configText);
}
}
$command = $_GET["command"];
if ($command == 'checkWriteAccess') {
$checker = new Installer();
$checker->checkWriteAccess();
} else if ($command == 'testDbConnection') {
$admin = new Admin();
try {
if (isset($_POST['host']) && isset($_POST['dbname']) && isset($_POST['user']) && isset($_POST['pass'])) {
$admin->testDbConnection($_POST['host'],$_POST['dbname'],$_POST['user'],$_POST['pass']);
} else {
echo json_encode("ERROR");
}
} catch (Exception $e) {
echo json_encode("ERROR");
}
} else if ($command == 'getConfig') {
$configWriter = new ConfigWriter();
$configWriter->getConfigVals();
} else if ($command == 'install') {
$admin = new Admin();
$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']);
$admin->setPdo($pdo);
$admin->setPrefix($_POST['prefix']);
$admin->createTables();
$admin->insertAdminUser($_POST['adminpass']);
$admin->writeConfigFile($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password'],$_POST['prefix']);
echo json_encode("OK");
}
?>

22
javaprinter/config.json Normal file
View File

@ -0,0 +1,22 @@
{
"vendorid" : "4348",
"productid" : "5584",
"printersize" : 32,
"printcode" : "123",
"baseurl":"http://localhost",
"baseusername" : "",
"basepass" : "",
"printreceipts" : 1,
"forreceiptprinters" : "1,2,3,4,5,6",
"printclosings" : 1,
"printfoodtickets1" : 1,
"printdrinktickets1" : 1,
"printfoodtickets2" : 1,
"printdrinktickets2" : 1,
"escinits" : [ 27, 64, 27, 116, 0 ],
"escposts" : [ 27,64,29,86,65,10],
"useeveryprintdevice" : 1,
"verbose_closing_summary" : 1,
"smallformat" : 0,
"logoscale" : 1.0
}

BIN
javaprinter/javaprinter.jar Normal file

Binary file not shown.

View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,167 @@
GNU LESSER GENERAL PUBLIC LICENSE
=================================
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates the terms
and conditions of version 3 of the GNU General Public License, supplemented
by the additional permissions listed below.
### 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser General
Public License, and the "GNU GPL" refers to version 3 of the GNU General
Public License.
"The Library" refers to a covered work governed by this License, other than
an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided by the
Library, but which is not otherwise based on the Library. Defining a
subclass of a class defined by the Library is deemed a mode of using an
interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an Application
with the Library. The particular version of the Library with which the
Combined Work was made is also called the "Linked Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code for
portions of the Combined Work that, considered in isolation, are based on
the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the object
code and/or source code for the Application, including any data and utility
programs needed for reproducing the Combined Work from the Application, but
excluding the System Libraries of the Combined Work.
### 1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License without
being bound by section 3 of the GNU GPL.
### 2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a facility
refers to a function or data to be supplied by an Application that uses the
facility (other than as an argument passed when the facility is invoked),
then you may convey a copy of the modified version:
* a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the function
or data, the facility still operates, and performs whatever part of its
purpose remains meaningful, or
* b) under the GNU GPL, with none of the additional permissions of this
License applicable to that copy.
### 3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from a
header file that is part of the Library. You may convey such object code
under terms of your choice, provided that, if the incorporated material is
not limited to numerical parameters, data structure layouts and accessors,
or small macros, inline functions and templates (ten or fewer lines in
length), you do both of the following:
* a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are covered by
this License.
* b) Accompany the object code with a copy of the GNU GPL and this license
document.
### 4. Combined Works.
You may convey a Combined Work under terms of your choice that, taken
together, effectively do not restrict modification of the portions of the
Library contained in the Combined Work and reverse engineering for debugging
such modifications, if you also do each of the following:
* a) Give prominent notice with each copy of the Combined Work that the
Library is used in it and that the Library and its use are covered by
this License.
* b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
* c) For a Combined Work that displays copyright notices during execution,
include the copyright notice for the Library among these notices, as
well as a reference directing the user to the copies of the GNU GPL and
this license document.
* d) Do one of the following:
* 0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form suitable
for, and under terms that permit, the user to recombine or relink
the Application with a modified version of the Linked Version to
produce a modified Combined Work, in the manner specified by
section 6 of the GNU GPL for conveying Corresponding Source.
* 1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time a
copy of the Library already present on the user's computer system,
and (b) will operate properly with a modified version of the
Library that is interface-compatible with the Linked Version.
* e) Provide Installation Information, but only if you would otherwise be
required to provide such information under section 6 of the GNU GPL,
and only to the extent that such information is necessary to install
and execute a modified version of the Combined Work produced by
recombining or relinking the Application with a modified version of the
Linked Version. (If you use option 4d0, the Installation Information
must accompany the Minimal Corresponding Source and Corresponding
Application Code. If you use option 4d1, you must provide the
Installation Information in the manner specified by section 6 of the
GNU GPL for conveying Corresponding Source.)
### 5. Combined Libraries.
You may place library facilities that are a work based on the Library side
by side in a single library together with other library facilities that are
not Applications and are not covered by this License, and convey such a
combined library under terms of your choice, if you do both of the
following:
* a) Accompany the combined library with a copy of the same work based on
the Library, uncombined with any other library facilities, conveyed
under the terms of this License.
* b) Give prominent notice with the combined library that part of it is a
work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
### 6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions of the
GNU Lesser General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Library as you
received it specifies that a certain numbered version of the GNU Lesser
General Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that published
version or of any later version published by the Free Software Foundation.
If the Library as you received it does not specify a version number of the
GNU Lesser General Public License, you may choose any version of the GNU
Lesser General Public License ever published by the Free Software
Foundation.
If the Library as you received it specifies that a proxy can decide whether
future versions of the GNU Lesser General Public License shall apply, that
proxy's public statement of acceptance of any version is permanent
authorization for you to choose that version for the Library.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,108 +0,0 @@
function declareProductBeCookingOrCooked(queueid,action) {
var data = { queueid: queueid,
action : action};
doAjax("POST","php/contenthandler.php?module=queue&command=declareProductBeCookingOrCooked",data,resultOfProductDeclaration,"could not declare product");
}
function resultOfProductDeclaration(jsonText) {
if (jsonText.status != "OK") {
alert("Fehler " + jsonText.code + ": " + jsonText.msg);
}
}
function declareProductNOTBeCooked(queueid) {
var data = { queueid: queueid };
doAjax("POST","php/contenthandler.php?module=queue&command=declareProductNotBeCooked",data,resultOfProductDeclaration,"could not unmake product");
}
function fillTableWithEntriesToCook(entriesToCook) {
var aList = '';
$.each(entriesToCook, function (i, table) {
aList += listOfTable(table);
});
$("#listWithEntriesToCook").html(aList);
$("#listWithEntriesToCook").trigger("create");
$(".preparedlistitem").off("click").on("click", function (e) {
if ($(this).hasClass("cooking")) {
declareProductBeCookingOrCooked($(this).attr("id"),"r");
} else {
declareProductBeCookingOrCooked($(this).attr("id"),"c");
}
getAndDisplayAllEntries();
});
}
function listOfTable(table) {
var tableid = table.tableid;
var tablename = table.table;
var maxWaitTime = table.maxwaittime;
var aList = '<ul data-role="listview" id="' + tableid + '" data-divider-theme="a" data-inset="true">';
aList += '<li data-role="list-divider" data-theme="c" data-role="heading">' + tablename + ' (Max. Wartezeit: ' + maxWaitTime + ' min)</li>';
var itemsForTable = table.queueitems;
$.each(itemsForTable, function (i, entry) {
var option = '';
if (entry.option != '') {
option = '<p>' + entry.option + '</p>';
}
var theme = 'c';
var icon = "check";
var status = "not_cooking";
var label = entry.longname;
if (entry.cooking != '') {
theme ='d';
icon = "arrow-d";
status = "cooking";
label += "<small><i> (" + entry.cooking + ")</i></small>";
}
var img = '<img src="img/waittimes/' + entry.waiticon + '" />';
aList += '<li data-theme="' + theme + '" data-icon="' + icon + '" class="preparedlistitem ' + status + '" + id="'+ entry.id + '"><a href="#">' + img + label + option + '</a></li>';
});
aList += '</ul>';
return aList;
}
function fillTableWithCookedEntries(cookedEntries) {
var theList = '<ul data-role="listview" id="deliveredProdsList" data-divider-theme="a" data-inset="true">';
theList += '<li data-role="list-divider" data-theme="b" data-role="heading" data-icon="check">Zubereitet</li>';
$.each(cookedEntries, function (i, queueentry) {
var prodname = queueentry.longname;
var option = queueentry.option;
var readytime = queueentry.readytime;
var tablename = queueentry.tablename;
var infotext = tablename;
if (option != '') {
infotext = option + ' - ' + tablename;
}
var queue_entry_id = queueentry.id;
var tablename = queueentry.tablename;
theList += '<li data-theme="e" data-icon="arrow-u" id="' + queueentry.id + '" class="deliveredlistitem"><a href="#">' + prodname;
theList += '<p>' + infotext + '</p>';
theList += '</A></LI>';
});
theList += '</ul>';
$("#listWithCookedEntries").html(theList);
$("#listWithCookedEntries").trigger("create");
$(".deliveredlistitem").off("click").on("click", function (e) {
declareProductNOTBeCooked($(this).attr("id"));
getAndDisplayAllEntries();
});
}
function getAndDisplayAllEntries()
{
getEntriesToCook();
getCookedEntries();
}

File diff suppressed because it is too large Load Diff

View File

@ -1,929 +0,0 @@
<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=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>
</head>
<body>
<style>
@media screen
{
.receipttable {width: 30%; background-color: #cccccc;}
}
@media print
{
.receipttable {width: 100%;};
}
@media print
{
#thefooter,#theheader,#modulemenu,#oben,#untenarea,#payWithoutPrint,#paybuttongroup,#hostbuttongroup {display: none;}
}
</style>
<script>
function getTax() {
doAjax("GET", "php/contenthandler.php?module=admin&command=getTax", null, insertTax, "Fehler Umsatzsteuerdaten");
}
function getTogoTax() {
doAjax("GET", "php/contenthandler.php?module=admin&command=getTogoTax", null, insertTogoTax, "Fehler Umsatzsteuerdaten");
}
function getCompanyInfo() {
doAjax("GET", "php/contenthandler.php?module=admin&command=getCompanyInfo", null, insertCompanyInfo, "Fehler Betriebsinfo");
}
function getLogoUrl() {
doAjax("GET", "php/contenthandler.php?module=admin&command=getLogoUrl", null, insertLogoUrl, "Fehler Logo-URL");
}
function getPayPrintType() {
doAjax("GET", "php/contenthandler.php?module=admin&command=getPayPrintType", null, insertPayPrintType, "Fehler Druckkonfiguration");
}
function getPayments() {
doAjax("GET", "php/contenthandler.php?module=admin&command=getPayments", null, insertPayments, "Fehler Zahlungswege");
}
function insertTax(taxval) {
if (taxval == "FAILED") {
alert("Keine Umsatzsteuerinformation bekommen!");
} else {
var usstGerVal = taxval.replace(".", ",");
$("#info-page").data("usstGerVal",usstGerVal);
$("#info-page").data("usst",taxval);
}
}
function insertTogoTax(taxval) {
if (taxval == "FAILED") {
alert("Keine ToGo-Umsatzsteuerinformation bekommen!");
} else {
var usstGerVal = taxval.replace(".", ",");
$("#info-page").data("togoTaxGerVal",usstGerVal);
$("#info-page").data("togotax",taxval);
}
}
function insertCompanyInfo(companyInfo) {
$("#info-page").data("companyInfo",companyInfo);
}
function insertLogoUrl(logoUrl) {
$("#info-page").data("logoUrl",logoUrl);
}
function insertPayPrintType(payPrintType) {
$("#info-page").data("payPrintType",payPrintType);
}
function insertPayments(payments) {
var paymentList = "";
$.each(payments, function (i,payType) {
paymentList += '<a href="#" class="sure-do" data-role="button" data-theme="f" data-rel="back" id="paym_' + payType.id + '">' + payType.name + '</a>';
});
paymentList += '<a href="#" data-role="button" data-theme="d" data-rel="back" id="paym_cancel">Abbruch</a>';
$("#paymentlist").html(paymentList);
}
function hideReceiptPart() {
$("#payWithoutPrint").hide();
$("#payWithPrint").hide();
$("#hostbutton").hide();
$("#togobutton").hide();
$("#unten").hide();
}
function showReceiptPart() {
$("#payWithoutPrint").show();
$("#payWithPrint").show();
$("#hostbutton").show();
$("#togobutton").show();
$("#unten").show();
}
function displayAllRooms() {
$("#moneyToInsert").val("");
$("#moneyToTakeOut").val("");
$("#cashactions").show();
hideReceiptPart();
// first empty receipt
$("#prodlistinreceipt").empty().append('<td id="receiptprodheader" class="price">Anz<td>Beschreibung<td class="price">Preis<td class="price">Total');
$.getJSON("php/contenthandler.php?module=roomtables&command=getRooms",function(roomtableinfo) {
var noOfRooms = roomtableinfo.length;
if (noOfRooms == 1) {
$("#info-page").data("roomid",roomtableinfo[0]["id"]);
displayTablesOfRoom(roomtableinfo[0]);
} else {
var li = "";
$.each(roomtableinfo, function (i, name) {
li += '<li data-theme="f"><a href="#" id="' + i + '" class="info-go">' + name.name + '</a></li>';
});
$("#oben").append(li).promise().done(function () {
$(this).off("click").on("click", "a", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var roomdetail = roomtableinfo[this.id];
$("#info-page").data("roomid",roomdetail["id"]);
displayTablesOfRoom(roomdetail);
});
refreshList(this);
});
}
});
}
function displayTablesOfRoom (roomdetail) {
var roomid = $("#info-page").data("roomid");
hideReceiptPart();
displayUnpaidTables("Tischinfo nicht erhalten!");
}
$(document).ready(function() {
var refreshId = setInterval(function() {
var roomid = $("#info-page").data("roomid");
if (roomid != null) {
displayUnpaidTables(null);
}
}, 10000);
$.ajaxSetup({ cache: false });
});
function displayUnpaidTables(errorMsg) {
doAjax("GET","php/contenthandler.php?module=roomtables&command=getUnpaidTables",{roomid:$("#info-page").data("roomid")},displayTables,errorMsg);
}
function displayTables(tables) {
$("#info-page").data("tableviewactive",1);
var li = '<li data-role="list-divider" data-theme="b" data-role="heading">Tischauswahl</li>';
$.each(tables, function( index, value ) {
var sum = value["sum"].replace(".",",");
var txt = value["name"] + "&nbsp;&nbsp;&nbsp;&nbsp;<small><i>(" + sum + " Euro)</i></small>";
li += '<li data-theme="e"><a href="#" id="' + index + '" class="info-go">' + txt + '</a></li>';
});
//append list to ul
$("#oben").empty().append(li).promise().done(function () {
$(this).off("click").on("click", ".info-go", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
// this.id = Nummer des Eintrags in der Liste der Tische (d.h. 8. Eintrag k?nnte Tisch 10 sein)
//var roomid = roomdetail["id"]; // hier ist roomdetail das alte, nicht das von oben!!!
$("#info-page").data("roomid",null);
$("#info-page").data("tableviewactive",0);
var tableid = tables[this.id]["id"];
var tablename = tables[this.id]["name"];
$("#info-page").data("tid",tableid);
$("#info-page").data("tablename",tablename);
//var roomtable_array= new Array(roomid,tableid,tablename);
getProdsToPayForTable(tableid,tablename);
});
//refresh list to enhance its styling.
refreshList(this);
});
};
function getProdsToPayForTable(tableid,tablename) {
$("#cashactions").hide();
$.ajax({ type: "GET",
dataType: "json",
data : { tableid: tableid },
url: "php/contenthandler.php?module=queue&command=getJsonProductsOfTableToPay",
async: false,
success : function(jsonText)
{
var status = jsonText.status;
var msg = jsonText.msg;
if (status != "ERROR") {
showReceiptPart();
$("#info-page").data("tableprods",msg);
bindPayButton(msg,tableid,tablename);
displayProdsToPayForTable(msg,tablename);
} else {
alert("Fehler: " + msg);
}
},
error: function( text ) {
alert( "Sorry, there was a problem getting the products to pay for table!");
}
});
}
function displayProdsToPayForTable(jsonContent,tablename) {
$('#tableinreceipt').html(tablename + '<br>&nbsp;');
clearUntenAndReceipt();
createAllEntriesInReceipt();
calcSum();
$("#oben").empty().promise().done(function () {
var li = '<li data-role="list-divider" data-theme="b" data-role="heading">Ausstehend für Tisch ' + tablename + '</li>'; // init a list
$("#oben").empty().append(li);
$("#oben").append('<li data-theme="f" data-icon="check"><a href="#" id="payall">Alles</a></li>');
$.each(jsonContent, function (index,aProd) {
// var queueid = jsonContent[this.id]["id"];
addToOben(aProd["prodid"],aProd["longname"],aProd["price"],aProd["pricelevelname"],index);
});
});
refreshList("#oben");
addAllToUnten(jsonContent,tablename);
}
function generateListItem(theme,icon,id,content) {
var li = '<li data-theme="' + theme + '" data-icon="' + icon + '">';
li += '<a href="#" id="' + id + '" class="info-go">' + content + '</a></li>';
return li;
}
function addAllToUnten(jsonContent,tablename) {
$("#payall").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var entryListForReceipt=new Array();
$("#oben li a.info-go").each(function() {
var id_in_jsonText = $(this).attr('id');
var prodid = jsonContent[id_in_jsonText]["prodid"];
var longname = jsonContent[id_in_jsonText]["longname"];
var price = jsonContent[id_in_jsonText]["price"];
var pricelevelname = jsonContent[id_in_jsonText]["pricelevelname"];
var entry = new Array(id_in_jsonText,prodid,longname,price,pricelevelname);
entryListForReceipt.push(entry);
});
$.each(entryListForReceipt, function (i, entry) {
var indexInJson = entry[0];
var prodid = entry[1];
var longname = entry[2];
var price = entry[2];
var pricelevelname = entry[2];
addToUnten(prodid,longname,price,pricelevelname,indexInJson);
$("#oben li .info-go").each(function() {
$(this).closest('li').remove().promise();
});
refreshList("#oben");
});
});
}
function addToOben(prodid,longname,price,pricelevelname,index) {
var jsonContent = $("#info-page").data("tableprods");
var tablename = $("#info-page").data("tablename");
if (pricelevelname != "A") {
longname += " (" + pricelevelname + ")";
}
var li_item = generateListItem("c","plus",index,longname);
$("#oben").append(li_item).promise().done(function () {
createAllEntriesInReceipt();
$(this).off("click").on("click", ".info-go", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var prodid = jsonContent[this.id]["prodid"];
var price = jsonContent[this.id]["price"];
var pricelevelname = jsonContent[this.id]["pricelevelname"];
var longname = jsonContent[this.id]["longname"];
addToUnten(prodid,longname,price,pricelevelname,this.id);
createAllEntriesInReceipt();
$(this).closest("li").remove();
refreshList("#oben");
});
});
refreshList("#oben");
}
// Make table empty...
function clearUntenAndReceipt() {
var untenHeader = '<li data-role="list-divider" data-theme="b" data-role="heading">';
untenHeader += 'Inhalt Kassenbon: <p id="priceinreceipt">0,00 Euro</p></li>';
$("#unten").empty().append(untenHeader).promise().done(function () {
refreshList("#unten");
});
$('#prodlistinreceipt tr').each(function() {
$(this).remove();
});
$("#thedate").html('<br><br>&nbsp;<br>');
}
function addToUnten(prodid,longname,price,pricelevelname,index) {
var jsonContent = $("#info-page").data("tableprods");
var tablename = $("#info-page").data("tablename");
if (pricelevelname != "A") {
longname += " (" + pricelevelname + ")";
}
var li_item = generateListItem("f","minus",index,longname);
$("#unten").append(li_item).promise().done(function () {
createAllEntriesInReceipt();
$(this).off("click").on("click", ".info-go", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var prodid = jsonContent[this.id]["prodid"];
var price = jsonContent[this.id]["price"];
var pricelevelname = jsonContent[this.id]["pricelevelname"];
var longname = jsonContent[this.id]["longname"];
addToOben(prodid,longname,price,pricelevelname,this.id);
$(this).closest("li").remove();
createAllEntriesInReceipt();
refreshList("#unten");
});
});
refreshList("#unten");
}
// arrayToFill:
// [0]: count prodid prodid-pricelevelname queueid longname price pricelevelname
// [1]: count prodid prodid-pricelevelname queueid longname price pricelevelname
//
// entry:
// [0]: prodid queueid longname price pricelevelname
function addEntryOrIncreaseCount(arrayToFill,entry) {
var index=0;
var found = false;
var combinedIdAndPricelevel = entry[0] + "-" + entry[4];
for (index=0;index<arrayToFill.length;index++) {
var anEntry = arrayToFill[index];
// entry = prodid,queueid,longname,price,pricelevelname
// anEntry = count,prodid,"prodid-pricelevel",queueid,longname,price
if (anEntry[2] == combinedIdAndPricelevel) {
// prodid equal
anEntry[0] += 1;
//alert("Duplikate: " + anEntry[0]);
found = true;
}
}
if (!found) {
//alert("Adde hinzu);
arrayToFill.push(new Array(1,entry[0],combinedIdAndPricelevel,entry[1],entry[2],entry[3],entry[4]));
}
return arrayToFill;
}
function calcSum() {
var jsonContent = $("#info-page").data("tableprods");
var sum = 0.0;
var tax = parseFloat($("#info-page").data("usst"));
if ($("#info-page").data("taxtype") == "togo") {
tax = parseFloat($("#info-page").data("togotax"));
}
$("#unten li a.info-go").each(function() {
var id_in_jsonText = $(this).attr('id');
var price = jsonContent[id_in_jsonText]["price"];
sum += parseFloat(price);
});
var netto = sum/(1 + tax/100.0);
var mwst_part = sum - netto;
$("#mwst").html(mwst_part.toFixed(2).replace(".",","));
$("#netto").html(netto.toFixed(2).replace(".",","));
$("#brutto").html(sum.toFixed(2).replace(".",","));
$("#priceinreceipt").html(sum.toFixed(2).replace(".",",") + " Euro");
$("#priceinreceipt2").html(sum.toFixed(2).replace(".",",") + " Euro");
}
function createAllEntriesInReceipt() {
var jsonContent = $("#info-page").data("tableprods");
var tablename = $("#info-page").data("tablename");
var priceStyle = 'style="border: solid black 0px;padding: 3px;text-align:right;vertical-align:bottom;"';
var entryListForReceipt=new Array();
// collect all entries in the list #unten
$("#unten li a.info-go").each(function() {
//tablecontent += '<tr class="prodlistinreceipt"><td id="count" class="price">1<td>' + longname + '<td id="price" class="price">' + (eval(price)).toFixed(2) + '<td id="total" class="price">' + (eval(price)).toFixed(2) + '</tr>';
var id_in_jsonText = $(this).attr('id');
var queueid = jsonContent[id_in_jsonText]["id"];
var prodid = jsonContent[id_in_jsonText]["prodid"];
var longname = jsonContent[id_in_jsonText]["longname"];
var price = jsonContent[id_in_jsonText]["price"];
var pricelevelname = jsonContent[id_in_jsonText]["pricelevelname"];
var entry = new Array(prodid,queueid,longname,price,pricelevelname);
entryListForReceipt = addEntryOrIncreaseCount(entryListForReceipt,entry);
});
var tablecontent = createReceiptHeader();
var index=0;
for (index=0;index<entryListForReceipt.length;index++) {
var anEntry = entryListForReceipt[index];
var count = parseInt(anEntry[0]);
var prodid = anEntry[1];
var queueid = anEntry[3];
var longname = anEntry[4];
var price = parseFloat(anEntry[5]);
var pricelevelname = anEntry[6];
if (pricelevelname != "A") {
longname += " (" + pricelevelname + ")";
}
var totalPrice = count * price;
var aProductLine = '<tr>';
//aProductLine += '<td class="price" id="prodid">' + prodid;
aProductLine += '<td ' + priceStyle + ' id="count">' + count + '<td>&nbsp;<td colspan=2>' + longname;
aProductLine = aProductLine + '<td ' + priceStyle + '>' + price.toFixed(2).replace(".",",");
aProductLine += '<td ' + priceStyle + '>' + totalPrice.toFixed(2).replace(".",",") + '</tr>';
tablecontent += aProductLine;
}
var taxGerFormat = $("#info-page").data("usstGerVal");
if ($("#info-page").data("taxtype") == "togo") {
taxGerFormat = $("#info-page").data("togoTaxGerVal");
}
tablecontent += createReceiptFooter(taxGerFormat);
// now calculate everything without hosting part for later export
$('#receiptpart').html(tablecontent);
calcSum(); // updates info:
var calculatedBill = $('#receiptpart').html();
$('#info-page').data("receipthtml",calculatedBill);
// shall the hosting be visible?
var visibilityHostPart = $("#info-page").data("hosting");
var hosttablepart = "";
if (visibilityHostPart == 1) {
// need to use .ajax instead of .get to set cache to false!
$.ajax({
url: "customer/bon-bewirtungsvorlage.html",
async: false,
success: function(hostdata){
$('#receiptpart').html(tablecontent + hostdata);
calcSum();
},
error: function( text ) {
alert( "Kommunikationsfehler zum Server: ");
},
cache: false
});
} else {
$('#receiptpart').html(tablecontent + hosttablepart);
calcSum();
}
}
function createReceiptHeader() {
var priceStyle = 'style="border: solid black 0px;padding: 3px;text-align:right;vertical-align:bottom;"';
var tablename = $("#info-page").data("tablename");
var logoUrl = $("#info-page").data("logoUrl");
var header = '';
if (logoUrl.length != 0) {
header += '<tr><td colspan=6><img src="' + logoUrl + '" width=100% /></td></tr>';
}
header += '<tr><td colspan=6>&nbsp;</tr>';
header += '<tr><td colspan=4>Tisch: ' + tablename + ' <td id="billid" colspan=2 ' + priceStyle + '></tr>';
header += '<tr><td colspan=4>&nbsp;<td id="billdate" colspan=2 ' + priceStyle + '></tr>';
header += '<tr><td colspan=4>Es bedient Sie: ' + $("#loggedinuser").html() + "</tr>";
header += '<tr><td colspan=6>&nbsp</tr>';
header += '<tr><td>Anz <td>&nbsp; <td colspan=2>Beschreibung <td ' + priceStyle + '>Preis <td ' + priceStyle + '>Total </tr>';
return header;
}
function createReceiptFooter(taxGerFormat) {
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>&nbsp</tr>';
var footer = emptyLine;
footer += '<tr><td> &nbsp; <td colspan=3>Summe: <td id="priceinreceipt2" ' + priceStyle + ' colspan=2></td></tr>';
footer += emptyLine;
footer += '<tr><td colspan=2>MwSt% <td ' + priceStyle + '>MwST <td ' + priceStyle + '>Netto <td ' + priceStyle + ' colspan=2>Brutto </tr>';
footer += '<tr><td colspan=2>' + taxGerFormat + '% <td id="mwst" ' + priceStyle + '> <td id="netto" ' + priceStyle + '><td id="brutto" ' + priceStyle + ' colspan=2> </tr>';
footer += '<tr><td ' + infoStyle + ' colspan=6><center>&nbsp;<br>';
footer += $("#info-page").data("companyInfo").replace(/(?:\r\n|\r|\n)/g, '<br />');
footer += '</center></tr>';
return footer;
}
function bindPayButton(jsonContent,tableid,tablename) {
$("#payWithoutPrint").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
selectPayment(jsonContent,tableid,tablename,false);
});
$("#payWithPrint").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
selectPayment(jsonContent,tableid,tablename,true);
});
}
function selectPayment(jsonContent,tableid,tablename,printoption) {
// first test if there are items to pay!
var itemsToPay = $('#unten li').size() - 1;
if (itemsToPay == 0) {
$.mobile.changePage("#nocashitems");
} else {
// start pay process by selection of payment types
$.mobile.changePage("#paymentdialog");
$("#paymentdialog .sure-do").off("click").on("click", function() {
var paymentId = (($(this).attr("id")).split("_"))[1];
$(this).off("click");
$.mobile.changePage("#info-page");
var appliedTax = $("#info-page").data("usst");
if ($("#info-page").data("taxtype") == "togo") {
appliedTax = $("#info-page").data("togotax");
}
startPayProcess(jsonContent,printoption,tableid,tablename,paymentId,appliedTax);
});
}
}
function startPayProcess(jsonContent,printoption,tableid,tablename,paymentid,tax) {
var ids="";
$('#unten li').each(function() {
var index = $(this).find("a").attr("id");
if (typeof index != 'undefined') {
var queueid = jsonContent[index]["id"];
ids += queueid + ",";
}
});
// declarePaidCreateBillReturnBillId
var style = ' style="width: 30%; background-color: #cccccc;" ';
var htmlContentWithoutHosting = '<table ' + style + '>' + $('#info-page').data("receipthtml") + '</table>';
$.ajax({ type: "POST",
dataType: "json",
data : { ids: ids,
html : htmlContentWithoutHosting,
brutto: $("#brutto").html().replace(",","."),
netto: $("#netto").html().replace(",","."),
tableid : tableid,
paymentid : paymentid,
tax : tax
},
url: "php/contenthandler.php?module=queue&command=declarePaidCreateBillReturnBillId",
async: false,
success : function(jsonText)
{
var status = jsonText.status;
var billinfo = jsonText.msg;
if (status != "ERROR") {
billid = billinfo.billid;
billdate = billinfo.date;
if (billid < 0) {
alert("Error! Bitte erneut versuchen. Error code: " + billid);
window.location.reload(false);
} else {
$("#billid").html("Bon-Nr: " + billid);
$("#billdate").html(billdate);
if (printoption) {
var htmlContent = "<table width=100%>" + $("#receiptpart").html() + "</table>";
var payPrintType = $("#info-page").data("payPrintType");
if (payPrintType == 's') {
printBill(htmlContent);
} else {
window.print();
}
}
var itemsLeft = $('#oben li').size() - 2;
if (itemsLeft > 0) {
getProdsToPayForTable(tableid,tablename);
} else {
// so that reload also works for Chrome:
setTimeout(function(){document.location.href = "paydesk.html"},500);
}
}
} else {
alert("Fehler: " + msg);
}
},
error: function( text ) {
alert( "Sorry, there was a problem! " + text);
}
});
}
function printBill(htmlText) {
doAjax("POST","php/contenthandler.php?module=printqueue&command=queuePrintJob",
{content : htmlText, type: 3 }, null, "Druckfehler");
}
function bindHostButton() {
$("#hostbutton").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var statusVisibility = $("#info-page").data("hosting");
if (statusVisibility == '0') {
$("#info-page").data("hosting",'1');
} else {
$("#info-page").data("hosting",'0');
}
createAllEntriesInReceipt();
});
}
function bindTogoButton() {
$("#togobutton").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
if ($("#info-page").data("taxtype") == "normal") {
$("#info-page").data("taxtype","togo");
$("#togobutton").buttonMarkup({ icon: "check"});
} else {
$("#info-page").data("taxtype","normal");
$("#togobutton").buttonMarkup({ icon: "delete"});
}
createAllEntriesInReceipt();
});
}
function cashactions() {
$(".cashaction").off("click").on("click", function (e) {
var id = $(this).attr('id');
if (id == "cashtakeout") {
startCashTakeOutProcess();
} else if (id == "cashinsert") {
startCashInsertProcess();
} else if (id == "cashoverview") {
startCashOverviewProcess() ;
}
});
}
function startCashInsertProcess() {
$("#cashinsertdialog .sure-do").off("click").on("click", function() {
//$(this).off("click");
$.mobile.changePage("#info-page");
var money = $("#moneyToInsert").val().replace(",",".");
if (isNaN(money)) {
alert("Keine Zahl!");
} else {
if (parseFloat(money) >= 0.0) {
doCashInsert(money);
} else {
alert("Betrag muss positiv sein!");
}
}
});
$.mobile.changePage("#cashinsertdialog");
}
function startCashTakeOutProcess() {
$("#cashtakeoutdialog .sure-do").off("click").on("click", function() {
//$(this).off("click");
$.mobile.changePage("#info-page");
var money = $("#moneyToTakeOut").val().replace(",",".");
if (isNaN(money)) {
alert("Keine Zahl!");
} else {
if (parseFloat(money) >= 0.0) {
doCashTakeOut(money);
} else {
alert("Betrag muss positiv sein!");
}
}
});
$.mobile.changePage("#cashtakeoutdialog");
}
function doCashInsert(money) {
doAjax("POST", "php/contenthandler.php?module=bill&command=doCashAction", {money: money}, handleCashActionResult, "Fehler Kassenaktion");
}
function doCashTakeOut(money) {
money = 0.0 - parseFloat(money);
doAjax("POST", "php/contenthandler.php?module=bill&command=doCashAction", {money: money}, handleCashActionResult, "Fehler Kassenaktion");
}
function startCashOverviewProcess() {
doAjax("POST", "php/contenthandler.php?module=bill&command=getCashOverviewOfUser", null, showCashOverview, "Fehler Kassenaktion");
}
function handleCashActionResult(jsonText) {
if (jsonText.status == "ERROR") {
alert("Fehler " + jsonText.code + ": " + jsonText.msg);
} else if (jsonText.status == "OK") {
alert("Kassenaktion abgeschlossen");
}
}
function showCashOverview(jsonText) {
$("#cashbyguests").html((parseFloat(jsonText.guestmoney).toFixed(2)).replace(".",","));
$("#cashtotal").html((parseFloat(jsonText.total).toFixed(2)).replace(".",","));
$.mobile.changePage("#cashoverviewinfo");
}
$(document).on("pageinit", "#info-page", function () {
initializeMainMenu("#modulemenu");
hideMenu();
getTax(); // put tax info as data to page
$("#info-page").data("taxtype","normal");
getTogoTax();
getCompanyInfo(); // request the company info and put it as data to page for later use
getLogoUrl();
getPayPrintType();
getPayments();
$("#hostingtablepart").hide();
$("#info-page").data("hosting",'0');
bindHostButton();
bindTogoButton();
cashactions();
// button in header to start paydesk
$("#startpaypage").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
window.location.reload(false);
});
var urlsuffix = location.search;
if (urlsuffix.length==0) {
displayAllRooms();
} else {
var urlstr=urlsuffix.slice(1);
var parts= urlstr.split("=");
if (parts.length != 2) {
// default
displayAllRooms();
}
var tid = parts[1];
// do not show cash actions if URL called by waiter module
$("#cashactions").hide();
$.ajax({ type: "GET",
url: "php/contenthandler.php?module=queue&command=getJsonTableNameFromId",
dataType: "json",
data: {tableid : tid},
async: false,
success : function(jsonContent)
{
$("#info-page").data("tid",tid);
$("#info-page").data("tablename",jsonContent);
getProdsToPayForTable(tid,jsonContent);
},
error: function( text ) {
alert( "Kommunikationsfehler zum Server bei Tischnamenabfrage: " + errorMsg);
}
});
}
});
</script>
<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">Module</li>
</ul>
</div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="theheader">
<h1>Kasse</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 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">
<ul data-role="listview" id="oben" data-divider-theme="a" data-inset="true">
<li data-role="list-divider" data-theme="b" data-role="heading">Raumauswahl</li>
</ul>
<ul data-role="listview" id="cashactions" data-divider-theme="a" data-inset="true">
<li data-role="list-divider" data-theme="b" data-role="heading">Kassenaktionen</li>
<li data-theme="e"><a href="#" id="cashinsert" class="info-go cashaction">Bareinlage</a></li>
<li data-theme="e"><a href="#" id="cashtakeout" class="info-go cashaction">Barentnahme</a></li>
<li data-theme="e"><a href="#" id="cashoverview" class="info-go cashaction">Einnahmen</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">Nur Zahlung</a>
<a href="#" data-role="button" data-theme="b" data-icon="grid" id="payWithPrint">Bondruck</a>
</div>
<div data-role="controlgroup" data-type="horizontal" id="hostbuttongroup">
<a href="#" data-role="button" data-theme="b" data-icon="check" id="hostbutton">Bewirtungsbeleg</a>
<a href="#" data-role="button" data-theme="b" data-icon="delete" id="togobutton">To Go</a>
</div>
<div id="partForSaveInBill"> <!-- This part will be saved into bill in db -->
<table id="receiptpart" class="receipttable" border=1>
</table>
</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">
<h3>Zahlungsart</h3>
<p>Auswahl der Zahlungsart</p>
<div id=paymentlist>
<a href="#" class="sure-do" data-role="button" data-theme="b" data-rel="back">Ja</a>
</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>Bareinlage in die Kasse</h3>
<label for="stornocode">Betrag: </label>
<input type="text" id="moneyToInsert" value="" data-mini="true">
<div id=paymentlist>
<a href="#" class="sure-do" data-role="button" data-theme="b" data-rel="back">Einlegen</a>
<a href="#" data-role="button" data-theme="d" data-rel="back" id="cash_insert_cancel">Abbruch</a>
</div>
</div>
</div>
<!-- Dialog page for cash insert -->
<div data-role="dialog" id="cashtakeoutdialog" data-title="Kassenaktion">
<div data-role="content">
<h3>Barentnahme aus der Kasse</h3>
<label for="stornocode">Betrag: </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">Entnehmen</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>Übersicht Kellnerkasse</h3>
<p>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.<p>
<p><i>Bewirtungseinnahmen:</i> <b><span id=cashbyguests></span></b></p>
<p><i>inkl. eigener Kassen-Eingaben/Entnahmen:</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>Keine Rechnungselemente</h3>
<p>Es wurden keine abrechenbaren Produkte festgelegt (der Bon ist leer!).<p>
<a href="#" data-role="button" data-theme="d" data-rel="back" id="nocashitems_ok">OK</a>
</div>
</div> <!-- popup nocashitems -->
</body>
</html>

View File

@ -1,929 +0,0 @@
<?php
// Datenbank-Verbindungsparameter
require_once ('dbutils.php');
require_once ('globals.php');
require_once ('utilities/TypeAndProducts/TypeAndProductFileManager.php');
require_once ('utilities/RoomsAndTables/RoomsAndTableFileManager.php');
require_once ('utilities/userrights.php');
require_once ('utilities/HistFiller.php');
class Admin {
var $dbutils;
var $userrights;
var $histfiller;
function __construct() {
$this->dbutils = new DbUtils();
$this->userrights = new Userrights();
$this->histfiller = new HistFiller();
}
function handleCommand($command) {
// these command are only allowed for user with manager or admin rights
$cmdArray = array('createNewUser', 'updateUser', 'deleteUser','changepassword' , 'changeConfig');
if (in_array($command, $cmdArray)) {
if (!($this->userrights->hasCurrentUserRight('right_manager')) && !($this->userrights->hasCurrentUserRight('is_admin'))) {
echo "Benutzerrechte nicht ausreichend!";
return false;
}
}
if ($command == 'tryAuthenticate') {
$this->tryAuthenticate($_POST['username'],$_POST['password']);
} else if ($command == 'setLastModuleOfUser') {
$this->setLastModuleOfUser($_POST['view']);
} else if ($command == 'getViewAfterLogin') {
$this->getViewAfterLogin();
} else if ($command == 'isUserAlreadyLoggedIn') {
$this->isUserAlreadyLoggedIn();
} else if ($command == 'logout') {
$this->logout();
} else if ($command == 'getCurrentUser') {
$this->getCurrentUser();
} else if ($command == 'isLoggedinUserAdmin') {
$this->isLoggedinUserAdmin();
} else if ($command == 'isLoggedinUserKitchen') {
$this->isLoggedinUserKitchen();
} else if ($command == 'isLoggedinUserBar') {
$this->isLoggedinUserBar();
} else if ($command == 'isLoggedinUserAdminOrManager') {
$this->isLoggedinUserAdminOrManager();
} else if ($command == 'hasUserPaydeskRight') {
$this->hasUserPaydeskRight();
} else if ($command == 'getJsonMenuItemsAndVersion') {
$this->getJsonMenuItemsAndVersion();
} else if ($command == 'getUserList') {
$this->getUserList();
} else if ($command == 'createNewUser') {
$this->createNewUser(
$_POST['username'],
$_POST['password'],
$_POST['isAdmin'],
$_POST['rWaiter'],
$_POST['rKitchen'],
$_POST['rBar'],
$_POST['rSupply'],
$_POST['rPayDesk'],
$_POST['rStat'],
$_POST['rBill'],
$_POST['rProducts'],
$_POST['rManager']
);
} else if ($command == 'updateUser') {
$this->updateUser(
$_POST['username'],
$_POST['isAdmin'],
$_POST['rWaiter'],
$_POST['rKitchen'],
$_POST['rBar'],
$_POST['rSupply'],
$_POST['rPayDesk'],
$_POST['rStat'],
$_POST['rBill'],
$_POST['rProducts'],
$_POST['rManager']
);
} else if ($command == 'deleteUser') {
$this->deleteUser($_POST['username']);
} else if ($command == 'changepassword') {
$this->changepassword($_POST['username'],$_POST['password']);
} else if ($command == 'changeOwnPassword') {
$this->changeOwnPassword($_POST['oldPass'],$_POST['newPass']);
} else if ($command == 'changeConfig') {
$this->changeConfig(
$_POST['taxChanged'],
$_POST['togoTaxChanged'],
$_POST['stornocodeChanged'],
$_POST['printpassChanged'],
$_POST['companyInfoChanged'],
$_POST['serverUrlChanged'],
$_POST['logoUrlChanged'],
$_POST['payPrintTypeChanged'],
$_POST['emailChanged'],
$_POST['tax'],
$_POST['togoTax'],
$_POST['stornocode'],
$_POST['printpass'],
$_POST['companyinfo'],
$_POST['serverUrl'],
$_POST['logoUrl'],
$_POST['payPrintType'],
$_POST['email']);
} else if ($command == 'getTax') {
$this->getTax();
} else if ($command == 'getTogoTax') {
$this->getTogoTax();
// from here on admin rights are needed
} else if ($command == 'getCompanyInfo') {
$this->getCompanyInfo();
} else if ($command == 'getServerUrl') {
$this->getServerUrl();
} else if ($command == 'getLogoUrl') {
$this->getLogoUrl();
} else if ($command == 'getPayPrintType') {
$this->getPayPrintType();
} else if ($command == 'getPayments') {
$this->getPayments();
} else if ($command == 'getEmail') {
$this->getEmail();
} else if (($command == 'new') || ($command == 'new') || ($command == 'drop') || ($command == 'fill') || ($command == 'fillSampleProdType') || ($command == 'fillSpeisekarte')) {
if ($this->isCurrentUserAdmin()) {
if ($command == 'fill') {
$this->fillSampleContent();
} else if ($command == 'fillSampleProdType') {
$this->fillSampleProdType("samples/speisekarte.txt");
} else if ($command == 'fillSpeisekarte') {
$this->fillSpeisekarte($_POST['speisekarte']);
}
//else if ($command == 'readRoomsTables') {
// $this->fillSampleRoomsAndTable("samples/roomstables.txt");
//}
echo json_encode(array("status" => "OK"));
} else {
echo json_encode(array("status" => "ERROR", "code" => ERROR_NOT_AUTHOTRIZED, "msg" => ERROR_NOT_AUTHOTRIZED_MSG));
}
// end area for admins
} else if ($command == 'exportConfigCsv') {
if ($this->isCurrentUserAdmin() || $this->hasCurrentUserRight('right_manager')) {
$this->exportConfigCsv();
}
} else if ($command == 'exportUserCsv') {
if ($this->isCurrentUserAdmin() || $this->hasCurrentUserRight('right_manager')) {
$this->exportUserCsv();
}
} else if ($command == 'setOrderVolume') {
if ($this->isUserAlreadyLoggedInForPhp()) {
$this->setOrderVolume($_POST['volume']);
}
} else if ($command == 'getOrderVolume') {
if ($this->isUserAlreadyLoggedInForPhp()) {
$this->getOrderVolume();
}
}
else {
echo "Command not supported.";
}
}
function isUserAlreadyLoggedInForPhp() {
if(session_id() == '') {
session_start();
}
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
return false;
} else {
return true;
}
}
function isUserAlreadyLoggedIn() {
if(session_id() == '') {
session_start();
}
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
// no user logged in
echo json_encode("NO");
} else {
echo json_encode("YES");
}
}
function logout() {
if(session_id() == '') {
session_start();
session_destroy();
}
echo json_encode("OK");
}
// for the login mask - if user is authenticated then the first page works different
function tryAuthenticate($username,$password) {
$authenticated = false;
$sql = "SELECT userpassword FROM %user% WHERE username='$username' AND active='1'";
$dbutils = new DbUtils();
$dbresult = $dbutils->performSqlCommand($sql);
$numberOfEntries = mysqli_num_rows($dbresult);
if ($numberOfEntries == 1) {
$zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC);
$pass_hash = $zeile['userpassword'];
// password_verify requires PHP > 5.5, so let's use MD5 instead
// (it is no banking software...)
if (md5($password) == $pass_hash) {
$authenticated = true;
}
}
mysqli_free_result( $dbresult );
if ($authenticated) {
if(session_id() == '') {
session_start();
}
$_SESSION['angemeldet'] = true;
// now read the rights of the user
$sql = "SELECT * FROM %user% WHERE username='$username' AND active='1'";
$dbutils = new DbUtils();
$dbresult = $dbutils->performSqlCommand($sql);
$numberOfEntries = mysqli_num_rows($dbresult);
if ($numberOfEntries == 1) {
$zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC);
$_SESSION['userid'] = $zeile['id'];
$_SESSION['currentuser'] = $username;
$_SESSION['is_admin'] = ($zeile['is_admin'] == 1 ? true : false);
$_SESSION['right_waiter'] = ($zeile['right_waiter'] == 1 ? true : false);
$_SESSION['right_kitchen'] = ($zeile['right_kitchen'] == 1 ? true : false);
$_SESSION['right_bar'] = ($zeile['right_bar'] == 1 ? true : false);
$_SESSION['right_supply'] = ($zeile['right_supply'] == 1 ? true : false);
$_SESSION['right_paydesk'] = ($zeile['right_paydesk'] == 1 ? true : false);
$_SESSION['right_statistics'] = ($zeile['right_statistics'] == 1 ? true : false);
$_SESSION['right_bill'] = ($zeile['right_bill'] == 1 ? true : false);
$_SESSION['right_products'] = ($zeile['right_products'] == 1 ? true : false);
$_SESSION['right_manager'] = ($zeile['right_manager'] == 1 ? true : false);
}
mysqli_free_result($dbresult);
}
if ($authenticated) {
echo json_encode("YES");
} else {
echo json_encode("NO");
}
}
function getOrderVolume() {
$userid = $_SESSION['userid'];
$sql = "SELECT ordervolume FROM %user% WHERE id=?";
$pdo = $this->dbutils->openDbAndReturnPdo();
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($userid));
$row =$stmt->fetchObject();
$volume = 0;
if ($row != null) {
$volume = $row->ordervolume;
if ($volume == null) {
$volume = 0;
}
}
echo json_encode($volume);
}
function setOrderVolume($volume) {
$userid = $_SESSION['userid'];
$sql = "UPDATE %user% SET ordervolume=? WHERE id=?";
$pdo = $this->dbutils->openDbAndReturnPdo();
$pdo->beginTransaction();
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($volume,$userid));
$pdo->commit();
echo json_encode(array("status" => "OK"));
}
function setLastModuleOfUser($view) {
if ($this->isUserAlreadyLoggedInForPhp()) {
$userid = $_SESSION['userid'];
$sql = "UPDATE %user% SET lastmodule=? WHERE id=?";
$pdo = $this->dbutils->openDbAndReturnPdo();
$pdo->beginTransaction();
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($view,$userid));
$pdo->commit();
echo json_encode(array("status" => "OK"));
}
}
function getViewAfterLogin() {
if ($this->isUserAlreadyLoggedInForPhp()) {
$userid = $_SESSION['userid'];
$sql = "SELECT lastmodule FROM %user% WHERE id=?";
$pdo = $this->dbutils->openDbAndReturnPdo();
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($userid));
$row =$stmt->fetchObject();
$view = "preferences.html";
if ($row != null) {
$newView = $row->lastmodule;
if ($newView != null) {
$view = $newView;
}
}
// test if user has still the right to go into that view
$mapping = array (
"waiter.html" => 'right_waiter',
"kitchen.html" => 'right_kitchen',
"bar.html" => 'right_bar',
"supplydesk.html" => 'right_supply',
"paydesk.html" => 'right_paydesk',
"reports.html" => 'right_statistics',
"bill.html" => 'right_bill',
"products.html" => 'right_products');
$valid = false;
if ($view == 'preferences.html') {
// always ok
$valid = true;
} else if ($view == 'manager.html') {
if (($_SESSION['is_admin'] == 1) || ($_SESSION['right_manager'] == 1)) {
$valid = true;
}
} else {
if ($_SESSION[$mapping[$view]] == 1) {
$valid = true;
}
}
if ($valid == false) {
$view = "preferences.html";
}
echo json_encode($view);
}
}
// for client request
function isLoggedinUserAdmin() {
if ($this->isCurrentUserAdmin()) {
echo json_encode(YES);
} else {
echo json_encode(NO);
}
}
function isLoggedinUserAdminOrManager() {
if ($this->hasCurrentUserRight('is_admin') || $this->hasCurrentUserRight('right_manager')) {
echo json_encode(YES);
} else {
echo json_encode(NO);
}
}
function isLoggedinUserKitchen() {
if ($this->hasCurrentUserRight('right_kitchen')) {
echo json_encode(YES);
} else {
echo json_encode(NO);
}
}
function isLoggedinUserBar() {
if ($this->hasCurrentUserRight('right_bar')) {
echo json_encode(YES);
} else {
echo json_encode(NO);
}
}
function hasUserPaydeskRight() {
if ($this->hasCurrentUserRight('right_paydesk')) {
echo json_encode(YES);
} else {
echo json_encode(NO);
}
}
function hasCurrentUserRight($whichRight) {
if(session_id() == '') {
session_start();
}
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
// no user logged in
return false;
} else {
return ($_SESSION[$whichRight]);
}
}
// for internal request
function isCurrentUserAdmin() {
return $this->hasCurrentUserRight('is_admin');
}
function fillSampleContentBySqlFile($sqlFile) {
$handle = fopen ($sqlFile, "r");
while (!feof($handle)) {
$sql = fgets($handle);
$this->dbutils->performSqlCommand($sql);
}
fclose ($handle);
}
private function fillSampleProdType($fileName) {
$speisekartenHandler = new TypeAndProductFileManager();
$speisekartenHandler->manageSpeisekarteFile($fileName);
$this->histfiller->readProdTableAndSendToHist();
}
private function fillSpeisekarte($speisekarte) {
$pdo = $this->dbutils->openDbAndReturnPdo();
$pdo->beginTransaction();
$speisekartenHandler = new TypeAndProductFileManager();
$speisekartenHandler->manageSpeisekarte($pdo,$speisekarte);
$this->histfiller->readProdTableAndSendToHist($pdo);
$pdo->commit();
}
/* obsolete: not needed any more after replacement by matrix in manager.html */
private function fillSampleRoomsAndTable($fileName) {
$roomsAndTableHandler = new RoomsAndTableFileManager();
$roomsAndTableHandler->readRoomTableDefinition($fileName);
}
private function fillSampleContent()
{
// first remove previous content, then fill the SQL file
$sql = "DELETE FROM `%queue%`";
$dbresult = $this->dbutils->performSqlCommand($sql);
$this->fillSampleContentBySqlFile("samples/queuecontent.txt");
$sql = "DELETE FROM `%hist%` WHERE action='3' OR action='7' OR action='8'";
$dbresult = $this->dbutils->performSqlCommand($sql);
$sql = "DELETE FROM `%histuser%`";
$dbresult = $this->dbutils->performSqlCommand($sql);
$sql = "DELETE FROM `%user%`";
$dbresult = $this->dbutils->performSqlCommand($sql);
$this->fillSampleContentBySqlFile("samples/usercontent.txt");
$this->histfiller->readUserTableAndSendToHist();
}
function dropProdTypeTable()
{
$this->dbutils->performSqlCommand("drop TABLE `" . DB_PRODTYPE_TABLE . "`;");
}
function dropQueueTable()
{
$this->dbutils->performSqlCommand("drop TABLE `" . DB_QUEUE_TABLE . "`;");
}
function dropProductsTable()
{
$this->dbutils->performSqlCommand("drop TABLE `" . DB_PRODUCTS_TABLE . "`;");
}
function dropUserTable()
{
$this->dbutils->performSqlCommand("drop TABLE `" . DB_USER_TABLE . "`;");
}
function dropRoomTable()
{
$this->dbutils->performSqlCommand("drop TABLE `" . DB_ROOM_TABLE . "`;");
}
function dropPaymentTable() {
$this->dbutils->performSqlCommand("drop TABLE `%payment%`;");
}
function dropRestTables()
{
$this->dbutils->performSqlCommand("drop TABLE `" . DB_RESTTABLES_TABLE . "`;");
}
function dropBillTable()
{
$this->dbutils->performSqlCommand("drop TABLE `%bill%`;");
}
function dropPriceLevelTable()
{
$this->dbutils->performSqlCommand("drop TABLE `%pricelevel%`;");
}
function dropConfigTable()
{
$this->dbutils->performSqlCommand("drop TABLE `%config%`;");
}
function dropClosingTable()
{
$this->dbutils->performSqlCommand("drop TABLE `%closing%`;");
}
function dropPrintJobsTable()
{
$this->dbutils->performSqlCommand("drop TABLE `%printjobs%`;");
}
function dropBillProductsTable() {
$this->dbutils->performSqlCommand("drop TABLE `%billproducts%`;");
}
function dropHistTables() {
$pdo = $this->dbutils->openDbAndReturnPdo();
$sql = "DROP TABLE `%hist%`";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$sql = "DROP TABLE `%histprod%`";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$sql = "DROP TABLE `%histconfig%`";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$sql = "DROP TABLE `%histuser%`";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$sql = "DROP TABLE `%histactions%`";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
}
/*
* Return all the entries for the main menu (the modules)
*/
function getJsonMenuItemsAndVersion() {
if(session_id() == '') {
session_start();
}
$mainMenu = array();
$currentUser = "";
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
// no user logged in
$mainMenu[] = array("name" => "Startseite", "link" => "index.html");
} else {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => "Kellner", "link" => "waiter.html"); };
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => "K&uuml;che", "link" => "kitchen.html"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => "Bereitstellung", "link" => "supplydesk.html"); };
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => "Kasse", "link" => "paydesk.html"); };
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => "Statistik", "link" => "reports.html"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => "Kassenbons", "link" => "bill.html"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => "Angebot", "link" => "products.html"); };
if ($_SESSION['right_manager']) { $mainMenu[] = array("name" => "Verwaltung", "link" => "manager.html"); };
$mainMenu[] = array("name" => "Einstellung", "link" => "preferences.html");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html");
$mainMenu[] = array("name" => "Abmelden", "link" => "logout.php");
$currentUser = $_SESSION['currentuser'];
}
// CAUTION: change version also in config.txt!!!
$mainMenuAndVersion = array ("version" => "1.0", "user" => $currentUser, "menu" => $mainMenu);
echo json_encode($mainMenuAndVersion);
}
function getUserList() {
$userInfo = array();
$sql = "SELECT * FROM %user% WHERE active='1'";
$dbresult = $this->dbutils->performSqlCommand($sql);
$numberOfEntries = mysqli_num_rows($dbresult);
while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) {
$userEntry = array ("username" => $zeile['username'],
"is_admin" => $zeile['is_admin'],
"right_waiter" => $zeile['right_waiter'],
"right_kitchen" => $zeile['right_kitchen'],
"right_bar" => $zeile['right_bar'],
"right_supply" => $zeile['right_supply'],
"right_paydesk" => $zeile['right_paydesk'],
"right_statistics" => $zeile['right_statistics'],
"right_bill" => $zeile['right_bill'],
"right_products" => $zeile['right_products'],
"right_manager" => $zeile['right_manager']
);
$userInfo[] = $userEntry;
}
mysqli_free_result($dbresult);
echo json_encode($userInfo);
}
function createNewUser($username, $password, $isAdmin, $rWaiter, $rKitchen, $rBar, $rSupply, $rPayDesk, $rStat, $rBill, $rProducts, $rManager) {
// check if the user with that name already exists
$sql = "SELECT username FROM %user% WHERE active='1' AND username='$username'";
$dbresult = $this->dbutils->performSqlCommand($sql);
$numberOfEntries = mysqli_num_rows($dbresult);
mysqli_free_result($dbresult);
if ($numberOfEntries > 0) {
echo json_encode("exists");
} else {
// create the new user
// instead if password_hash (PHP > 5.5) use MD5...
$password_hash = md5($password);
$userInsertSql = "INSERT INTO `%user%` (`id` , `username` , `userpassword`, `is_admin`, `right_waiter`,`right_kitchen`,`right_bar`,`right_supply`,`right_paydesk`,`right_statistics`,`right_bill`,`right_products`,`right_manager`,`active`) VALUES (";
$userInsertSql .= " NULL, '$username', '$password_hash' , '$isAdmin', '$rWaiter', '$rKitchen', '$rBar', '$rSupply', '$rPayDesk', '$rStat', '$rBill', '$rProducts', '$rManager', '1')";
$dbresult = $this->dbutils->performSqlCommandRetLastId($userInsertSql);
$lastId = $dbresult['id'];
echo json_encode("OK");
}
// now this has to be logged in the history tables...
$this->histfiller->createUserInHist($lastId,$username,
$isAdmin,$rWaiter,$rKitchen,$rBar,$rSupply,$rPayDesk,$rStat,$rBill,$rProducts,$rManager);
}
function getTax() {
$this->sendJsonValueFromConfigTable('tax');
}
function getTogoTax() {
$this->sendJsonValueFromConfigTable('togotax');
}
function getCompanyInfo() {
$this->sendJsonValueFromConfigTable('companyinfo');
}
function getServerUrl() {
$this->sendJsonValueFromConfigTable('serverurl');
}
function getLogoUrl() {
$this->sendJsonValueFromConfigTable('logourl');
}
function getPayPrintType() {
$this->sendJsonValueFromConfigTable('payprinttype');
}
function getEmail() {
$this->sendJsonValueFromConfigTable('email');
}
function getPayments() {
$pdo = $this->dbutils->openDbAndReturnPdo();
$sql = "SELECT id,name FROM %payment%";
$stmt_query = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt_query->execute();
$result = $stmt_query->fetchAll();
$retArray = array();
foreach($result as $row) {
$entry = array("id"=> $row['id'], "name" => $row['name']);
$retArray[] = $entry;
}
echo json_encode($retArray);
}
function sendJsonValueFromConfigTable($whichValue) {
$theVal = $this->getValueFromConfigTable($whichValue);
if ($theVal == null) {
echo json_encode("");
} else {
echo json_encode($theVal);
}
}
function getValueFromConfigTable($whichValue) {
$sql = "SELECT setting FROM %config% WHERE name='$whichValue'";
$dbresult = $this->dbutils->performSqlCommand($sql);
$numberOfEntries = mysqli_num_rows($dbresult);
$theValue = null;
if ($numberOfEntries == 1) {
$zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC);
$theValue = $zeile['setting'];
}
mysqli_free_result($dbresult);
return $theValue;
}
function changeConfig(
$taxChanged,$togoTaxChanged,$stornocodeChanged,$printpassChanged,$companyInfoChanged,$serverUrlChanged,$logoUrlChanged,$payPrintTypeChanged,$emailChanged,
$tax,$togoTax,$stornocode,$printpass,$companyInfo,$serverUrl,$logoUrl,$payPrintType,$email) {
$problem = false;
if ($stornocodeChanged == 1) {
$this->changeOneConfigDbItem('stornocode',$stornocode);
}
if ($printpassChanged == 1) {
$this->changeOneConfigDbItem('printpass',md5($printpass));
}
if ($companyInfoChanged == 1) {
$this->changeOneConfigDbItem('companyinfo',$companyInfo);
}
if ($serverUrlChanged == 1) {
$this->changeOneConfigDbItem('serverurl', $serverUrl);
}
if ($logoUrlChanged == 1) {
$this->changeOneConfigDbItem('logourl', $logoUrl);
}
if ($payPrintTypeChanged == 1) {
$this->changeOneConfigDbItem('payprinttype', $payPrintType);
}
if ($emailChanged == 1) {
$this->changeOneConfigDbItem('email', $email);
}
if ($taxChanged == 1) {
if (is_numeric($tax)) {
$this->changeOneConfigDbItem('tax',$tax);
} else {
$problem = true;
}
}
if ($togoTaxChanged == 1) {
if (is_numeric($togoTax)) {
$this->changeOneConfigDbItem('togotax',$togoTax);
} else {
$problem = true;
}
}
if ($problem) {
echo json_encode("FAILED");
} else {
echo json_encode("OK");
}
}
function changeOneConfigDbItem($theItem,$theValue) {
$sql = "UPDATE %config% SET setting='$theValue' WHERE name='$theItem'";
$dbresult = $this->dbutils->performSqlCommand($sql);
// now this has to be logged in the history tables...
$this->histfiller->updateConfigInHist($theItem, $theValue);
}
private function findActiveUserWithName($username) {
$sql_find_id = "SELECT id FROM %user% WHERE active='1' AND username='$username'";
$pdo = $this->dbutils->openDbAndReturnPdo();
$stmt_query = $pdo->query($this->dbutils->resolveTablenamesInSqlString($sql_find_id));
$row =$stmt_query->fetchObject();
$theUserId = $row->id;
return $theUserId;
}
function updateUser($username, $isAdmin, $rWaiter, $rKitchen, $rBar, $rSupply, $rPayDesk, $rStat, $rBill, $rProducts, $rManager) {
$theUserId = $this->findActiveUserWithName($username);
// check if the user with that name already exists
$sql = "UPDATE %user% SET is_admin='$isAdmin', right_waiter='$rWaiter',right_kitchen='$rKitchen',right_bar='$rBar',right_supply='$rSupply',right_paydesk='$rPayDesk',right_statistics='$rStat',right_bill='$rBill',right_products='$rProducts',right_manager='$rManager' WHERE active='1' AND username='$username'";
$dbresult = $this->dbutils->performSqlCommand($sql);
// now this has to be logged in the history tables...
$this->histfiller->updateUserInHist($theUserId,$username,
$isAdmin,$rWaiter,$rKitchen,$rBar,$rSupply,$rPayDesk,$rStat,$rBill,$rProducts,$rManager,'1');
echo json_encode("OK");
}
function deleteUser($username) {
$theUserId = $this->findActiveUserWithName($username);
$userSql = "UPDATE %user% set active='0' WHERE username='$username'";
$dbresult = $this->dbutils->performSqlCommand($userSql);
$this->histfiller->updateOneUser($theUserId);
echo json_encode("OK");
}
function getCurrentUser() {
if(session_id() == '') {
session_start();
}
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
// no user logged in
echo json_encode("Nobody");
} else {
echo json_encode($_SESSION['currentuser']);
}
}
function changepassword($username,$password) {
$password_hash = md5($password);
$userSql = "UPDATE %user% set userpassword='$password_hash' WHERE active='1' AND username='$username'";
$dbresult = $this->dbutils->performSqlCommand($userSql);
echo json_encode("OK");
}
function changeOwnPassword($oldpassword,$newpassword) {
if(session_id() == '') {
session_start();
}
$currentuser = $_SESSION['currentuser'];
$oldp_hash = md5($oldpassword);
$ok = true;
// is old password correct?
$sql = "SELECT userpassword FROM %user% WHERE username='$currentuser' AND active='1'";
$dbresult = $this->dbutils->performSqlCommand($sql);
$numberOfEntries = mysqli_num_rows($dbresult);
if ($numberOfEntries == 1) {
$zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC);
if ($zeile['userpassword'] != $oldp_hash) {
$ok = false;
}
} else {
// user not found
$ok = false;
}
mysqli_free_result($dbresult);
if ($ok) {
// allowed to change password
$newp_hash = md5($newpassword);
$sql = "UPDATE %user% set userpassword='$newp_hash' WHERE active='1' AND username='$currentuser'";
$dbresult = $this->dbutils->performSqlCommand($sql);
echo json_encode("OK");
} else {
echo json_encode("FAILED");
}
}
private function writeCsvHeader($defaultFilename) {
header("Content-type: text/x-csv");
header("Content-Disposition: attachment; filename=$defaultFilename");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
header("Expires: 0");
}
private function exportConfigCsv() {
$this->writeCsvHeader("datenexport-config.csv");
echo("Eintragsid; Datum ; Konfiguration; Wert;Beschreibung\n");
$sql = "SELECT DISTINCT %hist%.id as id,date,";
$sql .= "%config%.name as configitem,%histconfig%.setting as setting,description ";
$sql .= " FROM %hist%, %histconfig%, %histactions%, %config% ";
$sql .= " WHERE (refid=%histconfig%.id) ";
$sql .= " AND %histconfig%.configid = %config%.id ";
$sql .= " AND (action='2' OR action='6') ";
$sql .= " AND (action=%histactions%.id) ";
$sql .= " ORDER BY date,id";
$dbresult = $this->dbutils->performSqlCommand($sql);
while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) {
$val1 = $zeile['id'];
$val2 = $zeile['date'];
$val3 = $zeile['configitem'];
$val4 = str_replace("\r\n","<CR>",$zeile['setting']);
$val4 = str_replace("\n","<CR>",$val4);
$val5 = $zeile['description'];
echo "$val1; $val2; \"$val3\"; \"$val4\"; \"$val5\"\n";
}
mysqli_free_result( $dbresult );
}
private function exportUserCsv() {
$this->writeCsvHeader("datenexport-benutzer.csv");
echo("Eintragsid; Datum ; Benutzerid; Benutzername; Adminrechte; Kellnerrechte;Kuechenrechte; Barrechte; Bereitstellungsrechte; Kassenrechte; Reportrechte; Kassenbonrechte; Angebotsrechte; Managerrechte; Aktiviert\n");
$sql = "SELECT DISTINCT %hist%.id as id,date,";
$sql .= "userid,username,is_admin,right_waiter,right_kitchen,right_bar,right_supply,";
$sql .= "right_paydesk,right_statistics,right_bill,right_products,right_manager,active,";
$sql .= "description ";
$sql .= " FROM %hist%, %histuser%, %histactions% ";
$sql .= " WHERE (refid=%histuser%.id) ";
$sql .= " AND (action='3' OR action='7' OR action='8') ";
$sql .= " AND (action=%histactions%.id) ";
$sql .= " ORDER BY date,id";
$dbresult = $this->dbutils->performSqlCommand($sql);
while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) {
$val1 = $zeile['id'];
$val2 = $zeile['date'];
$val3 = $zeile['userid'];
$val4 = $zeile['username'];
$val5 = ($zeile['is_admin'] == '1' ? "Ja" : "Nein");
$val6 = ($zeile['right_waiter'] == '1' ? "Ja" : "Nein");
$val7 = ($zeile['right_kitchen'] == '1' ? "Ja" : "Nein");
$val8 = ($zeile['right_bar'] == '1' ? "Ja" : "Nein");
$val9 = ($zeile['right_supply'] == '1' ? "Ja" : "Nein");
$val10 = ($zeile['right_paydesk'] == '1' ? "Ja" : "Nein");
$val11 = ($zeile['right_statistics'] == '1' ? "Ja" : "Nein");
$val12 = ($zeile['right_bill'] == '1' ? "Ja" : "Nein");
$val13 = ($zeile['right_products'] == '1' ? "Ja" : "Nein");
$val14 = ($zeile['right_manager'] == '1' ? "Ja" : "Nein");
$val15 = ($zeile['active'] == '1' ? "Ja" : "Nein");
$val16 = $zeile['description'];
echo "$val1; $val2; $val3; $val4; $val5; $val6; $val7; $val8; $val9; $val10;";
echo "$val11;$val12;$val13;$val14;$val15;$val16\n";
}
mysqli_free_result( $dbresult );
}
}
?>

View File

@ -1,408 +0,0 @@
<?php
// Datenbank-Verbindungsparameter
require_once ('dbutils.php');
require_once ('commonutils.php');
class Bill {
var $dbutils;
function __construct() {
$this->dbutils = new DbUtils();
}
function handleCommand($command) {
if ($command == 'exportCsv') {
if ($this->hasCurrentUserAdminOrManagerRights()) {
// yes, we can export the data
$this->exportCsv($_GET['startMonth'],$_GET['startYear'],$_GET['endMonth'],$_GET['endYear']);
} else {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_NOT_AUTHOTRIZED, "msg" => ERROR_BILL_NOT_AUTHOTRIZED_MSG));
}
return;
}
if ($command == 'exportCsvOfClosing') {
if ($this->hasCurrentUserAdminOrManagerRights()) {
// yes, we can export the data
$this->exportCsvOfClosing($_GET['closingid']);
} else {
echo json_encode(array("status" => "ERROR", "code" => ERROR_MANAGER_NOT_AUTHOTRIZED, "msg" => ERROR_MANAGER_NOT_AUTHOTRIZED_MSG));
}
return;
}
if ($this->hasCurrentUserBillRights()) {
if ($command == 'getLastBillsWithContent') {
$this->getLastBillsWithContent();
} else if ($command == 'cancelBill') {
$this->cancelBill($_POST['billid'],$_POST['stornocode']);
} else if ($command == 'doCashAction') {
$this->doCashAction($_POST['money']);
} else if ($command == 'getCashOverviewOfUser') {
$this->getCashOverviewOfUser();
} else {
echo "Command not supported.";
}
} else {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_NOT_AUTHOTRIZED, "msg" => ERROR_BILL_NOT_AUTHOTRIZED_MSG));
}
}
// for internal request
private function hasCurrentUserBillRights() {
session_start();
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
// no user logged in
return false;
} else {
return ($_SESSION['right_bill']);
}
}
// for internal request
private function hasCurrentUserAdminOrManagerRights() {
session_start();
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
// no user logged in
return false;
} else {
return ($_SESSION['right_manager'] || $_SESSION['is_admin']);
}
}
private function billWithId($billid) {
$pdo = $this->dbutils->openDbAndReturnPdo();
$pdo->beginTransaction();
$sql = "SELECT content FROM %bill% WHERE id=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($billid));
$row =$stmt->fetchObject();
if ($row != null) {
return stripslashes($row->content);
}
}
// TODO: needed???
function getBillWithId($billid) {
echo json_encode($this->billWithId($billid));
}
/*
* insert or take out cash money. The direction done by sign of $money value
*/
private function doCashAction($money) {
// current time
date_default_timezone_set('Europe/Berlin');
$currentTime = date('Y-m-d H:i:s');
$pdo = $this->dbutils->openDbAndReturnPdo();
$pdo->beginTransaction();
$sql = "SELECT sum(brutto) as bruttosum FROM %bill% WHERE closingid is null AND paymentid='1'";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$row =$stmt->fetchObject();
if ($row != null) {
$sum = $row->bruttosum;
if (is_null($sum)) {
// no transaction after last closing
$sum = 0.0;
}
if (($sum + floatval($money)) >= 0.0) {
$userId = $this->getUserId();
$sql = "INSERT INTO `%bill%` (`id` , `billdate`,`content`,`brutto`,`netto`,`tax`,`tableid`, `status`, `paymentid`,`userid`,`ref`) VALUES ( NULL, ? , ?, ?,?,?, ?, 'c', ?,?,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($currentTime,NULL,$money,$money,'0.00',-1,1,$userId,NULL));
$pdo->commit();
echo json_encode(array("status" => "OK"));
} else {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_LESS_MONEY_TO_TAKE_OUT, "msg" => ERROR_BILL_LESS_MONEY_TO_TAKE_OUT_MSG));
}
} else {
$pdo->rollBack();
echo json_encode(array("status" => "ERROR", "code" => ERROR_GENERAL_PAYDESK_SUM, "msg" => ERROR_GENERAL_PAYDESK_SUM_MSG));
return;
}
}
/*
* User may ask what money he should have in his pocket by serving the guests. If the inserts and
* take outs are in in his waiter paydesk then this value is of interest, too. Return both.
*/
function getCashOverviewOfUser() {
$userId = $this->getUserId();
// without cash insert and cash takeout
$onlyCashByGuests = 0.0;
$pdo = $this->dbutils->openDbAndReturnPdo();
$sql = "SELECT sum(brutto) as sumtotal FROM %bill% WHERE closingid is null AND status is null AND paymentid=1 AND userid='$userId'";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$row =$stmt->fetchObject();
if ($row != null) {
if ($row->sumtotal != null) {
$onlyCashByGuests = $row->sumtotal;
}
}
// with cash
$cashByGuestsAndInsertTakeOut = 0.0;
$sql = "SELECT sum(brutto) as sumtotal FROM %bill% WHERE closingid is null AND paymentid='1' AND userid='$userId' AND (status is null OR status ='c')";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$row =$stmt->fetchObject();
if ($row != null) {
if ($row->sumtotal != null) {
$cashByGuestsAndInsertTakeOut = $row->sumtotal;
}
}
echo json_encode(array("guestmoney" => $onlyCashByGuests, "total" => $cashByGuestsAndInsertTakeOut));
}
function getLastBillsWithContent() {
$commonUtils = new CommonUtils();
$sql = "SELECT id,billdate,brutto,tableid,closingid,status FROM %bill% WHERE tableid >= '0' AND status is null ORDER BY billdate DESC LIMIT 20;";
$dbresult = $this->dbutils->performSqlCommand($sql);
$resultarray = array();
while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC))
{
$theId = $zeile['id'];
$theHtmlContentOfBill = $this->billWithId($theId);
$date = new DateTime($zeile['billdate']);
$shortdate = $date->format('H:i');
$closingID = $zeile['closingid'];
$isClosed = (is_null($closingID) ? 0 : 1);
$arr = array("id" => $theId,
"longdate" => $zeile['billdate'],
"shortdate" => $shortdate,
"brutto" => $zeile['brutto'],
"tablename" => $commonUtils->getTableNameFromId($zeile['tableid']),
"billcontent" => $theHtmlContentOfBill,
"isClosed" => $isClosed
);
$resultarray[] = $arr;
}
mysqli_free_result( $dbresult );
echo json_encode(array("status" => "OK", "code" => OK, "msg" => $resultarray));
}
private function getUserId() {
if(session_id() == '') {
session_start();
}
return $_SESSION['userid'];
}
/*
* Cancel a bill - set all queue items to not paid and drop the bill entry
*/
private function cancelBill($billid,$stornocode) {
// current time
date_default_timezone_set('Europe/Berlin');
$currentTime = date('Y-m-d H:i:s');
// check if stornocode is correct
$sql = "SELECT setting FROM %config% WHERE name='stornocode'";
$dbresult = $this->dbutils->performSqlCommand($sql);
$numberOfVals = mysqli_num_rows($dbresult);
if ($numberOfVals != 1) {
// stornocode not fixed
mysqli_free_result( $dbresult );
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_NOT_STORNO_CODE, "msg" => ERROR_BILL_NOT_STORNO_CODE_MSG));
return;
}
$zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC);
$stornocodeInDb = $zeile['setting'];
mysqli_free_result( $dbresult );
if ($stornocode != $stornocodeInDb) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_WRONG_STORNO_CODE, "msg" => ERROR_BILL_WRONG_STORNO_CODE_MSG));
return;
}
if (!is_numeric($billid)) {
// this may be an attack...
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_WRONG_NUMERIC_VALUE, "msg" => ERROR_BILL_WRONG_NUMERIC_VALUE_MSG));
return;
}
// Do transactional cancel
$pdo = $this->dbutils->openDbAndReturnPdo();
$pdo->beginTransaction();
// is the bill already closed? In this case no cancel is allowed!
$sql = "SELECT content,brutto,netto,tax,tableid,closingid,status,paymentid FROM %bill% WHERE id=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($billid));
$row =$stmt->fetchObject();
$closingId = null;
if ($row != null) {
$closingId = $row->closingid;
// save the next data for a copy!
$content = $row->content;
$brutto = $row->brutto;
$netto = $row->netto;
$tax = $row->tax;
$tableid = $row->tableid;
$status = $row->status;
$paymentid = $row->paymentid;
}
if (!is_null($closingId) || ($status == 's') || ($status == 'x')) {
// no cancel possible anymore!
$pdo->rollBack();
if (($status == 's') || ($status == 'x')) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_ALREADY_CANCELLED, "msg" => ERROR_BILL_ALREADY_CANCELLED_MSG));
} else {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_ALREADY_CLOSED, "msg" => ERROR_BILL_ALREADY_CLOSED_MSG));
}
return;
}
// 0. find the queueitems that are related to that bill
$sql = "SELECT id FROM %queue% WHERE billid=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($billid));
$result = $stmt->fetchAll();
$queueIdArray = array();
foreach($result as $row) {
$queueIdArray[] = $row['id'];
}
// 1. clear connection between queue item and bill
$sql = "UPDATE %queue% SET paidtime=null WHERE billid=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($billid));
// 2. copy bill with negativ brutto as part of storno
$userIdOfStornoUser = $this->getUserId();
$stornval = 0.0 - floatval($brutto);
$stornonettoval = 0.0 - floatval($netto);
$sql = "INSERT INTO `%bill%` (`id` , `billdate`,`content`,`brutto`,`netto`,`tax`,`tableid`, `status`, `paymentid`,`userid`,`ref`) VALUES ( NULL, ? , ?, ?, ?,?,?, 's', ?,?,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($currentTime,$content,$stornval,$stornonettoval,$tax,$tableid,$paymentid,$userIdOfStornoUser,$billid));
$refIdOfStornoEntry = $pdo->lastInsertId();
// 3. mark bill as part of storno
$sql = "UPDATE %bill% SET status='x', closingid=null, ref=? WHERE id=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($refIdOfStornoEntry,$billid));
// 4. now put the queue items into the billproducts so that later storno is evaluable
foreach ($queueIdArray as $aQueueid) {
$billProdsSql = "INSERT INTO `%billproducts%` (`queueid` , `billid`) VALUES ( ?,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($billProdsSql));
$stmt->execute(array($aQueueid,$refIdOfStornoEntry));
}
$pdo->commit();
// end of transactional cancel
echo json_encode(array("status" => "OK", "code" => OK));
return;
}
private function exportCsv($startMonth,$startYear,$endMonth,$endYear) {
$this->exportCsv_bin($startMonth,$startYear,$endMonth,$endYear,null);
}
/*
* Method to export data of a special closing
*/
private function exportCsvOfClosing($closingid) {
$this->exportCsv_bin(null,null,null,null,$closingid);
}
private function exportCsv_bin($startMonth,$startYear,$endMonth,$endYear,$onlyClosingId) {
if ($onlyClosingId == null) {
if ($startMonth < 10) {
$startMonth = "0" . $startMonth;
}
if ($endMonth < 10) {
$endMonth = "0" . $endMonth;
}
$startDate = $startYear . "-" . $startMonth . "-01 00:00:00";
// now find last day of month of end date!
$endDate = $endYear . "-" . $endMonth . "-01";
$lastdayOfMonth = date("t", strtotime($endDate));
$endDate = $endYear . "-" . $endMonth . "-" . $lastdayOfMonth . " 23:59:59";
}
$file_name = "datenexport.csv";
header("Content-type: text/x-csv");
header("Content-Disposition: attachment; filename=$file_name");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
header("Expires: 0");
if ($onlyClosingId == null) {
echo("Bonid;Bondatum;Brutto;Netto;MwSt;Status;Referenzbon-ID;Benutzerid;Benutzername;Tageslosung-ID; Tageslosung-Datum; Zahlungsart; Tageslosung-Bemerkung\n");
} else {
// closing id is know - do not output unnecessary info
echo("Bonid;Bondatum;Brutto;Netto;MwSt;Status;Referenzbon-ID;Benutzerid;Benutzername;Zahlungsart\n");
}
// first get the billids for that closing
$billIdsForThatClosing = array();
$sql = "SELECT DISTINCT %bill%.id,billdate,brutto,netto,tax,status,closingdate,remark,%bill%.closingid,%payment%.name,userid,ref,username FROM %bill%,%closing%,%payment%,%user% ";
$sql .= "WHERE closingid is not null AND %bill%.closingid=%closing%.id ";
$sql .= " AND %bill%.paymentid=%payment%.id ";
if ($onlyClosingId == null) {
// search for time span
$sql .= " AND %bill%.billdate BETWEEN '$startDate' AND '$endDate' ";
} else {
// search for a special closing id
$sql .= " AND closingid='$onlyClosingId' ";
}
$sql .= " AND %bill%.userid = %user%.id ";
$sql .= "ORDER BY billdate";
$dbresult = $this->dbutils->performSqlCommand($sql);
$retValues = array();
while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) {
$billid = $zeile['id'];
$billdate = $zeile['billdate'];
$brutto = str_replace(".",",",$zeile['brutto']);
$netto = str_replace(".",",",$zeile['netto']);
$tax = str_replace(".",",",$zeile['tax']);
$status = $zeile['status'];
if ($status == 'x') {
$status = "nachher storniert";
} else if ($status == 's') {
$status = "Stornierungsbuchung";
} else if ($status == 'c') {
$status = "Bareinlage/-entnahme";
} else {
$status = "";
}
$ref = ($zeile['ref'] == null ? "" : $zeile['ref']);
$userid = $zeile['userid'];
$username = $zeile['username'];
$closingid = $zeile['closingid'];
$closingdate = $zeile['closingdate'];
$remark = '"' . addslashes($zeile['remark']) . '"';
$paymentname = '"' . addslashes($zeile['name']) . '"';
if ($billid == null) {
$billid = "-";
}
if ($onlyClosingId == null) {
echo "$billid ; $billdate; $brutto; $netto; $tax; $status; $ref; $userid; $username ; $closingid; $closingdate; $paymentname; $remark\n";
} else {
echo "$billid ; $billdate; $brutto; $netto; $tax; $status; $ref; $userid; $username ; $paymentname\n";
}
}
mysqli_free_result( $dbresult );
}
}
?>

View File

@ -1,303 +0,0 @@
<?php
// Datenbank-Verbindungsparameter
require_once ('dbutils.php');
class Closing {
var $dbutils;
function __construct() {
$this->dbutils = new DbUtils();
}
function handleCommand($command) {
// all commands require manager rights
if (!($this->hasCurrentUserManagerOrAdminRights())) {
if ($command != 'exportCsv') {
echo json_encode(array("status" => "ERROR", "code" => ERROR_MANAGER_NOT_AUTHOTRIZED, "msg" => ERROR_MANAGER_NOT_AUTHOTRIZED_MSG));
} else {
// exception - result is not handled on HTML/JS side
echo "Fehlende Benutzerrechte";
}
return;
}
// user has manager rights
if($command == 'createClosing') {
$this->createClosing($_POST['remark']);
} else if ($command == 'getClosings') {
$this->getClosings($_GET['month'], $_GET['year']);
} else if ($command == 'exportCsv') {
$this->exportCsv($_GET['closingid']);
} else if ($command == 'getClosing') {
$this->getClosing($_GET['closingid']);
} else {
echo "Command not supported.";
}
}
private function hasCurrentUserManagerOrAdminRights() {
session_start();
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
// no user logged in
return false;
} else {
return ($_SESSION['right_manager'] || $_SESSION['is_admin']);
}
}
private function createClosing ($remark) {
if (is_null($remark)) {
$remark = "";
}
// first create a closing entry
$remark = $this->dbutils->filterString($remark);
date_default_timezone_set('Europe/Berlin');
$closingTime = date('Y-m-d H:i:s');
$closingEntrySql = "INSERT INTO `%closing%` (`id` , `closingdate`,`remark`) VALUES (NULL , $closingTime , '$remark')";
$newClosingId = $this->dbutils->performPreparedStatementCreateClosing($closingTime,$remark);
// declare not closed bills as closed
$declareClosedSql = "UPDATE %bill% SET closingid='$newClosingId' WHERE closingid is null AND (tableid >= '0' OR status='c') ";
$dbresult = $this->dbutils->performSqlCommand($declareClosedSql);
// now calculate the sum of the prices of this closing
$sql = "SELECT sum(brutto) as pricesum FROM %bill% WHERE closingid='$newClosingId' AND (tableid >= '0' OR status='c')";
$dbresult = $this->dbutils->performSqlCommand($sql);
$numberOfReturns = mysqli_num_rows($dbresult);
if ($numberOfReturns > 0) {
$zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC);
$pricesum = $zeile['pricesum'];
}
mysqli_free_result( $dbresult );
if (is_null($pricesum)) {
$pricesum = 0;
}
// now clean the items that should be removed after a closing, i.e. that haven't been paid
$sql = "DELETE FROM %queue% WHERE billid is null";
$dbresult = $this->dbutils->performSqlCommand($sql);
echo json_encode(array("status" => "OK", "msg" => "Summe des Tagesabschlusses: " . $pricesum));
}
private function getSumOfBillsWithClosingId($closingid,$onlyBar) {
$sql = "SELECT sum(brutto) as billsum FROM %bill% WHERE closingid='$closingid'";
if ($onlyBar) {
$sql .= " AND paymentid='1'";
}
$dbresult = $this->dbutils->performSqlCommand($sql);
$numberOfReturns = mysqli_num_rows($dbresult);
$sum = 0.0;
if ($numberOfReturns == 1) {
$zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC);
$sum = floatval($zeile["billsum"]);
}
mysqli_free_result( $dbresult );
return $sum;
}
/*
* Get all closings that are requested:
* if month and year is null or empty ==> last 30 closings
* otherwise query by date
*/
private function getClosings($month, $year) {
$monthText=$month;
if ($month < 10) {
$monthText = "0" . $month;
}
$lastDayInMonth = date("t", mktime(0, 0, 0, $month, 1, $year));
$dateStart = $year . $monthText . "01";
$dateEnd = $year . $monthText . $lastDayInMonth;
$sql = "SELECT id,closingdate,remark FROM %closing% WHERE DATE(closingdate) BETWEEN '" . $dateStart . "' AND '" . $dateEnd . "' ORDER BY closingdate DESC LIMIT 30;";
$dbresult = $this->dbutils->performSqlCommand($sql);
$resultarray = array();
while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC))
{
$theId = $zeile['id'];
$closingDate = $zeile['closingdate'];
$remark = $zeile['remark'];
$totalSum = $this->getSumOfBillsWithClosingId($theId, false);
$cashSum = $this->getSumOfBillsWithClosingId($theId, true);
$closingEntry = array("id" => $theId, "closingDate" => $closingDate, "remark" => $remark, "totalsum" => $totalSum, "cashsum" => $cashSum);
$resultarray[] = $closingEntry;
}
mysqli_free_result( $dbresult );
echo json_encode(array("status" => "OK", "msg" => $resultarray));
}
private function getPaymentArray() {
$sql = "SELECT id,name FROM %payment%";
$dbresult = $this->dbutils->performSqlCommand($sql);
$retArray = array();
while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC))
{
$retArray[$zeile['id']] = $zeile['name'];
}
mysqli_free_result( $dbresult );
return $retArray;
}
private function getClosing($closingid) {
$this->retrieveClosingFromDb($closingid, false);
}
private function exportCsv($closingid) {
$this->retrieveClosingFromDb($closingid, true);
}
private function getDateOfPreviousClosing($closingid) {
$previousId = intval($closingid) - 1;
$sql = "SELECT closingdate FROM %closing% WHERE id='$previousId'";
$dbresult = $this->dbutils->performSqlCommand($sql);
$numberOfReturns = mysqli_num_rows($dbresult);
$retVal = null;
if ($numberOfReturns == 1) {
$zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC);
$retVal = $zeile['closingdate'];
}
mysqli_free_result( $dbresult );
return $retVal;
}
private function retrieveClosingFromDb($closingid,$doCsvExport) {
$paymentArray = $this->getPaymentArray();
$previousClosingDate = $this->getDateOfPreviousClosing($closingid);
if ($doCsvExport) {
$file_name = "tagesabschluss.csv";
header("Content-type: text/x-csv");
header("Content-Disposition: attachment; filename=$file_name");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
header("Expires: 0");
echo("Bon-ID; Zahldatum; Produkt; Bruttopreis ; Nettopreis; MwSt; Zahlungsart; Benutzer-ID; Benutzername; Status; Referenz-Bon-ID\n");
}
// find the date of the closing - that shall later be exported
$sql = "SELECT closingdate FROM %closing% WHERE id='$closingid'";
$dbresult = $this->dbutils->performSqlCommand($sql);
$zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC);
$closingdate = $zeile['closingdate'];
mysqli_free_result( $dbresult );
// first get the billids for that closing
$billIdsAndPaymentsForThatClosing = array();
$sql = "SELECT %bill%.id as billid,paymentid,billdate,userid,ref,username,status,brutto,netto,tax FROM %bill%,%user% WHERE closingid=$closingid AND %bill%.userid = %user%.id ORDER BY billdate";
$dbresult = $this->dbutils->performSqlCommand($sql);
while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) {
$billIdsAndPaymentsForThatClosing[] = array(
"id" => $zeile['billid'],
"payment" => $zeile['paymentid'],
"userid" => $zeile['userid'],
"username" => $zeile['username'],
"status" => $zeile['status'],
"brutto" => $zeile['brutto'],
"netto" => $zeile['netto'],
"tax" => $zeile['tax'],
"ref" => $zeile['ref'],
"billdate" => $zeile['billdate']);
}
mysqli_free_result( $dbresult );
$retValues = array();
// Now we know all bills - find the related queue items!
// (cancelled "s" have a relation queue.billid = bill.refid!!!)
for ($index=0;$index < count($billIdsAndPaymentsForThatClosing);$index++) {
$aBillId = $billIdsAndPaymentsForThatClosing[$index]['id'];
$billdate = $billIdsAndPaymentsForThatClosing[$index]['billdate'];
$paymentid = $billIdsAndPaymentsForThatClosing[$index]['payment'];
$userid = $billIdsAndPaymentsForThatClosing[$index]['userid'];
$username = $billIdsAndPaymentsForThatClosing[$index]['username'];
$status = $billIdsAndPaymentsForThatClosing[$index]['status'];
// brutto instead of product price for cash actions needed
$brutto = $billIdsAndPaymentsForThatClosing[$index]['brutto'];
$netto = $billIdsAndPaymentsForThatClosing[$index]['netto'];
$tax = $billIdsAndPaymentsForThatClosing[$index]['tax'];
$ref = $billIdsAndPaymentsForThatClosing[$index]['ref'];
$ref = ($ref == null ? "" : $ref);
if ($status == 'c') {
// for cash insert / takeout there are no queue items! take "Kassenaktion" as product
$statusTxt = "Bareinlage/-entnahme";
$brutto = number_format($brutto, 2, ',', '');
$netto = number_format($netto, 2, ',', '');
$tax = number_format($tax, 2, ',', '');
$retValues[] = array (
"billid" => $aBillId,
"paidtime" => $billdate,
"productname" => "Kassenaktion",
"price" => $brutto,
"netto" => $netto,
"tax" => $tax,
"payment" => $paymentArray[$paymentid],
"userid" => $userid,
"username" => $username,
"status" => $statusTxt,
"ref" => $ref);
if ($doCsvExport) {
echo "$aBillId; \"$billdate\" ; \"Kassenaktion\" ; \"$brutto\" ; \"$netto\" ; \"$tax\" ; \"$paymentArray[$paymentid]\"; $userid; \"$username\"; \"$statusTxt\"; $ref\n";
}
} else {
$sql = "SELECT DISTINCT productname,price FROM %queue%,%billproducts% WHERE %billproducts%.billid='$aBillId' AND %billproducts%.queueid=%queue%.id";
if ($status == 'x') {
$statusTxt = "nachher storniert";
} else if ($status == 's') {
$statusTxt = "Stornierungsbuchung";
} else {
$statusTxt = "";
$sql = "SELECT productname,paidtime,price FROM %queue% WHERE billid=$aBillId";
}
$dbresult = $this->dbutils->performSqlCommand($sql);
while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) {
$productname = $zeile['productname'];
$paidtime = ($billdate == null ? "" : $billdate) ;
$price = ($status == 's' ? 0.0-floatval($zeile['price']) : $zeile['price']);
// calculate netto by tax
$netto = $price/(1 + $tax/100.0);
$netto = number_format($netto, 2, ',', '');
$price = number_format($price, 2, ',', '');
$tax = number_format($tax, 2, ',', '');
$retValues[] = array (
"billid" => $aBillId,
"paidtime" => $paidtime,
"productname" => $productname,
"price" => $price,
"netto" => $netto,
"tax" => $tax,
"payment" => $paymentArray[$paymentid],
"userid" => $userid,
"username" => $username,
"status" => $statusTxt,
"ref" => $ref);
$productname = str_replace('"','""',$productname);
if ($doCsvExport) {
echo "$aBillId; \"$paidtime\" ; \"$productname\" ; \"$price\" ; \"$netto\" ; \"$tax\" ; \"$paymentArray[$paymentid]\"; $userid; \"$username\"; \"$statusTxt\"; $ref\n";
}
}
mysqli_free_result( $dbresult );
}
}
if (!($doCsvExport)) {
// in this case it is for printing (fill html page area)
echo json_encode(array("status" => "OK", "msg" => $retValues, "closingid" => $closingid, "closingdate" => $closingdate, "previousClosingDate" => $previousClosingDate));
}
}
}
?>

View File

@ -1,121 +0,0 @@
<?php
require_once ('dbutils.php');
class CommonUtils {
var $dbutils;
function __construct() {
$this->dbutils = new DbUtils();
// $this->products = new Products(); --> endless loop!
// $this->lastSettingOfDisplayMode = "all";
}
function createGridTableWithSqrtSizeOfButtons ($inputArray) {
// create a table that is optimal (sqrt-like size)
$numberOfIcons = count($inputArray);
if ($numberOfIcons == 0) {
// no items to display
return;
}
$numberOfCols = ceil(sqrt($numberOfIcons));
$porcentageWidth = floor(100/$numberOfCols);
echo '<table class=gridtable>';
$colcounter = 0;
for ($index=0;$index<$numberOfIcons;$index++) {
if ($colcounter == 0) {
echo "<tr><td>";
}
$anEntry = $inputArray[$index];
$textOfButton = $anEntry["textOfButton"]; #
$onClickMethod = $anEntry["onClickMethod"]; // With parameters!
$button = '<input type="button" value="' . $textOfButton . '"';
$button = $button . ' onclick="' . $onClickMethod . '"';
$button = $button . ' style="height: 50px; width:' . $porcentageWidth . '%; font-size:20px; background-color:#b3b3c9" />';
echo $button;
$colcounter++;
if ($colcounter == $numberOfCols) {
$colcounter = 0;
echo "</tr>";
}
}
echo "</tr>";
echo "</table>";
}
function createGridTableWithSqrtSizeOfStyleButtons($inputArray) {
$this->createGridTableWithSqrtSizeOfStyleButtonsAndHeader($inputArray,'','dummy');
}
function getTableNameFromId($tableid) {
$sql = "SELECT tableno FROM " . DB_RESTTABLES_TABLE . " WHERE id=". $tableid;
$dbresult = $this->dbutils->performSqlCommand($sql);
$zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC);
$tablename = $zeile['tableno'];
mysqli_free_result( $dbresult );
return $tablename;
}
function getCurrentPriceLevel() {
$sql = "SELECT setting FROM %config% WHERE name='pricelevel'";
$dbresult = $this->dbutils->performSqlCommand($sql);
$zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC);
$pricelevelid = $zeile['setting'];
mysqli_free_result( $dbresult );
$sql = "SELECT id,name FROM %pricelevel% WHERE id=$pricelevelid";
$dbresult = $this->dbutils->performSqlCommand($sql);
$zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC);
$pricelevelname = $zeile['name'];
mysqli_free_result( $dbresult );
return (array("id" => $pricelevelid, "name" => $pricelevelname));
}
function createGridTableWithSqrtSizeOfStyleButtonsAndHeader ($inputArray,$headline,$headercolor) {
// create a table that is optimal (sqrt-like size)
$numberOfIcons = count($inputArray);
if ($numberOfIcons == 0) {
// no items to display
return;
}
$numberOfCols = ceil(sqrt($numberOfIcons));
$porcentageWidth = floor(100.0/$numberOfCols);
echo '<table class=gridtable>';
// Headline
if ($headline <> '') {
echo '<tr><th style="background-color:#' . $headercolor . '">' . $headline . '</th>';
}
$colcounter = 0;
for ($index=0;$index<$numberOfIcons;$index++) {
if ($colcounter == 0) {
echo "<tr><td>";
}
$anEntry = $inputArray[$index];
$textOfButton = $anEntry["textOfButton"]; #
$onClickMethod = $anEntry["onClickMethod"]; // With parameters!
$style = $anEntry["style"];
$button = '<input type="button" value="' . $textOfButton . '"';
$button = $button . ' onclick="' . $onClickMethod . '"';
$button = $button . ' style="' . $style . '; width:' . $porcentageWidth . '%;" />';
echo $button;
$colcounter++;
if ($colcounter == $numberOfCols) {
$colcounter = 0;
echo "</tr>";
}
}
echo "</tr>";
echo "</table>";
}
}
?>

View File

@ -1,12 +0,0 @@
<?php
error_reporting(E_ERROR);
// Zum Aufbau der Verbindung zur Datenbank
// die Daten erhalten Sie von Ihrem Provider
define ( 'MYSQL_HOST','localhost' );
define ( 'MYSQL_USER', 'dbuser' );
define ( 'MYSQL_PASSWORD', 'dbpass' );
define ( 'MYSQL_DB', 'pos' );
define ('TAB_PREFIX', 'ordersprinter_');
?>

View File

@ -1,161 +0,0 @@
<?php
// Datenbank-Verbindungsparameter
require_once ('config.php');
require_once ('globals.php');
require_once ('dbutils.php');
class PrintQueue {
var $dbutils;
var $userrights;
function __construct() {
$this->dbutils = new DbUtils();
$this->userrights = new Userrights();
}
function handleCommand($command) {
// these command are only allowed for user with waiter rights
if ($command == 'queuePrintJob') {
$this->queuePrintJob($_POST['content'],$_POST['type']);
} else if ($command == 'getNextPrintJob') {
$this->getNextPrintJob($_POST['pass']);
} else if ($command == 'deletePrintJob') {
$this->deletePrintJob($_POST['pass'],$_POST['id']);
} else if ($command == 'getPrintJobAsHtml') {
$this->getPrintJobAsHtml($_GET['id'],$_POST['pass']);
} else if ($command == 'getNextPrintJobIdType') {
$this->getNextPrintJobIdType($_POST['pass']);
} else {
echo "Kommando nicht erkannt!";
}
}
/*
* Insert a job into ther printjob queue. The POS Print Server will
* pick these jobs and delete them after successful printing
*/
function queuePrintJob($htmlContent,$printType) {
if (($printType == FOOD_PRINT_TYPE) || ($printType == DRINK_PRINT_TYPE)){
// waiter rights required
if (!($this->userrights->hasCurrentUserRight('right_waiter'))) {
echo "Benutzerrechte nicht ausreichend!";
return false;
}
}
if ($printType == PAY_PRINT_TYPE){
// waiter, or manager, bill, admin rights required
if (!($this->userrights->hasCurrentUserRight('right_paydesk')) &&
!($this->userrights->hasCurrentUserRight('right_manager')) &&
!($this->userrights->hasCurrentUserRight('right_bill')) &&
!($this->userrights->hasCurrentUserRight('right_waiter')) &&
!($this->userrights->hasCurrentUserRight('is_admin'))
) {
echo "Benutzerrechte nicht ausreichend!";
return false;
}
}
// from here on user is authorized
$printInsertSql = "INSERT INTO `%printjobs%` (`id` , `content`,`type`) VALUES ( NULL, '$htmlContent' , '$printType')";
$dbresult = $this->dbutils->performSqlCommand($printInsertSql);
echo json_encode("OK");
}
function isPasswordCorrect($pass) {
$sql = "SELECT setting FROM %config% WHERE name=?";
$pdo = $this->dbutils->openDbAndReturnPdo();
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array("printpass"));
$row =$stmt->fetchObject();
if ($row != null) {
$passInDb = $row->setting;
if ($passInDb != null) {
// plain comparison
if ($pass == $passInDb) {
return true;
} else {
echo "Error: Falscher Printpass!";
}
} else {
echo "Error: kein Printpass in DB gesetzt!";
}
}
echo "Error: DB konnte nicht abgefragt werden!";
return false;
}
function getNextPrintJob($pass) {
$isCorrect = $this->isPasswordCorrect($pass);
if ($isCorrect) {
$sql = "SELECT id,content,type FROM %printjobs% ORDER BY id ASC LIMIT 1";
$pdo = $this->dbutils->openDbAndReturnPdo();
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$row =$stmt->fetchObject();
if ($row != null) {
echo json_encode(array("id" => $row->id, "content" => $row->content, "type" => $row->type));
}
}
}
function getNextPrintJobIdType($md5pass) {
$isCorrect = $this->isPasswordCorrect($md5pass);
if ($isCorrect) {
$sql = "SELECT id,type FROM %printjobs% ORDER BY id ASC LIMIT 1";
$pdo = $this->dbutils->openDbAndReturnPdo();
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$row =$stmt->fetchObject();
if ($row != null) {
$id = $row->id;
$theType = $row->type;
if ($id != null) {
header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );
header( "Content-Type: text/html; charset=utf8" );
echo "<html><body>" . $id . "-" . $theType . "</body></html>";
}
}
}
}
function getPrintJobAsHtml($id,$md5pass) {
$isCorrect = $this->isPasswordCorrect($md5pass);
if ($isCorrect) {
$sql = "SELECT content FROM %printjobs% WHERE id=?";
$pdo = $this->dbutils->openDbAndReturnPdo();
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($id));
$row =$stmt->fetchObject();
if ($row != null) {
$content = $row->content;
if ($content != null)
{
header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );
header( "Content-Type: text/html; charset=utf8" );
echo "<html><body>" . $content . "</body></html>";
}
}
}
}
function deletePrintJob($pass,$id) {
$isCorrect = $this->isPasswordCorrect($pass);
if ($isCorrect) {
$sql = "DELETE FROM %printjobs% WHERE id=?";
$pdo = $this->dbutils->openDbAndReturnPdo();
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($id));
}
}
}
?>

View File

@ -1,609 +0,0 @@
<?php
// Datenbank-Verbindungsparameter
require_once ('dbutils.php');
require_once ('queuecontent.php');
require_once ('commonutils.php');
require_once ('utilities/userrights.php');
require_once ('utilities/HistFiller.php');
class Products {
var $dbutils;
var $queue;
var $commonUtils;
var $userrights;
var $histfiller;
function __construct() {
$this->dbutils = new DbUtils();
$this->queue = new QueueContent();
$this->commonUtils = new CommonUtils();
$this->userrights = new Userrights();
$this->histfiller = new HistFiller();
}
function handleCommand($command) {
// canUserCallCommands($currentCmd, $cmdArray,$right)
$cmdArray = array('showDbProducts', 'applySingleProdData', 'reassign', 'applyType', 'getSingleProdData','getPriceLevelInfo','setPriceLevelInfo', 'createProduct','createProdType');
if (in_array($command, $cmdArray)) {
if (!($this->userrights->hasCurrentUserRight('right_products'))) {
if ($command == 'createProdType') {
echo json_encode(array("status" => "ERROR", "code" => ERROR_PRODUCTS_NOT_AUTHOTRIZED, "msg" => ERROR_PRODUCTS_NOT_AUTHOTRIZED_MSG));
} else {
echo "Benutzerrechte nicht ausreichend!";
}
return false;
}
}
if($command == 'showDbProducts') {
$this->showDbProducts();
} else if ($command == 'getSpeisekarte') {
if ($this->userrights->hasCurrentUserRight('is_admin') || ($this->userrights->hasCurrentUserRight('right_manager'))) {
$this->getSpeisekarte();
} else {
echo "Fehlende Benutzerechte";
}
} else if ($command == 'exportCsv') {
if (($this->userrights->hasCurrentUserRight('is_admin'))
|| ($this->userrights->hasCurrentUserRight('right_manager'))) {
$this->exportCsv();
}
} else if ($command == 'getAllTypesAndAvailProds') {
$this->getAllTypesAndAvailProds();
} else if ($command == 'getAllAvailProdsAlphaSorted') {
$this->getAllAvailProdsAlphaSorted();
} else if ($command == 'getSingleProdData') {
$this->getSingleProdData($_GET['id']);
} else if ($command == 'applySingleProdData') {
$this->applySingleProdData($_POST['id'],$_POST['longname'],$_POST['shortname'],$_POST['priceA'],$_POST['priceB'],$_POST['priceC'],$_POST['available'],$_POST['audioFile']);
} else if ($command == 'createProduct') {
$this->createProduct($_POST['longname'],$_POST['shortname'],$_POST['priceA'],$_POST['priceB'],$_POST['priceC'],$_POST['available'],$_POST['prodTypeId'],$_POST['audioFile']);
} else if ($command == 'reassign') {
$this->reassign($_POST['productid'],$_POST['typeid']);
} else if ($command == 'createProdType') {
$this->createProdType($_POST['refid'],$_POST['name']);
} else if ($command == 'applyType') {
$this->applyType($_POST['id'],$_POST['name'],$_POST['kind'],$_POST['usekitchen'],$_POST['usesupply']);
} else if ($command == 'getPriceLevelInfo') {
$this->getPriceLevelInfo();
} else if ($command == 'setPriceLevelInfo') {
$this->setPriceLevelInfo($_POST['priceLevelId']);
} else if ($command == 'getSpeisekarte') {
$this->getSpeisekarte();
} else if ($command == 'getAudioFiles') {
$this->getAudioFiles();
} else {
echo "Command not supported.";
}
}
function getDateValueAsBoolInterpretatedIcon($aValue) {
if ($aValue != '0' ) {
$imgFile = "ok.png";
} else {
$imgFile = "notavailable.png";
}
return $imgFile;
}
private function getAllTypesAndAvailProds() {
$pdo = $this->dbutils->openDbAndReturnPdo();
$pdo->beginTransaction();
$sql = "select id,name,reference from %prodtype% where removed is null";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$result = $stmt->fetchAll();
$typeArray = array();
foreach($result as $row) {
$ref = $row['reference'];
if ($ref == null) {
$ref = 0;
}
$typeArray[] = array("id" => $row['id'], "name" => $row['name'], "ref" => $ref);
}
$sql = "select id,shortname,longname,audio,category as ref from %products% where available='1' AND removed is null";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$result = $stmt->fetchAll();
$prodArray = array();
foreach($result as $row) {
$ref = $row['ref'];
if ($ref == null) {
$ref = 0;
}
$audio = $row['audio'];
if ($audio == null) {
$audio = "";
}
$prodArray[] = array("id" => $row['id'], "name" => $row['shortname'], "longname" => $row['longname'], "audio" => $audio, "ref" => $ref);
}
$pdo->commit();
$retArray = array("types" => $typeArray, "prods" => $prodArray);
echo json_encode($retArray);
}
/*
* Return all available product with id and name that are not in given type.
* (used for re-assignment to type)
*/
function getAllAvailProdsAlphaSorted() {
$pdo = $this->dbutils->openDbAndReturnPdo();
// find categories with available products in them
$sql = "select distinct category from %products% WHERE available='1' AND removed is null";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$result = $stmt->fetchAll();
$typeArr = array();
foreach($result as $row) {
$cat = $row['category'];
// find all prods not in this array (for later re-assignment into this cat)
$sql = "select id,longname from %products% WHERE available='1' AND removed is null AND category <> ? ORDER BY longname";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($cat));
$prodresult = $stmt->fetchAll();
$prodArray = array();
foreach($prodresult as $prow) {
$prodArray[] = array("id" => $prow['id'], "name" => $prow['longname']);
}
$typeArr[] = array("type" => $cat, "prods" => $prodArray);
}
echo json_encode($typeArr);
}
// ************************************************************
// * Start OLD part
// ************************************************************
// Utility function: find the roomid if the tableid is known
function getRoomFromTableid($tableid) {
// Find roomid for table (variable roomid works in the one direction, but if called by back-button, not)
$sql = "select " . DB_ROOM_TABLE . ".id as id from " . DB_ROOM_TABLE . ", " . DB_RESTTABLES_TABLE . " where " . DB_RESTTABLES_TABLE . ".id = '" . $tableid . "' and " . DB_ROOM_TABLE . ".id = " . DB_RESTTABLES_TABLE . ".roomid;";
$dbresult = $this->dbutils->performSqlCommand($sql);
$zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC);
$roomid = $zeile['id'];
mysqli_free_result( $dbresult );
return $roomid;
}
function areThereProductsInTheCategory($categoryid) {
$sql = "SELECT id FROM " . DB_PRODUCTS_TABLE . " WHERE category = " . $categoryid . " AND available='1';";
$dbresult = $this->dbutils->performSqlCommand($sql);
$numberOfEnttry = mysqli_num_rows($dbresult);
mysqli_free_result( $dbresult );
if ($numberOfEnttry > 0) {
return true;
} else {
return false;
}
}
function areThereCategoriesInTheCategory($categoryid) {
$sql = "SELECT id FROM %prodtype% WHERE removed is null AND reference = $categoryid";
$dbresult = $this->dbutils->performSqlCommand($sql);
$numberOfEntry = mysqli_num_rows($dbresult);
mysqli_free_result( $dbresult );
if ($numberOfEntry > 0) {
return true;
} else {
return false;
}
}
/*
* Return in array all products with their id and longname that have a reference to
* the given category.
*
* The output is this:
* ["id" => 1, "longname" => "Whatever Product"],
* ["id" => 2, "longname" => "Whatever Other Product"], ...
*/
private function getProductsWithReferenz($ref) {
$prods = array();
$sql = "SELECT id,shortname,longname,priceA,priceB,priceC,available,audio from %products% where removed is null AND category is null";
if ($ref > 0) {
$sql = "SELECT id,shortname,longname,priceA,priceB,priceC,available,audio from %products% where removed is null AND category=$ref";
}
$dbresult = $this->dbutils->performSqlCommand($sql);
while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) {
$prod_entry = array(
"id" => $zeile['id'],
"shortname" => $zeile['shortname'],
"longname" => $zeile['longname'],
"available" => $zeile['available'],
"priceA" => $zeile['priceA'],
"priceB" => $zeile['priceB'],
"priceC" => $zeile['priceC'],
"audio" => ($zeile['audio'] == null ? '' : $zeile['audio']),
"type" => "p");
$prods[] = $prod_entry;
}
mysqli_free_result( $dbresult );
return $prods;
}
/*
* Return in array all types with their id and name that have a reference to
* the given category.
*
* The output is this:
* ["id" => 1, "name" => "Meal"],
* ["id" => 2, "name" => "Drinks"], ...
*/
private function getProdTypesWithReferenz($ref) {
$types = array();
$sql = "SELECT id,name,kind,usekitchen,usesupplydesk from %prodtype% where removed is null AND reference is null";
if ($ref > 0) {
$sql = "SELECT id,name,kind,usekitchen,usesupplydesk from %prodtype% where removed is null AND reference=$ref";
}
$dbresult = $this->dbutils->performSqlCommand($sql);
while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) {
$prod_entry = array(
"id" => $zeile['id'],
"name" => $zeile['name'],
"kind" => $zeile['kind'],
"usekitchen" => $zeile['usekitchen'],
"usesupplydesk" => $zeile['usesupplydesk'],
"type" => "t");
$types[] = $prod_entry;
}
mysqli_free_result( $dbresult );
return $types;
}
function showDbProducts() {
$productArray = $this->getDbProductsWithRef_json_version(0,0);
echo json_encode($productArray);
}
function readDbProducts() {
$speisekarte = $this->readDbProductsWithRef_json_version(0,0);
return $speisekarte;
}
private function exportCsv() {
$file_name = "datenexport-produkte.csv";
header("Content-type: text/x-csv");
header("Content-Disposition: attachment; filename=$file_name");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
header("Expires: 0");
echo("Eintragsid; Datum ; Produktid; Kurzname; Langname; Preis (Stufe A); Preis (Stufe B);");
echo("Preis (Stufe C); Verfügbarkeit; Beschreibung");
echo("\n");
$sql = "SELECT DISTINCT %hist%.id as id,date,";
$sql .= "prodid,shortname,longname,priceA,priceB,priceC,available, description ";
$sql .= " FROM %hist%, %histprod%, %histactions% ";
$sql .= " WHERE (refid=%histprod%.id) ";
$sql .= " AND (action='1' OR action='4' OR action='5') ";
$sql .= " AND (action=%histactions%.id) ";
$sql .= " ORDER BY date,id";
$dbresult = $this->dbutils->performSqlCommand($sql);
while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) {
$val1 = $zeile['id'];
$val2 = $zeile['date'];
$val3 = $zeile['prodid'];
$val4 = str_replace('"','""',$zeile['shortname']);
$val5 = str_replace('"','""',$zeile['longname']);
$val6 = $zeile['priceA'];
$val7 = $zeile['priceB'];
$val8 = $zeile['priceC'];
$val9 = ($zeile['available'] == '1' ? "Ja" : "Nein");
$val10 = $zeile['description'];
echo "$val1; $val2; $val3; \"$val4\"; \"$val5\"; $val6; $val7; $val8; $val9; $val10\n";
}
mysqli_free_result( $dbresult );
}
function getSingleProdData($id) {
if (is_numeric($id)) {
$sql = "SELECT shortname,longname,priceA,priceB,priceC,available,audio from %products% where id=$id";
$dbresult = $this->dbutils->performSqlCommand($sql);
$zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC);
$prod_entry = array(
"shortname" => $zeile['shortname'],
"longname" => $zeile['longname'],
"available" => $zeile['available'],
"priceA" => $zeile['priceA'],
"priceB" => $zeile['priceB'],
"priceC" => $zeile['priceC'],
"audio" => $zeile['audio']
);
mysqli_free_result( $dbresult );
echo json_encode($prod_entry);
}
}
function reassign($prodid,$typeid) {
$pdo = $this->dbutils->openDbAndReturnPdo();
$pdo->beginTransaction();
$sql = "UPDATE %products% SET category=? WHERE id=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($typeid,$prodid));
$affectedRows = $stmt->rowCount();
$pdo->commit();
if ($affectedRows == 1) {
echo json_encode("OK");
} else {
echo json_encode("Failed");
}
}
function applySingleProdData($id,$longname,$shortname,$priceA,$priceB,$priceC,$available,$audioFile) {
if (!is_numeric($id) || !is_numeric($available) || !is_numeric($priceA) || !is_numeric($priceB) || !is_numeric($priceC)) {
return;
}
$priceA = $this->dbutils->filterString($priceA);
$priceB = $this->dbutils->filterString($priceB);
$priceC = $this->dbutils->filterString($priceC);
if ($audioFile == '') {
$audioFile = null;
}
$updateSql = "UPDATE %products% SET shortname=?, longname=?, priceA=?, priceB=?, priceC=?, available=?, audio=? WHERE id=?";
$pdo = $this->dbutils->openDbAndReturnPdo();
$pdo->beginTransaction();
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($updateSql));
$stmt->execute(array($shortname,$longname,$priceA,$priceB,$priceC,$available,$audioFile,$id));
$pdo->commit();
echo json_encode("OK: $updateSql");
// now this has to be logged in the history tables...
$this->histfiller->updateProdInHist($id, $shortname, $longname, $priceA, $priceB, $priceC,
NULL, $available,$audioFile);
}
function createProdType($id,$prodTypeName) {
if (!is_numeric($id)) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_GENERAL_ID_TYPE, "msg" => ERROR_GENERAL_ID_TYPE_MSG));
return;
}
$pdo = $this->dbutils->openDbAndReturnPdo();
$pdo->beginTransaction();
// which kind is the referenced type?
$sql = "SELECT kind FROM %prodtype% WHERE id=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($id));
$row =$stmt->fetchObject();
if ($row == null) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_GENERAL_DB_NOT_READABLE, "msg" => ERROR_GENERAL_DB_NOT_READABLE_MSG));
return;
}
$kind = $row->kind;
$sql = "INSERT INTO `%prodtype%` (`id`,`name`,`usekitchen`,`usesupplydesk`,`kind`,`sorting`,`reference`) ";
$sql .= " VALUES(NULL,?,1,1,?,NULL,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($prodTypeName,$kind,$id));
$pdo->commit();
echo json_encode(array("status" => "OK"));
}
function createProduct($longname,$shortname,$priceA,$priceB,$priceC,$available,$typeId,$audioFile) {
if (!is_numeric($typeId) || !is_numeric($available) || !is_numeric($priceA) || !is_numeric($priceB) || !is_numeric($priceC)) {
return;
}
if ($audioFile == '') {
$audioFile = null;
}
$sql = "INSERT INTO `%products%` (`id`, `shortname`, `longname`, `priceA`, `priceB`, `priceC`, `category`,`available`,`audio`) VALUES (NULL,?,?,?,?,?,?,?,?)";
$pdo = $this->dbutils->openDbAndReturnPdo();
$pdo->beginTransaction();
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($shortname,$longname,$priceA,$priceB,$priceC,$typeId,$available,$audioFile));
$newProdId = $pdo->lastInsertId();
$pdo->commit();
// now this has to be logged in the history tables...
$this->histfiller->createProdInHist ($newProdId['id'], $shortname, $longname, $priceA, $priceB, $priceC,
NULL, $available,$audioFile);
echo json_encode("OK: sql");
}
/*
* Change the properties of a type of products
*/
function applyType($id,$name,$kind,$usekitchen,$usesupply) {
if (!is_numeric($id) || !is_numeric($kind) || !is_numeric($usekitchen) || !is_numeric($usesupply)) {
return;
}
$pdo = $this->dbutils->openDbAndReturnPdo();
$updateSql = "UPDATE %prodtype% SET kind=?, name=?, usekitchen=?, usesupplydesk=? WHERE id=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($updateSql));
$stmt->execute(array($kind,$name,$usekitchen,$usesupply,$id));
echo json_encode("OK: $updateSql");
}
/*
* Return a html table with all products in a structured way
*/
private function getDbProductsWithRef_json_version($ref,$depth) {
$allProdsAndTypesInThisLevel = array();
$allProdsInThisLevel = $this->getProductsWithReferenz($ref);
$allTypesInThisLevel = $this->getProdTypesWithReferenz($ref);
for ($index_prod=0;$index_prod<count($allProdsInThisLevel);$index_prod++) {
$aProd = $allProdsInThisLevel[$index_prod];
$allProdsAndTypesInThisLevel[] = array("entry" => $aProd, "content" => '');
}
for ($index_type=0;$index_type < count($allTypesInThisLevel);$index_type++) {
$aProdType = $allTypesInThisLevel[$index_type];
$typeRef = $aProdType['id'];
$allProdsAndTypesInThisLevel[] = array("entry" => $aProdType,"content" => $this->getDbProductsWithRef_json_version($typeRef,$depth+1));
}
return $allProdsAndTypesInThisLevel;
}
// return in text format
private function readDbProductsWithRef_json_version($ref,$depth) {
$text = "";
$allProdsAndTypesInThisLevel = array();
$allProdsInThisLevel = $this->getProductsWithReferenz($ref);
$allTypesInThisLevel = $this->getProdTypesWithReferenz($ref);
for ($index_prod=0;$index_prod<count($allProdsInThisLevel);$index_prod++) {
$aProd = $allProdsInThisLevel[$index_prod];
// Kurzname ; NormalPreis (Stufe A); Langname # Preis (Stufe B); Preis (Stufe C)
$shortname = $aProd['shortname'];
$longname = $aProd['longname'];
$available = $aProd['available'];
$priceA = $aProd['priceA'];
$priceB = $aProd['priceB'];
$priceC = $aProd['priceC'];
$prodText = "$shortname ; $priceA ; $longname # $priceB ; $priceC";
$text .= substr ( " " , 0 ,$depth) . $prodText . "\n";
}
for ($index_type=0;$index_type < count($allTypesInThisLevel);$index_type++) {
$aProdType = $allTypesInThisLevel[$index_type];
$typeRef = $aProdType['id'];
$indent = substr ( " " , 0 ,$depth);
$prod_entry = array(
"id" => $zeile['id'],
"name" => $zeile['name'],
"kind" => $zeile['kind'],
"usekitchen" => $zeile['usekitchen'],
"usesupplydesk" => $zeile['usesupplydesk'],
"type" => "t");
$prodTypeName = $aProdType['name'];
$kind = ($aProdType['kind'] == 0 ? "F" : "D");
$usekitchen = ($aProdType['usekitchen'] == 1 ? "K" : "");
$usesupplydesk = ($aProdType['usesupplydesk'] == 1 ? "B" : "");
$text .= $indent . $prodTypeName . " = $usekitchen$usesupplydesk$kind\n";
$text .= $this->readDbProductsWithRef_json_version($typeRef,$depth+1);
}
return $text;
}
private function numberOfProdsInProdType($theId) {
// how many prods are related to this type?
$sql = "SELECT COUNT(id) FROM %products% WHERE removed is null AND category=$theId";
$dbresult = $this->dbutils->performSqlCommand($sql);
$zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC);
$noProdsInThisProdType = $zeile['COUNT(id)'];
mysqli_free_result( $dbresult );
// iterate over all prodtypes in this prodtype
$prodtypesInside = $this->getProdTypesWithReferenz($theId);
for ($i=0;$i < count($prodtypesInside);$i++) {
$anInsideProdType = $prodtypesInside[i];
// recursive
$noProdsInThisProdType += $this->numberOfProdsInProdType($anInsideProdType["id"]);
}
return $noProdsInThisProdType;
}
private function getPriceLevelInfo() {
$currentPriceLevel = $this->commonUtils->getCurrentPriceLevel();
$currentPriceLevelId = $currentPriceLevel["id"];
$currentPriceLevelName = $currentPriceLevel["name"];
$pricelevels = array();
$sql = "SELECT * FROM %pricelevel%";
$dbresult = $this->dbutils->performSqlCommand($sql);
while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) {
$theId = $zeile['id'];
$selected = "0";
if ($theId == $currentPriceLevelId) {
$selected = "1";
}
$levels_entry = array(
"id" => $theId,
"name" => $zeile['name'],
"info" => $zeile['info'],
"selected" => $selected);
$pricelevels[] = $levels_entry;
}
mysqli_free_result( $dbresult );
$retArray = array("currentId" => $currentPriceLevelId, "currentName" => $currentPriceLevelName, "levels" => $pricelevels);
echo json_encode($retArray);
}
private function setPriceLevelInfo($levelId) {
if (is_numeric($levelId)) {
$updateSql = "UPDATE %config% SET setting=$levelId WHERE name='pricelevel'";
$dbresult = $this->dbutils->performSqlCommand($updateSql);
echo json_encode("OK");
}
}
private function getSpeisekarte() {
$pdo = $this->dbutils->openDbAndReturnPdo();
$sql = "SELECT * FROM %products% WHERE removed is null";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$numberOfProds = $stmt->rowCount();
$sql = "SELECT * FROM %prodtype% WHERE removed is null";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$numberOfProdTypes = $stmt->rowCount();
if (($numberOfProds == 0) && ($numberOfProdTypes == 0)) {
// no products defined yet - present Beispiel
$text = file_get_contents ("../customer/speisekarte.txt");
} else {
$text = $this->readDbProducts();
}
echo json_encode($text);
}
private function endsWith($haystack, $needle)
{
return $needle === "" || substr($haystack, -strlen($needle)) === $needle;
}
private function getAudioFiles() {
$dir = '../customer';
$fileList = scandir($dir);
$audioFiles = array();
foreach ($fileList as $aFile) {
if ($this->endsWith($aFile, '.mp3') || $this->endsWith($aFile, '.ogg') || $this->endsWith($aFile, '.wav')) {
$audioFiles[] = $aFile;
}
}
echo json_encode($audioFiles);
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -1,74 +0,0 @@
<?php
// print_r(explode('|', $str, 2));
class ProductEntry {
private $shortName; // the name that shall appear on the button of the waiter
private $priceA; // the price of the product (default)
private $priceB; // price level B
private $priceC; // price level C
private $longName; // the name that shall appear on the receipt
// Constructor - gehts the line as it is in the Speisekarte
function __construct($aTextLine) {
// is there multiple price levels?
$numberOfPrices = 1;
$priceparts = explode('#', $aTextLine, 2);
$price_level_B = "0.00";
$price_level_C = "0.00";
if (count($priceparts) == 2) {
// there is a # in the line --> probably two prices
$otherPrices = $priceparts[1];
// are there level 2&3 or only 2?
$otherPriceParts = explode(';', $otherPrices, 2);
$price_level_B = trim(floatval($otherPriceParts[0]));
if (count($otherPriceParts) == 1) {
$numberOfPrices = 2;
} else if (count($otherPriceParts) == 2) {
$price_level_C = trim(floatval($otherPriceParts[1]));
$numberOfPrices = 3;
} else {
// undefined
$numberOfPrices = 1; // fall back to default
}
}
$parts = explode(';', $priceparts[0], 3);
$this->shortName = trim($parts[0]);
$this->priceA = trim(floatval($parts[1]));
// default: all the same price
$this->priceB = $this->priceA;
$this->priceC = $this->priceA;
if ($numberOfPrices == 2) {
$this->priceB = $price_level_B; // A = C, only B is different
} else if ($numberOfPrices == 3) {
$this->priceB = $price_level_B;
$this->priceC = $price_level_C;
}
if (count($parts) < 3) {
// in this case the button name is the same as the name on the bill
$this->longName = $this->shortName;
} else {
$this->longName = trim($parts[2]);
}
}
function getShortName() {
return $this->shortName;
}
function getPriceA() {
return $this->priceA;
}
function getPriceB() {
return $this->priceB;
}
function getPriceC() {
return $this->priceC;
}
function getLongName() {
return $this->longName;
}
function toString() {
return "S:" . $this->shortName . " PA:" . $this->priceA . " PB:" . $this->priceB . " PC:" . $this->priceC . " R:" . $this->longName;
}
}

View File

@ -1,54 +0,0 @@
<?php
// Datenbank-Verbindungsparameter
require_once ('globals.php');
class Userrights {
/*
* can the current call the currentCmd
*/
function canUserCallCommands($currentCmd, $cmdArray,$right) {
session_start();
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
// no user logged in
return false;
} else {
// user is logged in
if (in_array($currentCmd, $cmdArray)) {
// yes, the current command is in the set of commands to test!
if ($_SESSION[$right]) {
return true;
}
}
return false;
}
}
function isCurrentUserAdmin() {
if(session_id() == '') {
session_start();
}
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
// no user logged in
return false;
} else {
return ($_SESSION['is_admin']);
}
}
function hasCurrentUserRight($whichRight) {
if(session_id() == '') {
session_start();
}
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
// no user logged in
return false;
} else {
return ($_SESSION[$whichRight]);
}
}
}
?>

View File

@ -1,161 +0,0 @@
<html>
<head>
<title>Ansicht persönliche Einstellungen</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>
</head>
<body>
<script>
function doAjaxPasswordChange(oldPass,newPass,errorMsg) {
var data = {
oldPass: oldPass,
newPass: newPass
};
doAjax("POST","php/contenthandler.php?module=admin&command=changeOwnPassword",data,changePassword,"Passwortproblem");
}
function changePassword(jsonContent) {
if (jsonContent == "OK") {
$("#passwordchangedpopup").popup( "open", {transition: 'flip'} );
} else {
$("#passwordnotchangedpopup").popup( "open", {transition: 'flip'} );
}
}
function fillCurrentUserIntoMask(username) {
$("#username").html(username);
}
function setCurrentUserIntoMask() {
doAjax("GET","php/contenthandler.php?module=admin&command=getCurrentUser",null,fillCurrentUserIntoMask,"Keine Benutzerinfo");
}
function setVolume() {
doAjax("GET","php/contenthandler.php?module=admin&command=getOrderVolume",null,fillOrderVolume,"Keine Ordertoninformation");
}
function fillOrderVolume(volume) {
$("#slidervolume").val(volume);
$("#slidervolume").slider('refresh');
}
function binding() {
// Help buttons
$("#changepasswordbutton").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var oldp = $("#oldpass").val();
var newp = $("#newpass").val();
doAjaxPasswordChange(oldp,newp,"Password change impossible");
$("#oldpass").val("");
$("#newpass").val("");
});
$("#slidervolume").off('slidestop').on('slidestop', function(e) {
doAjax("POST","php/contenthandler.php?module=admin&command=setOrderVolume",{volume:$("#slidervolume").val()},null,"Orderton nicht einstellbar");
});
}
//pageinit event for first page
//triggers only once
//write all your on-load functions and event handlers pertaining to page1
$(document).on("pageinit", "#admin-page", function () {
initializeMainMenu("#modulemenu");
hideMenu();
binding();
setCurrentUserIntoMask();
setVolume();
});
</script>
<!--
Seitenstruktur:
General settings
MwSt-Satz:
Abrechnung:
Tagesabrechung:
Erstellung neue Abrechnung
<Liste der alten Abrechungen>
Druck - csv-Export
-->
<div data-role="page" id="admin-page">
<div data-role="panel" id="modulepanel" data-position="right" data-display="overlay" class="noprint">
<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" class="noprint">
<h1>Persönliche Einstellungen für <span id="username"></span></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="userpart" data-role="collapsible" data-collapsed="false" data-theme="e" data-content-theme="c" class="noprint">
<h3>Passwort</h3>
<form action="php/contenthandler.php?module=admin&command=changeOwnPassword" method="post">
Altes Passwort: <input type="password" name="oldpassword" id="oldpass"/><br />
Neues Passwort: <input type="password" name="newpassword" id="newpass"/><br />
<input type="submit" value="Passwort ändern" data-theme="d" id="changepasswordbutton"/>
</form>
</div> <!-- Benutzerpasswort -->
<div id="volume" data-role="collapsible" data-collapsed="false" data-theme="e" data-content-theme="c" class="noprint">
<h3>Orderton</h3>
<label for="slidervolume">Lautstärke:</label>
<input type="range" name="slidervolume" id="slidervolume" value="0" min="0" max="10" />
</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="passwordchangedpopup" name="passwordchangedpopup" data-overlay-theme="a" style="max-width:70%;" class="ui-corner-all">
<div data-role="header" class="ui-corner-top">
<h1>Passwordänderung</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>Das Passwort wurde geändert.</p>
</div>
</div> <!-- popup for changed password -->
<div data-role="popup" id="passwordnotchangedpopup" name="passwordnotchangedpopup" data-overlay-theme="a" style="max-width:70%;" class="ui-corner-all">
<div data-role="header" class="ui-corner-top">
<h1>Passwordänderung</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>Das Passwort konnte nicht geändert werden. Bitte prüfen Sie, ob das alte Passwort korrekt eingegeben wurde.</p>
</div>
</div> <!-- popup for failed password change -->
</div>
</body>
</html>

Binary file not shown.

View File

@ -1,629 +0,0 @@
<html>
<head>
<title>Ansicht Produkte</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>
</head>
<body>
<script>
function showDbProducts() {
doAjax("GET","php/contenthandler.php?module=products&command=getAllAvailProdsAlphaSorted",null,saveProdsGetHierarchy,"keine Produktinformation bekommen");
}
function saveProdsGetHierarchy(prods) {
$("#info-page").data("allprods",prods);
doAjax("GET","php/contenthandler.php?module=products&command=showDbProducts",null,fillLevel0WithProductOverview,"keine Produkthierarchyinformation bekommen");
}
function getAudioFiles() {
doAjax("GET","php/contenthandler.php?module=products&command=getAudioFiles",null,setAvailableAudioFiles,"keine Audiofiles-Info bekommen");
}
function setAvailableAudioFiles(audioFiles) {
$("#info-page").data("audioFiles",audioFiles);
}
function fillLevel0WithProductOverview(prodInfo) {
displayProductOverview_level0(prodInfo,"componentStructure");
}
// only set available switch
function setRadioButton(avail_elem,valueToSet) {
var flipName = avail_elem.find("input").attr("name");
var newSwitchHtmlText = switchElement(flipName,valueToSet, "Verfügbar");
// does not work
// $("input[type='radio']").checkboxradio("refresh");
// therefore replace html content in div #avalaible - dirty, but works
var partToSubst = avail_elem.parent().parent().parent().find("#availablepart");
partToSubst.html(newSwitchHtmlText);
}
// only set audio selection
function setAudioFile(container_elem,valueToSet) {
var audioElem = container_elem.find("select").attr("id");
htmlText = fillAudioList(valueToSet);
$("#" + audioElem).html(htmlText);
$("#" + audioElem).selectmenu('refresh', true);
}
function applyProductChange(id,longname,shortname,priceA,priceB,priceC,avail,audioFile) {
var data = {
id: id,
longname: longname,
shortname: shortname,
priceA: priceA,
priceB: priceB,
priceC: priceC,
available: avail,
audioFile: audioFile
};
doAjax("POST","php/contenthandler.php?module=products&command=applySingleProdData",data,null,"Keine Produktmodifikation");
}
function createProduct(longname,shortname,priceA,priceB,priceC,avail,prodTypeId,audioFile) {
var data = {
longname: longname,
shortname: shortname,
priceA: priceA,
priceB: priceB,
priceC: priceC,
available: avail,
prodTypeId: prodTypeId,
audioFile: audioFile
};
doAjax("POST","php/contenthandler.php?module=products&command=createProduct",data,location.reload(),"Neues Produkt nicht anlegbar");
}
function applyTypeChange(id,name,kind,usekitchen,usesupply) {
var data = {
id: id,
name: name,
kind: kind,
usekitchen: usekitchen,
usesupply: usesupply
}
doAjax("POST","php/contenthandler.php?module=products&command=applyType",data,null,"Cannot apply Type Change");
}
function resetDataOfSingleProd(id,longname_elem,shortname_elem,price_elemA,price_elemB,price_elemC,avail_elem,container_elem) {
var jsonContent = '';
$.ajax({ type: "GET",
dataType: "json",
url: "php/contenthandler.php",
data : {
module: "products",
command: "getSingleProdData",
id: id
},
async: false,
success : function(jsonContent)
{
longname_elem.val(jsonContent.longname);
shortname_elem.val(jsonContent.shortname);
price_elemA.val(jsonContent.priceA);
price_elemB.val(jsonContent.priceB);
price_elemC.val(jsonContent.priceC);
var audio = jsonContent.audio;
if ((audio == '') || (audio == null)) {
audio = "Kein Ton";
}
setAudioFile(container_elem,audio);
var avail = jsonContent.available;
setRadioButton(avail_elem,avail);
$('#componentStructure').trigger('create');
},
error: function( text ) {
alert( "Sorry, there was a problem getDataOfSingleProd !" + text);
}
});
return jsonContent;
}
function reassignProd (prodid,typeid) {
var data = {
productid : prodid,
typeid : typeid
};
doAjax("POST","php/contenthandler.php?module=products&command=reassign",data,reloadPageWithTimeout,"Produkt nicht zuweisbar");
}
// reload, also for Chrome working
function reloadPageWithTimeout(result) {
if (result != "OK") {
alert("Fehler aufgetreten - bitte Aktion wiederholen!");
}
setTimeout(function(){document.location.href = "products.html"},500);
}
function new_prod_details_content() {
return ('<h3>Neues Produkt</h3>' + prod_details_content_by_vars("-1","","",1,"","","","","",false,true));
}
function prod_details_content(entry,flip_elemid) {
var id = entry.id;
var longname = entry.longname;
var shortname = entry.shortname;
var available = entry.available;
var priceA = entry.priceA;
var priceB = entry.priceB;
var priceC = entry.priceC;
var audio = entry.audio;
if (audio == '') {
audio = "Kein Ton";
}
return ('<h3>' + longname + '</h3>' + prod_details_content_by_vars(id,longname,shortname,available,priceA,priceB,priceC,audio,flip_elemid,true,false));
}
function fillAudioList(selectedAudio) {
audioList = $("#info-page").data("audioFiles");
var text = "<option>Kein Ton</option>";
$.each(audioList, function (i, anAudioFile) {
var audioFile = anAudioFile;
if (audioFile == selectedAudio) {
text += '<option selected>' + audioFile + '</option>';
} else {
text += '<option>' + audioFile + '</option>';
}
});
return text;
}
function prod_details_content_by_vars(id,longname,shortname,available,priceA,priceB,priceC,audio,flip_elemid,cancelAndConfirm,fillAllAudios) {
longname = longname.replace(/"/g, '&quot;');
shortname = shortname.replace(/"/g, '&quot;');
var aText = '<p><input type="hidden" name="prodid" value="' + id + '" id="id"></input></p>';
aText += ' <p><div data-role="fieldcontain">';
aText += ' <label for="basic">Langname:</label>';
aText += ' <input type="text" name="longname" id="longname" value="' + longname + '" />';
aText += ' </div></p>';
aText += ' <p><div data-role="fieldcontain">';
aText += ' <label for="basic">Kurzname:</label>';
aText += ' <input type="text" name="shortname" id="shortname" value="' + shortname + '" />';
aText += ' </div></p>';
aText += ' <p><div data-role="fieldcontain">';
aText += ' <label for="priceA">Preis (A):</label>';
aText += ' <input type="text" name="priceA" id="priceA" value="' + priceA.replace(".",",") + '" />';
aText += ' <label for="priceB">Preis (B):</label>';
aText += ' <input type="text" name="priceB" id="priceB" value="' + priceB.replace(".",",") + '" />';
aText += ' <label for="priceC">Preis (C):</label>';
aText += ' <input type="text" name="priceC" id="priceC" value="' + priceC.replace(".",",") + '" />';
aText += ' </div></p>';
aText += ' <p><div data-role="fieldcontain">';
aText += ' <label for="audiolistselection">Audiofile:</label>';
aText += ' <select name="audiolistselection" id="audiosel_' + flip_elemid + '" class="audiolistselection" data-theme="f">';
if (fillAllAudios) {
aText += fillAudioList('');
} else {
aText += fillAudioList(audio);
}
aText += ' </select>';
aText += ' </div></p>';
var buttonAreaId = flip_elemid + 'buttonarea';
aText += '<div data-role="fieldcontain" id="availablepart">';
aText += switchElement (flip_elemid,available,"Verfügbar");
aText += '</div>';
if (cancelAndConfirm) {
aText += ' <p><fieldset class="ui-grid-a" id="' + buttonAreaId + '">';
aText += ' <div class="ui-block-a"><button type="submit" data-theme="c" class="cancelButton" data-icon="back">Abbrechen</button></div>';
aText += ' <div class="ui-block-b"><button type="submit" data-theme="b" class="applyButton" data-icon="check">Anwenden</button></div> ';
aText += ' </fieldset>';
aText += ' </p>';
} else {
aText += '<button type="submit" data-theme="b" class="applyButton" data-icon="check">Anwenden</button>';
}
return aText;
}
function cb_showPriceLevels(jsonContent) {
var selectedLevel = jsonContent.currentId;
var selectedLevelName = jsonContent.currentName;
var levels = jsonContent.levels;
var aText = '<div data-role="collapsible" id="pricelevelcollapsible" data-theme="c" data-collapsed="false"><h3>Preisstufe: ' + selectedLevelName + '</h3><p>';
aText += '<fieldset data-role="controlgroup" id="pricelevelfieldset" >';
var htmlTextA = getPriceLevelRadio("radio-pricelevel-a",levels[0]["name"] + ": " + levels[0]["info"],levels[0]["selected"]);
var htmlTextB = getPriceLevelRadio("radio-pricelevel-b",levels[1]["name"] + ": " + levels[1]["info"],levels[1]["selected"]);
var htmlTextC = getPriceLevelRadio("radio-pricelevel-c",levels[2]["name"] + ": " + levels[2]["info"],levels[2]["selected"]);
aText += htmlTextA + htmlTextB + htmlTextC;
aText += '</fieldset></p></div>';
$("#pricelevelswitch").html(aText);
$("#pricelevelcollapsible").trigger('create');
$("#pricelevelswitch").trigger('create');
}
function showPriceLevels() {
var jsonContent = '';
doAjax("POST","php/contenthandler.php?module=products&command=getPriceLevelInfo",null,cb_showPriceLevels,"Preislevel");
}
function setPriceLevel(priceLevelId) {
$.ajax({ type: "POST",
dataType: "json",
url: "php/contenthandler.php?module=products&command=setPriceLevelInfo",
data : {
priceLevelId: priceLevelId
},
async: false,
success : function(jsonContent)
{
showPriceLevels();
binding();
},
error: function( text ) {
alert( "Sorry, there was a problem setting price level: " + text);
}
});
}
function getPriceLevelRadio (idname, priceinfo, checked) {
var aText = '<input type="radio" name="radio-pricelevel" id="' + idname + '" value="choice-level" data-theme="f" />';
if (checked == "1") {
aText = '<input type="radio" name="radio-pricelevel" id="' + idname + '" value="choice-level" checked="checked" data-theme="f"/>';
}
aText += '<label for="' + idname + '">' + priceinfo + '</label>';
return aText;
}
function switchElementWithFreeOptions(flip_elemid,available,displayText,firstOptionText,secondOptionText) {
var flip_elem_yes = flip_elemid + '_yes';
var flip_elem_no = flip_elemid + '_no';
var flip_name = flip_elemid;
var aText = '<fieldset data-role="controlgroup" data-type="horizontal">';
aText += ' <legend>' + displayText + ':</legend>';
if (available == '0') {
aText += ' <input type="radio" name="' + flip_name+ '" id="' + flip_elem_yes + '" value="choice-yes" />';
aText += ' <label for="' + flip_elem_yes+ '">' + firstOptionText + '</label>';
aText += ' <input type="radio" name="' + flip_name + '" id="' + flip_elem_no + '" value="choice-no" checked="checked"/>';
aText += ' <label for="' + flip_elem_no + '">' + secondOptionText + '</label>';
} else {
aText += ' <input type="radio" name="' + flip_name+ '" id="' + flip_elem_yes+ '" value="choice-yes" checked="checked" />';
aText += ' <label for="' + flip_elem_yes+ '">' + firstOptionText + '</label>';
aText += ' <input type="radio" name="' + flip_name + '" id="' + flip_elem_no + '" value="choice-no" />';
aText += ' <label for="' + flip_elem_no + '">' + secondOptionText + '</label>';
}
aText += '</fieldset>';
return aText;
}
function switchElement(flip_elemid,available,displayText) {
return(switchElementWithFreeOptions(flip_elemid,available,displayText,"Ja","Nein"));
}
function displayProductOverview_level0(jsonContent,elemid) {
var elems = jsonContent.length;
var idcounter = 0;
$.each(jsonContent, function (i, prodOrType) {
var prod = prodOrType;
var name = prod.entry.name;
++idcounter;
var newid = elemid + '_' + idcounter;
$('<div data-role="collapsible" data-content-theme="e" id="'+newid+'" data-collapsed="false" data-theme="c"><h3>'+name + '</h3>').appendTo('#'+elemid);
if (prod.entry.type == 't') {
idcounter = displayProductOverview_deeper_level(prod.content,newid,idcounter,prod.entry.id,name,prod.entry.kind,prod.entry.usekitchen,prod.entry.usesupplydesk,false);
}
});
$('#' + elemid).trigger('create');
}
function freeFlipElem(label,firstOptionText,secondOptionText,whichOptionSelected,elemid) {
var htmlText = '<div class="ui-field-contain">';
htmlText += '<label for="'+ elemid + '">' + label + ':</label>';
htmlText += '<select name="select-native-1" id="'+ elemid + '">';
if (whichOptionSelected == 1) {
htmlText += '<option value="1" selected>' + firstOptionText + '</option>';
htmlText += '<option value="2">' + secondOptionText + '</option>';
} else {
htmlText += '<option value="1">' + firstOptionText + '</option>';
htmlText += '<option value="2" selected>' + secondOptionText + '</option>';
}
htmlText += '</select>';
htmlText += '</div>';
return htmlText;
}
function htmlOfTypeProperties(name,kind,useKitchen,useSupply,setId) {
name = name.replace(/\"/g, "&quot;");
var html = '<form id="typeform_' + setId + '">';
html += freeFlipElem("Art","Speisen","Getränke",1-kind,setId + "_kind");
html += freeFlipElem("Küchen/Bar","Durchlaufe Küche/Bar","Durchlaufe nicht Küche/Bar",useKitchen,setId + "_usekitchen");
html += freeFlipElem("Bereitstellung","Durchlaufe Bereitstellung","Durchlaufe nicht Bereitstellung",useSupply,setId + "_usesupply");
html += ' <p><div data-role="fieldcontain">';
html += ' <label for="' + setId + '_name">Name:</label>';
html += ' <input type="text" name="' + setId + '_name" id="' + setId + '_name" value="' + name + '" />';
html += ' </div></p>';
html += ' <p><fieldset class="ui-grid-a" id="' + setId + "_buttonarea" + '">';
html += ' <div class="ui-block-a"><button type="submit" data-theme="c" class="cancelTypeButton" data-icon="back">Abbrechen</button></div>';
html += ' <div class="ui-block-b"><button type="submit" data-theme="b" class="applyTypeButton" data-icon="check">Anwenden</button></div> ';
html += ' </fieldset>';
html += ' </p>';
html += '</form>';
return html;
}
function displayProductOverview_deeper_level(jsonContent,elemid,idcounter,typeId,name,kind,usekitchen,usesupply,displayNewEntry) {
// show type/category properties
var kindText = htmlOfTypeProperties(name,kind,usekitchen,usesupply,typeId);
$(kindText).appendTo('#'+elemid);
var elems = jsonContent.length;
$.each(jsonContent, function (i, prod) {
var name = prod.entry.name;
++idcounter;
var newid = elemid + '_' + idcounter;
if (prod.entry.type == 't') {
// a type
$('<div data-role="collapsible" class="prodtype" data-content-theme="f" id="'+newid+'"><h3>'+name + '</h3>').appendTo('#'+elemid);
idcounter = displayProductOverview_deeper_level(prod.content,newid,idcounter,prod.entry.id,name,prod.entry.kind,prod.entry.usekitchen,prod.entry.usesupplydesk,true);
} else {
// is a product
var prodDetails = prod_details_content(prod.entry,"flip_" + newid);
$('<div data-role="collapsible" data-content-theme="a" id="'+newid+'">' + prodDetails).appendTo('#'+elemid);
var flipName = "flip_" + newid;
var aValue = $(flipName).val();
$("flip_" + newid).val('on').slider("refresh");
}
});
$('#'+elemid).data("prodtype",typeId);
if (displayNewEntry) {
// (on highest level no products)
var newProduct = new_prod_details_content();
$('<div data-role="collapsible" data-theme="d" data-content-theme="d">' + newProduct).appendTo('#'+elemid);
}
var newTypeButton = '<div class="ui-field-contain">';
newTypeButton += '<input type="text" value="" data-mini="true" placeholder="Neue Kategorie" id="newtype_' + typeId + '"/>';
newTypeButton += '<button data-theme="d" data-icon="plus" class="newTypeButtonClass">Neue Kategorie</button>';
newTypeButton += '</div>';
$(newTypeButton).appendTo('#'+elemid);
if (displayNewEntry) {
var selectOptions = selectProdForTypeAssign(typeId);
var assignProdButton = '<p><fieldset class="ui-grid-a">';
assignProdButton += ' <div class="ui-block-a">' + selectOptions + '</div>';
assignProdButton += ' <div class="ui-block-b"><button data-theme="d" data-icon="plus" class="assignProductButtonClass">Produkt zuweisen</button></div>';
assignProdButton += '</fieldset></p>';
$(assignProdButton).appendTo('#'+elemid);
}
return idcounter;
}
function selectProdForTypeAssign($type) {
var elname = "prodsel_" + $type;
var selecthtml = '<select name="' + elname + '" id="' + elname + '">';
var allprodtypes = $("#info-page").data("allprods");
var prods = null;
var i=0;
for (i=0;i<allprodtypes.length;i++) {
var aType = allprodtypes[i];
if (aType.type == $type) {
prods = aType.prods;
var j=0;
for (j=0;j<prods.length;j++) {
var aProd = prods[j];
var prodname = aProd.name;
prodname = prodname.replace(/"/g, '&quot;');
selecthtml += '<option value="' + aProd.id + '">' + prodname + '</option>';
}
}
}
selecthtml += '</select>';
return selecthtml;
}
function convertToDecimalPoint(aVal) {
if (aVal != null) {
var strVal = aVal.toString().replace(",",".");
if ($.isNumeric(strVal)) {
return [true, strVal];
}
}
return [false];
}
function handleAnswerOfCreateProdType(jsonText) {
if (jsonText.status == "OK") {
location.reload()
} else {
alert("Fehler " + jsonText.code + ": " + jsonText.msg);
}
}
function binding() {
$(".newTypeButtonClass").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var prodContainerElem = $(this).closest(".ui-collapsible");
var prodtypeId = prodContainerElem.data("prodtype");
var newTypeName = $("#newtype_"+ prodtypeId).val();
if ((newTypeName == null) || (newTypeName.replace(/ /g,"") == "")) {
alert ("Name der neuen Produktkategorie eingeben!");
} else {
var data = {
refid: prodtypeId,
name: newTypeName
}
doAjax("POST","php/contenthandler.php?module=products&command=createProdType",data,handleAnswerOfCreateProdType,"Neue Kategorie nicht anlegbar");
}
});
$(".assignProductButtonClass").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var prodContainerElem = $(this).closest(".ui-collapsible");
var prodtypeId = prodContainerElem.data("prodtype");
var selBox = "prodsel_" + prodtypeId;
var selectedProd = $("#" + selBox + " option:selected").val();
reassignProd (selectedProd,prodtypeId);
});
$(".applyButton").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var prodContainerElem = $(this).closest(".ui-collapsible");
var longname = prodContainerElem.find("#longname").val();
var shortname = prodContainerElem.find("#shortname").val();
var priceA_Arr = convertToDecimalPoint(prodContainerElem.find("#priceA").val());
var priceB_Arr = convertToDecimalPoint(prodContainerElem.find("#priceB").val());
var priceC_Arr = convertToDecimalPoint(prodContainerElem.find("#priceC").val());
var selectedAudioFile = prodContainerElem.find(".audiolistselection option:selected").text();
if (selectedAudioFile == 'Kein Ton') {
selectedAudioFile = '';
}
if (priceA_Arr[0] && priceB_Arr[0] && priceC_Arr[0]) {
var priceA = priceA_Arr[1];
var priceB = priceB_Arr[1];
var priceC = priceC_Arr[1];
var avail_elem = prodContainerElem.find(".ui-controlgroup-controls");
var checkInput = avail_elem.find( "input:checked" );
var text = checkInput.val();
var avail = 0;
if (text == 'choice-yes') {
avail = 1;
}
var idOfProd = prodContainerElem.find("#id").val();
if (parseInt(idOfProd) < 0) {
// new product!
var prodContainerElem = $(this).closest(".prodtype");
var prodtypeId = prodContainerElem.data("prodtype");
createProduct(longname,shortname,priceA,priceB,priceC,avail,prodtypeId,selectedAudioFile);
} else {
applyProductChange(idOfProd,longname,shortname,priceA,priceB,priceC,avail,selectedAudioFile);
}
} else {
alert("Falsches Zahlenformat oder fehlender Eintrag!");
}
});
$(".cancelButton").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
// getDataOfSingleProd(12);
var prodContainerElem = $(this).closest(".ui-collapsible");
var idOfProd = prodContainerElem.find("#id").val();
var longname_elem = prodContainerElem.find("#longname");
var shortname_elem = prodContainerElem.find("#shortname");
var price_elemA = prodContainerElem.find("#priceA");
var price_elemB = prodContainerElem.find("#priceB");
var price_elemC = prodContainerElem.find("#priceC");
var avail_elem = prodContainerElem.find(".ui-controlgroup-controls");
var prodElem = resetDataOfSingleProd(idOfProd,longname_elem,shortname_elem,price_elemA,price_elemB,price_elemC,avail_elem,prodContainerElem);
});
$("#radio-pricelevel-a").off("click").on("click", function (e) {
setPriceLevel(1);
});
$("#radio-pricelevel-b").off("click").on("click", function (e) {
setPriceLevel(2);
});
$("#radio-pricelevel-c").off("click").on("click", function (e) {
setPriceLevel(3);
});
$(".applyTypeButton").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var formContainer = $(this).closest("form");
var idOfCat = (formContainer[0].id).split("_")[1];
// 1 = Food, 2=Drinks -> minus 1 give DB val
var kindVal = parseInt(formContainer.find("#" + idOfCat+"_kind").find( ":selected" ).val()) - 1;
// 1 = use, 2 = do not use
var useKitVal = parseInt(formContainer.find("#" + idOfCat+"_usekitchen").find( ":selected" ).val());
var useSupplyVal = parseInt(formContainer.find("#" + idOfCat+"_usesupply").find( ":selected" ).val());
// convert do DB val
if (useKitVal == 2) {
useKitVal = 0;
}
if (useSupplyVal == 2) {
useSupplyVal = 0;
}
var theNewName = formContainer.find("#" + idOfCat+"_name").val();
applyTypeChange(idOfCat,theNewName,kindVal,useKitVal,useSupplyVal);
location.reload();
});
$(".cancelTypeButton").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
location.reload();
//alert("Cancel Kategorie");
});
}
$(document).on("pageinit", "#info-page", function () {
initializeMainMenu("#modulemenu");
hideMenu();
getAudioFiles();
showDbProducts();
showPriceLevels();
binding();
});
</script>
<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">Module</li>
</ul>
</div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="theheader">
<h1>Angebot</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" id="Content">
<div id="pricelevelswitch"></div>
<div id="componentStructure"></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>
</body>
</html>

View File

@ -1,123 +0,0 @@
<html>
<head>
<title>Ansicht Statistik</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>
</head>
<body>
<script>
function getStats() {
doAjax("GET","php/contenthandler.php?module=reports&command=getStats",null,fillPageWithStats,"Statistikreportzs nicht erhalten");
}
function fillPageWithStats(jsonText) {
var htmlToday = fillOnePart("Heute",jsonText.today,"Uhrzeit",
"Diese Übersicht umfasst alle Kassenbons, die bisher heute gedruckt wurden.",
"center",10,10,80);
var htmlYesterday = fillOnePart("Gestern",jsonText.yesterday,"Uhrzeit",
"Diese Übersicht umfasst die gestrigen Einnahmen, die in Tageslosungen erfasst wurden.",
"center",10,10,80);
// thismonth
var htmlThisMonth = fillOnePart(jsonText.thismonthname,jsonText.thismonth,"Tag",
"Diese Übersicht umfasst alle Einnahmen dieses Monats, die in Tageslosungen erfasst sind. ",
"center",10,10,80);
var htmlLastMonth = fillOnePart(jsonText.lastmonthname,jsonText.lastmonth,"Tag",
"Diese Übersicht umfasst Einnahmen des letzten Monats.",
"center",10,10,80);
var htmlProds = fillOnePart("Produktstatistik",jsonText.prodsums,"Produkt",
"Diese Übersicht zeigt die Einnahmen, die mit den in den letzten 30 Tagen verkauften"
+ " Produkten erzielt wurden.",
"left",30,10,60);
$("#content").html(htmlToday + htmlYesterday + htmlThisMonth + htmlLastMonth + htmlProds);
$("#content").trigger("create");
}
function fillOnePart(aName,values,iterObjName,infoText,iterAlignment,width1,width2,width3) {
var collapse_elem = '<div data-role="collapsible" data-content-theme="e" data-collapsed="true" data-theme="c">';
var header = '<h3>'+aName + '</h3><p>' + infoText + '</p><p>';
var maxValue = values.max;
var content = "Es liegen keine Daten vor.";
if (maxValue != 0.0) {
var content = "<table width=100% class='reporttable'>";
content += aTableHeader(iterObjName,"Summe","Graph",width1,width2,width3);
var contentValues = values.content;
// fill content
$.each(contentValues, function (i, aStatValue) {
var hourOrDay = aStatValue.iter;
var sum = aStatValue.sum;
content += aTableLine(hourOrDay,sum.toString().replace(".",","),sum/maxValue*98.0,iterAlignment,
width1,width2,width3);
});
content += "</table>";
}
var html = collapse_elem + header + content + "</p></div>";
return html;
}
function aTableHeader(val1,val2,val3,width1,width2,width3) {
var text = "<tr><th width=" + width1 + "%>" + val1 + "<th width=" + width2 + "%>" + val2 + "<th width=" + width3 + "%>" + val3;
return text;
}
function aTableLine(val1,val2,porcent,iterAlignment,width1,width2,width3) {
var text = "<tr><td width=" + width1 + "% style='text-align:" + iterAlignment + ";'>" + val1 + "<td width=" + width2 + "% style='text-align:right;'>" + val2;
text += "<td width=" + width3 + "%><img src=img/green.png width=" + porcent + "% height=20px />";
return text;
}
$(document).on("pageinit", "#info-page", function () {
initializeMainMenu("#modulemenu");
hideMenu();
getStats();
});
</script>
<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">Module</li>
</ul>
</div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="theheader">
<h1>Statistik</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" id="content">
<h3>Kein Inhalt</h3>
</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>
</body>
</html>

View File

@ -1,101 +0,0 @@
function initializeMainMenu(menuid) {
$.ajax({ type: "GET",
dataType: "json",
url: "php/contenthandler.php?module=admin&command=getJsonMenuItemsAndVersion",
async: false,
success : function(moduleEntries)
{
$("#loggedinuser").html(moduleEntries.user);
$("#versioninfo").html("v" + moduleEntries.version);
var li='<li data-role="list-divider" data-theme="b" data-role="heading">Module</li>';
$.each(moduleEntries.menu, function (i, module) {
var name = module.name;
var link = module.link;
if (name != "Abmelden") {
li += '<li data-theme="e"><a href="' + link + '" target="_top" class="modulebutton">' + name + '</a></li>';
} else {
li += '<li data-theme="e"><a href="' + link + '" target="_top">' + name + '</a></li>';
}
});
$(menuid).empty().append(li).promise().done(function () {
$(menuid).listview("refresh");
})
},
error: function( text ) {
alert( "Kommunikationsproblem zum Server bei Modulabfrage!" );
}
});
$(".modulebutton").off("click").on("click", function (e) {
var view = $(this).attr("href");
doAjax("POST","php/contenthandler.php?module=admin&command=setLastModuleOfUser",
{ view: view}, null, "Problem Benutzerdatenpflege");
});
}
function hideMenu() {
$( "#modulepanel" ).panel( "close" );
$("#menuswitch").off("click").on("click", function (e) {
$("#menuswitch").trigger("mouseout");
e.stopImmediatePropagation();
e.preventDefault();
$( "#modulepanel" ).panel( "open" );;
});
}
// to make IE happy...
function refreshList(selector) {
if ( $(selector).hasClass('ui-listview')) {
$(selector).listview('refresh');
} else {
$(selector).trigger('create');
}
}
function doAjax(getOrPost,url,data,functionToCallIfSuccess,errorMsg) {
$.ajax({ type: getOrPost,
url: url,
dataType: "json",
data: data,
async: false,
success : function(jsonContent)
{
if (functionToCallIfSuccess != null) {
functionToCallIfSuccess(jsonContent);
}
},
error: function( text ) {
if (errorMsg != null) {
alert( "Kommunikationsfehler zum Server: " + errorMsg);
}
}
});
}
function doAjaxSuppressError(getOrPost,url,data,functionToCallIfSuccess,errorMsg) {
$.ajax({ type: getOrPost,
url: url,
dataType: "json",
data: data,
async: false,
success : function(jsonContent)
{
if (functionToCallIfSuccess != null) {
functionToCallIfSuccess(jsonContent);
}
},
error: function( text ) {
functionToCallIfSuccess("ERROR");
}
});
}
function doAjaxNonJsonNonCall(getOrPost,url,data) {
$.ajax({ type: getOrPost,
data : data,
url: url,
async: false,
error: function( text ) {
alert( "Kommunikationsproblem zum Server" );
}
});
}

View File

@ -1,945 +0,0 @@
<html>
<head>
<title>Ansicht Kellner</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>
</head>
<style>
@media screen
{
#workprintarea {display: none;}
}
@media print
{
#waiterui,#thefooter3,#header3,#info-page,#details-page,#modulemenu-room,#modulemenu-table,#modulemenu-prod {display: none;}
}
@media print
{
#workprintarea {width: 100%;};
}
</style>
<script>
function initializeMainMenu(menuid,user,version,forward) {
$.ajax({ type: "GET",
dataType: "json",
url: "php/contenthandler.php?module=admin&command=getJsonMenuItemsAndVersion",
async: false,
success : function(moduleEntries)
{
$("#" + user).html(moduleEntries.user);
$("#" + version).html("v" + moduleEntries.version);
var li='<li data-role="list-divider" data-theme="b" data-role="heading">Module</li>';
$.each(moduleEntries.menu, function (i, module) {
var name = module.name;
var link = module.link;
if (forward) {
li += '<li data-theme="e"><a class="modules" href="#" id="menu_' + link + '">' + name + '</a></li>';
} else {
li += '<li data-theme="e"><a href="' + link + '" target="_top">' + name + '</a></li>';
}
});
$(menuid).empty().append(li).promise().done(function () {
refreshList(menuid);
})
},
error: function( text ) { alert( "Sorry, Hauptmenue nicht erhalten!" );
}
});
}
function refreshList(selector) {
if ( $(selector).hasClass('ui-listview')) {
$(selector).listview('refresh');
} else {
$(selector).trigger('create');
}
}
function moduleForward(linkid) {
var neworders = $("#typprodpage").data("neworders");
if (neworders.length == 0) {
var linkParts = linkid.split("_");
window.location.href = linkParts[1];
} else {
alert("Es sind noch ungesendete Orders vorhanden!");
hideMenuProd();
}
}
function getPayPrintType() {
doJsonAjax("GET", "php/contenthandler.php?module=admin&command=getPayPrintType", null, insertPayPrintType, "Fehler Druckkonfiguration");
}
function insertPayPrintType(payPrintType) {
$("#workprintarea").data("payPrintType",payPrintType);
}
function getUserHasRightForPaydesk() {
doJsonAjax("GET", "php/contenthandler.php?module=admin&command=hasUserPaydeskRight", null, hasUserPaydeskRight, "Fehler Kassenberechtigung");
}
function hasUserPaydeskRight(userRight) {
$("#gopaydesk_btn").data("allowed",userRight);
}
function hideMenuRoom() {
$( "#modulepanel-room" ).panel( "close" );
$("#menuswitchroom").off("click").on("click", function (e) {
$("#menuswitch").trigger("mouseout");
e.stopImmediatePropagation();
e.preventDefault();
$( "#modulepanel-room" ).panel( "open" );;
});
}
function hideMenuTable() {
$( "#modulepanel-table" ).panel( "close" );
$("#menuswitchtable").off("click").on("click", function (e) {
$("#menuswitch").trigger("mouseout");
e.stopImmediatePropagation();
e.preventDefault();
$( "#modulepanel-table" ).panel( "open" );;
});
}
function hideMenuProd() {
$( "#modulepanel-prod" ).panel( "close" );
$("#menuswitchprod").off("click").on("click", function (e) {
$("#menuswitch").trigger("mouseout");
e.stopImmediatePropagation();
e.preventDefault();
$( "#modulepanel-prod" ).panel( "open" );;
});
}
function addProductToQueue(tableid,productid) {
var option=$('#optionfield').val();
$('#optionfield').val("");
var entry = [productid,option];
var neworders = $("#typprodpage").data("neworders");
neworders[neworders.length] = entry;
$("#typprodpage").data("neworders",neworders);
updateNewOrdersList();
}
function updateNewOrdersList() {
var i=0;
var neworders = $("#typprodpage").data("neworders");
if (neworders.length == 0) {
$('#changetable_btn').closest('.ui-btn').show();
$('#sendorder_btn').closest('.ui-btn').hide();
} else {
$('#changetable_btn').closest('.ui-btn').hide();
$('#sendorder_btn').closest('.ui-btn').show();
}
var li = "<li data-role=\"list-divider\" data-theme=\"b\" data-role=\"heading\">Neue Order</li>";
for (i=0;i<neworders.length;i++) {
var entry = neworders[i];
var lname = getProdName(entry[0]);
var optiontext = "";
if (entry[1] != '') {
optiontext = "&nbsp;<i>(" + entry[1] + ")</i>";
}
li += '<li data-theme="c" data-icon="arrow-d"><a href="#" id="new_' + entry[0] + '" class="neworder_el">' + lname + optiontext + '</a></li>';
}
$("#neworders").html(li);
refreshList("#neworders");
binding_neworderelem();
}
function binding_neworderelem() {
$(".neworder_el").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var index = $("#neworders li").index($(this).closest("li")) - 1;
var neworders = $("#typprodpage").data("neworders");
neworders.splice(index, 1);
$("#typprodpage").data("neworders",neworders);
updateNewOrdersList();
});
}
function sendNewOrders(fct) {
var roominfo = $("#typprodpage").data("table-info");
var tableid = roominfo[1];
var neworders = $("#typprodpage").data("neworders");
if (neworders.length != 0) {
var data = {
tableid: tableid,
prods: neworders
}
$("#typprodpage").data("neworders",[]);
doJsonAjax("POST","php/contenthandler.php?module=queue&command=addProductListToQueue",data,fct,"Fehler bei Produktversand");
} else {
fct();
}
}
function reloadPage() {
window.location.href = "waiter.html";
}
// removeProductFromQueue
function removeProductFromQueue(queueid) {
$.ajax({ type: "POST",
url: "php/contenthandler.php?module=queue&command=removeProductFromQueue",
data : { queueid: queueid },
async: false,
success : function(text) {},
error: function( text ) {
alert( "Sorry, Fehler bei Produktentfernung!" );
}
});
}
//pageinit event for first page
//triggers only once
//write all your on-load functions and event handlers pertaining to page1
$(document).on("pageinit", "#info-page", function () {
initializeMainMenu("#modulemenu-room","loggedinuser1","versioninfo1",false);
initializeMainMenu("#modulemenu-table","loggedinuser2","versioninfo2",false);
initializeMainMenu("#modulemenu-prod","loggedinuser3","versioninfo3",true);
$(".modules").off("click").on("click", function (e) {
$("#menuswitch").trigger("mouseout");
e.stopImmediatePropagation();
e.preventDefault();
moduleForward(this.id);
});
hideMenuRoom();
$.getJSON("php/contenthandler.php?module=roomtables&command=showAllRooms",function(roomtableinfo) {
$("#details-page").data("allroomtables",roomtableinfo);
var noOfRooms = roomtableinfo.length;
var allRooms = roomtableinfo; // default: rooms
if (noOfRooms == 1) {
allRooms = roomtableinfo[0]["tables"];
$("#info-page").data("type","t");
$("#roomtableheader").html("Tische");
} else {
$("#info-page").data("type","r");
$("#roomtableheader").html("Räume");
}
var li = "";
//container for $li to be added
$.each(allRooms, function (i, name) {
//store index value in array as id of the <a> tag
li += '<li data-theme="f"><a href="#" id="' + i + '" class="info-go">' + name.name + '</a></li>';
});
//append list to ul
$("#room-list").append(li).promise().done(function () {
//wait for append to finish - thats why you use a promise()
//done() will run after append is done
//add the click event for the redirection to happen to #details-page
$(this).off("click").on("click", "a", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
//store the information in the next page's data
// this.id = html-Zeile des Eintrags = ID-1 des Raumes)))
// roomtableinfo[this.id]["name"] = "Drinnen" z.B.
if ($("#info-page").data("type") == "t") {
var tableid = allRooms[this.id]["id"];
var tablename = allRooms[this.id]["name"];
var roomtable_array= new Array(-1,tableid,tablename);
$("#typprodpage").data("table-info", roomtable_array);
$("#typprodpage").data("neworders",[]);
$.mobile.changePage("#typprodpage");
} else {
var roomdetail = allRooms[this.id];
$("#details-page").data("roomdetail", roomdetail);
$.mobile.changePage("#details-page");
}
});
//refresh list to enhance its styling.
refreshList(this);
});
});
}
);
// Now we prepare the second page (tables) for display
$(document).on("pagebeforeshow", "#details-page", function () {
hideMenuTable();
//get from data - you put this here when the "a" wa clicked in the previous page
var roomdetail = $(this).data("roomdetail");
var tables = roomdetail["tables"];
var li = '<li data-role=\"list-divider\" data-theme=\"b\" data-role=\"heading\">Tische</li>'; // init
$.each(tables, function( index, value ) {
li += '<li data-theme="e"><a href="#" id="' + index + '" class="info-go">' + value["name"] + '</a></li>';
});
//append list to ul
$("#tables-list").empty().append(li).promise().done(function () {
$(this).off("click").on("click", ".info-go", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
// this.id = Nummer des Eintrags in der Liste der Tische (d.h. 8. Eintrag könnte Tisch 10 sein)
var roomid = roomdetail["id"]; // hier ist roomdetail das alte, nicht das von oben!!!
var tableid = tables[this.id]["id"];
var tablename = tables[this.id]["name"];
var roomtable_array= new Array(roomid,tableid,tablename);
$("#typprodpage").data("table-info", roomtable_array); // das passt hier noch nicht!
$("#typprodpage").data("neworders",[]);
$.mobile.changePage("#typprodpage");
});
//refresh list to enhance its styling.
refreshList(this);
});
});
function createHtmlListOfEntries(entries) {
var li = "<li data-role=\"list-divider\" data-theme=\"b\" data-role=\"heading\">Auswahl</li>";
$.each(entries, function (i, name) {
if (entries[i]["type"] == "t") {
li += '<li data-theme="d"><a href="#" id="' + i + '">' + name.name + '</a></li>';
} else {
li += '<li data-theme="c" data-icon="plus"><a href="#" id="' + i + '">' + name.name + '</a></li>';
}
});
return li;
}
function attachAndDisplayFirstRefTypes(jsonTypesAndProds) {
$("#typprodpage").data("types_prods",jsonTypesAndProds);
displayTypesProds(0);
}
function listOfTypesProds(ref) {
var li = "<li data-role=\"list-divider\" data-theme=\"b\" data-role=\"heading\">Auswahl</li>";
var prodtypes = $("#typprodpage").data("types_prods");
$.each(prodtypes.types,function(i,aType) {
if (parseInt(aType.ref) == ref) {
li += '<li data-theme="d"><a href="#" id="t_' + aType.id + '">' + aType.name + '</a></li>';
}
});
$.each(prodtypes.prods,function(i,aProd) {
if (parseInt(aProd.ref) == ref) {
li += '<li data-theme="c" data-icon="plus"><a href="#" id="p_' + aProd.id + '">' + aProd.name + '</a></li>';
}
});
if (ref != 0) {
li += '<li data-theme="f" data-icon="back"><a href="#" id="t_0"><i>Anderes Produkt</i></a></li>';
}
return li;
}
function getProdEntry(prodid) {
var prodtypes = $("#typprodpage").data("types_prods");
var i=0;
var allprods = prodtypes.prods;
for (i=0;i<allprods.length;i++) {
var aProd = allprods[i];
if (parseInt(aProd.id) == prodid) {
return aProd;
}
}
return null;
}
function getProdAudio(prodid) {
var aProd = getProdEntry(prodid);
if (aProd != null) {
return aProd.audio;
} else {
return "";
}
}
function getProdName(prodid) {
var aProd = getProdEntry(prodid);
if (aProd != null) {
return aProd.longname;
} else {
return "FEHLER!";
}
}
function displayTypesProds(ref) {
var li = listOfTypesProds(parseInt(ref));
$("#typeproducts-list").empty().append(li).promise().done(function () {
refreshList("#typeproducts-list");
$(this).off("click").on("click", "a", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var theId = this.id;
var idParts = theId.split("_");
if (idParts[0] == 't') {
displayTypesProds(idParts[1]);
} else {
// Product was selected:
// 1. add the product to the table
// 2. go back in the prodtypes at the beginning
var prodid = idParts[1];
var roominfo = $("#typprodpage").data("table-info");
var tableid = roominfo[1];
addProductToQueue(tableid,prodid);
var audioFile = getProdAudio(parseInt(prodid));
if (audioFile != "") {
// play sound!
var audioUrl = "customer/" + audioFile;
if (audioFile.match(/mp3$/)) {
$("#audiofile").html('<source src=' + audioUrl + ' type="audio/mpeg" />');
} else if (audioFile.match(/ogg$/)) {
$("#audiofile").html('<source src=' + audioUrl + ' type="audio/ogg" />');
} else if (audioFile.match(/wav$/)) {
$("#audiofile").html('<source src=' + audioUrl + ' type="audio/wav" />');
}
var vol = parseInt($("#typprodpage").data("ordervolume")) / 10.0;
document.getElementById('audiofile').volume=vol;
document.getElementById('audiofile').load();
document.getElementById('audiofile').play();
}
var urlProdOfTableNotDelivered = "php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&"
+ "tableid=" + tableid;
var prodListToFill = "#orderedprod-list-0";
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
displayTypesProds(0);
refreshList("#typeproducts-list");
}
});
});
}
function fillTypeProdList(ref) {
if (ref == 0) {
// initial call -> retrieve all prods and types
doJsonAjax("GET","php/contenthandler.php?module=products&command=getAllTypesAndAvailProds",null,attachAndDisplayFirstRefTypes,"Produktkatalog nicht abrufbar");
} else {
displayTypesProds(ref);
}
return;
}
function fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill) {
$.getJSON(urlProdOfTableNotDelivered,function(prodOfTable) {
var li = "<li data-role=\"list-divider\" data-theme=\"b\" data-role=\"heading\">Küche/Bar</li>";
$.each(prodOfTable, function (i, name) {
var optiontext = "";
if (name.option != '') {
optiontext = "&nbsp;(" + name.option + ")";
}
if (name.isready == '0') {
li += '<li data-theme="c" data-icon="delete" class="notdelprod"><a href="#" id="' + i + '">' + name.longname + optiontext + '</a></li>';
} else {
li += '<li data-theme="f" data-icon="delete" class="notdelprod"><a href="#" id="' + i + '">' + name.longname + optiontext + '</a></li>';
}
});
$(prodListToFill).empty().append(li).promise().done(function () {
// now set as data the queueid
var index=0;
$(".notdelprod").each(function() {
$(this).data("queueid",prodOfTable[index].queueid);
index++;
});
$(this).off("click").on("click", "a", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
//alert ("Remove: id=" + prodOfTable[this.id]["queueid"]); // this.id=Zeile (0..ende)
var isReady = prodOfTable[this.id]["isready"];
var isPaid = prodOfTable[this.id]["isPaid"];
if ((isPaid == "1") && (isReady=="1")) {
var dialogText = "Produkt wurde schon zubereitet und bezahlt";
var this_elem = this;
areYouSure("Entfernen?", dialogText, "Ja", function() {
removeProductFromQueue(prodOfTable[this_elem.id]["queueid"]);
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
});
} else if (isReady=="1") {
var dialogText = "Produkt wurde schon zubereitet.";
var this_elem = this;
areYouSure("Entfernen?", dialogText, "Ja", function() {
removeProductFromQueue(prodOfTable[this_elem.id]["queueid"]);
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
});
} else if (isPaid == "1") {
var dialogText = "Produkt wurde schon bezahlt.";
var this_elem = this;
areYouSure("Entfernen?", dialogText, "Ja", function() {
removeProductFromQueue(prodOfTable[this_elem.id]["queueid"]);
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
});
} else {
removeProductFromQueue(prodOfTable[this.id]["queueid"]);
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
}
});
$(this).off("swipe").on("swipe", "a", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
//alert ("Remove: id=" + prodOfTable[this.id]["queueid"]); // this.id=Zeile (0..ende)
removeProductFromQueue(prodOfTable[this.id]["queueid"]);
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
});
refreshList(this);
});
}); // ende json call
}
function fillOrderVolume(volume) {
$("#typprodpage").data("ordervolume",volume);
}
//Now we prepare the product page (level 0) for display
$(document).on("pagebeforeshow", "#typprodpage", function () {
hideMenuProd();
getPayPrintType();
doJsonAjax("GET","php/contenthandler.php?module=admin&command=getOrderVolume",null,fillOrderVolume,"Keine Ordertoninformation");
$("#workprintarea").html("");
//get from data - you put this here when the "a" wa clicked in the previous page
var roomtable_info = $(this).data("table-info");
var roomid = roomtable_info[0];
var tableid = roomtable_info[1];
$("#changetablewhatdialog").data("fromtableid",tableid);
var tablename = roomtable_info[2];
$("#typprodpage h1").html("Tisch: " + tablename);
$("#optionfield").val(""); // clear option field
fillTypeProdList(0);
// now the products that are assigned to table but yet not delivered
var urlProdOfTableNotDelivered = "php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&"
+ "tableid=" + tableid;
var prodListToFill = "#orderedprod-list-0";
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
$("#workprint_btn").data("tableid",tableid);
$("#gopaydesk_btn").data("tableid",tableid);
$("#workprint_btn").data("tablename",tablename);
bindPrintButton();
bindGoPayDeskButton();
bindChangetableButton();
bindSendNewOrdersButton();
// "Paydesk-button" enable/disable
getUserHasRightForPaydesk();
updateNewOrdersList();
});
function bindSendNewOrdersButton() {
$("#sendorder_btn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
sendNewOrders(reloadPage);
});
}
function bindPrintButton() {
$("#workprint_btn").off("click").on("click", function (e) {
$("#workprint_btn").trigger("mouseout");
e.stopImmediatePropagation();
e.preventDefault();
sendNewOrders(printTheWorkItems);
});
}
function printTheWorkItems() {
doJsonAjax("GET","php/contenthandler.php?module=queue&command=getNotPrintedWorkItemsAndDeclareThemPrinted",
{tableid : $("#workprint_btn").data("tableid") }, fillPrintAreaAndPrint, "Druckfehler");
}
function bindGoPayDeskButton() {
$("#gopaydesk_btn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
sendNewOrders(goToPayDesk);
});
}
function goToPayDesk() {
var userRight = $("#gopaydesk_btn").data("allowed");
if (userRight.toLowerCase() == "yes") {
window.location.href = "paydesk.html?t=" + $("#gopaydesk_btn").data("tableid");
} else {
alert("Fehlendes Benutzerrecht für Kasse");
}
}
function createRoomOrTableList(roomtableinfo,titel) {
var li = '<li data-role="list-divider" data-theme="b" data-role="heading">' + titel + '</li>';
$.each(roomtableinfo, function (i, name) {
li += '<li data-theme="f"><a href="#" id="r_' + i + '" class="info-go">' + name.name + '</a></li>';
});
return li;
}
function displayTableDialog(tableinfo,initialChange) {
$("#header_tchange").html("Tischauswahl");
var li = createRoomOrTableList(tableinfo,"Tische");
$("#roomOrTableList").empty().append(li).promise().done(function () {
if (initialChange) {
$.mobile.changePage("#tablechangedialog");
}
refreshList("#roomOrTableList");
$(this).off("click").on("click", ".info-go", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var table = ($(this).attr("id")).split("_")[1];
$("#changetablewhatdialog").data("totableid",tableinfo[table].id);
$.mobile.changePage("#changetablewhatdialog");
});
});
}
function moveOrderItemsFromTables(alsoNotPayedItems) {
var fromTableId = $("#changetablewhatdialog").data("fromtableid");
var toTableId = $("#changetablewhatdialog").data("totableid");
var notDelProd = [];
$(".notdelprod").each(function() {
var el = $(this);
var queueid = $(this).data("queueid");
notDelProd[notDelProd.length] = queueid;
});
var data = {
fromTableId:fromTableId,
toTableId:toTableId,
alsoNotPayed:(alsoNotPayedItems ? 1 : 0),
queueids:notDelProd
};
doJsonAjax("POST", "php/contenthandler.php?module=queue&command=changeTable", data, resultOfChangeTable, "Fehler Tischwechsel");
}
function moveNotDeliveredItems() {
moveOrderItemsFromTables(false);
}
function moveNotPayedAndNotDeliveredItems() {
moveOrderItemsFromTables(true);
}
function resultOfChangeTable(jsonResult) {
if (jsonResult.status != "OK") {
alert("Fehler " + jsonResult.code + ": " + jsonResult.msg + "\n\nMöglicherweise hat ein Kollege\nin der Zwischenzeit Produkte zugestellt.");
} else {
alert("Tischwechsel durchgeführt!");
}
window.location.href = "waiter.html";
}
function bindChangetableButton() {
$("#changetable_btn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var allRoomTables = $("#details-page").data("allroomtables");
var noOfRooms = allRoomTables.length;
if (noOfRooms == 1) {
displayTableDialog(allRoomTables[0].tables,true);
} else {
$("#header_tchange").html("Raumauswahl");
var li = createRoomOrTableList(allRoomTables,"Räume");
$("#roomOrTableList").empty().append(li).promise().done(function () {
$.mobile.changePage("#tablechangedialog");
refreshList("#roomOrTableList");
$(this).off("click").on("click", ".info-go", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var roomid = ($(this).attr("id")).split("_")[1];
displayTableDialog(allRoomTables[roomid].tables,false);
});
});
}
});
$("#move_not_del_items").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
moveNotDeliveredItems();
});
$("#move_notDel_notPayed_items").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
moveNotPayedAndNotDeliveredItems();
});
}
function createHtmlOfKind(workItems,kind) {
var text = "";
$.each(workItems, function (i, item) {
var kindOfItem = item.kind;
var longname = item.longname;
var option = item.option;
if (kind == kindOfItem) {
text += longname + "<br><i>" + option + "</i><br><br>";
}
});
return text;
}
function arrayContainsKind(workItems,kind) {
var result = false;
for (var i=0; i < workItems.length; i++) {
var item = workItems[i];
var kindOfItem = item.kind;
if (kind == kindOfItem) {
result= true;
}
}
return result;
}
function fillPrintAreaAndPrint(jsonContent) {
updateNotDeliveredList();
var currentTime = new Date();
var hours = currentTime.getHours();
var minutes = currentTime.getMinutes();
var timeStamp = "<i>Erstellung: " + hours + ":" + minutes + "</i>";
if (jsonContent.status == "OK") {
var printdata = jsonContent.msg;
var result = arrayContainsKind(printdata,0);
var payPrintType = $("#workprintarea").data("payPrintType");
var totalHtml = "";
if (arrayContainsKind(printdata,0)) {
var foodHeaderLine = "<h1>Speisen für " + $("#workprint_btn").data("tablename") + "</h1><br>";
var foodText = foodHeaderLine + "<br>" + timeStamp + "<br><br>" + createHtmlOfKind(printdata,0) + "<br><br>";
if (payPrintType == 's') {
printJob(foodText,1);
} else {
totalHtml = foodText;
}
}
if (arrayContainsKind(printdata,1)) {
var drinkHeaderLine = "<h1>Getränke für " + $("#workprint_btn").data("tablename") + "</h1><br>";
var drinkText = drinkHeaderLine + "<br>" + timeStamp + "<br><br>" + createHtmlOfKind(printdata,1) + "<br><br>";
if (payPrintType == 's') {
printJob(drinkText,2);
} else {
totalHtml += "<br>" + drinkText;
}
}
if (payPrintType == 'l') {
$("#workprintarea").html(totalHtml);
window.print();
}
updateNewOrdersList();
} else {
alert ("Druckdaten konnten nicht angefordert werden");
}
}
function printJob(htmlText, theType) {
doJsonAjax("POST","php/contenthandler.php?module=printqueue&command=queuePrintJob",
{content : htmlText, type: theType }, null, "Druckfehler");
}
function updateNotDeliveredList() {
var roomtable_info = $("#typprodpage").data("table-info");
var tableid = roomtable_info[1];
var urlProdOfTableNotDelivered = "php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&"
+ "tableid=" + tableid;
var prodListToFill = "#orderedprod-list-0";
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
}
function doJsonAjax(getOrPost,url,data,functionToCallIfSuccess,errorMsg) {
$.ajax({ type: getOrPost,
url: url,
dataType: "json",
data: data,
async: false,
success : function(jsonContent)
{
if (functionToCallIfSuccess != null) {
functionToCallIfSuccess(jsonContent);
}
},
error: function( text ) {
alert( "Kommunikationsfehler zum Server: " + errorMsg);
}
});
}
function areYouSure(text1, text2, button, callback) {
$("#sure .sure-1").text(text1);
$("#sure .sure-2").text(text2);
$("#sure .sure-do").text(button).on("click.sure", function() {
callback();
$(this).off("click.sure");
});
$.mobile.changePage("#sure");
}
</script>
<!--first page -->
<div data-role="page" id="info-page">
<div data-role="panel" id="modulepanel-room" data-position="right" data-display="overlay">
<ul data-role="listview" id="modulemenu-room" 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">
<h1>Raum-Tisch</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="menuswitchroom">Module</a>
</div>
</div>
<div data-role="content">
<ul data-role="listview" id="room-list" data-divider-theme="a" data-inset="true">
<li data-role="list-divider" data-theme="b" data-role="heading" id=roomtableheader>Räume</li>
</ul>
</div>
<div data-role="footer" data-theme="b" id="thefooter1">
<div class="ui-grid-a">
<div class="ui-block-a userinfo" id="loggedinuser1"></div>
<div class="ui-block-b grid_right" id="versioninfo1"></div>
</div><!-- /grid-a -->
</div>
</div>
<!--second page -->
<div data-role="page" id="details-page">
<div data-role="panel" id="modulepanel-table" data-position="right" data-display="overlay">
<ul data-role="listview" id="modulemenu-table" 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"><a href="#" data-rel="back" data-role="button" data-icon="arrow-l">&nbsp;</a>
<h1>Tischauswahl</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="menuswitchtable">Module</a>
</div>
</div>
<div data-role="content">
<ul data-role="listview" id="tables-list" data-divider-theme="a" data-inset="true">
<li data-role="list-divider" data-theme="b" data-role="heading">Tische</li>
</ul>
</div>
<div data-role="footer" data-theme="b" id="thefooter2">
<div class="ui-grid-a">
<div class="ui-block-a userinfo" id="loggedinuser2"></div>
<div class="ui-block-b grid_right" id="versioninfo2"></div>
</div><!-- /grid-a -->
</div>
</div>
<!--third page (types and products)-->
<div data-role="page" id="typprodpage">
<audio id=audiofile>
<source src="customer/ding.wav" type="audio/wav" />
</audio>
<div data-role="panel" id="modulepanel-prod" data-position="right" data-display="overlay">
<ul data-role="listview" id="modulemenu-prod" data-divider-theme="a" data-inset="true">
<li data-role="list-divider" data-theme="b" data-role="heading">Module</li>
</ul>
</div><!-- /panel -->
<div id='header3' data-role="header" data-theme="b" data-position="fixed"><a href="#" data-rel="back" data-role="button" data-icon="arrow-l">&nbsp;</a>
<h1>Produktauswahl</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="menuswitchprod">Module</a>
</div>
</div>
<div data-role="content" class="print" id="waiterui">
<ul data-role="listview" id="typeproducts-list" data-divider-theme="a" data-inset="true">
<li data-role="list-divider" data-theme="b" data-role="heading">Auswahl</li>
</ul>
<input type="text" id="optionfield" value="" data-mini="true" placeholder="Bemerkung" />
<input type="button" id="sendorder_btn" value="Bestellung senden" data-mini="true" data-theme="e" />
<input type="button" id="workprint_btn" value="Arbeitsbon" data-mini="true" data-theme="e" />
<input type="button" id="gopaydesk_btn" value="-> Kasse" data-mini="true" data-theme="e" />
<input type="button" id="changetable_btn" value="Tischwechsel" data-mini="true" data-theme="e" />
<ul data-role="listview" id="neworders" data-divider-theme="b" data-inset="true">
<li data-role="list-divider" data-theme="b" data-role="heading">Neue Produkte</li>
</ul>
<ul data-role="listview" id="orderedprod-list-0" data-divider-theme="e" data-inset="true">
<li data-role="list-divider" data-theme="d" data-role="heading">Küche/Bar</li>
</ul>
</div>
<div id=workprintarea class="print"></div>
<div data-role="footer" data-theme="b" id="thefooter3">
<div class="ui-grid-a">
<div class="ui-block-a userinfo" id="loggedinuser3"></div>
<div class="ui-block-b grid_right" id="versioninfo3"></div>
</div><!-- /grid-a -->
</div>
</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>
<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>
</div>
</div>
<!-- Dialog page -->
<div data-role="dialog" id="tablechangedialog" data-title="Tischwechsel">
<div data-role="content">
<h3 class="sure-1" id="header_tchange">?</h3>
<p class="roomtabletitel">
<div data-role="content">
<ul data-role="listview" id="roomOrTableList" data-divider-theme="a" data-inset="true">
</ul>
</div>
</p>
<a href="#" data-role="button" data-theme="c" data-rel="back">Abbrechen</a>
</div>
</div> <!-- tablechangedialog -->
<div data-role="dialog" id="changetablewhatdialog" data-title="Tischwechsel">
<div data-role="content">
<h3 class="sure-1">Auswahl der Orderelemente</h3>
<p class="roomtabletitel">Welche Orderelemente sollen dem neuen Tisch zugewiesen werden?
<div data-role="content">
<a href="#" data-role="button" data-theme="f" data-rel="back" id="move_not_del_items">nicht zugestellte</a>
<a href="#" data-role="button" data-theme="f" data-rel="back" id="move_notDel_notPayed_items">nicht zugestellte, nicht bezahlte</a>
</div>
</p>
<a href="#" data-role="button" data-theme="c" data-rel="back">Zurück</a>
</div>
</div> <!-- changetablewhatdialog -->
</body>
</html>

Binary file not shown.

View File

@ -2,7 +2,7 @@
<head>
<title>Ansicht Bar</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css">
@ -52,12 +52,17 @@
<script>
var lang = 0;
function setLanguage(language) {
lang = language;
}
// refreshing the content
$(document).ready(function() {
var refreshId = setInterval(function() {
getAndDisplayAllEntries();
}, 10000);
}, 5000);
$.ajaxSetup({ cache: false });
});
@ -83,12 +88,16 @@ function hideElementsForNonBarUser(jsonAnswer) {
//triggers only once
//write all your on-load functions and event handlers pertaining to page1
$(document).on("pageinit", "#bar-page", function () {
initializeMainMenu("#modulemenu");
hideMenu();
doAjax("GET","php/contenthandler.php?module=admin&command=isLoggedinUserBar",null,hideElementsForNonBarUser,"Fehler");
getAndDisplayAllEntries();
var urlsuffix = location.search;
setWorkMode(urlsuffix);
getGeneralConfigItems();
});
function initializeEverything() {
hideMenu();
doAjax("GET","php/contenthandler.php?module=admin&command=isLoggedinUserBar",null,hideElementsForNonBarUser,"Fehler");
}
</script>
<!--first page -->
@ -98,7 +107,7 @@ $(document).on("pageinit", "#bar-page", function () {
<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">
<div data-role="header" data-theme="b" data-position="fixed" id="headerline">
<h1>Bar</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>
@ -106,15 +115,15 @@ $(document).on("pageinit", "#bar-page", function () {
</div>
<div data-role="content" id="allpagecontent">
<div id=listWithEntriesToCook></div>
<hr>
<hr id="hrline">
<div id=listWithCookedEntries></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-a userinfo"><span id="loggedinuser"></span></div>
<div class="ui-block-b grid_right" id="versioninfo"></div>
</div><!-- /grid-a -->
</div> <!-- footer -->
</div>
</body>
</html>

396
webapp/bill.html Normal file
View File

@ -0,0 +1,396 @@
<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">
<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" />
<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-2.0.3.min.js"></script>
<script src="php/3rdparty/jquery.mobile-1.4.0.min.js"></script>
<script src="utilities.js"></script>
<script src="receiptutils.js"></script>
<link rel="stylesheet" href="php/3rdparty/jqueryui1-11-2/jquery-ui.min.css" />
<script src="php/3rdparty/jqueryui1-11-2/jquery-ui.min.js"></script>
<script src="php/3rdparty/jqueryui1-11-2/jquery-ui-i18n.min.js"></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_CLOSED = ["abgeschlossen","closed","cerrado"];
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_QUEST_TEXT = ["Bon stornieren?","Cancel the receipt?","Contrapartida del tique"];
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 lang = 0;
var when = 0;
var decpoint = ".";
// REM* contains the bill information from server
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]);
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 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) {
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") {
$("#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] + " &lt;" + tablename + "&gt; " + brutto + ' ' + currency + '</h3>';
if (entry.isClosed == 1) {
header = '<h3>'+shortdate + ": " + BILL_TABLE[lang] + " &lt;" + tablename + "&gt; " + 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);
// REM* insert now the bill into collapsible_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;
$("#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);
}
$("#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];
areYouSure(BILL_STORNO_QUEST_TITLE[lang], BILL_STORNO_QUEST_TEXT[lang], BILL_YES[lang], function() {
doAjaxCancelBill(billid,$("#stornocode").val());
});
});
});
}
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);
var printbuttonid = 'print_' + id;
var cancelbuttonid = 'cancel_' + id;
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 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) {
// REM* bill is not closed - so can be printed AND cancelled
txt += cancelButton + '<br>' + content + '</center>';
} else {
// REM* bill is closed - only printing possible, no cancelling
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 }, 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");
}
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();
bindWhenSelection();
} 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();
});
</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><span id="billtitletxt">Kassenbons</span></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=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><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="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" data-rel="back"><span id="stornono">Nein</span></a>
</form>
</div>
</div>
</body>
</html>

View File

@ -48,8 +48,6 @@ table.viewtable tr:hover td {
}
table.receipttable td {
border: solid black 0px;
padding: 3px;
@ -300,4 +298,258 @@ table.billtable #totalprice {
.userinfo {
font-style: italic;
}
.counting {
position: absolute;
top: 0px; bottom: 0px; right: 90px;
width: 80px;
border: 0;
background-color: rgb(246, 246, 246, 0.0) !important;
}
.counting:hover {
background-color: rgb(0,255,0);
}
.goup {
position: absolute;
top: 5px; bottom: 0px; right: 90px;
border: 0;
background-color: rgb(246, 246, 246) !important;
}
.osroom-1 {
height: 40px !important;
}
.osroom-2 {
height: 70px !important;
}
.ostable-1 {
height: 40px !important;
}
.ostable-2 {
height: 70px !important;
}
.osprod-1 {
height: 40px !important;
}
.osprod-2 {
height: 70px !important;
}
.osbigbtn.ui-btn {
height: 40px !important;
text-align: center;
line-height:30px;
}
table.prodtable {
font-family: verdana,arial,sans-serif;
font-size:20px;
color:#333333;
border-width: 1px;
border-color: #666666;
border-collapse: collapse;
width: 70%;
}
table.prodtable th {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: OrangeRed;
font-weight:bold;
}
table.prodtable .prodtype td{
background-color: DarkGreen;
}
table.prodtable tr > td:first-child {
text-align:left;
}
table.prodtable td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: LimeGreen;
text-align:right;
font-weight:bold;
white-space:nowrap;
max-width:50%;
word-break:break-all;
}
table.prodtable input {
line-height:30px;
background-color: PaleGreen;
font-weight:bold;
}
table.prodtable select {
background-color: PaleGreen;
font-weight:bold;
width: 100%;
}
table.prodtable option.yes {
background-color: green;
}
table.prodtable option.no {
background-color: red;
}
table.prodtable .prodpriceA {
width: 50px;
text-align: right;
}
table.prodtable .prodpriceB {
width: 50px;
text-align: right;
}
table.prodtable .prodpriceC {
width: 50px;
text-align: right;
}
.prodinfo,.srinfo {
position: absolute;
top: 0px; bottom: 0px; right: 20px;
width: 20px;
border: 0;
background-color: rgb(246, 246, 246, 0.0) !important;
}
.waitinfo {
position: absolute;
top: 0px; bottom: 0px; right: 20px;
border: 0;
background-color: rgb(246, 246, 246, 0.0) !important;
}
.waitinfo img {
position: absolute;
top: 0px; bottom: 0px; right: 20px;
height: 35px;
border: 0;
background-color: rgb(246, 246, 246, 0.0) !important;
}
.typehigher {
position: absolute;
top: 0px; bottom: 0px; right: 40px;
border: 0;
background-color: rgb(246, 246, 246, 0.0) !important;
}
.typetop {
position: absolute;
top: 0px; bottom: 0px; left: 40px;
border: 0;
background-color: rgb(246, 246, 246, 0.0) !important;
}
.prodminus,.srminus {
position: absolute;
top: 0px; bottom: 0px; right: 130px;
width: 20px;
border: 0;
background-color: rgb(246, 246, 246, 0.0) !important;
}
.prodcount,.srprodcount {
position: absolute;
top: 10px; bottom: 0px; right: 95px;
width: 20px;
border: 0;
background-color: rgb(246, 246, 246, 0.0) !important;
}
.prodplus,.srplus {
position: absolute;
top: 0px; bottom: 0px; right: 60px;
height: 20px;
border: 0;
background-color: rgb(246, 246, 246, 0.0) !important;
}
.prodplus img {
width: 30px;
}
.prodminus img {
width: 30px;
}
.srplus img {
width: 30px;
}
.srminus img {
width: 30px;
}
.srminus:hover, .prodminus:hover{
height: 40px;
width: 30px;
background-color: rgb(0, 255, 0);
}
.srplus:hover, .prodplus:hover{
height: 40px;
width: 30px;
background-color: rgb(0, 255, 0);
}
.prodinfo img:hover,.srinfo img:hover {
background-color: rgb(0, 255, 0);
}
.tbusy {
color:black !important;
font-weight:bold;
font-style: italic;
}
.tempty {
color:gray !important;
color:gray !important;
font-weight:normal;
}
.overlaytxt {
background: linear-gradient(red, yellow);
color: black; font-weight: bold;
border-radius: 25px;
border: 3px solid #000000;
padding: 8px;
}
.overlayfull {
background: linear-gradient(red, yellow);
}
.overlayempty {
background: linear-gradient(green, yellow);
}
.overlaysize-0 {
font-size: 7px;
}
.overlaysize-1 {
font-size: 12px;
}
.overlaysize-2 {
font-size: 15px;
}
.prodreadyicon {
position: absolute;
top: 0px; bottom: 0px; right: 70px;
height: 20px;
border: 0;
background-color: rgb(246, 246, 246, 0.0) !important;
}
.prodreadyicon:hover {
height: 40px;
background-color: rgb(0, 255, 0);
}
.prodreadycount {
position: absolute;
top: 10px; bottom: 0px; right: 40px;
width: 20px;
border: 0;
background-color: rgb(246, 246, 246, 0.0) !important;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 KiB

BIN
webapp/customer/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

56
webapp/customer/menulegend.txt Executable file
View File

@ -0,0 +1,56 @@
# ***** Diese Speisekarte hat ein bestimmtes Format. ****
# ***** Das Format, insbesondere die Einrückungen, müssen ****
# ***** genau eingehalten werden, damit der Inhalt korrekt ****
# ***** übernommen werden kann. ****
#
# Einrückungen bauen die Produktpalette hierarchisch auf
# Die tiefsten Einrückungen stellen die Produkte dar, alle
# Ebenen darüber die Kategorien
#
# Die einfachste Struktur sieht wie folgt aus (Beispiel):
#
# Speisen
# Gericht 1 ; 2,90
# Gericht 2 ; 3,90
# Untergruppe xy
# Gericht 3 ; 2,90
# Getränke
# ...
#
# Kategorien und Produkte können zusätzlich noch weiter spezifiziert
# werden:
#
# Ein Produkteintrag hat folgendes Format:
# Kurzname (ID:123); NormalPreis (Stufe A); Langname # Preis (Stufe B); Preis (Stufe C); Steuersatz
# dabei ist der Kurzname nur in der Kellneransicht zu sehen
# Nur Kurzname und Preis (A) sind erforderlich, die anderen Teile werden bei
# Auslassung automatisch gefüllt (Preis B=C=A und Langname = Kurzname)
# Die ID ist muss nicht angegeben werden, in dem Fall wird das Produkt als
# neu anzulegendes Produkt behandelt.
# Wird ein Steuersatz angegeben, der für das Produkt vorgegeben sein soll, so
# müssen auch die Preise A und B angegeben werden.
#
# Bei Kategorien:
# Das Gleichheitszeichen dient als Trenner zwischen Namen und weiteren Eigenschaften.
# Wird ein K und B mitgegeben, so werden diese Produkte über die Küchen-
# und Bereitstellungsansicht geführt. Die Einstellung wird auf die Unterkategorien
# vererbt, wenn die darunter liegenden Kategorien keine Angabe dazu machen.
# Hinter dem zweiten Gleichheitszeichen kann die Nummer eines Arbeitsbondruckers
# des jeweiligen Typs (Speise/Getränk) angegeben werden.
#
# Wenn ein D da steht, wird als Typ "Getränk" angenommen, bei einem F "Speise".
# Auch hier wird der übergeordnete Eintrag genommen, wenn Angabe fehlt.
#
# Extras werden mit einem Ausrufezeichen am Zeilenanfang deklariert.
# Das Format ist:
# !Extraname (ID:8) # 12,34 ; (45),Langname eines Produkts,(49),(50)
# - Die ID-Angabe ist optional (kann weggelassen werden)
# - Der Wert 12,34 ist der Aufpreis
# - Hinter dem Semikolo können Komma-getrennt Produte angegebenen werden, die
# dieses Extra haben dürfen. Angabe entweder ID des Produkts in Klammern oder
# der Langname eines Produkts. (Gibt es den Langnamen mehrfach, wird das Extra
# auch mehrfach zugewiesen.)
#
# Reservierte Buchstaben: = ; # !
# (Diese werden als Trenner verwendet!)
#

BIN
webapp/customer/ping.mp3 Normal file

Binary file not shown.

BIN
webapp/customer/pong.mp3 Normal file

Binary file not shown.

98
webapp/customer/speisekarte.txt Executable file
View File

@ -0,0 +1,98 @@
# ***** Diese Speisekarte kann als Vorlage dienen. ****
#
# Einrückungen bauen die Produktpalette hierarchisch auf
# Die tiefsten Einrückungen stellen die Produkte dar, alle
# Ebenen darüber die Kategorien
#
# Ein Produkteintrag hat folgendes Format:
# Kurzname ; NormalPreis (Stufe A); Langname # Preis (Stufe B); Preis (Stufe C)
# dabei ist der Kurzname nur in der Kellneransicht zu sehen
# Nur Kurzname und Preis (A) sind erforderlich, die anderen Teile werden bei
# Auslassung automatisch gefüllt (Preis B=C=A und Langname = Kurzname)
# Wird ein Steuersatz angegeben, der für das Produkt vorgegeben sein soll, so
# müssen auch die Preise A und B angegeben werden.
#
# Bei Kategorien:
# Das Gleichheitszeichen dient als Trenner zwischen Namen und weiteren Eigenschaften.
# Wird ein K und B mitgegeben, so werden diese Produkte über die Küchen-
# und Bereitstellungsansicht geführt. Die Einstellung wird auf die Unterkategorien
# vererbt, wenn die darunter liegenden Kategorien keine Angabe dazu machen.
# Hinter dem zweiten Gleichheitszeichen kann die Nummer eines Arbeitsbondruckers
# des jeweiligen Typs (Speise/Getränk) angegeben werden.
#
# Wenn ein D da steht, wird als Typ "Getränk" angenommen, bei einem F "Speise".
# Auch hier wird der übergeordnete Eintrag genommen, wenn Angabe fehlt.
#
# Extras werden mit einem Ausrufezeichen am Zeilenanfang deklariert.
# Das Format ist:
# !Extraname (ID:8) # 12,34 ; (45),Langname eines Produkts,(49),(50)
# - Die ID-Angabe ist optional (kann weggelassen werden)
# - Der Wert 12,34 ist der Aufpreis
# - Hinter dem Semikolo können Komma-getrennt Produte angegebenen werden, die
# dieses Extra haben dürfen. Angabe entweder ID des Produkts in Klammern oder
# der Langname eines Produkts. (Gibt es den Langnamen mehrfach, wird das Extra
# auch mehrfach zugewiesen.)
#
# Reservierte Buchstaben: = ; # !
# (Diese werden als Trenner verwendet!)
#
Speisen = KBF
Fastfood
Pommes ; 3,00
Schnitzel ; 4,00
Vom Grill
El Greco 2P; 26{.}90; EL Greco 2 Personen # 20{.}90; 13{.}80
El Greco 1P; 14{.}80; EL Greco 1 Person
Fleisch-Gerichte
Lammkotelett; 13{.}50; Lammkotelett # 11{.}30; 6{.}00
Zigeuner/Jägerschnitzel; 10{.}50 # 9{.}80; 3{.}50
Suzukakia 4H; 10{.}50; Suzukakia 4 Hacksteaks
Suzukakia 2H; 10{.}50; Suzukakia 2 Hacksteaks
Souvlaki; 10{.}50
Italienische Küche
Pizza
Siciliana
klein; 7{.}50; Pizza Siciliana klein
groß; 7{.}50; Pizza Siciliana groß
Salami
klein; 6{.}20; Pizza Salami klein
groß; 7{.}80; Pizza Salami groß
Special; 6{.}90; Ital. Tagesspecial
Kategorie Selbstbedienung =
Frühstücksbuffet; 8{.}90
Frühstücksbuffet + Kaffe; 12{.}20
Kategorie vorbereitet = B
Deserts; 2{.}20
Fertigprodukte; 1{.}20
Kategorie Nur Küche = K
Tischzubereitung Fisch; 2{.}20
Tischzubereitung Fleischmenü; 1{.}20
Getränke = KBD
Kaffee
Cappuchino ; 2,50
Tasse Kaffee ; 3,00
Becher Kaffee ; 3,50
Latte Macchiato ; 3,00
Biere
Holsten; 1{.}60 # 1{.}00; 0{.}80
Warsteiner; 1{.}80 # 1{.}20
Becks Gold; 1{.}80
Alsterwasser; 1{.}50
Softdrinks
Coca-Cola; 2{.}50
Fanta; 2{.}50
Ohne Zucker = B
Cola Zero; 2{.}21
Sprite; 2{.}50
Eistee; 1{.}60
Wasser
Apollinaris; 2{.}20
still; 1{.}20; Stilles Wasser
Weine
Lambrusco; 7{.}00; Wein Lambrusco
#
# Es folgen die Extras
!Sahne # 0,50 ; Tasse Kaffee , Becher Kaffee
!Karamellaroma # 0,50 ; Tasse Kaffee , Becher Kaffee , Latte Macchiato
!Majo # 0,50 ; Pommes
!Ketchup # 0,50 ; Pommes

45
webapp/elements/extra.js Normal file
View File

@ -0,0 +1,45 @@
/**
*
*/
function newExtra(id, name, price) {
var extra = {
id:id,
name:name,
price: price,
createTableStructureLine:function (depth,audiofiles) {
if (id != null) {
var trline = "<tr id='extra_" + id + "'>"
+ "<td><input id='extraname_" + id + "' type='text' class='extraname'></input>"
+ "<td><input id='extraprice_" + id + "' type='text' class='extraprice'></input>"
+ "<td><button id='delextra_" + id + "' class='extracmd'>&minus;</button>"
+ "<td><button id='applyextra_" + id + "' class='extracmd'>&crarr;</button>"
+ "</tr>";
return trline;
} else {
var trline = "<tr id='extra_new_" + id + "'>"
+ "<td><input id='newextraname' type='text' class='extraname'></input>"
+ "<td><input id='newextraprice' type='text' class='extraprice'></input>"
+ "<td><button id='newextra_0' class='extracmd'>+</button>"
+ "</tr>";
return trline;
}
},
insertValuesIntoMenuTable:function() {
$("#extra_" + this.id + " input.extraname").val(this.name);
if (this.price != null) {
$("#extra_" + this.id + " input.extraprice").val(this.price);
}
},
createApplyArea:function(idApply) {
var txt = '<p><fieldset>'
+ '<div><button id="' + idApply + '" type="submit" data-theme="b" class="extracmd" data-icon="check">' + PROD_APPLY[lang] + '</button></div>'
+ '</fieldset></p>';
return txt;
},
};
return extra;
}

View File

@ -0,0 +1,31 @@
/**
*
*/
function closePrint () {
document.body.removeChild(this.__container__);
}
function setAndStartPrint () {
this.contentWindow.__container__ = this;
this.contentWindow.onbeforeunload = closePrint;
this.contentWindow.onafterprint = closePrint;
this.contentWindow.focus(); // Required for IE
this.contentWindow.print();
}
function printContent (content) {
var printiframe = document.createElement("iframe");
printiframe.setAttribute("id", "printiframe");
printiframe.onload = setAndStartPrint;
printiframe.style.visibility = "hidden";
printiframe.style.position = "fixed";
printiframe.style.right = "0";
printiframe.style.bottom = "0";
var htmlBody = '<body>' + content + '</body>';
printiframe.src = 'data:text/html;charset=utf-8,' + encodeURI(htmlBody);
document.body.appendChild(printiframe);
}

329
webapp/elements/product.js Normal file
View File

@ -0,0 +1,329 @@
/**
*
*/
function createProdTableHeaderLine() {
var txt = "<tr><th>Name"
+ "<th>Typ&nbsp;&nbsp;"
+ "<th>Durchlauf Küche"
+ "<th>Durchlauf Bereitst." +
+ "<th>Drucker" +
"<th id=shortnameheader class='prodheader'>Kurzname<th>Preis (A)" +
"<th class='prodheader'>Preis (B)" +
"<th class='prodheader'>Preis (C)" +
"<th class='prodheader'>Steuersatz" +
"<th class='prodheader'>Audio" +
"<th class='prodheader'>Verfügbar";
return txt;
}
function ident(depth) {
var txt = "";
var i=0;
for (i=0;i<depth;i++) {
txt += "&#9658;";
}
return txt;
}
function newProduct(id, longname, shortname,priceA,priceB,priceC,tax,available,audio,favorite) {
var product = {
id:id,
longname:longname,
shortname:shortname,
priceA: priceA,
priceB: priceB,
priceC: priceC,
tax: tax,
available: available,
audio: audio,
favorite: favorite,
createTableStructureLine:function (depth,audiofiles) {
//var depthstr = " ".substring(0, depth);
var depthstr = ident(depth);
var trline = "<tr id='prodleaf_" + this.id + "'>"
+ "<td>" + depthstr + "<input type='text' class='prodlongname'></input>"
+ "<td colspan=3>"
+ "<td><input type='text' class='prodshortname'></input>"
+ "<td><input type='text' class='prodpriceA'></input>"
+ "<td><input type='text' class='prodpriceB'></input>"
+ "<td><input type='text' class='prodpriceC'></input>"
+ "<td><input type='text' class='prodtax'></input>"
+ "<td>" + this.createAudioSelection(audiofiles,"audiosel_" + this.id)
+ "<td>" + this.createAvailSelection("prodavail_" + this.id,PROD_NO,PROD_YES)
+ "<td>" + this.createAvailSelection("prodfav_" + this.id,PROD_NO,PROD_YES)
+ "</tr>";
return trline;
},
insertValuesIntoMenuTable:function() {
$("#prodleaf_" + this.id + " input.prodlongname").val(this.longname);
$("#prodleaf_" + this.id + " input.prodshortname").val(this.shortname);
$("#prodleaf_" + this.id + " input.prodpriceA").val(this.priceA);
$("#prodleaf_" + this.id + " input.prodpriceB").val(this.priceB);
$("#prodleaf_" + this.id + " input.prodpriceC").val(this.priceC);
$("#prodleaf_" + this.id + " input.prodtax").val(this.tax);
},
createAudioSelection:function(audiofiles,id) {
var txt = "<select id='" + id + "'><option></option>";
var i=0;
for (i=0;i<audiofiles.length;i++) {
var audiofile = audiofiles[i];
if (this.audio == audiofile) {
txt += "<option selected>" + audiofile + "</option>";
} else {
txt += "<option>" + audiofile + "</option>";
}
}
txt += "</select>";
return txt;
},
createAvailSelection:function(id,text0,text1) {
if (this.available == 1) {
return "<select id=" + id + "><option value=0>" + text0[lang] + "</option><option value=1 selected>" + text1[lang] + "</option></select>";
} else {
return "<select id=" + id + "><option value=0 selected>" + text0[lang] + "</option><option value=1>" + text1[lang] + "</option></select>";
}
},
createFavoriteSelection:function(id,text0,text1) {
if (this.favorite == 1) {
return "<select id=" + id + "><option value=0>" + text0[lang] + "</option><option value=1 selected>" + text1[lang] + "</option></select>";
} else {
return "<select id=" + id + "><option value=0 selected>" + text0[lang] + "</option><option value=1>" + text1[lang] + "</option></select>";
}
},
createMobileAudioSel:function(audiofiles,id) {
var txt = '<p><div data-role="fieldcontain">'
+ '<label for="' + id + '">Audiofile:</label>'
+ this.createAudioSelection(audiofiles,id)
+ '</div></p>';
return txt;
},
createMobileAvail:function(id,label) {
var txt = '<p><div data-role="fieldcontain">'
+ '<label for="' + id + '">' + label + '</label>'
+ this.createAvailSelection(id,PROD_NO,PROD_YES)
+ '</div></p>';
return txt;
},
createMobileFavorite:function(id,label) {
var txt = '<p><div data-role="fieldcontain">'
+ '<label for="' + id + '">' + label + '</label>'
+ this.createFavoriteSelection(id,PROD_NO,PROD_YES)
+ '</div></p>';
return txt;
},
createListStructureLine:function (audiofiles) {
var theme="e";
if (this.id.indexOf("n") == 0) {
theme="f";
}
var line = '<div id="cont_' + this.id + '" data-role="collapsible" data-content-theme="a" data-theme="' + theme + '">'
+'<h3><span id=prodheader_' + this.id + '>Test</span></h3>'
+ '<p><input type="hidden" name="prodid" value="' + this.id + '"></input></p>'
+ createInputField("prodlong_" + this.id,"prodlong_input_" + this.id,"longname")
+ createInputField("prodshort_" + this.id,"prodshort_input_" + this.id,"shortname")
+ '<p><div data-role="fieldcontain">'
+ createInputField("prodpriceA_" + this.id,"prodpriceA_input_" + this.id,"priceA")
+ createInputField("prodpriceB_" + this.id,"prodpriceB_input_" + this.id,"priceB")
+ createInputField("prodpriceC_" + this.id,"prodpriceC_input_" + this.id,"priceC")
+ createInputField("prodtax_" + this.id,"prodtax_input_" + this.id,"tax")
+ '</div></p>'
+ "<div id=audiocont_" + this.id + ">"
+ this.createMobileAudioSel(audiofiles,"audiosel_" + this.id)
+ "</div>"
+ "<div id=availcont_" + this.id + ">"
+ this.createMobileAvail("prodavail_" + this.id,PROD_AVAILABLE[lang])
+ "</div>"
+ "<div id=favcont_" + this.id + ">"
+ this.createMobileFavorite("prodfav_" + this.id,PROD_FAVORITE[lang])
+ "</div>"
if (theme != "f") {
line += this.createProdNavArea();
line += createInputOsCmdField("prodextra_" + this.id,"prodextrainput_" + this.id,"extra");
line += "<div id=assextralist_" + this.id + " class='assextralist'></div>";
line += createResetApplyArea("prodapply_" + this.id,"prodcancel_" + this.id,null) + '</div>';
} else {
line += this.createApplyArea("prodnew_" + this.id) + '</div>';
}
return line;
},
insertValuesIntoMenuList:function() {
if (this.id.indexOf("n") != 0) {
$("#prodheader_" + this.id).html(toHtml(this.longname));
} else {
$("#prodheader_" + this.id).html(PROD_NEW_PROD[lang]);
}
$("#prodlong_" + this.id).html(PROD_LONG_NAME[lang]);
$("#prodlong_input_" + this.id).val(this.longname);
$("#prodshort_" + this.id).html(PROD_SHORTNAME[lang]);
$("#prodshort_input_" + this.id).val(this.shortname);
$("#prodpriceA_" + this.id).html(PROD_PRICE[lang] + ' (A)');
$("#prodpriceB_" + this.id).html(PROD_PRICE[lang] + ' (B)');
$("#prodpriceC_" + this.id).html(PROD_PRICE[lang] + ' (C)');
$("#prodtax_" + this.id).html(PROD_TAX[lang]);
$("#prodpriceA_input_" + this.id).val(this.priceA.toString().replace(".",decpoint));
$("#prodpriceB_input_" + this.id).val(this.priceB.toString().replace(".",decpoint));
$("#prodpriceC_input_" + this.id).val(this.priceC.toString().replace(".",decpoint));
if (this.tax != "null") {
$("#prodtax_input_" + this.id).val(this.tax.toString().replace(".",decpoint));
}
$("#availcont_" + this.id).html(this.createMobileAvail("prodavail_" + this.id,PROD_AVAILABLE[lang]));
$("#favcont_" + this.id).html(this.createMobileFavorite("prodfav_" + this.id,PROD_FAVORITE[lang]));
$("#audiocont_" + this.id).html(this.createMobileAudioSel(audiofiles,"audiosel_" + this.id));
$("#prodextra_" + this.id).html(PROD_ASS_EXTRAS[lang]);
$("#prodextra_" + this.id).data("orig_assignedextras",null);
$("#prodextra_" + this.id).data("assignedextras",null);
},
createApplyArea:function(idApply) {
var txt = '<p><fieldset>'
+ '<div><button id="' + idApply + '" type="submit" data-theme="b" class="oscmd" data-icon="check">' + PROD_APPLY[lang] + '</button></div>'
+ '</fieldset></p>';
return txt;
},
createProdNavArea:function() {
var buttonUp = '<button id="produp_' + this.id + '" type="submit" data-theme="c" class="oscmd">&uarr;</button>';
var buttonDown = '<button id="proddown_' + this.id + '" type="submit" data-theme="c" class="oscmd">&darr;</button>';
var buttonDel = '<button id="proddel_' + this.id + '" type="submit" data-theme="c" class="oscmd">' + PROD_DEL[lang] + '</button>';
var aText = '';
aText += '<p><fieldset class="ui-grid-b">';
aText += ' <div class="ui-block-a delProd">' + buttonDel + '</div>';
aText += ' <div class="ui-block-b prodUp">' + buttonUp + '</div>';
aText += ' <div class="ui-block-c prodDown">' + buttonDown + '</div>';
aText += '</fieldset></p>';
return aText;
}
};
return product;
}
function createInputField(idForNameOfField,idForInputField,nameOfInputField) {
var txt = '<p><div data-role="fieldcontain">'
+ '<label for="' + idForInputField + '"><span id="' + idForNameOfField + '"></span></label>'
+ '<input type="text" name="' + nameOfInputField + '" id="' + idForInputField + '" /></div></p>';
return txt;
}
function createInputOsCmdField(idForNameOfField,idForInputField,nameOfInputField) {
var txt = '<p><div data-role="fieldcontain">'
+ '<label for="' + idForInputField + '"><span id="' + idForNameOfField + '"></span></label>'
+ '<input type="button" name="' + nameOfInputField + '" id="' + idForInputField + '" class="oscmd" value="' + PROD_DO_ASS[lang] + '" data-theme="c" /></div></p>';
return txt;
}
function createResetApplyArea(idApply,idCancel,idDel) {
var txt = '<p><fieldset class="ui-grid-';
if (idDel == null) {
txt += 'a">'
+ '<div class="ui-block-a"><button id="' + idCancel + '" type="submit" data-theme="c" class="oscmd" data-icon="back">' + PROD_CANCEL[lang] + '</button></div>'
+ '<div class="ui-block-b"><button id="' + idApply + '" type="submit" data-theme="b" class="oscmd" data-icon="check">' + PROD_APPLY[lang] + '</button></div>'
+ '</fieldset></p>';
} else {
txt += 'b">'
+ '<div class="ui-block-a"><button id="' + idCancel + '" type="submit" data-theme="c" class="oscmd" data-icon="back">' + PROD_CANCEL[lang] + '</button></div>'
+ '<div class="ui-block-b"><button id="' + idApply + '" type="submit" data-theme="b" class="oscmd" data-icon="check">' + PROD_APPLY[lang] + '</button></div>'
+ '<div class="ui-block-c"><button id="' + idDel + '" type="submit" data-theme="d" class="oscmd" data-icon="delete">' + PROD_DEL[lang] + '</button></div>'
+ '</fieldset></p>';
}
return txt;
}
function createProdType(id,name,kind,usekitchen,usesupplydesk,printer) {
var prodtype = {
id:id,
name: name,
usekitchen:usekitchen,
usesupplydesk:usesupplydesk,
kind:kind,
printer:printer,
createTableStructureLine: function (depth) {
var depthstr = ident(depth);
var trline = "<tr class='prodtype' id='prodtype_" + this.id + "'>"
+ "<td>" + depthstr + "<input type='text' class='typename'></input>"
+ "<td class='type_kind'>" + this.createTwoValSelection(kind,PROD_FOOD,PROD_DRINKS)
+ "<td class='type_usekitchen'>" + this.createTwoValSelection(usekitchen,PROD_NO,PROD_YES)
+ "<td class='type_usesupply'>" + this.createTwoValSelection(usesupplydesk,PROD_NO,PROD_YES)
+ "<td class='type_printer'>" + this.createTwoValSelection(printer,PROD_PRINTER_1,PROD_PRINTER_2)
+ "<td colspan=6>"
+ "</tr>";
return trline;
},
insertValuesIntoMenuTable:function() {
$("#prodtype_" + id + " input.typename").val(name);
},
createTwoValSelection:function(theVal,text0,text1) {
if (theVal == 1) {
return "<select><option val=0 class='no'>" + text0[lang] + "</option><option val=1 selected class='yes'>" + text1[lang] + "</option></selected>";
} else {
return "<select><option val=0 selected>" + text0[lang] + "</option><option val=1>" + text1[lang] + "</option></selected>";
}
},
createUpperMenuTypeStructure: function() {
var txt = '<h3>' + this.name + '</h3><p>'
+ "<div id=dtypekind_" + this.id + "></div>"
+ "<div id=dtypeuk_" + this.id + "></div>"
+ "<div id=dtypeus_" + this.id + "></div>"
+ "<div id=dtypeprinter_" + this.id + "></div>"
+ createInputField("typename_" + this.id,"typename_input_" + this.id,"typename_input_" + this.id)
+ createResetApplyArea("typeapply_" + this.id,"typecancel_" + this.id,"typedel_" + this.id)
+ '</p>';
return txt;
},
createLowerMenuTypeStructure: function() {
var newTypeName = '<p><input type="text" name="newtypename" id="newtypename_' + this.id + '" /></p>';
var newTypeBtn = '<p><button id="newtype_' + this.id + '" type="submit" data-theme="c" class="oscmd">' + PROD_NEW_CAT[lang] + '</button></p>';
var assignBtn = '<p><button id="assignprod_' + this.id + '" type="submit" data-theme="c" class="oscmd">' + PROD_ASSIGN[lang] + ' &#10155; </button></p>';
return newTypeName + newTypeBtn + assignBtn;
},
insertValuesIntoMenuList:function() {
$("#typename_" + this.id).html(PROD_NAME[lang]);
$("#typename_input_" + this.id).val(this.name);
$("#dtypekind_" + this.id).html(this.createMobileSel("kind_" + this.id,this.kind,PROD_TYPE,PROD_FOOD,PROD_DRINKS));
$("#dtypeuk_" + this.id).html(this.createMobileSel("usekitchen_" + this.id,this.usekitchen,PROD_KITCHEN_BAR,PROD_NO_PASS_KITCHEN,PROD_PASS_KITCHEN));
$("#dtypeus_" + this.id).html(this.createMobileSel("usesupply_" + this.id,this.usesupplydesk,PROD_SUPPLY,PROD_NO_PASS_SUPPLY,PROD_PASS_SUPPLY));
$("#dtypeprinter_" + this.id).html(this.createMobileSel("printer_" + this.id,this.printer-1,PROD_PRINTER,PROD_PRINTER_1,PROD_PRINTER_2));
},
createMobileSel:function(id,theVal,label,text0,text1) {
var txt = '<p><div data-role="fieldcontain">'
+ '<label for="' + id + '">' + label[lang] + '</label>'
+ this.createSelection(id,theVal,text0,text1)
+ '</div></p>';
return txt;
},
createSelection:function(id,theVal,text0,text1) {
if (theVal == 1) {
return "<select id=" + id + "><option value=0>" + text0[lang] + "</option><option value=1 selected>" + text1[lang] + "</option></select>";
} else {
return "<select id=" + id + "><option value=0 selected>" + text0[lang] + "</option><option value=1>" + text1[lang] + "</option></select>";
}
}
};
return prodtype;
}

32
webapp/elements/rating.js Normal file
View File

@ -0,0 +1,32 @@
/**
*
*/
function Rating (day,serviceArr,kitchenArr,total) {
this.day = day;
this.service = serviceArr;
this.kitchen = kitchenArr;
this.total = total;
}
Rating.prototype.getServiceInfo = function() {
var good = "<img src=img/green.png style='height:20px;width:" + this.service[0] + "%;' />";
var ok = "<img src=img/yellow.png style='height:20px;width:" + this.service[1] + "%;' />";
var bad = "<img src=img/red.png style='height:20px;width:" + this.service[2] + "%;' />";
var nothing = "<img src=img/gray.png style='height:20px;width:" + this.service[3] + "%;' />";
return good + ok + bad + nothing;
};
Rating.prototype.getKitchenInfo = function() {
var good = "<img src=img/green.png style='height:20px;width:" + this.kitchen[0] + "%;' />";
var ok = "<img src=img/yellow.png style='height:20px;width:" + this.kitchen[1] + "%;' />";
var bad = "<img src=img/red.png style='height:20px;width:" + this.kitchen[2] + "%;' />";
var nothing = "<img src=img/gray.png style='height:20px;width:" + this.kitchen[3] + "%;' />";
return good + ok + bad + nothing;
};
Rating.prototype.getTotal = function() {
return this.total;
};

View File

@ -0,0 +1,88 @@
/**
*
*/
function Roommap (containerEl) {
this.roomindex = -1;
this.containerEl = containerEl;
doAjaxTransmitData("GET","php/tablemap.php?command=getRoomTableMap",null,this.fillRoom,null,this);
}
Roommap.prototype.reload = function() {
doAjaxTransmitData("GET","php/tablemap.php?command=getRoomTableMap",null,this.fillRoom.bind(this),null,this);
}
Roommap.prototype.fillRoom = function(tabs,instance) {
instance.tmRoommap = tabs;
if (instance.roomindex < 0) {
if (instance.tmRoommap.length > 0) {
instance.roomindex = 0;
} else {
instance.roomindex = -1;
}
}
instance.renderRoomList(instance);
}
Roommap.prototype.renderRoomList = function(instance) {
var tabHtml = tmCreateList(instance.tmRoommap,"room_","roombtn","e",instance);
$(instance.containerEl).html(tabHtml);
$(instance.containerEl).trigger("create");
instance.tablemaps = [];
for (var roomindex=0;roomindex<instance.tmRoommap.length;roomindex++) {
var tables = instance.tmRoommap[roomindex].tables;
instance.tablemaps[instance.tablemaps.length] = new Tablemap(instance.tmRoommap[roomindex].id,tables,"#tablenav");
}
if (instance.tmRoommap.length > 0) {
instance.tablemaps[instance.roomindex].renderContent();
}
instance.binding(instance);
}
Roommap.prototype.binding = function(instance) {
$('.roombtn').off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var roomindex = this.id.split("_")[1];
instance.roomindex = roomindex;
//instance.tablemaps[roomindex].renderContent();
instance.renderRoomList(instance);
});
$("#tmimgdelbtn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var roomid = instance.tmRoommap[instance.roomindex].id;
doAjaxTransmitData("POST","php/tablemap.php?command=deleteTableMap",{roomid:roomid},instance.reload.bind(instance),null,instance);
});
}
function tmCreateList(aList,idPrefix,classes,defaultTheme,instance) {
var txt = '<form><fieldset data-role="controlgroup" data-type="horizontal">';
for (var i=0;i<aList.length;i++) {
var theme = defaultTheme;
if (i==instance.roomindex) {
theme = "f";
}
var aListElem = aList[i];
var name = aListElem.name;
var id = aListElem.id;
txt += '<input id="' + idPrefix + i + '" class="' + classes + '" type="submit" value="' + name + '" data-theme="' + theme + '" />';
}
txt += '</fieldset></form>';
return txt;
}
function tmRefreshList(selector) {
if ( $(selector).hasClass('ui-listview')) {
$(selector).listview('refresh');
} else {
$(selector).trigger('create');
}
}

267
webapp/elements/tablemap.js Normal file
View File

@ -0,0 +1,267 @@
/**
*
*/
function Tablemap (roomid,tables,elem) {
this.tables = tables;
this.roomid = roomid;
this.elem = elem;
this.selectedTableId = -1;
if ((tables != null) && (tables.length > 0)) {
this.selectedTableId = tables[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(tables,instance) {
instance.tables = tables;
var tablelist = instance.createList(tables,"table_","tablebtn","c",instance);
$(instance.elem).html(tablelist);
tmRefreshList(instance.elem);
instance.binding(instance);
}
Tablemap.prototype.createList = function(aList,idPrefix,classes,defaultTheme,instance) {
var txt = '<form><fieldset data-role="controlgroup" data-type="horizontal">';
for (var i=0;i<aList.length;i++) {
var aListElem = aList[i];
var name = aListElem.name;
var id = aListElem.id;
var theme = "d";
var icon = "alert";
var hasPos = aListElem.haspos;
if (hasPos == 1) {
icon = "check";
theme = defaultTheme;
}
if (id == instance.selectedTableId) {
theme = "f";
}
txt += '<input id="' + idPrefix + id + '" class="' + classes + '" type="submit" value="' + name + '" data-theme="' + theme + '" data-icon="' + icon + '" />';
}
txt += '</fieldset></form>';
return txt;
}
Tablemap.prototype.binding = function(instance) {
$('.tablebtn').off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
instance.selectedTableId = this.id.split("_")[1];
instance.renderContent(instance.elem);
});
$("#tmimgbtn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
instance.uploadImg(instance);
});
$("#mapimgpart").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var width = $('#mapimgpart').width();
var height = $('#mapimgpart').height();
var offset_t = $(this).offset().top - $(window).scrollTop();
var offset_l = $(this).offset().left - $(window).scrollLeft();
var left = Math.round( (e.clientX - offset_l) );
var top = Math.round( (e.clientY - offset_t) );
var data = {
tableid:instance.selectedTableId,
x:(100*left)/width,
y:(100*top)/height
};
doAjaxTransmitData("POST","php/tablemap.php?command=setPosition",data,instance.renderIfOk,null,instance);
});
}
Tablemap.prototype.createOverlay = function (elem,positions,payTxt,decpoint,currency,tables,ostablebtnsize) {
var t = [];
var sizeclass = "";
if (ostablebtnsize == 0) {
sizeclass = "overlaysize-0";
} else if (ostablebtnsize == 1) {
sizeclass = "overlaysize-1";
} else if (ostablebtnsize == 2) {
sizeclass = "overlaysize-2";
}
for (var i=0;i<positions.length;i++) {
var aPos = positions[i];
if (aPos.haspos == 1) {
var posOfATable = aPos.pos;
var tableId = aPos.id;
var tablename = aPos.name;
var price = '0.00';
for (j=0;j<tables.length;j++) {
if (tables[j].id == tableId) {
price = tables[j].pricesum;
break;
}
}
var left = posOfATable.x;
var top =posOfATable.y; //100 / height * posOfATable.y;
var spanid = "overlay_" + tableId;
var priceTxt = price.replace(".", decpoint) + " " + currency;
var txt = '<span id="' + spanid + '" class="overlaytxt overlayempty ' + sizeclass + '" style="z-index:100;position:absolute;left:' + left + '%;top:' + top + '%;">' + tablename;
if (price != 0.00) {
txt = '<span id="' + spanid + '" class="overlaytxt overlayfull ' + sizeclass + '" style="z-index:100;position:absolute;left:' + left + '%;top:' + top + '%;">' + tablename;
if (payTxt != '') {
txt += '<br>(' + payTxt + ': ' + priceTxt + ')';
} else {
txt += '<br>(' + priceTxt + ')';
}
}
txt += '</span>';
t[t.length] = txt;
}
}
return t;
}
Tablemap.prototype.bindingForOverlaySelection = function(fct,roomid,tables) {
$(".overlaytxt").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var tableid = this.id.split('_')[1];
var tablename = "?";
for (var i=0;i<tables.length;i++) {
var table = tables[i];
if (table.id == tableid) {
tablename = table.name;
}
}
var data = {
roomid:roomid,
tableid:tableid,
tablename:tablename,
x:0,
y:0
};
fct(data);
});
}
Tablemap.prototype.bindingForSelection = function(elem,fct,positions,roomid) {
$(elem).off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var width = $(elem).width();
var height = $(elem).height();
var offset_t = $(this).offset().top - $(window).scrollTop();
var offset_l = $(this).offset().left - $(window).scrollLeft();
var left = 100 * Math.round( (e.clientX - offset_l) ) / width;
var top = 100 * Math.round( (e.clientY - offset_t) ) / height;
if ((positions != null) && (positions.length > 0)) {
var foundTableId = positions[0].id;
var tablename = positions[0].name;
var minDist = (100*100) + (100*100);
for (var i=0;i<positions.length;i++) {
var aPos = positions[i];
if (aPos.haspos == 1) {
var posOfATable = aPos.pos;
var aDist = (posOfATable.x - left) * (posOfATable.x - left) + ((posOfATable.y - top) * (posOfATable.y - top));
if (aDist < minDist) {
minDist = aDist;
foundTableId = aPos.id;
tablename = aPos.name;
}
}
}
var data = {
roomid:roomid,
tableid:foundTableId,
tablename:tablename,
x:left,
y:top
};
fct(data);
}
});
}
Tablemap.prototype.renderIfOk = function(jsonAnswer,instance) {
if (jsonAnswer.status == "OK") {
instance.renderContent(instance.elem);
} else {
alert("ERROR");
}
}
Tablemap.prototype.tmCreateList = function(aList,idPrefix,classes,defaultTheme) {
var txt = '<form><fieldset data-role="controlgroup" data-type="horizontal">';
for (var i=0;i<aList.length;i++) {
var aListElem = aList[i];
var name = aListElem.name;
var id = aListElem.id;
txt += '<input id="' + idPrefix + id + '" class="' + classes + '" type="submit" value="' + name + '" data-theme="' + defaultTheme + '" />';
}
txt += '</fieldset></form>';
return txt;
}
Tablemap.prototype.uploadImg = function(instance) {
var formData = new FormData($('#tablemapimgform')[0]);
formData.append("roomid",instance.roomid);
$.ajax({
url: 'php/tablemap.php?command=uploadimg', //Server script to process data
type: 'POST',
dataType: "json",
xhr: function() { // Custom XMLHttpRequest
var myXhr = $.ajaxSettings.xhr();
if(myXhr.upload){ // Check if upload property exists
//myXhr.upload.addEventListener('progress',progressHandlingFunction, false); // For handling the progress of the upload
}
return myXhr;
},
//Ajax events
success: function(jsonContent) {
if (jsonContent.status != "OK") {
instance.imgNotUploaded(jsonContent);
} else {
instance.imgUploaded(jsonContent,instance);
}
},
error: function(answer) {
instance.imgNotUploaded(answer);
},
// Form data
data: formData,
//Options to tell jQuery: do not to process data or worry about content-type.
cache: false,
contentType: false,
processData: false
});
}
Tablemap.prototype.imgUploaded = function(text,instance) {
instance.renderContent();
}
Tablemap.prototype.imgNotUploaded = function(text) {
alert("Bild konnte nicht hichgeladen werden. Ist es zu groß (> 1 MB)? Oder wurde der Dateiname nicht angegeben?");
}

268
webapp/feedback.html Normal file
View File

@ -0,0 +1,268 @@
<html>
<head>
<title>Ansicht Feedback</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<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>
<script src="kitchenbar.js"></script>
<style>
#tableWithEntriesToCook,#tableWithCookedEntries,#headertableToCook
{
width:100%;
}
#declareready,#declarenotcooked {
text-align:center;
vertical-align:middle;
}
#readybutton,#notreadybutton {
width:90%;
}
#optiontext
{
font-family:sans-serif;
font-size:10pt;
color:black;
}
#tableWithCookedEntries td {
background:#b4b4ec
}
.dividerline {
height: 10px;
}
</style>
</head>
<body>
<script>
var FEED_SENT_TXT = ["Wenn eine Kopie der Nachricht an die angegebene Emailadresse gesendet wurde, scheint der Mailversand an den Entwickler erfolgreich gewesen zu sein.",
"If a copy of the mail was sent to the given email address the mail transfer to the developer seems to be successful.",
"Si una copia del email ha sido enviado a su dirección, el transmisión al programador tuvo probablemente éxito."];
var FEED_ERROR_TXT = ["Fehler beim Nachrichtenversand: ","Error during mail transmisión: ","Error durante envío del mail: "];
var FEED_INFO_TXT = ["Diese Seite dient zur Übermittlung von Feedback an den Entwickler. Die Email wird das Mailkonto des Betreibers versendet.",
"This page serves for sending a feedmail email to the developer of this software. The email will be send by use of the mail account of the administrator.",
"Esta página sirve para enviar un email al programador de este software. El email va a ser enviado por la cuenta del administrador."];
var FEED_LABEL_ROLE = ["Rolle:","Role:","Posición:"];
var FEED_LABEL_WAITER = ["Kellner","Waiter","Camarero"];
var FEED_LABEL_KITSTAFF = ["Küchenpersonal","Kitchen staff","Cocincero"];
var FEED_LABEL_HOST = ["Gastwirt","Owner","Hostelero"];
var FEED_LABEL_ANALYZER = ["Betriebsprüfer","Controller","Examinador"];
var FEED_LABEL_TESTER = ["Tester","Tester","Testador"];
var FEED_TOPIC = ["Thema:","Topic:","Tema:"];
var FEED_PROBLEM = ["Problem","Problem","Problema"];
var FEED_QUESTION = ["Frage","Question","Pregunta"];
var FEED_FEEDB = ["Allg. Rückmeldung","General feedback","Feedback básico"];
var FEED_TRANSFER = ["Übermittlung:","Transfer:","Transmisión:"];
var FEED_WITH_INFO = ["mit DB-Info und Benutzerrechten","With DB info and user rights","con info sobre db y usarios"];
var FEED_ONLY_MAIL = ["nur Nachricht","only message","solo noticia"];
var FEED_MSG = ["Nachricht:","Message:","Noticia:"];
var FEED_PLEASE_TEL = ["Bitte <i>Telefonnummer</i> angeben, wenn eine <b>Antwort</b> per Telefon gewünscht wird.",
"Please enter a phone number if you wish to receive an <b>answer</b> by phone.",
"Por favor, inserte un número de telefono si quiere recibir una <b>respuesta</b> por telefono."];
var FEED_EMPTY_MSG = ["Nachrichtenfeld ist leer.","Message box is empty.","No hay ningún noticia."];
var FEED_MISS_EMAIL = ["Email-Adresse angeben!","Missing email address","Falta dirección de email"];
var FEED_MAYBE_ANSWER = ["Eine Antwort des Entwicklers kann nicht garantiert werden! Informationen über den verwendeten Internetbrowser wird an den Entwickler gesendet, damit mögliche Fragen oder Probleme leichter identifiziert werden können.",
"An answer of the developer cannot be guaranteed. Information about the used browser will always be transmitted to the developer so that questions and problems can answered more easily.",
"Una respuesta del programador no se puede ser garantizado. Informaciones sobre el browser usado siempre esta enviado al programador para que él pueda apoyar más facilmente en caso de problemas o preguntas."];
var FEED_SEND = ["Absenden","Send","Enviar"];
var FEED_PHONE = ["Telefon:","Phone:","Telefono:"];
var lang = 0;
function getGeneralConfigItems() {
doAjax("GET", "php/contenthandler.php?module=admin&command=getGeneralConfigItems", null, insertGeneralConfigItems, "Fehler Konfigurationsdaten");
}
function insertGeneralConfigItems(configResult) {
if (configResult.status == "OK") {
var values = configResult.msg;
setLanguage(values.userlanguage);
binding();
} else {
$("#allpagecontent").hide();
setTimeout(function(){document.location.href = "index.html"},250); // not logged in
//alert("Fehler beim Aufruf der Seite: " + configResult.msg);
}
}
function setLanguage(language) {
lang = language;
$("#feedbackinfotxt").html(FEED_INFO_TXT[lang]);
var rolehtml = '<label for="role"><span id="roletxt">' + FEED_LABEL_ROLE[lang] + '</span></label>'
+ '<select name="role" id="role" data-theme="e" id="roleoptions">'
+ '<option value="1" selected id="waitertxt">' + FEED_LABEL_WAITER[lang] + '</option>'
+ '<option value="2"><span id="kitstafftxt">' + FEED_LABEL_KITSTAFF[lang] + '</span></option>'
+ '<option value="3"><span id="hosttxt">' + FEED_LABEL_HOST[lang] + '</span></option>'
+ '<option value="4"><span id="analyzertxt">' + FEED_LABEL_ANALYZER[lang] + '</span></option>'
+ '<option value="5"><span id="testertxt">' + FEED_LABEL_TESTER[lang] + '</span></option></select>';
$("#rolepart").html(rolehtml);
$("#rolepart").trigger("create");
var topichtml = '<label for="topic">' + FEED_TOPIC[lang] + '</label>'
+ '<select name="topic" id="topic" data-theme="e">'
+ '<option value="1" selected>' + FEED_PROBLEM[lang] + '</option>'
+ '<option value="2">' + FEED_QUESTION[lang] + '</option>'
+ '<option value="3">' + FEED_FEEDB[lang] + '</option></select>';
$("#topicpart").html(topichtml);
$("#topicpart").trigger("create");
var transhtml = '<label for="rights">' + FEED_TRANSFER[lang] + '</label>'
+ '<select name="rights" id="rights" data-theme="e">'
+ '<option value="1" selected>' + FEED_WITH_INFO[lang] + '</option>'
+ '<option value="2">' + FEED_ONLY_MAIL[lang] + '</option></select>';
$("#transferpart").html(transhtml);
$("#transferpart").trigger("create");
var msghtml = '<label for="content">' + FEED_MSG[lang] + '</label>'
+ '<textarea cols="40" rows="8" name="content" id="content" data-theme="c"></textarea>';
$("#msgpart").html(msghtml);
$("#msgpart").trigger("create");
$("#pleasetel").html(FEED_PLEASE_TEL[lang]);
$("#maybe").html(FEED_MAYBE_ANSWER[lang]);
$("#sendtxt").html(FEED_SEND[lang]);
var phonehtml = '<label for="tel">' + FEED_PHONE[lang] + '</label>'
+ '<input type="text" id="tel" value="" data-mini="true" placeholder="0123-456789" data-theme="e"/>';
$("#phonepart").html(phonehtml);
$("#phonepart").trigger("create");
}
function binding() {
$("#sendMail").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var role = $('#role option:selected').text();
var topic = $('#topic option:selected').text();
var email = $("#emailaddr").val();
var tel = $("#tel").val();
var content = $("#content").val();
var rights = $("#rights").val();
if (email == '') {
alert(FEED_MISS_EMAIL[lang]);
return;
}
if (content == '') {
alert(FEED_EMPTY_MSG[lang]);
return;
}
var data = {
role : role,
topic : topic,
email : email,
tel : tel,
allowSendRights : (rights == 1 ? 1 : 0),
content : content
};
doAjax("POST","php/contenthandler.php?module=feedback&command=sendMail",data,mailWasSent,"Fehler Nachrichtenversand");
});
}
function mailWasSent(jsonText) {
if (jsonText == "OK") {
alert (FEED_SENT_TXT[lang]);
} else {
alert (FEED_ERROR_TXT[lang] + jsonText);
}
$("#emailaddr").val("");
$("#tel").val("");
$("#content").val("");
location.reload();
}
//pageinit event for first page
//triggers only once
//write all your on-load functions and event handlers pertaining to page1
$(document).on("pageinit", "#feedback-page", function () {
initializeMainMenu("#modulemenu");
hideMenu();
getGeneralConfigItems();
});
</script>
<!--first page -->
<div data-role="page" id="feedback-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">
<h1>Feedback</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" id="allpagecontent">
<p><span id="feedbackinfotxt">Diese Seite dient zur Übermittlung von Feedback an den Entwickler. Die Email wird das Mailkonto
des Betreibers versendet.</span></p>
<form>
<div class="ui-field-contain" id="rolepart">
</div> <!-- ui-field-contain -->
<div class="ui-field-contain" id="topicpart">
</div> <!-- ui-field-contain -->
<div class="ui-field-contain" id="transferpart">
</div> <!-- ui-field-contain -->
<div class="ui-field-contain">
<label for="emailaddr">Email:</label>
<input type="text" id="emailaddr" value="" data-mini="true" placeholder="Email-Adresse" data-theme="e" />
</div> <!-- ui-field-contain -->
<div class="ui-field-contain" id="phonepart">
</div> <!-- ui-field-contain -->
<div class="ui-field-contain" id="msgpart">
</div> <!-- ui-field-contain -->
<p><span id="pleasetel">Bitte <i>Telefonnummer</i> angeben, wenn eine <b>Antwort</b> per Telefon gewünscht wird.</span>
<br><span id="maybe">Eine Antwort des Entwicklers
kann nicht garantiert werden! Informationen über den verwendeten Internetbrowser wird an den Entwickler gesendet, damit mögliche Fragen
oder Probleme leichter identifiziert werden können.</span></p>
<button type="submit" data-theme="f" data-icon="check" id="sendMail"><span id="sendtxt">Absenden</span></button>
</form>
</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 -->
</body>
</html>

View File

Before

Width:  |  Height:  |  Size: 569 B

After

Width:  |  Height:  |  Size: 569 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 501 KiB

After

Width:  |  Height:  |  Size: 501 KiB

View File

Before

Width:  |  Height:  |  Size: 799 B

After

Width:  |  Height:  |  Size: 799 B

BIN
webapp/img/empty-room.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
webapp/img/germanflag.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

BIN
webapp/img/goup.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
webapp/img/gray.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

View File

Before

Width:  |  Height:  |  Size: 160 B

After

Width:  |  Height:  |  Size: 160 B

BIN
webapp/img/higher.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 986 B

After

Width:  |  Height:  |  Size: 986 B

BIN
webapp/img/i.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 B

BIN
webapp/img/minus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

BIN
webapp/img/multi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 594 B

After

Width:  |  Height:  |  Size: 594 B

View File

Before

Width:  |  Height:  |  Size: 741 B

After

Width:  |  Height:  |  Size: 741 B

BIN
webapp/img/plus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

View File

Before

Width:  |  Height:  |  Size: 160 B

After

Width:  |  Height:  |  Size: 160 B

BIN
webapp/img/serve.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 851 B

BIN
webapp/img/servecheck.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
webapp/img/smile_angry.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
webapp/img/smile_ok.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
webapp/img/smile_super.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
webapp/img/spainflag.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 990 B

BIN
webapp/img/top.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
webapp/img/ukflag.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 260 B

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Some files were not shown because too many files have changed in this diff Show More