=0);var m=(p.toLowerCase().indexOf(g)>=0);if(l||m){i++;h=toHtml(k+" - "+p);if(!c){c=true;f+=''+toHtml(k+" - "+p)+" "}else{f+=''+toHtml(k+" - "+p)+" "}}});if(i===1){$("#hotelroomfoundguest").html(h);$("#hotelroomselection").html(f)}else{$("#hotelroomselection").html(f)}if(b){$("#hotelroomselection").selectmenu("refresh")}}function setLanguage(b){$("#roomsel").html(P_ROOMSEL[b]);$("#oben").listview("refresh");lang=b;var a=''+P_PAYDESK_ACTIONS[lang]+' '+P_BAR_INPUT[lang]+' '+P_BAR_GET[lang]+' '+P_BAR_SUM[lang]+" ";$("#cashactions").html(a);$("#cashactions").listview("refresh");$("#navtitle").html(P_NAV[lang]);$("#nav2order").html(P_ORDER_ACTION[lang]);$("#navactions").listview("refresh");$("#paydesktitle").html(P_TITLE[lang]);$("#OnlyPayTxt").html(P_ONLY_PAY[lang]);$("#payprinttxt").html(P_PAY_PRINT[lang]);$("#payway").html(P_CHANGE_CALC[lang]);$("#choosepayway").html(P_CHOOSE_PAYWAY[lang]);$("#canceltxt").html(P_CANCEL[lang]);$("#cancelroomselectiontxt").html(P_CANCEL[lang]);$("#cashtakeouttxt").html(P_CASHTAKEOUT[lang]);$("#amounttxt").html(P_AMOUNT[lang]);$("#amounttxt2").html(P_AMOUNT[lang]);$("#cashtakeintxt").html(P_CASHTAKIN[lang]);$("#cashoverviewtxt").html(P_OVERVIEW[lang]);$("#putinact").html(P_PUT_IN[lang]);$("#takeoutact").html(P_TAKE_OUT[lang]);$("#overviewdetails").html(P_OVERV_DETAILS[lang]);$("#cashsum").html(P_CASH_SUM[lang]);$("#includeowncash").html(P_INCLUDE_OWN[lang]);$("#noelementstxt").html(P_NO_ELEM[lang]);$("#noelementsdetailstxt").html(P_NO_ELEM_DETAILS[lang]);$("#topaytxt").html(P_TO_PAY[lang]);$("#rettxt").html(P_PAY_RETURN[lang]);$("#calcreturn").html(P_CALC_PAYBACK[lang]);$("#haspaidtxt").html(P_HAS_PAID[lang]);$("#tableselimmaptxt").html(P_TABLE_SEL[lang]);setCalcModusBtn()}function getButtonSizes(){doAjax("GET","php/contenthandler.php?module=admin&command=getButtonSizes",null,fillButtonSizes,"Keine Buttongroesseninformation")}function fillButtonSizes(a){osroombtnsize=a.roombtnsize;ostablebtnsize=a.tablebtnsize;osprodbtnsize=a.prodbtnsize}function getProdSizeClass(){if(osprodbtnsize==1){return("osprod-1")}else{if(osprodbtnsize==2){return("osprod-2")}else{return""}}}function getTableSizeClass(){if(ostablebtnsize==1){return("ostable-1")}else{if(ostablebtnsize==2){return("ostable-2")}else{return""}}}function getRoomSizeClass(){if(osroombtnsize==1){return("osroom-1")}else{if(osroombtnsize==2){return("osroom-2")}else{return""}}}function insertPayments(f){var e=f.payments;hotelinterface=f.hotelinterface;guests=f.guests;internalguests=f.internalguests;var c="";var a=20;if(paymentconfig==1){a=2}var b=false;$.each(e,function(h,g){if(h'+g.name+" ";if(!b){c+=" ";b=true}}});c+=''+P_CANCEL[lang]+" ";$("#paymentlist").html(c)}function hideReceiptPart(){$("#payWithoutPrint").hide();$("#payWithPrint").hide();$("#hostbutton").hide();$("#unten").hide()}function showReceiptPart(){$("#payWithoutPrint").show();$("#payWithPrint").show();$("#hostbutton").show();$("#unten").show();$("#tablemapcontent").hide();$("#togoarea").hide()}function getTableMapPreferences(){doAjax("GET","php/tablemap.php?command=getTableMapPreferences",null,insertTMInfoAndStartDisplayProc,"Keine TM-Information")}function insertTMInfoAndStartDisplayProc(a){tminfo=a;startDisplayProcess()}function handleClickInTablemap(a){checkForLogIn();$("#info-page").data("roomid",null);$("#info-page").data("tableviewactive",0);$("#info-page").data("tid",a.tableid);$("#info-page").data("tablename",a.tablename);$("#oben").show();getProdsToPayForTable(a.tableid,a.tablename)}function displayAllRooms(){checkForLogIn();$("#moneyToInsert").val("");$("#moneyToTakeOut").val("");$("#cashactions").show();$("#navactions").show();$("#remarkin").val("");$("#remarkout").val();hideReceiptPart();var a=$("#info-page").data("billlanguage");$("#prodlistinreceipt").empty().append('"+P_DESCR[a]+' '+P_PRICE[a]+' '+P_TOTAL[a]);$.getJSON("php/contenthandler.php?module=roomtables&command=getRooms",function(f){var g=f.roomstables;var c=f.takeawayprice;var h=g.length;if(h==1){$("#info-page").data("roomid",g[0]["id"]);displayTablesOfRoom(g[0],false);if(cameFromOrdering==1){$("#startpaypage").show()}else{$("#startpaypage").hide()}}else{var b="";var e=getRoomSizeClass();$.each(g,function(l,k){b+=''+k.name+" "});if(c!="0.00"){b+=''+P_TOGO[a]+" ("+c+" "+currency+") "}$("#startpaypage").hide();$("#oben").append(b).promise().done(function(){bindTogoOrdering();$(this).off("click").on("click","a",function(k){k.stopImmediatePropagation();k.preventDefault();var i=g[this.id];$("#info-page").data("roomid",i.id);$("#startpaypage").show();displayTablesOfRoom(i,true)});refreshList(this)})}})}function bindTogoOrdering(){$(".togoorder").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();$("#info-page").data("roomid",null);$("#info-page").data("tableviewactive",0);$("#info-page").data("tid",0);$("#info-page").data("tablename",P_TOGO[lang]);$("#oben").show();getProdsToPayForTable(0,"")})}function displayTablesOfRoom(a,b){checkForLogIn();hasRooms=b;var c=$("#info-page").data("roomid");hideReceiptPart();displayUnpaidTables("Tischinfo nicht erhalten!")}$(document).ready(function(){checkForLogIn();var a=setInterval(function(){var b=$("#info-page").data("roomid");if(b!=null){displayUnpaidTables(null)}},10000);$.ajaxSetup({cache:false})});function displayUnpaidTables(a){doAjax("GET","php/contenthandler.php?module=roomtables&command=getUnpaidTables",{roomid:$("#info-page").data("roomid")},displayTables,a)}function displayTables(f){var i=f.tables;var e=f.takeawayprice;$("#info-page").data("tableviewactive",1);var a=$("#info-page").data("roomid");var g=shallDisplayRoom(a);if(g.show){$("#oben").hide();$("#tablemapcontent").show();$("#togoarea").show();d=new Date();$("#mapimgpart").attr("src","php/tablemap.php?command=getUnpaidTablesMapImgAsPng&showBubbles=0&roomid="+a+"&"+d.getTime());var b=new Tablemap(a,null,"");var c=b.createOverlay("#mapimgpart",g.pos,"",decpoint,currency,i,ostablebtnsize);$("#tableoverlay").html(c);b.bindingForOverlaySelection(handleClickInTablemap.bind(this),a,i,null);if(!hasRooms){if(e!="0.00"){var h=''+P_TOGO[lang]+" ";$("#tables-list-togo").html(h);$("#togoarea").show()}refreshList("#tables-list-togo");bindTogoOrdering()}}else{$("#oben").show();$("#tablemapcontent").hide();$("#togoarea").hide();var h=''+P_TABLE_SEL[lang]+" ";var k=getTableSizeClass();$.each(i,function(m,o){var n=o.pricesum.replace(".",decpoint);var l=o.name+" ("+n+" "+currency+") ";h+=''+l+" "});if(!hasRooms){if(e!="0.00"){h+=''+P_TOGO[lang]+" "}}$("#oben").empty().append(h).promise().done(function(){bindTogoOrdering();$(this).off("click").on("click",".info-go",function(n){n.stopImmediatePropagation();n.preventDefault();$("#info-page").data("roomid",null);$("#info-page").data("tableviewactive",0);var l=i[this.id]["id"];var m=i[this.id]["name"];$("#info-page").data("tid",l);$("#info-page").data("tablename",m);getProdsToPayForTable(l,m)});refreshList(this)})}}function getProdsToPayForTable(a,b){$("#startpaypage").show();if(a==0){b=P_TOGO[lang];$("#info-page").data("taxtype","togo")}else{$("#info-page").data("taxtype","normal")}$("#cashactions").hide();$("#navactions").hide();$.ajax({type:"GET",dataType:"json",data:{tableid:a},url:"php/contenthandler.php?module=queue&command=getJsonProductsOfTableToPay",async:false,success:function(e){var c=e.status;var f=e.msg;if(c!="ERROR"){showReceiptPart();prodsToPayList=f;$("#info-page").data("tableprods",f);bindPayButton(f,a,b);initiatePayableView(f,b)}else{alert("Fehler: "+f)}},error:function(c){alert("Sorry, there was a problem getting the products to pay for table!")}})}function initiatePayableView(a,b){$("#tableinreceipt").html(b+" ");clearUntenAndReceipt();createAllEntriesInReceipt();calcSum();prodsToPayList=a;payTable=b;displayProdsToPayForTable();bindingPressReceipt()}function bindingPressReceipt(){$(".receipttable").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();if(onlyReceiptShown===1){$("#oben").show();$("#unten").show();$("#paybuttongroup").show();$("#hostbuttongroup").show();$(".receipttable").css("width","70%")}else{$("#oben").hide();$("#unten").hide();$("#paybuttongroup").hide();$("#hostbuttongroup").hide();$(".receipttable").css("width","100%")}onlyReceiptShown=1-onlyReceiptShown})}function displayProdsToPayForTable(){prodsToPayListGrouping=new Grouping(prodsToPayList,createHashOfPayableItem);prodsToPayListGrouping.group();var b=getProdSizeClass();var a=''+P_NOT_PAID[lang]+payTable+" ";a+=''+P_ALL[lang]+" ";var c=a+prodsToPayListGrouping.outputList(createPayableItemListElement);$("#oben").html(c);refreshList("#oben");$(".payable").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();var g=$(this).closest("li");var i=$("#oben li").index(g)-2;var f=prodsToPayListGrouping.popSortedEntry(i);prodsOnReceiptList[prodsOnReceiptList.length]=f;displayProdsToPayForTable();displayProdsOnReceipt()});$("#payall").off("click").on("click",function(g){g.stopImmediatePropagation();g.preventDefault();for(var f=0;f0,00 '+currency+"";var c=a+prodsOnReceiptListGrouping.outputList(createOnReceiptItemListElement);$("#unten").html(c);refreshList("#unten");createAllEntriesInReceipt();$(".onreceipt").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();var g=$(this).closest("li");var i=$("#unten li").index(g)-1;var f=prodsOnReceiptListGrouping.popSortedEntry(i);prodsToPayList[prodsToPayList.length]=f;displayProdsToPayForTable();displayProdsOnReceipt()})}function generateListItem(g,c,h,e,f){var b=getProdSizeClass();var a='';a+=''+e+" ";return a}function createHashOfPayableItem(b){var a=b.longname;if(b.pricelevelname!="A"){a+=" ("+b.pricelevelname+")"}a+=" - "+(parseFloat(b.price).toFixed(2).replace(".",decpoint));if(b.togo==1){a="To-Go: "+a}var c=createExtraParagraph(b.extras);return toHtml(a)+c}function createPayableItemListElement(b){var a="";if("count" in b){if(b.count>1){a=b.count+"x "}}var c=generateListItem("c","plus","payable_"+b.id,a+createHashOfPayableItem(b),"payable");return c}function createOnReceiptItemListElement(b){var a="";if("count" in b){if(b.count>1){a=b.count+"x "}}var c=generateListItem("c","plus","payable_"+b.id,a+createHashOfPayableItem(b),"onreceipt");return c}function clearUntenAndReceipt(){var a='';a+=P_CONTENT_RECEIPT[lang]+': 0,00 '+currency+"
";$("#unten").empty().append(a).promise().done(function(){refreshList("#unten")});$("#prodlistinreceipt tr").each(function(){$(this).remove()});$("#thedate").html(" ")}function createAllEntriesInReceipt(){var a=new Array();for(var e=0;e'+$("#receiptpart").html()+"";var q=$("#info-page").data("payPrintType");if(q=="s"){printBill(billid)}else{$("#oben").hide();var u=""+$(".receipttable").html()+"
";printContent(u)}}prodsOnReceiptList=[];getProdsToPayForTable(b,k);var i=$("#oben li").size()-2;if(i>0){}else{if(cameFromOrdering==1){goToUrl("waiter.html")}else{goToUrl("paydesk.html")}}}}else{alert("Fehler: "+s)}},error:function(i){alert("Sorry, there was a problem! "+i)}})}function goToUrl(a){setTimeout(function(){document.location.href=a},500)}function cashactions(){$(".cashaction").off("click").on("click",function(a){var b=$(this).attr("id");if(b=="cashtakeout"){startCashTakeOutProcess()}else{if(b=="cashinsert"){startCashInsertProcess()}else{if(b=="cashoverview"){startCashOverviewProcess()}}}})}function startCashInsertProcess(){$("#cashinsertdialog .sure-do").off("click").on("click",function(){$.mobile.changePage("#info-page");var a=$("#moneyToInsert").val().replace($("#info-page").data("decpoint"),".");var b=$("#remarkin").val();if(isNaN(a)){alert("Keine Zahl!")}else{if((parseFloat(a)>=0)&&(parseFloat(a)<=10000)){doCashInsert(a,b)}else{alert("Betrag muss positiv und kleiner als 10000 sein!")}}});$.mobile.changePage("#cashinsertdialog");removeInputValsCashIn()}function removeInputValsCashOut(){setTimeout(function(){$("#moneyToTakeOut").val("");$("#remarkout").val("")},1000)}function removeInputValsCashIn(){setTimeout(function(){$("#moneyToInsert").val("");$("#remarkin").val("")},1000)}function startCashTakeOutProcess(){$("#cashtakeoutdialog .sure-do").off("click").on("click",function(){$.mobile.changePage("#info-page");var a=$("#moneyToTakeOut").val().replace(decpoint,".");var b=$("#remarkout").val();if(isNaN(a)){alert("Keine Zahl!")}else{if((parseFloat(a)>=0)&&(parseFloat(a)<=10000)){doCashTakeOut(a,b)}else{alert("Betrag muss positiv und kleiner als 10000 sein!")}}});$.mobile.changePage("#cashtakeoutdialog");removeInputValsCashOut()}function doCashInsert(a,b){doAjax("POST","php/contenthandler.php?module=bill&command=doCashAction",{money:a,remark:b},handleCashActionResult,"Fehler Kassenaktion")}function doCashTakeOut(a,b){a=0-parseFloat(a);doAjax("POST","php/contenthandler.php?module=bill&command=doCashAction",{money:a,remark:b},handleCashActionResult,"Fehler Kassenaktion")}function startCashOverviewProcess(){doAjax("POST","php/contenthandler.php?module=bill&command=getCashOverviewOfUser",null,showCashOverview,"Fehler Kassenaktion")}function handleCashActionResult(a){if(a.status=="ERROR"){alert("Fehler "+a.code+": "+a.msg)}else{if(a.status=="OK"){alert(P_CASHACTION_OK[lang])}}}function showCashOverview(a){$("#cashbyguests").html((parseFloat(a.guestmoney).toFixed(2)).replace(".",decpoint));$("#cashtotal").html((parseFloat(a.total).toFixed(2)).replace(".",decpoint));$.mobile.changePage("#cashoverviewinfo")}function startDisplayProcess(){var b=location.search;if(b.indexOf("t=")<0){displayAllRooms()}else{var e="";var g=b.split(/&|\?/);for(var a=0;a
diff --git a/webapp/php/admin.php b/webapp/php/admin.php
index 43c5e8c..0624b49 100644
--- a/webapp/php/admin.php
+++ b/webapp/php/admin.php
@@ -393,6 +393,15 @@ class Admin {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$authenticated = false;
+
+ $isLoginAllowed = self::checkIsLoginAllowed($pdo,$userid);
+ if (!$isLoginAllowed) {
+ Logger::logcmd("admin","authentication","Login with id $userid failed");
+ echo json_encode(array("status" => "WAIT"));
+ return;
+ }
+
+
$sql = "SELECT * FROM %user% WHERE id=? AND active='1'";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($userid));
@@ -533,14 +542,66 @@ class Admin {
if ($authenticated) {
Logger::logcmd("admin","authentication","Login $username successful");
+ self::clearFailedLogins($pdo, $userid);
$loginMessage = $this->getMessage(null,'loginmessage');
echo json_encode(array("status" => "YES","loginmessage" => $loginMessage, "timediff" => $timeDiff, "isadmin" => $zeile['is_admin'],"lang" => $_SESSION["language"]));
} else {
Logger::logcmd("admin","authentication","Login with id $userid failed");
+ self::increaseFailedLogins($pdo,$userid);
+
echo json_encode(array("status" => "NO"));
}
}
+ private static function checkIsLoginAllowed($pdo,$userid) {
+ date_default_timezone_set(DbUtils::getTimeZone());
+ $now = getdate();
+ $serverTime = $now["0"];
+
+ $sql = "SELECT failedlogins FROM %user% WHERE id=?";
+ $row = CommonUtils::getRowSqlObject($pdo, $sql, array($userid));
+ if (is_null($row) || is_null($row->failedlogins)) {
+ return true;
+ } else {
+ $lastFailure = explode("_",$row->failedlogins)[0];
+ $attempt = intval(explode("_",$row->failedlogins)[1]);
+
+ if ($attempt >= 5) {
+ if (abs($serverTime - $lastFailure) > (60*3)) {
+ self::clearFailedLogins($pdo, $userid);
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return true;
+ }
+ }
+ }
+
+ private static function increaseFailedLogins($pdo,$userid) {
+ date_default_timezone_set(DbUtils::getTimeZone());
+ $now = getdate();
+ $serverTime = $now["0"];
+ $lastFailure = (string) $serverTime . "_";
+
+ $sql = "SELECT failedlogins FROM %user% WHERE id=?";
+ $row = CommonUtils::getRowSqlObject($pdo, $sql, array($userid));
+ if (is_null($row) || is_null($row->failedlogins)) {
+ $lastFailure .= "1";
+ } else {
+ $attempt = intval(explode("_",$row->failedlogins)[1]);
+ $lastFailure .= ($attempt + 1);
+ }
+ $sql = "UPDATE %user% SET failedlogins=? WHERE id=?";
+ CommonUtils::execSql($pdo, $sql, array($lastFailure,$userid));
+ }
+
+ private static function clearFailedLogins($pdo,$userid) {
+ $sql = "UPDATE %user% SET failedlogins=? WHERE id=?";
+ CommonUtils::execSql($pdo, $sql, array(null,$userid));
+ }
+
private function getMessage($pdo,$messageType) {
if (is_null($pdo)) {
$pdo = DbUtils::openDbAndReturnPdoStatic();
@@ -1002,7 +1063,7 @@ class Admin {
$view = "preferences.html";
}
- echo json_encode($view . "?v=1.3.8");
+ echo json_encode($view . "?v=1.3.9");
}
}
@@ -1204,25 +1265,25 @@ class Admin {
if (!self::isOnlyRatingUser($rights, $right_rating, true)) {
if ($_SESSION['modus'] == 0) {
- if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.3.8"); };
+ if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.3.9"); };
} else {
- if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.3.8"); };
+ if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.3.9"); };
}
- if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.3.8"); };
- if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.3.8"); };
- if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.3.8"); };
+ if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.3.9"); };
+ if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.3.9"); };
+ if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.3.9"); };
if ($_SESSION['modus'] == 0) {
- if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.3.8"); };
+ if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.3.9"); };
}
- if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.3.8"); };
- if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.3.8"); };
- if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.3.8"); };
- if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.3.8"); };
- if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.3.8"); };
- if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.3.8"); };
- if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.3.8"); };
- $mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.3.8");
- $mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.3.8");
+ if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.3.9"); };
+ if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.3.9"); };
+ if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.3.9"); };
+ if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.3.9"); };
+ if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.3.9"); };
+ if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.3.9"); };
+ if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.3.9"); };
+ $mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.3.9");
+ $mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.3.9");
}
$mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php");
@@ -1230,7 +1291,7 @@ class Admin {
$waiterMessage = $this->getMessage(null, "waitermessage");
}
- $mainMenuAndVersion = array ("version" => "OrderSprinter 1.3.8",
+ $mainMenuAndVersion = array ("version" => "OrderSprinter 1.3.9",
"user" => $currentUser,
"menu" => $mainMenu,
"waitermessage" => $waiterMessage,
diff --git a/webapp/php/closing.php b/webapp/php/closing.php
index e6db29d..a0e3351 100644
--- a/webapp/php/closing.php
+++ b/webapp/php/closing.php
@@ -67,6 +67,45 @@ $row = $stmt->fetchObject();
return($row->setting);
}
+private function saveLastClosingCreation($pdo) {
+date_default_timezone_set(DbUtils::getTimeZone());
+$date = new DateTime();
+$unixTimeStamp = $date->getTimestamp();
+$sql = "SELECT count(id) as countid FROM %work% WHERE item=?";
+$row = CommonUtils::getRowSqlObject($pdo, $sql, array('lastclosing'));
+if ($row->countid == 0) {
+$sql = "INSERT INTO %work% (item,value,signature) VALUES(?,?,?)";
+CommonUtils::execSql($pdo, $sql, array('lastclosing', $unixTimeStamp, null));
+} else {
+$sql = "UPDATE %work% SET value=? WHERE item=?";
+CommonUtils::execSql($pdo, $sql, array($unixTimeStamp, 'lastclosing'));
+}
+}
+
+private function isClosingAllowed($pdo) {
+$TIMEOUT = 120;
+
+$sql = "SELECT count(id) as countid FROM %work% WHERE item=?";
+$row = CommonUtils::getRowSqlObject($pdo, $sql, array('lastclosing'));
+if ($row->countid == 0) {
+return true;
+} else {
+$sql = "SELECT value FROM %work% WHERE item=?";
+$row = CommonUtils::getRowSqlObject($pdo, $sql, array('lastclosing'));
+$lastaccess = $row->value;
+
+date_default_timezone_set(DbUtils::getTimeZone());
+$date = new DateTime();
+$currentTimeStamp = $date->getTimestamp();
+
+if (($currentTimeStamp - $lastaccess) > $TIMEOUT) {
+return true;
+} else {
+return false;
+}
+}
+}
+
private function createClosing ($remark) {
if (is_null($remark)) {
$remark = "";
@@ -80,8 +119,16 @@ date_default_timezone_set(DbUtils::getTimeZone());
$closingTime = date('Y-m-d H:i:s');
$pdo = $this->dbutils->openDbAndReturnPdo();
+
+if (!$this->isClosingAllowed($pdo)) {
+echo json_encode(array("status" => "ERROR", "msg" => "Time between closings too short", "code" => ERROR_CLOSING_TIME_LIMIT));
+return;
+}
+
$pdo->beginTransaction();
+$this->saveLastClosingCreation($pdo);
+
if (CommonUtils::callPlugin($pdo, "createClosing", "replace")) {
return;
}
diff --git a/webapp/php/dbutils.php b/webapp/php/dbutils.php
index dcb33f4..a8ba667 100644
--- a/webapp/php/dbutils.php
+++ b/webapp/php/dbutils.php
@@ -175,6 +175,8 @@ class DbUtils {
array("col" => 'priceA', "hist" => 1, "property" => "priceA"),
array("col" => 'priceB', "hist" => 1, "property" => "priceB"),
array("col" => 'priceC', "hist" => 1, "property" => "priceC"),
+ array("col" => 'unit', "hist" => 1, "property" => "unit"),
+ array("col" => 'days', "hist" => 1, "property" => "days"),
array("col" => 'tax', "hist" => 1, "property" => "tax"),
array("col" => 'taxaustria', "hist" => 1, "property" => "taxaustria"),
array("col" => 'amount', "hist" => 0, "property" => "amount"),
diff --git a/webapp/php/globals.php b/webapp/php/globals.php
index 0d49d28..afab1e2 100644
--- a/webapp/php/globals.php
+++ b/webapp/php/globals.php
@@ -99,4 +99,6 @@ define ( 'ERROR_COMMAND_ERROR', 31);
define ( 'ERROR_COMMAND_ERROR_MSG', 'Kommando konnte nicht korrekt ausgeführt werden');
define ( 'ERROR_BILL_CUSTOMER_PAID', '32');
-define ( 'ERROR_BILL_CUSTOMER_PAID_MSG', 'Bon wurde schon von einem Gast bezahlt - siehe Gästeansicht');
\ No newline at end of file
+define ( 'ERROR_BILL_CUSTOMER_PAID_MSG', 'Bon wurde schon von einem Gast bezahlt - siehe Gästeansicht');
+
+define ( 'ERROR_CLOSING_TIME_LIMIT', 33);
\ No newline at end of file
diff --git a/webapp/php/products.php b/webapp/php/products.php
index 1384510..e319055 100644
--- a/webapp/php/products.php
+++ b/webapp/php/products.php
@@ -146,15 +146,17 @@ class Products {
array("id" => "id","get" => "%products%.id as id","histid" => "prodid","histget" => "prodid","histexportname" => "Produktid","isnumber" => "0"),
array("id" => "shortname", "get" => "shortname","histid" => "shortname","histget" => "shortname","histexportname" => "Kurzname","isnumber" => "0"),
array("id" => "longname", "get" => "longname","histid" => "longname","histget" => "longname","histexportname" => "Langname","isnumber" => "0"),
- array("id" => "available", "get" => "available","histid" => "available","histget" => "available","histexportname" => "","histexportname" => "Verfügbarkeit","isnumber" => "0"),
+ array("id" => "available", "get" => "available","histid" => "available","histget" => "available","histexportname" => "","histexportname" => "Verfügbarkeit","isnumber" => "0", "exportvals" => array("default" => "Nein","1" => "Ja")),
array("id" => "priceA", "get" => "priceA","histid" => "priceA","histget" => "priceA","histexportname" => "Preis (Stufe A)","isnumber" => "1"),
array("id" => "priceB", "get" => "priceB","histid" => "priceB","histget" => "priceB","histexportname" => "Preis (Stufe B)","isnumber" => "1"),
array("id" => "priceC", "get" => "priceC","histid" => "priceC","histget" => "priceC","histexportname" => "Preis (Stufe C)","isnumber" => "1"),
+ array("id" => "unit", "get" => "unit","histid" => "unit","histget" => "unit","histexportname" => "Einheit","isnumber" => "0", "exportvals" => array("default" => "Stück","1" => "Preiseingabe bei Bestellung")),
+ array("id" => "days", "get" => "days","histid" => "days","histget" => "days","histexportname" => "Tage","isnumber" => "0"),
array("id" => "tax", "get" => "IF(tax is not null, tax, 'null') as tax","histid" => "tax","histget" => "tax","histexportname" => "Steuer","isnumber" => "1"),
array("id" => "taxaustria", "get" => "IF(taxaustria is not null, taxaustria, 'null') as taxaustria","histid" => "","histget" => "","histexportname" => "","isnumber" => "0"),
array("id" => "amount", "get" => "IF(amount is not null, amount, 'null') as amount","histid" => "","histget" => "","histexportname" => "","isnumber" => "0"),
array("id" => "audio", "get" => "IF(audio is not null, audio, '') as audio","histid" => "","histget" => "","histexportname" => "","isnumber" => "0"),
- array("id" => "favorite", "get" => "IF(favorite is not null, favorite, '') as favorite","histid" => "prodid","histget" => "favorite","histexportname" => "Favorit","isnumber" => "0"),
+ array("id" => "favorite", "get" => "IF(favorite is not null, favorite, '') as favorite","histid" => "prodid","histget" => "favorite","histexportname" => "Favorit","isnumber" => "0", "exportvals" => array("default" => "Nein","1" => "Ja")),
array("id" => "type", "get" => "'p' as type","histid" => "","histget" => "","histexportname" => "","isnumber" => "0"),
);
@@ -168,6 +170,13 @@ class Products {
}
private function getAllTypesAndAvailProds() {
+ date_default_timezone_set(DbUtils::getTimeZone());
+ $date = new DateTime();
+ $dayofweek = date('N');
+ if ($dayofweek == 7) {
+ $dayofweek = 0;
+ }
+
$pdo = DbUtils::openDbAndReturnPdoStatic();
$pdo->beginTransaction();
@@ -197,10 +206,10 @@ class Products {
$typeArray[] = array("id" => $row['id'], "name" => $row['name'], "ref" => $ref);
}
- $sql = "select id,shortname,longname,audio,category as ref,favorite,$priceTxt as price,IF(tax is not null, tax, 'null') as tax,IF(taxaustria is not null, taxaustria, 'null') as taxaustria,IF(amount is not null, amount, 'null') as amount from %products% where available='1' AND removed is null ORDER BY sorting";
- $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
- $stmt->execute();
- $result = $stmt->fetchAll();
+ $sql = "select id,shortname,longname,audio,category as ref,favorite,$priceTxt as price,IF(unit is not null, unit, '0') as unit,IF(days is not null, days, '0123456') as days,IF(tax is not null, tax, 'null') as tax,IF(taxaustria is not null, taxaustria, 'null') as taxaustria,IF(amount is not null, amount, 'null') as amount ";
+ $sql .= " from %products% where available='1' AND removed is null AND (days is null OR days like ?) ORDER BY sorting";
+ $result = CommonUtils::fetchSqlAll($pdo, $sql, array("%$dayofweek%"));
+
$prodArray = array();
foreach($result as $row) {
$ref = $row['ref'];
@@ -223,7 +232,7 @@ class Products {
$stmt->execute(array($row['id']));
$extras = $stmt->fetchAll(PDO::FETCH_OBJ);
- $prodArray[] = array("id" => $row['id'], "name" => $row['shortname'], "longname" => $row['longname'], "audio" => $audio, "ref" => $ref, "favorite" => $fav, "price" => $row['price'], "tax" => $row['tax'], "taxaustria" => $row['taxaustria'],"amount" => $row['amount'],"extras" => $extras);
+ $prodArray[] = array("id" => $row['id'], "name" => $row['shortname'], "longname" => $row['longname'], "audio" => $audio, "ref" => $ref, "favorite" => $fav, "price" => $row['price'], "unit" => $row['unit'],"days" => $row['days'],"tax" => $row['tax'], "taxaustria" => $row['taxaustria'],"amount" => $row['amount'],"extras" => $extras);
}
$pdo->commit();
@@ -515,10 +524,14 @@ class Products {
$value = '-';
}
$value = str_replace(".",$decpoint,$value);
- } else if ($itemsql == 'available') {
- $value = ($zeile['available'] == '1' ? "Ja" : "Nein");
- } else if ($itemsql == 'favorite') {
- $value = ($zeile['favorite'] == '1' ? "Ja" : "Nein");
+ } else if (isset($aProdDef["exportvals"])) {
+ $exportvals = $aProdDef["exportvals"];
+ $value = $zeile[$itemsql];
+ if (isset($exportvals[$value])) {
+ $value = $exportvals[$value];
+ } else {
+ $value = $exportvals["default"];
+ }
} else {
$isNumber = $aProdDef["isnumber"];
$value = $zeile[$aProdDef["histget"]];
@@ -537,7 +550,7 @@ class Products {
function getSingleProdData($pdo,$id) {
if (is_numeric($id)) {
- $sql = "SELECT id,shortname,longname,priceA,priceB,priceC,IF(tax is not null, tax, 'null') as tax,available,audio,favorite from %products% where id=?";
+ $sql = "SELECT id,shortname,longname,priceA,priceB,priceC,IF(unit is not null, unit, '0') as unit,IF(days is not null, days, '0123456') as days,IF(tax is not null, tax, 'null') as tax,available,audio,favorite from %products% where id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($id));
diff --git a/webapp/php/updater.php b/webapp/php/updater.php
index d24c1cb..6bdbc8d 100644
--- a/webapp/php/updater.php
+++ b/webapp/php/updater.php
@@ -117,11 +117,44 @@ class Updater {
$infoFileLines = $infoFile["msg"];
if (count($infoFileLines) > 1) {
- return array("status" => "OK","msg" => $infoFileLines[0],"url" => $url);
+ $checkIfNewerVersion = self::isV2Newer('1.3.9',trim($infoFileLines[0]));
+ return array("status" => "OK","msg" => $infoFileLines[0],"url" => $url,"neweravailable" => ($checkIfNewerVersion ? 1 : 0));
} else {
return array("status" => "ERROR","msg" => "Info file not valid","url" => $url);
}
}
+
+ private static function isV2Newer($v1,$v2) {
+ if (is_null($v1) || is_null($v2)) {
+ return false;
+ }
+ $v1key = self::genVerKey($v1);
+ $v2key = self::genVerKey($v2);
+
+ if (is_null($v1key) || is_null($v2key)) {
+ return false;
+ }
+
+ if ($v1key < $v2key) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private static function genVerKey($v) {
+ $vparts = split("\.",$v);
+ $len = count($vparts);
+ $key = 0;
+ try {
+ for ($i=0;$i<$len;$i++) {
+ $key += intval($vparts[$i]) * pow(1000,2-$i);
+ }
+ return $key;
+ } catch (Exception $e) {
+ return null;
+ }
+ }
private static function doCheck($lineArr) {
diff --git a/webapp/php/utilities/TypeAndProducts/ProductEntry.php b/webapp/php/utilities/TypeAndProducts/ProductEntry.php
index 344ad6a..523dd9b 100644
--- a/webapp/php/utilities/TypeAndProducts/ProductEntry.php
+++ b/webapp/php/utilities/TypeAndProducts/ProductEntry.php
@@ -15,6 +15,8 @@ class ProductEntry {
private $favorite = "";
private $audio = "";
private $category = null;
+ private $unit = null;
+ private $days = null;
private static $PRICE_B = "PreisB";
private static $PRICE_C = "PreisC";
@@ -23,6 +25,8 @@ class ProductEntry {
private static $AMOUNT = "Menge";
private static $SHORTNAME = "Kurzname";
private static $AVAILABLE = "vorhanden";
+ private static $UNIT = "Einheit";
+ private static $DAYS = "Tage";
private static $ID = "ID";
@@ -52,6 +56,16 @@ class ProductEntry {
if (!is_numeric($this->priceC)) {
$this->priceC = 0.00;
}
+ if (!is_numeric($this->unit)) {
+ $this->unit = null;
+ } else {
+ if ($this->unit == 0) {
+ $this->unit = null;
+ }
+ }
+ if (is_null($this->days) || ($this->days == "")) {
+ $this->days = '0123456';
+ }
if ($this->tax == "null") {
$this->tax = null;
}
@@ -67,17 +81,23 @@ class ProductEntry {
}
public function createProductInDb($pdo) {
- $sql = "INSERT INTO `%products%` (`id`, `shortname`, `longname`, `priceA`, `priceB`, `priceC`, `tax`, `taxaustria`,`amount`,`category`,`favorite`,`available`,`audio`) VALUES (NULL,?,?,?,?,?,?,?,?,?,?,?,?)";
+ $sql = "INSERT INTO `%products%` (`id`,`shortname`,`longname`,`priceA`,`priceB`,`priceC`,`unit`,`days`,`tax`,`taxaustria`,`amount`,`category`,`favorite`,`available`,`audio`) VALUES (NULL,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
- $stmt->execute(array($this->shortName,$this->longName,$this->priceA,$this->priceB,$this->priceC,$this->tax,$this->taxaustria,$this->amount,$this->category,$this->favorite,$this->available,$this->audio));
+ if ($this->days == '0123456') {
+ $this->days = null;
+ }
+ $stmt->execute(array($this->shortName,$this->longName,$this->priceA,$this->priceB,$this->priceC,$this->unit,$this->days,$this->tax,$this->taxaustria,$this->amount,$this->category,$this->favorite,$this->available,$this->audio));
return ($pdo->lastInsertId());
}
public function applyProductInDb($pdo) {
- $updateSql = "UPDATE %products% SET shortname=?, longname=?, priceA=?, priceB=?, priceC=?, tax=?, taxaustria=?, amount=?,available=?, audio=?, favorite=? WHERE id=?";
+ $updateSql = "UPDATE %products% SET shortname=?, longname=?, priceA=?, priceB=?, priceC=?, unit=?, days=?, tax=?, taxaustria=?, amount=?,available=?, audio=?, favorite=? WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($updateSql));
- $stmt->execute(array($this->shortName,$this->longName,$this->priceA,$this->priceB,$this->priceC,$this->tax,$this->taxaustria,$this->amount,$this->available,$this->audio,$this->favorite,$this->prodid));
+ if ($this->days == '0123456') {
+ $this->days = null;
+ }
+ $stmt->execute(array($this->shortName,$this->longName,$this->priceA,$this->priceB,$this->priceC,$this->unit,$this->days,$this->tax,$this->taxaustria,$this->amount,$this->available,$this->audio,$this->favorite,$this->prodid));
}
//
@@ -91,6 +111,8 @@ class ProductEntry {
$priceA = str_replace('.', $decpoint, $aProd['priceA']);
$priceB = str_replace('.', $decpoint, $aProd['priceB']);
$priceC = str_replace('.', $decpoint, $aProd['priceC']);
+ $unit = $aProd['unit'];
+ $days = $aProd['days'];
$tax = str_replace('.', $decpoint, $aProd['tax']);
$taxaustria = $aProd['taxaustria'];
$amount = $aProd['amount'];
@@ -122,6 +144,17 @@ class ProductEntry {
if ($available == 0) {
$extArr[] = self::$AVAILABLE . ":nein";
}
+
+ if (!is_null($unit)) {
+ if ($unit == 1) {
+ $extArr[] = self::$UNIT . ":Eingabe";
+ }
+ }
+
+ if (!is_null($days)) {
+ $extArr[] = self::$DAYS . ":$days";
+ }
+
if (!is_null($prodId)) {
$extArr[] = self::$ID . ":" . $prodId;
}
@@ -145,6 +178,8 @@ class ProductEntry {
$this->priceB = null;
$this->priceC = null;
+ $this->unit = null;
+ $this->days = null;
$this->shortName = null;
$this->taxaustria = 0;
@@ -169,6 +204,14 @@ class ProductEntry {
} else {
$this->available = 0;
}
+ } else if ($identifier == self::$UNIT) {
+ if ($value == "Stück") {
+ $this->unit = null;
+ } else if ($value == "Eingabe") {
+ $this->unit = 1;
+ }
+ } else if ($identifier == self::$DAYS) {
+ $this->days = $value;
} else if ($identifier == self::$TAX) {
$this->tax = floatval(str_replace(",",".",(string) $value));
} else if ($identifier == self::$SHORTNAME) {
@@ -216,7 +259,14 @@ class ProductEntry {
function getPriceC() {
return $this->priceC;
}
+
+ function getUnit() {
+ return $this->unit;
+ }
+ function getDays() {
+ return $this->days;
+ }
function getTax() {
return $this->tax;
}
diff --git a/webapp/php/utilities/TypeAndProducts/TypeAndProductFileManager.php b/webapp/php/utilities/TypeAndProducts/TypeAndProductFileManager.php
index 1864d06..32436d9 100644
--- a/webapp/php/utilities/TypeAndProducts/TypeAndProductFileManager.php
+++ b/webapp/php/utilities/TypeAndProducts/TypeAndProductFileManager.php
@@ -351,6 +351,8 @@ class TypeAndProductFileManager {
$priceA = $product->getPriceA();
$priceB = $product->getPriceB();
$priceC = $product->getPriceC();
+ $unit = $product->getUnit();
+ $days = $product->getDays();
$tax = $product->getTax();
$taxaustria = trim($product->getTaxAustria());
if (($taxaustria == "") || ($taxaustria == 0)) {
@@ -387,15 +389,15 @@ class TypeAndProductFileManager {
}
}
if ($isNewProd) {
- $sql = "INSERT INTO `%products%` (`id`, `shortname`, `longname`, `priceA`, `priceB`, `priceC`, `tax`, `taxaustria`, `amount`, `category`,`available`,`favorite`,`sorting`) VALUES (NULL,";
- $sql = $sql . "?,?,?,?,?,?,?,?,?,?,?,?)";
+ $sql = "INSERT INTO `%products%` (`id`, `shortname`, `longname`, `priceA`, `priceB`, `priceC`, `unit`,`days`, `tax`, `taxaustria`, `amount`, `category`,`available`,`favorite`,`sorting`) VALUES (NULL,";
+ $sql = $sql . "?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
- $stmt->execute(array($shortName,$longName,$priceA,$priceB,$priceC,$tax, $taxaustria, $amount, $category,$available,$favorite,$sorting));
+ $stmt->execute(array($shortName,$longName,$priceA,$priceB,$priceC,$unit,$days,$tax, $taxaustria, $amount, $category,$available,$favorite,$sorting));
$prodid = $pdo->lastInsertId();
HistFiller::createProdInHist($pdo, $prodid);
} else {
- $sql = "SELECT shortname,longname,priceA,priceB,priceC,tax,taxaustria,amount,available,category FROM %products% WHERE id=?";
+ $sql = "SELECT shortname,longname,priceA,priceB,priceC,unit,days,tax,taxaustria,amount,available,category FROM %products% WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($prodid));
$row = $stmt->fetchObject();
@@ -405,15 +407,17 @@ class TypeAndProductFileManager {
|| ($row->priceA != $priceA)
|| ($row->priceB != $priceB)
|| ($row->priceC != $priceC)
+ || ($row->unit != $unit)
+ || ($row->days != $days)
|| ($row->available != $available)
|| ($row->tax != $tax)
|| ($row->taxaustria != $taxaustria)
|| ($row->amount != $amount));
if ($changed) {
- $sql = "UPDATE %products% SET shortname=?,longname=?,priceA=?,priceB=?,priceC=?,tax=?,taxaustria=?,amount=?,available=?,sorting=? WHERE id=?";
+ $sql = "UPDATE %products% SET shortname=?,longname=?,priceA=?,priceB=?,priceC=?,unit=?,days=?,tax=?,taxaustria=?,amount=?,available=?,sorting=? WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
- $stmt->execute(array($shortName,$longName,$priceA,$priceB,$priceC,$tax,$taxaustria,$amount,$available,$sorting,$prodid));
+ $stmt->execute(array($shortName,$longName,$priceA,$priceB,$priceC,$unit,$days,$tax,$taxaustria,$amount,$available,$sorting,$prodid));
HistFiller::updateProdInHist($pdo, $prodid);
} else {
$sql = "UPDATE %products% SET sorting=? WHERE id=?";
diff --git a/webapp/php/utilities/basedb.php b/webapp/php/utilities/basedb.php
index 526575d..a0af21f 100644
--- a/webapp/php/utilities/basedb.php
+++ b/webapp/php/utilities/basedb.php
@@ -216,6 +216,7 @@ class Basedb {
`prefertablemap` INT(1) NULL,
`keeptypelevel` INT(1) NOT NULL,
`extrasapplybtnpos` INT(1) NOT NULL,
+ `failedlogins` VARCHAR(20) NULL,
`active` INT (2) NOT NULL
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ;
";
@@ -377,6 +378,8 @@ class Basedb {
`priceA` " . DECIMALSMALL . " NULL,
`priceB` " . DECIMALSMALL . " NULL,
`priceC` " .DECIMALSMALL . " NULL,
+ `unit` INT(2) NULL,
+ `days` VARCHAR(20) NULL,
`tax` " . DECIMALSMALL . " NULL,
`taxaustria` INT(1) NULL,
`amount` INT(5) NULL,
@@ -611,6 +614,8 @@ class Basedb {
`priceA` " . DECIMALSMALL . " NULL,
`priceB` " . DECIMALSMALL . " NULL,
`priceC` " . DECIMALSMALL . " NULL,
+ `unit` INT(2) NULL,
+ `days` VARCHAR(20) NULL,
`tax` " . DECIMALSMALL . " NULL,
`taxaustria` INT(1) NULL,
`sorting` INT(2) NULL,
diff --git a/webapp/php/utilities/pdfexport.php b/webapp/php/utilities/pdfexport.php
index c23dc2f..78f22c0 100644
--- a/webapp/php/utilities/pdfexport.php
+++ b/webapp/php/utilities/pdfexport.php
@@ -187,7 +187,10 @@ class PdfExport extends FPDF {
$host = ($zeile['host'] == 1 ? "x" : "-");
if (!$commonUtils->verifyBillByValues(null,$billdate, $brutto_orig, $netto_orig, $tax_orig, $userid, $signature)) {
- echo "Database is inconsistent!";
+ echo "Database is inconsistent! Bill $billid ";
+ if ($zeile['status'] == "c") {
+ echo '- a cash operation ("Bareinlage/Barauslage"). ';
+ }
return null;
}
diff --git a/webapp/preferences.html b/webapp/preferences.html
index 90aa613..a8aa749 100644
--- a/webapp/preferences.html
+++ b/webapp/preferences.html
@@ -5,7 +5,7 @@
-
+
diff --git a/webapp/products.html b/webapp/products.html
index 0179369..add1555 100644
--- a/webapp/products.html
+++ b/webapp/products.html
@@ -7,7 +7,7 @@
-
+
@@ -28,6 +28,8 @@ var PROD_NO = ["Nein","No","No"];
var PROD_NEW_PROD = ["Neues Produkt","New product","Nuevo producto"];
var PROD_NO_TONE = ["Kein Ton","No audio","Ningún sonido"];
var PROD_PRICE = ["Preis","Price","Precio"];
+var PROD_UNIT = ["Einheit","Unit","Unidad"];
+var PROD_DAYS = ["Tage","Days","Dias"];
var PROD_TAX = ["Steuersatz immer","Tax always","Impuesto siempre"];
var PROD_TAXAUSTRIA = ["Steuersatz Österreich","Tax Austria","Impuesto Austria"];
var PROD_AMOUNT = ["Verfügbare Menge","Available amount","Cuanto hay"];
@@ -163,13 +165,21 @@ function setLanguage(language) {
var i=0;
for (i=0;i
-
+
diff --git a/webapp/reports.html b/webapp/reports.html
index 766d787..fd9b6b4 100644
--- a/webapp/reports.html
+++ b/webapp/reports.html
@@ -7,7 +7,7 @@
-
+
diff --git a/webapp/reservation.html b/webapp/reservation.html
index 1695b65..177d3c3 100644
--- a/webapp/reservation.html
+++ b/webapp/reservation.html
@@ -5,7 +5,7 @@
-
+
diff --git a/webapp/supplydesk.html b/webapp/supplydesk.html
index 7194c47..c47704c 100644
--- a/webapp/supplydesk.html
+++ b/webapp/supplydesk.html
@@ -5,7 +5,7 @@
-
+
diff --git a/webapp/utilities.js b/webapp/utilities.js
index dc08232..81409e5 100644
--- a/webapp/utilities.js
+++ b/webapp/utilities.js
@@ -200,6 +200,10 @@ function isInt(value) {
}
}
+function isFloat(n){
+ return Number(n) === n && n % 1 !== 0;
+}
+
function getMillis() {
var d = new Date();
var n = d.getTime();
diff --git a/webapp/waiter.html b/webapp/waiter.html
index 6e5183c..8d95357 100644
--- a/webapp/waiter.html
+++ b/webapp/waiter.html
@@ -4,7 +4,8 @@
-
+
+
@@ -23,7 +24,7 @@
}
@media print
{
- #waiterui,#thefooter3,#header3,#info-page,#tables-page,#modulemenu-room,#modulemenu-table,#modulemenu-prod,#discard_new_orders_no,#searchField,#searchResult {display: none;}
+ #waiterui,#thefooter3,#header3,#info-page,#tables-page,#modulemenu-room,#modulemenu-table,#modulemenu-prod,#discard_new_orders_no,#discard_priceenter,#discard_new_orders_yes,#enterpricefield,#enterpriceheader,#enterpricedlg,#searchField,#searchResult {display: none;}
}
@media print
{
@@ -32,7 +33,7 @@
+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_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_SEARCHRESULTS=["Suchergebnis","Search Result","Encontrado"];var W_WRONG_PIN=["Falscher Stornocode","Wrong cancel code","Codigo falso"];var W_NO_ORDERS=["Keine gebuchten Orders vorhanden!","No orders available!","No hay ningún orden!"];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 Preiseingabe","No valid price","Precio no valido"];var W_NO_REORDER_VAR_PRICE=["Produkt mit variablem Preis kann nicht auf diese Weise nachbestellt werden.","Produkt with variable price cannot be reordered this way.","Producto con un precio variable no se puede reordenado asi."];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(h){lang=h;$("#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]);var f="";if(prominentsearch==0){f+='
'}else{f+='
";var e='
';if(prominentsearch==0){$("#searchposition-normal").html(f)}else{$("#searchposition-prominent").html(f)}var b=e;if((workflowconfig==WORKFLOW_DIGI_WORK)||(workflowconfig==WORKFLOW_DIGI)||(workflowconfig==WORKFLOW_WORK_SEND)){b+='
'+W_SEND_ORDERS[lang]+" "}if((workflowconfig==WORKFLOW_DIGI_WORK)||(workflowconfig==WORKFLOW_WORK)||(workflowconfig==WORKFLOW_WORK_SEND)){b+='
'+W_WORK_TICKET[lang]+" "}if(cashenabled==1){b+='
'+W_TO_PAYDESK[lang]+" "}b+='
';$("#commandbuttons").html(b);$("#waiterui").trigger("create");var c='
';$("#actremark").html(c);if(rightchangeprice==1){var a='
';$("#actchangepricesection").html(a);var g='
';g+=getDiscountButton("discount1","a",discount1,discountname1);g+=getDiscountButton("discount2","b",discount2,discountname2);g+=getDiscountButton("discount3","c",discount3,discountname3);g+="
";$("#actdiscount").html(g)}$("#actionneworderconfirm_all").html(W_ACT_CHANGE_ALL[lang]);$("#actionneworderconfirm_one").html(W_ACT_CHANGE_ONE[lang]);$("#actionnewordercancel").html(W_CANCEL[lang]);$("#select-comment").off("click").on("click",function(k){k.stopImmediatePropagation();k.preventDefault();var i=$("#select-comment").find(":selected").val();$("#optionfield").val(i)});$("#act-select-comment").off("click").on("click",function(k){k.stopImmediatePropagation();k.preventDefault();var i=$("#act-select-comment").find(":selected").val();$("#act-optionfield").val(i)});$("#discard_new_orders_no").off("click").on("click",function(i){i.stopImmediatePropagation();i.preventDefault();parent.history.back()});$("#discard_priceenter").off("click").on("click",function(i){i.stopImmediatePropagation();i.preventDefault();$("#enterpricedlg").dialog("close")});$("#discard_new_orders_yes").off("click").on("click",function(i){i.stopImmediatePropagation();i.preventDefault();neworders=[];gotoOtherPage($("#discardnewordersdlg").data("link"))});$("#prodbackbtn").off("click").on("click",function(i){if(neworders.length!=0){i.stopImmediatePropagation();i.preventDefault();hideMenuProd();$("#discardnewordersdlg").data("link","back_table");$.mobile.changePage("#discardnewordersdlg")}else{parent.history.back()}});$("#searchField").off("keyup").on("keyup",function(i){generateSearchResults()})}function getDiscountButton(f,e,c,a){var b='
";if(a.trim()!=""){b='
"}return b}function generateSearchResults(){var e=$("#searchField").val().trim().toLowerCase();if(e.length<3){$("#searchResult").html("")}else{var c=getProdSizeClass();var b='
";$("#searchResult").html(b);$("#searchResult").trigger("create");$(".srinfo").off("click").on("click",function(i){i.stopImmediatePropagation();i.preventDefault();var f=this.id.split("_")[1];var h=getProdEntry(f);var g=h.price;alert(W_PRICE[lang]+": "+g+" "+currency)});$(".srplus").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();var g=this.id.split("_")[1];var f=getSearchProdCount(g);$("#srprodcount_"+g).html(f+1)});$(".srminus").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();var g=this.id.split("_")[1];var f=getSearchProdCount(g);if(f==2){$("#srprodcount_"+g).html("");selectedProdCount=1}else{if(f>2){$("#srprodcount_"+g).html(f-1)}}});$(".searchresult").off("click").on("click",function(g){g.stopImmediatePropagation();g.preventDefault();favOrSearchWasClicked=true;var f=this.id.split("_")[1];selectedProdCount=getSearchProdCount(f);clearSearchAndGoToHigherTypeIfExtrasOpen();levelOneType=0;handleClickOnProd(f)})}}function fillGenCommentsList(f){if(f.status!="OK"){alert("Fehler "+f.code+": "+f.msg);return}var b='
';var e=f.msg;var c=0;for(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+=' "}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 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,e){var a=parseFloat(b);if(e!=null){for(var c=0;c";var l=groupedNewOrders.count.length;for(f=0;f1){k=""+g.toString()+"x "+k}var e=groupedNewOrders.prodids[f];if(h!=""){h=""+toHtml(h)+"
"}var b=groupedNewOrders.changedPrices[f];var a=groupedNewOrders.togos[f];var n="";var c=groupedNewOrders.extras[f];if((c!=null)&&(c!="")){n=""+c+" "}if(b!="NO"){b=b.replace(".",decpoint);if(a!=0){m+=''+k+h+n+" ("+b+" - To-Go) "}else{m+=''+k+h+n+" ("+b+") "}}else{if(a!=0){m+=''+k+h+n+" - To-Go "}else{m+=''+k+h+n+" "}}}$("#neworders").html(m);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]};$("#actiononneworderel").data("entry",a);$("#actiononneworderel").data("newcount",a.count);$("#actiononneworderel").data("groupedListIndex",b);$("#act-optionfield").val(a.option);$("#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 gotoTablePage(){var a=$("#tables-page").data("allroomtables");var b=a.length;if(!isTogoOrderSelected||(b==1)){$.mobile.changePage("#tables-page")}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,g){var a=getProdProperties(f);if(a.unit!=0){alert(W_NO_REORDER_VAR_PRICE[lang]);return}var e=[];for(var c=0;c'+k.name+" "});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("");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";return a}function displayTablesListOrMap(h){var g=$("#tables-page").data("roomdetail");if($("#info-page").data("type")=="t"){$("#tableselbackbtn").hide()}else{$("#tableselbackbtn").show()}var a=g.id;var l=g.tables;var i=shallDisplayRoom(a);var c=$("#info-page").data("type");if(i.show){$(h).hide();d=new Date();$("#mapimgpart").attr("src","php/tablemap.php?command=getTableMapImgAsPng&showBubbles=0&roomid="+a+"&"+d.getTime());$("#tablemapcontent").show();var b=new Tablemap(a,null,"");var e=b.createOverlay("#mapimgpart",i.pos,W_TO_PAY[lang],decpoint,currency,l,ostablebtnsize);$("#tableoverlay").html(e);b.bindingForOverlaySelection(handleClickInTablemap.bind(this),a,l,null);if(c=="t"){var k=''+W_TOGO[lang]+" ";$("#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(p,s){var r=s.pricesum;var n=r.replace(".",decpoint)+" "+currency;var o=s.prodcount;var m=s.prodready;var q=s.readyQueueIds;if(r!=0){k+=''+s.name+" ("+W_TO_PAY[lang]+": "+n+")"+createServeInfo(s.id,o,m)+" "}else{k+=''+s.name+createServeInfo(s.id,o,m)+" "}});if(c=="t"){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){k+=' "}for(var f=0;f=0){b="f";h="check"}k+=' "}if(requestPriceInExtras!=false){k+=' '}if(applyExtraBtnPos!=2){k+=' "}k+=createHigherLine(l);return k}function bindExtrasSel(){$(".extrasel").off("click").on("click",function(n){n.stopImmediatePropagation();n.preventDefault();var a=this.id.split("_");var b=a[1];var f=a[2];if((b=="abottom")||(b=="atop")){var l=getProdEntry(f);var c=l.extras;var o=[];for(var h=0;h=0){o[o.length]={id:b,name:m,price:g.price}}}if(requestPriceInExtras){var k=$("#enterpriceextrasfield").val();k=k.trim();k=k.replace(decpoint,".");if((k!="")&&($.isNumeric(k))){requestPriceInExtras=false;presetPriceInExtras="";addProductToNewOrdersList(f,o,k)}else{alert(W_NO_VALID_PRICE[lang])}}else{addProductToNewOrdersList(f,o)}}else{if(w_extras.indexOf(b)>=0){w_extras.splice(w_extras.indexOf(b),1)}else{w_extras[w_extras.length]=b}if(requestPriceInExtras!==false){presetPriceInExtras=$("#enterpriceextrasfield").val()}var p=listOfExtras(f);$("#typeproducts-list").html(p);refreshList("#typeproducts-list");bindExtrasSel();bindHigherButtons()}})}function lastSelectedProdToStr(){return" ("+W_LAST_SELECTED[lang]+": "+lastSelectedProduct+")"}function listOfTypesProds(e){var a=''+W_SELECTION[lang]+"";if(lastSelectedProduct!=""){a+=lastSelectedProdToStr()}a+=" ";var b=$("#typprodpage").data("types_prods");var c=getProdSizeClass();$.each(b.types,function(g,f){if(parseInt(f.ref)==e){a+=''+toHtml(f.name)+" "}});$.each(b.prods,function(f,g){if(parseInt(g.ref)==e){a+=''+toHtml(g.name);if((g.amount!="null")&&(g.amount<11)){a+=" ("+W_ONLY[lang]+" "+g.amount+") "}a+=createProdInfoTxt(g.id);a+=" "}});if(e!=0){a+=createHigherLine(c)}return a}function createHigherLine(b){var a='';a+='";a+=" ";return a}function createProdInfoTxt(b){var a=" ";a+="";a+="";a+="";return a}function createSearchProdInfoTxt(b){var a=" ";a+="";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'+W_FAVS[lang]+"";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}}});c.sort(prodcompare);$.each(c,function(g,h){f+=''+toHtml(h.longname);f+=createProdInfoTxt(h.id);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];selectedProdCount=getProdCount(a);handleClickOnProd(a)})}function displayTypesProds(c,b){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(i){i.stopImmediatePropagation();i.preventDefault();favOrSearchWasClicked=false;$("#searchField").val("");generateSearchResults();var g=this.id;var f=g.split("_");if(f[0]=="t"){if(c==0){levelOneType=f[1];c=f[1]}displayTypesProds(f[1],null)}else{var h=f[1];selectedProdCount=getProdCount(h);handleClickOnProd(h)}});bindHigherButtons()});$(".prodinfo").off("click").on("click",function(i){i.stopImmediatePropagation();i.preventDefault();var f=this.id.split("_")[1];var h=getProdEntry(f);var g=h.price;alert(W_PRICE[lang]+": "+g+" "+currency)});$(".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("");selectedProdCount=1}else{if(f>2){$("#prodcount_"+g).html(f-1)}}})}function getHigherType(){var c=$("#typprodpage").data("types_prods");var b=c.types;var f=0;if(!extrasMenuOpen){for(var e=0;e0)){w_extras=[];w_allextras=a;idOfHigherType=c.ref;if(c.unit==1){requestPriceInExtras=true;presetPriceInExtras=""}else{requestPriceInExtras=false}displayTypesProds(b,a);bindExtrasSel()}else{if(c.unit==1){hideMenuProd();enterpricedlgshown=true;$("#enterpricedlg").data("prodid",b);$("#enterpricefield").val("");$.mobile.changePage("#enterpricedlg");bindEnterPriceNumbers()}else{addProductToNewOrdersList(b,null)}}}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(c){c.stopImmediatePropagation();c.preventDefault();var a=$("#enterpricedlg").data("prodid");var b=$("#enterpricefield").val();b=b.trim();b=b.replace(decpoint,".");if((b!="")&&($.isNumeric(b))){$("#enterpricedlg").dialog("close");addProductToNewOrdersList(a,null,b)}else{alert(W_NO_VALID_PRICE[lang])}})}function addProductToNewOrdersList(b,c,f){var g=$("#typprodpage").data("table-info");var a=g[1];addProductToQueue(b,c,"NO",0,f);var h=getProdAudio(parseInt(b));var e=parseInt($("#typprodpage").data("ordervolume"))/10;if(h!=""){var k="customer/"+h;if(h.match(/mp3$/)){$("#audiofile").html(' ')}else{if(h.match(/ogg$/)){$("#audiofile").html(' ')}else{if(h.match(/wav$/)){$("#audiofile").html(' ')}}}document.getElementById("audiofile").load();document.getElementById("audiofile").volume=e;document.getElementById("audiofile").play()}else{if(e>0.5){beep()}}var i="php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&tableid="+a;fillNotDeliveredProductsOfATable(i);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(e){var b="";if(e.option!=""){b=" ("+toHtml(e.option)+")"}var c=e.longname;if(e.togo==1){c="To-Go: "+c}if(e.pricechanged==1){c+=" - "+e.price.replace(".",decpoint)}var a="";if(e.isready=="1"){a+=" ☞"}if(e.isCooking=="1"){a+=" ♨"}if(e.isPaid=="1"){a+=" ☑"}return toHtml(c)+b+a+" "+createExtraParagraph(e.extras)}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='";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)}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 '}$(document).on("pagebeforeshow","#typprodpage",function(){allowPrintAndOrderBtn=true;lastSelectedProduct="";tableListActive=false;if(nextPage==""){reloadPage()}$("#tablemapcontent").hide();$.ajaxSetup({cache:false});hideMenuProd();getPayPrintType();checkForLogIn();doJsonAjax("GET","php/contenthandler.php?module=admin&command=getOrderVolume",null,fillOrderVolume,"Keine Ordertoninformation");$("#workprintarea").html("");var a=$(this).data("table-info");var c=a[0];var b=a[1];$("#changetablewhatdialog").data("fromtableid",b);var e=a[2];$("#typprodpage h1").html(W_ATABLE[lang]+": "+e+getPrinterStatusStr());$("#optionfield").val("");if(!enterpricedlgshown){fillTypeProdList(0)}else{enterpricedlgshown=false}var f="php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&tableid="+b;fillNotDeliveredProductsOfATable(f);$("#workprint_btn").data("tableid",b);$("#gopaydesk_btn").data("tableid",b);$("#workprint_btn").data("tablename",e);bindPrintButton();bindGoPayDeskButton();bindChangetableButton();bindSendNewOrdersButton();getUserHasRightForPaydesk()});function bindSendNewOrdersButton(){$("#sendorder_btn").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();if(allowPrintAndOrderBtn){allowPrintAndOrderBtn=false;lastSelectedProduct="";if(extrasMenuOpen){alert(W_OPEN_PANEL[lang])}else{sendNewOrders(false,"s",gotoTablePage)}}})}function bindPrintButton(){$("#workprint_btn").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();if(allowPrintAndOrderBtn){allowPrintAndOrderBtn=false;lastSelectedProduct="";if(extrasMenuOpen){alert(W_OPEN_PANEL[lang])}else{if(neworders.length>0){var a=$("#workprintarea").data("payPrintType");sendNewOrders(true,a,gotoTablePage)}else{alert(W_NO_ORDERS[lang])}}}})}function bindGoPayDeskButton(){$("#gopaydesk_btn").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();if(allowPrintAndOrderBtn){allowPrintAndOrderBtn=false;lastSelectedProduct="";if(neworders.length>0){var a=$("#workprintarea").data("payPrintType");if(waitergopayprint==1){sendNewOrders(true,a,goToPayDesk)}else{sendNewOrders(false,a,goToPayDesk)}}else{if(notDeliveredProdsAvailable){goToPayDesk()}else{alert(W_NO_ORDERS[lang])}}}})}function goToPayDesk(){var a=$("#gopaydesk_btn").data("allowed");if(a.toLowerCase()=="yes"){window.location.href="paydesk.html?t="+$("#gopaydesk_btn").data("tableid")}else{alert("Fehlendes Benutzerrecht für Kasse")}}function createRoomOrTableList(b,c){var a=''+c+" ";$.each(b,function(f,e){a+=''+e.name+" "});return a}function handleClickInChangeTablemap(a){$("#changetablewhatdialog").data("totableid",a.tableid);$.mobile.changePage("#changetablewhatdialog")}function displayTableDialog(e,g,c){$("#header_tchange").html("Tischauswahl");var f=shallDisplayRoom(e);if(f.show){$("#roomOrTableList").hide();$("#tablemapcontentchangetable").show();d=new Date();$("#mapimgpartchangetable").attr("src","php/tablemap.php?command=getTableMapImgAsPng&roomid="+e+"&"+d.getTime());var b=new Tablemap(e,null,"");b.bindingForSelection("#mapimgpartchangetable",handleClickInChangeTablemap.bind(this),f.pos,e);if(c){$.mobile.changePage("#tablechangedialog")}$("#changetablebackbtn").off("click").on("click",function(h){$("#tablemapcontentchangetable").hide();$("#roomOrTableList").show()})}else{$("#roomOrTableList").show();var a=createRoomOrTableList(g,"Tische");$("#roomOrTableList").empty().append(a).promise().done(function(){if(c){$.mobile.changePage("#tablechangedialog")}refreshList("#roomOrTableList");$(this).off("click").on("click",".info-go",function(i){i.stopImmediatePropagation();i.preventDefault();var h=($(this).attr("id")).split("_")[1];$("#changetablewhatdialog").data("totableid",g[h].id);$.mobile.changePage("#changetablewhatdialog")})})}}function resultOfChangeTable(a){if(a.status!="OK"){alert("Fehler "+a.code+": "+a.msg+"\n\nMöglicherweise hat ein Kollege\nin der Zwischenzeit Produkte zugestellt.")}else{alert("Tischwechsel durchgeführt!")}window.location.href="waiter.html"}function bindChangetableButton(){$("#changetable_btn").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();var b=$("#tables-page").data("allroomtables");var f=b.length;if(f==1){displayTableDialog(b[0].id,b[0].tables,true)}else{$("#header_tchange").html("Raumauswahl");var a=createRoomOrTableList(b,W_ROOMS[lang]);$("#roomOrTableList").empty().append(a).promise().done(function(){$.mobile.changePage("#tablechangedialog");refreshList("#roomOrTableList");$(this).off("click").on("click",".info-go",function(h){h.stopImmediatePropagation();h.preventDefault();var g=($(this).attr("id")).split("_")[1];displayTableDialog(b[g].id,b[g].tables,false)})})}})}function createHtmlOfKind(e,a,k){var g="";for(var b=0;b"+c+" "+h+" "}}return g}function createExtraParagraph(b){if((b==null)||(b=="")){return""}var c="";for(var a=0;a"}return c}function arrayContainsKind(b,e,g){var a=false;for(var c=0;c";if(o.status=="OK"){var b=o.msg;var f=$("#workprintarea").data("payPrintType");var g="";var m=$("#workprint_btn").data("tablename");if(arrayContainsKind(b,0,1)){var e="Speisen für "+m+" (Printer 1) ";var l=e+" "+i+" "+createHtmlOfKind(b,0,1)+" ";g+=l+" "}if(arrayContainsKind(b,0,2)){var e="Speisen für "+m+" (Printer 2) ";var l=e+" "+i+" "+createHtmlOfKind(b,0,2)+" ";g+=l+" "}if(arrayContainsKind(b,1,1)){var c="Getränke für "+m+" (Printer 1) ";var k=c+" "+i+" "+createHtmlOfKind(b,1,1)+" ";g+=k+" "}if(arrayContainsKind(b,1,2)){var c="Getränke für "+m+" (Printer 2) ";var k=c+" "+i+" "+createHtmlOfKind(b,1,2)+" ";g+=k+" "}$("#workprintarea").html(g);window.print();setTimeout(function(){document.location.href="waiter.html"},250)}else{alert("Druckdaten konnten nicht angefordert werden")}}function printJob(h,c,f,b,g,a){var e={header:h,table:c,timestamp:f,prods:b,type:g,printer:a};doJsonAjax("POST","php/contenthandler.php?module=printqueue&command=queueWorkPrintJob",e,null,"Druckfehler")}function updateNotDeliveredList(){var a=$("#typprodpage").data("table-info");var c=a[1];var e="php/contenthandler.php?module=queue&command=getJsonLongNamesOfProdsForTableNotDelivered&tableid="+c;var b="#orderedprod-list-0";fillNotDeliveredProductsOfATable(e)}function doJsonAjax(a,b,f,e,c){$.ajax({type:a,url:b,dataType:"json",data:f,async:true,success:function(g){if(e!=null){e(g)}},error:function(k,g,h){if(c!=null){var i=c+", Status: "+g+", Error:"+h+", Msg: "+k.responseText+" ("+b+")";alert("Kommunikationsfehler zum Server: "+i)}}})}function doJsonAjaxAsync(a,b,e,c,f){$.ajax({type:a,url:b,dataType:"json",data:e,async:f,success:function(g){if(c!=null){c(g)}},error:function(i,g,h){}})}function doYouWantDelOrReorder(e,f,c,b,a){$("#delOrReorderDlg .sure-1").text(f);$("#delOrReorderDlg .sure-2").text(e);$("#delOrReorderDlg .sure-cancel").text(W_CANCEL[lang]);$("#delOrReorderDlg .sure-do").text(c).off("click.delOrReorderDlg").on("click.delOrReorderDlg",function(){b()});$("#delOrReorderDlg .reorder").text(W_REORDER[lang]).off("click.delOrReorderDlg").on("click.delOrReorderDlg",function(){a()});$(this).off("click.delOrReorderDlg");$.mobile.changePage("#delOrReorderDlg")}function areYouSure(c,b,a,e){$("#sure .sure-1").text(c);$("#sure .sure-2").text(b);$("#sure .sure-do").text(a).off("click.sure").on("click.sure",function(){e()});$(this).off("click.sure");$.mobile.changePage("#sure")}function changePriceInActPanel(a){if(rightchangeprice){$("#act-changepricefield").val(a.toFixed(2).replace(".",decpoint))}}function actionSelOnNewOrderElem(){var b=$("#actiononneworderel").data("entry");var a=$("#actiononneworderel").data("newcount");$("#act_count").html(a);$("#act_name").html(b.name+" ("+b.price.replace(".",decpoint)+" "+currency+")");if(b.option!=""){$("#act_option").html(" ("+b.option+")")}if(rightchangeprice){if(b.changedPrices!="NO"){$("#act-changepricefield").val(b.changedPrices)}}$("#act-select-comment").html(predefinedComments);$.mobile.changePage("#actiononneworderel");if(a==1){$("#actionneworderconfirm_all").html(W_ACT_CHANGE[lang]);$("#actionneworderconfirm_one").hide()}else{$("#actionneworderconfirm_all").html(W_ACT_CHANGE_ALL[lang]);$("#actionneworderconfirm_one").html(W_ACT_CHANGE_ONE[lang]);$("#actionneworderconfirm_one").show()}$("#act-select-comment").selectmenu("refresh");$("#togocheckbox").checkboxradio("refresh");$("#actminusone").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();reduceOneNewOrderItem();actionSelOnNewOrderElem($("#actiononneworderel").data("entry"),$("#actiononneworderel").data("groupedListIndex"))});$("#actplusone").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();increaseOneNewOrderItem();actionSelOnNewOrderElem($("#actiononneworderel").data("entry"),$("#actiononneworderel").data("groupedListIndex"))});$("#actdel").off("click").on("click",function(c){delOneNewOrderItem();actionSelOnNewOrderElem($("#actiononneworderel").data("entry"),$("#actiononneworderel").data("groupedListIndex"));actionNewOrderConfirm(CHANGE_ONE)});$("#actionneworderconfirm_all").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();$("#actiononneworderel").dialog("close");actionNewOrderConfirm(CHANGE_ALL)});$("#actionneworderconfirm_one").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();$("#actiononneworderel").dialog("close");actionNewOrderConfirm(CHANGE_ONE)});$("#actionnewordercancel").off("click").on("click",function(c){binding_neworderelem()});$("#discount1").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();var c=b.price;changePriceInActPanel(c-c*discount1/100)});$("#discount2").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();var c=b.price;changePriceInActPanel(c-c*discount2/100)});$("#discount3").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();var c=b.price;changePriceInActPanel(c-c*discount3/100)})}function actionNewOrderConfirm(h){var c=$("#actiononneworderel").data("entry");var n=$("#act-optionfield").val();if(rightchangeprice==1){var f=$("#act-changepricefield").val().trim();f=f.replace(",",".");if(f>999.99){alert(W_MAX_PRICE_EXCEEDED[lang]);return}if(f==""){f="NO"}else{if(!$.isNumeric(f)){alert(W_WRONG_FORMAT[lang]);return}else{$("#act-changepricefield").val("")}}}else{f="NO"}var g=$("#togocheckbox").prop("checked");if(g){g=1}else{g=0}if(h==CHANGE_ONE){var b=c.origidxs;neworders[b[0]].option=n;neworders[b[0]].changedPrice=f;neworders[b[0]].togo=g}else{var b=c.origidxs;for(m=0;m0){var b=c.origidxs;var q=b[0];var l=neworders[q].prodid;var f=neworders[q].changedPrice;var g=neworders[q].togo;var n=neworders[q].option;var k=neworders[q].extras;for(m=0;m0){$("#actiononneworderel").data("newcount",a-1)}}function delOneNewOrderItem(){$("#actiononneworderel").data("newcount",0)}function increaseOneNewOrderItem(){var b=$("#actiononneworderel").data("entry");var a=$("#actiononneworderel").data("newcount");$("#actiononneworderel").data("newcount",a+1)}function group(h){var x=[];var e=[];var z=[];var s=[];var o=[];var g=[];var v=[];var w=[];var a=[];var m=[];var y={count:x,joinedvals:e,name:z,price:s,option:o,extras:g,prodids:v,origidxs:w,changedPrices:a,togos:m};var u=0;for(u=0;u+ "+toHtml(c[t].name)+""}}var q=z+"-"+o+"-"+b;if(f!="NO"){q=z+"-"+o+"-"+b+f}if(l==1){q+=" - To-Go"}var k=y.joinedvals.indexOf(q);if(k>=0){y.count[k]=y.count[k]+1;idxarr=y.origidxs[k];idxarr[idxarr.length]=u;y.origidxs[k]=idxarr}else{var n=y.count.length;y.count[n]=1;y.joinedvals[n]=q;y.name[n]=z;y.price[n]=s;y.option[n]=o;y.extras[n]=b;y.prodids[n]=p;y.changedPrices[n]=f;y.togos[n]=l;y.origidxs[n]=[u]}}return y};
@@ -252,5 +253,25 @@ var W_TABLES=["Tische","Tables","Mesas"];var W_ATABLE=["Tisch","Table","Mesa"];v
+
+
+
+
+
+
+
+ 7 8 9
+ 4 5 6
+ 1 2 3
+ 0 ,
+ Anwenden
+
+
+
+
+
+