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];
}
}
</nav>
</div>
</div>
- <div class="row">
- <table class="table table-bordered table-hover table-striped" id="tbl_invoicedata">
- <thead class="thead-dark">
- <tr>
- <th data-checkbox="true"></th>
- <th data-sortable="true">Description</th>
- <th data-sortable="true">Qty</th>
- <th data-sortable="true">Unit</th>
- <th data-sortable="true">Price</th>
- <th data-sortable="true">VAT</th>
- <th data-sortable="true">Discount</th>
- <th data-sortable="true">Sums</th>
- </tr>
- </thead>
- </table>
+ <div class="row" style="margin: 0px;">
+ <table style="width: 100%;" class="noselect">
+ <tr>
+ <td style="padding: 0px; margin: 0px;">
+ <table class="table" style="width: 100%; margin: 0px;" id="tbl_bookings_head">
+ <thead class="thead-dark">
+ <tr>
+ <th>Beschreibung</th>
+ <th>Anz.</th>
+ <th>Einheit</th>
+ <th>Betrag</th>
+ <th>MwSt.</th>
+ <th>Rabatt.</th>
+ <th>Netto</th>
+ </tr>
+ </thead>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div style="width: 100%; height: 60vh; overflow-y: scroll;">
+ <table id="tbl_bookings" style="width: 100%;" class="table table-bordered table-hover table-striped">
+ <tbody></tbody>
+ </table>
+ </div>
+ </td>
+ </tr>
+ </table>
</div>
</div>
<div aria-labelledby="files-tab" class="tab-pane fade" id="files" role="tabpanel">
getaccounts();
if (mpref.cfg.id){
getinvoicedata(mpref.cfg.id);
+ loadinvoicepositions(mpref.cfg.id);
} else {
//load default new invoice data
}
}
}
-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 = '<tr onclick="setselection(\''+ data.sqldata[i].id +'\');" id="' +data.sqldata[i].id + '">'+
+ '<td>'+data.sqldata[i].description+ '</td>' +
+ '<td>'+data.sqldata[i].quantity+ '</td>' +
+ '<td>' + data.sqldata[i].unit+ '</td>' +
+ '<td>' + data.sqldata[i].unitamount+ '</td>' +
+ '<td>' + data.sqldata[i].taxpercent+ '</td>' +
+ '<td>' + data.sqldata[i].discountpercent+ '</td>' +
+ '<td>' + data.sqldata[i].netamount+ ' €</td>' +
+
+ '</tr>';
+ $("#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
// }
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});
+ }
}
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];
}
}
<table class="table" style="width: 100%; margin: 0px;" id="tbl_products_head">
<thead class="thead-dark">
<tr>
- <th>ID</th>
+ <!-- <th>ID</th> -->
<th>Type</th>
<th>Unit</th>
<th>Beschreibung</th>
</tr>
<tr>
<td>
- <div style="width: 100%; height: 80vh; overflow-y: scroll;">
+ <div style="width: 100%; height: 90vh; overflow-y: scroll;">
<table id="tbl_products" style="width: 100%;" class="table table-bordered table-hover table-striped">
<tbody></tbody>
</table>
//console.log(data.sqldata);
for (var i in data.sqldata){
var row = '<tr onclick="setselection(\''+ data.sqldata[i].id +'\');" id="' +data.sqldata[i].id + '">'+
- '<td>' + ((data.sqldata[i].ident != null)?data.sqldata[i].ident:'')+ '</td>' +
+ // '<td>' + ((data.sqldata[i].ident != null)?data.sqldata[i].ident:'')+ '</td>' +
'<td>' + ((data.sqldata[i].ptype != null)?data.sqldata[i].ptype:'')+ '</td>' +
'<td>' + ((data.sqldata[i].unit != null)?data.sqldata[i].unit:'')+ '</td>' +
'<td>' + ((data.sqldata[i].description != null)?data.sqldata[i].description:'')+ '</td>' +
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