OrderSprinter 1.2.5

This commit is contained in:
Geno 2020-11-19 23:00:05 +01:00
parent a0a538eb7b
commit 6097495d8d
29 changed files with 404 additions and 230 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 http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel"> <meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.4"> <link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.5">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" /> <link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" /> <link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

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

View File

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

View File

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

View File

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

View File

@ -7,6 +7,7 @@ require_once( "../php/config1.php" );
require_once( "../php/config.php" ); require_once( "../php/config.php" );
} }
require_once ('../php/utilities/basedb.php'); require_once ('../php/utilities/basedb.php');
require_once ('../php/utilities/decimaldefs.php');
require_once ('../php/admin.php'); require_once ('../php/admin.php');
class ConfigWriter { class ConfigWriter {
@ -404,7 +405,7 @@ $sql = "ALTER TABLE %queue% DROP action";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); $stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(); $stmt->execute();
$sql = "ALTER TABLE %queue% ADD tax DECIMAL (5,2) NULL AFTER price"; $sql = "ALTER TABLE %queue% ADD tax " . DECIMALSMALL . " NULL AFTER price";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); $stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(); $stmt->execute();
@ -428,15 +429,15 @@ $sql = "ALTER TABLE %bill% MODIFY tax decimal(5,2) NULL";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); $stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(); $stmt->execute();
$sql = "ALTER TABLE %queue% MODIFY tax DECIMAL (5,2) NOT NULL"; $sql = "ALTER TABLE %queue% MODIFY tax " . DECIMALSMALL . " NOT NULL";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); $stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(); $stmt->execute();
$sql = "ALTER TABLE %products% ADD tax DECIMAL (5,2) NULL AFTER priceC"; $sql = "ALTER TABLE %products% ADD tax " . DECIMALSMALL . " NULL AFTER priceC";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); $stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(); $stmt->execute();
$sql = "ALTER TABLE %histprod% ADD tax DECIMAL (5,2) NULL AFTER priceC"; $sql = "ALTER TABLE %histprod% ADD tax " . DECIMALSMALL . " NULL AFTER priceC";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); $stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(); $stmt->execute();
@ -995,10 +996,10 @@ $stmt->execute(array('paydeskid','OrderSprinter-1'));
$stmt->execute(array('aeskey','0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20')); $stmt->execute(array('aeskey','0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20'));
$stmt->execute(array('certificatesn','1234567')); $stmt->execute(array('certificatesn','1234567'));
$sql = "ALTER TABLE %bill% ADD prevbrutto DECIMAL (9,2) NULL AFTER netto"; $sql = "ALTER TABLE %bill% ADD prevbrutto " . DECIMALBIG . " NULL AFTER netto";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(); $stmt->execute();
$sql = "ALTER TABLE %bill% ADD prevnetto DECIMAL (9,2) NULL AFTER prevbrutto"; $sql = "ALTER TABLE %bill% ADD prevnetto " . DECIMALBIG . " NULL AFTER prevbrutto";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(); $stmt->execute();
@ -1321,6 +1322,30 @@ return true;
} catch (PDOException $e) { } catch (PDOException $e) {
return false; return false;
} }
}
function updateUserTable1204_1205($prefix, $version, $dbname) {
$pdo = $this->pdo;
try {
if ($version != "1.2.4") {
$ret = $this->updateUserTable1203_1204($prefix, $version, $dbname);
if (!$ret) {
return false;
}
}
DbUtils::overrulePrefix($prefix);
$sql = "INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL,?,?)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('oneprodworkreceipts',0));
$stmt->execute(array('digiprintwork',1));
$this->updateVersion($pdo, '1.2.5');
return true;
} catch (PDOException $e) {
return false;
}
} }
function setVersion($prefix,$theVersion) { function setVersion($prefix,$theVersion) {
@ -1435,7 +1460,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 , '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 , '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 , 'receiptfontsize', '12')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.2.4')"); $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.2.5')");
$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 , '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 , 'remoteaccesscode', null)");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'decpoint', '$decpoint')"); $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'decpoint', '$decpoint')");
@ -1466,6 +1491,9 @@ $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VAL
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'digigopaysetready', '1')"); $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'digigopaysetready', '1')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'waitergopayprint', '0')"); $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'waitergopayprint', '0')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'oneprodworkreceipts', '0')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'digiprintwork', '1')");
// prepare for later inconsistency check if version is obsolete // prepare for later inconsistency check if version is obsolete
date_default_timezone_set($timezone); date_default_timezone_set($timezone);
$installDate = date('Y-m-d H:i:s'); $installDate = date('Y-m-d H:i:s');
@ -1800,7 +1828,8 @@ $zones[] = $timezone_identifiers[$i];
} }
echo json_encode($zones); echo json_encode($zones);
} else if ($command == 'update') { } else if ($command == 'update') {
$installerVersion = "1.2.4";
$installerVersion = "1.2.5";
$admin = new InstallAdmin(); $admin = new InstallAdmin();
$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']); $pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']);
@ -1830,7 +1859,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.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.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.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.0","1.2.1","1.2.2", "1.2.3", "1.2.4"
); );
if (!in_array($version, $supportedVersions)) { if (!in_array($version, $supportedVersions)) {
@ -1838,7 +1867,7 @@ echo json_encode("Quellversion nicht unterstützt");
return; return;
} }
$ret = $admin->updateUserTable1203_1204($_POST['prefix'], $version, $_POST['db']); $ret = $admin->updateUserTable1204_1205($_POST['prefix'], $version, $_POST['db']);
if(session_id() == '') { if(session_id() == '') {
session_start(); session_start();

View File

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

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel"> <meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.4"> <link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.5">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" /> <link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" /> <link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -143,6 +143,11 @@ var MAN_DIGI_GOPAY_DESCR = ["Im Arbeitsablauf 'nur digital' bestimmt diese Einst
"In the 'only digital' workflow this setting specifies if after pressing the 'paydesk' button in the waiter's view and paying the products shall be handled as served.", "In the 'only digital' workflow this setting specifies if after pressing the 'paydesk' button in the waiter's view and paying the products shall be handled as served.",
"En el modus 'digital' este boton especifica si los productos deben declarados como servidos despues pagar por click en el boton 'caja' en la vista de camarero."]; "En el modus 'digital' este boton especifica si los productos deben declarados como servidos despues pagar por click en el boton 'caja' en la vista de camarero."];
var MAN_WAITER_GOPAY_PRINT = ["Bestell-Kassenbutton druckt Arbeitsbons","Waiter's paydesk button prints also work receipts","Boton caja en vista de camarero imprime también tiquets de trabajo"]; var MAN_WAITER_GOPAY_PRINT = ["Bestell-Kassenbutton druckt Arbeitsbons","Waiter's paydesk button prints also work receipts","Boton caja en vista de camarero imprime también tiquets de trabajo"];
var MAN_ONE_PROD_WORKREC = ["Nur ein Produkt pro Arbeitsbon","Max. one product on a work receipt","Sólo un producto en un tique de trabajo"];
var MAN_DIGI_PRINTWORK = ["Arbeitsbons in Küchen-/Baransicht","Work receipts in kitchen/bar view","Tiques de trabajo en modulo de cocina"];
var MAN_DIGI_PRINTWORK_HINT = ["Sollen Arbeitsbon erstellt werden, wenn in der Küchen-/Baransicht Produkte als zubereitet markiert werden?",
"Shall work receipts be printed if products are declared cooked in the kitchen or bar view?",
"Imprimir tiques de trabajo si productos estan declarados cocinados en el module cocina or bar?"];
var MAN_WAITER_GOPAY_DESCR = ["Im Arbeitsablauf 'nur Arbeitsbons' bestimmt diese Einstellung, ob bei Druck auf den Button 'Kasse' Arbeitsbons gedruckt werden sollen.", var MAN_WAITER_GOPAY_DESCR = ["Im Arbeitsablauf 'nur Arbeitsbons' bestimmt diese Einstellung, ob bei Druck auf den Button 'Kasse' Arbeitsbons gedruckt werden sollen.",
"In the 'only work receipts' workflow this setting specifies if after pressing the 'paydesk' button in the waiter's view work receipts shall be printed.", "In the 'only work receipts' workflow this setting specifies if after pressing the 'paydesk' button in the waiter's view work receipts shall be printed.",
"En el modus 'solo tiques de trabajar' este boton especifica se debe imprimido el tique de trabajar despues el click en el boton 'caja' en la vista de camarero."]; "En el modus 'solo tiques de trabajar' este boton especifica se debe imprimido el tique de trabajar despues el click en el boton 'caja' en la vista de camarero."];
@ -290,7 +295,7 @@ var MAN_CONFIRM_GO_LIVE = ["Die Umsatz- und Logdaten wurden gelöscht und nur di
"La configuración esta re-creado. Entonces es necesario registrar de nuevo."]; "La configuración esta re-creado. Entonces es necesario registrar de nuevo."];
var lang = 0; var lang = 0;
var generalVals = [12,2,0,3,0,1,1,0,0,1, 0,50,20,10,1,0,0]; var generalVals = [12,2,0,3,0,1,1,0,0,1, 0,50,20,10,1,0,0,0,1];
var numberOfClosings = 0; var numberOfClosings = 0;
@ -321,6 +326,8 @@ var generalValuesSettings = [
["austria",MAN_AUSTRIA[lang],"s",10], ["austria",MAN_AUSTRIA[lang],"s",10],
["digigopaysetready",MAN_DIGI_GOPAY_SET_READY[lang],"s",14], ["digigopaysetready",MAN_DIGI_GOPAY_SET_READY[lang],"s",14],
["waitergopayprint",MAN_WAITER_GOPAY_PRINT[lang],"s",15], ["waitergopayprint",MAN_WAITER_GOPAY_PRINT[lang],"s",15],
["oneprodworkreceipts",MAN_ONE_PROD_WORKREC[lang],"s",17],
["digiprintwork",MAN_DIGI_PRINTWORK[lang],"s",18],
["addreceipttoprinter",MAN_ADD_RECPRINTER[lang],"s",16], ["addreceipttoprinter",MAN_ADD_RECPRINTER[lang],"s",16],
["workflowconfig",MAN_WORKFLOW[lang],"s",4], ["workflowconfig",MAN_WORKFLOW[lang],"s",4],
["receiptfontsize",MAN_RECEIPT_FONTSIZE[lang],"s",0], ["receiptfontsize",MAN_RECEIPT_FONTSIZE[lang],"s",0],
@ -442,6 +449,8 @@ function setLanguage(l) {
$("#rectemplatehint").html(MAN_RECTEMPLATE_HINT[l]); $("#rectemplatehint").html(MAN_RECTEMPLATE_HINT[l]);
$("#foodtemplatehint").html(MAN_FOODTEMPLATE_HINT[l]); $("#foodtemplatehint").html(MAN_FOODTEMPLATE_HINT[l]);
$("#drinktemplatehint").html(MAN_DRINKTEMPLATE_HINT[l]); $("#drinktemplatehint").html(MAN_DRINKTEMPLATE_HINT[l]);
$("#digiprinthint").html(MAN_DIGI_PRINTWORK_HINT[l]);
} }
function createMonthSelection(label) { function createMonthSelection(label) {
@ -537,6 +546,8 @@ function insertGeneralConfigItems(configResult) {
$("#partOfAustria").html(createAustriaPart(values.austria)); $("#partOfAustria").html(createAustriaPart(values.austria));
$("#partOfDigigopaysetready").html(createDigigopaysetready(values.digigopaysetready)); $("#partOfDigigopaysetready").html(createDigigopaysetready(values.digigopaysetready));
$("#partOfWaitergopayprint").html(createWaitergopayprint(values.waitergopayprint)); $("#partOfWaitergopayprint").html(createWaitergopayprint(values.waitergopayprint));
$("#partOfOneprodworkreceipts").html(createOneprodworkreceipts(values.oneprodworkreceipts));
$("#partOfDigiprintwork").html(createDigiprintwork(values.digiprintwork));
var language = values.billlanguage; var language = values.billlanguage;
generalVals[2] = language; generalVals[2] = language;
@ -573,6 +584,8 @@ function insertGeneralConfigItems(configResult) {
generalVals[10] = values.austria; generalVals[10] = values.austria;
generalVals[14] = values.digigopaysetready; generalVals[14] = values.digigopaysetready;
generalVals[15] = values.waitergopayprint; generalVals[15] = values.waitergopayprint;
generalVals[17] = values.oneprodworkreceipts;
generalVals[18] = values.digiprintwork;
$("#smtphost").val(values.smtphost); $("#smtphost").val(values.smtphost);
$("#partOfSmtpauth").html(createSMTPAuth(values.smtpauth)); $("#partOfSmtpauth").html(createSMTPAuth(values.smtpauth));
@ -612,7 +625,7 @@ function createReceiptFontPart() {
html += '<label for="receiptfontsize">' + MAN_RECEIPT_FONTSIZE[lang] + ':</label>'; html += '<label for="receiptfontsize">' + MAN_RECEIPT_FONTSIZE[lang] + ':</label>';
html += '<select name="receiptfontsize" id="receiptfontsize" data-theme="e">'; html += '<select name="receiptfontsize" id="receiptfontsize" data-theme="e">';
for($i=7;$i<=14;$i++) { for($i=7;$i<=18;$i++) {
html += '<option value="' + $i + '"' + isSelectedOption($i,generalVals[0]) + '>' + $i + '</option>'; html += '<option value="' + $i + '"' + isSelectedOption($i,generalVals[0]) + '>' + $i + '</option>';
} }
@ -705,7 +718,12 @@ function createDigigopaysetready(theValue) {
function createWaitergopayprint(theValue) { function createWaitergopayprint(theValue) {
return createYesNo("waitergopayprint",MAN_WAITER_GOPAY_PRINT, theValue); return createYesNo("waitergopayprint",MAN_WAITER_GOPAY_PRINT, theValue);
} }
function createOneprodworkreceipts(theValue) {
return createYesNo("oneprodworkreceipts",MAN_ONE_PROD_WORKREC, theValue);
}
function createDigiprintwork(theValue) {
return createYesNo("digiprintwork",MAN_DIGI_PRINTWORK,theValue);
}
function createGroupWorkItemsPart(theValue) { function createGroupWorkItemsPart(theValue) {
return createYesNo("groupworkitems", MAN_GROUP_WORK_ITEMS, theValue); return createYesNo("groupworkitems", MAN_GROUP_WORK_ITEMS, theValue);
} }
@ -2404,6 +2422,11 @@ $(document).on("pageinit", "#admin-page", function () {
<div id="partOfWaitergopayprint"></div> <div id="partOfWaitergopayprint"></div>
<span id=waitergopayprinthint></span> <span id=waitergopayprinthint></span>
</div> </div>
<div id="partOfDigiprintworkContainer">
<div id="partOfDigiprintwork"></div>
<i id=digiprinthint style="padding-left: 50px;padding-right: 50px;">Hinweis: siehe Anleitung</i>
</div>
<div id="partOfOneprodworkreceipts"></div>
<div id="partOfBigFontWorkReceipt"></div> <div id="partOfBigFontWorkReceipt"></div>
<div id="partOfProminentSearch"></div> <div id="partOfProminentSearch"></div>
<div id="partOfGroupWorkItems"></div> <div id="partOfGroupWorkItems"></div>

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,7 @@ require_once ('utilities/TypeAndProducts/TypeAndProductFileManager.php');
require_once ('utilities/userrights.php'); require_once ('utilities/userrights.php');
require_once ('utilities/HistFiller.php'); require_once ('utilities/HistFiller.php');
require_once ('utilities/basedb.php'); require_once ('utilities/basedb.php');
require_once ('utilities/decimaldefs.php');
require_once ('utilities/sorter.php'); require_once ('utilities/sorter.php');
require_once ('utilities/Logger.php'); require_once ('utilities/Logger.php');
require_once ('utilities/Emailer.php'); require_once ('utilities/Emailer.php');
@ -830,6 +831,20 @@ class Admin {
$waitergopayprint = 0; $waitergopayprint = 0;
} }
$stmt->execute(array("oneprodworkreceipts"));
$row = $stmt->fetchObject();
$oneprodworkreceipts = $row->setting;
if (is_null($oneprodworkreceipts)) {
$oneprodworkreceipts = 0;
}
$stmt->execute(array("digiprintwork"));
$row = $stmt->fetchObject();
$digiprintwork = $row->setting;
if (is_null($digiprintwork)) {
$digiprintwork = 1;
}
$stmt->execute(array("groupworkitems")); $stmt->execute(array("groupworkitems"));
$row = $stmt->fetchObject(); $row = $stmt->fetchObject();
$groupworkitems = $row->setting; $groupworkitems = $row->setting;
@ -939,7 +954,8 @@ class Admin {
"sday" => $now["mday"],"smonth" => $now["mon"], "syear" => $now["year"], "shour" => $now["hours"], "smin" => $now["minutes"], "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, "smtphost" => $smtphost,"smtpauth" => $smtpauth,"smtpuser" => $smtpuser,"smtppass" => $smtppass,"smtpsecure" => $smtpsecure,"smtpport" => $smtpport,
"webimpressum" => $webimpressum, "cancelunpaidcode" => $cancelunpaidcode, "discount1" => $discount1,"discount2" => $discount2,"discount3" => $discount3, "webimpressum" => $webimpressum, "cancelunpaidcode" => $cancelunpaidcode, "discount1" => $discount1,"discount2" => $discount2,"discount3" => $discount3,
"austria" => $austria, "digigopaysetready" => $digigopaysetready, "waitergopayprint" => $waitergopayprint, "austria" => $austria, "digigopaysetready" => $digigopaysetready, "waitergopayprint" => $waitergopayprint, "oneprodworkreceipts" => $oneprodworkreceipts,
"digiprintwork" => $digiprintwork,
"paydeskid" => $paydeskid, "aeskey" => $aeskey, "certificatesn" => $certificatesn, "addreceipttoprinter" => $addreceipttoprinter "paydeskid" => $paydeskid, "aeskey" => $aeskey, "certificatesn" => $certificatesn, "addreceipttoprinter" => $addreceipttoprinter
); );
@ -1037,7 +1053,7 @@ class Admin {
$view = "preferences.html"; $view = "preferences.html";
} }
echo json_encode($view . "?v=1.2.4"); echo json_encode($view . "?v=1.2.5");
} }
} }
@ -1176,11 +1192,7 @@ class Admin {
$speisekartenHandler = new TypeAndProductFileManager(); $speisekartenHandler = new TypeAndProductFileManager();
$ret = $speisekartenHandler->manageSpeisekarte($pdo,$speisekarte); $ret = $speisekartenHandler->manageSpeisekarte($pdo,$speisekarte);
if ($ret["status"] == "OK") {
$sorter = new Sorter();
$sorter->initSortCurrentProductTable($pdo);
}
return $ret; return $ret;
} }
@ -1251,19 +1263,19 @@ class Admin {
$right_rating = $_SESSION['right_rating']; $right_rating = $_SESSION['right_rating'];
if (!self::isOnlyRatingUser($rights, $right_rating, true)) { if (!self::isOnlyRatingUser($rights, $right_rating, true)) {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.2.4"); }; if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.2.5"); };
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.2.4"); }; if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.2.5"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.2.4"); }; if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.2.5"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.2.4"); }; if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.2.5"); };
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.2.4"); }; if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.2.5"); };
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.2.4"); }; if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.2.5"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.2.4"); }; if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.2.5"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.2.4"); }; if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.2.5"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.2.4"); }; if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.2.5"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.2.4"); }; if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.2.5"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.2.4"); }; if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.2.5"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.2.4"); $mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.2.5");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.2.4"); $mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.2.5");
} }
$mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php"); $mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php");
@ -1272,7 +1284,7 @@ class Admin {
$waiterMessage = $this->getMessage(null, "waitermessage"); $waiterMessage = $this->getMessage(null, "waitermessage");
} }
// CAUTION: change version also in config.txt!!! // CAUTION: change version also in config.txt!!!
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.2.4", $mainMenuAndVersion = array ("version" => "OrderSprinter 1.2.5",
"user" => $currentUser, "user" => $currentUser,
"menu" => $mainMenu, "menu" => $mainMenu,
"waitermessage" => $waiterMessage, "waitermessage" => $waiterMessage,
@ -1499,6 +1511,8 @@ class Admin {
"austria" => array("dbcol" => "austria","checknum" => 0), "austria" => array("dbcol" => "austria","checknum" => 0),
"digigopaysetready" => array("dbcol" => "digigopaysetready","checknum" => 0), "digigopaysetready" => array("dbcol" => "digigopaysetready","checknum" => 0),
"waitergopayprint" => array("dbcol" => "waitergopayprint","checknum" => 0), "waitergopayprint" => array("dbcol" => "waitergopayprint","checknum" => 0),
"oneprodworkreceipts" => array("dbcol" => "oneprodworkreceipts","checknum" => 0),
"digiprintwork" => array("dbcol" => "digiprintwork","checknum" => 0),
"groupworkitems" => array("dbcol" => "groupworkitems","checknum" => 0), "groupworkitems" => array("dbcol" => "groupworkitems","checknum" => 0),
"workflowconfig" => array("dbcol" => "workflowconfig","checknum" => 0), "workflowconfig" => array("dbcol" => "workflowconfig","checknum" => 0),
"receiptfontsize" => array("dbcol" => "receiptfontsize","checknum" => 0), "receiptfontsize" => array("dbcol" => "receiptfontsize","checknum" => 0),

View File

@ -79,6 +79,11 @@ $closingTime = date('Y-m-d H:i:s');
$pdo = $this->dbutils->openDbAndReturnPdo(); $pdo = $this->dbutils->openDbAndReturnPdo();
$pdo->beginTransaction(); $pdo->beginTransaction();
if (CommonUtils::callPlugin($pdo, "createClosing", "replace")) {
return;
}
CommonUtils::callPlugin($pdo, "createClosing", "before");
$closingEntrySql = "INSERT INTO `%closing%` (`id` , `closingdate`,`remark`,`billcount`,`billsum`,`signature`) VALUES (NULL ,?,?,?,?,?)"; $closingEntrySql = "INSERT INTO `%closing%` (`id` , `closingdate`,`remark`,`billcount`,`billsum`,`signature`) VALUES (NULL ,?,?,?,?,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($closingEntrySql)); $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($closingEntrySql));
$stmt->execute(array($closingTime,$remark,0,0.0,null)); $stmt->execute(array($closingTime,$remark,0,0.0,null));
@ -154,9 +159,6 @@ $sql = "DELETE FROM %queue% WHERE id not in (select distinct queueid FROM %billp
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(); $stmt->execute();
// if bills were cancelled, but products not paid, they have no paidtime, but a billid
// -> thus they reappear in paydesk even after closure - mark them paid with a paidtime
// -> also declare them delivered so that they won't appear in supplydesk
$sql = "UPDATE %queue% set paidtime=?,delivertime=? WHERE billid is not null AND paidtime is null"; $sql = "UPDATE %queue% set paidtime=?,delivertime=? WHERE billid is not null AND paidtime is null";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($closingTime,$closingTime)); $stmt->execute(array($closingTime,$closingTime));
@ -200,6 +202,8 @@ array(
$newversionavailable = @file_get_contents($url, false, $ctx); $newversionavailable = @file_get_contents($url, false, $ctx);
// TODO: has to be forwarded to user to inform him // TODO: has to be forwarded to user to inform him
CommonUtils::callPlugin($pdo, "createClosing", "after");
echo json_encode(array("status" => "OK", "msg" => $content)); echo json_encode(array("status" => "OK", "msg" => $content));
} }
@ -572,12 +576,12 @@ echo json_encode(array("status" => "OK", "msg" => $retValues, "closingid" => $cl
} }
} }
public function getClosingSummaryWoSign($closingid,$pdo,$fromWeb) { public function getClosingSummaryWoSign($closingid,$pdo,$fromWeb,$fl=0) {
return $this->getClosingSummaryCore($closingid, $pdo, $fromWeb, false); return $this->getClosingSummaryCore($closingid, $pdo, $fromWeb, false,$fl);
} }
public function getClosingSummary($closingid,$pdo,$fromWeb) { public function getClosingSummary($closingid,$pdo,$fromWeb,$fl=0) {
return $this->getClosingSummaryCore($closingid, $pdo, $fromWeb, true); return $this->getClosingSummaryCore($closingid, $pdo, $fromWeb, true,$fl);
} }
public static function checkForClosingConsistency($pdo,$closingid) { public static function checkForClosingConsistency($pdo,$closingid) {
@ -604,7 +608,7 @@ openssl_free_key($pubkeyid);
return $ok; return $ok;
} }
public function getClosingSummaryCore($closingid,$pdo,$fromWeb,$exportSignature) { public function getClosingSummaryCore($closingid,$pdo,$fromWeb,$exportSignature,$fl=0) {
if(is_null($pdo)) { if(is_null($pdo)) {
$pdo = $this->dbutils->openDbAndReturnPdo(); $pdo = $this->dbutils->openDbAndReturnPdo();
}; };
@ -633,6 +637,13 @@ $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($closingid)); $stmt->execute(array($closingid));
$overview = $stmt->fetchAll(PDO::FETCH_ASSOC); $overview = $stmt->fetchAll(PDO::FETCH_ASSOC);
$sql = "select %queue%.tax as t,SUM(%queue%.price) as bruttosum,ROUND(SUM(%queue%.price)/(1 + %queue%.tax/100.0),2) as nettosum ";
$sql .= " FROM %bill%,%queue% ";
$sql .= " WHERE %bill%.closingid=? AND %queue%.billid=%bill%.id GROUP BY t";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($closingid));
$taxessum = $stmt->fetchAll(PDO::FETCH_ASSOC);
$sql = "select count(%queue%.productname) as count,%queue%.productname,%queue%.price,%queue%.tax as tax,sum(%queue%.price) as sumprice "; $sql = "select count(%queue%.productname) as count,%queue%.productname,%queue%.price,%queue%.tax as tax,sum(%queue%.price) as sumprice ";
$sql .= " from %queue%,%bill% where "; $sql .= " from %queue%,%bill% where ";
$sql .= "%queue%.billid=%bill%.id AND %bill%.closingid=? AND "; $sql .= "%queue%.billid=%bill%.id AND %bill%.closingid=? AND ";
@ -647,7 +658,11 @@ $details = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (!$exportSignature || $fromWeb) { if (!$exportSignature || $fromWeb) {
unset($closingpart->signature); unset($closingpart->signature);
} }
if ($fl >= 3) {
$retVal = array("closing" => $closingpart, "overview" => $overview, "details" => $details, "taxessum" => $taxessum);
} else {
$retVal = array("closing" => $closingpart, "overview" => $overview, "details" => $details); $retVal = array("closing" => $closingpart, "overview" => $overview, "details" => $details);
}
if ($fromWeb) { if ($fromWeb) {
echo json_encode(array("status" => "OK", "msg" => $retVal)); echo json_encode(array("status" => "OK", "msg" => $retVal));

View File

@ -5,44 +5,49 @@ require_once ('dbutils.php');
class CommonUtils { class CommonUtils {
var $dbutils; var $dbutils;
private static $plugins = null;
function __construct() { function __construct() {
$this->dbutils = new DbUtils(); $this->dbutils = new DbUtils();
// $this->products = new Products(); --> endless loop! // $this->products = new Products(); --> endless loop!
// $this->lastSettingOfDisplayMode = "all"; // $this->lastSettingOfDisplayMode = "all";
//error_reporting(E_ALL); //error_reporting(E_ALL);
}
public static function setPluginConfig($plugins) {
self::$plugins = $plugins;
} }
function verifyLastBillId($pdo,$nextIdToUse) { function verifyLastBillId($pdo,$nextIdToUse) {
if ($nextIdToUse == 1) { if ($nextIdToUse == 1) {
return true; return true;
} }
if (is_null($pdo)) { if (is_null($pdo)) {
$pdo = $this->dbutils->openDbAndReturnPdo(); $pdo = $this->dbutils->openDbAndReturnPdo();
} }
$nextIdToUse = intval($nextIdToUse); $nextIdToUse = intval($nextIdToUse);
$sql = "SELECT value,signature FROM %work% WHERE item=?"; $sql = "SELECT value,signature FROM %work% WHERE item=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array("lastbillid")); $stmt->execute(array("lastbillid"));
$row =$stmt->fetchObject(); $row =$stmt->fetchObject();
$lastBillid = intval($row->value); $lastBillid = intval($row->value);
$lastBillInc = $lastBillid+1; $lastBillInc = $lastBillid+1;
$signature = base64_decode($row->signature); $signature = base64_decode($row->signature);
if ($lastBillInc != $nextIdToUse) { if ($lastBillInc != $nextIdToUse) {
return false; return false;
} else { } else {
// test for correct signature // test for correct signature
$pubkeyid = $this->getCert($pdo); $pubkeyid = $this->getCert($pdo);
$ok = openssl_verify("B($lastBillid)", $signature, $pubkeyid); $ok = openssl_verify("B($lastBillid)", $signature, $pubkeyid);
openssl_free_key($pubkeyid); openssl_free_key($pubkeyid);
if ($ok == 0) { if ($ok == 0) {
return false; return false;
} else { } else {
// is id already used in bill table? // is id already used in bill table?
$sql = "SELECT id FROM %bill% WHERE id=?"; $sql = "SELECT id FROM %bill% WHERE id=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($nextIdToUse)); $stmt->execute(array($nextIdToUse));
if ($stmt->rowCount() > 0) { if ($stmt->rowCount() > 0) {
return false; return false;
@ -56,7 +61,7 @@ class CommonUtils {
} else { } else {
return true; return true;
} }
} }
} }
} }
} }
@ -80,15 +85,15 @@ class CommonUtils {
} }
function setLastBillIdInWorkTable($pdo,$lastBillId) { function setLastBillIdInWorkTable($pdo,$lastBillId) {
if (is_null($pdo)) { if (is_null($pdo)) {
$pdo = $this->dbutils->openDbAndReturnPdo(); $pdo = $this->dbutils->openDbAndReturnPdo();
} }
$pkeyid = $this->getPrivkey($pdo); $pkeyid = $this->getPrivkey($pdo);
openssl_sign("B($lastBillId)", $signature, $pkeyid); openssl_sign("B($lastBillId)", $signature, $pkeyid);
openssl_free_key($pkeyid); openssl_free_key($pkeyid);
$sql = "UPDATE %work% SET value=?, signature=? WHERE item=?"; $sql = "UPDATE %work% SET value=?, signature=? WHERE item=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$signature = base64_encode($signature); $signature = base64_encode($signature);
$stmt->execute(array($lastBillId,$signature,"lastbillid")); $stmt->execute(array($lastBillId,$signature,"lastbillid"));
} }
@ -98,9 +103,9 @@ class CommonUtils {
} }
$sql = "SELECT billdate,brutto,netto,userid,IF(tax is not null, tax, '0.00') as tax,signature FROM %bill% WHERE id=?"; $sql = "SELECT billdate,brutto,netto,userid,IF(tax is not null, tax, '0.00') as tax,signature FROM %bill% WHERE id=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($id)); $stmt->execute(array($id));
$row = $stmt->fetchObject(); $row = $stmt->fetchObject();
$billdate = $row->billdate; $billdate = $row->billdate;
$brutto = $row->brutto; $brutto = $row->brutto;
@ -109,30 +114,30 @@ class CommonUtils {
$userid = $row->userid; $userid = $row->userid;
$signature = $row->signature; $signature = $row->signature;
return($this->verifyBillByValues($pdo,$billdate, $brutto, $netto, $tax, $userid, $signature)); return($this->verifyBillByValues($pdo,$billdate, $brutto, $netto, $tax, $userid, $signature));
} }
function verifyBillByValues($pdo,$billdate,$brutto,$netto,$tax,$userid,$signature) { function verifyBillByValues($pdo,$billdate,$brutto,$netto,$tax,$userid,$signature) {
if (is_null($signature)) { if (is_null($signature)) {
return false; return false;
} }
if (is_null($pdo)) { if (is_null($pdo)) {
$pdo = $this->dbutils->openDbAndReturnPdo(); $pdo = $this->dbutils->openDbAndReturnPdo();
} }
$brutto = number_format($brutto, 2, ".", ''); $brutto = number_format($brutto, 2, ".", '');
$netto = number_format($netto, 2, ".", ''); $netto = number_format($netto, 2, ".", '');
$tax = number_format($tax, 2, ".", ''); $tax = number_format($tax, 2, ".", '');
$data = "D($billdate)B($brutto)N($netto)T($tax)U($userid)"; $data = "D($billdate)B($brutto)N($netto)T($tax)U($userid)";
$pubkeyid = $this->getCert($pdo); $pubkeyid = $this->getCert($pdo);
$ok = openssl_verify($data, $signature, $pubkeyid); $ok = openssl_verify($data, $signature, $pubkeyid);
openssl_free_key($pubkeyid); openssl_free_key($pubkeyid);
if ($ok == 0) { if ($ok == 0) {
return false; return false;
} else { } else {
return true; return true;
} }
} }
@ -142,31 +147,31 @@ class CommonUtils {
$nettostr = number_format($netto, 2, ".", ''); $nettostr = number_format($netto, 2, ".", '');
if (is_null($tax)) { if (is_null($tax)) {
$taxstr = "0.00"; $taxstr = "0.00";
} else { } else {
$taxstr = number_format($tax, 2, ".", ''); $taxstr = number_format($tax, 2, ".", '');
} }
$data = "D($theTime)B($bruttostr)N($nettostr)T($taxstr)U($userid)"; $data = "D($theTime)B($bruttostr)N($nettostr)T($taxstr)U($userid)";
$pkeyid = $this->getPrivkey($pdo); $pkeyid = $this->getPrivkey($pdo);
openssl_sign($data, $signature, $pkeyid); openssl_sign($data, $signature, $pkeyid);
openssl_free_key($pkeyid); openssl_free_key($pkeyid);
return $signature; return $signature;
} }
function createGridTableWithSqrtSizeOfButtons ($inputArray) { function createGridTableWithSqrtSizeOfButtons ($inputArray) {
// create a table that is optimal (sqrt-like size) // create a table that is optimal (sqrt-like size)
$numberOfIcons = count($inputArray); $numberOfIcons = count($inputArray);
if ($numberOfIcons == 0) { if ($numberOfIcons == 0) {
// no items to display // no items to display
return; return;
} }
$numberOfCols = ceil(sqrt($numberOfIcons)); $numberOfCols = ceil(sqrt($numberOfIcons));
$porcentageWidth = floor(100/$numberOfCols); $porcentageWidth = floor(100/$numberOfCols);
echo '<table class=gridtable>'; echo '<table class=gridtable>';
$colcounter = 0; $colcounter = 0;
for ($index=0;$index<$numberOfIcons;$index++) { for ($index=0;$index<$numberOfIcons;$index++) {
if ($colcounter == 0) { if ($colcounter == 0) {
echo "<tr><td>"; echo "<tr><td>";
} }
$anEntry = $inputArray[$index]; $anEntry = $inputArray[$index];
$textOfButton = $anEntry["textOfButton"]; # $textOfButton = $anEntry["textOfButton"]; #
@ -181,8 +186,8 @@ class CommonUtils {
$colcounter = 0; $colcounter = 0;
echo "</tr>"; echo "</tr>";
} }
} }
echo "</tr>"; echo "</tr>";
echo "</table>"; echo "</table>";
} }
@ -194,12 +199,12 @@ class CommonUtils {
function getTableNameFromId($pdo,$tableid) { function getTableNameFromId($pdo,$tableid) {
if (is_null($tableid) || ($tableid == 0)) { if (is_null($tableid) || ($tableid == 0)) {
return "-"; // togo return "-"; // togo
} }
$sql = "SELECT tableno FROM %resttables% WHERE id=?"; $sql = "SELECT tableno FROM %resttables% WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($tableid)); $stmt->execute(array($tableid));
$row = $stmt->fetchObject(); $row = $stmt->fetchObject();
return $row->tableno; return $row->tableno;
} }
function getCurrentPriceLevel($pdo) { function getCurrentPriceLevel($pdo) {
@ -218,59 +223,93 @@ class CommonUtils {
return (array("id" => $pricelevelid, "name" => $pricelevelname)); return (array("id" => $pricelevelid, "name" => $pricelevelname));
} }
function createGridTableWithSqrtSizeOfStyleButtonsAndHeader ($inputArray,$headline,$headercolor) { function createGridTableWithSqrtSizeOfStyleButtonsAndHeader ($inputArray,$headline,$headercolor) {
// create a table that is optimal (sqrt-like size) // create a table that is optimal (sqrt-like size)
$numberOfIcons = count($inputArray); $numberOfIcons = count($inputArray);
if ($numberOfIcons == 0) { if ($numberOfIcons == 0) {
// no items to display // no items to display
return; return;
} }
$numberOfCols = ceil(sqrt($numberOfIcons)); $numberOfCols = ceil(sqrt($numberOfIcons));
$porcentageWidth = floor(100.0/$numberOfCols); $porcentageWidth = floor(100.0/$numberOfCols);
echo '<table class=gridtable>'; echo '<table class=gridtable>';
// Headline // Headline
if ($headline <> '') { if ($headline <> '') {
echo '<tr><th style="background-color:#' . $headercolor . '">' . $headline . '</th>'; echo '<tr><th style="background-color:#' . $headercolor . '">' . $headline . '</th>';
} }
$colcounter = 0; $colcounter = 0;
for ($index=0;$index<$numberOfIcons;$index++) { for ($index=0;$index<$numberOfIcons;$index++) {
if ($colcounter == 0) { if ($colcounter == 0) {
echo "<tr><td>"; echo "<tr><td>";
} }
$anEntry = $inputArray[$index]; $anEntry = $inputArray[$index];
$textOfButton = $anEntry["textOfButton"]; # $textOfButton = $anEntry["textOfButton"]; #
$onClickMethod = $anEntry["onClickMethod"]; // With parameters! $onClickMethod = $anEntry["onClickMethod"]; // With parameters!
$style = $anEntry["style"]; $style = $anEntry["style"];
$button = '<input type="button" value="' . $textOfButton . '"'; $button = '<input type="button" value="' . $textOfButton . '"';
$button = $button . ' onclick="' . $onClickMethod . '"'; $button = $button . ' onclick="' . $onClickMethod . '"';
$button = $button . ' style="' . $style . '; width:' . $porcentageWidth . '%;" />'; $button = $button . ' style="' . $style . '; width:' . $porcentageWidth . '%;" />';
echo $button; echo $button;
$colcounter++; $colcounter++;
if ($colcounter == $numberOfCols) { if ($colcounter == $numberOfCols) {
$colcounter = 0; $colcounter = 0;
echo "</tr>"; echo "</tr>";
} }
} }
echo "</tr>"; echo "</tr>";
echo "</table>"; echo "</table>";
} }
function getCurrency() { function getCurrency() {
$pdo = $this->dbutils->openDbAndReturnPdo(); $pdo = $this->dbutils->openDbAndReturnPdo();
$sql = "SELECT setting from %config% where name='currency'"; $sql = "SELECT setting from %config% where name='currency'";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(); $stmt->execute();
$row =$stmt->fetchObject(); $row =$stmt->fetchObject();
if ($row != null) { if ($row != null) {
return $row->setting; return $row->setting;
} else { } else {
return "Euro"; return "Euro";
} }
}
public static function getConfigValue($pdo,$item,$default) {
$sql = "SELECT count(id) as countid FROM %config% WHERE name=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($item));
$row =$stmt->fetchObject();
if ($row->countid == 0) {
return $default;
} else {
$sql = "SELECT setting FROM %config% WHERE name=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($item));
$row = $stmt->fetchObject();
return $row->setting;
}
}
public static function callPlugin($pdo,$fct,$condition) {
try {
if (!is_null(self::$plugins)) {
if (array_key_exists($fct,self::$plugins)) {
$plugin = self::$plugins->$fct;
if (($plugin->execution) === $condition) {
$cls = $plugin->PluginClass;
$fct=$plugin->PluginFct;
$call = "Plugin\\$cls::$fct";
call_user_func($call,$pdo);
return true;
}
}
}
} catch(Exception $e) { }
return false;
} }
} }
?> ?>

View File

@ -19,8 +19,10 @@ $command = $_GET["command"];
Logger::logcmd($module,$command,""); Logger::logcmd($module,$command,"");
$plugins = havePlugins();
if ($module == 'admin') { if ($module == 'admin') {
$adminModule = new Admin; $adminModule = new Admin();
$adminModule->handleCommand($command); $adminModule->handleCommand($command);
} else if ($module == 'queue') { } else if ($module == 'queue') {
$queueContent = new QueueContent(); $queueContent = new QueueContent();
@ -54,4 +56,27 @@ if ($module == 'admin') {
$rating->handleCommand($command); $rating->handleCommand($command);
} }
function havePlugins() {
if (file_exists("../plugins")) {
if (file_exists("../plugins/config.json")) {
$content = file_get_contents("../plugins/config.json");
$pluginconfig = json_decode($content);
$props = get_object_vars($pluginconfig);
$keys = array_keys($props);
foreach ($keys as $aKey) {
$aPluginConfig = $pluginconfig->$aKey;
$className = $aPluginConfig->PluginClass;
require_once "../plugins/$className.php";
}
CommonUtils::setPluginConfig($pluginconfig);
return $pluginconfig;
}
}
return null;
}
?> ?>

View File

@ -30,7 +30,7 @@ class PrintQueue {
$this->getNextReceiptPrintJobs($_POST['pass'],$_GET['language'],"1,2,3,4,5,6",$fl); $this->getNextReceiptPrintJobs($_POST['pass'],$_GET['language'],"1,2,3,4,5,6",$fl);
} }
} else if ($command == 'getNextClosingPrintJobs') { } else if ($command == 'getNextClosingPrintJobs') {
$this->getNextClosingPrintJobs($_POST['pass'],$_GET['language']); $this->getNextClosingPrintJobs($_POST['pass'],$_GET['language'],$fl);
} else if ($command == 'getNextFoodWorkPrintJobs') { } else if ($command == 'getNextFoodWorkPrintJobs') {
if (isset($_GET['printer'])) { if (isset($_GET['printer'])) {
$this->getNextFoodWorkPrintJobs($_GET['printer'],$_POST['pass'],$fl); $this->getNextFoodWorkPrintJobs($_GET['printer'],$_POST['pass'],$fl);
@ -362,7 +362,7 @@ class PrintQueue {
echo json_encode($retArray); echo json_encode($retArray);
} }
function getNextClosingPrintJobs($md5pass,$language) { function getNextClosingPrintJobs($md5pass,$language,$fl=0) {
$isCorrect = $this->isPasswordCorrect($md5pass,false); $isCorrect = $this->isPasswordCorrect($md5pass,false);
if ($isCorrect) { if ($isCorrect) {
ob_start(); ob_start();
@ -381,7 +381,7 @@ class PrintQueue {
$jobid = $aClos['id']; $jobid = $aClos['id'];
$closid = $aClos["content"]; $closid = $aClos["content"];
$printer = $aClos["printer"]; $printer = $aClos["printer"];
$theClosing = $closing->getClosingSummaryWoSign($closid, $pdo, false); $theClosing = $closing->getClosingSummaryWoSign($closid, $pdo, false,$fl);
$aClosing = array("id" => $jobid,"closing" => $theClosing, "printer" => $printer); $aClosing = array("id" => $jobid,"closing" => $theClosing, "printer" => $printer);
$closingarray[] = $aClosing; $closingarray[] = $aClosing;
} }

View File

@ -197,17 +197,18 @@ class QueueContent {
$result1 = $stmt->fetchAll(); $result1 = $stmt->fetchAll();
$sql = "SELECT DISTINCT %queue%.id as id,'-' as tableid,'-' as tablenr,longname,anoption,'-' as tableno,date_format(ordertime,'%Y-%m-%d %H:%i:00') as ordertime,cooking,TIMESTAMPDIFF(MINUTE,ordertime,?) AS waittime FROM %queue%,%products%,%prodtype%,%resttables%,%bill% "; $sql = "SELECT DISTINCT q.id as id,'-' as tableid,'-' as tablenr,longname,anoption,'-' as tableno,date_format(ordertime,'%Y-%m-%d %H:%i:00') as ordertime,cooking,TIMESTAMPDIFF(MINUTE,ordertime,?) AS waittime FROM %products%,%prodtype%,%resttables%, %queue% q LEFT OUTER JOIN %bill% b ";
$sql .= " ON q.billid=b.id ";
$sql .= "WHERE (readytime = '0000-00-00 00:00:00' AND "; $sql .= "WHERE (readytime = '0000-00-00 00:00:00' AND ";
$sql .= " ordertime is not null AND "; $sql .= " ordertime is not null AND ";
$sql .= "%queue%.productid=%products%.id AND "; $sql .= "q.productid=%products%.id AND ";
$sql .= "%queue%.tablenr is null AND "; $sql .= "q.tablenr is null AND ";
$sql .= "%products%.category=%prodtype%.id AND "; $sql .= "%products%.category=%prodtype%.id AND ";
$sql .= "%prodtype%.kind=? AND "; $sql .= "%prodtype%.kind=? AND ";
$sql .= "%queue%.isclosed is null AND "; $sql .= "q.isclosed is null AND ";
$sql .= "%queue%.workprinted='0') "; $sql .= "q.workprinted='0') ";
$sql .= "AND (%queue%.billid is null OR ("; $sql .= "AND (q.billid is null OR ( ";
$sql .= "%queue%.billid=%bill%.id AND %bill%.closingid is null)) "; $sql .= "b.closingid is null)) ";
$sql .= "ORDER BY ordertime,longname,anoption,cooking DESC"; $sql .= "ORDER BY ordertime,longname,anoption,cooking DESC";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
@ -439,8 +440,20 @@ class QueueContent {
} }
} }
private function doWorkPrint($pdo,$theTableid,$insertedQueueIds,$username,$payPrintType,$lang,$declareReadyDelivered = true) {
$oneProdForEachWorkRec = CommonUtils::getConfigValue($pdo, 'oneprodworkreceipts', 0);
if (($payPrintType != "s") || ($oneProdForEachWorkRec == 0)) {
return ($this->doWorkPrintCore($pdo,$theTableid,$insertedQueueIds,$username,$payPrintType,$lang,$declareReadyDelivered));
}
$oneProdForEachWorkRec = CommonUtils::getConfigValue($pdo, 'oneprodworkreceipts', 0);
if ($oneProdForEachWorkRec == 1) {
foreach($insertedQueueIds as $aQueueId) {
$this->doWorkPrintCore($pdo,$theTableid,array($aQueueId),$username,$payPrintType,$lang,$declareReadyDelivered);
}
}
}
private function doWorkPrint($pdo,$theTableid,$insertedQueueIds,$username,$payPrintType,$lang) { private function doWorkPrintCore($pdo,$theTableid,$insertedQueueIds,$username,$payPrintType,$lang,$declareReadyDelivered = true) {
// is it server or local print? // is it server or local print?
$foodJobsPrinter1 = $this->getJobsToPrint($pdo, 0, 1, $insertedQueueIds); $foodJobsPrinter1 = $this->getJobsToPrint($pdo, 0, 1, $insertedQueueIds);
@ -448,13 +461,15 @@ class QueueContent {
$drinkJobsPrinter1 = $this->getJobsToPrint($pdo, 1, 1, $insertedQueueIds); $drinkJobsPrinter1 = $this->getJobsToPrint($pdo, 1, 1, $insertedQueueIds);
$drinkJobsPrinter2 = $this->getJobsToPrint($pdo, 1, 2, $insertedQueueIds); $drinkJobsPrinter2 = $this->getJobsToPrint($pdo, 1, 2, $insertedQueueIds);
if ($payPrintType == "s") { if ($payPrintType == "s") {
$this->createAWorkReceiptAndQueueWorkPrint($pdo,$foodJobsPrinter1,$theTableid,0,1,$username,$lang); $this->createAWorkReceiptAndQueueWorkPrint($pdo,$foodJobsPrinter1,$theTableid,0,1,$username,$lang);
$this->createAWorkReceiptAndQueueWorkPrint($pdo,$foodJobsPrinter2,$theTableid,0,2,$username,$lang); $this->createAWorkReceiptAndQueueWorkPrint($pdo,$foodJobsPrinter2,$theTableid,0,2,$username,$lang);
$this->createAWorkReceiptAndQueueWorkPrint($pdo,$drinkJobsPrinter1,$theTableid,1,1,$username,$lang); $this->createAWorkReceiptAndQueueWorkPrint($pdo,$drinkJobsPrinter1,$theTableid,1,1,$username,$lang);
$this->createAWorkReceiptAndQueueWorkPrint($pdo,$drinkJobsPrinter2,$theTableid,1,1,$username,$lang); $this->createAWorkReceiptAndQueueWorkPrint($pdo,$drinkJobsPrinter2,$theTableid,1,1,$username,$lang);
} }
$this->declareReadyAndDelivered($pdo, $insertedQueueIds); if ($declareReadyDelivered) {
$this->declareReadyAndDelivered($pdo, $insertedQueueIds);
}
$result = array_merge($foodJobsPrinter1,$foodJobsPrinter2,$drinkJobsPrinter1,$drinkJobsPrinter2); $result = array_merge($foodJobsPrinter1,$foodJobsPrinter2,$drinkJobsPrinter1,$drinkJobsPrinter2);
return $result; return $result;
@ -636,6 +651,14 @@ class QueueContent {
return($resultarray); return($resultarray);
} }
function getTableIdOfQueue($pdo,$queueid) {
$sql = "SELECT tablenr as tableid FROM %queue% WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($queueid));
$row =$stmt->fetchObject();
return $row->tableid;
}
/* /*
* Kitchen can delare a product as being cooked * Kitchen can delare a product as being cooked
*/ */
@ -666,6 +689,16 @@ class QueueContent {
// can bypass the supplydesk // can bypass the supplydesk
$this->declareProductBeDeliveredWithGivenPdo($pdo,$queueid); $this->declareProductBeDeliveredWithGivenPdo($pdo,$queueid);
} }
$payprinttype = CommonUtils::getConfigValue($pdo, 'payprinttype', "l");
$digiprintwork = CommonUtils::getConfigValue($pdo, 'digiprintwork', 1);
if (($payprinttype === 's') && ($digiprintwork == 1)) {
$theTableid = $this->getTableIdOfQueue($pdo, $queueid);
if (is_null($theTableid)) {
$theTableid = 0;
}
$this->doWorkPrint($pdo,$theTableid,array($queueid),$_SESSION['currentuser'],$payprinttype, $_SESSION['language'],false);
}
$pdo->commit(); $pdo->commit();
echo json_encode(array("status" => "OK")); echo json_encode(array("status" => "OK"));
} }
@ -1576,6 +1609,12 @@ class QueueContent {
$ids_array = explode ( ',', $ids ); $ids_array = explode ( ',', $ids );
$pdo = $this->dbutils->openDbAndReturnPdo(); $pdo = $this->dbutils->openDbAndReturnPdo();
if (CommonUtils::callPlugin($pdo, "createBill", "replace")) {
return;
}
CommonUtils::callPlugin($pdo, "createBill", "before");
$pdo->beginTransaction(); $pdo->beginTransaction();
// check if all items are not paid yet! // check if all items are not paid yet!
@ -1676,6 +1715,8 @@ class QueueContent {
$billInfo = array("billid" => $billid, "date" => $currentTime); $billInfo = array("billid" => $billid, "date" => $currentTime);
CommonUtils::callPlugin($pdo, "createBill", "after");
echo json_encode(array("status" => "OK", "msg" => $billInfo)); echo json_encode(array("status" => "OK", "msg" => $billInfo));
} }

View File

@ -339,6 +339,8 @@ class TypeAndProductFileManager {
} }
private function fillProductDbTable($pdo,$leafArray) { private function fillProductDbTable($pdo,$leafArray) {
$sortArr = array();
for ($i=0;$i < $leafArray->size(); $i++) { for ($i=0;$i < $leafArray->size(); $i++) {
$theLeafEntry = $leafArray->get($i); $theLeafEntry = $leafArray->get($i);
$product = new ProductEntry(); $product = new ProductEntry();
@ -356,6 +358,14 @@ class TypeAndProductFileManager {
$available = $product->getAvailable(); $available = $product->getAvailable();
$favorite = 0; $favorite = 0;
$category = $theLeafEntry->getReference(); $category = $theLeafEntry->getReference();
$sorting = 0;
if (array_key_exists($category, $sortArr)) {
$sorting = $sortArr[$category] + 1;
$sortArr[$category] = $sorting;
} else {
$sortArr[$category] = 0;
}
$isNewProd = true; $isNewProd = true;
if (!is_null($prodid)) { if (!is_null($prodid)) {
@ -369,10 +379,10 @@ class TypeAndProductFileManager {
} }
} }
if ($isNewProd) { if ($isNewProd) {
$sql = "INSERT INTO `%products%` (`id`, `shortname`, `longname`, `priceA`, `priceB`, `priceC`, `tax`, `category`,`available`,`favorite`) VALUES (NULL,"; $sql = "INSERT INTO `%products%` (`id`, `shortname`, `longname`, `priceA`, `priceB`, `priceC`, `tax`, `category`,`available`,`favorite`,`sorting`) VALUES (NULL,";
$sql = $sql . "?,?,?,?,?,?,?,?,?)"; $sql = $sql . "?,?,?,?,?,?,?,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($shortName,$longName,$priceA,$priceB,$priceC,$tax, $category,$available,$favorite)); $stmt->execute(array($shortName,$longName,$priceA,$priceB,$priceC,$tax, $category,$available,$favorite,$sorting));
$prodid = $pdo->lastInsertId(); $prodid = $pdo->lastInsertId();
HistFiller::createProdInHist($pdo, $prodid); HistFiller::createProdInHist($pdo, $prodid);
} else { } else {
@ -391,16 +401,14 @@ class TypeAndProductFileManager {
|| ($row->tax != $tax)); || ($row->tax != $tax));
if ($changed) { if ($changed) {
$sql = "UPDATE %products% SET shortname=?,longname=?,priceA=?,priceB=?,priceC=?,tax=?,available=? WHERE id=?"; $sql = "UPDATE %products% SET shortname=?,longname=?,priceA=?,priceB=?,priceC=?,tax=?,available=?,sorting=? WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($shortName,$longName,$priceA,$priceB,$priceC,$tax,$available,$prodid)); $stmt->execute(array($shortName,$longName,$priceA,$priceB,$priceC,$tax,$available,$sorting,$prodid));
$sql = "SELECT sorting,available,favorite,audio FROM %products% WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($prodid));
$row = $stmt->fetchObject();
HistFiller::updateProdInHist($pdo, $prodid); HistFiller::updateProdInHist($pdo, $prodid);
} else {
$sql = "UPDATE %products% SET sorting=? WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($sorting,$prodid));
} }
$sql = "UPDATE %products% SET category=?,removed=? WHERE id=?"; $sql = "UPDATE %products% SET category=?,removed=? WHERE id=?";

View File

@ -349,7 +349,7 @@ class Basedb {
CREATE TABLE `%extras%` ( CREATE TABLE `%extras%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` VARCHAR ( 150 ) NOT NULL, `name` VARCHAR ( 150 ) NOT NULL,
`price` DECIMAL (5,2) NOT NULL, `price` " . DECIMALSMALL . "NOT NULL,
`removed` INT(1) NULL `removed` INT(1) NULL
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ; ) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ;
"; ";
@ -390,10 +390,10 @@ class Basedb {
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`shortname` VARCHAR ( 150 ) NOT NULL, `shortname` VARCHAR ( 150 ) NOT NULL,
`longname` VARCHAR ( 150 ) NOT NULL, `longname` VARCHAR ( 150 ) NOT NULL,
`priceA` DECIMAL (5,2) NULL, `priceA` " . DECIMALSMALL . " NULL,
`priceB` DECIMAL (5,2) NULL, `priceB` " . DECIMALSMALL . " NULL,
`priceC` DECIMAL (5,2) NULL, `priceC` " .DECIMALSMALL . " NULL,
`tax` DECIMAL (5,2) NULL, `tax` " . DECIMALSMALL . " NULL,
`category` INT(3) NULL, `category` INT(3) NULL,
`favorite` INT(1) NULL, `favorite` INT(1) NULL,
`sorting` INT(2) NULL, `sorting` INT(2) NULL,
@ -426,7 +426,7 @@ class Basedb {
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`closingdate` DATETIME NOT NULL , `closingdate` DATETIME NOT NULL ,
`billcount` INT(5) NOT NULL , `billcount` INT(5) NOT NULL ,
`billsum` DECIMAL (9,2) NOT NULL , `billsum` " . DECIMALBIG . " NOT NULL ,
`signature` blob NULL, `signature` blob NULL,
`remark` VARCHAR ( 1000 ) `remark` VARCHAR ( 1000 )
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ; ) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ;
@ -456,17 +456,17 @@ class Basedb {
CREATE TABLE `%bill%` ( CREATE TABLE `%bill%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`billdate` DATETIME NOT NULL , `billdate` DATETIME NOT NULL ,
`brutto` DECIMAL (7,2) NULL, `brutto` " . DECIMALMIDDLE . " NULL,
`netto` DECIMAL (7,2) NULL, `netto` " . DECIMALMIDDLE . " NULL,
`prevbrutto` DECIMAL (9,2) NULL, `prevbrutto` " . DECIMALBIG . " NULL,
`prevnetto` DECIMAL (9,2) NULL, `prevnetto` " . DECIMALBIG . " NULL,
`tableid` VARCHAR ( 150 ) NOT NULL, `tableid` VARCHAR ( 150 ) NOT NULL,
`closingid` INT(4) NULL, `closingid` INT(4) NULL,
`status` VARCHAR(2) NULL, `status` VARCHAR(2) NULL,
`paymentid` INT(2) NULL, `paymentid` INT(2) NULL,
`userid` INT(3) NULL, `userid` INT(3) NULL,
`ref` INT(10) NULL, `ref` INT(10) NULL,
`tax` DECIMAL (5,2) NULL, `tax` " . DECIMALSMALL . " NULL,
`host` INT(2) NULL, `host` INT(2) NULL,
`reason` VARCHAR ( 150 ) NULL, `reason` VARCHAR ( 150 ) NULL,
`signature`blob NULL, `signature`blob NULL,
@ -492,8 +492,8 @@ class Basedb {
`tablenr` INT( 3 ) NULL , `tablenr` INT( 3 ) NULL ,
`productid` INT( 10 ) NULL , `productid` INT( 10 ) NULL ,
`pricelevel` INT( 3 ) NOT NULL , `pricelevel` INT( 3 ) NOT NULL ,
`price` DECIMAL (5,2) NOT NULL, `price` " . DECIMALSMALL . " NOT NULL,
`tax` DECIMAL (5,2) NOT NULL, `tax` " . DECIMALSMALL . " NOT NULL,
`productname` VARCHAR( 150 ) NULL, `productname` VARCHAR( 150 ) NULL,
`ordertime` DATETIME NULL , `ordertime` DATETIME NULL ,
`orderuser` INT(10) NOT NULL , `orderuser` INT(10) NOT NULL ,
@ -548,10 +548,10 @@ class Basedb {
`prodid` INT (10) NOT NULL, `prodid` INT (10) NOT NULL,
`shortname` VARCHAR ( 150 ) NOT NULL, `shortname` VARCHAR ( 150 ) NOT NULL,
`longname` VARCHAR ( 150 ) NOT NULL, `longname` VARCHAR ( 150 ) NOT NULL,
`priceA` DECIMAL (5,2) NULL, `priceA` " . DECIMALSMALL . " NULL,
`priceB` DECIMAL (5,2) NULL, `priceB` " . DECIMALSMALL . " NULL,
`priceC` DECIMAL (5,2) NULL, `priceC` " . DECIMALSMALL . " NULL,
`tax` DECIMAL (5,2) NULL, `tax` " . DECIMALSMALL . " NULL,
`sorting` INT(2) NULL, `sorting` INT(2) NULL,
`available` INT(2) NOT NULL, `available` INT(2) NOT NULL,
`favorite` INT(1) NULL, `favorite` INT(1) NULL,

View File

@ -0,0 +1,5 @@
<?php
defined('DECIMALSMALL') || define ( 'DECIMALSMALL','DECIMAL (5,2)' );
defined('DECIMALMIDDLE') || define ( 'DECIMALMIDDLE','DECIMAL (7,2)' );
defined('DECIMALBIG') || define ( 'DECIMALBIG','DECIMAL (9,2)' );

View File

@ -7,34 +7,6 @@ class Sorter {
function __construct() { function __construct() {
$this->dbutils = new DbUtils(); $this->dbutils = new DbUtils();
} }
public function initSortCurrentProductTable($pdo) {
// first find all product types
$sql = "SELECT id FROM %prodtype% WHERE removed is null";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$alltypes = $stmt->fetchAll();
foreach($alltypes as $aType) {
$typeid = $aType["id"];
// now sort inside this prodtype
$sql = "SELECT id FROM %products% WHERE removed is null AND category=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($typeid));
$allprods = $stmt->fetchAll();
$s = 0;
foreach($allprods as $aProd) {
$prodid = $aProd["id"];
$sql = "UPDATE %products% SET sorting=? WHERE id=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($s,$prodid));
$s++;
}
}
}
public function getMaxprodSortOfType($pdo,$typeid) { public function getMaxprodSortOfType($pdo,$typeid) {
$sql = "SELECT MAX(sorting) as maxsort FROM %products% WHERE removed is null AND category=?"; $sql = "SELECT MAX(sorting) as maxsort FROM %products% WHERE removed is null AND category=?";

View File

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

View File

@ -7,7 +7,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel"> <meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.4"> <link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.5">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" /> <link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" /> <link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -66,6 +66,9 @@ var PROD_PRINTER_1 = ["Drucker 1","Printer 1","Imprimadora 1"];
var PROD_PRINTER_2 = ["Drucker 2","Printer 2","Imprimadora 2"]; var PROD_PRINTER_2 = ["Drucker 2","Printer 2","Imprimadora 2"];
var PROD_PLACEHOLDER_NEW_PRODTYPE = ["Name der neuen Kategorie", "Name of the new category","Nombre de la categoría nueva"]; var PROD_PLACEHOLDER_NEW_PRODTYPE = ["Name der neuen Kategorie", "Name of the new category","Nombre de la categoría nueva"];
// this is the maximal price that a product may cost
var MAX_PRICE = 999.99;
var decpoint = "."; var decpoint = ".";
var lang = 0; var lang = 0;
@ -436,7 +439,7 @@ function setLanguage(language) {
} }
if (props.status) { if (props.status) {
if ((props.priceA > 999.99) || (props.priceB > 999.99) || (props.priceC > 999.99)) { if ((props.priceA > MAX_PRICE) || (props.priceB > MAX_PRICE) || (props.priceC > MAX_PRICE)) {
alert(PROD_MAX_PRICE_EXCEEDED[lang]); alert(PROD_MAX_PRICE_EXCEEDED[lang]);
return; return;
} }

View File

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

View File

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

View File

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

View File

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

View File

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