-PRAGMA foreign_keys=OFF;
-BEGIN TRANSACTION;
-CREATE TABLE payementtypes (
- id TEXT,
- name TEXT,
- modified DATETIME defaults CURRENT_TIMESTAMP,
- created DATETIME defaults CURRENT_TIMESTAMP,
- primary key (id)
-);
-CREATE TABLE products (
- id TEXT,
- id_group TEXT,
- name TEXT,
- specification TEXT,
- netamount REAL,
- grossamount REAL,
- vatpercent REAL,
- visible BOOLEAN,
- modified DATETIME defaults CURRENT_TIMESTAMP,
- created DATETIME defaults CURRENT_TIMESTAMP, productgroup TEXT,
- primary key (id)
-);
-INSERT INTO products VALUES('523FB3C9-562A-7644-9E0C-664A94984B60',NULL,'Softdrink (Cola, Fanta, Sprite)','0,3',1.3999999999999999111,1.3999999999999999111,NULL,1,'2019-03-18 20:31:18',NULL,'Boissons');
-INSERT INTO products VALUES('BE438932-ECDB-DF46-B0D8-5F1A4E2A8E77',NULL,'Rosport Bleu','0,5',1.3999999999999999111,1.3999999999999999111,NULL,1,'2019-03-18 20:31:18',NULL,'Boissons');
-INSERT INTO products VALUES('272B688C-FC90-D344-BC93-F4C4C0E78183',NULL,'Vittel','0,3',1.1999999999999999555,1.1999999999999999555,NULL,NULL,'2019-03-18 20:31:18',NULL,'Boissons');
-INSERT INTO products VALUES('9DF50B2D-8F58-CA4A-9F58-00E71138C80C',NULL,'Bière (Bouteille) Bofferding','0,33',2.0,2.0,NULL,1,'2019-03-18 20:31:18',NULL,'Alcohol');
-INSERT INTO products VALUES('E6AAD31B-B6E9-BE47-B221-4315ABFEF81D',NULL,'Bière (Mini) Bofferding','0,33',2.2000000000000001776,2.2000000000000001776,NULL,1,'2019-03-18 20:31:18',NULL,'Alcohol');
-INSERT INTO products VALUES('77D2A8A5-A1FE-704B-AF52-99817B25B7C7',NULL,'Pol Fabire brut','0,25',4.2000000000000001776,4.2000000000000001776,NULL,1,'2019-03-18 20:31:18',NULL,'Alcohol');
-INSERT INTO products VALUES('8D03C7EF-A773-6247-A0E3-057FA355B263',NULL,'Cellier rouge','0,25',2.2999999999999998223,2.2999999999999998223,NULL,1,'2019-03-18 20:31:18',NULL,'Alcohol');
-INSERT INTO products VALUES('EA1AFD8A-F839-5C47-9050-5EFF8229D12E',NULL,'Cellier rosé','0,25',2.2999999999999998223,2.2999999999999998223,NULL,1,'2019-03-18 20:31:18',NULL,'Alcohol');
-INSERT INTO products VALUES('242C42D6-3CC6-5147-8C68-C5F954B140B7',NULL,'Vin blanc (Rivaner / Elbling)','0,25',4.0,4.0,NULL,1,'2019-03-18 20:31:18',NULL,'Alcohol');
-INSERT INTO products VALUES('20683124-2DF2-FF4A-BC76-3844D26174A2',NULL,'Lëtzebuerger Grillwurscht',NULL,3.0,3.0,NULL,1,'2019-03-05 08:50:42',NULL,'Food');
-INSERT INTO products VALUES('6C487085-4221-F546-97BC-D3850E7742E6',NULL,'Lëtzebuerger Mettwurscht',NULL,3.0,3.0,NULL,1,'2019-03-05 08:50:42',NULL,'Food');
-INSERT INTO products VALUES('7B3B40EB-CC33-3140-9752-5FCE492796A0',NULL,'Edamer',NULL,3.0,3.0,NULL,1,'2019-03-05 08:50:42',NULL,'Food');
-INSERT INTO products VALUES('C507FA4B-31C1-144B-8F50-6BCF0B4E62DF',NULL,'Gauffre (sucre)',NULL,2.5,2.5,NULL,1,'2019-03-05 08:50:42',NULL,'Dessert');
-INSERT INTO products VALUES('D6C1C2A0-9343-C348-8786-1547F37ADB0E',NULL,'Gaufre (chantilly)',NULL,3.0,3.0,NULL,1,'2019-03-05 08:50:42',NULL,'Dessert');
-INSERT INTO products VALUES('0367CCA3-1FBB-DF41-AB10-ECDDFB3D0AC0',NULL,'Gaufre (chantily + fraises)',NULL,3.0,3.0,NULL,1,'2019-03-05 08:50:42',NULL,'Dessert');
-CREATE TABLE transactions (
- id TEXT,
- id_payementtype TEXT,
- id_client TEXT,
- id_table TEXT,
- id_product TEXT,
- netamount REAL,
- vatamount REAL,
- grossamount REAL,
- payedamount REAL,
- cashbackamount REAL,
- status TEXT,
- statusdate DATE,
- modified DATETIME defaults CURRENT_TIMESTAMP,
- created DATETIME defaults CURRENT_TIMESTAMP,
- primary key (id)
-);
-CREATE TABLE transactiondata (
- id TEXT,
- id_transaction TEXT,
- id_product TEXT,
- id_client TEXT,
- id_table TEXT,
- netamount REAL,
- vatamount REAL,
- grossamount REAL,
- quantity integer,
- modified DATETIME defaults CURRENT_TIMESTAMP,
- created DATETIME defaults CURRENT_TIMESTAMP,
- primary key (id)
-);
-CREATE TABLE printtemplates (
- id TEXT,
- name TEXT,
- templatedesign TEXT,
- templatesql TEXT,
- templatetype TEXT,
- modified DATETIME defaults CURRENT_TIMESTAMP,
- created DATETIME defaults CURRENT_TIMESTAMP,
- primary key (id)
-);
-CREATE TABLE stations (\r
+PRAGMA foreign_keys=OFF;\r
+BEGIN TRANSACTION;\r
+CREATE TABLE printtemplates (\r
id TEXT,\r
- hostname TEXT,\r
- type TEXT,\r
- currentip TEXT,\r
- staffmember TEXT,\r
- status TEXT,\r
- location TEXT,\r
+ name TEXT,\r
+ templatedesign TEXT,\r
+ templatesql TEXT,\r
+ templatetype TEXT,\r
modified DATETIME defaults CURRENT_TIMESTAMP,\r
created DATETIME defaults CURRENT_TIMESTAMP,\r
primary key (id)\r
-);
-CREATE TABLE config (
- id TEXT,
- value TEXT,
- primary key (id)
-);
-INSERT INTO config VALUES('cardpayement_enabled','1');
-INSERT INTO config VALUES('checkout_grouping','1');
-CREATE TABLE accounts (
- id TEXT,
- name TEXT,
- type TEXT,
- clientnumber text,
- prename TEXT,
- surname TEXT,
- address TEXT,
- zip TEXT,
- city TEXT,
- country TEXT,
- phone TEXT,
- email text,
- description TEXT,
- location TEXT,
- modified DATETIME defaults CURRENT_TIMESTAMP,
- created DATETIME defaults CURRENT_TIMESTAMP,
- primary key (id)
-);
-CREATE TRIGGER trg_payementtypes_upd UPDATE ON payementtypes
- BEGIN
- UPDATE payementtypes SET modified=CURRENT_TIMESTAMP WHERE id = NEW.id;
- END;
-CREATE TRIGGER trg_products_upd UPDATE ON products
- BEGIN
- UPDATE products SET modified=CURRENT_TIMESTAMP WHERE id = NEW.id;
- END;
-CREATE TRIGGER trg_transactions_upd UPDATE ON transactions
- BEGIN
- UPDATE transactions SET modified=CURRENT_TIMESTAMP WHERE id = NEW.id;
- END;
-CREATE TRIGGER trg_transactiondata_upd UPDATE ON transactiondata
- BEGIN
- UPDATE transactiondata SET modified=CURRENT_TIMESTAMP WHERE id = NEW.id;
- END;
-CREATE TRIGGER trg_printtemplates_upd UPDATE ON printtemplates
- BEGIN
- UPDATE printtemplates SET modified=CURRENT_TIMESTAMP WHERE id = NEW.id;
- END;
-CREATE TRIGGER trg_stations_upd UPDATE ON stations\r
+);\r
+CREATE TABLE stations (\r\r
+ id TEXT,\r\r
+ hostname TEXT,\r\r
+ type TEXT,\r\r
+ currentip TEXT,\r\r
+ staffmember TEXT,\r\r
+ status TEXT,\r\r
+ location TEXT,\r\r
+ modified DATETIME defaults CURRENT_TIMESTAMP,\r\r
+ created DATETIME defaults CURRENT_TIMESTAMP,\r\r
+ primary key (id)\r\r
+);\r
+CREATE TABLE config (\r\r
+ id TEXT,\r\r
+ value TEXT,\r\r
+ primary key (id)\r\r
+);\r
+INSERT INTO "config" VALUES('cardpayement_enabled','1');\r
+INSERT INTO "config" VALUES('checkout_grouping','0');\r
+CREATE TABLE transactiondata (\r\r
+ id TEXT,\r\r
+ id_transaction TEXT,\r\r
+ id_product TEXT,\r\r
+ id_account TEXT,\r\r
+ netamount REAL,\r\r
+ vatamount REAL,\r\r
+ grossamount REAL,\r\r
+ quantity integer,\r\r
+ modified DATETIME default CURRENT_TIMESTAMP,\r\r
+ created DATETIME default CURRENT_TIMESTAMP,\r\r
+ primary key (id)\r\r
+);\r
+INSERT INTO "transactiondata" VALUES('0764ee4c-3f09-3ac4-8be3-a6e12bd33f60','6cd6ecbf-d4de-bebc-c8e6-d30ffcd6b72e','20683124-2DF2-FF4A-BC76-3844D26174A2','c418ae7e-c5e9-45f5-93ca-30dcb3e5e90a',3.0,NULL,3.0,1,'2019-04-11 17:36:25','2019-04-11 17:36:25');\r
+INSERT INTO "transactiondata" VALUES('c8e39d22-f33e-3a98-8d22-517e9efe789c','6cd6ecbf-d4de-bebc-c8e6-d30ffcd6b72e','6C487085-4221-F546-97BC-D3850E7742E6','c418ae7e-c5e9-45f5-93ca-30dcb3e5e90a',3.0,NULL,3.0,1,'2019-04-11 17:36:25','2019-04-11 17:36:25');\r
+INSERT INTO "transactiondata" VALUES('cc6d65d4-c9c3-2276-6bc1-e27380699ab3','6cd6ecbf-d4de-bebc-c8e6-d30ffcd6b72e','D6C1C2A0-9343-C348-8786-1547F37ADB0E','c418ae7e-c5e9-45f5-93ca-30dcb3e5e90a',3.0,NULL,3.0,1,'2019-04-11 17:36:25','2019-04-11 17:36:25');\r
+INSERT INTO "transactiondata" VALUES('ca1baff0-8911-2e2f-f8f0-22fe09798021','db53cb86-d04a-997c-bb93-e3f45bcf45e7','20683124-2DF2-FF4A-BC76-3844D26174A2','53a4fdac-613a-4188-9695-2edeef90a1f3',3.0,NULL,3.0,1,'2019-04-11 18:40:14','2019-04-11 18:40:14');\r
+INSERT INTO "transactiondata" VALUES('5bfc9065-55d7-4e74-f8ac-5c52ee27e8a8','b142be13-db66-a16a-4bc4-7f7a727f46ca','6C487085-4221-F546-97BC-D3850E7742E6','0cecba8c-febc-47d1-820c-6c948be9b9c6',3.0,NULL,3.0,1,'2019-04-11 18:44:19','2019-04-11 18:44:19');\r
+INSERT INTO "transactiondata" VALUES('89e59470-8d6b-9b8b-64fe-0c5bde8f8234','b142be13-db66-a16a-4bc4-7f7a727f46ca','20683124-2DF2-FF4A-BC76-3844D26174A2','0cecba8c-febc-47d1-820c-6c948be9b9c6',3.0,NULL,3.0,1,'2019-04-11 18:44:19','2019-04-11 18:44:19');\r
+INSERT INTO "transactiondata" VALUES('bc120dc7-03dc-be25-e014-6ad473476031','b142be13-db66-a16a-4bc4-7f7a727f46ca','7B3B40EB-CC33-3140-9752-5FCE492796A0','0cecba8c-febc-47d1-820c-6c948be9b9c6',3.0,NULL,3.0,1,'2019-04-11 18:44:19','2019-04-11 18:44:19');\r
+INSERT INTO "transactiondata" VALUES('62ebd480-192c-2519-414a-9315386ce4d6','2f5d0393-d6b7-e455-89b6-f7e111b8aa41','20683124-2DF2-FF4A-BC76-3844D26174A2','ef69bc4b-3828-4bb2-8e9b-3931eb2e187e',3.0,NULL,3.0,1,'2019-04-11 18:48:13','2019-04-11 18:48:13');\r
+INSERT INTO "transactiondata" VALUES('4ceaa3d9-c940-8824-d9ea-d9fefa83ab1d','2f5d0393-d6b7-e455-89b6-f7e111b8aa41','C507FA4B-31C1-144B-8F50-6BCF0B4E62DF','ef69bc4b-3828-4bb2-8e9b-3931eb2e187e',2.5,NULL,2.5,1,'2019-04-11 18:48:13','2019-04-11 18:48:13');\r
+INSERT INTO "transactiondata" VALUES('ca98e648-7615-0d0c-1e79-555a95c27285','2f5d0393-d6b7-e455-89b6-f7e111b8aa41','BE438932-ECDB-DF46-B0D8-5F1A4E2A8E77','ef69bc4b-3828-4bb2-8e9b-3931eb2e187e',1.4,NULL,1.4,1,'2019-04-11 18:48:14','2019-04-11 18:48:14');\r
+INSERT INTO "transactiondata" VALUES('fc42101c-1ee6-15e3-83d1-6c7b3ab4e11a','2f5d0393-d6b7-e455-89b6-f7e111b8aa41','272B688C-FC90-D344-BC93-F4C4C0E78183','ef69bc4b-3828-4bb2-8e9b-3931eb2e187e',1.2,NULL,1.2,1,'2019-04-11 18:48:14','2019-04-11 18:48:14');\r
+INSERT INTO "transactiondata" VALUES('031ba6d5-b7cc-fff8-280a-6175866a3a63','2f5d0393-d6b7-e455-89b6-f7e111b8aa41','9DF50B2D-8F58-CA4A-9F58-00E71138C80C','ef69bc4b-3828-4bb2-8e9b-3931eb2e187e',2.0,NULL,2.0,1,'2019-04-11 18:48:14','2019-04-11 18:48:14');\r
+CREATE TABLE transactions (\r\r
+ id TEXT,\r\r
+ payementtype TEXT,\r\r
+ id_account TEXT,\r\r
+ payedamount REAL,\r\r
+ cashbackamount REAL,\r\r
+ cashamount REAL,\r\r
+ status TEXT,\r\r
+ statusdate DATE,\r\r
+ modified DATETIME default CURRENT_TIMESTAMP,\r\r
+ created DATETIME default CURRENT_TIMESTAMP,\r\r
+ primary key (id)\r\r
+);\r
+INSERT INTO "transactions" VALUES('2f5d0393-d6b7-e455-89b6-f7e111b8aa41','cash','ef69bc4b-3828-4bb2-8e9b-3931eb2e187e',10.1,NULL,10.1,'payed','2019-04-11','2019-04-11 18:48:13','2019-04-11 17:37:58');\r
+INSERT INTO "transactions" VALUES('313768a4-41d6-129e-7c56-ce1ddcdb8af9',NULL,NULL,NULL,NULL,NULL,'command','2019-04-11','2019-04-11 18:36:18','2019-04-11 18:36:18');\r
+INSERT INTO "transactions" VALUES('1561e1d4-f4b3-b710-d52c-c6c9d6bb2301',NULL,NULL,NULL,NULL,NULL,'command','2019-04-11','2019-04-11 18:37:26','2019-04-11 18:37:26');\r
+INSERT INTO "transactions" VALUES('b7c1f095-97ae-ae43-5034-7286260f8d96',NULL,NULL,NULL,NULL,NULL,'command','2019-04-11','2019-04-11 18:38:05','2019-04-11 18:38:05');\r
+INSERT INTO "transactions" VALUES('ddf95f30-d3d9-4bc8-792a-0aa10bd74732',NULL,NULL,NULL,NULL,NULL,'command','2019-04-11','2019-04-11 18:38:40','2019-04-11 18:38:40');\r
+INSERT INTO "transactions" VALUES('db53cb86-d04a-997c-bb93-e3f45bcf45e7',NULL,NULL,NULL,NULL,NULL,'command','2019-04-11','2019-04-11 18:39:50','2019-04-11 18:39:50');\r
+INSERT INTO "transactions" VALUES('b142be13-db66-a16a-4bc4-7f7a727f46ca',NULL,NULL,NULL,NULL,NULL,'command','2019-04-11','2019-04-11 18:43:33','2019-04-11 18:43:33');\r
+CREATE TABLE accounts (\r\r
+ id TEXT,\r\r
+ name TEXT,\r\r
+ type TEXT, \r\r
+ visible boolean,\r\r
+ info TEXT,\r\r
+ modified DATETIME default CURRENT_TIMESTAMP,\r\r
+ created DATETIME default CURRENT_TIMESTAMP,\r\r
+ primary key (id)\r\r
+);\r
+INSERT INTO "accounts" VALUES('f3203f46-ac89-4ce3-bdd0-16387bc30cc3','Table 1','table',1,NULL,'2019-04-11 14:08:49',NULL);\r
+INSERT INTO "accounts" VALUES('d8d7c17a-7a2d-41b6-b2be-f5a92df33c3f','Table 2','table',1,NULL,'2019-04-11 14:08:50',NULL);\r
+INSERT INTO "accounts" VALUES('6b504c20-d88c-4576-9c47-9074f0573cef','Table 4','table',1,NULL,'2019-04-11 14:08:51',NULL);\r
+INSERT INTO "accounts" VALUES('a2b97fd0-faa5-4dcb-b63e-f62f68d36d57','Table 5','table',1,NULL,'2019-04-11 14:08:52',NULL);\r
+INSERT INTO "accounts" VALUES('c418ae7e-c5e9-45f5-93ca-30dcb3e5e90a','Table 6','table',1,NULL,'2019-04-11 14:08:54',NULL);\r
+INSERT INTO "accounts" VALUES('ef69bc4b-3828-4bb2-8e9b-3931eb2e187e','Table 7','table',1,NULL,'2019-04-11 14:08:55',NULL);\r
+INSERT INTO "accounts" VALUES('53a4fdac-613a-4188-9695-2edeef90a1f3','Table 8','table',1,NULL,'2019-04-11 14:08:56',NULL);\r
+INSERT INTO "accounts" VALUES('7139973e-b86d-4474-b9e5-c28501fd9f30','Table 9','table',1,NULL,'2019-04-11 14:08:56',NULL);\r
+INSERT INTO "accounts" VALUES('e8bec5da-a6cf-4425-910e-638e3fa16e4a','Table 10','table',1,NULL,'2019-04-11 14:09:01',NULL);\r
+INSERT INTO "accounts" VALUES('96e24eb7-cae5-416d-ae23-79522a832507','Table 11','table',1,NULL,'2019-04-11 14:09:02',NULL);\r
+INSERT INTO "accounts" VALUES('f9403f7a-0430-4ab4-a6d1-7f347d422eff','Table 12','table',1,NULL,'2019-04-11 14:09:07',NULL);\r
+INSERT INTO "accounts" VALUES('6f7e649d-f07d-4ba8-bd73-226343dd111c','Table 14','table',1,NULL,'2019-04-11 14:09:08',NULL);\r
+INSERT INTO "accounts" VALUES('0cecba8c-febc-47d1-820c-6c948be9b9c6','Table 15','table',1,NULL,'2019-04-11 14:12:40',NULL);\r
+INSERT INTO "accounts" VALUES('9bcc8841-4bf3-41f7-894a-416264ef403c','Table 16','table',1,NULL,'2019-04-11 14:09:12',NULL);\r
+CREATE TABLE products (\r\r
+ id TEXT,\r\r
+ id_group TEXT,\r\r
+ name TEXT,\r\r
+ specification TEXT,\r\r
+ netamount REAL,\r\r
+ grossamount REAL,\r\r
+ vatpercent REAL,\r\r
+ visible BOOLEAN,\r\r
+ productgroup TEXT,\r\r
+ modified DATETIME default CURRENT_TIMESTAMP,\r\r
+ created DATETIME default CURRENT_TIMESTAMP, \r\r
+ primary key (id)\r\r
+);\r
+INSERT INTO "products" VALUES('523FB3C9-562A-7644-9E0C-664A94984B60',NULL,'Softdrink (Cola, Fanta, Sprite)',NULL,1.4,1.4,NULL,1,'Boissons','2019-04-11 17:34:23','2019-04-11 17:34:23');\r
+INSERT INTO "products" VALUES('BE438932-ECDB-DF46-B0D8-5F1A4E2A8E77',NULL,'Rosport Bleu',NULL,1.4,1.4,NULL,1,'Boissons','2019-04-11 17:34:23','2019-04-11 17:34:23');\r
+INSERT INTO "products" VALUES('272B688C-FC90-D344-BC93-F4C4C0E78183',NULL,'Vittel',NULL,1.2,1.2,NULL,NULL,'Boissons','2019-04-11 17:34:23','2019-04-11 17:34:23');\r
+INSERT INTO "products" VALUES('9DF50B2D-8F58-CA4A-9F58-00E71138C80C',NULL,'Bière (Bouteille) Bofferding',NULL,2.0,2.0,NULL,1,'Boissons','2019-04-11 17:34:23','2019-04-11 17:34:23');\r
+INSERT INTO "products" VALUES('E6AAD31B-B6E9-BE47-B221-4315ABFEF81D',NULL,'Bière (Mini) Bofferding',NULL,2.2,2.2,NULL,1,'Boissons','2019-04-11 17:34:23','2019-04-11 17:34:23');\r
+INSERT INTO "products" VALUES('77D2A8A5-A1FE-704B-AF52-99817B25B7C7',NULL,'Pol Fabire brut',NULL,4.2,4.2,NULL,1,'Boissons','2019-04-11 17:34:23','2019-04-11 17:34:23');\r
+INSERT INTO "products" VALUES('8D03C7EF-A773-6247-A0E3-057FA355B263',NULL,'Cellier rouge',NULL,2.3,2.3,NULL,1,'Boissons','2019-04-11 17:34:23','2019-04-11 17:34:23');\r
+INSERT INTO "products" VALUES('EA1AFD8A-F839-5C47-9050-5EFF8229D12E',NULL,'Cellier rosé',NULL,2.3,2.3,NULL,1,'Boissons','2019-04-11 17:34:23','2019-04-11 17:34:23');\r
+INSERT INTO "products" VALUES('242C42D6-3CC6-5147-8C68-C5F954B140B7',NULL,'Vin blanc (Rivaner / Elbling)',NULL,4.0,4.0,NULL,1,'Boissons','2019-04-11 17:34:23','2019-04-11 17:34:23');\r
+INSERT INTO "products" VALUES('20683124-2DF2-FF4A-BC76-3844D26174A2',NULL,'Lëtzebuerger Grillwurscht',NULL,3.0,3.0,NULL,1,'Food','2019-04-11 17:34:23','2019-04-11 17:34:23');\r
+INSERT INTO "products" VALUES('6C487085-4221-F546-97BC-D3850E7742E6',NULL,'Lëtzebuerger Mettwurscht',NULL,3.0,3.0,NULL,1,'Food','2019-04-11 17:34:23','2019-04-11 17:34:23');\r
+INSERT INTO "products" VALUES('7B3B40EB-CC33-3140-9752-5FCE492796A0',NULL,'Edamer',NULL,3.0,3.0,NULL,1,'Food','2019-04-11 17:34:23','2019-04-11 17:34:23');\r
+INSERT INTO "products" VALUES('C507FA4B-31C1-144B-8F50-6BCF0B4E62DF',NULL,'Gauffre (sucre)',NULL,2.5,2.5,NULL,1,'Dessert','2019-04-11 17:34:23','2019-04-11 17:34:23');\r
+INSERT INTO "products" VALUES('D6C1C2A0-9343-C348-8786-1547F37ADB0E',NULL,'Gaufre (chantilly)',NULL,3.0,3.0,NULL,1,'Dessert','2019-04-11 17:34:23','2019-04-11 17:34:23');\r
+INSERT INTO "products" VALUES('0367CCA3-1FBB-DF41-AB10-ECDDFB3D0AC0',NULL,'Gaufre (chantily + fraises)',NULL,3.0,3.0,NULL,1,'Dessert','2019-04-11 17:34:23','2019-04-11 17:34:23');\r
+CREATE TRIGGER trg_printtemplates_upd UPDATE ON printtemplates\r
BEGIN\r
- UPDATE stations SET modified=CURRENT_TIMESTAMP WHERE id = NEW.id;\r
- END;
-CREATE TRIGGER trg_accounts_upd UPDATE ON accounts
- BEGIN
- UPDATE accounts SET modified=CURRENT_TIMESTAMP WHERE id = NEW.id;
- END;
-COMMIT;
+ UPDATE printtemplates SET modified=CURRENT_TIMESTAMP WHERE id = NEW.id;\r
+ END;\r
+CREATE TRIGGER trg_stations_upd UPDATE ON stations\r\r
+ BEGIN\r\r
+ UPDATE stations SET modified=CURRENT_TIMESTAMP WHERE id = NEW.id;\r\r
+ END;\r
+CREATE TRIGGER trg_transactiondata_upd UPDATE ON transactiondata\r\r
+ BEGIN\r\r
+ UPDATE transactiondata SET modified=CURRENT_TIMESTAMP WHERE id = NEW.id;\r\r
+ END;\r
+CREATE TRIGGER trg_transactions_upd UPDATE ON transactions\r\r
+ BEGIN\r\r
+ UPDATE transactions SET modified=CURRENT_TIMESTAMP WHERE id = NEW.id;\r\r
+ END;\r
+CREATE TRIGGER trg_accounts_upd UPDATE ON accounts\r\r
+ BEGIN\r\r
+ UPDATE accounts SET modified=CURRENT_TIMESTAMP WHERE id = NEW.id;\r\r
+ END;\r
+CREATE TRIGGER trg_products_upd UPDATE ON products\r\r
+ BEGIN\r\r
+ UPDATE products SET modified=CURRENT_TIMESTAMP WHERE id = NEW.id;\r\r
+ END;\r
+COMMIT;\r
<link rel="stylesheet" href="../../css/cashbox.epic.css">
<link rel="stylesheet" href="../../css/app.css">
<title>CashBox</title>
+<style>
+input[type='checkbox']{
+ width: 25px;
+ height: 25px;
+}
+</style>
</head>
<body class="bg-white">
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
- <h5 class="modal-title" id="dlgTablesLabel">Tisch auswählen</h5>
+ <h5 class="modal-title" id="dlgTablesLabel">Konto auswählen</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
- <div class="modal-body" id="tableslist">
+ <div class="modal-body" id="tableslist" style="max-height: 500px;overflow-y: scroll;">
</div>
<div class="modal-footer">
<span aria-hidden="true">×</span>
</button>
</div>
- <div class="modal-body">
- ...
+ <div class="modal-body" style="max-height: 500px;overflow-y: scroll;">
+ <table id="tbl_commands" class="table table-bordered table-hover table-striped">
+ <thead class="thead-dark">
+ <th data-sortable="true">id</th>
+ <th data-sortable="true">Datum/Zeit</th>
+ <th data-sortable="true">Konto</th>
+ <th data-sortable="true">Betrag</th>
+ <th data-sortable="true">Anz. Produkte</th>
+ <th > </th>
+ <tfoot></tfoot>
+ <tbody></tbody>
+ </table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abrechen</button>
</div>
<div class="row" style="margin: 0px;">
- <div class="col-sm-6 bg-primary text-white" style=" font-weight: bold; font-size: 30px; padding-top: 3px; padding-right: 5px;">
- <i class="fas fa-map-marker-alt white"></i> <span id="pay_account"></span>
+ <div class="col-sm-6" style=" font-weight: bold; font-size: 30px; padding-top: 3px; padding-right: 5px;">
+ <!-- <i class="fas fa-map-marker-alt"></i> --> <span id="pay_account"></span>
</div>
- <div class="btn-group btn-group-toggle col-sm-6" data-toggle="buttons">
- <label class="btn btn-secondary btn-block" style="font-size: 20px;">
- <input type="radio" name="payementtype" id="cash" autocomplete="off" onchange="setpayementtype('cash');"><i class="far fa-square"></i> BAR</span>
+ <div class="col-sm-3 form-inline" >
+ <input type="radio" class="form-control" style="width: 30px;" name="payementtype" id="cash" onchange="setpayementtype('cash');">
+ <label style="font-size: 20px;"> Cash</label>
+ </div>
+ <div class="col-sm-3 form-inline">
+ <input type="radio" class="form-control" style="width: 30px;" name="payementtype" id="card" onchange="setpayementtype('card');">
+ <label style="font-size: 20px;"> Kredit-Karte</label>
+ </div> <!-- <label class="btn btn-secondary btn-block" style="font-size: 20px;">
+ <input type="radio" name="payementtype" id="cash" autocomplete="off" onchange="setpayementtype('cash');"> BAR</span>
</label>
<label class="btn btn-secondary btn-block" style="font-size: 20px;">
<input type="radio" name="payementtype" id="card" autocomplete="off" onchange="setpayementtype('card');"><i class="far fa-check-square"></i> KARTE
- </label>
+ </label> -->
- </div>
+ <!-- </div> -->
</div>
<div class="row" style="margin: 0px;">
<div class="col-sm-6" style="background-color: black; font-weight: bold; text-align: left; border: 1px solid red;; height: 40px; font-size: 30px; color: red; vertical-align: middle; padding-left: 5px;border-right: 0px;">
<span id="sumtotalchangeamount">0,00</span>€
</div>
</div>
- <!-- <div class="row" style="margin: 0px;">
- <div class="col-sm-6" style="background-color: black; font-weight: bold; text-align: left; border: 1px solid green; height: 40px; font-size: 30px; color: green; vertical-align: middle; padding-left: 5px;border-right: 0px;">
- Bezahlt
- </div>
- <div class="col-sm-6" style="background-color: black; font-weight: bold; text-align: right; border: 1px solid green; height: 40px; font-size: 30px; color: green; vertical-align: middle; padding-right: 5px;border-left: 0px;">
- <span id="sumtotalpayedamount"></span>€
- </div>
- </div> -->
<div id="keypad" class="row justify-content-center" >
<div class="row" style="margin: 0px;">
<div class="btn-group" role="group" >
<button class="btn btn-secondary border-white" style="font-size: 25px;" onclick="addvalue('3',0);">3</button>
</div>
<div class="btn-group" role="group">
- <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue(null,3);"><i class="fas fa-backspace"></i></button>
- <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue(null,4);"><i class="fas fa-undo"></i></button>
- <button class="btn btn-secondary border-white" style="font-size: 25px;width: 100px;" onclick="addvalue(null,2);">1:1</button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;width: 150px;" onclick="addvalue(null,3);"><i class="fas fa-backspace"></i></button>
+ <button class="btn btn-secondary border-white" style="font-size: 25px;width: 150px;" onclick="addvalue(null,4);"><i class="fas fa-undo"></i></button>
+
</div>
</div>
<div class="btn-group" role="group" >
<button class="btn btn-secondary border-white" style="font-size: 25px;width: 150px;" onclick="addvalue(',',0);">,</button>
<!-- <button class="btn btn-secondary border-white" style="font-size: 25px;width: 75px;" onclick="addvalue(',00');">,00</button> -->
-
+ <button class="btn btn-secondary border-white" style="font-size: 25px;width: 300px;" onclick="addvalue(null,2);">1:1</button>
</div>
- <div class="btn-group btn-group-toggle" data-toggle="buttons">
+ <!-- <div class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary border-white" style="width: 150px;font-size: 20px;">
- <input type="checkbox" name="printticket" id="printticket" autocomplete="off"><i class="far fa-square" onchange="setprinttype('ticket');"></i> Ticket
+ Ticket
</label>
<label class="btn btn-secondary border-white" style="width: 150px;font-size: 20px;">
- <input type="checkbox" name="printreceipt" id="printreceipt" autocomplete="off" onchange="setprinttype('receipt');"><i class="far fa-check-square"></i> KassenBon
+ KassenBon
</label>
- </div>
+ </div> -->
</div>
</div>
</div>
<div class="modal-footer">
+ <div class="from-group" style="width: 200px;">
+ <input type="checkbox" class="form-control" name="printticket" id="printticket" onchange="setprinttype('ticket');">
+ <label style="font-size: 20px;"> Ticket</label>
+ </div>
+ <div class="from-group" style="width: 200px;">
+ <input type="checkbox" class="form-control" name="printreceipt" id="printreceipt" onchange="setprinttype('receipt');">
+ <label style="font-size: 20px;"> KassenBon</label>
+ </div>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abrechen</button>
- <button type="button" class="btn btn-secondary" onclick="save_shoppingcard();">Buchen</button>
+ <button type="button" class="btn btn-secondary" onclick="save_shoppingcart();">Buchen</button>
</div>
</div>
</div>
//console.log("config loaded");
//console.log(config);
localconfig = parent.usersystem.getPreference('paywindow');
-
+ console.log('paywindow');
+ console.log(localconfig);
+ if (!localconfig){
+ localconfig = {};
+ localconfig['receipt'] = 1;
+ $('#printreceipt').prop('checked','checked');
+ }
}
function loadadmin(){
// }
-function printpreview(){
- window.open(decodeURIComponent(mpref.cfg.serviceurl)+ "receipt.html","receipt");
+function printreceipt(){
+ window.open(decodeURIComponent(mpref.cfg.serviceurl)+ "receipt.html?action=preview","receipt");
+}
+
+function printticket(){
+ window.open(decodeURIComponent(mpref.cfg.serviceurl)+ "ticket.html?action=preview","receipt");
}
function cardwindow(){
function clean_shoppingcart(){
$("#checkout > tbody").html("");
+ $("#account").html("");
+ $("#sumtotal").html("0,00");
shoppingcart = {products:{},transaction:{}};
}
function view_unpayedshoppingcarts(){
+ var sql = "select tr.id,strftime('%d.%m.%Y %H:%M:%S',tr.created) as created,acc.name,printf('%.2f€',sum(td.grossamount * td.quantity)) as totalamount, sum(td.quantity) as products_nbr from transactions tr left join accounts acc on (tr.id_account=acc.id) left join transactiondata td on (tr.id=td.id_transaction) where tr.status='command' group by tr.id order by tr.created asc;";
+ $('#tbl_commands > tbody').html("");
+ var data = appdb.dbquery(sql);
+ console.log("commands table list")
+ console.log(data);
+ for (var i in data.sqldata){
+ var row = '<tr>'+
+ '<td>'+data.sqldata[i].id+ '</td>' +
+ '<td>'+data.sqldata[i].created+ '</td>' +
+ '<td>'+((data.sqldata[i].name != null)?data.sqldata[i].name:'')+ '</td>' +
+ '<td>'+data.sqldata[i].totalamount+ '</td>' +
+ '<td>'+data.sqldata[i].products_nbr+ '</td>' +
+ '<td><button class="btn btn-primary" onclick="loadcommand(\''+data.sqldata[i].id+'\');"><i class="fas fa-edit"></i></button></td>' +
+ '</tr>';
+ $("#tbl_commands").append(row);
+ }
+ $('#tbl_commands').bootstrapTable({
+ pagination: false,
+ search: false,
+ });
$('#dlgCommands').modal('show');
}
+function loadcommand(id){
+
+ var sql = "select id_product,id_account,id_transaction from transactiondata where id_transaction='"+id+"';";
+ var sc = appdb.dbquery(sql);
+ clean_shoppingcart();
+ shoppingcart['transaction']['id']=sc.sqldata[0]['id_transaction'];
+ if (sc.sqldata[0]['id_account'] != null){
+ set_account(sc.sqldata[0]['id_account'],null);
+ }
+ for (var i in sc.sqldata){
+ addproduct(sc.sqldata[i]['id_product']);
+ }
+ $('#dlgCommands').modal('hide');
+}
+
function save_shoppingcart(){
- printpreview();
+ console.log(shoppingcart['products'].length);
+ if (Object.keys(shoppingcart['products']) == 0){
+ return;
+ }
+ var newtrans = true;
+ if (!shoppingcart['transaction']['id'] || shoppingcart['transaction']['id'] == null){
+ shoppingcart['transaction']['id']= appdb.generate_uuid();
+ }else {
+ newtrans = false;
+ }
+
+ if ($("#sumtotalchangeamount").html() != ""){
+ shoppingcart['transaction']['cashbackamount'] = parseFloat($("#sumtotalchangeamount").html().replace(',','.'));
+ }
+ if ($("#sumtotalcashamount").html() != ""){
+ shoppingcart['transaction']['cashamount'] = parseFloat($("#sumtotalcashamount").html().replace(',','.'));
+ }
+ if (shoppingcart['transaction']['payedamount'] && shoppingcart['transaction']['payedamount'] != null){
+ shoppingcart['transaction']['status'] = "payed";
+
+ } else {
+ shoppingcart['transaction']['status'] = "command";
+ }
+ console.log('save shoppingcard');
+ if (newtrans == true){
+ var tsql = "INSERT INTO transactions (id, payementtype, id_account, payedamount, cashbackamount, cashamount, status, statusdate) VALUES ("+
+ "'"+shoppingcart['transaction']['id']+"',"+
+ ""+((shoppingcart['transaction']['paymenttype'])?"'"+shoppingcart['transaction']['paymenttype']+"'":'null')+", "+
+ ""+((shoppingcart['transaction']['account'] && shoppingcart['transaction']['account']['id'])?"'"+shoppingcart['transaction']['account']['id']+"'":'null')+", "+
+ " "+((shoppingcart['transaction']['payedamount'])?shoppingcart['transaction']['payedamount']:'null')+", "+((shoppingcart['transaction']['cashbackamount'])?shoppingcart['transaction']['cashbackamount']:'null')+", "+((shoppingcart['transaction']['cashamount'])?shoppingcart['transaction']['cashamount']:'null')+", '"+shoppingcart['transaction']['status']+"', date('now'));";
+ appdb.dbexec(tsql);
+ } else {
+ var dsql = "DELETE FROM transactiondata where id_transaction='"+shoppingcart['transaction']['id']+"';";
+ appdb.dbexec(dsql);
+ var updsql = "UPDATE transactions SET payementtype="+((shoppingcart['transaction']['paymenttype'])?"'"+shoppingcart['transaction']['paymenttype']+"'":'null')+", id_account="+((shoppingcart['transaction']['account'] && shoppingcart['transaction']['account']['id'])?"'"+shoppingcart['transaction']['account']['id']+"'":'null')+", payedamount="+((shoppingcart['transaction']['payedamount'])?shoppingcart['transaction']['payedamount']:'null')+", cashbackamount="+((shoppingcart['transaction']['cashbackamount'])?shoppingcart['transaction']['cashbackamount']:'null')+", cashamount="+((shoppingcart['transaction']['cashamount'])?shoppingcart['transaction']['cashamount']:'null')+", status='"+shoppingcart['transaction']['status']+"', statusdate=date('now') WHERE id='"+shoppingcart['transaction']['id']+"';";
+ appdb.dbexec(updsql);
+ }
+ console.log(tsql);
+ for (var i in shoppingcart["products"]){
+ var tdsql = "INSERT INTO transactiondata (id, id_transaction, id_product, id_account, netamount, vatamount, grossamount, quantity) VALUES('" +appdb.generate_uuid()+"', '"+shoppingcart['transaction']['id']+"', '"+shoppingcart["products"][i]['id_product']+"', "+((shoppingcart['transaction']['account'] && shoppingcart['transaction']['account']['id'])?"'"+shoppingcart['transaction']['account']['id']+"'":'null')+", "+((shoppingcart["products"][i]['netamount'])?shoppingcart["products"][i]['netamount']:'null')+", "+((shoppingcart["products"][i]['vatamount'])?shoppingcart["products"][i]['vatamount']:'null')+", "+((shoppingcart["products"][i]['grossamount'])?shoppingcart["products"][i]['grossamount']:'null')+", "+shoppingcart["products"][i]['quantity']+");";
+ console.log(tdsql);
+ appdb.dbexec(tdsql);
+ }
+ console.log(shoppingcart);
+
+ $("#sumtotalcashamount").html("");
+ $("#sumtotalchangeamount").html("");
+
+ if (localconfig['ticket'] && localconfig['ticket'] == 1){
+ printticket();
+ }
+ if (localconfig['receipt'] && localconfig['receipt'] == 1){
+ printreceipt();
+ }
+ clean_shoppingcart();
+ $('#dlgPayement').modal('hide');
+ //printpreview();
}
function book_shoppingcart(ptype){
- shoppingcart['transaction']['id']= appdb.generate_uuid();
- if (shoppingcart['transaction']['table'] && shoppingcart['transaction']['table']['name']){
- $("#pay_account").html(shoppingcart['transaction']['table']['name']);
+ if (shoppingcart['products'].length == 0){
+ return;
+ }
+ //shoppingcart['transaction']['id']= appdb.generate_uuid();
+ if (shoppingcart['transaction']['account'] && shoppingcart['transaction']['account']['name']){
+ $("#pay_account").html(shoppingcart['transaction']['account']['name']);
} else {
$("#pay_account").html("");
}
if (shoppingcart['transaction']['grossamount']){
$("#pay_sumtotal").html(shoppingcart['transaction']['grossamount'].toFixed(2).replace('.',','));
}
-
shoppingcart['transaction']['paymenttype'] = ptype;
- shoppingcart['transaction']['changeamount'] = null;
- shoppingcart['transaction']['cashamount'] = null;
- shoppingcart['transaction']['payedamount'] = null;
+
$("#sumtotalcashamount").html("");
$("#sumtotalchangeamount").html("");
- //$("#sumtotalpayedamount").html("");
- if (localconfig && localconfig['printtype'] && localconfig['printtype']['receipt'] && localconfig['printtype']['receipt'] == 1){
- $("#printreceipt").attr("checked","checked");
- }
- if (localconfig && localconfig['printtype'] && localconfig['printtype']['ticket'] && localconfig['printtype']['ticket'] == 1){
- $("#printticket").attr("checked","checked");
- }
-
$('#'+ptype).attr('checked', 'checked');
- //$('#'+ptype).attr('checked', 'checked');
- //parent.usersystem.setPreference('paywindow',localconfig);
- // appdb.dbexec("INSERT INTO transactions (id, payementtype, id_table, payedamount, cashbackamount, status, statusdate) VALUES('"+shoppingcart['transaction']['id']+"', '"+ptype+"', '"+shoppingcart['transaction']['id_table']+"', 0, 0, '', now());");
-
+ setpayementtype(ptype);
$('#dlgPayement').modal('show');
}
function setprinttype(id){
//console.log("set printtypes");
- if (!localsystem['printtype']){
- localsystem['printtype'] = {};
- }
+
if ($("#print"+id).prop('checked')){
- localsystem['printtype'][id] = 1;
+ localconfig[id] = 1;
}else {
- localsystem['printtype'][id] = 0;
+ localconfig[id] = 0;
}
parent.usersystem.setPreference('paywindow',localconfig);
}
$("#tableslist").html("");
console.log(tbls);
for (var i in tbls.sqldata){
- $("#tableslist").append('<button class="btn btn-secondary" style="margin: 1px solid #fff;" onclick="set_account(\''+tbls.sqldata[i].id+'\',\''+tbls.sqldata[i].name+'\');">'+tbls.sqldata[i].name+'</button>');
+ $("#tableslist").append('<button class="btn btn-secondary" style="margin: 3px;" onclick="set_account(\''+tbls.sqldata[i].id+'\',\''+tbls.sqldata[i].name+'\');">'+tbls.sqldata[i].name+'</button>');
}
$('#dlgTables').modal('show');
}
function set_account(id,name){
+ if (name == null){
+ var xname = appdb.dbquery("select name from accounts where id='"+id+"'");
+ name = xname.sqldata[0]['name'];
+ }
$("#account").html(name);
- if (!shoppingcart['transaction']['table']){
- shoppingcart['transaction']['table'] ={};
+ if (!shoppingcart['transaction']['account']){
+ shoppingcart['transaction']['account'] ={};
}
- shoppingcart['transaction']['table']['id'] = id;
- shoppingcart['transaction']['table']['name'] = name;
+ shoppingcart['transaction']['account']['id'] = id;
+ shoppingcart['transaction']['account']['name'] = name;
$('#dlgTables').modal('hide');
}
function setpayementtype(ptype){
- //console.log("set payement type: " + ptype);
- if ($("#"+id).prop('checked')){
+ console.log("set payement type: " + ptype);
+ if (ptype == 'card'){
+ $("#keypad").hide();
+ addvalue(null,2);
+ shoppingcart['transaction']['payedamount'] = shoppingcart['transaction']['grossamount'];
+ shoppingcart['transaction']['cashamount'] = null;
+ shoppingcart['transaction']['cashbackamount'] = null;
+ } else {
+ $("#keypad").show();
+ shoppingcart['transaction']['payedamount'] = null;
+ shoppingcart['transaction']['cashamount'] = null;
+ shoppingcart['transaction']['cashbackamount'] = null;
+ }
+ if ($("#"+ptype).prop('checked')){
shoppingcart['transaction']['payementtype'] =ptype;
}
}
}else {
$("#sumtotalchangeamount").html("");
}
+ if (ncash >= ntotal){
+ shoppingcart['transaction']['payedamount'] = shoppingcart['transaction']['grossamount'];
+ }
+
// if (ncash >= ntotal){
// $("#sumtotalpayedamount").html($("#sumtotalcashamount").html());
// } else {