Implemented no-boil products.

Tue, 21 Apr 2020 16:11:26 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 21 Apr 2020 16:11:26 +0200
changeset 658
945d5eba869a
parent 657
a5ade45597d8
child 659
6e373acc5d00

Implemented no-boil products.

www/js/prod_edit.js file | annotate | diff | comparison | revisions
www/prod_checklist.php file | annotate | diff | comparison | revisions
www/prod_edit.php file | annotate | diff | comparison | revisions
--- a/www/js/prod_edit.js	Sat Apr 18 15:56:40 2020 +0200
+++ b/www/js/prod_edit.js	Tue Apr 21 16:11:26 2020 +0200
@@ -1547,6 +1547,7 @@
     calcYeast();
     calcInit();
     calcMash();
+    kookTijd();
     console.log('calculations ready');
     $('#jqxLoader').jqxLoader('close');
     $('#jqxTabs').jqxTabs('first');
@@ -1610,6 +1611,14 @@
  /*
   * Generic functions
   */
+ function kookTijd() {
+  if (dataRecord.boil_time) {
+   $('#brew_pmpt_koken').html('Koken ' + dataRecord.boil_time + ' minuten');
+  } else {
+   $('#brew_pmpt_koken').html('Koken "no-boil"');
+  }
+ }
+
  function calcViability() {
   var vpm = 1.00;
   var max = 100;
@@ -3664,6 +3673,26 @@
    $('#brew_aeration_speed').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
    $('#but_pre_boil').jqxButton({ disabled: true });
    $('#but_after_boil').jqxButton({ disabled: true });
+  } else {
+   if (dataRecord.boil_time == 0) {
+    $('#brew_preboil_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
+    $('#brew_aboil_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
+    $('#brew_preboil_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
+    $('#brew_aboil_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
+    $('#brew_preboil_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
+    $('#brew_aboil_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
+    $('#but_pre_boil').jqxButton({ disabled: true });
+    $('#but_after_boil').jqxButton({ disabled: true });
+   } else {
+    $('#brew_preboil_ph').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
+    $('#brew_aboil_ph').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
+    $('#brew_preboil_sg').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
+    $('#brew_aboil_sg').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
+    $('#brew_preboil_volume').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
+    $('#brew_aboil_volume').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
+    $('#but_pre_boil').jqxButton({ disabled: false });
+    $('#but_after_boil').jqxButton({ disabled: false });
+   }
   }
   if (dataRecord.stage == 5) // Lagering, allow packaging
    $('#package_date').jqxDateTimeInput({ disabled: false });
@@ -3943,17 +3972,42 @@
    calcMash();
   });
   $('#boil_time').on('change', function(event) {
-   console.log('boil_time change:' + parseFloat(event.args.value) + ' old:' + dataRecord.boil_time);
-   var new_boil, new_evap, old_evap = parseFloat(dataRecord.boil_size) - parseFloat(dataRecord.batch_size);
-   new_evap = old_evap * (parseFloat(event.args.value) / dataRecord.boil_time);
-   new_boil = parseFloat(dataRecord.batch_size) + new_evap;
-   dataRecord.boil_time = parseFloat(event.args.value);
-   dataRecord.boil_size = new_boil;
-   $('#est_pre_vol').val(Round(new_boil * 1.04, 2));
-   $('#boil_size').val(Round(new_boil, 2));
+   var new_boil, new_time, old_time, new_evap, old_evap;
+   old_time = parseFloat(dataRecord.boil_time);
+   new_time = parseFloat(event.args.value);
+
+   if (new_time && old_time) {
+    /* normal boiltime change */
+    console.log('boil_time change:' + new_time + ' old:' + old_time);
+    old_evap = parseFloat(dataRecord.boil_size) - parseFloat(dataRecord.batch_size);
+    new_evap = old_evap * (new_time / old_time);
+    new_boil = parseFloat(dataRecord.batch_size) + new_evap;
+    dataRecord.boil_time = new_time;
+    dataRecord.boil_size = new_boil;
+    $('#est_pre_vol').val(Round(new_boil * 1.04, 2));
+    $('#boil_size').val(Round(new_boil, 2));
+   } else if (new_time && ! old_time) {
+    /* from noboil to boil */
+    console.log('boil_time change:' + new_time + ' old: noboil');
+    new_evap = parseFloat($('#eq_evap_rate').jqxNumberInput('decimal')) * new_time / 60;
+    new_boil = parseFloat(dataRecord.batch_size) + new_evap;
+    dataRecord.boil_time = new_time;
+    dataRecord.boil_size = new_boil;
+    $('#est_pre_vol').val(Round(new_boil * 1.04, 2));
+    $('#boil_size').val(Round(new_boil, 2));
+   } else if (! new_time && old_time) {
+    /* from boil to noboil */
+    console.log('boil_time change: noboil, old:' + old_time);
+    dataRecord.boil_time = 0;
+    dataRecord.boil_size = dataRecord.batch_size;
+    $('#est_pre_vol').val(Round(new_boil * 1.04, 2));
+    $('#boil_size').val(Round(dataRecord.boil_size, 2));
+   }
    calcFermentables();
    calcIBUs();
    calcYeast();
+   calcStage();
+   kookTijd();
   });
   $('#efficiency').on('change', function(event) {
    var estog = parseFloat($('#est_og').jqxNumberInput('decimal'));
@@ -4611,7 +4665,7 @@
  $('#batch_size').jqxNumberInput(Spin1dec);
  $('#batch_size').jqxNumberInput({ min: 4 });
  $('#boil_time').jqxNumberInput(PosInt);
- $('#boil_time').jqxNumberInput({ min: 4, max: 360 });
+ $('#boil_time').jqxNumberInput({ min: 0, max: 360 });
  $('#boil_size').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 2, readOnly: true });
  $('#st_guide,#st_name,#st_type,#st_category').jqxInput({ theme: theme, width: 250, height: 23 });
  $('#est_og').jqxNumberInput(SGopts);
@@ -4648,7 +4702,7 @@
  $('#eq_top_up_water').jqxTooltip({ content: 'Extra water in het gistvat.' });
  $('#eq_trub_chiller_loss').jqxTooltip({ content: 'Standaard verlies bij het overbrengen naar het gistvat.' });
  $('#eq_evap_rate').jqxTooltip({ content: 'Verdamping in liters per uur.' });
- $('#eq_boil_time').jqxTooltip({ content: 'Normale kooktijd in minuten.' });
+ $('#eq_boil_time').jqxTooltip({ content: 'Normale kooktijd in minuten, 0 voor no-boil recepten.' });
  $('#eq_top_up_kettle').jqxTooltip({ content: 'Extra water toevoegen tijdens de kook.' });
  $('#eq_hop_utilization').jqxTooltip({ content: '100% voor kleine installaties, hoger voor grote brouwerijen.' });
  $('#eq_notes').jqxTooltip({ content: 'Opmerkingen over deze apparatuur.' });
--- a/www/prod_checklist.php	Sat Apr 18 15:56:40 2020 +0200
+++ b/www/prod_checklist.php	Tue Apr 21 16:11:26 2020 +0200
@@ -240,57 +240,63 @@
 		}
 		if ($this->Checksplit(1, $row))
 			$factor = 1;
-		if ($this->GetY() > 200)
+		if ($this->GetY() > 200 && $row['boil_time'] > 0)
+			$this->AddPage();
+		else if ($this->GetY() > 270 && $row['boil_time'] == 0)
 			$this->AddPage();
 		else
 			$this->Ln(5);
 
 		$this->Checkheader('Koken');
-		$this->Checkline('totale kooktijd: '.$row['boil_time'].' min.');
-		for ($i = $row['boil_time']; $i >= 0; $i--) {
-			if ($i == 10) {
-				foreach($ferms as $item1) {
-					if ($item1['f_added'] == 1) {
-						$s = sprintf("%.3f",$item1['f_amount']*$factor).' kg `';
-						$s .= iconv('UTF-8','windows-1252',$item1['f_name']).'` bij 10 minuten voor einde koken';
+		if ($row['boil_time'] > 0) {
+			$this->Checkline('totale kooktijd: '.$row['boil_time'].' min.');
+			for ($i = $row['boil_time']; $i >= 0; $i--) {
+				if ($i == 10) {
+					foreach($ferms as $item1) {
+						if ($item1['f_added'] == 1) {
+							$s = sprintf("%.3f",$item1['f_amount']*$factor).' kg `';
+							$s .= iconv('UTF-8','windows-1252',$item1['f_name']).'` bij 10 minuten voor einde koken';
+							$this->Checkline($s);
+						}
+					}
+					if ($row['brew_cooling_method'] == 1)
+						$this->Checkline('Plaats dompelkoeler bij 10 minuten voor einde koken');
+				}
+				foreach($hops as $item2) {
+					if (($item2['h_useat'] == 2 || $item2['h_useat'] == 3) && ($item2['h_time'] == $i)) {
+						$s = sprintf("%.2f",$item2['h_amount']*1000*$factor).' gr `';
+						$s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` bij ';
+						if ($i > 0)
+							$s .= $i.' minuten voor einde koken';
+						else
+							$s .= 'vlamuit';
 						$this->Checkline($s);
 					}
 				}
-				if ($row['brew_cooling_method'] == 1)
-					$this->Checkline('Plaats dompelkoeler bij 10 minuten voor einde koken');
-			}
-			foreach($hops as $item2) {
-				if (($item2['h_useat'] == 2 || $item2['h_useat'] == 3) && ($item2['h_time'] == $i)) {
-					$s = sprintf("%.2f",$item2['h_amount']*1000*$factor).' gr `';
-					$s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` bij ';
-					if ($i > 0)
-						$s .= $i.' minuten voor einde koken';
-					else
-						$s .= 'vlamuit';
-					$this->Checkline($s);
+				foreach($miscs as $item3) {
+					if ($item3['m_use_use'] == 2 && $item3['m_time'] == $i) {
+						$unit = ($item3['m_amount_is_weight']) ? " gr ":" ml ";
+						$s = sprintf("%.2f",$item3['m_amount']*1000*$factor).$unit.'`';
+						$s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` bij ';
+						if ($i > 0)
+							$s .= $i.' minuten voor einde koken';
+						else
+							$s .= 'vlamuit';
+						$this->Checkline($s);
+					}
 				}
+
 			}
-			foreach($miscs as $item3) {
-				if ($item3['m_use_use'] == 2 && $item3['m_time'] == $i) {
-					$unit = ($item3['m_amount_is_weight']) ? " gr ":" ml ";
-					$s = sprintf("%.2f",$item3['m_amount']*1000*$factor).$unit.'`';
-					$s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` bij ';
-					if ($i > 0)
-						$s .= $i.' minuten voor einde koken';
-					else
-						$s .= 'vlamuit';
-					$this->Checkline($s);
-				}
-			}
-
+			$s = 'doelvolume einde koken: '.sprintf("%.1f",$row['batch_size']*$factor*1.04).' liter (';
+			$s .= sprintf("%.1f",kettle_cm($row['batch_size']*$factor*1.04,$row['eq_kettle_volume'],$row['eq_kettle_height']));
+			$s .= ' cm onder de rand)';
+			$this->Checkline($s);
+			$this->Checkline('doel SG einde koken: '.density_str($row['est_og3']));
+			if ($this->Checksplit(2, $row))
+				$factor = 1;
+		} else {
+			$this->Checkline('Dit is een `no-boil\' recept');
 		}
-		$s = 'doelvolume einde koken: '.sprintf("%.1f",$row['batch_size']*$factor*1.04).' liter (';
-		$s .= sprintf("%.1f",kettle_cm($row['batch_size']*$factor*1.04,$row['eq_kettle_volume'],$row['eq_kettle_height']));
-		$s .= ' cm onder de rand)';
-		$this->Checkline($s);
-		$this->Checkline('doel SG einde koken: '.density_str($row['est_og3']));
-		if ($this->Checksplit(2, $row))
-			$factor = 1;
 		if ($this->GetY() > 200)
 			$this->AddPage();
 		else
--- a/www/prod_edit.php	Sat Apr 18 15:56:40 2020 +0200
+++ b/www/prod_edit.php	Tue Apr 21 16:11:26 2020 +0200
@@ -538,7 +538,7 @@
       </tr>
       <tr>
        <th style="text-align: center;" colspan="2">Maischen</th>
-       <th style="text-align: center;" colspan="4">Koken</th>
+       <th style="text-align: center;" colspan="4"><div id="brew_pmpt_koken">Koken</div></th>
       </tr>
       <tr>
        <td style="vertical-align: top; float: right;">Maisch pH:</td>

mercurial