bookings invoices prodocts
authorKilian Saffran <ksaffran@dks.lu>
Sun, 28 Apr 2019 13:59:13 +0000 (15:59 +0200)
committerKilian Saffran <ksaffran@dks.lu>
Sun, 28 Apr 2019 13:59:13 +0000 (15:59 +0200)
db/invoicejournal.sqlite [new file with mode: 0755]
modules/bookings/index.html
modules/bookings/index.js
modules/invoices/index.html
modules/invoices/index.js
modules/products/index.html
modules/products/index.js
server/Module/PDFExtract.pm

diff --git a/db/invoicejournal.sqlite b/db/invoicejournal.sqlite
new file mode 100755 (executable)
index 0000000..49c345e
Binary files /dev/null and b/db/invoicejournal.sqlite differ
index 400fe78..7daac10 100644 (file)
     <button class="btn btn-primary" onclick="booking_edit();"><i class="fas fa-edit"></i><br/>Edit</button>
     <button class="btn btn-primary" onclick="booking_delete();"><i class="fas fa-trash"></i><br/>Delete</button>
     <button class="btn btn-primary" onclick="booking_clone();"><i class="fas fa-clone"></i><br/>Dupl.</button>
-    <div class="btn-group">
-        <button type="button" class="btn btn-primary" id="seltimerange">TimeRange</button>
-        <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-          <span class="sr-only">Toggle Dropdown</span>
-        </button>
-        <div class="dropdown-menu" id="timerange">
-          
-        </div>
-      </div>
-   </div>
+    
                 </div>
               </nav>
     <div class="cotainer-fluid" style="margin-top: 52px;">
         <td>
           <div style="width: 100%; height: 80vh; overflow-y: scroll;">
           <table id="tbl_bookings" style="width: 100%;" class="table table-bordered table-hover table-striped">
-            <!-- <thead class="thead-dark"> <tr>
-              
-                    <th data-checkbox="true"></th>
-                    <th data-sortable="true">Datum</th>
-                    <th data-sortable="true" data-filter="true">Empfänger</th>
-                    <th data-sortable="true">Sender</th>
-                    <th data-sortable="true">Beschreibung</th>
-                    <th data-sortable="true">Status</th>
-                    <th data-sortable="true" data-align="right">Betrag</th>
-                  </tr>
-                    </thead> -->
-            
             <tbody></tbody>
           </table>
         </div>
 <script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
 <script src="../../node_modules/jquery/dist/jquery.min.js"></script>
 <script src="../../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
-<!-- <script src="../../node_modules/bootstrap-table/dist/bootstrap-table.min.js"></script> 
- <script src="../../node_modules/bootstrap-table/dist/extensions/select2-filter/bootstrap-table-select2-filter.min.js"></script> 
- <script src="../../node_modules/select2/dist/js/select2.full.min.js"></script> -->
 <script src="../../node_modules/@fortawesome/fontawesome-free/js/all.min.js"></script>
 <script src="../../js/moduleglobal.js"></script>
 <script src="../../js/database.js"></script>
index e6f2687..3cbb2fb 100644 (file)
@@ -54,9 +54,10 @@ function loadtable(){
     }
     
   }
+  console.log(where);
   sums = { planned: {cnt:0,sum:0},sended: {cnt:0,sum:0},payed: {cnt:0,sum:0},delayed: {cnt:0,sum:0},total: {cnt:0,sum:0}};
-  var sql = "select strftime('%d.%m.%Y',invoicepositions.bookingdate) as bookingdate, invoicepositions.bookingdate as datesortable,invoicepositions.id,sender.company as sender,receipient.company as receipient, invoicepositions.description,replace(printf('%.2f€',quantity * unitamount),'.',',') as amount,quantity * unitamount as sumamount , invoicejournal.status from invoicepositions left join accounts sender on (invoicepositions.id_sender=sender.id) left join invoicejournal  on (invoicepositions.id_invoice=invoicejournal.id) left join accounts receipient on (invoicepositions.id_receipient=receipient.id)" + where + " order by invoicepositions.bookingdate desc;";
-  console.log(sql);
+  var sql = "select strftime('%d.%m.%Y',invoicepositions.bookingdate) as bookingdate, invoicepositions.bookingdate as datesortable,invoicepositions.id,sender.company as sender,receipient.company as receipient, invoicepositions.description,replace(printf('%.2f€',quantity * unitamount),'.',',') as amount,quantity * unitamount as sumamount , invoicejournal.status from invoicepositions left join accounts sender on (invoicepositions.id_sender=sender.id) left join invoicejournal  on (invoicepositions.id_invoice=invoicejournal.id) left join accounts receipient on (invoicepositions.id_receipient=receipient.id) " + where + " order by invoicepositions.bookingdate desc;";
+  //console.log(sql);
   //$('#tbl_bookings').bootstrapTable('destroy');
   $("#tbl_bookings > tbody").html("");
   var data = appdb.dbquery(sql);
@@ -168,9 +169,12 @@ function setfilter(id,field){
   loadtable();
 }
 
+function booking_new(){
+  parent.browserapp.loadmodulepage('bookings','form_booking',{"id":null});
+}
 
 function booking_edit(){
-  var inv_id= getTableSelectionID();
+  //var inv_id= getTableSelectionID();
   if (inv_id){
     parent.browserapp.loadmodulepage('bookings','form_booking',{"id":inv_id});
   }
index f6c0642..77a0dab 100644 (file)
@@ -4,7 +4,7 @@
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <link rel="stylesheet" href="../../node_modules/bootstrap/dist/css/bootstrap.min.css">
-<link rel="stylesheet" href="../../node_modules/bootstrap-table/dist/bootstrap-table.min.css">
+<!-- <link rel="stylesheet" href="../../node_modules/bootstrap-table/dist/bootstrap-table.min.css"> -->
 <link rel="stylesheet" href="../../node_modules/@fortawesome/fontawesome-free/css/fontawesome.min.css">
 <link rel="stylesheet" href="../../css/invoicejournal.epic.css">
 <link rel="stylesheet" href="../../css/app.css">
    </div>
                 </div>
               </nav>
-    <div class="cotainer-fluid" style="margin-top: 52px;">            
-    <table id="tbl_invoices" class="table table-bordered table-hover table-striped">
-        <thead class="thead-dark"> 
-                <th data-checkbox="true"></th>
-                <th data-sortable="true">Datum</th>
-                <th data-sortable="true">Empfänger</th>
-                <th data-sortable="true">Sender</th>
-                <th data-sortable="true">Referenz</th>
-                <th data-sortable="true">Status</th>
-                <th data-sortable="true" data-align="right">Betrag</th>
-        <tfoot></tfoot>
-        <tbody></tbody>
-    </table>
+    <div class="cotainer-fluid" style="margin-top: 52px;"> 
+      <table style="width: 100%;" class="noselect">
+        <tr>
+          <td style="padding: 0px; margin: 0px;">
+            <table class="table" style="width: 100%; margin: 0px;"  id="tbl_invoices_head">
+              <thead class="thead-dark"> 
+                <tr>
+                <th><select id="daterange"  class="form-control" onchange="setfilter('daterange','date');"></select></th>
+                <th><select id="receipient"  class="form-control" onchange="setfilter('receipient','receipient');"></select></th>
+                <th><select id="sender" onchange="setfilter('sender','sender');" class="form-control"></select></th>
+                <th>Referenz</th>
+                <th>
+                  <select id="status" onchange="setfilter('status','status');" class="form-control">
+                    <option hidden>Status</option>
+                    <option value=""></option>
+                    <option value="bezahlt">bezahlt</option>
+                    <option value="verschickt">verschickt</option>
+                    <option value="geplant">geplant</option>
+                    <option value="überfällig">überfällig</option>
+                  </select>
+                </th>
+                <th >Betrag</th>
+              </tr>
+                </thead>
+            </table>
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <div style="width: 100%; height: 80vh; overflow-y: scroll;">
+            <table id="tbl_invoices" style="width: 100%;" class="table table-bordered table-hover table-striped">
+              <tbody></tbody>
+            </table>
+          </div>
+          </td>
+        </tr>
+      </table>           
+    
     </div>
 <script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
 <script src="../../node_modules/jquery/dist/jquery.min.js"></script>
 <script src="../../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
-<script src="../../node_modules/bootstrap-table/dist/bootstrap-table.min.js"></script>
 <script src="../../node_modules/@fortawesome/fontawesome-free/js/all.min.js"></script>
 <script src="../../js/moduleglobal.js"></script>
 <script src="../../js/database.js"></script>
index d43a041..32d1cf4 100644 (file)
@@ -1,18 +1,57 @@
 var winh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
 var tblh = winh-54;
-var cfg = {
-  byear: 2018
-}
+var pagepref = undefined;
+var selection = [];
+var shiftdown = false;
 function initpage(){
-  console.log(appdb.url);
-  loadyears();
+  
+  pagepref = parent.usersystem.getPreference("invoices");
+  if (pagepref === null){
+    pagepref= {};
+  }
+  console.log(pagepref);
+  //loadyears();
   loadtable();
+  load_senders();
+  load_receipients();
+  load_dateranges();
 }
 
+$(document).on('keydown',function(evt){
+  if (evt.key= "Shift"){
+    shiftdown = true;
+  }
+});
+
+$(document).on('keyup',function(evt){
+  if (evt.key = "Shift"){
+    shiftdown = false;
+  }
+});
  
 
 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, ' +
+  var where = '';
+  if (pagepref && pagepref.filter && Object.keys(pagepref.filter).length > 0){
+    var whfilter = [];
+    for (var i in pagepref.filter){
+      console.log(i);
+      if (i == 'date'){
+        if ($("#daterange :selected").text() != ''){
+          whfilter.push(pagepref.filter[i] + "='" + $("#daterange :selected").text() + "'");
+        }
+        
+      } else {
+        whfilter.push(i + "='" + pagepref.filter[i] + "'");
+      }
+      
+    }
+    if (whfilter.length > 0){
+      where = ' where ' + whfilter.join( " AND "); 
+    }
+    
+  }
+  var sql = 'select ij.id,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, ' +
@@ -21,9 +60,10 @@ function loadtable(){
   'from invoicejournal 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;';
+  'join accounts sen on (ij.id_sender = sen.id) ' + where +' group by pos.id_invoice order by date desc;';
+  $("#tbl_invoices > tbody").html("");
   var data = appdb.dbquery(sql);
-  //console.log(data.sqldata);
+  //console.log(sql);
   for (var i in data.sqldata){
     var cstatus = "secondary";
     if (data.sqldata[i].status== "bezahlt"){ cstatus = "success"; }
@@ -31,8 +71,8 @@ function loadtable(){
     if (data.sqldata[i].status== "verschickt"){ cstatus = "warning"; }
     var acolor = "";
     if (data.sqldata[i].totalamount.startsWith("-")){ acolor = "text-danger"; }
-    var row = '<tr id="' +data.sqldata[i].id + '">'+
-    '<td></td>' +
+    var row = '<tr onclick="setselection(\''+ data.sqldata[i].id +'\');" id="' +data.sqldata[i].id + '">'+
+    
     '<td><span class="d-none">'+data.sqldata[i].datesortable+'</span> ' + data.sqldata[i].date+ '</td>' +
     '<td>' + data.sqldata[i].recepient+ '</td>' +
     '<td>' + data.sqldata[i].sender+ '</td>' +
@@ -41,34 +81,41 @@ function loadtable(){
     '<td class="'+ acolor +'">' + data.sqldata[i].totalamount+ ' €</td>' +
     
     '</tr>';
-    $("#tbl_invoices").append(row);
+    $("#tbl_invoices > tbody").append(row);
   }
-  
-  $('#tbl_invoices').bootstrapTable({
-    pagination: false,
-    search: false,
-    height: tblh,
-    clickToSelect: true
-  });
+  var cols =  $("#tbl_invoices > tbody > tr:first-child").children();
+  var colnum = cols.length -1
+  console.log("childnum:" + colnum);
+  for (var i=1;i<=colnum;i++){
+    wx = $("#tbl_invoices > tbody > tr:first-child > td:nth-child("+ i +")").width();
+    wx = wx +3;
+    $("#tbl_invoices_head > thead > tr > th:nth-child("+ i +")").width(wx);
+  }
+  // $('#tbl_invoices').bootstrapTable({
+  //   pagination: false,
+  //   search: false,
+  //   height: tblh,
+  //   clickToSelect: true
+  // });
   
   
 }
 
-function loadyears(){
-  sql = "select byear from invoicejournal group by byear order by byear asc;";
-  var data = appdb.dbquery(sql);
-  //onsole.log(data.sqldata);
-  for (var i in data.sqldata){
-    $("#timerange").append('<a class="dropdown-item" href="javascript:change_timerange({"byear":"'+data.sqldata[i].byear+'"});">' + data.sqldata[i].byear+'</a>');
-  }
+// function loadyears(){
+//   sql = "select byear from invoicejournal group by byear order by byear asc;";
+//   var data = appdb.dbquery(sql);
+//   //onsole.log(data.sqldata);
+//   for (var i in data.sqldata){
+//     $("#timerange").append('<a class="dropdown-item" href="javascript:change_timerange({"byear":"'+data.sqldata[i].byear+'"});">' + data.sqldata[i].byear+'</a>');
+//   }
   
-}
+// }
 
 function invoice_edit(){
-  var inv_id= getTableSelectionID();
-  if (inv_id){
-    parent.browserapp.loadmodulepage('invoices','form_invoice',{"id":inv_id});
-  }
+  // var inv_id= 
+  // if (inv_id){
+  //   parent.browserapp.loadmodulepage('invoices','form_invoice',{"id":inv_id});
+  // }
   
 }
 
@@ -80,26 +127,74 @@ function invoice_duplicate(){
   
 }
 
-function change_timerange(){
+// function change_timerange(){
 
+// }
+
+function load_senders(){
+  var sql = "select distinct (sender.company) as sender from invoicepositions left join accounts sender on (invoicepositions.id_sender=sender.id) order by sender.company;";
+  $("#sender").html('<option hidden>Sender</option><option value=""></option>');
+  var data = appdb.dbquery(sql);
+  for (var i in data.sqldata){
+    $("#sender").append('<option value="'+data.sqldata[i].sender+'">'+data.sqldata[i].sender+'</option>');
+  }
+  if (pagepref && pagepref.filter && pagepref.filter.sender && pagepref.filter.sender != ''){
+    //console.log("set selection:" +  pagepref.filter.sender);
+    $("#sender").val(pagepref.filter.sender);
+  }
 }
 
-function getTableSelectionID(){
-  var sel = $('#tbl_invoices').bootstrapTable('getSelections');
-  var id = null;
-  
-  if (sel){  id=sel[0]._id; }
-  console.log("Selected ID:" + id);
-  return id;
+function load_receipients(){
+  var sql = "select distinct (receipient.company) as receipient from invoicepositions left join accounts receipient on (invoicepositions.id_receipient=receipient.id) order by receipient.company;";
+  $("#receipient").html('<option hidden>Empfänger</option><option value=""></option>');
+  var data = appdb.dbquery(sql);
+  for (var i in data.sqldata){
+    $("#receipient").append('<option value="'+data.sqldata[i].receipient+'">'+data.sqldata[i].receipient+'</option>');
+  }
+  if (pagepref && pagepref.filter && pagepref.filter.receipient && pagepref.filter.receipient != ''){
+    //console.log("set selection:" +  pagepref.filter.receipient);
+    $("#receipient").val(pagepref.filter.receipient);
+  }
+}
+
+function load_dateranges(){
+  var sql = "select strftime('%Y',date) as daterange, 'strftime(''%Y'',date)' as filter from invoicejournal where date is not null group by daterange union select strftime('%Y %m',date) as daterange , 'strftime(''%Y %m'',date)' as filter from invoicejournal where date is not null group by daterange union  select  strftime('%Y Q',date)  || (((CAST(strftime('%m',date) AS INT) -1 ) / 3) +1)   as daterange ,'strftime(''%Y Q'',date)  || (((CAST(strftime(''%m'',date) AS INT) -1 ) / 3) +1)' as filter from invoicejournal where date is not null group by daterange order by daterange desc;";
+  $("#daterange").html('<option hidden>Datum</option><option value=""></option>');
+  var data = appdb.dbquery(sql);
+  for (var i in data.sqldata){
+    $("#daterange").append('<option value="'+data.sqldata[i].filter+'">'+data.sqldata[i].daterange+'</option>');
+  }
 }
 
-function getTableSelectionIDs(){
-  var sel = $('#tbl_invoices').bootstrapTable('getSelections');
-  var ids = [];
-  if (sel){  
-    for (var s in sel){
-      ids.push(s._id);
+
+function setfilter(id,field){
+  console.log("setFilter");
+  if (pagepref['filter'] === undefined){
+    pagepref['filter'] = {};
+  }
+  if ($("#" + id + " :selected").val() != ""){
+    pagepref['filter'][field] = $("#" + id + " :selected").val();
+  }
+  else {
+    delete pagepref['filter'][field];
+    $("#" + id + "").val($("#"+ id +" option:first").val());
+  }
+  parent.usersystem.setPreference('invoices',pagepref);
+  loadtable();
+}
+
+
+function setselection(id){
+  if (shiftdown === true){
+    if ($("#" + id).hasClass('highlight')){
+      $("#" + id).removeClass('highlight');  
+    }else {
+      $("#" + id).addClass('highlight');
     }
+  } else {
+    $("#" + id).addClass('highlight').siblings().removeClass('highlight');
   }
-  return ids;
-}
\ No newline at end of file
+}
index 496178c..be31319 100644 (file)
@@ -4,7 +4,6 @@
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <link rel="stylesheet" href="../../node_modules/bootstrap/dist/css/bootstrap.min.css">
-<link rel="stylesheet" href="../../node_modules/bootstrap-table/dist/bootstrap-table.min.css">
 <link rel="stylesheet" href="../../node_modules/@fortawesome/fontawesome-free/css/fontawesome.min.css">
 <link rel="stylesheet" href="../../css/invoicejournal.epic.css">
 <link rel="stylesheet" href="../../css/app.css">
                 </div>
               </nav>
     <div class="cotainer-fluid" style="margin-top: 52px;">            
-    
+        <table style="width: 100%;" class="noselect">
+      <tr>
+        <td style="padding: 0px; margin: 0px;">
+          <table class="table" style="width: 100%; margin: 0px;"  id="tbl_products_head">
+            <thead class="thead-dark"> 
+              <tr>
+              <th>ID</th>
+              <th>Type</th>
+              <th>Unit</th>
+              <th>Beschreibung</th>
+              <th>MwSt.</th>
+              <th>Betrag</th>
+            </tr>
+              </thead>
+          </table>
+        </td>
+      </tr>
+      <tr>
+        <td>
+          <div style="width: 100%; height: 80vh; overflow-y: scroll;">
+          <table id="tbl_products" style="width: 100%;" class="table table-bordered table-hover table-striped">
+            <tbody></tbody>
+          </table>
+        </div>
+        </td>
+      </tr>
+    </table>
     </div>
 <script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
 <script src="../../node_modules/jquery/dist/jquery.min.js"></script>
 <script src="../../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
-<script src="../../node_modules/bootstrap-table/dist/bootstrap-table.min.js"></script>
 <script src="../../node_modules/@fortawesome/fontawesome-free/js/all.min.js"></script>
 <script src="../../js/moduleglobal.js"></script>
 <script src="../../js/database.js"></script>
index 2f60333..cb89619 100644 (file)
@@ -1,3 +1,129 @@
+var winh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
+var tblh = winh-54;
+var pagepref = undefined;
+var selection = [];
+
+var shiftdown = false;
 function initpage(){
+  console.log(appdb.url);
+  pagepref = parent.usersystem.getPreference("products");
+  if (pagepref === null){
+    pagepref= {};
+  }
+  console.log(pagepref);
+  loadtable();
+}
+
+$(document).on('keydown',function(evt){
+  if (evt.key= "Shift"){
+    shiftdown = true;
+  }
+});
+
+$(document).on('keyup',function(evt){
+  if (evt.key = "Shift"){
+    shiftdown = false;
+  }
+});
+
+function loadtable(){
+  // var where = '';
+  // if (pagepref && pagepref.filter && Object.keys(pagepref.filter).length > 0){
+  //   var whfilter = [];
+  //   for (var i in pagepref.filter){
+  //     console.log(i);
+  //     if (i == 'bookingdate'){
+  //       if ($("#daterange :selected").text() != ''){
+  //         whfilter.push(pagepref.filter[i] + "='" + $("#daterange :selected").text() + "'");
+  //       }
+        
+  //     } else {
+  //       whfilter.push(i + "='" + pagepref.filter[i] + "'");
+  //     }
+      
+  //   }
+  //   if (whfilter.length > 0){
+  //     where = ' where ' + whfilter.join( " AND "); 
+  //   }
     
-}
\ No newline at end of file
+  // }
+  // console.log(where);
+  // sums = { planned: {cnt:0,sum:0},sended: {cnt:0,sum:0},payed: {cnt:0,sum:0},delayed: {cnt:0,sum:0},total: {cnt:0,sum:0}};
+
+  var sql = "SELECT id, ident, ptype, unit, replace(printf('%.2f€',unitamount),'.',',') as unitamount, printf('%.2f%',100 * vatpercent,'.',',') as vatpercent, description FROM products;";
+  //console.log(sql);
+  //$('#tbl_bookings').bootstrapTable('destroy');
+  $("#tbl_products > tbody").html("");
+  var data = appdb.dbquery(sql);
+  //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].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>' +
+    '<td class="right">' + ((data.sqldata[i].vatpercent != null)?data.sqldata[i].vatpercent:'') + '</td>' +
+    '<td class="right">' + ((data.sqldata[i].unitamount != null)?data.sqldata[i].unitamount:'')+ '</td>' +
+    '</tr>';
+
+    $("#tbl_products > tbody").append(row);
+  }
+  var cols =  $("#tbl_products > tbody > tr:first-child").children();
+  var colnum = cols.length -1
+  console.log("childnum:" + colnum);
+  for (var i=1;i<=colnum;i++){
+    wx = $("#tbl_products > tbody > tr:first-child > td:nth-child("+ i +")").width();
+    wx = wx +3;
+    $("#tbl_products_head > thead > tr > th:nth-child("+ i +")").width(wx);
+  }
+}
+
+
+
+function setfilter(id,field){
+  console.log("setFilter");
+  if (pagepref['filter'] === undefined){
+    pagepref['filter'] = {};
+  }
+  if ($("#" + id + " :selected").val() != ""){
+    pagepref['filter'][field] = $("#" + id + " :selected").val();
+  }
+  else {
+    delete pagepref['filter'][field];
+    $("#" + id + "").val($("#"+ id +" option:first").val());
+  }
+  parent.usersystem.setPreference('products',pagepref);
+  loadtable();
+}
+
+function product_new(){
+  parent.browserapp.loadmodulepage('products','form_product',{"id":null});
+}
+
+function product_edit(){
+  //var inv_id= getTableSelectionID();
+  if (inv_id){
+    parent.browserapp.loadmodulepage('bookings','form_booking',{"id":inv_id});
+  }
+  
+}
+
+function product_delete(){
+  
+}
+
+function product_duplicate(){
+  
+}
+
+function setselection(id){
+  if (shiftdown === true){
+    if ($("#" + id).hasClass('highlight')){
+      $("#" + id).removeClass('highlight');  
+    }else {
+      $("#" + id).addClass('highlight');
+    }
+  } else {
+    $("#" + id).addClass('highlight').siblings().removeClass('highlight');
+  }
+}
index 393a1f9..d92b6d8 100644 (file)
@@ -141,8 +141,6 @@ sub parsestatement(){
   ];
   }
  
-  
-  
   my $pxdata = ();
    my @pdata = ();
    my $jdata = ();