From 2e62e35ba68f3eff5fd29ad0a39cd9371cdf49ab Mon Sep 17 00:00:00 2001 From: Kilian Date: Sun, 17 Mar 2019 10:37:37 +0100 Subject: [PATCH] stations and tables --- main.js | 4 +- modules/clients/index.js | 73 ++++++++----------------- modules/sales/index.html | 2 +- modules/stations/index.html | 29 +++------- modules/stations/index.js | 67 +++++++---------------- modules/tables/index.html | 31 ++++------- modules/tables/index.js | 67 +++++++---------------- modules/transactions/index.html | 14 ++--- modules/transactions/lib/transaction.js | 0 9 files changed, 94 insertions(+), 193 deletions(-) create mode 100644 modules/transactions/lib/transaction.js diff --git a/main.js b/main.js index d499a29..c813a67 100644 --- a/main.js +++ b/main.js @@ -45,12 +45,12 @@ function createWindow () { // var test = app.getPath('USERPROFILE'); // console.log("Path:" + test); // console.log(data.toString()); - win.show() + mainWindow.show() } }); } else { - win.show(); + mainWindow.show(); } mainWindow.show() diff --git a/modules/clients/index.js b/modules/clients/index.js index 9f39e0d..488cc5b 100644 --- a/modules/clients/index.js +++ b/modules/clients/index.js @@ -9,37 +9,21 @@ function initpage(){ function loadtable(){ - // var sql = 'select ij.id,ij.byear,ij.date as datesortable, STRFTIME("%d.%m.%Y",ij.date) as date,ij.id,rec.company as recepient, sen.company as sender,ij.reference, ' + - // 'printf("%.2f",CAST(sum(pos.quantity * pos.unitamount) as real)) as netamount, ' + - // 'printf("%.2f",CAST(case when pos.taxpercent > 0 then sum(pos.taxpercent * pos.quantity * pos.unitamount) else 0.0 end AS REAL)) as taxamount, ' + - // 'printf("%.2f",CAST(sum(pos.quantity * pos.unitamount) + case when pos.taxpercent > 0 then sum(pos.taxpercent * pos.quantity * pos.unitamount) else 0.0 end AS real)) as totalamount, ' + - // 'printf("%.2f",COALESCE(ij.payedamount,0.0)) as payedamount, ' + - // 'ij.status ' + - // 'from cashbox ij ' + - // 'left join invoicepositions pos on (ij.id=pos.id_invoice) ' + - // 'left join accounts rec on (ij.id_receipient = rec.id) ' + - // 'left join accounts sen on (ij.id_sender = sen.id) where ij.byear=' + cfg.byear +' group by pos.id_invoice order by date desc;'; - // var data = appdb.dbquery(sql); + var sql = 'SELECT id, prename,surname, address, zip, city, country, clientnumber, email, phone FROM clients;' + var data = appdb.dbquery(sql); // //console.log(data.sqldata); - // for (var i in data.sqldata){ - // var cstatus = "secondary"; - // if (data.sqldata[i].status== "bezahlt"){ cstatus = "success"; } - // if (data.sqldata[i].status== "überfällig"){ cstatus = "danger"; } - // if (data.sqldata[i].status== "verschickt"){ cstatus = "warning"; } - // var acolor = ""; - // if (data.sqldata[i].totalamount.startsWith("-")){ acolor = "text-danger"; } - // var row = ''+ - // '' + - // ''+data.sqldata[i].datesortable+' ' + data.sqldata[i].date+ '' + - // '' + data.sqldata[i].recepient+ '' + - // '' + data.sqldata[i].sender+ '' + - // '' + data.sqldata[i].reference+ '' + - // '' + data.sqldata[i].status+ '' + - // '' + data.sqldata[i].totalamount+ ' €' + - - // ''; - // $("#tbl_invoices").append(row); - // } + for (var i in data.sqldata){ + var row = ''+ + '' + + ''+ data.sqldata[i].prename + ' ' + data.sqldata[i].surname + '' + + ''+ data.sqldata[i].address + '
' + data.sqldata[i].zip + ' ' + data.sqldata[i].city + '
' + data.sqldata[i].country +'' + + '' + data.sqldata[i].phone+ '' + + '' + data.sqldata[i].email+ '' + + '' + '' + + '' + '' + + ''; + $("#tbl_clients").append(row); + } $('#tbl_clients').bootstrapTable({ pagination: false, search: false, @@ -50,38 +34,27 @@ function loadtable(){ } -function loadyears(){ - sql = "select byear from cashbox group by byear order by byear asc;"; - var data = appdb.dbquery(sql); - //onsole.log(data.sqldata); - for (var i in data.sqldata){ - $("#timerange").append('' + data.sqldata[i].byear+''); - } - -} -function invoice_edit(){ - var inv_id= getTableSelectionID(); - if (inv_id){ - parent.browserapp.loadmodulepage('invoices','invoice',{"id":inv_id}); + +function client_edit(){ + var cl_id= getTableSelectionID(); + if (cl_id){ + parent.browserapp.loadmodulepage('clients','client',{"id":cl_id}); } } -function invoice_delete(){ +function client_delete(){ } -function invoice_duplicate(){ +function client_duplicate(){ } -function change_timerange(){ - -} function getTableSelectionID(){ - var sel = $('#tbl_invoices').bootstrapTable('getSelections'); + var sel = $('#tbl_clients').bootstrapTable('getSelections'); var id = null; if (sel){ id=sel[0]._id; } @@ -90,7 +63,7 @@ function getTableSelectionID(){ } function getTableSelectionIDs(){ - var sel = $('#tbl_invoices').bootstrapTable('getSelections'); + var sel = $('#tbl_clients').bootstrapTable('getSelections'); var ids = []; if (sel){ for (var s in sel){ diff --git a/modules/sales/index.html b/modules/sales/index.html index 707db75..d3cbd62 100644 --- a/modules/sales/index.html +++ b/modules/sales/index.html @@ -6,7 +6,7 @@ - + Verkäufe diff --git a/modules/stations/index.html b/modules/stations/index.html index 2a66de8..d161e36 100644 --- a/modules/stations/index.html +++ b/modules/stations/index.html @@ -15,32 +15,22 @@ Rechnungen
- - - - -
- - - -
+ + + + +
- +
- - - - + + + -
DatumEmpfängerSenderReferenzNameTypMitarbeiter StatusBetrag
@@ -52,7 +42,6 @@ - diff --git a/modules/stations/index.js b/modules/stations/index.js index 7c61e85..7f398a4 100644 --- a/modules/stations/index.js +++ b/modules/stations/index.js @@ -1,49 +1,35 @@ var winh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); var tblh = winh-54; -var cfg = { - byear: 2018 -} + function initpage(){ console.log(appdb.url); - loadyears(); loadtable(); } function loadtable(){ - var sql = 'select ij.id,ij.byear,ij.date as datesortable, STRFTIME("%d.%m.%Y",ij.date) as date,ij.id,rec.company as recepient, sen.company as sender,ij.reference, ' + - 'printf("%.2f",CAST(sum(pos.quantity * pos.unitamount) as real)) as netamount, ' + - 'printf("%.2f",CAST(case when pos.taxpercent > 0 then sum(pos.taxpercent * pos.quantity * pos.unitamount) else 0.0 end AS REAL)) as taxamount, ' + - 'printf("%.2f",CAST(sum(pos.quantity * pos.unitamount) + case when pos.taxpercent > 0 then sum(pos.taxpercent * pos.quantity * pos.unitamount) else 0.0 end AS real)) as totalamount, ' + - 'printf("%.2f",COALESCE(ij.payedamount,0.0)) as payedamount, ' + - 'ij.status ' + - 'from cashbox ij ' + - 'left join invoicepositions pos on (ij.id=pos.id_invoice) ' + - 'left join accounts rec on (ij.id_receipient = rec.id) ' + - 'left join accounts sen on (ij.id_sender = sen.id) where ij.byear=' + cfg.byear +' group by pos.id_invoice order by date desc;'; + var sql = 'SELECT id, hostname, "type", currentip, staffmember, status, location FROM stations;'; var data = appdb.dbquery(sql); //console.log(data.sqldata); for (var i in data.sqldata){ var cstatus = "secondary"; - if (data.sqldata[i].status== "bezahlt"){ cstatus = "success"; } - if (data.sqldata[i].status== "überfällig"){ cstatus = "danger"; } - if (data.sqldata[i].status== "verschickt"){ cstatus = "warning"; } - var acolor = ""; - if (data.sqldata[i].totalamount.startsWith("-")){ acolor = "text-danger"; } + if (data.sqldata[i].status== "active"){ cstatus = "success"; } + if (data.sqldata[i].status== "inactive"){ cstatus = "danger"; } + // if (data.sqldata[i].status== "verschickt"){ cstatus = "warning"; } + // var acolor = ""; + // if (data.sqldata[i].totalamount.startsWith("-")){ acolor = "text-danger"; } var row = ''+ '' + - ''+data.sqldata[i].datesortable+' ' + data.sqldata[i].date+ '' + - '' + data.sqldata[i].recepient+ '' + - '' + data.sqldata[i].sender+ '' + - '' + data.sqldata[i].reference+ '' + + '' + data.sqldata[i].hostname+ '' + + '' + data.sqldata[i].type+ '' + + '' + data.sqldata[i].location+ '' + + '' + data.sqldata[i].staffmember+ '' + '' + data.sqldata[i].status+ '' + - '' + data.sqldata[i].totalamount+ ' €' + - ''; - $("#tbl_invoices").append(row); + $("#tbl_stations").append(row); } - $('#tbl_invoices').bootstrapTable({ + $('#tbl_stations').bootstrapTable({ pagination: false, search: false, height: tblh, @@ -53,38 +39,27 @@ function loadtable(){ } -function loadyears(){ - sql = "select byear from cashbox group by byear order by byear asc;"; - var data = appdb.dbquery(sql); - //onsole.log(data.sqldata); - for (var i in data.sqldata){ - $("#timerange").append('' + data.sqldata[i].byear+''); - } - -} -function invoice_edit(){ - var inv_id= getTableSelectionID(); - if (inv_id){ - parent.browserapp.loadmodulepage('invoices','invoice',{"id":inv_id}); +function station_edit(){ + var st_id= getTableSelectionID(); + if (st_id){ + parent.browserapp.loadmodulepage('stations','station',{"id":st_id}); } } -function invoice_delete(){ +function station_delete(){ } -function invoice_duplicate(){ +function station_duplicate(){ } -function change_timerange(){ -} function getTableSelectionID(){ - var sel = $('#tbl_invoices').bootstrapTable('getSelections'); + var sel = $('#tbl_stations').bootstrapTable('getSelections'); var id = null; if (sel){ id=sel[0]._id; } @@ -93,7 +68,7 @@ function getTableSelectionID(){ } function getTableSelectionIDs(){ - var sel = $('#tbl_invoices').bootstrapTable('getSelections'); + var sel = $('#tbl_stations').bootstrapTable('getSelections'); var ids = []; if (sel){ for (var s in sel){ diff --git a/modules/tables/index.html b/modules/tables/index.html index 2a66de8..34f2f6f 100644 --- a/modules/tables/index.html +++ b/modules/tables/index.html @@ -12,34 +12,26 @@
- +
- - - - + + + + @@ -52,7 +44,6 @@ - diff --git a/modules/tables/index.js b/modules/tables/index.js index 7c61e85..94ca376 100644 --- a/modules/tables/index.js +++ b/modules/tables/index.js @@ -1,49 +1,32 @@ var winh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); var tblh = winh-54; -var cfg = { - byear: 2018 -} + function initpage(){ console.log(appdb.url); - loadyears(); loadtable(); } function loadtable(){ - var sql = 'select ij.id,ij.byear,ij.date as datesortable, STRFTIME("%d.%m.%Y",ij.date) as date,ij.id,rec.company as recepient, sen.company as sender,ij.reference, ' + - 'printf("%.2f",CAST(sum(pos.quantity * pos.unitamount) as real)) as netamount, ' + - 'printf("%.2f",CAST(case when pos.taxpercent > 0 then sum(pos.taxpercent * pos.quantity * pos.unitamount) else 0.0 end AS REAL)) as taxamount, ' + - 'printf("%.2f",CAST(sum(pos.quantity * pos.unitamount) + case when pos.taxpercent > 0 then sum(pos.taxpercent * pos.quantity * pos.unitamount) else 0.0 end AS real)) as totalamount, ' + - 'printf("%.2f",COALESCE(ij.payedamount,0.0)) as payedamount, ' + - 'ij.status ' + - 'from cashbox ij ' + - 'left join invoicepositions pos on (ij.id=pos.id_invoice) ' + - 'left join accounts rec on (ij.id_receipient = rec.id) ' + - 'left join accounts sen on (ij.id_sender = sen.id) where ij.byear=' + cfg.byear +' group by pos.id_invoice order by date desc;'; + var sql = 'SELECT id, name, seats,location FROM tables;'; var data = appdb.dbquery(sql); //console.log(data.sqldata); for (var i in data.sqldata){ - var cstatus = "secondary"; - if (data.sqldata[i].status== "bezahlt"){ cstatus = "success"; } - if (data.sqldata[i].status== "überfällig"){ cstatus = "danger"; } - if (data.sqldata[i].status== "verschickt"){ cstatus = "warning"; } - var acolor = ""; - if (data.sqldata[i].totalamount.startsWith("-")){ acolor = "text-danger"; } + var row = ''+ '' + - '' + - '' + - '' + - '' + - '' + - '' + + '' + + '' + + '' + + '' + + '' + + '' + ''; - $("#tbl_invoices").append(row); + $("#tbl_tables").append(row); } - $('#tbl_invoices').bootstrapTable({ + $('#tbl_tables').bootstrapTable({ pagination: false, search: false, height: tblh, @@ -53,38 +36,28 @@ function loadtable(){ } -function loadyears(){ - sql = "select byear from cashbox group by byear order by byear asc;"; - var data = appdb.dbquery(sql); - //onsole.log(data.sqldata); - for (var i in data.sqldata){ - $("#timerange").append('' + data.sqldata[i].byear+''); - } - -} -function invoice_edit(){ - var inv_id= getTableSelectionID(); - if (inv_id){ - parent.browserapp.loadmodulepage('invoices','invoice',{"id":inv_id}); + +function table_edit(){ + var tbl_id= getTableSelectionID(); + if (tbl_id){ + parent.browserapp.loadmodulepage('tables','table',{"id":tbl_id}); } } -function invoice_delete(){ +function table_delete(){ } -function invoice_duplicate(){ +function table_clone(){ } -function change_timerange(){ -} function getTableSelectionID(){ - var sel = $('#tbl_invoices').bootstrapTable('getSelections'); + var sel = $('#tbl_tables').bootstrapTable('getSelections'); var id = null; if (sel){ id=sel[0]._id; } @@ -93,7 +66,7 @@ function getTableSelectionID(){ } function getTableSelectionIDs(){ - var sel = $('#tbl_invoices').bootstrapTable('getSelections'); + var sel = $('#tbl_tables').bootstrapTable('getSelections'); var ids = []; if (sel){ for (var s in sel){ diff --git a/modules/transactions/index.html b/modules/transactions/index.html index 2a66de8..cfb0709 100644 --- a/modules/transactions/index.html +++ b/modules/transactions/index.html @@ -8,11 +8,11 @@ -Rechnungen +Transaktionen
DatumEmpfängerSenderReferenzNameSitzplätzeStandort StatusFreie Plätze Betrag
'+data.sqldata[i].datesortable+' ' + data.sqldata[i].date+ '' + data.sqldata[i].recepient+ '' + data.sqldata[i].sender+ '' + data.sqldata[i].reference+ '' + data.sqldata[i].status+ '' + data.sqldata[i].totalamount+ ' €' + data.sqldata[i].name+ '' + data.sqldata[i].seats+ '' + data.sqldata[i].location+ '' + 'unbekannt' +'' + 0+ '' + 0.00+ ' €
- - - - + + + + @@ -52,7 +52,7 @@ - + diff --git a/modules/transactions/lib/transaction.js b/modules/transactions/lib/transaction.js new file mode 100644 index 0000000..e69de29 -- 2.39.5
DatumEmpfängerSenderReferenzZeitpunktBezahlartKundeTisch Status Betrag