OrderSprinter 1.2.8

This commit is contained in:
Geno 2020-11-19 23:00:18 +01:00
parent 19372fbca8
commit c85966dcbb
30 changed files with 435 additions and 185 deletions

BIN
printserver/OrderSprinterPrintserver.exe Normal file → Executable file

Binary file not shown.

BIN
webapp/OrderSprinterPrintserver.exe Normal file → Executable file

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.2.7">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.8">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
.groupitem{display:-webkit-flex;display:flex;-webkit-flex-flow:row wrap;flex-flow:row wrap;text-align:center;color:white;background-color:Gray;width:100px;height:30px;margin:10px;border:2px solid;border-top-right-radius:2em;border-bottom-right-radius:2em;padding:20px;color:black;font-weight:bold;text-align:center;box-shadow:10px 10px 5px #888}.groupitemchoice{background-color:#ffece4;width:100px;height:30px;margin:10px;border-radius:2px;border:2px solid #73ad21;padding:20px;color:black;font-weight:bold;text-align:center;box-shadow:10px 10px 5px #888}.groupitemchoiceselected{background-color:#ddece4;width:100px;height:30px;margin:10px;border-radius:2px;border:2px solid red;padding:20px;color:black;font-weight:bold;text-align:center;box-shadow:10px 10px 5px #888}
.groupitem{display:-webkit-flex;display:flex;-webkit-flex-flow:row wrap;flex-flow:row wrap;text-align:center;color:white;background-color:Gray;width:100px;height:30px;margin:10px;border:2px solid;border-top-right-radius:2em;border-bottom-right-radius:2em;padding:20px;color:black;font-weight:bold;text-align:center;box-shadow:10px 10px 5px #888;word-wrap:break-word;white-space:pre-line;overflow:hidden}.groupitemchoice{background-color:#ffece4;width:100px;height:30px;margin:10px;border-radius:2px;border:2px solid #73ad21;padding:20px;color:black;font-weight:bold;text-align:center;box-shadow:10px 10px 5px #888;word-wrap:break-word;white-space:pre-line;overflow:hidden}.groupitemchoiceselected{background-color:#ddece4;width:100px;height:30px;margin:10px;border-radius:2px;border:2px solid red;padding:20px;color:black;font-weight:bold;text-align:center;box-shadow:10px 10px 5px #888;word-wrap:break-word;white-space:pre-line;overflow:hidden}

View File

@ -1 +1 @@
html{overflow-y:scroll}.ospage{display:-webkit-flex;display:flex;-webkit-flex-flow:row wrap;flex-flow:row wrap;text-align:center;color:white}.ospage>*{padding:10px;flex:100%}.main{text-align:left;background:cornflowerblue;-webkit-flex:5;flex:5;-webkit-flex-flow:nowrap;flex-flow:nowrap}.header{background:black}.footer{display:-webkit-flex;display:flex;-webkit-justify-content:center;justify-content:center;-webkit-flex-wrap:row nowrap;flex-flow:row nowrap;background:black;-webkit-align-items:stretch;align-items:stretch}#loggedinuser{text-align:left;width:50%}#versioninfo{text-align:right;color:white;width:50%}.aside1{background:moccasin;color:black;width:0;-webkit-flex:2;flex:2}.aside2{background:violet;-webkit-flex:1;flex:1}@media all and (min-width:400px){.aside1{order:1}.main{order:2}.aside2{order:3}.ordereditem-sentcontainer{order:4}.footer{order:5}}.input100{width:100%;height:50px}.input50{width:49%;height:50px}.inputwhite[type="text"]{background-color:white}.inputwhite[type="submit"]{background-color:white}.inputgreen[type="text"]{background-color:#0f0}.inputgreen[type="submit"]{background-color:#0f0}.inputblue[type="text"]{background-color:#8ee5ee}.inputblue[type="submit"]{background-color:#8ee5ee}.infoarea{width:49%;background-color:#afa;color:black;font-weight:bold;font-size:20px;display:-webkit-flex;display:flex;-webkit-justify-content:center;justify-content:center;-webkit-align-items:center;align-items:center;border:2px solid red}.mainmenuchoice{list-style-type:none;padding:0;border:1px solid #ddd}.mainmenuitem{padding:8px 16px;border-bottom:1px solid #ddd;background-color:#fff6b5;height:40px;font-size:16px;font-weight:bold}.mainmenuitem:hover{background-color:#eed33f}.extraitem:last-child{border-bottom:0}#loggedinuser{color:black}.buttonarea{box-shadow:10px 10px 5px #888}
html{overflow-y:scroll}.ospage{display:-webkit-flex;display:flex;-webkit-flex-flow:row wrap;flex-flow:row wrap;text-align:center;color:white}.ospage>*{padding:10px;flex:100%}.main{text-align:left;background:cornflowerblue;-webkit-flex:5;flex:5;-webkit-flex-flow:nowrap;flex-flow:nowrap}.header{background:black}.footer{display:-webkit-flex;display:flex;-webkit-justify-content:center;justify-content:center;-webkit-flex-wrap:row nowrap;flex-flow:row nowrap;background:black;-webkit-align-items:stretch;align-items:stretch}#loggedinuser{text-align:left;width:50%}#versioninfo{text-align:right;color:white;width:50%}.aside1{background:moccasin;color:black;width:0;-webkit-flex:2;flex:2}.aside2{background:violet;-webkit-flex:1;flex:1}@media all and (min-width:400px){.aside1{order:1}.main{order:2}.aside2{order:3}.ordereditem-sentcontainer{order:4}.footer{order:5}}.input100{width:100%;height:50px;font-weight:bold;text-align:center}.input50{width:49%;height:50px;font-weight:bold;text-align:center}.inputwhite[type="text"]{background-color:white}.inputwhite[type="submit"]{background-color:white}.inputgreen[type="text"]{background-color:#0f0}.inputgreen[type="submit"]{background-color:#0f0}.inputblue[type="text"]{background-color:#8ee5ee}.inputblue[type="submit"]{background-color:#8ee5ee}.infoarea{width:49%;background-color:#afa;color:black;font-weight:bold;font-size:20px;display:-webkit-flex;display:flex;-webkit-justify-content:center;justify-content:center;-webkit-align-items:center;align-items:center;border:2px solid red}.mainmenuchoice{list-style-type:none;padding:0;border:1px solid #ddd}.mainmenuitem{padding:8px 16px;border-bottom:1px solid #ddd;background-color:#fff6b5;height:40px;font-size:16px;font-weight:bold}.mainmenuitem:hover{background-color:#eed33f}.extraitem:last-child{border-bottom:0}#loggedinuser{color:black}.buttonarea{box-shadow:10px 10px 5px #888}

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.2.7">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.8">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -6,8 +6,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.2.7">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.2.7">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.8">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.2.8">
<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.2.7</button>
<button id="updatebtn">Update -> 1.2.8</button>
</td>
<td>&nbsp;</td>
</tr>

View File

@ -1384,6 +1384,27 @@ return true;
} catch (PDOException $e) {
return false;
}
}
function updateUserTable1207_1208($prefix, $version, $dbname) {
$pdo = $this->pdo;
try {
if ($version != "1.2.7") {
$ret = $this->updateUserTable1206_1207($prefix, $version, $dbname);
if (!$ret) {
return false;
}
}
DbUtils::overrulePrefix($prefix);
$this->basedb->createLogTable($pdo);
$this->updateVersion($pdo, '1.2.8');
return true;
} catch (PDOException $e) {
return false;
}
}
function setVersion($prefix,$theVersion) {
@ -1444,6 +1465,7 @@ $this->basedb->setTimeZone($timezone);
$this->basedb->dropTables($pdo);
$this->basedb->createLogTable($pdo);
$this->basedb->createRatingsTable($pdo);
$this->createPaymentTable($pdo);
$this->basedb->createUserTable($pdo);
@ -1498,7 +1520,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.2.7')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.2.8')");
$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')");
@ -1867,7 +1889,7 @@ $zones[] = $timezone_identifiers[$i];
echo json_encode($zones);
} else if ($command == 'update') {
$installerVersion = "1.2.7";
$installerVersion = "1.2.8";
$admin = new InstallAdmin();
$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']);
@ -1897,7 +1919,7 @@ $supportedVersions = array("1.0.22","1.0.23","1.0.24","1.0.25","1.0.26","1.0.27"
"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","1.1.12","1.1.13","1.1.14","1.1.15","1.1.16","1.1.17",
"1.1.18","1.1.19","1.1.20","1.1.21","1.1.22","1.1.23","1.1.24","1.1.25","1.1.26","1.1.27","1.1.28","1.1.29","1.1.30",
"1.2.0","1.2.1","1.2.2", "1.2.3", "1.2.4","1.2.5","1.2.6"
"1.2.0","1.2.1","1.2.2", "1.2.3", "1.2.4","1.2.5","1.2.6","1.2.7"
);
if (!in_array($version, $supportedVersions)) {
@ -1905,7 +1927,7 @@ echo json_encode("Quellversion nicht unterstützt");
return;
}
$ret = $admin->updateUserTable1206_1207($_POST['prefix'], $version, $_POST['db']);
$ret = $admin->updateUserTable1207_1208($_POST['prefix'], $version, $_POST['db']);
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.2.7">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.8">
<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.2.7">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.8">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -888,16 +888,27 @@ function isNumeric(n) {
function startCreateClosing(remark) {
if (unpaidTables.length == "") {
hideClosingBtn();
doAjax("POST","php/contenthandler.php?module=closing&command=createClosing",{ remark: remark },createClosing,"Tagesabschluss");
} else {
areYouSure("Tageserfassung", MAN_UNPAID1[lang] + unpaidTables + ". " + MAN_UNPAID2[lang], MAN_YES[lang], function() {
doAjax("POST","php/contenthandler.php?module=closing&command=createClosing",{ remark: remark },createClosing,"Tagesabschluss");
});
hideClosingBtn();
doAjax("POST","php/contenthandler.php?module=closing&command=createClosing",{ remark: remark },createClosing,"Tagesabschluss");
});
}
}
function hideClosingBtn() {
$("#closingwaiticon").show();
$("#createclosing").hide();
}
function showClosingBtn() {
$("#closingwaiticon").hide();
$("#createclosing").show();
}
function binding() {
$("#createclosing").off("click").on("click", function (e) {
@ -1118,7 +1129,9 @@ function binding() {
window.open("php/contenthandler.php?module=bill&command=exportPdfReport&" + dateparams,'_blank');
} else if (theId == "createpdfsummary") {
window.open("php/contenthandler.php?module=bill&command=exportPdfSummary&" + dateparams,'_blank');
}
} else if (theId == "createlogexport") {
window.open("php/contenthandler.php?module=admin&command=exportLog",'_blank');
}
});
$("#changeroomsize").off("click").on("click", function (e) {
@ -1342,6 +1355,7 @@ function hasChangedData(idOfElem) {
}
function createClosing(closingresult) {
showClosingBtn();
requestUnpaidTables();
setMonthYearSelection();
getLastClosings();
@ -2247,6 +2261,7 @@ $(document).on("pageinit", "#admin-page", function () {
<input type="text" id="remarkfield" value="" data-mini="true" placeholder="Bemerkung" />
<button type="submit" data-theme="f" class="cancelButton" data-icon="plus" id="createclosing">Erstellen</button>
<img id="closingwaiticon" src="php/3rdparty/images/ajax-loader.gif" style="display:none;"/>
<div id=partofclosings>
<div data-role="collapsible" data-theme="d" data-content-theme="d">
@ -2299,6 +2314,7 @@ $(document).on("pageinit", "#admin-page", function () {
<button type="submit" data-theme="f" class="cancelButton exportbtn" data-icon="check" id="createprodexport">Export Produktdaten</button>
<button type="submit" data-theme="f" class="cancelButton exportbtn" data-icon="check" id="createuserexport">Export Benutzerdaten</button>
<button type="submit" data-theme="f" class="cancelButton exportbtn" data-icon="check" id="createconfigexport">Export Konfiguration</button>
<button type="submit" data-theme="f" class="cancelButton exportbtn" data-icon="check" id="createlogexport">Export Log</button>
</form>
</div><!-- Datenexport -->

File diff suppressed because one or more lines are too long

View File

@ -61,6 +61,7 @@ class Admin {
"exportConfigCsv" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("manager_or_admin")),
"exportUserCsv" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("manager_or_admin")),
"exportLog" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("manager_or_admin")),
"setOrderVolume" => array("loggedin" => 1, "isadmin" => 0, "rights" => null),
"setPreferTableMap" => array("loggedin" => 1, "isadmin" => 0, "rights" => null),
"setKeepTypeLevel" => array("loggedin" => 1, "isadmin" => 0, "rights" => null),
@ -217,6 +218,10 @@ class Admin {
if ($this->isCurrentUserAdmin() || $this->hasCurrentUserRight('right_manager')) {
$this->exportUserCsv();
}
} else if ($command == 'exportLog') {
if ($this->isCurrentUserAdmin() || $this->hasCurrentUserRight('right_manager')) {
$this->exportLog();
}
} else if ($command == 'setOrderVolume') {
if ($this->isUserAlreadyLoggedInForPhp()) {
$this->setOrderVolume($_POST['volume']);
@ -1069,7 +1074,7 @@ class Admin {
$view = "preferences.html";
}
echo json_encode($view . "?v=1.2.7");
echo json_encode($view . "?v=1.2.8");
}
}
@ -1286,24 +1291,24 @@ class Admin {
if (!self::isOnlyRatingUser($rights, $right_rating, true)) {
if ($_SESSION['modus'] == 0) {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.2.7"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.2.8"); };
} else {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.2.7"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.2.8"); };
}
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.2.7"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.2.7"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.2.7"); };
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.2.8"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.2.8"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.2.8"); };
if ($_SESSION['modus'] == 0) {
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.2.7"); };
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.2.8"); };
}
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.2.7"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.2.7"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.2.7"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.2.7"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.2.7"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.2.7"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.2.7");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.2.7");
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.2.8"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.2.8"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.2.8"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.2.8"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.2.8"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.2.8"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.2.8");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.2.8");
}
$mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php");
@ -1312,7 +1317,7 @@ class Admin {
$waiterMessage = $this->getMessage(null, "waitermessage");
}
// CAUTION: change version also in config.txt!!!
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.2.7",
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.2.8",
"user" => $currentUser,
"menu" => $mainMenu,
"waitermessage" => $waiterMessage,
@ -1882,6 +1887,16 @@ class Admin {
}
}
private function exportLog() {
header("Content-type: text/plain");
header("Content-Disposition: attachment; filename=server.log");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
header("Expires: 0");
$pdo = DbUtils::openDbAndReturnPdoStatic();
echo CommonUtils::getLog($pdo);
}
private function exportUserCsv() {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$this->writeCsvHeader("datenexport-benutzer.csv");
@ -1958,7 +1973,7 @@ class Admin {
}
private function getAllTablesToBackupRestore() {
return array("closing","logo","printjobs","ratings","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","products","config",
return array("log","closing","logo","printjobs","ratings","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","products","config",
"user","reservations","bill","queue","billproducts","comments","histprod","histconfig","histuser","histactions","hist","extras","extrasprods","queueextras");
}

View File

@ -1,20 +1,20 @@
<?php
// Datenbank-Verbindungsparameter
require_once ('dbutils.php');
// Datenbank-Verbindungsparameter
require_once ('dbutils.php');
require_once ('commonutils.php');
require_once ('admin.php');
require_once ('reports.php');
require_once ('utilities/pdfexport.php');
require_once ('3rdparty/phpexcel/classes/PHPExcel.php');
require_once ('3rdparty/phpexcel/classes/PHPExcel.php');
define('FPDF_FONTPATH','3rdparty/fpdf/font/');
define ('DO_EXCEL',1);
define ('DO_CSV',2);
class Bill {
class Bill {
var $dbutils;
var $t;
var $t;
private $P_SUM = array("Summe:","Sum:","Todo:");
private $P_TOTAL = array("Total","Total","Total");
@ -27,12 +27,12 @@ class Bill {
private $P_NO = array("Anz.", "No.", "Nú.");
private $P_DESCR = array("Beschreibung","Description","Descripción");
private $P_PRICE = array("Preis","Price","Precio");
function __construct() {
function __construct() {
$this->dbutils = new DbUtils();
require_once 'translations.php';
require_once 'translations.php';
}
function handleCommand($command) {
if ($command == 'exportCsv') {
if ($this->hasCurrentUserAdminOrManagerRights()) {
@ -74,12 +74,12 @@ class Bill {
}
if ($command == 'exportCsvOfClosing') {
if ($this->hasCurrentUserAdminOrManagerRights()) {
// yes, we can export the data
$this->exportCsvOfClosing($_GET['closingid'],DO_CSV);
} else {
echo json_encode(array("status" => "ERROR", "code" => ERROR_MANAGER_NOT_AUTHOTRIZED, "msg" => ERROR_MANAGER_NOT_AUTHOTRIZED_MSG));
}
if ($this->hasCurrentUserAdminOrManagerRights()) {
// yes, we can export the data
$this->exportCsvOfClosing($_GET['closingid'],DO_CSV);
} else {
echo json_encode(array("status" => "ERROR", "code" => ERROR_MANAGER_NOT_AUTHOTRIZED, "msg" => ERROR_MANAGER_NOT_AUTHOTRIZED_MSG));
}
return;
}
if ($command == 'exportXlsxOfClosing') {
@ -93,7 +93,11 @@ class Bill {
}
if ($command == 'doCashAction') {
if ($this->hasCurrentUserPaydeskRights()) {
$this->doCashAction($_POST['money']);
$remark = "";
if(isset($_POST["remark"])) {
$remark = $_POST['remark'];
}
$this->doCashAction($_POST['money'],$remark);
} else {
echo json_encode(array("status" => "ERROR", "code" => ERROR_PAYDESK_NOT_AUTHOTRIZED, "msg" => ERROR_PAYDESK_NOT_AUTHOTRIZED_MSG));
}
@ -117,7 +121,7 @@ class Bill {
return;
}
if ($this->hasCurrentUserBillRights()) {
if ($this->hasCurrentUserBillRights()) {
if ($command == 'getLastBillsWithContent') {
$this->getLastBillsWithContent($_GET['day'],$_GET['month'],$_GET['year']);
} else if ($command == 'cancelBill') {
@ -126,18 +130,18 @@ class Bill {
}
} 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 hasCurrentUserBillRights() {
session_start();
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
// no user logged in
return false;
} else {
return ($_SESSION['right_bill']);
}
}
private function hasCurrentUserPaydeskRights() {
@ -150,15 +154,15 @@ class 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']);
}
// 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']);
}
}
function billIsCancelled($pdo,$billid) {
@ -327,19 +331,19 @@ class Bill {
/*
* insert or take out cash money. The direction done by sign of $money value
*/
private function doCashAction($money) {
// current time
date_default_timezone_set(DbUtils::getTimeZone());
private function doCashAction($money,$remark) {
// current time
date_default_timezone_set(DbUtils::getTimeZone());
$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) {
$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
@ -347,21 +351,21 @@ class Bill {
}
if (($sum + floatval($money)) >= 0.0) {
// Test if it is allowed to insert new bill as storno bill or if manipulation has happened
$nextbillid = $this->testForNewBillIdAndUpdateWorkTable($pdo);
if ($nextbillid < 0) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_INCONSISTENT_DB, "msg" => ERROR_INCONSISTENT_DB_MSG));
$pdo->rollBack();
// Test if it is allowed to insert new bill as storno bill or if manipulation has happened
$nextbillid = $this->testForNewBillIdAndUpdateWorkTable($pdo);
if ($nextbillid < 0) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_INCONSISTENT_DB, "msg" => ERROR_INCONSISTENT_DB_MSG));
$pdo->rollBack();
}
$userId = $this->getUserId();
// now calculate the signature for the bill entry
$commonUtils = new CommonUtils();
// now calculate the signature for the bill entry
$commonUtils = new CommonUtils();
$signature = $commonUtils->calcSignatureForBill($pdo,$currentTime, $money, $money, 0.0, $userId);
$sql = "INSERT INTO `%bill%` (`id` , `billdate`,`brutto`,`netto`,`tax`,`tableid`, `status`, `paymentid`,`userid`,`ref`,`signature`) VALUES ( ?, ? , ?,?,?, ?, 'c', ?,?,?,?)";
$sql = "INSERT INTO `%bill%` (`id` , `billdate`,`brutto`,`netto`,`tax`,`tableid`, `status`, `paymentid`,`userid`,`ref`,`reason`,`signature`) VALUES ( ?, ? , ?,?,?, ?, 'c', ?,?,?,?,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($nextbillid,$currentTime,$money,$money,'0.00',-1,1,$userId,NULL,$signature));
$stmt->execute(array($nextbillid,$currentTime,$money,$money,'0.00',-1,1,$userId,NULL,$remark,$signature));
$lastId = $pdo->lastInsertId();
$prevbrutto = 0;
@ -399,11 +403,11 @@ class Bill {
$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();
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$row =$stmt->fetchObject();
if ($row != null) {
if ($row->sumtotal != null) {
if ($row->sumtotal != null) {
$onlyCashByGuests = $row->sumtotal;
}
}
@ -411,13 +415,13 @@ class Bill {
// 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();
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$row =$stmt->fetchObject();
if ($row != null) {
if ($row->sumtotal != null) {
if ($row->sumtotal != null) {
$cashByGuestsAndInsertTakeOut = $row->sumtotal;
}
}
}
echo json_encode(array("guestmoney" => $onlyCashByGuests, "total" => $cashByGuestsAndInsertTakeOut));
}
@ -437,12 +441,12 @@ class Bill {
$l = $genValues['billlanguage'];
$commonUtils = new CommonUtils();
$sql = "SELECT id,billdate,brutto,tableid,closingid,status,host FROM %bill% WHERE tableid >= '0' AND $whenClause ORDER BY id DESC,billdate DESC ";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($startDate,$endDate));
$result = $stmt->fetchAll();
$result = $stmt->fetchAll();
$resultarray = array();
foreach($result as $zeile) {
$theId = $zeile['id'];
@ -451,26 +455,26 @@ class Bill {
return;
}
date_default_timezone_set(DbUtils::getTimeZone());
$date = new DateTime($zeile['billdate']);
$date = new DateTime($zeile['billdate']);
$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'],
"longdate" => $zeile['billdate'],
"shortdate" => $shortdate,
"brutto" => $zeile['brutto'],
"tablename" => $commonUtils->getTableNameFromId($pdo,$zeile['tableid']),
"billcontent" => $this->getBillWithId($pdo,$theId,$l,0),
"isClosed" => $isClosed,
"host" => $zeile['host']
"host" => $zeile['host']
);
$resultarray[] = $arr;
}
$resultarray[] = $arr;
}
// insert also the host-html just in case it is needed
$hosthtml = file_get_contents("../customer/bon-bewirtungsvorlage.html");
@ -481,8 +485,8 @@ class Bill {
}
private function getUserId() {
if(session_id() == '') {
session_start();
if(session_id() == '') {
session_start();
}
return $_SESSION['userid'];
}
@ -494,17 +498,17 @@ class Bill {
*/
private function testForNewBillIdAndUpdateWorkTable($pdo) {
$commonUtils = new CommonUtils();
$sql = "SELECT MAX(id) as maxbillid FROM %bill%";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$row = $stmt->fetchObject();
$nextbillid = intval($row->maxbillid) + 1;
if (!$commonUtils->verifyLastBillId($pdo, $nextbillid)) {
return (-1);
} else {
// ok - then increment that last id in the work table
$sql = "SELECT MAX(id) as maxbillid FROM %bill%";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$row = $stmt->fetchObject();
$nextbillid = intval($row->maxbillid) + 1;
if (!$commonUtils->verifyLastBillId($pdo, $nextbillid)) {
return (-1);
} else {
// ok - then increment that last id in the work table
$commonUtils->setLastBillIdInWorkTable($pdo, $nextbillid);
return $nextbillid;
return $nextbillid;
}
}
@ -601,12 +605,12 @@ class Bill {
* Cancel a bill - set all queue items to not paid and drop the bill entry
*/
private function cancelBill($pdo,$billid,$stornocode,$reason,$doOwnTransaction,$doEcho,$checkStornoCode) {
// current time
date_default_timezone_set(DbUtils::getTimeZone());
// current time
date_default_timezone_set(DbUtils::getTimeZone());
$currentTime = date('Y-m-d H:i:s');
// check if stornocode is correct
$sql = "SELECT count(id) as countid,setting FROM %config% WHERE name='stornocode'";
$sql = "SELECT count(id) as countid,setting FROM %config% WHERE name='stornocode'";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$row = $stmt->fetchObject();
@ -618,7 +622,7 @@ class Bill {
}
return false;
}
$stornocodeInDb = $row->setting;
if ($checkStornoCode) {
@ -636,27 +640,27 @@ class Bill {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_WRONG_NUMERIC_VALUE, "msg" => ERROR_BILL_WRONG_NUMERIC_VALUE_MSG));
}
return false;
}
}
// Do transactional cancel
if ($doOwnTransaction) {
if ($doOwnTransaction) {
$pdo->beginTransaction();
}
// is the bill already closed? In this case no cancel is allowed!
$sql = "SELECT brutto,netto,tax,tableid,closingid,status,paymentid FROM %bill% WHERE id=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($billid));
$row =$stmt->fetchObject();
$closingId = null;
if ($row != null) {
if ($row != null) {
$closingId = $row->closingid;
// save the next data for a copy!
// save the next data for a copy!
$brutto = $row->brutto;
$netto = $row->netto;
$tax = $row->tax;
$tableid = $row->tableid;
$tax = $row->tax;
$tableid = $row->tableid;
$status = $row->status;
$paymentid = $row->paymentid;
}
@ -694,7 +698,7 @@ class Bill {
if ($nextbillid < 0) {
if ($doEcho) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_INCONSISTENT_DB, "msg" => ERROR_INCONSISTENT_DB_MSG));
}
}
if ($doOwnTransaction) {
$pdo->rollBack();
}
@ -702,14 +706,14 @@ class Bill {
}
// 0. find the queueitems that are related to that bill
$sql = "SELECT id FROM %queue% WHERE billid=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$sql = "SELECT id FROM %queue% WHERE billid=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($billid));
$result = $stmt->fetchAll();
$queueIdArray = array();
$result = $stmt->fetchAll();
$queueIdArray = array();
foreach($result as $row) {
$queueIdArray[] = $row['id'];
$queueIdArray[] = $row['id'];
}
// 1. clear connection between queue item and bill
@ -717,17 +721,17 @@ class Bill {
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($billid));
// 2. copy bill with negativ brutto as part of storno
$userIdOfStornoUser = $this->getUserId();
// 2. copy bill with negativ brutto as part of storno
$userIdOfStornoUser = $this->getUserId();
$stornval = 0.0 - floatval($brutto);
$stornonettoval = 0.0 - floatval($netto);
$commonUtils = new CommonUtils();
$commonUtils = new CommonUtils();
$signature = $commonUtils->calcSignatureForBill($pdo,$currentTime, $stornval, $stornonettoval, $tax, $userIdOfStornoUser);
$sql = "INSERT INTO `%bill%` (`id` , `billdate`,`brutto`,`netto`,`tax`,`tableid`, `status`, `paymentid`,`userid`,`ref`,`host`,`signature`) VALUES ( ?, ? , ?, ?,?,?, 's', ?,?,?,?,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($nextbillid,$currentTime,$stornval,$stornonettoval,$tax,$tableid,$paymentid,$userIdOfStornoUser,$billid,0,$signature));
$sql = "INSERT INTO `%bill%` (`id` , `billdate`,`brutto`,`netto`,`tax`,`tableid`, `status`, `paymentid`,`userid`,`ref`,`host`,`signature`) VALUES ( ?, ? , ?, ?,?,?, 's', ?,?,?,?,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($nextbillid,$currentTime,$stornval,$stornonettoval,$tax,$tableid,$paymentid,$userIdOfStornoUser,$billid,0,$signature));
$refIdOfStornoEntry = $pdo->lastInsertId();
$sql = "SELECT brutto,netto,prevbrutto,prevnetto FROM %bill% WHERE id=?";
@ -740,7 +744,7 @@ class Bill {
// 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 = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($refIdOfStornoEntry,$billid));
if (!is_null($reason) && ($reason != "")) {
@ -750,10 +754,10 @@ class Bill {
}
// 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 ( ?,?)";
foreach ($queueIdArray as $aQueueid) {
$billProdsSql = "INSERT INTO `%billproducts%` (`queueid` , `billid`) VALUES ( ?,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($billProdsSql));
$stmt->execute(array($aQueueid,$refIdOfStornoEntry));
$stmt->execute(array($aQueueid,$refIdOfStornoEntry));
}
if ($doOwnTransaction) {
@ -825,11 +829,11 @@ class Bill {
}
private function getDecPoint() {
$sql = "SELECT name,setting FROM %config% WHERE name=?";
$pdo = $this->dbutils->openDbAndReturnPdo();
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array("decpoint"));
$row = $stmt->fetchObject();
$sql = "SELECT name,setting FROM %config% WHERE name=?";
$pdo = $this->dbutils->openDbAndReturnPdo();
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array("decpoint"));
$row = $stmt->fetchObject();
return($row->setting);
}

View File

@ -202,6 +202,8 @@ array(
$newversionavailable = @file_get_contents($url, false, $ctx);
// TODO: has to be forwarded to user to inform him
CommonUtils::keepOnlyLastLog($pdo);
// call plugin after completion of closing
CommonUtils::callPlugin($pdo, "createClosing", "after");
echo json_encode(array("status" => "OK", "msg" => $content));

View File

@ -311,5 +311,43 @@ class CommonUtils {
} catch(Exception $e) { }
return false;
}
public static function log($pdo,$component,$message) {
date_default_timezone_set(DbUtils::getTimeZone());
$currentTime = date('Y-m-d H:i:s');
$sql = "INSERT INTO %log% (date,component,message) VALUES(?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($currentTime,$component,$message));
}
public static function getLog($pdo) {
$sql = "SELECT date,component,message FROM %log%";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$result = $stmt->fetchAll();
$txt = "";
foreach ($result as $aLogLine) {
$txt .= $aLogLine["date"] . ";" . $aLogLine["component"] . ";" . $aLogLine["message"] . "\n";
}
return $txt;
}
public static function getLastLog($pdo) {
$sql = "SELECT date,component,message FROM %log% WHERE DATE_SUB(NOW(),INTERVAL 2 HOUR) <= date";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$result = $stmt->fetchAll();
$txt = "";
foreach ($result as $aLogLine) {
$txt .= $aLogLine["date"] . ";" . $aLogLine["component"] . ";" . $aLogLine["message"] . "\n";
}
return $txt;
}
public static function keepOnlyLastLog($pdo) {
$sql = "DELETE FROM %log% WHERE DATE_SUB(NOW(),INTERVAL 2 HOUR) > date";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
}
}
?>

View File

@ -130,6 +130,7 @@ class DbUtils {
$out = str_replace("%reservations%",$prefix . 'reservations',$out);
$out = str_replace("%logo%",$prefix . 'logo',$out);
$out = str_replace("%log%",$prefix . 'log',$out);
$out = str_replace("%extras%", $prefix . 'extras',$out);
$out = str_replace("%extrasprods%",$prefix . 'extrasprods', $out);
$out = str_replace("%queueextras%",$prefix . 'queueextras', $out);
@ -203,6 +204,5 @@ class DbUtils {
array("col" => 'audio', "hist" => 1),
array("col" => 'removed', "hist" => 0)
);
}
?>

View File

@ -69,6 +69,8 @@ class PrintQueue {
$this->clearprintjobs($pdo);
} else if ($command == 'batchReceiptPrintJob') {
$this->batchReceiptPrintJob($_POST['start'],$_POST['end']);
} else if ($command == 'getLastLog') {
$this->getLastLog($_POST['pass']);
} else {
echo "Kommando nicht erkannt!";
}
@ -100,7 +102,7 @@ class PrintQueue {
header( "Pragma: no-cache" );
header( "Content-Type: text/html; charset=utf8" );
$isCorrect = $this->isPasswordCorrect($md5pass,true);
$isCorrect = $this->isPasswordCorrect(null,$md5pass,true);
if ($isCorrect) {
echo "ok";
} else {
@ -121,6 +123,10 @@ class PrintQueue {
$printInsertSql = "INSERT INTO `%printjobs%` (`id` , `content`,`type`,`printer`) VALUES ( NULL,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($printInsertSql));
$stmt->execute(array($content,intval($kind) + 1,$printer));
$idOfWorkJob = $pdo->lastInsertId();
CommonUtils::log($pdo,"QUEUE","Create work job with id=$idOfWorkJob for tableid $table from user $username of kind $kind for printer=$printer");
}
function getPrintJobOverview($pdo) {
@ -223,6 +229,8 @@ class PrintQueue {
// now get receipt info from bill table
$pdo = $this->dbutils->openDbAndReturnPdo();
CommonUtils::log($pdo, "PRINTQUEUE", "Insert bill with id=$billid for printer=$printer into queue.");
$sql = "SELECT setting FROM %config% WHERE name=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array("addreceipttoprinter"));
@ -259,6 +267,8 @@ class PrintQueue {
$pdo = $this->dbutils->openDbAndReturnPdo();
CommonUtils::log($pdo, "PRINTQUEUE", "Insert closing with id=$closingid for printer=$printer into queue.");
$printInsertSql = "INSERT INTO `%printjobs%` (`id` , `content`,`type`,`printer`) VALUES ( NULL,?,?,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($printInsertSql));
$stmt->execute(array((string)($closingid),'4',$printer));
@ -274,9 +284,11 @@ class PrintQueue {
return $row->setting;
}
function isPasswordCorrect($pass,$verbose) {
function isPasswordCorrect($pdo,$pass,$verbose) {
if (is_null($pdo)) {
$pdo = DbUtils::openDbAndReturnPdoStatic();
}
$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();
@ -363,10 +375,11 @@ class PrintQueue {
}
function getNextClosingPrintJobs($md5pass,$language,$fl=0) {
$isCorrect = $this->isPasswordCorrect($md5pass,false);
$pdo = $this->dbutils->openDbAndReturnPdo();
$isCorrect = $this->isPasswordCorrect($pdo,$md5pass,false);
if ($isCorrect) {
ob_start();
$pdo = $this->dbutils->openDbAndReturnPdo();
$this->saveLastPrintServerAccess($pdo);
$closing = new Closing();
@ -400,13 +413,24 @@ class PrintQueue {
return $row->setting;
}
function getLastLog ($md5pass) {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$isCorrect = $this->isPasswordCorrect($pdo,$md5pass,false);
if ($isCorrect || true) {
echo json_encode(CommonUtils::getLastLog($pdo));
} else {
echo json_encode("Log file from server unavaible due to wrong printcode");
}
}
function getNextReceiptPrintJobs($md5pass,$language,$printers,$fl) {
$isCorrect = $this->isPasswordCorrect($md5pass,false);
$pdo = $this->dbutils->openDbAndReturnPdo();
$isCorrect = $this->isPasswordCorrect($pdo,$md5pass,false);
if ($isCorrect) {
CommonUtils::log($pdo,"PRINTQUEUE", "getReceipts: p=$printers, fl=$fl");
ob_start();
$printersArr = explode ( ',', $printers );
$pdo = $this->dbutils->openDbAndReturnPdo();
$this->saveLastPrintServerAccess($pdo);
$template = $this->getTemplate($pdo, "rectemplate");
@ -425,11 +449,14 @@ class PrintQueue {
$result = $stmt->fetchAll();
CommonUtils::log($pdo,"PRINTQUEUE", "getNextReceiptPrintJobs: retrieve " . count($result) . " jobs");
$billarray = array();
foreach($result as $aBill) {
$printJobId = $aBill['id'];
$aBillId = $aBill["content"];
$printer = $aBill["printer"];
CommonUtils::log($pdo,"PRINTQUEUE", "getNextReceiptPrintJobs: collect bill with id=$aBillId for printer=$printer");
if (in_array($printer, $printersArr)) {
if (is_null($fl)) {
@ -442,7 +469,9 @@ class PrintQueue {
}
echo json_encode($billarray);
ob_end_flush();
CommonUtils::log($pdo,"PRINTQUEUE", "getNextReceiptPrintJobs: sent data to caller");
} else {
CommonUtils::log($pdo,"PRINTQUEUE", "getNextReceiptPrintJobs: Wrong printcode");
echo json_encode(array());
}
}
@ -456,10 +485,11 @@ class PrintQueue {
}
function getNextWorkPrintJobs($md5pass,$theType,$printer,$fl) {
$isCorrect = $this->isPasswordCorrect($md5pass,false);
$pdo = $this->dbutils->openDbAndReturnPdo();
$isCorrect = $this->isPasswordCorrect($pdo,$md5pass,false);
if ($isCorrect) {
$pdo = $this->dbutils->openDbAndReturnPdo();
CommonUtils::log($pdo,"PRINTQUEUE", "getNextWorkPrintJobs: type = $theType, printer = $printer, fl= $fl");
$this->saveLastPrintServerAccess($pdo);
$bigFontWorkReceipt = $this->getBigFontWorkReceiptSetting($pdo);
@ -480,10 +510,12 @@ class PrintQueue {
}
$result = $stmt->fetchAll();
CommonUtils::log($pdo,"PRINTQUEUE", "getNextWorkPrintJobs: retrieve " . count($result) . " jobs");
$workarray = array();
foreach($result as $aWorkJob) {
$aWork = json_decode($aWorkJob["content"]); // is in json format
CommonUtils::log($pdo,"PRINTQUEUE", "getNextWorkPrintJobs: collect work receipt with id=" . $aWorkJob["id"] . " for printer=$printer");
if ($fl >= 2) {
$workarray[] = array("id" => $aWorkJob["id"],"content" => $aWork, "bigfontworkreceipt" => intval($bigFontWorkReceipt), "template" => $template);
} else {
@ -491,16 +523,18 @@ class PrintQueue {
$workarray[] = array("id" => $aWorkJob["id"],"content" => $aWork, "bigfontworkreceipt" => intval($bigFontWorkReceipt));
}
}
CommonUtils::log($pdo,"PRINTQUEUE", "getNextWorkPrintJobs: sent data to caller");
echo json_encode($workarray);
} else {
CommonUtils::log($pdo,"PRINTQUEUE", "getNextWorkPrintJobs: wrong printcode");
echo json_encode(array());
}
}
function deletePrintJob($pass,$id) {
$isCorrect = $this->isPasswordCorrect($pass,false);
$pdo = $this->dbutils->openDbAndReturnPdo();
$isCorrect = $this->isPasswordCorrect($pdo,$pass,false);
if ($isCorrect) {
$pdo = $this->dbutils->openDbAndReturnPdo();
$this->saveLastPrintServerAccess($pdo);
@ -510,6 +544,7 @@ class PrintQueue {
$stmt->execute(array($id));
echo json_encode(array("status" => "OK", "code" => OK, "msg" => "Druckauftrag erfolgreich gelöscht."));
} else {
CommonUtils::log($pdo,"PRINTQUEUE", "deletePrintJob: wrong printcode");
echo json_encode(array("status" => "ERROR", "code" => ERROR_NOT_AUTHOTRIZED, "msg" => ERROR_NOT_AUTHOTRIZED_MSG));
}
}

View File

@ -1717,6 +1717,8 @@ class QueueContent {
CommonUtils::callPlugin($pdo, "createBill", "after");
CommonUtils::log($pdo, "QUEUE", "Created bill with id=$billid from user $userid");
echo json_encode(array("status" => "OK", "msg" => $billInfo));
}

View File

@ -114,6 +114,7 @@ class Basedb {
$out = str_replace("%comments%",$this->prefix . "comments",$out);
$out = str_replace("%reservations%",$this->prefix . "reservations",$out);
$out = str_replace("%logo%",$this->prefix . "logo",$out);
$out = str_replace("%log%",$this->prefix . "log",$out);
$out = str_replace("%extras%",$this->prefix . "extras",$out);
$out = str_replace("%extrasprods%",$this->prefix . "extrasprods", $out);
$out = str_replace("%queueextras%",$this->prefix . "queueextras", $out);
@ -153,6 +154,7 @@ class Basedb {
$this->doSQLcatch($pdo, "drop TABLE `%payment%`");
$this->doSQLcatch($pdo, "drop TABLE `%logo%`");
$this->doSQLcatch($pdo, "drop TABLE `%log%`");
}
function dropTablesNoCatch($pdo) {
@ -186,6 +188,20 @@ class Basedb {
$this->doSQL($pdo, "drop TABLE `%room%`");
$this->doSQL($pdo, "drop TABLE `%payment%`");
$this->doSQL($pdo, "drop TABLE `%logo%`");
$this->doSQL($pdo, "drop TABLE `%log%`");
}
function createLogTable($pdo) {
$sql = "
CREATE TABLE `%log%` (
`id` INT (3) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`date` DATETIME NULL,
`component` VARCHAR ( 20 ) NULL,
`message` VARCHAR ( 500 ) NULL
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb
";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute();
}
function createPaymentTable($pdo) {
@ -708,6 +724,7 @@ class Basedb {
function createEmptyTables($pdo)
{
$this->createLogTable($pdo);
$this->createPaymentTable($pdo);
$this->createUserTable($pdo);
$this->createRoomTable($pdo);

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.2.7">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.8">
<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.2.7">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.8">
<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.2.7">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.8">
<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.2.7">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.8">
<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.2.7">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.8">
<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.2.7">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.8">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -41,6 +41,7 @@ function initializeMainMenu(menuid) {
}
function intervalGetPrinterStatus(seconds) {
doAjax("GET","php/contenthandler.php?module=admin&command=isPrinterServerActive",null,setPrinterStatus,null,true);
var fetchTimer = setInterval(function() {
doAjax("GET","php/contenthandler.php?module=admin&command=isPrinterServerActive",null,setPrinterStatus,null,true);
}, seconds * 1000);

File diff suppressed because one or more lines are too long

View File

@ -1326,6 +1326,8 @@ var W_SELALL = ["Alles auswählen","Select all","Elegir todo"];
var W_UNSELALL = ["Alles abwählen","Unselect all","No elegir nada"];
var W_NO_PRODS_SELECTED = ["Es wurden keine Produkte ausgewählt!","You have not chosen any products!","No ha seleccionado ningún producto!"];
var P_CASHACTION_OK = ["Kassenaktion abgeschlossen.","Action completed.","Acción terminado."];
$(document).ready(function(){
selectedroomindex = null;
productFilter = null;
@ -1336,6 +1338,7 @@ $(document).ready(function(){
getMenuInBackground(60);
getPayments(savePayments);
getHostTemplate();
intervalGetPrinterStatus(5);
});
function savePayments(allPayments) {
@ -1587,6 +1590,7 @@ function displayRightButtons() {
$("#paydeskbtn").show();
}
$("#hostbutton").hide();
$("#cashbutton").hide();
$("#paydeskcash").hide();
$("#paydeskprint").hide();
$("#goorderbtn").hide();
@ -1605,6 +1609,7 @@ function displayRightButtons() {
// REM* paydesk
$("#paydeskbtn").hide();
$("#hostbutton").show();
$("#cashbutton").show();
if (prodsaccounted.length > 0) {
// REM* there are orders so show buttons
$("#paydeskcash").show();
@ -1815,13 +1820,19 @@ function bindActBtn() {
actcount++;
} else if (cmd === "actdiscount1btn") {
actprice = origprice - origprice * discount1/100;
$("#actpricefield").val(actprice.toString().replace(".", decpoint));
} else if (cmd === "actdiscount2btn") {
var modifiedPrice = actprice.toFixed(2).replace(".", decpoint);
$("#actpricefield").val(modifiedPrice);
$("#actpriceinfo").html(modifiedPrice + " " + currency);
} else if (cmd === "actdiscount2btn") {
actprice = origprice - origprice * discount2/100;
$("#actpricefield").val(actprice.toString().replace(".", decpoint));
} else if (cmd === "actdiscount3btn") {
var modifiedPrice = actprice.toFixed(2).replace(".", decpoint);
$("#actpricefield").val(modifiedPrice);
$("#actpriceinfo").html(modifiedPrice + " " + currency);
} else if (cmd === "actdiscount3btn") {
actprice = origprice - origprice * discount3/100;
$("#actpricefield").val(actprice.toString().replace(".", decpoint));
var modifiedPrice = actprice.toFixed(2).replace(".", decpoint);
$("#actpricefield").val(modifiedPrice);
$("#actpriceinfo").html(modifiedPrice + " " + currency);
}
insertDataIntoActDialog();
});
@ -1992,6 +2003,7 @@ function showProductsToPay(answer) {
function displayProdsToPayForTable() {
bindHostButton("#hostbutton");
bindCashButton();
if (prodsToPayList.length == 0) {
$("#oben").html("Keine weiteren Artikel vorhanden.");
} else {
@ -2795,6 +2807,68 @@ function calcSum() {
$("#priceinreceipt2").html(overallbrutto.toFixed(2).replace(".",decpoint) + " " + currency);
}
function bindCashButton() {
$("#cashbutton").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
$("#cashdlg").dialog({
autoOpen: false,
modal: true,
height: 470,
width: 500,
buttons: {
"Abbrechen": function() {$(this).dialog("close"); },
"Einlegen": function() { cashOperation("in"); },
"Entnehmen": function() { cashOperation("out"); }
}
});
$("#cashmoney").val("");
$("#cashremark").val("");
$("#cashdlg").dialog("open");
doAjax("POST", "php/contenthandler.php?module=bill&command=getCashOverviewOfUser", null, insertCashValues, "Fehler Kassenaktion");
$(".ui-dialog-buttonset .ui-button").css("font-weight","bold");
$(".ui-dialog-buttonset .ui-button").css("color","black");
$(".ui-dialog-buttonset .ui-button:nth-child(2)").css("background-color","#e0e0d1");
$(".ui-dialog-buttonset .ui-button:nth-child(2)").css("background-color","#ccff99");
$(".ui-dialog-buttonset .ui-button:nth-child(3)").css("background-color","#ffcc99");
});
}
function insertCashValues(jsonText) {
$("#cashbyguests").html((parseFloat(jsonText.guestmoney).toFixed(2)).replace(".",decpoint));
$("#cashtotal").html((parseFloat(jsonText.total).toFixed(2)).replace(".",decpoint));
}
function cashOperation(direction) {
// REM* is the value of type numeric?
var money = $("#cashmoney").val().replace(",", ".");
if (isNaN(money)) {
alert("Keine Zahl!");
} else {
$("#cashdlg").dialog("close");
var remark = $("#cashremark").val();
if (direction === "out") {
money = 0.0 - parseFloat(money);
}
doAjax("POST", "php/contenthandler.php?module=bill&command=doCashAction", {money: money, remark: remark}, handleCashActionResult, "Fehler Kassenaktion");
}
}
function handleCashActionResult(jsonText) {
if (jsonText.status == "ERROR") {
alert("Fehler " + jsonText.code + ": " + jsonText.msg);
} else if (jsonText.status == "OK") {
alert(P_CASHACTION_OK[lang]);
}
}
function bindHostButton(hostbtnid) {
$("#hostbutton").off("click").on("click", function (e) {
@ -2845,7 +2919,7 @@ function printBill(billid) {
<body>
<div class="ospage">
<header class="header">Kellneransicht (<span id="panelmodetxt">Bestellung</span>)</header>
<header class="header">Kellneransicht (<span id="panelmodetxt">Bestellung</span>) <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></header>
<aside class="aside aside1">
<div class="tablepanel">
@ -2888,6 +2962,7 @@ function printBill(billid) {
<div class="buttonarea">
<input id="mainmenubtn" class="input100 inputwhite"type="submit" value="Hautmenü" />
<input id="paydeskbtn" class="input100 inputwhite"type="submit" value="Kasse" style="display:none;"/><br>
<input id="cashbutton" class="input100 inputwhite"type="submit" style="display:none;" value="Ein-/Auslage" />
<input id="hostbutton" class="input100 inputwhite btnswitchoff"type="submit" style="display:none;" value="Bewirtungsbeleg" />
<input id="paydeskcash" class="input100 inputwhite"type="submit" style="display:none;" value="Zahlung" />
<input id="paydeskprint" class="input100 inputwhite"type="submit" style="display:none;" value="Bondruck" />
@ -2960,5 +3035,21 @@ function printBill(billid) {
</div>
<ul id="productsToMoveList" class="extraschoice"></ul>
</div>
<div id="cashdlg" title="Ein-/Auslage" style="display:none;">
<h3><span id="cashoverviewtxt">Übersicht Kellnerkasse</span></h3>
<p><span id="overviewdetails">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.</span><p>
<p><i><span id="cashsum">Bewirtungseinnahmen:</span></i> <b><span id=cashbyguests></span></b></p>
<p><i><span id="includeowncash">inkl. eigener Kassen-Eingaben/Entnahmen:</span></i> <b><span id=cashtotal></span></b><p>
<div>
<input id="cashmoney" class="input100 inputblue" type="text" placeholder="0,00"/>
</div>
<div>
<input id="cashremark" class="input100 inputblue" type="text" placeholder="Bemerkung"/>
</div>
</div>
</body>
</html>