From ea17d50f5eab018c65bf5e2f4d3934e65e492912 Mon Sep 17 00:00:00 2001 From: Geno Date: Thu, 19 Nov 2020 23:12:39 +0100 Subject: [PATCH] OrderSprinter 1.5.26 --- gastsystem/css/gueststyle.css | 2 +- gastsystem/db/.htaccess | 9 + gastsystem/index.php | 13 +- gastsystem/install.php | 24 +- gastsystem/js/ordering.js | 2 +- gastsystem/php/config.php | 15 +- gastsystem/php/dbutils.php | 113 ++++++- gastsystem/php/menu.php | 38 +-- gastsystem/php/ossystem.php | 130 +++++--- gastsystem/php/queue.php | 37 ++- gastsystem/php/tables.php | 37 +-- gastsystem/sync.php | 303 ++++++++++++++---- printserver/OrderSprinterPrintserver.exe | Bin 283136 -> 283136 bytes spider/install/installer.php | 2 +- webapp/OrderSprinterPrintserver.exe | Bin 283136 -> 283136 bytes webapp/bar.html | 6 +- webapp/bill.html | 2 +- webapp/customer/speisekarte.txt | 13 +- webapp/elements/extra.js | 47 +-- webapp/feedback.html | 2 +- webapp/index.html | 23 +- webapp/install.html | 2 +- webapp/install/installer.php | 2 +- webapp/kitchen.html | 6 +- webapp/logout.php | 2 +- webapp/manager.html | 60 +++- webapp/paydesk.html | 4 +- webapp/php/admin.php | 51 +-- webapp/php/bill.php | 29 +- webapp/php/customers.php | 2 +- webapp/php/debug.php | 2 +- webapp/php/guestsync.php | 14 +- webapp/php/printqueue.php | 49 ++- webapp/php/products.php | 50 +-- webapp/php/queuecontent.php | 18 +- webapp/php/reports.php | 2 +- .../utilities/TypeAndProducts/ExtraItem.php | 55 +++- .../TypeAndProducts/ProductEntry.php | 2 +- .../TypeAndProductFileManager.php | 2 +- webapp/php/utilities/clostemplater.php | 2 +- webapp/php/utilities/version.php | 15 +- webapp/pickups.html | 4 +- webapp/preferences.html | 2 +- webapp/products.html | 26 +- webapp/productsdesktop.php | 2 +- webapp/rating.html | 2 +- webapp/reports.html | 2 +- webapp/reservation.html | 4 +- webapp/sumuphandler.php | 6 +- webapp/supplydesk.html | 2 +- webapp/tasks.html | 4 +- webapp/timetracking.html | 2 +- webapp/waiter.html | 7 +- webapp/waiterdesktop.php | 3 +- 54 files changed, 864 insertions(+), 389 deletions(-) create mode 100644 gastsystem/db/.htaccess diff --git a/gastsystem/css/gueststyle.css b/gastsystem/css/gueststyle.css index 5ed1599..7766645 100644 --- a/gastsystem/css/gueststyle.css +++ b/gastsystem/css/gueststyle.css @@ -24,7 +24,7 @@ background-color: graytext; } -#warningdiv { +#warningdiv,#warningdiv2 { border: 20px solid black; border-radius: 5px; padding: 40px; diff --git a/gastsystem/db/.htaccess b/gastsystem/db/.htaccess new file mode 100644 index 0000000..c4daaee --- /dev/null +++ b/gastsystem/db/.htaccess @@ -0,0 +1,9 @@ +Options -Indexes + +Order allow,deny +Deny from all + + +Order allow,deny +Deny from all + \ No newline at end of file diff --git a/gastsystem/index.php b/gastsystem/index.php index 402e805..5c2ad53 100644 --- a/gastsystem/index.php +++ b/gastsystem/index.php @@ -9,8 +9,8 @@ - - + + @@ -38,10 +38,15 @@ + @@ -106,7 +111,7 @@
  OrderSprinter
-
1.5.25  
+
1.5.26  
diff --git a/gastsystem/install.php b/gastsystem/install.php index fdd17ad..17dd25f 100644 --- a/gastsystem/install.php +++ b/gastsystem/install.php @@ -2,6 +2,7 @@ require_once 'php/dbutils.php'; require_once 'php/config.php'; +defined('DB') || define ( 'DB','mysql' ); class Installer { @@ -24,7 +25,7 @@ class Installer { $sql = " CREATE TABLE `%images%` ( `id` INT (2) NOT NULL AUTO_INCREMENT PRIMARY KEY , - `name` VARCHAR ( 100 ) , + `imagename` VARCHAR ( 100 ) , `content` MEDIUMBLOB, `contenttype` INT(1) NULL, `productid` INT(10) NULL @@ -76,13 +77,24 @@ class Installer { } public static function install($code) { + $fileMsg = 'In der Konfiguration wurde festgelegt, dass die temporären Laufzeitdaten im Filesystem abgelegt werden sollen. '; + $fileMsg .= 'Daher ist keine Installation erforderlich und das Gastbestellsystem kann direkt aufgerufen werden.

'; + $fileMsg .= '
'; + if (DB == 'file') { + return array("status" => "ERROR", "msg" => $fileMsg); + }; if ($code != CODE) { return array("status" => "ERROR", "msg" => "Falscher Installationscode!"); } try { - $pdo = DbUtils::openDbAndReturnPdoStatic(); - self::createSystemTable($pdo); - return array("status" => "OK"); + if (DB == 'mysql') { + if (!extension_loaded("pdo_mysql")) { + return array("status" => "ERROR", "msg" => "PHP Pdo-MySQL extension nicht geladen"); + } + $pdo = DbUtils::openDbAndReturnPdoStatic(); + self::createSystemTable($pdo); + return array("status" => "OK"); + } } catch (Exception $ex) { return array("status" => "ERROR", "msg" => $ex->getMessage()); } @@ -102,10 +114,10 @@ if (isset($_POST['code'])) { } else { echo ""; echo "Installation Gastsystem"; - echo ''; + echo ''; echo ""; echo "
"; - echo "Installation OrderSprinter-Gastsystem 1.5.25

"; + echo "Installation OrderSprinter-Gastsystem 1.5.26

"; echo "
"; echo "
"; echo "
"; diff --git a/gastsystem/js/ordering.js b/gastsystem/js/ordering.js index 4b9c8b9..6e08505 100644 --- a/gastsystem/js/ordering.js +++ b/gastsystem/js/ordering.js @@ -1 +1 @@ -$(document).on("pageinit","#guest-page",function(){intervalCheckLastOsSystemAccess(5);getTables()});var selectedTableid=null;var syncisWorking=false;var dailycode=null;var tablecode=null;var products=null;var types=null;var currency="";var decpoint=".";var selectedproduct=null;var selectedtable=null;var timeout=0;var timecounter=0;var askdaycode=1;var asktablecode=1;var fetchTimer=null;function intervalCheckLastOsSystemAccess(b){doAjax("GET","php/ossystem.php?command=getlastosaccess",null,insertSyncIsWorking,true);var a=setInterval(function(){doAjax("GET","php/ossystem.php?command=getlastosaccess",null,insertSyncIsWorking,true)},b*1000)}function timeouting(){if(fetchTimer!=null){clearTimeout(fetchTimer)}if(timeout!=0){timecounter=0;fetchTimer=setInterval(function(){updateTimer()},1000)}}function createReadableTimeValue(c){var b=Math.floor(c/60);var a=c%60;if(a<10){a="0"+a.toString()}return"Verbleibende Zeit bis Neuanmeldung: "+b+":"+a+"  "}function updateTimer(){if(timecounter>0){$("#timecounter").show();$("#timecounter").html(createReadableTimeValue(timecounter))}else{$("#timecounter").hide()}if(timecounter>0){timecounter--;if(timecounter==0){var a=$("#tableselection").is(":visible");if(!a){$(".notcollapsible").hide();getTables()}}}}function insertSyncIsWorking(a){if(a.status=="OK"){if(a.msg==1){syncisWorking=true}else{syncisWorking=false}if(syncisWorking){$("#warningdiv").hide()}else{$("#warningdiv").show()}}}function getTables(){doAjax("GET","php/tables.php?command=gettables",null,insertTables,"Fehler beim Abruf der Tische",true)}function preventCollapsible(){$(".notcollapsible").off("collapsiblecollapse").on("collapsiblecollapse",function(a){a.stopImmediatePropagation();a.preventDefault();var b=this.id;$("#"+b).collapsible("expand")})}function insertTables(b){if(b.status!="OK"){alert("Es ist ein Fehler aufgetreten: "+b.msg)}else{currency=b.currency;decpoint=b.decpoint;timeout=b.timeout;askdaycode=b.askdaycode;asktablecode=b.asktablecode;var a="";a+=fillSelectionBox("tableselect",b.msg,"Tischauswahl");$("#tableselectionbox").html(a);$("#tableselection").show();$("#tableselection").trigger("create");preventCollapsible();$("#tableselectionbox").off("change").on("change",function(c){c.stopImmediatePropagation();c.preventDefault();selectedTableid=$("#tableselect").val();if(selectedTableid!=(-1)){$("#tableselection").hide();handleCodeInput()}});timeouting()}}function handleCodeInput(){if((askdaycode==0)&&(asktablecode==0)){tablecode="empty";dailycode="empty";timecounter=timeout;initProductsView();return}$("#tablecodediv").show();preventCollapsible();if(askdaycode==1){tablecode="empty";$("#daycodearea").show()}if(asktablecode==1){dailycode="empty";$("#tablecodearea").show()}$("#tablecodefield").val("");$("#dailycodefield").val("");$("#codebackbtn").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();hideCodeAreas();$("#tablecodediv").hide();getTables()});$("#submitcodesbtn").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();tablecode=$("#tablecodefield").val().trim();dailycode=$("#dailycodefield").val().trim();var a={tableid:selectedTableid,tablecode:tablecode,dailycode:dailycode};doAjax("POST","php/tables.php?command=checkcodes",a,handleCodeCheck,"Fehler bei der Abfrage der Codes",true)})}function hideCodeAreas(){$("#daycodearea").hide();$("#tablecodearea").hide()}function handleCodeCheck(a){if(a.status!="OK"){alert(a.msg)}else{hideCodeAreas();timecounter=timeout;initProductsView()}}function fillSelectionBox(f,b,d){var e='
';e+='";return e}function toHtml(a){return(a.replace(/"/g,""").replace(//g,">"))}function initProductsView(){doAjax("POST","php/menu.php?command=getmenu",null,showProductsView,"Fehler bei der Abfrage der Speisekarte",true)}function showProductsView(a){timecounter=timeout;preventCollapsible();if(a.status!="OK"){alert("Fehler: "+a.msg);$("#productsdiv").hide();getTables()}else{products=a.msg.products;types=a.msg.types;showProdTypes(0);$("#tablecodediv").hide();$("#productsdiv").show();$("#prodbackbtn").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();$("#productsdiv").hide();getTables()})}}function showProdTypes(c){timecounter=timeout;var a=createTypesHtml(c);if(a!=null){$("#typesdiv").html(a);$("#typesdiv").trigger("create")}bindProdTypes();var b=createProdsHtml(c);if(b!=null){$("#prodsdiv").show();$("#prodsdiv").html(b);$("#prodsdiv").trigger("create");bindProducts()}else{$("#prodsdiv").hide()}preventCollapsible()}function bindProducts(){$(".product").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();var b=this.id.split("_")[1];selectedproduct=b;$("#productsdiv").hide();$("#prodconfirmdiv").show();timecounter=timeout;var a=getProductName(b);$("#selectedprod").html(toHtml(a));bindProdConfirm()})}function bindProdTypes(){$(".prodtype").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();var a=this.id.split("_")[1];showProdTypes(a)});$(".up").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();var a=this.id.split("_")[1];showProdTypes(a)})}function createTypesHtml(d){if(types==null){return null}var c='";return c}function getParentOfReference(c){for(var b=0;b';if(a){var k="php/ossystem.php?command=getprodimage&prodid="+h.id;f+=''}f+=toHtml(h.longname);f+=" ("+g+")"}}f+="";if(e){return f}else{return null}}function getProductName(b){for(var a=0;a');intervalCheckLastOsSystemAccess(5);getTables()});var selectedTableid=null;var syncisWorking=false;var dailycode=null;var tablecode=null;var products=null;var types=null;var currency="";var decpoint=".";var selectedproduct=null;var selectedtable=null;var timeout=0;var timecounter=0;var askdaycode=1;var asktablecode=1;var fetchTimer=null;function intervalCheckLastOsSystemAccess(b){doAjax("GET","php/ossystem.php?command=getsystemstatus",null,insertSyncIsWorking,true);var a=setInterval(function(){doAjax("GET","php/ossystem.php?command=getsystemstatus",null,insertSyncIsWorking,true)},b*1000)}function timeouting(){if(fetchTimer!=null){clearTimeout(fetchTimer)}if(timeout!=0){timecounter=0;fetchTimer=setInterval(function(){updateTimer()},1000)}}function createReadableTimeValue(c){var b=Math.floor(c/60);var a=c%60;if(a<10){a="0"+a.toString()}return"Verbleibende Zeit bis Neuanmeldung: "+b+":"+a+"  "}function updateTimer(){if(timecounter>0){$("#timecounter").show();$("#timecounter").html(createReadableTimeValue(timecounter))}else{$("#timecounter").hide()}if(timecounter>0){timecounter--;if(timecounter==0){var a=$("#tableselection").is(":visible");if(!a){$(".notcollapsible").hide();getTables()}}}}function insertSyncIsWorking(c){if(c.status=="OK"){if(c.msg.lastaccessok==1){syncisWorking=true}else{syncisWorking=false}if(syncisWorking){$("#warningdiv").hide()}else{$("#warningdiv").show()}var a=c.msg.dbwritestatus;var d=a.writeable;if(d==0){var b=a.file;if(a.reason!=""){b+=" (Zusatzinfo: "+a.reason+")"}$("#writeprotectedfile").html(b);$("#warningdiv2").show()}else{$("#warningdiv2").hide()}}}function getTables(){doAjax("GET","php/tables.php?command=gettables",null,insertTables,"Fehler beim Abruf der Tische",true)}function preventCollapsible(){$(".notcollapsible").off("collapsiblecollapse").on("collapsiblecollapse",function(a){a.stopImmediatePropagation();a.preventDefault();var b=this.id;$("#"+b).collapsible("expand")})}function insertTables(b){if(b.status!="OK"){alert("Es ist ein Fehler aufgetreten: "+b.msg)}else{currency=b.currency;decpoint=b.decpoint;timeout=b.timeout;askdaycode=b.askdaycode;asktablecode=b.asktablecode;var a="";a+=fillSelectionBox("tableselect",b.msg,"Tischauswahl");$("#tableselectionbox").html(a);$("#tableselection").show();$("#tableselection").trigger("create");preventCollapsible();$("#tableselectionbox").off("change").on("change",function(c){c.stopImmediatePropagation();c.preventDefault();selectedTableid=$("#tableselect").val();if(selectedTableid!=(-1)){$("#tableselection").hide();handleCodeInput()}});timeouting()}}function handleCodeInput(){if((askdaycode==0)&&(asktablecode==0)){tablecode="empty";dailycode="empty";timecounter=timeout;initProductsView();return}$("#tablecodediv").show();preventCollapsible();if(askdaycode==1){tablecode="empty";$("#daycodearea").show()}if(asktablecode==1){dailycode="empty";$("#tablecodearea").show()}$("#tablecodefield").val("");$("#dailycodefield").val("");$("#codebackbtn").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();hideCodeAreas();$("#tablecodediv").hide();getTables()});$("#submitcodesbtn").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();tablecode=$("#tablecodefield").val().trim();dailycode=$("#dailycodefield").val().trim();var a={tableid:selectedTableid,tablecode:tablecode,dailycode:dailycode};doAjax("POST","php/tables.php?command=checkcodes",a,handleCodeCheck,"Fehler bei der Abfrage der Codes",true)})}function hideCodeAreas(){$("#daycodearea").hide();$("#tablecodearea").hide()}function handleCodeCheck(a){if(a.status!="OK"){alert(a.msg)}else{hideCodeAreas();timecounter=timeout;initProductsView()}}function fillSelectionBox(f,b,d){var e='
';e+='";return e}function toHtml(a){return(a.replace(/"/g,""").replace(//g,">"))}function initProductsView(){doAjax("POST","php/menu.php?command=getmenu",null,showProductsView,"Fehler bei der Abfrage der Speisekarte",true)}function showProductsView(a){timecounter=timeout;preventCollapsible();if(a.status!="OK"){alert("Fehler: "+a.msg);$("#productsdiv").hide();getTables()}else{products=a.msg.products;types=a.msg.types;showProdTypes(0);$("#tablecodediv").hide();$("#productsdiv").show();$("#prodbackbtn").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();$("#productsdiv").hide();getTables()})}}function showProdTypes(c){timecounter=timeout;var a=createTypesHtml(c);if(a!=null){$("#typesdiv").html(a);$("#typesdiv").trigger("create")}bindProdTypes();var b=createProdsHtml(c);if(b!=null){$("#prodsdiv").show();$("#prodsdiv").html(b);$("#prodsdiv").trigger("create");bindProducts()}else{$("#prodsdiv").hide()}preventCollapsible()}function bindProducts(){$(".product").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();var b=this.id.split("_")[1];selectedproduct=b;$("#productsdiv").hide();$("#prodconfirmdiv").show();timecounter=timeout;var a=getProductName(b);$("#selectedprod").html(toHtml(a));bindProdConfirm()})}function bindProdTypes(){$(".prodtype").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();var a=this.id.split("_")[1];showProdTypes(a)});$(".up").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();var a=this.id.split("_")[1];showProdTypes(a)})}function createTypesHtml(d){if(types==null){return null}var c='";return c}function getParentOfReference(c){for(var b=0;b';if(a){var l="php/ossystem.php?command=getprodimage&prodid="+j.id+"&t="+c;g+=''}g+=toHtml(j.longname);g+=" ("+h+")"}}g+="";if(f){return g}else{return null}}function getProductName(b){for(var a=0;a 0) { + $val = $result[0]["value"]; + } + } else { + $val = self::getOsValueFromDbFile($item, $default); + } + if ($item == "timezone") { + self::$cachedTimezone = $val; + } + return $val; + } + + public static function getImageData($pdo,$imageName,$productid) { + if (DB == "mysql") { + if (is_null($productid)) { + $sql = "SELECT content FROM %images% WHERE imagename=?"; + $result = DbUtils::fetchSqlAll($pdo, $sql, array($imageName)); + } else { + $sql = "SELECT content FROM %images% WHERE productid=?"; + $result = DbUtils::fetchSqlAll($pdo, $sql, array($productid)); + } + if (count($result) > 0) { + return ($result[0]["content"]); + } else { + return null; + } + } else { + $filename = dirname(__FILE__) . '/../db/' . IMAGES_FILE; + try { + if (file_exists($filename)) { + + $fileContent = file_get_contents($filename); + $images = json_decode($fileContent,true); + + foreach($images as $img) { + if (is_null($productid)) { + if ($img["imagename"] == $imageName) { + return $img["content"]; + } + } else { + if ($img["productid"] == $productid) { + return $img["content"]; + } + } + } + + } + } catch (Exception $ex) { + return null; + } + return null; + } + } + + private static function logTruncated($filename, $max) { + try { + $offset = filesize($filename) - $max; + if ($offset > 0) { + $logsToKeep = file_get_contents($filename, NULL, NULL, $offset, $max); + file_put_contents($filename, $logsToKeep); + } + } catch (Exception $ex) {} + } + + public static function log($str) { + if (LOG) { + try { + date_default_timezone_set(self::$cachedTimezone); + $logfile = dirname(__FILE__) . '/../db/log.txt'; + self::logTruncated($logfile, MAX_LOG_CHARS); + $logtime = date('Y-m-d H:i:s'); + file_put_contents($logfile, "$logtime: $str\r\n", FILE_APPEND); + } catch (Exception $ex) { } + } + } + + public static function logVar($description,$v) { + ob_start(); + print_r($v); + $result = ob_get_clean(); + self::log($description . ": " . $result); + } } \ No newline at end of file diff --git a/gastsystem/php/menu.php b/gastsystem/php/menu.php index 4ee4f99..1690743 100644 --- a/gastsystem/php/menu.php +++ b/gastsystem/php/menu.php @@ -2,35 +2,31 @@ require_once 'dbutils.php'; require_once 'config.php'; +defined('DB') || define ( 'DB','mysql' ); class Menu { public static function getmenu($pdo) { - $sql = "SELECT value FROM %ossystem% WHERE item=?"; - $result = DbUtils::fetchSqlAll($pdo, $sql, array('products')); - - if (is_null($result) || (count($result) == 0)) { + $productsJson = DbUtils::getConfigItem($pdo, 'products', null); + if (is_null($productsJson)) { return array("status" => "ERROR","msg" => "Keine Produktdefinition hinterlegt."); } + $products = json_decode($productsJson,true); - $products = json_decode($result[0]["value"], true); - - $sql = "SELECT value FROM %ossystem% WHERE item=?"; - $result = DbUtils::fetchSqlAll($pdo, $sql, array('types')); - - if (is_null($result) || (count($result) == 0)) { + $typesJson = DbUtils::getConfigItem($pdo, 'types', null); + if (is_null($typesJson)) { return array("status" => "ERROR","msg" => "Keine Produktdefinition hinterlegt."); } - - $types = json_decode($result[0]["value"], true); + $types = json_decode($typesJson,true); + foreach ($types as &$t) { $typeid = $t["id"]; - $t["hasprodimages"] = self::hasTypeProdImages($pdo, $types, $products, $typeid); + $t["hasprodimages"] = self::hasTypeProdImages($pdo, $products, $typeid); } return array("status" => "OK","msg" => array("types" => $types,"products" => $products)); } - private static function hasTypeProdImages($pdo,$alltypes,$allproducts,$typeid) { + private static function hasTypeProdImages($pdo,$allproducts,$typeid) { $prodids = array(); foreach($allproducts as $p) { if ($p["ref"] == $typeid) { @@ -39,12 +35,9 @@ class Menu { } $sql = "SELECT IFNULL(content,'') as content FROM %images% WHERE contenttype=? AND productid=?"; foreach($prodids as $prodid) { - $img = DbUtils::fetchSqlAll($pdo, $sql, array(DbUtils::$TYPE_PRODIMG,$prodid)); - if (count($img) > 0) { - $imgdata = $img[0]["content"]; - if ($imgdata != '') { - return 1; - } + $img = DbUtils::getImageData($pdo, '', $prodid); + if (!is_null($img)) { + return 1; } } return 0; @@ -55,7 +48,10 @@ class Menu { if (isset($_GET["command"])) { $command = $_GET["command"]; - $pdo = DbUtils::openDbAndReturnPdoStatic(); + $pdo = null; + if (DB == "mysql") { + $pdo = DbUtils::openDbAndReturnPdoStatic(); + } switch ($command) { case "getmenu": diff --git a/gastsystem/php/ossystem.php b/gastsystem/php/ossystem.php index ce24596..48afc4c 100644 --- a/gastsystem/php/ossystem.php +++ b/gastsystem/php/ossystem.php @@ -2,6 +2,7 @@ require_once 'dbutils.php'; require_once 'config.php'; +defined('DB') || define ( 'DB','mysql' ); class OsSystem { private static function outputEmptyImage() { @@ -15,84 +16,113 @@ class OsSystem { imagedestroy( $my_img ); } - public static function getlogo($pdo) { - $sql = "SELECT content as img FROM %images% WHERE name='logo'"; - self::outputImageFromDb($pdo, $sql, null); + public static function getlogo($pdo) { + $img = DbUtils::getImageData($pdo, 'logo', null); + self::outputImage($pdo, $img); } public static function getprodimage($pdo,$prodid) { - $sql = "SELECT content as img FROM %images% WHERE contenttype=? AND productid=?"; - $params = array(DbUtils::$TYPE_PRODIMG,$prodid); - self::outputImageFromDb($pdo, $sql, $params); + $img = DbUtils::getImageData($pdo, '', $prodid); + self::outputImage($pdo, $img); } - private static function outputImageFromDb($pdo,$sql,$params) { + private static function outputImage($pdo,$imgDataInBase64) { header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Pragma: no-cache"); header("Expires: Mon, 20 Dec 1998 01:00:00 GMT" ); header('Content-Type: ' . image_type_to_mime_type(IMAGETYPE_PNG)); - $result = DbUtils::fetchSqlAll($pdo, $sql, $params); - if (count($result) > 0) { - $logoImg = $result[0]["img"]; - if ($logoImg != '') { - $img = base64_decode($logoImg); - $php_img = imagecreatefromstring($img); - - imagesavealpha($php_img, true); - $color = imagecolorallocatealpha($php_img, 0, 0, 0, 127); - - imagepng($php_img, NULL); - imagecolordeallocate( $color ); - imagedestroy($php_img); - return; - } + if (!is_null($imgDataInBase64)) { + $img = base64_decode($imgDataInBase64); + $php_img = imagecreatefromstring($img); + + imagesavealpha($php_img, true); + $color = imagecolorallocatealpha($php_img, 0, 0, 0, 127); + + imagepng($php_img, NULL); + imagecolordeallocate( $color ); + imagedestroy($php_img); + return; } self::outputEmptyImage(); } - public static function checkLastOsAccess($pdo) { - $timezone = self::getTimeZone($pdo); - date_default_timezone_set($timezone); - - $sql = "SELECT date FROM %gueststatus% WHERE item=?"; - $result = DbUtils::fetchSqlAll($pdo, $sql, array('lastosaccess')); - - if (count($result) == 0) { - $msg = "0"; - } else { - $lastaccess = $result[0]["date"]; - - $date = new DateTime(); - $currentTimeStamp = $date->getTimestamp(); - - if (($currentTimeStamp - $lastaccess) > 60) { - $msg = 0; + private static function checkIndividualFileWriteStatus($filename) { + if (file_exists($filename)) { + if (is_writable($filename)) { + return array("writeable" => 1); } else { - $msg = 1; + return array("writeable" => 0,"file" => "Datei $filename nicht beschreibbar", "reason" => ''); } } - return array("status" => "OK","msg" => $msg); + } + private static function checkFileDbWriteStatus() { + $dir = dirname(__FILE__) . '/../db'; + if (!file_exists($dir)) { + return array("writeable" => 0,"file" => $dir, "reason" => "Verzeichnis existiert nicht"); + } else if (!is_writable($dir)) { + return array("writeable" => 0,"file" => $dir, "reason" => ''); + } + $filesToCheck = array(STATUS_FILE,OSSYSTEM_FILE,IMAGES_FILE,QUEUE_FILE); + foreach ($filesToCheck as $aFile) { + $filename = $dir . '/' . $aFile; + $writeStatus = self::checkIndividualFileWriteStatus($filename); + if ($writeStatus["writeable"] == 0) { + return $writeStatus; + } + } + return array(1); } - public static function getTimeZone($pdo) { - $sql = "select value from %ossystem% where item=?"; - $result = DbUtils::fetchSqlAll($pdo, $sql, array("timezone")); - if (count($result) == 1) { - return $result[0]["value"]; + public static function getsystemstatus($pdo) { + $timezone = DbUtils::getConfigItem($pdo, "timezone", "Europe/Berlin"); + date_default_timezone_set($timezone); + + $writeStatus = array(1); + $lastaccess = null; + if (DB == "mysql") { + $sql = "SELECT date FROM %gueststatus% WHERE item=?"; + $result = DbUtils::fetchSqlAll($pdo, $sql, array('lastosaccess')); + + if (count($result) > 0) { + $lastaccess = $result[0]["date"]; + } } else { - return "Europe/Berlin"; + try { + $writeStatus = self::checkFileDbWriteStatus(); + $lastaccess = file_get_contents("../db/" . STATUS_FILE); + } catch (Exception $ex) { + $lastaccess = null; + } + } + + $date = new DateTime(); + $currentTimeStamp = $date->getTimestamp(); + + if (!is_null($lastaccess)) { + if (($currentTimeStamp - $lastaccess) > 60) { + $lastaccessok = 0; + } else { + $lastaccessok = 1; + } + } else { + $lastaccessok = 0; } + + return array("status" => "OK","msg" => array("lastaccessok" => $lastaccessok,"dbwritestatus" => $writeStatus)); } } if (isset($_GET["command"])) { $command = $_GET["command"]; - $pdo = DbUtils::openDbAndReturnPdoStatic(); + $pdo = null; + if (DB == "mysql") { + $pdo = DbUtils::openDbAndReturnPdoStatic(); + } switch ($command) { - case "getlastosaccess": - $ret = OsSystem::checkLastOsAccess($pdo); + case "getsystemstatus": + $ret = OsSystem::getsystemstatus($pdo); echo json_encode($ret); break; case "getlogo": diff --git a/gastsystem/php/queue.php b/gastsystem/php/queue.php index 6388316..93b4661 100644 --- a/gastsystem/php/queue.php +++ b/gastsystem/php/queue.php @@ -2,19 +2,37 @@ require_once 'dbutils.php'; require_once 'config.php'; +defined('DB') || define ( 'DB','mysql' ); require_once 'ossystem.php'; class Queue { public static function putintoqueue($pdo,$prodid,$tableid,$tablecode,$dailycode) { - $timezone = OsSystem::getTimeZone($pdo); + $timezone = DbUtils::getConfigItem($pdo, "timezone", "Europe/Berlin"); date_default_timezone_set($timezone); $ordertime = date('Y-m-d H:i:s'); - $pdo->beginTransaction(); - $sql = "INSERT INTO %queue% (date,prodid,tableid,tablecode,dailycode) VALUES(?,?,?,?,?)"; - DbUtils::execSql($pdo, $sql, array($ordertime,$prodid,$tableid,$tablecode,$dailycode)); - $pdo->commit(); - - return array("status" => "OK"); + if (DB == "mysql") { + $pdo->beginTransaction(); + $sql = "INSERT INTO %queue% (date,prodid,tableid,tablecode,dailycode) VALUES(?,?,?,?,?)"; + DbUtils::execSql($pdo, $sql, array($ordertime,$prodid,$tableid,$tablecode,$dailycode)); + $pdo->commit(); + DbUtils::log("Added product with id $prodid to mysql queue table"); + return array("status" => "OK"); + } else { + $filename = dirname(__FILE__) . '/../db/' . QUEUE_FILE; + try { + $queueItems = array(); + if (file_exists($filename)) { + $queueItemsFileContent = file_get_contents($filename); + $queueItems = json_decode($queueItemsFileContent,true); + } + $queueItems[] = array("date" => $ordertime,"prodid" => $prodid,"tableid" => $tableid, "tablecode" => $tablecode, "dailycode" => $dailycode); + file_put_contents($filename, json_encode($queueItems)); + DbUtils::log("Add product with id $prodid to file queue"); + return array("status" => "OK"); + } catch (Exception $ex) { + return array("status" => "ERROR","msg" => $ex->getMessage()); + } + } } } @@ -22,7 +40,10 @@ class Queue { if (isset($_GET["command"])) { $command = $_GET["command"]; - $pdo = DbUtils::openDbAndReturnPdoStatic(); + $pdo = null; + if (DB == "mysql") { + $pdo = DbUtils::openDbAndReturnPdoStatic(); + } switch ($command) { case "putintoqueue": diff --git a/gastsystem/php/tables.php b/gastsystem/php/tables.php index b6d69b3..828b09c 100644 --- a/gastsystem/php/tables.php +++ b/gastsystem/php/tables.php @@ -2,24 +2,17 @@ require_once 'dbutils.php'; require_once 'config.php'; +defined('DB') || define ( 'DB','mysql' ); class Tables { public static function gettables($pdo) { - $sql = "SELECT value FROM %ossystem% WHERE item=?"; - $result = DbUtils::fetchSqlAll($pdo, $sql, array('resttables')); + $tables = DbUtils::getConfigItem($pdo, 'resttables', null); - if (is_null($result) || (count($result) == 0)) { - return array("status" => "ERROR","msg" => "Keine Tischdefinition hinterlegt."); - } - - if (is_null($result[0]["value"])) { + if (is_null($tables)) { return array("status" => "ERROR","msg" => "Keine Tischdefinition hinterlegt oder Tische für die Gastbestellung nicht eingerichtet."); } - $tables = json_decode($result[0]["value"], true); - - - + $tables = json_decode($tables,true); $tablesArr = array(); foreach ($tables as $t) { $tablesArr[] = array("id" => $t["id"],"name" => $t["name"]); @@ -46,19 +39,22 @@ class Tables { $askdaycode = DbUtils::getConfigItem($pdo, 'askdaycode', 1); $asktablecode = DbUtils::getConfigItem($pdo, 'asktablecode', 1); + $dailycodeInDbUntrimmed = DbUtils::getConfigItem($pdo, 'dailycode', null); + $dailycodeInDb = null; + if (!is_null($dailycodeInDbUntrimmed)) { + $dailycodeInDb = trim($dailycodeInDbUntrimmed); + } - $sql = "SELECT value FROM %ossystem% WHERE item=?"; - $result = DbUtils::fetchSqlAll($pdo, $sql, array('resttables')); + $resttables = DbUtils::getConfigItem($pdo, 'resttables', null); - if (count($result) == 0) { + if (is_null($resttables)) { return array("status" => "ERROR","msg" => "Keine Tischdefinition hinterlegt."); } if ($asktablecode == 1) { - $resttables = $result[0]; - $tables = json_decode($resttables["value"], true); - + $tables = json_decode($resttables, true); foreach ($tables as $t) { + DbUtils::log("CHECKE tid = " . $t["id"] . " mit tableid=" . $tableid); if ($t["id"] == $tableid) { if (trim($t["code"]) == $tablecode) { break; @@ -70,14 +66,11 @@ class Tables { } if ($askdaycode == 1) { - $sql = "SELECT value FROM %ossystem% WHERE item=?"; - $result = DbUtils::fetchSqlAll($pdo, $sql, array('dailycode')); - - if (count($result) == 0) { + + if (is_null($dailycodeInDb)) { return array("status" => "ERROR","msg" => "Keine Tageslosung wurde hinterlegt."); } - $dailycodeInDb = trim($result[0]["value"]); if ($dailycode == $dailycodeInDb) { return array("status" => "OK"); } else { diff --git a/gastsystem/sync.php b/gastsystem/sync.php index 99d4685..4554da8 100644 --- a/gastsystem/sync.php +++ b/gastsystem/sync.php @@ -2,11 +2,13 @@ require_once 'php/dbutils.php'; require_once 'php/config.php'; +defined('DB') || define ( 'DB','mysql' ); class Sync { public static function insertSystemData($pdo,$systemdata) { try { + DbUtils::log("insertSystemData started"); if (!isset($systemdata["guestcode"])) { return array("status" => "ERROR","msg" => "No Access code transmitted!"); } @@ -15,7 +17,7 @@ class Sync { if ($transmittedGuestcode != CODE) { return array("status" => "ERROR","msg" => "Wrong Access code!"); } - + self::insertIntoSystemTable($pdo, $systemdata, 'timezone'); self::insertIntoSystemTable($pdo, $systemdata, 'dailycode'); self::insertIntoSystemTable($pdo, $systemdata, 'resttables'); @@ -24,97 +26,286 @@ class Sync { self::insertIntoSystemTable($pdo, $systemdata, 'currency'); self::insertIntoSystemTable($pdo, $systemdata, 'decpoint'); - self::insertIntoSystemTableWithCheck($pdo, $systemdata, 'askdaycode'); - self::insertIntoSystemTableWithCheck($pdo, $systemdata, 'asktablecode'); - self::insertIntoSystemTableWithCheck($pdo, $systemdata, 'guesttimeout'); + self::insertIntoSystemTable($pdo, $systemdata, 'askdaycode'); + self::insertIntoSystemTable($pdo, $systemdata, 'asktablecode'); + self::insertIntoSystemTable($pdo, $systemdata, 'guesttimeout'); if (isset($systemdata["timezone"])) { self::updateOsAccessStatus($pdo, $systemdata["timezone"]); } - if (isset($systemdata["logo"])) { - $logo = $systemdata["logo"]; - } else { - $logo = ""; + $logo = ''; + if (isset($systemdata["logo"]) && ($systemdata["logo"] != '')) { + $logo = $systemdata["logo"]; } + self::insertOrUpdateOrDeleteImage($pdo, 'logo', $logo, DbUtils::$TYPE_LOGO, null); - DbUtils::execSql($pdo, "DELETE FROM %images% WHERE name='logo'",null); - $sql = "INSERT INTO %images% (name,content,contenttype,productid) VALUES('logo',?,?,?)"; - DbUtils::execSql($pdo, $sql, array($logo, DbUtils::$TYPE_LOGO,null)); - - $sql = "DELETE FROM %images% WHERE contenttype=?"; - DbUtils::execSql($pdo, $sql, array(DbUtils::$TYPE_PRODIMG)); - DbUtils::execSql($pdo, "OPTIMIZE TABLE %images%",null); if (isset($systemdata["prodimages"])) { - self::insertProdImages($pdo, $systemdata["prodimages"]); + DbUtils::log("prodimages are transmitted -> update now"); + self::insertOrUpdateProdImages($pdo, $systemdata["prodimages"]); } - return array("status" => "OK"); } catch (Exception $ex) { return array("status" => "ERROR","msg" => $ex->getMessage()); } } + + private static function deleteImage_not_used($pdo,$imageName,$productid) { + if (DB == "mysql") { + if (is_null($productid)) { + $sql = "DELETE FROM %images% WHERE imagename=?"; + DbUtils::execSql($pdo, $sql, array($imageName)); + } else { + $sql = "DELETE FROM %images% WHERE productid=?"; + DbUtils::execSql($pdo, $sql, array($productid)); + } + } else { + + } + } + + private static function insertOrUpdateOrDeleteImage($pdo,$imageName,$content,$contenttype,$productid) { + $contentMd5 = null; + if ($content == '-') { + $content = ''; + } + if (!is_null($content)) { + $contentMd5 = md5($content); + } + if (DB == "mysql") { + + if (is_null($productid)) { + $sql = "SELECT id,content FROM %images% WHERE imagename=?"; + $result = DbUtils::fetchSqlAll($pdo, $sql, array($imageName)); + } else { + $sql = "SELECT id,content FROM %images% WHERE productid=?"; + $result = DbUtils::fetchSqlAll($pdo, $sql, array($productid)); + } + + $delete = false; + if (!is_null($productid) && ($content == '')) { + $delete = true; + } else if (is_null($productid) && ($content == '')) { + $delete = true; + } + if ($delete) { + if (count($result) > 0) { + $id = $result[0]["id"]; + $sql = "DELETE FROM %images% WHERE id=?"; + DbUtils::execSql($pdo, $sql, array($id)); + if (!is_null($productid)) { + DbUtils::log("Product image with id $productid deleted from mysql"); + } else { + DbUtils::log("Product image with name $imageName deleted from mysql"); + } + } + return; + } + + + if (count($result) == 0) { + $sql = "INSERT INTO %images% (imagename,content,contenttype,productid) VALUES(?,?,?,?)"; + DbUtils::execSql($pdo, $sql, array($imageName,$content,$contenttype,$productid)); + DbUtils::log("Image with name '" . $imageName . "' and product id=" . (is_null($productid) ? "null":$productid) . " inserted into mysql"); + } else { + $origContentMd5 = md5($result[0]["content"]); + if ($contentMd5 != $origContentMd5) { + $rowId = $result[0]["id"]; + $sql = "UPDATE %images% SET imagename=?,content=?,contenttype=?,productid=? WHERE id=?"; + DbUtils::execSql($pdo, $sql, array($imageName,$content,$contenttype,$productid,$rowId)); + DbUtils::log("Image updated with imagename='$imageName' and productid=" . (is_null($productid) ? "null":$productid) . " in mysql"); + } + } + } else { + try { + $filename = "db/" . IMAGES_FILE; + $images = array(); + if (file_exists($filename)) { + $imagesContent = file_get_contents($filename); + $images = json_decode($imagesContent,true); + } + + $imgesWereChanged = false; + $foundImageAtKey = null; + + $keys = array_keys($images); + foreach($keys as $aKey) { + $img = $images[$aKey]; + if (is_null($productid)) { + if ($img["imagename"] == $imageName) { + $foundImageAtKey = $aKey; + break; + } + } else { + if ($img["productid"] == $productid) { + $foundImageAtKey = $aKey; + break; + } + } + } + + $delete = false; + if ($imageName == 'logo') { + DbUtils::log("Logo content: " . $content); + } + if (!is_null($productid) && ($content == '')) { + $delete = true; + } else if (is_null($productid) && ($content == '')) { + $delete = true; + } + + if ($delete) { + if (!is_null($foundImageAtKey)) { + unset ($images[$foundImageAtKey]); + file_put_contents($filename, json_encode($images)); + if (!is_null($productid)) { + DbUtils::log("Product image with id $productid deleted from file"); + } else { + DbUtils::log("Product image with name $imageName deleted from file"); + } + } + return; + } + + $img = array("imagename" => $imageName,"content" => $content, "contenttype" => $contenttype, "productid" => $productid); + if (is_null($foundImageAtKey)) { + $images[] = $img; + $imgesWereChanged = true; + DbUtils::log("Image with name '" . $imageName . "' and product id=" . (is_null($productid) ? "null":$productid) . " inserted into file db"); + } else { + $origContentMd5 = md5($images[$foundImageAtKey]["content"]); + if ($contentMd5 != $origContentMd5) { + $images[$foundImageAtKey] = $img; + $imgesWereChanged = true; + DbUtils::log("Image updated with imagename='$imageName' and productid=" . (is_null($productid) ? "null":$productid) . " in file db"); + } + } + + if ($imgesWereChanged) { + file_put_contents($filename, json_encode($images)); + } + } catch(Exception $ex) { } + } + } + + private static function insertOrUpdateProdImages($pdo,$imagedata) { + foreach ($imagedata as $img) { + $productid = $img['prodid']; + $imgl = $img['imagedata']; + self::insertOrUpdateOrDeleteImage($pdo, '', $imgl, DbUtils::$TYPE_PRODIMG, $productid); + } + } + private static function insertIntoSystemTable($pdo,$data,$item) { if (isset($data[$item])) { $value = $data[$item]; - $sql = "UPDATE %ossystem% SET value=? WHERE item=?"; - DbUtils::execSql($pdo, $sql, array($value,$item)); - } - } - - private static function insertIntoSystemTableWithCheck($pdo,$data,$item) { - if (isset($data[$item])) { - $sql = "SELECT id FROM %ossystem% WHERE item=?"; - $result = DbUtils::fetchSqlAll($pdo, $sql, array($item)); - if (count($result) == 0) { - $sql = "INSERT INTO %ossystem% (item,value) VALUES(?,?)"; - DbUtils::execSql($pdo, $sql, array($item,$data[$item])); + $valuemd5 = md5($value); + if (DB == "mysql") { + $sql = "SELECT value FROM %ossystem% WHERE item=?"; + $origvalSql = DbUtils::fetchSqlAll($pdo, $sql, array($item)); + if (count($origvalSql) == 0) { + $sql = "INSERT INTO %ossystem% (item,value) VALUES(?,?)"; + DbUtils::execSql($pdo, $sql, array($item,$value)); + } else { + // to avoid unnecessary write operations check if update is needed + $origvalmd5 = md5($origvalSql[0]["value"]); + if ($valuemd5 != $origvalmd5) { + $sql = "UPDATE %ossystem% SET value=? WHERE item=?"; + DbUtils::execSql($pdo, $sql, array($value,$item)); + } + } } else { - self::insertIntoSystemTable($pdo, $data, $item); + $filename = "db/" . OSSYSTEM_FILE; + try { + if (file_exists($filename)) { + $allOssystemvalues = file_get_contents($filename); + $dataItems = json_decode($allOssystemvalues, true); + if (isset($dataItems[$item])) { + $origvalmd5 = md5($dataItems[$item]); + if ($valuemd5 != $origvalmd5) { + $dataItems[$item] = $value; + file_put_contents($filename, json_encode($dataItems)); + DbUtils::log("In $filename update item $item with value $value"); + } + } else { + $dataItems[$item] = $value; + file_put_contents($filename, json_encode($dataItems)); + DbUtils::log("In $filename insert item $item with value $value"); + } + } else { + $dataItems = []; + $dataItems[$item] = $value; + file_put_contents($filename, json_encode($dataItems)); + DbUtils::log("Create $filename and insert item $item with value $value"); + } + } catch (Exception $ex) { } } } } - private static function insertProdImages($pdo,$imagedata) { - $sql = "INSERT INTO %images% (name,content,contenttype,productid) VALUES(?,?,?,?)"; - foreach ($imagedata as $img) { - $prodid = $img['prodid']; - $imgl = $img['imagedata']; - DbUtils::execSql($pdo, $sql, array('',$imgl, DbUtils::$TYPE_PRODIMG,$prodid)); - } - } - private static function updateOsAccessStatus($pdo,$timezone) { date_default_timezone_set($timezone); $date = new DateTime(); $currentTimeStamp = $date->getTimestamp(); - $sql = "SELECT id FROM %gueststatus% WHERE item=?"; - $result = DbUtils::fetchSqlAll($pdo, $sql, array('lastosaccess')); - if (count($result) == 0) { - $sql = "INSERT INTO %gueststatus% (date,item) VALUES(?,?)"; + if (DB == "mysql") { + $sql = "SELECT id FROM %gueststatus% WHERE item=?"; + $result = DbUtils::fetchSqlAll($pdo, $sql, array('lastosaccess')); + if (count($result) == 0) { + $sql = "INSERT INTO %gueststatus% (date,item) VALUES(?,?)"; + } else { + $sql = "UPDATE %gueststatus% SET date=? WHERE item=?"; + } + DbUtils::execSql($pdo, $sql, array($currentTimeStamp,'lastosaccess')); } else { - $sql = "UPDATE %gueststatus% SET date=? WHERE item=?"; + $filename = "db/" . STATUS_FILE; + try { + if (file_exists($filename)) { + $lastaccess = file_get_contents($filename); + if ($currentTimeStamp != $lastaccess) { + file_put_contents($filename, $currentTimeStamp); + } + } else { + file_put_contents($filename, $currentTimeStamp); + } + } catch (Exception $ex) { } } - DbUtils::execSql($pdo, $sql, array($currentTimeStamp,'lastosaccess')); } public static function fetchQueueData($pdo) { - // id | date | tableid | prodid | tablecode | dailycode - $pdo->beginTransaction(); - $sql = "SELECT id,date,tableid,prodid,tablecode,dailycode FROM %queue%"; - $result = DbUtils::fetchSqlAll($pdo, $sql, null); - $sql = "DELETE FROM %queue%"; - DbUtils::execSql($pdo, $sql, null); - $pdo->commit(); - - return $result; + if (DB == "mysql") { + $pdo->beginTransaction(); + $sql = "SELECT id,date,tableid,prodid,tablecode,dailycode FROM %queue%"; + $result = DbUtils::fetchSqlAll($pdo, $sql, null); + DbUtils::log("Transmit " . count($result) . " items to core system from mysql queue table"); + $sql = "DELETE FROM %queue%"; + DbUtils::execSql($pdo, $sql, null); + $pdo->commit(); + + return $result; + } else { + $filename = "db/" . QUEUE_FILE; + if (file_exists($filename)) { + $queueItemsInFile = file_get_contents($filename); + $queueItems = json_decode($queueItemsInFile,true); + DbUtils::log("Transmit " . count($queueItems) . " items to core system from file queue"); + + $emptyContent = json_encode(array()); + file_put_contents($filename, $emptyContent); + + return $queueItems; + } else { + return array(); + } + } } } if (isset($_POST["data"])) { - - $pdo = DbUtils::openDbAndReturnPdoStatic(); + $pdo = null; + if (DB == "mysql") { + $pdo = DbUtils::openDbAndReturnPdoStatic(); + } $data = $_POST["data"]; diff --git a/printserver/OrderSprinterPrintserver.exe b/printserver/OrderSprinterPrintserver.exe index c94b68d7999562aba9f8dfd8fd674ae394e17b4d..7a2fcd093e0bc5c21f27951eab2ccc374edd4c3d 100644 GIT binary patch delta 162 zcmZozBG|A*a6$+3O_Pm{-L2h>t=&vpyO}L_GfHhgx|=!GSjE!J+0oh2+)~%n&D>bm z#Ldu5*TUJ{NY};9(#X}s(ACY&!ezVPd**ZpMzihP^jVg12~?gsHLW;a%)h7T{-h^z z|9iLRSg}|O0Hs%Wu{>kslwx3IU}RumklH@ohb5j7DE{4-Wi^nVzSy6|oYjm$kHKKF NA*0fE#sHT8i~wB~GZ_E? delta 162 zcmZozBG|A*a6$*Op+RS3cWXCeYd6!@Zf48fjFQ`r?q*IkRxx&RGdD1DG|{zmbT!m9 zF*h;Sbux5z1ab|HEKE#{j0}uSxBI^g MDs5*BVENAo068Bo`Tzg` diff --git a/spider/install/installer.php b/spider/install/installer.php index 335d382..8d897c2 100644 --- a/spider/install/installer.php +++ b/spider/install/installer.php @@ -85,7 +85,7 @@ class Installer { } Database::dropTables($pdo); Database::createEmptyTables($pdo, $prefix); - Database::setVersion($pdo,$prefix,"1.5.25"); + Database::setVersion($pdo,$prefix,"1.5.26"); Database::setAccessPassword($pdo,$prefix,$adminpass); Database::setRefreshRate($pdo,$prefix,"5"); // default: 5 times per hour return array("status" => "OK","msg" => "Installation successful"); diff --git a/webapp/OrderSprinterPrintserver.exe b/webapp/OrderSprinterPrintserver.exe index c94b68d7999562aba9f8dfd8fd674ae394e17b4d..7a2fcd093e0bc5c21f27951eab2ccc374edd4c3d 100644 GIT binary patch delta 162 zcmZozBG|A*a6$+3O_Pm{-L2h>t=&vpyO}L_GfHhgx|=!GSjE!J+0oh2+)~%n&D>bm z#Ldu5*TUJ{NY};9(#X}s(ACY&!ezVPd**ZpMzihP^jVg12~?gsHLW;a%)h7T{-h^z z|9iLRSg}|O0Hs%Wu{>kslwx3IU}RumklH@ohb5j7DE{4-Wi^nVzSy6|oYjm$kHKKF NA*0fE#sHT8i~wB~GZ_E? delta 162 zcmZozBG|A*a6$*Op+RS3cWXCeYd6!@Zf48fjFQ`r?q*IkRxx&RGdD1DG|{zmbT!m9 zF*h;Sbux5z1ab|HEKE#{j0}uSxBI^g MDs5*BVENAo068Bo`Tzg` diff --git a/webapp/bar.html b/webapp/bar.html index b0ab808..61ddb8c 100644 --- a/webapp/bar.html +++ b/webapp/bar.html @@ -5,7 +5,7 @@ - + @@ -13,8 +13,8 @@ - - + + +var W_TABLES=["Tische","Tables","Mesas"];var W_ATABLE=["Tisch","Table","Mesa"];var W_ROOMS=["Räume","Rooms","Espacios"];var W_SELECTION=["Auswahl","Selection","Selección"];var W_LAST_SELECTED=["zuletzt","last","seleccionado"];var W_FAVS=["Favoriten","Favorites","Favoritos"];var W_NEW_ORDER=["Neue Order","New Orders","Ordenes nuevas"];var W_KIT_BAR=["nicht serviert/unbezahlt","unserved/unpaid","no servido/impagado"];var W_OTHER_PROD=["Auswahl Produktkategorie","Select product categroy","Categoría diferente"];var W_WORK_TICKET=["Arbeitsbon","Work ticket","Tique de trabajar"];var W_NOTE=["Bemerkung","Comment","Comentario"];var W_NUMBER=["Anzahl","Number","Número"];var W_SEND_ORDERS=["Bestellung senden","Send orders","Enviar Ordenes"];var W_TO_PAYDESK=["-> Kasse","-> Paydesk","-> Caja"];var W_TABLECHANGE=["Tischwechsel","Change table","Cambiar mesa"];var W_ROOMTABLE=["Raum-Tisch","Room-Table","Espacio-Mesa"];var W_TABLE_SEL=["Tischauswahl","Select table","Qué mesa?"];var W_UNDELIV_INFO=["Liste enthält die Produkte die noch in der Küchen-/Baransicht sind, sowie unbezahlte Produkte, die die Bereitstellungsansicht nicht durchlaufen.","List contains the products which are still in kitchen or bar view, as well as unpaid products that do not pass the supplydesk view.","La lista contiene los productos que estan todavía en modulo de cocina/bar, también productos impagados que no pasan vista de productos preparados."];var W_REMOVE_ERROR=["Ansicht nicht mehr aktuell - Liste wird neu geladen.","View is obsolete - List will be reloaded.","Vista no esta actual - vamos a actualisar la lista."];var W_FOOD_FOR=["Speisen für","Food for","Comidas para"];var W_DRINKS_FOR=["Getränke für","Beverage for","Bebidas para"];var W_ACT_NEW_ORD_EL=["Aktion auswählen","Select action","Que acción?"];var W_ACT_CHANGE=["Ändern","Modify","Modificar"];var W_ACT_CHANGE_ALL=["Alle Ändern","Modify all","Modificar todo"];var W_ACT_CHANGE_ONE=["Einen Artikel ändern","Modify one item","Modificar un artículo"];var W_APPLY=["Anwenden","Apply","Aplicar"];var W_CANCEL=["Abbrechen","Cancel","Cancelar"];var W_STILL_UNSENT_ORDERS=["Es sind noch ungesendete Orders vorhanden!","There are unsent orders in the list","Hay elementos in la liste que no han enviados"];var W_EXTRAS=["Extras/Optionen","Add-ons/Options","Opciones"];var W_OPEN_PANEL=["Extras-Auswahl noch offen","Add-ons selection still open","Selección de opciones todavía abierta"];var W_DEL=["Löschen","Delete","Removar"];var W_MSG=["Nachricht","Message","Mensaje"];var W_CHANGE_PRICE=["Neuer Preis: ","New price: ","Cambiar precio: "];var W_PRICE=["Preis","Price","Precio"];var W_WRONG_FORMAT=["Falsches Zahlenformat","Wrong number format","Formato de precio incorecto"];var W_TOGO=["Außer-Haus-Verkauf","Sale with Tax No 2","Venta IVA 2"];var W_YES=["Ja","Yes","Si"];var W_NO=["Nein","No","No"];var W_DISCARD_NO_ASK=["Es sind noch ungesendete Orders vorhanden! Sollen diese verworfen werden?","There are still unsent orders. Do you want to discard them?","Hay todavía ordenes non-enviados. Removarlos?"];var W_DISCARD_HEADER=["Neue Orders verwerfen?","Discard new orders?","Removar ordenes nuevos?"];var W_SEARCH=["Produktsuche","Product search","Buscar producto"];var W_BARCODE=["Barcode","Barcode","Código de barras"];var W_SEARCHRESULTS=["Suchergebnis","Search Result","Encontrado"];var W_WRONG_PIN=["Falscher Stornocode","Wrong cancel code","Codigo falso"];var W_NO_ORDERS=["Keine neuen Orders zum Versand vorhanden!","No new orders available!","No hay ningún orden nuevo!"];var W_TO_PAY=["offen","to pay","a pagar"];var W_MOVE_PRODS=["Produkte verschieben","Move products","Productos a otra mesa"];var W_NO_PRODS_SELECTED=["Es wurden keine Produkte ausgewählt!","You have not chosen any products!","No ha seleccionado ningún producto!"];var W_MAX_PRICE_EXCEEDED=["Der Maximalwert für den Preis wurde überschritten!","The max. value for the price is exceeded!","El valor del precio es más que el maximum!"];var W_REORDER=["Nachbestellen","Reorder","Order una vez mas"];var W_REMOVE=["Entfernen","Remove","Removar"];var W_SELALL=["Alles auswählen","Select all","Elegir todo"];var W_UNSELALL=["Alles abwählen","Unselect all","No elegir nada"];var W_ONLY=["noch","only","sólo"];var W_DEL_ALL_UNDELIVERED=["Entferne alles","Remove all","Borrar todo"];var W_DEL_ALL_ASSIGNED_PRODS=["Alle Produkte löschen?","Delete all products?","Removar todos los productos?"];var W_NO_VALID_PRICE=["Keine gültige Zahl","No valid value","No es un número valido"];var W_NO_REORDER_VAR_PRICE=["Nur Produkte mit der Einheit 'Stück' könne auf diese Weise nachbestellt werden.","Only products of unit 'Piece' can be reordered this way.","Un producto de esta unidad no se puede reordenado asi."];var W_INVALID_NO_ENTERING=["Fehler bei der Eingabe","Input contains errors","Número invalido"];var w_INVALID_NO_RANGE=["Ungültiger Zahlenbereich (1-1000)","Invalid number range (1-1000)","Número no es entre 1 y 1000"];var W_DAYCODETXT=["Tageslosung","Day code","Código del día"];var W_RECORDS_HEADER=["Tischprotokoll","Records of table","Historia de la mesa"];var W_RECORDS_INIT=["Tischprotokoll (Anklicken zum Öffnen)","Records of table (click to open)","Historia de la mesa (click para abrir)"];var W_RECORD_ACTION=[["Bestellung","Ordering","Ordenar"],["Rechnung","Bill","Pagar"],["Produktstorno","Discard product","Descartar producto"],["Rechnungsstorno","Discard bill","Descartar pago"],["Rechnungs- und Produktstorno","Discard bill and product","Descrtar pago y producto"],["Tischwechsel Produktentfernung","Move products to other table","Productos a otra mesa"],["Tischwechsel Produktbuchung","Received moved products","Recibo productos de otra mesa"]];var W_NO_ENTRIES=["Keine Einträge","No entries","Ningún data"];var W_NOT_SUPPORTED=["Nicht unterstützt für dieses Produkt","Not supported for this product","No posible para este producto"];var CHANGE_ALL=0;var CHANGE_ONE=1;var WORKFLOW_DIGI_WORK=0;var WORKFLOW_DIGI=1;var WORKFLOW_WORK=2;var WORKFLOW_WORK_SEND=3;function Grouping(b,a){this.set=b;this.sortedset=[];this.group=function(){this.sortedset=[];for(var g=0;g/g,">"))}function setLanguage(c){lang=c;$("#roomtableheader2").html(W_ROOMTABLE[lang]);$("#tableselection").html(W_TABLE_SEL[lang]);$("#actiontxt").html(W_ACT_NEW_ORD_EL[lang]);$("#actdeltxt").html(W_DEL[lang]);$("#discard_new_orders_yes").html(W_YES[lang]);$("#discard_new_orders_no").html(W_NO[lang]);$("#discardnewordersask").html(W_DISCARD_NO_ASK[lang]);$("#discardnoheader").html(W_DISCARD_HEADER[lang]);$("#moveprods").html(W_MOVE_PRODS[lang]);$(".daycodetxt").html(W_DAYCODETXT[lang]);var k="";if(prominentsearch==0){k+='
';if(usebarcode==1){k+=''}}else{if(usebarcode==0){k+='
';k+="
"}else{k+='
';k+='';k+="
"}}k+="
";var a='
';if(prominentsearch==0){$("#searchposition-normal").html(k)}else{$("#searchposition-prominent").html(k)}if(usebarcode==1){$("#barcode").focus()}var g=a;var f="";if((workflowconfig==WORKFLOW_DIGI_WORK)||(workflowconfig==WORKFLOW_DIGI)||(workflowconfig==WORKFLOW_WORK_SEND)){f=" osbigbtn ";if(preferfixbtns==1){f=" ossmallbtn fixedsendorderbtn "}if(showtransferbtns==1){g+=''+W_SEND_ORDERS[lang]+""}}if((workflowconfig==WORKFLOW_DIGI_WORK)||(workflowconfig==WORKFLOW_WORK)||(workflowconfig==WORKFLOW_WORK_SEND)){f=" osbigbtn ";if(preferfixbtns==1){f=" ossmallbtn fixedworkprintbtn "}if(showtransferbtns==1){g+=''+W_WORK_TICKET[lang]+""}}if(cashenabled==1){f=" osbigbtn ";if(preferfixbtns==1){f=" ossmallbtn fixedgopaydeskbtn "}g+=''+W_TO_PAYDESK[lang]+""}g+='';$("#commandbuttons").html(g);if(preferfixbtns==1){$("#waiterui").addClass("fixedwaiterui")}$("#waiterui").trigger("create");var i="
"+W_NUMBER[lang]+':
';var b='
';$("#actremark").html(i+b);if(rightchangeprice==1){var e='';$("#actchangepricesection").html(e);var h='
';h+=getDiscountButton("discount1","a",discount1,discountname1);h+=getDiscountButton("discount2","b",discount2,discountname2);h+=getDiscountButton("discount3","c",discount3,discountname3);h+="
";$("#actdiscount").html(h)}$("#actionneworderconfirm_all").html(W_ACT_CHANGE_ALL[lang]);$("#actionneworderconfirm_one").html(W_ACT_CHANGE_ONE[lang]);$("#actionnewordercancel").html(W_CANCEL[lang]);$("#select-comment").off("change").on("change",function(m){var l=$("#select-comment").find(":selected").val();$("#optionfield").val(l)});$("#act-select-comment").off("change").on("change",function(m){var l=$("#act-select-comment").find(":selected").val();$("#act-optionfield").val(l)});$("#discard_new_orders_no").off("click").on("click",function(l){l.stopImmediatePropagation();l.preventDefault();parent.history.back()});$("#discard_priceenter").off("click").on("click",function(l){l.stopImmediatePropagation();l.preventDefault();$("#enterpricedlg").dialog("close")});$("#discard_numberenter").off("click").on("click",function(l){l.stopImmediatePropagation();l.preventDefault();$("#enternumberdlg").dialog("close")});$("#discard_new_orders_yes").off("click").on("click",function(l){l.stopImmediatePropagation();l.preventDefault();neworders=[];gotoOtherPage($("#discardnewordersdlg").data("link"))});$("#prodbackbtn").off("click").on("click",function(l){if(neworders.length!=0){l.stopImmediatePropagation();l.preventDefault();hideMenuProd();$("#discardnewordersdlg").data("link","back_table");$.mobile.changePage("#discardnewordersdlg")}else{parent.history.back()}});$("#searchField").off("keyup").on("keyup",function(l){generateSearchResults()});if(usebarcode==1){$("#barcode").focus()}$("#barcode").off("keyup").on("keyup",function(l){handleBarcodeInput()})}function getDiscountButton(f,e,c,a){var b='";if(a.trim()!=""){b='"}return b}function generateSearchResults(){var i=$("#searchField").val().trim().toLowerCase();if(i.length";var h=$("#typprodpage").data("types_prods_sorted");var a=false;var g=null;for(var f=0;f=0){g=e.prodimageid;if(g!=0){a=true;break}}}$.each(h,function(n,o){var m=o.longname;if(m.toLowerCase().indexOf(i)>=0){c+='
  • ';if(a&&(preferimgmobile==1)){var l="php/contenthandler.php?module=products&command=getprodimage&prodid="+o.id+"&size=l";c+=''}c+=toHtml(m);c+=createSearchProdInfoTxt(o.id,o.unit);c+="
  • "}});c+="";$("#searchResult").html(c);$("#searchResult").trigger("create");$(".srinfo").off("click").on("click",function(q){q.stopImmediatePropagation();q.preventDefault();var m=this.id.split("_")[1];var p=getProdEntry(m);var o=p.price;var n=p.unit;var l=W_PRICE[lang]+": "+o+" "+currency;if(n>2){l+="/"+g_units_arr[n].text}alert(l)});$(".srplus").off("click").on("click",function(n){n.stopImmediatePropagation();n.preventDefault();var m=this.id.split("_")[1];var l=getSearchProdCount(m);$("#srprodcount_"+m).html(l+1)});$(".srminus").off("click").on("click",function(n){n.stopImmediatePropagation();n.preventDefault();var m=this.id.split("_")[1];var l=getSearchProdCount(m);if(l==2){$("#srprodcount_"+m).html(1);selectedProdCount=1}else{if(l>2){$("#srprodcount_"+m).html(l-1)}}});$(".srprodcount").off("click").on("click",function(o){o.stopImmediatePropagation();o.preventDefault();var n=this.id.split("_")[1];var m=getProdEntry(n);var l=m.unit;if(l>1){alert(W_NOT_SUPPORTED[lang]);return}$("#enternumberdlg").data("prodid",n);enternumberdlgshown=true;$("#enternumberfield").val("");$.mobile.changePage("#enternumberdlg");var p=$(this).parent().attr("id");bindEnterSearchNumberNumbers(p)});$(".searchresult").off("click").on("click",function(m){m.stopImmediatePropagation();m.preventDefault();var l=this.id.split("_")[1];handleClickOnSearchResult(l)})}}function handleBarcodeInput(){var c=$("#barcode").val();c=c.split("-").join("");c=c.split(" ").join("");if(c!=""){var a=findProdWithBarcode(c);if(a!=null){$("#barcode").val("");var b=a.id;beep();handleClickOnProd(b)}}}function findProdWithBarcode(b){var e=$("#typprodpage").data("types_prods_sorted");for(var c=0;c'+a+""}htmlComments=b;predefinedComments=b;$("#select-comment").html(b);$("#select-comment").selectmenu("refresh")}function initializeMainMenu(a,h,e,i,g){$("#"+e).html(" "+a.user);$("#"+i).html(a.version+" ");var k='
  • Module
  • ';$.each(a.menu,function(n,m){var l=m.name;var o=m.link;if(g){k+='
  • '+l+"
  • "}else{k+='
  • '+l+"
  • "}});$(h).empty().append(k).promise().done(function(){refreshList(h)});if(h=="#modulemenu-room"){var c=a.waitermessage;if(c!=""){$("#waitermessage").show();var b='
  • '+W_MSG[lang]+"
  • ";var f='
  • '+toHtml(c)+"
  • ";$("#waitermessage").html(b+f);refreshList("#waitermessage")}else{$("#waitermessage").hide()}}$(".modulebutton").off("click").on("click",function(m){var l=$(this).attr("href");doJsonAjaxAsync("POST","php/contenthandler.php?module=admin&command=setLastModuleOfUser",{view:l},null,"Problem Benutzerdatenpflege",false)})}function intervalCheckConnection(b){checkConnection();var a=setInterval(function(){checkConnection()},b*1000)}function checkConnection(){var a=new Image();a.onerror=function(){$(".connectionstatus").show()};a.onload=function(){$(".connectionstatus").hide()};a.src="img/gray.png?t="+(+new Date)}function refreshList(a){if($(a).hasClass("ui-listview")){$(a).listview("refresh")}else{$(a).trigger("create")}}function gotoOtherPage(a){var b=a.split("_");if(b[0]=="menu"){doJsonAjax("POST","php/contenthandler.php?module=admin&command=setLastModuleOfUser",{view:b[1]},null,null);setTimeout(function(){document.location.href=b[1]},250)}else{if(b[0]=="back"){$("#discardnewordersdlg").dialog("close");parent.history.back()}}}function moduleForward(a){if(neworders.length==0){gotoOtherPage(a)}else{hideMenuProd();$("#discardnewordersdlg").data("link",a);$.mobile.changePage("#discardnewordersdlg")}}function getPayPrintType(){doJsonAjax("GET","php/contenthandler.php?module=admin&command=getPayPrintType",null,insertPayPrintType,"Fehler Druckkonfiguration")}function insertPayPrintType(a){$("#workprintarea").data("payPrintType",a)}function getUserHasRightForPaydesk(){doJsonAjax("GET","php/contenthandler.php?module=admin&command=hasUserPaydeskRight",null,hasUserPaydeskRight,"Fehler Kassenberechtigung")}function hasUserPaydeskRight(a){$("#gopaydesk_btn").data("allowed",a)}function hideMenuRoom(){$("#modulepanel-room").panel("close");$("#menuswitch").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();$("#modulepanel-room").panel("open")})}function hideMenuTable(){$("#modulepanel-table").panel("close");$("#menuswitchtable").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();$("#modulepanel-table").panel("open")})}function hideMenuProd(){$("#modulepanel-prod").panel("close");$("#menuswitchprod").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();$("#modulepanel-prod").panel("open")})}function calcTotalPriceOfProdAndExtras(b,c){var e=parseFloat(b);var a=extrasManagement.calcPriceOfAssignedExtras(c);totalPrice=(parseFloat(e+a)).toFixed(2);return totalPrice}function addProductToQueueNoGuiUpdate(f,m,h,c,e,o,g){var b=getProdProperties(f);var a=b.name;var k=calcTotalPriceOfProdAndExtras(b.price,h);var n={name:a,option:m,extras:h,prodid:f,price:k,changedPrice:c,togo:e,unit:o,unitamount:g};for(var l=0;l";var q=groupedNewOrders.count.length;for(l=0;l1){o=f+g_units_arr[r].text+" "}var p=toHtml(groupedNewOrders.name[l]);var n=groupedNewOrders.option[l];var m=groupedNewOrders.count[l];if(m>1){p=""+m.toString()+"x "+o+p}else{p=o+p}var k=groupedNewOrders.prodids[l];if(n!=""){n="

    "+toHtml(n)+"

    "}var e=groupedNewOrders.changedPrices[l];var c=groupedNewOrders.togos[l];var t="";var h=groupedNewOrders.extras[l];if((h!=null)&&(h!="")){t=""+h+""}var g='
  • ';var b=p+n+t;if(e!="NO"){e=e.replace(".",decpoint)+" "+currency;if(r>1){e+="/"+g_units_arr[r].text}if(c!=0){s+=g+''+b+" ("+e+" - To-Go)
  • "}else{s+=g+''+b+" ("+e+")"}}else{if(c!=0){s+=g+''+b+" - To-Go"}else{s+=g+''+b+""}}}$("#neworders").html(s);refreshList("#neworders");binding_neworderelem()}function getProdSizeClass(){if(osprodbtnsize==1){return("osprod-1")}else{if(osprodbtnsize==2){return("osprod-2")}}return""}function binding_neworderelem(){$(".neworder_el").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();var b=$("#neworders li").index($(this).closest("li"))-1;var a={count:groupedNewOrders.count[b],name:groupedNewOrders.name[b],price:groupedNewOrders.price[b],option:groupedNewOrders.option[b],extras:groupedNewOrders.extras[b],prodid:groupedNewOrders.prodids[b],origidxs:groupedNewOrders.origidxs[b],changedPrices:groupedNewOrders.changedPrices[b],togos:groupedNewOrders.togos[b],unit:groupedNewOrders.units[b],unitamount:groupedNewOrders.unitamounts[b]};$("#actiononneworderel").data("entry",a);$("#actiononneworderel").data("newcount",a.count);$("#actiononneworderel").data("groupedListIndex",b);$("#actiononneworderel").data("countatdialogstart",a.count);$("#act-optionfield").val(a.option);$("#act-numberfield").val(a.count);$("#togocheckbox").prop("checked",a.togos==1?true:false);actionSelOnNewOrderElem()})}function sendNewOrders(c,f,a){var g=$("#typprodpage").data("table-info");var b=g[1];if(neworders.length!=0){var e={tableid:b,prods:neworders,print:(c?1:0),payprinttype:f};$("#typprodpage").data("neworders",[]);if(f=="s"){doJsonAjax("POST","php/contenthandler.php?module=queue&command=addProductListToQueue",e,a,"Fehler bei Produktversand")}else{doJsonAjax("POST","php/contenthandler.php?module=queue&command=addProductListToQueue",e,fillPrintAreaAndPrint,"Fehler bei Produktversand")}}else{if(c&¬DeliveredProdsAvailable){}}}function reloadPage(){tableListActive=false;setTimeout(function(){document.location.href="waiter.html"},250)}function removeCurrentOrders(){groupedNewOrders={count:[],joinedvals:[],name:[],prodids:[],extras:[],origidxs:[],changedPrices:[],togos:[]};neworders=[]}function gotoTablePage(){removeCurrentOrders();var a=$("#tables-page").data("allroomtables");var b=a.length;if(!isTogoOrderSelected||(b==1)){if(tablesAfterSend==1){$.mobile.changePage("#tables-page")}else{reloadPage()}}else{reloadPage()}}function removeProductFromQueue(a,c,f,e,b,g){if(typeof g==="undefined"){g=true}if(!b){alert(W_WRONG_PIN[lang]);return}$.ajax({type:"POST",dataType:"json",url:"php/contenthandler.php?module=queue&command=removeProductFromQueue",data:{queueid:a,isPaid:c,isCooking:f,isReady:e},async:false,success:function(l){if(l.status!="OK"){alert(W_REMOVE_ERROR[lang])}var k=$("#typprodpage").data("table-info");var h=k[1];var i="php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&tableid="+h;if(g){fillNotDeliveredProductsOfATable(i)}},error:function(h){alert("Sorry, Fehler bei Produktentfernung!")}})}function reorderProduct(f,b,h,g){var a=getProdProperties(f);if((a.unit!=0)&&(a.unit!="null")){alert(W_NO_REORDER_VAR_PRICE[lang]);return}var e=[];for(var c=0;c'+k.name+""});if(showtogo==1){a+='
  • '+W_TOGO[lang]}var f=h.takeawayprice;var c=f.replace(".",decpoint)+" "+currency;if(f!=0){a+=" ("+W_TO_PAY[lang]+": "+c+")"}a+=createServeInfo(null,h.takeawayprodcount,h.takeawayprodready);a+="
  • ";$("#room-list").append(a).promise().done(function(){bindTogoOrdering();bindServeClick();$(this).off("click").on("click","a",function(l){l.stopImmediatePropagation();l.preventDefault();var k=b[this.id];currentRoomIndex=this.id;isTogoOrderSelected=false;$("#tables-page").data("roomdetail",k);nextPage="tables-page";$.mobile.changePage("#tables-page")});refreshList(this)})}}})}function handleClickInTablemap(a){forwardDisplayToProductView.call(this,a.roomid,a.tableid,a.tablename)}$(document).on("pagebeforeshow","#tables-page",function(){lastSelectedProduct="";tableListActive=true;if(nextPage==""){reloadPage()}hideMenuTable();checkForLogIn();$("#searchField").val("");$("#barcode").val("");generateSearchResults();$("#tableselbackbtn").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();tableListActive=false;$.mobile.changePage("#info-page")});updateTableList()});$(document).on("pagebeforeshow","#changetablewhatdialog",function(){var a=$("#changetablewhatdialog").data("fromtableid");doJsonAjax("GET","php/contenthandler.php?module=queue&command=getProdsForTableChange",{tableId:a},insertProductsToChangeTableDlg,"Tischartikel")});function insertProductsToChangeTableDlg(a){if(a.status!="OK"){alert("Fehler");return}prodsToMove=a.msg;allselected=1;updateProdToMoveList();$("#selectallnothing").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();allselected=1-allselected;for(var c=0;c"+c.productname+b+"";a+="
  • "+g+"
  • "}$("#productsToMoveList").html(a);refreshList("#productsToMoveList");handleClickOnMoveableProd()}function handleClickOnMoveableProd(){$(".prodToMoveEl").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();var b=this.id.split("_")[1];var a=prodsToMove[b];var c=a["class"];if(c=="unselecteditem"){a["class"]="selecteditem"}else{a["class"]="unselecteditem"}updateProdToMoveList()});$("#moveprods").off("click").on("click",function(k){k.stopImmediatePropagation();k.preventDefault();var g=[];for(var f=0;f'+W_TOGO[lang]+""}k+="";$("#tables-list-togo").html(k);$("#togoarea").show();refreshList("#tables-list-togo");bindTogoOrdering();bindServeClick()}}else{$(h).show();$("#togoarea").hide();$("#tablemapcontent").hide();var k='
  • '+W_TABLES[lang]+"
  • ";var f="";if(ostablebtnsize==1){f="ostable-1"}else{if(ostablebtnsize==2){f="ostable-2"}}$.each(l,function(s,u){var r=u.pricesum;var q=r.replace(".",decpoint)+" "+currency;var o=u.prodcount;var t=u.prodready;var n=u.readyQueueIds;var m=u.reservations;var p=u.name;if(m!=""){p+=" (Res.: "+m+")"}if(r!=0){k+='
  • '+p+" ("+W_TO_PAY[lang]+": "+q+")"+createServeInfo(u.id,o,t)+"
  • "}else{k+='
  • '+p+createServeInfo(u.id,o,t)+"
  • "}});if(c=="t"){if(showtogo==1){k+='
  • '+W_TOGO[lang]+"
  • "}}$(h).empty().append(k).promise().done(function(){bindTogoOrdering();bindServeClick();$(this).off("click").on("click",".info-go",function(p){p.stopImmediatePropagation();p.preventDefault();var o=g;var m=l[this.id]["id"];var n=l[this.id]["name"];forwardDisplayToProductView.call(this,a,m,n)});refreshList(this)})}}function bindServeClick(){$(".prodreadyicon").off("click").on("click",function(l){l.stopImmediatePropagation();l.preventDefault();var f=this.id.split("_")[1];var h=queueIdsOfTakeAway;if((f!=null)&&(f!="n")){var a=$("#tables-page").data("roomdetail");var c=a.tables;for(var b=0;b0){var k=h.join();doJsonAjax("POST","php/contenthandler.php?module=queue&command=declareMultipleProductsDelivered",{queueids:k},updateAfterDelivery,"Bereitstellung")}})}function updateAfterDelivery(a){if(tableListActive){updateTableList()}else{reloadPage()}}function bindTogoOrdering(){$(".togoorder").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();isTogoOrderSelected=true;forwardDisplayToProductView.call(this,0,0,W_TOGO[lang])})}function forwardDisplayToProductView(b,a,c){neworders=[];updateNewOrdersGui();var e=new Array(b,a,c);$("#typprodpage").data("table-info",e);nextPage="typprodpage";$.mobile.changePage("#typprodpage");neworders=[];updateNewOrdersGui()}function attachAndDisplayFirstRefTypes(e){$("#typprodpage").data("types_prods",e);var a=e.prods;var c=[];for(var b=0;b";if(applyExtraBtnPos!=1){a+='
  • '+W_APPLY[lang]+"
  • "}a+=extrasManagement.renderExtras(c,b,true);if(requestPriceInExtras!=false){a+='
  •  '+currency+"
  • "}if(applyExtraBtnPos!=2){a+='
  • '+W_APPLY[lang]+"
  • "}a+=createHigherLine(b);return a}function bindExtrasSel(){$(".extrasel").off("click").on("click",function(i){i.stopImmediatePropagation();i.preventDefault();var a=this.id.split("_");var b=a[1];var f=a[2];if((b=="abottom")||(b=="atop")){var g=getProdEntry(f);var c=g.extras;var k=extrasManagement.getAssignedExtras();if(requestPriceInExtras){var h=$("#enterpriceextrasfield").val();h=h.trim();h=h.replace(decpoint,".");if((h!="")&&($.isNumeric(h))){requestPriceInExtras=false;presetPriceInExtras="";addProductToNewOrdersList(f,k,h,0,1)}else{alert(W_NO_VALID_PRICE[lang])}}else{addProductToNewOrdersList(f,k,null,0,1)}}else{extrasManagement.extraClicked(b);if(requestPriceInExtras!==false){presetPriceInExtras=$("#enterpriceextrasfield").val()}var l=listOfExtras(f);$("#typeproducts-list").html(l);refreshList("#typeproducts-list");bindExtrasSel();bindHigherButtons()}})}function lastSelectedProdToStr(){return" ("+W_LAST_SELECTED[lang]+": "+lastSelectedProduct+")"}function listOfTypesProds(g){var a='
  • '+W_SELECTION[lang]+"";if(lastSelectedProduct!=""){a+=lastSelectedProdToStr()}a+="
  • ";var b=$("#typprodpage").data("types_prods");var f=getProdSizeClass();$.each(b.types,function(l,k){if(parseInt(k.ref)==g){a+='
  • '+toHtml(k.name)+"
  • "}});var i=false;if(preferimgmobile==1){var e=null;for(var c=0;c';if(i&&(preferimgmobile==1)){var k="php/contenthandler.php?module=products&command=getprodimage&prodid="+m.id+"&size=l";a+=''}a+=toHtml(m.name);if((m.amount!="null")&&(m.amount<11)){a+=" ("+W_ONLY[lang]+" "+m.amount+")"}a+=createProdInfoTxt(m.id,m.unit);a+=""}});if(g!=0){a+=createHigherLine(f)}return a}function createHigherLine(e){var f="f";if(preferfixbtns==1){f="a"}var a='
  • ';a+='
    ';var c="";var b="";if(preferfixbtns==1){c="fixedtypetopimg";b="fixedtypehigherimg"}a+='
    ';a+='
    ';a+="
    ";a+="
  • ";return a}function createProdEntryWithTextPrice(a,f,g){var e=getProdEntry(a);var c=e.unit;if(e!=null){var b=e.price.replace(".",decpoint);if(c>1){b+="
    /"+g_units_arr[c].text}return"
    "+b+"
    "}return""}function createProdInfoTxt(b,c){var a="";if(showplusminus==1){a+="1";7}if(priceinlist==0){a+="
    "}else{a+=createProdEntryWithTextPrice(b,"prodtextinfo","pinfo")}if(showplusminus==1){a+="
    ";a+="
    "}return a}function createSearchProdInfoTxt(b,c){var a="";if(showplusminus==1){a+="1"}if(priceinlist==0){a+="
    "}else{a+=createProdEntryWithTextPrice(b,"srtextinfo","srinfo")}if(showplusminus==1){a+="
    ";a+="
    "}return a}function createServeInfo(e,c,b){if(supplyright==0){return""}if(e==null){e="n"}if(b>0){var a=""+b+"("+c+")";if(b>=c){a+="
    "}else{a+="
    "}return a}else{return""}}function getProdEntry(e){var b=$("#typprodpage").data("types_prods");var c=0;var a=b.prods;for(c=0;c";var b=$("#typprodpage").data("types_prods");var e=getProdSizeClass();var a=false;var c=[];$.each(b.prods,function(g,h){if(parseInt(h.favorite)==1){a=true;c[c.length]={id:h.id,longname:h.longname,unit:h.unit}}});c.sort(prodcompare);$.each(c,function(g,h){f+='
  • '+toHtml(h.longname);f+=createProdInfoTxt(h.id,h.unit);f+="
  • "});f+="";if(a){$("#favarea").html(f);$("#favarea").trigger("create")}else{$("#favarea").html("");$("#favarea").trigger("create")}}function bindFavEvent(){$(".fav").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();favOrSearchWasClicked=true;levelOneType=0;var a=this.id.split("_")[1];if(showplusminus==1){selectedProdCount=getProdCount(a)}else{selectedProdCount=1}handleClickOnProd(a)})}function displayTypesProds(c,b){if(preferfixbtns!=1){window.scrollTo(0,0)}if(c==0){fillFavArea();bindFavEvent()}else{$("#favarea").html("")}var a=null;if(b==null){idOfHigherType=c;a=listOfTypesProds(parseInt(c));extrasMenuOpen=false}else{a=listOfExtras(parseInt(c));extrasMenuOpen=true}$("#typeproducts-list").empty().append(a).promise().done(function(){refreshList("#typeproducts-list");$(this).off("click").on("click","a",function(f){f.stopImmediatePropagation();f.preventDefault();productInListClicked(this.id,c)});bindHigherButtons()});$(".prodinfo").off("click").on("click",function(l){l.stopImmediatePropagation();l.preventDefault();var g=this.id.split("_")[1];var k=getProdEntry(g);var i=k.price;var h=k.unit;var f=W_PRICE[lang]+": "+i+" "+currency;if(h>2){f+="/"+g_units_arr[h].text}alert(f)});$(".prodplus").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();var g=this.id.split("_")[1];var f=getProdCount(g);$("#prodcount_"+g).html(f+1)});$(".prodminus").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();var g=this.id.split("_")[1];var f=getProdCount(g);if(f==2){$("#prodcount_"+g).html(1);selectedProdCount=1}else{if(f>2){$("#prodcount_"+g).html(f-1)}}});$(".prodcount").off("click").on("click",function(i){i.stopImmediatePropagation();i.preventDefault();var h=this.id.split("_")[1];var g=getProdEntry(h);var f=g.unit;if(f>1){alert(W_NOT_SUPPORTED[lang]);return}$("#enternumberdlg").data("prodid",h);enternumberdlgshown=true;$("#enternumberfield").val("");$.mobile.changePage("#enternumberdlg");var k=$(this).parent().attr("id");bindEnterNumberNumbers(k,c)})}function productInListClicked(b,e){favOrSearchWasClicked=false;$("#searchField").val("");$("#barcode").val("");generateSearchResults();var a=b.split("_");if(a[0]=="t"){if(e==0){levelOneType=a[1];e=a[1]}displayTypesProds(a[1],null)}else{var c=a[1];if(showplusminus==1){selectedProdCount=getProdCount(c)}else{selectedProdCount=1}$("#prodcount_"+c).html(1);handleClickOnProd(c)}}function getHigherType(){var c=$("#typprodpage").data("types_prods");var b=c.types;var f=0;if(!extrasMenuOpen){for(var e=0;e0)&&(e<2)){idOfHigherType=f.ref;if(f.unit==1){requestPriceInExtras=true;presetPriceInExtras=""}else{requestPriceInExtras=false}displayTypesProds(c,b);bindExtrasSel()}else{if(f.unit!=0){var a=g_units_arr[f.unit].longtext;$("#enterpriceheader").html(a);$("#enterpricedlg").data("unit",f.unit);hideMenuProd();enterpricedlgshown=true;$("#enterpricedlg").data("prodid",c);$("#enterpricefield").val("");$.mobile.changePage("#enterpricedlg");bindEnterPriceNumbers()}else{addProductToNewOrdersList(c,null,null,0,1)}}}function bindEnterPriceNumbers(){$(".numfield td").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();var f=$(this).html();var a=$(this).attr("class");if(a!="keyboardapply"){var c=String($("#enterpricefield").val());$("#enterpricefield").val(c+f)}});$("#apply_priceenter").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();var a=$("#enterpricedlg").data("prodid");var c=$("#enterpricefield").val();c=c.trim();c=c.replace(decpoint,".");var b=$("#enterpricedlg").data("unit");if((c!="")&&($.isNumeric(c))){$("#enterpricedlg").dialog("close");if(b==1){addProductToNewOrdersList(a,null,c,0,1)}else{addProductToNewOrdersList(a,null,null,b,c)}}else{alert(W_NO_VALID_PRICE[lang])}})}function bindPartNumberEntry(){$(".numfield td").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();var g=$(this).html();var c=$(this).attr("class");if(c!="keyboardapply"){var a=String($("#enternumberfield").val());if(c=="dellastkey"){var h=a.length;if(h>0){var b=a.substring(0,h-1);$("#enternumberfield").val(b)}}else{$("#enternumberfield").val(a+g)}}})}function bindEnterNumberNumbers(b,a){bindPartNumberEntry();$("#apply_numberenter").off("click").on("click",function(g){g.stopImmediatePropagation();g.preventDefault();var f=$("#enternumberdlg").data("prodid");var c=$("#enternumberfield").val().trim();if(c==""){c=1}if($.isNumeric(c)){if((c<1)||(c>1000)){alert(w_INVALID_NO_RANGE[lang])}else{if(c>1){$("#enternumberdlg").dialog("close");$("#prodcount_"+f).html(c);productInListClicked(b,a)}else{$("#enternumberdlg").dialog("close");$("#prodcount_"+f).html("");productInListClicked(b,a)}}}else{alert(W_INVALID_NO_ENTERING[lang])}})}function bindEnterSearchNumberNumbers(a){bindPartNumberEntry();$("#apply_numberenter").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();var c=$("#enternumberdlg").data("prodid");var b=$("#enternumberfield").val().trim();if(b==""){b=1}if($.isNumeric(b)){if((b<1)||(b>1000)){alert(w_INVALID_NO_RANGE[lang])}else{if(b>1){$("#enternumberdlg").dialog("close");$("#srprodcount_"+c).html(b);handleClickOnSearchResult(c)}else{$("#enternumberdlg").dialog("close");$("#srprodcount_"+c).html(1);handleClickOnSearchResult(c)}}}else{alert(W_INVALID_NO_ENTERING[lang])}})}function addProductToNewOrdersList(e,f,g,m,b){if(g==undefined){g=null}if(m==undefined){m=0}if(b==undefined){b=1}var h=$("#typprodpage").data("table-info");var a=h[1];addProductToQueue(e,f,"NO",0,g,m,b);var i=getProdAudio(parseInt(e));var c=parseInt($("#typprodpage").data("ordervolume"))/10;if(i!=""){var l="customer/"+i;if(i.match(/mp3$/)){$("#audiofile").html('')}else{if(i.match(/ogg$/)){$("#audiofile").html('')}else{if(i.match(/wav$/)){$("#audiofile").html('')}}}document.getElementById("audiofile").load();document.getElementById("audiofile").volume=c;document.getElementById("audiofile").play()}else{if(c>0.5){beep()}}var k="php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&tableid="+a;fillNotDeliveredProductsOfATable(k);if((keeptypelevel==0)||(favOrSearchWasClicked)){displayTypesProds(levelOneType,null)}else{if(extrasMenuOpen){displayTypesProds(idOfHigherType,null)}}allowPrintAndOrderBtn=true;refreshList("#typeproducts-list")}function beep(){var a=new Audio("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI2cBoCFvfTDAo7eoOQInqDPBtvrDEZBNYN5xwNwxQRfw8ZQ5wQVLvO8OYU+mHvFLlDh05Mdg7BT6YrRPpCBznMB2r//xKJjyyOh+cImr2/4doscwD6neZjuZR4AgAABYAAAABy1xcdQtxYBYYZdifkUDgzzXaXn98Z0oi9ILU5mBjFANmRwlVJ3/6jYDAmxaiDG3/6xjQQCCKkRb/6kg/wW+kSJ5//rLobkLSiKmqP/0ikJuDaSaSf/6JiLYLEYnW/+kXg1WRVJL/9EmQ1YZIsv/6Qzwy5qk7/+tEU0nkls3/zIUMPKNX/6yZLf+kFgAfgGyLFAUwY//uQZAUABcd5UiNPVXAAAApAAAAAE0VZQKw9ISAAACgAAAAAVQIygIElVrFkBS+Jhi+EAuu+lKAkYUEIsmEAEoMeDmCETMvfSHTGkF5RWH7kz/ESHWPAq/kcCRhqBtMdokPdM7vil7RG98A2sc7zO6ZvTdM7pmOUAZTnJW+NXxqmd41dqJ6mLTXxrPpnV8avaIf5SvL7pndPvPpndJR9Kuu8fePvuiuhorgWjp7Mf/PRjxcFCPDkW31srioCExivv9lcwKEaHsf/7ow2Fl1T/9RkXgEhYElAoCLFtMArxwivDJJ+bR1HTKJdlEoTELCIqgEwVGSQ+hIm0NbK8WXcTEI0UPoa2NbG4y2K00JEWbZavJXkYaqo9CRHS55FcZTjKEk3NKoCYUnSQ0rWxrZbFKbKIhOKPZe1cJKzZSaQrIyULHDZmV5K4xySsDRKWOruanGtjLJXFEmwaIbDLX0hIPBUQPVFVkQkDoUNfSoDgQGKPekoxeGzA4DUvnn4bxzcZrtJyipKfPNy5w+9lnXwgqsiyHNeSVpemw4bWb9psYeq//uQZBoABQt4yMVxYAIAAAkQoAAAHvYpL5m6AAgAACXDAAAAD59jblTirQe9upFsmZbpMudy7Lz1X1DYsxOOSWpfPqNX2WqktK0DMvuGwlbNj44TleLPQ+Gsfb+GOWOKJoIrWb3cIMeeON6lz2umTqMXV8Mj30yWPpjoSa9ujK8SyeJP5y5mOW1D6hvLepeveEAEDo0mgCRClOEgANv3B9a6fikgUSu/DmAMATrGx7nng5p5iimPNZsfQLYB2sDLIkzRKZOHGAaUyDcpFBSLG9MCQALgAIgQs2YunOszLSAyQYPVC2YdGGeHD2dTdJk1pAHGAWDjnkcLKFymS3RQZTInzySoBwMG0QueC3gMsCEYxUqlrcxK6k1LQQcsmyYeQPdC2YfuGPASCBkcVMQQqpVJshui1tkXQJQV0OXGAZMXSOEEBRirXbVRQW7ugq7IM7rPWSZyDlM3IuNEkxzCOJ0ny2ThNkyRai1b6ev//3dzNGzNb//4uAvHT5sURcZCFcuKLhOFs8mLAAEAt4UWAAIABAAAAAB4qbHo0tIjVkUU//uQZAwABfSFz3ZqQAAAAAngwAAAE1HjMp2qAAAAACZDgAAAD5UkTE1UgZEUExqYynN1qZvqIOREEFmBcJQkwdxiFtw0qEOkGYfRDifBui9MQg4QAHAqWtAWHoCxu1Yf4VfWLPIM2mHDFsbQEVGwyqQoQcwnfHeIkNt9YnkiaS1oizycqJrx4KOQjahZxWbcZgztj2c49nKmkId44S71j0c8eV9yDK6uPRzx5X18eDvjvQ6yKo9ZSS6l//8elePK/Lf//IInrOF/FvDoADYAGBMGb7FtErm5MXMlmPAJQVgWta7Zx2go+8xJ0UiCb8LHHdftWyLJE0QIAIsI+UbXu67dZMjmgDGCGl1H+vpF4NSDckSIkk7Vd+sxEhBQMRU8j/12UIRhzSaUdQ+rQU5kGeFxm+hb1oh6pWWmv3uvmReDl0UnvtapVaIzo1jZbf/pD6ElLqSX+rUmOQNpJFa/r+sa4e/pBlAABoAAAAA3CUgShLdGIxsY7AUABPRrgCABdDuQ5GC7DqPQCgbbJUAoRSUj+NIEig0YfyWUho1VBBBA//uQZB4ABZx5zfMakeAAAAmwAAAAF5F3P0w9GtAAACfAAAAAwLhMDmAYWMgVEG1U0FIGCBgXBXAtfMH10000EEEEEECUBYln03TTTdNBDZopopYvrTTdNa325mImNg3TTPV9q3pmY0xoO6bv3r00y+IDGid/9aaaZTGMuj9mpu9Mpio1dXrr5HERTZSmqU36A3CumzN/9Robv/Xx4v9ijkSRSNLQhAWumap82WRSBUqXStV/YcS+XVLnSS+WLDroqArFkMEsAS+eWmrUzrO0oEmE40RlMZ5+ODIkAyKAGUwZ3mVKmcamcJnMW26MRPgUw6j+LkhyHGVGYjSUUKNpuJUQoOIAyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU=");a.play()}function fetchTypeProdsFromServer(){doJsonAjaxAsync("GET","php/contenthandler.php?module=products&command=getAllTypesAndAvailProds",null,attachAndDisplayFirstRefTypes,true)}var waitProdTimer=null;function fillTypeProdList(b){var a=$("#typprodpage").data("types_prods");if(a!=undefined){displayTypesProds(b,null)}else{waitProdTimer=setInterval(function(){var c=$("#typprodpage").data("types_prods");if(c!=undefined){clearInterval(waitProdTimer);displayTypesProds(b,null)}},200)}}function fillTypeProdList_(a){displayTypesProds(a,null)}function createTxtAssignedProd(f){var b="";if(f.option!=""){b=" ("+toHtml(f.option)+")"}var c=f.longname;if(f.togo==1){c="To-Go: "+c}if(f.pricechanged==1){c+=" - "+f.price.replace(".",decpoint)+" "+currency}if(f.unit>1){var g=g_units_arr[f.unit].text;var e=f.unitamount.replace(".",decpoint);c+=" ("+e+" "+g+")"}var a="";if(f.isready=="1"){a+=" ☞"}if(f.isCooking=="1"){a+=" ♨"}if(f.isPaid=="1"){a+=" ☑"}return toHtml(c)+b+a+"
    "+createExtraParagraph(f.extras,f.extrasamounts)}function createListElOfAssignedProd(b){var a="";if("count" in b){if(b.count>1){a=b.count+"x "}}if(b.isready=="0"){return'
  • '+a+createTxtAssignedProd(b)+"
  • "}else{return'
  • '+a+createTxtAssignedProd(b)+"
  • "}}function fillAssignedProdList(b){if(b.length>0){notDeliveredProdsAvailable=true}else{notDeliveredProdsAvailable=false}$("#cancelcodefield").val("");if(cancelunpaidcode!=""){if(b.length>0){$("#cancelcodearea").show()}else{$("#cancelcodearea").hide()}}else{$("#cancelcodearea").hide()}var c=new Grouping(b,createTxtAssignedProd);c.group();var a='
  • '+W_KIT_BAR[lang]+"
  • ";a+=c.outputList(createListElOfAssignedProd);if(notDeliveredProdsAvailable){a+='
  • '+W_DEL_ALL_UNDELIVERED[lang]+"
  • "}$("#orderedprod-list-0").html(a);refreshList("#orderedprod-list-0");$("#undeliveredheader").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();alert(W_UNDELIV_INFO[lang])});bindingOfAssignedProds(c);bindDelAllUndeliveredProds(b);$("#cancelcodeform").off("submit").on("submit",function(f){f.stopImmediatePropagation();f.preventDefault()})}function bindDelAllUndeliveredProds(a){$("#delallundelivered").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();areYouSure("Produkte löschen.",W_DEL_ALL_ASSIGNED_PRODS[lang],W_REMOVE[lang],function(){removeAllAssignedProds(a)})})}function removeAllAssignedProds(h){var c=true;if(cancelunpaidcode!=""){if($("#cancelcodefield").val()!=cancelunpaidcode){c=false;alert(W_WRONG_PIN[lang]);return}}for(var f=0;f
    "}if((f==4)&&(showpayment4==1)){c+='
    '+a+"
    "}if((f==5)&&(showpayment5==1)){c+='
    '+a+"
    "}if((f==6)&&(showpayment6==1)){c+='
    '+a+"
    "}if((f==7)&&(showpayment7==1)){c+='
    '+a+"
    "}if((f==8)&&(showpayment8==1)){c+='
    '+a+"
    "}}c+='
    '+P_CANCEL[lang]+"
    ";$("#selectiondialog").html(c);var e=600;if(paymentconfig==1){e=380}$("#selectiondialog").dialog({autoOpen:false,modal:true,height:e,buttons:{Abbrechen:function(){$(this).dialog("close")}}});$("#selectiondialog").dialog("open");bindPayment()}function payWithoutPaymentDlg(){startPayProcess(1,"","","")}function bindPayment(){$(".paymentcancel").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();$("#selectiondialog").dialog("close")});$(".paymentitem").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();var b=this.id.split("_")[1];currentPaymentId=b;$("#selectiondialog").dialog("close");if((currentPaymentId==PAYMENT_HS3)||(currentPaymentId==PAYMENT_GUEST)){$("#hoteldialog").dialog({autoOpen:false,modal:true,height:400,width:500,buttons:{Abbrechen:function(){$(this).dialog("close")}}});$("#hoteldialog").dialog("open");$("#roomguesttextfield").val("");bindhotelinterface(currentPaymentId);return}else{startPayProcess(b,"","","")}})}function bindhotelinterface(a){generateGuestResult($("#roomguesttextfield").val(),false,a);$("#roomguesttextfield").off("keyup").on("keyup",function(b){generateGuestResult($("#roomguesttextfield").val(),false,a)});$("#paym_hotel").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();var f=$("#hotelroomfoundguest").data("reservation");var c=$("#hotelroomfoundguest").data("guest");var b=$("#hotelroomselection").find(":selected").val();if(b!=undefined){var c=guests[b];var g="";if(currentPaymentId==PAYMENT_GUEST){c=internalguests[b];g=c.id}startPayProcess(currentPaymentId,c.reservationid,c.object+" - "+c.guest,g);$("#hoteldialog").dialog("close")}else{alert("Kein Gast ausgewählt")}})}function generateGuestResult(c){c=c.trim().toLowerCase();if(c==""){$("#hotelroomselection").html("");return}var b="";var a=false;$.each(guests,function(h,k){var e=k.object;var l=k.guest;var f=(e.toLowerCase().indexOf(c)>=0);var g=(l.toLowerCase().indexOf(c)>=0);if(f||g){if(!a){a=true;b+='"}else{b+='"}}});$("#hotelroomselection").html(b)}function updateAccounted(c,a,b){if(a===b){$("#"+c).removeClass("paystillopen");$("#"+c).removeClass("payallaccounted");$("#"+c).removeClass("payitemnormborder");$("#"+c).addClass("payallaccounted");$("#"+c).addClass("payitemoffborder")}else{$("#"+c).removeClass("paystillopen");$("#"+c).removeClass("payallaccounted");$("#"+c).removeClass("payitemoffborder");$("#"+c).addClass("paystillopen");$("#"+c).addClass("payitemnormborder")}if(a===0){$("#"+c+" .payitemaccounted").html("")}else{$("#"+c+" .payitemaccounted").html(a)}}function getProdAccountedEntry(c){var f=createHashOfPayableItem(c);for(var a=0;a");return toHtml(c)+g}function createHashOfPayableItem(b){var a="{{"+(parseFloat(b.tax).toFixed(2).replace(".",decpoint))+"}}";return createHashOfPayableItemWithoutTax(b)+toHtml(a)}function createPayableItemListElement(e){var f="";var h=1;if("count" in e){if(e.count>1){f=e.count+"x ";h=e.count}}var a=false;var g=getProdAccountedEntry(e);var i="";if(g!==null){if(g.count!=0){i=g.count}if(g.count==h){a=true}}var l="";if(a){if(preferimgdesk==0){l='
    '+f+createHashOfPayableItemWithoutTax(e)+"
    "+i+"
    "}else{var m="php/contenthandler.php?module=products&command=getprodimage&prodid="+e.prodid+"&size=m";var b=" style=\"background-image: url('"+m+"'); background-size: cover; background-repeat: no-repeat; background-position: center center; \" ";var c=""+f+createHashOfPayableItemWithoutTax(e)+"";l='
    "+c+"
    "+i+"
    "}}else{if(preferimgdesk==0){l='
    '+f+createHashOfPayableItemWithoutTax(e)+"
    "+i+"
    "}else{var m="php/contenthandler.php?module=products&command=getprodimage&prodid="+e.prodid+"&size=m";var k=" style=\"background-image: url('"+m+"'); background-size: cover; background-repeat: no-repeat; background-position: center center; \" ";var n=""+f+createHashOfPayableItemWithoutTax(e)+"";l='
    "+n+"
    "+i+"
    "}}return l}function createOnReceiptItemListElement(c){var b="";if("count" in c){if(c.count>1){b=c.count+"x "}}var a='
    '+b+createHashOfPayableItem(c)+"
    ";return a}function getProdOfAllProdsWithHash(e){var b=prodsToPayListGrouping.sortedset;for(var a=0;a";$("#receiptpanel").html(c);calcSum();var k=$("#receiptpart").html();$("#info-page").data("receipthtml",k);displayRightButtons()}function getTableName(){if(selectedtableindex!=null){var a=roominfo.roomstables[selectedroomindex].tables[selectedtableindex];return a.name}else{if(selectedroomindex=="-1"){return"Zum Mitnehmen"}else{return null}}}function createReceiptHeader(){var a=genCreateReceiptHeader(0,"",getTableName(),loggedinUser,currency);return a}function createReceiptFooter(b,c,a){var e=genCreateReceiptFooterNoSum(b,0,"",a);return e}function getQueueIdsDueToCountOfItem(g){var e=[];var h=g.hash;var f=g.count;for(var b=0;b=f){break}}}return e}function startPayProcess(n,l,m,g){var k=getTableName();var b=0;if(selectedroomindex!=-1){if(selectedtableindex!=null){var f=roominfo.roomstables[selectedroomindex].tables[selectedtableindex];b=f.id}else{b=0}}var e=$("#info-page").data("usst");if($("#info-page").data("taxtype")=="togo"){e=$("#info-page").data("togotax")}checkForLogIn();var a=[];for(var h=0;h";printContent(s)}}startCashProcess()}}else{alert("Fehler: "+q)}},error:function(i){alert("Sorry, there was a problem! "+i)}})}var P_DESCR=["Beschreibung","Description","Descripción"];var P_PRICE=["Preis","Price","Precio"];var P_TOTAL=["Total","Total","Total"];var P_ID=["Id:","Id:","Id:"];var P_ROOMSEL=["Raumauswahl","Room selection","Selección de espacio"];var P_PAYDESK_ACTIONS=["Kassenaktionen","Paydesk actions","Acciones de caja"];var P_BAR_INPUT=["Bareinlage","Input money","Insertar dinero"];var P_BAR_GET=["Barentnahme","Take money","Sacar dinero"];var P_BAR_SUM=["Einnahmen","Revenue","Cobro"];var P_TITLE=["Kasse","Paydesk","Caja"];var P_TABLE=["Tisch","Table","Mesa"];var P_TABLE_SEL=["Tischauswahl","Select table","Qué mesa?"];var P_NOT_PAID=["Ausstehend für ","Not paid for ","Impagado para "];var P_OPS=["Operationen","Operations","Operaciones"];var P_ALL=["Alles","All","Todo"];var P_CONTENT_RECEIPT=["Inhalt Kassenbon","Content of receipt","Contenido del tique"];var P_ONLY_PAY=["Nur Zahlung","Only pay","Solo pagar"];var P_PAY_PRINT=["Bondruck","Pay+Print","Pagar+Imprimir"];var P_CHANGE_CALC=["Wechselgeldrechner:","Change Calculator:","Calculadora de Cambio:"];var P_CHOOSE_PAYWAY=["Auswahl der Zahlungsart:","Selection of method of payment:","Selección del modo de pago:"];var P_CANCEL=["Abbrechen","Cancel","Cancelar"];var P_CASHTAKEOUT=["Barentnahme aus der Kasse","Cash take-out","Sacar dinero"];var P_CASHTAKIN=["Bareinlage in die Kasse","Cash insert","Insertar dinero"];var P_AMOUNT=["Betrag:","Amount:","Valor:"];var P_OVERVIEW=["Übersicht Kellnerkasse","Overview waiter purse","Resumen cartera de bolsillo"];var P_PUT_IN=["Einlegen","Insert","Insertar"];var P_TAKE_OUT=["Entnehmen","Take out","Sacar"];var P_OVERV_DETAILS=["Diese Übersicht zeigt die Einnahmen durch den Kellner pro Zahlungsweg seit der letzten Tageslosung sowie als weiteren Wert den Kassenstand unter Berücksichtigung der eigenen Eingaben und Entnahmen.","This overview contains the amount of money of this waiter since the last closing as well as the total amount of money including the own cash insert and take-out actions.","Este resumen contiene todo el dinero del camarero, y también el dinero incluido con acciones de insertar y sacar."];var P_CASH_SUM=["Bewirtungseinnahmen (ohne Ein-/Auslagen):","Cash by payment (without inserts/take-outs):","Cobro (sin tomas/entradas):"];var P_INCLUDE_OWN=["Barbestand inkl. eigener Kassenein-/auslagen:","Cash incl. own cash insert/take-outs:","Cash incl. tomas y entradas proprias:"];var P_NO_ELEM=["Keine Rechnungselemente","No items selected","Ningún producto selecionado"];var P_NO_ELEM_DETAILS=["Es wurden keine abrechenbaren Produkte festgelegt (der Bon ist leer!).","There are no selected items. The receipt is empty!","No hay ningún elemento seleccionado para pagar."];var P_CASHACTION_OK=["Kassenaktion abgeschlossen.","Action completed.","Acción terminado."];var P_NAV=["Navigation","Navigation","Navigación"];var P_ORDER_ACTION=["-> Bestellansicht","-> Order view","-> Vista de Orden"];var P_TO_PAY=["Zu zahlen: ","To pay: ","Pagar total: "];var P_PAY_RETURN=["Zurück: ","Return: ","Torna: "];var P_CALC_PAYBACK=["Berechne","Calculate","Calcular"];var P_HAS_PAID=["Bezahlt: ","Paid: ","Pagado: "];var P_TOGO=["Außer-Haus-Verkauf","Sale with Tax No 2","Venta IVA 2"];var P_TIP=["nur Trinkg.: ","Only tip: ","Solo prop.: "];var P_TOTAL_INCL_TIP=["Zielbetrag:","Target pay:","Quiere pagar:"];var CALC_TIP_TXT=["Angabe extra Trinkg.","Do Tip separate","Propina individual"];var CALC_TOTAL_TXT=["Angabe inkl.Trinkg.","Do Tip incl.","Propina incl."];var P_GUESTS=["Gäste","Guests","Habitaciones"];var P_OF_WORK_RECEIPT=[" von Arbeitsbon ","of work receipt "," del ticket de trabajo "];var P_BILL_TITLE=["Rechnung","Bill","Factura"];var showHostTemplate=false;var guests=[];var internalguests=[];var hotelinterface=0;var PAYMENT_CARD=2;var PAYMENT_HS3=7;var PAYMENT_GUEST=8;var currentPaymentId=7;var showpayments=1;var showpayment2=1;var showpayment3=1;var showpayment4=1;var showpayment5=1;var showpayment6=1;var showpayment7=1;var showpayment8=1;var forceprint=0;var showhostprint=1;var billprintjobs=0;var prodsByPrintjob=[];var currentSelectedIsTogo=false;function getGeneralConfigItems(){doAjax("GET","php/contenthandler.php?module=admin&command=getGeneralConfigItems",null,insertGeneralConfigItems,"Fehler Konfigurationsdaten")}function getPayments(a){doAjax("GET","php/contenthandler.php?module=admin&command=getPayments",null,a,"Fehler Zahlungswege")}function insertGeneralConfigItems(b){if(b.status=="OK"){var a=b.msg;decpoint=a.decpoint;$("#info-page").data("decpoint",a.decpoint);currency=a.currency;var e=a.tax;var c=e.replace(".",decpoint);$("#info-page").data("usstGerVal",c);$("#info-page").data("usst",e);e=a.togotax;c=e.replace(".",decpoint);$("#info-page").data("togoTaxGerVal",c);$("#info-page").data("togotax",e);$("#info-page").data("companyinfo",a.companyinfo);$("#info-page").data("payPrintType",a.payprinttype);$("#info-page").data("currency",a.currency);$("#info-page").data("billlanguage",a.billlanguage);$("#info-page").data("userlanguage",a.userlanguage);receiptfontsize=parseInt(a.receiptfontsize);$("#receiptpart").css("font-size",receiptfontsize+"px");paymentconfig=a.paymentconfig;showpayments=a.showpayments;showpayment2=a.showpayment2;showpayment3=a.showpayment3;showpayment4=a.showpayment4;showpayment5=a.showpayment5;showpayment6=a.showpayment6;showpayment7=a.showpayment7;showpayment8=a.showpayment8;forceprint=a.forceprint;$("#curtopay2").html(" "+a.currency);workflowconfig=a.workflowconfig;digigopaysetready=a.digigopaysetready;showhostprint=a.showhostprint;restaurantmode=a.restaurantmode;billprintjobs=a.billprintjobs;sumupforcard=a.sumupforcard;affiliatekey=a.affiliatekey;appid=a.appid;serverurl=a.serverurl;if(serverurl.endsWith("/")){serverurl=serverurl.substr(0,serverurl.length-1)}setLanguage(a.userlanguage)}else{$("#contentpart").hide();setTimeout(function(){document.location.href="index.html"},250)}}function addEntryOrIncreaseCount(a,f){var c=0;var g=false;var e=f.prodid+"-"+f.extras.join("_")+f.price+"-"+f.pricelevelname+"#"+f.tax+"_"+f.togo;for(c=0;cID:"+e+"";g+=' ";g+=""+c+"";g+=" ";if(l!=""){g+="Gast: "+toHtml(l)+"";g+=" "}g+=""+P_NO[b]+""+P_DESCR[b]+""+P_PRICE[b]+""+P_TOTAL[b]+"";return g}function genCreateReceiptFooterNoSum(c,e,b,a){return genCreateReceiptFooter(c,e,b,"","","",a)}function genCreateReceiptFooter(a,f,b,k,e,m,n){var c='style="border: solid black 0px;padding: 3px;text-align:right;vertical-align:bottom;"';var p='style="text-align:center;vertical-align:bottom;"';var h=" ";var o=h;o+=""+P_MWST[f]+"% "+P_MWST[f]+""+P_NETTO[f]+""+P_BRUTTO[f]+"";for(var l=0;l"+k+'"+e+'"+m+""}o+=h;o+="   "+P_SUM[f]+'"+m+"";o+=h;o+="
     
    ";o+=toHtml(b).replace(/(?:\r\n|\r|\n)/g,"
    ");o+="
    ";return o}function generateOneProdLine(k,g,i,a,o,f){var b='style="border: solid black 0px;padding: 3px;text-align:right;vertical-align:bottom;"';var h='style="border: solid black 0px;padding: 3px;text-align:center;vertical-align:bottom;"';var c=(parseFloat(i)).toFixed(2).replace(".",o);if(a!="A"){g+=" ("+a+")"}if(f==1){g="To-Go: "+g}var n=k*i;var m="";var e='style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;width: 60%;"';var l=n.toFixed(2).replace(".",o);if(k==0){k="";c="";l=""}m+="'+k+""+g;m=m+""+c;m+=""+l+"";return m}function generateProdPartByDbContent(f,e){var c=0;tablecontent="";for(c=0;c=0);var m=(p.toLowerCase().indexOf(g)>=0);if(l||m){i++;h=toHtml(k+" - "+p);if(!c){c=true;f+='"}else{f+='"}}});if(i===1){$("#hotelroomfoundguest").html(h);$("#hotelroomselection").html(f)}else{$("#hotelroomselection").html(f)}if(b){$("#hotelroomselection").selectmenu("refresh")}}function generateCashOverviewOfUser(e){var a="";for(var b=0;b"+(parseFloat(c.value).toFixed(2)).replace(".",decpoint)+" "+currency+"
    "}return a}function fillProdByPrintJobsList(g){prodsByPrintjob=[];var a=g.length;for(var b=0;b