Code cleanup and manual compress

Sat, 19 Oct 2019 21:23:06 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 19 Oct 2019 21:23:06 +0200
changeset 528
202272a28052
parent 527
9dfefad3ae1d
child 529
bb8a37fe6326

Code cleanup and manual compress

www/js/inv_equipments.js file | annotate | diff | comparison | revisions
www/js/inv_fermentables.js file | annotate | diff | comparison | revisions
www/js/inv_hops.js file | annotate | diff | comparison | revisions
www/js/inv_miscs.js file | annotate | diff | comparison | revisions
www/js/inv_suppliers.js file | annotate | diff | comparison | revisions
www/js/inv_waters.js file | annotate | diff | comparison | revisions
www/js/inv_yeasts.js file | annotate | diff | comparison | revisions
--- a/www/js/inv_equipments.js	Sat Oct 19 13:54:38 2019 +0200
+++ b/www/js/inv_equipments.js	Sat Oct 19 21:23:06 2019 +0200
@@ -1,6 +1,6 @@
 /*****************************************************************************
  * Copyright (C) 2014-2019
- *   
+ *
  * Michiel Broek <mbroek at mbse dot eu>
  *
  * This file is part of BrewCloud
@@ -14,7 +14,7 @@
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with ThermFerm; see the file COPYING.  If not, write to the Free
  * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
@@ -22,366 +22,367 @@
 
 
 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');
+ $('#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 () {
+$(document).ready(function() {
 
-	function calcBatchVolume() {
-		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.
-			batch = boil_size - (evap_rate * boil_time / 60) + top_up;
-			$("#batch_size").val(batch);
-		}
-	}
+ function calcBatchVolume() {
+  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.
+   batch = boil_size - (evap_rate * boil_time / 60) + top_up;
+   $('#batch_size').val(batch);
+  }
+ }
 
-	// tooltips
-	$("#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.' });
+ // tooltips
+ $('#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 dataRecord = {},
-	url = 'includes/db_inventory_equipments.php',
-	// prepare the data
-	source = {
-		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: url,
-		deleterow: function (rowid, commit) {
-			// synchronize with the server - send delete command
-			var data = "delete=true&" + $.param({ record: rowid });
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function (jqXHR, textStatus, errorThrown) {
-					commit(false);
-				}
-			});
-		},
-               	addrow: function (rowid, rowdata, position, commit) {
-                       	var data = "insert=true&" + $.param(rowdata);
-                       	$.ajax({
-                               	dataType: 'json',
-                               	url: url,
-                               	cache: false,
-                               	data: data,
-				type: "POST",
-                               	success: function (data, status, xhr) {
-                                       	commit(true);
-					location.reload( true );
-                               	},
-                               	error: function(jqXHR, textStatus, errorThrown) {
-                                        commit(false);
-                                }
-                        });
-                },
-		updaterow: function (rowid, rowdata, commit) {
-			var data = "update=true&" + $.param(rowdata);
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function(jqXHR, textStatus, errorThrown) {
-					commit(false);
-				}
-			});
-		}
-	},
-	dataAdapter = new $.jqx.dataAdapter(source),
-        editrow = -1;
+ var dataRecord = {},
+ url = 'includes/db_inventory_equipments.php',
+ // prepare the data
+ source = {
+  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: url,
+  deleterow: function(rowid, commit) {
+   // synchronize with the server - send delete command
+   var data = 'delete=true&' + $.param({ record: rowid });
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     commit(true);
+     location.reload(true);
+    },
+    error: function(jqXHR, textStatus, errorThrown) {
+     commit(false);
+    }
+   });
+  },
+  addrow: function(rowid, rowdata, position, commit) {
+   var data = 'insert=true&' + $.param(rowdata);
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     commit(true);
+     location.reload(true);
+    },
+    error: function(jqXHR, textStatus, errorThrown) {
+     commit(false);
+    }
+   });
+  },
+  updaterow: function(rowid, rowdata, commit) {
+   var data = 'update=true&' + $.param(rowdata);
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     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: 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 (event) {
-		$("#batch_size").jqxNumberInput({ readOnly: true, width: 90, spinButtons: false });
-	});
-	$("#calc_boil_volume").on('unchecked', function (event) {
-		$("#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 );
+ // initialize the input fields.
+ $('#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(event) {
+  $('#batch_size').jqxNumberInput({ readOnly: true, width: 90, spinButtons: false });
+ });
+ $('#calc_boil_volume').on('unchecked', function(event) {
+  $('#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);
 
-	// initialize jqxGrid
-	$("#jqxgrid").jqxGrid({
-		width: 1280,
-		height: 630,
-		source: dataAdapter,
-		theme: theme,
-		showstatusbar: true,
-		renderstatusbar: function (statusbar) {
-			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 });
-			// add new row.
-			addButton.click(function (event) {
-				editrow = -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 (event) { calcBatchVolume(); });
-			$('#evap_rate').on('change', function (event) { calcBatchVolume(); });
-			$('#boil_time').on('change', function (event) { calcBatchVolume(); });
-			$('#top_up_kettle').on('change', function (event) { calcBatchVolume(); });
-			$("#calc_boil_volume").on('change', function (event) { calcBatchVolume(); });
-			$('#tun_material').on('change', function (event) {
-				dataRecord.tun_specific_heat = MaterialData[event.args.index].sh;
-				$("#tun_specific_heat").val(dataRecord.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 (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.
-					dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
-					$("#name").val(dataRecord.name);
-					$("#boil_size").val(dataRecord.boil_size);
-					$("#batch_size").val(dataRecord.batch_size);
-					$("#tun_volume").val(dataRecord.tun_volume);
-					$("#tun_weight").val(dataRecord.tun_weight);
-					$("#tun_specific_heat").val(dataRecord.tun_specific_heat);
-					$("#tun_material").val(dataRecord.tun_material);
-					$("#tun_height").val(dataRecord.tun_height);
-					$("#top_up_water").val(dataRecord.top_up_water);
-					$("#trub_chiller_loss").val(dataRecord.trub_chiller_loss);
-					$("#evap_rate").val(dataRecord.evap_rate);
-					$("#boil_time").val(dataRecord.boil_time);
-					$("#calc_boil_volume").val(dataRecord.calc_boil_volume);
-					$("#top_up_kettle").val(dataRecord.top_up_kettle);
-					$("#hop_utilization").val(dataRecord.hop_utilization);
-					$("#notes").val(dataRecord.notes);
-					$("#lauter_volume").val(dataRecord.lauter_volume);
-					$("#lauter_height").val(dataRecord.lauter_height);
-					$("#lauter_deadspace").val(dataRecord.lauter_deadspace);
-					$("#kettle_volume").val(dataRecord.kettle_volume);
-					$("#kettle_height").val(dataRecord.kettle_height);
-					$("#mash_volume").val(dataRecord.mash_volume);
-					$("#mash_max").val(dataRecord.mash_max);
-					$("#efficiency").val(dataRecord.efficiency);
-					// show the popup window.
-					$("#popupWindow").jqxWindow('open');
-				}
-			}
-		]
-	});
-	// initialize the popup window and buttons.
-	$("#popupWindow").jqxWindow({
-		width: 1050,
-		height: 600,
-		resizable: false,
-		theme: theme,
-		isModal: true,
-		autoOpen: false,
-		cancelButton: $("#Cancel"),
-		modalOpacity: 0.40
-	});
-	$("#popupWindow").on('open', function () {
-		$("#name").jqxInput('selectAll');
-	});
-	$("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme });
-	$("#Delete").click(function () {
-		if (editrow >= 0) {
-			// Open a popup to confirm this action.
-			$('#eventWindow').jqxWindow('open');
-			$("#delOk").click(function () {
-				var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
-				$("#jqxgrid").jqxGrid('deleterow', rowID);
-			});
-		}
-		$("#popupWindow").jqxWindow('hide');
-	});
-	$("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme });
-	$("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
-	// update the edited row when the user clicks the 'Save' button.
-	$("#Save").click(function () {
-		var row, rowID = -1;
-		if (editrow >= 0) {
-			rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
-		}
-		row = {
-			record: rowID,
-			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 (editrow >= 0) {
-			$('#jqxgrid').jqxGrid('updaterow', rowID, row);
-		} else {
-			$('#jqxgrid').jqxGrid('addrow', null, row);
-		}
-		$("#popupWindow").jqxWindow('hide');
-	});
-	createDelElements();
+ // initialize jqxGrid
+ $('#jqxgrid').jqxGrid({
+  width: 1280,
+  height: 630,
+  source: dataAdapter,
+  theme: theme,
+  showstatusbar: true,
+  renderstatusbar: function(statusbar) {
+   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 });
+   // add new row.
+   addButton.click(function(event) {
+    editrow = -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(event) { calcBatchVolume(); });
+   $('#evap_rate').on('change', function(event) { calcBatchVolume(); });
+   $('#boil_time').on('change', function(event) { calcBatchVolume(); });
+   $('#top_up_kettle').on('change', function(event) { calcBatchVolume(); });
+   $('#calc_boil_volume').on('change', function(event) { calcBatchVolume(); });
+   $('#tun_material').on('change', function(event) {
+    dataRecord.tun_specific_heat = MaterialData[event.args.index].sh;
+    $('#tun_specific_heat').val(dataRecord.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(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.
+     dataRecord = $('#jqxgrid').jqxGrid('getrowdata', editrow);
+     $('#name').val(dataRecord.name);
+     $('#boil_size').val(dataRecord.boil_size);
+     $('#batch_size').val(dataRecord.batch_size);
+     $('#tun_volume').val(dataRecord.tun_volume);
+     $('#tun_weight').val(dataRecord.tun_weight);
+     $('#tun_specific_heat').val(dataRecord.tun_specific_heat);
+     $('#tun_material').val(dataRecord.tun_material);
+     $('#tun_height').val(dataRecord.tun_height);
+     $('#top_up_water').val(dataRecord.top_up_water);
+     $('#trub_chiller_loss').val(dataRecord.trub_chiller_loss);
+     $('#evap_rate').val(dataRecord.evap_rate);
+     $('#boil_time').val(dataRecord.boil_time);
+     $('#calc_boil_volume').val(dataRecord.calc_boil_volume);
+     $('#top_up_kettle').val(dataRecord.top_up_kettle);
+     $('#hop_utilization').val(dataRecord.hop_utilization);
+     $('#notes').val(dataRecord.notes);
+     $('#lauter_volume').val(dataRecord.lauter_volume);
+     $('#lauter_height').val(dataRecord.lauter_height);
+     $('#lauter_deadspace').val(dataRecord.lauter_deadspace);
+     $('#kettle_volume').val(dataRecord.kettle_volume);
+     $('#kettle_height').val(dataRecord.kettle_height);
+     $('#mash_volume').val(dataRecord.mash_volume);
+     $('#mash_max').val(dataRecord.mash_max);
+     $('#efficiency').val(dataRecord.efficiency);
+     // show the popup window.
+     $('#popupWindow').jqxWindow('open');
+    }
+   }
+  ]
+ });
+ // initialize the popup window and buttons.
+ $('#popupWindow').jqxWindow({
+  width: 1050,
+  height: 600,
+  resizable: false,
+  theme: theme,
+  isModal: true,
+  autoOpen: false,
+  cancelButton: $('#Cancel'),
+  modalOpacity: 0.40
+ });
+ $('#popupWindow').on('open', function() {
+  $('#name').jqxInput('selectAll');
+ });
+ $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme });
+ $('#Delete').click(function() {
+  if (editrow >= 0) {
+   // Open a popup to confirm this action.
+   $('#eventWindow').jqxWindow('open');
+   $('#delOk').click(function() {
+    var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
+    $('#jqxgrid').jqxGrid('deleterow', rowID);
+   });
+  }
+  $('#popupWindow').jqxWindow('hide');
+ });
+ $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme });
+ $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme });
+ // update the edited row when the user clicks the 'Save' button.
+ $('#Save').click(function() {
+  var row, rowID = -1;
+  if (editrow >= 0) {
+   rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
+  }
+  row = {
+   record: rowID,
+   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 (editrow >= 0) {
+   $('#jqxgrid').jqxGrid('updaterow', rowID, row);
+  } else {
+   $('#jqxgrid').jqxGrid('addrow', null, row);
+  }
+  $('#popupWindow').jqxWindow('hide');
+ });
+ createDelElements();
 });
 
--- a/www/js/inv_fermentables.js	Sat Oct 19 13:54:38 2019 +0200
+++ b/www/js/inv_fermentables.js	Sat Oct 19 21:23:06 2019 +0200
@@ -22,398 +22,397 @@
 
 
 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');
+ $('#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 () {
+$(document).ready(function() {
 
-	function calcTotal(cost, inventory) {
-
-		$('#totval').val(cost * inventory);
-	}
+ function calcTotal(cost, inventory) {
+  $('#totval').val(cost * inventory);
+ }
 
-	var dataRecord = {},
-	url = 'includes/db_inventory_fermentables.php',
-	// prepare the data
-	source = {
-		datatype: "json",
-		cache: false,
-		datafields: [
-			{ name: 'record', type: 'number' },
-			{ name: 'name', type: 'string' },
-			{ name: 'type', type: 'string' },
-			{ 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: 'string' },
-			{ name: 'always_on_stock', type: 'int' },
-			{ name: 'di_ph', type: 'float' },
-			{ name: 'acid_to_ph_57', type: 'float' },
-			{ name: 'graintype', type: 'string' },
-			{ name: 'inventory', type: 'float' },
-			{ name: 'cost', type: 'float' },
-			{ name: 'production_date', type: 'string' },
-			{ name: 'tht_date', type: 'string' }
-		],
-		id: 'record',
-		url: url,
-		deleterow: function (rowid, commit) {
-			// synchronize with the server - send delete command
-			var data = "delete=true&" + $.param({ record: rowid });
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function (jqXHR, textStatus, errorThrown) {
-					commit(false);
-				}
-			});
-		},
-               	addrow: function (rowid, rowdata, position, commit) {
-                       	var data = "insert=true&" + $.param(rowdata);
-                       	$.ajax({
-                               	dataType: 'json',
-                               	url: url,
-                               	cache: false,
-                               	data: data,
-				type: "POST",
-                               	success: function (data, status, xhr) {
-                                       	commit(true);
-					location.reload( true );
-                               	},
-                               	error: function(jqXHR, textStatus, errorThrown) {
-                                        commit(false);
-                                }
-                        });
-                },
-		updaterow: function (rowid, rowdata, commit) {
-			var data = "update=true&" + $.param(rowdata);
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function(jqXHR, textStatus, errorThrown) {
-					commit(false);
-				}
-			});
-		}
-	},
-	dataAdapter = new $.jqx.dataAdapter(source),
-        editrow = -1;
+ var dataRecord = {},
+ url = 'includes/db_inventory_fermentables.php',
+ source = {
+  datatype: 'json',
+  cache: false,
+  datafields: [
+   { name: 'record', type: 'number' },
+   { name: 'name', type: 'string' },
+   { name: 'type', type: 'string' },
+   { 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: 'string' },
+   { name: 'always_on_stock', type: 'int' },
+   { name: 'di_ph', type: 'float' },
+   { name: 'acid_to_ph_57', type: 'float' },
+   { name: 'graintype', type: 'string' },
+   { name: 'inventory', type: 'float' },
+   { name: 'cost', type: 'float' },
+   { name: 'production_date', type: 'string' },
+   { name: 'tht_date', type: 'string' }
+  ],
+  id: 'record',
+  url: url,
+  deleterow: function(rowid, commit) {
+   var data = 'delete=true&' + $.param({ record: rowid });
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     commit(true);
+     location.reload(true);
+    },
+    error: function(jqXHR, textStatus, errorThrown) {
+     commit(false);
+    }
+   });
+  },
+  addrow: function(rowid, rowdata, position, commit) {
+   var data = 'insert=true&' + $.param(rowdata);
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     commit(true);
+     location.reload(true);
+    },
+    error: function(jqXHR, textStatus, errorThrown) {
+     commit(false);
+    }
+   });
+  },
+  updaterow: function(rowid, rowdata, commit) {
+   var data = 'update=true&' + $.param(rowdata);
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     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({
-		theme: theme,
-		source: FermentableTypeAdapter,
-		valueMember: 'nl',
-		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: 'nl',
-		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: 'nl',
-		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 );
+ // initialize the input fields.
+ $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
+ $('#type').jqxDropDownList({
+  theme: theme,
+  source: FermentableTypeAdapter,
+  valueMember: 'nl',
+  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: 'nl',
+  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: 'nl',
+  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);
 
-	// initialize jqxGrid
-	$("#jqxgrid").jqxGrid({
-		width: 1280,
-		height: 630,
-		source: dataAdapter,
-		theme: theme,
-		showstatusbar: true,
-		renderstatusbar: function (statusbar) {
-			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);
-			addButton.jqxButton({ theme: theme, width: 90, height: 20 });
-			impButton.jqxButton({ theme: theme, width: 90, height: 20 });
-			// add new row.
-			addButton.click(function (event) {
-				editrow = -1;
-				$("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } });
-				$("#name").val('Nieuw product');
-				$("#type").val('Mout');
-				$("#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('Basismout');
-				$("#add_after_boil").val(0);
-				$("#added").val('Maischen');
-				$("#inventory").val(0);
-				$("#cost").val(0);
-				$("#production_date").val('');
-				$("#tht_date").val('');
-				$("#popupWindow").jqxWindow('open');
-			});
-			impButton.click(function (event) {
-				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' },
-			{ text: 'Graan type', datafield: 'graintype', align: 'center', cellsalign: 'center', width: 125 },
-			{ 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 (index, datafield, value, defaultvalue, column, rowdata) {
-				var amount = "";
-				if (value > 0) {
-					if (value < 1.000)
-						amount = dataAdapter.formatNumber(value * 1000,"f0")+" gr";
-					else
-						amount = dataAdapter.formatNumber(value,"f1")+" kg";
-				}
-				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";
-				}, 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.
-					dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
-					$("#name").val(dataRecord.name);
-					$("#type").val(dataRecord.type);
-					$("#yield").val(dataRecord.yield);
-					$("#color").val(dataRecord.color);
-					$("#add_after_boil").val(dataRecord.add_after_boil);
-					$("#origin").val(dataRecord.origin);
-					$("#supplier").val(dataRecord.supplier);
-					$("#notes").val(dataRecord.notes);
-					$("#coarse_fine_diff").val(dataRecord.coarse_fine_diff);
-					$("#moisture").val(dataRecord.moisture);
-					$("#diastatic_power").val(lintner_to_kolbach(dataRecord.diastatic_power));
-					$("#protein").val(dataRecord.protein);
-					$("#dissolved_protein").val(dataRecord.dissolved_protein);
-					$("#max_in_batch").val(dataRecord.max_in_batch);
-					$("#recommend_mash").val(dataRecord.recommend_mash);
-					$("#added").val(dataRecord.added);
-					$("#always_on_stock").val(dataRecord.always_on_stock);
-					$("#di_ph").val(dataRecord.di_ph);
-					$("#acid_to_ph_57").val(dataRecord.acid_to_ph_57);
-					$("#graintype").val(dataRecord.graintype);
-					$("#inventory").val(dataRecord.inventory);
-					$("#cost").val(dataRecord.cost);
-					$("#production_date").val(dataRecord.production_date);
-					$("#tht_date").val(dataRecord.tht_date);
-					calcTotal(dataRecord.cost, dataRecord.inventory);
-					// show the popup window.
-					$("#popupWindow").jqxWindow('open');
-				}
-			}
-		]
-	});
+ // initialize jqxGrid
+ $('#jqxgrid').jqxGrid({
+  width: 1280,
+  height: 630,
+  source: dataAdapter,
+  theme: theme,
+  showstatusbar: true,
+  renderstatusbar: function(statusbar) {
+   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);
+   addButton.jqxButton({ theme: theme, width: 90, height: 20 });
+   impButton.jqxButton({ theme: theme, width: 90, height: 20 });
+   // add new row.
+   addButton.click(function(event) {
+    editrow = -1;
+    $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } });
+    $('#name').val('Nieuw product');
+    $('#type').val('Mout');
+    $('#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('Basismout');
+    $('#add_after_boil').val(0);
+    $('#added').val('Maischen');
+    $('#inventory').val(0);
+    $('#cost').val(0);
+    $('#production_date').val('');
+    $('#tht_date').val('');
+    $('#popupWindow').jqxWindow('open');
+   });
+   impButton.click(function(event) {
+    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' },
+   { text: 'Graan type', datafield: 'graintype', align: 'center', cellsalign: 'center', width: 125 },
+   { 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(index, datafield, value, defaultvalue, column, rowdata) {
+     var amount = '';
+     if (value > 0) {
+      if (value < 1.000)
+       amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' gr';
+      else
+       amount = dataAdapter.formatNumber(value, 'f1') + ' kg';
+     }
+     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';
+    }, 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.
+     dataRecord = $('#jqxgrid').jqxGrid('getrowdata', editrow);
+     $('#name').val(dataRecord.name);
+     $('#type').val(dataRecord.type);
+     $('#yield').val(dataRecord.yield);
+     $('#color').val(dataRecord.color);
+     $('#add_after_boil').val(dataRecord.add_after_boil);
+     $('#origin').val(dataRecord.origin);
+     $('#supplier').val(dataRecord.supplier);
+     $('#notes').val(dataRecord.notes);
+     $('#coarse_fine_diff').val(dataRecord.coarse_fine_diff);
+     $('#moisture').val(dataRecord.moisture);
+     $('#diastatic_power').val(lintner_to_kolbach(dataRecord.diastatic_power));
+     $('#protein').val(dataRecord.protein);
+     $('#dissolved_protein').val(dataRecord.dissolved_protein);
+     $('#max_in_batch').val(dataRecord.max_in_batch);
+     $('#recommend_mash').val(dataRecord.recommend_mash);
+     $('#added').val(dataRecord.added);
+     $('#always_on_stock').val(dataRecord.always_on_stock);
+     $('#di_ph').val(dataRecord.di_ph);
+     $('#acid_to_ph_57').val(dataRecord.acid_to_ph_57);
+     $('#graintype').val(dataRecord.graintype);
+     $('#inventory').val(dataRecord.inventory);
+     $('#cost').val(dataRecord.cost);
+     $('#production_date').val(dataRecord.production_date);
+     $('#tht_date').val(dataRecord.tht_date);
+     calcTotal(dataRecord.cost, dataRecord.inventory);
+     // show the popup window.
+     $('#popupWindow').jqxWindow('open');
+    }
+   }
+  ]
+ });
 
-	$("#cost").on('change', function (event) {
-		dataRecord.cost = parseFloat(event.args.value);
-		calcTotal(dataRecord.cost, dataRecord.inventory);
-	});
-	$("#inventory").on('change', function (event) {
-		dataRecord.inventory = parseFloat(event.args.value);
-		calcTotal(dataRecord.cost, dataRecord.inventory);
-	});
+ $('#cost').on('change', function(event) {
+  dataRecord.cost = parseFloat(event.args.value);
+  calcTotal(dataRecord.cost, dataRecord.inventory);
+ });
+ $('#inventory').on('change', function(event) {
+  dataRecord.inventory = parseFloat(event.args.value);
+  calcTotal(dataRecord.cost, dataRecord.inventory);
+ });
 
-	// initialize the popup window and buttons.
-	$("#popupWindow").jqxWindow({
-		width: 1050,
-		height: 550,
-		resizable: false,
-		theme: theme,
-		isModal: true,
-		autoOpen: false,
-		cancelButton: $("#Cancel"),
-		modalOpacity: 0.40
-	});
-	$("#popupWindow").on('open', function () {
-		$("#name").jqxInput('selectAll');
-	});
-	$("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme });
-	$("#Delete").click(function() {
-		if (editrow >= 0) {
-			// Open a popup to confirm this action.
-			$('#eventWindow').jqxWindow('open');
-			$("#delOk").click(function () {
-				var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
-				$("#jqxgrid").jqxGrid('deleterow', rowID);
-			});
-		}
-		$("#popupWindow").jqxWindow('hide');
-	});
-	$('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme });
-        $('#Clone').jqxButton({ template: 'warning', width: '90px', theme: theme });
-        $('#Clone').click(function() {
-                var row = {
-                        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, row);
-                $('#popupWindow').jqxWindow('hide');
-        });
-	$("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
-	// update the edited row when the user clicks the 'Save' button.
-	$("#Save").click(function() {
-		var row, rowID = -1;
-		if (editrow >= 0) {
-			rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
-		}
-		row = {
-			record: rowID,
-			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 (editrow >= 0) {
-			$('#jqxgrid').jqxGrid('updaterow', rowID, row);
-		} else {
-			$('#jqxgrid').jqxGrid('addrow', null, row);
-		}
-		$("#popupWindow").jqxWindow('hide');
-	});
-	createDelElements();
+ // initialize the popup window and buttons.
+ $('#popupWindow').jqxWindow({
+  width: 1050,
+  height: 550,
+  resizable: false,
+  theme: theme,
+  isModal: true,
+  autoOpen: false,
+  cancelButton: $('#Cancel'),
+  modalOpacity: 0.40
+ });
+ $('#popupWindow').on('open', function() {
+  $('#name').jqxInput('selectAll');
+ });
+ $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme });
+ $('#Delete').click(function() {
+  if (editrow >= 0) {
+   // Open a popup to confirm this action.
+   $('#eventWindow').jqxWindow('open');
+   $('#delOk').click(function() {
+    var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
+    $('#jqxgrid').jqxGrid('deleterow', rowID);
+   });
+  }
+  $('#popupWindow').jqxWindow('hide');
+ });
+ $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme });
+ $('#Clone').jqxButton({ template: 'warning', width: '90px', theme: theme });
+ $('#Clone').click(function() {
+  var row = {
+   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, row);
+  $('#popupWindow').jqxWindow('hide');
+ });
+ $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme });
+ // update the edited row when the user clicks the 'Save' button.
+ $('#Save').click(function() {
+  var row, rowID = -1;
+  if (editrow >= 0) {
+   rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
+  }
+  row = {
+   record: rowID,
+   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 (editrow >= 0) {
+   $('#jqxgrid').jqxGrid('updaterow', rowID, row);
+  } else {
+   $('#jqxgrid').jqxGrid('addrow', null, row);
+  }
+  $('#popupWindow').jqxWindow('hide');
+ });
+ createDelElements();
 });
 
--- a/www/js/inv_hops.js	Sat Oct 19 13:54:38 2019 +0200
+++ b/www/js/inv_hops.js	Sat Oct 19 21:23:06 2019 +0200
@@ -22,363 +22,362 @@
 
 
 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');
+ $('#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 () {
+$(document).ready(function() {
 
-	function calcTotal(cost, inventory) {
-
-		$('#totval').val(cost * (inventory / 1000));
-	}
+ function calcTotal(cost, inventory) {
+  $('#totval').val(cost * (inventory / 1000));
+ }
 
-	var dataRecord = {},
-	url = 'includes/db_inventory_hops.php',
-	// prepare the data
-	source = {
-		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: 'string' },
-			{ name: 'form', type: 'string' },
-			{ 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: url,
-		deleterow: function (rowid, commit) {
-			// synchronize with the server - send delete command
-			var data = "delete=true&" + $.param({ record: rowid });
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function (jqXHR, textStatus, errorThrown) {
-					commit(false);
-				}
-			});
-		},
-		addrow: function (rowid, rowdata, position, commit) {
-			var data = "insert=true&" + $.param(rowdata);
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function(jqXHR, textStatus, errorThrown) {
-                                        commit(false);
-                                }
-                        });
-                },
-		updaterow: function (rowid, rowdata, commit) {
-			var data = "update=true&" + $.param(rowdata);
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function(jqXHR, textStatus, errorThrown) {
-					commit(false);
-				}
-			});
-		}
-	},
-	dataAdapter = new $.jqx.dataAdapter(source),
-        editrow = -1;
+ var dataRecord = {},
+ url = 'includes/db_inventory_hops.php',
+ source = {
+  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: 'string' },
+   { name: 'form', type: 'string' },
+   { 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: url,
+  deleterow: function(rowid, commit) {
+   var data = 'delete=true&' + $.param({ record: rowid });
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     commit(true);
+     location.reload(true);
+    },
+    error: function(jqXHR, textStatus, errorThrown) {
+     commit(false);
+    }
+   });
+  },
+  addrow: function(rowid, rowdata, position, commit) {
+   var data = 'insert=true&' + $.param(rowdata);
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     commit(true);
+     location.reload(true);
+    },
+    error: function(jqXHR, textStatus, errorThrown) {
+     commit(false);
+    }
+   });
+  },
+  updaterow: function(rowid, rowdata, commit) {
+   var data = 'update=true&' + $.param(rowdata);
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     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 );
-	$("#beta").jqxNumberInput( Perc1dec );
-	$("#humulene").jqxNumberInput( Perc1dec );
-	$("#caryophyllene").jqxNumberInput( Perc1dec );
-	$("#cohumulone").jqxNumberInput( Perc1dec );
-	$("#myrcene").jqxNumberInput( Perc1dec );
-	$("#hsi").jqxNumberInput( Perc1dec );
+ // initialize the input fields.
+ $('#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: 'nl',
-		displayMember: 'nl',
-		width: 150,
-		height: 23,
-		autoDropDownHeight: true
-	});
-	$("#form").jqxDropDownList({
-		theme: theme,
-		source: HopFormAdapter,
-		valueMember: 'nl',
-		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 );
+ $('#type').jqxDropDownList({
+  theme: theme,
+  source: HopTypeAdapter,
+  valueMember: 'nl',
+  displayMember: 'nl',
+  width: 150,
+  height: 23,
+  autoDropDownHeight: true
+ });
+ $('#form').jqxDropDownList({
+  theme: theme,
+  source: HopFormAdapter,
+  valueMember: 'nl',
+  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);
 
-	// initialize jqxGrid
-	$("#jqxgrid").jqxGrid({
-		width: 1280,
-		height: 630,
-		source: dataAdapter,
-		theme: theme,
-		showstatusbar: true,
-		renderstatusbar: function (statusbar) {
-			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);
-			addButton.jqxButton({ theme: theme, width: 90, height: 20 });
-			impButton.jqxButton({ theme: theme, width: 90, height: 20 });
-			// add new row.
-			addButton.click(function (event) {
-				editrow = -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('Bitterhop');
-				$("#form").val('Pellets');
-				$("#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');
-			});
-			impButton.click(function (event) {
-				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', width: 90 },
-			{ text: 'Vorm', datafield: 'form', align: 'left', width: 90 },
-			{ 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 (index, datafield, value, defaultvalue, column, rowdata) {
-				var amount = "";
-				if (value > 0) {
-					if (value < 1000)
-						amount = dataAdapter.formatNumber(value,"f1")+" gr";
-					else
-						amount = dataAdapter.formatNumber(value / 1000.0,"f1")+" kg";
-				}
-				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";
-				}, 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.
-					dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
-					$("#name").val(dataRecord.name);
-					$("#alpha").val(dataRecord.alpha);
-					$("#beta").val(dataRecord.beta);
-					$("#humulene").val(dataRecord.humulene);
-					$("#caryophyllene").val(dataRecord.caryophyllene);
-					$("#cohumulone").val(dataRecord.cohumulone);
-					$("#myrcene").val(dataRecord.myrcene);
-					$("#hsi").val(dataRecord.hsi);
-					$("#type").val(dataRecord.type);
-					$("#form").val(dataRecord.form);
-					$("#notes").val(dataRecord.notes);
-					$("#origin").val(dataRecord.origin);
-					$("#substitutes").val(dataRecord.substitutes);
-					$("#always_on_stock").val(dataRecord.always_on_stock);
-					$("#inventory").val(dataRecord.inventory);
-					$("#cost").val(dataRecord.cost);
-					$("#production_date").val(dataRecord.production_date);
-					$("#tht_date").val(dataRecord.tht_date);
-					$("#total_oil").val(dataRecord.total_oil);
-					calcTotal(dataRecord.cost, dataRecord.inventory);
-					// show the popup window.
-					$("#popupWindow").jqxWindow('open');
-				}
-			}
-		]
-	});
+ // initialize jqxGrid
+ $('#jqxgrid').jqxGrid({
+  width: 1280,
+  height: 630,
+  source: dataAdapter,
+  theme: theme,
+  showstatusbar: true,
+  renderstatusbar: function(statusbar) {
+   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);
+   addButton.jqxButton({ theme: theme, width: 90, height: 20 });
+   impButton.jqxButton({ theme: theme, width: 90, height: 20 });
+   // add new row.
+   addButton.click(function(event) {
+    editrow = -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('Bitterhop');
+    $('#form').val('Pellets');
+    $('#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');
+   });
+   impButton.click(function(event) {
+    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', width: 90 },
+   { text: 'Vorm', datafield: 'form', align: 'left', width: 90 },
+   { 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(index, datafield, value, defaultvalue, column, rowdata) {
+     var amount = '';
+     if (value > 0) {
+      if (value < 1000)
+       amount = dataAdapter.formatNumber(value, 'f1') + ' gr';
+      else
+       amount = dataAdapter.formatNumber(value / 1000.0, 'f1') + ' kg';
+     }
+     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';
+    }, 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.
+     dataRecord = $('#jqxgrid').jqxGrid('getrowdata', editrow);
+     $('#name').val(dataRecord.name);
+     $('#alpha').val(dataRecord.alpha);
+     $('#beta').val(dataRecord.beta);
+     $('#humulene').val(dataRecord.humulene);
+     $('#caryophyllene').val(dataRecord.caryophyllene);
+     $('#cohumulone').val(dataRecord.cohumulone);
+     $('#myrcene').val(dataRecord.myrcene);
+     $('#hsi').val(dataRecord.hsi);
+     $('#type').val(dataRecord.type);
+     $('#form').val(dataRecord.form);
+     $('#notes').val(dataRecord.notes);
+     $('#origin').val(dataRecord.origin);
+     $('#substitutes').val(dataRecord.substitutes);
+     $('#always_on_stock').val(dataRecord.always_on_stock);
+     $('#inventory').val(dataRecord.inventory);
+     $('#cost').val(dataRecord.cost);
+     $('#production_date').val(dataRecord.production_date);
+     $('#tht_date').val(dataRecord.tht_date);
+     $('#total_oil').val(dataRecord.total_oil);
+     calcTotal(dataRecord.cost, dataRecord.inventory);
+     // show the popup window.
+     $('#popupWindow').jqxWindow('open');
+    }
+   }
+  ]
+ });
 
-	$("#cost").on('change', function (event) {
-		dataRecord.cost = parseFloat(event.args.value);
-		calcTotal(dataRecord.cost, dataRecord.inventory);
-	});
-	$("#inventory").on('change', function (event) {
-		dataRecord.inventory = parseFloat(event.args.value);
-		calcTotal(dataRecord.cost, dataRecord.inventory);
-	});
+ $('#cost').on('change', function(event) {
+  dataRecord.cost = parseFloat(event.args.value);
+  calcTotal(dataRecord.cost, dataRecord.inventory);
+ });
+ $('#inventory').on('change', function(event) {
+  dataRecord.inventory = parseFloat(event.args.value);
+  calcTotal(dataRecord.cost, dataRecord.inventory);
+ });
 
-	// initialize the popup window and buttons.
-	$("#popupWindow").jqxWindow({
-		width: 1050,
-		height: 550,
-		resizable: false,
-		theme: theme,
-		isModal: true,
-		autoOpen: false,
-		cancelButton: $("#Cancel"),
-		modalOpacity: 0.40
-	});
-	$("#popupWindow").on('open', function () {
-		$("#name").jqxInput('selectAll');
-	});
-	$("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme });
-	$("#Delete").click(function () {
-		if (editrow >= 0) {
-			// Open a popup to confirm this action.
-			$('#eventWindow').jqxWindow('open');
-			$("#delOk").click(function () {
-				var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
-				$("#jqxgrid").jqxGrid('deleterow', rowID);
-			});
-		}
-		$("#popupWindow").jqxWindow('hide');
-	});
-	$("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme });
-	$("#Clone").jqxButton({ template: "warning", width: '90px', theme: theme });
-	$("#Clone").click(function () {
-		var row = {
-			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, row);
-	        $("#popupWindow").jqxWindow('hide');
-	});
-	$("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
-	// update the edited row when the user clicks the 'Save' button.
-	$("#Save").click(function () {
-		var row, rowID = -1;
-		if (editrow >= 0) {
-			rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
-		}
-		row = {
-			record: rowID,
-			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 (editrow >= 0) {
-			$('#jqxgrid').jqxGrid('updaterow', rowID, row);
-		} else {
-			$('#jqxgrid').jqxGrid('addrow', null, row);
-		}
-		$("#popupWindow").jqxWindow('hide');
-	});
-	createDelElements();
+ // initialize the popup window and buttons.
+ $('#popupWindow').jqxWindow({
+  width: 1050,
+  height: 550,
+  resizable: false,
+  theme: theme,
+  isModal: true,
+  autoOpen: false,
+  cancelButton: $('#Cancel'),
+  modalOpacity: 0.40
+ });
+ $('#popupWindow').on('open', function() {
+  $('#name').jqxInput('selectAll');
+ });
+ $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme });
+ $('#Delete').click(function() {
+  if (editrow >= 0) {
+   // Open a popup to confirm this action.
+   $('#eventWindow').jqxWindow('open');
+   $('#delOk').click(function() {
+    var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
+    $('#jqxgrid').jqxGrid('deleterow', rowID);
+   });
+  }
+  $('#popupWindow').jqxWindow('hide');
+ });
+ $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme });
+ $('#Clone').jqxButton({ template: 'warning', width: '90px', theme: theme });
+ $('#Clone').click(function() {
+  var row = {
+   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, row);
+  $('#popupWindow').jqxWindow('hide');
+ });
+ $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme });
+ // update the edited row when the user clicks the 'Save' button.
+ $('#Save').click(function() {
+  var row, rowID = -1;
+  if (editrow >= 0) {
+   rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
+  }
+  row = {
+   record: rowID,
+   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 (editrow >= 0) {
+   $('#jqxgrid').jqxGrid('updaterow', rowID, row);
+  } else {
+   $('#jqxgrid').jqxGrid('addrow', null, row);
+  }
+  $('#popupWindow').jqxWindow('hide');
+ });
+ createDelElements();
 });
 
--- a/www/js/inv_miscs.js	Sat Oct 19 13:54:38 2019 +0200
+++ b/www/js/inv_miscs.js	Sat Oct 19 21:23:06 2019 +0200
@@ -20,336 +20,338 @@
 
 
 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');
+ $('#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 () {
+$(document).ready(function() {
 
-	function calcTotal(cost, inventory) {
+ function calcTotal(cost, inventory) {
 
-		$('#totval').val(cost * (inventory / 1000));
-	}
+  $('#totval').val(cost * (inventory / 1000));
+ }
 
-	function prompts(isweight) {
+ function prompts(isweight) {
 
-		if (isweight) {
-			$("#pmpt_cost").html('Prijs per kg:');
-			$("#pmpt_inventory").html('Voorraad gram:');
-		} else {
-			$("#pmpt_cost").html('Prijs per liter:');
-			$("#pmpt_inventory").html('Voorraad ml:');
-		}
-	}
+  if (isweight) {
+   $('#pmpt_cost').html('Prijs per kg:');
+   $('#pmpt_inventory').html('Voorraad gram:');
+  } else {
+   $('#pmpt_cost').html('Prijs per liter:');
+   $('#pmpt_inventory').html('Voorraad ml:');
+  }
+ }
 
-	var dataRecord = {},
-	url = 'includes/db_inventory_miscs.php',
-	// prepare the data
-	source = {
-		datatype: "json",
-		cache: false,
-		datafields: [
-			{ name: 'record', type: 'number' },
-			{ name: 'name', type: 'string' },
-			{ name: 'type', type: 'string' },
-			{ name: 'use_use', type: 'string' },
-			{ 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: url,
-		deleterow: function (rowid, commit) {
-			// synchronize with the server - send delete command
-			var data = "delete=true&" + $.param({ record: rowid });
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function (jqXHR, textStatus, errorThrown) {
-					commit(false);
-				}
-			});
-		},
-		addrow: function (rowid, rowdata, position, commit) {
-			var data = "insert=true&" + $.param(rowdata);
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function(jqXHR, textStatus, errorThrown) {
-                                        commit(false);
-                                }
-                        });
-                },
-		updaterow: function (rowid, rowdata, commit) {
-			var data = "update=true&" + $.param(rowdata);
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function(jqXHR, textStatus, errorThrown) {
-					commit(false);
-				}
-			});
-		}
-	},
-	dataAdapter = new $.jqx.dataAdapter(source),
-        editrow = -1;
+ var dataRecord = {},
+ url = 'includes/db_inventory_miscs.php',
+ // prepare the data
+ source = {
+  datatype: 'json',
+  cache: false,
+  datafields: [
+   { name: 'record', type: 'number' },
+   { name: 'name', type: 'string' },
+   { name: 'type', type: 'string' },
+   { name: 'use_use', type: 'string' },
+   { 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: url,
+  deleterow: function(rowid, commit) {
+   // synchronize with the server - send delete command
+   var data = 'delete=true&' + $.param({ record: rowid });
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     commit(true);
+     location.reload(true);
+    },
+    error: function(jqXHR, textStatus, errorThrown) {
+     commit(false);
+    }
+   });
+  },
+  addrow: function(rowid, rowdata, position, commit) {
+   var data = 'insert=true&' + $.param(rowdata);
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     commit(true);
+     location.reload(true);
+    },
+    error: function(jqXHR, textStatus, errorThrown) {
+     commit(false);
+    }
+   });
+  },
+  updaterow: function(rowid, rowdata, commit) {
+   var data = 'update=true&' + $.param(rowdata);
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     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 });
+ // initialize the input fields.
+ $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
+ $('#notes').jqxInput({ theme: theme, width: 800, height: 100 });
 
-	$("#type").jqxDropDownList({theme: theme,
-		source: MiscTypeAdapter,
-		valueMember: 'nl',
-		displayMember: 'nl',
-		width: 180,
-		height: 23,
-		autoDropDownHeight: true
-	});
-	$("#use_use").jqxDropDownList({
-		theme: theme,
-		source: MiscUseAdapter,
-		valueMember: 'nl',
-		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 );
+ $('#type').jqxDropDownList({theme: theme,
+  source: MiscTypeAdapter,
+  valueMember: 'nl',
+  displayMember: 'nl',
+  width: 180,
+  height: 23,
+  autoDropDownHeight: true
+ });
+ $('#use_use').jqxDropDownList({
+  theme: theme,
+  source: MiscUseAdapter,
+  valueMember: 'nl',
+  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);
 
-	// initialize jqxGrid
-	$("#jqxgrid").jqxGrid({
-		width: 1280,
-		height: 630,
-		source: dataAdapter,
-		theme: theme,
-		showstatusbar: true,
-		renderstatusbar: function (statusbar) {
-			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);
-			addButton.jqxButton({ theme: theme, width: 90, height: 20 });
-			impButton.jqxButton({ theme: theme, width: 90, height: 20 });
-			// add new row.
-			addButton.click(function (event) {
-				editrow = -1;
-				$("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } });
-				$("#name").val('');
-				$("#type").val('Specerij');
-				$("#use_use").val('Starter');
-				$("#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');
-			});
-			impButton.click(function (event) {
-				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 },
-			{ text: 'Gebruik', datafield: 'use_use', align: 'left', width: 120 },
-			{ text: 'Tijd', datafield: 'time', width: 90, align: 'left', menu: false,
-			  cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
-				var duration = "";
-				if (value > 0) {
-					if (value == 1)
-						duration = "1 minuut";
-					else if (value < 60)
-						duration = dataAdapter.formatNumber(value, "f0")+" minuten";
-					else if (value == 60)
-						duration = "1 uur";
-					else if (value < 1440)
-						duration = dataAdapter.formatNumber(value / 60, "f0")+" uren";
-					else if (value == 1440)
-						duration = "1 dag";
-					else
-						duration = dataAdapter.formatNumber(value / 1440, "f0")+" dagen";
-				}
-				return "<span style='margin: 3px; margin-top: 6px; float: left;'>" + duration + "</span>";
-			  }
-		       	},
-			{ text: 'Voorraad', datafield: 'inventory', width: 110, menu: false, align: 'right',
-			  cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
-				var amount = "";
-				if (value > 0) {
-					if (rowdata.amount_is_weight)
-						amount = dataAdapter.formatNumber(value,"f1")+" gr";
-					else
-						amount = dataAdapter.formatNumber(value,"f1")+" ml";
-				}
-				return "<span style='margin: 3px; margin-top: 6px; float: right;'>" + amount + "</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 (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.
-					dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
-					$("#name").val(dataRecord.name);
-					$("#type").val(dataRecord.type);
-					$("#use_use").val(dataRecord.use_use);
-					$("#time").val(dataRecord.time);
-					$("#amount_is_weight").val(dataRecord.amount_is_weight);
-					$("#use_for").val(dataRecord.use_for);
-					$("#notes").val(dataRecord.notes);
-					$("#always_on_stock").val(dataRecord.always_on_stock);
-					$("#inventory").val(dataRecord.inventory);
-					$("#cost").val(dataRecord.cost);
-					$("#production_date").val(dataRecord.production_date);
-					$("#tht_date").val(dataRecord.tht_date);
-					calcTotal(dataRecord.cost, dataRecord.inventory);
-					prompts(dataRecord.amount_is_weight);
-					// show the popup window.
-					$("#popupWindow").jqxWindow('open');
-				}
-			}
-		]
-	});
+ // initialize jqxGrid
+ $('#jqxgrid').jqxGrid({
+  width: 1280,
+  height: 630,
+  source: dataAdapter,
+  theme: theme,
+  showstatusbar: true,
+  renderstatusbar: function(statusbar) {
+   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);
+   addButton.jqxButton({ theme: theme, width: 90, height: 20 });
+   impButton.jqxButton({ theme: theme, width: 90, height: 20 });
+   // add new row.
+   addButton.click(function(event) {
+    editrow = -1;
+    $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } });
+    $('#name').val('');
+    $('#type').val('Specerij');
+    $('#use_use').val('Starter');
+    $('#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');
+   });
+   impButton.click(function(event) {
+    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 },
+   { text: 'Gebruik', datafield: 'use_use', align: 'left', width: 120 },
+   { text: 'Tijd', datafield: 'time', width: 90, align: 'left', menu: false,
+    cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
+     var duration = '';
+     if (value > 0) {
+      if (value == 1)
+       duration = '1 minuut';
+      else if (value < 60)
+       duration = dataAdapter.formatNumber(value, 'f0') + ' minuten';
+      else if (value == 60)
+       duration = '1 uur';
+      else if (value < 1440)
+       duration = dataAdapter.formatNumber(value / 60, 'f0') + ' uren';
+      else if (value == 1440)
+       duration = '1 dag';
+      else
+       duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen';
+     }
+     return '<span style="margin: 3px; margin-top: 6px; float: left;">' + duration + '</span>';
+    }
+   },
+   { text: 'Voorraad', datafield: 'inventory', width: 110, menu: false, align: 'right',
+    cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
+     var amount = '';
+     if (value > 0) {
+      if (rowdata.amount_is_weight)
+       amount = dataAdapter.formatNumber(value, 'f1') + ' gr';
+      else
+       amount = dataAdapter.formatNumber(value, 'f1') + ' ml';
+     }
+     return '<span style="margin: 3px; margin-top: 6px; float: right;">' + amount + '</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(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.
+     dataRecord = $('#jqxgrid').jqxGrid('getrowdata', editrow);
+     $('#name').val(dataRecord.name);
+     $('#type').val(dataRecord.type);
+     $('#use_use').val(dataRecord.use_use);
+     $('#time').val(dataRecord.time);
+     $('#amount_is_weight').val(dataRecord.amount_is_weight);
+     $('#use_for').val(dataRecord.use_for);
+     $('#notes').val(dataRecord.notes);
+     $('#always_on_stock').val(dataRecord.always_on_stock);
+     $('#inventory').val(dataRecord.inventory);
+     $('#cost').val(dataRecord.cost);
+     $('#production_date').val(dataRecord.production_date);
+     $('#tht_date').val(dataRecord.tht_date);
+     calcTotal(dataRecord.cost, dataRecord.inventory);
+     prompts(dataRecord.amount_is_weight);
+     // show the popup window.
+     $('#popupWindow').jqxWindow('open');
+    }
+   }
+  ]
+ });
 
-	$("#cost").on('change', function (event) {
-		dataRecord.cost = parseFloat(event.args.value);
-		calcTotal(dataRecord.cost, dataRecord.inventory);
-	});
-	$("#inventory").on('change', function (event) {
-		dataRecord.inventory = parseFloat(event.args.value);
-		calcTotal(dataRecord.cost, dataRecord.inventory);
-	});
-	$("#amount_is_weight").on('checked', function (event) {
-		dataRecord.amount_is_weight = true;
-		prompts(true);
-	});
-	$("#amount_is_weight").on('unchecked', function (event) {
-		dataRecord.amount_is_weight = false;
-		prompts(false);
-	});
+ $('#cost').on('change', function(event) {
+  dataRecord.cost = parseFloat(event.args.value);
+  calcTotal(dataRecord.cost, dataRecord.inventory);
+ });
+ $('#inventory').on('change', function(event) {
+  dataRecord.inventory = parseFloat(event.args.value);
+  calcTotal(dataRecord.cost, dataRecord.inventory);
+ });
+ $('#amount_is_weight').on('checked', function(event) {
+  dataRecord.amount_is_weight = true;
+  prompts(true);
+ });
+ $('#amount_is_weight').on('unchecked', function(event) {
+  dataRecord.amount_is_weight = false;
+  prompts(false);
+ });
 
-	// initialize the popup window and buttons.
-	$("#popupWindow").jqxWindow({
-		width: 1050,
-		height: 550,
-		resizable: false,
-		theme: theme,
-		isModal: true,
-		autoOpen: false,
-		cancelButton: $("#Cancel"),
-		modalOpacity: 0.40
-	});
-	$("#popupWindow").on('open', function () {
-		$("#name").jqxInput('selectAll');
-	});
-	$("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme });
-	$("#Delete").click(function () {
-		if (editrow >= 0) {
-			// Open a popup to confirm this action.
-			$('#eventWindow').jqxWindow('open');
-			$("#delOk").click(function () {
-				var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
-				$("#jqxgrid").jqxGrid('deleterow', rowID);
-			});
-		}
-		$("#popupWindow").jqxWindow('hide');
-	});
-	$("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme });
-	$("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
-	// update the edited row when the user clicks the 'Save' button.
-	$("#Save").click(function () {
-		var row, rowID = -1;
-		if (editrow >= 0) {
-			rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
-		}
-		row = {
-			record: rowID,
-			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 (editrow >= 0) {
-			$('#jqxgrid').jqxGrid('updaterow', rowID, row);
-		} else {
-			$('#jqxgrid').jqxGrid('addrow', null, row);
-		}
-		$("#popupWindow").jqxWindow('hide');
-	});
-	createDelElements();
+ // initialize the popup window and buttons.
+ $('#popupWindow').jqxWindow({
+  width: 1050,
+  height: 550,
+  resizable: false,
+  theme: theme,
+  isModal: true,
+  autoOpen: false,
+  cancelButton: $('#Cancel'),
+  modalOpacity: 0.40
+ });
+ $('#popupWindow').on('open', function() {
+  $('#name').jqxInput('selectAll');
+ });
+ $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme });
+ $('#Delete').click(function() {
+  if (editrow >= 0) {
+   // Open a popup to confirm this action.
+   $('#eventWindow').jqxWindow('open');
+   $('#delOk').click(function() {
+    var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
+    $('#jqxgrid').jqxGrid('deleterow', rowID);
+   });
+  }
+  $('#popupWindow').jqxWindow('hide');
+ });
+ $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme });
+ $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme });
+ // update the edited row when the user clicks the 'Save' button.
+ $('#Save').click(function() {
+  var row, rowID = -1;
+  if (editrow >= 0) {
+   rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
+  }
+  row = {
+   record: rowID,
+   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 (editrow >= 0) {
+   $('#jqxgrid').jqxGrid('updaterow', rowID, row);
+  } else {
+   $('#jqxgrid').jqxGrid('addrow', null, row);
+  }
+  $('#popupWindow').jqxWindow('hide');
+ });
+ createDelElements();
 });
 
--- a/www/js/inv_suppliers.js	Sat Oct 19 13:54:38 2019 +0200
+++ b/www/js/inv_suppliers.js	Sat Oct 19 21:23:06 2019 +0200
@@ -1,6 +1,6 @@
 /*****************************************************************************
  * Copyright (C) 2014-2019
- *   
+ *
  * Michiel Broek <mbroek at mbse dot eu>
  *
  * This file is part of Brewery Management System
@@ -14,7 +14,7 @@
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with ThermFerm; see the file COPYING.  If not, write to the Free
  * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
@@ -23,239 +23,239 @@
 
 
 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');
+ $('#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 () {
+$(document).ready(function() {
 
-	// tooltips
-	$("#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.' });
+ // tooltips
+ $('#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 url = 'includes/db_inventory_suppliers.php',
-	// prepare the data
-	source = {
-		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: url,
-		deleterow: function (rowid, commit) {
-			// synchronize with the server - send delete command
-			var data = "delete=true&" + $.param({ record: rowid });
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function (jqXHR, textStatus, errorThrown) {
-					commit(false);
-				}
-			});
-		},
-		addrow: function (rowid, rowdata, position, commit) {
-			var data = "insert=true&" + $.param(rowdata);
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function(jqXHR, textStatus, errorThrown) {
-                                        commit(false);
-                                }
-                        });
-                },
-		updaterow: function (rowid, rowdata, commit) {
-			var data = "update=true&" + $.param(rowdata);
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function(jqXHR, textStatus, errorThrown) {
-					commit(false);
-				}
-			});
-		}
-	},
-	dataAdapter = new $.jqx.dataAdapter(source),
+ var url = 'includes/db_inventory_suppliers.php',
+ source = {
+  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: url,
+  deleterow: function(rowid, commit) {
+   // synchronize with the server - send delete command
+   var data = 'delete=true&' + $.param({ record: rowid });
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     commit(true);
+     location.reload(true);
+    },
+    error: function(jqXHR, textStatus, errorThrown) {
+     commit(false);
+    }
+   });
+  },
+  addrow: function(rowid, rowdata, position, commit) {
+   var data = 'insert=true&' + $.param(rowdata);
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     commit(true);
+     location.reload(true);
+    },
+    error: function(jqXHR, textStatus, errorThrown) {
+     commit(false);
+    }
+   });
+  },
+  updaterow: function(rowid, rowdata, commit) {
+   var data = 'update=true&' + $.param(rowdata);
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     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 });
-	$("#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 });
+ // initialize the input fields.
+ $('#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 });
 
-	// initialize jqxGrid
-	$("#jqxgrid").jqxGrid({
-		width: 1280,
-		height: 630,
-		source: dataAdapter,
-		theme: theme,
-		showstatusbar: true,
-		renderstatusbar: function (statusbar) {
-			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 });
-			// add new row.
-			addButton.click(function (event) {
-				editrow = -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 (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);
-					$("#name").val(dataRecord.name);
-					$("#address").val(dataRecord.address);
-					$("#city").val(dataRecord.city);
-					$("#zip").val(dataRecord.zip);
-					$("#country").val(dataRecord.country);
-					$("#website").val(dataRecord.website);
-					$("#email").val(dataRecord.email);
-					$("#phone").val(dataRecord.phone);
-					$("#notes").val(dataRecord.notes);
-					// show the popup window.
-					$("#popupWindow").jqxWindow('open');
-				}
-			}
-		]
-	});
-	// initialize the popup window and buttons.
-	$("#popupWindow").jqxWindow({
-		width: 1050,
-		height: 550,
-		resizable: false,
-		theme: theme,
-		isModal: true,
-		autoOpen: false,
-		cancelButton: $("#Cancel"),
-		modalOpacity: 0.40
-	});
-	$("#popupWindow").on('open', function () {
-		$("#name").jqxInput('selectAll');
-	});
-	$("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme });
-	$("#Delete").click(function () {
-		if (editrow >= 0) {
-			// Open a popup to confirm this action.
-			$('#eventWindow').jqxWindow('open');
-			$("#delOk").click(function () {
-				var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
-				$("#jqxgrid").jqxGrid('deleterow', rowID);
-			});
-		}
-		$("#popupWindow").jqxWindow('hide');
-	});
-	$("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme });
-	$("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
-	// update the edited row when the user clicks the 'Save' button.
-	$("#Save").click(function () {
-		var row, rowID = -1;
-		if (editrow >= 0) {
-			rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
-		}
-		row = {
-			record: rowID,
-			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 (editrow >= 0) {
-			$('#jqxgrid').jqxGrid('updaterow', rowID, row);
-		} else {
-			$('#jqxgrid').jqxGrid('addrow', null, row);
-		}
-		$("#popupWindow").jqxWindow('hide');
-	});
-	createDelElements();
+ // initialize jqxGrid
+ $('#jqxgrid').jqxGrid({
+  width: 1280,
+  height: 630,
+  source: dataAdapter,
+  theme: theme,
+  showstatusbar: true,
+  renderstatusbar: function(statusbar) {
+   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 });
+   // add new row.
+   addButton.click(function(event) {
+    editrow = -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(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);
+     $('#name').val(dataRecord.name);
+     $('#address').val(dataRecord.address);
+     $('#city').val(dataRecord.city);
+     $('#zip').val(dataRecord.zip);
+     $('#country').val(dataRecord.country);
+     $('#website').val(dataRecord.website);
+     $('#email').val(dataRecord.email);
+     $('#phone').val(dataRecord.phone);
+     $('#notes').val(dataRecord.notes);
+     // show the popup window.
+     $('#popupWindow').jqxWindow('open');
+    }
+   }
+  ]
+ });
+ // initialize the popup window and buttons.
+ $('#popupWindow').jqxWindow({
+  width: 1050,
+  height: 550,
+  resizable: false,
+  theme: theme,
+  isModal: true,
+  autoOpen: false,
+  cancelButton: $('#Cancel'),
+  modalOpacity: 0.40
+ });
+ $('#popupWindow').on('open', function() {
+  $('#name').jqxInput('selectAll');
+ });
+ $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme });
+ $('#Delete').click(function() {
+  if (editrow >= 0) {
+   // Open a popup to confirm this action.
+   $('#eventWindow').jqxWindow('open');
+   $('#delOk').click(function() {
+    var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
+    $('#jqxgrid').jqxGrid('deleterow', rowID);
+   });
+  }
+  $('#popupWindow').jqxWindow('hide');
+ });
+ $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme });
+ $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme });
+ // update the edited row when the user clicks the 'Save' button.
+ $('#Save').click(function() {
+  var row, rowID = -1;
+  if (editrow >= 0) {
+   rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
+  }
+  row = {
+   record: rowID,
+   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 (editrow >= 0) {
+   $('#jqxgrid').jqxGrid('updaterow', rowID, row);
+  } else {
+   $('#jqxgrid').jqxGrid('addrow', null, row);
+  }
+  $('#popupWindow').jqxWindow('hide');
+ });
+ createDelElements();
 });
 
--- a/www/js/inv_waters.js	Sat Oct 19 13:54:38 2019 +0200
+++ b/www/js/inv_waters.js	Sat Oct 19 21:23:06 2019 +0200
@@ -22,279 +22,280 @@
 
 
 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');
+ $('#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 () {
+$(document).ready(function() {
+
+ // tooltips
+ $('#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.' });
 
-	// tooltips
-	$("#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 dataRecord = {},
-        url = 'includes/db_inventory_water.php',
-	// prepare the data
-	source = {
-		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: url,
-		deleterow: function (rowid, commit) {
-			// synchronize with the server - send delete command
-			var data = "delete=true&" + $.param({ record: rowid });
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function (jqXHR, textStatus, errorThrown) {
-					commit(false);
-				}
-			});
-		},
-		addrow: function (rowid, rowdata, position, commit) {
-			var data = "insert=true&" + $.param(rowdata);
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function(jqXHR, textStatus, errorThrown) {
-                                        commit(false);
-                                }
-                        });
-                },
-		updaterow: function (rowid, rowdata, commit) {
-			var data = "update=true&" + $.param(rowdata);
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function(jqXHR, textStatus, errorThrown) {
-					commit(false);
-				}
-			});
-		}
-	},
-	dataAdapter = new $.jqx.dataAdapter(source),
-        editrow = -1;
+ var dataRecord = {},
+ url = 'includes/db_inventory_water.php',
+ // prepare the data
+ source = {
+  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: url,
+  deleterow: function(rowid, commit) {
+   // synchronize with the server - send delete command
+   var data = 'delete=true&' + $.param({ record: rowid });
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     commit(true);
+     location.reload(true);
+    },
+    error: function(jqXHR, textStatus, errorThrown) {
+     commit(false);
+    }
+   });
+  },
+  addrow: function(rowid, rowdata, position, commit) {
+   var data = 'insert=true&' + $.param(rowdata);
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     commit(true);
+     location.reload(true);
+    },
+    error: function(jqXHR, textStatus, errorThrown) {
+     commit(false);
+    }
+   });
+  },
+  updaterow: function(rowid, rowdata, commit) {
+   var data = 'update=true&' + $.param(rowdata);
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     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 });
+ $('#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 });
 
-	// initialize the input fields.
-	$("#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 });
-	
-	// initialize jqxGrid
-	$("#jqxgrid").jqxGrid({
-		width: 1280,
-		height: 630,
-		source: dataAdapter,
-		theme: theme,
-		showstatusbar: true,
-		renderstatusbar: function (statusbar) {
-			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 });
-			// add new row.
-			addButton.click(function (event) {
-				editrow = -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 (index, datafield, value, defaultvalue, column, rowdata) {
-				var amount = "";
-				if (value > 0 && rowdata.unlimited_stock == 0)
-					amount = dataAdapter.formatNumber(value,"f1")+" L";
-				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";
-				}, 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.
-					dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
-					$("#name").val(dataRecord.name);
-					$("#unlimited_stock").val(dataRecord.unlimited_stock);
-					$("#calcium").val(dataRecord.calcium);
-					$("#bicarbonate").val(dataRecord.bicarbonate);
-					$("#sulfate").val(dataRecord.sulfate);
-					$("#chloride").val(dataRecord.chloride);
-					$("#sodium").val(dataRecord.sodium);
-					$("#magnesium").val(dataRecord.magnesium);
-					$("#ph").val(dataRecord.ph);
-					$("#notes").val(dataRecord.notes);
-					$("#total_alkalinity").val(dataRecord.total_alkalinity);
-					$("#inventory").val(dataRecord.inventory);
-					$("#cost").val(dataRecord.cost);
-					// show the popup window.
-					$("#popupWindow").jqxWindow('open');
-				}
-			}
-		]
-	});
+ // initialize jqxGrid
+ $('#jqxgrid').jqxGrid({
+  width: 1280,
+  height: 630,
+  source: dataAdapter,
+  theme: theme,
+  showstatusbar: true,
+  renderstatusbar: function(statusbar) {
+   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 });
+   // add new row.
+   addButton.click(function(event) {
+    editrow = -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(index, datafield, value, defaultvalue, column, rowdata) {
+     var amount = '';
+     if (value > 0 && rowdata.unlimited_stock == 0)
+      amount = dataAdapter.formatNumber(value, 'f1') + ' L';
+     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';
+    }, 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.
+     dataRecord = $('#jqxgrid').jqxGrid('getrowdata', editrow);
+     $('#name').val(dataRecord.name);
+     $('#unlimited_stock').val(dataRecord.unlimited_stock);
+     $('#calcium').val(dataRecord.calcium);
+     $('#bicarbonate').val(dataRecord.bicarbonate);
+     $('#sulfate').val(dataRecord.sulfate);
+     $('#chloride').val(dataRecord.chloride);
+     $('#sodium').val(dataRecord.sodium);
+     $('#magnesium').val(dataRecord.magnesium);
+     $('#ph').val(dataRecord.ph);
+     $('#notes').val(dataRecord.notes);
+     $('#total_alkalinity').val(dataRecord.total_alkalinity);
+     $('#inventory').val(dataRecord.inventory);
+     $('#cost').val(dataRecord.cost);
+     // show the popup window.
+     $('#popupWindow').jqxWindow('open');
+    }
+   }
+  ]
+ });
 
-	$("#total_alkalinity").on('change', function (event) {
-		dataRecord.bicarbonate = parseFloat(event.args.value) * 1.22;
-		$("#bicarbonate").val(dataRecord.bicarbonate);
-	});
-	$("#bicarbonate").on('change', function (event) {
-		dataRecord.total_alkalinity = parseFloat(event.args.value) * 50 / 61;
-		$("#total_alkalinity").val(dataRecord.total_alkalinity);
-	});
+ $('#total_alkalinity').on('change', function(event) {
+  dataRecord.bicarbonate = parseFloat(event.args.value) * 1.22;
+  $('#bicarbonate').val(dataRecord.bicarbonate);
+ });
+ $('#bicarbonate').on('change', function(event) {
+  dataRecord.total_alkalinity = parseFloat(event.args.value) * 50 / 61;
+  $('#total_alkalinity').val(dataRecord.total_alkalinity);
+ });
 
-	// initialize the popup window and buttons.
-	$("#popupWindow").jqxWindow({
-		width: 1050,
-		height: 550,
-		resizable: false,
-		theme: theme,
-		isModal: true,
-		autoOpen: false,
-		cancelButton: $("#Cancel"),
-		modalOpacity: 0.40
-	});
-	$("#popupWindow").on('open', function () {
-		$("#name").jqxInput('selectAll');
-	});
-	$("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme });
-	$("#Delete").click(function () {
-		if (editrow >= 0) {
-			// Open a popup to confirm this action.
-			$('#eventWindow').jqxWindow('open');
-			$("#delOk").click(function () {
-				var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
-				$("#jqxgrid").jqxGrid('deleterow', rowID);
-			});
-		}
-		$("#popupWindow").jqxWindow('hide');
-	});
-	$("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme });
-	$("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
-	// update the edited row when the user clicks the 'Save' button.
-	$("#Save").click(function () {
-		var row, rowID = -1;
-		if (editrow >= 0) {
-			rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
-		}
-		row = {
-			record: rowID,
-			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 (editrow >= 0) {
-			$('#jqxgrid').jqxGrid('updaterow', rowID, row);
-		} else {
-			$('#jqxgrid').jqxGrid('addrow', null, row);
-		}
-		$("#popupWindow").jqxWindow('hide');
-	});
-	createDelElements();
+ // initialize the popup window and buttons.
+ $('#popupWindow').jqxWindow({
+  width: 1050,
+  height: 550,
+  resizable: false,
+  theme: theme,
+  isModal: true,
+  autoOpen: false,
+  cancelButton: $('#Cancel'),
+  modalOpacity: 0.40
+ });
+ $('#popupWindow').on('open', function() {
+  $('#name').jqxInput('selectAll');
+ });
+ $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme });
+ $('#Delete').click(function() {
+  if (editrow >= 0) {
+   // Open a popup to confirm this action.
+   $('#eventWindow').jqxWindow('open');
+   $('#delOk').click(function() {
+    var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
+    $('#jqxgrid').jqxGrid('deleterow', rowID);
+   });
+  }
+  $('#popupWindow').jqxWindow('hide');
+ });
+ $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme });
+ $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme });
+ // update the edited row when the user clicks the 'Save' button.
+ $('#Save').click(function() {
+  var row, rowID = -1;
+  if (editrow >= 0) {
+   rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
+  }
+  row = {
+   record: rowID,
+   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 (editrow >= 0) {
+   $('#jqxgrid').jqxGrid('updaterow', rowID, row);
+  } else {
+   $('#jqxgrid').jqxGrid('addrow', null, row);
+  }
+  $('#popupWindow').jqxWindow('hide');
+ });
+ createDelElements();
 });
 
--- a/www/js/inv_yeasts.js	Sat Oct 19 13:54:38 2019 +0200
+++ b/www/js/inv_yeasts.js	Sat Oct 19 21:23:06 2019 +0200
@@ -22,462 +22,464 @@
 
 
 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');
+ $('#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 calcTotal() {
+ function calcTotal() {
 
-		$('#totval').val(dataRecord.cost * dataRecord.inventory);
-		if (dataRecord.form == 'Vloeibaar') { // Liquid
-			$("#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 (dataRecord.form == 'Droog' || dataRecord.form == 'Gedroogd') { // Dry
-			$("#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 });
-		}
-	}
+  $('#totval').val(dataRecord.cost * dataRecord.inventory);
+  if (dataRecord.form == 'Vloeibaar') { // Liquid
+   $('#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 (dataRecord.form == 'Droog' || dataRecord.form == 'Gedroogd') { // Dry
+   $('#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 dataRecord = {},
-	url = 'includes/db_inventory_yeasts.php',
-	source = {
-		datatype: 'json',
-		cache: false,
-		datafields: [
-			{ name: 'record', type: 'number' },
-			{ name: 'name', type: 'string' },
-			{ name: 'type', type: 'string' },
-			{ name: 'form', type: 'string' },
-			{ 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' },
-			{ name: 'sta1', type: 'int' },
-			{ name: 'bacteria', type: 'int' },
-			{ name: 'harvest_top', type: 'int' },
-			{ name: 'harvest_time', type: 'int' },
-			{ name: 'pitch_temperature', type: 'float' },
-			{ name: 'pofpos', type: 'int' },
-			{ name: 'zymocide', type: 'int' }
-		],
-		id: 'record',
-		url: url,
-		deleterow: function (rowid, commit) {
-			// synchronize with the server - send delete command
-			var data = "delete=true&" + $.param({ record: rowid });
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function (jqXHR, textStatus, errorThrown) {
-					commit(false);
-				}
-			});
-		},
-		addrow: function (rowid, rowdata, position, commit) {
-			var data = "insert=true&" + $.param(rowdata);
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function(jqXHR, textStatus, errorThrown) {
-					commit(false);
-				}
-			});
-		},
-		updaterow: function (rowid, rowdata, commit) {
-			var data = "update=true&" + $.param(rowdata);
-			$.ajax({
-				dataType: 'json',
-				url: url,
-				cache: false,
-				data: data,
-				type: "POST",
-				success: function (data, status, xhr) {
-					commit(true);
-					location.reload( true );
-				},
-				error: function(jqXHR, textStatus, errorThrown) {
-					commit(false);
-				}
-			});
-		}
-	},
-	dataAdapter = new $.jqx.dataAdapter(source),
-        editrow = -1;
+ var dataRecord = {},
+ url = 'includes/db_inventory_yeasts.php',
+ source = {
+  datatype: 'json',
+  cache: false,
+  datafields: [
+   { name: 'record', type: 'number' },
+   { name: 'name', type: 'string' },
+   { name: 'type', type: 'string' },
+   { name: 'form', type: 'string' },
+   { 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' },
+   { name: 'sta1', type: 'int' },
+   { name: 'bacteria', type: 'int' },
+   { name: 'harvest_top', type: 'int' },
+   { name: 'harvest_time', type: 'int' },
+   { name: 'pitch_temperature', type: 'float' },
+   { name: 'pofpos', type: 'int' },
+   { name: 'zymocide', type: 'int' }
+  ],
+  id: 'record',
+  url: url,
+  deleterow: function(rowid, commit) {
+   // synchronize with the server - send delete command
+   var data = 'delete=true&' + $.param({ record: rowid });
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     commit(true);
+     location.reload(true);
+    },
+    error: function(jqXHR, textStatus, errorThrown) {
+     commit(false);
+    }
+   });
+  },
+  addrow: function(rowid, rowdata, position, commit) {
+   var data = 'insert=true&' + $.param(rowdata);
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     commit(true);
+     location.reload(true);
+    },
+    error: function(jqXHR, textStatus, errorThrown) {
+     commit(false);
+    }
+   });
+  },
+  updaterow: function(rowid, rowdata, commit) {
+   var data = 'update=true&' + $.param(rowdata);
+   $.ajax({
+    dataType: 'json',
+    url: url,
+    cache: false,
+    data: data,
+    type: 'POST',
+    success: function(data, status, xhr) {
+     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 });
-	$("#product_id").jqxInput({ theme: theme, width: 320, height: 23 });
-	$("#type").jqxDropDownList({
-		theme: theme,
-		source: YeastTypeAdapter,
-		valueMember: 'nl',
-		displayMember: 'nl',
-		width: 180,
-		height: 23,
-		autoDropDownHeight: true
-	});
-	$("#form").jqxDropDownList({
-		theme: theme,
-		source: YeastFormAdapter,
-		valueMember: 'nl',
-		displayMember: 'nl',
-		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 });
-	$('#sta1').jqxCheckBox({ theme: theme, width: 120, height: 23 });
-	$('#sta1').on('checked', function(event) { dataRecord.sta1 = 1; });
-	$('#sta1').on('unchecked', function(event) { dataRecord.sta1 = 0; });
-        $('#bacteria').jqxCheckBox({ theme: theme, width: 120, height: 23 });
-        $('#bacteria').on('checked', function(event) { dataRecord.bacteria = 1; });
-        $('#bacteria').on('unchecked', function(event) { dataRecord.bacteria = 0; });
-        $('#harvest_top').jqxCheckBox({ theme: theme, width: 120, height: 23 });
-        $('#harvest_top').on('checked', function(event) { dataRecord.harvest_top = 1; });
-        $('#harvest_top').on('unchecked', function(event) { dataRecord.harvest_top = 0; });
-	$('#harvest_time').jqxNumberInput( PosInt );
-	$("#pitch_temperature").jqxNumberInput( YeastT );
-        $('#pofpos').jqxCheckBox({ theme: theme, width: 120, height: 23 });
-        $('#pofpos').on('checked', function(event) { dataRecord.pofpos = 1; });
-        $('#pofpos').on('unchecked', function(event) { dataRecord.pofpos = 0; });
-	$("#zymocide").jqxDropDownList({
-                theme: theme,
-                source: ZymocideAdapter,
-                valueMember: 'id',
-                displayMember: 'nl',
-                width: 80,
-                height: 23,
-                autoDropDownHeight: true
-        });
+ // initialize the input fields.
+ $('#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: 'nl',
+  displayMember: 'nl',
+  width: 180,
+  height: 23,
+  autoDropDownHeight: true
+ });
+ $('#form').jqxDropDownList({
+  theme: theme,
+  source: YeastFormAdapter,
+  valueMember: 'nl',
+  displayMember: 'nl',
+  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 });
+ $('#sta1').jqxCheckBox({ theme: theme, width: 120, height: 23 });
+ $('#sta1').on('checked', function(event) { dataRecord.sta1 = 1; });
+ $('#sta1').on('unchecked', function(event) { dataRecord.sta1 = 0; });
+ $('#bacteria').jqxCheckBox({ theme: theme, width: 120, height: 23 });
+ $('#bacteria').on('checked', function(event) { dataRecord.bacteria = 1; });
+ $('#bacteria').on('unchecked', function(event) { dataRecord.bacteria = 0; });
+ $('#harvest_top').jqxCheckBox({ theme: theme, width: 120, height: 23 });
+ $('#harvest_top').on('checked', function(event) { dataRecord.harvest_top = 1; });
+ $('#harvest_top').on('unchecked', function(event) { dataRecord.harvest_top = 0; });
+ $('#harvest_time').jqxNumberInput(PosInt);
+ $('#pitch_temperature').jqxNumberInput(YeastT);
+ $('#pofpos').jqxCheckBox({ theme: theme, width: 120, height: 23 });
+ $('#pofpos').on('checked', function(event) { dataRecord.pofpos = 1; });
+ $('#pofpos').on('unchecked', function(event) { dataRecord.pofpos = 0; });
+ $('#zymocide').jqxDropDownList({
+  theme: theme,
+  source: ZymocideAdapter,
+  valueMember: 'id',
+  displayMember: 'nl',
+  width: 80,
+  height: 23,
+  autoDropDownHeight: true
+ });
 
-	// initialize jqxGrid
-	$("#jqxgrid").jqxGrid({
-		width: 1280,
-		height: 630,
-		source: dataAdapter,
-		theme: theme,
-		showstatusbar: true,
-		renderstatusbar: function(statusbar) {
-			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);
-			addButton.jqxButton({ theme: theme, width: 90, height: 20 });
-			impButton.jqxButton({ theme: theme, width: 90, height: 20 });
-			// add new row.
-			addButton.click(function (event) {
-				editrow = -1;
-				$("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } });
-				$("#name").val('');
-				$("#laboratory").val('');
-				$("#product_id").val('');
-				$("#type").val('Bovengist');
-				$("#form").val('Vloeibaar');
-				$("#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);
-				$("#sta1").val(0);
-				$("#bacteria").val(0);
-				$("#harvest_top").val(0);
-				$("#harvest_time").val(0);
-				$("#pitch_temperature").val(0);
-				$("#pofpos").val(0);
-				$("#zymocide").val(0);
-				$("#popupWindow").jqxWindow('open');
-			});
-			impButton.click(function (event) {
-				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', width: 110 },
-			{ text: 'Vorm', datafield: 'form', align: 'center', cellsalign: 'center', width: 110 },
-			{ 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 (index, datafield, value, defaultvalue, column, rowdata) {
-				var amount = "";
-				if (value > 0)
-					amount = dataAdapter.formatNumber(value, "p0");
-				return  '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>';
-			  }
-			},
-			{ text: 'Voorraad', datafield: 'inventory', width: 100, align: 'right', menu: false,
-			  cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
-				var amount = "";
-				if (value > 0) {
-					if ((rowdata.form == 'Vloeibaar') && (value > 1))
-						amount = dataAdapter.formatNumber(value,"f0")+" pakken";
-					else if (rowdata.form == 'Vloeibaar')
-						amount = dataAdapter.formatNumber(value,"f0")+" pak";
-					else if (rowdata.form == 'Droog' || rowdata.form == 'Gedroogd')
-						amount = dataAdapter.formatNumber(value * 1000,"f1")+" gram";
-					else
-						amount = dataAdapter.formatNumber(value * 1000,"f1")+" ml";
-				}
-				return "<span style='margin: 3px; margin-top: 6px; float: right;'>" + amount + "</span>";
-			  }
-			},
-			{ text: '', datafield: 'Edit', 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;
-					$("#popupWindow").jqxWindow({ position: { x: 110, y: 15 } });
-					// get the clicked row's data and initialize the input fields.
-					dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
-					$("#name").val(dataRecord.name);
-					$("#laboratory").val(dataRecord.laboratory);
-					$("#product_id").val(dataRecord.product_id);
-					$("#type").val(dataRecord.type);
-					$("#form").val(dataRecord.form);
-					$("#min_temperature").val(parseFloat(dataRecord.min_temperature));
-					$("#max_temperature").val(parseFloat(dataRecord.max_temperature));
-					$("#flocculation").val(dataRecord.flocculation);
-					$("#attenuation").val(dataRecord.attenuation);
-					$("#notes").val(dataRecord.notes);
-					$("#best_for").val(dataRecord.best_for);
-					$("#max_reuse").val(dataRecord.max_reuse);
-					if (dataRecord.form == 'Vloeibaar')
-						$("#inventory").val(dataRecord.inventory);
-					else
-						$("#inventory").val(dataRecord.inventory * 1000);
-					$("#cost").val(dataRecord.cost);
-					$("#production_date").val(dataRecord.production_date);
-					$("#tht_date").val(dataRecord.tht_date);
-					$("#cells").val(dataRecord.cells);
-					$("#tolerance").val(dataRecord.tolerance);
-					$("#sta1").val(dataRecord.sta1);
-					$("#bacteria").val(dataRecord.bacteria);
-					$("#harvest_top").val(dataRecord.harvest_top);
-					$("#harvest_time").val(dataRecord.harvest_time);
-					$("#pitch_temperature").val(parseFloat(dataRecord.pitch_temperature));
-					$("#pofpos").val(dataRecord.pofpos);
-					$("#zymocide").val(dataRecord.zymocide);
-					calcTotal();
-					// show the popup window.
-					$("#popupWindow").jqxWindow('open');
-				}
-			}
-		]
-	});
+ // initialize jqxGrid
+ $('#jqxgrid').jqxGrid({
+  width: 1280,
+  height: 630,
+  source: dataAdapter,
+  theme: theme,
+  showstatusbar: true,
+  renderstatusbar: function(statusbar) {
+   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);
+   addButton.jqxButton({ theme: theme, width: 90, height: 20 });
+   impButton.jqxButton({ theme: theme, width: 90, height: 20 });
+   // add new row.
+   addButton.click(function(event) {
+    editrow = -1;
+    $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } });
+    $('#name').val('');
+    $('#laboratory').val('');
+    $('#product_id').val('');
+    $('#type').val('Bovengist');
+    $('#form').val('Vloeibaar');
+    $('#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);
+    $('#sta1').val(0);
+    $('#bacteria').val(0);
+    $('#harvest_top').val(0);
+    $('#harvest_time').val(0);
+    $('#pitch_temperature').val(0);
+    $('#pofpos').val(0);
+    $('#zymocide').val(0);
+    $('#popupWindow').jqxWindow('open');
+   });
+   impButton.click(function(event) {
+    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', width: 110 },
+   { text: 'Vorm', datafield: 'form', align: 'center', cellsalign: 'center', width: 110 },
+   { 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(index, datafield, value, defaultvalue, column, rowdata) {
+     var amount = '';
+     if (value > 0)
+      amount = dataAdapter.formatNumber(value, 'p0');
+     return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>';
+    }
+   },
+   { text: 'Voorraad', datafield: 'inventory', width: 100, align: 'right', menu: false,
+    cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
+     var amount = '';
+     if (value > 0) {
+      if ((rowdata.form == 'Vloeibaar') && (value > 1))
+       amount = dataAdapter.formatNumber(value, 'f0') + ' pakken';
+      else if (rowdata.form == 'Vloeibaar')
+       amount = dataAdapter.formatNumber(value, 'f0') + ' pak';
+      else if (rowdata.form == 'Droog' || rowdata.form == 'Gedroogd')
+       amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gram';
+      else
+       amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' ml';
+     }
+     return '<span style="margin: 3px; margin-top: 6px; float: right;">' + amount + '</span>';
+    }
+   },
+   { text: '', datafield: 'Edit', 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;
+     $('#popupWindow').jqxWindow({ position: { x: 110, y: 15 } });
+     // get the clicked row's data and initialize the input fields.
+     dataRecord = $('#jqxgrid').jqxGrid('getrowdata', editrow);
+     $('#name').val(dataRecord.name);
+     $('#laboratory').val(dataRecord.laboratory);
+     $('#product_id').val(dataRecord.product_id);
+     $('#type').val(dataRecord.type);
+     $('#form').val(dataRecord.form);
+     $('#min_temperature').val(parseFloat(dataRecord.min_temperature));
+     $('#max_temperature').val(parseFloat(dataRecord.max_temperature));
+     $('#flocculation').val(dataRecord.flocculation);
+     $('#attenuation').val(dataRecord.attenuation);
+     $('#notes').val(dataRecord.notes);
+     $('#best_for').val(dataRecord.best_for);
+     $('#max_reuse').val(dataRecord.max_reuse);
+     if (dataRecord.form == 'Vloeibaar')
+      $('#inventory').val(dataRecord.inventory);
+     else
+      $('#inventory').val(dataRecord.inventory * 1000);
+     $('#cost').val(dataRecord.cost);
+     $('#production_date').val(dataRecord.production_date);
+     $('#tht_date').val(dataRecord.tht_date);
+     $('#cells').val(dataRecord.cells);
+     $('#tolerance').val(dataRecord.tolerance);
+     $('#sta1').val(dataRecord.sta1);
+     $('#bacteria').val(dataRecord.bacteria);
+     $('#harvest_top').val(dataRecord.harvest_top);
+     $('#harvest_time').val(dataRecord.harvest_time);
+     $('#pitch_temperature').val(parseFloat(dataRecord.pitch_temperature));
+     $('#pofpos').val(dataRecord.pofpos);
+     $('#zymocide').val(dataRecord.zymocide);
+     calcTotal();
+     // show the popup window.
+     $('#popupWindow').jqxWindow('open');
+    }
+   }
+  ]
+ });
 
-	$('#popupWindow').on('open', function (event) { calcTotal(); });
-	$("#cost").on('change', function (event) {
-		dataRecord.cost = parseFloat(event.args.value);
-		calcTotal();
-	});
-	$("#inventory").on('change', function (event) {
-		if (dataRecord.form == 'Vloeibaar')
-			dataRecord.inventory = parseFloat(event.args.value);
-		else
-			dataRecord.inventory = parseFloat(event.args.value) / 1000.0;
-		calcTotal();
-	});
-	$("#form").on('select', function (event) {
-		dataRecord.form = $("#form").val();
-		calcTotal();
-	});
+ $('#popupWindow').on('open', function(event) { calcTotal(); });
+ $('#cost').on('change', function(event) {
+  dataRecord.cost = parseFloat(event.args.value);
+  calcTotal();
+ });
+ $('#inventory').on('change', function(event) {
+  if (dataRecord.form == 'Vloeibaar')
+   dataRecord.inventory = parseFloat(event.args.value);
+  else
+   dataRecord.inventory = parseFloat(event.args.value) / 1000.0;
+  calcTotal();
+ });
+ $('#form').on('select', function(event) {
+  dataRecord.form = $('#form').val();
+  calcTotal();
+ });
 
-	// initialize the popup window and buttons.
-	$("#popupWindow").jqxWindow({
-		width: 1050,
-		height: 625,
-		resizable: false,
-		theme: theme,
-		isModal: true,
-		autoOpen: false,
-		cancelButton: $("#Cancel"),
-		modalOpacity: 0.40
-	});
-	$("#popupWindow").on('open', function () {
-		$("#name").jqxInput('selectAll');
-	});
-	$("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme });
-	$("#Delete").click(function() {
-		if (editrow >= 0) {
-			// Open a popup to confirm this action.
-			$('#eventWindow').jqxWindow('open');
-			$("#delOk").click(function () {
-				var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
-				$("#jqxgrid").jqxGrid('deleterow', rowID);
-			});
-		}
-		$("#popupWindow").jqxWindow('hide');
-	});
-	$("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme });
-	$("#Clone").jqxButton({ template: "warning", width: '90px', theme: theme });
-	$("#Clone").click(function() {
-		var row = {
-			record: -1,
-			name: $("#name").val()+" kopie",
-			type: $("#type").val(),
-			form: $("#form").val(),
-			laboratory: $("#laboratory").val(),
-			product_id: $("#product_id").val(),
-			min_temperature: parseFloat($("#min_temperature").jqxNumberInput('decimal')),
-			max_temperature: parseFloat($("#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')),
-			sta1: $("#sta1").val(),
-			bacteria: $("#bacteria").val(),
-			harvest_top: $("#harvest_top").val(),
-			harvest_time: $("#harvest_time").val(),
-			pitch_temperature: parseFloat($("#pitch_temperature").jqxNumberInput('decimal')),
-			pofpos: $("#pofpos").val(),
-			zymocide: $("#zymocide").val()
-		};
-		$('#jqxgrid').jqxGrid('addrow', null, row);
-		$("#popupWindow").jqxWindow('hide');
-	});
-	$("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
-	// update the edited row when the user clicks the 'Save' button.
-	$("#Save").click(function() {
-		var n_inventory, row, rowID = -1;
-		if (editrow >= 0) {
-			rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
-		}
-		if (dataRecord.form == 'Vloeibaar')
-			n_inventory = parseFloat($("#inventory").jqxNumberInput('decimal'));
-		else
-			n_inventory = parseFloat($("#inventory").jqxNumberInput('decimal')) / 1000.0;
-		row = {
-			record: rowID,
-			name: $("#name").val(),
-			type: $("#type").val(),
-			form: $("#form").val(),
-			laboratory: $("#laboratory").val(),
-			product_id: $("#product_id").val(),
-			min_temperature: parseFloat($("#min_temperature").jqxNumberInput('decimal')),
-			max_temperature: parseFloat($("#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: n_inventory,
-			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')),
-			sta1: $("#sta1").val(),
-                        bacteria: $("#bacteria").val(),
-                        harvest_top: $("#harvest_top").val(),
-                        harvest_time: $("#harvest_time").val(),
-                        pitch_temperature: parseFloat($("#pitch_temperature").jqxNumberInput('decimal')),
-                        pofpos: $("#pofpos").val(),
-                        zymocide: $("#zymocide").val()
-		};
-		if (editrow >= 0) {
-			$('#jqxgrid').jqxGrid('updaterow', rowID, row);
-		} else {
-			$('#jqxgrid').jqxGrid('addrow', null, row);
-		}
-		$("#popupWindow").jqxWindow('hide');
-	});
-	createDelElements();
+ // initialize the popup window and buttons.
+ $('#popupWindow').jqxWindow({
+  width: 1050,
+  height: 625,
+  resizable: false,
+  theme: theme,
+  isModal: true,
+  autoOpen: false,
+  cancelButton: $('#Cancel'),
+  modalOpacity: 0.40
+ });
+ $('#popupWindow').on('open', function() {
+  $('#name').jqxInput('selectAll');
+ });
+ $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme });
+ $('#Delete').click(function() {
+  if (editrow >= 0) {
+   // Open a popup to confirm this action.
+   $('#eventWindow').jqxWindow('open');
+   $('#delOk').click(function() {
+    var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
+    $('#jqxgrid').jqxGrid('deleterow', rowID);
+   });
+  }
+  $('#popupWindow').jqxWindow('hide');
+ });
+ $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme });
+ $('#Clone').jqxButton({ template: 'warning', width: '90px', theme: theme });
+ $('#Clone').click(function() {
+  var row = {
+   record: -1,
+   name: $('#name').val() + ' kopie',
+   type: $('#type').val(),
+   form: $('#form').val(),
+   laboratory: $('#laboratory').val(),
+   product_id: $('#product_id').val(),
+   min_temperature: parseFloat($('#min_temperature').jqxNumberInput('decimal')),
+   max_temperature: parseFloat($('#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')),
+   sta1: $('#sta1').val(),
+   bacteria: $('#bacteria').val(),
+   harvest_top: $('#harvest_top').val(),
+   harvest_time: $('#harvest_time').val(),
+   pitch_temperature: parseFloat($('#pitch_temperature').jqxNumberInput('decimal')),
+   pofpos: $('#pofpos').val(),
+   zymocide: $('#zymocide').val()
+  };
+  $('#jqxgrid').jqxGrid('addrow', null, row);
+  $('#popupWindow').jqxWindow('hide');
+ });
+ $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme });
+ // update the edited row when the user clicks the 'Save' button.
+ $('#Save').click(function() {
+  var n_inventory, row, rowID = -1;
+  if (editrow >= 0) {
+   rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
+  }
+  if (dataRecord.form == 'Vloeibaar')
+   n_inventory = parseFloat($('#inventory').jqxNumberInput('decimal'));
+  else
+   n_inventory = parseFloat($('#inventory').jqxNumberInput('decimal')) / 1000.0;
+  row = {
+   record: rowID,
+   name: $('#name').val(),
+   type: $('#type').val(),
+   form: $('#form').val(),
+   laboratory: $('#laboratory').val(),
+   product_id: $('#product_id').val(),
+   min_temperature: parseFloat($('#min_temperature').jqxNumberInput('decimal')),
+   max_temperature: parseFloat($('#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: n_inventory,
+   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')),
+   sta1: $('#sta1').val(),
+   bacteria: $('#bacteria').val(),
+   harvest_top: $('#harvest_top').val(),
+   harvest_time: $('#harvest_time').val(),
+   pitch_temperature: parseFloat($('#pitch_temperature').jqxNumberInput('decimal')),
+   pofpos: $('#pofpos').val(),
+   zymocide: $('#zymocide').val()
+  };
+  if (editrow >= 0) {
+   $('#jqxgrid').jqxGrid('updaterow', rowID, row);
+  } else {
+   $('#jqxgrid').jqxGrid('addrow', null, row);
+  }
+  $('#popupWindow').jqxWindow('hide');
+ });
+ createDelElements();
 });
 

mercurial