Added alcohol tolerance field in the yeasts database.

Sun, 03 Mar 2019 16:27:39 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 03 Mar 2019 16:27:39 +0100
changeset 313
9f45d09c2071
parent 312
ec26ad6ff509
child 314
f943efa07d9f

Added alcohol tolerance field in the yeasts database.

README.design file | annotate | diff | comparison | revisions
www/includes/db_inventory_yeasts.php file | annotate | diff | comparison | revisions
www/inv_yeasts.php file | annotate | diff | comparison | revisions
www/js/inv_yeasts.js file | annotate | diff | comparison | revisions
--- a/README.design	Sun Mar 03 13:26:58 2019 +0100
+++ b/README.design	Sun Mar 03 16:27:39 2019 +0100
@@ -143,3 +143,9 @@
 
 Export ingredienten naar xml.
 
+Extra:
+
+Gisten alcohol_tolerance veld toevoegen.
+Gist typen: kveik en brett? Apart of niet.
+
+
--- a/www/includes/db_inventory_yeasts.php	Sun Mar 03 13:26:58 2019 +0100
+++ b/www/includes/db_inventory_yeasts.php	Sun Mar 03 16:27:39 2019 +0100
@@ -32,6 +32,7 @@
 	$sql .= "', best_for='" . mysqli_real_escape_string($connect, $_POST['best_for']);
 	$sql .= "', max_reuse='" . $_POST['max_reuse'];
 	$sql .= "', cells='" . floatval($_POST['cells']) * 1000000000.0;
+	$sql .= "', tolerance='" . $_POST['tolerance'];
 	$sql .= "', inventory='" . $_POST['inventory'];
 	$sql .= "', cost='" . $_POST['cost'] . "'";
 	if ($_POST['production_date'] == '')
@@ -97,7 +98,8 @@
 			'cost' => $row['cost'],
 			'production_date' => $row['production_date'],
 			'tht_date' => $row['tht_date'],
-			'cells' => floatval($row['cells']) / 1000000000.0
+			'cells' => floatval($row['cells']) / 1000000000.0,
+			'tolerance' => $row['tolerance']
 		);
 	}
 	header("Content-type: application/json");
--- a/www/inv_yeasts.php	Sun Mar 03 13:26:58 2019 +0100
+++ b/www/inv_yeasts.php	Sun Mar 03 16:27:39 2019 +0100
@@ -45,8 +45,8 @@
        <td align="left"><div id="attenuation"></div></td>
       </tr>
       <tr>
-       <td rowspan="3" align="right" style="vertical-align: top;">Geschikt voor:</td>
-       <td rowspan="3" align="left"><textarea id="best_for"></textarea></td>
+       <td rowspan="4" align="right" style="vertical-align: top;">Geschikt voor:</td>
+       <td rowspan="4" align="left"><textarea id="best_for"></textarea></td>
        <td align="right" style="vertical-align: top;">Maximum Hergebruik:</td>
        <td align="left"><div id="max_reuse"></div></td>
       </tr>
@@ -59,6 +59,10 @@
        <td align="left"><div id="cells"></div></td>
       </tr>
       <tr>
+       <td align="right" style="vertical-align: top;"><div id="pmpt_cells">Alcohol tolerantie:</div></td>
+       <td align="left"><div id="tolerance"></div></td>
+      </tr>
+      <tr>
        <td colspan="4"><hr></td>
       </tr>
       <tr>
--- a/www/js/inv_yeasts.js	Sun Mar 03 13:26:58 2019 +0100
+++ b/www/js/inv_yeasts.js	Sun Mar 03 16:27:39 2019 +0100
@@ -90,7 +90,8 @@
 			{ name: 'cost', type: 'float' },
 			{ name: 'production_date', type: 'string' },
 			{ name: 'tht_date', type: 'string' },
-			{ name: 'cells', type: 'float' }
+			{ name: 'cells', type: 'float' },
+			{ name: 'tolerance', type: 'float' }
 		],
 		id: 'record',
 		url: url,
@@ -170,7 +171,7 @@
 		autoDropDownHeight: true
 	});
 	$("#notes").jqxInput({ theme: theme, width: 800, height: 120 });
-	$("#best_for").jqxInput({ theme: theme, width: 320, height: 75 });
+	$("#best_for").jqxInput({ theme: theme, width: 320, height: 100 });
 	$("#inventory").jqxNumberInput( Spin1dec );
 	$("#production_date").jqxDateTimeInput( Dateopts );
 	$("#min_temperature").jqxNumberInput( YeastT );
@@ -191,6 +192,8 @@
 	$("#tht_date").jqxDateTimeInput( Dateopts );
 	$("#totval").jqxNumberInput( Show2dec );
 	$("#cells").jqxNumberInput( Spin1dec );
+	$("#tolerance").jqxNumberInput( Perc1dec );
+	$("#tolerance").jqxNumberInput({ max: 25 });
 
 	var dataAdapter = new $.jqx.dataAdapter(source);
 	var editrow = -1;
@@ -231,6 +234,7 @@
 				$("#production_date").val('');
 				$("#tht_date").val('');
 				$("#cells").val(1);
+				$("#tolerance").val(0);
 				$("#popupWindow").jqxWindow('open');
 			});
 			impButton.click(function (event) {
@@ -254,7 +258,15 @@
 				return "<div style='margin: 4px;' class='jqx-center-align'>" + YeastFormData[value].nl + "</div>";
 			  }
 			},
-			{ text: 'SVG', datafield: 'attenuation', width: 80, align: 'right', cellsalign: 'right', menu: false, cellsformat: 'p1' },
+			{ 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 = "";
@@ -299,6 +311,7 @@
 					$("#production_date").val(dataRecord.production_date);
 					$("#tht_date").val(dataRecord.tht_date);
 					$("#cells").val(dataRecord.cells);
+					$("#tolerance").val(dataRecord.tolerance);
 					calcTotal();
 					// show the popup window.
 					$("#popupWindow").jqxWindow('open');
@@ -329,7 +342,7 @@
 	// initialize the popup window and buttons.
 	$("#popupWindow").jqxWindow({
 		width: 1050,
-		height: 550,
+		height: 575,
 		resizable: false,
 		theme: theme,
 		isModal: true,
@@ -382,7 +395,8 @@
 			cost: parseFloat($("#cost").jqxNumberInput('decimal')),
 			production_date: $("#production_date").val(),
 			tht_date: $("#tht_date").val(),
-			cells: parseFloat($("#cells").jqxNumberInput('decimal'))
+			cells: parseFloat($("#cells").jqxNumberInput('decimal')),
+			tolerance: parseFloat($("#tolerance").jqxNumberInput('decimal'))
 		};
 		if (editrow >= 0) {
 			$('#jqxgrid').jqxGrid('updaterow', rowID, row);

mercurial