OrderSprinter 1.1.22

This commit is contained in:
Geno 2020-11-19 22:58:20 +01:00
parent 58cc7c15b2
commit 863683ef23
24 changed files with 205 additions and 40 deletions

Binary file not shown.

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.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.22">
<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.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.22">
<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">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.22">
<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.21">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.1.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.22">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.1.22">
<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.21</button>
<button id="updatebtn">Update -> 1.1.22</button>
</td>
<td>&nbsp;</td>
</tr>

View File

@ -943,6 +943,59 @@ return false;
}
}
function updateUserTable1121_1122($prefix,$version) {
$pdo = $this->pdo;
try {
if ($version != "1.1.21") {
$ret = $this->updateUserTable1120_1121($prefix,$version);
if (!$ret) {
return false;
}
}
$adminCl = new Admin();
DbUtils::overrulePrefix($prefix);
$sql = "INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL,?,?)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('paydeskid','OrderSprinter-1'));
$stmt->execute(array('aeskey','0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20'));
$stmt->execute(array('certificatesn','1234567'));
$sql = "ALTER TABLE %bill% ADD prevbrutto DECIMAL (9,2) NULL AFTER netto";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "ALTER TABLE %bill% ADD prevnetto DECIMAL (9,2) NULL AFTER prevbrutto";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "SELECT IFNULL(MAX(id), 0) as maxid FROM %bill%";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$row = $stmt->fetchObject();
$maxid = $row->maxid;
$sql = "UPDATE %bill% SET prevbrutto=?, prevnetto=? WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array(0,0,1));
for ($i=2;$i<=$maxid;$i++) {
$sql = "SELECT SUM(brutto) as sumbrutto, SUM(netto) as sumnetto FROM %bill% WHERE id<?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($i));
$row = $stmt->fetchObject();
$sql = "UPDATE %bill% SET prevbrutto=?, prevnetto=? WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($row->sumbrutto,$row->sumnetto,$i));
}
$this->updateVersion($pdo, '1.1.22');
return true;
} catch (PDOException $e) {
return false;
}
}
function setVersion($prefix,$theVersion) {
$pdo = $this->pdo;
try {
@ -1014,7 +1067,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.21')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.1.22')");
$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')");
@ -1037,6 +1090,9 @@ $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VAL
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'discount3', '10')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'austria', '0')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'paydeskid', 'OrderSprinter-1')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'aeskey', '0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'certificatesn', '1234567')");
// prepare for later inconsistency check if version is obsolete
date_default_timezone_set($timezone);
@ -1372,7 +1428,7 @@ $zones[] = $timezone_identifiers[$i];
}
echo json_encode($zones);
} else if ($command == 'update') {
$installerVersion = "1.1.21";
$installerVersion = "1.1.22";
$admin = new InstallAdmin();
$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']);
@ -1401,7 +1457,7 @@ $supportedVersions = array("1.0.22","1.0.23","1.0.24","1.0.25","1.0.26","1.0.27"
"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.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.18","1.1.19","1.1.20","1.1.21"
);
if (!in_array($version, $supportedVersions)) {
@ -1409,7 +1465,7 @@ echo json_encode("Quellversion nicht unterstützt");
return;
}
$ret = $admin->updateUserTable1120_1121($_POST['prefix'], $version);
$ret = $admin->updateUserTable1121_1122($_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.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.22">
<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.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.22">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -253,7 +253,13 @@ var MAN_UNPAID1 = ["Es wurden folgende Tische noch nicht abgerechnet: ",
var MAN_UNPAID2 = ["Soll die Tageserfassung vorgenommen werden? In diesem Fall wird die Tisch-Zuweisung der unbezahlten Artikel gelöscht!",
"Do you want to continue create the closing? In this case these products will be unassigned from the tables!",
"Quieres continuar y removar estos productos?"];
var MAN_AUSTRIA_INCOMPLETE = ["Aktuell ist OrderSprinter noch nicht kompatibel mit der RKSV in Österreich!","Currently OrderSprinter is still incompatible with the RKSV in Austria!","De momento OrderSprinter no esta acuerdo con la RKSV en Austria!"];
var MAN_PAYDESKID = ["Kassenidentifikationsnummer","Paydesk ID","Caja identificación"];
var MAN_AESKEY = ["AES256 Schlüssel","AES256 Key","AES256 LLave"];
var MAN_AESKEY_WRONG_LENGTH = ["Ein AES256-Schlüssel muss in Hex-Darstellung 64 Zeichen haben.","An AES256 key requires to have 64 characters in a hex string.", "Una llave de AES256 tiene que contener 64 characteres en forma hex."];
var MAN_AESKEY_NO_HEX = ["Der AES-Schlüssel muss als Hex-Zahl angegeben werden.","The AES key must be specified as hex number","La llava AES tiene que especificado en formato hex."];
var MAN_CERTIFICATE_SN = ["Zertifikatsseriennummer", "Certificate Serial No","Certificado ID"];
var lang = 0;
var generalVals = [12,2,0,3,0,1,1,0,0,1, 0,50,20,10];
@ -295,7 +301,11 @@ var generalValuesSettings = [
["smtpsecure",MAN_SMTPSECURE[lang],"s",6],
["smtpport",MAN_SMTPPORT[lang],"i",0,""],
// // REM Web setting
["webimpressum",MAN_WEBIMPRESSUM[lang],"i",0,""]
["webimpressum",MAN_WEBIMPRESSUM[lang],"i",0,""],
["paydeskid",MAN_PAYDESKID[lang],"i",0,""],
["aeskey",MAN_AESKEY[lang],"i",0,""],
["certificatesn",MAN_CERTIFICATE_SN[lang],"i",0,""]
];
var predef = "";
@ -348,6 +358,11 @@ function setLanguage(l) {
$("#smtppasstxt").html(MAN_SMTPPASS[l]);
$("#smtpporttxt").html(MAN_SMTPPORT[l]);
$("#paydeskidtxt").html(MAN_PAYDESKID[l]);
$("#austriahint").html(MAN_AUSTRIA_INCOMPLETE[l]);
$("#aeskeytxt").html(MAN_AESKEY[l]);
$("#certificatesntxt").html(MAN_CERTIFICATE_SN[l]);
$("#emailbadratingtxt").html(MAN_EMAIL_BAD_RATING[l]);
$("#emailratingcontacttxt").html(MAN_EMAIL_RATING_CONTACT[l]);
@ -505,6 +520,10 @@ function insertGeneralConfigItems(configResult) {
$("#partOfSmtpsecure").html(createSMTPSecure(values.smtpsecure));
$("#smtpport").val(values.smtpport);
$("#paydeskid").val(values.paydeskid);
$("#aeskey").val(values.aeskey);
$("#certificatesn").val(values.certificatesn);
$("#configpart").trigger("create");
} else {
setTimeout(function(){document.location.href = "index.html"},250); // not logged in
@ -876,6 +895,21 @@ function binding() {
needsCheck : aGenConfigEntry[3],
checkTxt : (aGenConfigEntry[3] ? aGenConfigEntry[4] : "")
};
if (entryName == "aeskey") {
var aeskey = $("#aeskey").val().trim();
if (aeskey.length != 64) {
alert(MAN_AESKEY_WRONG_LENGTH[lang]);
return;
}
var isOk = /^[0-9A-F]{64}$/i.test(aeskey);
if (!isOk) {
alert(MAN_AESKEY_NO_HEX[lang]);
return;
}
}
changedEntries[changedEntries.length] = valueElToChange;
}
@ -1068,8 +1102,28 @@ function binding() {
};
doAjax("POST","php/contenthandler.php?module=admin&command=assignTaxes",data,confirmMsg,"Problem Steuersatzzuweisung");
});
$("#configpart").off("collapsibleexpand").on("collapsibleexpand", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
setVisibilityOfAustriaButtons();
});
$("#austria").off("change").on("change", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
setVisibilityOfAustriaButtons();
});
}
function setVisibilityOfAustriaButtons() {
var austriaSelectionBox = $("#austria").find(":selected").val();
if (austriaSelectionBox == 1) {
$("#partIfAustriaEnabled").show();
} else {
$("#partIfAustriaEnabled").hide();
}
}
function confirmMsg (result) {
if (result.status != 'OK') {
@ -2141,6 +2195,22 @@ $(document).on("pageinit", "#admin-page", function () {
<div id="partOfDiscount2"></div>
<div id="partOfDiscount3"></div>
<div id="partOfAustria"></div>
<div id="partIfAustriaEnabled">
<i><b><span id=austriahint></span></b></i>
<div data-role="fieldcontain">
<label for="paydeskid"><span id="paydeskidtxt">Kassenid:</span></label>
<input type="text" value="" data-mini="true" placeholder="OrderSprinter-1" id="paydeskid" data-theme="c" class="genConfigEl"/>
</div>
<div data-role="fieldcontain">
<label for="aeskey"><span id="aeskeytxt">AES-Schlüssel:</span></label>
<input type="text" value="" data-mini="true" placeholder="" id="aeskey" data-theme="c" class="genConfigEl"/>
</div>
<div data-role="fieldcontain">
<label for="certificatesn"><span id="certificatesntxt">Zert.Seriennummer:</span></label>
<input type="text" value="" data-mini="true" placeholder="1234567" id="certificatesn" data-theme="c" class="genConfigEl"/>
</div>
</div>
<button type="submit" data-theme="f" data-icon="check" id="changeConfig">Ändern</button>
</form><!-- Konfiguration -->

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

View File

@ -784,6 +784,10 @@ class Admin {
$smtpport = $this->getConfigItemOrDefault("smtpport",$stmt,"");
}
$paydeskid = $this->getConfigItemOrDefault("paydeskid",$stmt,"");
$aeskey = $this->getConfigItemOrDefault("aeskey",$stmt,"");
$certificatesn = $this->getConfigItemOrDefault("certificatesn", $stmt, "");
$webimpressum = $this->getConfigItemOrDefault("webimpressum",$stmt,"");
restore_error_handler();
@ -810,7 +814,7 @@ class Admin {
"sday" => $now["mday"],"smonth" => $now["mon"], "syear" => $now["year"], "shour" => $now["hours"], "smin" => $now["minutes"],
"smtphost" => $smtphost,"smtpauth" => $smtpauth,"smtpuser" => $smtpuser,"smtppass" => $smtppass,"smtpsecure" => $smtpsecure,"smtpport" => $smtpport,
"webimpressum" => $webimpressum, "cancelunpaidcode" => $cancelunpaidcode, "discount1" => $discount1,"discount2" => $discount2,"discount3" => $discount3,
"austria" => $austria
"austria" => $austria, "paydeskid" => $paydeskid, "aeskey" => $aeskey, "certificatesn" => $certificatesn
);
if ($forHtml) {
@ -1123,19 +1127,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.21"); };
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.1.21"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.1.21"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.1.21"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.1.22"); };
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.1.22"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.1.22"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.1.22"); };
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.21"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.1.21"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.1.21"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.1.21"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.1.21"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.1.21"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.1.21");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.1.21");
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.1.22"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.1.22"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.1.22"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.1.22"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.1.22"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.1.22"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.1.22");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.1.22");
}
$mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php");
@ -1144,7 +1148,7 @@ class Admin {
$waiterMessage = $this->getMessage(null, "waitermessage");
}
// CAUTION: change version also in config.txt!!!
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.1.21",
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.1.22",
"user" => $currentUser,
"menu" => $mainMenu,
"waitermessage" => $waiterMessage,
@ -1359,6 +1363,10 @@ class Admin {
"smtppass" => array("dbcol" => "smtppass","checknum" => 0),
"smtpsecure" => array("dbcol" => "smtpsecure","checknum" => 1),
"smtpport" => array("dbcol" => "smtpport","checknum" => 0),
"paydeskid" => array("dbcol" => "paydeskid","checknum" => 0),
"aeskey" => array("dbcol" => "aeskey","checknum" => 0),
"certificatesn" => array("dbcol" => "certificatesn","checksum" => 0)
);
$problem = false;
foreach ($changedValues as $aChangeSet) {

View File

@ -363,6 +363,19 @@ class Bill {
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($nextbillid,$currentTime,$money,$money,'0.00',-1,1,$userId,NULL,$signature));
$lastId = $pdo->lastInsertId();
$prevbrutto = 0;
$prevnetto = 0;
if ($lastId > 1) {
$sql = "SELECT brutto,prevbrutto,netto,prevnetto FROM %bill% WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($lastId-1));
$row =$stmt->fetchObject();
}
$sql = "UPDATE %bill% SET prevbrutto=?,prevnetto=? WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($row->brutto + $row->prevbrutto,$row->netto + $row->prevnetto,$lastId));
$pdo->commit();
echo json_encode(array("status" => "OK"));
} else {
@ -717,6 +730,14 @@ class Bill {
$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=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($refIdOfStornoEntry-1));
$row =$stmt->fetchObject();
$sql = "UPDATE %bill% set prevbrutto=?,prevnetto=? WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($row->brutto + $row->prevbrutto + $stornval,$row->netto + $row->prevnetto + $stornonettoval,$refIdOfStornoEntry));
// 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));

View File

@ -619,7 +619,7 @@ $sql = "select count(%queue%.productname) as count,%queue%.productname,%queue%.p
$sql .= " from %queue%,%bill% where ";
$sql .= "%queue%.billid=%bill%.id AND %bill%.closingid=? AND ";
$sql .= "%bill%.status is null ";
$sql .= "group by %queue%.productname,%queue%.price";
$sql .= "group by %queue%.productname,%queue%.tax,%queue%.price";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($closingid));

View File

@ -1575,10 +1575,18 @@ class QueueContent {
$stmt->execute();
$numberOfIds = $stmt->rowCount();
$newprevbrutto = 0;
$newprevnetto = 0;
if ($numberOfIds > 0) {
$row =$stmt->fetchObject();
if ($row != null) {
$billid = intval($row->id)+1;
$sql = "SELECT brutto,netto,prevbrutto,prevnetto FROM %bill% WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($row->id));
$row = $stmt->fetchObject();
$newprevbrutto = $row->prevbrutto + $row->brutto;
$newprevnetto = $row->prevnetto + $row->netto;
} else {
echo " - row ist null - ";
$pdo->rollBack();
@ -1605,9 +1613,9 @@ class QueueContent {
// now calculate the signature for the bill entry
$signature = $this->commonUtils->calcSignatureForBill($pdo,$currentTime, $brutto, $netto, '0.00', $userid);
$billInsertSql = "INSERT INTO `%bill%` (`id` , `billdate`,`brutto`,`netto`,`tableid`,`paymentid`,`userid`,`ref`,`tax`,`host`,`signature`) VALUES (?,?,?,?,?,?,?,NULL,NULL,?,?)";
$billInsertSql = "INSERT INTO `%bill%` (`id` , `billdate`,`brutto`,`netto`,`prevbrutto`,`prevnetto`,`tableid`,`paymentid`,`userid`,`ref`,`tax`,`host`,`signature`) VALUES (?,?,?,?,?,?,?,?,?,NULL,NULL,?,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($billInsertSql));
$stmt->execute(array($billid,$currentTime,$brutto,$netto,$tableid,$paymentId,$userid,$host,$signature));
$stmt->execute(array($billid,$currentTime,$brutto,$netto,$newprevbrutto,$newprevnetto,$tableid,$paymentId,$userid,$host,$signature));
// now declare them all to be paid:
for ($i=0;$i<count($ids_array);$i++) {

View File

@ -457,6 +457,8 @@ class Basedb {
`billdate` DATETIME NOT NULL ,
`brutto` DECIMAL (7,2) NULL,
`netto` DECIMAL (7,2) NULL,
`prevbrutto` DECIMAL (9,2) NULL,
`prevnetto` DECIMAL (9,2) NULL,
`tableid` VARCHAR ( 150 ) NOT NULL,
`closingid` INT(4) NULL,
`status` VARCHAR(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.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.22">
<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.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.22">
<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.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.22">
<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.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.22">
<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.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.22">
<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.21">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.1.22">
<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