www/js/prod_edit.js

changeset 463
0efdafd23753
parent 462
c91175610f8a
child 464
fbd2a7cecaaa
--- a/www/js/prod_edit.js	Thu Sep 05 14:43:04 2019 +0200
+++ b/www/js/prod_edit.js	Thu Sep 05 20:14:16 2019 +0200
@@ -22,14 +22,24 @@
 
 
 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');
 }
 
 
@@ -133,9 +143,9 @@
 		}
 	}
 
-	/*
+	/* 
 	 * All calculations that depend on changes in the fermentables,
-	 * volumes and equipments.
+ 	 * volumes and equipments.
 	 */
 	function calcFermentables() {
 
@@ -157,20 +167,23 @@
 		var mashtime = 0;	// Total mash time
 		var mashtemp = 0;	// Average mash temperature
 		var bv = 0.925; 	// Bierverlies rendement
-                var sr = 0.95;  	// Mash en spoel rendement
+        	var sr = 0.95;  	// Mash en spoel rendement
 		var lintner = 0;	// Total recipe lintner
 
-		if ((rows = $('#mashGrid').jqxGrid('getrows'))) {
-			for (var i = 0; i < rows.length; i++) {
-				var row = rows[i];
-				if (row.step_type == 0) // Infusion
-					mvol += parseFloat(row.step_infuse_amount);
-				if (row.step_temp <= 75) { // Ignore mashout
-					mashtime += row.step_time;
-					mashtemp += row.step_time * row.step_temp;
+		if ((rows = $('#mashGrid').jqxGrid('getrows'))){
+			for(var i=0;i<rows.length;i++){
+				var row=rows[i];
+				if(row.step_type==0) // Infusion
+					mvol+=parseFloat(row.step_infuse_amount);
+				if(row.step_temp<=75){ // Ignore mashout
+					var timem=row.step_time+row.ramp_time;
+					mashtime+=timem;
+					mashtemp+=timem*row.step_temp;
 				}
 			}
-			mashtemp = mashtemp / mashtime;
+			if(mashtime>5)
+				mashtime-=5;//Correct last ramp > 75
+			mashtemp=Round(mashtemp/mashtime,2);
 		}
 
 		if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) {

mercurial