diff --git a/javaprinter/javaprinter.jar b/javaprinter/javaprinter.jar index 1220bf0..1de1f3e 100644 Binary files a/javaprinter/javaprinter.jar and b/javaprinter/javaprinter.jar differ diff --git a/printserver/OrderSprinterPrintserver.exe b/printserver/OrderSprinterPrintserver.exe index 30d16de..66085f1 100644 Binary files a/printserver/OrderSprinterPrintserver.exe and b/printserver/OrderSprinterPrintserver.exe differ diff --git a/webapp/OrderSprinterPrintserver.exe b/webapp/OrderSprinterPrintserver.exe index 30d16de..66085f1 100644 Binary files a/webapp/OrderSprinterPrintserver.exe and b/webapp/OrderSprinterPrintserver.exe differ diff --git a/webapp/bar.html b/webapp/bar.html index 8171a22..b468362 100644 --- a/webapp/bar.html +++ b/webapp/bar.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/bill.html b/webapp/bill.html index 515213b..75aa094 100644 --- a/webapp/bill.html +++ b/webapp/bill.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/feedback.html b/webapp/feedback.html index 1c2ba6c..4f7d84e 100644 --- a/webapp/feedback.html +++ b/webapp/feedback.html @@ -4,7 +4,7 @@ - + diff --git a/webapp/index.html b/webapp/index.html index 9e9bf3c..c1e99f5 100644 --- a/webapp/index.html +++ b/webapp/index.html @@ -7,8 +7,8 @@ - - + + diff --git a/webapp/install.html b/webapp/install.html index a4d82a4..18a88c3 100644 --- a/webapp/install.html +++ b/webapp/install.html @@ -679,7 +679,7 @@ $(document).ready(function() {   - +   diff --git a/webapp/install/installer.php b/webapp/install/installer.php index 198b13e..e3131fc 100644 --- a/webapp/install/installer.php +++ b/webapp/install/installer.php @@ -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(); @@ -1321,6 +1322,30 @@ return true; } catch (PDOException $e) { 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) { @@ -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(); diff --git a/webapp/kitchen.html b/webapp/kitchen.html index baed5f7..a2e47d7 100644 --- a/webapp/kitchen.html +++ b/webapp/kitchen.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/manager.html b/webapp/manager.html index e696a9e..f354fcf 100644 --- a/webapp/manager.html +++ b/webapp/manager.html @@ -5,7 +5,7 @@ - + @@ -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 += ''; html += ''; - echo $button; - $colcounter++; - if ($colcounter == $numberOfCols) { - $colcounter = 0; - echo ""; - } - } - echo ""; - echo ""; + $button = $button . ' onclick="' . $onClickMethod . '"'; + $button = $button . ' style="' . $style . '; width:' . $porcentageWidth . '%;" />'; + echo $button; + $colcounter++; + if ($colcounter == $numberOfCols) { + $colcounter = 0; + echo ""; + } + } + echo ""; + echo ""; } - function getCurrency() { - $pdo = $this->dbutils->openDbAndReturnPdo(); + function getCurrency() { + $pdo = $this->dbutils->openDbAndReturnPdo(); - $sql = "SELECT setting from %config% where name='currency'"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - $row =$stmt->fetchObject(); - if ($row != null) { - return $row->setting; + $sql = "SELECT setting from %config% where name='currency'"; + $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); + $stmt->execute(); + $row =$stmt->fetchObject(); + if ($row != null) { + return $row->setting; } else { 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; } } ?> \ No newline at end of file diff --git a/webapp/php/contenthandler.php b/webapp/php/contenthandler.php index 90c99aa..92848c5 100644 --- a/webapp/php/contenthandler.php +++ b/webapp/php/contenthandler.php @@ -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; +} + ?> \ No newline at end of file diff --git a/webapp/php/printqueue.php b/webapp/php/printqueue.php index 93c2af3..a47d6d6 100644 --- a/webapp/php/printqueue.php +++ b/webapp/php/printqueue.php @@ -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; } diff --git a/webapp/php/queuecontent.php b/webapp/php/queuecontent.php index 79c63a7..8ca2c3b 100644 --- a/webapp/php/queuecontent.php +++ b/webapp/php/queuecontent.php @@ -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); @@ -448,13 +461,15 @@ class QueueContent { $drinkJobsPrinter1 = $this->getJobsToPrint($pdo, 1, 1, $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,$foodJobsPrinter2,$theTableid,0,2,$username,$lang); $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)); } diff --git a/webapp/php/utilities/TypeAndProducts/TypeAndProductFileManager.php b/webapp/php/utilities/TypeAndProducts/TypeAndProductFileManager.php index f6e7deb..c598c98 100644 --- a/webapp/php/utilities/TypeAndProducts/TypeAndProductFileManager.php +++ b/webapp/php/utilities/TypeAndProducts/TypeAndProductFileManager.php @@ -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(); @@ -356,6 +358,14 @@ class TypeAndProductFileManager { $available = $product->getAvailable(); $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)) { @@ -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=?"; diff --git a/webapp/php/utilities/basedb.php b/webapp/php/utilities/basedb.php index 1731f62..232a22f 100644 --- a/webapp/php/utilities/basedb.php +++ b/webapp/php/utilities/basedb.php @@ -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, diff --git a/webapp/php/utilities/decimaldefs.php b/webapp/php/utilities/decimaldefs.php new file mode 100644 index 0000000..5b610bf --- /dev/null +++ b/webapp/php/utilities/decimaldefs.php @@ -0,0 +1,5 @@ +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=?"; diff --git a/webapp/preferences.html b/webapp/preferences.html index c9a6c78..8d0ded8 100644 --- a/webapp/preferences.html +++ b/webapp/preferences.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/products.html b/webapp/products.html index ceb9556..6a389a9 100644 --- a/webapp/products.html +++ b/webapp/products.html @@ -7,7 +7,7 @@ - + @@ -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; } diff --git a/webapp/rating.html b/webapp/rating.html index 5a9ec61..e8b8db8 100644 --- a/webapp/rating.html +++ b/webapp/rating.html @@ -7,7 +7,7 @@ - + diff --git a/webapp/reports.html b/webapp/reports.html index 32e728f..96c54d1 100644 --- a/webapp/reports.html +++ b/webapp/reports.html @@ -7,7 +7,7 @@ - + diff --git a/webapp/reservation.html b/webapp/reservation.html index 960fd5e..f7629a3 100644 --- a/webapp/reservation.html +++ b/webapp/reservation.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/supplydesk.html b/webapp/supplydesk.html index 269bfaf..f9801cf 100644 --- a/webapp/supplydesk.html +++ b/webapp/supplydesk.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/waiter.html b/webapp/waiter.html index 267173a..000bdce 100644 --- a/webapp/waiter.html +++ b/webapp/waiter.html @@ -4,7 +4,7 @@ - +