Added mash SG and pH fields. Fixed default Yeast update. Added mash step SG and pH input datafields. Added a Brix input too. The print report shows the mash measurements too. Other brewing results now show expected and measured values and the difference.

Thu, 15 Apr 2021 10:57:01 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 15 Apr 2021 10:57:01 +0200
changeset 738
11e6bd8d8107
parent 737
3f823bc205ca
child 739
bb923d2cbc35

Added mash SG and pH fields. Fixed default Yeast update. Added mash step SG and pH input datafields. Added a Brix input too. The print report shows the mash measurements too. Other brewing results now show expected and measured values and the difference.

www/includes/db_product.php file | annotate | diff | comparison | revisions
www/js/prod_edit.js file | annotate | diff | comparison | revisions
www/prod_edit.php file | annotate | diff | comparison | revisions
www/prod_print.php file | annotate | diff | comparison | revisions
--- a/www/includes/db_product.php	Wed Apr 14 10:49:37 2021 +0200
+++ b/www/includes/db_product.php	Thu Apr 15 10:57:01 2021 +0200
@@ -496,6 +496,14 @@
                                 $mash .= ',"step_wg_ratio":' . $item['step_wg_ratio'];
                         else
                                 $mash .= ',"step_wg_ratio":0';
+			if (isset($item['step_ph']) && $item['step_ph'] != "")
+				$mash .= ',"step_ph":' . $item['step_ph'];
+			else
+				$mash .= ',"step_ph":0.0';
+			if (isset($item['step_sg']) && $item['step_sg'] != "")
+				$mash .= ',"step_sg":' . $item['step_sg'];
+			else
+				$mash .= ',"step_sg":0.0';
 			$mash .= '}';
 			//syslog(LOG_NOTICE, $mash);
 			$mashs .= $mash;
@@ -1012,6 +1020,14 @@
                                                         $yeasts[$i]['y_pofpos'] = 0;
                                                 if (! isset($yeasts[$i]['y_zymocide']))
                                                         $yeasts[$i]['y_zymocide'] = 0;
+						if (! isset($yeasts[$i]['y_gr_hl_lo']))
+                                                        $yeasts[$i]['y_gr_hl_lo'] = 50;
+						if (! isset($yeasts[$i]['y_sg_lo']))
+                                                        $yeasts[$i]['y_sg_lo'] = 1.04;
+						if (! isset($yeasts[$i]['y_gr_hl_hi']))
+                                                        $yeasts[$i]['y_gr_hl_hi'] = 80;
+						if (! isset($yeasts[$i]['y_sg_hi']))
+                                                        $yeasts[$i]['y_sg_hi'] = 1.08;
                                         }
 					mysqli_free_result($result2);
 				}
--- a/www/js/prod_edit.js	Wed Apr 14 10:49:37 2021 +0200
+++ b/www/js/prod_edit.js	Thu Apr 15 10:57:01 2021 +0200
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright (C) 2018-2020
+ * Copyright (C) 2018-2021
  *
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -115,7 +115,7 @@
 
  $('#popupMash').jqxWindow({
   width: 800,
-  height: 375,
+  height: 400,
   position: { x: 230, y: 100 },
   resizable: false,
   theme: theme,
@@ -1565,7 +1565,9 @@
     { name: 'step_time', type: 'float' },
     { name: 'step_wg_ratio', type: 'float' },
     { name: 'ramp_time', type: 'float' },
-    { name: 'end_temp', type: 'float' }
+    { name: 'end_temp', type: 'float' },
+    { name: 'step_ph', type: 'float' },
+    { name: 'step_sg', type: 'float' }
    ],
    addrow: function(rowid, rowdata, position, commit) { commit(true); },
    deleterow: function(rowid, commit) { commit(true); }
@@ -1614,6 +1616,8 @@
      row['step_wg_ratio'] = 0;
      row['ramp_time'] = 1.0;
      row['end_temp'] = 62.0;
+     row['step_ph'] = 0.0;
+     row['step_sg'] = 0.0;
      $('#mashGrid').jqxGrid('addrow', null, row);
      calcMash();
     });
@@ -1648,16 +1652,16 @@
    },
    columns: [
     { text: 'Stap naam', datafield: 'step_name' },
-    { text: 'Stap type', datafield: 'step_type', width: 175,
+    { text: 'Stap type', datafield: 'step_type', width: 150,
       cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
        return '<span style="margin: 4px; margin-top: 6px; float: left;">' + MashStepTypeData[value].nl + '</span>';
       }
     },
-    { text: 'Start &deg;C', datafield: 'step_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
-    { text: 'Eind &deg;C', datafield: 'end_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
-    { text: 'Rust min.', datafield: 'step_time', width: 90, align: 'right', cellsalign: 'right' },
-    { text: 'Stap min.', datafield: 'ramp_time', width: 90, align: 'right', cellsalign: 'right' },
-    { text: 'Inf/dec L.', datafield: 'step_infuse_amount', width: 90, align: 'right',
+    { text: 'Start &deg;C', datafield: 'step_temp', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
+    { text: 'Eind &deg;C', datafield: 'end_temp', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
+    { text: 'Rust min.', datafield: 'step_time', width: 80, align: 'right', cellsalign: 'right' },
+    { text: 'Stap min.', datafield: 'ramp_time', width: 80, align: 'right', cellsalign: 'right' },
+    { text: 'Inf/dec L.', datafield: 'step_infuse_amount', width: 80, align: 'right',
       cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
        if (rowdata.step_type == 1)
         return '<span></span>';
@@ -1675,7 +1679,7 @@
        return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(value, 'f2') + '</span>';
       }
     },
-    { text: 'L/Kg.', datafield: 'step_wg_ratio', width: 90, align: 'right',
+    { text: 'L/Kg.', datafield: 'step_wg_ratio', width: 80, align: 'right',
       cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
        var color = '#ffffff';
        if (value < 2.0 || value > 6.0)
@@ -1683,6 +1687,8 @@
        return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + dataAdapter.formatNumber(value, 'f2') + '</span>';
       }
     },
+    { text: 'pH', datafield: 'step_ph', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f2' },
+    { text: 'SG', datafield: 'step_sg', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
     { text: '', columntype: 'button', width: 15, align: 'center',
      cellsrenderer: function(row) {
       if (row < 2)
@@ -1741,6 +1747,8 @@
          $('#wstep_pmpt_temp').show();
         }
        }
+       $('#wstep_ph').val(mashData.step_ph);
+       $('#wstep_sg').val(mashData.step_sg);
        // show the popup window.
        $('#popupMash').jqxWindow('open');
       }
@@ -1779,10 +1787,10 @@
   var row2 = $('#mashGrid').jqxGrid('getrowdata', r2);
   var obj1 = { step_name: row1.step_name, step_type: row1.step_type, step_volume: row1.step_volume, step_infuse_amount: row1.step_infuse_amount,
                step_infuse_temp: row1.step_infuse_temp, step_temp: row1.step_temp, step_time: row1.step_time,
-               ramp_time: row1.ramp_time, end_temp: row1.end_temp, step_wg_ratio: row1.step_wg_ratio };
+               ramp_time: row1.ramp_time, end_temp: row1.end_temp, step_wg_ratio: row1.step_wg_ratio, step_ph: row1.step_ph, step_sg: row1.step_sg };
   var obj2 = { step_name: row2.step_name, step_type: row2.step_type, step_volume: row2.step_volume, step_infuse_amount: row2.step_infuse_amount,
                step_infuse_temp: row2.step_infuse_temp, step_temp: row2.step_temp, step_time: row2.step_time,
-               ramp_time: row2.ramp_time, end_temp: row2.end_temp, step_wg_ratio: row2.step_wg_ratio };
+               ramp_time: row2.ramp_time, end_temp: row2.end_temp, step_wg_ratio: row2.step_wg_ratio, step_ph: row2.step_ph, step_sg: row2.step_sg };
   $("#mashGrid").jqxGrid('updaterow', r1, obj2);
   $("#mashGrid").jqxGrid('updaterow', r2, obj1);
  }
@@ -5693,6 +5701,8 @@
       row['step_infuse_temp'] = 99.0;
      }
     }
+    row['step_ph'] = 0.0;
+    row['step_sg'] = 0.0;
     //console.log(i + ' type: ' + row['step_type'] + ' start infusion: ' + parseFloat(row['step_infuse_amount']) + ' mash_infuse: ' + mash_infuse);
     infused += parseFloat(row['step_infuse_amount']);
     row['step_volume'] = infused;
@@ -5800,6 +5810,26 @@
   rowdata.step_time = parseFloat(event.args.value);
   calcMash();
  });
+ $('#wstep_ph').jqxNumberInput(Spin2pH);
+ $('#wstep_ph').on('change', function(event) {
+  var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
+  rowdata.step_ph = parseFloat(event.args.value);
+ });
+ $('#wstep_sg').jqxNumberInput(SGopts);
+ $('#wstep_sg').on('change', function(event) {
+  var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
+  rowdata.step_sg = parseFloat(event.args.value);
+ });
+ $('#wstep_brix').jqxNumberInput(Spin1dec);
+ $('#wstep_brix').on('change', function(event) {
+  var sg = brix_to_sg(parseFloat(event.args.value));
+console.log('brix: ' + parseFloat(event.args.value) + ' sg: ' + sg);
+  if (sg > 1.005) {
+   var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
+   rowdata.step_sg = sg;
+   $('#wstep_sg').val(sg);
+  }
+ });
  $('#wramp_time').on('change', function(event) {
   var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
   rowdata.ramp_time = parseFloat(event.args.value);
@@ -6052,7 +6082,7 @@
  $('#brew_date_start,#brew_date_end').jqxDateTimeInput(DateTimeopts);
  $('#brew_date_start,#brew_date_end').on('close', function(event) { calcStage(); });
  $('#est_mash_ph').jqxNumberInput(Show2wat);
- $('#brew_mash_ph,#brew_preboil_ph,#brew_aboil_ph').jqxNumberInput(SpinpH);
+ $('#brew_mash_ph,#brew_preboil_ph,#brew_aboil_ph').jqxNumberInput(Spin2pH);
  $('#brew_mash_sg').on('valueChanged', function() { calcMashEfficiency(); });
  $('#brew_preboil_sg').on('valueChanged', function(event) {
   dataRecord.brew_preboil_sg = event.args.value;
@@ -6125,7 +6155,7 @@
  $('#est_pre_vol,#est_a_vol').jqxNumberInput(Show1wat);
  $('#brew_preboil_efficiency,#brew_aboil_efficiency,#brew_sparge_temperature,#brew_sparge_volume,#brew_sparge_est').jqxNumberInput(Show1dec);
  $('#brew_cooling_to').jqxNumberInput(Spin1dec);
- $('#brew_sparge_ph').jqxNumberInput(SpinpH);
+ $('#brew_sparge_ph').jqxNumberInput(Spin2pH);
  $('#brew_cooling_method').jqxDropDownList({
   theme: theme,
   source: CoolingTypeAdapter,
--- a/www/prod_edit.php	Wed Apr 14 10:49:37 2021 +0200
+++ b/www/prod_edit.php	Thu Apr 15 10:57:01 2021 +0200
@@ -1073,38 +1073,48 @@
      <table style="width: 100%;">
       <tr>
        <td align="right" style="vertical-align: top;">Stap naam:</td>
-       <td style="padding: 3px;"><input id="wstep_name" /></td>
+       <td style="padding: 3px;" colspan="3"><input id="wstep_name" /></td>
       </tr>
       <tr>
        <td align="right" style="vertical-align: top;">Stap type:</td>
-       <td style="padding: 3px;"><div id="wstep_type" /></div></td>
+       <td style="padding: 3px;" colspan="3"><div id="wstep_type" /></div></td>
       </tr>
       <tr>
        <td align="right" style="vertical-align: top;">Start temperatuur &deg;C:</td>
-       <td style="padding: 3px;"><div id="wstep_temp" /></div></td>
+       <td style="padding: 3px;" colspan="3"><div id="wstep_temp" /></div></td>
       </tr>
       <tr>
        <td align="right" style="vertical-align: top;">Eind temperatuur &deg;C:</td>
-       <td style="padding: 3px;"><div id="wend_temp"></div></td>
+       <td style="padding: 3px;" colspan="3"><div id="wend_temp"></div></td>
       </tr>
       <tr>
        <td align="right" style="vertical-align: top;">Stap tijd minuten:</td>
-       <td style="padding: 3px;"><div id="wstep_time"></div></td>
+       <td style="padding: 3px;" colspan="3"><div id="wstep_time"></div></td>
       </tr>
       <tr>
        <td align="right" style="vertical-align: top;">Opwarm tijd minuten:</td>
-       <td style="padding: 3px;"><div id="wramp_time"></div></td>
+       <td style="padding: 3px;" colspan="3"><div id="wramp_time"></div></td>
       </tr>
       <tr>
        <td align="right" style="vertical-align: top;"><div id="wstep_pmpt_amount">Infusie liters:</div></td>
-       <td style="padding: 3px;"><div id="wstep_infuse_amount"></div></td>
+       <td style="padding: 3px;" colspan="3"><div id="wstep_infuse_amount"></div></td>
       </tr>
       <tr>
        <td align="right" style="vertical-align: top;"><div id="wstep_pmpt_temp">Infusie temperatuur:</div></td>
-       <td style="padding: 3px;"><div id="wstep_infuse_temp"></div></td>
+       <td style="padding: 3px;" colspan="3"><div id="wstep_infuse_temp"></div></td>
+      </tr>
+      <tr>
+       <td align="right" style="vertical-align: top;">Gemeten pH:</td>
+       <td style="padding: 3px;" colspan="3"><div id="wstep_ph"></div></td>
       </tr>
       <tr>
-       <td style="padding-top: 30px;" colspan="2" align="center">
+       <td align="right" style="vertical-align: top;">Gemeten SG:</td>
+       <td style="padding: 3px;"><div id="wstep_sg"></div></td>
+       <td style="vertical-align: top; float: right; padding: 3px;">Afgelezen &deg;Brix RI:</td>
+       <td align="left" style="vertical-align: top;"><div id="wstep_brix"></div></td>
+      </tr>
+      <tr>
+       <td style="padding-top: 30px;" colspan="4" align="center">
         <input id="MashReady" type="button" value="Sla op" />
        </td>
       </tr>
--- a/www/prod_print.php	Wed Apr 14 10:49:37 2021 +0200
+++ b/www/prod_print.php	Thu Apr 15 10:57:01 2021 +0200
@@ -38,11 +38,13 @@
 $keg_sugar = '';
 $bottle_sugar_amount = 0;
 $keg_sugar_amount = 0;
+$est_mash_sg = 0;
 
 $divide_parts = $row['divide_parts'];
 $divide_part = $row['divide_part'];
 $divide_factor = floatval($row['divide_factor']);
 
+
 class PDF_MySQL_Table extends FPDF
 {
 	protected $ProcessingTable=false;
@@ -141,6 +143,7 @@
 		global $added;
 		global $fermentabletype;
 		global $graintype;
+		global $est_mash_sg;
 		$vul = $this->w - $this->rMargin - $this->lMargin - 125;
 		$this->Ln();
 		$this->AddCol($vul,'Mout, granen en suikers','L');
@@ -160,6 +163,7 @@
 		$sugarsf = 0;
 		$sugarsm = 0;
 		$mashkg = 0;
+		$s = 0;
 		$this->SetFont('Helvetica','',9);
 		$this->SetFillColor(250, 195, 65);
 		$arr = json_decode($row['json_fermentables'], true);
@@ -198,6 +202,7 @@
 			/* Calculate the amount of sugars */
 			$d = $amount * ($yield / 100) * (1 - $moisture / 100);
 			if ($item['f_added']  == 0) {
+				$s += $d;
 				$d = floatval($row['efficiency']) / 100 * $d;
 				$sugarsm += $d;
 				$mashkg += $amount;
@@ -223,7 +228,9 @@
 			$this->Cell(20,5,sprintf("%.3f",$cost).EURO,0,0,'R',true);
 			$this->Ln();
 		}
-
+		$v = $s / 1.611 + $row['wg_amount'];
+		$s = 1000 * $s / ($v * 10);	//deg. Plato
+		$est_mash_sg = plato_to_sg($s);
 		$row['est_og'] = estimate_sg($sugarsf, floatval($row['batch_size']));
 		$preboil_sg = estimate_sg($sugarsm, floatval($row['boil_size']));
 		$this->SetFillColor(210,245,255);
@@ -692,14 +699,26 @@
                 $this->Ln();
 	}
 
+	function PrintDiff($v1, $v2, $decimals, $un) {
+
+		$val1 = floatval($v1);
+		$val2 = floatval($v2);
+		if ($val2 > $val1)
+			$diff = '+' . number_format($val2 - $val1, $decimals) . $un;
+		else
+			$diff = number_format($val2 - $val1, $decimals) . $un;
+		$this->Cell(30,5,$diff,0,0,'L',true);
+	}
+
 	function Brewday($row) {
 
 		global $my_brix_correction;
 		global $my_grain_absorbtion;
 		global $coolingtype;
 		global $aerationtype;
-
-		if ($this->GetY() > 180)
+		global $est_mash_sg;
+		global $mashtype;
+		if ($this->GetY() > 100)
                         $this->AddPage();
                 else
                         $this->Ln(10);
@@ -716,132 +735,201 @@
 
 		$this->SetFont('Helvetica','',9);
         	$this->SetFillColor(210,245,255);
-
         	$this->SetX($this->TableX);
         	$this->Cell(35,5,'Datum start',0,0,'L',true);
         	$this->Cell(50,5,$row['brew_date_start'],0,0,'L',true);
         	$this->Cell($vul,5,'',0,0,'L',false);
-        	$this->Cell(35,5,'Maisch zuurgraad',0,0,'L',true);
-        	$this->Cell(50,5,sprintf("%.1f", $row['brew_mash_ph']).' pH',0,0,'L',true);
+		$this->Cell(35,5,'Datum eind',0,0,'L',true);
+		$this->Cell(50,5,$row['brew_date_end'],0,0,'L',true);
+		$this->Ln(10);
+
+		$domash = 0;
+		$arr = json_decode($row['json_mashs'], true);
+		foreach($arr as $item) {
+			if ($item['step_sg'] > 1.005)
+				$domash = 1;
+		}
+		if ($domash) {
+			$this->SetX($this->TableX);
+			$this->SetFont('Helvetica','B',9);
+			$this->SetFillColor(175,175,255);
+			$vul = $this->w - $this->rMargin - $this->lMargin - 125;
+			$this->Cell(5, 5, '',0,0,'L',true);
+			$this->Cell($vul,5, 'Maisch stap',0,0,'L',true);
+			$this->Cell(30,5, 'Type',0,0,'L',true);
+			$this->Cell(30,5, 'Temperatuur',0,0,'L',true);
+			$this->Cell(30,5, 'SG',0,0,'L',true);
+			$this->Cell(30,5, 'pH',0,0,'L',true);
+			$this->Ln();
+			$this->SetFont('Helvetica','',9);
+			$this->SetFillColor(210,245,255);
+			$arr = json_decode($row['json_mashs'], true);
+			$step = 0;
+			foreach($arr as $item) {
+				$step++;
+				$this->Cell(5,5,$step,0,0,'L',true);
+				$this->Cell($vul,5,$item['step_name'],0,0,'L',true);
+				$this->Cell(30,5,$mashtype[$item['step_type']],0,0,'L',true);
+				$this->Cell(30,5,sprintf("%.1f",$item['step_temp']).'-'.sprintf("%.1f",$item['end_temp']).DEG.'C',0,0,'L',true);
+				$this->Cell(30,5,sprintf("%.3f",$item['step_sg']),0,0,'L',true);
+				$this->Cell(30,5,sprintf("%.2f",$item['step_ph']),0,0,'L',true);
+				$this->Ln();
+			}
+			$this->Ln();
+		}
+
+		$this->SetX($this->TableX);
+		$this->SetFont('Helvetica','B',9);
+		$this->SetFillColor(175,175,255);
+		$vul = $this->w - $this->rMargin - $this->lMargin - 130;
+		$this->Cell($vul, 5, 'Gegeven',0,0,'L',true);
+		$this->Cell(50, 5, 'Gewenst',0,0,'L',true);
+		$this->Cell(50, 5, 'Werkelijk',0,0,'L',true);
+		$this->Cell(30, 5, 'Verschil',0,0,'L',true);
+		$this->Ln();
+
+		$this->SetX($this->TableX);
+		$this->SetFont('Helvetica','',9);
+                $this->SetFillColor(210,245,255);
+        	$this->Cell($vul,5,'Maisch zuurgraad',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.1f", $row['mash_ph']).' pH',0,0,'L',true);
+        	$this->Cell(50,5,sprintf("%.2f", $row['brew_mash_ph']).' pH',0,0,'L',true);
+		$this->PrintDiff($row['mash_ph'], $row['brew_mash_ph'], 2, ' pH');
         	$this->Ln();
 
 		$this->SetX($this->TableX);
-                $this->Cell(35,5,'Datum eind',0,0,'L',true);
-                $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);
+                $this->Cell($vul,5,'Maisch densiteit',0,0,'L',true);
+		$this->Cell(50,5,density_str(floatval($est_mash_sg)),0,0,'L',true);
                 $this->Cell(50,5,density_str(floatval($row['brew_mash_sg'])),0,0,'L',true);
-                $this->Ln();
-
-		$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", floatval($row['brew_mash_efficiency']))."%",0,0,'L',true);
-                $this->Ln(7);
-
-		$this->SetX($this->TableX);
-                $this->Cell(35,5,'Voor koken zuurgraad',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.1f", $row['brew_preboil_ph'])." pH",0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-                $this->Cell(35,5,'Na koken zuurgraad',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.1f", $row['brew_aboil_ph'])." pH",0,0,'L',true);
+		$this->PrintDiff($est_mash_sg, $row['brew_mash_sg'], 3, ' SG');
                 $this->Ln();
 
 		$this->SetX($this->TableX);
-                $this->Cell(35,5,'Voor koken densiteit',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);
-                $this->Cell(50,5,density_str(floatval($row['brew_aboil_sg'])),0,0,'L',true);
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(35,5,'Voor koken volume',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.1f", $row['brew_preboil_volume'])." liter",0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-                $this->Cell(35,5,'Na koken volume',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.1f", $row['brew_aboil_volume'])." liter",0,0,'L',true);
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(35,5,'Voor koken rendement',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);
-                $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_aboil_efficiency']))."%",0,0,'L',true);
-                $this->Ln(7);
-
-		$this->SetX($this->TableX);
-                $this->Cell(35,5,'Spoelwater temperatuur',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.1f", $row['sparge_temp']).DEG.'C',0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-                $this->Cell(35,5,'Koel methode',0,0,'L',true);
-                $this->Cell(50,5,$coolingtype[$row['brew_cooling_method']],0,0,'L',true);
+                $this->Cell($vul,5,'Maisch rendement',0,0,'L',true);
+                $this->Cell(50,5,'100.0%',0,0,'L',true);
+                $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_mash_efficiency']))."%",0,0,'L',true);
+		$this->PrintDiff(100.0, $row['brew_mash_efficiency'], 1, '%');
                 $this->Ln();
 
 		$this->SetX($this->TableX);
-                $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);
+		$this->Cell($vul,5,'Spoelwater zuurgraad',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.1f", $row['sparge_ph']).' pH',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.2f", $row['brew_sparge_ph']).' pH',0,0,'L',true);
+		$this->PrintDiff($row['sparge_ph'], $row['brew_sparge_ph'], 2, ' pH');
+		$this->Ln(7);
+
+		$this->SetX($this->TableX);
+                $this->Cell($vul,5,'Voor koken zuurgraad',0,0,'L',true);
+		$this->Cell(50,5,'',0,0,'L',true);
+                $this->Cell(50,5,sprintf("%.2f", $row['brew_preboil_ph'])." pH",0,0,'L',true);
+		$this->Cell(30,5,'',0,0,'L',true);
+		$this->Ln();
+
+		$this->SetX($this->TableX);
+		$this->Cell($vul,5,'Voor koken densiteit',0,0,'L',true);
+		$this->Cell(50,5,'',0,0,'L',true);
+		$this->Cell(50,5,density_str(floatval($row['brew_preboil_sg'])),0,0,'L',true);
+		$this->Cell(30,5,'',0,0,'L',true);
+		$this->Ln();
+
+		$this->SetX($this->TableX);
+		$this->Cell($vul,5,'Voor koken volume',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.1f", $row['boil_size'] * 1.04)." liter",0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.1f", $row['brew_preboil_volume'])." liter",0,0,'L',true);
+		$this->PrintDiff($row['boil_size'] * 1.04, $row['brew_preboil_volume'], 1, ' liter');
+		$this->Ln();
+
+		$this->SetX($this->TableX);
+		$this->Cell($vul,5,'Voor koken rendement',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.1f", floatval($row['efficiency']))."%",0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.1f", floatval($row['brew_preboil_efficiency']))."%",0,0,'L',true);
+		$this->PrintDiff($row['efficiency'], $row['brew_preboil_efficiency'], 1, '%');
+		$this->Ln(7);
+
+		$this->SetX($this->TableX);
+                $this->Cell($vul,5,'Na koken zuurgraad',0,0,'L',true);
+		$this->Cell(50,5,'',0,0,'L',true);
+                $this->Cell(50,5,sprintf("%.2f", $row['brew_aboil_ph'])." pH",0,0,'L',true);
+		$this->Cell(30,5,'',0,0,'L',true);
                 $this->Ln();
 
 		$this->SetX($this->TableX);
-                $this->Cell(35,5,'Spoelwater zuurgraad',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.1f", $row['brew_sparge_ph']).' pH',0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-                $this->Cell(35,5,'Koel tijdsduur',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.0f", floatval($row['brew_cooling_time'])).' minuten',0,0,'L',true);
-                $this->Ln(7);
+                $this->Cell($vul,5,'Na koken densiteit',0,0,'L',true);
+		$this->Cell(50,5,density_str(floatval($row['est_og'])),0,0,'L',true);
+                $this->Cell(50,5,density_str(floatval($row['brew_aboil_sg'])),0,0,'L',true);
+		$this->PrintDiff($row['est_og'], $row['brew_aboil_sg'], 3, ' SG');
+                $this->Ln();
 
 		$this->SetX($this->TableX);
-                $this->Cell(35,5,'Whirlpool +85'.DEG.'C',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.0f", $row['brew_whirlpool9']).' minuten',0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-                $this->Cell(35,5,'Koeler & trub verlies',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_fermenter_tcloss'])).' liter',0,0,'L',true);
+                $this->Cell($vul,5,'Na koken volume',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.1f", $row['batch_size'] * 1.04)." liter",0,0,'L',true);
+                $this->Cell(50,5,sprintf("%.1f", $row['brew_aboil_volume'])." liter",0,0,'L',true);
+		$this->PrintDiff($row['batch_size'] * 1.04, $row['brew_aboil_volume'], 1, ' liter');
                 $this->Ln();
 
 		$this->SetX($this->TableX);
-                $this->Cell(35,5,'Whirlpool 72..79'.DEG.'C',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.0f", $row['brew_whirlpool7']).' minuten',0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-                $this->Cell(35,5,'Extra water in gistvat',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_fermenter_extrawater'])).' liter',0,0,'L',true);
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(35,5,'Whirlpool 60..66'.DEG.'C',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.0f", $row['brew_whirlpool6']).' minuten',0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-                $this->Cell(35,5,'Volume naar gistvat',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_fermenter_volume'])).' liter',0,0,'L',true);
-                $this->Ln();
-
-		$this->SetX($this->TableX);
-                $this->Cell(35,5,'Whirlpool koud',0,0,'L',true);
-                $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,density_str(floatval($row['brew_fermenter_sg'])),0,0,'L',true);
+                $this->Cell($vul,5,'Na koken rendement',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.1f", floatval($row['efficiency']))."%",0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.1f", floatval($row['brew_aboil_efficiency']))."%",0,0,'L',true);
+		$this->PrintDiff($row['efficiency'], $row['brew_aboil_efficiency'], 1, '%');
                 $this->Ln(7);
 
 		$this->SetX($this->TableX);
-                $this->Cell(35,5,'Beluchten met',0,0,'L',true);
-                $this->Cell(50,5,$aerationtype[$row['brew_aeration_type']],0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-                $this->Cell(35,5,'Kleur in gistvat',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.0f", floatval($row['brew_fermenter_color'])).' EBC',0,0,'L',true);
-                $this->Ln();
+		$this->Cell($vul,5,'Koeler & trub verlies',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.1f", floatval($row['eq_trub_chiller_loss'])).' liter',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.1f", floatval($row['brew_fermenter_tcloss'])).' liter',0,0,'L',true);
+		$this->PrintDiff($row['eq_trub_chiller_loss'], $row['brew_fermenter_tcloss'], 1, ' lter');
+		$this->Ln();
+
+		$this->SetX($this->TableX);
+		$this->Cell($vul,5,'Extra water in gistvat',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.1f", floatval($row['eq_top_up_water'])).' liter',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.1f", floatval($row['brew_fermenter_extrawater'])).' liter',0,0,'L',true);
+		$this->PrintDiff($row['eq_top_up_water'], $row['brew_fermenter_extrawater'], 1, ' liter');
+		$this->Ln();
+
+		$this->SetX($this->TableX);
+		$this->Cell($vul,5,'Volume naar gistvat',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.1f", floatval($row['batch_size']) - floatval($row['eq_trub_chiller_loss'])).' liter',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.1f", floatval($row['brew_fermenter_volume'])).' liter',0,0,'L',true);
+		$this->PrintDiff(floatval($row['batch_size']) - floatval($row['eq_trub_chiller_loss']), $row['brew_fermenter_volume'], 1, ' liter');
+		$this->Ln();
+
+		$this->SetX($this->TableX);
+		$this->Cell($vul,5,'Densiteit in gistvat',0,0,'L',true);
+		$this->Cell(50,5,density_str(floatval($row['est_og'])),0,0,'L',true);
+		$this->Cell(50,5,density_str(floatval($row['brew_fermenter_sg'])),0,0,'L',true);
+		$this->PrintDiff($row['est_og'], $row['brew_fermenter_sg'], 3, ' SG');
+		$this->Ln();
 
 		$this->SetX($this->TableX);
-                $this->Cell(35,5,'Beluchten snelheid/tijd',0,0,'L',true);
-                $this->Cell(50,5,$row['brew_aeration_speed'].'/'.$row['brew_aeration_time'],0,0,'L',true);
-                $this->Cell($vul,5,'',0,0,'L',false);
-                $this->Cell(35,5,'Bitterheid in gistvat',0,0,'L',true);
-                $this->Cell(50,5,sprintf("%.0f", floatval($row['brew_fermenter_ibu'])).' IBU',0,0,'L',true);
-                $this->Ln();
+		$this->Cell($vul,5,'Kleur in gistvat',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.0f", floatval($row['est_color'])).' EBC',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.0f", floatval($row['brew_fermenter_color'])).' EBC',0,0,'L',true);
+		$this->PrintDiff($row['est_color'], $row['brew_fermenter_color'], 0, ' EBC');
+		$this->Ln();
+
+		$this->SetX($this->TableX);
+		$this->Cell($vul,5,'Bitterheid in gistvat',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.0f", floatval($row['est_ibu'])).' IBU',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.0f", floatval($row['brew_fermenter_ibu'])).' IBU',0,0,'L',true);
+		$this->PrintDiff($row['est_ibu'], $row['brew_fermenter_ibu'], 0, ' IBU');
+		$this->Ln(7);
+
+		$this->SetX($this->TableX);
+		$this->Cell($vul,5,'Koelen methode',0,0,'L',true);
+		$this->Cell(50,5,$coolingtype[$row['brew_cooling_method']],0,0,'L',true);
+		$this->Ln();
+
+		$this->SetX($this->TableX);
+		$this->Cell($vul,5,'Koelen temperatuur',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.1f", floatval($row['brew_cooling_to'])).DEG.'C',0,0,'L',true);
+		$this->Ln();
+
+		$this->SetX($this->TableX);
+		$this->Cell($vul,5,'Koelen tijdsduur',0,0,'L',true);
+		$this->Cell(50,5,sprintf("%.0f", floatval($row['brew_cooling_time'])).' minuten',0,0,'L',true);
+		$this->Ln(7);
 	}
 
 	function Fermentation($row) {

mercurial