From ea7f15f02fff15a10549a35a68083d2180fc7b96 Mon Sep 17 00:00:00 2001 From: Kilian Saffran Date: Mon, 18 Mar 2019 21:53:53 +0100 Subject: [PATCH] paywindow products and groups --- js/database.js | 3 ++ modules/paywindow/index.html | 71 ++++++++++++++++++++++++++---------- modules/paywindow/index.js | 32 +++++++++++++++- 3 files changed, 84 insertions(+), 22 deletions(-) diff --git a/js/database.js b/js/database.js index c94a3c9..54a0a59 100644 --- a/js/database.js +++ b/js/database.js @@ -1,6 +1,9 @@ var appdb = { //dbfile: null, url: null, + secvalue: function(text){ + return text.replace(/'/g,"''"); + }, dbquery: function(sQuery){ var type='querysorted'; var result= {sqldata:[]}; diff --git a/modules/paywindow/index.html b/modules/paywindow/index.html index 100a375..cf9ef2e 100644 --- a/modules/paywindow/index.html +++ b/modules/paywindow/index.html @@ -27,26 +27,67 @@
-
+
- +
- - - + + +
Anz.EinkaufAnz.Einkauf
+
+
+ +
+
+ +
+
-
-
+
+ + + + + + + + +
+
+
+ + + + + + + + +
+
+
+ + + + + + + + +
+
+ + +
diff --git a/modules/paywindow/index.js b/modules/paywindow/index.js index ef22d6b..515c742 100644 --- a/modules/paywindow/index.js +++ b/modules/paywindow/index.js @@ -1,13 +1,41 @@ var winh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); function initpage(){ - + load_group_selects(); } function loadadmin(){ parent.browserapp.loadmodule('overview'); } -function load_group_buttons(){ +function load_group_selects(){ + var sql = "select productgroup from products group by productgroup;"; + var opts = ""; + var data = appdb.dbquery(sql); + for (var i in data.sqldata){ + opts += ''; + } + $("#grouplist1").append(opts); + $("#grouplist2").append(opts); + $("#grouplist3").append(opts); +} + +function load_productgroup(listnum){ + var listval = $("#grouplist" + listnum + " :selected").val(); + console.log(listval); + $('#producttable' + listnum + " > tbody").html(""); + var sql ="select id,name,specification,replace(printf(\"%.2f\",grossamount),'.',',') as grossamount from products where productgroup='"+appdb.secvalue(listval)+"';"; + var products = appdb.dbquery(sql); + + for (var i in products.sqldata){ + var trow = ''; + trow += '
' + products.sqldata[i].name+'
'+ products.sqldata[i].specification +''+products.sqldata[i].grossamount+'€
'; + trow += ''; + $('#producttable' + listnum + " > tbody").append(trow.replace(/null/g,'')); + } +} + +function addproduct(idproduct){ + console.log(idproduct); } -- 2.39.5