diff --git a/bill.html b/bill.html deleted file mode 100644 index 22378fb..0000000 --- a/bill.html +++ /dev/null @@ -1,231 +0,0 @@ - - - Ansicht Kassenbons - - - - - - - - - - - - - - - - - - - - - -
-
- -
-
-

Kassenbons

-
- Module -
-
-
-
-
-
-
-
-
-
-
-
- -
-
-

Storno fehlgeschlagen

-
- -
-

Der Stornovorgang ist fehlgeschlagen. Die wahrscheinlichste Ursache ist ein Tagesabschluss, der den zu - stornierenden Bon einschliet. In diesem Fall darf der Bon rckwirkend nicht mehr annuliert werden.

-
-
- -
- - -
-
-

?

-

?

-
- - - Ja - Nein -
-
-
- - - \ No newline at end of file diff --git a/customer/logo.png b/customer/logo.png deleted file mode 100644 index 8a9260e..0000000 Binary files a/customer/logo.png and /dev/null differ diff --git a/customer/speisekarte.txt b/customer/speisekarte.txt deleted file mode 100755 index bd7edc2..0000000 --- a/customer/speisekarte.txt +++ /dev/null @@ -1,72 +0,0 @@ -# ***** Es wurde noch keine Speisekarte festgelegt **** -# ***** Daher wird hier nun eine Beispielkarte angezeigt, **** -# ***** die als Vorlage dienen soll **** -# -# Einrückungen bauen die Produktpalette hierarchisch auf -# Die tiefsten Einrückungen stellen die Produkte dar, alle -# Ebenen darüber die Kategorien -# -# Ein Produkteintrag hat folgendes Format: -# Kurzname ; NormalPreis (Stufe A); Langname # Preis (Stufe B); Preis (Stufe C) -# dabei ist der Kurzname nur in der Kellneransicht zu sehen -# Nur Kurzname und Preis (A) sind erforderlich, die anderen Teile werden bei -# Auslassung automatisch gefüllt (Preis B=C=A und Langname = Kurzname) -# -# Bei Kategorien: -# Wird ein K und B mitgegeben, so werden diese Produkte über die Küchen- -# und Bereitstellungsansicht geführt. Die Einstellung wird auf die Unterkategorien -# vererbt, wenn die darunter liegenden Kategorien keine Angabe dazu machen. -# -# Wenn ein D da steht, wird als Typ "Getränk" angenommen, bei einem F "Speise". -# Auch hier wird der übergeordnete Eintrag genommen, wenn Angabe fehlt. -# -# -# Reservierte Buchstaben: = ; # -# (Diese werden als Trenner verwendet!) -# -Speisen = KBF - Vom Grill - El Greco 2P; 26.90; EL Greco 2 Personen # 20.90; 13.80 - El Greco 1P; 14.80; EL Greco 1 Person - Fleisch-Gerichte - Lammkotelett; 13.50; Lammkotelett # 11.30; 6.00 - Zigeuner/Jägerschnitzel; 10.50 # 9.80; 3.50 - Suzukakia 4H; 10.50; Suzukakia 4 Hacksteaks - Suzukakia 2H; 10.50; Suzukakia 2 Hacksteaks - Souvlaki; 10.50 - Italienische Küche - Pizza - Siciliana - klein; 7.50; Pizza Siciliana klein - groß; 7.50; Pizza Siciliana groß - Salami - klein; 6,20; Pizza Salami klein - groß; 7.80; Pizza Salami groß - Special; 6.90; Ital. Tagesspecial -Getränke = KBD - Biere - Holsten; 1.60 # 1.00; 0.80 - Warsteiner; 1.80 # 1.20 - Becks Gold; 1.80 - Alsterwasser; 1.50 - Softdrinks - Coca-Cola; 2.50 - Fanta; 2.50 - Ohne Zucker = B - Cola Zero; 2.21 - Sprite; 2.50 - Eistee; 1.60 - Wasser - Apollinaris; 2.20 - still; 1.20; Stilles Wasser - Kategorie Selbstbedienung = - Frühstücksbuffet; 8.90 - Frühstücksbuffet + Kaffe; 12.20 - Kategorie vorbereitet = B - Deserts; 2.20 - Fertigprodukte; 1.20 - Kategorie Nur Küche = K - Tischzubereitung Fisch; 2.20 - Tischzubereitung Fleischmenü; 1.20 - Weine - Lambrusco; 7.00; Wein Lambrusco \ No newline at end of file diff --git a/feedback.html b/feedback.html deleted file mode 100644 index aca727f..0000000 --- a/feedback.html +++ /dev/null @@ -1,190 +0,0 @@ - - - Ansicht Feedback - - - - - - - - - - - - - - - - - - - - - -
-
- -
-
-

Feedback

-
- Module -
-
-
-

Diese Seite dient zur bermittlung von Feedback an den Entwickler. Die Email wird das Mailkonto - des Betreibers versendet.

-
-
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -

Bitte Telefonnummer angeben, wenn eine Antwort per Telefon gewnscht wird. -
Eine Antwort des Entwicklers - kann nicht garantiert werden! Informationen ber den verwendeten Internetbrowser wird an den Entwickler gesendet, damit mgliche Fragen - oder Probleme leichter identifiziert werden knnen.

- - -
-
-
-
-
-
-
-
- - - \ No newline at end of file diff --git a/img/banner.png b/img/banner.png deleted file mode 100644 index 236eadc..0000000 Binary files a/img/banner.png and /dev/null differ diff --git a/img/cook.png b/img/cook.png deleted file mode 100644 index 03c8d55..0000000 Binary files a/img/cook.png and /dev/null differ diff --git a/img/cook_l.png b/img/cook_l.png deleted file mode 100644 index a3ef012..0000000 Binary files a/img/cook_l.png and /dev/null differ diff --git a/install.html b/install.html deleted file mode 100644 index 63dce7d..0000000 --- a/install.html +++ /dev/null @@ -1,238 +0,0 @@ - - - - -Setup - - - - - - - - - -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KategorieEinstellungWert
Datenbank - Datenbank-Server:
Datenbank-Name:
Datenbank-Benutzer:
Datenbank-Passwort:
Präfix für die Tabellen:
- -
Schreibberechtigungen - php-Verzeichnis -   -
config.php -   -
- -
Applikation - Administrator-Passwort:
Administrator-Passwort (Wdh.):
  - -
 
-
-
-
- - - - \ No newline at end of file diff --git a/install/installer.php b/install/installer.php deleted file mode 100644 index fad9f3a..0000000 --- a/install/installer.php +++ /dev/null @@ -1,624 +0,0 @@ - $this->checkwriteaccessconfigfolder(), - "configfile" => $this->checkwriteaccessconfigfile(), - "customerfolder" => $this->checkwritecustomerfolder(), - "speisekarte" => $this->checkwritespeisekarte() - ); - echo json_encode($retArray); - } -} - -class ConfigWriter { - function getConfigVals() { - if (is_readable("../php/config.php")) { - include( "../php/config.php" ); - $retArray = array( - "host" => MYSQL_HOST, - "db" => MYSQL_DB, - "user" => MYSQL_USER, - "password" => MYSQL_PASSWORD, - "tabprefix" => TAB_PREFIX); - echo json_encode(array("status" => "OK","result" => $retArray)); - } else { - echo json_encode(array("status" => "Failed")); - } - } -} - - -class Admin { - var $prefix = ""; - var $pdo; - - function setPrefix($pre) { - $this->prefix = $pre; - } - - function setPdo($pdo) { - $this->pdo = $pdo; - } - - function openDbAndReturnPdo ($host,$db,$user,$password) { - $dsn = 'mysql:host=' . $host . ';dbname=' . $db; - $pdo = null; - try { - $pdo = new PDO($dsn, $user, $password); - $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - } - catch (PDOException $e) { - echo 'Verbindungsproblem: ' . $e->getMessage(); - $pdo = null; - } - return $pdo; - } - - function createTables() - { - $pdo = $this->pdo; - - $this->doSQLcatch($pdo, "DROP TABLE `%hist%`"); - $this->doSQLcatch($pdo, "DROP TABLE `%histprod%`"); - $this->doSQLcatch($pdo, "DROP TABLE `%histconfig%`"); - $this->doSQLcatch($pdo, "DROP TABLE `%histuser%`"); - $this->doSQLcatch($pdo, "DROP TABLE `%histactions%`"); - - $this->doSQLcatch($pdo, "drop TABLE `%billproducts%`"); - $this->doSQLcatch($pdo, "drop TABLE `%queue%`"); - $this->doSQLcatch($pdo, "drop TABLE `%printjobs%`"); - $this->doSQLcatch($pdo, "drop TABLE `%bill%`"); - $this->doSQLcatch($pdo, "drop TABLE `%user%`"); - $this->doSQLcatch($pdo, "drop TABLE `%closing%`"); - $this->doSQLcatch($pdo, "drop TABLE `%config%`"); - $this->doSQLcatch($pdo, "drop TABLE `%products%`"); - $this->doSQLcatch($pdo, "drop TABLE `%prodtype%`"); - $this->doSQLcatch($pdo, "drop TABLE `%pricelevel%`"); - $this->doSQLcatch($pdo, "drop TABLE `%resttables%`"); - $this->doSQLcatch($pdo, "drop TABLE `%room%`"); - $this->doSQLcatch($pdo, "drop TABLE `%payment%`"); - - $this->createPaymentTable($pdo); - $this->createUserTable($pdo); - $this->createRoomTable($pdo); - $this->createRestTables($pdo); - $this->createConfigTable($pdo); - $this->createProdTypeTable($pdo); - $this->createProductTable($pdo); - $this->createPriceLevelTable($pdo); - $this->createClosingTable($pdo); - $this->createBillTable($pdo); - $this->createQueueTable($pdo); - $this->createBillProductsTable($pdo); - $this->createHistTables($pdo); - $this->createPrintJobsTable($pdo); - - $this->doSQL($pdo,"INSERT INTO `%pricelevel%` (`id` , `name`,`info`) VALUES ('1', 'A', 'Normale Preisstufe')"); - $this->doSQL($pdo,"INSERT INTO `%pricelevel%` (`id` , `name`,`info`) VALUES ('2', 'B', 'Wochenendtarif')"); - $this->doSQL($pdo,"INSERT INTO `%pricelevel%` (`id` , `name`,`info`) VALUES ('3', 'C', 'Happy Hour')"); - - $this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'pricelevel', '1')"); - $this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'tax', '19,0')"); - $this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'togotax', '7,0')"); - $this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'stornocode', '123')"); - $this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'printpass', 'printen')"); - $this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'companyinfo', 'Musterrestaurant\nBeispielstrasse 123\n12345 Musterort')"); - $this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'serverurl', '')"); - $this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'email', '')"); - $this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'logourl', 'customer/logo.png')"); - $this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'payprinttype', 'l')"); - $this->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.0')"); - - $this->readConfigTableAndSendToHist($pdo); - - return; - } - - function doSQL($pdo,$sql) { - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - } - - function doSQLcatch($pdo,$sql) { - try { - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - } catch (Exception $e) { - // nothing - table not present or whatever... - } - } - - function readConfigTableAndSendToHist($pdo) { - $sql_query = "SELECT * FROM %config%"; - - $sql_insert_histconfig = "INSERT INTO %histconfig% (id,configid,setting) VALUES ( - NULL,?,?)"; - - $stmt_query = $pdo->prepare($this->resolveTablenamesInSqlString($sql_query)); - $stmt_insert_histconfig = $pdo->prepare($this->resolveTablenamesInSqlString($sql_insert_histconfig)); - - $stmt_query->execute(); - $result = $stmt_query->fetchAll(); - foreach($result as $row){ - $stmt_insert_histconfig->execute(array($row['id'],$row['setting'])); - $newRefIdForHist = $pdo->lastInsertId(); - $this->insertIntoHist($pdo, '2', $newRefIdForHist); - } - } - - private function insertIntoHist($pdo,$action,$refIdForHist) { - date_default_timezone_set('Europe/Berlin'); - $currentTime = date('Y-m-d H:i:s'); - - $sql_insert_hist = "INSERT INTO %hist% (id,date,action,refid) VALUES (NULL,?,?,?)"; - $stmt_insert_hist = $pdo->prepare($this->resolveTablenamesInSqlString($sql_insert_hist)); - $stmt_insert_hist->execute(array($currentTime, $action, $refIdForHist)); - } - - function insertAdminUser($adminpass) { - $md5adminpass = md5($adminpass); - $pdo = $this->pdo; - - $userInsertSql = "INSERT INTO `%user%` (`id` , `username` , `userpassword`, `is_admin`, `right_waiter`,`right_kitchen`,`right_bar`,`right_supply`,`right_paydesk`,`right_statistics`,`right_bill`,`right_products`,`right_manager`,`active`) VALUES (NULL,?,?,?,?,?,?,?,?,?,?,?,?,'1')"; - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($userInsertSql)); - $stmt->execute(array('admin',$md5adminpass,1,0,0,0,0,0,0,0,0,1)); - $newUserIdForHist = $pdo->lastInsertId(); - - // now insert into hist - $sql_insert_histuser = "INSERT INTO %histuser% (`id` , `userid`, `username` , - `is_admin`, `right_waiter`,`right_kitchen`,`right_bar`,`right_supply`,`right_paydesk`, - `right_statistics`,`right_bill`,`right_products`,`right_manager`,`active`) VALUES ( - NULL,?,?,?,?,?,?,?,?,?,?,?,?,?)"; - $stmt_insert_histuser = $pdo->prepare($this->resolveTablenamesInSqlString($sql_insert_histuser)); - $stmt_insert_histuser->execute(array($newUserIdForHist,'admin',1,0,0,0,0,0,0,0,0,1,1)); - $newRefIdForHist = $pdo->lastInsertId(); - $this->insertIntoHist($pdo, '3', $newRefIdForHist); - } - - function createBillProductsTable($pdo) { - $sql = " - CREATE TABLE `%billproducts%` ( - `queueid` INT( 10 ) NOT NULL, - `billid` INT(10) NOT NULL, - FOREIGN KEY (queueid) REFERENCES %queue%(id), - FOREIGN KEY (billid) REFERENCES %bill%(id) - ) ENGINE = InnoDb ; - "; - $this->doSQL($pdo,$sql); - } - - /* - * Create the queue table: - * action: P=Pay, S=Storno - */ - function createQueueTable($pdo) - { - $sql = " - CREATE TABLE `%queue%` ( - `id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , - `tablenr` INT( 3 ) NOT NULL , - `productid` INT( 10 ) NULL , - `pricelevel` INT( 3 ) NOT NULL , - `price` DECIMAL (5,2) NOT NULL, - `productname` VARCHAR( 150 ) NULL, - `ordertime` DATETIME NULL , - `anoption` VARCHAR( 150 ) NULL , - `readytime` DATETIME NOT NULL, - `delivertime` DATETIME NULL, - `payinprogress` INT(3) NOT NULL, - `paidtime` DATETIME NULL, - `billid` INT(10), - `toremove` INT(3) NOT NULL, - `cooking` INT(10) NULL, - `workprinted` INT(2) NOT NULL, - `action` VARCHAR(3) NOT NULL, - FOREIGN KEY (tablenr) REFERENCES %resttables%(id), - FOREIGN KEY (pricelevel) REFERENCES %pricelevel%(id), - FOREIGN KEY (productid) REFERENCES %products%(id), - FOREIGN KEY (billid) REFERENCES %bill%(id), - FOREIGN KEY (cooking) REFERENCES %user%(id) - ) ENGINE = InnoDb ; - "; - $this->doSQL($pdo,$sql); - } - - function createProdTypeTable($pdo) - { - $sql = " - CREATE TABLE `%prodtype%` ( - `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , - `name` VARCHAR ( 150 ) NOT NULL, - `usekitchen` INT(1) NOT NULL, - `usesupplydesk` INT(1) NOT NULL, - `kind` INT(2) NOT NULL, - `sorting` INT(2) NULL, - `reference` INT (10) NULL, - `removed` INT(1) NULL, - FOREIGN KEY (reference) REFERENCES %prodtype%(id) - ) ENGINE = InnoDb ; - "; - $this->doSQL($pdo,$sql); - } - - - function createProductTable($pdo) - { - $sql = " - CREATE TABLE `%products%` ( - `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , - `shortname` VARCHAR ( 150 ) NOT NULL, - `longname` VARCHAR ( 150 ) NOT NULL, - `priceA` DECIMAL (5,2) NULL, - `priceB` DECIMAL (5,2) NULL, - `priceC` DECIMAL (5,2) NULL, - `category` INT(3) NULL, - `sorting` INT(2) NULL, - `available` INT(2) NOT NULL, - `audio` VARCHAR ( 150 ) NULL, - `removed` INT(1) NULL, - FOREIGN KEY (category) REFERENCES %prodtype%(id) - ) ENGINE = InnoDb ; - "; - $this->doSQL($pdo,$sql); - } - - - function createUserTable($pdo) - { - $sql = " - CREATE TABLE `%user%` ( - `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , - `username` VARCHAR ( 150 ) NOT NULL, - `userpassword` VARCHAR ( 150 ) NOT NULL, - `is_admin` INT (2) NOT NULL, - `right_waiter` INT (2) NOT NULL, - `right_kitchen` INT (2) NOT NULL, - `right_bar` INT (2) NOT NULL, - `right_supply` INT (2) NOT NULL, - `right_paydesk` INT (2) NOT NULL, - `right_statistics` INT (2) NOT NULL, - `right_bill` INT (2) NOT NULL, - `right_products` INT (2) NOT NULL, - `right_manager` INT (2) NOT NULL, - `lastmodule` VARCHAR ( 30 ) NULL, - `ordervolume` INT (2) NULL, - `active` INT (2) NOT NULL - ) ENGINE = InnoDb ; - "; - $this->doSQL($pdo,$sql); - } - - function createPaymentTable($pdo) { - $sql = " - CREATE TABLE `%payment%` ( - `id` INT (3) NOT NULL UNIQUE, - `name` VARCHAR ( 20 ) NOT NULL - ) ENGINE = InnoDb - "; - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - - $sql = "INSERT INTO %payment% (id,name) VALUES (?,?)"; - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - - $stmt->execute(array('1', 'Barzahlung')); - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - - $stmt->execute(array('2', 'EC-Kartenzahlung')); - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - $stmt->execute(array('3', 'Kreditkartenzahlung')); - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - $stmt->execute(array('4', 'Rechnung')); - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - $stmt->execute(array('5', 'Ueberweisung')); - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - $stmt->execute(array('6', 'Lastschrift')); - } - - function createHistTables($pdo) { - $sql = " - CREATE TABLE `%hist%` ( - `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , - `date` DATETIME NOT NULL , - `action` INT ( 2 ) NOT NULL, - `refid` INT (10) NOT NULL - ) ENGINE = InnoDb - "; - $this->doSQL($pdo,$sql); - - $sql = " - CREATE TABLE `%histprod%` ( - `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , - `prodid` INT (10) NOT NULL, - `shortname` VARCHAR ( 150 ) NOT NULL, - `longname` VARCHAR ( 150 ) NOT NULL, - `priceA` DECIMAL (5,2) NULL, - `priceB` DECIMAL (5,2) NULL, - `priceC` DECIMAL (5,2) NULL, - `sorting` INT(2) NULL, - `available` INT(2) NOT NULL, - `audio` VARCHAR ( 150 ) NULL, - FOREIGN KEY (prodid) REFERENCES %products%(id) - ) ENGINE = InnoDb - "; - $this->doSQL($pdo,$sql); - - $sql = " - CREATE TABLE `%histconfig%` ( - `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , - `configid` INT (10) , - `setting` VARCHAR ( 10000 ), - FOREIGN KEY (configid) REFERENCES %config%(id) - ) ENGINE = InnoDb - "; - $this->doSQL($pdo,$sql); - - $sql = " - CREATE TABLE `%histuser%` ( - `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , - `userid` INT (10) , - `username` VARCHAR ( 150 ) NOT NULL, - `is_admin` INT (2) NOT NULL, - `right_waiter` INT (2) NOT NULL, - `right_kitchen` INT (2) NOT NULL, - `right_bar` INT (2) NOT NULL, - `right_supply` INT (2) NOT NULL, - `right_paydesk` INT (2) NOT NULL, - `right_statistics` INT (2) NOT NULL, - `right_bill` INT (2) NOT NULL, - `right_products` INT (2) NOT NULL, - `right_manager` INT (2) NOT NULL, - `active` INT (2) NOT NULL, - FOREIGN KEY (userid) REFERENCES %user%(id) - ) ENGINE = InnoDb - "; - $this->doSQL($pdo,$sql); - - $sql = " - CREATE TABLE `%histactions%` ( - `id` INT (3) NOT NULL, - `name` VARCHAR ( 20 ) NOT NULL, - `description` VARCHAR ( 150 ) NULL - ) ENGINE = InnoDb - "; - $this->doSQL($pdo,$sql); - - $this->defineHistActions($pdo); - } - - public function defineHistActions ($pdo) { - $sql = "INSERT INTO %histactions% (id,name,description) VALUES (?,?,?)"; - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - - $stmt->execute(array('1', 'ProdInit', 'Initiales Befuellen der Produkttabelle')); - $stmt->execute(array('2', 'ConfigInit', 'Initiales Befuellen der Konfigurationstabelle')); - $stmt->execute(array('3', 'UserInit', 'Initiales Befuellen der Benutzertabelle')); - $stmt->execute(array('4', 'ProdChange', 'Modifikation der Produktdaten')); - $stmt->execute(array('5', 'ProdCreation', 'Neues Produkt')); - $stmt->execute(array('6', 'ConfigChange', 'Modifikation der Konfiguration')); - $stmt->execute(array('7', 'UserCreation', 'Neuer Benutzer')); - $stmt->execute(array('8', 'UserChange', 'Modifikation eines Benutzers')); - } - - function createRoomTable($pdo) - { - $sql = " - CREATE TABLE `%room%` ( - `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , - `roomname` VARCHAR ( 150 ) NOT NULL, - `removed` INT(2) NULL, - `sorting` INT(2) NULL - ) ENGINE = InnoDb ; - "; - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - } - - function createRestTables($pdo) - { - $sql = " - CREATE TABLE `%resttables%` ( - `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , - `tableno` VARCHAR ( 150 ) NOT NULL, - `roomid` INT ( 10 ) NOT NULL, - `removed` INT(2) NULL, - `sorting` INT(2) NULL, - FOREIGN KEY (roomid) REFERENCES %room%(id) - ) ENGINE = InnoDb ; - "; - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - - $sql = "INSERT INTO `%room%` (`id`, `roomname`) VALUES (NULL,?)"; - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - $stmt->execute(array('Raum 1')); - $roomId = $pdo->lastInsertId(); - - $sql = "INSERT INTO `%resttables%` (`id` , `tableno`, `roomid`) VALUES (NULL ,?,?)"; - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - $stmt->execute(array('Tisch 1',$roomId)); - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - $stmt->execute(array('Tisch 2',$roomId)); - } - - function createBillTable($pdo) - { - $sql = " - CREATE TABLE `%bill%` ( - `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , - `billdate` DATETIME NOT NULL , - `content` VARCHAR ( 50000 ) , - `brutto` DECIMAL (5,2) NULL, - `netto` DECIMAL (5,2) NULL, - `tableid` VARCHAR ( 150 ) NOT NULL, - `closingid` INT(4) NULL, - `status` VARCHAR(2) NULL, - `paymentid` INT(2) NULL, - `userid` INT(3) NULL, - `ref` INT(10) NULL, - `tax` DECIMAL (5,2) NOT NULL, - FOREIGN KEY (closingid) REFERENCES %closing%(id), - FOREIGN KEY (paymentid) REFERENCES %payment%(id), - FOREIGN KEY (userid) REFERENCES %user%(id), - FOREIGN KEY (ref) REFERENCES %bill%(id) - ) ENGINE = InnoDb ; - "; - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - - // insert dummy entry so that select query with closing works - date_default_timezone_set('Europe/Berlin'); - $currentTime = date('Y-m-d H:i:s'); - $billInsertSql = "INSERT INTO `%bill%` (`id` , `billdate`,`content`,`brutto`,`tableid`,`paymentid`,`tax`) VALUES ( '0', '$currentTime' , '', '', '-1', NULL, '0.00')"; - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($billInsertSql)); - $stmt->execute(); - } - - function createPriceLevelTable($pdo) { - $sql = " - CREATE TABLE `%pricelevel%` ( - `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , - `name` VARCHAR ( 10000 ) , - `info` VARCHAR ( 10000 ) - ) ENGINE = InnoDb ; - "; - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - } - - function createConfigTable($pdo) { - $sql = " - CREATE TABLE `%config%` ( - `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , - `name` VARCHAR ( 1000 ) , - `setting` VARCHAR ( 10000 ) - ) ENGINE = InnoDb ; - "; - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - } - - function createClosingTable($pdo) { - $sql = " - CREATE TABLE `%closing%` ( - `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , - `closingdate` DATETIME NOT NULL , - `remark` VARCHAR ( 10000 ) - ) ENGINE = InnoDb ; - "; - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - } - - function createPrintJobsTable($pdo) { - $sql = " - CREATE TABLE `%printjobs%` ( - `id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY , - `content` VARCHAR ( 50000 ) NOT NULL , - `type` INT (2) NOT NULL - ) ENGINE = InnoDb ; - "; - $stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - } - - function resolveTablenamesInSqlString($sqlString) { - $out = str_replace("%queue%",$this->prefix . "queue",$sqlString); - $out = str_replace("%products%",$this->prefix . "products",$out); - $out = str_replace("%user%",$this->prefix . "user",$out); - $out = str_replace("%room%",$this->prefix . "room",$out); - $out = str_replace("%resttables%",$this->prefix . "resttables",$out); - $out = str_replace("%bill%",$this->prefix . "bill",$out); - $out = str_replace("%pricelevel%",$this->prefix . "pricelevel",$out); - $out = str_replace("%config%",$this->prefix . "config",$out); - $out = str_replace("%closing%",$this->prefix . "closing",$out); - $out = str_replace("%printjobs%",$this->prefix . "printjob",$out); - $out = str_replace("%hist%",$this->prefix . "hist",$out); - $out = str_replace("%histprod%",$this->prefix . "histprod",$out); - $out = str_replace("%histconfig%",$this->prefix . "histconfig",$out); - $out = str_replace("%histuser%",$this->prefix . "histuser",$out); - $out = str_replace("%histactions%",$this->prefix . "histactions",$out); - $out = str_replace("%payment%",$this->prefix . "payment",$out); - $out = str_replace("%billproducts%",$this->prefix . "billproducts",$out); - return (str_replace("%prodtype%",$this->prefix . "prodtype",$out)); - } - - function testDbConnection($host,$dbname,$user,$pass) { - $pdo = $this->openDbAndReturnPdo($host,$dbname,$user,$pass); - if (!is_null($pdo)) { - echo json_encode("OK"); - } else { - echo json_encode("ERROR"); - } - } - - function writeConfigFile($host,$db,$user,$password,$prefix) { - $errorlevel = ""; - file_put_contents("../php/config.php", $configText); - } -} -$command = $_GET["command"]; -if ($command == 'checkWriteAccess') { - $checker = new Installer(); - $checker->checkWriteAccess(); -} else if ($command == 'testDbConnection') { - $admin = new Admin(); - try { - if (isset($_POST['host']) && isset($_POST['dbname']) && isset($_POST['user']) && isset($_POST['pass'])) { - $admin->testDbConnection($_POST['host'],$_POST['dbname'],$_POST['user'],$_POST['pass']); - } else { - echo json_encode("ERROR"); - } - } catch (Exception $e) { - echo json_encode("ERROR"); - } -} else if ($command == 'getConfig') { - $configWriter = new ConfigWriter(); - $configWriter->getConfigVals(); -} else if ($command == 'install') { - $admin = new Admin(); - $pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']); - $admin->setPdo($pdo); - $admin->setPrefix($_POST['prefix']); - $admin->createTables(); - $admin->insertAdminUser($_POST['adminpass']); - $admin->writeConfigFile($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password'],$_POST['prefix']); - echo json_encode("OK"); -} -?> \ No newline at end of file diff --git a/javaprinter/config.json b/javaprinter/config.json new file mode 100644 index 0000000..cb8a75b --- /dev/null +++ b/javaprinter/config.json @@ -0,0 +1,22 @@ +{ + "vendorid" : "4348", + "productid" : "5584", + "printersize" : 32, + "printcode" : "123", + "baseurl":"http://localhost", + "baseusername" : "", + "basepass" : "", + "printreceipts" : 1, + "forreceiptprinters" : "1,2,3,4,5,6", + "printclosings" : 1, + "printfoodtickets1" : 1, + "printdrinktickets1" : 1, + "printfoodtickets2" : 1, + "printdrinktickets2" : 1, + "escinits" : [ 27, 64, 27, 116, 0 ], + "escposts" : [ 27,64,29,86,65,10], + "useeveryprintdevice" : 1, + "verbose_closing_summary" : 1, + "smallformat" : 0, + "logoscale" : 1.0 +} \ No newline at end of file diff --git a/javaprinter/javaprinter.jar b/javaprinter/javaprinter.jar new file mode 100644 index 0000000..14d03c5 Binary files /dev/null and b/javaprinter/javaprinter.jar differ diff --git a/javaprinter/javaprinter_lib/LICENSE-apache-commons-codec.txt b/javaprinter/javaprinter_lib/LICENSE-apache-commons-codec.txt new file mode 100644 index 0000000..75b5248 --- /dev/null +++ b/javaprinter/javaprinter_lib/LICENSE-apache-commons-codec.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/javaprinter/javaprinter_lib/LICENSE-jackson-jr.html b/javaprinter/javaprinter_lib/LICENSE-jackson-jr.html new file mode 100644 index 0000000..891050c --- /dev/null +++ b/javaprinter/javaprinter_lib/LICENSE-jackson-jr.html @@ -0,0 +1,1606 @@ + + + + + + + + + + + + + jackson-jr/LICENSE at master · FasterXML/jackson-jr · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Skip to content +
+ + + + + + + + + + + +
+
+
+ +
+
+
+ + + + +

+ + /jackson-jr + + + + + +

+
+
+ +
+
+
+ + + +
+ +
+

HTTPS clone URL

+
+ + + + +
+
+ + +
+

Subversion checkout URL

+
+ + + + +
+
+ + + +
You can clone with +
or
. + + + +
+ + + + + + + Download ZIP + +
+
+ +
+ + + + + + + + + + +
+
+ @cowtowncoder + cowtowncoder + + +
+ + + +
+ +
+
+
+ +
+ Raw + Blame + History +
+ + + + + +
+ +
+ 192 lines (155 sloc) + + 10.273 kB +
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
1. Definitions.
+
"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright
owner that is granting the License.
+
"Legal Entity" shall mean the union of the acting entity and all other entities
that control, are controlled by, or are under common control with that entity.
For the purposes of this definition, "control" means (i) the power, direct or
indirect, to cause the direction or management of such entity, whether by
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
+
"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.
+
"Source" form shall mean the preferred form for making modifications, including
but not limited to software source code, documentation source, and configuration
files.
+
"Object" form shall mean any form resulting from mechanical transformation or
translation of a Source form, including but not limited to compiled object code,
generated documentation, and conversions to other media types.
+
"Work" shall mean the work of authorship, whether in Source or Object form, made
available under the License, as indicated by a copyright notice that is included
in or attached to the work (an example is provided in the Appendix below).
+
"Derivative Works" shall mean any work, whether in Source or Object form, that
is based on (or derived from) the Work and for which the editorial revisions,
annotations, elaborations, or other modifications represent, as a whole, an
original work of authorship. For the purposes of this License, Derivative Works
shall not include works that remain separable from, or merely link (or bind by
name) to the interfaces of, the Work and Derivative Works thereof.
+
"Contribution" shall mean any work of authorship, including the original version
of the Work and any modifications or additions to that Work or Derivative Works
thereof, that is intentionally submitted to Licensor for inclusion in the Work
by the copyright owner or by an individual or Legal Entity authorized to submit
on behalf of the copyright owner. For the purposes of this definition,
"submitted" means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, and
issue tracking systems that are managed by, or on behalf of, the Licensor for
the purpose of discussing and improving the Work, but excluding communication
that is conspicuously marked or otherwise designated in writing by the copyright
owner as "Not a Contribution."
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
of whom a Contribution has been received by Licensor and subsequently
incorporated within the Work.
+
2. Grant of Copyright License.
+
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the Work and such
Derivative Works in Source or Object form.
+
3. Grant of Patent License.
+
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to make, have
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
such license applies only to those patent claims licensable by such Contributor
that are necessarily infringed by their Contribution(s) alone or by combination
of their Contribution(s) with the Work to which such Contribution(s) was
submitted. If You institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or contributory
patent infringement, then any patent licenses granted to You under this License
for that Work shall terminate as of the date such litigation is filed.
+
4. Redistribution.
+
You may reproduce and distribute copies of the Work or Derivative Works thereof
in any medium, with or without modifications, and in Source or Object form,
provided that You meet the following conditions:
+
You must give any other recipients of the Work or Derivative Works a copy of
this License; and
You must cause any modified files to carry prominent notices stating that You
changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute,
all copyright, patent, trademark, and attribution notices from the Source form
of the Work, excluding those notices that do not pertain to any part of the
Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any
Derivative Works that You distribute must include a readable copy of the
attribution notices contained within such NOTICE file, excluding those notices
that do not pertain to any part of the Derivative Works, in at least one of the
following places: within a NOTICE text file distributed as part of the
Derivative Works; within the Source form or documentation, if provided along
with the Derivative Works; or, within a display generated by the Derivative
Works, if and wherever such third-party notices normally appear. The contents of
the NOTICE file are for informational purposes only and do not modify the
License. You may add Your own attribution notices within Derivative Works that
You distribute, alongside or as an addendum to the NOTICE text from the Work,
provided that such additional attribution notices cannot be construed as
modifying the License.
You may add Your own copyright statement to Your modifications and may provide
additional or different license terms and conditions for use, reproduction, or
distribution of Your modifications, or for any such Derivative Works as a whole,
provided Your use, reproduction, and distribution of the Work otherwise complies
with the conditions stated in this License.
+
5. Submission of Contributions.
+
Unless You explicitly state otherwise, any Contribution intentionally submitted
for inclusion in the Work by You to the Licensor shall be under the terms and
conditions of this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify the terms of
any separate license agreement you may have executed with Licensor regarding
such Contributions.
+
6. Trademarks.
+
This License does not grant permission to use the trade names, trademarks,
service marks, or product names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.
+
7. Disclaimer of Warranty.
+
Unless required by applicable law or agreed to in writing, Licensor provides the
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
including, without limitation, any warranties or conditions of TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
solely responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your exercise of
permissions under this License.
+
8. Limitation of Liability.
+
In no event and under no legal theory, whether in tort (including negligence),
contract, or otherwise, unless required by applicable law (such as deliberate
and grossly negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special, incidental,
or consequential damages of any character arising as a result of this License or
out of the use or inability to use the Work (including but not limited to
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
any and all other commercial damages or losses), even if such Contributor has
been advised of the possibility of such damages.
+
9. Accepting Warranty or Additional Liability.
+
While redistributing the Work or Derivative Works thereof, You may choose to
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
other liability obligations and/or rights consistent with this License. However,
in accepting such obligations, You may act only on Your own behalf and on Your
sole responsibility, not on behalf of any other Contributor, and only if You
agree to indemnify, defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason of your
accepting any such warranty or additional liability.
+
END OF TERMS AND CONDITIONS
+
APPENDIX: How to apply the Apache License to your work
+
To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets "[]" replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also
recommend that a file or class name and description of purpose be included on
the same "printed page" as the copyright notice for easier identification within
third-party archives.
+
Copyright [yyyy] [name of copyright owner]
+
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
+
http://www.apache.org/licenses/LICENSE-2.0
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+ +
+ +
+ +Jump to Line + + +
+ +
+ +
+
+ + +
+ +
+ +
+ + +
+
+
+ +
+
+
+
+
+ +
+ + + + + + +
+ + + Something went wrong with that request. Please try again. +
+ + + + + + + + + diff --git a/javaprinter/javaprinter_lib/LICENSE-usb4java.md b/javaprinter/javaprinter_lib/LICENSE-usb4java.md new file mode 100644 index 0000000..f684aa1 --- /dev/null +++ b/javaprinter/javaprinter_lib/LICENSE-usb4java.md @@ -0,0 +1,167 @@ +GNU LESSER GENERAL PUBLIC LICENSE +================================= + +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +This version of the GNU Lesser General Public License incorporates the terms +and conditions of version 3 of the GNU General Public License, supplemented +by the additional permissions listed below. + + +### 0. Additional Definitions. + +As used herein, "this License" refers to version 3 of the GNU Lesser General +Public License, and the "GNU GPL" refers to version 3 of the GNU General +Public License. + +"The Library" refers to a covered work governed by this License, other than +an Application or a Combined Work as defined below. + +An "Application" is any work that makes use of an interface provided by the +Library, but which is not otherwise based on the Library. Defining a +subclass of a class defined by the Library is deemed a mode of using an +interface provided by the Library. + +A "Combined Work" is a work produced by combining or linking an Application +with the Library. The particular version of the Library with which the +Combined Work was made is also called the "Linked Version". + +The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code for +portions of the Combined Work that, considered in isolation, are based on +the Application, and not on the Linked Version. + +The "Corresponding Application Code" for a Combined Work means the object +code and/or source code for the Application, including any data and utility +programs needed for reproducing the Combined Work from the Application, but +excluding the System Libraries of the Combined Work. + + +### 1. Exception to Section 3 of the GNU GPL. + +You may convey a covered work under sections 3 and 4 of this License without +being bound by section 3 of the GNU GPL. + + +### 2. Conveying Modified Versions. + +If you modify a copy of the Library, and, in your modifications, a facility +refers to a function or data to be supplied by an Application that uses the +facility (other than as an argument passed when the facility is invoked), +then you may convey a copy of the modified version: + +* a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the function + or data, the facility still operates, and performs whatever part of its + purpose remains meaningful, or + +* b) under the GNU GPL, with none of the additional permissions of this + License applicable to that copy. + + +### 3. Object Code Incorporating Material from Library Header Files. + +The object code form of an Application may incorporate material from a +header file that is part of the Library. You may convey such object code +under terms of your choice, provided that, if the incorporated material is +not limited to numerical parameters, data structure layouts and accessors, +or small macros, inline functions and templates (ten or fewer lines in +length), you do both of the following: + +* a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are covered by + this License. + +* b) Accompany the object code with a copy of the GNU GPL and this license + document. + + +### 4. Combined Works. + +You may convey a Combined Work under terms of your choice that, taken +together, effectively do not restrict modification of the portions of the +Library contained in the Combined Work and reverse engineering for debugging +such modifications, if you also do each of the following: + +* a) Give prominent notice with each copy of the Combined Work that the + Library is used in it and that the Library and its use are covered by + this License. + +* b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + +* c) For a Combined Work that displays copyright notices during execution, + include the copyright notice for the Library among these notices, as + well as a reference directing the user to the copies of the GNU GPL and + this license document. + +* d) Do one of the following: + + * 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form suitable + for, and under terms that permit, the user to recombine or relink + the Application with a modified version of the Linked Version to + produce a modified Combined Work, in the manner specified by + section 6 of the GNU GPL for conveying Corresponding Source. + + * 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time a + copy of the Library already present on the user's computer system, + and (b) will operate properly with a modified version of the + Library that is interface-compatible with the Linked Version. + +* e) Provide Installation Information, but only if you would otherwise be + required to provide such information under section 6 of the GNU GPL, + and only to the extent that such information is necessary to install + and execute a modified version of the Combined Work produced by + recombining or relinking the Application with a modified version of the + Linked Version. (If you use option 4d0, the Installation Information + must accompany the Minimal Corresponding Source and Corresponding + Application Code. If you use option 4d1, you must provide the + Installation Information in the manner specified by section 6 of the + GNU GPL for conveying Corresponding Source.) + + +### 5. Combined Libraries. + +You may place library facilities that are a work based on the Library side +by side in a single library together with other library facilities that are +not Applications and are not covered by this License, and convey such a +combined library under terms of your choice, if you do both of the +following: + +* a) Accompany the combined library with a copy of the same work based on + the Library, uncombined with any other library facilities, conveyed + under the terms of this License. + +* b) Give prominent notice with the combined library that part of it is a + work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + +### 6. Revised Versions of the GNU Lesser General Public License. + +The Free Software Foundation may publish revised and/or new versions of the +GNU Lesser General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Library as you +received it specifies that a certain numbered version of the GNU Lesser +General Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that published +version or of any later version published by the Free Software Foundation. +If the Library as you received it does not specify a version number of the +GNU Lesser General Public License, you may choose any version of the GNU +Lesser General Public License ever published by the Free Software +Foundation. + +If the Library as you received it specifies that a proxy can decide whether +future versions of the GNU Lesser General Public License shall apply, that +proxy's public statement of acceptance of any version is permanent +authorization for you to choose that version for the Library. \ No newline at end of file diff --git a/javaprinter/javaprinter_lib/commons-codec-1.10.jar b/javaprinter/javaprinter_lib/commons-codec-1.10.jar new file mode 100644 index 0000000..1d7417c Binary files /dev/null and b/javaprinter/javaprinter_lib/commons-codec-1.10.jar differ diff --git a/javaprinter/javaprinter_lib/commons-lang3-3.2.1.jar b/javaprinter/javaprinter_lib/commons-lang3-3.2.1.jar new file mode 100644 index 0000000..6bf4f93 Binary files /dev/null and b/javaprinter/javaprinter_lib/commons-lang3-3.2.1.jar differ diff --git a/javaprinter/javaprinter_lib/jackson-annotations-2.5.4.jar b/javaprinter/javaprinter_lib/jackson-annotations-2.5.4.jar new file mode 100644 index 0000000..3ac1d0a Binary files /dev/null and b/javaprinter/javaprinter_lib/jackson-annotations-2.5.4.jar differ diff --git a/javaprinter/javaprinter_lib/jackson-core-2.5.4.jar b/javaprinter/javaprinter_lib/jackson-core-2.5.4.jar new file mode 100644 index 0000000..addf939 Binary files /dev/null and b/javaprinter/javaprinter_lib/jackson-core-2.5.4.jar differ diff --git a/javaprinter/javaprinter_lib/jackson-databind-2.5.4.jar b/javaprinter/javaprinter_lib/jackson-databind-2.5.4.jar new file mode 100644 index 0000000..0bc240c Binary files /dev/null and b/javaprinter/javaprinter_lib/jackson-databind-2.5.4.jar differ diff --git a/javaprinter/javaprinter_lib/libusb4java-1.2.0-linux-arm.jar b/javaprinter/javaprinter_lib/libusb4java-1.2.0-linux-arm.jar new file mode 100644 index 0000000..cb29774 Binary files /dev/null and b/javaprinter/javaprinter_lib/libusb4java-1.2.0-linux-arm.jar differ diff --git a/javaprinter/javaprinter_lib/libusb4java-1.2.0-linux-x86.jar b/javaprinter/javaprinter_lib/libusb4java-1.2.0-linux-x86.jar new file mode 100644 index 0000000..16ac538 Binary files /dev/null and b/javaprinter/javaprinter_lib/libusb4java-1.2.0-linux-x86.jar differ diff --git a/javaprinter/javaprinter_lib/libusb4java-1.2.0-linux-x86_64.jar b/javaprinter/javaprinter_lib/libusb4java-1.2.0-linux-x86_64.jar new file mode 100644 index 0000000..4652525 Binary files /dev/null and b/javaprinter/javaprinter_lib/libusb4java-1.2.0-linux-x86_64.jar differ diff --git a/javaprinter/javaprinter_lib/usb-api-1.0.2.jar b/javaprinter/javaprinter_lib/usb-api-1.0.2.jar new file mode 100644 index 0000000..7abd6f7 Binary files /dev/null and b/javaprinter/javaprinter_lib/usb-api-1.0.2.jar differ diff --git a/javaprinter/javaprinter_lib/usb4java-1.2.0.jar b/javaprinter/javaprinter_lib/usb4java-1.2.0.jar new file mode 100644 index 0000000..fa6128d Binary files /dev/null and b/javaprinter/javaprinter_lib/usb4java-1.2.0.jar differ diff --git a/javaprinter/javaprinter_lib/usb4java-javax-1.2.0.jar b/javaprinter/javaprinter_lib/usb4java-javax-1.2.0.jar new file mode 100644 index 0000000..9c2ba2a Binary files /dev/null and b/javaprinter/javaprinter_lib/usb4java-javax-1.2.0.jar differ diff --git a/kitchenbar.js b/kitchenbar.js deleted file mode 100644 index 8d499a9..0000000 --- a/kitchenbar.js +++ /dev/null @@ -1,108 +0,0 @@ -function declareProductBeCookingOrCooked(queueid,action) { - var data = { queueid: queueid, - action : action}; - doAjax("POST","php/contenthandler.php?module=queue&command=declareProductBeCookingOrCooked",data,resultOfProductDeclaration,"could not declare product"); -} - -function resultOfProductDeclaration(jsonText) { - if (jsonText.status != "OK") { - alert("Fehler " + jsonText.code + ": " + jsonText.msg); - } -} - -function declareProductNOTBeCooked(queueid) { - var data = { queueid: queueid }; - doAjax("POST","php/contenthandler.php?module=queue&command=declareProductNotBeCooked",data,resultOfProductDeclaration,"could not unmake product"); -} - -function fillTableWithEntriesToCook(entriesToCook) { - var aList = ''; - - $.each(entriesToCook, function (i, table) { - aList += listOfTable(table); - }); - - $("#listWithEntriesToCook").html(aList); - $("#listWithEntriesToCook").trigger("create"); - - $(".preparedlistitem").off("click").on("click", function (e) { - if ($(this).hasClass("cooking")) { - declareProductBeCookingOrCooked($(this).attr("id"),"r"); - } else { - declareProductBeCookingOrCooked($(this).attr("id"),"c"); - } - getAndDisplayAllEntries(); - }); -} - -function listOfTable(table) { - var tableid = table.tableid; - var tablename = table.table; - var maxWaitTime = table.maxwaittime; - - var aList = ''; - - return aList; -} - - -function fillTableWithCookedEntries(cookedEntries) { - var theList = ''; - - $("#listWithCookedEntries").html(theList); - $("#listWithCookedEntries").trigger("create"); - - $(".deliveredlistitem").off("click").on("click", function (e) { - declareProductNOTBeCooked($(this).attr("id")); - getAndDisplayAllEntries(); - }); -} - -function getAndDisplayAllEntries() -{ - getEntriesToCook(); - getCookedEntries(); -} - - diff --git a/manager.html b/manager.html deleted file mode 100644 index 9393a7f..0000000 --- a/manager.html +++ /dev/null @@ -1,1370 +0,0 @@ - - - Ansicht Kassenbons - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
    -
  • Module
  • -
-
- -
-

Administration

-
- Module -
-
-
- -
-

Abrechnung und Datenexport

-

Hier finden sich die Menpunkte zum Tagesabschluss oder Datenexport.

- -
-

Tagesabschluss

-

Hier knnen Sie die seit dem letzten Abschluss gettigten neuen Transaktionen - zu einem neuen Abschluss fhren. Anschlieend sind alle bis zu diesem Zeitpunkt - erstellten Transaktionen/Kassenbons nicht mehr stornierbar!

- -
-
- - -
-
- -
-
-
- - -
-
- - - - -
-
-

Tagesabschlussbeispiel

-

Dieser Eintrag sollte hier nicht mehr stehen...

-
-
-
- - -
-

Datenexport

-

Hier knnen Sie eine csv-Datei erzeugen lassen, die -

  • alle abgerechneten und in Tagesabschlssen enthaltenen - Bonabrechungen im unten auswhlbaren Zeitraum beinhaltet.
  • -
  • alle Stammdaten (Produkte) und deren nderungen seit der Installation auffhrt.
  • -
-

- - - Startdatum Umstze: -
- - -
- -
- -
- - -
-
- - Enddatum Umstze: -
- - -
- -
-
- - -
-
- - - - - - - -
- -
- -
-

Benutzer

-
-
-
- -
-

Konfiguration

-
-
- - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
-
- -
-

Datenbank

- -
-

Speisekarte

- - -
- -

-

-

Raumplan

-
-
- - - - -
Anzahl Rume: - -
Max. Anzahl Tische pro Raum: - -
-
-
-
-
- -
- - - -
- - -
-
-
-
-

- -
- -
Wenn dieser Text dargestellt wird, liegt ein Fehler vor!
- -
-
-
-
-
-
- -
- -
-
-

Keine Datennderung

-
- -
-

Es wurden keine Daten gendert.

-
-
- -
- - -
-
-

?

-

?

- Ja - Nein -
-
- - - - - - \ No newline at end of file diff --git a/paydesk.html b/paydesk.html deleted file mode 100644 index b51c2a8..0000000 --- a/paydesk.html +++ /dev/null @@ -1,929 +0,0 @@ - - - Ansicht Kasse - - - - - - - - - - - - - - - - - - - -
-
-
    -
  • Module
  • -
-
-
-

Kasse

-
- Module -
-
- -
-
-
-
    -
  • Raumauswahl
  • -
- - - -
-
    -
  • - Inhalt Kassenbon:

    0,00 Euro

    -
  • -
-
- - - - - -
- - -
-
- -
- -
-
-
-
-
-
-
- - - - -
-
-

Zahlungsart

-

Auswahl der Zahlungsart

-
- Ja -
-
-
- - -
-
-

Zahlungsart

- Ja - Wert2 - Nein -
-
- - -
-
-

Bareinlage in die Kasse

- - - -
-
- - -
-
-

Barentnahme aus der Kasse

- - - -
-
- -
-
-

bersicht Kellnerkasse

- -

Diese bersicht enthlt die Bewirtungseinnahme durch den Kellner seit der letzten Tageslosung sowie - als weiteren Wert den Kassenstand unter Bercksichtigung der eigenen Eingaben und Entnahmen.

-

Bewirtungseinnahmen:

-

inkl. eigener Kassen-Eingaben/Entnahmen:

- OK -

-
- -
-
-

Keine Rechnungselemente

- -

Es wurden keine abrechenbaren Produkte festgelegt (der Bon ist leer!).

- OK -

-
- - - \ No newline at end of file diff --git a/php/admin.php b/php/admin.php deleted file mode 100644 index 14a6c01..0000000 --- a/php/admin.php +++ /dev/null @@ -1,929 +0,0 @@ -dbutils = new DbUtils(); - $this->userrights = new Userrights(); - $this->histfiller = new HistFiller(); - } - - function handleCommand($command) { - // these command are only allowed for user with manager or admin rights - $cmdArray = array('createNewUser', 'updateUser', 'deleteUser','changepassword' , 'changeConfig'); - if (in_array($command, $cmdArray)) { - if (!($this->userrights->hasCurrentUserRight('right_manager')) && !($this->userrights->hasCurrentUserRight('is_admin'))) { - echo "Benutzerrechte nicht ausreichend!"; - return false; - } - } - - if ($command == 'tryAuthenticate') { - $this->tryAuthenticate($_POST['username'],$_POST['password']); - } else if ($command == 'setLastModuleOfUser') { - $this->setLastModuleOfUser($_POST['view']); - } else if ($command == 'getViewAfterLogin') { - $this->getViewAfterLogin(); - } else if ($command == 'isUserAlreadyLoggedIn') { - $this->isUserAlreadyLoggedIn(); - } else if ($command == 'logout') { - $this->logout(); - } else if ($command == 'getCurrentUser') { - $this->getCurrentUser(); - } else if ($command == 'isLoggedinUserAdmin') { - $this->isLoggedinUserAdmin(); - } else if ($command == 'isLoggedinUserKitchen') { - $this->isLoggedinUserKitchen(); - } else if ($command == 'isLoggedinUserBar') { - $this->isLoggedinUserBar(); - } else if ($command == 'isLoggedinUserAdminOrManager') { - $this->isLoggedinUserAdminOrManager(); - } else if ($command == 'hasUserPaydeskRight') { - $this->hasUserPaydeskRight(); - } else if ($command == 'getJsonMenuItemsAndVersion') { - $this->getJsonMenuItemsAndVersion(); - } else if ($command == 'getUserList') { - $this->getUserList(); - } else if ($command == 'createNewUser') { - $this->createNewUser( - $_POST['username'], - $_POST['password'], - $_POST['isAdmin'], - $_POST['rWaiter'], - $_POST['rKitchen'], - $_POST['rBar'], - $_POST['rSupply'], - $_POST['rPayDesk'], - $_POST['rStat'], - $_POST['rBill'], - $_POST['rProducts'], - $_POST['rManager'] - ); - } else if ($command == 'updateUser') { - $this->updateUser( - $_POST['username'], - $_POST['isAdmin'], - $_POST['rWaiter'], - $_POST['rKitchen'], - $_POST['rBar'], - $_POST['rSupply'], - $_POST['rPayDesk'], - $_POST['rStat'], - $_POST['rBill'], - $_POST['rProducts'], - $_POST['rManager'] - ); - } else if ($command == 'deleteUser') { - $this->deleteUser($_POST['username']); - } else if ($command == 'changepassword') { - $this->changepassword($_POST['username'],$_POST['password']); - } else if ($command == 'changeOwnPassword') { - $this->changeOwnPassword($_POST['oldPass'],$_POST['newPass']); - } else if ($command == 'changeConfig') { - $this->changeConfig( - $_POST['taxChanged'], - $_POST['togoTaxChanged'], - $_POST['stornocodeChanged'], - $_POST['printpassChanged'], - $_POST['companyInfoChanged'], - $_POST['serverUrlChanged'], - $_POST['logoUrlChanged'], - $_POST['payPrintTypeChanged'], - $_POST['emailChanged'], - $_POST['tax'], - $_POST['togoTax'], - $_POST['stornocode'], - $_POST['printpass'], - $_POST['companyinfo'], - $_POST['serverUrl'], - $_POST['logoUrl'], - $_POST['payPrintType'], - $_POST['email']); - } else if ($command == 'getTax') { - $this->getTax(); - } else if ($command == 'getTogoTax') { - $this->getTogoTax(); - // from here on admin rights are needed - } else if ($command == 'getCompanyInfo') { - $this->getCompanyInfo(); - } else if ($command == 'getServerUrl') { - $this->getServerUrl(); - } else if ($command == 'getLogoUrl') { - $this->getLogoUrl(); - } else if ($command == 'getPayPrintType') { - $this->getPayPrintType(); - } else if ($command == 'getPayments') { - $this->getPayments(); - } else if ($command == 'getEmail') { - $this->getEmail(); - } else if (($command == 'new') || ($command == 'new') || ($command == 'drop') || ($command == 'fill') || ($command == 'fillSampleProdType') || ($command == 'fillSpeisekarte')) { - if ($this->isCurrentUserAdmin()) { - if ($command == 'fill') { - $this->fillSampleContent(); - } else if ($command == 'fillSampleProdType') { - $this->fillSampleProdType("samples/speisekarte.txt"); - } else if ($command == 'fillSpeisekarte') { - $this->fillSpeisekarte($_POST['speisekarte']); - } - //else if ($command == 'readRoomsTables') { - // $this->fillSampleRoomsAndTable("samples/roomstables.txt"); - //} - echo json_encode(array("status" => "OK")); - } else { - echo json_encode(array("status" => "ERROR", "code" => ERROR_NOT_AUTHOTRIZED, "msg" => ERROR_NOT_AUTHOTRIZED_MSG)); - } - // end area for admins - } else if ($command == 'exportConfigCsv') { - if ($this->isCurrentUserAdmin() || $this->hasCurrentUserRight('right_manager')) { - $this->exportConfigCsv(); - } - } else if ($command == 'exportUserCsv') { - if ($this->isCurrentUserAdmin() || $this->hasCurrentUserRight('right_manager')) { - $this->exportUserCsv(); - } - } else if ($command == 'setOrderVolume') { - if ($this->isUserAlreadyLoggedInForPhp()) { - $this->setOrderVolume($_POST['volume']); - } - } else if ($command == 'getOrderVolume') { - if ($this->isUserAlreadyLoggedInForPhp()) { - $this->getOrderVolume(); - } - } - else { - echo "Command not supported."; - } - } - - function isUserAlreadyLoggedInForPhp() { - if(session_id() == '') { - session_start(); - } - if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) { - return false; - } else { - return true; - } - } - - function isUserAlreadyLoggedIn() { - if(session_id() == '') { - session_start(); - } - if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) { - // no user logged in - echo json_encode("NO"); - } else { - echo json_encode("YES"); - } - } - - function logout() { - if(session_id() == '') { - session_start(); - session_destroy(); - } - echo json_encode("OK"); - } - - // for the login mask - if user is authenticated then the first page works different - function tryAuthenticate($username,$password) { - $authenticated = false; - $sql = "SELECT userpassword FROM %user% WHERE username='$username' AND active='1'"; - $dbutils = new DbUtils(); - $dbresult = $dbutils->performSqlCommand($sql); - $numberOfEntries = mysqli_num_rows($dbresult); - - if ($numberOfEntries == 1) { - $zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC); - $pass_hash = $zeile['userpassword']; - - // password_verify requires PHP > 5.5, so let's use MD5 instead - // (it is no banking software...) - if (md5($password) == $pass_hash) { - $authenticated = true; - } - } - mysqli_free_result( $dbresult ); - - if ($authenticated) { - if(session_id() == '') { - session_start(); - } - $_SESSION['angemeldet'] = true; - - // now read the rights of the user - $sql = "SELECT * FROM %user% WHERE username='$username' AND active='1'"; - $dbutils = new DbUtils(); - $dbresult = $dbutils->performSqlCommand($sql); - $numberOfEntries = mysqli_num_rows($dbresult); - if ($numberOfEntries == 1) { - $zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC); - $_SESSION['userid'] = $zeile['id']; - $_SESSION['currentuser'] = $username; - $_SESSION['is_admin'] = ($zeile['is_admin'] == 1 ? true : false); - $_SESSION['right_waiter'] = ($zeile['right_waiter'] == 1 ? true : false); - $_SESSION['right_kitchen'] = ($zeile['right_kitchen'] == 1 ? true : false); - $_SESSION['right_bar'] = ($zeile['right_bar'] == 1 ? true : false); - $_SESSION['right_supply'] = ($zeile['right_supply'] == 1 ? true : false); - $_SESSION['right_paydesk'] = ($zeile['right_paydesk'] == 1 ? true : false); - $_SESSION['right_statistics'] = ($zeile['right_statistics'] == 1 ? true : false); - $_SESSION['right_bill'] = ($zeile['right_bill'] == 1 ? true : false); - $_SESSION['right_products'] = ($zeile['right_products'] == 1 ? true : false); - $_SESSION['right_manager'] = ($zeile['right_manager'] == 1 ? true : false); - } - mysqli_free_result($dbresult); - } - - if ($authenticated) { - echo json_encode("YES"); - } else { - echo json_encode("NO"); - } - } - - function getOrderVolume() { - $userid = $_SESSION['userid']; - - $sql = "SELECT ordervolume FROM %user% WHERE id=?"; - $pdo = $this->dbutils->openDbAndReturnPdo(); - - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($userid)); - $row =$stmt->fetchObject(); - $volume = 0; - if ($row != null) { - $volume = $row->ordervolume; - if ($volume == null) { - $volume = 0; - } - } - - echo json_encode($volume); - } - - function setOrderVolume($volume) { - $userid = $_SESSION['userid']; - - $sql = "UPDATE %user% SET ordervolume=? WHERE id=?"; - $pdo = $this->dbutils->openDbAndReturnPdo(); - $pdo->beginTransaction(); - - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($volume,$userid)); - $pdo->commit(); - echo json_encode(array("status" => "OK")); - } - - function setLastModuleOfUser($view) { - if ($this->isUserAlreadyLoggedInForPhp()) { - $userid = $_SESSION['userid']; - - $sql = "UPDATE %user% SET lastmodule=? WHERE id=?"; - $pdo = $this->dbutils->openDbAndReturnPdo(); - $pdo->beginTransaction(); - - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($view,$userid)); - $pdo->commit(); - echo json_encode(array("status" => "OK")); - } - } - - function getViewAfterLogin() { - if ($this->isUserAlreadyLoggedInForPhp()) { - $userid = $_SESSION['userid']; - - $sql = "SELECT lastmodule FROM %user% WHERE id=?"; - $pdo = $this->dbutils->openDbAndReturnPdo(); - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($userid)); - $row =$stmt->fetchObject(); - - $view = "preferences.html"; - if ($row != null) { - $newView = $row->lastmodule; - if ($newView != null) { - $view = $newView; - } - } - - // test if user has still the right to go into that view - $mapping = array ( - "waiter.html" => 'right_waiter', - "kitchen.html" => 'right_kitchen', - "bar.html" => 'right_bar', - "supplydesk.html" => 'right_supply', - "paydesk.html" => 'right_paydesk', - "reports.html" => 'right_statistics', - "bill.html" => 'right_bill', - "products.html" => 'right_products'); - - $valid = false; - if ($view == 'preferences.html') { - // always ok - $valid = true; - } else if ($view == 'manager.html') { - if (($_SESSION['is_admin'] == 1) || ($_SESSION['right_manager'] == 1)) { - $valid = true; - } - } else { - if ($_SESSION[$mapping[$view]] == 1) { - $valid = true; - } - } - if ($valid == false) { - $view = "preferences.html"; - } - - echo json_encode($view); - } - } - - // for client request - function isLoggedinUserAdmin() { - if ($this->isCurrentUserAdmin()) { - echo json_encode(YES); - } else { - echo json_encode(NO); - } - } - - function isLoggedinUserAdminOrManager() { - if ($this->hasCurrentUserRight('is_admin') || $this->hasCurrentUserRight('right_manager')) { - echo json_encode(YES); - } else { - echo json_encode(NO); - } - } - - function isLoggedinUserKitchen() { - if ($this->hasCurrentUserRight('right_kitchen')) { - echo json_encode(YES); - } else { - echo json_encode(NO); - } - } - - function isLoggedinUserBar() { - if ($this->hasCurrentUserRight('right_bar')) { - echo json_encode(YES); - } else { - echo json_encode(NO); - } - } - - function hasUserPaydeskRight() { - if ($this->hasCurrentUserRight('right_paydesk')) { - echo json_encode(YES); - } else { - echo json_encode(NO); - } - } - - function hasCurrentUserRight($whichRight) { - if(session_id() == '') { - session_start(); - } - if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) { - // no user logged in - return false; - } else { - return ($_SESSION[$whichRight]); - } - } - - // for internal request - function isCurrentUserAdmin() { - return $this->hasCurrentUserRight('is_admin'); - } - - - function fillSampleContentBySqlFile($sqlFile) { - $handle = fopen ($sqlFile, "r"); - while (!feof($handle)) { - $sql = fgets($handle); - $this->dbutils->performSqlCommand($sql); - } - fclose ($handle); - } - - private function fillSampleProdType($fileName) { - $speisekartenHandler = new TypeAndProductFileManager(); - $speisekartenHandler->manageSpeisekarteFile($fileName); - - $this->histfiller->readProdTableAndSendToHist(); - } - - private function fillSpeisekarte($speisekarte) { - $pdo = $this->dbutils->openDbAndReturnPdo(); - $pdo->beginTransaction(); - - $speisekartenHandler = new TypeAndProductFileManager(); - $speisekartenHandler->manageSpeisekarte($pdo,$speisekarte); - - $this->histfiller->readProdTableAndSendToHist($pdo); - $pdo->commit(); - } - - /* obsolete: not needed any more after replacement by matrix in manager.html */ - private function fillSampleRoomsAndTable($fileName) { - $roomsAndTableHandler = new RoomsAndTableFileManager(); - $roomsAndTableHandler->readRoomTableDefinition($fileName); - } - - private function fillSampleContent() - { - // first remove previous content, then fill the SQL file - $sql = "DELETE FROM `%queue%`"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $this->fillSampleContentBySqlFile("samples/queuecontent.txt"); - - $sql = "DELETE FROM `%hist%` WHERE action='3' OR action='7' OR action='8'"; - $dbresult = $this->dbutils->performSqlCommand($sql); - - $sql = "DELETE FROM `%histuser%`"; - $dbresult = $this->dbutils->performSqlCommand($sql); - - $sql = "DELETE FROM `%user%`"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $this->fillSampleContentBySqlFile("samples/usercontent.txt"); - - $this->histfiller->readUserTableAndSendToHist(); - } - - function dropProdTypeTable() - { - $this->dbutils->performSqlCommand("drop TABLE `" . DB_PRODTYPE_TABLE . "`;"); - } - - function dropQueueTable() - { - $this->dbutils->performSqlCommand("drop TABLE `" . DB_QUEUE_TABLE . "`;"); - } - - function dropProductsTable() - { - $this->dbutils->performSqlCommand("drop TABLE `" . DB_PRODUCTS_TABLE . "`;"); - } - - function dropUserTable() - { - $this->dbutils->performSqlCommand("drop TABLE `" . DB_USER_TABLE . "`;"); - } - - function dropRoomTable() - { - $this->dbutils->performSqlCommand("drop TABLE `" . DB_ROOM_TABLE . "`;"); - } - - function dropPaymentTable() { - $this->dbutils->performSqlCommand("drop TABLE `%payment%`;"); - } - - function dropRestTables() - { - $this->dbutils->performSqlCommand("drop TABLE `" . DB_RESTTABLES_TABLE . "`;"); - } - - function dropBillTable() - { - $this->dbutils->performSqlCommand("drop TABLE `%bill%`;"); - } - - function dropPriceLevelTable() - { - $this->dbutils->performSqlCommand("drop TABLE `%pricelevel%`;"); - } - - function dropConfigTable() - { - $this->dbutils->performSqlCommand("drop TABLE `%config%`;"); - } - - function dropClosingTable() - { - $this->dbutils->performSqlCommand("drop TABLE `%closing%`;"); - } - - function dropPrintJobsTable() - { - $this->dbutils->performSqlCommand("drop TABLE `%printjobs%`;"); - } - - function dropBillProductsTable() { - $this->dbutils->performSqlCommand("drop TABLE `%billproducts%`;"); - } - - function dropHistTables() { - $pdo = $this->dbutils->openDbAndReturnPdo(); - $sql = "DROP TABLE `%hist%`"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - - $sql = "DROP TABLE `%histprod%`"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - - $sql = "DROP TABLE `%histconfig%`"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - - $sql = "DROP TABLE `%histuser%`"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - - $sql = "DROP TABLE `%histactions%`"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - } - /* - * Return all the entries for the main menu (the modules) - */ - function getJsonMenuItemsAndVersion() { - if(session_id() == '') { - session_start(); - } - $mainMenu = array(); - $currentUser = ""; - if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) { - // no user logged in - $mainMenu[] = array("name" => "Startseite", "link" => "index.html"); - } else { - if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => "Kellner", "link" => "waiter.html"); }; - if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => "Küche", "link" => "kitchen.html"); }; - if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html"); }; - if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => "Bereitstellung", "link" => "supplydesk.html"); }; - if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => "Kasse", "link" => "paydesk.html"); }; - if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => "Statistik", "link" => "reports.html"); }; - if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => "Kassenbons", "link" => "bill.html"); }; - if ($_SESSION['right_products']) { $mainMenu[] = array("name" => "Angebot", "link" => "products.html"); }; - if ($_SESSION['right_manager']) { $mainMenu[] = array("name" => "Verwaltung", "link" => "manager.html"); }; - $mainMenu[] = array("name" => "Einstellung", "link" => "preferences.html"); - $mainMenu[] = array("name" => "Feedback", "link" => "feedback.html"); - $mainMenu[] = array("name" => "Abmelden", "link" => "logout.php"); - $currentUser = $_SESSION['currentuser']; - } - // CAUTION: change version also in config.txt!!! - $mainMenuAndVersion = array ("version" => "1.0", "user" => $currentUser, "menu" => $mainMenu); - echo json_encode($mainMenuAndVersion); - } - - function getUserList() { - $userInfo = array(); - $sql = "SELECT * FROM %user% WHERE active='1'"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $numberOfEntries = mysqli_num_rows($dbresult); - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) { - $userEntry = array ("username" => $zeile['username'], - "is_admin" => $zeile['is_admin'], - "right_waiter" => $zeile['right_waiter'], - "right_kitchen" => $zeile['right_kitchen'], - "right_bar" => $zeile['right_bar'], - "right_supply" => $zeile['right_supply'], - "right_paydesk" => $zeile['right_paydesk'], - "right_statistics" => $zeile['right_statistics'], - "right_bill" => $zeile['right_bill'], - "right_products" => $zeile['right_products'], - "right_manager" => $zeile['right_manager'] - ); - $userInfo[] = $userEntry; - } - - mysqli_free_result($dbresult); - echo json_encode($userInfo); - } - - function createNewUser($username, $password, $isAdmin, $rWaiter, $rKitchen, $rBar, $rSupply, $rPayDesk, $rStat, $rBill, $rProducts, $rManager) { - // check if the user with that name already exists - $sql = "SELECT username FROM %user% WHERE active='1' AND username='$username'"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $numberOfEntries = mysqli_num_rows($dbresult); - mysqli_free_result($dbresult); - - if ($numberOfEntries > 0) { - echo json_encode("exists"); - } else { - // create the new user - // instead if password_hash (PHP > 5.5) use MD5... - $password_hash = md5($password); - $userInsertSql = "INSERT INTO `%user%` (`id` , `username` , `userpassword`, `is_admin`, `right_waiter`,`right_kitchen`,`right_bar`,`right_supply`,`right_paydesk`,`right_statistics`,`right_bill`,`right_products`,`right_manager`,`active`) VALUES ("; - $userInsertSql .= " NULL, '$username', '$password_hash' , '$isAdmin', '$rWaiter', '$rKitchen', '$rBar', '$rSupply', '$rPayDesk', '$rStat', '$rBill', '$rProducts', '$rManager', '1')"; - $dbresult = $this->dbutils->performSqlCommandRetLastId($userInsertSql); - $lastId = $dbresult['id']; - echo json_encode("OK"); - } - - // now this has to be logged in the history tables... - $this->histfiller->createUserInHist($lastId,$username, - $isAdmin,$rWaiter,$rKitchen,$rBar,$rSupply,$rPayDesk,$rStat,$rBill,$rProducts,$rManager); - } - - function getTax() { - $this->sendJsonValueFromConfigTable('tax'); - } - - function getTogoTax() { - $this->sendJsonValueFromConfigTable('togotax'); - } - - function getCompanyInfo() { - $this->sendJsonValueFromConfigTable('companyinfo'); - } - - function getServerUrl() { - $this->sendJsonValueFromConfigTable('serverurl'); - } - - function getLogoUrl() { - $this->sendJsonValueFromConfigTable('logourl'); - } - - function getPayPrintType() { - $this->sendJsonValueFromConfigTable('payprinttype'); - } - - function getEmail() { - $this->sendJsonValueFromConfigTable('email'); - } - - function getPayments() { - $pdo = $this->dbutils->openDbAndReturnPdo(); - - $sql = "SELECT id,name FROM %payment%"; - $stmt_query = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - - $stmt_query->execute(); - $result = $stmt_query->fetchAll(); - $retArray = array(); - - foreach($result as $row) { - $entry = array("id"=> $row['id'], "name" => $row['name']); - $retArray[] = $entry; - } - echo json_encode($retArray); - } - - function sendJsonValueFromConfigTable($whichValue) { - $theVal = $this->getValueFromConfigTable($whichValue); - if ($theVal == null) { - echo json_encode(""); - } else { - echo json_encode($theVal); - } - } - - function getValueFromConfigTable($whichValue) { - $sql = "SELECT setting FROM %config% WHERE name='$whichValue'"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $numberOfEntries = mysqli_num_rows($dbresult); - $theValue = null; - if ($numberOfEntries == 1) { - $zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC); - $theValue = $zeile['setting']; - } - mysqli_free_result($dbresult); - return $theValue; - } - - function changeConfig( - $taxChanged,$togoTaxChanged,$stornocodeChanged,$printpassChanged,$companyInfoChanged,$serverUrlChanged,$logoUrlChanged,$payPrintTypeChanged,$emailChanged, - $tax,$togoTax,$stornocode,$printpass,$companyInfo,$serverUrl,$logoUrl,$payPrintType,$email) { - - $problem = false; - if ($stornocodeChanged == 1) { - $this->changeOneConfigDbItem('stornocode',$stornocode); - } - - if ($printpassChanged == 1) { - $this->changeOneConfigDbItem('printpass',md5($printpass)); - } - - if ($companyInfoChanged == 1) { - $this->changeOneConfigDbItem('companyinfo',$companyInfo); - } - - if ($serverUrlChanged == 1) { - $this->changeOneConfigDbItem('serverurl', $serverUrl); - } - - if ($logoUrlChanged == 1) { - $this->changeOneConfigDbItem('logourl', $logoUrl); - } - - if ($payPrintTypeChanged == 1) { - $this->changeOneConfigDbItem('payprinttype', $payPrintType); - } - if ($emailChanged == 1) { - $this->changeOneConfigDbItem('email', $email); - } - if ($taxChanged == 1) { - if (is_numeric($tax)) { - $this->changeOneConfigDbItem('tax',$tax); - } else { - $problem = true; - } - } - - if ($togoTaxChanged == 1) { - if (is_numeric($togoTax)) { - $this->changeOneConfigDbItem('togotax',$togoTax); - } else { - $problem = true; - } - } - - if ($problem) { - echo json_encode("FAILED"); - } else { - echo json_encode("OK"); - } - } - - function changeOneConfigDbItem($theItem,$theValue) { - $sql = "UPDATE %config% SET setting='$theValue' WHERE name='$theItem'"; - $dbresult = $this->dbutils->performSqlCommand($sql); - - // now this has to be logged in the history tables... - $this->histfiller->updateConfigInHist($theItem, $theValue); - } - - private function findActiveUserWithName($username) { - $sql_find_id = "SELECT id FROM %user% WHERE active='1' AND username='$username'"; - $pdo = $this->dbutils->openDbAndReturnPdo(); - $stmt_query = $pdo->query($this->dbutils->resolveTablenamesInSqlString($sql_find_id)); - $row =$stmt_query->fetchObject(); - $theUserId = $row->id; - return $theUserId; - } - - function updateUser($username, $isAdmin, $rWaiter, $rKitchen, $rBar, $rSupply, $rPayDesk, $rStat, $rBill, $rProducts, $rManager) { - $theUserId = $this->findActiveUserWithName($username); - - // check if the user with that name already exists - $sql = "UPDATE %user% SET is_admin='$isAdmin', right_waiter='$rWaiter',right_kitchen='$rKitchen',right_bar='$rBar',right_supply='$rSupply',right_paydesk='$rPayDesk',right_statistics='$rStat',right_bill='$rBill',right_products='$rProducts',right_manager='$rManager' WHERE active='1' AND username='$username'"; - - $dbresult = $this->dbutils->performSqlCommand($sql); - - // now this has to be logged in the history tables... - - $this->histfiller->updateUserInHist($theUserId,$username, - $isAdmin,$rWaiter,$rKitchen,$rBar,$rSupply,$rPayDesk,$rStat,$rBill,$rProducts,$rManager,'1'); - - echo json_encode("OK"); - } - - function deleteUser($username) { - $theUserId = $this->findActiveUserWithName($username); - - $userSql = "UPDATE %user% set active='0' WHERE username='$username'"; - $dbresult = $this->dbutils->performSqlCommand($userSql); - - $this->histfiller->updateOneUser($theUserId); - - echo json_encode("OK"); - } - - function getCurrentUser() { - if(session_id() == '') { - session_start(); - } - if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) { - // no user logged in - echo json_encode("Nobody"); - } else { - echo json_encode($_SESSION['currentuser']); - } - } - - function changepassword($username,$password) { - $password_hash = md5($password); - $userSql = "UPDATE %user% set userpassword='$password_hash' WHERE active='1' AND username='$username'"; - $dbresult = $this->dbutils->performSqlCommand($userSql); - echo json_encode("OK"); - } - - function changeOwnPassword($oldpassword,$newpassword) { - if(session_id() == '') { - session_start(); - } - $currentuser = $_SESSION['currentuser']; - $oldp_hash = md5($oldpassword); - - $ok = true; - - // is old password correct? - $sql = "SELECT userpassword FROM %user% WHERE username='$currentuser' AND active='1'"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $numberOfEntries = mysqli_num_rows($dbresult); - if ($numberOfEntries == 1) { - $zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC); - if ($zeile['userpassword'] != $oldp_hash) { - $ok = false; - } - } else { - // user not found - $ok = false; - } - mysqli_free_result($dbresult); - - if ($ok) { - // allowed to change password - $newp_hash = md5($newpassword); - $sql = "UPDATE %user% set userpassword='$newp_hash' WHERE active='1' AND username='$currentuser'"; - $dbresult = $this->dbutils->performSqlCommand($sql); - echo json_encode("OK"); - } else { - echo json_encode("FAILED"); - } - } - - private function writeCsvHeader($defaultFilename) { - header("Content-type: text/x-csv"); - header("Content-Disposition: attachment; filename=$defaultFilename"); - header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); - header("Pragma: no-cache"); - header("Expires: 0"); - } - - private function exportConfigCsv() { - $this->writeCsvHeader("datenexport-config.csv"); - - echo("Eintragsid; Datum ; Konfiguration; Wert;Beschreibung\n"); - - $sql = "SELECT DISTINCT %hist%.id as id,date,"; - $sql .= "%config%.name as configitem,%histconfig%.setting as setting,description "; - $sql .= " FROM %hist%, %histconfig%, %histactions%, %config% "; - $sql .= " WHERE (refid=%histconfig%.id) "; - $sql .= " AND %histconfig%.configid = %config%.id "; - $sql .= " AND (action='2' OR action='6') "; - $sql .= " AND (action=%histactions%.id) "; - $sql .= " ORDER BY date,id"; - - $dbresult = $this->dbutils->performSqlCommand($sql); - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) { - $val1 = $zeile['id']; - $val2 = $zeile['date']; - $val3 = $zeile['configitem']; - $val4 = str_replace("\r\n","",$zeile['setting']); - $val4 = str_replace("\n","",$val4); - $val5 = $zeile['description']; - - echo "$val1; $val2; \"$val3\"; \"$val4\"; \"$val5\"\n"; - } - mysqli_free_result( $dbresult ); - } - - private function exportUserCsv() { - $this->writeCsvHeader("datenexport-benutzer.csv"); - - echo("Eintragsid; Datum ; Benutzerid; Benutzername; Adminrechte; Kellnerrechte;Kuechenrechte; Barrechte; Bereitstellungsrechte; Kassenrechte; Reportrechte; Kassenbonrechte; Angebotsrechte; Managerrechte; Aktiviert\n"); - - $sql = "SELECT DISTINCT %hist%.id as id,date,"; - $sql .= "userid,username,is_admin,right_waiter,right_kitchen,right_bar,right_supply,"; - $sql .= "right_paydesk,right_statistics,right_bill,right_products,right_manager,active,"; - $sql .= "description "; - $sql .= " FROM %hist%, %histuser%, %histactions% "; - $sql .= " WHERE (refid=%histuser%.id) "; - $sql .= " AND (action='3' OR action='7' OR action='8') "; - $sql .= " AND (action=%histactions%.id) "; - $sql .= " ORDER BY date,id"; - - $dbresult = $this->dbutils->performSqlCommand($sql); - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) { - $val1 = $zeile['id']; - $val2 = $zeile['date']; - $val3 = $zeile['userid']; - $val4 = $zeile['username']; - $val5 = ($zeile['is_admin'] == '1' ? "Ja" : "Nein"); - $val6 = ($zeile['right_waiter'] == '1' ? "Ja" : "Nein"); - $val7 = ($zeile['right_kitchen'] == '1' ? "Ja" : "Nein"); - $val8 = ($zeile['right_bar'] == '1' ? "Ja" : "Nein"); - $val9 = ($zeile['right_supply'] == '1' ? "Ja" : "Nein"); - $val10 = ($zeile['right_paydesk'] == '1' ? "Ja" : "Nein"); - $val11 = ($zeile['right_statistics'] == '1' ? "Ja" : "Nein"); - $val12 = ($zeile['right_bill'] == '1' ? "Ja" : "Nein"); - $val13 = ($zeile['right_products'] == '1' ? "Ja" : "Nein"); - $val14 = ($zeile['right_manager'] == '1' ? "Ja" : "Nein"); - $val15 = ($zeile['active'] == '1' ? "Ja" : "Nein"); - $val16 = $zeile['description']; - - echo "$val1; $val2; $val3; $val4; $val5; $val6; $val7; $val8; $val9; $val10;"; - echo "$val11;$val12;$val13;$val14;$val15;$val16\n"; - } - mysqli_free_result( $dbresult ); - } - -} - -?> \ No newline at end of file diff --git a/php/bill.php b/php/bill.php deleted file mode 100644 index 432e94a..0000000 --- a/php/bill.php +++ /dev/null @@ -1,408 +0,0 @@ -dbutils = new DbUtils(); - } - - function handleCommand($command) { - if ($command == 'exportCsv') { - if ($this->hasCurrentUserAdminOrManagerRights()) { - // yes, we can export the data - $this->exportCsv($_GET['startMonth'],$_GET['startYear'],$_GET['endMonth'],$_GET['endYear']); - } else { - echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_NOT_AUTHOTRIZED, "msg" => ERROR_BILL_NOT_AUTHOTRIZED_MSG)); - } - return; - } - if ($command == 'exportCsvOfClosing') { - if ($this->hasCurrentUserAdminOrManagerRights()) { - // yes, we can export the data - $this->exportCsvOfClosing($_GET['closingid']); - } else { - echo json_encode(array("status" => "ERROR", "code" => ERROR_MANAGER_NOT_AUTHOTRIZED, "msg" => ERROR_MANAGER_NOT_AUTHOTRIZED_MSG)); - } - return; - } - - if ($this->hasCurrentUserBillRights()) { - if ($command == 'getLastBillsWithContent') { - $this->getLastBillsWithContent(); - } else if ($command == 'cancelBill') { - $this->cancelBill($_POST['billid'],$_POST['stornocode']); - } else if ($command == 'doCashAction') { - $this->doCashAction($_POST['money']); - } else if ($command == 'getCashOverviewOfUser') { - $this->getCashOverviewOfUser(); - } else { - echo "Command not supported."; - } - } else { - echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_NOT_AUTHOTRIZED, "msg" => ERROR_BILL_NOT_AUTHOTRIZED_MSG)); - } - } - - // for internal request - private function hasCurrentUserBillRights() { - session_start(); - if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) { - // no user logged in - return false; - } else { - return ($_SESSION['right_bill']); - } - } - - // for internal request - private function hasCurrentUserAdminOrManagerRights() { - session_start(); - if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) { - // no user logged in - return false; - } else { - return ($_SESSION['right_manager'] || $_SESSION['is_admin']); - } - } - - private function billWithId($billid) { - $pdo = $this->dbutils->openDbAndReturnPdo(); - $pdo->beginTransaction(); - - $sql = "SELECT content FROM %bill% WHERE id=?"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($billid)); - $row =$stmt->fetchObject(); - if ($row != null) { - return stripslashes($row->content); - } - } - - - // TODO: needed??? - function getBillWithId($billid) { - echo json_encode($this->billWithId($billid)); - } - - /* - * insert or take out cash money. The direction done by sign of $money value - */ - private function doCashAction($money) { - // current time - date_default_timezone_set('Europe/Berlin'); - $currentTime = date('Y-m-d H:i:s'); - - $pdo = $this->dbutils->openDbAndReturnPdo(); - $pdo->beginTransaction(); - - $sql = "SELECT sum(brutto) as bruttosum FROM %bill% WHERE closingid is null AND paymentid='1'"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - $row =$stmt->fetchObject(); - if ($row != null) { - $sum = $row->bruttosum; - if (is_null($sum)) { - // no transaction after last closing - $sum = 0.0; - } - if (($sum + floatval($money)) >= 0.0) { - $userId = $this->getUserId(); - $sql = "INSERT INTO `%bill%` (`id` , `billdate`,`content`,`brutto`,`netto`,`tax`,`tableid`, `status`, `paymentid`,`userid`,`ref`) VALUES ( NULL, ? , ?, ?,?,?, ?, 'c', ?,?,?)"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($currentTime,NULL,$money,$money,'0.00',-1,1,$userId,NULL)); - $pdo->commit(); - echo json_encode(array("status" => "OK")); - } else { - echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_LESS_MONEY_TO_TAKE_OUT, "msg" => ERROR_BILL_LESS_MONEY_TO_TAKE_OUT_MSG)); - } - } else { - $pdo->rollBack(); - echo json_encode(array("status" => "ERROR", "code" => ERROR_GENERAL_PAYDESK_SUM, "msg" => ERROR_GENERAL_PAYDESK_SUM_MSG)); - return; - } - } - - /* - * User may ask what money he should have in his pocket by serving the guests. If the inserts and - * take outs are in in his waiter paydesk then this value is of interest, too. Return both. - */ - function getCashOverviewOfUser() { - $userId = $this->getUserId(); - - // without cash insert and cash takeout - $onlyCashByGuests = 0.0; - $pdo = $this->dbutils->openDbAndReturnPdo(); - $sql = "SELECT sum(brutto) as sumtotal FROM %bill% WHERE closingid is null AND status is null AND paymentid=1 AND userid='$userId'"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - $row =$stmt->fetchObject(); - if ($row != null) { - if ($row->sumtotal != null) { - $onlyCashByGuests = $row->sumtotal; - } - } - - // with cash - $cashByGuestsAndInsertTakeOut = 0.0; - $sql = "SELECT sum(brutto) as sumtotal FROM %bill% WHERE closingid is null AND paymentid='1' AND userid='$userId' AND (status is null OR status ='c')"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - $row =$stmt->fetchObject(); - if ($row != null) { - if ($row->sumtotal != null) { - $cashByGuestsAndInsertTakeOut = $row->sumtotal; - } - } - echo json_encode(array("guestmoney" => $onlyCashByGuests, "total" => $cashByGuestsAndInsertTakeOut)); - } - - function getLastBillsWithContent() { - $commonUtils = new CommonUtils(); - $sql = "SELECT id,billdate,brutto,tableid,closingid,status FROM %bill% WHERE tableid >= '0' AND status is null ORDER BY billdate DESC LIMIT 20;"; - $dbresult = $this->dbutils->performSqlCommand($sql); - - $resultarray = array(); - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) - { - $theId = $zeile['id']; - $theHtmlContentOfBill = $this->billWithId($theId); - $date = new DateTime($zeile['billdate']); - $shortdate = $date->format('H:i'); - $closingID = $zeile['closingid']; - $isClosed = (is_null($closingID) ? 0 : 1); - $arr = array("id" => $theId, - "longdate" => $zeile['billdate'], - "shortdate" => $shortdate, - "brutto" => $zeile['brutto'], - "tablename" => $commonUtils->getTableNameFromId($zeile['tableid']), - "billcontent" => $theHtmlContentOfBill, - "isClosed" => $isClosed - ); - $resultarray[] = $arr; - } - mysqli_free_result( $dbresult ); - - echo json_encode(array("status" => "OK", "code" => OK, "msg" => $resultarray)); - } - - private function getUserId() { - if(session_id() == '') { - session_start(); - } - return $_SESSION['userid']; - } - - /* - * Cancel a bill - set all queue items to not paid and drop the bill entry - */ - private function cancelBill($billid,$stornocode) { - // current time - date_default_timezone_set('Europe/Berlin'); - $currentTime = date('Y-m-d H:i:s'); - - // check if stornocode is correct - $sql = "SELECT setting FROM %config% WHERE name='stornocode'"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $numberOfVals = mysqli_num_rows($dbresult); - if ($numberOfVals != 1) { - // stornocode not fixed - mysqli_free_result( $dbresult ); - echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_NOT_STORNO_CODE, "msg" => ERROR_BILL_NOT_STORNO_CODE_MSG)); - return; - } - - $zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC); - $stornocodeInDb = $zeile['setting']; - - mysqli_free_result( $dbresult ); - if ($stornocode != $stornocodeInDb) { - echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_WRONG_STORNO_CODE, "msg" => ERROR_BILL_WRONG_STORNO_CODE_MSG)); - return; - } - - if (!is_numeric($billid)) { - // this may be an attack... - echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_WRONG_NUMERIC_VALUE, "msg" => ERROR_BILL_WRONG_NUMERIC_VALUE_MSG)); - return; - } - - // Do transactional cancel - - $pdo = $this->dbutils->openDbAndReturnPdo(); - $pdo->beginTransaction(); - - // is the bill already closed? In this case no cancel is allowed! - $sql = "SELECT content,brutto,netto,tax,tableid,closingid,status,paymentid FROM %bill% WHERE id=?"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($billid)); - $row =$stmt->fetchObject(); - $closingId = null; - if ($row != null) { - $closingId = $row->closingid; - - // save the next data for a copy! - $content = $row->content; - $brutto = $row->brutto; - $netto = $row->netto; - $tax = $row->tax; - $tableid = $row->tableid; - $status = $row->status; - $paymentid = $row->paymentid; - } - - if (!is_null($closingId) || ($status == 's') || ($status == 'x')) { - // no cancel possible anymore! - $pdo->rollBack(); - if (($status == 's') || ($status == 'x')) { - echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_ALREADY_CANCELLED, "msg" => ERROR_BILL_ALREADY_CANCELLED_MSG)); - } else { - echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_ALREADY_CLOSED, "msg" => ERROR_BILL_ALREADY_CLOSED_MSG)); - } - - return; - } - - // 0. find the queueitems that are related to that bill - $sql = "SELECT id FROM %queue% WHERE billid=?"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($billid)); - $result = $stmt->fetchAll(); - $queueIdArray = array(); - - foreach($result as $row) { - $queueIdArray[] = $row['id']; - } - - // 1. clear connection between queue item and bill - $sql = "UPDATE %queue% SET paidtime=null WHERE billid=?"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($billid)); - - // 2. copy bill with negativ brutto as part of storno - $userIdOfStornoUser = $this->getUserId(); - $stornval = 0.0 - floatval($brutto); - $stornonettoval = 0.0 - floatval($netto); - $sql = "INSERT INTO `%bill%` (`id` , `billdate`,`content`,`brutto`,`netto`,`tax`,`tableid`, `status`, `paymentid`,`userid`,`ref`) VALUES ( NULL, ? , ?, ?, ?,?,?, 's', ?,?,?)"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($currentTime,$content,$stornval,$stornonettoval,$tax,$tableid,$paymentid,$userIdOfStornoUser,$billid)); - $refIdOfStornoEntry = $pdo->lastInsertId(); - - // 3. mark bill as part of storno - $sql = "UPDATE %bill% SET status='x', closingid=null, ref=? WHERE id=?"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($refIdOfStornoEntry,$billid)); - - // 4. now put the queue items into the billproducts so that later storno is evaluable - foreach ($queueIdArray as $aQueueid) { - $billProdsSql = "INSERT INTO `%billproducts%` (`queueid` , `billid`) VALUES ( ?,?)"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($billProdsSql)); - $stmt->execute(array($aQueueid,$refIdOfStornoEntry)); - } - - $pdo->commit(); - // end of transactional cancel - - echo json_encode(array("status" => "OK", "code" => OK)); - return; - } - - private function exportCsv($startMonth,$startYear,$endMonth,$endYear) { - $this->exportCsv_bin($startMonth,$startYear,$endMonth,$endYear,null); - } - - /* - * Method to export data of a special closing - */ - private function exportCsvOfClosing($closingid) { - $this->exportCsv_bin(null,null,null,null,$closingid); - } - - private function exportCsv_bin($startMonth,$startYear,$endMonth,$endYear,$onlyClosingId) { - if ($onlyClosingId == null) { - if ($startMonth < 10) { - $startMonth = "0" . $startMonth; - } - if ($endMonth < 10) { - $endMonth = "0" . $endMonth; - } - $startDate = $startYear . "-" . $startMonth . "-01 00:00:00"; - // now find last day of month of end date! - $endDate = $endYear . "-" . $endMonth . "-01"; - $lastdayOfMonth = date("t", strtotime($endDate)); - $endDate = $endYear . "-" . $endMonth . "-" . $lastdayOfMonth . " 23:59:59"; - } - - $file_name = "datenexport.csv"; - header("Content-type: text/x-csv"); - header("Content-Disposition: attachment; filename=$file_name"); - header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); - header("Pragma: no-cache"); - header("Expires: 0"); - if ($onlyClosingId == null) { - echo("Bonid;Bondatum;Brutto;Netto;MwSt;Status;Referenzbon-ID;Benutzerid;Benutzername;Tageslosung-ID; Tageslosung-Datum; Zahlungsart; Tageslosung-Bemerkung\n"); - } else { - // closing id is know - do not output unnecessary info - echo("Bonid;Bondatum;Brutto;Netto;MwSt;Status;Referenzbon-ID;Benutzerid;Benutzername;Zahlungsart\n"); - } - - // first get the billids for that closing - $billIdsForThatClosing = array(); - $sql = "SELECT DISTINCT %bill%.id,billdate,brutto,netto,tax,status,closingdate,remark,%bill%.closingid,%payment%.name,userid,ref,username 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) { - // search for time span - $sql .= " AND %bill%.billdate BETWEEN '$startDate' AND '$endDate' "; - } else { - // search for a special closing id - $sql .= " AND closingid='$onlyClosingId' "; - } - - $sql .= " AND %bill%.userid = %user%.id "; - $sql .= "ORDER BY billdate"; - - $dbresult = $this->dbutils->performSqlCommand($sql); - - $retValues = array(); - - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) { - $billid = $zeile['id']; - $billdate = $zeile['billdate']; - $brutto = str_replace(".",",",$zeile['brutto']); - $netto = str_replace(".",",",$zeile['netto']); - $tax = str_replace(".",",",$zeile['tax']); - $status = $zeile['status']; - if ($status == 'x') { - $status = "nachher storniert"; - } else if ($status == 's') { - $status = "Stornierungsbuchung"; - } else if ($status == 'c') { - $status = "Bareinlage/-entnahme"; - } else { - $status = ""; - } - $ref = ($zeile['ref'] == null ? "" : $zeile['ref']); - $userid = $zeile['userid']; - $username = $zeile['username']; - $closingid = $zeile['closingid']; - $closingdate = $zeile['closingdate']; - $remark = '"' . addslashes($zeile['remark']) . '"'; - $paymentname = '"' . addslashes($zeile['name']) . '"'; - if ($billid == null) { - $billid = "-"; - } - - if ($onlyClosingId == null) { - echo "$billid ; $billdate; $brutto; $netto; $tax; $status; $ref; $userid; $username ; $closingid; $closingdate; $paymentname; $remark\n"; - } else { - echo "$billid ; $billdate; $brutto; $netto; $tax; $status; $ref; $userid; $username ; $paymentname\n"; - } - } - mysqli_free_result( $dbresult ); - } -} -?> \ No newline at end of file diff --git a/php/closing.php b/php/closing.php deleted file mode 100644 index 57a7b38..0000000 --- a/php/closing.php +++ /dev/null @@ -1,303 +0,0 @@ -dbutils = new DbUtils(); - } - - function handleCommand($command) { - // all commands require manager rights - if (!($this->hasCurrentUserManagerOrAdminRights())) { - if ($command != 'exportCsv') { - echo json_encode(array("status" => "ERROR", "code" => ERROR_MANAGER_NOT_AUTHOTRIZED, "msg" => ERROR_MANAGER_NOT_AUTHOTRIZED_MSG)); - } else { - // exception - result is not handled on HTML/JS side - echo "Fehlende Benutzerrechte"; - } - return; - } - - // user has manager rights - if($command == 'createClosing') { - $this->createClosing($_POST['remark']); - } else if ($command == 'getClosings') { - $this->getClosings($_GET['month'], $_GET['year']); - } else if ($command == 'exportCsv') { - $this->exportCsv($_GET['closingid']); - } else if ($command == 'getClosing') { - $this->getClosing($_GET['closingid']); - } else { - echo "Command not supported."; - } - } - - private function hasCurrentUserManagerOrAdminRights() { - session_start(); - if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) { - // no user logged in - return false; - } else { - return ($_SESSION['right_manager'] || $_SESSION['is_admin']); - } - } - - private function createClosing ($remark) { - if (is_null($remark)) { - $remark = ""; - } - - // first create a closing entry - $remark = $this->dbutils->filterString($remark); - - date_default_timezone_set('Europe/Berlin'); - $closingTime = date('Y-m-d H:i:s'); - - $closingEntrySql = "INSERT INTO `%closing%` (`id` , `closingdate`,`remark`) VALUES (NULL , $closingTime , '$remark')"; - - $newClosingId = $this->dbutils->performPreparedStatementCreateClosing($closingTime,$remark); - - // declare not closed bills as closed - $declareClosedSql = "UPDATE %bill% SET closingid='$newClosingId' WHERE closingid is null AND (tableid >= '0' OR status='c') "; - $dbresult = $this->dbutils->performSqlCommand($declareClosedSql); - - // now calculate the sum of the prices of this closing - $sql = "SELECT sum(brutto) as pricesum FROM %bill% WHERE closingid='$newClosingId' AND (tableid >= '0' OR status='c')"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $numberOfReturns = mysqli_num_rows($dbresult); - - if ($numberOfReturns > 0) { - $zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC); - $pricesum = $zeile['pricesum']; - } - mysqli_free_result( $dbresult ); - - if (is_null($pricesum)) { - $pricesum = 0; - } - - // now clean the items that should be removed after a closing, i.e. that haven't been paid - $sql = "DELETE FROM %queue% WHERE billid is null"; - $dbresult = $this->dbutils->performSqlCommand($sql); - - echo json_encode(array("status" => "OK", "msg" => "Summe des Tagesabschlusses: " . $pricesum)); - } - - private function getSumOfBillsWithClosingId($closingid,$onlyBar) { - $sql = "SELECT sum(brutto) as billsum FROM %bill% WHERE closingid='$closingid'"; - if ($onlyBar) { - $sql .= " AND paymentid='1'"; - } - $dbresult = $this->dbutils->performSqlCommand($sql); - $numberOfReturns = mysqli_num_rows($dbresult); - $sum = 0.0; - if ($numberOfReturns == 1) { - $zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC); - $sum = floatval($zeile["billsum"]); - } - mysqli_free_result( $dbresult ); - return $sum; - } - - /* - * Get all closings that are requested: - * if month and year is null or empty ==> last 30 closings - * otherwise query by date - */ - private function getClosings($month, $year) { - $monthText=$month; - if ($month < 10) { - $monthText = "0" . $month; - } - - $lastDayInMonth = date("t", mktime(0, 0, 0, $month, 1, $year)); - - $dateStart = $year . $monthText . "01"; - $dateEnd = $year . $monthText . $lastDayInMonth; - $sql = "SELECT id,closingdate,remark FROM %closing% WHERE DATE(closingdate) BETWEEN '" . $dateStart . "' AND '" . $dateEnd . "' ORDER BY closingdate DESC LIMIT 30;"; - $dbresult = $this->dbutils->performSqlCommand($sql); - - $resultarray = array(); - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) - { - $theId = $zeile['id']; - $closingDate = $zeile['closingdate']; - $remark = $zeile['remark']; - $totalSum = $this->getSumOfBillsWithClosingId($theId, false); - $cashSum = $this->getSumOfBillsWithClosingId($theId, true); - $closingEntry = array("id" => $theId, "closingDate" => $closingDate, "remark" => $remark, "totalsum" => $totalSum, "cashsum" => $cashSum); - $resultarray[] = $closingEntry; - } - mysqli_free_result( $dbresult ); - - echo json_encode(array("status" => "OK", "msg" => $resultarray)); - } - - private function getPaymentArray() { - $sql = "SELECT id,name FROM %payment%"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $retArray = array(); - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) - { - $retArray[$zeile['id']] = $zeile['name']; - } - mysqli_free_result( $dbresult ); - return $retArray; - } - - private function getClosing($closingid) { - $this->retrieveClosingFromDb($closingid, false); - } - - private function exportCsv($closingid) { - $this->retrieveClosingFromDb($closingid, true); - } - - private function getDateOfPreviousClosing($closingid) { - $previousId = intval($closingid) - 1; - $sql = "SELECT closingdate FROM %closing% WHERE id='$previousId'"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $numberOfReturns = mysqli_num_rows($dbresult); - $retVal = null; - if ($numberOfReturns == 1) { - $zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC); - $retVal = $zeile['closingdate']; - } - mysqli_free_result( $dbresult ); - return $retVal; - } - - private function retrieveClosingFromDb($closingid,$doCsvExport) { - $paymentArray = $this->getPaymentArray(); - $previousClosingDate = $this->getDateOfPreviousClosing($closingid); - - if ($doCsvExport) { - $file_name = "tagesabschluss.csv"; - header("Content-type: text/x-csv"); - header("Content-Disposition: attachment; filename=$file_name"); - header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); - header("Pragma: no-cache"); - header("Expires: 0"); - echo("Bon-ID; Zahldatum; Produkt; Bruttopreis ; Nettopreis; MwSt; Zahlungsart; Benutzer-ID; Benutzername; Status; Referenz-Bon-ID\n"); - } - - // find the date of the closing - that shall later be exported - $sql = "SELECT closingdate FROM %closing% WHERE id='$closingid'"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC); - $closingdate = $zeile['closingdate']; - mysqli_free_result( $dbresult ); - - // first get the billids for that closing - $billIdsAndPaymentsForThatClosing = array(); - $sql = "SELECT %bill%.id as billid,paymentid,billdate,userid,ref,username,status,brutto,netto,tax FROM %bill%,%user% WHERE closingid=$closingid AND %bill%.userid = %user%.id ORDER BY billdate"; - $dbresult = $this->dbutils->performSqlCommand($sql); - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) { - $billIdsAndPaymentsForThatClosing[] = array( - "id" => $zeile['billid'], - "payment" => $zeile['paymentid'], - "userid" => $zeile['userid'], - "username" => $zeile['username'], - "status" => $zeile['status'], - "brutto" => $zeile['brutto'], - "netto" => $zeile['netto'], - "tax" => $zeile['tax'], - "ref" => $zeile['ref'], - "billdate" => $zeile['billdate']); - } - mysqli_free_result( $dbresult ); - - $retValues = array(); - - // Now we know all bills - find the related queue items! - // (cancelled "s" have a relation queue.billid = bill.refid!!!) - for ($index=0;$index < count($billIdsAndPaymentsForThatClosing);$index++) { - $aBillId = $billIdsAndPaymentsForThatClosing[$index]['id']; - $billdate = $billIdsAndPaymentsForThatClosing[$index]['billdate']; - $paymentid = $billIdsAndPaymentsForThatClosing[$index]['payment']; - $userid = $billIdsAndPaymentsForThatClosing[$index]['userid']; - $username = $billIdsAndPaymentsForThatClosing[$index]['username']; - $status = $billIdsAndPaymentsForThatClosing[$index]['status']; - // brutto instead of product price for cash actions needed - $brutto = $billIdsAndPaymentsForThatClosing[$index]['brutto']; - $netto = $billIdsAndPaymentsForThatClosing[$index]['netto']; - $tax = $billIdsAndPaymentsForThatClosing[$index]['tax']; - $ref = $billIdsAndPaymentsForThatClosing[$index]['ref']; - $ref = ($ref == null ? "" : $ref); - - if ($status == 'c') { - // for cash insert / takeout there are no queue items! take "Kassenaktion" as product - $statusTxt = "Bareinlage/-entnahme"; - $brutto = number_format($brutto, 2, ',', ''); - $netto = number_format($netto, 2, ',', ''); - $tax = number_format($tax, 2, ',', ''); - $retValues[] = array ( - "billid" => $aBillId, - "paidtime" => $billdate, - "productname" => "Kassenaktion", - "price" => $brutto, - "netto" => $netto, - "tax" => $tax, - "payment" => $paymentArray[$paymentid], - "userid" => $userid, - "username" => $username, - "status" => $statusTxt, - "ref" => $ref); - if ($doCsvExport) { - echo "$aBillId; \"$billdate\" ; \"Kassenaktion\" ; \"$brutto\" ; \"$netto\" ; \"$tax\" ; \"$paymentArray[$paymentid]\"; $userid; \"$username\"; \"$statusTxt\"; $ref\n"; - } - } else { - $sql = "SELECT DISTINCT productname,price FROM %queue%,%billproducts% WHERE %billproducts%.billid='$aBillId' AND %billproducts%.queueid=%queue%.id"; - if ($status == 'x') { - $statusTxt = "nachher storniert"; - } else if ($status == 's') { - $statusTxt = "Stornierungsbuchung"; - } else { - $statusTxt = ""; - $sql = "SELECT productname,paidtime,price FROM %queue% WHERE billid=$aBillId"; - } - - $dbresult = $this->dbutils->performSqlCommand($sql); - - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) { - $productname = $zeile['productname']; - $paidtime = ($billdate == null ? "" : $billdate) ; - $price = ($status == 's' ? 0.0-floatval($zeile['price']) : $zeile['price']); - - // calculate netto by tax - $netto = $price/(1 + $tax/100.0); - $netto = number_format($netto, 2, ',', ''); - $price = number_format($price, 2, ',', ''); - $tax = number_format($tax, 2, ',', ''); - $retValues[] = array ( - "billid" => $aBillId, - "paidtime" => $paidtime, - "productname" => $productname, - "price" => $price, - "netto" => $netto, - "tax" => $tax, - "payment" => $paymentArray[$paymentid], - "userid" => $userid, - "username" => $username, - "status" => $statusTxt, - "ref" => $ref); - $productname = str_replace('"','""',$productname); - if ($doCsvExport) { - echo "$aBillId; \"$paidtime\" ; \"$productname\" ; \"$price\" ; \"$netto\" ; \"$tax\" ; \"$paymentArray[$paymentid]\"; $userid; \"$username\"; \"$statusTxt\"; $ref\n"; - } - } - mysqli_free_result( $dbresult ); - } - - } - if (!($doCsvExport)) { - // in this case it is for printing (fill html page area) - echo json_encode(array("status" => "OK", "msg" => $retValues, "closingid" => $closingid, "closingdate" => $closingdate, "previousClosingDate" => $previousClosingDate)); - } - } -} - -?> \ No newline at end of file diff --git a/php/commonutils.php b/php/commonutils.php deleted file mode 100644 index bd892c5..0000000 --- a/php/commonutils.php +++ /dev/null @@ -1,121 +0,0 @@ -dbutils = new DbUtils(); - // $this->products = new Products(); --> endless loop! - // $this->lastSettingOfDisplayMode = "all"; - } - - function createGridTableWithSqrtSizeOfButtons ($inputArray) { - // create a table that is optimal (sqrt-like size) - $numberOfIcons = count($inputArray); - if ($numberOfIcons == 0) { - // no items to display - return; - } - $numberOfCols = ceil(sqrt($numberOfIcons)); - $porcentageWidth = floor(100/$numberOfCols); - - echo ''; - $colcounter = 0; - for ($index=0;$index<$numberOfIcons;$index++) { - if ($colcounter == 0) { - echo ""; - } - } - echo ""; - echo "
"; - } - $anEntry = $inputArray[$index]; - $textOfButton = $anEntry["textOfButton"]; # - $onClickMethod = $anEntry["onClickMethod"]; // With parameters! - - $button = ''; - echo $button; - $colcounter++; - if ($colcounter == $numberOfCols) { - $colcounter = 0; - echo "
"; - } - - - function createGridTableWithSqrtSizeOfStyleButtons($inputArray) { - $this->createGridTableWithSqrtSizeOfStyleButtonsAndHeader($inputArray,'','dummy'); - } - - function getTableNameFromId($tableid) { - $sql = "SELECT tableno FROM " . DB_RESTTABLES_TABLE . " WHERE id=". $tableid; - $dbresult = $this->dbutils->performSqlCommand($sql); - $zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC); - $tablename = $zeile['tableno']; - mysqli_free_result( $dbresult ); - return $tablename; - } - - function getCurrentPriceLevel() { - $sql = "SELECT setting FROM %config% WHERE name='pricelevel'"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC); - $pricelevelid = $zeile['setting']; - mysqli_free_result( $dbresult ); - - $sql = "SELECT id,name FROM %pricelevel% WHERE id=$pricelevelid"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC); - $pricelevelname = $zeile['name']; - mysqli_free_result( $dbresult ); - - return (array("id" => $pricelevelid, "name" => $pricelevelname)); - } - - function createGridTableWithSqrtSizeOfStyleButtonsAndHeader ($inputArray,$headline,$headercolor) { - // create a table that is optimal (sqrt-like size) - $numberOfIcons = count($inputArray); - if ($numberOfIcons == 0) { - // no items to display - return; - } - $numberOfCols = ceil(sqrt($numberOfIcons)); - $porcentageWidth = floor(100.0/$numberOfCols); - - echo ''; - - // Headline - if ($headline <> '') { - echo ''; - } - - $colcounter = 0; - for ($index=0;$index<$numberOfIcons;$index++) { - if ($colcounter == 0) { - echo ""; - } - } - echo ""; - echo "
' . $headline . '
"; - } - $anEntry = $inputArray[$index]; - $textOfButton = $anEntry["textOfButton"]; # - $onClickMethod = $anEntry["onClickMethod"]; // With parameters! - $style = $anEntry["style"]; - - $button = ''; - echo $button; - $colcounter++; - if ($colcounter == $numberOfCols) { - $colcounter = 0; - echo "
"; - } - -} -?> \ No newline at end of file diff --git a/php/config.php b/php/config.php deleted file mode 100644 index 4a50fcc..0000000 --- a/php/config.php +++ /dev/null @@ -1,12 +0,0 @@ - \ No newline at end of file diff --git a/php/printqueue.php b/php/printqueue.php deleted file mode 100644 index 958f235..0000000 --- a/php/printqueue.php +++ /dev/null @@ -1,161 +0,0 @@ -dbutils = new DbUtils(); - $this->userrights = new Userrights(); - } - - function handleCommand($command) { - // these command are only allowed for user with waiter rights - if ($command == 'queuePrintJob') { - $this->queuePrintJob($_POST['content'],$_POST['type']); - } else if ($command == 'getNextPrintJob') { - $this->getNextPrintJob($_POST['pass']); - } else if ($command == 'deletePrintJob') { - $this->deletePrintJob($_POST['pass'],$_POST['id']); - } else if ($command == 'getPrintJobAsHtml') { - $this->getPrintJobAsHtml($_GET['id'],$_POST['pass']); - } else if ($command == 'getNextPrintJobIdType') { - $this->getNextPrintJobIdType($_POST['pass']); - } else { - echo "Kommando nicht erkannt!"; - } - } - - /* - * Insert a job into ther printjob queue. The POS Print Server will - * pick these jobs and delete them after successful printing - */ - function queuePrintJob($htmlContent,$printType) { - if (($printType == FOOD_PRINT_TYPE) || ($printType == DRINK_PRINT_TYPE)){ - // waiter rights required - if (!($this->userrights->hasCurrentUserRight('right_waiter'))) { - echo "Benutzerrechte nicht ausreichend!"; - return false; - } - } - if ($printType == PAY_PRINT_TYPE){ - // waiter, or manager, bill, admin rights required - if (!($this->userrights->hasCurrentUserRight('right_paydesk')) && - !($this->userrights->hasCurrentUserRight('right_manager')) && - !($this->userrights->hasCurrentUserRight('right_bill')) && - !($this->userrights->hasCurrentUserRight('right_waiter')) && - !($this->userrights->hasCurrentUserRight('is_admin')) - ) { - echo "Benutzerrechte nicht ausreichend!"; - return false; - } - } - - // from here on user is authorized - $printInsertSql = "INSERT INTO `%printjobs%` (`id` , `content`,`type`) VALUES ( NULL, '$htmlContent' , '$printType')"; - $dbresult = $this->dbutils->performSqlCommand($printInsertSql); - echo json_encode("OK"); - } - - - function isPasswordCorrect($pass) { - $sql = "SELECT setting FROM %config% WHERE name=?"; - $pdo = $this->dbutils->openDbAndReturnPdo(); - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array("printpass")); - $row =$stmt->fetchObject(); - - if ($row != null) { - $passInDb = $row->setting; - if ($passInDb != null) { - // plain comparison - if ($pass == $passInDb) { - return true; - } else { - echo "Error: Falscher Printpass!"; - } - } else { - echo "Error: kein Printpass in DB gesetzt!"; - } - } - echo "Error: DB konnte nicht abgefragt werden!"; - return false; - } - - function getNextPrintJob($pass) { - $isCorrect = $this->isPasswordCorrect($pass); - if ($isCorrect) { - $sql = "SELECT id,content,type FROM %printjobs% ORDER BY id ASC LIMIT 1"; - - $pdo = $this->dbutils->openDbAndReturnPdo(); - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - $row =$stmt->fetchObject(); - if ($row != null) { - echo json_encode(array("id" => $row->id, "content" => $row->content, "type" => $row->type)); - } - } - } - - function getNextPrintJobIdType($md5pass) { - $isCorrect = $this->isPasswordCorrect($md5pass); - if ($isCorrect) { - - $sql = "SELECT id,type FROM %printjobs% ORDER BY id ASC LIMIT 1"; - $pdo = $this->dbutils->openDbAndReturnPdo(); - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - $row =$stmt->fetchObject(); - if ($row != null) { - $id = $row->id; - $theType = $row->type; - if ($id != null) { - header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" ); - header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" ); - header( "Cache-Control: no-cache, must-revalidate" ); - header( "Pragma: no-cache" ); - header( "Content-Type: text/html; charset=utf8" ); - echo "" . $id . "-" . $theType . ""; - } - } - } - } - - function getPrintJobAsHtml($id,$md5pass) { - $isCorrect = $this->isPasswordCorrect($md5pass); - if ($isCorrect) { - $sql = "SELECT content FROM %printjobs% WHERE id=?"; - $pdo = $this->dbutils->openDbAndReturnPdo(); - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($id)); - $row =$stmt->fetchObject(); - if ($row != null) { - $content = $row->content; - if ($content != null) - { - header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" ); - header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" ); - header( "Cache-Control: no-cache, must-revalidate" ); - header( "Pragma: no-cache" ); - header( "Content-Type: text/html; charset=utf8" ); - echo "" . $content . ""; - } - } - } - } - - function deletePrintJob($pass,$id) { - $isCorrect = $this->isPasswordCorrect($pass); - if ($isCorrect) { - $sql = "DELETE FROM %printjobs% WHERE id=?"; - $pdo = $this->dbutils->openDbAndReturnPdo(); - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($id)); - } - } -} -?> \ No newline at end of file diff --git a/php/products.php b/php/products.php deleted file mode 100644 index d52d3e0..0000000 --- a/php/products.php +++ /dev/null @@ -1,609 +0,0 @@ -dbutils = new DbUtils(); - $this->queue = new QueueContent(); - $this->commonUtils = new CommonUtils(); - $this->userrights = new Userrights(); - $this->histfiller = new HistFiller(); - } - - function handleCommand($command) { - // canUserCallCommands($currentCmd, $cmdArray,$right) - $cmdArray = array('showDbProducts', 'applySingleProdData', 'reassign', 'applyType', 'getSingleProdData','getPriceLevelInfo','setPriceLevelInfo', 'createProduct','createProdType'); - if (in_array($command, $cmdArray)) { - if (!($this->userrights->hasCurrentUserRight('right_products'))) { - if ($command == 'createProdType') { - echo json_encode(array("status" => "ERROR", "code" => ERROR_PRODUCTS_NOT_AUTHOTRIZED, "msg" => ERROR_PRODUCTS_NOT_AUTHOTRIZED_MSG)); - } else { - echo "Benutzerrechte nicht ausreichend!"; - } - return false; - } - } - - if($command == 'showDbProducts') { - $this->showDbProducts(); - } else if ($command == 'getSpeisekarte') { - if ($this->userrights->hasCurrentUserRight('is_admin') || ($this->userrights->hasCurrentUserRight('right_manager'))) { - $this->getSpeisekarte(); - } else { - echo "Fehlende Benutzerechte"; - } - } else if ($command == 'exportCsv') { - if (($this->userrights->hasCurrentUserRight('is_admin')) - || ($this->userrights->hasCurrentUserRight('right_manager'))) { - $this->exportCsv(); - } - } else if ($command == 'getAllTypesAndAvailProds') { - $this->getAllTypesAndAvailProds(); - } else if ($command == 'getAllAvailProdsAlphaSorted') { - $this->getAllAvailProdsAlphaSorted(); - } else if ($command == 'getSingleProdData') { - $this->getSingleProdData($_GET['id']); - } else if ($command == 'applySingleProdData') { - $this->applySingleProdData($_POST['id'],$_POST['longname'],$_POST['shortname'],$_POST['priceA'],$_POST['priceB'],$_POST['priceC'],$_POST['available'],$_POST['audioFile']); - } else if ($command == 'createProduct') { - $this->createProduct($_POST['longname'],$_POST['shortname'],$_POST['priceA'],$_POST['priceB'],$_POST['priceC'],$_POST['available'],$_POST['prodTypeId'],$_POST['audioFile']); - } else if ($command == 'reassign') { - $this->reassign($_POST['productid'],$_POST['typeid']); - } else if ($command == 'createProdType') { - $this->createProdType($_POST['refid'],$_POST['name']); - } else if ($command == 'applyType') { - $this->applyType($_POST['id'],$_POST['name'],$_POST['kind'],$_POST['usekitchen'],$_POST['usesupply']); - } else if ($command == 'getPriceLevelInfo') { - $this->getPriceLevelInfo(); - } else if ($command == 'setPriceLevelInfo') { - $this->setPriceLevelInfo($_POST['priceLevelId']); - } else if ($command == 'getSpeisekarte') { - $this->getSpeisekarte(); - } else if ($command == 'getAudioFiles') { - $this->getAudioFiles(); - } else { - echo "Command not supported."; - } - } - - function getDateValueAsBoolInterpretatedIcon($aValue) { - if ($aValue != '0' ) { - $imgFile = "ok.png"; - } else { - $imgFile = "notavailable.png"; - } - return $imgFile; - } - - private function getAllTypesAndAvailProds() { - $pdo = $this->dbutils->openDbAndReturnPdo(); - $pdo->beginTransaction(); - - $sql = "select id,name,reference from %prodtype% where removed is null"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - $result = $stmt->fetchAll(); - $typeArray = array(); - - foreach($result as $row) { - $ref = $row['reference']; - if ($ref == null) { - $ref = 0; - } - $typeArray[] = array("id" => $row['id'], "name" => $row['name'], "ref" => $ref); - } - - $sql = "select id,shortname,longname,audio,category as ref from %products% where available='1' AND removed is null"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - $result = $stmt->fetchAll(); - $prodArray = array(); - foreach($result as $row) { - $ref = $row['ref']; - if ($ref == null) { - $ref = 0; - } - $audio = $row['audio']; - if ($audio == null) { - $audio = ""; - } - $prodArray[] = array("id" => $row['id'], "name" => $row['shortname'], "longname" => $row['longname'], "audio" => $audio, "ref" => $ref); - } - $pdo->commit(); - - $retArray = array("types" => $typeArray, "prods" => $prodArray); - echo json_encode($retArray); - } - - /* - * Return all available product with id and name that are not in given type. - * (used for re-assignment to type) - */ - function getAllAvailProdsAlphaSorted() { - $pdo = $this->dbutils->openDbAndReturnPdo(); - - // find categories with available products in them - $sql = "select distinct category from %products% WHERE available='1' AND removed is null"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - $result = $stmt->fetchAll(); - $typeArr = array(); - foreach($result as $row) { - $cat = $row['category']; - - // find all prods not in this array (for later re-assignment into this cat) - $sql = "select id,longname from %products% WHERE available='1' AND removed is null AND category <> ? ORDER BY longname"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($cat)); - $prodresult = $stmt->fetchAll(); - $prodArray = array(); - foreach($prodresult as $prow) { - $prodArray[] = array("id" => $prow['id'], "name" => $prow['longname']); - } - $typeArr[] = array("type" => $cat, "prods" => $prodArray); - } - - echo json_encode($typeArr); - } - - // ************************************************************ - // * Start OLD part - // ************************************************************ - - // Utility function: find the roomid if the tableid is known - function getRoomFromTableid($tableid) { - // Find roomid for table (variable roomid works in the one direction, but if called by back-button, not) - $sql = "select " . DB_ROOM_TABLE . ".id as id from " . DB_ROOM_TABLE . ", " . DB_RESTTABLES_TABLE . " where " . DB_RESTTABLES_TABLE . ".id = '" . $tableid . "' and " . DB_ROOM_TABLE . ".id = " . DB_RESTTABLES_TABLE . ".roomid;"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC); - $roomid = $zeile['id']; - mysqli_free_result( $dbresult ); - return $roomid; - } - - function areThereProductsInTheCategory($categoryid) { - $sql = "SELECT id FROM " . DB_PRODUCTS_TABLE . " WHERE category = " . $categoryid . " AND available='1';"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $numberOfEnttry = mysqli_num_rows($dbresult); - mysqli_free_result( $dbresult ); - if ($numberOfEnttry > 0) { - return true; - } else { - return false; - } - } - - function areThereCategoriesInTheCategory($categoryid) { - $sql = "SELECT id FROM %prodtype% WHERE removed is null AND reference = $categoryid"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $numberOfEntry = mysqli_num_rows($dbresult); - mysqli_free_result( $dbresult ); - if ($numberOfEntry > 0) { - return true; - } else { - return false; - } - } - - /* - * Return in array all products with their id and longname that have a reference to - * the given category. - * - * The output is this: - * ["id" => 1, "longname" => "Whatever Product"], - * ["id" => 2, "longname" => "Whatever Other Product"], ... - */ - private function getProductsWithReferenz($ref) { - $prods = array(); - $sql = "SELECT id,shortname,longname,priceA,priceB,priceC,available,audio from %products% where removed is null AND category is null"; - if ($ref > 0) { - $sql = "SELECT id,shortname,longname,priceA,priceB,priceC,available,audio from %products% where removed is null AND category=$ref"; - } - $dbresult = $this->dbutils->performSqlCommand($sql); - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) { - $prod_entry = array( - "id" => $zeile['id'], - "shortname" => $zeile['shortname'], - "longname" => $zeile['longname'], - "available" => $zeile['available'], - "priceA" => $zeile['priceA'], - "priceB" => $zeile['priceB'], - "priceC" => $zeile['priceC'], - "audio" => ($zeile['audio'] == null ? '' : $zeile['audio']), - "type" => "p"); - $prods[] = $prod_entry; - } - mysqli_free_result( $dbresult ); - return $prods; - } - - /* - * Return in array all types with their id and name that have a reference to - * the given category. - * - * The output is this: - * ["id" => 1, "name" => "Meal"], - * ["id" => 2, "name" => "Drinks"], ... - */ - private function getProdTypesWithReferenz($ref) { - $types = array(); - $sql = "SELECT id,name,kind,usekitchen,usesupplydesk from %prodtype% where removed is null AND reference is null"; - if ($ref > 0) { - $sql = "SELECT id,name,kind,usekitchen,usesupplydesk from %prodtype% where removed is null AND reference=$ref"; - } - $dbresult = $this->dbutils->performSqlCommand($sql); - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) { - $prod_entry = array( - "id" => $zeile['id'], - "name" => $zeile['name'], - "kind" => $zeile['kind'], - "usekitchen" => $zeile['usekitchen'], - "usesupplydesk" => $zeile['usesupplydesk'], - "type" => "t"); - $types[] = $prod_entry; - } - mysqli_free_result( $dbresult ); - return $types; - } - - function showDbProducts() { - $productArray = $this->getDbProductsWithRef_json_version(0,0); - echo json_encode($productArray); - } - - function readDbProducts() { - $speisekarte = $this->readDbProductsWithRef_json_version(0,0); - return $speisekarte; - } - - private function exportCsv() { - $file_name = "datenexport-produkte.csv"; - header("Content-type: text/x-csv"); - header("Content-Disposition: attachment; filename=$file_name"); - header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); - header("Pragma: no-cache"); - header("Expires: 0"); - echo("Eintragsid; Datum ; Produktid; Kurzname; Langname; Preis (Stufe A); Preis (Stufe B);"); - echo("Preis (Stufe C); Verfgbarkeit; Beschreibung"); - echo("\n"); - - $sql = "SELECT DISTINCT %hist%.id as id,date,"; - $sql .= "prodid,shortname,longname,priceA,priceB,priceC,available, description "; - $sql .= " FROM %hist%, %histprod%, %histactions% "; - $sql .= " WHERE (refid=%histprod%.id) "; - $sql .= " AND (action='1' OR action='4' OR action='5') "; - $sql .= " AND (action=%histactions%.id) "; - $sql .= " ORDER BY date,id"; - - $dbresult = $this->dbutils->performSqlCommand($sql); - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) { - $val1 = $zeile['id']; - $val2 = $zeile['date']; - $val3 = $zeile['prodid']; - $val4 = str_replace('"','""',$zeile['shortname']); - $val5 = str_replace('"','""',$zeile['longname']); - $val6 = $zeile['priceA']; - $val7 = $zeile['priceB']; - $val8 = $zeile['priceC']; - $val9 = ($zeile['available'] == '1' ? "Ja" : "Nein"); - $val10 = $zeile['description']; - - echo "$val1; $val2; $val3; \"$val4\"; \"$val5\"; $val6; $val7; $val8; $val9; $val10\n"; - } - mysqli_free_result( $dbresult ); - } - - function getSingleProdData($id) { - if (is_numeric($id)) { - $sql = "SELECT shortname,longname,priceA,priceB,priceC,available,audio from %products% where id=$id"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC); - - $prod_entry = array( - "shortname" => $zeile['shortname'], - "longname" => $zeile['longname'], - "available" => $zeile['available'], - "priceA" => $zeile['priceA'], - "priceB" => $zeile['priceB'], - "priceC" => $zeile['priceC'], - "audio" => $zeile['audio'] - ); - - mysqli_free_result( $dbresult ); - echo json_encode($prod_entry); - } - } - - function reassign($prodid,$typeid) { - $pdo = $this->dbutils->openDbAndReturnPdo(); - $pdo->beginTransaction(); - $sql = "UPDATE %products% SET category=? WHERE id=?"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($typeid,$prodid)); - $affectedRows = $stmt->rowCount(); - $pdo->commit(); - if ($affectedRows == 1) { - echo json_encode("OK"); - } else { - echo json_encode("Failed"); - } - } - - function applySingleProdData($id,$longname,$shortname,$priceA,$priceB,$priceC,$available,$audioFile) { - if (!is_numeric($id) || !is_numeric($available) || !is_numeric($priceA) || !is_numeric($priceB) || !is_numeric($priceC)) { - return; - } - $priceA = $this->dbutils->filterString($priceA); - $priceB = $this->dbutils->filterString($priceB); - $priceC = $this->dbutils->filterString($priceC); - - if ($audioFile == '') { - $audioFile = null; - } - $updateSql = "UPDATE %products% SET shortname=?, longname=?, priceA=?, priceB=?, priceC=?, available=?, audio=? WHERE id=?"; - $pdo = $this->dbutils->openDbAndReturnPdo(); - $pdo->beginTransaction(); - - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($updateSql)); - $stmt->execute(array($shortname,$longname,$priceA,$priceB,$priceC,$available,$audioFile,$id)); - - $pdo->commit(); - - echo json_encode("OK: $updateSql"); - - // now this has to be logged in the history tables... - $this->histfiller->updateProdInHist($id, $shortname, $longname, $priceA, $priceB, $priceC, - NULL, $available,$audioFile); - } - - function createProdType($id,$prodTypeName) { - if (!is_numeric($id)) { - echo json_encode(array("status" => "ERROR", "code" => ERROR_GENERAL_ID_TYPE, "msg" => ERROR_GENERAL_ID_TYPE_MSG)); - return; - } - - $pdo = $this->dbutils->openDbAndReturnPdo(); - $pdo->beginTransaction(); - - // which kind is the referenced type? - $sql = "SELECT kind FROM %prodtype% WHERE id=?"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($id)); - $row =$stmt->fetchObject(); - - if ($row == null) { - echo json_encode(array("status" => "ERROR", "code" => ERROR_GENERAL_DB_NOT_READABLE, "msg" => ERROR_GENERAL_DB_NOT_READABLE_MSG)); - return; - } - $kind = $row->kind; - - $sql = "INSERT INTO `%prodtype%` (`id`,`name`,`usekitchen`,`usesupplydesk`,`kind`,`sorting`,`reference`) "; - $sql .= " VALUES(NULL,?,1,1,?,NULL,?)"; - - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($prodTypeName,$kind,$id)); - - $pdo->commit(); - echo json_encode(array("status" => "OK")); - } - - function createProduct($longname,$shortname,$priceA,$priceB,$priceC,$available,$typeId,$audioFile) { - if (!is_numeric($typeId) || !is_numeric($available) || !is_numeric($priceA) || !is_numeric($priceB) || !is_numeric($priceC)) { - return; - } - - if ($audioFile == '') { - $audioFile = null; - } - - $sql = "INSERT INTO `%products%` (`id`, `shortname`, `longname`, `priceA`, `priceB`, `priceC`, `category`,`available`,`audio`) VALUES (NULL,?,?,?,?,?,?,?,?)"; - $pdo = $this->dbutils->openDbAndReturnPdo(); - $pdo->beginTransaction(); - - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($shortname,$longname,$priceA,$priceB,$priceC,$typeId,$available,$audioFile)); - - $newProdId = $pdo->lastInsertId(); - $pdo->commit(); - - // now this has to be logged in the history tables... - - $this->histfiller->createProdInHist ($newProdId['id'], $shortname, $longname, $priceA, $priceB, $priceC, - NULL, $available,$audioFile); - - echo json_encode("OK: sql"); - } - - /* - * Change the properties of a type of products - */ - function applyType($id,$name,$kind,$usekitchen,$usesupply) { - if (!is_numeric($id) || !is_numeric($kind) || !is_numeric($usekitchen) || !is_numeric($usesupply)) { - return; - } - $pdo = $this->dbutils->openDbAndReturnPdo(); - $updateSql = "UPDATE %prodtype% SET kind=?, name=?, usekitchen=?, usesupplydesk=? WHERE id=?"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($updateSql)); - $stmt->execute(array($kind,$name,$usekitchen,$usesupply,$id)); - echo json_encode("OK: $updateSql"); - } - - - /* - * Return a html table with all products in a structured way - */ - private function getDbProductsWithRef_json_version($ref,$depth) { - $allProdsAndTypesInThisLevel = array(); - - $allProdsInThisLevel = $this->getProductsWithReferenz($ref); - $allTypesInThisLevel = $this->getProdTypesWithReferenz($ref); - - for ($index_prod=0;$index_prod $aProd, "content" => ''); - } - for ($index_type=0;$index_type < count($allTypesInThisLevel);$index_type++) { - $aProdType = $allTypesInThisLevel[$index_type]; - $typeRef = $aProdType['id']; - $allProdsAndTypesInThisLevel[] = array("entry" => $aProdType,"content" => $this->getDbProductsWithRef_json_version($typeRef,$depth+1)); - } - return $allProdsAndTypesInThisLevel; - } - - // return in text format - private function readDbProductsWithRef_json_version($ref,$depth) { - $text = ""; - $allProdsAndTypesInThisLevel = array(); - - $allProdsInThisLevel = $this->getProductsWithReferenz($ref); - $allTypesInThisLevel = $this->getProdTypesWithReferenz($ref); - - for ($index_prod=0;$index_prod $zeile['id'], - "name" => $zeile['name'], - "kind" => $zeile['kind'], - "usekitchen" => $zeile['usekitchen'], - "usesupplydesk" => $zeile['usesupplydesk'], - "type" => "t"); - - $prodTypeName = $aProdType['name']; - $kind = ($aProdType['kind'] == 0 ? "F" : "D"); - $usekitchen = ($aProdType['usekitchen'] == 1 ? "K" : ""); - $usesupplydesk = ($aProdType['usesupplydesk'] == 1 ? "B" : ""); - - $text .= $indent . $prodTypeName . " = $usekitchen$usesupplydesk$kind\n"; - - $text .= $this->readDbProductsWithRef_json_version($typeRef,$depth+1); - } - return $text; - } - - private function numberOfProdsInProdType($theId) { - // how many prods are related to this type? - $sql = "SELECT COUNT(id) FROM %products% WHERE removed is null AND category=$theId"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC); - $noProdsInThisProdType = $zeile['COUNT(id)']; - mysqli_free_result( $dbresult ); - - // iterate over all prodtypes in this prodtype - $prodtypesInside = $this->getProdTypesWithReferenz($theId); - for ($i=0;$i < count($prodtypesInside);$i++) { - $anInsideProdType = $prodtypesInside[i]; - // recursive - $noProdsInThisProdType += $this->numberOfProdsInProdType($anInsideProdType["id"]); - } - return $noProdsInThisProdType; - } - - private function getPriceLevelInfo() { - $currentPriceLevel = $this->commonUtils->getCurrentPriceLevel(); - $currentPriceLevelId = $currentPriceLevel["id"]; - $currentPriceLevelName = $currentPriceLevel["name"]; - - $pricelevels = array(); - $sql = "SELECT * FROM %pricelevel%"; - $dbresult = $this->dbutils->performSqlCommand($sql); - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) { - $theId = $zeile['id']; - $selected = "0"; - if ($theId == $currentPriceLevelId) { - $selected = "1"; - } - $levels_entry = array( - "id" => $theId, - "name" => $zeile['name'], - "info" => $zeile['info'], - "selected" => $selected); - $pricelevels[] = $levels_entry; - } - mysqli_free_result( $dbresult ); - - $retArray = array("currentId" => $currentPriceLevelId, "currentName" => $currentPriceLevelName, "levels" => $pricelevels); - echo json_encode($retArray); - } - - private function setPriceLevelInfo($levelId) { - if (is_numeric($levelId)) { - $updateSql = "UPDATE %config% SET setting=$levelId WHERE name='pricelevel'"; - $dbresult = $this->dbutils->performSqlCommand($updateSql); - echo json_encode("OK"); - } - } - - private function getSpeisekarte() { - $pdo = $this->dbutils->openDbAndReturnPdo(); - - $sql = "SELECT * FROM %products% WHERE removed is null"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - $numberOfProds = $stmt->rowCount(); - - $sql = "SELECT * FROM %prodtype% WHERE removed is null"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - $numberOfProdTypes = $stmt->rowCount(); - - if (($numberOfProds == 0) && ($numberOfProdTypes == 0)) { - // no products defined yet - present Beispiel - $text = file_get_contents ("../customer/speisekarte.txt"); - } else { - $text = $this->readDbProducts(); - } - - echo json_encode($text); - } - - private function endsWith($haystack, $needle) - { - return $needle === "" || substr($haystack, -strlen($needle)) === $needle; - } - - private function getAudioFiles() { - $dir = '../customer'; - $fileList = scandir($dir); - $audioFiles = array(); - - foreach ($fileList as $aFile) { - if ($this->endsWith($aFile, '.mp3') || $this->endsWith($aFile, '.ogg') || $this->endsWith($aFile, '.wav')) { - $audioFiles[] = $aFile; - } - } - - echo json_encode($audioFiles); - } -} - -?> \ No newline at end of file diff --git a/php/queuecontent.php b/php/queuecontent.php deleted file mode 100644 index 82a91db..0000000 --- a/php/queuecontent.php +++ /dev/null @@ -1,1030 +0,0 @@ -dbutils = new DbUtils(); - $this->commonUtils = new CommonUtils(); - $this->userrights = new Userrights(); - } - - function handleCommand($command) { - header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); - header("Cache-Control: post-check=0, pre-check=0", false); - header("Pragma: no-cache"); - - if ($command == "getJsonTableNameFromId") { - $this->getJsonTableNameFromId($_GET['tableid']); - return; - } - - // these command are only allowed for user with supply rights - $cmdArray = array('getJsonAllPreparedProducts', 'getJsonLastDeliveredProducts', 'declareProductBeDelivered', 'declareMultipleProductsDelivered','declareProductNotBeDelivered'); - if (in_array($command, $cmdArray)) { - if (!($this->userrights->hasCurrentUserRight('right_supply'))) { - echo "Benutzerrechte nicht ausreichend!"; - return false; - } - } - - // these command are only allowed for user with kitchen or bar rights - $cmdArray = array('declareProductBeCookingOrCooked', 'declareProductNOTBeCooked'); - if (in_array($command, $cmdArray)) { - if (!($this->userrights->hasCurrentUserRight('right_kitchen')) && !($this->userrights->hasCurrentUserRight('right_bar'))) { - echo "Benutzerrechte nicht ausreichend!"; - return false; - } - } - - // these command are only allowed for user with waiter rights - $cmdArray = array('addProductListToQueue', 'removeProductFromQueue', 'getNotPrintedWorkItemsAndDeclareThemPrinted', 'changeTable'); - if (in_array($command, $cmdArray)) { - if (!($this->userrights->hasCurrentUserRight('right_waiter'))) { - echo "Benutzerrechte nicht ausreichend!"; - return false; - } - } - - // these command are only allowed for user with paydesk rights - $cmdArray = array('getJsonProductsOfTableToPay', 'declarePaidCreateBillReturnBillId'); - if (in_array($command, $cmdArray)) { - if (!($this->userrights->hasCurrentUserRight('right_paydesk'))) { - echo json_encode(array("status" => "ERROR", "code" => ERROR_PAYDESK_NOT_AUTHOTRIZED, "msg" => ERROR_PAYDESK_NOT_AUTHOTRIZED_MSG)); - return false; - } - } - - if ($command == 'addProductListToQueue') { - $this->addProductListToQueue($_POST["tableid"],$_POST["prods"]); - } else if ($command == 'kitchenToCook') { - $this->kitchenToCook(); - } else if ($command == 'declareProductBeCookingOrCooked') { - $this->declareProductBeCookingOrCooked($_POST['queueid'],$_POST['action']); - } else if ($command == 'declareProductNotBeCooked') { - $this->declareProductNotBeCooked($_POST['queueid']); - } else if ($command == 'showProductsOfTableToPay') { - $this->showProductsOfTableToPay($_GET['tableid']); - } else if ($command == 'getJsonAllPreparedProducts') { - $this->getJsonAllPreparedProducts(); - } else if ($command == 'declareProductBeDelivered') { - $this->declareProductBeDelivered($_POST['queueid']); - } else if ($command == 'declareMultipleProductsDelivered') { - $this->declareMultipleProductsDelivered($_POST['queueids']); - } else if ($command == 'declareProductNotBeDelivered') { - $this->declareProductNotBeDelivered($_POST['queueid']); - } else if ($command == 'getJsonLongNamesOfProdsForTableNotDelivered') { - $this->getJsonLongNamesOfProdsForTableNotDelivered($_GET["tableid"]); - } else if ($command == 'changeTable') { - $this->changeTable($_POST['fromTableId'],$_POST['toTableId'],$_POST['alsoNotPayed'],$_POST['queueids']); - } else if ($command == 'removeProductFromQueue') { - $this->removeProductFromQueue($_POST["queueid"]); - } else if ($command == 'getJsonAllQueueItemsToMake') { - $this->getJsonAllQueueItemsToMake(intval($_GET["kind"])); - } else if ($command == 'getJsonLastMadeItems') { - $this->getJsonLastMadeItems(intval($_GET["kind"])); - } else if ($command == 'getJsonLastDeliveredProducts') { - $this->getJsonLastDeliveredProducts(); - } else if ($command == 'getJsonProductsOfTableToPay') { - $this->getJsonProductsOfTableToPay($_GET['tableid']); - } else if ($command == 'declarePaidCreateBillReturnBillId') { - $this->declarePaidCreateBillReturnBillId($_POST['ids'],$_POST['html'],$_POST['brutto'],$_POST['netto'],$_POST['tableid'],$_POST['paymentid'],$_POST['tax']); - } else if ($command == 'getNotPrintedWorkItemsAndDeclareThemPrinted') { - $this->getNotPrintedWorkItemsAndDeclareThemPrinted($_GET['tableid']); - } else { - echo "Command not supported."; - } - } - - function getTableNameFromId($tableid) { - $sql = "SELECT tableno FROM " . DB_RESTTABLES_TABLE . " WHERE id=". $tableid; - $dbresult = $this->dbutils->performSqlCommand($sql); - $zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC); - $tablename = $zeile['tableno']; - mysqli_free_result( $dbresult ); - return $tablename; - } - - // needed if paydesk gets the tableid by direct call - function getJsonTableNameFromId($tableid) { - echo json_encode($this->getTableNameFromId($tableid)); - } - - function getDateValueAsBoolInterpretatedIcon($aValue) { - if ($aValue != '0000-00-00 00:00:00' ) { - $imgFile = "ok.png"; - } else { - $imgFile = "wait.png"; - } - return ""; - } - - function getUserName($userid) { - $pdo = $this->dbutils->openDbAndReturnPdo(); - - $sql = "SELECT username FROM %user% WHERE id=?"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($userid)); - $row =$stmt->fetchObject(); - if ($row != null) { - return($row->username); - } else { - return ""; - } - } - - /* - * Get the queue items for the kitchen view that have to be still be cooked - * as a json element array - * - * 1. It is sorted for ordertime - * 2. From this ordertime search for the distinct tables - * 3. Sort it that way that tables are grouped together - * - * $kind=0 -> return only food elements, =1 -> return drinks - */ - private function getJsonAllQueueItemsToMake($kind) { - // current time - date_default_timezone_set('Europe/Berlin'); - $currentTime = date('Y-m-d H:i:s'); - - // first sort all non-ready products ordered by ordertime - $sql = "SELECT DISTINCT %queue%.id as id,tablenr,longname,anoption,tableno,ordertime,cooking FROM %queue%,%products%,%prodtype%,%resttables%,%bill% "; - $sql .= "WHERE (readytime = '0000-00-00 00:00:00' AND "; - $sql .= " ordertime is not null AND "; - $sql .= "%queue%.productid=%products%.id AND "; - $sql .= "%queue%.tablenr = %resttables%.id AND "; - $sql .= "%products%.category=%prodtype%.id AND "; - $sql .= "%prodtype%.kind='$kind' AND "; - $sql .= "%queue%.workprinted='0') "; - - // now remove closed items - $sql .= "AND (%queue%.billid is null OR ("; - $sql .= "%queue%.billid=%bill%.id AND %bill%.closingid is null)) "; - - $sql .= "ORDER BY ordertime"; - $dbresult = $this->dbutils->performSqlCommand($sql); - - $resultarray = array(); - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) - { - $waitTime = round(abs(strtotime($currentTime) - strtotime($zeile['ordertime'])) / 60,0); - $cook = $zeile['cooking']; - if (is_null($cook)) { - $cook = 0; - } - $arr = array("id" => $zeile['id'], - "tablenr" => $zeile['tableno'], - "longname" => $zeile['longname'], - "option" => $zeile['anoption'], - "cooking" => $cook, - "waittime" => $waitTime - ); - $resultarray[] = $arr; - } - mysqli_free_result( $dbresult ); - - $tablearray = array(); - $insertedTables = array(); - $table = (-1); - if (count($resultarray) <> 0) { - for ($queue_index=0;$queue_index < count($resultarray);$queue_index++) { - $aTable = $resultarray[$queue_index]['tablenr']; - if (($table <> $aTable) && !in_array($aTable,$insertedTables)) { - // sort all entries for this table - $table = $aTable; - $maxWaitTime = $resultarray[$queue_index]['waittime']; - $tableArr = array(); - for ($i=0;$i $foundItem['id'], - "longname" => $foundItem['longname'], - "option" => $foundItem['option'], - "cooking" => $this->getUserName($foundItem['cooking']), - "waiticon" => $waitIconMinStep, - "waittime" => $waittimeofentry); - $tableArr[] = $anEntryForThisTable; - } - } - // Now fit max wait time of table to entry wait time steps: - if (($maxWaitTime > 20) && ($maxWaitTime < 60)) { - if ($maxWaitTime >= 50) { - $maxWaitTime = "> 50"; - } else if ($maxWaitTime >= 40) { - $maxWaitTime = "> 40"; - } else if ($maxWaitTime >= 30) { - $maxWaitTime = "> 30"; - } else if ($maxWaitTime >= 25) { - $maxWaitTime = "> 25"; - } else { - $maxWaitTime = "> 20"; - } - } else if ($maxWaitTime <= 1) { - $maxWaitTime = "1"; - } - - $tablearray[] = array("table" => $table, "count" => count($tableArr), "queueitems" => $tableArr, "maxwaittime" => $maxWaitTime); - $insertedTables[] = $aTable; - } - } - } - echo json_encode($tablearray); - } - - /* - * Return in an JSON element declared by kind - product - option all work items that haven't been printed. - * In the next step declare them all printed - */ - private function getNotPrintedWorkItemsAndDeclareThemPrinted($tableid) { - // which elements are not printed yet? - $whereClause = "WHERE "; - $whereClause .= "%queue%.productid=%products%.id AND "; - $whereClause .= "%queue%.tablenr = %resttables%.id AND "; - $whereClause .= "%products%.category=%prodtype%.id AND "; - $whereClause .= "workprinted='0' AND "; - $whereClause .= "ordertime is not null AND "; - $whereClause .= "%resttables%.id='$tableid' AND "; - $whereClause .= "%queue%.readytime = '0000-00-00 00:00:00' AND "; - $whereClause .= "%queue%.cooking is null AND "; - $whereClause .= "%queue%.delivertime = '0000-00-00 00:00:00' "; - - $sql = "SELECT %queue%.id as id,longname,anoption,ordertime,kind FROM %queue%,%products%,%prodtype%,%resttables% "; - $sql .= $whereClause; - $sql .= "ORDER BY ordertime"; - - $dbresult = $this->dbutils->performSqlCommand($sql); - $resultarray = array(); - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) - { - $arr = array("id" => $zeile['id'], - "longname" => $zeile['longname'], - "option" => $zeile['anoption'], - "ordertime" => $zeile['ordertime'], - "kind" => $zeile['kind'] - ); - $resultarray[] = $arr; - } - mysqli_free_result( $dbresult ); - - // then declare them as printed - $sql = "UPDATE %queue%,%products%,%prodtype%,%resttables% SET %queue%.workprinted='1' $whereClause"; - - $dbresult = $this->dbutils->performSqlCommand($sql); - - // return result to print - echo json_encode(array("status" => "OK", "msg" => $resultarray)); - } - - private function getJsonLastMadeItems($kind) { - // first sort all non-ready products ordered by ordertime - $sql = "SELECT DISTINCT %queue%.id as id,tablenr,longname,anoption,tableno,readytime,%products%.id as prodid FROM %queue%,%products%,%prodtype%,%resttables%,%bill% "; - $sql .= "WHERE (readytime <> '0000-00-00 00:00:00' AND "; - $sql .= "delivertime = '0000-00-00 00:00:00' AND "; - $sql .= "ordertime is not null AND "; - $sql .= "%queue%.productid=%products%.id AND "; - $sql .= "%queue%.tablenr = %resttables%.id AND "; - $sql .= "%products%.category=%prodtype%.id AND "; - $sql .= "%prodtype%.kind='$kind' AND "; - $sql .= "%queue%.workprinted='0') "; - - // now remove closed items - $sql .= "AND (%queue%.billid is null OR ("; - $sql .= "%queue%.billid=%bill%.id AND %bill%.closingid is null)) "; - - $sql .= "ORDER BY readytime DESC LIMIT 10;"; - $dbresult = $this->dbutils->performSqlCommand($sql); - - $resultarray = array(); - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) - { - $productid = $zeile['prodid']; - $useConditions = $this->getUseKitchenAndSupplyForProd($productid); - if ($useConditions["usekitchen"] == 1) { - // yes, display it in kitchen view as cooked - $arr = array("id" => $zeile['id'], - "tablename" => $zeile['tableno'], - "longname" => $zeile['longname'], - "option" => $zeile['anoption'], - "readytime" => $zeile['readytime'] - ); - $resultarray[] = $arr; - } - } - mysqli_free_result( $dbresult ); - echo json_encode($resultarray); - } - - /* - * Kitchen can delare a product as being cooked - */ - function declareProductBeCookingOrCooked($queueid,$action) { - if (is_numeric($queueid)) { - $pdo = $this->dbutils->openDbAndReturnPdo(); - $pdo->beginTransaction(); - - // is product already cooking or will it be set to cooking? - $sql = "SELECT cooking,productid FROM %queue% WHERE id=?"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($queueid)); - $row =$stmt->fetchObject(); - if ($row != null) { - $cooking = $row->cooking; - $productid = $row->productid; - - if ($action == 'r') { - // product shall be declared ready - if (is_null($cooking)) { - // a product must be cooking before it can be ready! - $pdo->rollBack(); - echo json_encode(array("status" => "ERROR", "code" => ERROR_DB_PAR_ACCESS, "msg" => ERROR_DB_PAR_ACCESS_MSG)); - } else { - $this->reallyDeclareAsCooked($pdo,$queueid); - $useConditions = $this->getUseKitchenAndSupplyForProd($productid); - if ($useConditions["usesupply"] == 0) { - // can bypass the supplydesk - $this->declareProductBeDeliveredWithGivenPdo($pdo,$queueid); - } - $pdo->commit(); - echo json_encode(array("status" => "OK")); - } - } else if ($action == 'c') { - // product shall be declared as cooking (in progress) - if (!is_null($cooking)) { - // a product must not be cooking before it can becomes cooking - $pdo->rollBack(); - echo json_encode(array("status" => "ERROR", "code" => ERROR_DB_PAR_ACCESS, "msg" => ERROR_DB_PAR_ACCESS_MSG)); - } else { - $userid = $this->getUserId(); - $updSql = "UPDATE %queue% SET cooking=? WHERE id=?"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($updSql)); - $stmt->execute(array($userid,$queueid)); - $pdo->commit(); - echo json_encode(array("status" => "OK")); - } - } - } else { - $pdo->rollBack(); - } - } else { - echo json_encode(array("status" => "ERROR", "code" => ERROR_GENERAL_ID_TYPE, "msg" => ERROR_GENERAL_ID_TYPE_MSG)); - } - } - - private function reallyDeclareAsCooked($pdo,$queueid) { - date_default_timezone_set('Europe/Berlin'); - $readytime = date('Y-m-d H:i:s'); - $insertSql = "UPDATE %queue% SET readytime=? WHERE id=?"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($insertSql)); - $stmt->execute(array($readytime,$queueid)); - } - - /* - * Product is not cooked (undo of kitchen) - */ - function declareProductNotBeCooked($queueid) { - if (is_numeric($queueid)) { - $pdo = $this->dbutils->openDbAndReturnPdo(); - $pdo->beginTransaction(); - - // first: is the product still declared as delivered? - $sql = "SELECT id FROM %queue% WHERE id=? AND readytime <> '0000-00-00 00:00:00'"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($queueid)); - $row =$stmt->fetchObject(); - if ($row != null) { - $foundid = $row->id; - if ($foundid == $queueid) { - $sql = "UPDATE %queue% SET readytime='0000-00-00 00:00:00', cooking=NULL WHERE id=?"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($queueid)); - $pdo->commit(); - echo json_encode(array("status" => "OK")); - } else { - echo json_encode(array("status" => "ERROR", "code" => ERROR_DB_PAR_ACCESS, "msg" => ERROR_DB_PAR_ACCESS_MSG)); - $pdo->rollBack(); - } - } else { - $pdo->rollBack(); - echo json_encode(array("status" => "ERROR", "code" => ERROR_DB_PAR_ACCESS, "msg" => ERROR_DB_PAR_ACCESS_MSG)); - } - } else { - echo json_encode(array("status" => "ERROR", "code" => ERROR_GENERAL_ID_TYPE, "msg" => ERROR_GENERAL_ID_TYPE_MSG)); - } - } - - private function findCategoryOfProd($prodid) { - $sql = "SELECT category FROM %products% WHERE id=$prodid"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC); - $categoryid = $zeile['category']; - mysqli_free_result( $dbresult ); - return $categoryid; - } - - private function getUseKitchenAndSupplyForProdInCat($catid) { - $sql = "SELECT usekitchen, usesupplydesk FROM %prodtype% WHERE id=$catid"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC); - $useKit = $zeile['usekitchen']; - $useSupply = $zeile['usesupplydesk']; - mysqli_free_result( $dbresult ); - return array("usekitchen" => $useKit, "usesupply" => $useSupply); - } - - private function getUseKitchenAndSupplyForProd($prodid) { - $catid = $this->findCategoryOfProd($prodid); - return $this->getUseKitchenAndSupplyForProdInCat($catid); - } - - private function getUseKitchenAndSupplyForProdWithPdo($pdo,$prodid) { - $sql = "SELECT usekitchen, usesupplydesk FROM %prodtype%,%products% WHERE %products%.category=%prodtype%.id AND %products%.id=?"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($prodid)); - $row = $stmt->fetchObject(); - if ($row != null) { - return array("usekitchen" => $row->usekitchen, "usesupply" => $row->usesupplydesk); - } else { - return array("usekitchen" => "1", "usesupply" => "1"); - } - } - - /* - * Add a product list to the queue as if it was ordered by the waiter. - * The ordertime is set by the time that this method is invoked. - * - * If product shall not be run over kitchen or supplydesk this is - * managed here as well - */ - function addProductListToQueue($theTableid,$prods) { - $pdo = $this->dbutils->openDbAndReturnPdo(); - - $pdo->beginTransaction(); - - // get current pricelevel - $currentPriceLevel = $this->commonUtils->getCurrentPriceLevel(); - $currentPriceLevelId = $currentPriceLevel["id"]; - - $i = 0; - for ($i=0;$iprepare($this->dbutils->resolveTablenamesInSqlString($getPriceSql)); - $stmt->execute(array($productid)); - $row = $stmt->fetchObject(); - if ($row == null) { - echo "Fehler: Preise nicht vorhanden"; // error - return; - } - $productname = $row->longname; - $price_for_level_A = $row->priceA; - $price_for_level_B = $row->priceB; - $price_for_level_C = $row->priceC; - - $price = $price_for_level_A; // default - levl 1 - if ($currentPriceLevelId == 2) { - $price = $price_for_level_B; - } else if ($currentPriceLevelId == 3) { - $price = $price_for_level_C; - } // else: use default price A - - if (is_numeric($theTableid) && is_numeric($productid)) { - // first get category of product - $useConditions = $this->getUseKitchenAndSupplyForProdWithPdo($pdo,$productid); - - date_default_timezone_set('Europe/Berlin'); - $ordertime = date('Y-m-d H:i:s'); - - $insertSql = "INSERT INTO `%queue%` ( - `id` , `tablenr`,`productid`,`pricelevel`,`price`,`productname`,`ordertime`,`anoption`,`readytime`,`delivertime`,`paidtime`,`billid`,`toremove`,`cooking`,`workprinted`,`action`) - VALUES ( - NULL , ?,?,?,?,?,?,?, '0000-00-00 00:00:00', '0000-00-00 00:00:00', NULL,NULL,'0',NULL,'0','P');"; - - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($insertSql)); - $stmt->execute(array($theTableid,$productid,$currentPriceLevelId,$price,$productname,$ordertime,$theOption)); - $queueid = $pdo->lastInsertId(); - - if ($useConditions["usekitchen"] == 0) { - // no - can bypass the kitchen - - $this->reallyDeclareAsCooked($pdo,$queueid); - // then also look for supplydesk, since kitchen action won't do this! - if ($useConditions["usesupply"] == 0) { - // can bypass the supplydesk - $this->declareProductBeDelivered($queueid); - // THIS autop declares as "prepared" (cooked)!!! - } - } - } - } - $pdo->commit(); - echo json_encode("OK"); - } - - - /* - * Do as if the product would have been removed from queue - but don't do it exactly, - * because then it would not appear in the reports any more. Instead declare the - * ordertime = null (was never ordered...) - */ - function removeProductFromQueue($queueid) { - if (is_numeric($queueid)) { - $sql = "UPDATE %queue% SET ordertime=null WHERE id=$queueid"; - $dbresult = $this->dbutils->performSqlCommand($sql); - } - } - - /* - * Return as JSON structure all products that are assigned to a specified table, with the - * specification that they are not delivered yet. - * - * ordertime must not be null, because =null means that is is paid but was cancelled later - * by the waiter! (in a previous version such entries were deleted from queue, but then - * they won't appear in reports any more) - * - * Return is: [ - * {"queueid":"2","longname":"EL Greco 1 Person", "isReady":"1"}, - * {"queueid":"5","longname":"Souvlaki","isReady":"0"}] - * (a sample) - * - */ - function getJsonLongNamesOfProdsForTableNotDelivered($tableid) { - if (is_numeric($tableid)) { - $prods = array(); - - $sql = "SELECT DISTINCT %queue%.id as id,longname,anoption,readytime,delivertime,paidtime "; - $sql .= "FROM %queue%,%products%,%bill% "; - $sql .= "WHERE (%queue%.productid = %products%.id "; - $sql .= "AND tablenr=$tableid AND delivertime = '0000-00-00 00:00:00') "; - $sql .= "AND ordertime is not null "; - $sql .= " AND "; - $sql .= "(%queue%.billid is null OR ("; - $sql .= "%queue%.billid=%bill%.id AND %bill%.closingid is null)) "; - $sql .= "ORDER BY ordertime"; - - $dbresult = $this->dbutils->performSqlCommand($sql); - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) { - $isReady = "1"; - $isDelivered = "1"; - $isPaid = "1"; - if ($zeile['readytime'] == '0000-00-00 00:00:00') { - $isReady = "0"; // not yet prepared by the kitchen - } - if ($zeile['paidtime'] == null) { - $isPaid = "0"; // not yet paid - } - $prodEntry = array( - "queueid" => $zeile['id'], - "longname" => $zeile['longname'], - "option" => $zeile['anoption'], - "isready" => $isReady, - "isPaid" => $isPaid); - $prods[] = $prodEntry; - } - mysqli_free_result( $dbresult ); - echo json_encode($prods); - } - } - - - function changeTable($fromTableId, $toTableId, $doAlsoNotPayed,$queueidsNotDelivered) { - $pdo = $this->dbutils->openDbAndReturnPdo(); - $pdo->beginTransaction(); - - $sql = "SELECT DISTINCT %queue%.id as id,longname,anoption,readytime,delivertime,paidtime "; - $sql .= "FROM %queue%,%products%,%bill% "; - - $whereClause = "WHERE (%queue%.productid = %products%.id "; - $whereClause .= "AND tablenr=? AND delivertime = '0000-00-00 00:00:00') "; - $whereClause .= "AND ordertime is not null "; - $whereClause .= " AND "; - $whereClause .= "(%queue%.billid is null OR ("; - $whereClause .= "%queue%.billid=%bill%.id AND %bill%.closingid is null)) "; - - $sql .= $whereClause . "ORDER BY ordertime"; - - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($fromTableId)); - $result = $stmt->fetchAll(); - $queueIdArray = array(); - - foreach($result as $row) { - $queueIdArray[] = $row['id']; - } - - if ($queueIdArray != $queueidsNotDelivered) { - echo json_encode(array("status" => "ERROR", "code" => ERROR_DB_PAR_ACCESS, "msg" => ERROR_DB_PAR_ACCESS_MSG)); - $pdo->rollBack(); - } else { - $sql = "UPDATE %queue%,%products%,%bill% SET %queue%.tablenr = ? "; - $sql .= $whereClause; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($toTableId,$fromTableId)); - - if ($doAlsoNotPayed == 1) { - $sql = "UPDATE %queue%,%products%,%pricelevel% SET %queue%.tablenr=? - WHERE tablenr = ? AND paidtime is null AND toremove <> '1' - AND %queue%.productid = %products%.id - AND %queue%.pricelevel = %pricelevel%.id - AND ordertime is not null"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($toTableId,$fromTableId)); - } - $pdo->commit(); - echo json_encode(array("status" => "OK")); - } - } - - - // ********************************** - // * Kassenfunktionen * - // ********************************** - - function getJsonProductsOfTableToPay($tableid) { - $sql = "SELECT %queue%.id as id,longname,%queue%.price as price,%pricelevel%.name as pricelevelname,%products%.id as prodid - FROM %queue% - INNER JOIN %products% ON %queue%.productid = %products%.id - INNER JOIN %pricelevel% ON %queue%.pricelevel = %pricelevel%.id - WHERE tablenr = $tableid AND paidtime is null AND toremove <> '1' - AND ordertime is not null - ORDER BY ordertime;"; - - $dbresult = $this->dbutils->performSqlCommand($sql); - - $prodsToPay = array(); - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) { - $thePrice = $zeile['price']; - $thePriceLevelName = $zeile['pricelevelname']; - $longName = $zeile['longname']; - $queueid = $zeile['id']; - $prodId = $zeile['prodid']; - $prodsToPay[] = array("id" => $queueid, "prodid" => $prodId, "longname" => $longName, "pricelevelname" => $thePriceLevelName, "price" => $thePrice); - } - mysqli_free_result( $dbresult ); - echo json_encode(array("status" => "OK", "msg" => $prodsToPay)); - } - - // This function gets the items to pay and creates a table, in which these items - // are listed up. It can be used as a receipt to print later - function displayBill($billtableitems,$totalPrice) { - $numberOfItemsToPay = count($billtableitems); - if ($numberOfItemsToPay > 0) { - echo "

"; - echo ""; - for ($i=0;$i < $numberOfItemsToPay; $i++) { - $aProductToPay = $billtableitems[$i]; - echo ""; - echo ""; - } - echo ""; - } - - echo "
Speise/GetränkPreis (Euro)
" . $aProductToPay['textOfButton'] . "" . $aProductToPay['price'] . "
Gesamtpreis: " . $totalPrice . " Euro
"; - } - - // ********************************** - // * Bereitstellung * - // ********************************** - - - function declareProductBeDeliveredWithGivenPdo($pdo,$queueid) { - if (is_numeric($queueid)) { - date_default_timezone_set('Europe/Berlin'); - $delivertime = date('Y-m-d H:i:s'); - - $updateSql = "UPDATE %queue% SET delivertime=? WHERE id=?"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($updateSql)); - $stmt->execute(array($delivertime,$queueid)); - - // then it was probably already prepared - $updateSql = "UPDATE %queue% SET readytime=? WHERE id=?"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($updateSql)); - $stmt->execute(array($delivertime,$queueid)); - } - } - - function declareProductBeDelivered($queueid) { - if (is_numeric($queueid)) { - $pdo = $this->dbutils->openDbAndReturnPdo(); - $pdo->beginTransaction(); - $this->declareProductBeDeliveredWithGivenPdo($pdo, $queueid); - $pdo->commit(); - } - } - - function declareMultipleProductsDelivered($queueids) { - $ids = explode(",",$queueids); - - $pdo = $this->dbutils->openDbAndReturnPdo(); - $pdo->beginTransaction(); - - for ($i=0;$i < count($ids); $i++) { - $aQueueId = $ids[$i]; - if (is_numeric($aQueueId)) { - $this->declareProductBeDeliveredWithGivenPdo($pdo,$aQueueId); - } - } - $pdo->commit(); - } - - function declareProductNotBeDelivered($queueid) { - if (is_numeric($queueid)) { - date_default_timezone_set('Europe/Berlin'); - $delivertime = date('Y-m-d H:i:s'); - $updateSql = "UPDATE %queue% SET delivertime='0000-00-00 00:00:00' WHERE id='" . $queueid . "';"; - $dbresult = $this->dbutils->performSqlCommand($updateSql); - } - } - - private function getAllPreparedProductsForTableidAsArray($tableid) { - $sql = "SELECT DISTINCT %queue%.id as id,tableno,longname,anoption,readytime "; - $sql = $sql . "FROM %queue%,%products%,%resttables%,%bill% "; - $sql = $sql . "WHERE (readytime <> '0000-00-00 00:00:00' and delivertime = '0000-00-00 00:00:00' "; - $sql = $sql . "AND %queue%.productid=%products%.id "; - $sql = $sql . "AND %queue%.tablenr=%resttables%.id "; - $sql = $sql . "AND %resttables%.id=" . $tableid . " "; - $sql = $sql . "AND toremove <> '1') "; - - // now remove closed items - $sql .= "AND (%queue%.billid is null OR ("; - $sql .= "%queue%.billid=%bill%.id AND %bill%.closingid is null)) "; - - $sql = $sql . " ORDER BY tableno"; - - $dbresult = $this->dbutils->performSqlCommand($sql); - - // create a table that is optimal (sqrt-like size) - $numberOfIcons = mysqli_num_rows($dbresult); - $arrayOfProdsForTable = array(); - $idsProdsOfTable = ''; // this is a hack! All queueids of a table redundant for "Deliver all" - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) { - $theAction= "deliver"; - $longname = $zeile['longname']; - $anProdElem = array( - "id" => $zeile['id'], - "longname" => $zeile['longname'], - "option" => $zeile['anoption'], - "status" => "ready_to_deliver"); - $arrayOfProdsForTable[] = $anProdElem; - if ($idsProdsOfTable == '') { - $idsProdsOfTable = $idsProdsOfTable . $zeile['id']; - } else { - $idsProdsOfTable = $idsProdsOfTable . ',' . $zeile['id']; - } - } - mysqli_free_result( $dbresult ); - return array("prods" => $arrayOfProdsForTable, "ids" => $idsProdsOfTable); - } - - // total number of products for table - // can later be used for color indication if products can be delivered completly for a table - private function numberOfProductsForTableNotDelivered($tableid) { - $sql = "SELECT %queue%.id as id "; - $sql = $sql . "FROM %queue%,%resttables% "; - $sql = $sql . "WHERE delivertime = '0000-00-00 00:00:00' "; - $sql = $sql . "AND %queue%.tablenr=%resttables%.id "; - $sql = $sql . "AND toremove <> '1' "; - $sql = $sql . "AND %resttables%.id=" . $tableid; - - $dbresult = $this->dbutils->performSqlCommand($sql); - $numberOfProducts = mysqli_num_rows($dbresult); - - mysqli_free_result( $dbresult ); - return $numberOfProducts; - } - - function getJsonAllPreparedProducts() { - // find out the tables that are relevant - $sql = "SELECT DISTINCT tablenr "; - $sql .= "FROM %queue%,%resttables%,%bill% "; - $sql .= "WHERE (readytime <> '0000-00-00 00:00:00' and delivertime = '0000-00-00 00:00:00' "; - $sql .= "AND toremove <> '1' "; - $sql .= "AND %queue%.tablenr=%resttables%.id AND "; - $sql .= "ordertime is not null AND "; - $sql .= "%queue%.workprinted='0') "; - - // now remove closed items - $sql .= "AND (%queue%.billid is null OR ("; - $sql .= "%queue%.billid=%bill%.id AND %bill%.closingid is null)) "; - - $sql .= " ORDER BY tableno"; - $dbresult = $this->dbutils->performSqlCommand($sql); - $tablesToServe = array(); - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) { - $tablesToServe[] = $zeile['tablenr']; - } - mysqli_free_result( $dbresult ); - - // to sort complete prepared tables use two arrays: - $preparedProds_incomplete_tables = array(); - $preparedProds = array(); - - $commonUtils = new CommonUtils(); - foreach ($tablesToServe as $tableid) { - $arrayOfProdsAndIdsOfATable = $this->getAllPreparedProductsForTableidAsArray($tableid); - $arrayOfProdsOfATable = $arrayOfProdsAndIdsOfATable['prods']; - $numberOfProductsTotalToServe = $this->numberOfProductsForTableNotDelivered($tableid); - $numberOfReadyProducts = count($arrayOfProdsOfATable); - - if ($numberOfReadyProducts >= $numberOfProductsTotalToServe) { - $tablestatus = "complete"; - $tableheadeline = "Tisch: " . $commonUtils->getTableNameFromId($tableid); - $preparedProds[] = array( - "tableheadline" => $tableheadeline, - "tableid" => $tableid, - "tablestatus" => $tablestatus, - "ids" => $arrayOfProdsAndIdsOfATable['ids'], - "prodsOfTable" => $arrayOfProdsOfATable); - } else { - $tablestatus = "incomplete"; - $tableheadeline = "Tisch: " . $commonUtils->getTableNameFromId($tableid); - $preparedProds_incomplete_tables[] = array( - "tableheadline" => $tableheadeline, - "tableid" => $tableid, - "tablestatus" => $tablestatus, - "ids" => $arrayOfProdsAndIdsOfATable['ids'], - "prodsOfTable" => $arrayOfProdsOfATable); - } - } - - echo json_encode(array_merge($preparedProds,$preparedProds_incomplete_tables)); - } - - /* - * Return as JSON object a list of max 10 entries of products that - * have been delivered to a table - */ - function getJsonLastDeliveredProducts() { - $sql = "SELECT DISTINCT %queue%.id as id,tableno,longname,delivertime,anoption,%products%.id as prodid "; - $sql .= "FROM %queue%,%resttables%,%products%,%bill% "; - $sql .= "WHERE (delivertime <> '0000-00-00 00:00:00' "; - $sql .= "AND %queue%.productid=%products%.id "; - $sql .= "AND %queue%.tablenr=%resttables%.id "; - $sql .= "AND toremove <> '1' AND "; - $sql .= "ordertime is not null AND "; - $sql .= "%queue%.workprinted='0') "; - - // now remove closed items - $sql .= "AND (%queue%.billid is null OR ("; - $sql .= "%queue%.billid=%bill%.id AND %bill%.closingid is null)) "; - - $sql = $sql . "ORDER BY delivertime DESC LIMIT 10"; - $dbresult = $this->dbutils->performSqlCommand($sql); - - $lastDeliveredProds = array(); - while ($zeile = mysqli_fetch_array( $dbresult, MYSQL_ASSOC)) { - $productid = $zeile['prodid']; - $useConditions = $this->getUseKitchenAndSupplyForProd($productid); - if ($useConditions["usesupply"] == 1) { - // yes, display it in supplydesk view as cooked - $deliveredProd = array( - "id" => $zeile['id'], - "longname" => $zeile['longname'], - "option" => $zeile['anoption'], - "delivertime" => $zeile['delivertime'], - "tablename" => $zeile['tableno']); - $lastDeliveredProds[] = $deliveredProd; - } - } - mysqli_free_result( $dbresult ); - echo json_encode($lastDeliveredProds); - } - - - // ********************************** - // * Kasse * - // ********************************** - - /* - * Test if all queue items with the given ids are not paid - * -> if there are paid items --> report error by return negative value - * - * Set paid column with the given date - * Create bill - * Return a bill id - */ - function declarePaidCreateBillReturnBillId($ids,$html,$brutto,$netto,$tableid,$paymentId,$tax) { - - $userid = $this->getUserId(); - - $ids_array = explode ( ',', $ids ); - - $pdo = $this->dbutils->openDbAndReturnPdo(); - $pdo->beginTransaction(); - - // check if all items are not paid yet! - $allNotPaid = true; - for ($i=0;$iprepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($anId)); - $row =$stmt->fetchObject(); - if ($row != null) { - $aCount = $row->countid; - if (($aCount != null) && ($aCount == 1)) { - $allNotPaid = false; - } - } - } - } - - // current time - date_default_timezone_set('Europe/Berlin'); - $currentTime = date('Y-m-d H:i:s'); - - $billid = (-1); - if ($allNotPaid == true) { - $billid = -1; - - // find highest bill id - $sql = "SELECT id from %bill% ORDER BY id DESC"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(); - $numberOfIds = $stmt->rowCount(); - - if ($numberOfIds > 0) { - $row =$stmt->fetchObject(); - if ($row != null) { - $billid = intval($row->id)+1; - } else { - echo " - row ist null - "; - $pdo->rollBack(); - return; - } - } else { - $billid = 1; - } - - $html = $this->dbutils->filterString($html); - $brutto = $this->dbutils->filterString($brutto); - $tableid = $this->dbutils->filterString($tableid); - $billInsertSql = "INSERT INTO `%bill%` (`id` , `billdate`,`content`,`brutto`,`netto`,`tableid`,`paymentid`,`userid`,`ref`,`tax`) VALUES (?,?,?,?,?,?,?,?,NULL,?)"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($billInsertSql)); - $stmt->execute(array($billid,$currentTime,$html,$brutto,$netto,$tableid,$paymentId,$userid,$tax)); - - // now declare them all to be paid: - for ($i=0;$iprepare($this->dbutils->resolveTablenamesInSqlString($updateSql)); - $stmt->execute(array($currentTime,$billid,$queueid)); - - $billProdsSql = "INSERT INTO `%billproducts%` (`queueid`,`billid`) VALUES ( ?,?)"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($billProdsSql)); - $stmt->execute(array($queueid,$billid)); - } - } - } - $pdo->commit(); - - $billInfo = array("billid" => $billid, "date" => $currentTime); - - echo json_encode(array("status" => "OK", "msg" => $billInfo)); - } - - private function getUserId() { - if(session_id() == '') { - session_start(); - } - return $_SESSION['userid']; - } -} - -?> \ No newline at end of file diff --git a/php/utilities/TypeAndProducts/ProductEntry.php b/php/utilities/TypeAndProducts/ProductEntry.php deleted file mode 100644 index 70b4d69..0000000 --- a/php/utilities/TypeAndProducts/ProductEntry.php +++ /dev/null @@ -1,74 +0,0 @@ - probably two prices - $otherPrices = $priceparts[1]; - // are there level 2&3 or only 2? - $otherPriceParts = explode(';', $otherPrices, 2); - $price_level_B = trim(floatval($otherPriceParts[0])); - if (count($otherPriceParts) == 1) { - $numberOfPrices = 2; - } else if (count($otherPriceParts) == 2) { - $price_level_C = trim(floatval($otherPriceParts[1])); - $numberOfPrices = 3; - } else { - // undefined - $numberOfPrices = 1; // fall back to default - } - } - - $parts = explode(';', $priceparts[0], 3); - $this->shortName = trim($parts[0]); - $this->priceA = trim(floatval($parts[1])); - // default: all the same price - $this->priceB = $this->priceA; - $this->priceC = $this->priceA; - if ($numberOfPrices == 2) { - $this->priceB = $price_level_B; // A = C, only B is different - } else if ($numberOfPrices == 3) { - $this->priceB = $price_level_B; - $this->priceC = $price_level_C; - } - - if (count($parts) < 3) { - // in this case the button name is the same as the name on the bill - $this->longName = $this->shortName; - } else { - $this->longName = trim($parts[2]); - } - } - - function getShortName() { - return $this->shortName; - } - function getPriceA() { - return $this->priceA; - } - function getPriceB() { - return $this->priceB; - } - function getPriceC() { - return $this->priceC; - } - function getLongName() { - return $this->longName; - } - - function toString() { - return "S:" . $this->shortName . " PA:" . $this->priceA . " PB:" . $this->priceB . " PC:" . $this->priceC . " R:" . $this->longName; - } -} \ No newline at end of file diff --git a/php/utilities/userrights.php b/php/utilities/userrights.php deleted file mode 100644 index 2835b26..0000000 --- a/php/utilities/userrights.php +++ /dev/null @@ -1,54 +0,0 @@ - \ No newline at end of file diff --git a/preferences.html b/preferences.html deleted file mode 100644 index 8c0655c..0000000 --- a/preferences.html +++ /dev/null @@ -1,161 +0,0 @@ - - - Ansicht persnliche Einstellungen - - - - - - - - - - - - - - - - - - - - - -
-
-
    -
  • Module
  • -
-
- -
-

Persnliche Einstellungen fr

-
- Module -
-
-
- -
-

Passwort

-
- Altes Passwort:
- Neues Passwort:
- -
-
- -
-

Orderton

- - -
- -
-
-
-
-
-
-
- -
-
-

Passwordnderung

-
- -
-

Das Passwort wurde gendert.

-
-
- -
-
-

Passwordnderung

-
- -
-

Das Passwort konnte nicht gendert werden. Bitte prfen Sie, ob das alte Passwort korrekt eingegeben wurde.

-
-
-
- - - \ No newline at end of file diff --git a/printserver/OrderSprinterPrintserver.exe b/printserver/OrderSprinterPrintserver.exe new file mode 100644 index 0000000..8323cc7 Binary files /dev/null and b/printserver/OrderSprinterPrintserver.exe differ diff --git a/products.html b/products.html deleted file mode 100644 index 10f0718..0000000 --- a/products.html +++ /dev/null @@ -1,629 +0,0 @@ - - - - - Ansicht Produkte - - - - - - - - - - - - - - - - - -
-
-
    -
  • Module
  • -
-
-
-

Angebot

-
- Module -
-
-
-
- -
-
-
-
-
-
-
-
-
- - - - diff --git a/reports.html b/reports.html deleted file mode 100644 index 3e1dddf..0000000 --- a/reports.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Ansicht Statistik - - - - - - - - - - - - - - - - - -
-
-
    -
  • Module
  • -
-
-
-

Statistik

-
- Module -
-
-
-

Kein Inhalt

-
-
-
-
-
-
-
-
- - - \ No newline at end of file diff --git a/utilities.js b/utilities.js deleted file mode 100644 index 7c1f656..0000000 --- a/utilities.js +++ /dev/null @@ -1,101 +0,0 @@ -function initializeMainMenu(menuid) { - $.ajax({ type: "GET", - dataType: "json", - url: "php/contenthandler.php?module=admin&command=getJsonMenuItemsAndVersion", - async: false, - success : function(moduleEntries) - { - $("#loggedinuser").html(moduleEntries.user); - $("#versioninfo").html("v" + moduleEntries.version); - var li='
  • Module
  • '; - $.each(moduleEntries.menu, function (i, module) { - var name = module.name; - var link = module.link; - if (name != "Abmelden") { - li += '
  • ' + name + '
  • '; - } else { - li += '
  • ' + name + '
  • '; - } - }); - $(menuid).empty().append(li).promise().done(function () { - $(menuid).listview("refresh"); - }) - }, - error: function( text ) { - alert( "Kommunikationsproblem zum Server bei Modulabfrage!" ); - } - }); - - $(".modulebutton").off("click").on("click", function (e) { - var view = $(this).attr("href"); - doAjax("POST","php/contenthandler.php?module=admin&command=setLastModuleOfUser", - { view: view}, null, "Problem Benutzerdatenpflege"); - }); -} - -function hideMenu() { - $( "#modulepanel" ).panel( "close" ); - $("#menuswitch").off("click").on("click", function (e) { - $("#menuswitch").trigger("mouseout"); - e.stopImmediatePropagation(); - e.preventDefault(); - $( "#modulepanel" ).panel( "open" );; - }); -} - -// to make IE happy... -function refreshList(selector) { - if ( $(selector).hasClass('ui-listview')) { - $(selector).listview('refresh'); - } else { - $(selector).trigger('create'); - } -} - -function doAjax(getOrPost,url,data,functionToCallIfSuccess,errorMsg) { - $.ajax({ type: getOrPost, - url: url, - dataType: "json", - data: data, - async: false, - success : function(jsonContent) - { - if (functionToCallIfSuccess != null) { - functionToCallIfSuccess(jsonContent); - } - }, - error: function( text ) { - if (errorMsg != null) { - alert( "Kommunikationsfehler zum Server: " + errorMsg); - } - } - }); -} - -function doAjaxSuppressError(getOrPost,url,data,functionToCallIfSuccess,errorMsg) { - $.ajax({ type: getOrPost, - url: url, - dataType: "json", - data: data, - async: false, - success : function(jsonContent) - { - if (functionToCallIfSuccess != null) { - functionToCallIfSuccess(jsonContent); - } - }, - error: function( text ) { - functionToCallIfSuccess("ERROR"); - } - }); -} -function doAjaxNonJsonNonCall(getOrPost,url,data) { - $.ajax({ type: getOrPost, - data : data, - url: url, - async: false, - error: function( text ) { - alert( "Kommunikationsproblem zum Server" ); - } - }); -} \ No newline at end of file diff --git a/waiter.html b/waiter.html deleted file mode 100644 index 80d919b..0000000 --- a/waiter.html +++ /dev/null @@ -1,945 +0,0 @@ - - - Ansicht Kellner - - - - - - - - - - - - - - - - -
    -
    -
      -
    • Module
    • -
    -
    -
    -

    Raum-Tisch

    -
    - Module -
    -
    -
    -
      -
    • Rume
    • -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
      -
    • Module
    • -
    -
    -
      -

    Tischauswahl

    -
    - Module -
    -
    -
    -
      -
    • Tische
    • -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
      -
    • Module
    • -
    -
    -
      -

    Produktauswahl

    -
    - Module -
    -
    -
    -
      -
    • Auswahl
    • -
    - - - - - - - - - - - -
      -
    • Neue Produkte
    • -
    - -
      -
    • Kche/Bar
    • -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    - - -
    -
    -

    ?

    -

    ?

    - Ja - Nein -
    -
    - - -
    -
    -

    ?

    -

    -

    -
      - -
    -
    -

    - Abbrechen -
    -
    - -
    -
    -

    Auswahl der Orderelemente

    -

    Welche Orderelemente sollen dem neuen Tisch zugewiesen werden? -

    -

    - Zurck -
    -
    - - - \ No newline at end of file diff --git a/OrderSprinter-LIZENZ.html b/webapp/OrderSprinter-LIZENZ.html similarity index 100% rename from OrderSprinter-LIZENZ.html rename to webapp/OrderSprinter-LIZENZ.html diff --git a/webapp/OrderSprinterPrintserver.exe b/webapp/OrderSprinterPrintserver.exe new file mode 100644 index 0000000..8323cc7 Binary files /dev/null and b/webapp/OrderSprinterPrintserver.exe differ diff --git a/auth.php b/webapp/auth.php similarity index 100% rename from auth.php rename to webapp/auth.php diff --git a/bar.html b/webapp/bar.html similarity index 90% rename from bar.html rename to webapp/bar.html index b1d09f7..67c6800 100644 --- a/bar.html +++ b/webapp/bar.html @@ -2,7 +2,7 @@ Ansicht Bar - + @@ -52,12 +52,17 @@ @@ -98,7 +107,7 @@ $(document).on("pageinit", "#bar-page", function () {
  • Module
  • -
    +

    Bar

    Module @@ -106,15 +115,15 @@ $(document).on("pageinit", "#bar-page", function () {
    -
    +
    -
    +
    - +
    \ No newline at end of file diff --git a/webapp/bill.html b/webapp/bill.html new file mode 100644 index 0000000..4110919 --- /dev/null +++ b/webapp/bill.html @@ -0,0 +1,396 @@ + + + Ansicht Kassenbons + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
      +
    • Module
    • +
    +
    +
    +

    Kassenbons

    +
    + Module +
    +
    +
    + +
    + + +
    + + Aktualisieren +

    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +

    Storno fehlgeschlagen

    +
    + +
    +

    Der Stornovorgang ist fehlgeschlagen. Die wahrscheinlichste Ursache ist ein Tagesabschluss, der den zu + stornierenden Bon einschließt. In diesem Fall darf der Bon rückwirkend nicht mehr annuliert werden.

    +
    +
    + +
    + + +
    +
    +

    ?

    +

    ?

    +
    + + + Ja + Nein +
    +
    +
    + + + \ No newline at end of file diff --git a/css/bestformat.css b/webapp/css/bestformat.css similarity index 54% rename from css/bestformat.css rename to webapp/css/bestformat.css index 8184417..d623e60 100644 --- a/css/bestformat.css +++ b/webapp/css/bestformat.css @@ -48,8 +48,6 @@ table.viewtable tr:hover td { } - - table.receipttable td { border: solid black 0px; padding: 3px; @@ -300,4 +298,258 @@ table.billtable #totalprice { .userinfo { font-style: italic; +} + + + +.counting { + position: absolute; + top: 0px; bottom: 0px; right: 90px; + width: 80px; + border: 0; + background-color: rgb(246, 246, 246, 0.0) !important; +} + +.counting:hover { + background-color: rgb(0,255,0); +} + +.goup { + position: absolute; + top: 5px; bottom: 0px; right: 90px; + border: 0; + background-color: rgb(246, 246, 246) !important; +} + +.osroom-1 { + height: 40px !important; +} +.osroom-2 { + height: 70px !important; +} +.ostable-1 { + height: 40px !important; +} +.ostable-2 { + height: 70px !important; +} +.osprod-1 { + height: 40px !important; +} +.osprod-2 { + height: 70px !important; +} +.osbigbtn.ui-btn { + height: 40px !important; + text-align: center; + line-height:30px; +} + + +table.prodtable { + font-family: verdana,arial,sans-serif; + font-size:20px; + color:#333333; + border-width: 1px; + border-color: #666666; + border-collapse: collapse; + width: 70%; +} +table.prodtable th { + border-width: 1px; + padding: 8px; + border-style: solid; + border-color: #666666; + background-color: OrangeRed; + font-weight:bold; +} + +table.prodtable .prodtype td{ + background-color: DarkGreen; +} +table.prodtable tr > td:first-child { + text-align:left; +} +table.prodtable td { + border-width: 1px; + padding: 8px; + border-style: solid; + border-color: #666666; + background-color: LimeGreen; + text-align:right; + font-weight:bold; + white-space:nowrap; + max-width:50%; + word-break:break-all; +} +table.prodtable input { + line-height:30px; + background-color: PaleGreen; + font-weight:bold; +} +table.prodtable select { + background-color: PaleGreen; + font-weight:bold; + width: 100%; +} + +table.prodtable option.yes { + background-color: green; +} +table.prodtable option.no { + background-color: red; +} +table.prodtable .prodpriceA { + width: 50px; + text-align: right; +} +table.prodtable .prodpriceB { + width: 50px; + text-align: right; +} +table.prodtable .prodpriceC { + width: 50px; + text-align: right; +} + +.prodinfo,.srinfo { + position: absolute; + top: 0px; bottom: 0px; right: 20px; + width: 20px; + border: 0; + background-color: rgb(246, 246, 246, 0.0) !important; +} + +.waitinfo { + position: absolute; + top: 0px; bottom: 0px; right: 20px; + border: 0; + background-color: rgb(246, 246, 246, 0.0) !important; +} +.waitinfo img { + position: absolute; + top: 0px; bottom: 0px; right: 20px; + height: 35px; + border: 0; + background-color: rgb(246, 246, 246, 0.0) !important; +} + +.typehigher { + position: absolute; + top: 0px; bottom: 0px; right: 40px; + border: 0; + background-color: rgb(246, 246, 246, 0.0) !important; +} +.typetop { + position: absolute; + top: 0px; bottom: 0px; left: 40px; + border: 0; + background-color: rgb(246, 246, 246, 0.0) !important; +} + +.prodminus,.srminus { + position: absolute; + top: 0px; bottom: 0px; right: 130px; + width: 20px; + border: 0; + background-color: rgb(246, 246, 246, 0.0) !important; +} + +.prodcount,.srprodcount { + position: absolute; + top: 10px; bottom: 0px; right: 95px; + width: 20px; + border: 0; + background-color: rgb(246, 246, 246, 0.0) !important; +} + +.prodplus,.srplus { + position: absolute; + top: 0px; bottom: 0px; right: 60px; + height: 20px; + border: 0; + background-color: rgb(246, 246, 246, 0.0) !important; +} + +.prodplus img { + width: 30px; +} +.prodminus img { + width: 30px; +} +.srplus img { + width: 30px; +} +.srminus img { + width: 30px; +} + +.srminus:hover, .prodminus:hover{ + height: 40px; + width: 30px; + background-color: rgb(0, 255, 0); +} +.srplus:hover, .prodplus:hover{ + height: 40px; + width: 30px; + background-color: rgb(0, 255, 0); +} +.prodinfo img:hover,.srinfo img:hover { + background-color: rgb(0, 255, 0); +} + +.tbusy { + color:black !important; + font-weight:bold; + font-style: italic; +} +.tempty { + color:gray !important; + color:gray !important; + font-weight:normal; +} + +.overlaytxt { + background: linear-gradient(red, yellow); + color: black; font-weight: bold; + border-radius: 25px; + border: 3px solid #000000; + padding: 8px; +} + +.overlayfull { + background: linear-gradient(red, yellow); +} +.overlayempty { + background: linear-gradient(green, yellow); +} +.overlaysize-0 { + font-size: 7px; +} +.overlaysize-1 { + font-size: 12px; +} +.overlaysize-2 { + font-size: 15px; +} + +.prodreadyicon { + position: absolute; + top: 0px; bottom: 0px; right: 70px; + height: 20px; + border: 0; + background-color: rgb(246, 246, 246, 0.0) !important; +} + +.prodreadyicon:hover { + height: 40px; + background-color: rgb(0, 255, 0); +} + +.prodreadycount { + position: absolute; + top: 10px; bottom: 0px; right: 40px; + width: 20px; + border: 0; + background-color: rgb(246, 246, 246, 0.0) !important; } \ No newline at end of file diff --git a/webapp/customer/aussenraum.png b/webapp/customer/aussenraum.png new file mode 100644 index 0000000..c124fb3 Binary files /dev/null and b/webapp/customer/aussenraum.png differ diff --git a/customer/bon-bewirtungsvorlage.html b/webapp/customer/bon-bewirtungsvorlage.html similarity index 100% rename from customer/bon-bewirtungsvorlage.html rename to webapp/customer/bon-bewirtungsvorlage.html diff --git a/webapp/customer/innenraum.png b/webapp/customer/innenraum.png new file mode 100644 index 0000000..f508376 Binary files /dev/null and b/webapp/customer/innenraum.png differ diff --git a/webapp/customer/logo.png b/webapp/customer/logo.png new file mode 100644 index 0000000..f1b66f8 Binary files /dev/null and b/webapp/customer/logo.png differ diff --git a/webapp/customer/menulegend.txt b/webapp/customer/menulegend.txt new file mode 100755 index 0000000..6d825a1 --- /dev/null +++ b/webapp/customer/menulegend.txt @@ -0,0 +1,56 @@ +# ***** Diese Speisekarte hat ein bestimmtes Format. **** +# ***** Das Format, insbesondere die Einrückungen, müssen **** +# ***** genau eingehalten werden, damit der Inhalt korrekt **** +# ***** übernommen werden kann. **** +# +# Einrückungen bauen die Produktpalette hierarchisch auf +# Die tiefsten Einrückungen stellen die Produkte dar, alle +# Ebenen darüber die Kategorien +# +# Die einfachste Struktur sieht wie folgt aus (Beispiel): +# +# Speisen +# Gericht 1 ; 2,90 +# Gericht 2 ; 3,90 +# Untergruppe xy +# Gericht 3 ; 2,90 +# Getränke +# ... +# +# Kategorien und Produkte können zusätzlich noch weiter spezifiziert +# werden: +# +# Ein Produkteintrag hat folgendes Format: +# Kurzname (ID:123); NormalPreis (Stufe A); Langname # Preis (Stufe B); Preis (Stufe C); Steuersatz +# dabei ist der Kurzname nur in der Kellneransicht zu sehen +# Nur Kurzname und Preis (A) sind erforderlich, die anderen Teile werden bei +# Auslassung automatisch gefüllt (Preis B=C=A und Langname = Kurzname) +# Die ID ist muss nicht angegeben werden, in dem Fall wird das Produkt als +# neu anzulegendes Produkt behandelt. +# Wird ein Steuersatz angegeben, der für das Produkt vorgegeben sein soll, so +# müssen auch die Preise A und B angegeben werden. +# +# Bei Kategorien: +# Das Gleichheitszeichen dient als Trenner zwischen Namen und weiteren Eigenschaften. +# Wird ein K und B mitgegeben, so werden diese Produkte über die Küchen- +# und Bereitstellungsansicht geführt. Die Einstellung wird auf die Unterkategorien +# vererbt, wenn die darunter liegenden Kategorien keine Angabe dazu machen. +# Hinter dem zweiten Gleichheitszeichen kann die Nummer eines Arbeitsbondruckers +# des jeweiligen Typs (Speise/Getränk) angegeben werden. +# +# Wenn ein D da steht, wird als Typ "Getränk" angenommen, bei einem F "Speise". +# Auch hier wird der übergeordnete Eintrag genommen, wenn Angabe fehlt. +# +# Extras werden mit einem Ausrufezeichen am Zeilenanfang deklariert. +# Das Format ist: +# !Extraname (ID:8) # 12,34 ; (45),Langname eines Produkts,(49),(50) +# - Die ID-Angabe ist optional (kann weggelassen werden) +# - Der Wert 12,34 ist der Aufpreis +# - Hinter dem Semikolo können Komma-getrennt Produte angegebenen werden, die +# dieses Extra haben dürfen. Angabe entweder ID des Produkts in Klammern oder +# der Langname eines Produkts. (Gibt es den Langnamen mehrfach, wird das Extra +# auch mehrfach zugewiesen.) +# +# Reservierte Buchstaben: = ; # ! +# (Diese werden als Trenner verwendet!) +# diff --git a/webapp/customer/ping.mp3 b/webapp/customer/ping.mp3 new file mode 100644 index 0000000..0d05ffd Binary files /dev/null and b/webapp/customer/ping.mp3 differ diff --git a/webapp/customer/pong.mp3 b/webapp/customer/pong.mp3 new file mode 100644 index 0000000..2b60e28 Binary files /dev/null and b/webapp/customer/pong.mp3 differ diff --git a/webapp/customer/speisekarte.txt b/webapp/customer/speisekarte.txt new file mode 100755 index 0000000..650d617 --- /dev/null +++ b/webapp/customer/speisekarte.txt @@ -0,0 +1,98 @@ +# ***** Diese Speisekarte kann als Vorlage dienen. **** +# +# Einrückungen bauen die Produktpalette hierarchisch auf +# Die tiefsten Einrückungen stellen die Produkte dar, alle +# Ebenen darüber die Kategorien +# +# Ein Produkteintrag hat folgendes Format: +# Kurzname ; NormalPreis (Stufe A); Langname # Preis (Stufe B); Preis (Stufe C) +# dabei ist der Kurzname nur in der Kellneransicht zu sehen +# Nur Kurzname und Preis (A) sind erforderlich, die anderen Teile werden bei +# Auslassung automatisch gefüllt (Preis B=C=A und Langname = Kurzname) +# Wird ein Steuersatz angegeben, der für das Produkt vorgegeben sein soll, so +# müssen auch die Preise A und B angegeben werden. +# +# Bei Kategorien: +# Das Gleichheitszeichen dient als Trenner zwischen Namen und weiteren Eigenschaften. +# Wird ein K und B mitgegeben, so werden diese Produkte über die Küchen- +# und Bereitstellungsansicht geführt. Die Einstellung wird auf die Unterkategorien +# vererbt, wenn die darunter liegenden Kategorien keine Angabe dazu machen. +# Hinter dem zweiten Gleichheitszeichen kann die Nummer eines Arbeitsbondruckers +# des jeweiligen Typs (Speise/Getränk) angegeben werden. +# +# Wenn ein D da steht, wird als Typ "Getränk" angenommen, bei einem F "Speise". +# Auch hier wird der übergeordnete Eintrag genommen, wenn Angabe fehlt. +# +# Extras werden mit einem Ausrufezeichen am Zeilenanfang deklariert. +# Das Format ist: +# !Extraname (ID:8) # 12,34 ; (45),Langname eines Produkts,(49),(50) +# - Die ID-Angabe ist optional (kann weggelassen werden) +# - Der Wert 12,34 ist der Aufpreis +# - Hinter dem Semikolo können Komma-getrennt Produte angegebenen werden, die +# dieses Extra haben dürfen. Angabe entweder ID des Produkts in Klammern oder +# der Langname eines Produkts. (Gibt es den Langnamen mehrfach, wird das Extra +# auch mehrfach zugewiesen.) +# +# Reservierte Buchstaben: = ; # ! +# (Diese werden als Trenner verwendet!) +# +Speisen = KBF + Fastfood + Pommes ; 3,00 + Schnitzel ; 4,00 + Vom Grill + El Greco 2P; 26{.}90; EL Greco 2 Personen # 20{.}90; 13{.}80 + El Greco 1P; 14{.}80; EL Greco 1 Person + Fleisch-Gerichte + Lammkotelett; 13{.}50; Lammkotelett # 11{.}30; 6{.}00 + Zigeuner/Jägerschnitzel; 10{.}50 # 9{.}80; 3{.}50 + Suzukakia 4H; 10{.}50; Suzukakia 4 Hacksteaks + Suzukakia 2H; 10{.}50; Suzukakia 2 Hacksteaks + Souvlaki; 10{.}50 + Italienische Küche + Pizza + Siciliana + klein; 7{.}50; Pizza Siciliana klein + groß; 7{.}50; Pizza Siciliana groß + Salami + klein; 6{.}20; Pizza Salami klein + groß; 7{.}80; Pizza Salami groß + Special; 6{.}90; Ital. Tagesspecial + Kategorie Selbstbedienung = + Frühstücksbuffet; 8{.}90 + Frühstücksbuffet + Kaffe; 12{.}20 + Kategorie vorbereitet = B + Deserts; 2{.}20 + Fertigprodukte; 1{.}20 + Kategorie Nur Küche = K + Tischzubereitung Fisch; 2{.}20 + Tischzubereitung Fleischmenü; 1{.}20 +Getränke = KBD + Kaffee + Cappuchino ; 2,50 + Tasse Kaffee ; 3,00 + Becher Kaffee ; 3,50 + Latte Macchiato ; 3,00 + Biere + Holsten; 1{.}60 # 1{.}00; 0{.}80 + Warsteiner; 1{.}80 # 1{.}20 + Becks Gold; 1{.}80 + Alsterwasser; 1{.}50 + Softdrinks + Coca-Cola; 2{.}50 + Fanta; 2{.}50 + Ohne Zucker = B + Cola Zero; 2{.}21 + Sprite; 2{.}50 + Eistee; 1{.}60 + Wasser + Apollinaris; 2{.}20 + still; 1{.}20; Stilles Wasser + Weine + Lambrusco; 7{.}00; Wein Lambrusco +# +# Es folgen die Extras +!Sahne # 0,50 ; Tasse Kaffee , Becher Kaffee +!Karamellaroma # 0,50 ; Tasse Kaffee , Becher Kaffee , Latte Macchiato +!Majo # 0,50 ; Pommes +!Ketchup # 0,50 ; Pommes \ No newline at end of file diff --git a/webapp/elements/extra.js b/webapp/elements/extra.js new file mode 100644 index 0000000..89372b5 --- /dev/null +++ b/webapp/elements/extra.js @@ -0,0 +1,45 @@ +/** + * + */ + + +function newExtra(id, name, price) { + var extra = { + id:id, + name:name, + price: price, + createTableStructureLine:function (depth,audiofiles) { + if (id != null) { + var trline = "" + + "" + + "" + + "" + + "" + + ""; + return trline; + } else { + var trline = "" + + "" + + "" + + "" + + ""; + return trline; + } + }, + + insertValuesIntoMenuTable:function() { + $("#extra_" + this.id + " input.extraname").val(this.name); + if (this.price != null) { + $("#extra_" + this.id + " input.extraprice").val(this.price); + } + }, + + createApplyArea:function(idApply) { + var txt = '

    ' + + '
    ' + + '

    '; + return txt; + }, + }; + return extra; +} \ No newline at end of file diff --git a/webapp/elements/localprint.js b/webapp/elements/localprint.js new file mode 100644 index 0000000..3c072c6 --- /dev/null +++ b/webapp/elements/localprint.js @@ -0,0 +1,31 @@ +/** + * + */ + + +function closePrint () { + document.body.removeChild(this.__container__); +} + +function setAndStartPrint () { + this.contentWindow.__container__ = this; + this.contentWindow.onbeforeunload = closePrint; + this.contentWindow.onafterprint = closePrint; + this.contentWindow.focus(); // Required for IE + this.contentWindow.print(); +} + +function printContent (content) { + var printiframe = document.createElement("iframe"); + printiframe.setAttribute("id", "printiframe"); + printiframe.onload = setAndStartPrint; + printiframe.style.visibility = "hidden"; + printiframe.style.position = "fixed"; + printiframe.style.right = "0"; + printiframe.style.bottom = "0"; + + var htmlBody = '' + content + ''; + printiframe.src = 'data:text/html;charset=utf-8,' + encodeURI(htmlBody); + + document.body.appendChild(printiframe); +} diff --git a/webapp/elements/product.js b/webapp/elements/product.js new file mode 100644 index 0000000..81cceac --- /dev/null +++ b/webapp/elements/product.js @@ -0,0 +1,329 @@ +/** + * + */ + +function createProdTableHeaderLine() { + var txt = "Name" + + "Typ  " + + "Durchlauf Kche" + + "Durchlauf Bereitst." + + + "Drucker" + + "KurznamePreis (A)" + + "Preis (B)" + + "Preis (C)" + + "Steuersatz" + + "Audio" + + "Verfgbar"; + return txt; +} + +function ident(depth) { + var txt = ""; + var i=0; + for (i=0;i" + + "" + depthstr + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + this.createAudioSelection(audiofiles,"audiosel_" + this.id) + + "" + this.createAvailSelection("prodavail_" + this.id,PROD_NO,PROD_YES) + + "" + this.createAvailSelection("prodfav_" + this.id,PROD_NO,PROD_YES) + + ""; + return trline; + }, + + insertValuesIntoMenuTable:function() { + $("#prodleaf_" + this.id + " input.prodlongname").val(this.longname); + $("#prodleaf_" + this.id + " input.prodshortname").val(this.shortname); + $("#prodleaf_" + this.id + " input.prodpriceA").val(this.priceA); + $("#prodleaf_" + this.id + " input.prodpriceB").val(this.priceB); + $("#prodleaf_" + this.id + " input.prodpriceC").val(this.priceC); + $("#prodleaf_" + this.id + " input.prodtax").val(this.tax); + }, + + createAudioSelection:function(audiofiles,id) { + var txt = ""; + return txt; + }, + + createAvailSelection:function(id,text0,text1) { + if (this.available == 1) { + return ""; + } else { + return ""; + } + }, + + createFavoriteSelection:function(id,text0,text1) { + if (this.favorite == 1) { + return ""; + } else { + return ""; + } + }, + + + createMobileAudioSel:function(audiofiles,id) { + var txt = '

    ' + + '' + + this.createAudioSelection(audiofiles,id) + + '

    '; + return txt; + }, + createMobileAvail:function(id,label) { + var txt = '

    ' + + '' + + this.createAvailSelection(id,PROD_NO,PROD_YES) + + '

    '; + return txt; + }, + createMobileFavorite:function(id,label) { + var txt = '

    ' + + '' + + this.createFavoriteSelection(id,PROD_NO,PROD_YES) + + '

    '; + return txt; + }, + + createListStructureLine:function (audiofiles) { + var theme="e"; + if (this.id.indexOf("n") == 0) { + theme="f"; + } + var line = '
    ' + +'

    Test

    ' + + '

    ' + + + createInputField("prodlong_" + this.id,"prodlong_input_" + this.id,"longname") + + createInputField("prodshort_" + this.id,"prodshort_input_" + this.id,"shortname") + + + '

    ' + + createInputField("prodpriceA_" + this.id,"prodpriceA_input_" + this.id,"priceA") + + createInputField("prodpriceB_" + this.id,"prodpriceB_input_" + this.id,"priceB") + + createInputField("prodpriceC_" + this.id,"prodpriceC_input_" + this.id,"priceC") + + createInputField("prodtax_" + this.id,"prodtax_input_" + this.id,"tax") + + '

    ' + + + "
    " + + this.createMobileAudioSel(audiofiles,"audiosel_" + this.id) + + "
    " + + + "
    " + + this.createMobileAvail("prodavail_" + this.id,PROD_AVAILABLE[lang]) + + "
    " + + + "
    " + + this.createMobileFavorite("prodfav_" + this.id,PROD_FAVORITE[lang]) + + "
    " + + if (theme != "f") { + line += this.createProdNavArea(); + line += createInputOsCmdField("prodextra_" + this.id,"prodextrainput_" + this.id,"extra"); + line += "
    "; + line += createResetApplyArea("prodapply_" + this.id,"prodcancel_" + this.id,null) + '
    '; + } else { + line += this.createApplyArea("prodnew_" + this.id) + '
    '; + } + + return line; + }, + + insertValuesIntoMenuList:function() { + if (this.id.indexOf("n") != 0) { + $("#prodheader_" + this.id).html(toHtml(this.longname)); + } else { + $("#prodheader_" + this.id).html(PROD_NEW_PROD[lang]); + } + + $("#prodlong_" + this.id).html(PROD_LONG_NAME[lang]); + $("#prodlong_input_" + this.id).val(this.longname); + + $("#prodshort_" + this.id).html(PROD_SHORTNAME[lang]); + $("#prodshort_input_" + this.id).val(this.shortname); + + $("#prodpriceA_" + this.id).html(PROD_PRICE[lang] + ' (A)'); + $("#prodpriceB_" + this.id).html(PROD_PRICE[lang] + ' (B)'); + $("#prodpriceC_" + this.id).html(PROD_PRICE[lang] + ' (C)'); + $("#prodtax_" + this.id).html(PROD_TAX[lang]); + $("#prodpriceA_input_" + this.id).val(this.priceA.toString().replace(".",decpoint)); + $("#prodpriceB_input_" + this.id).val(this.priceB.toString().replace(".",decpoint)); + $("#prodpriceC_input_" + this.id).val(this.priceC.toString().replace(".",decpoint)); + + if (this.tax != "null") { + $("#prodtax_input_" + this.id).val(this.tax.toString().replace(".",decpoint)); + } + + $("#availcont_" + this.id).html(this.createMobileAvail("prodavail_" + this.id,PROD_AVAILABLE[lang])); + $("#favcont_" + this.id).html(this.createMobileFavorite("prodfav_" + this.id,PROD_FAVORITE[lang])); + $("#audiocont_" + this.id).html(this.createMobileAudioSel(audiofiles,"audiosel_" + this.id)); + + $("#prodextra_" + this.id).html(PROD_ASS_EXTRAS[lang]); + + $("#prodextra_" + this.id).data("orig_assignedextras",null); + $("#prodextra_" + this.id).data("assignedextras",null); + }, + + createApplyArea:function(idApply) { + var txt = '

    ' + + '
    ' + + '

    '; + return txt; + }, + + createProdNavArea:function() { + var buttonUp = ''; + var buttonDown = ''; + var buttonDel = ''; + + var aText = ''; + aText += '

    '; + aText += '
    ' + buttonDel + '
    '; + aText += '
    ' + buttonUp + '
    '; + aText += '
    ' + buttonDown + '
    '; + aText += '

    '; + return aText; + } + }; + return product; +} + +function createInputField(idForNameOfField,idForInputField,nameOfInputField) { + var txt = '

    ' + + '' + + '

    '; + return txt; +} + +function createInputOsCmdField(idForNameOfField,idForInputField,nameOfInputField) { + var txt = '

    ' + + '' + + '

    '; + return txt; +} + +function createResetApplyArea(idApply,idCancel,idDel) { + var txt = '

    ' + + '
    ' + + '
    ' + + '

    '; + } else { + txt += 'b">' + + '
    ' + + '
    ' + + '
    ' + + '

    '; + } + return txt; +} + +function createProdType(id,name,kind,usekitchen,usesupplydesk,printer) { + var prodtype = { + id:id, + name: name, + usekitchen:usekitchen, + usesupplydesk:usesupplydesk, + kind:kind, + printer:printer, + createTableStructureLine: function (depth) { + var depthstr = ident(depth); + var trline = "" + + "" + depthstr + "" + + "" + this.createTwoValSelection(kind,PROD_FOOD,PROD_DRINKS) + + "" + this.createTwoValSelection(usekitchen,PROD_NO,PROD_YES) + + "" + this.createTwoValSelection(usesupplydesk,PROD_NO,PROD_YES) + + "" + this.createTwoValSelection(printer,PROD_PRINTER_1,PROD_PRINTER_2) + + "" + + ""; + return trline; + }, + insertValuesIntoMenuTable:function() { + $("#prodtype_" + id + " input.typename").val(name); + }, + createTwoValSelection:function(theVal,text0,text1) { + if (theVal == 1) { + return ""; + } + }, + + + createUpperMenuTypeStructure: function() { + var txt = '

    ' + this.name + '

    ' + + "

    " + + "
    " + + "
    " + + "
    " + + + createInputField("typename_" + this.id,"typename_input_" + this.id,"typename_input_" + this.id) + + createResetApplyArea("typeapply_" + this.id,"typecancel_" + this.id,"typedel_" + this.id) + + '

    '; + return txt; + }, + createLowerMenuTypeStructure: function() { + var newTypeName = '

    '; + var newTypeBtn = '

    '; + var assignBtn = '

    '; + return newTypeName + newTypeBtn + assignBtn; + }, + insertValuesIntoMenuList:function() { + $("#typename_" + this.id).html(PROD_NAME[lang]); + $("#typename_input_" + this.id).val(this.name); + $("#dtypekind_" + this.id).html(this.createMobileSel("kind_" + this.id,this.kind,PROD_TYPE,PROD_FOOD,PROD_DRINKS)); + $("#dtypeuk_" + this.id).html(this.createMobileSel("usekitchen_" + this.id,this.usekitchen,PROD_KITCHEN_BAR,PROD_NO_PASS_KITCHEN,PROD_PASS_KITCHEN)); + $("#dtypeus_" + this.id).html(this.createMobileSel("usesupply_" + this.id,this.usesupplydesk,PROD_SUPPLY,PROD_NO_PASS_SUPPLY,PROD_PASS_SUPPLY)); + $("#dtypeprinter_" + this.id).html(this.createMobileSel("printer_" + this.id,this.printer-1,PROD_PRINTER,PROD_PRINTER_1,PROD_PRINTER_2)); + }, + createMobileSel:function(id,theVal,label,text0,text1) { + var txt = '

    ' + + '' + + this.createSelection(id,theVal,text0,text1) + + '

    '; + return txt; + }, + createSelection:function(id,theVal,text0,text1) { + if (theVal == 1) { + return ""; + } else { + return ""; + } + } + }; + return prodtype; +} \ No newline at end of file diff --git a/webapp/elements/rating.js b/webapp/elements/rating.js new file mode 100644 index 0000000..1ceeeb2 --- /dev/null +++ b/webapp/elements/rating.js @@ -0,0 +1,32 @@ +/** + * + */ + +function Rating (day,serviceArr,kitchenArr,total) { + this.day = day; + this.service = serviceArr; + this.kitchen = kitchenArr; + this.total = total; +} + +Rating.prototype.getServiceInfo = function() { + var good = ""; + var ok = ""; + var bad = ""; + var nothing = ""; + + return good + ok + bad + nothing; +}; + +Rating.prototype.getKitchenInfo = function() { + var good = ""; + var ok = ""; + var bad = ""; + var nothing = ""; + + return good + ok + bad + nothing; +}; + +Rating.prototype.getTotal = function() { + return this.total; +}; \ No newline at end of file diff --git a/webapp/elements/roommap.js b/webapp/elements/roommap.js new file mode 100644 index 0000000..cf1d3de --- /dev/null +++ b/webapp/elements/roommap.js @@ -0,0 +1,88 @@ +/** + * + */ + + +function Roommap (containerEl) { + this.roomindex = -1; + this.containerEl = containerEl; + doAjaxTransmitData("GET","php/tablemap.php?command=getRoomTableMap",null,this.fillRoom,null,this); +} + +Roommap.prototype.reload = function() { + doAjaxTransmitData("GET","php/tablemap.php?command=getRoomTableMap",null,this.fillRoom.bind(this),null,this); +} + +Roommap.prototype.fillRoom = function(tabs,instance) { + instance.tmRoommap = tabs; + if (instance.roomindex < 0) { + if (instance.tmRoommap.length > 0) { + instance.roomindex = 0; + } else { + instance.roomindex = -1; + } + } + instance.renderRoomList(instance); +} + +Roommap.prototype.renderRoomList = function(instance) { + + var tabHtml = tmCreateList(instance.tmRoommap,"room_","roombtn","e",instance); + $(instance.containerEl).html(tabHtml); + $(instance.containerEl).trigger("create"); + + instance.tablemaps = []; + for (var roomindex=0;roomindex 0) { + instance.tablemaps[instance.roomindex].renderContent(); + } + + instance.binding(instance); +} + +Roommap.prototype.binding = function(instance) { + $('.roombtn').off("click").on("click", function (e) { + e.stopImmediatePropagation(); + e.preventDefault(); + var roomindex = this.id.split("_")[1]; + instance.roomindex = roomindex; + + //instance.tablemaps[roomindex].renderContent(); + instance.renderRoomList(instance); + }); + + $("#tmimgdelbtn").off("click").on("click", function (e) { + e.stopImmediatePropagation(); + e.preventDefault(); + var roomid = instance.tmRoommap[instance.roomindex].id; + doAjaxTransmitData("POST","php/tablemap.php?command=deleteTableMap",{roomid:roomid},instance.reload.bind(instance),null,instance); + }); +} + +function tmCreateList(aList,idPrefix,classes,defaultTheme,instance) { + var txt = '
    '; + for (var i=0;i'; + } + txt += '
    '; + return txt; +} + +function tmRefreshList(selector) { + if ( $(selector).hasClass('ui-listview')) { + $(selector).listview('refresh'); + } else { + $(selector).trigger('create'); + } +} \ No newline at end of file diff --git a/webapp/elements/tablemap.js b/webapp/elements/tablemap.js new file mode 100644 index 0000000..9ba257d --- /dev/null +++ b/webapp/elements/tablemap.js @@ -0,0 +1,267 @@ +/** + * + */ + +function Tablemap (roomid,tables,elem) { + this.tables = tables; + this.roomid = roomid; + this.elem = elem; + this.selectedTableId = -1; + + if ((tables != null) && (tables.length > 0)) { + this.selectedTableId = tables[0].id; + } +} + +Tablemap.prototype.renderContent = function() { + doAjaxTransmitData("GET","php/tablemap.php?command=getTableMap&roomid=" + this.roomid,null,this.renderTableList,null,this); + + d = new Date(); + $("#mapimgpart").attr("src", "php/tablemap.php?command=getTableMapImgAsPng&roomid=" + this.roomid + "&tableid=" + this.selectedTableId + "&"+d.getTime()); +} + +Tablemap.prototype.renderTableList = function(tables,instance) { + instance.tables = tables; + var tablelist = instance.createList(tables,"table_","tablebtn","c",instance); + $(instance.elem).html(tablelist); + tmRefreshList(instance.elem); + instance.binding(instance); +} + +Tablemap.prototype.createList = function(aList,idPrefix,classes,defaultTheme,instance) { + var txt = '
    '; + for (var i=0;i'; + } + txt += '
    '; + return txt; +} + +Tablemap.prototype.binding = function(instance) { + $('.tablebtn').off("click").on("click", function (e) { + e.stopImmediatePropagation(); + e.preventDefault(); + instance.selectedTableId = this.id.split("_")[1]; + instance.renderContent(instance.elem); + }); + + $("#tmimgbtn").off("click").on("click", function (e) { + e.stopImmediatePropagation(); + e.preventDefault(); + instance.uploadImg(instance); + }); + + $("#mapimgpart").off("click").on("click", function (e) { + e.stopImmediatePropagation(); + e.preventDefault(); + + var width = $('#mapimgpart').width(); + var height = $('#mapimgpart').height(); + + var offset_t = $(this).offset().top - $(window).scrollTop(); + var offset_l = $(this).offset().left - $(window).scrollLeft(); + + var left = Math.round( (e.clientX - offset_l) ); + var top = Math.round( (e.clientY - offset_t) ); + + var data = { + tableid:instance.selectedTableId, + x:(100*left)/width, + y:(100*top)/height + }; + + doAjaxTransmitData("POST","php/tablemap.php?command=setPosition",data,instance.renderIfOk,null,instance); + }); +} + +Tablemap.prototype.createOverlay = function (elem,positions,payTxt,decpoint,currency,tables,ostablebtnsize) { + var t = []; + + var sizeclass = ""; + if (ostablebtnsize == 0) { + sizeclass = "overlaysize-0"; + } else if (ostablebtnsize == 1) { + sizeclass = "overlaysize-1"; + } else if (ostablebtnsize == 2) { + sizeclass = "overlaysize-2"; + } + + for (var i=0;i' + tablename; + if (price != 0.00) { + txt = '' + tablename; + if (payTxt != '') { + txt += '
    (' + payTxt + ': ' + priceTxt + ')'; + } else { + txt += '
    (' + priceTxt + ')'; + } + } + txt += '
    '; + t[t.length] = txt; + } + } + return t; +} + +Tablemap.prototype.bindingForOverlaySelection = function(fct,roomid,tables) { + $(".overlaytxt").off("click").on("click", function (e) { + e.stopImmediatePropagation(); + e.preventDefault(); + + var tableid = this.id.split('_')[1]; + var tablename = "?"; + for (var i=0;i 0)) { + var foundTableId = positions[0].id; + var tablename = positions[0].name; + var minDist = (100*100) + (100*100); + for (var i=0;i'; + } + txt += ''; + return txt; +} + +Tablemap.prototype.uploadImg = function(instance) { + var formData = new FormData($('#tablemapimgform')[0]); + + formData.append("roomid",instance.roomid); + $.ajax({ + url: 'php/tablemap.php?command=uploadimg', //Server script to process data + type: 'POST', + dataType: "json", + xhr: function() { // Custom XMLHttpRequest + var myXhr = $.ajaxSettings.xhr(); + if(myXhr.upload){ // Check if upload property exists + //myXhr.upload.addEventListener('progress',progressHandlingFunction, false); // For handling the progress of the upload + } + return myXhr; + }, + //Ajax events + success: function(jsonContent) { + if (jsonContent.status != "OK") { + instance.imgNotUploaded(jsonContent); + } else { + instance.imgUploaded(jsonContent,instance); + } + }, + error: function(answer) { + instance.imgNotUploaded(answer); + }, + // Form data + data: formData, + //Options to tell jQuery: do not to process data or worry about content-type. + cache: false, + contentType: false, + processData: false + }); +} + +Tablemap.prototype.imgUploaded = function(text,instance) { + instance.renderContent(); +} + +Tablemap.prototype.imgNotUploaded = function(text) { + alert("Bild konnte nicht hichgeladen werden. Ist es zu gro (> 1 MB)? Oder wurde der Dateiname nicht angegeben?"); +} \ No newline at end of file diff --git a/webapp/feedback.html b/webapp/feedback.html new file mode 100644 index 0000000..0a2c50d --- /dev/null +++ b/webapp/feedback.html @@ -0,0 +1,268 @@ + + + Ansicht Feedback + + + + + + + + + + + + + + + + + + + + + +
    +
    +
      +
    • Module
    • +
    +
    +
    +

    Feedback

    +
    + Module +
    +
    +
    +

    Diese Seite dient zur Übermittlung von Feedback an den Entwickler. Die Email wird das Mailkonto + des Betreibers versendet.

    +
    +
    +
    + +
    +
    + +
    +
    + +
    + + +
    + +
    +
    + +
    +
    + +

    Bitte Telefonnummer angeben, wenn eine Antwort per Telefon gewünscht wird. +
    Eine Antwort des Entwicklers + kann nicht garantiert werden! Informationen über den verwendeten Internetbrowser wird an den Entwickler gesendet, damit mögliche Fragen + oder Probleme leichter identifiziert werden können.

    + + +
    +
    +
    +
    +
    +
    +
    +
    + + + \ No newline at end of file diff --git a/img/add.png b/webapp/img/add.png similarity index 100% rename from img/add.png rename to webapp/img/add.png diff --git a/img/back.png b/webapp/img/back.png similarity index 100% rename from img/back.png rename to webapp/img/back.png diff --git a/img/bannerwithphone.png b/webapp/img/bannerwithphone.png similarity index 100% rename from img/bannerwithphone.png rename to webapp/img/bannerwithphone.png diff --git a/img/delete.png b/webapp/img/delete.png similarity index 100% rename from img/delete.png rename to webapp/img/delete.png diff --git a/webapp/img/empty-room.png b/webapp/img/empty-room.png new file mode 100644 index 0000000..db1021c Binary files /dev/null and b/webapp/img/empty-room.png differ diff --git a/webapp/img/germanflag.png b/webapp/img/germanflag.png new file mode 100644 index 0000000..151b4ad Binary files /dev/null and b/webapp/img/germanflag.png differ diff --git a/webapp/img/goup.png b/webapp/img/goup.png new file mode 100644 index 0000000..2576ef7 Binary files /dev/null and b/webapp/img/goup.png differ diff --git a/webapp/img/gray.png b/webapp/img/gray.png new file mode 100644 index 0000000..3aceffb Binary files /dev/null and b/webapp/img/gray.png differ diff --git a/img/green.png b/webapp/img/green.png similarity index 100% rename from img/green.png rename to webapp/img/green.png diff --git a/webapp/img/higher.png b/webapp/img/higher.png new file mode 100644 index 0000000..55f7932 Binary files /dev/null and b/webapp/img/higher.png differ diff --git a/img/home.png b/webapp/img/home.png similarity index 100% rename from img/home.png rename to webapp/img/home.png diff --git a/webapp/img/i.png b/webapp/img/i.png new file mode 100644 index 0000000..f569a38 Binary files /dev/null and b/webapp/img/i.png differ diff --git a/webapp/img/minus.png b/webapp/img/minus.png new file mode 100644 index 0000000..8de9dae Binary files /dev/null and b/webapp/img/minus.png differ diff --git a/webapp/img/multi.png b/webapp/img/multi.png new file mode 100644 index 0000000..ef43f41 Binary files /dev/null and b/webapp/img/multi.png differ diff --git a/img/notavailable.png b/webapp/img/notavailable.png similarity index 100% rename from img/notavailable.png rename to webapp/img/notavailable.png diff --git a/img/ok.png b/webapp/img/ok.png similarity index 100% rename from img/ok.png rename to webapp/img/ok.png diff --git a/webapp/img/plus.png b/webapp/img/plus.png new file mode 100644 index 0000000..4e40f9c Binary files /dev/null and b/webapp/img/plus.png differ diff --git a/img/red.png b/webapp/img/red.png similarity index 100% rename from img/red.png rename to webapp/img/red.png diff --git a/webapp/img/serve.png b/webapp/img/serve.png new file mode 100644 index 0000000..5604cea Binary files /dev/null and b/webapp/img/serve.png differ diff --git a/webapp/img/servecheck.png b/webapp/img/servecheck.png new file mode 100644 index 0000000..454f68d Binary files /dev/null and b/webapp/img/servecheck.png differ diff --git a/webapp/img/smile_angry.png b/webapp/img/smile_angry.png new file mode 100644 index 0000000..4fc1d52 Binary files /dev/null and b/webapp/img/smile_angry.png differ diff --git a/webapp/img/smile_ok.png b/webapp/img/smile_ok.png new file mode 100644 index 0000000..e6a05ec Binary files /dev/null and b/webapp/img/smile_ok.png differ diff --git a/webapp/img/smile_super.png b/webapp/img/smile_super.png new file mode 100644 index 0000000..1814a5a Binary files /dev/null and b/webapp/img/smile_super.png differ diff --git a/webapp/img/spainflag.png b/webapp/img/spainflag.png new file mode 100644 index 0000000..2ac456a Binary files /dev/null and b/webapp/img/spainflag.png differ diff --git a/webapp/img/top.png b/webapp/img/top.png new file mode 100644 index 0000000..a19fe58 Binary files /dev/null and b/webapp/img/top.png differ diff --git a/webapp/img/ukflag.png b/webapp/img/ukflag.png new file mode 100644 index 0000000..c0d5d8e Binary files /dev/null and b/webapp/img/ukflag.png differ diff --git a/img/wait.png b/webapp/img/wait.png similarity index 100% rename from img/wait.png rename to webapp/img/wait.png diff --git a/img/waittimes/10min.png b/webapp/img/waittimes/10min.png similarity index 100% rename from img/waittimes/10min.png rename to webapp/img/waittimes/10min.png diff --git a/img/waittimes/11min.png b/webapp/img/waittimes/11min.png similarity index 100% rename from img/waittimes/11min.png rename to webapp/img/waittimes/11min.png diff --git a/img/waittimes/12min.png b/webapp/img/waittimes/12min.png similarity index 100% rename from img/waittimes/12min.png rename to webapp/img/waittimes/12min.png diff --git a/img/waittimes/13min.png b/webapp/img/waittimes/13min.png similarity index 100% rename from img/waittimes/13min.png rename to webapp/img/waittimes/13min.png diff --git a/img/waittimes/14min.png b/webapp/img/waittimes/14min.png similarity index 100% rename from img/waittimes/14min.png rename to webapp/img/waittimes/14min.png diff --git a/img/waittimes/15min.png b/webapp/img/waittimes/15min.png similarity index 100% rename from img/waittimes/15min.png rename to webapp/img/waittimes/15min.png diff --git a/img/waittimes/16min.png b/webapp/img/waittimes/16min.png similarity index 100% rename from img/waittimes/16min.png rename to webapp/img/waittimes/16min.png diff --git a/img/waittimes/17min.png b/webapp/img/waittimes/17min.png similarity index 100% rename from img/waittimes/17min.png rename to webapp/img/waittimes/17min.png diff --git a/img/waittimes/18min.png b/webapp/img/waittimes/18min.png similarity index 100% rename from img/waittimes/18min.png rename to webapp/img/waittimes/18min.png diff --git a/img/waittimes/19min.png b/webapp/img/waittimes/19min.png similarity index 100% rename from img/waittimes/19min.png rename to webapp/img/waittimes/19min.png diff --git a/img/waittimes/1min.png b/webapp/img/waittimes/1min.png similarity index 100% rename from img/waittimes/1min.png rename to webapp/img/waittimes/1min.png diff --git a/img/waittimes/20min.png b/webapp/img/waittimes/20min.png similarity index 100% rename from img/waittimes/20min.png rename to webapp/img/waittimes/20min.png diff --git a/img/waittimes/25min.png b/webapp/img/waittimes/25min.png similarity index 100% rename from img/waittimes/25min.png rename to webapp/img/waittimes/25min.png diff --git a/img/waittimes/2min.png b/webapp/img/waittimes/2min.png similarity index 100% rename from img/waittimes/2min.png rename to webapp/img/waittimes/2min.png diff --git a/img/waittimes/30min.png b/webapp/img/waittimes/30min.png similarity index 100% rename from img/waittimes/30min.png rename to webapp/img/waittimes/30min.png diff --git a/img/waittimes/3min.png b/webapp/img/waittimes/3min.png similarity index 100% rename from img/waittimes/3min.png rename to webapp/img/waittimes/3min.png diff --git a/img/waittimes/40min.png b/webapp/img/waittimes/40min.png similarity index 100% rename from img/waittimes/40min.png rename to webapp/img/waittimes/40min.png diff --git a/img/waittimes/4min.png b/webapp/img/waittimes/4min.png similarity index 100% rename from img/waittimes/4min.png rename to webapp/img/waittimes/4min.png diff --git a/img/waittimes/50min.png b/webapp/img/waittimes/50min.png similarity index 100% rename from img/waittimes/50min.png rename to webapp/img/waittimes/50min.png diff --git a/img/waittimes/5min.png b/webapp/img/waittimes/5min.png similarity index 100% rename from img/waittimes/5min.png rename to webapp/img/waittimes/5min.png diff --git a/img/waittimes/60min.png b/webapp/img/waittimes/60min.png similarity index 100% rename from img/waittimes/60min.png rename to webapp/img/waittimes/60min.png diff --git a/img/waittimes/6min.png b/webapp/img/waittimes/6min.png similarity index 100% rename from img/waittimes/6min.png rename to webapp/img/waittimes/6min.png diff --git a/img/waittimes/7min.png b/webapp/img/waittimes/7min.png similarity index 100% rename from img/waittimes/7min.png rename to webapp/img/waittimes/7min.png diff --git a/img/waittimes/8min.png b/webapp/img/waittimes/8min.png similarity index 100% rename from img/waittimes/8min.png rename to webapp/img/waittimes/8min.png diff --git a/img/waittimes/9min.png b/webapp/img/waittimes/9min.png similarity index 100% rename from img/waittimes/9min.png rename to webapp/img/waittimes/9min.png diff --git a/img/workflow.png b/webapp/img/workflow.png similarity index 100% rename from img/workflow.png rename to webapp/img/workflow.png diff --git a/img/yellow.png b/webapp/img/yellow.png similarity index 100% rename from img/yellow.png rename to webapp/img/yellow.png diff --git a/index.html b/webapp/index.html similarity index 75% rename from index.html rename to webapp/index.html index a01f736..54b08cf 100644 --- a/index.html +++ b/webapp/index.html @@ -2,7 +2,7 @@ - Ansicht Startseite + OrderSprinter Startseite @@ -20,12 +20,17 @@ @@ -126,7 +171,7 @@ $(document).on("pageinit", "#index-page", function () {
    -

    Info

    +

    OrderSprinter

    diff --git a/webapp/infopage.html b/webapp/infopage.html new file mode 100644 index 0000000..1673a18 --- /dev/null +++ b/webapp/infopage.html @@ -0,0 +1,86 @@ + + + + + Information + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +

    Info

    +
    + +
    + + +
    + + + + +
    + +
    +
    +
    +
    +
    +
    + +
    + +
    + + + + diff --git a/webapp/install.html b/webapp/install.html new file mode 100644 index 0000000..1de21d9 --- /dev/null +++ b/webapp/install.html @@ -0,0 +1,730 @@ + + + + +Setup + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/webapp/install/installer.php b/webapp/install/installer.php new file mode 100644 index 0000000..c64a6b6 --- /dev/null +++ b/webapp/install/installer.php @@ -0,0 +1,1400 @@ + "Failed")); +} +$retArray = array( +"host" => MYSQL_HOST, +"db" => MYSQL_DB, +"user" => MYSQL_USER, +"password" => MYSQL_PASSWORD, +"tabprefix" => TAB_PREFIX); +echo json_encode(array("status" => "OK","result" => $retArray)); +} +} + + +class InstallAdmin { +var $pdo; +var $basedb; +var $timezone; + +function __construct() { +$this->basedb = new Basedb(); +} + +function setPrefix($pre) { +$this->basedb->setPrefix($pre); +} + +function setPdo($pdo) { +$this->pdo = $pdo; +} + +function setTimeZone($zone) { +$this->timezone = $zone; +} + +function openDbAndReturnPdo ($host,$db,$user,$password) { +$dsn = 'mysql:host=' . $host . ';dbname=' . $db; +$pdo = null; +try { +$pdo = new PDO($dsn, $user, $password); +$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); +} +catch (PDOException $e) { +echo 'Verbindungsproblem: ' . $e->getMessage(); +$pdo = null; +} +return $pdo; +} + +function checkPhpStatus() { +$extensions = array("gd","mysqli","openssl","pdo_mysql","PDO","session","zlib"); +$missing = array(); + +$extensions_status = 1; +foreach($extensions as $anExtension) { +if (!extension_loaded($anExtension)) { +$missing[] = $anExtension; +$extensions_status = 0; +} +} + +set_time_limit(60*5+1); +ini_set('session.gc_maxlifetime',65535); +session_set_cookie_params(65535); + +$max_execution_status = 1; +// 5 minutes = 5*60 +if (ini_get('max_execution_time') < (5*60)) { +$max_execution_status = 0; +} + +$session_lifetime_status = 1; +if (ini_get('session.gc_maxlifetime') < (10*60*60)) { +$session_lifetime_status = 0; +} + +$ret = array("extensions_status" => $extensions_status, "missing_extensions" => join(",",$missing), +"max_execution_status" => $max_execution_status, "max_execution_time" => ini_get('max_execution_time'), +"session_lifetime_status" => $session_lifetime_status, "session_gc_maxlifetime" => ini_get('session.gc_maxlifetime') +); + +echo json_encode($ret); +} + +function updateUserTable1013_1014() { +$pdo = $this->pdo; +try { +$prkey = file_get_contents("../php/privkey.pem"); +$cert = file_get_contents("../php/cert.pem"); + +if ((strlen($prkey) < 10) || (strlen($cert) < 10)) { +echo json_encode('Fehler: Vorversion falsch oder Inhalt des php-Verzeichnisses ungueltig!'); +} else { +$sql = "ALTER TABLE `%work%` MODIFY signature VARBINARY(4000)"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(); + +$sql = "INSERT INTO `%work%` (`id` , `item`,`value`,`signature`) VALUES ( NULL,?,?,?)"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(array("privkey","privkey",$prkey)); + +$sql = "INSERT INTO `%work%` (`id` , `item`,`value`,`signature`) VALUES ( NULL,?,?,?)"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(array("cert","cert",$cert)); + +$this->updateVersion($pdo, '1.0.14'); + +unlink("../php/privkey.pem"); +unlink("../php/cert.pem"); +} +return true; +} catch (PDOException $e) { +return false; +} +} + +function updateUserTable1014_1015() { +$pdo = $this->pdo; +try { +$add_favorite_col_sql = "ALTER TABLE %products% ADD favorite INT(1) NULL AFTER category"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($add_favorite_col_sql)); +$stmt->execute(); +$sql = "UPDATE %products% SET favorite=?"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(array('0')); + +$add_favorite_col_sql = "ALTER TABLE %histprod% ADD favorite INT(1) NULL AFTER available"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($add_favorite_col_sql)); +$stmt->execute(); +$sql = "UPDATE %histprod% SET favorite=?"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(array('0')); + +$this->updateVersion($pdo, '1.0.15'); +return true; +} catch (PDOException $e) { +return false; +} +} + +function updateUserTable1015_1016() { +$pdo = $this->pdo; +try { +$this->updateVersion($pdo, '1.0.16'); +return true; +} catch (PDOException $e) { +return false; +} +} + +function updateUserTable1016_1017() { +$pdo = $this->pdo; +try { +$sql = "ALTER TABLE %user% ADD right_rating INT(1) NULL AFTER right_reservation"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(); +$sql = "UPDATE %user% SET right_rating=?"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(array('0')); +$sql = "ALTER TABLE %user% MODIFY right_rating INT(1) NOT NULL DEFAULT '0'"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(); + +$sql = "ALTER TABLE %histuser% ADD right_rating INT(1) NULL AFTER right_reservation"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(); +$sql = "UPDATE %histuser% SET right_rating=?"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(array('0')); +$sql = "ALTER TABLE %histuser% MODIFY right_rating INT(1) NOT NULL DEFAULT '0'"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(); +$this->basedb->createRatingsTable($pdo); + +$this->updateVersion($pdo, '1.0.17'); +return true; +} catch (PDOException $e) { +return false; +} +} + +function updateVersion($pdo,$version) { +$setVersion = "update %config% set setting=? where name='version'"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($setVersion)); +$stmt->execute(array($version)); + +$sql = "SELECT id FROM %config% WHERE name=?"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(array('version')); +$row = $stmt->fetchObject(); + +$sql_insert_histconfig = "INSERT INTO %histconfig% (id,configid,setting) VALUES (NULL,?,?)"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql_insert_histconfig)); +$stmt->execute(array($row->id,$version)); + +$newRefIdForHist = $pdo->lastInsertId(); + +$sql = "SELECT setting FROM %config% WHERE name=?"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(array('timezone')); +$row = $stmt->fetchObject(); +date_default_timezone_set($row->setting); +$currentTime = date('Y-m-d H:i:s'); + +$sql_insert_hist = "INSERT INTO %hist% (id,date,action,refid) VALUES (NULL,?,?,?)"; +$stmt_insert_hist = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql_insert_hist)); +$stmt_insert_hist->execute(array($currentTime, '6', $newRefIdForHist)); +} + +function updateUserTable1018_1019() { +$pdo = $this->pdo; +try { +$sql = "INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL,?,?)"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(array('remoteaccesscode',null)); + +$this->updateVersion($pdo, '1.0.19'); +return true; +} catch (PDOException $e) { +return false; +} +} + +function updateUserTable1019_1020() { +$pdo = $this->pdo; +try { +$this->updateVersion($pdo, '1.0.20'); +return true; +} catch (PDOException $e) { +return false; +} +} + +function updateUserTable1022_1023($prefix) { +$pdo = $this->pdo; +try { +$adminCl = new Admin(); +DbUtils::overrulePrefix($prefix); +$adminCl->changeOneConfigDbItem($pdo,"timezone","Europe/Berlin","%config%",true); +$this->updateVersion($pdo, '1.0.23'); +return true; +} catch (PDOException $e) { +return false; +} +} + +function updateUserTable1023_1024($prefix) { +$pdo = $this->pdo; +try { +$adminCl = new Admin(); +DbUtils::overrulePrefix($prefix); + +$sql = "ALTER TABLE %user% ADD right_changeprice INT (1) NULL AFTER right_rating"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(); +$sql = "UPDATE %user% SET right_changeprice=?"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(array(1)); +$sql = "ALTER TABLE %user% MODIFY right_changeprice INT (1) NOT NULL"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(); + +$sql = "ALTER TABLE %histuser% ADD right_changeprice INT (1) NULL AFTER right_rating"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(); +$sql = "UPDATE %histuser% SET right_changeprice=?"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(array(1)); +$sql = "ALTER TABLE %histuser% MODIFY right_changeprice INT (1) NOT NULL"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(); + +$sql = "ALTER TABLE %user% ADD prefertablemap INT(1) NULL AFTER prodbtnsize"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(); +$sql = "UPDATE %user% SET prefertablemap=?"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(array(1)); + +$this->basedb->createTableMapsTable($pdo); +$this->basedb->createTablePosTable($pdo); +$this->updateVersion($pdo, '1.0.24'); +return true; +} catch (PDOException $e) { +return false; +} +} + +function updateUserTable1024_1025($prefix) { +return $this->setVersion($prefix, '1.0.25'); +} + +function updateUserTable1025_1026($prefix) { +$pdo = $this->pdo; +try { +$adminCl = new Admin(); +DbUtils::overrulePrefix($prefix); + +$sql = "ALTER TABLE %queue% DROP payinprogress"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(); + +$this->updateVersion($pdo, '1.0.26'); +return true; +} catch (PDOException $e) { +return false; +} +} + +function updateUserTable1026_1027($prefix) { +return $this->setVersion($prefix, '1.0.27'); +} + +function updateUserTable1027_1028($prefix) { +$pdo = $this->pdo; +try { +$adminCl = new Admin(); +DbUtils::overrulePrefix($prefix); + +$sql = "ALTER TABLE %queue% MODIFY tablenr INT( 3 ) NULL"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(); + +$this->updateVersion($pdo, '1.0.28'); +return true; +} catch (PDOException $e) { +return false; +} +} + +function updateUserTable1028_1029($prefix) { +return $this->setVersion($prefix, '1.0.29'); +} + +function updateUserTable1029_1030($prefix) { +return $this->setVersion($prefix, '1.0.30'); +} + +function updateUserTable1030_1031($prefix) { +return $this->setVersion($prefix, '1.0.31'); +} + +function updateUserTable1031_1032($prefix) { +return $this->setVersion($prefix, '1.0.32'); +} + +function updateUserTable1032_1033($prefix) { +return $this->setVersion($prefix, '1.0.33'); +} + +function updateUserTable1033_1034($prefix) { +return $this->setVersion($prefix, '1.0.34'); +} + +function updateUserTable1034_1035($prefix) { +return $this->setVersion($prefix, '1.0.35'); +} + +function updateUserTable1035_1036($prefix) { +return $this->setVersion($prefix, '1.0.36'); +} + +function updateUserTable1036_1037($prefix) { +return $this->setVersion($prefix, '1.0.37'); +} + +function updateUserTable1037_1038($prefix) { +$pdo = $this->pdo; +try { +$adminCl = new Admin(); +DbUtils::overrulePrefix($prefix); + +$sql = "ALTER TABLE %queue% DROP action"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(); + +$sql = "ALTER TABLE %queue% ADD tax DECIMAL (5,2) NULL AFTER price"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(); + + +$sql = "UPDATE %queue%,%bill% SET %queue%.tax = %bill%.tax WHERE %queue%.billid=%bill%.id"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(); +// at this point all queue items have the tax from the bill, if their billid was set - otherwise they keep being NULL + +$sql = "UPDATE %queue%,%config% SET %queue%.tax = %config%.setting WHERE %queue%.billid is NULL AND %config%.name='tax' AND %queue%.tablenr is not null;"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(); + +$sql = "UPDATE %queue%,%config% SET %queue%.tax = %config%.setting WHERE %queue%.billid is NULL AND %config%.name='togotax' AND %queue%.tablenr is null;"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(); +// at this point all unpaid products have the normal tax + +// allow bill table to have no taxes (tax column is needed for signature of old bills (verifyBill) +$sql = "ALTER TABLE %bill% MODIFY tax decimal(5,2) NULL"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(); + +$sql = "ALTER TABLE %queue% MODIFY tax DECIMAL (5,2) NOT NULL"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(); + +$sql = "ALTER TABLE %products% ADD tax DECIMAL (5,2) NULL AFTER priceC"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(); + +$sql = "ALTER TABLE %histprod% ADD tax DECIMAL (5,2) NULL AFTER priceC"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(); + +$this->updateVersion($pdo, "1.0.38"); + +return true; +} catch (PDOException $e) { +return false; +} +} + +function updateUserTable1038_1039($prefix) { +return $this->setVersion($prefix, '1.0.39'); +} + +function updateUserTable1039_1040($prefix) { +$pdo = $this->pdo; +try { +$adminCl = new Admin(); +DbUtils::overrulePrefix($prefix); + +$sql = "INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL,?,?)"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(array('cancelunpaidcode','')); + +$sql = "ALTER TABLE %hist% MODIFY refid INT (10) NULL"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(); + +$this->updateVersion($pdo, '1.0.40'); +return true; +} catch (PDOException $e) { +return false; +} +} + +function updateUserTable1040_1041($prefix) { +$pdo = $this->pdo; +try { +$adminCl = new Admin(); +DbUtils::overrulePrefix($prefix); + +$sql = "ALTER TABLE %prodtype% ADD printer INT(2) NULL AFTER kind"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(); +$sql = "UPDATE %prodtype% SET printer=?"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(array(1)); + +$sql = "UPDATE %printjobs% SET printer=? WHERE (type=1 OR type=2) AND printer is null"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(array(1)); + +$this->updateVersion($pdo, '1.0.41'); +return true; +} catch (PDOException $e) { +return false; +} +} + +function updateUserTable1041_1042($prefix) { +$pdo = $this->pdo; +try { +$adminCl = new Admin(); +DbUtils::overrulePrefix($prefix); +$this->updateVersion($pdo, '1.0.42'); +return true; +} catch (PDOException $e) { +return false; +} +} + +function updateUserTable1042_1043($prefix) { +$pdo = $this->pdo; +try { +$adminCl = new Admin(); +DbUtils::overrulePrefix($prefix); + +$sql = "ALTER TABLE %queue% ADD orderuser INT(10) NULL AFTER ordertime"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(); + +// get the first user - at least the admin should be aways there +$sql = "SELECT id FROM %user% WHERE active=? ORDER BY id LIMIT 1"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(array(1)); +$row = $stmt->fetchObject(); +$userid = $row->id; + +$sql = "UPDATE %queue% SET orderuser=?"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(array($userid)); + +$sql = "ALTER TABLE %queue% MODIFY orderuser INT(10) NOT NULL"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(); + +$sql = "ALTER TABLE %room% ADD printer INT(2) NULL AFTER roomname"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(); + +$this->updateVersion($pdo, '1.0.43'); +return true; +} catch (PDOException $e) { +return false; +} +} + +function updateUserTable1043_1100($prefix) { +return $this->setVersion($prefix, '1.1.0'); +} + +function setVersion($prefix,$theVersion) { +$pdo = $this->pdo; +try { +$adminCl = new Admin(); +DbUtils::overrulePrefix($prefix); + +$this->updateVersion($pdo, $theVersion); +return true; +} catch (PDOException $e) { +return false; +} +} + +function signLastBillId() { +$pdo = $this->pdo; +$this->basedb->signLastBillid($pdo); +} + +function createTables($decpoint,$billlanguage,$currency,$timezone) +{ +$pdo = $this->pdo; + +$this->basedb->setTimeZone($timezone); + +$this->basedb->dropTables($pdo); + +$this->basedb->createRatingsTable($pdo); +$this->createPaymentTable($pdo); +$this->basedb->createUserTable($pdo); +$this->basedb->createRoomTable($pdo); +$this->basedb->createRestTables($pdo); +$this->basedb->createTableMapsTable($pdo); +$this->basedb->createTablePosTable($pdo); +$this->basedb->createConfigTable($pdo); +$this->basedb->createProdTypeTable($pdo); +$this->basedb->createProductTable($pdo); +$this->basedb->createPriceLevelTable($pdo); +$this->basedb->createClosingTable($pdo); +$this->basedb->createBillTable($pdo); +$this->basedb->createQueueTable($pdo); +$this->basedb->createBillProductsTable($pdo); +$this->basedb->createHistTables($pdo); +$this->defineHistActions($pdo); +$this->basedb->createPrintJobsTable($pdo); +$this->basedb->createWorkTable($pdo); +$this->basedb->createCommentsTable($pdo); +$this->basedb->createReservationsTable($pdo); +$this->basedb->createLogoTable($pdo); +$this->basedb->createExtrasTable($pdo); +$this->basedb->createExtrasprodsTable($pdo); +$this->basedb->createQueueExtrasTable($pdo); + +$this->basedb->doSQL($pdo,"INSERT INTO `%pricelevel%` (`id` , `name`,`info`,`info_en`,`info_esp`) VALUES ('1', 'A', 'Normale Preisstufe', 'Normal', 'Normal')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%pricelevel%` (`id` , `name`,`info`,`info_en`,`info_esp`) VALUES ('2', 'B', 'Wochenendtarif', 'Weekend prices','Tarifa del fin de semana')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%pricelevel%` (`id` , `name`,`info`,`info_en`,`info_esp`) VALUES ('3', 'C', 'Happy Hour', 'Happy Hour','Happy Hour')"); + +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'pricelevel', '1')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'tax', '19.0')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'togotax', '7.0')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'stornocode', '123')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'printpass', 'printen')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'companyinfo', 'Musterrestaurant\nBeispielstrasse 123\n12345 Musterort')"); +$resTxt = 'Vielen Dank für Ihre Reservierung am DATUM um ZEIT Uhr für ANZAHL Personen.\n\nWir freuen uns auf Ihren Besuch!\n\nBETRIEBSINFO'; +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'reservationnote', '$resTxt')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'serverurl', '')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'email', '')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'receiveremail', '')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'payprinttype', 's')"); +$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.1.0')"); +$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')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'timezone', '$timezone')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'webimpressum', 'Musterrestaurant\nBeispielstrasse 123\n12345 Musterort')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'cancelunpaidcode', '')"); + +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'smtphost', '')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'smtpauth', '1')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'smtpuser', '')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'smtppass', '')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'smtpsecure', '1')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'smtpport', '587')"); + +// prepare for later inconsistency check if version is obsolete +date_default_timezone_set($timezone); +$installDate = date('Y-m-d H:i:s'); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'installdate', '$installDate')"); + +$this->readConfigTableAndSendToHist($pdo); +return; +} + +public function getCurrentVersion() { +try { +$pdo = $this->pdo; +$sql = "SELECT setting FROM %config% WHERE name=?"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(array("version")); +$row = $stmt->fetchObject(); +return($row->setting); +} catch (Exception $e) { +return null; +} +} + +function readConfigTableAndSendToHist($pdo) { +$sql_query = "SELECT * FROM %config%"; + +$sql_insert_histconfig = "INSERT INTO %histconfig% (id,configid,setting) VALUES (NULL,?,?)"; + +$stmt_query = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql_query)); +$stmt_insert_histconfig = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql_insert_histconfig)); + +$stmt_query->execute(); +$result = $stmt_query->fetchAll(); +foreach($result as $row){ +$stmt_insert_histconfig->execute(array($row['id'],$row['setting'])); +$newRefIdForHist = $pdo->lastInsertId(); +$this->insertIntoHist($pdo, '2', $newRefIdForHist); +} +} + +private function insertIntoHist($pdo,$action,$refIdForHist) { +date_default_timezone_set($this->timezone); +$currentTime = date('Y-m-d H:i:s'); + +$sql_insert_hist = "INSERT INTO %hist% (id,date,action,refid) VALUES (NULL,?,?,?)"; +$stmt_insert_hist = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql_insert_hist)); +$stmt_insert_hist->execute(array($currentTime, $action, $refIdForHist)); +} + +function insertUser($username,$adminpass,$is_admin,$right_waiter,$right_kitchen,$right_bar, +$right_supply,$right_paydesk,$right_statistics,$right_bill,$right_products,$right_changeprice, +$right_manager,$right_reservation,$right_rating,$lang,$prefertablemap) { +$md5adminpass = md5($adminpass); +$pdo = $this->pdo; + +$userInsertSql = "INSERT INTO `%user%` (`id` , `username` , `userpassword`, `is_admin`, `right_waiter`,`right_kitchen`,`right_bar`,`right_supply`,`right_paydesk`,`right_statistics`,`right_bill`,`right_products`,`right_changeprice`,`right_manager`,`right_reservation`,`right_rating`,`language`,`prefertablemap`,`active`) VALUES (NULL,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,'1')"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($userInsertSql)); + +$stmt->execute(array($username,$md5adminpass,$is_admin,$right_waiter,$right_kitchen,$right_bar,$right_supply,$right_paydesk,$right_statistics,$right_bill,$right_products,$right_changeprice,$right_manager,$right_reservation,$right_rating,$lang,$prefertablemap)); + +$newUserIdForHist = $pdo->lastInsertId(); + +// now insert into hist +$sql_insert_histuser = "INSERT INTO %histuser% (`id` , `userid`, `username` , +`is_admin`, `right_waiter`,`right_kitchen`,`right_bar`,`right_supply`,`right_paydesk`, +`right_statistics`,`right_bill`,`right_products`,`right_changeprice`,`right_manager`,`right_reservation`,`right_rating`,`active`) VALUES ( +NULL,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; +$stmt_insert_histuser = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql_insert_histuser)); +$stmt_insert_histuser->execute(array($newUserIdForHist,$username,$is_admin,$right_waiter,$right_kitchen,$right_bar,$right_supply,$right_paydesk,$right_statistics,$right_bill,$right_products,$right_changeprice,$right_manager,$right_reservation,$right_rating,1)); +$newRefIdForHist = $pdo->lastInsertId(); +$this->insertIntoHist($pdo, '3', $newRefIdForHist); +} + +function createPaymentTable($pdo) { +$this->basedb->createPaymentTable($pdo); + +$sql = "INSERT INTO %payment% (id,name,name_en,name_esp) VALUES (?,?,?,?)"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); + +$stmt->execute(array('1', 'Barzahlung', 'Cash', 'Contado')); +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); + +$stmt->execute(array('2', 'EC-Kartenzahlung','Electr. purse (EC)','Pago con tarjeta EC')); +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(array('3', 'Kreditkartenzahlung','Credit card','Tarjeta de credito')); +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(array('4', 'Rechnung','bill','Factura')); +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(array('5', 'Ueberweisung','Bank transfer','Transferencia')); +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(array('6', 'Lastschrift','Debit','Cargo en cuenta')); +} + +public function defineHistActions ($pdo) { +$sql = "INSERT INTO %histactions% (id,name,description) VALUES (?,?,?)"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); + +$stmt->execute(array('1', 'ProdInit', 'Initiales Befuellen der Produkttabelle')); +$stmt->execute(array('2', 'ConfigInit', 'Initiales Befuellen der Konfigurationstabelle')); +$stmt->execute(array('3', 'UserInit', 'Initiales Befuellen der Benutzertabelle')); +$stmt->execute(array('4', 'ProdChange', 'Modifikation der Produktdaten')); +$stmt->execute(array('5', 'ProdCreation', 'Neues Produkt')); +$stmt->execute(array('6', 'ConfigChange', 'Modifikation der Konfiguration')); +$stmt->execute(array('7', 'UserCreation', 'Neuer Benutzer')); +$stmt->execute(array('8', 'UserChange', 'Modifikation eines Benutzers')); +} + +function testDbConnection($host,$dbname,$user,$pass) { +$pdo = $this->openDbAndReturnPdo($host,$dbname,$user,$pass); +if (!is_null($pdo)) { +echo json_encode("OK"); +} else { +echo json_encode("ERROR"); +} +} + +function writeConfigFile($host,$db,$user,$password,$prefix) { +$errorlevel = ""; +file_put_contents("../php/config.php", $configText); +try { +file_put_contents("../php/config1.php", $configText); +} catch (Exception $e) { +// nothing +} +} + +function createSslKeys($pdo) { +$sslconfig = array( +"digest_alg" => "sha512", +"private_key_bits" => 4096, +"private_key_type" => OPENSSL_KEYTYPE_RSA, +); +// thus the signature is exactly 512 bytes + +// Create the private and public key +$res = openssl_pkey_new($sslconfig); +if (is_null($res) || ($res=="")) { +// openssl may be incorrectly installed +return false; +} + +// Extract the private key from $res to $privKey +openssl_pkey_export($res, $privKey); + +// Extract the public key from $res to $pubKey +$pubKey = openssl_pkey_get_details($res); +$pubKey = $pubKey["key"]; + +$sql = "INSERT INTO `%work%` (`id` , `item`,`value`,`signature`) VALUES ( NULL,?,?,?)"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(array("privkey","privkey",$privKey)); + +$sql = "INSERT INTO `%work%` (`id` , `item`,`value`,`signature`) VALUES ( NULL,?,?,?)"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(array("cert","cert",$pubKey)); +return true; +} + +static function insertSampleMenu($pdo,$adminCl) { +$menu = file_get_contents("../customer/speisekarte.txt"); +$adminCl->fillSpeisekarteCore($pdo, $menu); +} + +function insertSample($level,$lang,$adminpass,$workflow,$timezone) { +$pdo = $this->pdo; +$adminCl = new Admin(); +$adminCl::overruleTimeZone($timezone); +$adminCl->changeOneConfigDbItem($pdo,"workflowconfig",$workflow,"%config%",true); +if ($level == 1) { +// nothing to do - empty db +} else { +$roomTxt1 = array("Raum 1 (Tischkarte)","Room 1 (table map)","Espacio 1 (mapa de mesas)"); +$roomTxt2 = array("Raum 2 (Tischbuttons)","Room 2 (table buttons)","Espacio (botones des mesas)"); +$tableTxt = array("Tisch","Table","Mesa"); +$waiterTxt = array("Karl Kellner","Walter Waiter","Carlo Camarero"); +$cookTxt = array("Koch 1","Charlie Cook","Cocinero 1"); +$bossTxt = array("Charlie Chef","Maggy Manager","Jefe"); + + +$sql = "INSERT INTO `%room%` (`id`, `roomname`) VALUES (?,?)"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(array(1,$roomTxt1[$lang])); +if ($level == 3) { +$stmt->execute(array(2,$roomTxt2[$lang])); +} + +$sql = "INSERT INTO `%resttables%` (`id` , `tableno`, `roomid`) VALUES (? ,?,?)"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); + +for ($i=1;$i<7;$i++) { +$stmt->execute(array($i,$tableTxt[$lang] . " $i",1)); +if ($level == 3) { +$stmt->execute(array($i + 6,$tableTxt[$lang] . " " . ($i + 6),2)); +} +} +if ($level == 3) { +$sql = "INSERT INTO `%tablemaps%` (`id` , `roomid`, `img`,`sizex`,`sizey`) VALUES (NULL ,?,?,?,?)"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$room = file_get_contents("../customer/innenraum.png"); +$stmt->execute(array(1,$room,739,490)); + +$sql = "INSERT INTO `%tablepos%` (`id` , `tableid`, `x`,`y`) VALUES (NULL ,?,?,?)"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(array(1,70,74)); +$stmt->execute(array(2,9,57)); +$stmt->execute(array(3,19,37)); +$stmt->execute(array(4,30,21)); +$stmt->execute(array(5,49,21)); +$stmt->execute(array(6,76,22)); +} + +if ($workflow == 2) { +// only receipts - no views kitchen,bar,supply +$this->insertUser($waiterTxt[$lang],$adminpass,0,1,0,0,0,1,0,1,0,0,0,1,0,$lang,1); +if ($level == 3) { +$this->insertUser($bossTxt[$lang],$adminpass ,0,1,0,0,0,1,1,1,1,1,1,1,1,$lang,1); +} +} else { +$this->insertUser($waiterTxt[$lang],$adminpass,0,1,0,0,1,1,0,1,0,0,0,1,0,$lang,1); +if ($level == 3) { +$this->insertUser($cookTxt[$lang],$adminpass ,0,0,1,1,1,0,0,0,0,0,0,0,0,$lang,1); +$this->insertUser($bossTxt[$lang],$adminpass ,0,1,1,1,1,1,1,1,1,1,1,1,1,$lang,1); +} +} + + +$logoimg = file_get_contents("../customer/logo.png"); +$sql = "INSERT INTO %logo% (id,name,setting) VALUES(1,?,?)"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(array("logoimg",$logoimg)); + +self::insertSampleMenu($pdo,$adminCl); +} +} +} + + +$command = $_GET["command"]; +if ($command == 'checkWriteAccess') { +$checker = new Checks(); +$checker->checkWriteAccess(); +} else if ($command == 'checkPhpStatus') { +$checker = new InstallAdmin(); +$checker->checkPhpStatus(); +} else if ($command == 'testDbConnection') { +$admin = new InstallAdmin(); +try { +if (isset($_POST['host']) && isset($_POST['dbname']) && isset($_POST['user']) && isset($_POST['pass'])) { +$admin->testDbConnection($_POST['host'],$_POST['dbname'],$_POST['user'],$_POST['pass']); +} else { +echo json_encode("ERROR"); +} +} catch (Exception $e) { +echo json_encode("ERROR"); +} +} else if ($command == 'getConfig') { +$configWriter = new ConfigWriter(); +$configWriter->getConfigVals(); +} else if ($command == 'install') { +$admin = new InstallAdmin(); +$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']); +$admin->setPdo($pdo); +$admin->setPrefix($_POST['prefix']); +$admin->setTimeZone($_POST['timezone']); + +DbUtils::overruleTimeZone($_POST['timezone']); +DbUtils::overrulePrefix($_POST['prefix']); + +set_time_limit(60*5); +$admin->createTables($_POST['point'],$_POST['lang'],$_POST['currency'],$_POST['timezone']); +$ok = $admin->createSslKeys($pdo); + +$admin->signLastBillId(); +if (!$ok) { +echo json_encode("Fehler: Ist OpenSSL richtig installiert?"); +return; +} + +$admin->insertUser("admin",$_POST['adminpass'],1,0,0,0,0,0,0,0,0,1,1,0,0,$_POST['lang'],1); +$admin->writeConfigFile($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password'],$_POST['prefix']); +if(session_id() == '') { +session_start(); +} +session_destroy(); +echo json_encode("OK"); +} else if ($command == 'insertsamplecontent') { +try { +$admin = new InstallAdmin(); +$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']); +$admin->setPdo($pdo); +$admin->setPrefix($_POST['prefix']); +$admin->setTimeZone($_POST["timezone"]); + +$admin->insertSample(intval($_POST["level"]),intval($_POST["lang"]),$_POST['adminpass'],$_POST["workflow"],$_POST["timezone"]); +echo json_encode("OK"); +} +catch (PDOException $e) { +echo json_encode("ERROR: $e"); +} +} else if ($command == 'gettimezones') { +$timezone_identifiers = DateTimeZone::listIdentifiers(); +$zones = array(); +for ($i=0; $i < count($timezone_identifiers); $i++) { +$zones[] = $timezone_identifiers[$i]; +} +echo json_encode($zones); +} else if ($command == 'update') { +$admin = new InstallAdmin(); +$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']); +$admin->setPdo($pdo); +$admin->setPrefix($_POST['prefix']); + +$version = $admin->getCurrentVersion(); +if (is_null($version)) { +echo json_encode("Version nicht bestimmbar"); +return; +} + +$ret = true; +if ($version == "1.0.13") { +$ret &= $admin->updateUserTable1013_1014(); +$ret &= $admin->updateUserTable1014_1015(); +$ret &= $admin->updateUserTable1015_1016(); +$ret &= $admin->updateUserTable1016_1017(); +$ret &= $admin->updateUserTable1017_1018(); +$ret &= $admin->updateUserTable1019_1020(); +$ret &= $admin->updateUserTable1022_1023($_POST['prefix']); +$ret &= $admin->updateUserTable1023_1024($_POST['prefix']); +$ret &= $admin->updateUserTable1024_1025($_POST['prefix']); +$ret &= $admin->updateUserTable1025_1026($_POST['prefix']); +$ret &= $admin->updateUserTable1026_1027($_POST['prefix']); +$ret &= $admin->updateUserTable1027_1028($_POST['prefix']); +$ret &= $admin->updateUserTable1028_1029($_POST['prefix']); +$ret &= $admin->updateUserTable1029_1030($_POST['prefix']); +$ret &= $admin->updateUserTable1030_1031($_POST['prefix']); +$ret &= $admin->updateUserTable1031_1032($_POST['prefix']); +$ret &= $admin->updateUserTable1032_1033($_POST['prefix']); +$ret &= $admin->updateUserTable1033_1034($_POST['prefix']); +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if ($version == "1.0.14") { +$ret &= $admin->updateUserTable1014_1015(); +$ret &= $admin->updateUserTable1015_1016(); +$ret &= $admin->updateUserTable1016_1017(); +$ret &= $admin->updateUserTable1017_1018(); +$ret &= $admin->updateUserTable1019_1020(); +$ret &= $admin->updateUserTable1022_1023($_POST['prefix']); +$ret &= $admin->updateUserTable1023_1024($_POST['prefix']); +$ret &= $admin->updateUserTable1024_1025($_POST['prefix']); +$ret &= $admin->updateUserTable1025_1026($_POST['prefix']); +$ret &= $admin->updateUserTable1026_1027($_POST['prefix']); +$ret &= $admin->updateUserTable1027_1028($_POST['prefix']); +$ret &= $admin->updateUserTable1028_1029($_POST['prefix']); +$ret &= $admin->updateUserTable1029_1030($_POST['prefix']); +$ret &= $admin->updateUserTable1030_1031($_POST['prefix']); +$ret &= $admin->updateUserTable1031_1032($_POST['prefix']); +$ret &= $admin->updateUserTable1032_1033($_POST['prefix']); +$ret &= $admin->updateUserTable1033_1034($_POST['prefix']); +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if ($version == "1.0.15") { +$ret &= $admin->updateUserTable1015_1016(); +$ret &= $admin->updateUserTable1016_1017(); +$ret &= $admin->updateUserTable1017_1018(); +$ret &= $admin->updateUserTable1019_1020(); +$ret &= $admin->updateUserTable1022_1023($_POST['prefix']); +$ret &= $admin->updateUserTable1023_1024($_POST['prefix']); +$ret &= $admin->updateUserTable1024_1025($_POST['prefix']); +$ret &= $admin->updateUserTable1025_1026($_POST['prefix']); +$ret &= $admin->updateUserTable1026_1027($_POST['prefix']); +$ret &= $admin->updateUserTable1027_1028($_POST['prefix']); +$ret &= $admin->updateUserTable1028_1029($_POST['prefix']); +$ret &= $admin->updateUserTable1029_1030($_POST['prefix']); +$ret &= $admin->updateUserTable1030_1031($_POST['prefix']); +$ret &= $admin->updateUserTable1031_1032($_POST['prefix']); +$ret &= $admin->updateUserTable1032_1033($_POST['prefix']); +$ret &= $admin->updateUserTable1033_1034($_POST['prefix']); +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if ($version == "1.0.16") { +$ret &= $admin->updateUserTable1016_1017(); +$ret &= $admin->updateUserTable1017_1018(); +$ret &= $admin->updateUserTable1019_1020(); +$ret &= $admin->updateUserTable1022_1023($_POST['prefix']); +$ret &= $admin->updateUserTable1023_1024($_POST['prefix']); +$ret &= $admin->updateUserTable1024_1025($_POST['prefix']); +$ret &= $admin->updateUserTable1025_1026($_POST['prefix']); +$ret &= $admin->updateUserTable1026_1027($_POST['prefix']); +$ret &= $admin->updateUserTable1027_1028($_POST['prefix']); +$ret &= $admin->updateUserTable1028_1029($_POST['prefix']); +$ret &= $admin->updateUserTable1029_1030($_POST['prefix']); +$ret &= $admin->updateUserTable1030_1031($_POST['prefix']); +$ret &= $admin->updateUserTable1031_1032($_POST['prefix']); +$ret &= $admin->updateUserTable1032_1033($_POST['prefix']); +$ret &= $admin->updateUserTable1033_1034($_POST['prefix']); +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.17") || ($version == "1.0.18")) { +$ret &= $admin->updateUserTable1018_1019(); +$ret &= $admin->updateUserTable1019_1020(); +$ret &= $admin->updateUserTable1022_1023($_POST['prefix']); +$ret &= $admin->updateUserTable1023_1024($_POST['prefix']); +$ret &= $admin->updateUserTable1024_1025($_POST['prefix']); +$ret &= $admin->updateUserTable1025_1026($_POST['prefix']); +$ret &= $admin->updateUserTable1026_1027($_POST['prefix']); +$ret &= $admin->updateUserTable1027_1028($_POST['prefix']); +$ret &= $admin->updateUserTable1028_1029($_POST['prefix']); +$ret &= $admin->updateUserTable1029_1030($_POST['prefix']); +$ret &= $admin->updateUserTable1030_1031($_POST['prefix']); +$ret &= $admin->updateUserTable1031_1032($_POST['prefix']); +$ret &= $admin->updateUserTable1032_1033($_POST['prefix']); +$ret &= $admin->updateUserTable1033_1034($_POST['prefix']); +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if ($version == "1.0.19") { +$ret &= $admin->updateUserTable1019_1020(); +$ret &= $admin->updateUserTable1022_1023($_POST['prefix']); +$ret &= $admin->updateUserTable1023_1024($_POST['prefix']); +$ret &= $admin->updateUserTable1024_1025($_POST['prefix']); +$ret &= $admin->updateUserTable1025_1026($_POST['prefix']); +$ret &= $admin->updateUserTable1026_1027($_POST['prefix']); +$ret &= $admin->updateUserTable1027_1028($_POST['prefix']); +$ret &= $admin->updateUserTable1028_1029($_POST['prefix']); +$ret &= $admin->updateUserTable1029_1030($_POST['prefix']); +$ret &= $admin->updateUserTable1030_1031($_POST['prefix']); +$ret &= $admin->updateUserTable1031_1032($_POST['prefix']); +$ret &= $admin->updateUserTable1032_1033($_POST['prefix']); +$ret &= $admin->updateUserTable1033_1034($_POST['prefix']); +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.20") || ($version == "1.0.21")) { +// nothing to do... :) (but maybe user has pressed though) +} else if (($version == "1.0.22")) { +$ret &= $admin->updateUserTable1022_1023($_POST['prefix']); +$ret &= $admin->updateUserTable1023_1024($_POST['prefix']); +$ret &= $admin->updateUserTable1024_1025($_POST['prefix']); +$ret &= $admin->updateUserTable1025_1026($_POST['prefix']); +$ret &= $admin->updateUserTable1026_1027($_POST['prefix']); +$ret &= $admin->updateUserTable1027_1028($_POST['prefix']); +$ret &= $admin->updateUserTable1028_1029($_POST['prefix']); +$ret &= $admin->updateUserTable1029_1030($_POST['prefix']); +$ret &= $admin->updateUserTable1030_1031($_POST['prefix']); +$ret &= $admin->updateUserTable1031_1032($_POST['prefix']); +$ret &= $admin->updateUserTable1032_1033($_POST['prefix']); +$ret &= $admin->updateUserTable1033_1034($_POST['prefix']); +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.23")) { +$ret &= $admin->updateUserTable1023_1024($_POST['prefix']); +$ret &= $admin->updateUserTable1024_1025($_POST['prefix']); +$ret &= $admin->updateUserTable1025_1026($_POST['prefix']); +$ret &= $admin->updateUserTable1026_1027($_POST['prefix']); +$ret &= $admin->updateUserTable1027_1028($_POST['prefix']); +$ret &= $admin->updateUserTable1028_1029($_POST['prefix']); +$ret &= $admin->updateUserTable1029_1030($_POST['prefix']); +$ret &= $admin->updateUserTable1030_1031($_POST['prefix']); +$ret &= $admin->updateUserTable1031_1032($_POST['prefix']); +$ret &= $admin->updateUserTable1032_1033($_POST['prefix']); +$ret &= $admin->updateUserTable1033_1034($_POST['prefix']); +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.24")) { +$ret &= $admin->updateUserTable1024_1025($_POST['prefix']); +$ret &= $admin->updateUserTable1025_1026($_POST['prefix']); +$ret &= $admin->updateUserTable1026_1027($_POST['prefix']); +$ret &= $admin->updateUserTable1027_1028($_POST['prefix']); +$ret &= $admin->updateUserTable1028_1029($_POST['prefix']); +$ret &= $admin->updateUserTable1029_1030($_POST['prefix']); +$ret &= $admin->updateUserTable1030_1031($_POST['prefix']); +$ret &= $admin->updateUserTable1031_1032($_POST['prefix']); +$ret &= $admin->updateUserTable1032_1033($_POST['prefix']); +$ret &= $admin->updateUserTable1033_1034($_POST['prefix']); +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.25")) { +$ret &= $admin->updateUserTable1025_1026($_POST['prefix']); +$ret &= $admin->updateUserTable1026_1027($_POST['prefix']); +$ret &= $admin->updateUserTable1027_1028($_POST['prefix']); +$ret &= $admin->updateUserTable1028_1029($_POST['prefix']); +$ret &= $admin->updateUserTable1029_1030($_POST['prefix']); +$ret &= $admin->updateUserTable1030_1031($_POST['prefix']); +$ret &= $admin->updateUserTable1031_1032($_POST['prefix']); +$ret &= $admin->updateUserTable1032_1033($_POST['prefix']); +$ret &= $admin->updateUserTable1033_1034($_POST['prefix']); +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.26")) { +$ret &= $admin->updateUserTable1026_1027($_POST['prefix']); +$ret &= $admin->updateUserTable1027_1028($_POST['prefix']); +$ret &= $admin->updateUserTable1028_1029($_POST['prefix']); +$ret &= $admin->updateUserTable1029_1030($_POST['prefix']); +$ret &= $admin->updateUserTable1030_1031($_POST['prefix']); +$ret &= $admin->updateUserTable1031_1032($_POST['prefix']); +$ret &= $admin->updateUserTable1032_1033($_POST['prefix']); +$ret &= $admin->updateUserTable1033_1034($_POST['prefix']); +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.27")) { +$ret &= $admin->updateUserTable1027_1028($_POST['prefix']); +$ret &= $admin->updateUserTable1028_1029($_POST['prefix']); +$ret &= $admin->updateUserTable1029_1030($_POST['prefix']); +$ret &= $admin->updateUserTable1030_1031($_POST['prefix']); +$ret &= $admin->updateUserTable1031_1032($_POST['prefix']); +$ret &= $admin->updateUserTable1032_1033($_POST['prefix']); +$ret &= $admin->updateUserTable1033_1034($_POST['prefix']); +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.28")) { +$ret &= $admin->updateUserTable1028_1029($_POST['prefix']); +$ret &= $admin->updateUserTable1029_1030($_POST['prefix']); +$ret &= $admin->updateUserTable1030_1031($_POST['prefix']); +$ret &= $admin->updateUserTable1031_1032($_POST['prefix']); +$ret &= $admin->updateUserTable1032_1033($_POST['prefix']); +$ret &= $admin->updateUserTable1033_1034($_POST['prefix']); +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.29")) { +$ret &= $admin->updateUserTable1029_1030($_POST['prefix']); +$ret &= $admin->updateUserTable1030_1031($_POST['prefix']); +$ret &= $admin->updateUserTable1031_1032($_POST['prefix']); +$ret &= $admin->updateUserTable1032_1033($_POST['prefix']); +$ret &= $admin->updateUserTable1033_1034($_POST['prefix']); +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.30")) { +$ret &= $admin->updateUserTable1030_1031($_POST['prefix']); +$ret &= $admin->updateUserTable1031_1032($_POST['prefix']); +$ret &= $admin->updateUserTable1032_1033($_POST['prefix']); +$ret &= $admin->updateUserTable1033_1034($_POST['prefix']); +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.31")) { +$ret &= $admin->updateUserTable1031_1032($_POST['prefix']); +$ret &= $admin->updateUserTable1032_1033($_POST['prefix']); +$ret &= $admin->updateUserTable1033_1034($_POST['prefix']); +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.32")) { +$ret &= $admin->updateUserTable1032_1033($_POST['prefix']); +$ret &= $admin->updateUserTable1033_1034($_POST['prefix']); +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.33")) { +$ret &= $admin->updateUserTable1033_1034($_POST['prefix']); +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.34")) { +$ret &= $admin->updateUserTable1034_1035($_POST['prefix']); +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.35")) { +$ret &= $admin->updateUserTable1035_1036($_POST['prefix']); +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.36")) { +$ret &= $admin->updateUserTable1036_1037($_POST['prefix']); +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.37")) { +$ret &= $admin->updateUserTable1037_1038($_POST['prefix']); +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.38")) { +$ret &= $admin->updateUserTable1038_1039($_POST['prefix']); +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.39")) { +$ret &= $admin->updateUserTable1039_1040($_POST['prefix']); +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.40")) { +$ret &= $admin->updateUserTable1040_1041($_POST['prefix']); +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.41")) { +$ret &= $admin->updateUserTable1041_1042($_POST['prefix']); +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.42")) { +$ret &= $admin->updateUserTable1042_1043($_POST['prefix']); +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else if (($version == "1.0.43")) { +$ret &= $admin->updateUserTable1043_1100($_POST['prefix']); +} else { +echo json_encode("Quellversion nicht unterstützt"); +return; +} + +if(session_id() == '') { +session_start(); +} +session_destroy(); +if ($ret) { +$admin->writeConfigFile($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password'],$_POST['prefix']); +echo json_encode("OK"); +} else { +echo json_encode("ERROR"); +} +} +?> \ No newline at end of file diff --git a/jQuery-MIT-LICENSE.html b/webapp/jQuery-MIT-LICENSE.html similarity index 100% rename from jQuery-MIT-LICENSE.html rename to webapp/jQuery-MIT-LICENSE.html diff --git a/webapp/jquery-UI-MIT-LICENSE.txt b/webapp/jquery-UI-MIT-LICENSE.txt new file mode 100644 index 0000000..2965224 --- /dev/null +++ b/webapp/jquery-UI-MIT-LICENSE.txt @@ -0,0 +1,25 @@ +Copyright (c) 2012 Paul Bakaus, http://jqueryui.com/ + +This software consists of voluntary contributions made by many +individuals (AUTHORS.txt, http://jqueryui.com/about) For exact +contribution history, see the revision history and logs, available +at http://jquery-ui.googlecode.com/svn/ + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/webapp/jquery-mobile-datepicker-wrapper-LICENSE.html b/webapp/jquery-mobile-datepicker-wrapper-LICENSE.html new file mode 100644 index 0000000..ca68798 --- /dev/null +++ b/webapp/jquery-mobile-datepicker-wrapper-LICENSE.html @@ -0,0 +1,16 @@ +The MIT License (MIT) +Copyright (c) 2013 Alexander Schmitz +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/kitchen.html b/webapp/kitchen.html similarity index 86% rename from kitchen.html rename to webapp/kitchen.html index 3aea062..3dbfbc5 100644 --- a/kitchen.html +++ b/webapp/kitchen.html @@ -2,7 +2,7 @@ Ansicht Kueche - + @@ -52,12 +52,20 @@ @@ -95,23 +109,23 @@ $(document).on("pageinit", "#kitchen-page", function () {
  • Module
  • -
    -

    Kche

    +
    +

    Küche

    -
    +
    -
    +
    - +
    \ No newline at end of file diff --git a/webapp/kitchenbar.js b/webapp/kitchenbar.js new file mode 100644 index 0000000..7ab3f2d --- /dev/null +++ b/webapp/kitchenbar.js @@ -0,0 +1,489 @@ +var KB_READY = ["Zubereitet","Ready","Preparado"]; +var KB_MAX_WAIT = ["Max. Wartezeit: ","Max. waited: ","Tiempo de espera: "]; +var KB_TO_MAKE = ["Herzustellen","To prepare","Para preparar"]; +var KB_TO_FINISHED = ["Fertig","Ready to serve","Completo"]; +var KB_TABLE = ["Tisch","Table","Mesa"]; + +// user has rights (default: no) +var isInitialized = false; + +var displayWorkToDo = false; +var displayFinished = false; +var displayHeaderFooter = false; + +var cookedEntries = null; +var entriesToCook = null; +var user = ""; + +// increase performance by calling AJAX a bit later as a thread +function declareProductBeCookingOrCooked(queueid,action) { + window.setTimeout(function(){declareProductBeCookingOrCooked_orig(queueid,action)},100); +} + +function declareProductBeCookingOrCooked_orig(queueid,action) { + var data = { queueid: queueid, + action : action}; + doAjax("POST","php/contenthandler.php?module=queue&command=declareProductBeCookingOrCooked",data,resultOfProductDeclaration,"could not declare product"); +} + +function resultOfProductDeclaration(jsonText) { + if (jsonText.status != "OK") { + alert("Fehler " + jsonText.code + ": " + jsonText.msg); + } +} + +function declareProductNOTBeCooked(queueid) { + var data = { queueid: queueid }; + doAjax("POST","php/contenthandler.php?module=queue&command=declareProductNotBeCooked",data,resultOfProductDeclaration,"could not unmake product"); +} + +function fillTableWithEntriesToCook(allEntriesToCook) { + entriesToCook = allEntriesToCook; + fillTableWithEntriesToCookCore(); + bindEntriesToCook(); +} + +function removeOrRedeclareAnIdFromPrepared(theId,doRemove) { + $.each(entriesToCook, function (j, table) { + var aList = table.queueitems; + var tablename = table.table; + + // now remove this from the list or change entry! + + var i=0; + var found = false; + for (i=0;i'; + } + var icon = "check"; + var status = "not_cooking"; + var label = toHtml(entry.longname); + if (entry.cooking != '') { + theme ='d'; + status = "cooking"; + label += " (" + entry.cooking + ")"; + } + + var extratxt = createExtraParagraph(entry.extras); + + var entryToAdd = { + name: label + extratxt, + cooking: entry.cooking, + queueid: entry.id, + option: option, + waiticon: entry.waiticon + }; + var setLength = qset.length; + qset[setLength] = entryToAdd; + }); + + var grouped = groupItemToMake(qset); + + // now format these entries + var aList = '
      '; + aList += '
    • ' + tablename + ' (' + KB_MAX_WAIT[lang] + maxWaitTime + ' min)
    • '; + + var i=0; + var length = grouped.counts.length; + + for (i=0;i'; + var id_joined = grouped.queueids[i].join("_"); + var theme = 'c'; + var icon = "check"; + var status = "not_cooking"; + var count = grouped.counts[i]; + + var label = grouped.names[i]; + var imgpart = ""; + if (count > 1) { + label = "" + count + "x " + label; + imgpart = "
      "; + } + var cooking = grouped.cookings[i]; + var option = grouped.options[i]; + if (cooking != '') { + theme ='d'; + icon = "arrow-d"; + status = "cooking"; + } + aList += '
    • ' + img + label + option + imgpart + '
    • '; + } + + aList += '
    '; + + return aList; +} + +function fillTableWithCookedEntries(entries) { + cookedEntries = entries; + fillTableWithCookedEntriesCore(); + bindCookedEntries(); +} + +function bindCookedEntries() { + $(".deliveredlistitem").off("click").on("click", function (e) { + + var idlist = this.id; + var idarr = idlist.split("_"); + var firstid = idarr[0]; // this is the id to handle! + declareProductNOTBeCooked(firstid); + + getAndDisplayAllEntries(); + + }); +} + +function fillTableWithCookedEntriesCore() { + if ((cookedEntries != null) && (cookedEntries.length > 0)) { + + var qset = []; + + $.each(cookedEntries, function (i, entry) { + var option = ''; + if (entry.option != '') { + var theComment = toHtml(entry.option); + option = '

    ' + theComment + '

    '; + } + + var label = toHtml(entry.longname); + + var extratxt = createExtraParagraph(entry.extras); + + var table = entry.tablename; + var entryToAdd = { + name: label + extratxt, + queueid: entry.id, + option: option, + extras: extratxt, + table: table + }; + var setLength = qset.length; + qset[setLength] = entryToAdd; + }); + + var grouped = groupMadeItems(qset); + + var theList = '
      '; + theList += '
    • ' + KB_READY[lang] + '
    • '; + + var length = grouped.counts.length; + + for (i=0;i 1) { + label = "" + count + "x " + label; + //imgpart = "
      "; + } + var option = grouped.options[i]; + var tablename = KB_TABLE[lang] + ": " + grouped.tables[i]; + var infotext = tablename; + if (option != '') { + infotext = option + "

      " + tablename + "

      "; + } + + var id_joined = grouped.queueids[i].join("_"); + theList += '
    • ' + label; + theList += '

      ' + infotext + '

      ' + imgpart; + theList += '
    • '; + } + + theList += '
    '; + + $("#listWithCookedEntries").html(theList); + $("#listWithCookedEntries").trigger("create"); + + + } else { + // remove also headline of list, if list is empty + $("#listWithCookedEntries").html(""); + } +} + +function handleGlobalRefresh(name) { + parent.frames[name].location.reload(); + getAndDisplayAllEntries(); +} + +function getAndDisplayAllEntries() +{ + checkForLogIn(); + if (isInitialized) { + if (displayWorkToDo) { + getEntriesToCook(); + } + if (displayFinished) { + getCookedEntries(); + } + } +} + +function getGeneralConfigItems() { + doAjax("GET", "php/contenthandler.php?module=admin&command=getGeneralConfigItems", null, insertGeneralConfigItems, "Fehler Konfigurationsdaten"); + doAjax("GET","php/contenthandler.php?module=admin&command=getJsonMenuItemsAndVersion",null,setUser,"Benutzerdaten nicht bermittelt"); +} + +function setUser(userAndVersion) { + user = userAndVersion.user; +} + +function insertGeneralConfigItems(configResult) { + if (configResult.status == "OK") { + var values = configResult.msg; + setLanguage(values.userlanguage); + isInitialized = true; + if (displayHeaderFooter) { + initializeMainMenu("#modulemenu"); + } else { + $("#modulepanel").hide(); + $("#menuswitch").hide(); + $("#thefooterr").hide(); + } + initializeEverything(); + setHeadlines(); + getAndDisplayAllEntries(); + } else { + setTimeout(function(){document.location.href = "index.html"},250); // not logged in + //alert("Fehler beim Aufruf der Seite: " + configResult.msg); + } +} + +function setWorkMode(urlsuffix) { + if (urlsuffix.length<=1) { + // no limitations - display all + displayWorkToDo = true; + displayFinished = true; + displayHeaderFooter = true; + } else { + var modes = (urlsuffix.replace("?","")).split(","); + $("#hrline").hide(); + if (modes.indexOf("toprepare") >= 0) { + displayWorkToDo = true; + } + if (modes.indexOf("finished") >= 0) { + displayFinished = true; + } + if (modes.indexOf("headerfooter") >= 0) { + displayHeaderFooter = true; + } + } +} + +/** + * Not possible in setWorkMode, because set Lang would overwrite. + * So set headlines in method that can be called later + */ +function setHeadlines() { + if (!displayHeaderFooter) { + // then replace by individual footer (embedded in iframe) + if (displayWorkToDo) { + $("#moduleheadline").html(KB_TO_MAKE[lang]); + } else if (displayFinished) { + $("#moduleheadline").html(KB_TO_FINISHED[lang]); + } + $("#headerline").trigger("create"); + } +} + +function groupMadeItems(theSet) { + var counts = []; + var joinedvals = []; + var names = []; + var options = []; + var extras = []; + var tables = []; + var queueids = []; + + var grouped = { + counts:counts, + joinedvals : joinedvals, + names: names, + options: options, + extras: extras, + tables: tables, + queueids : queueids + }; + + var i=0; + for (i=0;i= 0) { + // element is already in group + grouped.counts[index] = grouped.counts[index] + 1; + var queueidsarr = grouped.queueids[index]; + // append the current queueid + queueidsarr[queueidsarr.length] = queueid; + grouped.queueids[index] = queueidsarr; + } else { + // new element to be inserted in grouped + var gLength = grouped.counts.length; + grouped.counts[gLength] = 1; + grouped.joinedvals[gLength] = joinedNeedle; + grouped.names[gLength] = name; + grouped.options[gLength] = option; + grouped.extras[gLength] = extras; + grouped.tables[gLength] = table; + grouped.queueids[gLength] = [queueid]; + } + } + return grouped; +} + +function groupItemToMake(theSet) { + var counts = []; + var joinedvals = []; + var names = []; + var options = []; + var cookings = []; + var waiticons = []; + var queueids = []; + + var grouped = { counts:counts, + joinedvals : joinedvals, + names: names, + options: options, + cookings: cookings, + waiticons: waiticons, + queueids : queueids + }; + + var i=0; + for (i=0;i= 0) { + // element is already in group + grouped.counts[index] = grouped.counts[index] + 1; + var queueidsarr = grouped.queueids[index]; + // append the current queueid + queueidsarr[queueidsarr.length] = queueid; + grouped.queueids[index] = queueidsarr; + } else { + // new element to be inserted in grouped + var gLength = grouped.counts.length; + grouped.counts[gLength] = 1; + grouped.joinedvals[gLength] = joinedNeedle; + grouped.names[gLength] = name; + grouped.options[gLength] = option; + grouped.cookings[gLength] = cooking; + grouped.waiticons[gLength] = waiticon; + grouped.queueids[gLength] = [queueid]; + } + } + return grouped; +} \ No newline at end of file diff --git a/webapp/kundenwebseite/images.php b/webapp/kundenwebseite/images.php new file mode 100644 index 0000000..22e355a --- /dev/null +++ b/webapp/kundenwebseite/images.php @@ -0,0 +1,59 @@ += count($images)) { + $nextImg = 0; +} + +$txt = ""; +foreach ($images as $im) { + $txt .= $im["image"]; +} + +$content = Imager::getPageLayout($images,$prevImg,$imgno,$nextImg); + +//$content = $txt; + +//$content = "
    " . Pager::readAndSubstituteFile($pdo, $contentTemplate) . "
    "; + +$page = $header . $menu . $content . $footer; +echo $page; + + +?> \ No newline at end of file diff --git a/webapp/kundenwebseite/impressum.php b/webapp/kundenwebseite/impressum.php new file mode 100644 index 0000000..f4cce67 --- /dev/null +++ b/webapp/kundenwebseite/impressum.php @@ -0,0 +1,32 @@ +" . Pager::readAndSubstituteFile($pdo, $contentTemplate) . ""; + +$page = $header . $menu . $content . $footer; +echo $page; + + + +?> \ No newline at end of file diff --git a/webapp/kundenwebseite/index.php b/webapp/kundenwebseite/index.php new file mode 100644 index 0000000..be66676 --- /dev/null +++ b/webapp/kundenwebseite/index.php @@ -0,0 +1,31 @@ +" . Pager::readAndSubstituteFile($pdo, $contentTemplate) . ""; + +$page = $header . $menu . $content . $footer; +echo $page; + + + +?> \ No newline at end of file diff --git a/webapp/kundenwebseite/menu.php b/webapp/kundenwebseite/menu.php new file mode 100644 index 0000000..d47c97d --- /dev/null +++ b/webapp/kundenwebseite/menu.php @@ -0,0 +1,38 @@ +" . Pager::readAndSubstituteFile($pdo, $contentTemplate) . ""; + +$content = str_replace("{Produktkategorie}",Menumanager::getProdTypeName($pdo,$prodtype),$content); + +$menutxt = Menumanager::getMenu($pdo, $prodtype); +$content = str_replace("{Menu}", $menutxt, $content); + +$page = $header . $menu . $content . $footer; +echo $page; + + + +?> \ No newline at end of file diff --git a/webapp/kundenwebseite/php/imager.php b/webapp/kundenwebseite/php/imager.php new file mode 100644 index 0000000..bc4a2a0 --- /dev/null +++ b/webapp/kundenwebseite/php/imager.php @@ -0,0 +1,61 @@ += 0 && strpos($haystack, $needle, $temp) !== FALSE); + } + + public static function imagesInFolder($pdo) { + if (is_null($pdo)) { + $pdo = DbUtils::openDbAndReturnPdo(); + } + + $files = scandir("restaurantbilder"); + + $images = array(); + foreach($files as $aFile) { + if (self::endsWith(strtolower($aFile), ".jpg") + || + self::endsWith(strtolower($aFile), ".png") + || + self::endsWith(strtolower($aFile), ".gif") + ) { + $fileWithoutExtension = substr($aFile, 0, strlen($aFile) - 4); + if (file_exists("restaurantbilder/" . $fileWithoutExtension . ".txt")) { + $images[] = array("image" => $aFile, "description" => $fileWithoutExtension . ".txt"); + } else if ("restaurantbilder/" . file_exists($fileWithoutExtension . ".TXT")) { + $images[] = array("image" => $aFile, "description" => $fileWithoutExtension . ".TXT"); + } else { + $images[] = array("image" => $aFile, "description" => null); + } + } + } + + return $images; + } + + public static function getPageLayout($images,$prevImg,$imgno,$nextImg) { + $html = '
    '; + + $html .= '
    '; + if (!is_null($images[$imgno]["description"])) { + $txt = file_get_contents("restaurantbilder/" . $images[$imgno]["description"]); + $txt = str_replace("\n","
    ",$txt); + $html .= $txt . '

    '; + } + + $html .= ''; + + $html .= '
    '; + + return $html; + } +} + + +?> \ No newline at end of file diff --git a/webapp/kundenwebseite/php/menumanager.php b/webapp/kundenwebseite/php/menumanager.php new file mode 100644 index 0000000..84a03ed --- /dev/null +++ b/webapp/kundenwebseite/php/menumanager.php @@ -0,0 +1,65 @@ +prepare(DbUtils::substTableAlias($sql)); + $stmt->execute(); + return $stmt->fetchAll(PDO::FETCH_ASSOC); + } + + public static function getProdTypeName($pdo,$id) { + $sql = "SELECT name FROM %prodtype% WHERE id=?"; + $stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); + $stmt->execute(array($id)); + return $stmt->fetchObject()->name; + } + + private static function getDecPoint($pdo) { + $sql = "SELECT setting FROM %config% WHERE name=?"; + $stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); + $stmt->execute(array("decpoint")); + return $stmt->fetchObject()->setting; + } + private static function prods2Txt($prods,$depth,$decpoint) { + $txt = ""; + foreach ($prods as $aProd) { + $price = str_replace(".",$decpoint,$aProd["priceA"]); + $txt .= "
  • " . htmlspecialchars($aProd["longname"]) . "   $price
  • "; + } + return $txt; + } + + private static function getSubMenu($pdo,$id,$depth,$decpoint) { + $txt = ""; + $sql = "SELECT id,longname,priceA FROM %products% WHERE removed is null AND category=? ORDER BY sorting"; + $stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); + $stmt->execute(array($id)); + $allProdsInThisCat = $stmt->fetchAll(PDO::FETCH_ASSOC); + $txt = self::prods2Txt($allProdsInThisCat, $depth, $decpoint); + + $sql = "SELECT id,name FROM %prodtype% WHERE removed is null AND reference=? ORDER BY sorting"; + $stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); + $stmt->execute(array($id)); + $allProdTypesInThisCat = $stmt->fetchAll(PDO::FETCH_ASSOC); + + foreach($allProdTypesInThisCat as $aCat) { + $txt .= "
  • " . htmlspecialchars($aCat["name"]) . "
  • "; + + $txt .= self::getSubMenu($pdo, $aCat["id"],$depth+1,$decpoint); + } + return $txt; + } + + public static function getMenu($pdo,$id) { + $txt = "
      "; + $txt .= self::getSubMenu($pdo, $id, 0, self::getDecPoint($pdo)); + $txt .= "
    "; + + return $txt; + } +} + +?> \ No newline at end of file diff --git a/webapp/kundenwebseite/php/pager.php b/webapp/kundenwebseite/php/pager.php new file mode 100644 index 0000000..4fb01b6 --- /dev/null +++ b/webapp/kundenwebseite/php/pager.php @@ -0,0 +1,64 @@ + \n\n"; + return $menu; + } + + + +} + +?> \ No newline at end of file diff --git a/webapp/kundenwebseite/php/replacer.php b/webapp/kundenwebseite/php/replacer.php new file mode 100644 index 0000000..10e3e45 --- /dev/null +++ b/webapp/kundenwebseite/php/replacer.php @@ -0,0 +1,41 @@ +",htmlspecialchars($companyInfo)); + } + + public static function getWebimpressum($pdo) { + $companyInfo = self::getConfigItem($pdo, "webimpressum"); + return str_replace("\n","
    ",htmlspecialchars($companyInfo)); + } + + public static function lineSubstitution ($pdo,$textline) { + $txt = str_replace("{Restaurantname}",self::getRestName($pdo),$textline); + $txt = str_replace("{Betriebsinfo}",self::getWebimpressum($pdo),$txt); + $txt = str_replace("{Version}",self::getConfigItem($pdo,"version"),$txt); + return $txt; + } + + private static function getConfigItem($pdo,$item) { + $sql = "SELECT setting FROM %config% WHERE name=?"; + $stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); + $stmt->execute(array($item)); + $row = $stmt->fetchObject(); + return $row->setting; + } + +} + +?> \ No newline at end of file diff --git a/webapp/kundenwebseite/vorlage-impressum.txt b/webapp/kundenwebseite/vorlage-impressum.txt new file mode 100644 index 0000000..b267d9d --- /dev/null +++ b/webapp/kundenwebseite/vorlage-impressum.txt @@ -0,0 +1,37 @@ + +

    Impressum

    + +Angaben gemäß § 5 TMG:

    + + +{Betriebsinfo} + + +
    + +

    Haftungsausschluss (Disclaimer)

    + +

    Haftung für Inhalte

    + +Als Diensteanbieter sind wir gemäß § 7 Abs.1 TMG für eigene Inhalte auf diesen Seiten nach den allgemeinen Gesetzen verantwortlich. +Sollten wir davon Kenntnis bekommen, dass Inhalte dieser Webseite rechtswidriger Matur sind, werden wir diese unverzüglich entfernen. +Eine Haftung für derlei Inhalte ist jedoch erst ab Kenntnis der Rechtsverletzung möglich. + + +

    Haftung für Links

    + +Unser Angebot enthält Links zu externen Webseiten Dritter. Auf die Inhalte der verlinkten Seiten haben wir jedoch keinen +redaktionellen Einfluss. Der Inhalt der verlinkten Seiten kann sich ändern, ohne dass wir davon Kenntnis erhalten. + +Sobald wir auf rechtswidrige Inhalte aufmerksam werden, auf die wir verlinkt haben, werden wir diese Links unverzüglich entfernen. Es +ist uns jedoch nicht möglich, alle verlinkten Seiten permanent auf rechtswidrige Inhalte hin zu überwachen. + + +

    Urheberrecht

    + +Die durch uns erstellten Inhalte auf diesen Seiten unterliegen dem deutschen Urheberrecht. +Die kommerzielle Vervielfältigung, Bearbeitung, Verbreitung und jede Art der Verwertung außerhalb der Grenzen des Urheberrechtes bedürfen +unserer schriftlichen Zustimmung. + +Sollten Sie Urheberrechtsverletzungen auf unseren Seiten feststellen, bitten wir um eine Nachricht, damit wir die rechtswidrige +Nutzung unterbinden können. \ No newline at end of file diff --git a/webapp/kundenwebseite/vorlage-menu.txt b/webapp/kundenwebseite/vorlage-menu.txt new file mode 100644 index 0000000..5ce7a7d --- /dev/null +++ b/webapp/kundenwebseite/vorlage-menu.txt @@ -0,0 +1,5 @@ +

    Unser Angebot

    + +

    Im {Restaurantname} haben wir sehr leckere {Produktkategorie} für Sie:

    + +

    {Menu}

    diff --git a/webapp/kundenwebseite/vorlage-startseite.txt b/webapp/kundenwebseite/vorlage-startseite.txt new file mode 100644 index 0000000..326377f --- /dev/null +++ b/webapp/kundenwebseite/vorlage-startseite.txt @@ -0,0 +1,13 @@ +

    Willkommen im {Restaurantname}

    + +

    Wir heißen Sie herzlich auf unserer Internetseite zum {Restaurantname} willkommen. In unserem Restaurant finden Sie die leckersten +Speisen der ganzen Stadt!

    + +

    Zusätzlich zu unserem Standard-Speiseplan bieten wir Ihnen saisonale und regionale Spezialitäten an. Unsere Küche ist bemüht, +Gemüse aus ökologischem Anbau und Fleisch aus ethisch vorbildhaften Betrieben anzubieten.

    + +

    Lassen Sie sich vom Ambiente überzeugen und reservieren Sie noch heute einen Tisch!

    + +

    Wir freuen uns auf Ihren Besuch!

    + +

    Das gesamte Restaurant-Team

    \ No newline at end of file diff --git a/webapp/kundenwebseite/vorlagen/classic/css/style.css b/webapp/kundenwebseite/vorlagen/classic/css/style.css new file mode 100644 index 0000000..43bb9f9 --- /dev/null +++ b/webapp/kundenwebseite/vorlagen/classic/css/style.css @@ -0,0 +1,234 @@ +@CHARSET "UTF-8"; + +html { + background-color:black; +} + + +.titleimg { + #background-image: url("../title.png"); + #background-repeat: repeat-x; +} + +.caption1 { + top:10; + left:20; + position:absolute; + + color:white; + font-size: 5em; + font-family: Helvetica, Arial, sans-serif; +} + +.caption2 { + bottom:10px; + right:10px; + position:absolute; + text-align:right; + + color:white; + font-size: 4em; + font-family: Helvetica, Arial, sans-serif; +} + +.titlepart{ + position:relative; + background-image: url("../title.png"); + background-repeat: repeat-x; +} + +.selectedmenuitem { + font-style: italic; + font-weight: bold; + color:yellow; +} + +.menupart { + border-top:1px solid MintCream; + border-bottom:1px solid MintCream; + background-color:black; +} + +.mainmenu li *:hover { + color:red; +} + +.mainmenu { + text-align:justify; + width:90%; + font-family: Helvetica, Arial, sans-serif; + font-size: 1.5em; + color:white; +} + +.mainmenu li a{ + color:white; + text-decoration: none; +} + +.mainmenu:after { + content: ''; + display: inline-block; + width: 100%; +} +.mainmenu:before { + content: ''; + display: block; + margin-top: -1.25em; +} +.mainmenu li{ + display: inline-block; + margin-right: -.25em; + position: relative; + top: 1.25em; +} + +.footer { + text-align:right; +} + +.footer a { + background-color:black; + text-decoration: none; + padding-right: 5%; + font-family: Helvetica, Arial, sans-serif; + color:gray; + font-size: 0.7em; +} + +.content { + font-family: Helvetica, Arial, sans-serif; + background-image: linear-gradient(0deg, black 0%, #444444 50%, black 100%); + color:MintCream; + padding-right: 30px; + padding-left: 30px; + padding-top: 30px; + padding-bottom: 30px; +} + +ul{ + margin-left:50px; +} + +.product { + color:#ffffff; + list-style-type: square; +} + +.type { + color:#aaaaaa; +} + +.level0 { + margin-left:0px; +} +.level1 { + margin-left:40px; + list-style-type: circle; +} +.level2 { + margin-left:80px; + list-style-type: circle; +} +.level3 { + margin-left:120px; + list-style-type: circle; +} +.level4 { + margin-left:160px; + list-style-type: circle; +} +.level5 { + margin-left:200px; + list-style-type: circle; +} +.level6 { + margin-left:240px; + list-style-type: circle; +} +.level7 { + margin-left:280px; + list-style-type: circle; +} +.level8 { + margin-left:320px; + list-style-type: circle; +} +.level9 { + margin-left:360px; + list-style-type: circle; +} +.level10 { + margin-left:400px; + list-style-type: circle; +} + +.plevel0 { + margin-left:0px; +} +.plevel1 { + margin-left:40px; +} +.plevel2 { + margin-left:80px; +} +.plevel3 { + margin-left:120px; +} +.plevel4 { + margin-left:160px; +} +.plevel5 { + margin-left:200px; +} +.plevel6 { + margin-left:240px; +} +.plevel7 { + margin-left:280px; +} +.plevel8 { + margin-left:320px; +} +.plevel9 { + margin-left:360px; +} +.level10 { + margin-left:400px; +} + + +#wrapper { + width: 100%; +} + +.imgarea { + text-align: center; + color: white; + max-width:80%; +} + +.nav { + max-width:10%; + color:white; + font-size:50px; + vertical-align:top; +} + +.nav input { + height:50px; + color:white; + background-color:transparent; + border-color:transparent; + font-size:50px; + margin-top:30px; +} + +.nav a { + text-decoration:none; +} + +.restimg { + width:100%; +} + diff --git a/webapp/kundenwebseite/vorlagen/classic/footer.html b/webapp/kundenwebseite/vorlagen/classic/footer.html new file mode 100644 index 0000000..d513375 --- /dev/null +++ b/webapp/kundenwebseite/vorlagen/classic/footer.html @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/webapp/kundenwebseite/vorlagen/classic/header.html b/webapp/kundenwebseite/vorlagen/classic/header.html new file mode 100644 index 0000000..7ff045b --- /dev/null +++ b/webapp/kundenwebseite/vorlagen/classic/header.html @@ -0,0 +1,19 @@ + + {Restaurantname} + + + + + + + +
    + +
    + {Restaurantname} +
    +
    + Willkommen! +
    +
    + diff --git a/webapp/kundenwebseite/vorlagen/classic/title.png b/webapp/kundenwebseite/vorlagen/classic/title.png new file mode 100644 index 0000000..65e2ab5 Binary files /dev/null and b/webapp/kundenwebseite/vorlagen/classic/title.png differ diff --git a/logout.php b/webapp/logout.php similarity index 100% rename from logout.php rename to webapp/logout.php diff --git a/webapp/manager.html b/webapp/manager.html new file mode 100644 index 0000000..9ff120d --- /dev/null +++ b/webapp/manager.html @@ -0,0 +1,2125 @@ + + + Ansicht Verwaltungs + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
      +
    • Module
    • +
    +
    + +
    +

    Administration

    +
    + Module +
    +
    +
    + +
    +

    Abrechnung und Datenexport

    +

    Hier finden sich die Menüpunkte zum Tagesabschluss oder Datenexport.

    + +
    +

    Tagesabschluss

    +

    Hier können Sie die seit dem letzten Abschluss getätigten neuen Transaktionen + zu einem neuen Abschluss führen. Anschließend sind alle bis zu diesem Zeitpunkt + erstellten Transaktionen/Kassenbons nicht mehr stornierbar!

    + +
    +
    + +
    +
    + +
    +
    +
    + + +
    +
    + + + + +
    +
    +

    Tagesabschlussbeispiel

    +

    Dieser Eintrag sollte hier nicht mehr stehen...

    +
    +
    +
    + + +
    +

    Datenexport

    +

    Hier können Sie eine csv-Datei erzeugen lassen, die ... + +

    + + + Startdatum Umsätze: +
    + +
    + +
    + + +
    +
    + + Enddatum Umsätze: +
    + +
    +
    + + +
    +
    + + + + + + + + +
    + +
    + +
    +

    Benutzer

    +
    +
    +
    + +
    +

    Konfiguration

    +
    +
    + + +
    +
    + + +
    +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    + +
    + + +
    + +
    + +
    + + +
    + +
    + + +
    + +
    + +
    + + +
    +
    +
    +
    +
    +
    + + +
    + + +
    + + Logo-Datei hochladen: + +
    + +
    +
    + Kein Logo +
    +
    + +
    +

    Druckerwarteschlangen

    +

    Daten

    +
    +
    + +
    +

    Datenbank

    + +
    +

    Speisekarte

    +
    +
    +
    +
    + + +
    + +

    +

    +

    Umsatzsteuer-Zuw.

    +

    +

    +

    + + + + +
    (%):
    (%):
    +

    +
    +

    + +
    +

    Raumplan

    +
    +
    + + + + +
    Anzahl Räume: + +
    Max. Anzahl Tische pro Raum: + +
    +
    +
    +
    +
    + +
    + + + +
    + + +
    +
    +
    + +
    +
    Inhalt
    +
    +
    + +
    + + +
    +
    +
    +
    +
    + +

    +

    + +

    +
    + +
    +

    +

    +

    +

    Sicherung und Import

    + Die Datensicherung und -wiederherstellung erfordert... +
    +
    + +
    +
    + + Die Datensicherung und -wiederherstellung erfordert... +
    +
    + +
    +
    + +
    +
    + + Diese Datei hochladen: + +
    + +
    +
    +
    +

    + +

    +

    + +
    +
    +

    + +
    + +
    Wenn dieser Text dargestellt wird, liegt ein Fehler vor!
    + + Download Printserver + +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +

    Keine Datenänderung

    +
    + +
    +

    Es wurden keine Daten geändert.

    +
    +
    + +
    + + +
    +
    +

    ?

    +

    ?

    + Ja + Nein +
    +
    + + + + \ No newline at end of file diff --git a/webapp/paydesk.html b/webapp/paydesk.html new file mode 100644 index 0000000..1c9b11c --- /dev/null +++ b/webapp/paydesk.html @@ -0,0 +1,1375 @@ + + + Ansicht Kasse + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
      +
    • Module
    • +
    +
    +
    +

    Kasse

    +
    + Module +
    +
    + +
    +
    +
    +
      +
    • Raumauswahl
    • +
    + + +
    +
      +
    +
    + +
      +
    + + + +
    +
      +
    • + Inhalt Kassenbon:

      0,00 Euro

      +
    • +
    +
    + + + + + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    + + + + +
    +
    +

    Zahlungsart

    +

    +

    +
    + + + + + +
    Zahlen: 0,00 +  Bezahlt: +
    Zurück: 0,00 Berechne +
    +
    +
    +

    +

    Auswahl der Zahlungsart

    +
    + Ja +
    +
    +
    + + +
    +
    +

    Zahlungsart

    + Ja + Wert2 + Nein +
    +
    + + +
    +
    +

    Bareinlage in die Kasse

    + + + +
    +
    + + +
    +
    +

    Barentnahme aus der Kasse

    + + + +
    +
    + +
    +
    +

    Übersicht Kellnerkasse

    + +

    Diese Übersicht enthält die Bewirtungseinnahme durch den Kellner seit der letzten Tageslosung sowie + als weiteren Wert den Kassenstand unter Berücksichtigung der eigenen Eingaben und Entnahmen.

    +

    Bewirtungseinnahmen:

    +

    inkl. eigener Kassen-Eingaben/Entnahmen:

    + OK +

    +
    + +
    +
    +

    Keine Rechnungselemente

    + +

    Es wurden keine abrechenbaren Produkte festgelegt (der Bon ist leer!).

    + OK +

    +
    + + + \ No newline at end of file diff --git a/webapp/php/3rdparty/fpdf/font/helvetica.php b/webapp/php/3rdparty/fpdf/font/helvetica.php new file mode 100644 index 0000000..7e20c3a --- /dev/null +++ b/webapp/php/3rdparty/fpdf/font/helvetica.php @@ -0,0 +1,19 @@ +278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, + 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, + chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, + chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +?> diff --git a/webapp/php/3rdparty/fpdf/font/helveticab.php b/webapp/php/3rdparty/fpdf/font/helveticab.php new file mode 100644 index 0000000..452e0ac --- /dev/null +++ b/webapp/php/3rdparty/fpdf/font/helveticab.php @@ -0,0 +1,19 @@ +278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, + 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, + 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, + chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, + chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); +?> diff --git a/webapp/php/3rdparty/fpdf/font/helveticabi.php b/webapp/php/3rdparty/fpdf/font/helveticabi.php new file mode 100644 index 0000000..ea5c56f --- /dev/null +++ b/webapp/php/3rdparty/fpdf/font/helveticabi.php @@ -0,0 +1,19 @@ +278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, + 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, + 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, + chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, + chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); +?> diff --git a/webapp/php/3rdparty/fpdf/font/helveticai.php b/webapp/php/3rdparty/fpdf/font/helveticai.php new file mode 100644 index 0000000..e3c638a --- /dev/null +++ b/webapp/php/3rdparty/fpdf/font/helveticai.php @@ -0,0 +1,19 @@ +278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, + 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, + chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, + chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +?> diff --git a/webapp/php/3rdparty/fpdf/fpdf.css b/webapp/php/3rdparty/fpdf/fpdf.css new file mode 100644 index 0000000..5db3377 --- /dev/null +++ b/webapp/php/3rdparty/fpdf/fpdf.css @@ -0,0 +1,21 @@ +body {font-family:"Times New Roman",serif} +h1 {font:bold 135% Arial,sans-serif; color:#4000A0; margin-bottom:0.9em} +h2 {font:bold 100% Arial,sans-serif; color:#900000; margin-top:1.5em} +dl.param dt {text-decoration:underline} +dl.param dd {margin-top:1em; margin-bottom:1em} +dl.param ul {margin-top:1em; margin-bottom:1em} +tt, code, kbd {font-family:"Courier New",Courier,monospace; font-size:82%} +div.source {margin-top:1.4em; margin-bottom:1.3em} +div.source pre {display:table; border:1px solid #24246A; width:100%; margin:0em; font-family:inherit; font-size:100%} +div.source code {display:block; border:1px solid #C5C5EC; background-color:#F0F5FF; padding:6px; color:#000000} +div.doc-source {margin-top:1.4em; margin-bottom:1.3em} +div.doc-source pre {display:table; width:100%; margin:0em; font-family:inherit; font-size:100%} +div.doc-source code {display:block; background-color:#E0E0E0; padding:4px} +.kw {color:#000080; font-weight:bold} +.str {color:#CC0000} +.cmt {color:#008000} +p.demo {text-align:center; margin-top:-0.9em} +a.demo {text-decoration:none; font-weight:bold; color:#0000CC} +a.demo:link {text-decoration:none; font-weight:bold; color:#0000CC} +a.demo:hover {text-decoration:none; font-weight:bold; color:#0000FF} +a.demo:active {text-decoration:none; font-weight:bold; color:#0000FF} diff --git a/webapp/php/3rdparty/fpdf/fpdf.php b/webapp/php/3rdparty/fpdf/fpdf.php new file mode 100644 index 0000000..0dd1cb6 --- /dev/null +++ b/webapp/php/3rdparty/fpdf/fpdf.php @@ -0,0 +1,1804 @@ +_dochecks(); + // Initialization of properties + $this->page = 0; + $this->n = 2; + $this->buffer = ''; + $this->pages = array(); + $this->PageSizes = array(); + $this->state = 0; + $this->fonts = array(); + $this->FontFiles = array(); + $this->diffs = array(); + $this->images = array(); + $this->links = array(); + $this->InHeader = false; + $this->InFooter = false; + $this->lasth = 0; + $this->FontFamily = ''; + $this->FontStyle = ''; + $this->FontSizePt = 12; + $this->underline = false; + $this->DrawColor = '0 G'; + $this->FillColor = '0 g'; + $this->TextColor = '0 g'; + $this->ColorFlag = false; + $this->ws = 0; + // Font path + if(defined('FPDF_FONTPATH')) + { + $this->fontpath = FPDF_FONTPATH; + if(substr($this->fontpath,-1)!='/' && substr($this->fontpath,-1)!='\\') + $this->fontpath .= '/'; + } + elseif(is_dir(dirname(__FILE__).'/font')) + $this->fontpath = dirname(__FILE__).'/font/'; + else + $this->fontpath = ''; + // Core fonts + $this->CoreFonts = array('courier', 'helvetica', 'times', 'symbol', 'zapfdingbats'); + // Scale factor + if($unit=='pt') + $this->k = 1; + elseif($unit=='mm') + $this->k = 72/25.4; + elseif($unit=='cm') + $this->k = 72/2.54; + elseif($unit=='in') + $this->k = 72; + else + $this->Error('Incorrect unit: '.$unit); + // Page sizes + $this->StdPageSizes = array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28), + 'letter'=>array(612,792), 'legal'=>array(612,1008)); + $size = $this->_getpagesize($size); + $this->DefPageSize = $size; + $this->CurPageSize = $size; + // Page orientation + $orientation = strtolower($orientation); + if($orientation=='p' || $orientation=='portrait') + { + $this->DefOrientation = 'P'; + $this->w = $size[0]; + $this->h = $size[1]; + } + elseif($orientation=='l' || $orientation=='landscape') + { + $this->DefOrientation = 'L'; + $this->w = $size[1]; + $this->h = $size[0]; + } + else + $this->Error('Incorrect orientation: '.$orientation); + $this->CurOrientation = $this->DefOrientation; + $this->wPt = $this->w*$this->k; + $this->hPt = $this->h*$this->k; + // Page margins (1 cm) + $margin = 28.35/$this->k; + $this->SetMargins($margin,$margin); + // Interior cell margin (1 mm) + $this->cMargin = $margin/10; + // Line width (0.2 mm) + $this->LineWidth = .567/$this->k; + // Automatic page break + $this->SetAutoPageBreak(true,2*$margin); + // Default display mode + $this->SetDisplayMode('default'); + // Enable compression + $this->SetCompression(true); + // Set default PDF version number + $this->PDFVersion = '1.3'; +} + +function SetMargins($left, $top, $right=null) +{ + // Set left, top and right margins + $this->lMargin = $left; + $this->tMargin = $top; + if($right===null) + $right = $left; + $this->rMargin = $right; +} + +function SetLeftMargin($margin) +{ + // Set left margin + $this->lMargin = $margin; + if($this->page>0 && $this->x<$margin) + $this->x = $margin; +} + +function SetTopMargin($margin) +{ + // Set top margin + $this->tMargin = $margin; +} + +function SetRightMargin($margin) +{ + // Set right margin + $this->rMargin = $margin; +} + +function SetAutoPageBreak($auto, $margin=0) +{ + // Set auto page break mode and triggering margin + $this->AutoPageBreak = $auto; + $this->bMargin = $margin; + $this->PageBreakTrigger = $this->h-$margin; +} + +function SetDisplayMode($zoom, $layout='default') +{ + // Set display mode in viewer + if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) + $this->ZoomMode = $zoom; + else + $this->Error('Incorrect zoom display mode: '.$zoom); + if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') + $this->LayoutMode = $layout; + else + $this->Error('Incorrect layout display mode: '.$layout); +} + +function SetCompression($compress) +{ + // Set page compression + if(function_exists('gzcompress')) + $this->compress = $compress; + else + $this->compress = false; +} + +function SetTitle($title, $isUTF8=false) +{ + // Title of document + if($isUTF8) + $title = $this->_UTF8toUTF16($title); + $this->title = $title; +} + +function SetSubject($subject, $isUTF8=false) +{ + // Subject of document + if($isUTF8) + $subject = $this->_UTF8toUTF16($subject); + $this->subject = $subject; +} + +function SetAuthor($author, $isUTF8=false) +{ + // Author of document + if($isUTF8) + $author = $this->_UTF8toUTF16($author); + $this->author = $author; +} + +function SetKeywords($keywords, $isUTF8=false) +{ + // Keywords of document + if($isUTF8) + $keywords = $this->_UTF8toUTF16($keywords); + $this->keywords = $keywords; +} + +function SetCreator($creator, $isUTF8=false) +{ + // Creator of document + if($isUTF8) + $creator = $this->_UTF8toUTF16($creator); + $this->creator = $creator; +} + +function AliasNbPages($alias='{nb}') +{ + // Define an alias for total number of pages + $this->AliasNbPages = $alias; +} + +function Error($msg) +{ + // Fatal error + die('FPDF error: '.$msg); +} + +function Open() +{ + // Begin document + $this->state = 1; +} + +function Close() +{ + // Terminate document + if($this->state==3) + return; + if($this->page==0) + $this->AddPage(); + // Page footer + $this->InFooter = true; + $this->Footer(); + $this->InFooter = false; + // Close page + $this->_endpage(); + // Close document + $this->_enddoc(); +} + +function AddPage($orientation='', $size='') +{ + // Start a new page + if($this->state==0) + $this->Open(); + $family = $this->FontFamily; + $style = $this->FontStyle.($this->underline ? 'U' : ''); + $fontsize = $this->FontSizePt; + $lw = $this->LineWidth; + $dc = $this->DrawColor; + $fc = $this->FillColor; + $tc = $this->TextColor; + $cf = $this->ColorFlag; + if($this->page>0) + { + // Page footer + $this->InFooter = true; + $this->Footer(); + $this->InFooter = false; + // Close page + $this->_endpage(); + } + // Start new page + $this->_beginpage($orientation,$size); + // Set line cap style to square + $this->_out('2 J'); + // Set line width + $this->LineWidth = $lw; + $this->_out(sprintf('%.2F w',$lw*$this->k)); + // Set font + if($family) + $this->SetFont($family,$style,$fontsize); + // Set colors + $this->DrawColor = $dc; + if($dc!='0 G') + $this->_out($dc); + $this->FillColor = $fc; + if($fc!='0 g') + $this->_out($fc); + $this->TextColor = $tc; + $this->ColorFlag = $cf; + // Page header + $this->InHeader = true; + $this->Header(); + $this->InHeader = false; + // Restore line width + if($this->LineWidth!=$lw) + { + $this->LineWidth = $lw; + $this->_out(sprintf('%.2F w',$lw*$this->k)); + } + // Restore font + if($family) + $this->SetFont($family,$style,$fontsize); + // Restore colors + if($this->DrawColor!=$dc) + { + $this->DrawColor = $dc; + $this->_out($dc); + } + if($this->FillColor!=$fc) + { + $this->FillColor = $fc; + $this->_out($fc); + } + $this->TextColor = $tc; + $this->ColorFlag = $cf; +} + +function Header() +{ + // To be implemented in your own inherited class +} + +function Footer() +{ + // To be implemented in your own inherited class +} + +function PageNo() +{ + // Get current page number + return $this->page; +} + +function SetDrawColor($r, $g=null, $b=null) +{ + // Set color for all stroking operations + if(($r==0 && $g==0 && $b==0) || $g===null) + $this->DrawColor = sprintf('%.3F G',$r/255); + else + $this->DrawColor = sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255); + if($this->page>0) + $this->_out($this->DrawColor); +} + +function SetFillColor($r, $g=null, $b=null) +{ + // Set color for all filling operations + if(($r==0 && $g==0 && $b==0) || $g===null) + $this->FillColor = sprintf('%.3F g',$r/255); + else + $this->FillColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); + $this->ColorFlag = ($this->FillColor!=$this->TextColor); + if($this->page>0) + $this->_out($this->FillColor); +} + +function SetTextColor($r, $g=null, $b=null) +{ + // Set color for text + if(($r==0 && $g==0 && $b==0) || $g===null) + $this->TextColor = sprintf('%.3F g',$r/255); + else + $this->TextColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); + $this->ColorFlag = ($this->FillColor!=$this->TextColor); +} + +function GetStringWidth($s) +{ + // Get width of a string in the current font + $s = (string)$s; + $cw = &$this->CurrentFont['cw']; + $w = 0; + $l = strlen($s); + for($i=0;$i<$l;$i++) + $w += $cw[$s[$i]]; + return $w*$this->FontSize/1000; +} + +function SetLineWidth($width) +{ + // Set line width + $this->LineWidth = $width; + if($this->page>0) + $this->_out(sprintf('%.2F w',$width*$this->k)); +} + +function Line($x1, $y1, $x2, $y2) +{ + // Draw a line + $this->_out(sprintf('%.2F %.2F m %.2F %.2F l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k)); +} + +function Rect($x, $y, $w, $h, $style='') +{ + // Draw a rectangle + if($style=='F') + $op = 'f'; + elseif($style=='FD' || $style=='DF') + $op = 'B'; + else + $op = 'S'; + $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op)); +} + +function AddFont($family, $style='', $file='') +{ + // Add a TrueType, OpenType or Type1 font + $family = strtolower($family); + if($file=='') + $file = str_replace(' ','',$family).strtolower($style).'.php'; + $style = strtoupper($style); + if($style=='IB') + $style = 'BI'; + $fontkey = $family.$style; + if(isset($this->fonts[$fontkey])) + return; + $info = $this->_loadfont($file); + $info['i'] = count($this->fonts)+1; + if(!empty($info['diff'])) + { + // Search existing encodings + $n = array_search($info['diff'],$this->diffs); + if(!$n) + { + $n = count($this->diffs)+1; + $this->diffs[$n] = $info['diff']; + } + $info['diffn'] = $n; + } + if(!empty($info['file'])) + { + // Embedded font + if($info['type']=='TrueType') + $this->FontFiles[$info['file']] = array('length1'=>$info['originalsize']); + else + $this->FontFiles[$info['file']] = array('length1'=>$info['size1'], 'length2'=>$info['size2']); + } + $this->fonts[$fontkey] = $info; +} + +function SetFont($family, $style='', $size=0) +{ + // Select a font; size given in points + if($family=='') + $family = $this->FontFamily; + else + $family = strtolower($family); + $style = strtoupper($style); + if(strpos($style,'U')!==false) + { + $this->underline = true; + $style = str_replace('U','',$style); + } + else + $this->underline = false; + if($style=='IB') + $style = 'BI'; + if($size==0) + $size = $this->FontSizePt; + // Test if font is already selected + if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size) + return; + // Test if font is already loaded + $fontkey = $family.$style; + if(!isset($this->fonts[$fontkey])) + { + // Test if one of the core fonts + if($family=='arial') + $family = 'helvetica'; + if(in_array($family,$this->CoreFonts)) + { + if($family=='symbol' || $family=='zapfdingbats') + $style = ''; + $fontkey = $family.$style; + if(!isset($this->fonts[$fontkey])) + $this->AddFont($family,$style); + } + else + $this->Error('Undefined font: '.$family.' '.$style); + } + // Select it + $this->FontFamily = $family; + $this->FontStyle = $style; + $this->FontSizePt = $size; + $this->FontSize = $size/$this->k; + $this->CurrentFont = &$this->fonts[$fontkey]; + if($this->page>0) + $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); +} + +function SetFontSize($size) +{ + // Set font size in points + if($this->FontSizePt==$size) + return; + $this->FontSizePt = $size; + $this->FontSize = $size/$this->k; + if($this->page>0) + $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); +} + +function AddLink() +{ + // Create a new internal link + $n = count($this->links)+1; + $this->links[$n] = array(0, 0); + return $n; +} + +function SetLink($link, $y=0, $page=-1) +{ + // Set destination of internal link + if($y==-1) + $y = $this->y; + if($page==-1) + $page = $this->page; + $this->links[$link] = array($page, $y); +} + +function Link($x, $y, $w, $h, $link) +{ + // Put a link on the page + $this->PageLinks[$this->page][] = array($x*$this->k, $this->hPt-$y*$this->k, $w*$this->k, $h*$this->k, $link); +} + +function Text($x, $y, $txt) +{ + // Output a string + $s = sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt)); + if($this->underline && $txt!='') + $s .= ' '.$this->_dounderline($x,$y,$txt); + if($this->ColorFlag) + $s = 'q '.$this->TextColor.' '.$s.' Q'; + $this->_out($s); +} + +function AcceptPageBreak() +{ + // Accept automatic page break or not + return $this->AutoPageBreak; +} + +function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='') +{ + // Output a cell + $k = $this->k; + if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) + { + // Automatic page break + $x = $this->x; + $ws = $this->ws; + if($ws>0) + { + $this->ws = 0; + $this->_out('0 Tw'); + } + $this->AddPage($this->CurOrientation,$this->CurPageSize); + $this->x = $x; + if($ws>0) + { + $this->ws = $ws; + $this->_out(sprintf('%.3F Tw',$ws*$k)); + } + } + if($w==0) + $w = $this->w-$this->rMargin-$this->x; + $s = ''; + if($fill || $border==1) + { + if($fill) + $op = ($border==1) ? 'B' : 'f'; + else + $op = 'S'; + $s = sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op); + } + if(is_string($border)) + { + $x = $this->x; + $y = $this->y; + if(strpos($border,'L')!==false) + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k); + if(strpos($border,'T')!==false) + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k); + if(strpos($border,'R')!==false) + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k); + if(strpos($border,'B')!==false) + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k); + } + if($txt!=='') + { + if($align=='R') + $dx = $w-$this->cMargin-$this->GetStringWidth($txt); + elseif($align=='C') + $dx = ($w-$this->GetStringWidth($txt))/2; + else + $dx = $this->cMargin; + if($this->ColorFlag) + $s .= 'q '.$this->TextColor.' '; + $txt2 = str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt))); + $s .= sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2); + if($this->underline) + $s .= ' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); + if($this->ColorFlag) + $s .= ' Q'; + if($link) + $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link); + } + if($s) + $this->_out($s); + $this->lasth = $h; + if($ln>0) + { + // Go to next line + $this->y += $h; + if($ln==1) + $this->x = $this->lMargin; + } + else + $this->x += $w; +} + +function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false) +{ + // Output text with automatic or explicit line breaks + $cw = &$this->CurrentFont['cw']; + if($w==0) + $w = $this->w-$this->rMargin-$this->x; + $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; + $s = str_replace("\r",'',$txt); + $nb = strlen($s); + if($nb>0 && $s[$nb-1]=="\n") + $nb--; + $b = 0; + if($border) + { + if($border==1) + { + $border = 'LTRB'; + $b = 'LRT'; + $b2 = 'LR'; + } + else + { + $b2 = ''; + if(strpos($border,'L')!==false) + $b2 .= 'L'; + if(strpos($border,'R')!==false) + $b2 .= 'R'; + $b = (strpos($border,'T')!==false) ? $b2.'T' : $b2; + } + } + $sep = -1; + $i = 0; + $j = 0; + $l = 0; + $ns = 0; + $nl = 1; + while($i<$nb) + { + // Get next character + $c = $s[$i]; + if($c=="\n") + { + // Explicit line break + if($this->ws>0) + { + $this->ws = 0; + $this->_out('0 Tw'); + } + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + $i++; + $sep = -1; + $j = $i; + $l = 0; + $ns = 0; + $nl++; + if($border && $nl==2) + $b = $b2; + continue; + } + if($c==' ') + { + $sep = $i; + $ls = $l; + $ns++; + } + $l += $cw[$c]; + if($l>$wmax) + { + // Automatic line break + if($sep==-1) + { + if($i==$j) + $i++; + if($this->ws>0) + { + $this->ws = 0; + $this->_out('0 Tw'); + } + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + } + else + { + if($align=='J') + { + $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; + $this->_out(sprintf('%.3F Tw',$this->ws*$this->k)); + } + $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill); + $i = $sep+1; + } + $sep = -1; + $j = $i; + $l = 0; + $ns = 0; + $nl++; + if($border && $nl==2) + $b = $b2; + } + else + $i++; + } + // Last chunk + if($this->ws>0) + { + $this->ws = 0; + $this->_out('0 Tw'); + } + if($border && strpos($border,'B')!==false) + $b .= 'B'; + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + $this->x = $this->lMargin; +} + +function Write($h, $txt, $link='') +{ + // Output text in flowing mode + $cw = &$this->CurrentFont['cw']; + $w = $this->w-$this->rMargin-$this->x; + $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; + $s = str_replace("\r",'',$txt); + $nb = strlen($s); + $sep = -1; + $i = 0; + $j = 0; + $l = 0; + $nl = 1; + while($i<$nb) + { + // Get next character + $c = $s[$i]; + if($c=="\n") + { + // Explicit line break + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); + $i++; + $sep = -1; + $j = $i; + $l = 0; + if($nl==1) + { + $this->x = $this->lMargin; + $w = $this->w-$this->rMargin-$this->x; + $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; + } + $nl++; + continue; + } + if($c==' ') + $sep = $i; + $l += $cw[$c]; + if($l>$wmax) + { + // Automatic line break + if($sep==-1) + { + if($this->x>$this->lMargin) + { + // Move to next line + $this->x = $this->lMargin; + $this->y += $h; + $w = $this->w-$this->rMargin-$this->x; + $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; + $i++; + $nl++; + continue; + } + if($i==$j) + $i++; + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); + } + else + { + $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link); + $i = $sep+1; + } + $sep = -1; + $j = $i; + $l = 0; + if($nl==1) + { + $this->x = $this->lMargin; + $w = $this->w-$this->rMargin-$this->x; + $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; + } + $nl++; + } + else + $i++; + } + // Last chunk + if($i!=$j) + $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link); +} + +function Ln($h=null) +{ + // Line feed; default value is last cell height + $this->x = $this->lMargin; + if($h===null) + $this->y += $this->lasth; + else + $this->y += $h; +} + +function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='') +{ + // Put an image on the page + if(!isset($this->images[$file])) + { + // First use of this image, get info + if($type=='') + { + $pos = strrpos($file,'.'); + if(!$pos) + $this->Error('Image file has no extension and no type was specified: '.$file); + $type = substr($file,$pos+1); + } + $type = strtolower($type); + if($type=='jpeg') + $type = 'jpg'; + $mtd = '_parse'.$type; + if(!method_exists($this,$mtd)) + $this->Error('Unsupported image type: '.$type); + $info = $this->$mtd($file); + $info['i'] = count($this->images)+1; + $this->images[$file] = $info; + } + else + $info = $this->images[$file]; + + // Automatic width and height calculation if needed + if($w==0 && $h==0) + { + // Put image at 96 dpi + $w = -96; + $h = -96; + } + if($w<0) + $w = -$info['w']*72/$w/$this->k; + if($h<0) + $h = -$info['h']*72/$h/$this->k; + if($w==0) + $w = $h*$info['w']/$info['h']; + if($h==0) + $h = $w*$info['h']/$info['w']; + + // Flowing mode + if($y===null) + { + if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) + { + // Automatic page break + $x2 = $this->x; + $this->AddPage($this->CurOrientation,$this->CurPageSize); + $this->x = $x2; + } + $y = $this->y; + $this->y += $h; + } + + if($x===null) + $x = $this->x; + $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i'])); + if($link) + $this->Link($x,$y,$w,$h,$link); +} + +function GetX() +{ + // Get x position + return $this->x; +} + +function SetX($x) +{ + // Set x position + if($x>=0) + $this->x = $x; + else + $this->x = $this->w+$x; +} + +function GetY() +{ + // Get y position + return $this->y; +} + +function SetY($y) +{ + // Set y position and reset x + $this->x = $this->lMargin; + if($y>=0) + $this->y = $y; + else + $this->y = $this->h+$y; +} + +function SetXY($x, $y) +{ + // Set x and y positions + $this->SetY($y); + $this->SetX($x); +} + +function Output($name='', $dest='') +{ + // Output PDF to some destination + if($this->state<3) + $this->Close(); + $dest = strtoupper($dest); + if($dest=='') + { + if($name=='') + { + $name = 'doc.pdf'; + $dest = 'I'; + } + else + $dest = 'F'; + } + switch($dest) + { + case 'I': + // Send to standard output + $this->_checkoutput(); + if(PHP_SAPI!='cli') + { + // We send to a browser + header('Content-Type: application/pdf'); + header('Content-Disposition: inline; filename="'.$name.'"'); + header('Cache-Control: private, max-age=0, must-revalidate'); + header('Pragma: public'); + } + echo $this->buffer; + break; + case 'D': + // Download file + $this->_checkoutput(); + header('Content-Type: application/x-download'); + header('Content-Disposition: attachment; filename="'.$name.'"'); + header('Cache-Control: private, max-age=0, must-revalidate'); + header('Pragma: public'); + echo $this->buffer; + break; + case 'F': + // Save to local file + $f = fopen($name,'wb'); + if(!$f) + $this->Error('Unable to create output file: '.$name); + fwrite($f,$this->buffer,strlen($this->buffer)); + fclose($f); + break; + case 'S': + // Return as a string + return $this->buffer; + default: + $this->Error('Incorrect output destination: '.$dest); + } + return ''; +} + +/******************************************************************************* +* * +* Protected methods * +* * +*******************************************************************************/ +function _dochecks() +{ + // Check availability of %F + if(sprintf('%.1F',1.0)!='1.0') + $this->Error('This version of PHP is not supported'); + // Check mbstring overloading + if(ini_get('mbstring.func_overload') & 2) + $this->Error('mbstring overloading must be disabled'); + // Ensure runtime magic quotes are disabled + if(get_magic_quotes_runtime()) + @set_magic_quotes_runtime(0); +} + +function _checkoutput() +{ + if(PHP_SAPI!='cli') + { + if(headers_sent($file,$line)) + $this->Error("Some data has already been output, can't send PDF file (output started at $file:$line)"); + } + if(ob_get_length()) + { + // The output buffer is not empty + if(preg_match('/^(\xEF\xBB\xBF)?\s*$/',ob_get_contents())) + { + // It contains only a UTF-8 BOM and/or whitespace, let's clean it + ob_clean(); + } + else + $this->Error("Some data has already been output, can't send PDF file"); + } +} + +function _getpagesize($size) +{ + if(is_string($size)) + { + $size = strtolower($size); + if(!isset($this->StdPageSizes[$size])) + $this->Error('Unknown page size: '.$size); + $a = $this->StdPageSizes[$size]; + return array($a[0]/$this->k, $a[1]/$this->k); + } + else + { + if($size[0]>$size[1]) + return array($size[1], $size[0]); + else + return $size; + } +} + +function _beginpage($orientation, $size) +{ + $this->page++; + $this->pages[$this->page] = ''; + $this->state = 2; + $this->x = $this->lMargin; + $this->y = $this->tMargin; + $this->FontFamily = ''; + // Check page size and orientation + if($orientation=='') + $orientation = $this->DefOrientation; + else + $orientation = strtoupper($orientation[0]); + if($size=='') + $size = $this->DefPageSize; + else + $size = $this->_getpagesize($size); + if($orientation!=$this->CurOrientation || $size[0]!=$this->CurPageSize[0] || $size[1]!=$this->CurPageSize[1]) + { + // New size or orientation + if($orientation=='P') + { + $this->w = $size[0]; + $this->h = $size[1]; + } + else + { + $this->w = $size[1]; + $this->h = $size[0]; + } + $this->wPt = $this->w*$this->k; + $this->hPt = $this->h*$this->k; + $this->PageBreakTrigger = $this->h-$this->bMargin; + $this->CurOrientation = $orientation; + $this->CurPageSize = $size; + } + if($orientation!=$this->DefOrientation || $size[0]!=$this->DefPageSize[0] || $size[1]!=$this->DefPageSize[1]) + $this->PageSizes[$this->page] = array($this->wPt, $this->hPt); +} + +function _endpage() +{ + $this->state = 1; +} + +function _loadfont($font) +{ + // Load a font definition file from the font directory + include($this->fontpath.$font); + $a = get_defined_vars(); + if(!isset($a['name'])) + $this->Error('Could not include font definition file'); + return $a; +} + +function _escape($s) +{ + // Escape special characters in strings + $s = str_replace('\\','\\\\',$s); + $s = str_replace('(','\\(',$s); + $s = str_replace(')','\\)',$s); + $s = str_replace("\r",'\\r',$s); + return $s; +} + +function _textstring($s) +{ + // Format a text string + return '('.$this->_escape($s).')'; +} + +function _UTF8toUTF16($s) +{ + // Convert UTF-8 to UTF-16BE with BOM + $res = "\xFE\xFF"; + $nb = strlen($s); + $i = 0; + while($i<$nb) + { + $c1 = ord($s[$i++]); + if($c1>=224) + { + // 3-byte character + $c2 = ord($s[$i++]); + $c3 = ord($s[$i++]); + $res .= chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2)); + $res .= chr((($c2 & 0x03)<<6) + ($c3 & 0x3F)); + } + elseif($c1>=192) + { + // 2-byte character + $c2 = ord($s[$i++]); + $res .= chr(($c1 & 0x1C)>>2); + $res .= chr((($c1 & 0x03)<<6) + ($c2 & 0x3F)); + } + else + { + // Single-byte character + $res .= "\0".chr($c1); + } + } + return $res; +} + +function _dounderline($x, $y, $txt) +{ + // Underline text + $up = $this->CurrentFont['up']; + $ut = $this->CurrentFont['ut']; + $w = $this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '); + return sprintf('%.2F %.2F %.2F %.2F re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt); +} + +function _parsejpg($file) +{ + // Extract info from a JPEG file + $a = getimagesize($file); + if(!$a) + $this->Error('Missing or incorrect image file: '.$file); + if($a[2]!=2) + $this->Error('Not a JPEG file: '.$file); + if(!isset($a['channels']) || $a['channels']==3) + $colspace = 'DeviceRGB'; + elseif($a['channels']==4) + $colspace = 'DeviceCMYK'; + else + $colspace = 'DeviceGray'; + $bpc = isset($a['bits']) ? $a['bits'] : 8; + $data = file_get_contents($file); + return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data); +} + +function _parsepng($file) +{ + // Extract info from a PNG file + $f = fopen($file,'rb'); + if(!$f) + $this->Error('Can\'t open image file: '.$file); + $info = $this->_parsepngstream($f,$file); + fclose($f); + return $info; +} + +function _parsepngstream($f, $file) +{ + // Check signature + if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) + $this->Error('Not a PNG file: '.$file); + + // Read header chunk + $this->_readstream($f,4); + if($this->_readstream($f,4)!='IHDR') + $this->Error('Incorrect PNG file: '.$file); + $w = $this->_readint($f); + $h = $this->_readint($f); + $bpc = ord($this->_readstream($f,1)); + if($bpc>8) + $this->Error('16-bit depth not supported: '.$file); + $ct = ord($this->_readstream($f,1)); + if($ct==0 || $ct==4) + $colspace = 'DeviceGray'; + elseif($ct==2 || $ct==6) + $colspace = 'DeviceRGB'; + elseif($ct==3) + $colspace = 'Indexed'; + else + $this->Error('Unknown color type: '.$file); + if(ord($this->_readstream($f,1))!=0) + $this->Error('Unknown compression method: '.$file); + if(ord($this->_readstream($f,1))!=0) + $this->Error('Unknown filter method: '.$file); + if(ord($this->_readstream($f,1))!=0) + $this->Error('Interlacing not supported: '.$file); + $this->_readstream($f,4); + $dp = '/Predictor 15 /Colors '.($colspace=='DeviceRGB' ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w; + + // Scan chunks looking for palette, transparency and image data + $pal = ''; + $trns = ''; + $data = ''; + do + { + $n = $this->_readint($f); + $type = $this->_readstream($f,4); + if($type=='PLTE') + { + // Read palette + $pal = $this->_readstream($f,$n); + $this->_readstream($f,4); + } + elseif($type=='tRNS') + { + // Read transparency info + $t = $this->_readstream($f,$n); + if($ct==0) + $trns = array(ord(substr($t,1,1))); + elseif($ct==2) + $trns = array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1))); + else + { + $pos = strpos($t,chr(0)); + if($pos!==false) + $trns = array($pos); + } + $this->_readstream($f,4); + } + elseif($type=='IDAT') + { + // Read image data block + $data .= $this->_readstream($f,$n); + $this->_readstream($f,4); + } + elseif($type=='IEND') + break; + else + $this->_readstream($f,$n+4); + } + while($n); + + if($colspace=='Indexed' && empty($pal)) + $this->Error('Missing palette in '.$file); + $info = array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'FlateDecode', 'dp'=>$dp, 'pal'=>$pal, 'trns'=>$trns); + if($ct>=4) + { + // Extract alpha channel + if(!function_exists('gzuncompress')) + $this->Error('Zlib not available, can\'t handle alpha channel: '.$file); + $data = gzuncompress($data); + $color = ''; + $alpha = ''; + if($ct==4) + { + // Gray image + $len = 2*$w; + for($i=0;$i<$h;$i++) + { + $pos = (1+$len)*$i; + $color .= $data[$pos]; + $alpha .= $data[$pos]; + $line = substr($data,$pos+1,$len); + $color .= preg_replace('/(.)./s','$1',$line); + $alpha .= preg_replace('/.(.)/s','$1',$line); + } + } + else + { + // RGB image + $len = 4*$w; + for($i=0;$i<$h;$i++) + { + $pos = (1+$len)*$i; + $color .= $data[$pos]; + $alpha .= $data[$pos]; + $line = substr($data,$pos+1,$len); + $color .= preg_replace('/(.{3})./s','$1',$line); + $alpha .= preg_replace('/.{3}(.)/s','$1',$line); + } + } + unset($data); + $data = gzcompress($color); + $info['smask'] = gzcompress($alpha); + if($this->PDFVersion<'1.4') + $this->PDFVersion = '1.4'; + } + $info['data'] = $data; + return $info; +} + +function _readstream($f, $n) +{ + // Read n bytes from stream + $res = ''; + while($n>0 && !feof($f)) + { + $s = fread($f,$n); + if($s===false) + $this->Error('Error while reading stream'); + $n -= strlen($s); + $res .= $s; + } + if($n>0) + $this->Error('Unexpected end of stream'); + return $res; +} + +function _readint($f) +{ + // Read a 4-byte integer from stream + $a = unpack('Ni',$this->_readstream($f,4)); + return $a['i']; +} + +function _parsegif($file) +{ + // Extract info from a GIF file (via PNG conversion) + if(!function_exists('imagepng')) + $this->Error('GD extension is required for GIF support'); + if(!function_exists('imagecreatefromgif')) + $this->Error('GD has no GIF read support'); + $im = imagecreatefromgif($file); + if(!$im) + $this->Error('Missing or incorrect image file: '.$file); + imageinterlace($im,0); + $f = @fopen('php://temp','rb+'); + if($f) + { + // Perform conversion in memory + ob_start(); + imagepng($im); + $data = ob_get_clean(); + imagedestroy($im); + fwrite($f,$data); + rewind($f); + $info = $this->_parsepngstream($f,$file); + fclose($f); + } + else + { + // Use temporary file + $tmp = tempnam('.','gif'); + if(!$tmp) + $this->Error('Unable to create a temporary file'); + if(!imagepng($im,$tmp)) + $this->Error('Error while saving to temporary file'); + imagedestroy($im); + $info = $this->_parsepng($tmp); + unlink($tmp); + } + return $info; +} + +function _newobj() +{ + // Begin a new object + $this->n++; + $this->offsets[$this->n] = strlen($this->buffer); + $this->_out($this->n.' 0 obj'); +} + +function _putstream($s) +{ + $this->_out('stream'); + $this->_out($s); + $this->_out('endstream'); +} + +function _out($s) +{ + // Add a line to the document + if($this->state==2) + $this->pages[$this->page] .= $s."\n"; + else + $this->buffer .= $s."\n"; +} + +function _putpages() +{ + $nb = $this->page; + if(!empty($this->AliasNbPages)) + { + // Replace number of pages + for($n=1;$n<=$nb;$n++) + $this->pages[$n] = str_replace($this->AliasNbPages,$nb,$this->pages[$n]); + } + if($this->DefOrientation=='P') + { + $wPt = $this->DefPageSize[0]*$this->k; + $hPt = $this->DefPageSize[1]*$this->k; + } + else + { + $wPt = $this->DefPageSize[1]*$this->k; + $hPt = $this->DefPageSize[0]*$this->k; + } + $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; + for($n=1;$n<=$nb;$n++) + { + // Page + $this->_newobj(); + $this->_out('<_out('/Parent 1 0 R'); + if(isset($this->PageSizes[$n])) + $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageSizes[$n][0],$this->PageSizes[$n][1])); + $this->_out('/Resources 2 0 R'); + if(isset($this->PageLinks[$n])) + { + // Links + $annots = '/Annots ['; + foreach($this->PageLinks[$n] as $pl) + { + $rect = sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); + $annots .= '<_textstring($pl[4]).'>>>>'; + else + { + $l = $this->links[$pl[4]]; + $h = isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt; + $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',1+2*$l[0],$h-$l[1]*$this->k); + } + } + $this->_out($annots.']'); + } + if($this->PDFVersion>'1.3') + $this->_out('/Group <>'); + $this->_out('/Contents '.($this->n+1).' 0 R>>'); + $this->_out('endobj'); + // Page content + $p = ($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; + $this->_newobj(); + $this->_out('<<'.$filter.'/Length '.strlen($p).'>>'); + $this->_putstream($p); + $this->_out('endobj'); + } + // Pages root + $this->offsets[1] = strlen($this->buffer); + $this->_out('1 0 obj'); + $this->_out('<_out($kids.']'); + $this->_out('/Count '.$nb); + $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$wPt,$hPt)); + $this->_out('>>'); + $this->_out('endobj'); +} + +function _putfonts() +{ + $nf = $this->n; + foreach($this->diffs as $diff) + { + // Encodings + $this->_newobj(); + $this->_out('<>'); + $this->_out('endobj'); + } + foreach($this->FontFiles as $file=>$info) + { + // Font file embedding + $this->_newobj(); + $this->FontFiles[$file]['n'] = $this->n; + $font = file_get_contents($this->fontpath.$file,true); + if(!$font) + $this->Error('Font file not found: '.$file); + $compressed = (substr($file,-2)=='.z'); + if(!$compressed && isset($info['length2'])) + $font = substr($font,6,$info['length1']).substr($font,6+$info['length1']+6,$info['length2']); + $this->_out('<_out('/Filter /FlateDecode'); + $this->_out('/Length1 '.$info['length1']); + if(isset($info['length2'])) + $this->_out('/Length2 '.$info['length2'].' /Length3 0'); + $this->_out('>>'); + $this->_putstream($font); + $this->_out('endobj'); + } + foreach($this->fonts as $k=>$font) + { + // Font objects + $this->fonts[$k]['n'] = $this->n+1; + $type = $font['type']; + $name = $font['name']; + if($type=='Core') + { + // Core font + $this->_newobj(); + $this->_out('<_out('/BaseFont /'.$name); + $this->_out('/Subtype /Type1'); + if($name!='Symbol' && $name!='ZapfDingbats') + $this->_out('/Encoding /WinAnsiEncoding'); + $this->_out('>>'); + $this->_out('endobj'); + } + elseif($type=='Type1' || $type=='TrueType') + { + // Additional Type1 or TrueType/OpenType font + $this->_newobj(); + $this->_out('<_out('/BaseFont /'.$name); + $this->_out('/Subtype /'.$type); + $this->_out('/FirstChar 32 /LastChar 255'); + $this->_out('/Widths '.($this->n+1).' 0 R'); + $this->_out('/FontDescriptor '.($this->n+2).' 0 R'); + if(isset($font['diffn'])) + $this->_out('/Encoding '.($nf+$font['diffn']).' 0 R'); + else + $this->_out('/Encoding /WinAnsiEncoding'); + $this->_out('>>'); + $this->_out('endobj'); + // Widths + $this->_newobj(); + $cw = &$font['cw']; + $s = '['; + for($i=32;$i<=255;$i++) + $s .= $cw[chr($i)].' '; + $this->_out($s.']'); + $this->_out('endobj'); + // Descriptor + $this->_newobj(); + $s = '<$v) + $s .= ' /'.$k.' '.$v; + if(!empty($font['file'])) + $s .= ' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$font['file']]['n'].' 0 R'; + $this->_out($s.'>>'); + $this->_out('endobj'); + } + else + { + // Allow for additional types + $mtd = '_put'.strtolower($type); + if(!method_exists($this,$mtd)) + $this->Error('Unsupported font type: '.$type); + $this->$mtd($font); + } + } +} + +function _putimages() +{ + foreach(array_keys($this->images) as $file) + { + $this->_putimage($this->images[$file]); + unset($this->images[$file]['data']); + unset($this->images[$file]['smask']); + } +} + +function _putimage(&$info) +{ + $this->_newobj(); + $info['n'] = $this->n; + $this->_out('<_out('/Subtype /Image'); + $this->_out('/Width '.$info['w']); + $this->_out('/Height '.$info['h']); + if($info['cs']=='Indexed') + $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); + else + { + $this->_out('/ColorSpace /'.$info['cs']); + if($info['cs']=='DeviceCMYK') + $this->_out('/Decode [1 0 1 0 1 0 1 0]'); + } + $this->_out('/BitsPerComponent '.$info['bpc']); + if(isset($info['f'])) + $this->_out('/Filter /'.$info['f']); + if(isset($info['dp'])) + $this->_out('/DecodeParms <<'.$info['dp'].'>>'); + if(isset($info['trns']) && is_array($info['trns'])) + { + $trns = ''; + for($i=0;$i_out('/Mask ['.$trns.']'); + } + if(isset($info['smask'])) + $this->_out('/SMask '.($this->n+1).' 0 R'); + $this->_out('/Length '.strlen($info['data']).'>>'); + $this->_putstream($info['data']); + $this->_out('endobj'); + // Soft mask + if(isset($info['smask'])) + { + $dp = '/Predictor 15 /Colors 1 /BitsPerComponent 8 /Columns '.$info['w']; + $smask = array('w'=>$info['w'], 'h'=>$info['h'], 'cs'=>'DeviceGray', 'bpc'=>8, 'f'=>$info['f'], 'dp'=>$dp, 'data'=>$info['smask']); + $this->_putimage($smask); + } + // Palette + if($info['cs']=='Indexed') + { + $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; + $pal = ($this->compress) ? gzcompress($info['pal']) : $info['pal']; + $this->_newobj(); + $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>'); + $this->_putstream($pal); + $this->_out('endobj'); + } +} + +function _putxobjectdict() +{ + foreach($this->images as $image) + $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); +} + +function _putresourcedict() +{ + $this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); + $this->_out('/Font <<'); + foreach($this->fonts as $font) + $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); + $this->_out('>>'); + $this->_out('/XObject <<'); + $this->_putxobjectdict(); + $this->_out('>>'); +} + +function _putresources() +{ + $this->_putfonts(); + $this->_putimages(); + // Resource dictionary + $this->offsets[2] = strlen($this->buffer); + $this->_out('2 0 obj'); + $this->_out('<<'); + $this->_putresourcedict(); + $this->_out('>>'); + $this->_out('endobj'); +} + +function _putinfo() +{ + $this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION)); + if(!empty($this->title)) + $this->_out('/Title '.$this->_textstring($this->title)); + if(!empty($this->subject)) + $this->_out('/Subject '.$this->_textstring($this->subject)); + if(!empty($this->author)) + $this->_out('/Author '.$this->_textstring($this->author)); + if(!empty($this->keywords)) + $this->_out('/Keywords '.$this->_textstring($this->keywords)); + if(!empty($this->creator)) + $this->_out('/Creator '.$this->_textstring($this->creator)); + $this->_out('/CreationDate '.$this->_textstring('D:'.@date('YmdHis'))); +} + +function _putcatalog() +{ + $this->_out('/Type /Catalog'); + $this->_out('/Pages 1 0 R'); + if($this->ZoomMode=='fullpage') + $this->_out('/OpenAction [3 0 R /Fit]'); + elseif($this->ZoomMode=='fullwidth') + $this->_out('/OpenAction [3 0 R /FitH null]'); + elseif($this->ZoomMode=='real') + $this->_out('/OpenAction [3 0 R /XYZ null null 1]'); + elseif(!is_string($this->ZoomMode)) + $this->_out('/OpenAction [3 0 R /XYZ null null '.sprintf('%.2F',$this->ZoomMode/100).']'); + if($this->LayoutMode=='single') + $this->_out('/PageLayout /SinglePage'); + elseif($this->LayoutMode=='continuous') + $this->_out('/PageLayout /OneColumn'); + elseif($this->LayoutMode=='two') + $this->_out('/PageLayout /TwoColumnLeft'); +} + +function _putheader() +{ + $this->_out('%PDF-'.$this->PDFVersion); +} + +function _puttrailer() +{ + $this->_out('/Size '.($this->n+1)); + $this->_out('/Root '.$this->n.' 0 R'); + $this->_out('/Info '.($this->n-1).' 0 R'); +} + +function _enddoc() +{ + $this->_putheader(); + $this->_putpages(); + $this->_putresources(); + // Info + $this->_newobj(); + $this->_out('<<'); + $this->_putinfo(); + $this->_out('>>'); + $this->_out('endobj'); + // Catalog + $this->_newobj(); + $this->_out('<<'); + $this->_putcatalog(); + $this->_out('>>'); + $this->_out('endobj'); + // Cross-ref + $o = strlen($this->buffer); + $this->_out('xref'); + $this->_out('0 '.($this->n+1)); + $this->_out('0000000000 65535 f '); + for($i=1;$i<=$this->n;$i++) + $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i])); + // Trailer + $this->_out('trailer'); + $this->_out('<<'); + $this->_puttrailer(); + $this->_out('>>'); + $this->_out('startxref'); + $this->_out($o); + $this->_out('%%EOF'); + $this->state = 3; +} +// End of class +} + +// Handle special IE contype request +if(isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT']=='contype') +{ + header('Content-Type: application/pdf'); + exit; +} + +?> diff --git a/webapp/php/3rdparty/fpdf/license.txt b/webapp/php/3rdparty/fpdf/license.txt new file mode 100644 index 0000000..fd811c6 --- /dev/null +++ b/webapp/php/3rdparty/fpdf/license.txt @@ -0,0 +1,6 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software to use, copy, modify, distribute, sublicense, and/or sell +copies of the software, and to permit persons to whom the software is furnished +to do so. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. \ No newline at end of file diff --git a/webapp/php/3rdparty/fpdf/makefont/cp1252.map b/webapp/php/3rdparty/fpdf/makefont/cp1252.map new file mode 100644 index 0000000..dd490e5 --- /dev/null +++ b/webapp/php/3rdparty/fpdf/makefont/cp1252.map @@ -0,0 +1,251 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+20AC Euro +!82 U+201A quotesinglbase +!83 U+0192 florin +!84 U+201E quotedblbase +!85 U+2026 ellipsis +!86 U+2020 dagger +!87 U+2021 daggerdbl +!88 U+02C6 circumflex +!89 U+2030 perthousand +!8A U+0160 Scaron +!8B U+2039 guilsinglleft +!8C U+0152 OE +!8E U+017D Zcaron +!91 U+2018 quoteleft +!92 U+2019 quoteright +!93 U+201C quotedblleft +!94 U+201D quotedblright +!95 U+2022 bullet +!96 U+2013 endash +!97 U+2014 emdash +!98 U+02DC tilde +!99 U+2122 trademark +!9A U+0161 scaron +!9B U+203A guilsinglright +!9C U+0153 oe +!9E U+017E zcaron +!9F U+0178 Ydieresis +!A0 U+00A0 space +!A1 U+00A1 exclamdown +!A2 U+00A2 cent +!A3 U+00A3 sterling +!A4 U+00A4 currency +!A5 U+00A5 yen +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AA U+00AA ordfeminine +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+00AF macron +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+00B4 acute +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+00B8 cedilla +!B9 U+00B9 onesuperior +!BA U+00BA ordmasculine +!BB U+00BB guillemotright +!BC U+00BC onequarter +!BD U+00BD onehalf +!BE U+00BE threequarters +!BF U+00BF questiondown +!C0 U+00C0 Agrave +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+00C3 Atilde +!C4 U+00C4 Adieresis +!C5 U+00C5 Aring +!C6 U+00C6 AE +!C7 U+00C7 Ccedilla +!C8 U+00C8 Egrave +!C9 U+00C9 Eacute +!CA U+00CA Ecircumflex +!CB U+00CB Edieresis +!CC U+00CC Igrave +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+00CF Idieresis +!D0 U+00D0 Eth +!D1 U+00D1 Ntilde +!D2 U+00D2 Ograve +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+00D5 Otilde +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+00D8 Oslash +!D9 U+00D9 Ugrave +!DA U+00DA Uacute +!DB U+00DB Ucircumflex +!DC U+00DC Udieresis +!DD U+00DD Yacute +!DE U+00DE Thorn +!DF U+00DF germandbls +!E0 U+00E0 agrave +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+00E3 atilde +!E4 U+00E4 adieresis +!E5 U+00E5 aring +!E6 U+00E6 ae +!E7 U+00E7 ccedilla +!E8 U+00E8 egrave +!E9 U+00E9 eacute +!EA U+00EA ecircumflex +!EB U+00EB edieresis +!EC U+00EC igrave +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+00EF idieresis +!F0 U+00F0 eth +!F1 U+00F1 ntilde +!F2 U+00F2 ograve +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+00F5 otilde +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+00F8 oslash +!F9 U+00F9 ugrave +!FA U+00FA uacute +!FB U+00FB ucircumflex +!FC U+00FC udieresis +!FD U+00FD yacute +!FE U+00FE thorn +!FF U+00FF ydieresis diff --git a/webapp/php/3rdparty/fpdf/makefont/iso-8859-1.map b/webapp/php/3rdparty/fpdf/makefont/iso-8859-1.map new file mode 100644 index 0000000..61740a3 --- /dev/null +++ b/webapp/php/3rdparty/fpdf/makefont/iso-8859-1.map @@ -0,0 +1,256 @@ +!00 U+0000 .notdef +!01 U+0001 .notdef +!02 U+0002 .notdef +!03 U+0003 .notdef +!04 U+0004 .notdef +!05 U+0005 .notdef +!06 U+0006 .notdef +!07 U+0007 .notdef +!08 U+0008 .notdef +!09 U+0009 .notdef +!0A U+000A .notdef +!0B U+000B .notdef +!0C U+000C .notdef +!0D U+000D .notdef +!0E U+000E .notdef +!0F U+000F .notdef +!10 U+0010 .notdef +!11 U+0011 .notdef +!12 U+0012 .notdef +!13 U+0013 .notdef +!14 U+0014 .notdef +!15 U+0015 .notdef +!16 U+0016 .notdef +!17 U+0017 .notdef +!18 U+0018 .notdef +!19 U+0019 .notdef +!1A U+001A .notdef +!1B U+001B .notdef +!1C U+001C .notdef +!1D U+001D .notdef +!1E U+001E .notdef +!1F U+001F .notdef +!20 U+0020 space +!21 U+0021 exclam +!22 U+0022 quotedbl +!23 U+0023 numbersign +!24 U+0024 dollar +!25 U+0025 percent +!26 U+0026 ampersand +!27 U+0027 quotesingle +!28 U+0028 parenleft +!29 U+0029 parenright +!2A U+002A asterisk +!2B U+002B plus +!2C U+002C comma +!2D U+002D hyphen +!2E U+002E period +!2F U+002F slash +!30 U+0030 zero +!31 U+0031 one +!32 U+0032 two +!33 U+0033 three +!34 U+0034 four +!35 U+0035 five +!36 U+0036 six +!37 U+0037 seven +!38 U+0038 eight +!39 U+0039 nine +!3A U+003A colon +!3B U+003B semicolon +!3C U+003C less +!3D U+003D equal +!3E U+003E greater +!3F U+003F question +!40 U+0040 at +!41 U+0041 A +!42 U+0042 B +!43 U+0043 C +!44 U+0044 D +!45 U+0045 E +!46 U+0046 F +!47 U+0047 G +!48 U+0048 H +!49 U+0049 I +!4A U+004A J +!4B U+004B K +!4C U+004C L +!4D U+004D M +!4E U+004E N +!4F U+004F O +!50 U+0050 P +!51 U+0051 Q +!52 U+0052 R +!53 U+0053 S +!54 U+0054 T +!55 U+0055 U +!56 U+0056 V +!57 U+0057 W +!58 U+0058 X +!59 U+0059 Y +!5A U+005A Z +!5B U+005B bracketleft +!5C U+005C backslash +!5D U+005D bracketright +!5E U+005E asciicircum +!5F U+005F underscore +!60 U+0060 grave +!61 U+0061 a +!62 U+0062 b +!63 U+0063 c +!64 U+0064 d +!65 U+0065 e +!66 U+0066 f +!67 U+0067 g +!68 U+0068 h +!69 U+0069 i +!6A U+006A j +!6B U+006B k +!6C U+006C l +!6D U+006D m +!6E U+006E n +!6F U+006F o +!70 U+0070 p +!71 U+0071 q +!72 U+0072 r +!73 U+0073 s +!74 U+0074 t +!75 U+0075 u +!76 U+0076 v +!77 U+0077 w +!78 U+0078 x +!79 U+0079 y +!7A U+007A z +!7B U+007B braceleft +!7C U+007C bar +!7D U+007D braceright +!7E U+007E asciitilde +!7F U+007F .notdef +!80 U+0080 .notdef +!81 U+0081 .notdef +!82 U+0082 .notdef +!83 U+0083 .notdef +!84 U+0084 .notdef +!85 U+0085 .notdef +!86 U+0086 .notdef +!87 U+0087 .notdef +!88 U+0088 .notdef +!89 U+0089 .notdef +!8A U+008A .notdef +!8B U+008B .notdef +!8C U+008C .notdef +!8D U+008D .notdef +!8E U+008E .notdef +!8F U+008F .notdef +!90 U+0090 .notdef +!91 U+0091 .notdef +!92 U+0092 .notdef +!93 U+0093 .notdef +!94 U+0094 .notdef +!95 U+0095 .notdef +!96 U+0096 .notdef +!97 U+0097 .notdef +!98 U+0098 .notdef +!99 U+0099 .notdef +!9A U+009A .notdef +!9B U+009B .notdef +!9C U+009C .notdef +!9D U+009D .notdef +!9E U+009E .notdef +!9F U+009F .notdef +!A0 U+00A0 space +!A1 U+00A1 exclamdown +!A2 U+00A2 cent +!A3 U+00A3 sterling +!A4 U+00A4 currency +!A5 U+00A5 yen +!A6 U+00A6 brokenbar +!A7 U+00A7 section +!A8 U+00A8 dieresis +!A9 U+00A9 copyright +!AA U+00AA ordfeminine +!AB U+00AB guillemotleft +!AC U+00AC logicalnot +!AD U+00AD hyphen +!AE U+00AE registered +!AF U+00AF macron +!B0 U+00B0 degree +!B1 U+00B1 plusminus +!B2 U+00B2 twosuperior +!B3 U+00B3 threesuperior +!B4 U+00B4 acute +!B5 U+00B5 mu +!B6 U+00B6 paragraph +!B7 U+00B7 periodcentered +!B8 U+00B8 cedilla +!B9 U+00B9 onesuperior +!BA U+00BA ordmasculine +!BB U+00BB guillemotright +!BC U+00BC onequarter +!BD U+00BD onehalf +!BE U+00BE threequarters +!BF U+00BF questiondown +!C0 U+00C0 Agrave +!C1 U+00C1 Aacute +!C2 U+00C2 Acircumflex +!C3 U+00C3 Atilde +!C4 U+00C4 Adieresis +!C5 U+00C5 Aring +!C6 U+00C6 AE +!C7 U+00C7 Ccedilla +!C8 U+00C8 Egrave +!C9 U+00C9 Eacute +!CA U+00CA Ecircumflex +!CB U+00CB Edieresis +!CC U+00CC Igrave +!CD U+00CD Iacute +!CE U+00CE Icircumflex +!CF U+00CF Idieresis +!D0 U+00D0 Eth +!D1 U+00D1 Ntilde +!D2 U+00D2 Ograve +!D3 U+00D3 Oacute +!D4 U+00D4 Ocircumflex +!D5 U+00D5 Otilde +!D6 U+00D6 Odieresis +!D7 U+00D7 multiply +!D8 U+00D8 Oslash +!D9 U+00D9 Ugrave +!DA U+00DA Uacute +!DB U+00DB Ucircumflex +!DC U+00DC Udieresis +!DD U+00DD Yacute +!DE U+00DE Thorn +!DF U+00DF germandbls +!E0 U+00E0 agrave +!E1 U+00E1 aacute +!E2 U+00E2 acircumflex +!E3 U+00E3 atilde +!E4 U+00E4 adieresis +!E5 U+00E5 aring +!E6 U+00E6 ae +!E7 U+00E7 ccedilla +!E8 U+00E8 egrave +!E9 U+00E9 eacute +!EA U+00EA ecircumflex +!EB U+00EB edieresis +!EC U+00EC igrave +!ED U+00ED iacute +!EE U+00EE icircumflex +!EF U+00EF idieresis +!F0 U+00F0 eth +!F1 U+00F1 ntilde +!F2 U+00F2 ograve +!F3 U+00F3 oacute +!F4 U+00F4 ocircumflex +!F5 U+00F5 otilde +!F6 U+00F6 odieresis +!F7 U+00F7 divide +!F8 U+00F8 oslash +!F9 U+00F9 ugrave +!FA U+00FA uacute +!FB U+00FB ucircumflex +!FC U+00FC udieresis +!FD U+00FD yacute +!FE U+00FE thorn +!FF U+00FF ydieresis diff --git a/php/3rdparty/orderstyle/images/ajax-loader.gif b/webapp/php/3rdparty/images/ajax-loader.gif similarity index 100% rename from php/3rdparty/orderstyle/images/ajax-loader.gif rename to webapp/php/3rdparty/images/ajax-loader.gif diff --git a/webapp/php/3rdparty/jquery-1.11.3.min.js b/webapp/php/3rdparty/jquery-1.11.3.min.js new file mode 100644 index 0000000..0f60b7b --- /dev/null +++ b/webapp/php/3rdparty/jquery-1.11.3.min.js @@ -0,0 +1,5 @@ +/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.3",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1; + +return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="
    a",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),ha=/^\s+/,ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ja=/<([\w:]+)/,ka=/\s*$/g,ra={option:[1,""],legend:[1,"
    ","
    "],area:[1,"",""],param:[1,"",""],thead:[1,"","
    "],tr:[2,"","
    "],col:[2,"","
    "],td:[3,"","
    "],_default:k.htmlSerialize?[0,"",""]:[1,"X
    ","
    "]},sa=da(y),ta=sa.appendChild(y.createElement("div"));ra.optgroup=ra.option,ra.tbody=ra.tfoot=ra.colgroup=ra.caption=ra.thead,ra.th=ra.td;function ua(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ua(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function va(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wa(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xa(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function ya(a){var b=pa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function za(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Aa(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Ba(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xa(b).text=a.text,ya(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!ga.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ta.innerHTML=a.outerHTML,ta.removeChild(f=ta.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ua(f),h=ua(a),g=0;null!=(e=h[g]);++g)d[g]&&Ba(e,d[g]);if(b)if(c)for(h=h||ua(a),d=d||ua(f),g=0;null!=(e=h[g]);g++)Aa(e,d[g]);else Aa(a,f);return d=ua(f,"script"),d.length>0&&za(d,!i&&ua(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=da(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(la.test(f)){h=h||o.appendChild(b.createElement("div")),i=(ja.exec(f)||["",""])[1].toLowerCase(),l=ra[i]||ra._default,h.innerHTML=l[1]+f.replace(ia,"<$1>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&ha.test(f)&&p.push(b.createTextNode(ha.exec(f)[0])),!k.tbody){f="table"!==i||ka.test(f)?""!==l[1]||ka.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ua(p,"input"),va),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ua(o.appendChild(f),"script"),g&&za(h),c)){e=0;while(f=h[e++])oa.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ua(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&za(ua(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ua(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fa,""):void 0;if(!("string"!=typeof a||ma.test(a)||!k.htmlSerialize&&ga.test(a)||!k.leadingWhitespace&&ha.test(a)||ra[(ja.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ia,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ua(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ua(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&na.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ua(i,"script"),xa),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ua(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,ya),j=0;f>j;j++)d=g[j],oa.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qa,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Ca,Da={};function Ea(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fa(a){var b=y,c=Da[a];return c||(c=Ea(a,b),"none"!==c&&c||(Ca=(Ca||m("