OrderSprinter 1.1.12

This commit is contained in:
Geno 2020-11-19 22:55:09 +01:00
parent 8f6f59e47a
commit 6f9dcaf7ea
28 changed files with 792 additions and 311 deletions

32
scripts/Liesmich.txt Normal file
View File

@ -0,0 +1,32 @@
Hinweise zum Inhalt dieses Verzeichnisses:
Mit dem Backup-Skript "backup-db-linux.sh" ist es möglich, auf einem Linux-System
- ein Backup der Datenbank
- das Kassenbuch (PDF-Zusammenfassung) vom Zeitraum des aktuellen Jahres
auf einem USB-Stick anzulegen. Der USB-Stick wird vor dem Backup eingehängt,
und nachher wieder ausgehängt, so dass er anschließend vom Gerät abgezogen werden kann.
Das Skript kann beispielsweise auf einem Raspberry Pi oder anderen Linux-System eingesetzt
werden.
Das Ein- und Aushängen erfordert eigentlich Root-Berechtigungen. Entweder lässt man das Skript
als Root laufen, oder nutzt Möglichkeiten des setuid (wird hier nicht beschrieben).
Es werden immer die letzten maximal drei Backups gespeichert bzw. aufbewahrt.
Im Skript müssen am Anfang einige Variablen angepasst werden:
- der Gerätenamen des Sticks
- die Zugangsparameter der Datenbank (lassen sich aus der config.php) entnehmen, wenn nicht mehr bekannt.
- die Server-Baseadresse
- der Remoteaccess-Code, wie er zuvor in der Verwaltungsansicht eingestellt werden muss
Es wird empfohlen, die Ausführung des Skripts über einen cron-Job regelmäßig und automatisisiert
zu starten:
Um z.B. jeden Morgen um 4 Uhr eine Datensicherung zu starten, legt man den Cronjob wie folgt an:
In der Datei /etc/crontab ans Ende folgenden Eintrag und anschließend eine Zeile freilassen:
0 4 * * * root /usr/local/bin/backup-db-linux.sh > /dev/null 2>&1

61
scripts/backup-db-linux.sh Executable file
View File

@ -0,0 +1,61 @@
#!/bin/bash
# Die folgenden Werte müssen je nach Installation angepasst werden:
mount="/dev/sdc1"
database="ordersprinter"
user="Benutzer"
password="DasPasswort"
serverbase="http://localhost/ordersprinter"
remoteaccesscode="123"
if grep -qs "$mount" /proc/mounts; then
echo "Der USB-Stick ist bereits eingehaengt"
else
echo "Der USB-Stick ist noch nicht eingehaengt."
mount "$mount" /mnt
if [ $? -eq 0 ]; then
echo "Der USB-Stick konnte eingehaengt werden."
# Halte die letzten 3 Sicherungen der DB vor:
if [ -f /mnt/db-dump-1.json ]
then mv /mnt/db-dump-1.json /mnt/db-dump-2.json
fi
if [ -f /mnt/db-dump.json ]
then mv /mnt/db-dump.json /mnt/db-dump-1.json
fi
# Halte die letzten 3 Sicherungen des Kassenbuchs vor
if [ -f /mnt/kassenbuch-1.pdf ]
then mv /mnt/kassenbuch-1.pdf /mnt/kassenbuch-2.pdf
fi
if [ -f /mnt/kassenbuch.pdf ]
then mv /mnt/kassenbuch.pdf /mnt/kassenbuch-1.pdf
fi
#
# Sicherung der Datenbank über die OrderSprinter Backup-Funktion
# (das ist die bevorzugte Variante, weil die Ausgabe-Datei wieder über die Wiederherstellungsfunktion
# vom OrderSprinter eingelesen werden kann).
#
#
wget --post-data "remoteaccesscode=$remoteaccesscode" -O /mnt/db-dump.json 2>>/dev/null "$serverbase/php/contenthandler.php?module=admin&command=autobackup"
#
#
# Sicherung der Datenbank direkt über mysqldump:
# (wird diese Variante genutzt, ist das Umkopieren anzupassen, wenn mehrere Datensicherungen aufbewahrt
# werden sollen.)
#
#mysqldump --user=$user --password=$password --databases $database > /mnt/db-dump.sql
#
# Sicherung des Kassenbuchs als PDF
wget --post-data "remoteaccesscode=$remoteaccesscode" -O /mnt/kassenbuch.pdf 2>>/dev/null "$serverbase/php/contenthandler.php?module=bill&command=autoBackupPdfSummary&lang=0"
#
umount /mnt
echo "Das Datenbank-Backup ist erfolgt, der USB-Stick wurde wieder ausgehaengt."
else
echo "Der USB-Stick konnte nicht eingehaengt werden, das Backup ist nicht erfolgt!"
fi
fi

Binary file not shown.

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.11">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.11">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -0,0 +1,97 @@
function Grouping(set,hashFct) {
// initialization during construction of class
this.set = set;
// setting by group()
this.sortedset = [];
this.group = function() {
this.sortedset = [];
for (var i=0;i<this.set.length;i++) {
var anEntry = this.set[i];
if (this.sortedset.length == 0) {
// new value
anEntry["count"] = 1;
anEntry["ids"] = [ anEntry["id"]];
this.sortedset[this.sortedset.length] = anEntry;
} else {
// check if the entry must be added to an existing entry
var hashOfValueToInsert = hashFct(anEntry);
var found = false;
for (j=0;j<this.sortedset.length;j++) {
var existingVal = this.sortedset[j];
var hashOfExistingValue = hashFct(existingVal);
if (hashOfValueToInsert == hashOfExistingValue) {
existingVal["count"] = existingVal["count"] + 1;
// now add the id
var ids = existingVal["ids"];
ids[ids.length] = anEntry["id"];
found = true;
break;
}
}
if (!found) {
// new value
anEntry["count"] = 1;
anEntry["ids"] = [ anEntry["id"]];
this.sortedset[this.sortedset.length] = anEntry;
}
}
}
}
this.outputList = function(outputFct) {
var txt = "";
for (var i=0;i<this.sortedset.length;i++) {
var anEntry = this.sortedset[i];
txt += outputFct(anEntry);
}
return txt;
}
this.getItemsOfRow = function(rowId) {
var anEntrySet = this.sortedset[rowId];
var ids = anEntrySet["ids"];
var items = [];
for (var j=0;j<ids.length;j++) {
var anId = ids[j];
for (var i=0;i<this.set.length;i++) {
var anEntry = this.set[i];
if (anEntry.id==anId) {
items[items.length] = anEntry;
break;
}
}
}
return items;
}
this.popSortedEntry = function(rowId) {
var anEntry = this.sortedset[rowId];
var ids = anEntry["ids"];
var id = ids.pop();
var aSetEntry = this.popSetEntry(id);
this.group();
return aSetEntry;
}
this.popSetEntry = function(id) {
for (var i=0;i<this.set.length;i++) {
var anEntry = this.set[i];
if (anEntry.id==id) {
this.set.splice(i,1);
return anEntry;
}
}
}
this.getSourceSet = function() {
return this.set;
}
this.getGroupedList = function() {
return this.sortedset;
}
}

View File

@ -4,7 +4,7 @@
<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?v=1.1.11">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -7,8 +7,8 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.11">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.1.11">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.1.12">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -679,7 +679,7 @@ $(document).ready(function() {
<tr id=updateline>
<td>&nbsp;</td>
<td align=center>
<button id="updatebtn">Update -> 1.1.11</button>
<button id="updatebtn">Update -> 1.1.12</button>
</td>
<td>&nbsp;</td>
</tr>

View File

@ -778,6 +778,30 @@ $ret &= $this->setVersion($prefix, '1.1.11');
return $ret;
}
function updateUserTable1111_1112($prefix,$version) {
$pdo = $this->pdo;
try {
if ($version != "1.1.11") {
$ret = $this->updateUserTable1110_1111($prefix,$version);
if (!$ret) {
return false;
}
}
$adminCl = new Admin();
DbUtils::overrulePrefix($prefix);
$sql = "ALTER TABLE %room% ADD `abbreviation` VARCHAR (10) NULL AFTER roomname";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$this->updateVersion($pdo, '1.1.12');
return true;
} catch (PDOException $e) {
return false;
}
}
function setVersion($prefix,$theVersion) {
$pdo = $this->pdo;
try {
@ -849,7 +873,7 @@ $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VAL
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'billlanguage', $billlanguage)");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'currency', '$currency')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'receiptfontsize', '12')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.1.11')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.1.12')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'paymentconfig', '0')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'remoteaccesscode', null)");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'decpoint', '$decpoint')");
@ -1221,8 +1245,8 @@ return;
$supportedVersions = array("1.0.22","1.0.23","1.0.24","1.0.25","1.0.26","1.0.27","1.0.28","1.0.29",
"1.0.30","1.0.31","1.0.32","1.0.33","1.0.34","1.0.35","1.0.36","1.0.37","1.0.38","1.0.39",
"1.0.40",
"1.1.0","1.1.1","1.1.2","1.1.3","1.1.4","1.1.5","1.1.6","1.1.7","1.1.8", "1.1.9","1.1.10"
"1.0.40","1.0.41","1.0.42","1.0.43",
"1.1.0","1.1.1","1.1.2","1.1.3","1.1.4","1.1.5","1.1.6","1.1.7","1.1.8", "1.1.9","1.1.10","1.1.11"
);
if (!in_array($version, $supportedVersions)) {
@ -1230,7 +1254,7 @@ echo json_encode("Quellversion nicht unterstützt");
return;
}
$ret = $admin->updateUserTable1110_1111($_POST['prefix'], $version);
$ret = $admin->updateUserTable1111_1112($_POST['prefix'], $version);
if(session_id() == '') {
session_start();

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.11">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.11">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -229,6 +229,7 @@ var MAN_ROOM_PRINTER_NO = ["Kategorieeinstellung","Category setting","Configurac
var MAN_ROOM_PRINTER_1 = ["Drucker 1","Printer 1","Imprimadora 1"];
var MAN_ROOM_PRINTER_2 = ["Drucker 2","Printer 2","Imprimadora 2"];
var MAN_ROOM_PRINTER_TXT = ["Arbeitsdrucker","Work printer","Imprimadora de trabajo"];
var MAN_ROOM_ABBR_TXT = ["Kürzel","Abbr.","Abbr."];
var MAN_USERNAME = ["Benutzer","User","Usario"];
var MAN_BILLSUMALL = ["Gesamtbrutto","Total (brutto)","Todo (brutto)"];
@ -889,17 +890,9 @@ function binding() {
} else if (theId == "createdbexportxlsx") {
window.location.href = "php/contenthandler.php?module=bill&command=exportXlsx&" + dateparams;
} else if (theId == "createpdfexport") {
if (numberOfClosings == 0) {
alert(MAN_NO_CLOSINGS[lang]);
} else {
window.location.href = "php/contenthandler.php?module=bill&command=exportPdfReport&" + dateparams;
}
window.location.href = "php/contenthandler.php?module=bill&command=exportPdfReport&" + dateparams;
} else if (theId == "createpdfsummary") {
if (numberOfClosings == 0) {
alert(MAN_NO_CLOSINGS[lang]);
} else {
window.location.href = "php/contenthandler.php?module=bill&command=exportPdfSummary&" + dateparams;
}
window.location.href = "php/contenthandler.php?module=bill&command=exportPdfSummary&" + dateparams;
}
});
@ -1682,9 +1675,10 @@ function createRoomPrinterSelection(roomid,selectedPrinter) {
function createEmptyRoomField(n,m) {
var i=0;
var text = "<table>";
text += '<tr><th>' + MAN_ROOM_LABEL[lang] + '<th>' + MAN_ROOM_PRINTER_TXT[lang] + '<th colspan=' + m + '>' + MAN_TABLE_LABEL[lang] + '</tr>';
text += '<tr><th>' + MAN_ROOM_LABEL[lang] + '<th>' + MAN_ROOM_ABBR_TXT[lang] + '<th>' + MAN_ROOM_PRINTER_TXT[lang] + '<th colspan=' + m + '>' + MAN_TABLE_LABEL[lang] + '</tr>';
for (i=0;i<n;i++) {
text += '<tr><td><input style="background:white;" type="text" id="r_' + i.toString() + '"' + ' size="10" />';
text += '<td><input style="background:white;" type="text" id="rabbr_' + i.toString() + '"' + ' size="10" />';
text += '<td id=roomprintercol_' + i + '>' + createRoomPrinterSelection(i,0);
text += tablelist(m,i);
}
@ -1710,6 +1704,8 @@ function initroomfield(roomfield_json) {
r_id = "#r_" + room_index.toString();
$(r_id).val(aRoom.roomname);
$("#rabbr_" + room_index).val(aRoom.abbreviation);
var noOfTables = aRoom.noOfTables;
var roomPrinter = aRoom.printer;
@ -1744,6 +1740,7 @@ function roomfield_prefill() {
var endNumber = startNumber + parseInt(m) - 1;
$(id).val(MAN_TABLE_LABEL[lang] + " " + startNumber + "-" + endNumber);
$("#rabbr_" + i).val('');
for (j=0;j<m;j++) {
var t = (i + parseInt((j+1)/10)).toString() + ((j+1)%10).toString();
id = "#t_" + i.toString() + "_" + j.toString();
@ -1767,12 +1764,14 @@ function roomfield_apply() {
r_id = "#r_" + room_index.toString();
var roominfo = [];
var roomname = $(r_id).val();
var roomabbr = $("#rabbr_" + room_index).val();
var selectedPrinter = $("#roomprinter_" + room_index).find(":selected").val();
if ((roomname.replace(/ /,"")) != "") {
roominfo[0] = roomname;
roominfo[1] = selectedPrinter;
roominfo[1] = roomabbr.trim();
roominfo[2] = selectedPrinter;
var tablesOfRoom = [];
for (table_index = 0; table_index < m; table_index++) {
t_id = "#t_" + room_index.toString() + "_" + table_index.toString();
@ -1782,7 +1781,7 @@ function roomfield_apply() {
}
}
if (tablesOfRoom.length > 0) {
roominfo[2] = tablesOfRoom;
roominfo[3] = tablesOfRoom;
} else {
continue;
}

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.11">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -16,6 +16,7 @@
<script src="receiptutils.js"></script>
<script src="elements/tablemap.js"></script>
<script src="elements/localprint.js"></script>
<script src="elements/grouping.js"></script>
</head>
<body>
@ -116,6 +117,18 @@ var cameFromOrdering = 0;
var billbrutto = 0.0;
var billnetto = 0.0;
// REM* info about items to pay and the table - after products are retrieved for table
// REM* this is the list of items, including double entries:
var prodsToPayList = [];
// REM* this is the list that is grouped of all items in the "oben" list, i.e. still not on the receipt
var prodsToPayListGrouping = [];
// REM* this is the tablename that shall appear on the receipt and on the lists
var payTable = "";
//REM* this is the list of items, including double entries, of all entries already marked as being on the receipt
var prodsOnReceiptList = [];
// REM* this is the list that is grouped of all items in the "unten" list, i.e. on the receipt
var prodsOnReceiptListGrouping = [];
function getGeneralConfigItems() {
doAjax("GET", "php/contenthandler.php?module=admin&command=getGeneralConfigItems", null, insertGeneralConfigItems, "Fehler Konfigurationsdaten");
}
@ -516,7 +529,7 @@ function getProdsToPayForTable(tableid,tablename) {
$("#info-page").data("tableprods",msg);
bindPayButton(msg,tableid,tablename);
displayProdsToPayForTable(msg,tablename);
initiatePayableView(msg,tablename);
} else {
alert("Fehler: " + msg);
}
@ -527,32 +540,94 @@ function getProdsToPayForTable(tableid,tablename) {
});
}
function displayProdsToPayForTable(jsonContent,tablename) {
function initiatePayableView(jsonContent,tablename) {
$('#tableinreceipt').html(tablename + '<br>&nbsp;');
clearUntenAndReceipt();
createAllEntriesInReceipt();
calcSum();
prodsToPayList = jsonContent;
payTable = tablename;
displayProdsToPayForTable();
}
function displayProdsToPayForTable() {
// REM* first group the items
prodsToPayListGrouping = new Grouping(prodsToPayList,createHashOfPayableItem);
prodsToPayListGrouping.group();
var size = getProdSizeClass();
$("#oben").empty().promise().done(function () {
var li = '<li data-role="list-divider" data-theme="b" data-role="heading">' + P_NOT_PAID[lang] + tablename + '</li>'; // init a list
$("#oben").empty().append(li);
$("#oben").append('<li data-theme="f" data-icon="check"><a href="#" id="payall" class="' + size + '">' + P_ALL[lang] + '</a></li>');
$.each(jsonContent, function (index,aProd) {
// var queueid = jsonContent[this.id]["id"];
addToOben(aProd["prodid"],toHtml(aProd["longname"]),aProd["price"],aProd["tax"],aProd["pricelevelname"],aProd["extras"],index);
});
});
var txt = '<li data-role="list-divider" data-theme="b" data-role="heading">' + P_NOT_PAID[lang] + payTable + '</li>'; // init a list
txt += '<li data-theme="f" data-icon="check"><a href="#" id="payall" class="' + size + '">' + P_ALL[lang] + '</a></li>';
var listContent = txt + prodsToPayListGrouping.outputList(createPayableItemListElement);
$("#oben").html(listContent);
refreshList("#oben");
addAllToUnten(jsonContent,tablename);
$(".payable").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
// REM* get rowIndex of item
var listItem = $(this).closest("li");
var rowIndex = $( "#oben li" ).index(listItem) - 2;
// REM* get an item from the payableList
var removedEntry = prodsToPayListGrouping.popSortedEntry(rowIndex);
prodsOnReceiptList[prodsOnReceiptList.length] = removedEntry;
displayProdsToPayForTable();
displayProdsOnReceipt();
});
$("#payall").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
for (var i=0;i<prodsToPayList.length;i++) {
prodsOnReceiptList[prodsOnReceiptList.length] = prodsToPayList[i];
}
prodsToPayList = [];
displayProdsToPayForTable();
displayProdsOnReceipt();
});
window.scrollTo(0,0);
}
function generateListItem(theme,icon,id,content) {
function displayProdsOnReceipt() {
// REM* first group the items
prodsOnReceiptListGrouping = new Grouping(prodsOnReceiptList,createHashOfPayableItem);
prodsOnReceiptListGrouping.group();
var size = getProdSizeClass();
var txt = '<li data-role="list-divider" data-theme="b" data-role="heading">';
txt += P_CONTENT_RECEIPT[lang] +': <p id="priceinreceipt">0,00 ' + currency + '</p></li>';
var listContent = txt + prodsOnReceiptListGrouping.outputList(createOnReceiptItemListElement);
$("#unten").html(listContent);
refreshList("#unten");
createAllEntriesInReceipt();
$(".onreceipt").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
// REM* get rowIndex of item
var listItem = $(this).closest("li");
var rowIndex = $( "#unten li" ).index(listItem) - 1;
// REM* get an item from the payableList
var removedEntry = prodsOnReceiptListGrouping.popSortedEntry(rowIndex);
prodsToPayList[prodsToPayList.length] = removedEntry;
displayProdsToPayForTable();
displayProdsOnReceipt();
});
};
function generateListItem(theme,icon,id,content,classname) {
var size = getProdSizeClass();
var li = '<li data-theme="' + theme + '" data-icon="' + icon + '">';
li += '<a href="#" id="' + id + '" class="info-go ' + size + '">' + content + '</a></li>';
li += '<a href="#" id="' + id + '" class="info-go ' + size + ' ' + classname + '">' + content + '</a></li>';
return li;
}
@ -591,39 +666,39 @@ function addAllToUnten(jsonContent,tablename) {
}
function addToOben(prodid,longname,price,tax,pricelevelname,extras,index) {
var jsonContent = $("#info-page").data("tableprods");
var tablename = $("#info-page").data("tablename");
if (pricelevelname != "A") {
longname += " (" + pricelevelname + ")";
function createHashOfPayableItem(aProd) {
var longname = aProd["longname"];
if (aProd["pricelevelname"] != "A") {
longname += " (" + aProd["pricelevelname"] + ")";
}
longname += " - " + (parseFloat(price).toFixed(2).replace(".",decpoint));
var extratxt = createExtraParagraph(extras);
var li_item = generateListItem("c","plus",index,toHtml(longname) + extratxt);
$("#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 tax = jsonContent[this.id]["tax"];
var pricelevelname = jsonContent[this.id]["pricelevelname"];
var longname = jsonContent[this.id]["longname"];
var extras = jsonContent[this.id]["extras"];
addToUnten(prodid,longname,price,tax,pricelevelname,extras,this.id);
createAllEntriesInReceipt();
$(this).closest("li").remove();
refreshList("#oben");
});
});
refreshList("#oben");
longname += " - " + (parseFloat(aProd["price"]).toFixed(2).replace(".",decpoint));
var extratxt = createExtraParagraph(aProd["extras"]);
return toHtml(longname) + extratxt;
}
function createPayableItemListElement(aProd) {
var count = "";
if("count" in aProd) {
if (aProd["count"] > 1) {
count = aProd["count"] + "x ";
}
}
var li_item = generateListItem("c","plus","payable_" + aProd["id"],count + createHashOfPayableItem(aProd),"payable");
return li_item;
}
function createOnReceiptItemListElement(aProd) {
var count = "";
if("count" in aProd) {
if (aProd["count"] > 1) {
count = aProd["count"] + "x ";
}
}
var li_item = generateListItem("c","plus","payable_" + aProd["id"],count + createHashOfPayableItem(aProd),"onreceipt");
return li_item;
}
// Make table empty...
function clearUntenAndReceipt() {
var untenHeader = '<li data-role="list-divider" data-theme="b" data-role="heading">';
@ -639,36 +714,6 @@ function clearUntenAndReceipt() {
$("#thedate").html('<br><br>&nbsp;<br>');
}
function addToUnten(prodid,longname,price,tax,pricelevelname,extras,index) {
var jsonContent = $("#info-page").data("tableprods");
var tablename = $("#info-page").data("tablename");
if (pricelevelname != "A") {
longname += " (" + pricelevelname + ")";
}
longname += " - " + (parseFloat(price).toFixed(2).replace(".",decpoint));
var extratxt = createExtraParagraph(extras);
var li_item = generateListItem("f","minus",index,toHtml(longname) + extratxt);
$("#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 tax = jsonContent[this.id]["tax"];
var extras = jsonContent[this.id]["extras"];
var pricelevelname = jsonContent[this.id]["pricelevelname"];
var longname = jsonContent[this.id]["longname"];
addToOben(prodid,longname,price,tax,pricelevelname,extras,this.id);
$(this).closest("li").remove();
createAllEntriesInReceipt();
refreshList("#unten");
});
});
refreshList("#unten");
}
// arrayToFill:
// [0]: count prodid prodid-pricelevelname queueid longname price pricelevelname
@ -714,18 +759,15 @@ function listTaxes(collectionOfTaxes,decpointx) {
}
function listTaxesBasedOnUntenList(decpointx) {
var jsonContent = $("#info-page").data("tableprods");
// REM* which different taxes do we have?
var mytaxes = [];
var count = 0;
$("#unten li a.info-go").each(function() {
var id_in_jsonText = this.id;
var prodEl = jsonContent[id_in_jsonText];
mytaxes.push(prodEl.tax);
});
for (var i=0;i<prodsOnReceiptList.length;i++) {
var prodEl = prodsOnReceiptList[i];
mytaxes.push(prodEl.tax);
}
return listTaxes(mytaxes,decpoint);
}
@ -751,10 +793,10 @@ function calcSum() {
var overallbrutto = 0.0;
var overallmwst = 0.0;
$("#unten li a.info-go").each(function() {
var id_in_jsonText = $(this).attr('id');
var bruttoprice = parseFloat(jsonContent[id_in_jsonText]["price"]);
var taxStr = jsonContent[id_in_jsonText]["tax"];
for (var k=0;k<prodsOnReceiptList.length;k++) {
var item = prodsOnReceiptList[k];
var bruttoprice = parseFloat(item["price"]);
var taxStr = item["tax"];
var tax = parseFloat(taxStr);
taxStr = taxStr.replace(".",decpoint);
@ -776,7 +818,7 @@ function calcSum() {
overallnetto += nettoprice;
overallbrutto += bruttoprice;
overallmwst += mwst;
});
};
for (var j=0;j<taxes.length;j++) {
@ -797,27 +839,26 @@ function calcSum() {
$("#priceinreceipt2").html(overallbrutto.toFixed(2).replace(".",decpoint) + " " + currency);
}
// REM* use prodsOnReceiptListGrouping
function createAllEntriesInReceipt() {
var jsonContent = $("#info-page").data("tableprods");
var tablename = $("#info-page").data("tablename");
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');
for (var i=0;i<prodsOnReceiptList.length;i++) {
var item = prodsOnReceiptList[i];
var entry = {
prodid: jsonContent[id_in_jsonText]["prodid"],
queueid: jsonContent[id_in_jsonText]["id"],
longname: jsonContent[id_in_jsonText]["longname"],
price: jsonContent[id_in_jsonText]["price"],
tax: jsonContent[id_in_jsonText]["tax"],
extras: jsonContent[id_in_jsonText]["extras"],
pricelevelname: jsonContent[id_in_jsonText]["pricelevelname"]
prodid: item["prodid"],
queueid: item["id"],
longname: item["longname"],
price: item["price"],
tax: item["tax"],
extras: item["extras"],
pricelevelname: item["pricelevelname"]
};
entryListForReceipt = addEntryOrIncreaseCount(entryListForReceipt,entry);
});
}
var tablecontent = createReceiptHeader();
@ -892,18 +933,18 @@ function bindPayButton(jsonContent,tableid,tablename) {
$("#payWithoutPrint").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
selectPayment(jsonContent,tableid,tablename,false);
selectPayment(tableid,tablename,false);
});
$("#payWithPrint").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
selectPayment(jsonContent,tableid,tablename,true);
selectPayment(tableid,tablename,true);
});
}
function selectPayment(jsonContent,tableid,tablename,printoption) {
function selectPayment(tableid,tablename,printoption) {
// first test if there are items to pay!
var itemsToPay = $('#unten li').size() - 1;
var itemsToPay = prodsOnReceiptList.length;
if (itemsToPay == 0) {
$.mobile.changePage("#nocashitems");
} else {
@ -925,7 +966,7 @@ function selectPayment(jsonContent,tableid,tablename,printoption) {
if ($("#info-page").data("taxtype") == "togo") {
appliedTax = $("#info-page").data("togotax");
}
startPayProcess(jsonContent,printoption,tableid,tablename,paymentId,appliedTax);
startPayProcess(printoption,tableid,tablename,paymentId,appliedTax);
});
}
}
@ -951,16 +992,15 @@ function bindCalcReturn() {
});
}
function startPayProcess(jsonContent,printoption,tableid,tablename,paymentid,tax) {
function startPayProcess(printoption,tableid,tablename,paymentid,tax) {
checkForLogIn();
var ids="";
$('#unten li').each(function() {
var index = $(this).find("a").attr("id");
if (typeof index != 'undefined') {
var queueid = jsonContent[index]["id"];
ids += queueid + ",";
}
});
for (var i=0;i<prodsOnReceiptList.length;i++) {
var item = prodsOnReceiptList[i];
var queueId = item["id"];
ids += queueId + ",";
}
// REM* declarePaidCreateBillReturnBillId
var style = ' style="table-layout: fixed; width: 70%; background-color: #cccccc;" ';
@ -1016,6 +1056,7 @@ function startPayProcess(jsonContent,printoption,tableid,tablename,paymentid,tax
}
}
// bug workaround. reload does not work after pdf-print-so getProd in all cases
prodsOnReceiptList = [];
getProdsToPayForTable(tableid,tablename);
var itemsLeft = $('#oben li').size() - 2;
if (itemsLeft > 0) {

View File

@ -123,6 +123,8 @@ class Admin {
$this->getPayPrintType();
} else if ($command == 'getPayments') {
$this->getPayments();
} else if ($command == 'autobackup') {
$this->backup('auto',$_POST['remoteaccesscode']);
} else if (($command == 'new') || ($command == 'shutdown') || ($command == 'backup') || ($command == 'restore') || ($command == 'drop') || ($command == 'fill') || ($command == 'fillSampleProdType') || ($command == 'fillSpeisekarte') || ($command == 'assignTaxes')) {
if ($this->isCurrentUserAdmin()) {
if ($command == 'fill') {
@ -134,7 +136,7 @@ class Admin {
} else if ($command == 'fillSpeisekarte') {
$this->fillSpeisekarte($_POST['speisekarte']);
} else if ($command == 'backup') {
$this->backup($_GET['type']);
$this->backup($_GET['type'],null);
return;
} else if ($command == 'restore') {
$this->restore();
@ -1104,19 +1106,19 @@ class Admin {
$right_rating = $_SESSION['right_rating'];
if (!self::isOnlyRatingUser($rights, $right_rating, true)) {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.1.11"); };
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.1.11"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.1.11"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.1.11"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.1.12"); };
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.1.12"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.1.12"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.1.12"); };
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html"); };
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.1.11"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.1.11"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.1.11"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.1.11"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.1.11"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.1.11"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.1.11");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.1.11");
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.1.12"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.1.12"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.1.12"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.1.12"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.1.12"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.1.12"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.1.12");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.1.12");
}
$mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php");
@ -1125,7 +1127,7 @@ class Admin {
$waiterMessage = $this->getMessage(null, "waitermessage");
}
// CAUTION: change version also in config.txt!!!
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.1.11",
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.1.12",
"user" => $currentUser,
"menu" => $mainMenu,
"waitermessage" => $waiterMessage,
@ -1724,13 +1726,33 @@ class Admin {
"user","reservations","bill","queue","billproducts","comments","histprod","histconfig","histuser","histactions","hist","extras","extrasprods","queueextras");
}
public function backup($theType) {
public function backup($theType,$remoteaccesscode) {
date_default_timezone_set(DbUtils::getTimeZone());
$nowtime = date('Y-m-d');
ini_set('memory_limit', '1000M');
$pdo = DButils::openDbAndReturnPdoStatic();
if ($theType == "auto") {
$sql = "SELECT count(id) as number,setting FROM %config% WHERE name=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array("remoteaccesscode"));
$row = $stmt->fetchObject();
if ($row->number == 0) {
echo "No remote access code available - backup not allowed";
return;
}
$code = $row->setting;
if (is_null($code) || (trim($code) == "")) {
echo "No remote access code set - backup not allowed";
return;
}
if ($code != md5($remoteaccesscode)) {
echo "Wrong remote access code used - backup not allowed";
return;
}
}
$pdo->beginTransaction();
$genInfo = $this->getGeneralConfigItems(false, $pdo);
@ -1801,18 +1823,24 @@ class Admin {
}
private function restore() {
ini_set('memory_limit', '1000M');
set_time_limit(60*5);
if ($_FILES['userfile']['error'] != UPLOAD_ERR_OK //checks for errors
&& is_uploaded_file($_FILES['userfile']['tmp_name'])) { //checks that file is uploaded
header("Location: ../infopage.html?e=manager.html=Kann_Datei_nicht_laden.");
exit();
}
if(!file_exists($_FILES['userfile']['tmp_name']) || !is_uploaded_file($_FILES['userfile']['tmp_name'])) {
header("Location: ../infopage.html?e=manager.html=Datei_nicht_angegeben.");
if(!file_exists($_FILES['userfile']['tmp_name'])) {
header("Location: ../infopage.html?e=manager.html=Datei_existiert_nicht._Bitte_PHP-Variable_upload_max_filesize_checken.");
exit();
}
ini_set('memory_limit', '1000M');
if(!is_uploaded_file($_FILES['userfile']['tmp_name'])) {
header("Location: ../infopage.html?e=manager.html=Datei_konnte_nicht_hochgeladen_werden.");
exit();
}
$binaryFields = array("signature","img","setting","content");
@ -1822,8 +1850,6 @@ class Admin {
$basedb->setPrefix(TAB_PREFIX);
$basedb->setTimeZone(DbUtils::getTimeZone());
set_time_limit(60*5);
$pdo = DbUtils::openDbAndReturnPdoStatic();
$pdo->beginTransaction();

View File

@ -54,7 +54,7 @@ class Bill {
}
if ($command == 'exportPdfReport') {
if ($this->hasCurrentUserAdminOrManagerRights()) {
$this->exportPdfReport($_GET['lang'],$_GET['startMonth'],$_GET['startYear'],$_GET['endMonth'],$_GET['endYear']);
$this->exportPdfReport($_GET['startMonth'],$_GET['startYear'],$_GET['endMonth'],$_GET['endYear']);
} else {
echo "Benutzer nicht berechtigt";
}
@ -62,12 +62,16 @@ class Bill {
}
if ($command == 'exportPdfSummary') {
if ($this->hasCurrentUserAdminOrManagerRights()) {
$this->exportPdfSummary($_GET['lang'],$_GET['startMonth'],$_GET['startYear'],$_GET['endMonth'],$_GET['endYear']);
$this->exportPdfSummary($_GET['startMonth'],$_GET['startYear'],$_GET['endMonth'],$_GET['endYear']);
} else {
echo "Benutzer nicht berechtigt";
}
return;
}
if ($command == 'autoBackupPdfSummary') {
$this->autoBackupPdfSummary($_POST['remoteaccesscode']);
return;
}
if ($command == 'exportCsvOfClosing') {
if ($this->hasCurrentUserAdminOrManagerRights()) {
@ -146,14 +150,26 @@ class Bill {
}
}
function billIsCancelled($pdo,$billid) {
$sql = "SELECT status FROM %bill% WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($billid));
$row = $stmt->fetchObject();
$status = $row->status;
$ret = false;
if (($status == "x") || ($status == "s")) {
$ret = true;
}
return $ret;
}
/**
* get the content of a bill (to be used for printserver etc.)
*
* @param unknown $billid
*/
function getBillWithId($billid,$language,$printer) {
function getBillWithId($pdo,$billid,$language,$printer) {
set_time_limit(120);
$pdo = $this->dbutils->openDbAndReturnPdo();
// is bill correct with signature?
$commonUtils = new CommonUtils();
@ -176,25 +192,43 @@ class Bill {
$stmt->execute(array($billid));
$qrow = $stmt->fetchObject();
$tableid = $row->tableid;
if ($qrow->countid == 0) {
if ($row->tableid == 0) {
if ($tableid == 0) {
// togo
$sql = "SELECT DISTINCT billdate,brutto,netto,'-' as tablename,username,host FROM %bill%,%user% WHERE %bill%.id=? AND userid=%user%.id AND tableid='0' ";
$sql = "SELECT DISTINCT billdate,brutto,netto,'-' as tablename,username,host,IFNULL(%bill%.status,'') as status FROM %bill%,%user% WHERE %bill%.id=? AND userid=%user%.id AND tableid='0' ";
} else {
$sql = "SELECT DISTINCT billdate,brutto,netto,tableno as tablename,username,host FROM %bill%,%user%,%resttables% WHERE %bill%.id=? AND userid=%user%.id AND tableid=%resttables%.id ";
$sql = "SELECT DISTINCT billdate,brutto,netto,tableno as tablename,username,host,IFNULL(%bill%.status,'') as status FROM %bill%,%user%,%resttables% WHERE %bill%.id=? AND userid=%user%.id AND tableid=%resttables%.id ";
}
} else {
if ($row->tableid == 0) {
if ($tableid == 0) {
// togo
$sql = "SELECT DISTINCT billdate,brutto,netto,'-' as tablename,username,host FROM %bill%,%user%,%queue% WHERE %bill%.id=? AND %bill%.id=%queue%.billid AND userid=%user%.id AND tableid='0' AND paidtime is not null ";
$sql = "SELECT DISTINCT billdate,brutto,netto,'-' as tablename,username,host,IFNULL(%bill%.status,'') as status FROM %bill%,%user%,%queue% WHERE %bill%.id=? AND %bill%.id=%queue%.billid AND userid=%user%.id AND tableid='0' AND paidtime is not null ";
} else {
$sql = "SELECT DISTINCT billdate,brutto,netto,tableno as tablename,username,host FROM %bill%,%user%,%resttables%,%queue% WHERE %bill%.id=? AND %bill%.id=%queue%.billid AND userid=%user%.id AND tableid=%resttables%.id AND paidtime is not null ";
$sql = "SELECT DISTINCT billdate,brutto,netto,tableno as tablename,username,host,IFNULL(%bill%.status,'') as status FROM %bill%,%user%,%resttables%,%queue% WHERE %bill%.id=? AND %bill%.id=%queue%.billid AND userid=%user%.id AND tableid=%resttables%.id AND paidtime is not null ";
}
}
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($billid));
$row = $stmt->fetchObject();
$status = $row->status;
$sign = ($status == "s" ? "-" : "");
if ($tableid != 0) {
$sql = "SELECT abbreviation FROM %room%,%resttables% WHERE %resttables%.id=? AND %resttables%.roomid=%room%.id";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($tableid));
$trow = $stmt->fetchObject();
if (is_null($trow->abbreviation)) {
$tablename = $row->tablename;
} else {
$tablename = $trow->abbreviation . "-" . $row->tablename;
}
} else {
$tablename = "-";
}
if ($row == null) {
// no rows found -> deliver no content
echo json_encode(array("billoverallinfo" => array()));
@ -228,7 +262,7 @@ class Bill {
"billmin" => $min,
"brutto" => $row->brutto,
"netto" => $row->netto,
"table" => $row->tablename,
"table" => $tablename,
"username" => $row->username,
"printer" => $printer,
"host" => $host
@ -250,7 +284,7 @@ class Bill {
}
// now get all products of this bill
$sql = "select productname,price,%pricelevel%.name as pricelevelname,count(%queue%.productname) as count from %bill%,%queue%,%pricelevel% where %bill%.id=? and %queue%.billid=%bill%.id AND paidtime is not null AND %queue%.pricelevel = %pricelevel%.id group by productname,price,pricelevelname";
$sql = "select productname,price,%pricelevel%.name as pricelevelname,count(%queue%.productname) as count from %queue%,%pricelevel%,%billproducts% where %billproducts%.billid=? AND %billproducts%.queueid=%queue%.id AND %queue%.pricelevel = %pricelevel%.id group by productname,price,pricelevelname";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($billid));
$result = $stmt->fetchAll();
@ -260,16 +294,16 @@ class Bill {
$prodarray[] = array("count" => $zeile['count'],
"productname" => $zeile['productname'],
"pricelevel" => $zeile['pricelevelname'],
"price" => $zeile['price']
"price" => $sign . $zeile['price']
);
}
$sql = "select tax,round(sum(price) - sum(price / (1.0 + tax/100.0)),2) as mwst, round(sum(price / (1.0 + tax/100.0)),2) as netto, sum(price) as brutto FROM %queue% WHERE billid=? group by tax ORDER BY tax";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$sql = "select tax,concat('$sign',round(sum(price) - sum(price / (1.0 + tax/100.0)),2)) as mwst, concat('$sign',round(sum(price / (1.0 + tax/100.0)),2)) as netto, concat('$sign',sum(price)) as brutto FROM %queue%,%billproducts% WHERE %billproducts%.billid=? AND %billproducts%.queueid=%queue%.id group by tax ORDER BY tax";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($billid));
$result = $stmt->fetchAll(PDO::FETCH_OBJ);
$out = array("billoverallinfo" => $billoverallinfo,"translations" => $billtranslations,"products" => $prodarray, "taxes" => $result);
return $out;
}
@ -376,7 +410,7 @@ class Bill {
$commonUtils = new CommonUtils();
$sql = "SELECT id,billdate,brutto,tableid,closingid,status FROM %bill% WHERE tableid >= '0' AND status is null AND $whenClause ORDER BY billdate DESC ";
$sql = "SELECT id,billdate,brutto,tableid,closingid,status FROM %bill% WHERE tableid >= '0' AND $whenClause ORDER BY billdate DESC ";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($startDate,$endDate));
$result = $stmt->fetchAll();
@ -393,13 +427,16 @@ class Bill {
$shortdate = $date->format('H:i');
$closingID = $zeile['closingid'];
$isClosed = (is_null($closingID) ? 0 : 1);
if ($this->billIsCancelled($pdo,$theId)) {
$isClosed = 1;
}
$arr = array("id" => $theId,
"longdate" => $zeile['billdate'],
"shortdate" => $shortdate,
"brutto" => $zeile['brutto'],
"tablename" => $commonUtils->getTableNameFromId($pdo,$zeile['tableid']),
"billcontent" => $this->getBillWithId($theId,$l,0),
"billcontent" => $this->getBillWithId($pdo,$theId,$l,0),
"isClosed" => $isClosed
);
@ -580,13 +617,50 @@ class Bill {
return;
}
private function autoBackupPdfSummary($remoteaccesscode) {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$sql = "SELECT count(id) as number,setting FROM %config% WHERE name=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array("remoteaccesscode"));
$row = $stmt->fetchObject();
if ($row->number == 0) {
echo "No remote access code available - backup not allowed";
return;
}
$code = $row->setting;
if (is_null($code) || (trim($code) == "")) {
echo "No remote access code set - backup not allowed";
return;
}
if ($code != md5($remoteaccesscode)) {
echo "Wrong remote access code used - backup not allowed";
return;
}
$pdo = null;
date_default_timezone_set(DbUtils::getTimeZone());
$currentYear = date('Y');
$currentMonth = date('n');
$this->exportPdfSummary(1, $currentYear, $currentMonth, $currentYear);
}
private function exportPdfReport($startMonth,$startYear,$endMonth,$endYear) {
$pdfExport = new PdfExport();
$pdfExport->exportPdfReport($_GET['lang'],$_GET['startMonth'],$_GET['startYear'],$_GET['endMonth'],$_GET['endYear']);
$lang = 0;
if(isset($_GET["lang"])) {
$lang = $_GET['lang'];
}
$pdfExport->exportPdfReport($lang,$startMonth,$startYear,$endMonth,$endYear);
}
private function exportPdfSummary($startMonth,$startYear,$endMonth,$endYear) {
$pdfExport = new PdfExport();
$pdfExport->exportPdfSummary($_GET['lang'],$_GET['startMonth'],$_GET['startYear'],$_GET['endMonth'],$_GET['endYear']);
$lang = 0;
if(isset($_GET["lang"])) {
$lang = $_GET['lang'];
}
$pdfExport->exportPdfSummary($lang,$startMonth,$startYear,$endMonth,$endYear);
}
private function exportCsv($startMonth,$startYear,$endMonth,$endYear,$exportType) {

View File

@ -501,7 +501,7 @@ $csv .= "$aBillId; \"$billdate\" ; \"" . $this->t['cashaction'][$l] . "\" ; \"$b
}
} else {
$sql = "SELECT DISTINCT productname,price,%queue%.tax as tax FROM %queue%,%billproducts% WHERE %billproducts%.billid=?' AND %billproducts%.queueid=%queue%.id";
$sql = "SELECT DISTINCT productname,price,%queue%.tax as tax FROM %queue%,%billproducts% WHERE %billproducts%.billid=? AND %billproducts%.queueid=%queue%.id";
if ($status == 'x') {
$statusTxt = $this->t["laterCancelled"][$l];
} else if ($status == 's') {

View File

@ -331,7 +331,7 @@ class PrintQueue {
$printer = $aBill["printer"];
if (in_array($printer, $printersArr)) {
$receiptJob = array("id" => $printJobId,"bill" => $bill->getBillWithId($aBillId,$language,$printer));
$receiptJob = array("id" => $printJobId,"bill" => $bill->getBillWithId($pdo,$aBillId,$language,$printer));
$billarray[] = $receiptJob;
}
}

View File

@ -474,12 +474,16 @@ class QueueContent {
$takeAwayStr = array("Zum Mitnehmen","Take away","Para llevar");
$tablename = $takeAwayStr[$lang];
} else {
$sql = "SELECT tableno FROM %resttables% WHERE id=?";
$sql = "SELECT tableno,%room%.abbreviation FROM %resttables%,%room% WHERE %resttables%.id=? AND %resttables%.roomid=%room%.id";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($theTableid));
$row = $stmt->fetchObject();
$tablename = $row->tableno;
if (is_null($row->abbreviation)) {
$tablename = $row->tableno;
} else {
$tablename = $row->abbreviation . "-" . $row->tableno;
}
}
PrintQueue::queueWorkPrintJob($pdo, $tablename, $germanTime, $resultarray, $kind, $printer, $user);
@ -1025,7 +1029,7 @@ class QueueContent {
$extras = $this->getExtrasOfQueueItem($pdo,$anId);
$prodEntry = array(
"queueid" =>$anId,
"id" =>$anId,
"longname" => $row->productname,
"option" => $row->anoption,
"extras" => $extras,
@ -1108,6 +1112,7 @@ class QueueContent {
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$result = $stmt->fetchAll();
$prodsToPay = array();
foreach ($result as $zeile) {
$thePrice = $zeile['price'];
$theTax = $zeile['tax'];

View File

@ -275,17 +275,21 @@ class Roomtables {
for ($roomindex = 0;$roomindex < $noOfRooms; $roomindex++) {
$aRoom = $rooms[$roomindex];
$aRoomName = $aRoom[0];
$roomPrinter = $aRoom[1];
$aRoomAbbr = $aRoom[1];
if ($aRoomAbbr == "") {
$aRoomAbbr = null;
}
$roomPrinter = $aRoom[2];
if ($roomPrinter == 0) {
$roomPrinter = null;
}
$sql = "INSERT INTO `%room%` (`id`, `roomname`, `printer`) VALUES (NULL,?,?)";
$sql = "INSERT INTO `%room%` (`id`, `roomname`, `abbreviation`, `printer`) VALUES (NULL,?,?,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($aRoomName,$roomPrinter));
$stmt->execute(array($aRoomName,$aRoomAbbr,$roomPrinter));
$roomId = $pdo->lastInsertId();
$tablesArr = $aRoom[2];
$tablesArr = $aRoom[3];
$noOfTables = count($tablesArr);
for ($tableindex = 0; $tableindex < $noOfTables; $tableindex++) {
@ -302,7 +306,7 @@ class Roomtables {
function getRoomfield() {
$pdo = $this->dbutils->openDbAndReturnPdo();
$sql = "SELECT id,roomname,IFNULL(printer,0) as printer FROM %room% WHERE removed is null ORDER BY 'sorting'";
$sql = "SELECT id,roomname,IFNULL(abbreviation,'') as abbreviation,IFNULL(printer,0) as printer FROM %room% WHERE removed is null ORDER BY 'sorting'";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$result = $stmt->fetchAll();
@ -315,6 +319,7 @@ class Roomtables {
foreach($result as $row) {
$roomid = $row['id'];
$roomname = $row['roomname'];
$abbreviation = $row['abbreviation'];
$printer = $row['printer'];
// now get the tables of this room
@ -329,7 +334,7 @@ class Roomtables {
foreach($tableresult as $aTable) {
$tableArr[] = array("id" => $aTable['id'], "tablename" => $aTable['tableno']);
}
$roomArr[] = array("roomid" => $roomid, "roomname" => $roomname, "printer" => $printer, "tables" => $tableArr, "noOfTables" => $numberOfTables);
$roomArr[] = array("roomid" => $roomid, "roomname" => $roomname, "abbreviation" => $abbreviation, "printer" => $printer, "tables" => $tableArr, "noOfTables" => $numberOfTables);
}
echo json_encode(array("status" => "OK", "noOfRooms" => $numberOfRooms, "maxTables" => $maxTables, "roomfield" => $roomArr));

View File

@ -243,6 +243,7 @@ class Basedb {
CREATE TABLE `%room%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`roomname` VARCHAR ( 150 ) NOT NULL,
`abbreviation` VARCHAR (10) NULL,
`printer` INT(2) NULL,
`removed` INT(2) NULL,
`sorting` INT(2) NULL

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.11">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -7,7 +7,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.11">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -7,7 +7,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.11">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -7,7 +7,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.11">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.11">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.11">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.11">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.12">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -81,6 +81,103 @@ var W_UNDELIVERED = ["nicht serviert (+ unbezahlt)","not served (and unpaid)","n
var W_MOVE_PRODS = ["Produkte verschieben","Move products","Productos a otra mesa"];
var W_NO_PRODS_SELECTED = ["Es wurden keine Produkte ausgewählt!","You have not chosen any products!","No ha seleccionado ningún producto!"];
function Grouping(set,hashFct) {
// initialization during construction of class
this.set = set;
// setting by group()
this.sortedset = [];
this.group = function() {
this.sortedset = [];
for (var i=0;i<this.set.length;i++) {
var anEntry = this.set[i];
if (this.sortedset.length == 0) {
// new value
anEntry["count"] = 1;
anEntry["ids"] = [ anEntry["id"]];
this.sortedset[this.sortedset.length] = anEntry;
} else {
// check if the entry must be added to an existing entry
var hashOfValueToInsert = hashFct(anEntry);
var found = false;
for (j=0;j<this.sortedset.length;j++) {
var existingVal = this.sortedset[j];
var hashOfExistingValue = hashFct(existingVal);
if (hashOfValueToInsert == hashOfExistingValue) {
existingVal["count"] = existingVal["count"] + 1;
// now add the id
var ids = existingVal["ids"];
ids[ids.length] = anEntry["id"];
found = true;
break;
}
}
if (!found) {
// new value
anEntry["count"] = 1;
anEntry["ids"] = [ anEntry["id"]];
this.sortedset[this.sortedset.length] = anEntry;
}
}
}
}
this.outputList = function(outputFct) {
var txt = "";
for (var i=0;i<this.sortedset.length;i++) {
var anEntry = this.sortedset[i];
txt += outputFct(anEntry);
}
return txt;
}
this.getItemsOfRow = function(rowId) {
var anEntrySet = this.sortedset[rowId];
var ids = anEntrySet["ids"];
var items = [];
for (var j=0;j<ids.length;j++) {
var anId = ids[j];
for (var i=0;i<this.set.length;i++) {
var anEntry = this.set[i];
if (anEntry.id==anId) {
items[items.length] = anEntry;
break;
}
}
}
return items;
}
this.popSortedEntry = function(rowId) {
var anEntry = this.sortedset[rowId];
var ids = anEntry["ids"];
var id = ids.pop();
var aSetEntry = this.popSetEntry(id);
this.group();
return aSetEntry;
}
this.popSetEntry = function(id) {
for (var i=0;i<this.set.length;i++) {
var anEntry = this.set[i];
if (anEntry.id==id) {
this.set.splice(i,1);
return anEntry;
}
}
}
this.getSourceSet = function() {
return this.set;
}
this.getGroupedList = function() {
return this.sortedset;
}
}
var lang = 0;
var nextPage = "";
@ -638,12 +735,11 @@ function removeProductFromQueue(queueid,isPaid,isCooking,isReady) {
success : function(text) {
if (text.status != "OK") {
alert (W_REMOVE_ERROR[lang]);
var roomtable_info = $(this).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);
}
var roominfo = $("#typprodpage").data("table-info");
var tableid = roominfo[1];
var urlProdOfTableNotDelivered = "php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&" + "tableid=" + tableid;
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered);
},
error: function( text ) {
alert( "Sorry, Fehler bei Produktentfernung!" );
@ -1483,10 +1579,8 @@ function addProductToNewOrdersList(prodid,extras) {
document.getElementById('audiofile').play();
}
var urlProdOfTableNotDelivered = "php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&"
+ "tableid=" + tableid;
var prodListToFill = "#orderedprod-list-0";
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
var urlProdOfTableNotDelivered = "php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&tableid=" + tableid;
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered);
if (keeptypelevel == 0) {
displayTypesProds(levelOneType,null);
@ -1521,106 +1615,131 @@ function fillTypeProdList_(ref) {
displayTypesProds(ref,null);
}
function createTxtAssignedProd(p) {
var optiontext = "";
if (p.option != '') {
optiontext = "&nbsp;(" + toHtml(p.option) + ")";
}
var status = "";
if (p.isready == '1') {
status += " &#9758";
}
if (p.isCooking == '1') {
status += " &#9832";
}
if (p.isPaid == '1') {
status += " &#9745";
}
return toHtml(p.longname) + optiontext + status + "<br>" + createExtraParagraph(p.extras);
}
function fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill) {
$.getJSON(urlProdOfTableNotDelivered,function(prodOfTable) {
if (prodOfTable.length > 0) {
notDeliveredProdsAvailable = true;
} else {
notDeliveredProdsAvailable = false;
}
var li = "<li data-role=\"list-divider\" data-theme=\"b\" data-role=\"heading\" id='undeliveredheader'>" + W_KIT_BAR[lang] + "</li>";
$.each(prodOfTable, function (i, name) {
var optiontext = "";
if (name.option != '') {
optiontext = "&nbsp;(" + toHtml(name.option) + ")";
}
if (name.isready == '0') {
li += '<li data-theme="c" data-icon="delete" class="notdelprod"><a href="#" id="' + i + '">' + toHtml(name.longname) + optiontext + '</a></li>';
} else {
li += '<li data-theme="f" data-icon="delete" class="notdelprod"><a href="#" id="' + i + '">' + toHtml(name.longname) + optiontext + '</a></li>';
}
});
$("#cancelcodefield").val("");
if (cancelunpaidcode != "") {
if (prodOfTable.length > 0) {
$("#cancelcodearea").show();
} else {
$("#cancelcodearea").hide();
}
} else {
$("#cancelcodearea").hide();
}
$(prodListToFill).empty().append(li).promise().done(function () {
$("#undeliveredheader").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
alert(W_UNDELIV_INFO[lang]);
});
// 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();
if (cancelunpaidcode != "") {
if ($("#cancelcodefield").val() != cancelunpaidcode) {
alert(W_WRONG_PIN[lang]);
return;
}
}
var isReady = prodOfTable[this.id]["isready"];
var isPaid = prodOfTable[this.id]["isPaid"];
var isCooking = prodOfTable[this.id]["isCooking"];
if ((isPaid == "1") && (isReady=="1")) {
var dialogText = "Entfernen?";
var this_elem = this;
areYouSure("Produkt wurde schon zubereitet und bezahlt", dialogText, "Ja", function() {
removeProductFromQueue(prodOfTable[this_elem.id]["queueid"],isPaid,isCooking,isReady);
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
});
} else if (isReady=="1") {
var dialogText = "Entfernen?";
var this_elem = this;
areYouSure("Produkt wurde schon zubereitet.", dialogText, "Ja", function() {
removeProductFromQueue(prodOfTable[this_elem.id]["queueid"],isPaid,isCooking,isReady);
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
});
} else if (isPaid == "1") {
var dialogText = "Entfernen?";
var this_elem = this;
areYouSure("Produkt wurde schon bezahlt.", dialogText, "Ja", function() {
removeProductFromQueue(prodOfTable[this_elem.id]["queueid"],isPaid,isCooking,isReady);
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
});
} else if (isCooking == "1") {
var dialogText = "Entfernen?";
var this_elem = this;
areYouSure("Produkt wird soeben zubereitet.", dialogText, "Ja", function() {
removeProductFromQueue(prodOfTable[this_elem.id]["queueid"],isPaid,isCooking,isReady);
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
});
} else {
removeProductFromQueue(prodOfTable[this.id]["queueid"],isPaid,isCooking,isReady);
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
}
function createListElOfAssignedProd(aProd) {
var count = "";
if("count" in aProd) {
if (aProd["count"] > 1) {
count = aProd["count"] + "x ";
}
}
if (aProd.isready == '0') {
return '<li data-theme="c" data-icon="delete" class="notdelprod"><a href="#" >' + count + createTxtAssignedProd(aProd) + '</a></li>';
} else {
return '<li data-theme="f" data-icon="delete" class="notdelprod"><a href="#" >' + count + createTxtAssignedProd(aProd) + '</a></li>';
}
}
function fillAssignedProdList(assignedProds) {
if (assignedProds.length > 0) {
notDeliveredProdsAvailable = true;
} else {
notDeliveredProdsAvailable = false;
}
$("#cancelcodefield").val("");
if (cancelunpaidcode != "") {
if (assignedProds.length > 0) {
$("#cancelcodearea").show();
} else {
$("#cancelcodearea").hide();
}
} else {
$("#cancelcodearea").hide();
}
var assignedProdsGrouping = new Grouping(assignedProds,createTxtAssignedProd);
assignedProdsGrouping.group();
var listContent = "<li data-role=\"list-divider\" data-theme=\"b\" data-role=\"heading\" id='undeliveredheader'>" + W_KIT_BAR[lang] + "</li>";
listContent += assignedProdsGrouping.outputList(createListElOfAssignedProd);
$("#orderedprod-list-0").html(listContent);
refreshList("#orderedprod-list-0");
$("#undeliveredheader").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
alert(W_UNDELIV_INFO[lang]);
});
bindingOfAssignedProds(assignedProdsGrouping);
}
function bindingOfAssignedProds(assignedProdsGrouping) {
$(".notdelprod").off("click").on("click", "a", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
if (cancelunpaidcode != "") {
if ($("#cancelcodefield").val() != cancelunpaidcode) {
alert(W_WRONG_PIN[lang]);
return;
}
}
var listItem = $(this).closest("li");
var rowIndex = $( "#orderedprod-list-0 li" ).index(listItem) - 1;
var rowEntries = assignedProdsGrouping.getItemsOfRow(rowIndex);
var anEntry = rowEntries[0];
var queueid = anEntry.id;
var isReady = anEntry.isready;
var isPaid = anEntry.isPaid;
var isCooking = anEntry.isCooking;
if ((isPaid == "1") && (isReady=="1")) {
var dialogText = "Entfernen?";
var this_elem = this;
areYouSure("Produkt wurde schon zubereitet und bezahlt", dialogText, "Ja", function() {
removeProductFromQueue(queueid,isPaid,isCooking,isReady);
});
} else if (isReady=="1") {
var dialogText = "Entfernen?";
var this_elem = this;
areYouSure("Produkt wurde schon zubereitet.", dialogText, "Ja", function() {
removeProductFromQueue(queueid,isPaid,isCooking,isReady);
});
refreshList(this);
});
}); // ende json call
} else if (isPaid == "1") {
var dialogText = "Entfernen?";
var this_elem = this;
areYouSure("Produkt wurde schon bezahlt.", dialogText, "Ja", function() {
removeProductFromQueue(queueid,isPaid,isCooking,isReady);
});
} else if (isCooking == "1") {
var dialogText = "Entfernen?";
var this_elem = this;
areYouSure("Produkt wird soeben zubereitet.", dialogText, "Ja", function() {
removeProductFromQueue(queueid,isPaid,isCooking,isReady);
});
} else {
removeProductFromQueue(queueid,isPaid,isCooking,isReady);
}
});
}
function fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered) {
doJsonAjaxAsync("GET", urlProdOfTableNotDelivered, null, fillAssignedProdList);
}
function fillOrderVolume(volume) {
@ -1669,11 +1788,9 @@ $(document).on("pagebeforeshow", "#typprodpage", function () {
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 urlProdOfTableNotDelivered = "php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&tableid=" + tableid;
var prodListToFill = "#orderedprod-list-0";
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,prodListToFill);
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered);
$("#workprint_btn").data("tableid",tableid);
$("#gopaydesk_btn").data("tableid",tableid);
@ -1998,8 +2115,7 @@ function bindSendNewOrdersButton() {
var urlProdOfTableNotDelivered = "php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&"
+ "tableid=" + tableid;
var prodListToFill = "#orderedprod-list-0";
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered,
prodListToFill);
fillNotDeliveredProductsOfATable(urlProdOfTableNotDelivered);
}
function doJsonAjax(getOrPost, url, data, functionToCallIfSuccess, errorMsg) {
$.ajax({