www/js/prod_edit.js

changeset 438
61436d428454
parent 433
c2d42c5ae51b
child 439
b72478cd2c18
--- a/www/js/prod_edit.js	Thu Jul 11 16:53:34 2019 +0200
+++ b/www/js/prod_edit.js	Sun Jul 14 15:25:23 2019 +0200
@@ -21,25 +21,15 @@
  *****************************************************************************/
 
 
-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');
+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');
 }
 
 
@@ -103,16 +93,9 @@
 	$('#jqxMenu').jqxMenu('destroy');
 
 	console.log("record:" + my_record + "  return:" + my_return + "  theme:" + theme);
-        $("#jqxLoader").jqxLoader({
-                width: 250,
-                height: 150,
-                isModal: true,
-                text: "Laden product ...",
-                theme: theme
-        });
+        $("#jqxLoader").jqxLoader({width:250,height:150,isModal:true,text:"Laden product ...",theme:theme});
 
 	function calcSupplies() {
-
 		if (dataRecord.inventory_reduced > 6) {
 			$("#ok_pmpt").hide();
 			return;
@@ -251,7 +234,7 @@
 		fermentableInit = 0;
 		$("#ferm_lintner").val(Math.round(parseFloat(lintner / mashkg)));
 		$("#mash_kg").val(mashkg);
-		console.log("calcFermentables() supplies:"+ok_fermentables);
+		console.log("calcFermentables() supplies:"+ok_fermentables+" moutsuiker:"+sugarsm+"/"+sugarsf);
 		to_100 = my_100;
 		if (to_100) {
 			$("#wf_amount").jqxNumberInput({ width: 90, readOnly: true, spinButtons: false  });
@@ -2541,19 +2524,22 @@
 			// Brix reading from refractometer RI
 			if (dataRecord.brew_fermenter_sg >= 1.020) {
 				OBrix = sg_to_brix(dataRecord.brew_fermenter_sg);
-				FBrix = parseFloat(event.args.value) / my_brix_correction;
+				FBrix = parseFloat(event.args.value);
 				// http://seanterrill.com/2011/04/07/refractometer-fg-results/
-				var FG = 1.0000 - 0.0044993 * OBrix + 0.0117741 * FBrix +
-					 0.000275806 * (OBrix * OBrix) - 0.00127169 * (FBrix * FBrix) -
-					 0.00000727999 * Math.pow(OBrix, 3) + 0.0000632929 * Math.pow(FBrix, 3);
+	//			var FG = 1.0000 - 0.0044993 * OBrix + 0.0117741 * FBrix +
+	//				 0.000275806 * (OBrix * OBrix) - 0.00127169 * (FBrix * FBrix) -
+	//				 0.00000727999 * Math.pow(OBrix, 3) + 0.0000632929 * Math.pow(FBrix, 3);
 	//			var FG = 1.0000 - 0.00085683 * OBrix + 0.0034941 * FBrix;
 				// Brouwhulp
+				var FG = 1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) -
+                                         0.000000034 * Math.pow(OBrix, 3) + 0.00574 * (FBrix) +
+                                         0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3);
 	//			var FG = ((1.001843 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix)
 	//				  - 0.000000034 * Math.pow(OBrix, 3) + 0.00574 * (FBrix)
 	//				  + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3))
 	//				  + (1.313454) * 0.001);
 				console.log("OBrix:"+OBrix+" FBrix:"+FBrix+" FG:"+FG);
-				if (FG > 1.00001) {
+				if (FBrix > 0.05) {
 					$("#primary_end_sg").val(FG);
 					dataRecord.primary_end_sg = FG;
 				}
@@ -2564,12 +2550,22 @@
 			// Brix reading from refractometer RI
 			if (dataRecord.brew_fermenter_sg >= 1.020) {
 				OBrix = sg_to_brix(dataRecord.brew_fermenter_sg);
-				FBrix = parseFloat(event.args.value) / my_brix_correction;
-				var FG = 1.0000 - 0.0044993 * OBrix + 0.0117741 * FBrix +
-					 0.000275806 * (OBrix * OBrix) - 0.00127169 * (FBrix * FBrix) -
-					 0.00000727999 * Math.pow(OBrix, 3) + 0.0000632929 * Math.pow(FBrix, 3);
+				FBrix = parseFloat(event.args.value);
+				// http://seanterrill.com/2011/04/07/refractometer-fg-results/
+		//		var FG = 1.0000 - 0.0044993 * OBrix + 0.0117741 * FBrix +
+		//			 0.000275806 * (OBrix * OBrix) - 0.00127169 * (FBrix * FBrix) -
+		//			 0.00000727999 * Math.pow(OBrix, 3) + 0.0000632929 * Math.pow(FBrix, 3);
+				// Brouwhulp BrixToFG()
+				var FG = 1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) -
+					 0.000000034 * Math.pow(OBrix, 3) + 0.00574 * (FBrix) +
+					 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3);
+				// Ook brouwhulp SGFerm() maar is niet in gebruik.
+		//		var FG = ((1.001843 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix)
+                //                        - 0.000000034 * Math.pow(OBrix, 3) + 0.00574 * (FBrix)
+                //                        + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3))
+                //                        + (1.313454) * 0.001);
 				console.log("OBrix:"+OBrix+" FBrix:"+FBrix+" FG:"+FG);
-				if (FG > 1.00001) {
+				if (FBrix > 0.05) {
 					$("#fg").val(FG);
 					dataRecord.fg = FG;
 				}

mercurial