OrderSprinter 1.2.5
This commit is contained in:
parent
a0a538eb7b
commit
6097495d8d
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -5,7 +5,7 @@
|
|||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="author" content="Stefan Pichel">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.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/jquery.mobile.icons.min.css" />
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="author" content="Stefan Pichel">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.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/jquery.mobile.icons.min.css" />
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.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/jquery.mobile.icons.min.css" />
|
||||
|
|
|
@ -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.2.4">
|
||||
<link rel="stylesheet" type="text/css" href="css/numfield.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.5">
|
||||
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
||||
|
|
|
@ -679,7 +679,7 @@ $(document).ready(function() {
|
|||
<tr id=updateline>
|
||||
<td> </td>
|
||||
<td align=center>
|
||||
<button id="updatebtn">Update -> 1.2.4</button>
|
||||
<button id="updatebtn">Update -> 1.2.5</button>
|
||||
</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
|
|
|
@ -7,6 +7,7 @@ require_once( "../php/config1.php" );
|
|||
require_once( "../php/config.php" );
|
||||
}
|
||||
require_once ('../php/utilities/basedb.php');
|
||||
require_once ('../php/utilities/decimaldefs.php');
|
||||
require_once ('../php/admin.php');
|
||||
|
||||
class ConfigWriter {
|
||||
|
@ -404,7 +405,7 @@ $sql = "ALTER TABLE %queue% DROP action";
|
|||
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
|
||||
$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->execute();
|
||||
|
||||
|
@ -428,15 +429,15 @@ $sql = "ALTER TABLE %bill% MODIFY tax decimal(5,2) NULL";
|
|||
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
|
||||
$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->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->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->execute();
|
||||
|
||||
|
@ -995,10 +996,10 @@ $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";
|
||||
$sql = "ALTER TABLE %bill% ADD prevbrutto " . DECIMALBIG . " NULL AFTER netto";
|
||||
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
|
||||
$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->execute();
|
||||
|
||||
|
@ -1323,6 +1324,30 @@ 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) {
|
||||
$pdo = $this->pdo;
|
||||
try {
|
||||
|
@ -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 , 'currency', '$currency')");
|
||||
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'receiptfontsize', '12')");
|
||||
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.2.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 , 'remoteaccesscode', null)");
|
||||
$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 , '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
|
||||
date_default_timezone_set($timezone);
|
||||
$installDate = date('Y-m-d H:i:s');
|
||||
|
@ -1800,7 +1828,8 @@ $zones[] = $timezone_identifiers[$i];
|
|||
}
|
||||
echo json_encode($zones);
|
||||
} else if ($command == 'update') {
|
||||
$installerVersion = "1.2.4";
|
||||
|
||||
$installerVersion = "1.2.5";
|
||||
|
||||
$admin = new InstallAdmin();
|
||||
$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.1.0","1.1.1","1.1.2","1.1.3","1.1.4","1.1.5","1.1.6","1.1.7","1.1.8", "1.1.9","1.1.10","1.1.11","1.1.12","1.1.13","1.1.14","1.1.15","1.1.16","1.1.17",
|
||||
"1.1.18","1.1.19","1.1.20","1.1.21","1.1.22","1.1.23","1.1.24","1.1.25","1.1.26","1.1.27","1.1.28","1.1.29","1.1.30",
|
||||
"1.2.0","1.2.1","1.2.2", "1.2.3"
|
||||
"1.2.0","1.2.1","1.2.2", "1.2.3", "1.2.4"
|
||||
);
|
||||
|
||||
if (!in_array($version, $supportedVersions)) {
|
||||
|
@ -1838,7 +1867,7 @@ echo json_encode("Quellversion nicht unterstützt");
|
|||
return;
|
||||
}
|
||||
|
||||
$ret = $admin->updateUserTable1203_1204($_POST['prefix'], $version, $_POST['db']);
|
||||
$ret = $admin->updateUserTable1204_1205($_POST['prefix'], $version, $_POST['db']);
|
||||
|
||||
if(session_id() == '') {
|
||||
session_start();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="author" content="Stefan Pichel">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.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/jquery.mobile.icons.min.css" />
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="author" content="Stefan Pichel">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.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/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.",
|
||||
"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_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.",
|
||||
"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."];
|
||||
|
@ -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."];
|
||||
|
||||
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;
|
||||
|
||||
|
@ -321,6 +326,8 @@ var generalValuesSettings = [
|
|||
["austria",MAN_AUSTRIA[lang],"s",10],
|
||||
["digigopaysetready",MAN_DIGI_GOPAY_SET_READY[lang],"s",14],
|
||||
["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],
|
||||
["workflowconfig",MAN_WORKFLOW[lang],"s",4],
|
||||
["receiptfontsize",MAN_RECEIPT_FONTSIZE[lang],"s",0],
|
||||
|
@ -442,6 +449,8 @@ function setLanguage(l) {
|
|||
$("#rectemplatehint").html(MAN_RECTEMPLATE_HINT[l]);
|
||||
$("#foodtemplatehint").html(MAN_FOODTEMPLATE_HINT[l]);
|
||||
$("#drinktemplatehint").html(MAN_DRINKTEMPLATE_HINT[l]);
|
||||
|
||||
$("#digiprinthint").html(MAN_DIGI_PRINTWORK_HINT[l]);
|
||||
}
|
||||
|
||||
function createMonthSelection(label) {
|
||||
|
@ -537,6 +546,8 @@ function insertGeneralConfigItems(configResult) {
|
|||
$("#partOfAustria").html(createAustriaPart(values.austria));
|
||||
$("#partOfDigigopaysetready").html(createDigigopaysetready(values.digigopaysetready));
|
||||
$("#partOfWaitergopayprint").html(createWaitergopayprint(values.waitergopayprint));
|
||||
$("#partOfOneprodworkreceipts").html(createOneprodworkreceipts(values.oneprodworkreceipts));
|
||||
$("#partOfDigiprintwork").html(createDigiprintwork(values.digiprintwork));
|
||||
|
||||
var language = values.billlanguage;
|
||||
generalVals[2] = language;
|
||||
|
@ -573,6 +584,8 @@ function insertGeneralConfigItems(configResult) {
|
|||
generalVals[10] = values.austria;
|
||||
generalVals[14] = values.digigopaysetready;
|
||||
generalVals[15] = values.waitergopayprint;
|
||||
generalVals[17] = values.oneprodworkreceipts;
|
||||
generalVals[18] = values.digiprintwork;
|
||||
|
||||
$("#smtphost").val(values.smtphost);
|
||||
$("#partOfSmtpauth").html(createSMTPAuth(values.smtpauth));
|
||||
|
@ -612,7 +625,7 @@ function createReceiptFontPart() {
|
|||
html += '<label for="receiptfontsize">' + MAN_RECEIPT_FONTSIZE[lang] + ':</label>';
|
||||
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>';
|
||||
}
|
||||
|
||||
|
@ -705,7 +718,12 @@ function createDigigopaysetready(theValue) {
|
|||
function createWaitergopayprint(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) {
|
||||
return createYesNo("groupworkitems", MAN_GROUP_WORK_ITEMS, theValue);
|
||||
}
|
||||
|
@ -2404,6 +2422,11 @@ $(document).on("pageinit", "#admin-page", function () {
|
|||
<div id="partOfWaitergopayprint"></div>
|
||||
<span id=waitergopayprinthint></span>
|
||||
</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="partOfProminentSearch"></div>
|
||||
<div id="partOfGroupWorkItems"></div>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -6,6 +6,7 @@ require_once ('utilities/TypeAndProducts/TypeAndProductFileManager.php');
|
|||
require_once ('utilities/userrights.php');
|
||||
require_once ('utilities/HistFiller.php');
|
||||
require_once ('utilities/basedb.php');
|
||||
require_once ('utilities/decimaldefs.php');
|
||||
require_once ('utilities/sorter.php');
|
||||
require_once ('utilities/Logger.php');
|
||||
require_once ('utilities/Emailer.php');
|
||||
|
@ -830,6 +831,20 @@ class Admin {
|
|||
$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"));
|
||||
$row = $stmt->fetchObject();
|
||||
$groupworkitems = $row->setting;
|
||||
|
@ -939,7 +954,8 @@ 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, "digigopaysetready" => $digigopaysetready, "waitergopayprint" => $waitergopayprint,
|
||||
"austria" => $austria, "digigopaysetready" => $digigopaysetready, "waitergopayprint" => $waitergopayprint, "oneprodworkreceipts" => $oneprodworkreceipts,
|
||||
"digiprintwork" => $digiprintwork,
|
||||
"paydeskid" => $paydeskid, "aeskey" => $aeskey, "certificatesn" => $certificatesn, "addreceipttoprinter" => $addreceipttoprinter
|
||||
);
|
||||
|
||||
|
@ -1037,7 +1053,7 @@ class Admin {
|
|||
$view = "preferences.html";
|
||||
}
|
||||
|
||||
echo json_encode($view . "?v=1.2.4");
|
||||
echo json_encode($view . "?v=1.2.5");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1177,10 +1193,6 @@ class Admin {
|
|||
|
||||
$ret = $speisekartenHandler->manageSpeisekarte($pdo,$speisekarte);
|
||||
|
||||
if ($ret["status"] == "OK") {
|
||||
$sorter = new Sorter();
|
||||
$sorter->initSortCurrentProductTable($pdo);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
@ -1251,19 +1263,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.2.4"); };
|
||||
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.2.4"); };
|
||||
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.2.4"); };
|
||||
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.2.4"); };
|
||||
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.2.4"); };
|
||||
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.2.4"); };
|
||||
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.2.4"); };
|
||||
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.2.4"); };
|
||||
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.2.4"); };
|
||||
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.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.4"); };
|
||||
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.2.4");
|
||||
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.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.5"); };
|
||||
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.5"); };
|
||||
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.5"); };
|
||||
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.5"); };
|
||||
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.5"); };
|
||||
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.5");
|
||||
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.2.5");
|
||||
}
|
||||
|
||||
$mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php");
|
||||
|
@ -1272,7 +1284,7 @@ class Admin {
|
|||
$waiterMessage = $this->getMessage(null, "waitermessage");
|
||||
}
|
||||
// CAUTION: change version also in config.txt!!!
|
||||
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.2.4",
|
||||
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.2.5",
|
||||
"user" => $currentUser,
|
||||
"menu" => $mainMenu,
|
||||
"waitermessage" => $waiterMessage,
|
||||
|
@ -1499,6 +1511,8 @@ class Admin {
|
|||
"austria" => array("dbcol" => "austria","checknum" => 0),
|
||||
"digigopaysetready" => array("dbcol" => "digigopaysetready","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),
|
||||
"workflowconfig" => array("dbcol" => "workflowconfig","checknum" => 0),
|
||||
"receiptfontsize" => array("dbcol" => "receiptfontsize","checknum" => 0),
|
||||
|
|
|
@ -79,6 +79,11 @@ $closingTime = date('Y-m-d H:i:s');
|
|||
$pdo = $this->dbutils->openDbAndReturnPdo();
|
||||
$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 ,?,?,?,?,?)";
|
||||
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($closingEntrySql));
|
||||
$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->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";
|
||||
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
|
||||
$stmt->execute(array($closingTime,$closingTime));
|
||||
|
@ -200,6 +202,8 @@ array(
|
|||
$newversionavailable = @file_get_contents($url, false, $ctx);
|
||||
// TODO: has to be forwarded to user to inform him
|
||||
|
||||
CommonUtils::callPlugin($pdo, "createClosing", "after");
|
||||
|
||||
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) {
|
||||
return $this->getClosingSummaryCore($closingid, $pdo, $fromWeb, false);
|
||||
public function getClosingSummaryWoSign($closingid,$pdo,$fromWeb,$fl=0) {
|
||||
return $this->getClosingSummaryCore($closingid, $pdo, $fromWeb, false,$fl);
|
||||
}
|
||||
|
||||
public function getClosingSummary($closingid,$pdo,$fromWeb) {
|
||||
return $this->getClosingSummaryCore($closingid, $pdo, $fromWeb, true);
|
||||
public function getClosingSummary($closingid,$pdo,$fromWeb,$fl=0) {
|
||||
return $this->getClosingSummaryCore($closingid, $pdo, $fromWeb, true,$fl);
|
||||
}
|
||||
|
||||
public static function checkForClosingConsistency($pdo,$closingid) {
|
||||
|
@ -604,7 +608,7 @@ openssl_free_key($pubkeyid);
|
|||
return $ok;
|
||||
}
|
||||
|
||||
public function getClosingSummaryCore($closingid,$pdo,$fromWeb,$exportSignature) {
|
||||
public function getClosingSummaryCore($closingid,$pdo,$fromWeb,$exportSignature,$fl=0) {
|
||||
if(is_null($pdo)) {
|
||||
$pdo = $this->dbutils->openDbAndReturnPdo();
|
||||
};
|
||||
|
@ -633,6 +637,13 @@ $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
|
|||
$stmt->execute(array($closingid));
|
||||
$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 .= " from %queue%,%bill% where ";
|
||||
$sql .= "%queue%.billid=%bill%.id AND %bill%.closingid=? AND ";
|
||||
|
@ -647,7 +658,11 @@ $details = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|||
if (!$exportSignature || $fromWeb) {
|
||||
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);
|
||||
}
|
||||
|
||||
if ($fromWeb) {
|
||||
echo json_encode(array("status" => "OK", "msg" => $retVal));
|
||||
|
|
|
@ -5,6 +5,7 @@ require_once ('dbutils.php');
|
|||
|
||||
class CommonUtils {
|
||||
var $dbutils;
|
||||
private static $plugins = null;
|
||||
|
||||
function __construct() {
|
||||
$this->dbutils = new DbUtils();
|
||||
|
@ -13,6 +14,10 @@ class CommonUtils {
|
|||
//error_reporting(E_ALL);
|
||||
}
|
||||
|
||||
public static function setPluginConfig($plugins) {
|
||||
self::$plugins = $plugins;
|
||||
}
|
||||
|
||||
function verifyLastBillId($pdo,$nextIdToUse) {
|
||||
if ($nextIdToUse == 1) {
|
||||
return true;
|
||||
|
@ -272,5 +277,39 @@ class CommonUtils {
|
|||
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;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -19,8 +19,10 @@ $command = $_GET["command"];
|
|||
|
||||
Logger::logcmd($module,$command,"");
|
||||
|
||||
$plugins = havePlugins();
|
||||
|
||||
if ($module == 'admin') {
|
||||
$adminModule = new Admin;
|
||||
$adminModule = new Admin();
|
||||
$adminModule->handleCommand($command);
|
||||
} else if ($module == 'queue') {
|
||||
$queueContent = new QueueContent();
|
||||
|
@ -54,4 +56,27 @@ if ($module == 'admin') {
|
|||
$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;
|
||||
}
|
||||
|
||||
?>
|
|
@ -30,7 +30,7 @@ class PrintQueue {
|
|||
$this->getNextReceiptPrintJobs($_POST['pass'],$_GET['language'],"1,2,3,4,5,6",$fl);
|
||||
}
|
||||
} else if ($command == 'getNextClosingPrintJobs') {
|
||||
$this->getNextClosingPrintJobs($_POST['pass'],$_GET['language']);
|
||||
$this->getNextClosingPrintJobs($_POST['pass'],$_GET['language'],$fl);
|
||||
} else if ($command == 'getNextFoodWorkPrintJobs') {
|
||||
if (isset($_GET['printer'])) {
|
||||
$this->getNextFoodWorkPrintJobs($_GET['printer'],$_POST['pass'],$fl);
|
||||
|
@ -362,7 +362,7 @@ class PrintQueue {
|
|||
echo json_encode($retArray);
|
||||
}
|
||||
|
||||
function getNextClosingPrintJobs($md5pass,$language) {
|
||||
function getNextClosingPrintJobs($md5pass,$language,$fl=0) {
|
||||
$isCorrect = $this->isPasswordCorrect($md5pass,false);
|
||||
if ($isCorrect) {
|
||||
ob_start();
|
||||
|
@ -381,7 +381,7 @@ class PrintQueue {
|
|||
$jobid = $aClos['id'];
|
||||
$closid = $aClos["content"];
|
||||
$printer = $aClos["printer"];
|
||||
$theClosing = $closing->getClosingSummaryWoSign($closid, $pdo, false);
|
||||
$theClosing = $closing->getClosingSummaryWoSign($closid, $pdo, false,$fl);
|
||||
$aClosing = array("id" => $jobid,"closing" => $theClosing, "printer" => $printer);
|
||||
$closingarray[] = $aClosing;
|
||||
}
|
||||
|
|
|
@ -197,17 +197,18 @@ class QueueContent {
|
|||
|
||||
$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 .= " ordertime is not null AND ";
|
||||
$sql .= "%queue%.productid=%products%.id AND ";
|
||||
$sql .= "%queue%.tablenr is null AND ";
|
||||
$sql .= "q.productid=%products%.id AND ";
|
||||
$sql .= "q.tablenr is null AND ";
|
||||
$sql .= "%products%.category=%prodtype%.id AND ";
|
||||
$sql .= "%prodtype%.kind=? AND ";
|
||||
$sql .= "%queue%.isclosed is null AND ";
|
||||
$sql .= "%queue%.workprinted='0') ";
|
||||
$sql .= "AND (%queue%.billid is null OR (";
|
||||
$sql .= "%queue%.billid=%bill%.id AND %bill%.closingid is null)) ";
|
||||
$sql .= "q.isclosed is null AND ";
|
||||
$sql .= "q.workprinted='0') ";
|
||||
$sql .= "AND (q.billid is null OR ( ";
|
||||
$sql .= "b.closingid is null)) ";
|
||||
$sql .= "ORDER BY ordertime,longname,anoption,cooking DESC";
|
||||
|
||||
$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?
|
||||
|
||||
$foodJobsPrinter1 = $this->getJobsToPrint($pdo, 0, 1, $insertedQueueIds);
|
||||
|
@ -454,7 +467,9 @@ class QueueContent {
|
|||
$this->createAWorkReceiptAndQueueWorkPrint($pdo,$drinkJobsPrinter1,$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);
|
||||
return $result;
|
||||
|
@ -636,6 +651,14 @@ class QueueContent {
|
|||
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
|
||||
*/
|
||||
|
@ -666,6 +689,16 @@ class QueueContent {
|
|||
// can bypass the supplydesk
|
||||
$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();
|
||||
echo json_encode(array("status" => "OK"));
|
||||
}
|
||||
|
@ -1576,6 +1609,12 @@ class QueueContent {
|
|||
$ids_array = explode ( ',', $ids );
|
||||
|
||||
$pdo = $this->dbutils->openDbAndReturnPdo();
|
||||
|
||||
if (CommonUtils::callPlugin($pdo, "createBill", "replace")) {
|
||||
return;
|
||||
}
|
||||
CommonUtils::callPlugin($pdo, "createBill", "before");
|
||||
|
||||
$pdo->beginTransaction();
|
||||
|
||||
// check if all items are not paid yet!
|
||||
|
@ -1676,6 +1715,8 @@ class QueueContent {
|
|||
|
||||
$billInfo = array("billid" => $billid, "date" => $currentTime);
|
||||
|
||||
CommonUtils::callPlugin($pdo, "createBill", "after");
|
||||
|
||||
echo json_encode(array("status" => "OK", "msg" => $billInfo));
|
||||
}
|
||||
|
||||
|
|
|
@ -339,6 +339,8 @@ class TypeAndProductFileManager {
|
|||
}
|
||||
|
||||
private function fillProductDbTable($pdo,$leafArray) {
|
||||
$sortArr = array();
|
||||
|
||||
for ($i=0;$i < $leafArray->size(); $i++) {
|
||||
$theLeafEntry = $leafArray->get($i);
|
||||
$product = new ProductEntry();
|
||||
|
@ -357,6 +359,14 @@ class TypeAndProductFileManager {
|
|||
$favorite = 0;
|
||||
$category = $theLeafEntry->getReference();
|
||||
|
||||
$sorting = 0;
|
||||
if (array_key_exists($category, $sortArr)) {
|
||||
$sorting = $sortArr[$category] + 1;
|
||||
$sortArr[$category] = $sorting;
|
||||
} else {
|
||||
$sortArr[$category] = 0;
|
||||
}
|
||||
|
||||
$isNewProd = true;
|
||||
if (!is_null($prodid)) {
|
||||
$sql = "SELECT count(id) as countid FROM %products% WHERE id=?";
|
||||
|
@ -369,10 +379,10 @@ class TypeAndProductFileManager {
|
|||
}
|
||||
}
|
||||
if ($isNewProd) {
|
||||
$sql = "INSERT INTO `%products%` (`id`, `shortname`, `longname`, `priceA`, `priceB`, `priceC`, `tax`, `category`,`available`,`favorite`) VALUES (NULL,";
|
||||
$sql = $sql . "?,?,?,?,?,?,?,?,?)";
|
||||
$sql = "INSERT INTO `%products%` (`id`, `shortname`, `longname`, `priceA`, `priceB`, `priceC`, `tax`, `category`,`available`,`favorite`,`sorting`) VALUES (NULL,";
|
||||
$sql = $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();
|
||||
HistFiller::createProdInHist($pdo, $prodid);
|
||||
} else {
|
||||
|
@ -391,16 +401,14 @@ class TypeAndProductFileManager {
|
|||
|| ($row->tax != $tax));
|
||||
|
||||
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->execute(array($shortName,$longName,$priceA,$priceB,$priceC,$tax,$available,$prodid));
|
||||
|
||||
$sql = "SELECT sorting,available,favorite,audio FROM %products% WHERE id=?";
|
||||
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
|
||||
$stmt->execute(array($prodid));
|
||||
$row = $stmt->fetchObject();
|
||||
|
||||
$stmt->execute(array($shortName,$longName,$priceA,$priceB,$priceC,$tax,$available,$sorting,$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=?";
|
||||
|
|
|
@ -349,7 +349,7 @@ class Basedb {
|
|||
CREATE TABLE `%extras%` (
|
||||
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||
`name` VARCHAR ( 150 ) NOT NULL,
|
||||
`price` DECIMAL (5,2) NOT NULL,
|
||||
`price` " . DECIMALSMALL . "NOT NULL,
|
||||
`removed` INT(1) NULL
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ;
|
||||
";
|
||||
|
@ -390,10 +390,10 @@ class Basedb {
|
|||
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||
`shortname` VARCHAR ( 150 ) NOT NULL,
|
||||
`longname` VARCHAR ( 150 ) NOT NULL,
|
||||
`priceA` DECIMAL (5,2) NULL,
|
||||
`priceB` DECIMAL (5,2) NULL,
|
||||
`priceC` DECIMAL (5,2) NULL,
|
||||
`tax` DECIMAL (5,2) NULL,
|
||||
`priceA` " . DECIMALSMALL . " NULL,
|
||||
`priceB` " . DECIMALSMALL . " NULL,
|
||||
`priceC` " .DECIMALSMALL . " NULL,
|
||||
`tax` " . DECIMALSMALL . " NULL,
|
||||
`category` INT(3) NULL,
|
||||
`favorite` INT(1) NULL,
|
||||
`sorting` INT(2) NULL,
|
||||
|
@ -426,7 +426,7 @@ class Basedb {
|
|||
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||
`closingdate` DATETIME NOT NULL ,
|
||||
`billcount` INT(5) NOT NULL ,
|
||||
`billsum` DECIMAL (9,2) NOT NULL ,
|
||||
`billsum` " . DECIMALBIG . " NOT NULL ,
|
||||
`signature` blob NULL,
|
||||
`remark` VARCHAR ( 1000 )
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ;
|
||||
|
@ -456,17 +456,17 @@ class Basedb {
|
|||
CREATE TABLE `%bill%` (
|
||||
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
||||
`billdate` DATETIME NOT NULL ,
|
||||
`brutto` DECIMAL (7,2) NULL,
|
||||
`netto` DECIMAL (7,2) NULL,
|
||||
`prevbrutto` DECIMAL (9,2) NULL,
|
||||
`prevnetto` DECIMAL (9,2) NULL,
|
||||
`brutto` " . DECIMALMIDDLE . " NULL,
|
||||
`netto` " . DECIMALMIDDLE . " NULL,
|
||||
`prevbrutto` " . DECIMALBIG . " NULL,
|
||||
`prevnetto` " . DECIMALBIG . " NULL,
|
||||
`tableid` VARCHAR ( 150 ) NOT NULL,
|
||||
`closingid` INT(4) NULL,
|
||||
`status` VARCHAR(2) NULL,
|
||||
`paymentid` INT(2) NULL,
|
||||
`userid` INT(3) NULL,
|
||||
`ref` INT(10) NULL,
|
||||
`tax` DECIMAL (5,2) NULL,
|
||||
`tax` " . DECIMALSMALL . " NULL,
|
||||
`host` INT(2) NULL,
|
||||
`reason` VARCHAR ( 150 ) NULL,
|
||||
`signature`blob NULL,
|
||||
|
@ -492,8 +492,8 @@ class Basedb {
|
|||
`tablenr` INT( 3 ) NULL ,
|
||||
`productid` INT( 10 ) NULL ,
|
||||
`pricelevel` INT( 3 ) NOT NULL ,
|
||||
`price` DECIMAL (5,2) NOT NULL,
|
||||
`tax` DECIMAL (5,2) NOT NULL,
|
||||
`price` " . DECIMALSMALL . " NOT NULL,
|
||||
`tax` " . DECIMALSMALL . " NOT NULL,
|
||||
`productname` VARCHAR( 150 ) NULL,
|
||||
`ordertime` DATETIME NULL ,
|
||||
`orderuser` INT(10) NOT NULL ,
|
||||
|
@ -548,10 +548,10 @@ class Basedb {
|
|||
`prodid` INT (10) NOT NULL,
|
||||
`shortname` VARCHAR ( 150 ) NOT NULL,
|
||||
`longname` VARCHAR ( 150 ) NOT NULL,
|
||||
`priceA` DECIMAL (5,2) NULL,
|
||||
`priceB` DECIMAL (5,2) NULL,
|
||||
`priceC` DECIMAL (5,2) NULL,
|
||||
`tax` DECIMAL (5,2) NULL,
|
||||
`priceA` " . DECIMALSMALL . " NULL,
|
||||
`priceB` " . DECIMALSMALL . " NULL,
|
||||
`priceC` " . DECIMALSMALL . " NULL,
|
||||
`tax` " . DECIMALSMALL . " NULL,
|
||||
`sorting` INT(2) NULL,
|
||||
`available` INT(2) NOT NULL,
|
||||
`favorite` INT(1) NULL,
|
||||
|
|
|
@ -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)' );
|
|
@ -8,34 +8,6 @@ class Sorter {
|
|||
$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) {
|
||||
$sql = "SELECT MAX(sorting) as maxsort FROM %products% WHERE removed is null AND category=?";
|
||||
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="author" content="Stefan Pichel">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.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/jquery.mobile.icons.min.css" />
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="author" content="Stefan Pichel">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.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/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_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 lang = 0;
|
||||
|
||||
|
@ -436,7 +439,7 @@ function setLanguage(language) {
|
|||
}
|
||||
|
||||
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]);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="author" content="Stefan Pichel">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.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/jquery.mobile.icons.min.css" />
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="author" content="Stefan Pichel">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.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/jquery.mobile.icons.min.css" />
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="author" content="Stefan Pichel">
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.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/jquery.mobile.icons.min.css" />
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="author" content="Stefan Pichel">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.2.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/jquery.mobile.icons.min.css" />
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="author" content="Stefan Pichel">
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.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/jquery.mobile.icons.min.css" />
|
||||
|
||||
|
|
Loading…
Reference in New Issue