Fixed inventory databases race conditions

Fri, 13 Sep 2019 20:24:31 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 13 Sep 2019 20:24:31 +0200
changeset 488
77f1617b6994
parent 487
06df1320327c
child 489
18e5cfe5d126

Fixed inventory databases race conditions

www/js/inv_equipments-min.js file | annotate | diff | comparison | revisions
www/js/inv_equipments.js file | annotate | diff | comparison | revisions
www/js/inv_fermentables-min.js file | annotate | diff | comparison | revisions
www/js/inv_fermentables.js file | annotate | diff | comparison | revisions
www/js/inv_hops-min.js file | annotate | diff | comparison | revisions
www/js/inv_hops.js file | annotate | diff | comparison | revisions
www/js/inv_miscs-min.js file | annotate | diff | comparison | revisions
www/js/inv_miscs.js file | annotate | diff | comparison | revisions
www/js/inv_suppliers-min.js file | annotate | diff | comparison | revisions
www/js/inv_suppliers.js file | annotate | diff | comparison | revisions
www/js/inv_waters-min.js file | annotate | diff | comparison | revisions
www/js/inv_waters.js file | annotate | diff | comparison | revisions
www/js/inv_yeasts-min.js file | annotate | diff | comparison | revisions
www/js/inv_yeasts.js file | annotate | diff | comparison | revisions
--- a/www/js/inv_equipments-min.js	Fri Sep 13 16:54:51 2019 +0200
+++ b/www/js/inv_equipments-min.js	Fri Sep 13 20:24:31 2019 +0200
@@ -1,1 +1,1 @@
-function createDelElements(){$("#eventWindow").jqxWindow({theme:theme,position:{x:490,y:210},width:300,height:175,resizable:false,isModal:true,modalOpacity:0.4,okButton:$("#delOk"),cancelButton:$("#delCancel"),initContent:function(){$("#delOk").jqxButton({template:"danger",width:"65px",theme:theme});$("#delCancel").jqxButton({template:"success",width:"65px",theme:theme});$("#delCancel").focus()}});$("#eventWindow").jqxWindow("hide")}$(document).ready(function(){var c={};function b(){var j=$("#calc_boil_volume").val();var k=parseFloat($("#boil_size").jqxNumberInput("decimal"));var l=parseFloat($("#evap_rate").jqxNumberInput("decimal"));var g=parseFloat($("#boil_time").jqxNumberInput("decimal"));var h=parseFloat($("#top_up_kettle").jqxNumberInput("decimal"));if(j){var i=k-(l*g/60)+h;$("#batch_size").val(i)}}var a="includes/db_inventory_equipments.php";$("#name").jqxTooltip({content:"The unique name of this brew equipment."});$("#notes").jqxTooltip({content:"Some notes about the equipment."});$("#tun_volume").jqxTooltip({content:"Mash TUN volume."});$("#tun_height").jqxTooltip({content:"Mash TUN height in cm."});$("#tun_weight").jqxTooltip({content:"Mash TUN weight in Kg."});$("#tun_material").jqxTooltip({content:"Mash TUN material. Needed to calculate the right strike temperature."});$("#mash_volume").jqxTooltip({content:"Liters maisch water voor de eerste maisch stap."});$("#mash_max").jqxTooltip({content:"Maximale moutstort voor deze installatie in Kg."});$("#lauter_volume").jqxTooltip({content:"Total lauter volume."});$("#lauter_height").jqxTooltip({content:"Height of the lauter TUN in cm."});$("#lauter_deadspace").jqxTooltip({content:"Volume loss in the lauter TUN."});$("#efficiency").jqxTooltip({content:"Average efficiency."});$("#kettle_volume").jqxTooltip({content:"Boil kettle volume in liters."});$("#kettle_height").jqxTooltip({content:"Boil kettle height in cm."});$("#boil_size").jqxTooltip({content:"Normal boil volume in liters"});$("#evap_rate").jqxTooltip({content:"Evaporation in liters per hour."});$("#boil_time").jqxTooltip({content:"Normal boil time in minutes."});$("#top_up_kettle").jqxTooltip({content:"Extra water added to the boil."});$("#hop_utilization").jqxTooltip({content:"100% for smaller installations, higher for large breweries."});$("#batch_size").jqxTooltip({content:"Calculated batch size, liters at end of the boil."});$("#trub_chiller_loss").jqxTooltip({content:"Standard loss in liters during transfer to the fermenter."});var e={datatype:"json",cache:false,datafields:[{name:"record",type:"number"},{name:"name",type:"string"},{name:"boil_size",type:"float"},{name:"batch_size",type:"float"},{name:"tun_volume",type:"float"},{name:"tun_weight",type:"float"},{name:"tun_specific_heat",type:"float"},{name:"tun_material",type:"int"},{name:"tun_height",type:"float"},{name:"top_up_water",type:"float"},{name:"trub_chiller_loss",type:"float"},{name:"evap_rate",type:"float"},{name:"boil_time",type:"float"},{name:"calc_boil_volume",type:"int"},{name:"top_up_kettle",type:"float"},{name:"hop_utilization",type:"float"},{name:"notes",type:"string"},{name:"lauter_volume",type:"float"},{name:"lauter_height",type:"float"},{name:"lauter_deadspace",type:"float"},{name:"kettle_volume",type:"float"},{name:"kettle_height",type:"float"},{name:"mash_volume",type:"float"},{name:"mash_max",type:"float"},{name:"efficiency",type:"float"}],id:"record",url:a,deleterow:function(g,i){var h="delete=true&"+$.param({record:g});$.ajax({dataType:"json",url:a,cache:false,data:h,type:"POST",success:function(k,j,l){i(true)},error:function(j,l,k){i(false)}})},addrow:function(h,k,g,j){var i="insert=true&"+$.param(k);$.ajax({dataType:"json",url:a,cache:false,data:i,type:"POST",success:function(m,l,n){j(true)},error:function(l,n,m){j(false)}})},updaterow:function(g,j,i){var h="update=true&"+$.param(j);$.ajax({dataType:"json",url:a,cache:false,data:h,type:"POST",success:function(l,k,m){i(true)},error:function(k,m,l){i(false)}})}};$("#name").jqxInput({theme:theme,width:250,height:23});$("#notes").jqxInput({theme:theme,width:640,height:100});$("#boil_size").jqxNumberInput(Spin1dec);$("#batch_size").jqxNumberInput(Spin2dec);$("#batch_size").jqxNumberInput({spinButtonsStep:0.5});$("#tun_volume").jqxNumberInput(Spin1dec);$("#tun_weight").jqxNumberInput(Spin2dec);$("#tun_specific_heat").jqxNumberInput({inputMode:"simple",readOnly:true,theme:theme,width:70,height:23,decimalDigits:3});$("#tun_material").jqxDropDownList({theme:theme,source:MaterialAdapter,valueMember:"id",displayMember:"nl",width:180,height:23,autoDropDownHeight:true});$("#tun_height").jqxNumberInput(Spin1dec);$("#top_up_water").jqxNumberInput(Spin1dec);$("#trub_chiller_loss").jqxNumberInput(Spin1dec);$("#evap_rate").jqxNumberInput(Spin2dec);$("#boil_time").jqxNumberInput(PosInt);$("#boil_time").jqxNumberInput({max:1440});$("#calc_boil_volume").jqxCheckBox({theme:theme,width:120,height:23});$("#calc_boil_volume").on("checked",function(g){$("#batch_size").jqxNumberInput({readOnly:true,width:90,spinButtons:false})});$("#calc_boil_volume").on("unchecked",function(g){$("#batch_size").jqxNumberInput({readOnly:false,width:110,spinButtons:true})});$("#top_up_kettle").jqxNumberInput(Spin1dec);$("#hop_utilization").jqxNumberInput(Perc0);$("#hop_utilization").jqxNumberInput({Max:200});$("#lauter_volume").jqxNumberInput(Spin1dec);$("#lauter_height").jqxNumberInput(Spin1dec);$("#lauter_deadspace").jqxNumberInput(Spin1dec);$("#kettle_volume").jqxNumberInput(Spin1dec);$("#kettle_height").jqxNumberInput(Spin1dec);$("#mash_volume").jqxNumberInput(Spin1dec);$("#mash_max").jqxNumberInput(Spin1dec);$("#efficiency").jqxNumberInput(Perc1dec);var f=new $.jqx.dataAdapter(e);var d=-1;$("#jqxgrid").jqxGrid({width:1280,height:630,source:f,theme:theme,showstatusbar:true,renderstatusbar:function(i){var g=$("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");var h=$("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");g.append(h);i.append(g);h.jqxButton({theme:theme,width:90,height:20});h.click(function(j){d=-1;$("#popupWindow").jqxWindow({position:{x:110,y:30}});$("#name").val("Nieuwe brouwset");$("#boil_size").val(18);$("#batch_size").val(15.3);$("#tun_volume").val(20);$("#tun_weight").val(2);$("#tun_specific_heat").val(0.11);$("#tun_material").val(0);$("#tun_height").val(20);$("#top_up_water").val(0);$("#trub_chiller_loss").val(0.5);$("#evap_rate").val(1.8);$("#boil_time").val(90);$("#calc_boil_volume").val(1);$("#top_up_kettle").val(0);$("#hop_utilization").val(100);$("#notes").val("");$("#lauter_volume").val(20);$("#lauter_height").val(20);$("#lauter_deadspace").val(0.5);$("#kettle_volume").val(20);$("#kettle_height").val(20);$("#mash_volume").val(18);$("#mash_max").val(6);$("#efficiency").val(75);$("#popupWindow").jqxWindow("open")})},filterable:false,ready:function(){$("#boil_size").on("change",function(g){b()});$("#evap_rate").on("change",function(g){b()});$("#boil_time").on("change",function(g){b()});$("#top_up_kettle").on("change",function(g){b()});$("#calc_boil_volume").on("change",function(g){b()});$("#tun_material").on("change",function(g){c.tun_specific_heat=MaterialData[g.args.index].sh;$("#tun_specific_heat").val(c.tun_specific_heat)})},columns:[{text:"Installatie naam",datafield:"name",width:200},{text:"Kook volume",datafield:"boil_size",width:110,align:"right",cellsalign:"right",cellsformat:"f1"},{text:"Batch volume",datafield:"batch_size",width:110,align:"right",cellsalign:"right",cellsformat:"f1"},{text:"Opmerkingen",datafield:"notes"},{text:"",datafield:"Edit",width:100,align:"center",columntype:"button",cellsrenderer:function(){return"Wijzig"},buttonclick:function(g){d=g;$("#popupWindow").jqxWindow({position:{x:110,y:30}});c=$("#jqxgrid").jqxGrid("getrowdata",d);$("#name").val(c.name);$("#boil_size").val(c.boil_size);$("#batch_size").val(c.batch_size);$("#tun_volume").val(c.tun_volume);$("#tun_weight").val(c.tun_weight);$("#tun_specific_heat").val(c.tun_specific_heat);$("#tun_material").val(c.tun_material);$("#tun_height").val(c.tun_height);$("#top_up_water").val(c.top_up_water);$("#trub_chiller_loss").val(c.trub_chiller_loss);$("#evap_rate").val(c.evap_rate);$("#boil_time").val(c.boil_time);$("#calc_boil_volume").val(c.calc_boil_volume);$("#top_up_kettle").val(c.top_up_kettle);$("#hop_utilization").val(c.hop_utilization);$("#notes").val(c.notes);$("#lauter_volume").val(c.lauter_volume);$("#lauter_height").val(c.lauter_height);$("#lauter_deadspace").val(c.lauter_deadspace);$("#kettle_volume").val(c.kettle_volume);$("#kettle_height").val(c.kettle_height);$("#mash_volume").val(c.mash_volume);$("#mash_max").val(c.mash_max);$("#efficiency").val(c.efficiency);$("#popupWindow").jqxWindow("open")}}]});$("#popupWindow").jqxWindow({width:1050,height:600,resizable:false,theme:theme,isModal:true,autoOpen:false,cancelButton:$("#Cancel"),modalOpacity:0.4});$("#popupWindow").on("open",function(){$("#name").jqxInput("selectAll")});$("#Delete").jqxButton({template:"danger",width:"90px",theme:theme});$("#Delete").click(function(){if(d>=0){$("#eventWindow").jqxWindow("open");$("#delOk").click(function(){var g=$("#jqxgrid").jqxGrid("getrowid",d);$("#jqxgrid").jqxGrid("deleterow",g)})}$("#popupWindow").jqxWindow("hide")});$("#Cancel").jqxButton({template:"primary",width:"90px",theme:theme});$("#Save").jqxButton({template:"success",width:"90px",theme:theme});$("#Save").click(function(){var g=-1;if(d>=0){var g=$("#jqxgrid").jqxGrid("getrowid",d)}var h={record:g,name:$("#name").val(),boil_size:parseFloat($("#boil_size").jqxNumberInput("decimal")),batch_size:parseFloat($("#batch_size").jqxNumberInput("decimal")),tun_volume:parseFloat($("#tun_volume").jqxNumberInput("decimal")),tun_weight:parseFloat($("#tun_weight").jqxNumberInput("decimal")),tun_specific_heat:parseFloat($("#tun_specific_heat").jqxNumberInput("decimal")),tun_material:$("#tun_material").val(),tun_height:parseFloat($("#tun_height").jqxNumberInput("decimal")),top_up_water:parseFloat($("#top_up_water").jqxNumberInput("decimal")),trub_chiller_loss:parseFloat($("#trub_chiller_loss").jqxNumberInput("decimal")),evap_rate:parseFloat($("#evap_rate").jqxNumberInput("decimal")),boil_time:parseFloat($("#boil_time").jqxNumberInput("decimal")),calc_boil_volume:$("#calc_boil_volume").val(),top_up_kettle:parseFloat($("#top_up_kettle").jqxNumberInput("decimal")),hop_utilization:parseFloat($("#hop_utilization").jqxNumberInput("decimal")),notes:$("#notes").val(),lauter_volume:parseFloat($("#lauter_volume").jqxNumberInput("decimal")),lauter_height:parseFloat($("#lauter_height").jqxNumberInput("decimal")),lauter_deadspace:parseFloat($("#lauter_deadspace").jqxNumberInput("decimal")),kettle_volume:parseFloat($("#kettle_volume").jqxNumberInput("decimal")),kettle_height:parseFloat($("#kettle_height").jqxNumberInput("decimal")),mash_volume:parseFloat($("#mash_volume").jqxNumberInput("decimal")),mash_max:parseFloat($("#mash_max").jqxNumberInput("decimal")),efficiency:parseFloat($("#efficiency").jqxNumberInput("decimal"))};if(d>=0){$("#jqxgrid").jqxGrid("updaterow",g,h)}else{$("#jqxgrid").jqxGrid("addrow",null,h)}$("#popupWindow").jqxWindow("hide");location.reload(true)});createDelElements()});
\ No newline at end of file
+function createDelElements(){$("#eventWindow").jqxWindow({theme:theme,position:{x:490,y:210},width:300,height:175,resizable:false,isModal:true,modalOpacity:0.4,okButton:$("#delOk"),cancelButton:$("#delCancel"),initContent:function(){$("#delOk").jqxButton({template:"danger",width:"65px",theme:theme});$("#delCancel").jqxButton({template:"success",width:"65px",theme:theme});$("#delCancel").focus()}});$("#eventWindow").jqxWindow("hide")}$(document).ready(function(){function c(){var j=$("#calc_boil_volume").val(),k=parseFloat($("#boil_size").jqxNumberInput("decimal")),l=parseFloat($("#evap_rate").jqxNumberInput("decimal")),g=parseFloat($("#boil_time").jqxNumberInput("decimal")),h=parseFloat($("#top_up_kettle").jqxNumberInput("decimal")),i;if(j){i=k-(l*g/60)+h;$("#batch_size").val(i)}}$("#name").jqxTooltip({content:"The unique name of this brew equipment."});$("#notes").jqxTooltip({content:"Some notes about the equipment."});$("#tun_volume").jqxTooltip({content:"Mash TUN volume."});$("#tun_height").jqxTooltip({content:"Mash TUN height in cm."});$("#tun_weight").jqxTooltip({content:"Mash TUN weight in Kg."});$("#tun_material").jqxTooltip({content:"Mash TUN material. Needed to calculate the right strike temperature."});$("#mash_volume").jqxTooltip({content:"Liters maisch water voor de eerste maisch stap."});$("#mash_max").jqxTooltip({content:"Maximale moutstort voor deze installatie in Kg."});$("#lauter_volume").jqxTooltip({content:"Total lauter volume."});$("#lauter_height").jqxTooltip({content:"Height of the lauter TUN in cm."});$("#lauter_deadspace").jqxTooltip({content:"Volume loss in the lauter TUN."});$("#efficiency").jqxTooltip({content:"Average efficiency."});$("#kettle_volume").jqxTooltip({content:"Boil kettle volume in liters."});$("#kettle_height").jqxTooltip({content:"Boil kettle height in cm."});$("#boil_size").jqxTooltip({content:"Normal boil volume in liters"});$("#evap_rate").jqxTooltip({content:"Evaporation in liters per hour."});$("#boil_time").jqxTooltip({content:"Normal boil time in minutes."});$("#top_up_kettle").jqxTooltip({content:"Extra water added to the boil."});$("#hop_utilization").jqxTooltip({content:"100% for smaller installations, higher for large breweries."});$("#batch_size").jqxTooltip({content:"Calculated batch size, liters at end of the boil."});$("#trub_chiller_loss").jqxTooltip({content:"Standard loss in liters during transfer to the fermenter."});var b={},a="includes/db_inventory_equipments.php",e={datatype:"json",cache:false,datafields:[{name:"record",type:"number"},{name:"name",type:"string"},{name:"boil_size",type:"float"},{name:"batch_size",type:"float"},{name:"tun_volume",type:"float"},{name:"tun_weight",type:"float"},{name:"tun_specific_heat",type:"float"},{name:"tun_material",type:"int"},{name:"tun_height",type:"float"},{name:"top_up_water",type:"float"},{name:"trub_chiller_loss",type:"float"},{name:"evap_rate",type:"float"},{name:"boil_time",type:"float"},{name:"calc_boil_volume",type:"int"},{name:"top_up_kettle",type:"float"},{name:"hop_utilization",type:"float"},{name:"notes",type:"string"},{name:"lauter_volume",type:"float"},{name:"lauter_height",type:"float"},{name:"lauter_deadspace",type:"float"},{name:"kettle_volume",type:"float"},{name:"kettle_height",type:"float"},{name:"mash_volume",type:"float"},{name:"mash_max",type:"float"},{name:"efficiency",type:"float"}],id:"record",url:a,deleterow:function(g,i){var h="delete=true&"+$.param({record:g});$.ajax({dataType:"json",url:a,cache:false,data:h,type:"POST",success:function(k,j,l){i(true);location.reload(true)},error:function(j,l,k){i(false)}})},addrow:function(h,k,g,j){var i="insert=true&"+$.param(k);$.ajax({dataType:"json",url:a,cache:false,data:i,type:"POST",success:function(m,l,n){j(true);location.reload(true)},error:function(l,n,m){j(false)}})},updaterow:function(g,j,i){var h="update=true&"+$.param(j);$.ajax({dataType:"json",url:a,cache:false,data:h,type:"POST",success:function(l,k,m){i(true);location.reload(true)},error:function(k,m,l){i(false)}})}};$("#name").jqxInput({theme:theme,width:250,height:23});$("#notes").jqxInput({theme:theme,width:640,height:100});$("#boil_size").jqxNumberInput(Spin1dec);$("#batch_size").jqxNumberInput(Spin2dec);$("#batch_size").jqxNumberInput({spinButtonsStep:0.5});$("#tun_volume").jqxNumberInput(Spin1dec);$("#tun_weight").jqxNumberInput(Spin2dec);$("#tun_specific_heat").jqxNumberInput({inputMode:"simple",readOnly:true,theme:theme,width:70,height:23,decimalDigits:3});$("#tun_material").jqxDropDownList({theme:theme,source:MaterialAdapter,valueMember:"id",displayMember:"nl",width:180,height:23,autoDropDownHeight:true});$("#tun_height").jqxNumberInput(Spin1dec);$("#top_up_water").jqxNumberInput(Spin1dec);$("#trub_chiller_loss").jqxNumberInput(Spin1dec);$("#evap_rate").jqxNumberInput(Spin2dec);$("#boil_time").jqxNumberInput(PosInt);$("#boil_time").jqxNumberInput({max:1440});$("#calc_boil_volume").jqxCheckBox({theme:theme,width:120,height:23});$("#calc_boil_volume").on("checked",function(g){$("#batch_size").jqxNumberInput({readOnly:true,width:90,spinButtons:false})});$("#calc_boil_volume").on("unchecked",function(g){$("#batch_size").jqxNumberInput({readOnly:false,width:110,spinButtons:true})});$("#top_up_kettle").jqxNumberInput(Spin1dec);$("#hop_utilization").jqxNumberInput(Perc0);$("#hop_utilization").jqxNumberInput({Max:200});$("#lauter_volume").jqxNumberInput(Spin1dec);$("#lauter_height").jqxNumberInput(Spin1dec);$("#lauter_deadspace").jqxNumberInput(Spin1dec);$("#kettle_volume").jqxNumberInput(Spin1dec);$("#kettle_height").jqxNumberInput(Spin1dec);$("#mash_volume").jqxNumberInput(Spin1dec);$("#mash_max").jqxNumberInput(Spin1dec);$("#efficiency").jqxNumberInput(Perc1dec);var f=new $.jqx.dataAdapter(e);var d=-1;$("#jqxgrid").jqxGrid({width:1280,height:630,source:f,theme:theme,showstatusbar:true,renderstatusbar:function(i){var h,g=$("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");h=$("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");g.append(h);i.append(g);h.jqxButton({theme:theme,width:90,height:20});h.click(function(j){d=-1;$("#popupWindow").jqxWindow({position:{x:110,y:30}});$("#name").val("Nieuwe brouwset");$("#boil_size").val(18);$("#batch_size").val(15.3);$("#tun_volume").val(20);$("#tun_weight").val(2);$("#tun_specific_heat").val(0.11);$("#tun_material").val(0);$("#tun_height").val(20);$("#top_up_water").val(0);$("#trub_chiller_loss").val(0.5);$("#evap_rate").val(1.8);$("#boil_time").val(90);$("#calc_boil_volume").val(1);$("#top_up_kettle").val(0);$("#hop_utilization").val(100);$("#notes").val("");$("#lauter_volume").val(20);$("#lauter_height").val(20);$("#lauter_deadspace").val(0.5);$("#kettle_volume").val(20);$("#kettle_height").val(20);$("#mash_volume").val(18);$("#mash_max").val(6);$("#efficiency").val(75);$("#popupWindow").jqxWindow("open")})},filterable:false,ready:function(){$("#boil_size").on("change",function(g){c()});$("#evap_rate").on("change",function(g){c()});$("#boil_time").on("change",function(g){c()});$("#top_up_kettle").on("change",function(g){c()});$("#calc_boil_volume").on("change",function(g){c()});$("#tun_material").on("change",function(g){b.tun_specific_heat=MaterialData[g.args.index].sh;$("#tun_specific_heat").val(b.tun_specific_heat)})},columns:[{text:"Installatie naam",datafield:"name",width:200},{text:"Kook volume",datafield:"boil_size",width:110,align:"right",cellsalign:"right",cellsformat:"f1"},{text:"Batch volume",datafield:"batch_size",width:110,align:"right",cellsalign:"right",cellsformat:"f1"},{text:"Opmerkingen",datafield:"notes"},{text:"",datafield:"Edit",width:100,align:"center",columntype:"button",cellsrenderer:function(){return"Wijzig"},buttonclick:function(g){d=g;$("#popupWindow").jqxWindow({position:{x:110,y:30}});b=$("#jqxgrid").jqxGrid("getrowdata",d);$("#name").val(b.name);$("#boil_size").val(b.boil_size);$("#batch_size").val(b.batch_size);$("#tun_volume").val(b.tun_volume);$("#tun_weight").val(b.tun_weight);$("#tun_specific_heat").val(b.tun_specific_heat);$("#tun_material").val(b.tun_material);$("#tun_height").val(b.tun_height);$("#top_up_water").val(b.top_up_water);$("#trub_chiller_loss").val(b.trub_chiller_loss);$("#evap_rate").val(b.evap_rate);$("#boil_time").val(b.boil_time);$("#calc_boil_volume").val(b.calc_boil_volume);$("#top_up_kettle").val(b.top_up_kettle);$("#hop_utilization").val(b.hop_utilization);$("#notes").val(b.notes);$("#lauter_volume").val(b.lauter_volume);$("#lauter_height").val(b.lauter_height);$("#lauter_deadspace").val(b.lauter_deadspace);$("#kettle_volume").val(b.kettle_volume);$("#kettle_height").val(b.kettle_height);$("#mash_volume").val(b.mash_volume);$("#mash_max").val(b.mash_max);$("#efficiency").val(b.efficiency);$("#popupWindow").jqxWindow("open")}}]});$("#popupWindow").jqxWindow({width:1050,height:600,resizable:false,theme:theme,isModal:true,autoOpen:false,cancelButton:$("#Cancel"),modalOpacity:0.4});$("#popupWindow").on("open",function(){$("#name").jqxInput("selectAll")});$("#Delete").jqxButton({template:"danger",width:"90px",theme:theme});$("#Delete").click(function(){if(d>=0){$("#eventWindow").jqxWindow("open");$("#delOk").click(function(){var g=$("#jqxgrid").jqxGrid("getrowid",d);$("#jqxgrid").jqxGrid("deleterow",g)})}$("#popupWindow").jqxWindow("hide")});$("#Cancel").jqxButton({template:"primary",width:"90px",theme:theme});$("#Save").jqxButton({template:"success",width:"90px",theme:theme});$("#Save").click(function(){var h,g=-1;if(d>=0){g=$("#jqxgrid").jqxGrid("getrowid",d)}h={record:g,name:$("#name").val(),boil_size:parseFloat($("#boil_size").jqxNumberInput("decimal")),batch_size:parseFloat($("#batch_size").jqxNumberInput("decimal")),tun_volume:parseFloat($("#tun_volume").jqxNumberInput("decimal")),tun_weight:parseFloat($("#tun_weight").jqxNumberInput("decimal")),tun_specific_heat:parseFloat($("#tun_specific_heat").jqxNumberInput("decimal")),tun_material:$("#tun_material").val(),tun_height:parseFloat($("#tun_height").jqxNumberInput("decimal")),top_up_water:parseFloat($("#top_up_water").jqxNumberInput("decimal")),trub_chiller_loss:parseFloat($("#trub_chiller_loss").jqxNumberInput("decimal")),evap_rate:parseFloat($("#evap_rate").jqxNumberInput("decimal")),boil_time:parseFloat($("#boil_time").jqxNumberInput("decimal")),calc_boil_volume:$("#calc_boil_volume").val(),top_up_kettle:parseFloat($("#top_up_kettle").jqxNumberInput("decimal")),hop_utilization:parseFloat($("#hop_utilization").jqxNumberInput("decimal")),notes:$("#notes").val(),lauter_volume:parseFloat($("#lauter_volume").jqxNumberInput("decimal")),lauter_height:parseFloat($("#lauter_height").jqxNumberInput("decimal")),lauter_deadspace:parseFloat($("#lauter_deadspace").jqxNumberInput("decimal")),kettle_volume:parseFloat($("#kettle_volume").jqxNumberInput("decimal")),kettle_height:parseFloat($("#kettle_height").jqxNumberInput("decimal")),mash_volume:parseFloat($("#mash_volume").jqxNumberInput("decimal")),mash_max:parseFloat($("#mash_max").jqxNumberInput("decimal")),efficiency:parseFloat($("#efficiency").jqxNumberInput("decimal"))};if(d>=0){$("#jqxgrid").jqxGrid("updaterow",g,h)}else{$("#jqxgrid").jqxGrid("addrow",null,h)}$("#popupWindow").jqxWindow("hide")});createDelElements()});
\ No newline at end of file
--- a/www/js/inv_equipments.js	Fri Sep 13 16:54:51 2019 +0200
+++ b/www/js/inv_equipments.js	Fri Sep 13 20:24:31 2019 +0200
@@ -44,22 +44,20 @@
 
 $(document).ready(function () {
 
-	var dataRecord = {};
-
 	function calcBatchVolume() {
-		var	calc = $("#calc_boil_volume").val();
-		var	boil_size = parseFloat($("#boil_size").jqxNumberInput('decimal'));
-		var	evap_rate = parseFloat($("#evap_rate").jqxNumberInput('decimal'));
-		var	boil_time = parseFloat($("#boil_time").jqxNumberInput('decimal'));
-		var	top_up    = parseFloat($("#top_up_kettle").jqxNumberInput('decimal'));
+		var calc = $("#calc_boil_volume").val(),
+		boil_size = parseFloat($("#boil_size").jqxNumberInput('decimal')),
+		evap_rate = parseFloat($("#evap_rate").jqxNumberInput('decimal')),
+		boil_time = parseFloat($("#boil_time").jqxNumberInput('decimal')),
+		top_up = parseFloat($("#top_up_kettle").jqxNumberInput('decimal')),
+		batch;
 		
 		if (calc) {	// If checked, calculate the batch size.
-			var	batch = boil_size - (evap_rate * boil_time / 60) + top_up;
+			batch = boil_size - (evap_rate * boil_time / 60) + top_up;
 			$("#batch_size").val(batch);
 		}
 	}
 
-	var url = "includes/db_inventory_equipments.php";
 	// tooltips
 	$("#name").jqxTooltip({ content: 'The unique name of this brew equipment.' });
 	$("#notes").jqxTooltip({ content: 'Some notes about the equipment.' });
@@ -82,9 +80,11 @@
 	$("#hop_utilization").jqxTooltip({ content: '100% for smaller installations, higher for large breweries.' });
 	$("#batch_size").jqxTooltip({ content: 'Calculated batch size, liters at end of the boil.' });
 	$("#trub_chiller_loss").jqxTooltip({ content: 'Standard loss in liters during transfer to the fermenter.' });
-	
+
+	var dataRecord = {},
+	url = 'includes/db_inventory_equipments.php',
 	// prepare the data
-	var source = {
+	source = {
 		datatype: "json",
 		cache: false,
 		datafields: [
@@ -126,8 +126,8 @@
 				data: data,
 				type: "POST",
 				success: function (data, status, xhr) {
-					// delete command is executed.
 					commit(true);
+					location.reload( true );
 				},
 				error: function (jqXHR, textStatus, errorThrown) {
 					commit(false);
@@ -144,6 +144,7 @@
 				type: "POST",
                                	success: function (data, status, xhr) {
                                        	commit(true);
+					location.reload( true );
                                	},
                                	error: function(jqXHR, textStatus, errorThrown) {
                                         commit(false);
@@ -159,8 +160,8 @@
 				data: data,
 				type: "POST",
 				success: function (data, status, xhr) {
-					// update command is executed.
 					commit(true);
+					location.reload( true );
 				},
 				error: function(jqXHR, textStatus, errorThrown) {
 					commit(false);
@@ -183,7 +184,6 @@
 		source: MaterialAdapter,
 		valueMember: 'id',
 		displayMember: 'nl',
-//		selectedIndex: 0,
 		width: 180,
 		height: 23,
 		autoDropDownHeight: true
@@ -223,8 +223,8 @@
 		theme: theme,
 		showstatusbar: true,
 		renderstatusbar: function (statusbar) {
-			var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
-			var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
+			var addButton, container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
+			addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
 			container.append(addButton);
 			statusbar.append(container);
 			addButton.jqxButton({ theme: theme, width: 90, height: 20 });
@@ -344,11 +344,11 @@
 	$("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
 	// update the edited row when the user clicks the 'Save' button.
 	$("#Save").click(function () {
-		var rowID = -1;
+		var row, rowID = -1;
 		if (editrow >= 0) {
-			var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
+			rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
 		}
-		var row = {
+		row = {
 			record: rowID,
 			name: $("#name").val(),
 			boil_size: parseFloat($("#boil_size").jqxNumberInput('decimal')),
@@ -381,7 +381,6 @@
 			$('#jqxgrid').jqxGrid('addrow', null, row);
 		}
 		$("#popupWindow").jqxWindow('hide');
-		location.reload( true );        // reload ourself.
 	});
 	createDelElements();
 });
--- a/www/js/inv_fermentables-min.js	Fri Sep 13 16:54:51 2019 +0200
+++ b/www/js/inv_fermentables-min.js	Fri Sep 13 20:24:31 2019 +0200
@@ -1,1 +1,1 @@
-function createDelElements(){$("#eventWindow").jqxWindow({theme:theme,position:{x:490,y:210},width:300,height:175,resizable:false,isModal:true,modalOpacity:0.4,okButton:$("#delOk"),cancelButton:$("#delCancel"),initContent:function(){$("#delOk").jqxButton({template:"danger",width:"65px",theme:theme});$("#delCancel").jqxButton({template:"success",width:"65px",theme:theme});$("#delCancel").focus()}});$("#eventWindow").jqxWindow("hide")}$(document).ready(function(){var b={};function d(h,g){$("#totval").val(h*g)}var a="includes/db_inventory_fermentables.php";var e={datatype:"json",cache:false,datafields:[{name:"record",type:"number"},{name:"name",type:"string"},{name:"type",type:"int"},{name:"yield",type:"float"},{name:"color",type:"float"},{name:"add_after_boil",type:"int"},{name:"origin",type:"string"},{name:"supplier",type:"string"},{name:"notes",type:"string"},{name:"coarse_fine_diff",type:"float"},{name:"moisture",type:"float"},{name:"diastatic_power",type:"float"},{name:"protein",type:"float"},{name:"dissolved_protein",type:"float"},{name:"max_in_batch",type:"float"},{name:"recommend_mash",type:"int"},{name:"added",type:"int"},{name:"always_on_stock",type:"int"},{name:"di_ph",type:"float"},{name:"acid_to_ph_57",type:"float"},{name:"graintype",type:"int"},{name:"inventory",type:"float"},{name:"cost",type:"float"},{name:"production_date",type:"string"},{name:"tht_date",type:"string"}],id:"record",url:a,deleterow:function(g,i){var h="delete=true&"+$.param({record:g});$.ajax({dataType:"json",url:a,cache:false,data:h,type:"POST",success:function(k,j,l){i(true)},error:function(j,l,k){i(false)}})},addrow:function(h,k,g,j){var i="insert=true&"+$.param(k);$.ajax({dataType:"json",url:a,cache:false,data:i,type:"POST",success:function(m,l,n){j(true)},error:function(l,n,m){j(false)}})},updaterow:function(g,j,i){var h="update=true&"+$.param(j);$.ajax({dataType:"json",url:a,cache:false,data:h,type:"POST",success:function(l,k,m){i(true)},error:function(k,m,l){i(false)}})}};$("#name").jqxInput({theme:theme,width:640,height:23});$("#type").jqxDropDownList({theme:theme,source:FermentableTypeAdapter,valueMember:"id",displayMember:"nl",width:180,height:23,autoDropDownHeight:true});$("#yield").jqxNumberInput(Spin1dec);$("#color").jqxNumberInput(Spin1dec);$("#add_after_boil").jqxCheckBox({theme:theme,width:120,height:23});$("#origin").jqxInput({theme:theme,width:250,height:23});$("#supplier").jqxInput({theme:theme,width:250,height:23});$("#notes").jqxInput({theme:theme,width:640,height:100});$("#coarse_fine_diff").jqxNumberInput(Spin1dec);$("#moisture").jqxNumberInput(Spin1dec);$("#diastatic_power").jqxNumberInput(PosInt);$("#protein").jqxNumberInput(Spin1dec);$("#dissolved_protein").jqxNumberInput(Spin1dec);$("#max_in_batch").jqxNumberInput(Perc1dec);$("#recommend_mash").jqxCheckBox({theme:theme,width:120,height:23});$("#added").jqxDropDownList({theme:theme,source:AddedAdapter,valueMember:"id",displayMember:"nl",width:180,height:23,autoDropDownHeight:true});$("#always_on_stock").jqxCheckBox({theme:theme,width:120,height:23});$("#di_ph").jqxNumberInput(Spin2pH);$("#acid_to_ph_57").jqxNumberInput({inputMode:"simple",theme:theme,width:110,height:23,min:-1000,max:1000,decimalDigits:4,spinButtons:true});$("#graintype").jqxDropDownList({theme:theme,source:GrainTypeAdapter,valueMember:"id",displayMember:"nl",width:180,height:23,autoDropDownHeight:true});$("#inventory").jqxNumberInput(Spin3dec);$("#production_date").jqxDateTimeInput(Dateopts);$("#cost").jqxNumberInput(Spin2dec);$("#tht_date").jqxDateTimeInput(Dateopts);$("#totval").jqxNumberInput(Show2dec);var f=new $.jqx.dataAdapter(e);var c=-1;$("#jqxgrid").jqxGrid({width:1280,height:630,source:f,theme:theme,showstatusbar:true,renderstatusbar:function(i){var g=$("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");var h=$("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");var j=$("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");g.append(h);g.append(j);i.append(g);h.jqxButton({theme:theme,width:90,height:20});j.jqxButton({theme:theme,width:90,height:20});h.click(function(k){c=-1;$("#popupWindow").jqxWindow({position:{x:110,y:30}});$("#name").val("Nieuw product");$("#type").val(0);$("#origin").val("");$("#supplier").val("");$("#notes").val("");$("#yield").val(80);$("#color").val(3);$("#coarse_fine_diff").val(3);$("#moisture").val(4);$("#diastatic_power").val(0);$("#protein").val(0);$("#dissolved_protein").val(0);$("#max_in_batch").val(100);$("#recommend_mash").val(1);$("#always_on_stock").val(0);$("#di_ph").val(0);$("#acid_to_ph_57").val(0);$("#graintype").val(0);$("#add_after_boil").val(0);$("#added").val(0);$("#inventory").val(0);$("#cost").val(0);$("#production_date").val("");$("#tht_date").val("");$("#popupWindow").jqxWindow("open")});j.click(function(l){var k="import_ingredients.php?select=fermentables";window.location.href=k})},filterable:true,filtermode:"excel",columns:[{text:"Herkomst",datafield:"origin",width:150},{text:"Producent",datafield:"supplier",width:140},{text:"Vergistbaar product",datafield:"name",menu:false},{text:"Soort",width:135,filtertype:"list",datafield:"type",cellsrenderer:function(h,g,k,j,i,l){return"<span style='margin: 3px; margin-top: 6px; float: left;'>"+FermentableTypeData[k].nl+"</span>"}},{text:"Graan type",datafield:"graintype",align:"center",cellsalign:"center",width:125,cellsrenderer:function(h,g,k,j,i,l){return"<span style='margin: 3px; margin-top: 6px; float: left;'>"+GrainTypeData[k].nl+"</span>"}},{text:"EBC",datafield:"color",width:60,align:"right",menu:false,cellsalign:"right"},{text:"Opbrengst",datafield:"yield",width:70,align:"right",menu:false,cellsalign:"right",cellsformat:"p1"},{text:"Voorraad",datafield:"inventory",width:100,align:"right",menu:false,cellsrenderer:function(h,g,l,k,j,m){var i="";if(l>0){if(l<1){i=f.formatNumber(l*1000,"f0")+" gr"}else{i=f.formatNumber(l,"f1")+" kg"}}return"<span style='margin: 3px; margin-top: 6px; float: right;'>"+i+"</span>"}},{text:"",datafield:"Edit",width:100,align:"center",menu:false,columntype:"button",cellsrenderer:function(){return"Wijzig"},buttonclick:function(g){c=g;$("#popupWindow").jqxWindow({position:{x:110,y:30}});b=$("#jqxgrid").jqxGrid("getrowdata",c);$("#name").val(b.name);$("#type").val(b.type);$("#yield").val(b.yield);$("#color").val(b.color);$("#add_after_boil").val(b.add_after_boil);$("#origin").val(b.origin);$("#supplier").val(b.supplier);$("#notes").val(b.notes);$("#coarse_fine_diff").val(b.coarse_fine_diff);$("#moisture").val(b.moisture);$("#diastatic_power").val(lintner_to_kolbach(b.diastatic_power));$("#protein").val(b.protein);$("#dissolved_protein").val(b.dissolved_protein);$("#max_in_batch").val(b.max_in_batch);$("#recommend_mash").val(b.recommend_mash);$("#added").val(b.added);$("#always_on_stock").val(b.always_on_stock);$("#di_ph").val(b.di_ph);$("#acid_to_ph_57").val(b.acid_to_ph_57);$("#graintype").val(b.graintype);$("#inventory").val(b.inventory);$("#cost").val(b.cost);$("#production_date").val(b.production_date);$("#tht_date").val(b.tht_date);d(b.cost,b.inventory);$("#popupWindow").jqxWindow("open")}}]});$("#cost").on("change",function(g){b.cost=parseFloat(g.args.value);d(b.cost,b.inventory)});$("#inventory").on("change",function(g){b.inventory=parseFloat(g.args.value);d(b.cost,b.inventory)});$("#popupWindow").jqxWindow({width:1050,height:550,resizable:false,theme:theme,isModal:true,autoOpen:false,cancelButton:$("#Cancel"),modalOpacity:0.4});$("#popupWindow").on("open",function(){$("#name").jqxInput("selectAll")});$("#Delete").jqxButton({template:"danger",width:"90px",theme:theme});$("#Delete").click(function(){if(c>=0){$("#eventWindow").jqxWindow("open");$("#delOk").click(function(){var g=$("#jqxgrid").jqxGrid("getrowid",c);$("#jqxgrid").jqxGrid("deleterow",g)})}$("#popupWindow").jqxWindow("hide")});$("#Cancel").jqxButton({template:"primary",width:"90px",theme:theme});$("#Clone").jqxButton({template:"warning",width:"90px",theme:theme});$("#Clone").click(function(){var g={record:-1,name:$("#name").val()+" kopie",type:$("#type").val(),yield:parseFloat($("#yield").jqxNumberInput("decimal")),color:parseFloat($("#color").jqxNumberInput("decimal")),add_after_boil:$("#add_after_boil").val(),origin:$("#origin").val(),supplier:$("#supplier").val(),notes:$("#notes").val(),coarse_fine_diff:parseFloat($("#coarse_fine_diff").jqxNumberInput("decimal")),moisture:parseFloat($("#moisture").jqxNumberInput("decimal")),diastatic_power:kolbach_to_lintner(parseFloat($("#diastatic_power").jqxNumberInput("decimal"))),protein:parseFloat($("#protein").jqxNumberInput("decimal")),dissolved_protein:parseFloat($("#dissolved_protein").jqxNumberInput("decimal")),max_in_batch:parseFloat($("#max_in_batch").jqxNumberInput("decimal")),recommend_mash:$("#recommend_mash").val(),added:$("#added").val(),always_on_stock:$("#always_on_stock").val(),di_ph:parseFloat($("#di_ph").jqxNumberInput("decimal")),acid_to_ph_57:parseFloat($("#acid_to_ph_57").jqxNumberInput("decimal")),graintype:$("#graintype").val(),inventory:0,cost:parseFloat($("#cost").jqxNumberInput("decimal")),production_date:"",tht_date:""};$("#jqxgrid").jqxGrid("addrow",null,g);$("#popupWindow").jqxWindow("hide");location.reload(true)});$("#Save").jqxButton({template:"success",width:"90px",theme:theme});$("#Save").click(function(){var g=-1;if(c>=0){g=$("#jqxgrid").jqxGrid("getrowid",c)}var h={record:g,name:$("#name").val(),type:$("#type").val(),yield:parseFloat($("#yield").jqxNumberInput("decimal")),color:parseFloat($("#color").jqxNumberInput("decimal")),add_after_boil:$("#add_after_boil").val(),origin:$("#origin").val(),supplier:$("#supplier").val(),notes:$("#notes").val(),coarse_fine_diff:parseFloat($("#coarse_fine_diff").jqxNumberInput("decimal")),moisture:parseFloat($("#moisture").jqxNumberInput("decimal")),diastatic_power:kolbach_to_lintner(parseFloat($("#diastatic_power").jqxNumberInput("decimal"))),protein:parseFloat($("#protein").jqxNumberInput("decimal")),dissolved_protein:parseFloat($("#dissolved_protein").jqxNumberInput("decimal")),max_in_batch:parseFloat($("#max_in_batch").jqxNumberInput("decimal")),recommend_mash:$("#recommend_mash").val(),added:$("#added").val(),always_on_stock:$("#always_on_stock").val(),di_ph:parseFloat($("#di_ph").jqxNumberInput("decimal")),acid_to_ph_57:parseFloat($("#acid_to_ph_57").jqxNumberInput("decimal")),graintype:$("#graintype").val(),inventory:parseFloat($("#inventory").jqxNumberInput("decimal")),cost:parseFloat($("#cost").jqxNumberInput("decimal")),production_date:$("#production_date").val(),tht_date:$("#tht_date").val(),};if(c>=0){$("#jqxgrid").jqxGrid("updaterow",g,h)}else{$("#jqxgrid").jqxGrid("addrow",null,h);location.reload(true)}$("#popupWindow").jqxWindow("hide")});createDelElements()});
\ No newline at end of file
+function createDelElements(){$("#eventWindow").jqxWindow({theme:theme,position:{x:490,y:210},width:300,height:175,resizable:false,isModal:true,modalOpacity:0.4,okButton:$("#delOk"),cancelButton:$("#delCancel"),initContent:function(){$("#delOk").jqxButton({template:"danger",width:"65px",theme:theme});$("#delCancel").jqxButton({template:"success",width:"65px",theme:theme});$("#delCancel").focus()}});$("#eventWindow").jqxWindow("hide")}$(document).ready(function(){function d(h,g){$("#totval").val(h*g)}var b={},a="includes/db_inventory_fermentables.php",e={datatype:"json",cache:false,datafields:[{name:"record",type:"number"},{name:"name",type:"string"},{name:"type",type:"int"},{name:"yield",type:"float"},{name:"color",type:"float"},{name:"add_after_boil",type:"int"},{name:"origin",type:"string"},{name:"supplier",type:"string"},{name:"notes",type:"string"},{name:"coarse_fine_diff",type:"float"},{name:"moisture",type:"float"},{name:"diastatic_power",type:"float"},{name:"protein",type:"float"},{name:"dissolved_protein",type:"float"},{name:"max_in_batch",type:"float"},{name:"recommend_mash",type:"int"},{name:"added",type:"int"},{name:"always_on_stock",type:"int"},{name:"di_ph",type:"float"},{name:"acid_to_ph_57",type:"float"},{name:"graintype",type:"int"},{name:"inventory",type:"float"},{name:"cost",type:"float"},{name:"production_date",type:"string"},{name:"tht_date",type:"string"}],id:"record",url:a,deleterow:function(g,i){var h="delete=true&"+$.param({record:g});$.ajax({dataType:"json",url:a,cache:false,data:h,type:"POST",success:function(k,j,l){i(true);location.reload(true)},error:function(j,l,k){i(false)}})},addrow:function(h,k,g,j){var i="insert=true&"+$.param(k);$.ajax({dataType:"json",url:a,cache:false,data:i,type:"POST",success:function(m,l,n){j(true);location.reload(true)},error:function(l,n,m){j(false)}})},updaterow:function(g,j,i){var h="update=true&"+$.param(j);$.ajax({dataType:"json",url:a,cache:false,data:h,type:"POST",success:function(l,k,m){i(true);location.reload(true)},error:function(k,m,l){i(false)}})}},f=new $.jqx.dataAdapter(e),c=-1;$("#name").jqxInput({theme:theme,width:640,height:23});$("#type").jqxDropDownList({theme:theme,source:FermentableTypeAdapter,valueMember:"id",displayMember:"nl",width:180,height:23,autoDropDownHeight:true});$("#yield").jqxNumberInput(Spin1dec);$("#color").jqxNumberInput(Spin1dec);$("#add_after_boil").jqxCheckBox({theme:theme,width:120,height:23});$("#origin").jqxInput({theme:theme,width:250,height:23});$("#supplier").jqxInput({theme:theme,width:250,height:23});$("#notes").jqxInput({theme:theme,width:640,height:100});$("#coarse_fine_diff").jqxNumberInput(Spin1dec);$("#moisture").jqxNumberInput(Spin1dec);$("#diastatic_power").jqxNumberInput(PosInt);$("#protein").jqxNumberInput(Spin1dec);$("#dissolved_protein").jqxNumberInput(Spin1dec);$("#max_in_batch").jqxNumberInput(Perc1dec);$("#recommend_mash").jqxCheckBox({theme:theme,width:120,height:23});$("#added").jqxDropDownList({theme:theme,source:AddedAdapter,valueMember:"id",displayMember:"nl",width:180,height:23,autoDropDownHeight:true});$("#always_on_stock").jqxCheckBox({theme:theme,width:120,height:23});$("#di_ph").jqxNumberInput(Spin2pH);$("#acid_to_ph_57").jqxNumberInput({inputMode:"simple",theme:theme,width:110,height:23,min:-1000,max:1000,decimalDigits:4,spinButtons:true});$("#graintype").jqxDropDownList({theme:theme,source:GrainTypeAdapter,valueMember:"id",displayMember:"nl",width:180,height:23,autoDropDownHeight:true});$("#inventory").jqxNumberInput(Spin3dec);$("#production_date").jqxDateTimeInput(Dateopts);$("#cost").jqxNumberInput(Spin2dec);$("#tht_date").jqxDateTimeInput(Dateopts);$("#totval").jqxNumberInput(Show2dec);$("#jqxgrid").jqxGrid({width:1280,height:630,source:f,theme:theme,showstatusbar:true,renderstatusbar:function(i){var g,h,j;g=$("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");h=$("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");j=$("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");g.append(h);g.append(j);i.append(g);h.jqxButton({theme:theme,width:90,height:20});j.jqxButton({theme:theme,width:90,height:20});h.click(function(k){c=-1;$("#popupWindow").jqxWindow({position:{x:110,y:30}});$("#name").val("Nieuw product");$("#type").val(0);$("#origin").val("");$("#supplier").val("");$("#notes").val("");$("#yield").val(80);$("#color").val(3);$("#coarse_fine_diff").val(3);$("#moisture").val(4);$("#diastatic_power").val(0);$("#protein").val(0);$("#dissolved_protein").val(0);$("#max_in_batch").val(100);$("#recommend_mash").val(1);$("#always_on_stock").val(0);$("#di_ph").val(0);$("#acid_to_ph_57").val(0);$("#graintype").val(0);$("#add_after_boil").val(0);$("#added").val(0);$("#inventory").val(0);$("#cost").val(0);$("#production_date").val("");$("#tht_date").val("");$("#popupWindow").jqxWindow("open")});j.click(function(k){window.location.href="import_ingredients.php?select=fermentables"})},filterable:true,filtermode:"excel",columns:[{text:"Herkomst",datafield:"origin",width:150},{text:"Producent",datafield:"supplier",width:140},{text:"Vergistbaar product",datafield:"name",menu:false},{text:"Soort",width:135,filtertype:"list",datafield:"type",cellsrenderer:function(h,g,k,j,i,l){return"<span style='margin: 3px; margin-top: 6px; float: left;'>"+FermentableTypeData[k].nl+"</span>"}},{text:"Graan type",datafield:"graintype",align:"center",cellsalign:"center",width:125,cellsrenderer:function(h,g,k,j,i,l){return"<span style='margin: 3px; margin-top: 6px; float: left;'>"+GrainTypeData[k].nl+"</span>"}},{text:"EBC",datafield:"color",width:60,align:"right",menu:false,cellsalign:"right"},{text:"Opbrengst",datafield:"yield",width:70,align:"right",menu:false,cellsalign:"right",cellsformat:"p1"},{text:"Voorraad",datafield:"inventory",width:100,align:"right",menu:false,cellsrenderer:function(h,g,l,k,j,m){var i="";if(l>0){if(l<1){i=f.formatNumber(l*1000,"f0")+" gr"}else{i=f.formatNumber(l,"f1")+" kg"}}return"<span style='margin: 3px; margin-top: 6px; float: right;'>"+i+"</span>"}},{text:"",datafield:"Edit",width:100,align:"center",menu:false,columntype:"button",cellsrenderer:function(){return"Wijzig"},buttonclick:function(g){c=g;$("#popupWindow").jqxWindow({position:{x:110,y:30}});b=$("#jqxgrid").jqxGrid("getrowdata",c);$("#name").val(b.name);$("#type").val(b.type);$("#yield").val(b.yield);$("#color").val(b.color);$("#add_after_boil").val(b.add_after_boil);$("#origin").val(b.origin);$("#supplier").val(b.supplier);$("#notes").val(b.notes);$("#coarse_fine_diff").val(b.coarse_fine_diff);$("#moisture").val(b.moisture);$("#diastatic_power").val(lintner_to_kolbach(b.diastatic_power));$("#protein").val(b.protein);$("#dissolved_protein").val(b.dissolved_protein);$("#max_in_batch").val(b.max_in_batch);$("#recommend_mash").val(b.recommend_mash);$("#added").val(b.added);$("#always_on_stock").val(b.always_on_stock);$("#di_ph").val(b.di_ph);$("#acid_to_ph_57").val(b.acid_to_ph_57);$("#graintype").val(b.graintype);$("#inventory").val(b.inventory);$("#cost").val(b.cost);$("#production_date").val(b.production_date);$("#tht_date").val(b.tht_date);d(b.cost,b.inventory);$("#popupWindow").jqxWindow("open")}}]});$("#cost").on("change",function(g){b.cost=parseFloat(g.args.value);d(b.cost,b.inventory)});$("#inventory").on("change",function(g){b.inventory=parseFloat(g.args.value);d(b.cost,b.inventory)});$("#popupWindow").jqxWindow({width:1050,height:550,resizable:false,theme:theme,isModal:true,autoOpen:false,cancelButton:$("#Cancel"),modalOpacity:0.4});$("#popupWindow").on("open",function(){$("#name").jqxInput("selectAll")});$("#Delete").jqxButton({template:"danger",width:"90px",theme:theme});$("#Delete").click(function(){if(c>=0){$("#eventWindow").jqxWindow("open");$("#delOk").click(function(){var g=$("#jqxgrid").jqxGrid("getrowid",c);$("#jqxgrid").jqxGrid("deleterow",g)})}$("#popupWindow").jqxWindow("hide")});$("#Cancel").jqxButton({template:"primary",width:"90px",theme:theme});$("#Clone").jqxButton({template:"warning",width:"90px",theme:theme});$("#Clone").click(function(){var g={record:-1,name:$("#name").val()+" kopie",type:$("#type").val(),yield:parseFloat($("#yield").jqxNumberInput("decimal")),color:parseFloat($("#color").jqxNumberInput("decimal")),add_after_boil:$("#add_after_boil").val(),origin:$("#origin").val(),supplier:$("#supplier").val(),notes:$("#notes").val(),coarse_fine_diff:parseFloat($("#coarse_fine_diff").jqxNumberInput("decimal")),moisture:parseFloat($("#moisture").jqxNumberInput("decimal")),diastatic_power:kolbach_to_lintner(parseFloat($("#diastatic_power").jqxNumberInput("decimal"))),protein:parseFloat($("#protein").jqxNumberInput("decimal")),dissolved_protein:parseFloat($("#dissolved_protein").jqxNumberInput("decimal")),max_in_batch:parseFloat($("#max_in_batch").jqxNumberInput("decimal")),recommend_mash:$("#recommend_mash").val(),added:$("#added").val(),always_on_stock:$("#always_on_stock").val(),di_ph:parseFloat($("#di_ph").jqxNumberInput("decimal")),acid_to_ph_57:parseFloat($("#acid_to_ph_57").jqxNumberInput("decimal")),graintype:$("#graintype").val(),inventory:0,cost:parseFloat($("#cost").jqxNumberInput("decimal")),production_date:"",tht_date:""};$("#jqxgrid").jqxGrid("addrow",null,g);$("#popupWindow").jqxWindow("hide")});$("#Save").jqxButton({template:"success",width:"90px",theme:theme});$("#Save").click(function(){var h,g=-1;if(c>=0){g=$("#jqxgrid").jqxGrid("getrowid",c)}h={record:g,name:$("#name").val(),type:$("#type").val(),yield:parseFloat($("#yield").jqxNumberInput("decimal")),color:parseFloat($("#color").jqxNumberInput("decimal")),add_after_boil:$("#add_after_boil").val(),origin:$("#origin").val(),supplier:$("#supplier").val(),notes:$("#notes").val(),coarse_fine_diff:parseFloat($("#coarse_fine_diff").jqxNumberInput("decimal")),moisture:parseFloat($("#moisture").jqxNumberInput("decimal")),diastatic_power:kolbach_to_lintner(parseFloat($("#diastatic_power").jqxNumberInput("decimal"))),protein:parseFloat($("#protein").jqxNumberInput("decimal")),dissolved_protein:parseFloat($("#dissolved_protein").jqxNumberInput("decimal")),max_in_batch:parseFloat($("#max_in_batch").jqxNumberInput("decimal")),recommend_mash:$("#recommend_mash").val(),added:$("#added").val(),always_on_stock:$("#always_on_stock").val(),di_ph:parseFloat($("#di_ph").jqxNumberInput("decimal")),acid_to_ph_57:parseFloat($("#acid_to_ph_57").jqxNumberInput("decimal")),graintype:$("#graintype").val(),inventory:parseFloat($("#inventory").jqxNumberInput("decimal")),cost:parseFloat($("#cost").jqxNumberInput("decimal")),production_date:$("#production_date").val(),tht_date:$("#tht_date").val(),};if(c>=0){$("#jqxgrid").jqxGrid("updaterow",g,h)}else{$("#jqxgrid").jqxGrid("addrow",null,h)}$("#popupWindow").jqxWindow("hide")});createDelElements()});
\ No newline at end of file
--- a/www/js/inv_fermentables.js	Fri Sep 13 16:54:51 2019 +0200
+++ b/www/js/inv_fermentables.js	Fri Sep 13 20:24:31 2019 +0200
@@ -44,16 +44,15 @@
 
 $(document).ready(function () {
 
-	var dataRecord = {};
-
 	function calcTotal(cost, inventory) {
 
 		$('#totval').val(cost * inventory);
 	}
 
-	var url = "includes/db_inventory_fermentables.php";
+	var dataRecord = {},
+	url = 'includes/db_inventory_fermentables.php',
 	// prepare the data
-	var source = {
+	source = {
 		datatype: "json",
 		cache: false,
 		datafields: [
@@ -95,8 +94,8 @@
 				data: data,
 				type: "POST",
 				success: function (data, status, xhr) {
-					// delete command is executed.
 					commit(true);
+					location.reload( true );
 				},
 				error: function (jqXHR, textStatus, errorThrown) {
 					commit(false);
@@ -113,6 +112,7 @@
 				type: "POST",
                                	success: function (data, status, xhr) {
                                        	commit(true);
+					location.reload( true );
                                	},
                                	error: function(jqXHR, textStatus, errorThrown) {
                                         commit(false);
@@ -128,15 +128,18 @@
 				data: data,
 				type: "POST",
 				success: function (data, status, xhr) {
-					// update command is executed.
 					commit(true);
+					location.reload( true );
 				},
 				error: function(jqXHR, textStatus, errorThrown) {
 					commit(false);
 				}
 			});
 		}
-	};
+	},
+	dataAdapter = new $.jqx.dataAdapter(source),
+        editrow = -1;
+
 	// initialize the input fields.
 	$("#name").jqxInput({ theme: theme, width: 640, height: 23 });
 	$("#type").jqxDropDownList({
@@ -188,8 +191,6 @@
 	$("#tht_date").jqxDateTimeInput( Dateopts );
 	$("#totval").jqxNumberInput( Show2dec );
 
-	var dataAdapter = new $.jqx.dataAdapter(source);
-	var editrow = -1;
 	// initialize jqxGrid
 	$("#jqxgrid").jqxGrid({
 		width: 1280,
@@ -198,9 +199,10 @@
 		theme: theme,
 		showstatusbar: true,
 		renderstatusbar: function (statusbar) {
-			var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
-			var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
-			var impButton = $("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");
+			var container, addButton, impButton;
+			container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
+			addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
+			impButton = $("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");
 			container.append(addButton);
 			container.append(impButton);
 			statusbar.append(container);
@@ -237,8 +239,7 @@
 				$("#popupWindow").jqxWindow('open');
 			});
 			impButton.click(function (event) {
-				var url="import_ingredients.php?select=fermentables";
-				window.location.href = url;
+				window.location.href = 'import_ingredients.php?select=fermentables';
 			});
 		},
 		filterable: true,
@@ -271,8 +272,9 @@
 				return "<span style='margin: 3px; margin-top: 6px; float: right;'>" + amount + "</span>";
 			  }
 			},
-			{ text: '', datafield: 'Edit', width: 100, align: 'center', menu: false, columntype: 'button', cellsrenderer: function () {
-				return "Wijzig";
+			{ text: '', datafield: 'Edit', width: 100, align: 'center', menu: false, columntype: 'button',
+				cellsrenderer: function () {
+					return "Wijzig";
 				}, buttonclick: function (row) {
 					// open the popup window when the user clicks a button.
 					editrow = row;
@@ -375,20 +377,18 @@
                         cost: parseFloat($('#cost').jqxNumberInput('decimal')),
                         production_date: '',
                         tht_date: ''
-
                 };
                 $('#jqxgrid').jqxGrid('addrow', null, row);
                 $('#popupWindow').jqxWindow('hide');
-                location.reload( true );        // reload ourself.
         });
 	$("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
 	// update the edited row when the user clicks the 'Save' button.
 	$("#Save").click(function() {
-		var rowID = -1;
+		var row, rowID = -1;
 		if (editrow >= 0) {
 			rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
 		}
-		var row = {
+		row = {
 			record: rowID,
 			name: $("#name").val(),
 			type: $("#type").val(),
@@ -419,7 +419,6 @@
 			$('#jqxgrid').jqxGrid('updaterow', rowID, row);
 		} else {
 			$('#jqxgrid').jqxGrid('addrow', null, row);
-			location.reload( true );	// reload ourself.
 		}
 		$("#popupWindow").jqxWindow('hide');
 	});
--- a/www/js/inv_hops-min.js	Fri Sep 13 16:54:51 2019 +0200
+++ b/www/js/inv_hops-min.js	Fri Sep 13 20:24:31 2019 +0200
@@ -1,1 +1,1 @@
-function createDelElements(){$("#eventWindow").jqxWindow({theme:theme,position:{x:490,y:210},width:300,height:175,resizable:false,isModal:true,modalOpacity:0.4,okButton:$("#delOk"),cancelButton:$("#delCancel"),initContent:function(){$("#delOk").jqxButton({template:"danger",width:"65px",theme:theme});$("#delCancel").jqxButton({template:"success",width:"65px",theme:theme});$("#delCancel").focus()}});$("#eventWindow").jqxWindow("hide")}$(document).ready(function(){var b={};function d(h,g){$("#totval").val(h*(g/1000))}var a="includes/db_inventory_hops.php";var e={datatype:"json",cache:false,datafields:[{name:"record",type:"number"},{name:"name",type:"string"},{name:"alpha",type:"float"},{name:"beta",type:"float"},{name:"humulene",type:"float"},{name:"caryophyllene",type:"float"},{name:"cohumulone",type:"float"},{name:"myrcene",type:"float"},{name:"hsi",type:"float"},{name:"type",type:"int"},{name:"form",type:"int"},{name:"notes",type:"string"},{name:"origin",type:"string"},{name:"substitutes",type:"string"},{name:"always_on_stock",type:"int"},{name:"inventory",type:"float"},{name:"cost",type:"float"},{name:"production_date",type:"string"},{name:"tht_date",type:"string"},{name:"total_oil",type:"float"}],id:"record",url:a,deleterow:function(g,i){var h="delete=true&"+$.param({record:g});$.ajax({dataType:"json",url:a,cache:false,data:h,type:"POST",success:function(k,j,l){i(true)},error:function(j,l,k){i(false)}})},addrow:function(h,k,g,j){var i="insert=true&"+$.param(k);$.ajax({dataType:"json",url:a,cache:false,data:i,type:"POST",success:function(m,l,n){j(true)},error:function(l,n,m){j(false)}})},updaterow:function(g,j,i){var h="update=true&"+$.param(j);$.ajax({dataType:"json",url:a,cache:false,data:h,type:"POST",success:function(l,k,m){i(true)},error:function(k,m,l){i(false)}})}};$("#name").jqxInput({theme:theme,width:640,height:23});$("#alpha").jqxNumberInput(Perc1dec);$("#beta").jqxNumberInput(Perc1dec);$("#humulene").jqxNumberInput(Perc1dec);$("#caryophyllene").jqxNumberInput(Perc1dec);$("#cohumulone").jqxNumberInput(Perc1dec);$("#myrcene").jqxNumberInput(Perc1dec);$("#hsi").jqxNumberInput(Perc1dec);$("#type").jqxDropDownList({theme:theme,source:HopTypeAdapter,valueMember:"id",displayMember:"nl",width:150,height:23,autoDropDownHeight:true});$("#form").jqxDropDownList({theme:theme,source:HopFormAdapter,valueMember:"id",displayMember:"nl",width:150,height:23,autoDropDownHeight:true});$("#notes").jqxInput({theme:theme,width:640,height:100});$("#origin").jqxInput({theme:theme,width:320,height:23});$("#substitutes").jqxInput({theme:theme,width:320,height:23});$("#always_on_stock").jqxCheckBox({theme:theme,width:120,height:23});$("#inventory").jqxNumberInput(Spin1dec);$("#production_date").jqxDateTimeInput(Dateopts);$("#cost").jqxNumberInput(Spin2dec);$("#tht_date").jqxDateTimeInput(Dateopts);$("#total_oil").jqxNumberInput(Perc1dec);$("#totval").jqxNumberInput(Show2dec);var f=new $.jqx.dataAdapter(e);var c=-1;$("#jqxgrid").jqxGrid({width:1280,height:630,source:f,theme:theme,showstatusbar:true,renderstatusbar:function(i){var g=$("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");var h=$("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");var j=$("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");g.append(h);g.append(j);i.append(g);h.jqxButton({theme:theme,width:90,height:20});j.jqxButton({theme:theme,width:90,height:20});h.click(function(k){c=-1;$("#popupWindow").jqxWindow({position:{x:110,y:30}});$("#name").val("Nieuwe hop");$("#alpha").val(0);$("#beta").val(0);$("#humulene").val(0);$("#caryophyllene").val(0);$("#cohumulone").val(0);$("#myrcene").val(0);$("#hsi").val(0);$("#type").val(0);$("#form").val(0);$("#notes").val("");$("#origin").val("");$("#substitutes").val("");$("#always_on_stock").val(0);$("#inventory").val(0);$("#cost").val(0);$("#production_date").val("");$("#tht_date").val("");$("#total_oil").val(0);$("#popupWindow").jqxWindow("open")});j.click(function(l){var k="import_ingredients.php?select=hops";window.location.href=k})},filterable:true,filtermode:"excel",columns:[{text:"Herkomst",datafield:"origin",width:150},{text:"Hop Naam",datafield:"name",menu:false},{text:"Soort",datafield:"type",align:"left",menu:false,width:90,cellsrenderer:function(h,g,k,j,i,l){return'<span style="margin: 4px; margin-top: 6px; float: left;">'+HopTypeData[k].nl+"</span>"}},{text:"Vorm",datafield:"form",align:"left",menu:false,width:90,cellsrenderer:function(h,g,k,j,i,l){return'<span style="margin: 4px; margin-top: 6px; float: left;">'+HopFormData[k].nl+"</span>"}},{text:"Alpha %",datafield:"alpha",width:80,align:"right",cellsalign:"right",menu:false,cellsformat:"p1"},{text:"Beta %",datafield:"beta",width:80,align:"right",cellsalign:"right",menu:false,cellsformat:"p1"},{text:"Cohumuloon %%",datafield:"cohumulone",width:80,align:"right",cellsalign:"right",menu:false,cellsformat:"p1"},{text:"HSI",datafield:"hsi",width:60,align:"right",cellsalign:"right",menu:false,cellsformat:"f1"},{text:"Oogst datum",datafield:"production_date",align:"center",cellsalign:"center",menu:false,width:110},{text:"Voorraad",datafield:"inventory",width:100,align:"right",cellsalign:"right",menu:false,cellsformat:"f1",cellsrenderer:function(h,g,l,k,j,m){var i="";if(l>0){if(l<1000){i=f.formatNumber(l,"f1")+" gr"}else{i=f.formatNumber(l/1000,"f1")+" kg"}}return'<span style="margin: 4px; margin-top: 6px; float: right;">'+i+"</span>"}},{text:"",datafield:"Wijzig",columntype:"button",width:100,align:"center",menu:false,cellsrenderer:function(){return"Wijzig"},buttonclick:function(g){c=g;$("#popupWindow").jqxWindow({position:{x:110,y:30}});b=$("#jqxgrid").jqxGrid("getrowdata",c);$("#name").val(b.name);$("#alpha").val(b.alpha);$("#beta").val(b.beta);$("#humulene").val(b.humulene);$("#caryophyllene").val(b.caryophyllene);$("#cohumulone").val(b.cohumulone);$("#myrcene").val(b.myrcene);$("#hsi").val(b.hsi);$("#type").val(b.type);$("#form").val(b.form);$("#notes").val(b.notes);$("#origin").val(b.origin);$("#substitutes").val(b.substitutes);$("#always_on_stock").val(b.always_on_stock);$("#inventory").val(b.inventory);$("#cost").val(b.cost);$("#production_date").val(b.production_date);$("#tht_date").val(b.tht_date);$("#total_oil").val(b.total_oil);d(b.cost,b.inventory);$("#popupWindow").jqxWindow("open")}}]});$("#cost").on("change",function(g){b.cost=parseFloat(g.args.value);d(b.cost,b.inventory)});$("#inventory").on("change",function(g){b.inventory=parseFloat(g.args.value);d(b.cost,b.inventory)});$("#popupWindow").jqxWindow({width:1050,height:550,resizable:false,theme:theme,isModal:true,autoOpen:false,cancelButton:$("#Cancel"),modalOpacity:0.4});$("#popupWindow").on("open",function(){$("#name").jqxInput("selectAll")});$("#Delete").jqxButton({template:"danger",width:"90px",theme:theme});$("#Delete").click(function(){if(c>=0){$("#eventWindow").jqxWindow("open");$("#delOk").click(function(){var g=$("#jqxgrid").jqxGrid("getrowid",c);$("#jqxgrid").jqxGrid("deleterow",g)})}$("#popupWindow").jqxWindow("hide")});$("#Cancel").jqxButton({template:"primary",width:"90px",theme:theme});$("#Clone").jqxButton({template:"warning",width:"90px",theme:theme});$("#Clone").click(function(){var g={record:-1,name:$("#name").val()+" kopie",alpha:parseFloat($("#alpha").jqxNumberInput("decimal")),beta:parseFloat($("#beta").jqxNumberInput("decimal")),humulene:parseFloat($("#humulene").jqxNumberInput("decimal")),caryophyllene:parseFloat($("#caryophyllene").jqxNumberInput("decimal")),cohumulone:parseFloat($("#cohumulone").jqxNumberInput("decimal")),myrcene:parseFloat($("#myrcene").jqxNumberInput("decimal")),hsi:parseFloat($("#hsi").jqxNumberInput("decimal")),type:$("#type").val(),form:$("#form").val(),notes:$("#notes").val(),origin:$("#origin").val(),substitutes:$("#substitutes").val(),always_on_stock:$("#always_on_stock").val(),inventory:0,cost:parseFloat($("#cost").jqxNumberInput("decimal")),production_date:"",tht_date:"",total_oil:parseFloat($("#total_oil").jqxNumberInput("decimal"))};$("#jqxgrid").jqxGrid("addrow",null,g);$("#popupWindow").jqxWindow("hide");location.reload(true)});$("#Save").jqxButton({template:"success",width:"90px",theme:theme});$("#Save").click(function(){var g=-1;if(c>=0){var g=$("#jqxgrid").jqxGrid("getrowid",c)}var h={record:g,name:$("#name").val(),alpha:parseFloat($("#alpha").jqxNumberInput("decimal")),beta:parseFloat($("#beta").jqxNumberInput("decimal")),humulene:parseFloat($("#humulene").jqxNumberInput("decimal")),caryophyllene:parseFloat($("#caryophyllene").jqxNumberInput("decimal")),cohumulone:parseFloat($("#cohumulone").jqxNumberInput("decimal")),myrcene:parseFloat($("#myrcene").jqxNumberInput("decimal")),hsi:parseFloat($("#hsi").jqxNumberInput("decimal")),type:$("#type").val(),form:$("#form").val(),notes:$("#notes").val(),origin:$("#origin").val(),substitutes:$("#substitutes").val(),always_on_stock:$("#always_on_stock").val(),inventory:parseFloat($("#inventory").jqxNumberInput("decimal")),cost:parseFloat($("#cost").jqxNumberInput("decimal")),production_date:$("#production_date").val(),tht_date:$("#tht_date").val(),total_oil:parseFloat($("#total_oil").jqxNumberInput("decimal"))};if(c>=0){$("#jqxgrid").jqxGrid("updaterow",g,h)}else{$("#jqxgrid").jqxGrid("addrow",null,h);location.reload(true)}$("#popupWindow").jqxWindow("hide")});createDelElements()});
\ No newline at end of file
+function createDelElements(){$("#eventWindow").jqxWindow({theme:theme,position:{x:490,y:210},width:300,height:175,resizable:false,isModal:true,modalOpacity:0.4,okButton:$("#delOk"),cancelButton:$("#delCancel"),initContent:function(){$("#delOk").jqxButton({template:"danger",width:"65px",theme:theme});$("#delCancel").jqxButton({template:"success",width:"65px",theme:theme});$("#delCancel").focus()}});$("#eventWindow").jqxWindow("hide")}$(document).ready(function(){function d(h,g){$("#totval").val(h*(g/1000))}var b={},a="includes/db_inventory_hops.php",e={datatype:"json",cache:false,datafields:[{name:"record",type:"number"},{name:"name",type:"string"},{name:"alpha",type:"float"},{name:"beta",type:"float"},{name:"humulene",type:"float"},{name:"caryophyllene",type:"float"},{name:"cohumulone",type:"float"},{name:"myrcene",type:"float"},{name:"hsi",type:"float"},{name:"type",type:"int"},{name:"form",type:"int"},{name:"notes",type:"string"},{name:"origin",type:"string"},{name:"substitutes",type:"string"},{name:"always_on_stock",type:"int"},{name:"inventory",type:"float"},{name:"cost",type:"float"},{name:"production_date",type:"string"},{name:"tht_date",type:"string"},{name:"total_oil",type:"float"}],id:"record",url:a,deleterow:function(g,i){var h="delete=true&"+$.param({record:g});$.ajax({dataType:"json",url:a,cache:false,data:h,type:"POST",success:function(k,j,l){i(true);location.reload(true)},error:function(j,l,k){i(false)}})},addrow:function(h,k,g,j){var i="insert=true&"+$.param(k);$.ajax({dataType:"json",url:a,cache:false,data:i,type:"POST",success:function(m,l,n){j(true);location.reload(true)},error:function(l,n,m){j(false)}})},updaterow:function(g,j,i){var h="update=true&"+$.param(j);$.ajax({dataType:"json",url:a,cache:false,data:h,type:"POST",success:function(l,k,m){i(true);location.reload(true)},error:function(k,m,l){i(false)}})}},f=new $.jqx.dataAdapter(e),c=-1;$("#name").jqxInput({theme:theme,width:640,height:23});$("#alpha").jqxNumberInput(Perc1dec);$("#beta").jqxNumberInput(Perc1dec);$("#humulene").jqxNumberInput(Perc1dec);$("#caryophyllene").jqxNumberInput(Perc1dec);$("#cohumulone").jqxNumberInput(Perc1dec);$("#myrcene").jqxNumberInput(Perc1dec);$("#hsi").jqxNumberInput(Perc1dec);$("#type").jqxDropDownList({theme:theme,source:HopTypeAdapter,valueMember:"id",displayMember:"nl",width:150,height:23,autoDropDownHeight:true});$("#form").jqxDropDownList({theme:theme,source:HopFormAdapter,valueMember:"id",displayMember:"nl",width:150,height:23,autoDropDownHeight:true});$("#notes").jqxInput({theme:theme,width:640,height:100});$("#origin").jqxInput({theme:theme,width:320,height:23});$("#substitutes").jqxInput({theme:theme,width:320,height:23});$("#always_on_stock").jqxCheckBox({theme:theme,width:120,height:23});$("#inventory").jqxNumberInput(Spin1dec);$("#production_date").jqxDateTimeInput(Dateopts);$("#cost").jqxNumberInput(Spin2dec);$("#tht_date").jqxDateTimeInput(Dateopts);$("#total_oil").jqxNumberInput(Perc1dec);$("#totval").jqxNumberInput(Show2dec);$("#jqxgrid").jqxGrid({width:1280,height:630,source:f,theme:theme,showstatusbar:true,renderstatusbar:function(i){var g,h,j;g=$("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");h=$("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");j=$("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");g.append(h);g.append(j);i.append(g);h.jqxButton({theme:theme,width:90,height:20});j.jqxButton({theme:theme,width:90,height:20});h.click(function(k){c=-1;$("#popupWindow").jqxWindow({position:{x:110,y:30}});$("#name").val("Nieuwe hop");$("#alpha").val(0);$("#beta").val(0);$("#humulene").val(0);$("#caryophyllene").val(0);$("#cohumulone").val(0);$("#myrcene").val(0);$("#hsi").val(0);$("#type").val(0);$("#form").val(0);$("#notes").val("");$("#origin").val("");$("#substitutes").val("");$("#always_on_stock").val(0);$("#inventory").val(0);$("#cost").val(0);$("#production_date").val("");$("#tht_date").val("");$("#total_oil").val(0);$("#popupWindow").jqxWindow("open")});j.click(function(k){window.location.href="import_ingredients.php?select=hops"})},filterable:true,filtermode:"excel",columns:[{text:"Herkomst",datafield:"origin",width:150},{text:"Hop Naam",datafield:"name",menu:false},{text:"Soort",datafield:"type",align:"left",menu:false,width:90,cellsrenderer:function(h,g,k,j,i,l){return'<span style="margin: 4px; margin-top: 6px; float: left;">'+HopTypeData[k].nl+"</span>"}},{text:"Vorm",datafield:"form",align:"left",menu:false,width:90,cellsrenderer:function(h,g,k,j,i,l){return'<span style="margin: 4px; margin-top: 6px; float: left;">'+HopFormData[k].nl+"</span>"}},{text:"Alpha %",datafield:"alpha",width:80,align:"right",cellsalign:"right",menu:false,cellsformat:"p1"},{text:"Beta %",datafield:"beta",width:80,align:"right",cellsalign:"right",menu:false,cellsformat:"p1"},{text:"Cohumuloon %%",datafield:"cohumulone",width:80,align:"right",cellsalign:"right",menu:false,cellsformat:"p1"},{text:"HSI",datafield:"hsi",width:60,align:"right",cellsalign:"right",menu:false,cellsformat:"f1"},{text:"Oogst datum",datafield:"production_date",align:"center",cellsalign:"center",menu:false,width:110},{text:"Voorraad",datafield:"inventory",width:100,align:"right",cellsalign:"right",menu:false,cellsformat:"f1",cellsrenderer:function(h,g,l,k,j,m){var i="";if(l>0){if(l<1000){i=f.formatNumber(l,"f1")+" gr"}else{i=f.formatNumber(l/1000,"f1")+" kg"}}return'<span style="margin: 4px; margin-top: 6px; float: right;">'+i+"</span>"}},{text:"",datafield:"Wijzig",columntype:"button",width:100,align:"center",menu:false,cellsrenderer:function(){return"Wijzig"},buttonclick:function(g){c=g;$("#popupWindow").jqxWindow({position:{x:110,y:30}});b=$("#jqxgrid").jqxGrid("getrowdata",c);$("#name").val(b.name);$("#alpha").val(b.alpha);$("#beta").val(b.beta);$("#humulene").val(b.humulene);$("#caryophyllene").val(b.caryophyllene);$("#cohumulone").val(b.cohumulone);$("#myrcene").val(b.myrcene);$("#hsi").val(b.hsi);$("#type").val(b.type);$("#form").val(b.form);$("#notes").val(b.notes);$("#origin").val(b.origin);$("#substitutes").val(b.substitutes);$("#always_on_stock").val(b.always_on_stock);$("#inventory").val(b.inventory);$("#cost").val(b.cost);$("#production_date").val(b.production_date);$("#tht_date").val(b.tht_date);$("#total_oil").val(b.total_oil);d(b.cost,b.inventory);$("#popupWindow").jqxWindow("open")}}]});$("#cost").on("change",function(g){b.cost=parseFloat(g.args.value);d(b.cost,b.inventory)});$("#inventory").on("change",function(g){b.inventory=parseFloat(g.args.value);d(b.cost,b.inventory)});$("#popupWindow").jqxWindow({width:1050,height:550,resizable:false,theme:theme,isModal:true,autoOpen:false,cancelButton:$("#Cancel"),modalOpacity:0.4});$("#popupWindow").on("open",function(){$("#name").jqxInput("selectAll")});$("#Delete").jqxButton({template:"danger",width:"90px",theme:theme});$("#Delete").click(function(){if(c>=0){$("#eventWindow").jqxWindow("open");$("#delOk").click(function(){var g=$("#jqxgrid").jqxGrid("getrowid",c);$("#jqxgrid").jqxGrid("deleterow",g)})}$("#popupWindow").jqxWindow("hide")});$("#Cancel").jqxButton({template:"primary",width:"90px",theme:theme});$("#Clone").jqxButton({template:"warning",width:"90px",theme:theme});$("#Clone").click(function(){var g={record:-1,name:$("#name").val()+" kopie",alpha:parseFloat($("#alpha").jqxNumberInput("decimal")),beta:parseFloat($("#beta").jqxNumberInput("decimal")),humulene:parseFloat($("#humulene").jqxNumberInput("decimal")),caryophyllene:parseFloat($("#caryophyllene").jqxNumberInput("decimal")),cohumulone:parseFloat($("#cohumulone").jqxNumberInput("decimal")),myrcene:parseFloat($("#myrcene").jqxNumberInput("decimal")),hsi:parseFloat($("#hsi").jqxNumberInput("decimal")),type:$("#type").val(),form:$("#form").val(),notes:$("#notes").val(),origin:$("#origin").val(),substitutes:$("#substitutes").val(),always_on_stock:$("#always_on_stock").val(),inventory:0,cost:parseFloat($("#cost").jqxNumberInput("decimal")),production_date:"",tht_date:"",total_oil:parseFloat($("#total_oil").jqxNumberInput("decimal"))};$("#jqxgrid").jqxGrid("addrow",null,g);$("#popupWindow").jqxWindow("hide")});$("#Save").jqxButton({template:"success",width:"90px",theme:theme});$("#Save").click(function(){var h,g=-1;if(c>=0){g=$("#jqxgrid").jqxGrid("getrowid",c)}h={record:g,name:$("#name").val(),alpha:parseFloat($("#alpha").jqxNumberInput("decimal")),beta:parseFloat($("#beta").jqxNumberInput("decimal")),humulene:parseFloat($("#humulene").jqxNumberInput("decimal")),caryophyllene:parseFloat($("#caryophyllene").jqxNumberInput("decimal")),cohumulone:parseFloat($("#cohumulone").jqxNumberInput("decimal")),myrcene:parseFloat($("#myrcene").jqxNumberInput("decimal")),hsi:parseFloat($("#hsi").jqxNumberInput("decimal")),type:$("#type").val(),form:$("#form").val(),notes:$("#notes").val(),origin:$("#origin").val(),substitutes:$("#substitutes").val(),always_on_stock:$("#always_on_stock").val(),inventory:parseFloat($("#inventory").jqxNumberInput("decimal")),cost:parseFloat($("#cost").jqxNumberInput("decimal")),production_date:$("#production_date").val(),tht_date:$("#tht_date").val(),total_oil:parseFloat($("#total_oil").jqxNumberInput("decimal"))};if(c>=0){$("#jqxgrid").jqxGrid("updaterow",g,h)}else{$("#jqxgrid").jqxGrid("addrow",null,h)}$("#popupWindow").jqxWindow("hide")});createDelElements()});
\ No newline at end of file
--- a/www/js/inv_hops.js	Fri Sep 13 16:54:51 2019 +0200
+++ b/www/js/inv_hops.js	Fri Sep 13 20:24:31 2019 +0200
@@ -44,16 +44,15 @@
 
 $(document).ready(function () {
 
-	var dataRecord = {};
-
 	function calcTotal(cost, inventory) {
 
 		$('#totval').val(cost * (inventory / 1000));
 	}
 
-	var url = "includes/db_inventory_hops.php";
+	var dataRecord = {},
+	url = 'includes/db_inventory_hops.php',
 	// prepare the data
-	var source = {
+	source = {
 		datatype: "json",
 		cache: false,
 		datafields: [
@@ -90,8 +89,8 @@
 				data: data,
 				type: "POST",
 				success: function (data, status, xhr) {
-					// delete command is executed.
 					commit(true);
+					location.reload( true );
 				},
 				error: function (jqXHR, textStatus, errorThrown) {
 					commit(false);
@@ -108,6 +107,7 @@
 				type: "POST",
 				success: function (data, status, xhr) {
 					commit(true);
+					location.reload( true );
 				},
 				error: function(jqXHR, textStatus, errorThrown) {
                                         commit(false);
@@ -123,15 +123,18 @@
 				data: data,
 				type: "POST",
 				success: function (data, status, xhr) {
-					// update command is executed.
 					commit(true);
+					location.reload( true );
 				},
 				error: function(jqXHR, textStatus, errorThrown) {
 					commit(false);
 				}
 			});
 		}
-	};
+	},
+	dataAdapter = new $.jqx.dataAdapter(source),
+        editrow = -1;
+
 	// initialize the input fields.
 	$("#name").jqxInput({ theme: theme, width: 640, height: 23 });
 	$("#alpha").jqxNumberInput( Perc1dec );
@@ -171,8 +174,6 @@
 	$("#total_oil").jqxNumberInput( Perc1dec );
 	$("#totval").jqxNumberInput( Show2dec );
 
-	var dataAdapter = new $.jqx.dataAdapter(source);
-	var editrow = -1;
 	// initialize jqxGrid
 	$("#jqxgrid").jqxGrid({
 		width: 1280,
@@ -181,9 +182,10 @@
 		theme: theme,
 		showstatusbar: true,
 		renderstatusbar: function (statusbar) {
-			var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
-			var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
-			var impButton = $("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");
+			var container, addButton, impButton;
+			container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
+			addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
+			impButton = $("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");
 			container.append(addButton);
 			container.append(impButton);
 			statusbar.append(container);
@@ -215,8 +217,7 @@
 				$("#popupWindow").jqxWindow('open');
 			});
 			impButton.click(function (event) {
-				var url="import_ingredients.php?select=hops";
-				window.location.href = url;
+				window.location.href = 'import_ingredients.php?select=hops';
 			});
 		},
 		filterable: true,
@@ -251,8 +252,9 @@
 				return  '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>';
 			  }
 		       	},
-			{ text: '', datafield: 'Wijzig', columntype: 'button', width: 100, align: 'center', menu: false, cellsrenderer: function () {
-				return "Wijzig";
+			{ text: '', datafield: 'Wijzig', columntype: 'button', width: 100, align: 'center', menu: false,
+				cellsrenderer: function () {
+					return "Wijzig";
 				}, buttonclick: function (row) {
 					// open the popup window when the user clicks a button.
 					editrow = row;
@@ -348,16 +350,15 @@
 		};
 		$('#jqxgrid').jqxGrid('addrow', null, row);
 	        $("#popupWindow").jqxWindow('hide');
-		location.reload( true );        // reload ourself.
 	});
 	$("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
 	// update the edited row when the user clicks the 'Save' button.
 	$("#Save").click(function () {
-		var rowID = -1;
+		var row, rowID = -1;
 		if (editrow >= 0) {
-			var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
+			rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
 		}
-		var row = {
+		row = {
 			record: rowID,
 			name: $("#name").val(),
 			alpha: parseFloat($("#alpha").jqxNumberInput('decimal')),
@@ -383,7 +384,6 @@
 			$('#jqxgrid').jqxGrid('updaterow', rowID, row);
 		} else {
 			$('#jqxgrid').jqxGrid('addrow', null, row);
-			location.reload( true );	// reload ourself.
 		}
 		$("#popupWindow").jqxWindow('hide');
 	});
--- a/www/js/inv_miscs-min.js	Fri Sep 13 16:54:51 2019 +0200
+++ b/www/js/inv_miscs-min.js	Fri Sep 13 20:24:31 2019 +0200
@@ -1,1 +1,1 @@
-function createDelElements(){$("#eventWindow").jqxWindow({theme:theme,position:{x:490,y:210},width:300,height:175,resizable:false,isModal:true,modalOpacity:0.4,okButton:$("#delOk"),cancelButton:$("#delCancel"),initContent:function(){$("#delOk").jqxButton({template:"danger",width:"65px",theme:theme});$("#delCancel").jqxButton({template:"success",width:"65px",theme:theme});$("#delCancel").focus()}});$("#eventWindow").jqxWindow("hide")}$(document).ready(function(){var c={};function e(i,h){$("#totval").val(i*(h/1000))}function a(h){if(h){$("#pmpt_cost").html("Prijs per kg:");$("#pmpt_inventory").html("Voorraad gram:")}else{$("#pmpt_cost").html("Prijs per liter:");$("#pmpt_inventory").html("Voorraad ml:")}}var b="includes/db_inventory_miscs.php";var f={datatype:"json",cache:false,datafields:[{name:"record",type:"number"},{name:"name",type:"string"},{name:"type",type:"int"},{name:"use_use",type:"int"},{name:"time",type:"int"},{name:"amount",type:"float"},{name:"amount_is_weight",type:"int"},{name:"use_for",type:"string"},{name:"notes",type:"string"},{name:"always_on_stock",type:"int"},{name:"inventory",type:"float"},{name:"cost",type:"float"},{name:"production_date",type:"string"},{name:"tht_date",type:"string"}],id:"record",url:b,deleterow:function(h,j){var i="delete=true&"+$.param({record:h});$.ajax({dataType:"json",url:b,cache:false,data:i,type:"POST",success:function(l,k,m){j(true)},error:function(k,m,l){j(false)}})},addrow:function(i,l,h,k){var j="insert=true&"+$.param(l);$.ajax({dataType:"json",url:b,cache:false,data:j,type:"POST",success:function(n,m,o){k(true)},error:function(m,o,n){k(false)}})},updaterow:function(h,k,j){var i="update=true&"+$.param(k);$.ajax({dataType:"json",url:b,cache:false,data:i,type:"POST",success:function(m,l,n){j(true)},error:function(l,n,m){j(false)}})}};$("#name").jqxInput({theme:theme,width:640,height:23});$("#notes").jqxInput({theme:theme,width:800,height:100});$("#type").jqxDropDownList({theme:theme,source:MiscTypeAdapter,valueMember:"id",displayMember:"nl",width:180,height:23,autoDropDownHeight:true});$("#use_use").jqxDropDownList({theme:theme,source:MiscUseAdapter,valueMember:"id",displayMember:"nl",width:180,height:23,autoDropDownHeight:true});$("#time").jqxNumberInput(PosInt);$("#amount_is_weight").jqxCheckBox({theme:theme,width:120,height:23});$("#use_for").jqxInput({theme:theme,width:640,height:48});$("#always_on_stock").jqxCheckBox({theme:theme,width:120,height:23});$("#inventory").jqxNumberInput(Spin1dec);$("#production_date").jqxDateTimeInput(Dateopts);$("#cost").jqxNumberInput(Spin2dec);$("#tht_date").jqxDateTimeInput(Dateopts);$("#totval").jqxNumberInput(Show2dec);var g=new $.jqx.dataAdapter(f);var d=-1;$("#jqxgrid").jqxGrid({width:1280,height:630,source:g,theme:theme,showstatusbar:true,renderstatusbar:function(j){var h=$("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");var i=$("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");var k=$("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");h.append(i);h.append(k);j.append(h);i.jqxButton({theme:theme,width:90,height:20});k.jqxButton({theme:theme,width:90,height:20});i.click(function(l){d=-1;$("#popupWindow").jqxWindow({position:{x:110,y:30}});$("#name").val("");$("#type").val(0);$("#use_use").val(0);$("#time").val(0);$("#amount_is_weight").val(1);$("#use_for").val("");$("#notes").val("");$("#always_on_stock").val(0);$("#inventory").val(0);$("#cost").val(0);$("#production_date").val("");$("#tht_date").val("");$("#popupWindow").jqxWindow("open")});k.click(function(m){var l="import_ingredients.php?select=miscs";window.location.href=l})},filterable:true,filtermode:"excel",columns:[{text:"Ingredient naam",datafield:"name",menu:false},{text:"Type",datafield:"type",align:"left",width:120,cellsrenderer:function(i,h,l,k,j,m){return"<span style='margin: 3px; margin-top: 6px; float: left;'>"+MiscTypeData[l].nl+"</span>"}},{text:"Gebruik",datafield:"use_use",align:"left",width:120,cellsrenderer:function(i,h,l,k,j,m){return"<span style='margin: 3px; margin-top: 6px; float: left;'>"+MiscUseData[l].nl+"</span>"}},{text:"Tijd",datafield:"time",width:90,align:"left",menu:false,cellsrenderer:function(i,h,l,k,j,n){var m="";if(l>0){if(l==1){m="1 minuut"}else{if(l<60){m=g.formatNumber(l,"f0")+" minuten"}else{if(l==60){m="1 uur"}else{if(l<1440){m=g.formatNumber(l/60,"f0")+" uren"}else{if(l==1440){m="1 dag"}else{m=g.formatNumber(l/1440,"f0")+" dagen"}}}}}}return"<span style='margin: 3px; margin-top: 6px; float: left;'>"+m+"</span>"}},{text:"Voorraad",datafield:"inventory",width:110,menu:false,align:"right",cellsrenderer:function(i,h,m,l,k,n){var j="";if(m>0){if(n.amount_is_weight){j=g.formatNumber(m,"f1")+" gr"}else{j=g.formatNumber(m,"f1")+" ml"}}return"<span style='margin: 3px; margin-top: 6px; float: right;'>"+j+"</span>"}},{text:"THT datum",datafield:"tht_date",width:100,menu:false,align:"center",cellsalign:"center"},{text:"",datafield:"Edit",columntype:"button",width:100,menu:false,align:"center",cellsrenderer:function(){return"Wijzig"},buttonclick:function(h){d=h;$("#popupWindow").jqxWindow({position:{x:110,y:30}});c=$("#jqxgrid").jqxGrid("getrowdata",d);$("#name").val(c.name);$("#type").val(c.type);$("#use_use").val(c.use_use);$("#time").val(c.time);$("#amount_is_weight").val(c.amount_is_weight);$("#use_for").val(c.use_for);$("#notes").val(c.notes);$("#always_on_stock").val(c.always_on_stock);$("#inventory").val(c.inventory);$("#cost").val(c.cost);$("#production_date").val(c.production_date);$("#tht_date").val(c.tht_date);e(c.cost,c.inventory);a(c.amount_is_weight);$("#popupWindow").jqxWindow("open")}}]});$("#cost").on("change",function(h){c.cost=parseFloat(h.args.value);e(c.cost,c.inventory)});$("#inventory").on("change",function(h){c.inventory=parseFloat(h.args.value);e(c.cost,c.inventory)});$("#amount_is_weight").on("checked",function(h){c.amount_is_weight=true;a(true)});$("#amount_is_weight").on("unchecked",function(h){c.amount_is_weight=false;a(false)});$("#popupWindow").jqxWindow({width:1050,height:550,resizable:false,theme:theme,isModal:true,autoOpen:false,cancelButton:$("#Cancel"),modalOpacity:0.4});$("#popupWindow").on("open",function(){$("#name").jqxInput("selectAll")});$("#Delete").jqxButton({template:"danger",width:"90px",theme:theme});$("#Delete").click(function(){if(d>=0){$("#eventWindow").jqxWindow("open");$("#delOk").click(function(){var h=$("#jqxgrid").jqxGrid("getrowid",d);$("#jqxgrid").jqxGrid("deleterow",h)})}$("#popupWindow").jqxWindow("hide")});$("#Cancel").jqxButton({template:"primary",width:"90px",theme:theme});$("#Save").jqxButton({template:"success",width:"90px",theme:theme});$("#Save").click(function(){var h=-1;if(d>=0){h=$("#jqxgrid").jqxGrid("getrowid",d)}var i={record:h,name:$("#name").val(),type:$("#type").val(),use_use:$("#use_use").val(),time:parseFloat($("#time").jqxNumberInput("decimal")),amount_is_weight:$("#amount_is_weight").val(),use_for:$("#use_for").val(),notes:$("#notes").val(),always_on_stock:$("#always_on_stock").val(),inventory:parseFloat($("#inventory").jqxNumberInput("decimal")),cost:parseFloat($("#cost").jqxNumberInput("decimal")),production_date:$("#production_date").val(),tht_date:$("#tht_date").val()};if(d>=0){$("#jqxgrid").jqxGrid("updaterow",h,i)}else{$("#jqxgrid").jqxGrid("addrow",null,i);location.reload(true)}$("#popupWindow").jqxWindow("hide")});createDelElements()});
\ No newline at end of file
+function createDelElements(){$("#eventWindow").jqxWindow({theme:theme,position:{x:490,y:210},width:300,height:175,resizable:false,isModal:true,modalOpacity:0.4,okButton:$("#delOk"),cancelButton:$("#delCancel"),initContent:function(){$("#delOk").jqxButton({template:"danger",width:"65px",theme:theme});$("#delCancel").jqxButton({template:"success",width:"65px",theme:theme});$("#delCancel").focus()}});$("#eventWindow").jqxWindow("hide")}$(document).ready(function(){function e(i,h){$("#totval").val(i*(h/1000))}function a(h){if(h){$("#pmpt_cost").html("Prijs per kg:");$("#pmpt_inventory").html("Voorraad gram:")}else{$("#pmpt_cost").html("Prijs per liter:");$("#pmpt_inventory").html("Voorraad ml:")}}var c={},b="includes/db_inventory_miscs.php",f={datatype:"json",cache:false,datafields:[{name:"record",type:"number"},{name:"name",type:"string"},{name:"type",type:"int"},{name:"use_use",type:"int"},{name:"time",type:"int"},{name:"amount",type:"float"},{name:"amount_is_weight",type:"int"},{name:"use_for",type:"string"},{name:"notes",type:"string"},{name:"always_on_stock",type:"int"},{name:"inventory",type:"float"},{name:"cost",type:"float"},{name:"production_date",type:"string"},{name:"tht_date",type:"string"}],id:"record",url:b,deleterow:function(h,j){var i="delete=true&"+$.param({record:h});$.ajax({dataType:"json",url:b,cache:false,data:i,type:"POST",success:function(l,k,m){j(true);location.reload(true)},error:function(k,m,l){j(false)}})},addrow:function(i,l,h,k){var j="insert=true&"+$.param(l);$.ajax({dataType:"json",url:b,cache:false,data:j,type:"POST",success:function(n,m,o){k(true);location.reload(true)},error:function(m,o,n){k(false)}})},updaterow:function(h,k,j){var i="update=true&"+$.param(k);$.ajax({dataType:"json",url:b,cache:false,data:i,type:"POST",success:function(m,l,n){j(true);location.reload(true)},error:function(l,n,m){j(false)}})}},g=new $.jqx.dataAdapter(f),d=-1;$("#name").jqxInput({theme:theme,width:640,height:23});$("#notes").jqxInput({theme:theme,width:800,height:100});$("#type").jqxDropDownList({theme:theme,source:MiscTypeAdapter,valueMember:"id",displayMember:"nl",width:180,height:23,autoDropDownHeight:true});$("#use_use").jqxDropDownList({theme:theme,source:MiscUseAdapter,valueMember:"id",displayMember:"nl",width:180,height:23,autoDropDownHeight:true});$("#time").jqxNumberInput(PosInt);$("#amount_is_weight").jqxCheckBox({theme:theme,width:120,height:23});$("#use_for").jqxInput({theme:theme,width:640,height:48});$("#always_on_stock").jqxCheckBox({theme:theme,width:120,height:23});$("#inventory").jqxNumberInput(Spin1dec);$("#production_date").jqxDateTimeInput(Dateopts);$("#cost").jqxNumberInput(Spin2dec);$("#tht_date").jqxDateTimeInput(Dateopts);$("#totval").jqxNumberInput(Show2dec);$("#jqxgrid").jqxGrid({width:1280,height:630,source:g,theme:theme,showstatusbar:true,renderstatusbar:function(j){var h,i,k;h=$("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");i=$("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");k=$("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");h.append(i);h.append(k);j.append(h);i.jqxButton({theme:theme,width:90,height:20});k.jqxButton({theme:theme,width:90,height:20});i.click(function(l){d=-1;$("#popupWindow").jqxWindow({position:{x:110,y:30}});$("#name").val("");$("#type").val(0);$("#use_use").val(0);$("#time").val(0);$("#amount_is_weight").val(1);$("#use_for").val("");$("#notes").val("");$("#always_on_stock").val(0);$("#inventory").val(0);$("#cost").val(0);$("#production_date").val("");$("#tht_date").val("");$("#popupWindow").jqxWindow("open")});k.click(function(l){window.location.href="import_ingredients.php?select=miscs"})},filterable:true,filtermode:"excel",columns:[{text:"Ingredient naam",datafield:"name",menu:false},{text:"Type",datafield:"type",align:"left",width:120,cellsrenderer:function(i,h,l,k,j,m){return"<span style='margin: 3px; margin-top: 6px; float: left;'>"+MiscTypeData[l].nl+"</span>"}},{text:"Gebruik",datafield:"use_use",align:"left",width:120,cellsrenderer:function(i,h,l,k,j,m){return"<span style='margin: 3px; margin-top: 6px; float: left;'>"+MiscUseData[l].nl+"</span>"}},{text:"Tijd",datafield:"time",width:90,align:"left",menu:false,cellsrenderer:function(i,h,l,k,j,n){var m="";if(l>0){if(l==1){m="1 minuut"}else{if(l<60){m=g.formatNumber(l,"f0")+" minuten"}else{if(l==60){m="1 uur"}else{if(l<1440){m=g.formatNumber(l/60,"f0")+" uren"}else{if(l==1440){m="1 dag"}else{m=g.formatNumber(l/1440,"f0")+" dagen"}}}}}}return"<span style='margin: 3px; margin-top: 6px; float: left;'>"+m+"</span>"}},{text:"Voorraad",datafield:"inventory",width:110,menu:false,align:"right",cellsrenderer:function(i,h,m,l,k,n){var j="";if(m>0){if(n.amount_is_weight){j=g.formatNumber(m,"f1")+" gr"}else{j=g.formatNumber(m,"f1")+" ml"}}return"<span style='margin: 3px; margin-top: 6px; float: right;'>"+j+"</span>"}},{text:"THT datum",datafield:"tht_date",width:100,menu:false,align:"center",cellsalign:"center"},{text:"",datafield:"Edit",columntype:"button",width:100,menu:false,align:"center",cellsrenderer:function(){return"Wijzig"},buttonclick:function(h){d=h;$("#popupWindow").jqxWindow({position:{x:110,y:30}});c=$("#jqxgrid").jqxGrid("getrowdata",d);$("#name").val(c.name);$("#type").val(c.type);$("#use_use").val(c.use_use);$("#time").val(c.time);$("#amount_is_weight").val(c.amount_is_weight);$("#use_for").val(c.use_for);$("#notes").val(c.notes);$("#always_on_stock").val(c.always_on_stock);$("#inventory").val(c.inventory);$("#cost").val(c.cost);$("#production_date").val(c.production_date);$("#tht_date").val(c.tht_date);e(c.cost,c.inventory);a(c.amount_is_weight);$("#popupWindow").jqxWindow("open")}}]});$("#cost").on("change",function(h){c.cost=parseFloat(h.args.value);e(c.cost,c.inventory)});$("#inventory").on("change",function(h){c.inventory=parseFloat(h.args.value);e(c.cost,c.inventory)});$("#amount_is_weight").on("checked",function(h){c.amount_is_weight=true;a(true)});$("#amount_is_weight").on("unchecked",function(h){c.amount_is_weight=false;a(false)});$("#popupWindow").jqxWindow({width:1050,height:550,resizable:false,theme:theme,isModal:true,autoOpen:false,cancelButton:$("#Cancel"),modalOpacity:0.4});$("#popupWindow").on("open",function(){$("#name").jqxInput("selectAll")});$("#Delete").jqxButton({template:"danger",width:"90px",theme:theme});$("#Delete").click(function(){if(d>=0){$("#eventWindow").jqxWindow("open");$("#delOk").click(function(){var h=$("#jqxgrid").jqxGrid("getrowid",d);$("#jqxgrid").jqxGrid("deleterow",h)})}$("#popupWindow").jqxWindow("hide")});$("#Cancel").jqxButton({template:"primary",width:"90px",theme:theme});$("#Save").jqxButton({template:"success",width:"90px",theme:theme});$("#Save").click(function(){var i,h=-1;if(d>=0){h=$("#jqxgrid").jqxGrid("getrowid",d)}i={record:h,name:$("#name").val(),type:$("#type").val(),use_use:$("#use_use").val(),time:parseFloat($("#time").jqxNumberInput("decimal")),amount_is_weight:$("#amount_is_weight").val(),use_for:$("#use_for").val(),notes:$("#notes").val(),always_on_stock:$("#always_on_stock").val(),inventory:parseFloat($("#inventory").jqxNumberInput("decimal")),cost:parseFloat($("#cost").jqxNumberInput("decimal")),production_date:$("#production_date").val(),tht_date:$("#tht_date").val()};if(d>=0){$("#jqxgrid").jqxGrid("updaterow",h,i)}else{$("#jqxgrid").jqxGrid("addrow",null,i)}$("#popupWindow").jqxWindow("hide")});createDelElements()});
\ No newline at end of file
--- a/www/js/inv_miscs.js	Fri Sep 13 16:54:51 2019 +0200
+++ b/www/js/inv_miscs.js	Fri Sep 13 20:24:31 2019 +0200
@@ -42,8 +42,6 @@
 
 $(document).ready(function () {
 
-	var dataRecord = {};
-
 	function calcTotal(cost, inventory) {
 
 		$('#totval').val(cost * (inventory / 1000));
@@ -60,9 +58,10 @@
 		}
 	}
 
-	var url = "includes/db_inventory_miscs.php";
+	var dataRecord = {},
+	url = 'includes/db_inventory_miscs.php',
 	// prepare the data
-	var source = {
+	source = {
 		datatype: "json",
 		cache: false,
 		datafields: [
@@ -93,8 +92,8 @@
 				data: data,
 				type: "POST",
 				success: function (data, status, xhr) {
-					// delete command is executed.
 					commit(true);
+					location.reload( true );
 				},
 				error: function (jqXHR, textStatus, errorThrown) {
 					commit(false);
@@ -111,6 +110,7 @@
 				type: "POST",
 				success: function (data, status, xhr) {
 					commit(true);
+					location.reload( true );
 				},
 				error: function(jqXHR, textStatus, errorThrown) {
                                         commit(false);
@@ -126,15 +126,18 @@
 				data: data,
 				type: "POST",
 				success: function (data, status, xhr) {
-					// update command is executed.
 					commit(true);
+					location.reload( true );
 				},
 				error: function(jqXHR, textStatus, errorThrown) {
 					commit(false);
 				}
 			});
 		}
-	};
+	},
+	dataAdapter = new $.jqx.dataAdapter(source),
+        editrow = -1;
+
 	// initialize the input fields.
 	$("#name").jqxInput({ theme: theme, width: 640, height: 23 });
 	$("#notes").jqxInput({ theme: theme, width: 800, height: 100 });
@@ -166,8 +169,6 @@
 	$("#tht_date").jqxDateTimeInput( Dateopts );
 	$("#totval").jqxNumberInput( Show2dec );
 
-	var dataAdapter = new $.jqx.dataAdapter(source);
-	var editrow = -1;
 	// initialize jqxGrid
 	$("#jqxgrid").jqxGrid({
 		width: 1280,
@@ -176,9 +177,10 @@
 		theme: theme,
 		showstatusbar: true,
 		renderstatusbar: function (statusbar) {
-			var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
-			var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
-			var impButton = $("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");
+			var container, addButton, impButton;
+			container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
+			addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
+			impButton = $("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");
 			container.append(addButton);
 			container.append(impButton);
 			statusbar.append(container);
@@ -203,8 +205,7 @@
 				$("#popupWindow").jqxWindow('open');
 			});
 			impButton.click(function (event) {
-				var url="import_ingredients.php?select=miscs";
-				window.location.href = url;
+				window.location.href = 'import_ingredients.php?select=miscs';
 			});
 		},
 		filterable: true,
@@ -254,8 +255,9 @@
 			  }
 		       	},
 			{ text: 'THT datum', datafield: 'tht_date', width: 100, menu: false, align: 'center', cellsalign: 'center' },
-			{ text: '', datafield: 'Edit', columntype: 'button', width: 100, menu: false, align: 'center', cellsrenderer: function () {
-				return "Wijzig";
+			{ text: '', datafield: 'Edit', columntype: 'button', width: 100, menu: false, align: 'center',
+				cellsrenderer: function () {
+					return "Wijzig";
 				}, buttonclick: function (row) {
 					// open the popup window when the user clicks a button.
 					editrow = row;
@@ -330,11 +332,11 @@
 	$("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
 	// update the edited row when the user clicks the 'Save' button.
 	$("#Save").click(function () {
-		var rowID = -1;
+		var row, rowID = -1;
 		if (editrow >= 0) {
 			rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
 		}
-		var row = {
+		row = {
 			record: rowID,
 			name: $("#name").val(),
 			type: $("#type").val(),
@@ -353,7 +355,6 @@
 			$('#jqxgrid').jqxGrid('updaterow', rowID, row);
 		} else {
 			$('#jqxgrid').jqxGrid('addrow', null, row);
-			location.reload( true );	// reload ourself.
 		}
 		$("#popupWindow").jqxWindow('hide');
 	});
--- a/www/js/inv_suppliers-min.js	Fri Sep 13 16:54:51 2019 +0200
+++ b/www/js/inv_suppliers-min.js	Fri Sep 13 20:24:31 2019 +0200
@@ -1,1 +1,1 @@
-function createDelElements(){$("#eventWindow").jqxWindow({theme:theme,position:{x:490,y:210},width:300,height:175,resizable:false,isModal:true,modalOpacity:0.4,okButton:$("#delOk"),cancelButton:$("#delCancel"),initContent:function(){$("#delOk").jqxButton({template:"danger",width:"65px",theme:theme});$("#delCancel").jqxButton({template:"success",width:"65px",theme:theme});$("#delCancel").focus()}});$("#eventWindow").jqxWindow("hide")}$(document).ready(function(){var a="includes/db_inventory_suppliers.php";$("#name").jqxTooltip({content:"De naam van de leverancier."});$("#address").jqxTooltip({content:"Het adres en huisnummer."});$("#city").jqxTooltip({content:"De woonplaats of gemeente."});$("#zip").jqxTooltip({content:"De postcode."});$("#country").jqxTooltip({content:"Het land."});$("#website").jqxTooltip({content:"Het website adres."});$("#email").jqxTooltip({content:"Het email adres."});$("#phone").jqxTooltip({content:"Het telefoon nummer."});$("#notes").jqxTooltip({content:"Opmerkingen over deze leverancier."});var c={datatype:"json",cache:false,datafields:[{name:"record",type:"number"},{name:"name",type:"string"},{name:"address",type:"string"},{name:"city",type:"string"},{name:"zip",type:"string"},{name:"country",type:"string"},{name:"website",type:"string"},{name:"email",type:"string"},{name:"phone",type:"string"},{name:"notes",type:"string"}],id:"record",url:a,deleterow:function(e,g){var f="delete=true&"+$.param({record:e});$.ajax({dataType:"json",url:a,cache:false,data:f,type:"POST",success:function(i,h,j){g(true)},error:function(h,j,i){g(false)}})},addrow:function(f,i,e,h){var g="insert=true&"+$.param(i);$.ajax({dataType:"json",url:a,cache:false,data:g,type:"POST",success:function(k,j,l){h(true)},error:function(j,l,k){h(false)}})},updaterow:function(e,h,g){var f="update=true&"+$.param(h);$.ajax({dataType:"json",url:a,cache:false,data:f,type:"POST",success:function(j,i,k){g(true)},error:function(i,k,j){g(false)}})}};$("#name").jqxInput({theme:theme,width:640,height:23});$("#address").jqxInput({theme:theme,width:350,height:23});$("#zip").jqxInput({theme:theme,width:120,height:23});$("#city").jqxInput({theme:theme,width:350,height:23});$("#country").jqxInput({theme:theme,width:250,height:23});$("#website").jqxInput({theme:theme,width:640,height:23});$("#email").jqxInput({theme:theme,width:640,height:23});$("#phone").jqxInput({theme:theme,width:175,height:23});$("#notes").jqxInput({theme:theme,width:800,height:100});var d=new $.jqx.dataAdapter(c);var b=-1;$("#jqxgrid").jqxGrid({width:1280,height:630,source:d,theme:theme,showstatusbar:true,renderstatusbar:function(g){var e=$("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");var f=$("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");e.append(f);g.append(e);f.jqxButton({theme:theme,width:90,height:20});f.click(function(h){b=-1;$("#popupWindow").jqxWindow({position:{x:110,y:30}});$("#name").val("Nieuwe leverancier");$("#address").val("");$("#city").val("");$("#zip").val("");$("#country").val("Nederland");$("#website").val("");$("#email").val("");$("#phone").val("");$("#notes").val("");$("#popupWindow").jqxWindow("open")})},filterable:false,columns:[{text:"Leverancier naam",datafield:"name"},{text:"Adres",datafield:"address",width:300},{text:"Plaats",datafield:"city",width:250},{text:"Land",datafield:"country",width:200},{text:"Telefoon",datafield:"phone",width:175},{text:"Wijzig",datafield:"Edit",width:100,align:"center",columntype:"button",cellsrenderer:function(){return"Wijzig"},buttonclick:function(f){b=f;$("#popupWindow").jqxWindow({position:{x:110,y:30}});var e=$("#jqxgrid").jqxGrid("getrowdata",b);$("#name").val(e.name);$("#address").val(e.address);$("#city").val(e.city);$("#zip").val(e.zip);$("#country").val(e.country);$("#website").val(e.website);$("#email").val(e.email);$("#phone").val(e.phone);$("#notes").val(e.notes);$("#popupWindow").jqxWindow("open")}}]});$("#popupWindow").jqxWindow({width:1050,height:550,resizable:false,theme:theme,isModal:true,autoOpen:false,cancelButton:$("#Cancel"),modalOpacity:0.4});$("#popupWindow").on("open",function(){$("#name").jqxInput("selectAll")});$("#Delete").jqxButton({template:"danger",width:"90px",theme:theme});$("#Delete").click(function(){if(b>=0){$("#eventWindow").jqxWindow("open");$("#delOk").click(function(){var e=$("#jqxgrid").jqxGrid("getrowid",b);$("#jqxgrid").jqxGrid("deleterow",e)})}$("#popupWindow").jqxWindow("hide")});$("#Cancel").jqxButton({template:"primary",width:"90px",theme:theme});$("#Save").jqxButton({template:"success",width:"90px",theme:theme});$("#Save").click(function(){var e=-1;if(b>=0){e=$("#jqxgrid").jqxGrid("getrowid",b)}var f={record:e,name:$("#name").val(),address:$("#address").val(),city:$("#city").val(),zip:$("#zip").val(),country:$("#country").val(),website:$("#website").val(),email:$("#email").val(),phone:$("#phone").val(),notes:$("#notes").val()};if(b>=0){$("#jqxgrid").jqxGrid("updaterow",e,f)}else{$("#jqxgrid").jqxGrid("addrow",null,f)}$("#popupWindow").jqxWindow("hide");location.reload(true)});createDelElements()});
\ No newline at end of file
+function createDelElements(){$("#eventWindow").jqxWindow({theme:theme,position:{x:490,y:210},width:300,height:175,resizable:false,isModal:true,modalOpacity:0.4,okButton:$("#delOk"),cancelButton:$("#delCancel"),initContent:function(){$("#delOk").jqxButton({template:"danger",width:"65px",theme:theme});$("#delCancel").jqxButton({template:"success",width:"65px",theme:theme});$("#delCancel").focus()}});$("#eventWindow").jqxWindow("hide")}$(document).ready(function(){$("#name").jqxTooltip({content:"De naam van de leverancier."});$("#address").jqxTooltip({content:"Het adres en huisnummer."});$("#city").jqxTooltip({content:"De woonplaats of gemeente."});$("#zip").jqxTooltip({content:"De postcode."});$("#country").jqxTooltip({content:"Het land."});$("#website").jqxTooltip({content:"Het website adres."});$("#email").jqxTooltip({content:"Het email adres."});$("#phone").jqxTooltip({content:"Het telefoon nummer."});$("#notes").jqxTooltip({content:"Opmerkingen over deze leverancier."});var a="includes/db_inventory_suppliers.php",c={datatype:"json",cache:false,datafields:[{name:"record",type:"number"},{name:"name",type:"string"},{name:"address",type:"string"},{name:"city",type:"string"},{name:"zip",type:"string"},{name:"country",type:"string"},{name:"website",type:"string"},{name:"email",type:"string"},{name:"phone",type:"string"},{name:"notes",type:"string"}],id:"record",url:a,deleterow:function(e,g){var f="delete=true&"+$.param({record:e});$.ajax({dataType:"json",url:a,cache:false,data:f,type:"POST",success:function(i,h,j){g(true);location.reload(true)},error:function(h,j,i){g(false)}})},addrow:function(f,i,e,h){var g="insert=true&"+$.param(i);$.ajax({dataType:"json",url:a,cache:false,data:g,type:"POST",success:function(k,j,l){h(true);location.reload(true)},error:function(j,l,k){h(false)}})},updaterow:function(e,h,g){var f="update=true&"+$.param(h);$.ajax({dataType:"json",url:a,cache:false,data:f,type:"POST",success:function(j,i,k){g(true);location.reload(true)},error:function(i,k,j){g(false)}})}},d=new $.jqx.dataAdapter(c),b=-1;$("#name").jqxInput({theme:theme,width:640,height:23});$("#address").jqxInput({theme:theme,width:350,height:23});$("#zip").jqxInput({theme:theme,width:120,height:23});$("#city").jqxInput({theme:theme,width:350,height:23});$("#country").jqxInput({theme:theme,width:250,height:23});$("#website").jqxInput({theme:theme,width:640,height:23});$("#email").jqxInput({theme:theme,width:640,height:23});$("#phone").jqxInput({theme:theme,width:175,height:23});$("#notes").jqxInput({theme:theme,width:800,height:100});$("#jqxgrid").jqxGrid({width:1280,height:630,source:d,theme:theme,showstatusbar:true,renderstatusbar:function(g){var f,e=$("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");f=$("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");e.append(f);g.append(e);f.jqxButton({theme:theme,width:90,height:20});f.click(function(h){b=-1;$("#popupWindow").jqxWindow({position:{x:110,y:30}});$("#name").val("Nieuwe leverancier");$("#address").val("");$("#city").val("");$("#zip").val("");$("#country").val("Nederland");$("#website").val("");$("#email").val("");$("#phone").val("");$("#notes").val("");$("#popupWindow").jqxWindow("open")})},filterable:false,columns:[{text:"Leverancier naam",datafield:"name"},{text:"Adres",datafield:"address",width:300},{text:"Plaats",datafield:"city",width:250},{text:"Land",datafield:"country",width:200},{text:"Telefoon",datafield:"phone",width:175},{text:"Wijzig",datafield:"Edit",width:100,align:"center",columntype:"button",cellsrenderer:function(){return"Wijzig"},buttonclick:function(f){b=f;$("#popupWindow").jqxWindow({position:{x:110,y:30}});var e=$("#jqxgrid").jqxGrid("getrowdata",b);$("#name").val(e.name);$("#address").val(e.address);$("#city").val(e.city);$("#zip").val(e.zip);$("#country").val(e.country);$("#website").val(e.website);$("#email").val(e.email);$("#phone").val(e.phone);$("#notes").val(e.notes);$("#popupWindow").jqxWindow("open")}}]});$("#popupWindow").jqxWindow({width:1050,height:550,resizable:false,theme:theme,isModal:true,autoOpen:false,cancelButton:$("#Cancel"),modalOpacity:0.4});$("#popupWindow").on("open",function(){$("#name").jqxInput("selectAll")});$("#Delete").jqxButton({template:"danger",width:"90px",theme:theme});$("#Delete").click(function(){if(b>=0){$("#eventWindow").jqxWindow("open");$("#delOk").click(function(){var e=$("#jqxgrid").jqxGrid("getrowid",b);$("#jqxgrid").jqxGrid("deleterow",e)})}$("#popupWindow").jqxWindow("hide")});$("#Cancel").jqxButton({template:"primary",width:"90px",theme:theme});$("#Save").jqxButton({template:"success",width:"90px",theme:theme});$("#Save").click(function(){var f,e=-1;if(b>=0){e=$("#jqxgrid").jqxGrid("getrowid",b)}f={record:e,name:$("#name").val(),address:$("#address").val(),city:$("#city").val(),zip:$("#zip").val(),country:$("#country").val(),website:$("#website").val(),email:$("#email").val(),phone:$("#phone").val(),notes:$("#notes").val()};if(b>=0){$("#jqxgrid").jqxGrid("updaterow",e,f)}else{$("#jqxgrid").jqxGrid("addrow",null,f)}$("#popupWindow").jqxWindow("hide")});createDelElements()});
\ No newline at end of file
--- a/www/js/inv_suppliers.js	Fri Sep 13 16:54:51 2019 +0200
+++ b/www/js/inv_suppliers.js	Fri Sep 13 20:24:31 2019 +0200
@@ -45,7 +45,7 @@
 
 
 $(document).ready(function () {
-	var url = "includes/db_inventory_suppliers.php";
+
 	// tooltips
 	$("#name").jqxTooltip({ content: 'De naam van de leverancier.' });
 	$("#address").jqxTooltip({ content: 'Het adres en huisnummer.' });
@@ -56,8 +56,10 @@
 	$("#email").jqxTooltip({ content: 'Het email adres.' });
 	$("#phone").jqxTooltip({ content: 'Het telefoon nummer.' });
 	$("#notes").jqxTooltip({ content: 'Opmerkingen over deze leverancier.' });
+
+	var url = 'includes/db_inventory_suppliers.php',
 	// prepare the data
-	var source = {
+	source = {
 		datatype: "json",
 		cache: false,
 		datafields: [
@@ -84,8 +86,8 @@
 				data: data,
 				type: "POST",
 				success: function (data, status, xhr) {
-					// delete command is executed.
 					commit(true);
+					location.reload( true );
 				},
 				error: function (jqXHR, textStatus, errorThrown) {
 					commit(false);
@@ -102,6 +104,7 @@
 				type: "POST",
 				success: function (data, status, xhr) {
 					commit(true);
+					location.reload( true );
 				},
 				error: function(jqXHR, textStatus, errorThrown) {
                                         commit(false);
@@ -117,15 +120,18 @@
 				data: data,
 				type: "POST",
 				success: function (data, status, xhr) {
-					// update command is executed.
 					commit(true);
+					location.reload( true );
 				},
 				error: function(jqXHR, textStatus, errorThrown) {
 					commit(false);
 				}
 			});
 		}
-	};
+	},
+	dataAdapter = new $.jqx.dataAdapter(source),
+        editrow = -1;
+
 	// initialize the input fields.
 	$("#name").jqxInput({ theme: theme, width: 640, height: 23 });
 	$("#address").jqxInput({ theme: theme, width: 350, height: 23 });
@@ -137,8 +143,6 @@
 	$("#phone").jqxInput({ theme: theme, width: 175, height: 23 });
 	$("#notes").jqxInput({ theme: theme, width: 800, height: 100 });
 
-	var dataAdapter = new $.jqx.dataAdapter(source);
-	var editrow = -1;
 	// initialize jqxGrid
 	$("#jqxgrid").jqxGrid({
 		width: 1280,
@@ -147,8 +151,8 @@
 		theme: theme,
 		showstatusbar: true,
 		renderstatusbar: function (statusbar) {
-			var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
-			var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
+			var addButton, container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
+			addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
 			container.append(addButton);
 			statusbar.append(container);
 			addButton.jqxButton({ theme: theme, width: 90, height: 20 });
@@ -175,8 +179,9 @@
 			{ text: 'Plaats', datafield: 'city', width: 250 },
 			{ text: 'Land', datafield: 'country', width: 200 },
 			{ text: 'Telefoon', datafield: 'phone', width: 175 },
-			{ text: 'Wijzig', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer: function () {
-				return "Wijzig";
+			{ text: 'Wijzig', datafield: 'Edit', width: 100, align: 'center', columntype: 'button',
+				cellsrenderer: function () {
+					return "Wijzig";
 				}, buttonclick: function (row) {
 					// open the popup window when the user clicks a button.
 					editrow = row;
@@ -228,11 +233,11 @@
 	$("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
 	// update the edited row when the user clicks the 'Save' button.
 	$("#Save").click(function () {
-		var rowID = -1;
+		var row, rowID = -1;
 		if (editrow >= 0) {
 			rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
 		}
-		var row = {
+		row = {
 			record: rowID,
 			name: $("#name").val(),
 			address: $("#address").val(),
@@ -250,7 +255,6 @@
 			$('#jqxgrid').jqxGrid('addrow', null, row);
 		}
 		$("#popupWindow").jqxWindow('hide');
-		location.reload( true );        // reload ourself.
 	});
 	createDelElements();
 });
--- a/www/js/inv_waters-min.js	Fri Sep 13 16:54:51 2019 +0200
+++ b/www/js/inv_waters-min.js	Fri Sep 13 20:24:31 2019 +0200
@@ -1,1 +1,1 @@
-function createDelElements(){$("#eventWindow").jqxWindow({theme:theme,position:{x:490,y:210},width:300,height:175,resizable:false,isModal:true,modalOpacity:0.4,okButton:$("#delOk"),cancelButton:$("#delCancel"),initContent:function(){$("#delOk").jqxButton({template:"danger",width:"65px",theme:theme});$("#delCancel").jqxButton({template:"success",width:"65px",theme:theme});$("#delCancel").focus()}});$("#eventWindow").jqxWindow("hide")}$(document).ready(function(){var b={};var a="includes/db_inventory_water.php";$("#name").jqxTooltip({content:"De unieke naam van dit brouwwater."});$("#notes").jqxTooltip({content:"Extra opmerkingen over dit water."});$("#unlimited_stock").jqxTooltip({content:"Onbeperkte voorraad zoals kraanwater en bronnen."});$("#calcium").jqxTooltip({content:"Calcium (Ca)."});$("#bicarbonate").jqxTooltip({content:"Bicarbonaat (HCO3). Berekend meteen de Totale alkaliteit."});$("#sulfate").jqxTooltip({content:"Calcium Sulfaat (CaSO4)."});$("#chloride").jqxTooltip({content:"Chloride (Cl)."});$("#sodium").jqxTooltip({content:"Natrium, oftewel keukenzout (Na). In berekeningen ook vaak als Sodium."});$("#magnesium").jqxTooltip({content:"Magnesium (Mg)."});$("#ph").jqxTooltip({content:"De zuurgraad (pH)."});$("#total_alkalinity").jqxTooltip({content:"Totale alkaliniteit. Berekend meteen de Bicarbonaat."});$("#inventory").jqxTooltip({content:"Voorraad in liters."});$("#cost").jqxTooltip({content:"Kostprijs per liter. 5 cijfers achter de comma zodat het kraanwater er ook in kan."});var d={datatype:"json",cache:false,datafields:[{name:"record",type:"number"},{name:"name",type:"string"},{name:"unlimited_stock",type:"int"},{name:"calcium",type:"float"},{name:"bicarbonate",type:"float"},{name:"sulfate",type:"float"},{name:"chloride",type:"float"},{name:"sodium",type:"float"},{name:"magnesium",type:"float"},{name:"ph",type:"float"},{name:"notes",type:"string"},{name:"total_alkalinity",type:"float"},{name:"inventory",type:"float"},{name:"cost",type:"float"}],id:"record",url:a,deleterow:function(f,h){var g="delete=true&"+$.param({record:f});$.ajax({dataType:"json",url:a,cache:false,data:g,type:"POST",success:function(j,i,k){h(true)},error:function(i,k,j){h(false)}})},addrow:function(g,j,f,i){var h="insert=true&"+$.param(j);$.ajax({dataType:"json",url:a,cache:false,data:h,type:"POST",success:function(l,k,m){i(true)},error:function(k,m,l){i(false)}})},updaterow:function(f,i,h){var g="update=true&"+$.param(i);$.ajax({dataType:"json",url:a,cache:false,data:g,type:"POST",success:function(k,j,l){h(true)},error:function(j,l,k){h(false)}})}};$("#name").jqxInput({theme:theme,width:640,height:23});$("#notes").jqxInput({theme:theme,width:640,height:100});$("#unlimited_stock").jqxCheckBox({theme:theme,width:120,height:23});$("#calcium").jqxNumberInput(Spin1dec);$("#bicarbonate").jqxNumberInput(Spin1dec);$("#sulfate").jqxNumberInput(Spin1dec);$("#chloride").jqxNumberInput(Spin1dec);$("#sodium").jqxNumberInput(Spin1dec);$("#magnesium").jqxNumberInput(Spin1dec);$("#ph").jqxNumberInput(Spin2pH);$("#total_alkalinity").jqxNumberInput(Spin1dec);$("#inventory").jqxNumberInput(Spin1dec);$("#cost").jqxNumberInput({inputMode:"simple",theme:theme,width:110,height:23,min:0,decimalDigits:5,spinButtons:true});var e=new $.jqx.dataAdapter(d);var c=-1;$("#jqxgrid").jqxGrid({width:1280,height:630,source:e,theme:theme,showstatusbar:true,renderstatusbar:function(h){var f=$("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");var g=$("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");f.append(g);h.append(f);g.jqxButton({theme:theme,width:90,height:20});g.click(function(i){c=-1;$("#popupWindow").jqxWindow({position:{x:110,y:30}});$("#name").val("Nieuw brouwwater");$("#unlimited_stock").val(0);$("#calcium").val(0);$("#bicarbonate").val(0);$("#sulfate").val(0);$("#chloride").val(0);$("#sodium").val(0);$("#magnesium").val(0);$("#ph").val(7);$("#notes").val("");$("#total_alkalinity").val(0);$("#inventory").val(0);$("#cost").val(0);$("#popupWindow").jqxWindow("open")})},filterable:false,columns:[{text:"Water leverancier",datafield:"name",width:225},{text:"Opmerkingen",datafield:"notes"},{text:"Onbeperkt",datafield:"unlimited_stock",columntype:"checkbox",width:80},{text:"Voorraad",datafield:"inventory",width:100,align:"right",cellsalign:"right",cellsformat:"f1",cellsrenderer:function(g,f,k,j,i,l){var h="";if(k>0&&l.unlimited_stock==0){h=e.formatNumber(k,"f1")+" L"}return"<span style='margin: 3px; margin-top: 6px; float: right;'>"+h+"</span>"}},{text:"",datafield:"Edit",width:100,align:"center",columntype:"button",cellsrenderer:function(){return"Wijzig"},buttonclick:function(g){c=g;$("#popupWindow").jqxWindow({position:{x:110,y:30}});var f=$("#jqxgrid").jqxGrid("getrowdata",c);$("#name").val(f.name);$("#unlimited_stock").val(f.unlimited_stock);$("#calcium").val(f.calcium);$("#bicarbonate").val(f.bicarbonate);$("#sulfate").val(f.sulfate);$("#chloride").val(f.chloride);$("#sodium").val(f.sodium);$("#magnesium").val(f.magnesium);$("#ph").val(f.ph);$("#notes").val(f.notes);$("#total_alkalinity").val(f.total_alkalinity);$("#inventory").val(f.inventory);$("#cost").val(f.cost);$("#popupWindow").jqxWindow("open")}}]});$("#total_alkalinity").on("change",function(f){b.bicarbonate=parseFloat(f.args.value)*1.22;$("#bicarbonate").val(b.bicarbonate)});$("#bicarbonate").on("change",function(f){b.total_alkalinity=parseFloat(f.args.value)*50/61;$("#total_alkalinity").val(b.total_alkalinity)});$("#popupWindow").jqxWindow({width:1050,height:550,resizable:false,theme:theme,isModal:true,autoOpen:false,cancelButton:$("#Cancel"),modalOpacity:0.4});$("#popupWindow").on("open",function(){$("#name").jqxInput("selectAll")});$("#Delete").jqxButton({template:"danger",width:"90px",theme:theme});$("#Delete").click(function(){if(c>=0){$("#eventWindow").jqxWindow("open");$("#delOk").click(function(){var f=$("#jqxgrid").jqxGrid("getrowid",c);$("#jqxgrid").jqxGrid("deleterow",f)})}$("#popupWindow").jqxWindow("hide")});$("#Cancel").jqxButton({template:"primary",width:"90px",theme:theme});$("#Save").jqxButton({template:"success",width:"90px",theme:theme});$("#Save").click(function(){var f=-1;if(c>=0){var f=$("#jqxgrid").jqxGrid("getrowid",c)}var g={record:f,name:$("#name").val(),unlimited_stock:$("#unlimited_stock").val(),calcium:parseFloat($("#calcium").jqxNumberInput("decimal")),bicarbonate:parseFloat($("#bicarbonate").jqxNumberInput("decimal")),sulfate:parseFloat($("#sulfate").jqxNumberInput("decimal")),chloride:parseFloat($("#chloride").jqxNumberInput("decimal")),sodium:parseFloat($("#sodium").jqxNumberInput("decimal")),magnesium:parseFloat($("#magnesium").jqxNumberInput("decimal")),ph:parseFloat($("#ph").jqxNumberInput("decimal")),notes:$("#notes").val(),total_alkalinity:parseFloat($("#total_alkalinity").jqxNumberInput("decimal")),inventory:parseFloat($("#inventory").jqxNumberInput("decimal")),cost:parseFloat($("#cost").jqxNumberInput("decimal"))};if(c>=0){$("#jqxgrid").jqxGrid("updaterow",f,g)}else{$("#jqxgrid").jqxGrid("addrow",null,g)}$("#popupWindow").jqxWindow("hide");location.reload(true)});createDelElements()});
\ No newline at end of file
+function createDelElements(){$("#eventWindow").jqxWindow({theme:theme,position:{x:490,y:210},width:300,height:175,resizable:false,isModal:true,modalOpacity:0.4,okButton:$("#delOk"),cancelButton:$("#delCancel"),initContent:function(){$("#delOk").jqxButton({template:"danger",width:"65px",theme:theme});$("#delCancel").jqxButton({template:"success",width:"65px",theme:theme});$("#delCancel").focus()}});$("#eventWindow").jqxWindow("hide")}$(document).ready(function(){$("#name").jqxTooltip({content:"De unieke naam van dit brouwwater."});$("#notes").jqxTooltip({content:"Extra opmerkingen over dit water."});$("#unlimited_stock").jqxTooltip({content:"Onbeperkte voorraad zoals kraanwater en bronnen."});$("#calcium").jqxTooltip({content:"Calcium (Ca)."});$("#bicarbonate").jqxTooltip({content:"Bicarbonaat (HCO3). Berekend meteen de Totale alkaliteit."});$("#sulfate").jqxTooltip({content:"Calcium Sulfaat (CaSO4)."});$("#chloride").jqxTooltip({content:"Chloride (Cl)."});$("#sodium").jqxTooltip({content:"Natrium, oftewel keukenzout (Na). In berekeningen ook vaak als Sodium."});$("#magnesium").jqxTooltip({content:"Magnesium (Mg)."});$("#ph").jqxTooltip({content:"De zuurgraad (pH)."});$("#total_alkalinity").jqxTooltip({content:"Totale alkaliniteit. Berekend meteen de Bicarbonaat."});$("#inventory").jqxTooltip({content:"Voorraad in liters."});$("#cost").jqxTooltip({content:"Kostprijs per liter. 5 cijfers achter de comma zodat het kraanwater er ook in kan."});var b={},a="includes/db_inventory_water.php",d={datatype:"json",cache:false,datafields:[{name:"record",type:"number"},{name:"name",type:"string"},{name:"unlimited_stock",type:"int"},{name:"calcium",type:"float"},{name:"bicarbonate",type:"float"},{name:"sulfate",type:"float"},{name:"chloride",type:"float"},{name:"sodium",type:"float"},{name:"magnesium",type:"float"},{name:"ph",type:"float"},{name:"notes",type:"string"},{name:"total_alkalinity",type:"float"},{name:"inventory",type:"float"},{name:"cost",type:"float"}],id:"record",url:a,deleterow:function(f,h){var g="delete=true&"+$.param({record:f});$.ajax({dataType:"json",url:a,cache:false,data:g,type:"POST",success:function(j,i,k){h(true);location.reload(true)},error:function(i,k,j){h(false)}})},addrow:function(g,j,f,i){var h="insert=true&"+$.param(j);$.ajax({dataType:"json",url:a,cache:false,data:h,type:"POST",success:function(l,k,m){i(true);location.reload(true)},error:function(k,m,l){i(false)}})},updaterow:function(f,i,h){var g="update=true&"+$.param(i);$.ajax({dataType:"json",url:a,cache:false,data:g,type:"POST",success:function(k,j,l){h(true);location.reload(true)},error:function(j,l,k){h(false)}})}},e=new $.jqx.dataAdapter(d),c=-1;$("#name").jqxInput({theme:theme,width:640,height:23});$("#notes").jqxInput({theme:theme,width:640,height:100});$("#unlimited_stock").jqxCheckBox({theme:theme,width:120,height:23});$("#calcium").jqxNumberInput(Spin1dec);$("#bicarbonate").jqxNumberInput(Spin1dec);$("#sulfate").jqxNumberInput(Spin1dec);$("#chloride").jqxNumberInput(Spin1dec);$("#sodium").jqxNumberInput(Spin1dec);$("#magnesium").jqxNumberInput(Spin1dec);$("#ph").jqxNumberInput(Spin2pH);$("#total_alkalinity").jqxNumberInput(Spin1dec);$("#inventory").jqxNumberInput(Spin1dec);$("#cost").jqxNumberInput({inputMode:"simple",theme:theme,width:110,height:23,min:0,decimalDigits:5,spinButtons:true});$("#jqxgrid").jqxGrid({width:1280,height:630,source:e,theme:theme,showstatusbar:true,renderstatusbar:function(h){var g,f=$("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");g=$("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");f.append(g);h.append(f);g.jqxButton({theme:theme,width:90,height:20});g.click(function(i){c=-1;$("#popupWindow").jqxWindow({position:{x:110,y:30}});$("#name").val("Nieuw brouwwater");$("#unlimited_stock").val(0);$("#calcium").val(0);$("#bicarbonate").val(0);$("#sulfate").val(0);$("#chloride").val(0);$("#sodium").val(0);$("#magnesium").val(0);$("#ph").val(7);$("#notes").val("");$("#total_alkalinity").val(0);$("#inventory").val(0);$("#cost").val(0);$("#popupWindow").jqxWindow("open")})},filterable:false,columns:[{text:"Water leverancier",datafield:"name",width:225},{text:"Opmerkingen",datafield:"notes"},{text:"Onbeperkt",datafield:"unlimited_stock",columntype:"checkbox",width:80},{text:"Voorraad",datafield:"inventory",width:100,align:"right",cellsalign:"right",cellsformat:"f1",cellsrenderer:function(g,f,k,j,i,l){var h="";if(k>0&&l.unlimited_stock==0){h=e.formatNumber(k,"f1")+" L"}return"<span style='margin: 3px; margin-top: 6px; float: right;'>"+h+"</span>"}},{text:"",datafield:"Edit",width:100,align:"center",columntype:"button",cellsrenderer:function(){return"Wijzig"},buttonclick:function(f){c=f;$("#popupWindow").jqxWindow({position:{x:110,y:30}});b=$("#jqxgrid").jqxGrid("getrowdata",c);$("#name").val(b.name);$("#unlimited_stock").val(b.unlimited_stock);$("#calcium").val(b.calcium);$("#bicarbonate").val(b.bicarbonate);$("#sulfate").val(b.sulfate);$("#chloride").val(b.chloride);$("#sodium").val(b.sodium);$("#magnesium").val(b.magnesium);$("#ph").val(b.ph);$("#notes").val(b.notes);$("#total_alkalinity").val(b.total_alkalinity);$("#inventory").val(b.inventory);$("#cost").val(b.cost);$("#popupWindow").jqxWindow("open")}}]});$("#total_alkalinity").on("change",function(f){b.bicarbonate=parseFloat(f.args.value)*1.22;$("#bicarbonate").val(b.bicarbonate)});$("#bicarbonate").on("change",function(f){b.total_alkalinity=parseFloat(f.args.value)*50/61;$("#total_alkalinity").val(b.total_alkalinity)});$("#popupWindow").jqxWindow({width:1050,height:550,resizable:false,theme:theme,isModal:true,autoOpen:false,cancelButton:$("#Cancel"),modalOpacity:0.4});$("#popupWindow").on("open",function(){$("#name").jqxInput("selectAll")});$("#Delete").jqxButton({template:"danger",width:"90px",theme:theme});$("#Delete").click(function(){if(c>=0){$("#eventWindow").jqxWindow("open");$("#delOk").click(function(){var f=$("#jqxgrid").jqxGrid("getrowid",c);$("#jqxgrid").jqxGrid("deleterow",f)})}$("#popupWindow").jqxWindow("hide")});$("#Cancel").jqxButton({template:"primary",width:"90px",theme:theme});$("#Save").jqxButton({template:"success",width:"90px",theme:theme});$("#Save").click(function(){var g,f=-1;if(c>=0){f=$("#jqxgrid").jqxGrid("getrowid",c)}g={record:f,name:$("#name").val(),unlimited_stock:$("#unlimited_stock").val(),calcium:parseFloat($("#calcium").jqxNumberInput("decimal")),bicarbonate:parseFloat($("#bicarbonate").jqxNumberInput("decimal")),sulfate:parseFloat($("#sulfate").jqxNumberInput("decimal")),chloride:parseFloat($("#chloride").jqxNumberInput("decimal")),sodium:parseFloat($("#sodium").jqxNumberInput("decimal")),magnesium:parseFloat($("#magnesium").jqxNumberInput("decimal")),ph:parseFloat($("#ph").jqxNumberInput("decimal")),notes:$("#notes").val(),total_alkalinity:parseFloat($("#total_alkalinity").jqxNumberInput("decimal")),inventory:parseFloat($("#inventory").jqxNumberInput("decimal")),cost:parseFloat($("#cost").jqxNumberInput("decimal"))};if(c>=0){$("#jqxgrid").jqxGrid("updaterow",f,g)}else{$("#jqxgrid").jqxGrid("addrow",null,g)}$("#popupWindow").jqxWindow("hide")});createDelElements()});
\ No newline at end of file
--- a/www/js/inv_waters.js	Fri Sep 13 16:54:51 2019 +0200
+++ b/www/js/inv_waters.js	Fri Sep 13 20:24:31 2019 +0200
@@ -44,9 +44,6 @@
 
 $(document).ready(function () {
 
-	var dataRecord = {};
-
-	var url = "includes/db_inventory_water.php";
 	// tooltips
 	$("#name").jqxTooltip({ content: 'De unieke naam van dit brouwwater.' });
 	$("#notes").jqxTooltip({ content: 'Extra opmerkingen over dit water.' });
@@ -61,8 +58,11 @@
 	$("#total_alkalinity").jqxTooltip({ content: 'Totale alkaliniteit. Berekend meteen de Bicarbonaat.' });
 	$("#inventory").jqxTooltip({ content: 'Voorraad in liters.' });
 	$("#cost").jqxTooltip({ content: 'Kostprijs per liter. 5 cijfers achter de comma zodat het kraanwater er ook in kan.' });
+	
+	var dataRecord = {},
+        url = 'includes/db_inventory_water.php',
 	// prepare the data
-	var source = {
+	source = {
 		datatype: "json",
 		cache: false,
 		datafields: [
@@ -93,8 +93,8 @@
 				data: data,
 				type: "POST",
 				success: function (data, status, xhr) {
-					// delete command is executed.
 					commit(true);
+					location.reload( true );
 				},
 				error: function (jqXHR, textStatus, errorThrown) {
 					commit(false);
@@ -111,6 +111,7 @@
 				type: "POST",
 				success: function (data, status, xhr) {
 					commit(true);
+					location.reload( true );
 				},
 				error: function(jqXHR, textStatus, errorThrown) {
                                         commit(false);
@@ -126,15 +127,18 @@
 				data: data,
 				type: "POST",
 				success: function (data, status, xhr) {
-					// update command is executed.
 					commit(true);
+					location.reload( true );
 				},
 				error: function(jqXHR, textStatus, errorThrown) {
 					commit(false);
 				}
 			});
 		}
-	};
+	},
+	dataAdapter = new $.jqx.dataAdapter(source),
+        editrow = -1;
+
 	// initialize the input fields.
 	$("#name").jqxInput({ theme: theme, width: 640, height: 23 });
 	$("#notes").jqxInput({ theme: theme, width: 640, height: 100 });
@@ -149,8 +153,7 @@
 	$("#total_alkalinity").jqxNumberInput( Spin1dec );
 	$("#inventory").jqxNumberInput( Spin1dec );
 	$("#cost").jqxNumberInput({inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 5, spinButtons: true });
-	var dataAdapter = new $.jqx.dataAdapter(source);
-	var editrow = -1;
+	
 	// initialize jqxGrid
 	$("#jqxgrid").jqxGrid({
 		width: 1280,
@@ -159,8 +162,8 @@
 		theme: theme,
 		showstatusbar: true,
 		renderstatusbar: function (statusbar) {
-			var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
-			var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
+			var addButton, container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
+			addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
 			container.append(addButton);
 			statusbar.append(container);
 			addButton.jqxButton({ theme: theme, width: 90, height: 20 });
@@ -197,14 +200,15 @@
 				return "<span style='margin: 3px; margin-top: 6px; float: right;'>" + amount + "</span>";
 			  }
 			},
-			{ text: '', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer: function () {
-				return "Wijzig";
+			{ text: '', datafield: 'Edit', width: 100, align: 'center', columntype: 'button',
+				cellsrenderer: function () {
+					return "Wijzig";
 				}, buttonclick: function (row) {
 					// open the popup window when the user clicks a button.
 					editrow = row;
 					$("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } });
 					// get the clicked row's data and initialize the input fields.
-					var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
+					dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
 					$("#name").val(dataRecord.name);
 					$("#unlimited_stock").val(dataRecord.unlimited_stock);
 					$("#calcium").val(dataRecord.calcium);
@@ -264,11 +268,11 @@
 	$("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
 	// update the edited row when the user clicks the 'Save' button.
 	$("#Save").click(function () {
-		var rowID = -1;
+		var row, rowID = -1;
 		if (editrow >= 0) {
-			var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
+			rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
 		}
-		var row = {
+		row = {
 			record: rowID,
 			name: $("#name").val(),
 			unlimited_stock: $("#unlimited_stock").val(),
@@ -290,7 +294,6 @@
 			$('#jqxgrid').jqxGrid('addrow', null, row);
 		}
 		$("#popupWindow").jqxWindow('hide');
-		location.reload( true );        // reload ourself.
 	});
 	createDelElements();
 });
--- a/www/js/inv_yeasts-min.js	Fri Sep 13 16:54:51 2019 +0200
+++ b/www/js/inv_yeasts-min.js	Fri Sep 13 20:24:31 2019 +0200
@@ -1,1 +1,1 @@
-function createDelElements(){$("#eventWindow").jqxWindow({theme:theme,position:{x:490,y:210},width:300,height:175,resizable:false,isModal:true,modalOpacity:0.4,okButton:$("#delOk"),cancelButton:$("#delCancel"),initContent:function(){$("#delOk").jqxButton({template:"danger",width:"65px",theme:theme});$("#delCancel").jqxButton({template:"success",width:"65px",theme:theme});$("#delCancel").focus()}});$("#eventWindow").jqxWindow("hide")}$(document).ready(function(){var b={};function d(){$("#totval").val(b.cost*b.inventory);if(b.form==0){$("#pmpt_cost").html("Prijs per pak:");$("#pmpt_inventory").html("Voorraad pak(ken):");$("#pmpt_cells").html("Miljard cellen per pak:");$("#inventory").jqxNumberInput({decimalDigits:0})}else{if(b.form==1){$("#pmpt_cost").html("Prijs per kg:");$("#pmpt_inventory").html("Voorraad gram:");$("#pmpt_cells").html("Miljard cellen per gram:");$("#inventory").jqxNumberInput({decimalDigits:1})}else{$("#pmpt_cost").html("Prijs per liter:");$("#pmpt_inventory").html("Voorraad ml:");$("#pmpt_cells").html("Miljard cellen per ml:");$("#inventory").jqxNumberInput({decimalDigits:1})}}}var a="includes/db_inventory_yeasts.php",e={datatype:"json",cache:false,datafields:[{name:"record",type:"number"},{name:"name",type:"string"},{name:"type",type:"int"},{name:"form",type:"int"},{name:"laboratory",type:"string"},{name:"product_id",type:"string"},{name:"min_temperature",type:"float"},{name:"max_temperature",type:"float"},{name:"flocculation",type:"int"},{name:"attenuation",type:"float"},{name:"notes",type:"string"},{name:"best_for",type:"string"},{name:"max_reuse",type:"int"},{name:"inventory",type:"float"},{name:"cost",type:"float"},{name:"production_date",type:"string"},{name:"tht_date",type:"string"},{name:"cells",type:"float"},{name:"tolerance",type:"float"}],id:"record",url:a,deleterow:function(g,i){var h="delete=true&"+$.param({record:g});$.ajax({dataType:"json",url:a,cache:false,data:h,type:"POST",success:function(k,j,l){i(true)},error:function(j,l,k){i(false)}})},addrow:function(h,k,g,j){var i="insert=true&"+$.param(k);$.ajax({dataType:"json",url:a,cache:false,data:i,type:"POST",success:function(m,l,n){j(true)},error:function(l,n,m){j(false)}})},updaterow:function(g,j,i){var h="update=true&"+$.param(j);$.ajax({dataType:"json",url:a,cache:false,data:h,type:"POST",success:function(l,k,m){i(true)},error:function(k,m,l){i(false)}})}};$("#name").jqxInput({theme:theme,width:640,height:23});$("#laboratory").jqxInput({theme:theme,width:320,height:23});$("#product_id").jqxInput({theme:theme,width:320,height:23});$("#type").jqxDropDownList({theme:theme,source:YeastTypeAdapter,valueMember:"id",displayMember:"nl",width:180,height:23,autoDropDownHeight:true});$("#form").jqxDropDownList({theme:theme,source:YeastFormAdapter,valueMember:"id",displayMember:"nl",selectedIndex:0,width:180,height:23,autoDropDownHeight:true});$("#notes").jqxInput({theme:theme,width:800,height:120});$("#best_for").jqxInput({theme:theme,width:320,height:100});$("#inventory").jqxNumberInput(Spin1dec);$("#production_date").jqxDateTimeInput(Dateopts);$("#min_temperature").jqxNumberInput(YeastT);$("#max_temperature").jqxNumberInput(YeastT);$("#flocculation").jqxDropDownList({theme:theme,source:FlocculationAdapter,valueMember:"id",displayMember:"nl",width:180,height:23,autoDropDownHeight:true});$("#attenuation").jqxNumberInput(Perc1dec);$("#max_reuse").jqxNumberInput(PosInt);$("#max_reuse").jqxNumberInput({max:10});$("#cost").jqxNumberInput(Spin2dec);$("#tht_date").jqxDateTimeInput(Dateopts);$("#totval").jqxNumberInput(Show2dec);$("#cells").jqxNumberInput(Spin1dec);$("#tolerance").jqxNumberInput(Perc1dec);$("#tolerance").jqxNumberInput({max:25});var f=new $.jqx.dataAdapter(e),c=-1;$("#jqxgrid").jqxGrid({width:1280,height:630,source:f,theme:theme,showstatusbar:true,renderstatusbar:function(i){var g,h,j;g=$("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");h=$("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");j=$("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");g.append(h);g.append(j);i.append(g);h.jqxButton({theme:theme,width:90,height:20});j.jqxButton({theme:theme,width:90,height:20});h.click(function(k){c=-1;$("#popupWindow").jqxWindow({position:{x:110,y:30}});$("#name").val("");$("#laboratory").val("");$("#product_id").val("");$("#type").val(0);$("#form").val(0);$("#min_temperature").val(18);$("#max_temperature").val(22);$("#flocculation").val(0);$("#attenuation").val(77);$("#notes").val("");$("#best_for").val("");$("#max_reuse").val(10);$("#inventory").val(0);$("#cost").val(0);$("#production_date").val("");$("#tht_date").val("");$("#cells").val(1);$("#tolerance").val(0);$("#popupWindow").jqxWindow("open")});j.click(function(k){window.location.href="import_ingredients.php?select=yeasts"})},filterable:true,filtermode:"excel",columns:[{text:"Laboratorium",datafield:"laboratory",width:150},{text:"Product ID",datafield:"product_id",width:120,menu:false},{text:"Gist naam",datafield:"name",menu:false},{text:"Type",datafield:"type",align:"center",cellsalign:"center",menu:false,width:110,cellsrenderer:function(h,g,k,j,i,l){return"<div style='margin: 4px;' class='jqx-center-align'>"+YeastTypeData[k].nl+"</div>"}},{text:"Vorm",datafield:"form",align:"center",cellsalign:"center",menu:false,width:110,cellsrenderer:function(h,g,k,j,i,l){return"<div style='margin: 4px;' class='jqx-center-align'>"+YeastFormData[k].nl+"</div>"}},{text:"SVG",datafield:"attenuation",width:70,align:"right",cellsalign:"right",menu:false,cellsformat:"p1"},{text:"Tol%",datafield:"tolerance",width:60,align:"right",cellsalign:"right",menu:false,cellsrenderer:function(h,g,l,k,j,m){var i="";if(l>0){i=f.formatNumber(l,"p0")}return'<span style="margin: 4px; margin-top: 6px; float: right;">'+i+"</span>"}},{text:"Voorraad",datafield:"inventory",width:100,align:"right",menu:false,cellsrenderer:function(h,g,l,k,j,m){var i="";if(l>0){if((m.form==0)&&(l>1)){i=f.formatNumber(l,"f0")+" pakken"}else{if(m.form==0){i=f.formatNumber(l,"f0")+" pak"}else{if(m.form==1){i=f.formatNumber(l*1000,"f1")+" gram"}else{i=f.formatNumber(l*1000,"f1")+" ml"}}}}return"<span style='margin: 3px; margin-top: 6px; float: right;'>"+i+"</span>"}},{text:"",datafield:"Edit",columntype:"button",width:100,align:"center",menu:false,cellsrenderer:function(){return"Wijzig"},buttonclick:function(g){c=g;$("#popupWindow").jqxWindow({position:{x:110,y:30}});b=$("#jqxgrid").jqxGrid("getrowdata",c);$("#name").val(b.name);$("#laboratory").val(b.laboratory);$("#product_id").val(b.product_id);$("#type").val(b.type);$("#form").val(b.form);$("#min_temperature").val(b.min_temperature);$("#max_temperature").val(b.max_temperature);$("#flocculation").val(b.flocculation);$("#attenuation").val(b.attenuation);$("#notes").val(b.notes);$("#best_for").val(b.best_for);$("#max_reuse").val(b.max_reuse);if(b.form==0){$("#inventory").val(b.inventory)}else{$("#inventory").val(b.inventory*1000)}$("#cost").val(b.cost);$("#production_date").val(b.production_date);$("#tht_date").val(b.tht_date);$("#cells").val(b.cells);$("#tolerance").val(b.tolerance);d();$("#popupWindow").jqxWindow("open")}}]});$("#popupWindow").on("open",function(g){d()});$("#cost").on("change",function(g){b.cost=parseFloat(g.args.value);d()});$("#inventory").on("change",function(g){if(b.form==0){b.inventory=parseFloat(g.args.value)}else{b.inventory=parseFloat(g.args.value)/1000}d()});$("#form").on("select",function(g){if(g.args){b.form=g.args.index;d()}});$("#popupWindow").jqxWindow({width:1050,height:575,resizable:false,theme:theme,isModal:true,autoOpen:false,cancelButton:$("#Cancel"),modalOpacity:0.4});$("#popupWindow").on("open",function(){$("#name").jqxInput("selectAll")});$("#Delete").jqxButton({template:"danger",width:"90px",theme:theme});$("#Delete").click(function(){if(c>=0){$("#eventWindow").jqxWindow("open");$("#delOk").click(function(){var g=$("#jqxgrid").jqxGrid("getrowid",c);$("#jqxgrid").jqxGrid("deleterow",g)})}$("#popupWindow").jqxWindow("hide")});$("#Cancel").jqxButton({template:"primary",width:"90px",theme:theme});$("#Clone").jqxButton({template:"warning",width:"90px",theme:theme});$("#Clone").click(function(){var g={record:-1,name:$("#name").val()+" kopie",type:$("#type").val(),form:$("#form").val(),laboratory:$("#laboratory").val(),product_id:$("#product_id").val(),min_temperature:parseInt($("#min_temperature").jqxNumberInput("decimal")),max_temperature:parseInt($("#max_temperature").jqxNumberInput("decimal")),flocculation:$("#flocculation").val(),attenuation:parseFloat($("#attenuation").jqxNumberInput("decimal")),notes:$("#notes").val(),best_for:$("#best_for").val(),max_reuse:parseInt($("#max_reuse").jqxNumberInput("decimal")),inventory:0,cost:parseFloat($("#cost").jqxNumberInput("decimal")),production_date:"",tht_date:"",cells:parseFloat($("#cells").jqxNumberInput("decimal")),tolerance:parseFloat($("#tolerance").jqxNumberInput("decimal"))};$("#jqxgrid").jqxGrid("addrow",null,g);$("#popupWindow").jqxWindow("hide");location.reload(true)});$("#Save").jqxButton({template:"success",width:"90px",theme:theme});$("#Save").click(function(){var g,i,h=-1;if(c>=0){h=$("#jqxgrid").jqxGrid("getrowid",c)}if(b.form==0){g=parseFloat($("#inventory").jqxNumberInput("decimal"))}else{g=parseFloat($("#inventory").jqxNumberInput("decimal"))/1000}i={record:h,name:$("#name").val(),type:$("#type").val(),form:$("#form").val(),laboratory:$("#laboratory").val(),product_id:$("#product_id").val(),min_temperature:parseInt($("#min_temperature").jqxNumberInput("decimal")),max_temperature:parseInt($("#max_temperature").jqxNumberInput("decimal")),flocculation:$("#flocculation").val(),attenuation:parseFloat($("#attenuation").jqxNumberInput("decimal")),notes:$("#notes").val(),best_for:$("#best_for").val(),max_reuse:parseInt($("#max_reuse").jqxNumberInput("decimal")),inventory:g,cost:parseFloat($("#cost").jqxNumberInput("decimal")),production_date:$("#production_date").val(),tht_date:$("#tht_date").val(),cells:parseFloat($("#cells").jqxNumberInput("decimal")),tolerance:parseFloat($("#tolerance").jqxNumberInput("decimal"))};if(c>=0){$("#jqxgrid").jqxGrid("updaterow",h,i)}else{$("#jqxgrid").jqxGrid("addrow",null,i);location.reload(true)}$("#popupWindow").jqxWindow("hide")});createDelElements()});
\ No newline at end of file
+function createDelElements(){$("#eventWindow").jqxWindow({theme:theme,position:{x:490,y:210},width:300,height:175,resizable:false,isModal:true,modalOpacity:0.4,okButton:$("#delOk"),cancelButton:$("#delCancel"),initContent:function(){$("#delOk").jqxButton({template:"danger",width:"65px",theme:theme});$("#delCancel").jqxButton({template:"success",width:"65px",theme:theme});$("#delCancel").focus()}});$("#eventWindow").jqxWindow("hide")}$(document).ready(function(){function d(){$("#totval").val(b.cost*b.inventory);if(b.form==0){$("#pmpt_cost").html("Prijs per pak:");$("#pmpt_inventory").html("Voorraad pak(ken):");$("#pmpt_cells").html("Miljard cellen per pak:");$("#inventory").jqxNumberInput({decimalDigits:0})}else{if(b.form==1){$("#pmpt_cost").html("Prijs per kg:");$("#pmpt_inventory").html("Voorraad gram:");$("#pmpt_cells").html("Miljard cellen per gram:");$("#inventory").jqxNumberInput({decimalDigits:1})}else{$("#pmpt_cost").html("Prijs per liter:");$("#pmpt_inventory").html("Voorraad ml:");$("#pmpt_cells").html("Miljard cellen per ml:");$("#inventory").jqxNumberInput({decimalDigits:1})}}}var b={},a="includes/db_inventory_yeasts.php",e={datatype:"json",cache:false,datafields:[{name:"record",type:"number"},{name:"name",type:"string"},{name:"type",type:"int"},{name:"form",type:"int"},{name:"laboratory",type:"string"},{name:"product_id",type:"string"},{name:"min_temperature",type:"float"},{name:"max_temperature",type:"float"},{name:"flocculation",type:"int"},{name:"attenuation",type:"float"},{name:"notes",type:"string"},{name:"best_for",type:"string"},{name:"max_reuse",type:"int"},{name:"inventory",type:"float"},{name:"cost",type:"float"},{name:"production_date",type:"string"},{name:"tht_date",type:"string"},{name:"cells",type:"float"},{name:"tolerance",type:"float"}],id:"record",url:a,deleterow:function(g,i){var h="delete=true&"+$.param({record:g});$.ajax({dataType:"json",url:a,cache:false,data:h,type:"POST",success:function(k,j,l){i(true);location.reload(true)},error:function(j,l,k){i(false)}})},addrow:function(h,k,g,j){var i="insert=true&"+$.param(k);$.ajax({dataType:"json",url:a,cache:false,data:i,type:"POST",success:function(m,l,n){j(true);location.reload(true)},error:function(l,n,m){j(false)}})},updaterow:function(g,j,i){var h="update=true&"+$.param(j);$.ajax({dataType:"json",url:a,cache:false,data:h,type:"POST",success:function(l,k,m){i(true);location.reload(true)},error:function(k,m,l){i(false)}})}},f=new $.jqx.dataAdapter(e),c=-1;$("#name").jqxInput({theme:theme,width:640,height:23});$("#laboratory").jqxInput({theme:theme,width:320,height:23});$("#product_id").jqxInput({theme:theme,width:320,height:23});$("#type").jqxDropDownList({theme:theme,source:YeastTypeAdapter,valueMember:"id",displayMember:"nl",width:180,height:23,autoDropDownHeight:true});$("#form").jqxDropDownList({theme:theme,source:YeastFormAdapter,valueMember:"id",displayMember:"nl",selectedIndex:0,width:180,height:23,autoDropDownHeight:true});$("#notes").jqxInput({theme:theme,width:800,height:120});$("#best_for").jqxInput({theme:theme,width:320,height:100});$("#inventory").jqxNumberInput(Spin1dec);$("#production_date").jqxDateTimeInput(Dateopts);$("#min_temperature").jqxNumberInput(YeastT);$("#max_temperature").jqxNumberInput(YeastT);$("#flocculation").jqxDropDownList({theme:theme,source:FlocculationAdapter,valueMember:"id",displayMember:"nl",width:180,height:23,autoDropDownHeight:true});$("#attenuation").jqxNumberInput(Perc1dec);$("#max_reuse").jqxNumberInput(PosInt);$("#max_reuse").jqxNumberInput({max:10});$("#cost").jqxNumberInput(Spin2dec);$("#tht_date").jqxDateTimeInput(Dateopts);$("#totval").jqxNumberInput(Show2dec);$("#cells").jqxNumberInput(Spin1dec);$("#tolerance").jqxNumberInput(Perc1dec);$("#tolerance").jqxNumberInput({max:25});$("#jqxgrid").jqxGrid({width:1280,height:630,source:f,theme:theme,showstatusbar:true,renderstatusbar:function(i){var g,h,j;g=$("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");h=$("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");j=$("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");g.append(h);g.append(j);i.append(g);h.jqxButton({theme:theme,width:90,height:20});j.jqxButton({theme:theme,width:90,height:20});h.click(function(k){c=-1;$("#popupWindow").jqxWindow({position:{x:110,y:30}});$("#name").val("");$("#laboratory").val("");$("#product_id").val("");$("#type").val(0);$("#form").val(0);$("#min_temperature").val(18);$("#max_temperature").val(22);$("#flocculation").val(0);$("#attenuation").val(77);$("#notes").val("");$("#best_for").val("");$("#max_reuse").val(10);$("#inventory").val(0);$("#cost").val(0);$("#production_date").val("");$("#tht_date").val("");$("#cells").val(1);$("#tolerance").val(0);$("#popupWindow").jqxWindow("open")});j.click(function(k){window.location.href="import_ingredients.php?select=yeasts"})},filterable:true,filtermode:"excel",columns:[{text:"Laboratorium",datafield:"laboratory",width:150},{text:"Product ID",datafield:"product_id",width:120,menu:false},{text:"Gist naam",datafield:"name",menu:false},{text:"Type",datafield:"type",align:"center",cellsalign:"center",menu:false,width:110,cellsrenderer:function(h,g,k,j,i,l){return"<div style='margin: 4px;' class='jqx-center-align'>"+YeastTypeData[k].nl+"</div>"}},{text:"Vorm",datafield:"form",align:"center",cellsalign:"center",menu:false,width:110,cellsrenderer:function(h,g,k,j,i,l){return"<div style='margin: 4px;' class='jqx-center-align'>"+YeastFormData[k].nl+"</div>"}},{text:"SVG",datafield:"attenuation",width:70,align:"right",cellsalign:"right",menu:false,cellsformat:"p1"},{text:"Tol%",datafield:"tolerance",width:60,align:"right",cellsalign:"right",menu:false,cellsrenderer:function(h,g,l,k,j,m){var i="";if(l>0){i=f.formatNumber(l,"p0")}return'<span style="margin: 4px; margin-top: 6px; float: right;">'+i+"</span>"}},{text:"Voorraad",datafield:"inventory",width:100,align:"right",menu:false,cellsrenderer:function(h,g,l,k,j,m){var i="";if(l>0){if((m.form==0)&&(l>1)){i=f.formatNumber(l,"f0")+" pakken"}else{if(m.form==0){i=f.formatNumber(l,"f0")+" pak"}else{if(m.form==1){i=f.formatNumber(l*1000,"f1")+" gram"}else{i=f.formatNumber(l*1000,"f1")+" ml"}}}}return"<span style='margin: 3px; margin-top: 6px; float: right;'>"+i+"</span>"}},{text:"",datafield:"Edit",columntype:"button",width:100,align:"center",menu:false,cellsrenderer:function(){return"Wijzig"},buttonclick:function(g){c=g;$("#popupWindow").jqxWindow({position:{x:110,y:30}});b=$("#jqxgrid").jqxGrid("getrowdata",c);$("#name").val(b.name);$("#laboratory").val(b.laboratory);$("#product_id").val(b.product_id);$("#type").val(b.type);$("#form").val(b.form);$("#min_temperature").val(b.min_temperature);$("#max_temperature").val(b.max_temperature);$("#flocculation").val(b.flocculation);$("#attenuation").val(b.attenuation);$("#notes").val(b.notes);$("#best_for").val(b.best_for);$("#max_reuse").val(b.max_reuse);if(b.form==0){$("#inventory").val(b.inventory)}else{$("#inventory").val(b.inventory*1000)}$("#cost").val(b.cost);$("#production_date").val(b.production_date);$("#tht_date").val(b.tht_date);$("#cells").val(b.cells);$("#tolerance").val(b.tolerance);d();$("#popupWindow").jqxWindow("open")}}]});$("#popupWindow").on("open",function(g){d()});$("#cost").on("change",function(g){b.cost=parseFloat(g.args.value);d()});$("#inventory").on("change",function(g){if(b.form==0){b.inventory=parseFloat(g.args.value)}else{b.inventory=parseFloat(g.args.value)/1000}d()});$("#form").on("select",function(g){if(g.args){b.form=g.args.index;d()}});$("#popupWindow").jqxWindow({width:1050,height:575,resizable:false,theme:theme,isModal:true,autoOpen:false,cancelButton:$("#Cancel"),modalOpacity:0.4});$("#popupWindow").on("open",function(){$("#name").jqxInput("selectAll")});$("#Delete").jqxButton({template:"danger",width:"90px",theme:theme});$("#Delete").click(function(){if(c>=0){$("#eventWindow").jqxWindow("open");$("#delOk").click(function(){var g=$("#jqxgrid").jqxGrid("getrowid",c);$("#jqxgrid").jqxGrid("deleterow",g)})}$("#popupWindow").jqxWindow("hide")});$("#Cancel").jqxButton({template:"primary",width:"90px",theme:theme});$("#Clone").jqxButton({template:"warning",width:"90px",theme:theme});$("#Clone").click(function(){var g={record:-1,name:$("#name").val()+" kopie",type:$("#type").val(),form:$("#form").val(),laboratory:$("#laboratory").val(),product_id:$("#product_id").val(),min_temperature:parseInt($("#min_temperature").jqxNumberInput("decimal")),max_temperature:parseInt($("#max_temperature").jqxNumberInput("decimal")),flocculation:$("#flocculation").val(),attenuation:parseFloat($("#attenuation").jqxNumberInput("decimal")),notes:$("#notes").val(),best_for:$("#best_for").val(),max_reuse:parseInt($("#max_reuse").jqxNumberInput("decimal")),inventory:0,cost:parseFloat($("#cost").jqxNumberInput("decimal")),production_date:"",tht_date:"",cells:parseFloat($("#cells").jqxNumberInput("decimal")),tolerance:parseFloat($("#tolerance").jqxNumberInput("decimal"))};$("#jqxgrid").jqxGrid("addrow",null,g);$("#popupWindow").jqxWindow("hide")});$("#Save").jqxButton({template:"success",width:"90px",theme:theme});$("#Save").click(function(){var g,i,h=-1;if(c>=0){h=$("#jqxgrid").jqxGrid("getrowid",c)}if(b.form==0){g=parseFloat($("#inventory").jqxNumberInput("decimal"))}else{g=parseFloat($("#inventory").jqxNumberInput("decimal"))/1000}i={record:h,name:$("#name").val(),type:$("#type").val(),form:$("#form").val(),laboratory:$("#laboratory").val(),product_id:$("#product_id").val(),min_temperature:parseInt($("#min_temperature").jqxNumberInput("decimal")),max_temperature:parseInt($("#max_temperature").jqxNumberInput("decimal")),flocculation:$("#flocculation").val(),attenuation:parseFloat($("#attenuation").jqxNumberInput("decimal")),notes:$("#notes").val(),best_for:$("#best_for").val(),max_reuse:parseInt($("#max_reuse").jqxNumberInput("decimal")),inventory:g,cost:parseFloat($("#cost").jqxNumberInput("decimal")),production_date:$("#production_date").val(),tht_date:$("#tht_date").val(),cells:parseFloat($("#cells").jqxNumberInput("decimal")),tolerance:parseFloat($("#tolerance").jqxNumberInput("decimal"))};if(c>=0){$("#jqxgrid").jqxGrid("updaterow",h,i)}else{$("#jqxgrid").jqxGrid("addrow",null,i)}$("#popupWindow").jqxWindow("hide")});createDelElements()});
\ No newline at end of file
--- a/www/js/inv_yeasts.js	Fri Sep 13 16:54:51 2019 +0200
+++ b/www/js/inv_yeasts.js	Fri Sep 13 20:24:31 2019 +0200
@@ -44,8 +44,6 @@
 
 $(document).ready(function() {
 
-	var dataRecord = {};
-
 	function calcTotal() {
 
 		$('#totval').val(dataRecord.cost * dataRecord.inventory);
@@ -67,7 +65,8 @@
 		}
 	}
 
-	var url = 'includes/db_inventory_yeasts.php',
+	var dataRecord = {},
+	url = 'includes/db_inventory_yeasts.php',
 	source = {
 		datatype: 'json',
 		cache: false,
@@ -104,8 +103,8 @@
 				data: data,
 				type: "POST",
 				success: function (data, status, xhr) {
-					// delete command is executed.
 					commit(true);
+					location.reload( true );
 				},
 				error: function (jqXHR, textStatus, errorThrown) {
 					commit(false);
@@ -122,6 +121,7 @@
 				type: "POST",
 				success: function (data, status, xhr) {
 					commit(true);
+					location.reload( true );
 				},
 				error: function(jqXHR, textStatus, errorThrown) {
 					commit(false);
@@ -137,15 +137,18 @@
 				data: data,
 				type: "POST",
 				success: function (data, status, xhr) {
-					// update command is executed.
 					commit(true);
+					location.reload( true );
 				},
 				error: function(jqXHR, textStatus, errorThrown) {
 					commit(false);
 				}
 			});
 		}
-	};
+	},
+	dataAdapter = new $.jqx.dataAdapter(source),
+        editrow = -1;
+
 	// initialize the input fields.
 	$("#name").jqxInput({ theme: theme, width: 640, height: 23 });
 	$("#laboratory").jqxInput({ theme: theme, width: 320, height: 23 });
@@ -194,8 +197,6 @@
 	$("#tolerance").jqxNumberInput( Perc1dec );
 	$("#tolerance").jqxNumberInput({ max: 25 });
 
-	var dataAdapter = new $.jqx.dataAdapter(source),
-	editrow = -1;
 	// initialize jqxGrid
 	$("#jqxgrid").jqxGrid({
 		width: 1280,
@@ -390,7 +391,6 @@
 		};
 		$('#jqxgrid').jqxGrid('addrow', null, row);
 		$("#popupWindow").jqxWindow('hide');
-		location.reload( true );        // reload ourself.
 	});
 	$("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
 	// update the edited row when the user clicks the 'Save' button.
@@ -428,7 +428,6 @@
 			$('#jqxgrid').jqxGrid('updaterow', rowID, row);
 		} else {
 			$('#jqxgrid').jqxGrid('addrow', null, row);
-			location.reload( true );	// reload ourself.
 		}
 		$("#popupWindow").jqxWindow('hide');
 	});

mercurial