From: Kilian Saffran Date: Wed, 6 Mar 2019 05:53:02 +0000 (+0100) Subject: db and products X-Git-Url: http://cloud.dks.lu/git/?a=commitdiff_plain;h=9afd8f405525b932e894b4d51e0f3ddc3b3d8caa;p=cashbox.git db and products --- diff --git a/db.cashboxdev.json b/db.cashboxdev.json new file mode 100644 index 0000000..8489aa0 --- /dev/null +++ b/db.cashboxdev.json @@ -0,0 +1 @@ +{"name":"CashBox Dev","type":"local","server":"localhost","dbfile":"cashbox","vpn":"","vat":"0,17","currency":"€","mailserver":"","mailencryption":"","mailport":"","maillogin":"","mailpassword":""} \ No newline at end of file diff --git a/db/cashbox.sqlite.dev.full.sql b/db/cashbox.sqlite.dev.full.sql new file mode 100644 index 0000000..1352a95 Binary files /dev/null and b/db/cashbox.sqlite.dev.full.sql differ diff --git a/db/cashbox.sqlite.schema.sql b/db/cashbox.sqlite.schema.sql new file mode 100644 index 0000000..3b7d137 Binary files /dev/null and b/db/cashbox.sqlite.schema.sql differ diff --git a/js/moduleglobal.js b/js/moduleglobal.js index 5efb098..20b0b17 100644 --- a/js/moduleglobal.js +++ b/js/moduleglobal.js @@ -20,5 +20,16 @@ var mpref ={ //apppref.getpreference(page); //appdb.dbfile = this.cfg.dbfile; appdb.url = decodeURIComponent(this.cfg.serviceurl) + 'sqlite/' + decodeURIComponent(this.cfg.dbfile); + }, + formatvalue(value){ + var valret = value; + var isnumber= new RegExp("^[0-9]*,[0-9]*$"); + if (value == ''){ + valret = null; + } else if (isnumber.test(value)){ + valret = value.replace(",","."); + } + return valret; } -} \ No newline at end of file +} + diff --git a/main.js b/main.js index f49e854..56cf9c1 100644 --- a/main.js +++ b/main.js @@ -15,7 +15,7 @@ function createWindow () { var parameters = []; if (os.platform() == "win32"){ executablePath = "C:\\Strawberry\\perl\\bin\\perl.exe"; - parameters = ["C:\\Users\\ksaff\\Workspace\\DKSService\\dkslocalserver.pl"]; + parameters = ["C:\\Users\\ksaff\\Workspace\\dks_server\\dkslocalserver.pl"]; } else { //os.platform() == "darwin" executablePath = "/Users/kilian/perl5/perlbrew/perls/perl-5.28.1/bin/perl"; parameters = ["/Users/kilian/Workspace/DKSService/dkslocalserver.pl"]; diff --git a/modules/products/index.html b/modules/products/index.html index 3c12976..9ddaea9 100644 --- a/modules/products/index.html +++ b/modules/products/index.html @@ -45,7 +45,7 @@ - + diff --git a/modules/products/index.js b/modules/products/index.js index 903fc88..02e802b 100644 --- a/modules/products/index.js +++ b/modules/products/index.js @@ -1,5 +1,3 @@ -import { on } from "cluster"; - var winh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); var tblh = winh-54; @@ -9,9 +7,9 @@ function initpage(){ loadtable(); } -$("input,select").on('focusout',function(){ - console.log($(this).attr("id")); -}); +// $("input,select").on('focusout',function(){ +// console.log("TEST"); +// }); function loaddatalist_productgroup(){ var sql = "select productgroup from products where productgroup is not null group by productgroup;"; @@ -34,15 +32,15 @@ function loadtable(){ var data = appdb.dbquery(sql); console.log(data.sqldata); - $('#tbl_products').html(""); + $('#tbl_products > tbody').html(""); for (var i in data.sqldata){ var row = ''+ - '' + - '
' + - '' + - '' + - '' + - '' + + '' + + '
' + + '' + + '' + + '' + + '' + ''; $("#tbl_products").append(row); } @@ -103,4 +101,4 @@ function getTableSelectionIDs(){ } } return ids; -} \ No newline at end of file +} diff --git a/modules/products/lib/group.js b/modules/products/lib/group.js deleted file mode 100644 index b6ece23..0000000 --- a/modules/products/lib/group.js +++ /dev/null @@ -1,14 +0,0 @@ -var group = { - new: function(){ - - }, - edit: function(){ - - }, - delete: function(){ - - }, - duplicate: function(){ - - } -} \ No newline at end of file diff --git a/modules/products/lib/product.js b/modules/products/lib/product.js index 0a4334f..798d63d 100644 --- a/modules/products/lib/product.js +++ b/modules/products/lib/product.js @@ -1,4 +1,24 @@ var product = { + savevalue: function(obj){ + console.log(obj.type); + var savevalue= mpref.formatvalue(obj.value); + if (obj.type == "checkbox"){ + if (obj.checked){ + savevalue='1'; + } else { + savevalue=null; + } + } + if (savevalue==null){ + savevalue='null'; + }else { + savevalue="'"+ savevalue+"'"; + } + var ds = obj.id.split("-"); + var sql = "update " + ds[0]+" set "+ds[1]+ "="+savevalue+" where id='"+obj.parentNode.parentNode.id+"';"; + console.log(sql); + appdb.dbexec(sql); + }, import: function(){ }, diff --git a/modules/settings/index.html b/modules/settings/index.html index 631f384..3a37071 100644 --- a/modules/settings/index.html +++ b/modules/settings/index.html @@ -24,7 +24,7 @@ -
+
diff --git a/renderer.js b/renderer.js index 596f3dc..866763e 100644 --- a/renderer.js +++ b/renderer.js @@ -4,9 +4,11 @@ const os = require('os'); var usersystem = { profilepath: function(){ var ppath=""; + console.log(os.platform()); + console.log(os.homedir()); if (os.platform() == "darwin"){ ppath = os.homedir() + '/Library/Application Support/cashbox/'; - } else if (os.platform() == "Win32") { + } else if (os.platform() == "win32") { ppath = os.homedir() + '/AppData/Roaming/cashbox/'; } return ppath; @@ -51,6 +53,7 @@ var usersystem = { }, getLocalDataSets: function(){ var datasets =[]; + console.log(this.profilepath()); var files = fs.readdirSync(this.profilepath()); files.forEach(function(file) { if (file.match('db\..*\.json')){