From e2ffab3466b599bd1ef4b504ba142297e4678738 Mon Sep 17 00:00:00 2001 From: Geno Date: Thu, 19 Nov 2020 23:10:09 +0100 Subject: [PATCH] OrderSprinter 1.4.1 --- gastsystem/index.php | 6 +-- gastsystem/install.php | 4 +- printserver/OrderSprinterPrintserver.exe | Bin 265728 -> 265728 bytes spider/install/installer.php | 2 +- webapp/OrderSprinterPrintserver.exe | Bin 265728 -> 265728 bytes webapp/bar.html | 2 +- webapp/bill.html | 4 +- webapp/feedback.html | 2 +- webapp/index.html | 6 +-- webapp/install.html | 2 +- webapp/install/installer.php | 55 ++++++++++++++++++++--- webapp/kitchen.html | 2 +- webapp/manager.html | 12 ++--- webapp/paydesk.html | 2 +- webapp/php/admin.php | 41 ++++++++--------- webapp/php/bill.php | 21 ++++----- webapp/php/closing.php | 21 ++++----- webapp/php/commonutils.php | 2 +- webapp/php/debug.php | 6 +-- webapp/php/queuecontent.php | 10 ++--- webapp/php/translations.php | 1 + webapp/php/utilities/basedb.php | 2 +- webapp/php/utilities/decimaldefs.php | 1 + webapp/php/utilities/pdfexport.php | 5 ++- webapp/preferences.html | 14 +++--- webapp/products.html | 2 +- webapp/rating.html | 2 +- webapp/reports.html | 2 +- webapp/reservation.html | 2 +- webapp/supplydesk.html | 2 +- webapp/waiter.html | 4 +- 31 files changed, 144 insertions(+), 93 deletions(-) diff --git a/gastsystem/index.php b/gastsystem/index.php index 32c369e..2fc70d6 100644 --- a/gastsystem/index.php +++ b/gastsystem/index.php @@ -9,8 +9,8 @@ - - + + @@ -98,7 +98,7 @@
  OrderSprinter
-
1.4.0  
+
1.4.1  
diff --git a/gastsystem/install.php b/gastsystem/install.php index 5269116..0122c7a 100644 --- a/gastsystem/install.php +++ b/gastsystem/install.php @@ -90,10 +90,10 @@ if (isset($_POST['code'])) { } else { echo ""; echo "Installation Gastsystem"; - echo ''; + echo ''; echo ""; echo "
"; - echo "Installation OrderSprinter-Gastsystem 1.4.0

"; + echo "Installation OrderSprinter-Gastsystem 1.4.1

"; echo "
"; echo "
"; echo "
"; diff --git a/printserver/OrderSprinterPrintserver.exe b/printserver/OrderSprinterPrintserver.exe index c528a5ebf883a1252a18abd71785acf5aee01cda..3d985ef527faec7d117a80535a2b49ab9b997c05 100644 GIT binary patch delta 154 zcmZpeBhWBMU_uA;pR1c1yIZ>%Tf3RIb~A78W@OxM-^094N5#O=!pPag+(OsF#KltA z#L3ZF*TUS~Mc2T^*vZMn*wxg@)nL2ePUdK1M#Js7Z&Z_MlXfzsw|Ea6O?j0`Lcj0_A6jN7Mku*5O~#lLd0EC5mwQzBB)^#;CadUPwGcqu-FyAh?lR4U$(O`S-8)j}UfflP{E~@Y6Irjc}>VGPU zrG0zHH|BNxKxuO}mT)Fc1_l-eMg}0*KAnRlmJulam6K&Tke)u5n+0UbMQ#>-CIBDT BE^z<= diff --git a/spider/install/installer.php b/spider/install/installer.php index 6a4dca8..4180302 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.4.0"); + Database::setVersion($pdo,$prefix,"1.4.1"); 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 c528a5ebf883a1252a18abd71785acf5aee01cda..3d985ef527faec7d117a80535a2b49ab9b997c05 100644 GIT binary patch delta 154 zcmZpeBhWBMU_uA;pR1c1yIZ>%Tf3RIb~A78W@OxM-^094N5#O=!pPag+(OsF#KltA z#L3ZF*TUS~Mc2T^*vZMn*wxg@)nL2ePUdK1M#Js7Z&Z_MlXfzsw|Ea6O?j0`Lcj0_A6jN7Mku*5O~#lLd0EC5mwQzBB)^#;CadUPwGcqu-FyAh?lR4U$(O`S-8)j}UfflP{E~@Y6Irjc}>VGPU zrG0zHH|BNxKxuO}mT)Fc1_l-eMg}0*KAnRlmJulam6K&Tke)u5n+0UbMQ#>-CIBDT BE^z<= diff --git a/webapp/bar.html b/webapp/bar.html index cb8a0cb..62386c4 100644 --- a/webapp/bar.html +++ b/webapp/bar.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/bill.html b/webapp/bill.html index d5614fc..9c88ca8 100644 --- a/webapp/bill.html +++ b/webapp/bill.html @@ -5,7 +5,7 @@ - + @@ -334,7 +334,7 @@ function getBillWithId(id) { for (var i=0;i - + diff --git a/webapp/index.html b/webapp/index.html index f2e111b..50bc4e5 100644 --- a/webapp/index.html +++ b/webapp/index.html @@ -9,8 +9,8 @@ - - + + @@ -215,7 +215,7 @@ function handleResultOfInstallCheck(is_installed) { if (is_installed == "Yes") { useInstallation(); } else { - setTimeout(function(){document.location.href = "install.html?v=1.4.0"},500); + setTimeout(function(){document.location.href = "install.html?v=1.4.1"},500); } } diff --git a/webapp/install.html b/webapp/install.html index 26e595a..954be77 100644 --- a/webapp/install.html +++ b/webapp/install.html @@ -727,7 +727,7 @@ $(document).ready(function() {   - +   diff --git a/webapp/install/installer.php b/webapp/install/installer.php index 79b7652..78daf8c 100644 --- a/webapp/install/installer.php +++ b/webapp/install/installer.php @@ -2621,7 +2621,7 @@ $stmt->execute(array(null)); $sql = "OPTIMIZE TABLE %user%"; $stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); -$stmt->execute(array(null)); +$stmt->execute(); } $this->updateVersion($pdo, '1.3.23'); @@ -2760,6 +2760,38 @@ return false; } } +function updateUserTable1400_1401($prefix, $version, $dbname) { +$pdo = $this->pdo; +try { +if ($version != "1.4.0") { +$ret = $this->updateUserTable1326_1400($prefix, $version, $dbname); +if (!$ret) { +echo "Version update v1.3.26 to 1.4.0 not successful."; +return false; +} +} + +DbUtils::overrulePrefix($prefix); + +$sql = "ALTER TABLE %bill% MODIFY netto DECIMAL (17,6) NULL"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(); + +$this->updateNettoValuesOfBill($pdo); + +$sql = "OPTIMIZE TABLE %bill%"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(); + +$this->updateVersion($pdo, '1.4.1'); + +return true; +} catch (PDOException $e) { +echo "Error in v1.4.0 to 1.4.1: $e"; +return false; +} +} + function insertIntRow($pdo,$table,$rowToInsert,$afterRow) { $this->insertTypeRow($pdo, $table, $rowToInsert, $afterRow, 'INT(1) NULL'); } @@ -2840,6 +2872,19 @@ $rect .= "s: zu storn. Arb.bon: ;q:v\n"; return $rect; } +function updateNettoValuesOfBill($pdo) { +$sql = "SELECT %bill%.id as billid,IF(status='s',-1,1)*ROUND(SUM(price/(1 + %queue%.tax/100.0)),6) as netto FROM %queue%,%billproducts%,%bill% WHERE %billproducts%.billid=%bill%.id AND %billproducts%.queueid=%queue%.id AND (status is null OR status=? OR status=?) GROUP by billid"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(array('x','s')); +$result = $stmt->fetchAll(PDO::FETCH_ASSOC); + +$sql = "UPDATE %bill% SET netto=? WHERE id=?"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +foreach($result as $r) { +$stmt->execute(array($r["netto"],$r["billid"])); +} +} + function createTables($decpoint,$billlanguage,$currency,$timezone) { $pdo = $this->pdo; @@ -2922,7 +2967,7 @@ $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VAL $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'billlanguage', $billlanguage)"); $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'currency', '$currency')"); $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'receiptfontsize', '12')"); -$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.4.0')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.4.1')"); $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'paymentconfig', '0')"); $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'remoteaccesscode', null)"); $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'decpoint', '$decpoint')"); @@ -3369,7 +3414,7 @@ $zones[] = $timezone_identifiers[$i]; } echo json_encode($zones); } else if ($command == 'update') { -$installerVersion = "1.4.0"; +$installerVersion = "1.4.1"; $admin = new InstallAdmin(); $pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']); @@ -3400,7 +3445,7 @@ $supportedVersions = array("1.0.22","1.0.23","1.0.24","1.0.25","1.0.26","1.0.27" "1.1.18","1.1.19","1.1.20","1.1.21","1.1.22","1.1.23","1.1.24","1.1.25","1.1.26","1.1.27","1.1.28","1.1.29","1.1.30", "1.2.0","1.2.1","1.2.2", "1.2.3", "1.2.4","1.2.5","1.2.6","1.2.7","1.2.8","1.2.9","1.2.10","1.2.11","1.2.12","1.2.13","1.2.14","1.2.15","1.2.16","1.2.17", "1.2.18","1.2.19","1.2.20","1.2.21","1.2.22","1.3.0","1.3.1","1.3.2","1.3.3","1.3.4","1.3.5","1.3.6","1.3.7","1.3.8","1.3.9","1.3.10","1.3.11","1.3.12", -"1.3.13","1.3.14","1.3.15","1.3.16","1.3.17","1.3.18","1.3.19","1.3.20","1.3.21","1.3.22","1.3.23","1.3.24","1.3.25","1.3.26" +"1.3.13","1.3.14","1.3.15","1.3.16","1.3.17","1.3.18","1.3.19","1.3.20","1.3.21","1.3.22","1.3.23","1.3.24","1.3.25","1.3.26","1.4.0" ); if (!in_array($version, $supportedVersions)) { @@ -3408,7 +3453,7 @@ echo json_encode("Quellversion nicht unterstützt"); return; } -$ret = $admin->updateUserTable1326_1400($_POST['prefix'], $version, $_POST['db']); +$ret = $admin->updateUserTable1400_1401($_POST['prefix'], $version, $_POST['db']); if(session_id() == '') { session_start(); diff --git a/webapp/kitchen.html b/webapp/kitchen.html index 62b5d2f..af96e5b 100644 --- a/webapp/kitchen.html +++ b/webapp/kitchen.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/manager.html b/webapp/manager.html index 09f62cd..cc694f3 100644 --- a/webapp/manager.html +++ b/webapp/manager.html @@ -5,7 +5,7 @@ - + @@ -382,7 +382,7 @@ var MAN_PRINT_INSTANCE = ["Druckerinstanz","Printer instance","Impresora"]; var MAN_RECEIPT_TXT = ["Kasse","Receipts","Recibos"]; var MAN_DRINKS_REC_TXT = ["Getränke","Drinks","Bebidas"]; var MAN_FOOD_REC_TXT = ["Speisen","Food","Comidas"]; -var MAN_PRINSTANCE_HINT = ["Die Zuordnungen wirken nur bei Printserverversionen ab 1.3.14!","The assignments only work with print server versions 1.3.14 and higher!","Esta configuración sólo funciona con printservers de una version 1.3.14 o despues!"]; +var MAN_PRINSTANCE_HINT = ["Die Zuordnungen wirken erst ab Printserverversion 1.3.14 oder höher!","The assignments only work with print server versions 1.3.14 and higher!","Esta configuración sólo funciona con printservers de una version 1.3.14 o despues!"]; var MAN_DASHSLOT1 = ["Dashboard Slot 1","Dashboard Slot 1","Dashboard Slot 1"]; var MAN_DASHSLOT2 = ["Dashboard Slot 2","Dashboard Slot 2","Dashboard Slot 2"]; var MAN_DASHSLOT3 = ["Dashboard Slot 3","Dashboard Slot 3","Dashboard Slot 3"]; @@ -1227,7 +1227,7 @@ function initRestoreFileUpload() { } else { alert("Import war erfolgreich."); setTimeout(function(){ - document.location.href = "index.html?v=1.4.0"; + document.location.href = "index.html?v=1.4.1"; },250); } }, @@ -1764,9 +1764,9 @@ function handleUpdateCheckResult(answer) { var millis=getMillis(); setTimeout(function(){ - document.location.href = "install.html?v=1.4.0&mode=onlyupdate&n=" + millis; + document.location.href = "install.html?v=1.4.1&mode=onlyupdate&n=" + millis; },250); - document.location.href = "install.html?v=1.4.0&mode=onlyupdate&n=" + millis; + document.location.href = "install.html?v=1.4.1&mode=onlyupdate&n=" + millis; } function handleUpdateReplace(answer) { @@ -3920,4 +3920,4 @@ $(document).on("pageinit", "#admin-page", function () { - \ No newline at end of file + diff --git a/webapp/paydesk.html b/webapp/paydesk.html index 7dd70ca..370445c 100644 --- a/webapp/paydesk.html +++ b/webapp/paydesk.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/php/admin.php b/webapp/php/admin.php index 1f97ce8..687a174 100644 --- a/webapp/php/admin.php +++ b/webapp/php/admin.php @@ -1245,7 +1245,7 @@ class Admin { $view = "preferences.html"; } - echo json_encode($view . "?v=1.4.0"); + echo json_encode($view . "?v=1.4.1"); } } @@ -1452,27 +1452,27 @@ 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.4.0"); }; + if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.4.1"); }; } else { - if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.4.0"); }; + if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.4.1"); }; } - if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.4.0"); }; - if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.4.0"); }; - if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.4.0"); }; + if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.4.1"); }; + if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.4.1"); }; + if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.4.1"); }; if ($_SESSION['modus'] == 0) { - if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.4.0"); }; + if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.4.1"); }; } - if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.4.0"); }; - if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.4.0"); }; - if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.4.0"); }; - if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.4.0"); }; - if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.4.0"); }; - if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.4.0"); }; - if ($_SESSION['right_dash']) { $mainMenu[] = array("name" => $dashtxt[$lang], "link" => "dash.php?v=1.4.0"); }; - if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.4.0"); }; - $mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.4.0"); - $mainMenu[] = array("name" => "Hilfe", "link" => "help.php?v=1.4.0"); - $mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.4.0"); + if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.4.1"); }; + if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.4.1"); }; + if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.4.1"); }; + if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.4.1"); }; + if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.4.1"); }; + if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.4.1"); }; + if ($_SESSION['right_dash']) { $mainMenu[] = array("name" => $dashtxt[$lang], "link" => "dash.php?v=1.4.1"); }; + if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.4.1"); }; + $mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.4.1"); + $mainMenu[] = array("name" => "Hilfe", "link" => "help.php?v=1.4.1"); + $mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.4.1"); } $mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php"); @@ -1480,7 +1480,7 @@ class Admin { $waiterMessage = $this->getMessage(null, "waitermessage"); } - $mainMenuAndVersion = array ("version" => "OrderSprinter 1.4.0", + $mainMenuAndVersion = array ("version" => "OrderSprinter 1.4.1", "user" => $currentUser, "menu" => $mainMenu, "waitermessage" => $waiterMessage, @@ -2119,8 +2119,9 @@ class Admin { $roleid = $_POST['roleid']; $is_admin_role = self::isRoleAdmin($pdo, $roleid); + $isRoleOfUserAdmin = self::isRoleOfUserAdmin($pdo, $theUserId); - if (!$this->isCurrentUserAdmin() && $is_admin_role) { + if (!$this->isCurrentUserAdmin() && ($is_admin_role || $isRoleOfUserAdmin)) { echo json_encode("noadmin"); } else { $sql = "UPDATE %user% SET roleid=? WHERE id=?"; diff --git a/webapp/php/bill.php b/webapp/php/bill.php index 7efd3f4..17596dd 100644 --- a/webapp/php/bill.php +++ b/webapp/php/bill.php @@ -207,15 +207,15 @@ class Bill { $tableid = $row->tableid; if ($qrow->countid == 0) { if ($tableid == 0) { - $sql = "SELECT DISTINCT billdate,brutto,netto,'-' as tablename,username,host,IFNULL(%bill%.status,'') as status,guestinfo,paymentid FROM %bill%,%user% WHERE %bill%.id=? AND userid=%user%.id AND tableid='0' "; + $sql = "SELECT DISTINCT billdate,brutto,ROUND(netto,2) as netto,'-' as tablename,username,host,IFNULL(%bill%.status,'') as status,guestinfo,paymentid FROM %bill%,%user% WHERE %bill%.id=? AND userid=%user%.id AND tableid='0' "; } else { - $sql = "SELECT DISTINCT billdate,brutto,netto,tableno as tablename,username,host,IFNULL(%bill%.status,'') as status,guestinfo,paymentid FROM %bill%,%user%,%resttables% WHERE %bill%.id=? AND userid=%user%.id AND tableid=%resttables%.id "; + $sql = "SELECT DISTINCT billdate,brutto,ROUND(netto,2) as netto,tableno as tablename,username,host,IFNULL(%bill%.status,'') as status,guestinfo,paymentid FROM %bill%,%user%,%resttables% WHERE %bill%.id=? AND userid=%user%.id AND tableid=%resttables%.id "; } } else { if ($tableid == 0) { - $sql = "SELECT DISTINCT billdate,brutto,netto,'-' as tablename,username,host,IFNULL(%bill%.status,'') as status,guestinfo,paymentid FROM %bill%,%user%,%queue% WHERE %bill%.id=? AND %bill%.id=%queue%.billid AND userid=%user%.id AND tableid='0' AND paidtime is not null "; + $sql = "SELECT DISTINCT billdate,brutto,ROUND(netto,2) as netto,'-' as tablename,username,host,IFNULL(%bill%.status,'') as status,guestinfo,paymentid FROM %bill%,%user%,%queue% WHERE %bill%.id=? AND %bill%.id=%queue%.billid AND userid=%user%.id AND tableid='0' AND paidtime is not null "; } else { - $sql = "SELECT DISTINCT billdate,brutto,netto,tableno as tablename,username,host,IFNULL(%bill%.status,'') as status,guestinfo,paymentid FROM %bill%,%user%,%resttables%,%queue% WHERE %bill%.id=? AND %bill%.id=%queue%.billid AND userid=%user%.id AND tableid=%resttables%.id AND paidtime is not null "; + $sql = "SELECT DISTINCT billdate,brutto,ROUND(netto,2) as netto,tableno as tablename,username,host,IFNULL(%bill%.status,'') as status,guestinfo,paymentid FROM %bill%,%user%,%resttables%,%queue% WHERE %bill%.id=? AND %bill%.id=%queue%.billid AND userid=%user%.id AND tableid=%resttables%.id AND paidtime is not null "; } } $stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); @@ -566,7 +566,7 @@ class Bill { if (!is_null($maxbillid)) { $nextbillid = intval($maxbillid) + 1; - $sql = "SELECT brutto,netto,prevbrutto,prevnetto FROM %bill% WHERE id=?"; + $sql = "SELECT brutto,ROUND(netto,2) as netto,prevbrutto,prevnetto FROM %bill% WHERE id=?"; $row = CommonUtils::getRowSqlObject($pdo, $sql, array(intval($maxbillid))); $newprevbrutto = $row->prevbrutto ; $newprevnetto = $row->prevnetto; @@ -979,6 +979,7 @@ class Bill { $this->t['Date'][$l], $this->t['Brutto'][$l] ."($currency)", $this->t['Netto'][$l] . "($currency)", + $this->t['Tablename'][$l], $this->t['State'][$l], $this->t['Ref'][$l], $this->t['host'][$l], @@ -1005,7 +1006,7 @@ class Bill { $payment_col = $payment_lang[$l]; $pdo = DbUtils::openDbAndReturnPdoStatic(); - $sql = "SELECT DISTINCT %bill%.id,%bill%.signature,billdate,brutto,netto,IF(tax is not null, tax, '0.00') as tax,status,closingdate,remark,%bill%.host,%bill%.closingid,%payment%.$payment_col as payway,userid,ref,username,IF(%bill%.reason is not null,reason,'') as reason FROM %bill%,%closing%,%payment%,%user% "; + $sql = "SELECT DISTINCT %bill%.id,IF(tableid > '0',(SELECT tableno FROM %resttables% WHERE id=tableid),'') as tablename,%bill%.signature,billdate,brutto,ROUND(netto,2) as netto,IF(tax is not null, tax, '0.00') as tax,status,closingdate,remark,%bill%.host,%bill%.closingid,%payment%.$payment_col as payway,userid,ref,username,IF(%bill%.reason is not null,reason,'') as reason FROM %bill%,%closing%,%payment%,%user% "; $sql .= "WHERE closingid is not null AND %bill%.closingid=%closing%.id "; $sql .= " AND %bill%.paymentid=%payment%.id "; if ($onlyClosingId == null) { @@ -1027,6 +1028,7 @@ class Bill { $dbresult = $stmt->fetchAll(); foreach($dbresult as $zeile) { $billid = $zeile['id']; + $tablename = $zeile['tablename']; $billdate = $zeile['billdate']; $brutto_orig = $zeile['brutto']; @@ -1068,9 +1070,9 @@ class Bill { } if ($onlyClosingId == null) { - $line = array($billid , $billdate, $brutto, $netto, $status, $ref, $host, $reason, $userid,$username , $closingid, $closingdate, $paymentname, $remark); + $line = array($billid , $billdate, $brutto, $netto, $tablename, $status, $ref, $host, $reason, $userid,$username , $closingid, $closingdate, $paymentname, $remark); } else { - $line = array($billid , $billdate, $brutto, $netto, $status, $ref, $host, $reason, $userid,$username , $paymentname); + $line = array($billid , $billdate, $brutto, $netto, $tablename, $status, $ref, $host, $reason, $userid,$username , $paymentname); } $allcells[] = $line; } @@ -1121,5 +1123,4 @@ class Bill { $objPHPExcel->disconnectWorksheets(); unset($objPHPExcel); } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/webapp/php/closing.php b/webapp/php/closing.php index 71266dd..a509434 100644 --- a/webapp/php/closing.php +++ b/webapp/php/closing.php @@ -532,7 +532,7 @@ $count = count($result); if ($count == 0) { return ""; } else { -$msg = "Umsätze aufgeschlüsselt nach Benutzer und Steuersatz:\n\n"; +$msg = "Umsätze aufgeschlüsselt nach Benutzer und Steuersatz (ohne Ein-/Auslagen):\n\n"; $msg .= "Benutzer;Steuersatz;Umsatz (Brutto)\n"; foreach($result as $res) { // sumprice | thetax | username @@ -542,8 +542,8 @@ $msg .= $res['username'] . ";$tax;$sumprice\n"; } return $msg . "\n"; } - } + private function retrieveClosingFromDb($pdo,$closingid,$doCsvExport,$onlyresultreturn) { if(session_id() == '') { session_start(); @@ -566,7 +566,7 @@ header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Pragma: no-cache"); header("Expires: 0"); -$csv .= $this->t['ID'][$l] . ";" . $this->t['Date'][$l] . ";" . $this->t['Prod'][$l] . ";" . $this->t['Brutto'][$l] . "($currency);"; +$csv .= $this->t['ID'][$l] . ";" . $this->t['Date'][$l] . ";" . $this->t['Tablename'][$l] . ";" . $this->t['Prod'][$l] . ";" . $this->t['Brutto'][$l] . "($currency);"; $csv .= $this->t['Netto'][$l] . "($currency);"; $csv .= $this->t['Tax'][$l] . ";"; $csv .= $this->t['PayWay'][$l] . ";"; @@ -587,7 +587,7 @@ $billsum = $row->billsum; $billcount = $row->billcount; $signature = $row->signature; -$sql = "SELECT %bill%.id as id,paymentid,billdate,userid,ref,username,status,brutto,netto,IF(tax is not null, tax, '0.00') as tax FROM %bill%,%user% WHERE closingid=? AND %bill%.userid = %user%.id ORDER BY billdate"; +$sql = "SELECT %bill%.id as id,IF(tableid > '0',(SELECT tableno FROM %resttables% WHERE id=tableid),'') as tablename,paymentid,billdate,userid,ref,username,status,brutto,netto,IF(tax is not null, tax, '0.00') as tax FROM %bill%,%user% WHERE closingid=? AND %bill%.userid = %user%.id ORDER BY billdate"; $stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt->execute(array($closingid)); $billIdsAndPaymentsForThatClosing = $stmt->fetchAll(); @@ -620,6 +620,7 @@ $this->returnErrorInconsDB($doCsvExport, $onlyresultreturn); return; } +$tablename = $billIdsAndPaymentsForThatClosing[$index]['tablename']; $billdate = $billIdsAndPaymentsForThatClosing[$index]['billdate']; $paymentid = $billIdsAndPaymentsForThatClosing[$index]['paymentid']; $userid = $billIdsAndPaymentsForThatClosing[$index]['userid']; @@ -638,6 +639,7 @@ $netto = number_format($netto, 2, $decpoint, ''); $tax = number_format($tax, 2, $decpoint, ''); $retValues[] = array ( "billid" => $aBillId, +"tablename" => '', "paidtime" => $billdate, "productname" => $this->t['cashaction'][$l], // Kassenaktion "price" => $brutto, @@ -649,7 +651,7 @@ $retValues[] = array ( "status" => $statusTxt, "ref" => $ref); if ($doCsvExport || $onlyresultreturn) { -$csv .= "$aBillId; \"$billdate\" ; \"" . $this->t['cashaction'][$l] . "\" ; \"$brutto\" ; \"$netto\" ; \"$tax\" ; \"$paymentArray[$paymentid]\";$userid; \"$username\"; \"$statusTxt\"; $ref\n"; +$csv .= "$aBillId; \"$billdate\" ; \"$tablename\" ; \"" . $this->t['cashaction'][$l] . "\" ; \"$brutto\" ; \"$netto\" ; \"$tax\" ; \"$paymentArray[$paymentid]\";$userid; \"$username\"; \"$statusTxt\"; $ref\n"; } } else { @@ -680,6 +682,7 @@ $price = number_format($price, 2, $decpoint, ''); $formattedtax = number_format($tax, 2, $decpoint, ''); $retValues[] = array ( "billid" => $aBillId, +"tablename" => $tablename, "paidtime" => $paidtime, "productname" => $productname, "price" => $price, @@ -692,7 +695,7 @@ $retValues[] = array ( "ref" => $ref); $productname = str_replace('"','""',$productname); if ($doCsvExport || $onlyresultreturn) { -$csv .= "$aBillId; \"$paidtime\" ; \"$productname\" ; \"$price\" ; \"$netto\" ; \"$formattedtax\" ; \"$paymentArray[$paymentid]\"; $userid; \"$username\"; \"$statusTxt\"; $ref\n"; +$csv .= "$aBillId; \"$paidtime\" ; \"$tablename\" ; \"$productname\" ; \"$price\" ; \"$netto\" ; \"$formattedtax\" ; \"$paymentArray[$paymentid]\"; $userid; \"$username\"; \"$statusTxt\"; $ref\n"; } } } @@ -758,7 +761,7 @@ return null; } } -$sql = "select sum(%bill%.brutto) as sum,sum(%bill%.netto) as netto,%payment%.name,%bill%.status from %bill%,%payment% where "; +$sql = "select sum(%bill%.brutto) as sum,round(sum(%bill%.netto),2) as netto,%payment%.name,%bill%.status from %bill%,%payment% where "; $sql .= "%bill%.closingid=? and "; $sql .= "%bill%.paymentid=%payment%.id "; $sql .= "group by %bill%.tax,%payment%.name,%bill%.status"; @@ -826,6 +829,4 @@ echo json_encode(array("status" => "OK", "msg" => $retVal)); return $retVal; } } -} - -?> +} \ No newline at end of file diff --git a/webapp/php/commonutils.php b/webapp/php/commonutils.php index 3091413..17e3647 100644 --- a/webapp/php/commonutils.php +++ b/webapp/php/commonutils.php @@ -102,7 +102,7 @@ class CommonUtils { $pdo = $this->dbutils->openDbAndReturnPdo(); } - $sql = "SELECT billdate,brutto,netto,userid,IF(tax is not null, tax, '0.00') as tax,signature,status FROM %bill% WHERE id=?"; + $sql = "SELECT billdate,brutto,ROUND(netto,2) as netto,userid,IF(tax is not null, tax, '0.00') as tax,signature,status FROM %bill% WHERE id=?"; $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt->execute(array($id)); $row = $stmt->fetchObject(); diff --git a/webapp/php/debug.php b/webapp/php/debug.php index c34bce9..d768109 100644 --- a/webapp/php/debug.php +++ b/webapp/php/debug.php @@ -15,8 +15,8 @@ if (isset($_POST["cmd"])) { if (strlen($cmd) > 150) { $cmd = substr($cmd, 0,149); } - if (strlen($xhr) > 700) { - $xhr = substr($xhr, 0,699); + if (strlen($xhr) > 900) { + $xhr = substr($xhr, 0,899); } if (strlen($fct) > 100) { $fct = substr($fct, 0,99); @@ -27,7 +27,7 @@ if (isset($_POST["cmd"])) { if (strlen($status) > 150) { $status = substr($status, 0,149); } - $version = "1.4.0"; + $version = "1.4.1"; $arr = array("cmd" => $cmd,"fct" => $fct, "xhr" => $xhr,"errormsg" => $errormsg,"status" => $status,"version" => $version,"phpversion" => $phpversion); } else { diff --git a/webapp/php/queuecontent.php b/webapp/php/queuecontent.php index c7730ec..47a54d6 100644 --- a/webapp/php/queuecontent.php +++ b/webapp/php/queuecontent.php @@ -1730,7 +1730,7 @@ class QueueContent { * Create bill * Return a bill id */ - function declarePaidCreateBillReturnBillId($pdo,$ids,$tableid,$paymentId,$declareready,$host,$calledInternally = false,$reservationid,$guestinfo,$intguestid) { + function declarePaidCreateBillReturnBillId($pdo,$ids,$tableid,$paymentId,$declareready,$host,$calledInternally = false,$reservationid='',$guestinfo='',$intguestid='') { if ($intguestid == '') { $intguestid = null; @@ -1792,7 +1792,7 @@ class QueueContent { $row =$stmt->fetchObject(); if ($row != null) { $billid = intval($row->id)+1; - $sql = "SELECT brutto,netto,prevbrutto,prevnetto FROM %bill% WHERE id=?"; + $sql = "SELECT brutto,ROUND(netto,2) as netto,prevbrutto,prevnetto FROM %bill% WHERE id=?"; $row = CommonUtils::getRowSqlObject($pdo, $sql, array($row->id)); $newprevbrutto = $row->prevbrutto + $row->brutto; $newprevnetto = $row->prevnetto + $row->netto; @@ -1822,7 +1822,7 @@ class QueueContent { } $idlist = join("','",$ids_array); - $sql = "SELECT SUM(price) as brutto,ROUND(SUM(price/(1 + %queue%.tax/100.0)),2) as netto FROM %queue% WHERE id IN ('$idlist')"; + $sql = "SELECT SUM(price) as brutto,ROUND(SUM(price/(1 + %queue%.tax/100.0)),6) as netto FROM %queue% WHERE id IN ('$idlist')"; $row = CommonUtils::getRowSqlObject($pdo, $sql, null); $brutto = $row->brutto; $netto = $row->netto; @@ -1877,6 +1877,4 @@ class QueueContent { } return $_SESSION['userid']; } -} - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/webapp/php/translations.php b/webapp/php/translations.php index c51186d..a30fa16 100644 --- a/webapp/php/translations.php +++ b/webapp/php/translations.php @@ -1,6 +1,7 @@ t = array( "ID" => array("Bonid","ID","Nú"), + "Tablename" => array("Tisch","Table","Mesa"), "Date" => array("Zahlungsdatum","Pay date","Fecha de pago"), "Prod" => array("Produkt","Product","Producto"), "Brutto" => array("Bruttopreis","Gross","Bruto"), diff --git a/webapp/php/utilities/basedb.php b/webapp/php/utilities/basedb.php index ab07937..98d35a2 100644 --- a/webapp/php/utilities/basedb.php +++ b/webapp/php/utilities/basedb.php @@ -478,7 +478,7 @@ class Basedb { `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , `billdate` DATETIME NOT NULL , `brutto` " . DECIMALMIDDLE . " NULL, - `netto` " . DECIMALMIDDLE . " NULL, + `netto` " . DECIMALMIDDLEEXACT . " NULL, `prevbrutto` " . DECIMALBIG . " NULL, `prevnetto` " . DECIMALBIG . " NULL, `tableid` VARCHAR ( 150 ) NOT NULL, diff --git a/webapp/php/utilities/decimaldefs.php b/webapp/php/utilities/decimaldefs.php index d015269..9a1b156 100644 --- a/webapp/php/utilities/decimaldefs.php +++ b/webapp/php/utilities/decimaldefs.php @@ -2,4 +2,5 @@ defined('DECIMALSMALL') || define ( 'DECIMALSMALL','DECIMAL (15,2)' ); defined('DECIMALMIDDLE') || define ( 'DECIMALMIDDLE','DECIMAL (17,2)' ); +defined('DECIMALMIDDLEEXACT') || define ( 'DECIMALMIDDLEEXACT','DECIMAL (17,6)' ); defined('DECIMALBIG') || define ( 'DECIMALBIG','DECIMAL (19,2)' ); diff --git a/webapp/php/utilities/pdfexport.php b/webapp/php/utilities/pdfexport.php index e1b7fa8..11b2995 100644 --- a/webapp/php/utilities/pdfexport.php +++ b/webapp/php/utilities/pdfexport.php @@ -254,11 +254,14 @@ class PdfExport extends FPDF { for ($i=1;$idecpoint,".",$line[2]); $nettosum += str_replace($this->decpoint,".",$line[3]); for ($j=0;$jdecpoint,''); + } $this->Cell($this->flengths[$j],6,$aVal,"LR",0,"R",$fill); } $this->Ln(); diff --git a/webapp/preferences.html b/webapp/preferences.html index 758d07e..94917ee 100644 --- a/webapp/preferences.html +++ b/webapp/preferences.html @@ -5,7 +5,7 @@ - + @@ -262,7 +262,7 @@ function fillOrderVolume(volume) { function createBtnSizePart(size,label,labeltxt) { var html = '
'; - html += ''; + html += ''; html += ''; html += ''; @@ -290,7 +290,7 @@ function createPreferImgPart(prefervalue,label,labeltxt) { prefervalue = 0; } var html = '
'; - html += ''; + html += ''; html += ''; html += ''; @@ -314,7 +314,7 @@ function createPreferKTLPart(prefervalue,label,labeltxt) { function createPreferMobileThemePart(prefervalue,label,labeltxt) { var html = '
'; - html += ''; + html += ''; html += ''; html += ''; diff --git a/webapp/products.html b/webapp/products.html index 21891ec..f80d62c 100644 --- a/webapp/products.html +++ b/webapp/products.html @@ -7,7 +7,7 @@ - + diff --git a/webapp/rating.html b/webapp/rating.html index 7308f45..bea2112 100644 --- a/webapp/rating.html +++ b/webapp/rating.html @@ -7,7 +7,7 @@ - + diff --git a/webapp/reports.html b/webapp/reports.html index db9e9fa..241242d 100644 --- a/webapp/reports.html +++ b/webapp/reports.html @@ -7,7 +7,7 @@ - + diff --git a/webapp/reservation.html b/webapp/reservation.html index d6bcd89..b279392 100644 --- a/webapp/reservation.html +++ b/webapp/reservation.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/supplydesk.html b/webapp/supplydesk.html index 3da35ef..21f5d9d 100644 --- a/webapp/supplydesk.html +++ b/webapp/supplydesk.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/waiter.html b/webapp/waiter.html index bf71205..499f9e7 100644 --- a/webapp/waiter.html +++ b/webapp/waiter.html @@ -4,8 +4,8 @@ - - + +