--- /dev/null
+{"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
//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
+}
+
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"];
<script src="../../js/moduleglobal.js"></script>
<script src="../../js/database.js"></script>
<script src="lib/product.js"></script>
-<script src="lib/group.js"></script>
+
<script src="index.js"></script>
<script>if (window.module) module = window.module;</script>
</body>
-import { on } from "cluster";
-
var winh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
var tblh = winh-54;
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;";
var data = appdb.dbquery(sql);
console.log(data.sqldata);
- $('#tbl_products').html("");
+ $('#tbl_products > tbody').html("");
for (var i in data.sqldata){
var row = '<tr id="' +data.sqldata[i].id + '"><td></td>'+
- '<td><input type="checkbox" class="form-control" id="visible" name="visible" value="'+data.sqldata[i].visible+ '" '+ ((data.sqldata[i].visible == '1')?"checked":'')+'/></td>' +
- '<td><input type="text" class="form-control" value="'+((data.sqldata[i].name != null)?data.sqldata[i].name:'')+'"/><br><input class="form-control" type="text" value="' + ((data.sqldata[i].specification != null)?data.sqldata[i].specification:'')+ '" /></td>' +
- '<td><input type="text" class="form-control" list="productgroup" value="' + (( data.sqldata[i].productgroup!= null)?data.sqldata[i].productgroup:'')+ '"/></td>' +
- '<td><input type="text" class="form-control right" value="' + data.sqldata[i].netamount+ '" /></td>' +
- '<td><input type="text" class="form-control right" list="vatpercent" value="' + data.sqldata[i].vatpercent+ '" /></td>' +
- '<td><input type="text" class="form-control right" value="' + data.sqldata[i].grossamount+ '" /></td>' +
+ '<td><input type="checkbox" class="form-control" id="products-visible" name="products-visible" onfocusout="product.savevalue(this);" value="'+data.sqldata[i].visible+ '" '+ ((data.sqldata[i].visible == '1')?"checked":'')+'/></td>' +
+ '<td><input type="text" class="form-control font-weight-bold" id="products-name" name="products-name" onfocusout="product.savevalue(this);" value="'+((data.sqldata[i].name != null)?data.sqldata[i].name:'')+'"/><br><input class="form-control" type="text" onfocusout="product.savevalue(this);" id="products-specification" name="products-specification" value="' + ((data.sqldata[i].specification != null)?data.sqldata[i].specification:'')+ '" /></td>' +
+ '<td><input type="text" class="form-control" list="productgroup" id="products-productgroup" name="products-productgroup" onfocusout="product.savevalue(this);" value="' + (( data.sqldata[i].productgroup!= null)?data.sqldata[i].productgroup:'')+ '"/></td>' +
+ '<td><input type="text" class="form-control right" id="products-netamount" name="products-netamount" onfocusout="product.savevalue(this);" value="' + data.sqldata[i].netamount+ '" /></td>' +
+ '<td><input type="text" class="form-control right" list="vatpercent" id="products-vatpercent" name="products-vatpercent" onfocusout="product.savevalue(this);" value="' + data.sqldata[i].vatpercent+ '" /></td>' +
+ '<td><input type="text" class="form-control right" id="products-grossamount" name="products-grossamount" onfocusout="product.savevalue(this);" value="' + data.sqldata[i].grossamount+ '" /></td>' +
'</tr>';
$("#tbl_products").append(row);
}
}
}
return ids;
-}
\ No newline at end of file
+}
+++ /dev/null
-var group = {
- new: function(){
-
- },
- edit: function(){
-
- },
- delete: function(){
-
- },
- duplicate: function(){
-
- }
-}
\ No newline at end of file
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(){
},
</div>
</div>
</nav>
- <div class="cotainer-fluid" style="margin-top: 52px;">
+ <div class="cotainer-fluid bg-white" style="margin-top: 52px;">
<!-- <button class="btn btn-secondary" onclick="parent.usersystem.showError('MyError','My Error Message from settings!');">Show Error</button> -->
<table class="table table-bordered table-hover table-striped" id="tbl_datasets">
<thead class="thead-dark">
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;
},
getLocalDataSets: function(){
var datasets =[];
+ console.log(this.profilepath());
var files = fs.readdirSync(this.profilepath());
files.forEach(function(file) {
if (file.match('db\..*\.json')){