From bfdb70ea28ce9a9ef8048a93956f1c5ae840b911 Mon Sep 17 00:00:00 2001 From: Kilian Saffran Date: Sun, 19 May 2019 12:09:04 +0200 Subject: [PATCH] misc changes --- modules/bookings/index.js | 3 ++ modules/invoices/form_invoice.html | 44 ++++++++++++++++++++---------- modules/invoices/form_invoice.js | 42 ++++++++++++++++++++++++++-- modules/invoices/index.js | 11 +++++--- modules/products/index.html | 4 +-- modules/products/index.js | 7 +++-- 6 files changed, 86 insertions(+), 25 deletions(-) diff --git a/modules/bookings/index.js b/modules/bookings/index.js index 3cbb2fb..6797a4f 100644 --- a/modules/bookings/index.js +++ b/modules/bookings/index.js @@ -193,10 +193,13 @@ function setselection(id){ if (shiftdown === true){ if ($("#" + id).hasClass('highlight')){ $("#" + id).removeClass('highlight'); + selection.splice($.inArray(id, selection),1); }else { $("#" + id).addClass('highlight'); + selection.push(id); } } else { $("#" + id).addClass('highlight').siblings().removeClass('highlight'); + selection = [id]; } } diff --git a/modules/invoices/form_invoice.html b/modules/invoices/form_invoice.html index 09b7480..745ba7b 100644 --- a/modules/invoices/form_invoice.html +++ b/modules/invoices/form_invoice.html @@ -174,21 +174,35 @@ -
- - - - - - - - - - - - - -
DescriptionQtyUnitPriceVATDiscountSums
+
+ + + + + + + +
+ + + + + + + + + + + + +
BeschreibungAnz.EinheitBetragMwSt.Rabatt.Netto
+
+
+ + +
+
+
diff --git a/modules/invoices/form_invoice.js b/modules/invoices/form_invoice.js index e98ccbc..23f3e47 100644 --- a/modules/invoices/form_invoice.js +++ b/modules/invoices/form_invoice.js @@ -13,6 +13,7 @@ function initpage(){ getaccounts(); if (mpref.cfg.id){ getinvoicedata(mpref.cfg.id); + loadinvoicepositions(mpref.cfg.id); } else { //load default new invoice data } @@ -75,7 +76,44 @@ function getinvoicedata(id){ } } -function loadinvoicepositions(){ - +function loadinvoicepositions(id){ + var sql = "select id,quantity, printf(\"%.2f\",unitamount) as unitamount,coalesce(unit,'') as unit,description,printf(\"%.2f\",taxpercent) as taxpercent,printf(\"%.2f\",discountpercent) as discountpercent,printf(\"%.2f\",quantity * unitamount) as netamount from invoicepositions where id_invoice='"+id+"';"; + var data = appdb.dbquery(sql); + $("#tbl_bookings > tbody").html(""); + for (var i in data.sqldata){ + var row = ''+ + ''+data.sqldata[i].description+ '' + + ''+data.sqldata[i].quantity+ '' + + '' + data.sqldata[i].unit+ '' + + '' + data.sqldata[i].unitamount+ '' + + '' + data.sqldata[i].taxpercent+ '' + + '' + data.sqldata[i].discountpercent+ '' + + '' + data.sqldata[i].netamount+ ' €' + + + ''; + $("#tbl_bookings > tbody").append(row); + } + var cols = $("#tbl_bookings > tbody > tr:first-child").children(); + var colnum = cols.length -1; + console.log("childnum:" + colnum); + for (var i=1;i<=colnum;i++){ + wx = $("#tbl_bookings > tbody > tr:first-child > td:nth-child("+ i +")").width(); + wx = wx +3; + $("#tbl_bookings > thead > tr > th:nth-child("+ i +")").width(wx); + } } +function setselection(id){ + if (shiftdown === true){ + if ($("#" + id).hasClass('highlight')){ + $("#" + id).removeClass('highlight'); + selection.splice($.inArray(id, selection),1); + }else { + $("#" + id).addClass('highlight'); + selection.push(id); + } + } else { + $("#" + id).addClass('highlight').siblings().removeClass('highlight'); + selection = [id]; + } +} \ No newline at end of file diff --git a/modules/invoices/index.js b/modules/invoices/index.js index 32d1cf4..bdaab6b 100644 --- a/modules/invoices/index.js +++ b/modules/invoices/index.js @@ -112,10 +112,10 @@ function loadtable(){ // } function invoice_edit(){ - // var inv_id= - // if (inv_id){ - // parent.browserapp.loadmodulepage('invoices','form_invoice',{"id":inv_id}); - // } + var inv_id= selection[0]; + if (inv_id){ + parent.browserapp.loadmodulepage('invoices','form_invoice',{"id":inv_id}); + } } @@ -191,10 +191,13 @@ function setselection(id){ if (shiftdown === true){ if ($("#" + id).hasClass('highlight')){ $("#" + id).removeClass('highlight'); + selection.splice($.inArray(id, selection),1); }else { $("#" + id).addClass('highlight'); + selection.push(id); } } else { $("#" + id).addClass('highlight').siblings().removeClass('highlight'); + selection = [id]; } } diff --git a/modules/products/index.html b/modules/products/index.html index be31319..6bf10d2 100644 --- a/modules/products/index.html +++ b/modules/products/index.html @@ -30,7 +30,7 @@ - + @@ -43,7 +43,7 @@ '+ - '' + + // '' + '' + '' + '' + @@ -120,10 +120,13 @@ function setselection(id){ if (shiftdown === true){ if ($("#" + id).hasClass('highlight')){ $("#" + id).removeClass('highlight'); + selection.splice($.inArray(id, selection),1); }else { $("#" + id).addClass('highlight'); + selection.push(id); } } else { $("#" + id).addClass('highlight').siblings().removeClass('highlight'); + selection = [id]; } -} +} \ No newline at end of file -- 2.39.5
ID Type Unit Beschreibung
-
+
diff --git a/modules/products/index.js b/modules/products/index.js index cb89619..923c73d 100644 --- a/modules/products/index.js +++ b/modules/products/index.js @@ -58,7 +58,7 @@ function loadtable(){ //console.log(data.sqldata); for (var i in data.sqldata){ var row = '
' + ((data.sqldata[i].ident != null)?data.sqldata[i].ident:'')+ '' + ((data.sqldata[i].ident != null)?data.sqldata[i].ident:'')+ '' + ((data.sqldata[i].ptype != null)?data.sqldata[i].ptype:'')+ '' + ((data.sqldata[i].unit != null)?data.sqldata[i].unit:'')+ '' + ((data.sqldata[i].description != null)?data.sqldata[i].description:'')+ '