Added 15 fields to the recipes table. Added 18 fields to the products table. These are calculated values that are now stored in the database so export programs can use these values without calculating them again. Product and recipe print have water and mash schedule added. Product print has brewday results added if the brewday is over. The ingredients layout changed in the product and recipe prints.

Sun, 02 Jun 2019 12:48:54 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 02 Jun 2019 12:48:54 +0200
changeset 392
544d7d0183b2
parent 391
a1bcebc61ddd
child 393
5020feba78ec

Added 15 fields to the recipes table. Added 18 fields to the products table. These are calculated values that are now stored in the database so export programs can use these values without calculating them again. Product and recipe print have water and mash schedule added. Product print has brewday results added if the brewday is over. The ingredients layout changed in the product and recipe prints.

www/includes/db_product.php file | annotate | diff | comparison | revisions
www/includes/db_recipes.php file | annotate | diff | comparison | revisions
www/includes/formulas.php file | annotate | diff | comparison | revisions
www/js/prod_edit.js file | annotate | diff | comparison | revisions
www/js/rec_edit.js file | annotate | diff | comparison | revisions
www/prod_forum.php file | annotate | diff | comparison | revisions
www/prod_print.php file | annotate | diff | comparison | revisions
www/rec_forum.php file | annotate | diff | comparison | revisions
www/rec_print.php file | annotate | diff | comparison | revisions
--- a/www/includes/db_product.php	Fri May 31 22:58:03 2019 +0200
+++ b/www/includes/db_product.php	Sun Jun 02 12:48:54 2019 +0200
@@ -76,12 +76,15 @@
 		$sql .= "', brew_date_start='" . $_POST['brew_date_start'] . "'";
 	$sql .=  ", brew_mash_ph='" . $_POST['brew_mash_ph'];
 	$sql .= "', brew_mash_sg='" . $_POST['brew_mash_sg'];
+	$sql .= "', brew_mash_efficiency='" . $_POST['brew_mash_efficiency'];
 	$sql .= "', brew_sparge_temperature='" . $_POST['brew_sparge_temperature'];
 	$sql .= "', brew_sparge_volume='" . $_POST['brew_sparge_volume'];
+	$sql .= "', brew_sparge_est='" . $_POST['brew_sparge_est'];
 	$sql .= "', brew_sparge_ph='" . $_POST['brew_sparge_ph'];
 	$sql .= "', brew_preboil_volume='" . $_POST['brew_preboil_volume'];
 	$sql .= "', brew_preboil_sg='" . $_POST['brew_preboil_sg'];
 	$sql .= "', brew_preboil_ph='" . $_POST['brew_preboil_ph'];
+	$sql .= "', brew_preboil_efficiency='" . $_POST['brew_preboil_efficiency'];
 	$sql .= "', brew_aboil_volume='" . $_POST['brew_aboil_volume'];
 	$sql .= "', brew_aboil_sg='" . $_POST['brew_aboil_sg'];
 	$sql .= "', brew_aboil_ph='" . $_POST['brew_aboil_ph'];
@@ -220,6 +223,21 @@
 		$sql .= "', w2_ph='" . $_POST['w2_ph'];
 		$sql .= "', w2_cost='" . $_POST['w2_cost'];
 	}
+	$sql .= "', wg_amount='" . $_POST['wg_amount'];
+        $sql .= "', wg_calcium='" . $_POST['wg_calcium'];
+        $sql .= "', wg_sulfate='" . $_POST['wg_sulfate'];
+        $sql .= "', wg_chloride='" . $_POST['wg_chloride'];
+        $sql .= "', wg_sodium='" . $_POST['wg_sodium'];
+        $sql .= "', wg_magnesium='" . $_POST['wg_magnesium'];
+        $sql .= "', wg_total_alkalinity='" . $_POST['wg_total_alkalinity'];
+        $sql .= "', wg_ph='" . $_POST['wg_ph'];
+        $sql .= "', wb_calcium='" . $_POST['wb_calcium'];
+        $sql .= "', wb_sulfate='" . $_POST['wb_sulfate'];
+        $sql .= "', wb_chloride='" . $_POST['wb_chloride'];
+        $sql .= "', wb_sodium='" . $_POST['wb_sodium'];
+        $sql .= "', wb_magnesium='" . $_POST['wb_magnesium'];
+        $sql .= "', wb_total_alkalinity='" . $_POST['wb_total_alkalinity'];
+        $sql .= "', wb_ph='" . $_POST['wb_ph'];
 	$sql .= "', wa_acid_name='" . $_POST['wa_acid_name'];
 	$sql .= "', wa_acid_perc='" . $_POST['wa_acid_perc'];
 	$sql .= "', wa_base_name='" . $_POST['wa_base_name'];
@@ -596,12 +614,15 @@
 		$brew .= ',"brew_date_start":"' . $row['brew_date_start'];
 		$brew .= '","brew_mash_ph":' . floatval($row['brew_mash_ph']);
 		$brew .= ',"brew_mash_sg":' . floatval($row['brew_mash_sg']);
+		$brew .= ',"brew_mash_efficiency":' . floatval($row['brew_mash_efficiency']);
 		$brew .= ',"brew_sparge_temperature":' . floatval($row['brew_sparge_temperature']);
 		$brew .= ',"brew_sparge_volume":' . floatval($row['brew_sparge_volume']);
+		$brew .= ',"brew_sparge_est":' . floatval($row['brew_sparge_est']);
 		$brew .= ',"brew_sparge_ph":' . floatval($row['brew_sparge_ph']);
 		$brew .= ',"brew_preboil_volume":' . floatval($row['brew_preboil_volume']);
 		$brew .= ',"brew_preboil_sg":' . floatval($row['brew_preboil_sg']);
 		$brew .= ',"brew_preboil_ph":' . floatval($row['brew_preboil_ph']);
+		$brew .= ',"brew_preboil_efficiency":' . floatval($row['brew_preboil_efficiency']);
 		$brew .= ',"brew_aboil_volume":' . floatval($row['brew_aboil_volume']);
 		$brew .= ',"brew_aboil_sg":' . floatval($row['brew_aboil_sg']);
 		$brew .= ',"brew_aboil_ph":' . floatval($row['brew_aboil_ph']);
@@ -717,6 +738,21 @@
 		$brew .= ',"w2_total_alkalinity":' . floatval($row['w2_total_alkalinity']);
 		$brew .= ',"w2_ph":' . floatval($row['w2_ph']);
 		$brew .= ',"w2_cost":' . floatval($row['w2_cost']);
+		$brew .= ',"wg_amount":' . floatval($row['wg_amount']);
+                $brew .= ',"wg_calcium":' . floatval($row['wg_calcium']);
+                $brew .= ',"wg_sulfate":' . floatval($row['wg_sulfate']);
+                $brew .= ',"wg_chloride":' . floatval($row['wg_chloride']);
+                $brew .= ',"wg_sodium":' . floatval($row['wg_sodium']);
+                $brew .= ',"wg_magnesium":' . floatval($row['wg_magnesium']);
+                $brew .= ',"wg_total_alkalinity":' . floatval($row['wg_total_alkalinity']);
+                $brew .= ',"wg_ph":' . floatval($row['wg_ph']);
+                $brew .= ',"wb_calcium":' . floatval($row['wb_calcium']);
+                $brew .= ',"wb_sulfate":' . floatval($row['wb_sulfate']);
+                $brew .= ',"wb_chloride":' . floatval($row['wb_chloride']);
+                $brew .= ',"wb_sodium":' . floatval($row['wb_sodium']);
+                $brew .= ',"wb_magnesium":' . floatval($row['wb_magnesium']);
+                $brew .= ',"wb_total_alkalinity":' . floatval($row['wb_total_alkalinity']);
+                $brew .= ',"wb_ph":' . floatval($row['wb_ph']);
 		$brew .= ',"wa_acid_name":' . $row['wa_acid_name'];
 		$brew .= ',"wa_acid_perc":' . $row['wa_acid_perc'];
 		$brew .= ',"wa_base_name":' . $row['wa_base_name'];
--- a/www/includes/db_recipes.php	Fri May 31 22:58:03 2019 +0200
+++ b/www/includes/db_recipes.php	Sun Jun 02 12:48:54 2019 +0200
@@ -100,6 +100,21 @@
 		$sql .= "', w2_ph='" . $_POST['w2_ph'];
 		$sql .= "', w2_cost='" . $_POST['w2_cost'];
 	}
+	$sql .= "', wg_amount='" . $_POST['wg_amount'];
+	$sql .= "', wg_calcium='" . $_POST['wg_calcium'];
+	$sql .= "', wg_sulfate='" . $_POST['wg_sulfate'];
+	$sql .= "', wg_chloride='" . $_POST['wg_chloride'];
+	$sql .= "', wg_sodium='" . $_POST['wg_sodium'];
+	$sql .= "', wg_magnesium='" . $_POST['wg_magnesium'];
+	$sql .= "', wg_total_alkalinity='" . $_POST['wg_total_alkalinity'];
+	$sql .= "', wg_ph='" . $_POST['wg_ph'];
+	$sql .= "', wb_calcium='" . $_POST['wb_calcium'];
+	$sql .= "', wb_sulfate='" . $_POST['wb_sulfate'];
+	$sql .= "', wb_chloride='" . $_POST['wb_chloride'];
+	$sql .= "', wb_sodium='" . $_POST['wb_sodium'];
+	$sql .= "', wb_magnesium='" . $_POST['wb_magnesium'];
+	$sql .= "', wb_total_alkalinity='" . $_POST['wb_total_alkalinity'];
+	$sql .= "', wb_ph='" . $_POST['wb_ph'];
 	$sql .= "', wa_acid_name='" . $_POST['wa_acid_name'];
 	$sql .= "', wa_acid_perc='" . $_POST['wa_acid_perc'];
 	$sql .= "', wa_base_name='" . $_POST['wa_base_name'];
@@ -369,6 +384,21 @@
 		$recipes .= ',"w2_total_alkalinity":' . floatval($row['w2_total_alkalinity']);
 		$recipes .= ',"w2_ph":' . floatval($row['w2_ph']);
 		$recipes .= ',"w2_cost":' . floatval($row['w2_cost']);
+		$recipes .= ',"wg_amount":' . floatval($row['wg_amount']);
+		$recipes .= ',"wg_calcium":' . floatval($row['wg_calcium']);
+		$recipes .= ',"wg_sulfate":' . floatval($row['wg_sulfate']);
+		$recipes .= ',"wg_chloride":' . floatval($row['wg_chloride']);
+		$recipes .= ',"wg_sodium":' . floatval($row['wg_sodium']);
+		$recipes .= ',"wg_magnesium":' . floatval($row['wg_magnesium']);
+		$recipes .= ',"wg_total_alkalinity":' . floatval($row['wg_total_alkalinity']);
+		$recipes .= ',"wg_ph":' . floatval($row['wg_ph']);
+		$recipes .= ',"wb_calcium":' . floatval($row['wb_calcium']);
+		$recipes .= ',"wb_sulfate":' . floatval($row['wb_sulfate']);
+		$recipes .= ',"wb_chloride":' . floatval($row['wb_chloride']);
+		$recipes .= ',"wb_sodium":' . floatval($row['wb_sodium']);
+		$recipes .= ',"wb_magnesium":' . floatval($row['wb_magnesium']);
+		$recipes .= ',"wb_total_alkalinity":' . floatval($row['wb_total_alkalinity']);
+		$recipes .= ',"wb_ph":' . floatval($row['wb_ph']);
 		$recipes .= ',"wa_acid_name":' . $row['wa_acid_name'];
 		$recipes .= ',"wa_acid_perc":' . floatval($row['wa_acid_perc']);
 		$recipes .= ',"wa_base_name":' . $row['wa_base_name'];
--- a/www/includes/formulas.php	Fri May 31 22:58:03 2019 +0200
+++ b/www/includes/formulas.php	Sun Jun 02 12:48:54 2019 +0200
@@ -280,6 +280,16 @@
 
 
 
+function density_str($sg) {
+
+	global $my_brix_correction;
+	$plato = sg_to_plato(floatval($sg));
+	$brix = $plato * $my_brix_correction;
+	return sprintf("%.3f", floatval($sg))." SG  ".sprintf("%.1f",$brix).DEG.'Brix  '.sprintf("%.1f",$plato).DEG.'P';
+}
+
+
+
 /*
 
 Brouwhulp data.pas
--- a/www/js/prod_edit.js	Fri May 31 22:58:03 2019 +0200
+++ b/www/js/prod_edit.js	Sun Jun 02 12:48:54 2019 +0200
@@ -2548,12 +2548,15 @@
 			brew_date_start: $("#brew_date_start").val(),
 			brew_mash_ph: parseFloat($("#brew_mash_ph").jqxNumberInput('decimal')),
 			brew_mash_sg: parseFloat($("#brew_mash_sg").jqxNumberInput('decimal')),
+			brew_mash_efficiency: parseFloat($("#brew_mash_efficiency").jqxNumberInput('decimal')),
 			brew_sparge_temperature: parseFloat($("#brew_sparge_temperature").jqxNumberInput('decimal')),
 			brew_sparge_volume: parseFloat($("#brew_sparge_volume").jqxNumberInput('decimal')),
+			brew_sparge_est: parseFloat($("#brew_sparge_est").jqxNumberInput('decimal')),
 			brew_sparge_ph: parseFloat($("#brew_sparge_ph").jqxNumberInput('decimal')),
 			brew_preboil_volume: parseFloat($("#brew_preboil_volume").jqxNumberInput('decimal')),
 			brew_preboil_sg: parseFloat($("#brew_preboil_sg").jqxNumberInput('decimal')),
 			brew_preboil_ph: parseFloat($("#brew_preboil_ph").jqxNumberInput('decimal')),
+			brew_preboil_efficiency: parseFloat($("#brew_preboil_efficiency").jqxNumberInput('decimal')),
 			brew_aboil_volume: parseFloat($("#brew_aboil_volume").jqxNumberInput('decimal')),
 			brew_aboil_sg: parseFloat($("#brew_aboil_sg").jqxNumberInput('decimal')),
 			brew_aboil_ph: parseFloat($("#brew_aboil_ph").jqxNumberInput('decimal')),
@@ -2669,6 +2672,21 @@
 			w2_total_alkalinity: parseFloat($("#w2_total_alkalinity").jqxNumberInput('decimal')),
 			w2_ph: parseFloat($("#w2_ph").jqxNumberInput('decimal')),
 			w2_cost: dataRecord.w2_cost,
+			wg_amount: parseFloat($("#wg_amount").jqxNumberInput('decimal')),
+                        wg_calcium: parseFloat($("#wg_calcium").jqxNumberInput('decimal')),
+                        wg_sulfate: parseFloat($("#wg_sulfate").jqxNumberInput('decimal')),
+                        wg_chloride: parseFloat($("#wg_chloride").jqxNumberInput('decimal')),
+                        wg_sodium: parseFloat($("#wg_sodium").jqxNumberInput('decimal')),
+                        wg_magnesium: parseFloat($("#wg_magnesium").jqxNumberInput('decimal')),
+                        wg_total_alkalinity: parseFloat($("#wg_total_alkalinity").jqxNumberInput('decimal')),
+                        wg_ph: parseFloat($("#wg_ph").jqxNumberInput('decimal')),
+                        wb_calcium: parseFloat($("#wb_calcium").jqxNumberInput('decimal')),
+                        wb_sulfate: parseFloat($("#wb_sulfate").jqxNumberInput('decimal')),
+                        wb_chloride: parseFloat($("#wb_chloride").jqxNumberInput('decimal')),
+                        wb_sodium: parseFloat($("#wb_sodium").jqxNumberInput('decimal')),
+                        wb_magnesium: parseFloat($("#wb_magnesium").jqxNumberInput('decimal')),
+                        wb_total_alkalinity: parseFloat($("#wb_total_alkalinity").jqxNumberInput('decimal')),
+                        wb_ph: parseFloat($("#wb_ph").jqxNumberInput('decimal')),
 			wa_acid_name: $("#wa_acid_name").val(),
 			wa_acid_perc: parseFloat($("#wa_acid_perc").jqxNumberInput('decimal')),
 			wa_base_name: $("#wa_base_name").val(),
@@ -2753,12 +2771,15 @@
 			{ name: 'brew_date_start', type: 'string' },
 			{ name: 'brew_mash_ph', type: 'float' },
 			{ name: 'brew_mash_sg', type: 'float' },
+			{ name: 'brew_mash_efficiency', type: 'float' },
 			{ name: 'brew_sparge_temperature', type: 'float' },
 			{ name: 'brew_sparge_volume', type: 'float' },
+			{ name: 'brew_sparge_est', type: 'float' },
 			{ name: 'brew_sparge_ph', type: 'float' },
 			{ name: 'brew_preboil_volume', type: 'float' },
 			{ name: 'brew_preboil_sg', type: 'float' },
 			{ name: 'brew_preboil_ph', type: 'float' },
+			{ name: 'brew_preboil_efficiency', type: 'float' },
 			{ name: 'brew_aboil_volume', type: 'float' },
 			{ name: 'brew_aboil_sg', type: 'float' },
 			{ name: 'brew_aboil_ph', type: 'float' },
@@ -2874,6 +2895,21 @@
 			{ name: 'w2_total_alkalinity', type: 'float' },
 			{ name: 'w2_ph', type: 'float' },
 			{ name: 'w2_cost', type: 'float' },
+			{ name: 'wg_amount', type: 'float' },
+                        { name: 'wg_calcium', type: 'float' },
+                        { name: 'wg_sulfate', type: 'float' },
+                        { name: 'wg_chloride', type: 'float' },
+                        { name: 'wg_sodium', type: 'float' },
+                        { name: 'wg_magnesium', type: 'float' },
+                        { name: 'wg_total_alkalinity', type: 'float' },
+                        { name: 'wg_ph', type: 'float' },
+                        { name: 'wb_calcium', type: 'float' },
+                        { name: 'wb_sulfate', type: 'float' },
+                        { name: 'wb_chloride', type: 'float' },
+                        { name: 'wb_sodium', type: 'float' },
+                        { name: 'wb_magnesium', type: 'float' },
+                        { name: 'wb_total_alkalinity', type: 'float' },
+                        { name: 'wb_ph', type: 'float' },
 			{ name: 'wa_acid_name', type: 'int' },
 			{ name: 'wa_acid_perc', type: 'int' },
 			{ name: 'wa_base_name', type: 'int' },
@@ -2930,10 +2966,11 @@
 			$("#brew_date_start").val(dataRecord.brew_date_start);
 			$("#brew_mash_ph").val(dataRecord.brew_mash_ph);
 			$("#brew_mash_sg").val(dataRecord.brew_mash_sg);
-			// brew_mash_efficiency to calculate on th fly.
+			$("#brew_mash_efficiency").val(dataRecord.brew_mash_efficiency);
 			// Header Spoelen en filteren
 			$("#brew_sparge_temperature").val(dataRecord.brew_sparge_temperature);
 			$("#brew_sparge_volume").val(dataRecord.brew_sparge_volume);
+			$("#brew_sparge_est").val(dataRecord.brew_sparge_est);
 			$("#brew_sparge_ph").val(dataRecord.brew_sparge_ph);
 			// Header Beluchten
 			$("#brew_aeration_type").val(dataRecord.brew_aeration_type);
@@ -2943,7 +2980,7 @@
 			$("#brew_preboil_ph").val(dataRecord.brew_preboil_ph);
 			$("#brew_preboil_sg").val(dataRecord.brew_preboil_sg);
 			$("#brew_preboil_volume").val(dataRecord.brew_preboil_volume);
-			//$("#brew_preboil_efficiency").val(dataRecord.brew_preboil_efficiency);
+			$("#brew_preboil_efficiency").val(dataRecord.brew_preboil_efficiency);
 			// Header Koelen en whirlpoolen
 			$("#brew_whirlpool9").val(dataRecord.brew_whirlpool9);
 			$("#brew_whirlpool7").val(dataRecord.brew_whirlpool7);
@@ -3074,6 +3111,21 @@
 			$("#w2_total_alkalinity").val(dataRecord.w2_total_alkalinity);
 			$("#w2_ph").val(dataRecord.w2_ph);
 			$("#w2_cost").val(dataRecord.w2_cost);
+			$("#wg_amount").val(dataRecord.wg_amount);
+                        $("#wg_calcium").val(dataRecord.wg_calcium);
+                        $("#wg_sulfate").val(dataRecord.wg_sulfate);
+                        $("#wg_chloride").val(dataRecord.wg_chloride);
+                        $("#wg_sodium").val(dataRecord.wg_sodium);
+                        $("#wg_magnesium").val(dataRecord.wg_magnesium);
+                        $("#wg_total_alkalinity").val(dataRecord.wg_total_alkalinity);
+                        $("#wg_ph").val(dataRecord.wg_ph);
+                        $("#wb_calcium").val(dataRecord.wb_calcium);
+                        $("#wb_sulfate").val(dataRecord.wb_sulfate);
+                        $("#wb_chloride").val(dataRecord.wb_chloride);
+                        $("#wb_sodium").val(dataRecord.wb_sodium);
+                        $("#wb_magnesium").val(dataRecord.wb_magnesium);
+                        $("#wb_total_alkalinity").val(dataRecord.wb_total_alkalinity);
+                        $("#wb_ph").val(dataRecord.wb_ph);
 			$("#wa_acid_name").val(dataRecord.wa_acid_name);
 			$("#wa_acid_perc").val(dataRecord.wa_acid_perc);
 			$("#wa_base_name").val(dataRecord.wa_base_name);
@@ -5239,13 +5291,11 @@
 	$("#wb_magnesium").jqxNumberInput( Show1wat );
 	$("#wb_sodium").jqxTooltip({ content: 'De ideale hoeveelheid Natrium is lager dan 150.'});
 	$("#wb_sodium").jqxNumberInput( Show1wat );
-
 	$("#wb_total_alkalinity").jqxNumberInput( Show1wat );
 	$("#wb_chloride").jqxTooltip({ content: 'De ideale hoeveelheid Chloride is tussen 50 en 100.'});
 	$("#wb_chloride").jqxNumberInput( Show1wat );
 	$("#wb_sulfate").jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is tussen 50 en 350.'});
 	$("#wb_sulfate").jqxNumberInput( Show1wat );
-
 	$("#wb_ph").jqxNumberInput( Show1wat );
 	// Water target profile
 	$("#pr_name").jqxDropDownList({
--- a/www/js/rec_edit.js	Fri May 31 22:58:03 2019 +0200
+++ b/www/js/rec_edit.js	Sun Jun 02 12:48:54 2019 +0200
@@ -1525,6 +1525,21 @@
 			w2_total_alkalinity: parseFloat($("#w2_total_alkalinity").jqxNumberInput('decimal')),
 			w2_ph: parseFloat($("#w2_ph").jqxNumberInput('decimal')),
 			w2_cost: dataRecord.w2_cost,
+			wg_amount: parseFloat($("#wg_amount").jqxNumberInput('decimal')),
+			wg_calcium: parseFloat($("#wg_calcium").jqxNumberInput('decimal')),
+			wg_sulfate: parseFloat($("#wg_sulfate").jqxNumberInput('decimal')),
+			wg_chloride: parseFloat($("#wg_chloride").jqxNumberInput('decimal')),
+			wg_sodium: parseFloat($("#wg_sodium").jqxNumberInput('decimal')),
+			wg_magnesium: parseFloat($("#wg_magnesium").jqxNumberInput('decimal')),
+			wg_total_alkalinity: parseFloat($("#wg_total_alkalinity").jqxNumberInput('decimal')),
+			wg_ph: parseFloat($("#wg_ph").jqxNumberInput('decimal')),
+			wb_calcium: parseFloat($("#wb_calcium").jqxNumberInput('decimal')),
+			wb_sulfate: parseFloat($("#wb_sulfate").jqxNumberInput('decimal')),
+			wb_chloride: parseFloat($("#wb_chloride").jqxNumberInput('decimal')),
+			wb_sodium: parseFloat($("#wb_sodium").jqxNumberInput('decimal')),
+			wb_magnesium: parseFloat($("#wb_magnesium").jqxNumberInput('decimal')),
+			wb_total_alkalinity: parseFloat($("#wb_total_alkalinity").jqxNumberInput('decimal')),
+			wb_ph: parseFloat($("#wb_ph").jqxNumberInput('decimal')),
 			wa_acid_name: $("#wa_acid_name").val(),
 			wa_acid_perc: parseFloat($("#wa_acid_perc").jqxNumberInput('decimal')),
 			wa_base_name: $("#wa_base_name").val(),
@@ -1625,6 +1640,21 @@
 			{ name: 'w2_total_alkalinity', type: 'float' },
 			{ name: 'w2_ph', type: 'float' },
 			{ name: 'w2_cost', type: 'float' },
+			{ name: 'wg_amount', type: 'float' },
+			{ name: 'wg_calcium', type: 'float' },
+			{ name: 'wg_sulfate', type: 'float' },
+			{ name: 'wg_chloride', type: 'float' },
+			{ name: 'wg_sodium', type: 'float' },
+			{ name: 'wg_magnesium', type: 'float' },
+			{ name: 'wg_total_alkalinity', type: 'float' },
+			{ name: 'wg_ph', type: 'float' },
+			{ name: 'wb_calcium', type: 'float' },
+			{ name: 'wb_sulfate', type: 'float' },
+			{ name: 'wb_chloride', type: 'float' },
+			{ name: 'wb_sodium', type: 'float' },
+			{ name: 'wb_magnesium', type: 'float' },
+			{ name: 'wb_total_alkalinity', type: 'float' },
+			{ name: 'wb_ph', type: 'float' },
 			{ name: 'wa_acid_name', type: 'int' },
 			{ name: 'wa_acid_perc', type: 'int' },
 			{ name: 'wa_base_name', type: 'int' },
@@ -1712,6 +1742,21 @@
 			$("#w2_total_alkalinity").val(dataRecord.w2_total_alkalinity);
 			$("#w2_ph").val(dataRecord.w2_ph);
 			$("#w2_cost").val(dataRecord.w2_cost);
+			$("#wg_amount").val(dataRecord.wg_amount);
+			$("#wg_calcium").val(dataRecord.wg_calcium);
+			$("#wg_sulfate").val(dataRecord.wg_sulfate);
+			$("#wg_chloride").val(dataRecord.wg_chloride);
+			$("#wg_sodium").val(dataRecord.wg_sodium);
+			$("#wg_magnesium").val(dataRecord.wg_magnesium);
+			$("#wg_total_alkalinity").val(dataRecord.wg_total_alkalinity);
+			$("#wg_ph").val(dataRecord.wg_ph);
+			$("#wb_calcium").val(dataRecord.wb_calcium);
+			$("#wb_sulfate").val(dataRecord.wb_sulfate);
+			$("#wb_chloride").val(dataRecord.wb_chloride);
+			$("#wb_sodium").val(dataRecord.wb_sodium);
+			$("#wb_magnesium").val(dataRecord.wb_magnesium);
+			$("#wb_total_alkalinity").val(dataRecord.wb_total_alkalinity);
+			$("#wb_ph").val(dataRecord.wb_ph);
 			$("#wa_acid_name").val(dataRecord.wa_acid_name);
 			$("#wa_acid_perc").val(dataRecord.wa_acid_perc);
 			$("#wa_base_name").val(dataRecord.wa_base_name);
--- a/www/prod_forum.php	Fri May 31 22:58:03 2019 +0200
+++ b/www/prod_forum.php	Sun Jun 02 12:48:54 2019 +0200
@@ -142,7 +142,9 @@
 	$ibu    = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $amount, $time, $alpha, $row['ibu_method']);
 	$moment = $hopuse[$item['h_useat']];
         if ($item['h_useat'] == 2) {    // Boil
-        	$moment = "Kook ".$time." minuten";
+        	$moment = "Koken ".$time." minuten";
+	} else if ($item['h_useat'] == 5) {	// Dryhop
+		$moment   = 'Koudhop '.sprintf("%.0f", $time / 1440).' dagen';
         }
 
 	echo sprintf("%s %-7s %5.1f %5.1f %6.1f %-20s", $name, $hopform[$item['h_form']], $alpha, $ibu, $amount, $moment);
@@ -224,8 +226,7 @@
 	itemline("Maischwater", sprintf("%.1f",floatval($row['w1_amount'])).' liter water '.$row['w1_name']);
 }
 itemline("Maischwater aanzuren tot pH", $row['mash_ph'].' pH');
-$spoelw = ($row['boil_size'] - $mashwater + $grainabsorbtion + $row['eq_lauter_deadspace']) * 1.03;     // A small heat correction
-itemline("Spoelwater geschat", sprintf("%.1f", $spoelw)." liter");
+itemline("Spoelwater geschat", sprintf("%.1f", $row['brew_sparge_est'])." liter");
 itemline("Spoelwater temperatuur", $row['sparge_temp'].' &deg;C');
 itemline("Spoelwater aanzuren tot pH", sprintf("%.1f",$row['sparge_ph']).' pH');
 echo PHP_EOL . PHP_EOL;
--- a/www/prod_print.php	Fri May 31 22:58:03 2019 +0200
+++ b/www/prod_print.php	Sun Jun 02 12:48:54 2019 +0200
@@ -111,16 +111,17 @@
 		global $colorw;
 		global $preboil_sg;
 		global $mashkg;
-		$added = array( 'Maischen', 'Koken', 'Vergisten', 'Nagisten/lageren', 'Bottelen' );
-		$vul = $this->w - $this->rMargin - $this->lMargin - 132;
-		$this->Ln();	
-		$this->AddCol($vul,'Grondstof','L');
-		$this->AddCol(30,'Leverancier','L');
-		$this->AddCol(15,'EBC','R');
-		$this->AddCol(17,'Moment','L');
-		$this->AddCol(20,'Kg','R');
+		$added = array( 'Maischen', 'Koken 10 min', 'Vergisten', 'Nagisten/lageren', 'Bottelen' );
+		$ftype = array( 'Mout', 'Suiker', 'Vloeibaar extract', 'Droog extract', 'Ongemout graan' );
+		$mtype = array( 'Basismout', 'Geroosterde mout', 'Cara- of crystalmout', 'Geëeste mout', 'Zuurmout', 'Speciale mout', 'Geen mout' );
+		$vul = $this->w - $this->rMargin - $this->lMargin - 125;
+		$this->Ln();
+		$this->AddCol($vul,'Mout, granen en suikers','L');
 		$this->AddCol(15,'Procent','R');
 		$this->AddCol(15,'Opbr.','R');
+		$this->AddCol(25,'Soort', 'L');
+		$this->AddCol(30,'Gebruik moment','L');
+		$this->AddCol(20,'Hoeveel','R');
 		$this->AddCol(20,'Prijs','R');
 
 		$cMargin=$this->cMargin;
@@ -150,6 +151,11 @@
 			if ($item['f_graintype'] == 2)		// Crystal
 				$pCara += $percent;
 
+			if ($item['f_type'] == 0)
+				$soort = iconv('UTF-8','windows-1252',$mtype[$item['f_graintype']]);
+			else
+				$soort = iconv('UTF-8','windows-1252',$ftype[$item['f_type']]);
+
 			$cost = $amount * $costkg;
 			$cost_fermentables += $cost;
 			$total_fermentables += $amount;
@@ -163,24 +169,27 @@
 			$sugarsf += $d;
 			$colorw += ($amount * ebc_to_srm($color) / $row['batch_size']) * 8.34436;
 
-			$this->Cell($vul,5,$name,0,0,'L',true);
-			$this->Cell(30,5,$supplier,0,0,'L',true);
-			$this->Cell(15,5,sprintf("%.0f",$color),0,0,'R',true);
-			$this->Cell(17,5,$added[$item['f_added']],0,0,'L',true);
-			$this->Cell(20,5,sprintf("%8.3f",$amount),0,0,'R',true);
+			if ($amount > 100)
+				$amount = sprintf("%.1f",$amount).' kg';
+			else if ($amount > 10)
+				$amount = sprintf("%.2f",$amount).' kg';
+			else
+				$amount = sprintf("%.0f",$amount * 1000).' gr';
+			$this->Cell($vul,5,$name.' ('.$supplier.') '.sprintf("%.0f",$color).' EBC',0,0,'L',true);
 			$this->Cell(15,5,sprintf("%.1f%%",$percent),0,0,'R',true);
 			$this->Cell(15,5,sprintf("%.1f%%",$yield),0,0,'R',true);
-			$this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true);
+			$this->Cell(25,5,$soort,0,0,'L',true);
+			$this->Cell(30,5,$added[$item['f_added']],0,0,'L',true);
+			$this->Cell(20,5,$amount,0,0,'R',true);
+			$this->Cell(20,5,sprintf("%.3f",$cost).EURO,0,0,'R',true);
 			$this->Ln();
 		}
 
 		$row['est_og'] = estimate_sg($sugarsf, floatval($row['batch_size']));
 		$preboil_sg = estimate_sg($sugarsm, floatval($row['boil_size']));
 		$this->SetFillColor(210,245,255);
-		$this->Cell($vul+62,5,'',0,0,'L',false);
-		$this->Cell(20,5,sprintf("%8.3f",$total_fermentables),0,0,'R',true);
-		$this->Cell(30,5,'',0,0,'L',false);
-		$this->Cell(20,5,sprintf("%8.3f",$cost_fermentables).EURO,0,0,'R',true);
+		$this->Cell($vul+105,5,'',0,0,'L',false);
+		$this->Cell(20,5,sprintf("%.3f",$cost_fermentables).EURO,0,0,'R',true);
 		$this->ProcessingTable=false;
 		$this->cMargin=$cMargin;
 		$this->aCols=array();
@@ -194,15 +203,14 @@
 		global $preboil_sg;
 		$hopform = array( 'Pellets', 'Plugs', 'Bellen', 'Hop nat' );
 		$hopuse  = array( 'Maischen', 'First wort', 'Koken', 'Vlamuit', 'Whirlpool', 'Koudhop' );
-		$vul = $this->w - $this->rMargin - $this->lMargin - 135;
+		$vul = $this->w - $this->rMargin - $this->lMargin - 122;
 		$this->Ln();
 		$this->AddCol($vul,'Hop','L');
-		$this->AddCol(35,'Land','L');
-		$this->AddCol(15,'Soort','L');
-		$this->AddCol(20,'Moment','L');
 		$this->AddCol(15,'Alpha','R');
 		$this->AddCol(12,'IBU','R');
-		$this->AddCol(18,'Gram','R');
+		$this->AddCol(25,'Soort','L');
+		$this->AddCol(30,'Gebruik moment','L');
+		$this->AddCol(20,'Hoeveel','R');
 		$this->AddCol(20,'Prijs','R');
 
 		$cMargin=$this->cMargin;
@@ -218,39 +226,43 @@
 		foreach($arr as $item) { //foreach element in $arr
 			$name     = iconv('UTF-8','windows-1252',$item['h_name']);
 			$origin   = iconv('UTF-8','windows-1252',$item['h_origin']);
-			$amount   = floatval($item['h_amount']) * 1000;
-			$mass     = $amount;
+			$amount   = floatval($item['h_amount']);
+			$mass     = $amount * 1000;
 			$costkg   = floatval($item['h_cost']);
 			$time     = floatval($item['h_time']);
 			$alpha    = floatval($item['h_alpha']);
 
-			$cost = ($amount * $costkg) / 1000;
+			$cost = ($amount * $costkg);
 			$cost_hops += $cost;
 			$total_hops += $amount;
 
 			$moment = $hopuse[$item['h_useat']];
 			if ($item['h_useat'] == 2) {    // Boil
-				$moment   = "Kook@".$time;
+				$moment   = "Koken ".$time." min";
+			} else if ($item['h_useat'] == 5) {	// Dryhop
+				$moment   = 'Koudhop '.sprintf("%.0f", $time / 1440).' dagen';
 			}
 			$ibu = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $mass, $time, $alpha, $row['ibu_method']);
 			$total_ibus += $ibu;
 
-			$this->Cell($vul,5,$name,0,0,'L',true);
-			$this->Cell(35,5,$origin,0,0,'L',true);
-			$this->Cell(15,5,$hopform[$item['h_form']],0,0,'L',true);
-			$this->Cell(20,5,$moment,0,0,'L',true);
+			if ($amount > 1)
+				$amount = sprintf("%.3f",$amount).' kg';
+			else
+				$amount = sprintf("%.1f",$amount * 1000).' gr';
+
+			$this->Cell($vul,5,$name.' ('.$origin.')',0,0,'L',true);
 			$this->Cell(15,5,sprintf("%.1f%%",$alpha),0,0,'R',true);
 			$this->Cell(12,5,sprintf("%.1f",$ibu),0,0,'R',true);
-			$this->Cell(18,5,sprintf("%.1f",$amount),0,0,'R',true);
-			$this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true);
+			$this->Cell(25,5,$hopform[$item['h_form']],0,0,'L',true);
+			$this->Cell(30,5,$moment,0,0,'L',true);
+			$this->Cell(20,5,$amount,0,0,'R',true);
+			$this->Cell(20,5,sprintf("%.3f",$cost).EURO,0,0,'R',true);
 			$this->Ln();
 		}
 
 		$this->SetFillColor(210,245,255);
-		$this->Cell($vul+85,5,'',0,0,'L',false);
-		$this->Cell(12,5,sprintf("%.1f",$total_ibus),0,0,'R',true);
-		$this->Cell(18,5,sprintf("%.1f",$total_hops),0,0,'R',true);
-		$this->Cell(20,5,sprintf("%8.3f",$cost_hops).EURO,0,0,'R',true);
+		$this->Cell($vul+102,5,'',0,0,'L',false);
+		$this->Cell(20,5,sprintf("%.3f",$cost_hops).EURO,0,0,'R',true);
 		$this->ProcessingTable=false;
 		$this->cMargin=$cMargin;
 		$this->aCols=array();
@@ -262,15 +274,13 @@
 		global $svg;
 		$yeastform = array( 'Vloeibaar', 'Droog', 'Schuine buis', 'Slurry', 'Ingevroren', 'Depot' );
 		$yeastuse  = array( 'Hoofdgisting', 'Nagisting', 'Lagering', 'Bottelen' );
-		$vul = $this->w - $this->rMargin - $this->lMargin - 140;
+		$vul = $this->w - $this->rMargin - $this->lMargin - 110;
 		$this->Ln();
-		$this->AddCol(27,'Laboratorium','L');
-		$this->AddCol(18,'Product','L');
 		$this->AddCol($vul,'Gist','L');
-		$this->AddCol(20,'Gebruik','L');
 		$this->AddCol(15,'Attn','R');
-		$this->AddCol(22,'Vorm','L');
-		$this->AddCol(18,'Gram','R');
+		$this->AddCol(25,'Soort','L');
+		$this->AddCol(30,'Gebruik moment','L');
+		$this->AddCol(20,'Hoeveel','R');
 		$this->AddCol(20,'Prijs','R');
 
 		$cMargin=$this->cMargin;
@@ -300,29 +310,35 @@
 			else
 				$amount = sprintf("%.0f",floatval($item['y_amount'])*1000)." ml";
 
-			$this->Cell(27,5,$laboratory,0,0,'L',true);
-			$this->Cell(18,5,$product_id,0,0,'L',true);
-			$this->Cell($vul,5,$name,0,0,'L',true);
-			$this->Cell(20,5,$yeastuse[$item['y_use']],0,0,'L',true);
+			$this->Cell($vul,5,$laboratory.' '.$product_id.' ('.$name.')',0,0,'L',true);
 			$this->Cell(15,5,sprintf("%.1f%%",$attenuation),0,0,'R',true);
-			$this->Cell(22,5,$yeastform[$item['y_form']],0,0,'L',true);
-			$this->Cell(18,5,$amount,0,0,'R',true);
+			$this->Cell(25,5,$yeastform[$item['y_form']],0,0,'L',true);
+			$this->Cell(30,5,$yeastuse[$item['y_use']],0,0,'L',true);
+			$this->Cell(20,5,$amount,0,0,'R',true);
 			$this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true);
 			$this->Ln();
 		}
-		if ($row['starter_enable']) {
-			$v = floatval($row['prop1_volume']) + floatval($row['prop2_volume']) + floatval($row['prop3_volume']) + floatval($row['prop4_volume']);
-			if ($v) {
-				$this->Cell(45,5,'',0,0,'L',true);
-				$this->Cell($vul,5,"Giststarter ".sprintf("%.2f",$v)." liter",0,0,'L',true);
-				$this->Cell(20,5,"Tevoren",0,0,'L',true);
-				$this->Cell(75,5,'',0,0,'L',true);
-				$this->Ln();
-			}
+		if ($row['starter_enable'] && $row['prop1_volume']) {
+			$sv = 0;
+			$st = 0;
+        		for ($i = 1; $i < 5; $i++) {
+                		$pv = "prop".$i."_volume";
+                		if (floatval($row[$pv])) {
+					$st++;
+					if (floatval($row[$pv]) > $sv)
+                        			$sv = floatval($row[$pv]);
+                		}
+        		}
+			$this->Cell($vul,5,$st." staps giststarter",0,0,'L',true);
+			$this->Cell(40,5,'',0,0,'R',true);
+			$this->Cell(30,5,"Vooraf",0,0,'L',true);
+			$this->Cell(20,5,sprintf("%.2f",$sv)." L",0,0,'R',true);
+			$this->Cell(20,5,'',0,0,'R',true);
+			$this->Ln();
 		}
 
 		$this->SetFillColor(210,245,255);
-		$this->Cell($vul+120,5,'',0,0,'L',false);
+		$this->Cell($vul+90,5,'',0,0,'L',false);
 		$this->Cell(20,5,sprintf("%8.3f",$cost_yeasts).EURO,0,0,'R',true);
 		$this->ProcessingTable=false;
 		$this->cMargin=$cMargin;
@@ -334,14 +350,14 @@
 		global $cost_miscs;
 		$misctype = array( 'Specerij', 'Kruid', 'Smaakstof', 'Klaringsmiddel', 'Brouwzout', 'Gistvoeding', 'Anders' );
 		$miscuse  = array( 'Starter', 'Maischen', 'Koken', 'Hoofdvergisting', 'Nagisting/lagering', 'Bottelen' );
-		$vul = $this->w - $this->rMargin - $this->lMargin - 100;
+		$vul = $this->w - $this->rMargin - $this->lMargin - 95;
 		if ($this->GetY() > 200)
                         $this->AddPage();
                 else
                         $this->Ln();
 		$this->AddCol($vul,'Diversen naam','L');
-		$this->AddCol(30,'Soort','L');
-		$this->AddCol(30,'Gebruik','L');
+		$this->AddCol(25,'Soort','L');
+		$this->AddCol(30,'Gebruik moment','L');
 		$this->AddCol(20,'Hoeveel','R');
 		$this->AddCol(20,'Prijs','R');
 
@@ -382,7 +398,7 @@
 
 			$hoeveel = sprintf("%.2f %s",$amount,$aiw ? "gr":"ml");
 			$this->Cell($vul,5,$name,0,0,'L',true);
-			$this->Cell(30,5,$misctype[$type],0,0,'L',true);
+			$this->Cell(25,5,$misctype[$type],0,0,'L',true);
 			$this->Cell(30,5,$gebruik,0,0,'L',true);
 			$this->Cell(20,5,$hoeveel,0,0,'R',true);
 			$this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true);
@@ -390,7 +406,7 @@
 		}
 
 		$this->SetFillColor(210,245,255);
-		$this->Cell($vul+80,5,'',0,0,'L',false);
+		$this->Cell($vul+75,5,'',0,0,'L',false);
 		$this->Cell(20,5,sprintf("%8.3f",$cost_miscs).EURO,0,0,'R',true);
 
 		$this->ProcessingTable=false;
@@ -453,7 +469,76 @@
 		$this->Ln();
 	}
 
-	// Watercolor $this->SetFillColor(120,255,250);
+	function TableWaters($row) {
+
+		$vul = $this->w - $this->rMargin - $this->lMargin - 137;
+                if ($this->GetY() > 250)
+                        $this->AddPage();
+                else
+                        $this->Ln();
+                $this->AddCol($vul,'Water bron','L');
+                $this->AddCol(20,'Volume','R');
+                $this->AddCol(15,'Ca','R');
+                $this->AddCol(15,'Mg','R');
+                $this->AddCol(15,'Na','R');
+                $this->AddCol(15,'CaCO3','R');
+                $this->AddCol(15,'Cl','R');
+                $this->AddCol(15,'SO4','R');
+		$this->AddCol(15,'pH','R');
+
+		$cMargin=$this->cMargin;
+                $this->cMargin=2;
+                $this->TableX=$this->lMargin;
+                $this->TableHeader();
+                $this->ProcessingTable=true;
+
+                $this->SetFont('Helvetica','',9);
+                $this->SetFillColor(120, 255, 250);
+
+		$this->Cell($vul,5,$row['w1_name'],0,0,'L',true);
+                $this->Cell(20,5,sprintf("%.1f", $row['w1_amount']).' L',0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w1_calcium']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w1_magnesium']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w1_sodium']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w1_total_alkalinity']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w1_chloride']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w1_sulfate']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w1_ph']),0,0,'R',true);
+                $this->Ln();
+		$this->Cell($vul,5,$row['w2_name'],0,0,'L',true);
+                $this->Cell(20,5,sprintf("%.1f", $row['w2_amount']).' L',0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['w2_calcium']),0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['w2_magnesium']),0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['w2_sodium']),0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['w2_total_alkalinity']),0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['w2_chloride']),0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['w2_sulfate']),0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['w2_ph']),0,0,'R',true);
+                $this->Ln();
+		$this->Cell($vul,5,'Gemengd water',0,0,'L',true);
+                $this->Cell(20,5,sprintf("%.1f", $row['wg_amount']).' L',0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['wg_calcium']),0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['wg_magnesium']),0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['wg_sodium']),0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['wg_total_alkalinity']),0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['wg_chloride']),0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['wg_sulfate']),0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['wg_ph']),0,0,'R',true);
+                $this->Ln();
+		$this->Cell($vul,5,'Behandeld water',0,0,'L',true);
+                $this->Cell(20,5,'',0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['wb_calcium']),0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['wb_magnesium']),0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['wb_sodium']),0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['wb_total_alkalinity']),0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['wb_chloride']),0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['wb_sulfate']),0,0,'R',true);
+                $this->Cell(15,5,sprintf("%.1f", $row['wb_ph']),0,0,'R',true);
+		$this->ProcessingTable=false;
+                $this->cMargin=$cMargin;
+                $this->aCols=array();
+                $this->Ln();
+	}
 
 	function TableSummary($row) {
 		global $pSugar;
@@ -718,10 +803,7 @@
 			$v = $msugars / $sugardensity + $mvol;
 			$plato = 1000 * $msugars / ($v * 10);	// deg. Plato
 			$mash_sg = plato_to_sg($plato);
-			$brix = $plato * $my_brix_correction;
-			$s = 'doel sg eind maischen: '.sprintf("%.3f",$mash_sg);
-			$s .= ' SG ('.sprintf("%.1f",$brix).' '.DEG.'Brix, '.sprintf("%.1f",$plato).' '.DEG.'P)';
-			$this->Checkline($s);
+			$this->Checkline('doel SG eind maischen: '.density_str($mash_sg));
 		}
 		if ($this->GetY() > 200)
 			$this->AddPage();
@@ -741,10 +823,7 @@
 		$s .= sprintf("%.1f",kettle_cm($row['boil_size'] * 1.04,$row['eq_kettle_volume'],$row['eq_kettle_height'])).' cm onder de rand)';
 		$this->Checkline($s);
 		$pre_sg = estimate_sg($msugars * floatval($row['efficiency']) / 100,floatval($row['boil_size']));
-		$plato = sg_to_plato($pre_sg);
-		$brix = $plato * $my_brix_correction;
-		$s = 'doel SG in kookketel: '.sprintf("%.3f",$pre_sg).' SG ('.sprintf("%.1f",$brix).' '.DEG.'Brix, '.sprintf("%.1f",$plato).' '.DEG.'P)';
-		$this->Checkline($s);
+		$this->Checkline('doel SG in kookketel: '.density_str($pre_sg));
 		$hops = json_decode($row['json_hops'], true);
 		foreach($hops as $item2) {
 			if ($item2['h_useat'] == 1) {
@@ -803,11 +882,7 @@
 		$s .= sprintf("%.1f",kettle_cm($row['batch_size']*1.04,$row['eq_kettle_volume'],$row['eq_kettle_height']));
 		$s .= ' cm onder de rand)';
 		$this->Checkline($s);
-		$plato = sg_to_plato($row['est_og']);
-		$brix = $plato * $my_brix_correction;
-		$s = 'doel SG einde koken: '.sprintf("%.3f",$row['est_og']).' SG (';
-		$s .= sprintf("%.1f",$brix).' '.DEG.'Brix, '.sprintf("%.1f",$plato).' '.DEG.'P)';
-		$this->Checkline($s);
+		$this->Checkline('doel SG einde koken: '.density_str($row['est_og']));
 		if ($this->GetY() > 200)
 			$this->AddPage();
 		else
@@ -934,37 +1009,13 @@
                 $this->Cell(50,5,$row['brew_date_end'],0,0,'L',true);
                 $this->Cell($vul,5,'',0,0,'L',false);
                 $this->Cell(35,5,'Maisch densiteit',0,0,'L',true);
-		$plato = sg_to_plato(floatval($row['brew_mash_sg']));
-                $brix = $plato * $my_brix_correction;
-                $this->Cell(50,5,sprintf("%.3f", floatval($row['brew_mash_sg']))." SG  ".sprintf("%.1f",$brix).DEG.'Brix  '.sprintf("%.1f",$plato).DEG.'P',0,0,'L',true);
+                $this->Cell(50,5,density_str(floatval($row['brew_mash_sg'])),0,0,'L',true);
                 $this->Ln();
 
-		$infuse = $mvol = floatval($row['w1_amount']) + floatval($row['w2_amount']);
-		$msugars = 0;
-		$bsugars = 0;
-		$mashkg = 0;
-		$ferms = json_decode($row['json_fermentables'], true);
-                foreach($ferms as $item) {
-                	if ($item['f_added'] == 0) {	// Mash
-                        	$msugars += floatval($item['f_amount']) * (floatval($item['f_yield']) / 100) * (1 - floatval($item['f_moisture']) / 100);
-                                $mvol += floatval($item['f_amount']) * floatval($item['f_moisture']) / 100;
-				$mashkg += floatval($item['f_amount']);
-                        }
-			if ($item['f_added'] == 1) {	// Boil
-				$bsugars += floatval($item['f_amount']) * (floatval($item['f_yield']) / 100) * (1 - floatval($item['f_moisture']) / 100);
-			}
-                }
-                $sugardensity = 1.611;
-                $v = $msugars / $sugardensity + $mvol;
-                $plato = 1000 * $msugars / ($v * 10);
-		if ($plato > 0.5)
-			$e = 100 * sg_to_plato(floatval($row['brew_mash_sg'])) / $plato;
-		else
-			$e = 0;
 		$this->SetX($this->TableX);
                 $this->Cell(85+$vul,5,'',0,0,'L',false);
                 $this->Cell(35,5,'Maisch rendement',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.1f", $e)."%",0,0,'L',true);
+                $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_mash_efficiency']))."%",0,0,'L',true);
                 $this->Ln(7);
 
 		$this->SetX($this->TableX);
@@ -977,14 +1028,10 @@
 
 		$this->SetX($this->TableX);
                 $this->Cell(35,5,'Voor koken densiteit',0,0,'L',true);
-		$plato = sg_to_plato(floatval($row['brew_preboil_sg']));
-                $brix = $plato * $my_brix_correction;
-                $this->Cell(50,5,sprintf("%.3f", floatval($row['brew_preboil_sg']))." SG  ".sprintf("%.1f",$brix).DEG.'Brix  '.sprintf("%.1f",$plato).DEG.'P',0,0,'L',true);
+                $this->Cell(50,5,density_str(floatval($row['brew_preboil_sg'])),0,0,'L',true);
                 $this->Cell($vul,5,'',0,0,'L',false);
                 $this->Cell(35,5,'Na koken densiteit',0,0,'L',true);
-		$plato = sg_to_plato(floatval($row['brew_aboil_sg']));
-                $brix = $plato * $my_brix_correction;
-                $this->Cell(50,5,sprintf("%.3f", floatval($row['brew_aboil_sg']))." SG  ".sprintf("%.1f",$brix).DEG.'Brix  '.sprintf("%.1f",$plato).DEG.'P',0,0,'L',true);
+                $this->Cell(50,5,density_str(floatval($row['brew_aboil_sg'])),0,0,'L',true);
                 $this->Ln();
 
 		$this->SetX($this->TableX);
@@ -997,23 +1044,10 @@
 
 		$this->SetX($this->TableX);
                 $this->Cell(35,5,'Voor koken rendement',0,0,'L',true);
-		$tot = sg_to_plato(floatval($row['brew_preboil_sg'])) * (floatval($row['brew_preboil_volume']) / 1.04) * floatval($row['brew_preboil_sg']) * 10 / 1000;
-		$result = 0;
-		if ($msugars > 0)
-			$result = (($tot / $msugars * 100) * 10) / 10;
-		if ($result < 0)
-			$result = 0;
-                $this->Cell(50,5,sprintf("%.1f", $result)."%",0,0,'L',true);
+                $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_preboil_efficiency']))."%",0,0,'L',true);
                 $this->Cell($vul,5,'',0,0,'L',false);
                 $this->Cell(35,5,'Na koken rendement',0,0,'L',true);
-		$tot = sg_to_plato(floatval($row['brew_aboil_sg'])) * (floatval($row['brew_aboil_volume']) / 1.04) * floatval($row['brew_aboil_sg']) * 10 / 1000;
-		$tot -= $bsugars;
-		$result = 0;
-		if ($msugars > 0)
-                        $result = (($tot / $msugars * 100) * 10) / 10;
-                if ($result < 0)
-                        $result = 0;
-                $this->Cell(50,5,sprintf("%.1f", $result)."%",0,0,'L',true);
+                $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_aboil_efficiency']))."%",0,0,'L',true);
                 $this->Ln(7);
 
 		$coolingtype = array( '-', 'Dompelkoeler', 'Tegenstroomkoeler', 'Au bain marie', 'Laten afkoelen' );
@@ -1025,10 +1059,9 @@
                 $this->Cell(50,5,$coolingtype[$row['brew_cooling_method']],0,0,'L',true);
                 $this->Ln();
 
-		$spoelw = (floatval($row['boil_size']) - $infuse + ($mashkg * $my_grain_absorbtion) + floatval($row['eq_lauter_deadspace'])) * 1.03;
 		$this->SetX($this->TableX);
-                $this->Cell(35,5,'Spoelwater volume',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.1f", $spoelw).' liter',0,0,'L',true);
+                $this->Cell(35,5,'Spoelwater geschat',0,0,'L',true);
+                $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_sparge_est'])).' liter',0,0,'L',true);
                 $this->Cell($vul,5,'',0,0,'L',false);
                 $this->Cell(35,5,'Koel temperatuur',0,0,'L',true);
                 $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_cooling_to'])).DEG.'C',0,0,'L',true);
@@ -1071,7 +1104,7 @@
                 $this->Cell(50,5,sprintf("%.0f", $row['brew_whirlpool2']).' minuten',0,0,'L',true);
                 $this->Cell($vul,5,'',0,0,'L',false);
                 $this->Cell(35,5,'Densiteit in gistvat',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.3f", floatval($row['brew_fermenter_sg'])).' SG',0,0,'L',true);
+                $this->Cell(50,5,density_str(floatval($row['brew_fermenter_sg'])),0,0,'L',true);
                 $this->Ln(7);
 
 		$aerationtype = array( 'Geen', 'Lucht', 'Zuurstof' );
@@ -1134,6 +1167,7 @@
 $pdf->TableYeasts($row);
 $pdf->TableMiscs($row);
 $pdf->TableMashs($row);
+$pdf->TableWaters($row);
 $pdf->TableSummary($row);
 if (strlen($row['notes'])) {
 	if ($pdf->GetY() > 200)
--- a/www/rec_forum.php	Fri May 31 22:58:03 2019 +0200
+++ b/www/rec_forum.php	Sun Jun 02 12:48:54 2019 +0200
@@ -142,7 +142,9 @@
 	$ibu    = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $amount, $time, $alpha, $row['ibu_method']);
 	$moment = $hopuse[$item['h_useat']];
         if ($item['h_useat'] == 2) {    // Boil
-        	$moment = "Kook ".$time." minuten";
+        	$moment = "Koken ".$time." minuten";
+	} else if ($item['h_useat'] == 5) {	// Dryhop
+		$moment   = 'Koudhop '.sprintf("%.0f", $time / 1440).' dagen';
         }
 
 	echo sprintf("%s %-7s %5.1f %5.1f %6.1f %-20s", $name, $hopform[$item['h_form']], $alpha, $ibu, $amount, $moment);
--- a/www/rec_print.php	Fri May 31 22:58:03 2019 +0200
+++ b/www/rec_print.php	Sun Jun 02 12:48:54 2019 +0200
@@ -88,7 +88,7 @@
 		$this->Cell($vul,5,'',0,0,'L',false);
 		$this->Cell(35,5,'Brouwzaal rendement',0,0,'L',true);
 		$this->Cell(25,5,$row['efficiency'].' %',0,0,'L',true);
-		$this->Ln(10);
+		$this->Ln();
 
 		$this->cMargin=$cMargin;
 	}
@@ -100,15 +100,17 @@
 		global $pCara;
 		global $colorw;
 		global $preboil_sg;
-		$added = array( 'Maischen', 'Koken', 'Vergisten', 'Nagisten/lageren', 'Bottelen' );
-		$vul = $this->w - $this->rMargin - $this->lMargin - 132;
-		$this->AddCol($vul,'Grondstof','L');
-		$this->AddCol(30,'Leverancier','L');
-		$this->AddCol(15,'EBC','R');
-		$this->AddCol(17,'Moment','L');
-		$this->AddCol(20,'Kg','R');
+		$added = array( 'Maischen', 'Koken 10 min', 'Vergisten', 'Nagisten/lageren', 'Bottelen' );
+		$ftype = array( 'Mout', 'Suiker', 'Vloeibaar extract', 'Droog extract', 'Ongemout graan' );
+		$mtype = array( 'Basismout', 'Geroosterde mout', 'Cara- of crystalmout', 'Geëeste mout', 'Zuurmout', 'Speciale mout', 'Geen mout' );
+		$vul = $this->w - $this->rMargin - $this->lMargin - 125;
+		$this->Ln();
+		$this->AddCol($vul,'Mout, granen en suikers','L');
 		$this->AddCol(15,'Procent','R');
 		$this->AddCol(15,'Opbr.','R');
+		$this->AddCol(25,'Soort', 'L');
+		$this->AddCol(30,'Gebruik moment','L');
+		$this->AddCol(20,'Hoeveel','R');
 		$this->AddCol(20,'Prijs','R');
 
 		$cMargin=$this->cMargin;
@@ -137,6 +139,11 @@
 			if ($item['f_graintype'] == 2)	// Crystal
 				$pCara += $percent;
 
+			if ($item['f_type'] == 0)
+				$soort = iconv('UTF-8','windows-1252',$mtype[$item['f_graintype']]);
+			else
+				$soort = iconv('UTF-8','windows-1252',$ftype[$item['f_type']]);
+
 			$cost = $amount * $costkg;
 			$cost_fermentables += $cost;
 			$total_fermentables += $amount;
@@ -149,28 +156,31 @@
 			$sugarsf += $d;
 			$colorw += ($amount * ebc_to_srm($color) / $row['batch_size']) * 8.34436;
 
-			$this->Cell($vul,5,$name,0,0,'L',true);
-			$this->Cell(30,5,$supplier,0,0,'L',true);
-			$this->Cell(15,5,sprintf("%.0f",$color),0,0,'R',true);
-			$this->Cell(17,5,$added[$item['f_added']],0,0,'L',true);
-			$this->Cell(20,5,sprintf("%8.3f",$amount),0,0,'R',true);
+			if ($amount > 100)
+				$amount = sprintf("%.1f",$amount).' kg';
+			else if ($amount > 10)
+				$amount = sprintf("%.2f",$amount).' kg';
+			else
+				$amount = sprintf("%.0f",$amount * 1000).' gr';
+			$this->Cell($vul,5,$name.' ('.$supplier.') '.sprintf("%.0f",$color).' EBC',0,0,'L',true);
 			$this->Cell(15,5,sprintf("%.1f%%",$percent),0,0,'R',true);
 			$this->Cell(15,5,sprintf("%.1f%%",$yield),0,0,'R',true);
-			$this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true);
+			$this->Cell(25,5,$soort,0,0,'L',true);
+			$this->Cell(30,5,$added[$item['f_added']],0,0,'L',true);
+			$this->Cell(20,5,$amount,0,0,'R',true);
+			$this->Cell(20,5,sprintf("%.3f",$cost).EURO,0,0,'R',true);
 			$this->Ln();
 		}
 
 		$row['est_og'] = estimate_sg($sugarsf, floatval($row['batch_size']));
 		$preboil_sg = estimate_sg($sugarsm, floatval($row['boil_size']));
 		$this->SetFillColor(210,245,255);
-		$this->Cell($vul+62,5,'',0,0,'L',false);
-		$this->Cell(20,5,sprintf("%8.3f",$total_fermentables),0,0,'R',true);
-		$this->Cell(30,5,'',0,0,'L',false);
-		$this->Cell(20,5,sprintf("%8.3f",$cost_fermentables).EURO,0,0,'R',true);
-		$this->Ln(10);
+		$this->Cell($vul+105,5,'',0,0,'L',false);
+		$this->Cell(20,5,sprintf("%.3f",$cost_fermentables).EURO,0,0,'R',true);
 		$this->ProcessingTable=false;
 		$this->cMargin=$cMargin;
 		$this->aCols=array();
+		$this->Ln();
 	}
 
 	function TableHops($row) {
@@ -178,17 +188,16 @@
 		global $total_ibus;
 		global $cost_hops;
 		global $preboil_sg;
-//		$hoptype = array( 'Bitterhop', 'Aromahop', 'Beide' );
 		$hopform = array( 'Pellets', 'Plugs', 'Bellen', 'Hop nat' );
 		$hopuse  = array( 'Maischen', 'First wort', 'Koken', 'Vlamuit', 'Whirlpool', 'Koudhop' );
-		$vul = $this->w - $this->rMargin - $this->lMargin - 135;
+		$vul = $this->w - $this->rMargin - $this->lMargin - 122;
+		$this->Ln();
 		$this->AddCol($vul,'Hop','L');
-		$this->AddCol(35,'Land','L');
-		$this->AddCol(15,'Soort','L');
-		$this->AddCol(20,'Moment','L');
 		$this->AddCol(15,'Alpha','R');
 		$this->AddCol(12,'IBU','R');
-		$this->AddCol(18,'Gram','R');
+		$this->AddCol(25,'Soort','L');
+		$this->AddCol(30,'Gebruik moment','L');
+		$this->AddCol(20,'Hoeveel','R');
 		$this->AddCol(20,'Prijs','R');
 
 		$cMargin=$this->cMargin;
@@ -204,43 +213,47 @@
 		foreach($arr as $item) { //foreach element in $arr
 			$name     = iconv('UTF-8','windows-1252',$item['h_name']);
 			$origin   = iconv('UTF-8','windows-1252',$item['h_origin']);
-			$amount   = floatval($item['h_amount']) * 1000;
-			$mass     = $amount;
+			$amount   = floatval($item['h_amount']);
+			$mass     = $amount * 1000;
 			$costkg   = floatval($item['h_cost']);
 			$time     = floatval($item['h_time']);
 			$alpha    = floatval($item['h_alpha']);
 
-			$cost = ($amount * $costkg) / 1000;
+			$cost = ($amount * $costkg);
 			$cost_hops += $cost;
 			$total_hops += $amount;
 
 			$moment = $hopuse[$item['h_useat']];
 			if ($item['h_useat'] == 2) {	// Boil
-				$moment   = "Kook@".$time;
+				$moment   = "Koken ".$time." min";
+			} else if ($item['h_useat'] == 5) {	// Dryhop
+				$moment   = 'Koudhop '.sprintf("%.0f", $time / 1440).' dagen';
 			}
 			$ibu = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $mass, $time, $alpha, $row['ibu_method']);
 			$total_ibus += $ibu;
 
-			$this->Cell($vul,5,$name,0,0,'L',true);
-			$this->Cell(35,5,$origin,0,0,'L',true);
-			$this->Cell(15,5,$hopform[$item['h_form']],0,0,'L',true);
-			$this->Cell(20,5,$moment,0,0,'L',true);
+			if ($amount > 1)
+				$amount = sprintf("%.3f",$amount).' kg';
+			else
+				$amount = sprintf("%.1f",$amount * 1000).' gr';
+
+			$this->Cell($vul,5,$name.' ('.$origin.')',0,0,'L',true);
 			$this->Cell(15,5,sprintf("%.1f%%",$alpha),0,0,'R',true);
 			$this->Cell(12,5,sprintf("%.1f",$ibu),0,0,'R',true);
-			$this->Cell(18,5,sprintf("%.1f",$amount),0,0,'R',true);
-			$this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true);
+			$this->Cell(25,5,$hopform[$item['h_form']],0,0,'L',true);
+			$this->Cell(30,5,$moment,0,0,'L',true);
+			$this->Cell(20,5,$amount,0,0,'R',true);
+			$this->Cell(20,5,sprintf("%.3f",$cost).EURO,0,0,'R',true);
 			$this->Ln();
 		}
 
 		$this->SetFillColor(210,245,255);
-		$this->Cell($vul+85,5,'',0,0,'L',false);
-		$this->Cell(12,5,sprintf("%.1f",$total_ibus),0,0,'R',true);
-		$this->Cell(18,5,sprintf("%.1f",$total_hops),0,0,'R',true);
-		$this->Cell(20,5,sprintf("%8.3f",$cost_hops).EURO,0,0,'R',true);
-		$this->Ln(10);
+		$this->Cell($vul+102,5,'',0,0,'L',false);
+		$this->Cell(20,5,sprintf("%.3f",$cost_hops).EURO,0,0,'R',true);
 		$this->ProcessingTable=false;
 		$this->cMargin=$cMargin;
 		$this->aCols=array();
+		$this->Ln();
 	}
 
 	function TableYeasts($row) {
@@ -248,14 +261,13 @@
 		global $svg;
 		$yeastform = array( 'Vloeibaar', 'Droog', 'Schuine buis', 'Slurry', 'Ingevroren', 'Depot' );
 		$yeastuse  = array( 'Hoofdgisting', 'Nagisting', 'Lagering', 'Bottelen' );
-		$vul = $this->w - $this->rMargin - $this->lMargin - 140;
-		$this->AddCol(27,'Laboratorium','L');
-		$this->AddCol(18,'Product','L');
+		$vul = $this->w - $this->rMargin - $this->lMargin - 110;
+		$this->Ln();
 		$this->AddCol($vul,'Gist','L');
-		$this->AddCol(20,'Gebruik','L');
 		$this->AddCol(15,'Attn','R');
-		$this->AddCol(22,'Vorm','L');
-		$this->AddCol(18,'Hoeveel','R');
+		$this->AddCol(25,'Soort','L');
+		$this->AddCol(30,'Gebruik moment','L');
+		$this->AddCol(20,'Hoeveel','R');
 		$this->AddCol(20,'Prijs','R');
 
 		$cMargin=$this->cMargin;
@@ -285,34 +297,36 @@
 				$amount = sprintf("%.1f",floatval($item['y_amount'])*1000)." gr";
 			else
 				$amount = sprintf("%.0f",floatval($item['y_amount'])*1000)." ml";
-			$this->Cell(27,5,$laboratory,0,0,'L',true);
-			$this->Cell(18,5,$product_id,0,0,'L',true);
-			$this->Cell($vul,5,$name,0,0,'L',true);
-			$this->Cell(20,5,$yeastuse[$item['y_use']],0,0,'L',true);
+			$this->Cell($vul,5,$laboratory.' '.$product_id.' ('.$name.')',0,0,'L',true);
 			$this->Cell(15,5,sprintf("%.1f%%",$attenuation),0,0,'R',true);
-			$this->Cell(22,5,$yeastform[$item['y_form']],0,0,'L',true);
-			$this->Cell(18,5,$amount,0,0,'R',true);
+			$this->Cell(25,5,$yeastform[$item['y_form']],0,0,'L',true);
+			$this->Cell(30,5,$yeastuse[$item['y_use']],0,0,'L',true);
+			$this->Cell(20,5,$amount,0,0,'R',true);
 			$this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true);
 			$this->Ln();
 		}
 
 		$this->SetFillColor(210,245,255);
-		$this->Cell($vul+120,5,'',0,0,'L',false);
+		$this->Cell($vul+90,5,'',0,0,'L',false);
 		$this->Cell(20,5,sprintf("%8.3f",$cost_yeasts).EURO,0,0,'R',true);
-		$this->Ln(10);
 		$this->ProcessingTable=false;
 		$this->cMargin=$cMargin;
 		$this->aCols=array();
+		$this->Ln();
 	}
 
 	function TableMiscs($row) {
 		global $cost_miscs;
 		$misctype = array( 'Specerij', 'Kruid', 'Smaakstof', 'Klaringsmiddel', 'Brouwzout', 'Gistvoeding', 'Anders' );
 		$miscuse  = array( 'Starter', 'Maischen', 'Koken', 'Hoofdvergisting', 'Nagisting/lagering', 'Bottelen' );
-		$vul = $this->w - $this->rMargin - $this->lMargin - 100;
+		$vul = $this->w - $this->rMargin - $this->lMargin - 95;
+		if ($this->GetY() > 200)
+                        $this->AddPage();
+                else
+                        $this->Ln();
 		$this->AddCol($vul,'Naam','L');
-		$this->AddCol(30,'Soort','L');
-		$this->AddCol(30,'Gebruik','L');
+		$this->AddCol(25,'Soort','L');
+		$this->AddCol(30,'Gebruik moment','L');
 		$this->AddCol(20,'Hoeveel','R');
 		$this->AddCol(20,'Prijs','R');
 
@@ -353,7 +367,7 @@
 
 			$hoeveel = sprintf("%.1f %s",$amount,$aiw ? "gr":"ml");
 			$this->Cell($vul,5,$name,0,0,'L',true);
-			$this->Cell(30,5,$misctype[$type],0,0,'L',true);
+			$this->Cell(25,5,$misctype[$type],0,0,'L',true);
 			$this->Cell(30,5,$gebruik,0,0,'L',true);
 			$this->Cell(20,5,$hoeveel,0,0,'R',true);
 			$this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true);
@@ -361,16 +375,139 @@
 		}
 
 		$this->SetFillColor(210,245,255);
-		$this->Cell($vul+80,5,'',0,0,'L',false);
+		$this->Cell($vul+75,5,'',0,0,'L',false);
 		$this->Cell(20,5,sprintf("%8.3f",$cost_miscs).EURO,0,0,'R',true);
-		$this->Ln(10);
 
 		$this->ProcessingTable=false;
 		$this->cMargin=$cMargin;
 		$this->aCols=array();
+		$this->Ln();
+	}
+
+	function TableMashs($row) {
+                global $cost_yeasts;
+                global $svg;
+                global $mashkg;
+                $mashtype = array( 'Infusie', 'Verwarming', 'Decoctie' );
+                $vul = $this->w - $this->rMargin - $this->lMargin - 137;
+                if ($this->GetY() > 250)
+                        $this->AddPage();
+                else
+                        $this->Ln();
+                $this->AddCol($vul,'Maisch stap naam','L');
+                $this->AddCol(25,'Stap type','L');
+                $this->AddCol(18,'Start '.DEG.'C','R');
+                $this->AddCol(18,'Eind '.DEG.'C','R');
+                $this->AddCol(18,'Rust min','R');
+                $this->AddCol(18,'Stap min','R');
+                $this->AddCol(20,'L/Kg','R');
+                $this->AddCol(20,'Infusie L','R');
+
+                $cMargin=$this->cMargin;
+                $this->cMargin=2;
+                $this->TableX=$this->lMargin;
+                $this->TableHeader();
+                $this->ProcessingTable=true;
+
+                $this->SetFont('Helvetica','',9);
+                $this->SetFillColor(175, 175, 255);
+
+                $vol = 0;
+                $arr = json_decode($row['json_mashs'], true);
+                foreach($arr as $item) { //foreach element in $arr
+
+                        if ($item['step_type'] == 0)
+                                $vol += $item['step_infuse_amount'];
+                        if ($mashkg > 0)
+                                $thick = $vol / $mashkg;
+                        else
+                                $thick = 0;
+                        $this->Cell($vul,5,$item['step_name'],0,0,'L',true);
+                        $this->Cell(25,5,$mashtype[$item['step_type']],0,0,'L',true);
+                        $this->Cell(18,5,sprintf("%.1f",$item['step_temp']),0,0,'R',true);
+                        $this->Cell(18,5,sprintf("%.1f",$item['end_temp']),0,0,'R',true);
+                        $this->Cell(18,5,sprintf("%.0f",$item['step_time']),0,0,'R',true);
+                        $this->Cell(18,5,sprintf("%.0f",$item['ramp_time']),0,0,'R',true);
+                        $this->Cell(20,5,sprintf("%.2f",$thick),0,0,'R',true);
+                        $this->Cell(20,5,sprintf("%.1f",$item['step_infuse_amount']),0,0,'R',true);
+                        $this->Ln();
+                }
+                $this->ProcessingTable=false;
+                $this->cMargin=$cMargin;
+                $this->aCols=array();
+                $this->Ln();
 	}
 
-	// Watercolor $this->SetFillColor(120,255,250);
+	function TableWaters($row) {
+
+		$vul = $this->w - $this->rMargin - $this->lMargin - 137;
+		if ($this->GetY() > 250)
+			$this->AddPage();
+		else
+			$this->Ln();
+		$this->AddCol($vul,'Water bron','L');
+		$this->AddCol(20,'Volume','R');
+		$this->AddCol(15,'Ca','R');
+		$this->AddCol(15,'Mg','R');
+		$this->AddCol(15,'Na','R');
+		$this->AddCol(15,'CaCO3','R');
+		$this->AddCol(15,'Cl','R');
+		$this->AddCol(15,'SO4','R');
+		$this->AddCol(15,'pH','R');
+
+		$cMargin=$this->cMargin;
+		$this->cMargin=2;
+		$this->TableX=$this->lMargin;
+		$this->TableHeader();
+		$this->ProcessingTable=true;
+
+		$this->SetFont('Helvetica','',9);
+		$this->SetFillColor(120, 255, 250);
+
+		$this->Cell($vul,5,$row['w1_name'],0,0,'L',true);
+		$this->Cell(20,5,sprintf("%.1f", $row['w1_amount']).' L',0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w1_calcium']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w1_magnesium']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w1_sodium']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w1_total_alkalinity']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w1_chloride']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w1_sulfate']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w1_ph']),0,0,'R',true);
+		$this->Ln();
+		$this->Cell($vul,5,$row['w2_name'],0,0,'L',true);
+		$this->Cell(20,5,sprintf("%.1f", $row['w2_amount']).' L',0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w2_calcium']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w2_magnesium']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w2_sodium']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w2_total_alkalinity']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w2_chloride']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w2_sulfate']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['w2_ph']),0,0,'R',true);
+		$this->Ln();
+		$this->Cell($vul,5,'Gemengd water',0,0,'L',true);
+		$this->Cell(20,5,sprintf("%.1f", $row['wg_amount']).' L',0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['wg_calcium']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['wg_magnesium']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['wg_sodium']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['wg_total_alkalinity']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['wg_chloride']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['wg_sulfate']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['wg_ph']),0,0,'R',true);
+		$this->Ln();
+		$this->Cell($vul,5,'Behandeld water',0,0,'L',true);
+		$this->Cell(20,5,'',0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['wb_calcium']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['wb_magnesium']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['wb_sodium']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['wb_total_alkalinity']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['wb_chloride']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['wb_sulfate']),0,0,'R',true);
+		$this->Cell(15,5,sprintf("%.1f", $row['wb_ph']),0,0,'R',true);
+		$this->ProcessingTable=false;
+                $this->cMargin=$cMargin;
+                $this->aCols=array();
+		$this->Ln();
+	}
 
 	function TableSummary($row) {
 		global $pSugar;
@@ -384,6 +521,10 @@
 		$colormethod = array( 'Morey', 'Mosher', 'Daniels' );
 		$ibumethod = array( 'Tinseth', 'Rager', 'Daniels' );
 		/* 2 Columns */
+		if ($this->GetY() > 200)
+                        $this->AddPage();
+                else
+                        $this->Ln();
 		$vul = $this->w - $this->rMargin - $this->lMargin - 170;
 		$cMargin=$this->cMargin;
 		$this->cMargin=2;
@@ -442,11 +583,12 @@
 		$this->Cell(35,5,'Kosten',0,0,'L',true);
 		$this->Cell(25,5,sprintf("%.2f",$cost_total).EURO,0,0,'L',true);
 		$this->Cell(25,5,sprintf("%.2f",$cost_total/$row['batch_size']).EURO.' / liter',0,0,'L',true);
-		$this->Ln(10);
 
-
-		// Kostprijs per liter, calorieren
-		$this->cMargin=$cMargin;
+                // calorieen
+                $this->ProcessingTable=false;
+                $this->cMargin=$cMargin;
+                $this->aCols=array();
+                $this->Ln();
 	}
 }
 
@@ -486,11 +628,19 @@
 $pdf->TableHops($row);
 $pdf->TableYeasts($row);
 $pdf->TableMiscs($row);
+$pdf->TableMashs($row);
+$pdf->TableWaters($row);
 $pdf->TableSummary($row);
 if (strlen($row['notes'])) {
+	if ($pdf->GetY() > 200)
+                $pdf->AddPage();
+        else
+                $pdf->Ln(10);
 	$pdf->SetFillColor(255,150,100);
+	$pdf->SetFont('Helvetica','B',9);
 	$pdf->Cell(0, 5, 'Recept opmerkingen',0,0,'C',true);
 	$pdf->Ln();
+	$pdf->SetFont('Helvetica','',9);
 	$pdf->SetFillColor(210,245,255);
 	$pdf->MultiCell(0,4,$row['notes'],0,'L',true);
 }

mercurial