--- a/www/prod_print.php Thu May 30 23:19:43 2019 +0200 +++ b/www/prod_print.php Wed Jun 05 20:04:26 2019 +0200 @@ -98,7 +98,7 @@ $this->Cell($vul,5,'',0,0,'L',false); $this->Cell(35,5,'Installatie',0,0,'L',true); $this->Cell(45,5,$row['eq_name'],0,0,'L',true); - $this->Ln(10); + $this->Ln(); $this->cMargin=$cMargin; } @@ -111,15 +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->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; @@ -149,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; @@ -162,28 +169,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) { @@ -193,14 +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; @@ -216,43 +226,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; + if (($item['h_useat'] == 2) || ($item['h_useat'] == 4)) { // Boil or Whirlpool + $moment = $hopuse[$item['h_useat']].' '.$time." min"; + } else if ($item['h_useat'] == 5) { // Dryhop + $moment = $hopuse[$item['h_useat']].' '.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) { @@ -260,14 +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; - $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,'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; @@ -297,44 +310,54 @@ 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->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; - $this->AddCol($vul,'Naam','L'); - $this->AddCol(30,'Soort','L'); - $this->AddCol(30,'Gebruik','L'); + $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(25,'Soort','L'); + $this->AddCol(30,'Gebruik moment','L'); $this->AddCol(20,'Hoeveel','R'); $this->AddCol(20,'Prijs','R'); @@ -375,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); @@ -383,16 +406,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; @@ -407,6 +553,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; @@ -483,356 +633,164 @@ $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; - } - - function Checkheader($text) { - $this->SetFont('Arial','B',10); - $this->Cell(0, 4,$text,0,0,'L',true); - $this->SetFont('Arial','',10); - $this->Ln(6); - } - - function Checkline($text) { - // $this->SetX(5); - $this->Cell(2, 4,' ',0,0,'L',true); - $this->Cell(4, 4,' ',1,0,'L',true); - // $this->Rect(10,$this->GetY(),4,4); - // $this->SetX(15); - $this->Cell(0, 4,' '.$text,0,1,'L',true); - $this->Ln(1); + // calorieen + $this->ProcessingTable=false; + $this->cMargin=$cMargin; + $this->aCols=array(); + $this->Ln(); } - function Checklist($row) { + function Brewday($row) { - global $my_grain_absorbtion; global $my_brix_correction; - $mashwater = 0; - $numsalts = 0; + global $my_grain_absorbtion; - $this->AddPage(); - $this->SetFillColor(255,255,255); + if ($this->GetY() > 180) + $this->AddPage(); + else + $this->Ln(10); - if ($row['starter_enable'] && $row['prop1_volume']) { - $this->Checkheader('Giststarter maken'); - $days = 0; - $last = 0; - for ($i = 1; $i < 5; $i++) { - $pt = "prop".$i."_type"; - $pv = "prop".$i."_volume"; - if (floatval($row[$pv])) { - $last = $i; - if ($row[$pt] == 0) - $days += 2; - else if ($row[$pt] == 1) - $days += 4; - else - $days += 6; - } - } - $this->Checkline("begin ongeveer ".$days." dagen voor de brouwdag met de giststarter"); - for ($i = 1; $i < 5; $i++) { - $pt = "prop".$i."_type"; - $pv = "prop".$i."_volume"; - if (floatval($row[$pv])) { - $s = "Starter stap ".$i.", van ".sprintf("%.3f",floatval($row[$pv])); - $s .= " liter maken met SG ".sprintf("%.3f",floatval($row['starter_sg'])); - $this->Checkline($s); - if ($row[$pt] == 0) { - $s = "ongeveer 24 uur op een magneetroerder"; - } else if ($row[$pt] == 1) { - $s = "enkele dagen regelmatig schudden"; - } else { - $s = "bijna een week rustig laten staan"; - } - $s .= " tot er voldoende gist is"; - $this->Checkline($s); - if ($i < $last) { - $this->Checkline("starter minstens 24 uur in de koeling laten uitzakken"); - $this->Checkline("starter uit de koelkast halen en afgieten"); - } else { - $this->Checkline("starter in de koeling zetten tot de brouwdag"); - $this->Checkline("starter op de brouwdag uit de koelkast halen en afgieten"); - } - } - } - $this->Ln(5); - } + $vul = $this->w - $this->rMargin - $this->lMargin - 170; + $cMargin=$this->cMargin; + $this->cMargin=2; + $this->TableX=$this->lMargin; + $this->SetFont('Helvetica','B',9); + $this->SetX($this->TableX); + $this->SetFillColor(255,150,100); + $this->Cell(0, 5, 'Brouwdag gegevens',0,0,'C',true); + $this->Ln(); - $this->Checkheader('Water en -behandeling'); - if ($row['w1_name']) { - $this->Checkline(sprintf("%.1f",floatval($row['w1_amount'])).' liter water '.$row['w1_name']); - $mashwater += floatval($row['w1_amount']); - } - if ($row['w2_name']) { - $this->Checkline(sprintf("%.1f",floatval($row['w2_amount'])).' liter water '.$row['w2_name']); - $mashwater += floatval($row['w2_amount']); - } - $arr = json_decode($row['json_miscs'], true); - foreach($arr as $item) { - if ($item['m_type'] == 4) { // Only the water agents - $unit = ($item['m_amount_is_weight']) ? " gram ":" ml "; - $this->Checkline(sprintf("%.1f",floatval($item['m_amount'] * 1000)).$unit.$item['m_name']); - $numsalts++; - } - } - $this->Ln(5); + $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->Ln(); - $this->Checkheader('Mout afwegen en schroten'); - $arr = json_decode($row['json_fermentables'], true); - foreach($arr as $item) { - if ($item['f_added'] == 0) { // to mash - $s = sprintf("%.3f",floatval($item['f_amount'])).' kg '; - $s .= iconv('UTF-8','windows-1252',$item['f_name']); - $s .= ' ('.iconv('UTF-8','windows-1252',$item['f_supplier']).')'; - $this->Checkline($s); - } - } - $this->Checkline('mout schroten'); - $this->Ln(5); + $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(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->Checkheader('Maischen'); - $mvol = 0; - $msugars = 0; // mash sugars - $grainabsorbtion = 0; - $arr = json_decode($row['json_mashs'], true); - if (count($arr) > 0) { - $loop = 0; - foreach($arr as $item) { - if ($item['step_type'] == 0) - $mvol += $item['step_infuse_amount']; // We need this later. - if ($loop == 0) { - if ($item['step_type'] == 0) - $l = $item['step_infuse_amount']; - else - $l = $mashwater; - $s = sprintf("%.1f",$l).' liter water opwarmen tot '; - $s .= sprintf("%.1f",$item['step_temp']).' '.DEG.'C ('; - $s .= sprintf("%.1f",kettle_cm($l,$row['eq_tun_volume'],$row['eq_tun_height'])); - $s .= ' cm onder de rand)'; - $this->Checkline($s); - if ($numsalts > 0) - $this->Checkline('brouwzouten en -zuren toevoegen'); - $this->Checkline('mout storten en inmaischen'); - $hops = json_decode($row['json_hops'], true); - foreach($hops as $item2) { - if ($item2['h_useat'] == 0) { - $s = sprintf("%.1f",$item2['h_amount']*1000).' gr '; - $s .= iconv('UTF-8','windows-1252',$item2['h_name']).' toevoegen'; - $this->Checkline($s); - } - } - $this->Checkline($item['step_time'].' min. bij '.$item['step_temp'].' '.DEG.'C'); - $this->Checkline('pH meten en bijstellen (doel pH beslag: '.sprintf("%.1f",$row['mash_ph']).' pH)'); - } else { - if ($item['step_type'] == 0) { // Infusion - $s = 'toevoegen '.$item['step_infuse_amount'].' liter water van xx '.DEG.'C'; - } else if ($item['step_type'] == 1) { // Direct heat - $s = 'opwarmen tot '.$item['step_temp'].' '.DEG.'C'; - } else { // Decoction - $s = 'uitnemen, opwarmen, koken en terugstorten van '.$item['step_infuse_amount'].' liter deelbeslag'; - } - $this->Checkline($s); - $this->Checkline($item['step_time'].' min. bij '.$item['step_temp'].' '.DEG.'C'); - } - $loop++; - } - $est_mash_sg = 0; - $ferms = json_decode($row['json_fermentables'], true); - foreach($ferms as $item) { - if ($item['f_added'] == 0) { - $d = $item['f_amount'] * ($item['f_yield'] / 100) * (1 - $item['f_moisture'] / 100); - $mvol += $item['f_amount'] * $item['f_moisture'] / 100; - $grainabsorbtion += $my_grain_absorbtion * $item['f_amount']; - $msugars += $d; - } - } - $sugardensity = 1.611; - $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); - } - if ($this->GetY() > 200) - $this->AddPage(); - else - $this->Ln(5); + $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->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(); - $acidtype = array( 'Melkzuur', 'Zoutzuur', 'Fosforzuur', 'Zwavelzuur' ); - $this->Checkheader('Filteren en spoelen'); - $s = sprintf("%.1f",$row['sparge_volume']).' liter spoelwater opwarmen tot '.sprintf("%.1f",$row['sparge_temp']).' '.DEG.'C'; - $this->Checkline($s); - $s = 'spoelwater aanzuren tot pH <= '.sprintf("%.1f",$row['sparge_ph']).' met '; - $s .= sprintf("%.1f",$row['sparge_acid_amount']*1000).' ml. '.$acidtype[$row['sparge_acid_type']]; - $this->Checkline($s); - $spoelw = ($row['boil_size'] - $mashwater + $grainabsorbtion + $row['eq_lauter_deadspace']) * 1.03; // A small heat correction - $this->Checkline('spoelen met ongeveer '.sprintf("%.1f",$spoelw).' liter spoelwater'); - $s = 'doelvolume in kookketel: '.sprintf("%.1f",$row['boil_size'] * 1.04).' liter ('; - $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); - $hops = json_decode($row['json_hops'], true); - foreach($hops as $item2) { - if ($item2['h_useat'] == 1) { - $s = sprintf("%.1f",$item2['h_amount']*1000).' gr '; - $s .= iconv('UTF-8','windows-1252',$item2['h_name']).' toevoegen na het spoelen'; - $this->Checkline($s); - } - } - if ($this->GetY() > 200) - $this->AddPage(); - else - $this->Ln(5); + $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); + + $coolingtype = array( '-', 'Dompelkoeler', 'Tegenstroomkoeler', 'Au bain marie', 'Laten afkoelen' ); + $this->SetX($this->TableX); + $this->Cell(35,5,'Spoelwater temperatuur',0,0,'L',true); + $this->Cell(50,5,sprintf("%.1f", $row['brew_sparge_temperature']).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->Ln(); - $this->Checkheader('Koken'); - $this->Checkline('totale kooktijd: '.$row['boil_time'].' min.'); - for ($i = $row['boil_time']; $i >= 0; $i--) { - if ($i == 10) { - $ferms = json_decode($row['json_fermentables'], true); - foreach($ferms as $item1) { - if ($item1['f_added'] == 1) { - $s = sprintf("%.3f",$item1['f_amount']).' 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'); - } - $hops = json_decode($row['json_hops'], true); - foreach($hops as $item2) { - if (($item2['h_useat'] == 2 || $item2['h_useat'] == 3) && ($item2['h_time'] == $i)) { - $s = sprintf("%.1f",$item2['h_amount']*1000).' 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); - } - } - $miscs = json_decode($row['json_miscs'], true); - foreach($miscs as $item3) { - if ($item3['m_use_use'] == 2 && $item3['m_time'] == $i) { - $s = sprintf("%.1f",$item3['m_amount']*1000).' gr '; - $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); - } - } + $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->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->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->Ln(); - } - $s = 'doelvolume einde koken: '.sprintf("%.1f",$row['batch_size']*1.04).' liter ('; - $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); - if ($this->GetY() > 200) - $this->AddPage(); - else - $this->Ln(5); + $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(); - if (($row['brew_whirlpool9'] + $row['brew_whirlpool7'] + $row['brew_whirlpool6'] + $row['brew_whirlpool2']) > 0) { - $this->Checkheader('Whirlpool en koelen'); - if ($row['brew_whirlpool9'] > 0) { - $s = 'Whirlpool voor '.$row['brew_whirlpool9'].' min. Temperatuur boven 85 '.DEG.'C houden'; - $this->Checkline($s); - } - if ($row['brew_whirlpool7'] > 0) { - $this->Checkline('koelen tot 79 '.DEG.'C'); - $s = 'Whirlpool voor '.$row['brew_whirlpool7'].' min. Temperatuur tussen 72 en 79 '.DEG.'C houden'; - $this->Checkline($s); - } - if ($row['brew_whirlpool6'] > 0) { - $this->Checkline('koelen tot 66 '.DEG.'C'); - $s = 'Whirlpool voor '.$row['brew_whirlpool6'].' min. Temperatuur tussen 60 en 66 '.DEG.'C houden'; - $this->Checkline($s); - } - $this->Checkline('koelen tot '.sprintf("%.1f",$row['brew_cooling_to']).' '.DEG.'C'); - if ($row['brew_whirlpool2'] > 0) { - $s = 'Whirlpool voor '.$row['brew_whirlpool2'].' min.'; - $this->Checkline($s); - } - } else { - $this->Checkheader('Koelen'); - $this->Checkline('koelen tot '.sprintf("%.1f",$row['brew_cooling_to']).' '.DEG.'C'); - } - $this->Checkline('gistvat ontsmetten en evt. pomp en slangen ontsmetten'); - $this->Checkline('wort naar gistvat overbrengen'); - if ($this->GetY() > 200) - $this->AddPage(); - else - $this->Ln(5); + $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->Checkheader('Gist enten'); - $dry = 0; - $yeasts = json_decode($row['json_yeasts'], true); - foreach ($yeasts as $item) { - if ($item['y_use'] == 0) { // primary - if ($item['y_form'] == 0) { // Liquid - $this->Checkline($item['y_amount'].' pak '.$item['y_product_id'].', '.$item['y_name'].' gist'); - } else if ($item['y_form'] == 1) { // Dry - $s = sprintf("%.1f",$item['y_amount']*1000).' gram '.$item['y_product_id'].', '.$item['y_name']; - $s .= ' gist'; - $dry += $item['y_amount']*10000; - $this->Checkline($s); - } else { // Slant/Culture/Frozen/Bottle - $s = sprintf("%.0f",$item['y_amount']*1000).' ml '.$item['y_product_id'].', '.$item['y_name'].' gist'; - $this->Checkline($s); - } - } - } - if ($dry > 0) { - $this->Checkline(' gist hydrateren in '.$dry.' ml gedesinfecteerd water van 32 '.DEG.'C'); - $this->Checkline(' 15 minuten laten staan bij 32 '.DEG.'C'); - $this->Checkline(' gistmengsel voorzichtig roeren en laten afkoelen tot temperatuur wort'); - $this->Checkline(' gist toevoegen'); - $this->Checkline('Of'); - $this->Checkline(' gist rechtstreeks over het wort strooien'); - } else { - if ($row['starter_enable'] && $row['prop1_volume']) - $this->Checkline('giststarter toevoegen'); - else - $this->Checkline('gist toevoegen'); - } - if ($row['brew_fermenter_extrawater'] > 0) - $this->Checkline(sprintf("%.1f", $row['brew_fermenter_extrawater']).' liter water toevoegen in gistvat'); - if ($row['brew_aeration_type'] > 0) { - $s = 'wort '.$row['brew_aeration_time'].' minuten beluchten met '; - $s .= ($row['brew_aeration_type'] == 1) ? "lucht":"zuurstof"; - $this->Checkline($s); - } - if ($this->GetY() > 200) - $this->AddPage(); - else - $this->Ln(5); + $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->Ln(7); - $this->Checkheader('Vergisting starten'); - $this->Checkline('klimaatkast instellen op '.sprintf("%.1f",$row['brew_cooling_to']).' '.DEG.'C'); + $aerationtype = array( 'Geen', 'Lucht', 'Zuurstof' ); + $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(); - // 'Toevoegingen tijdens vergisting' - // 'Toevoegingen tijdens nagisting/lagering' - // fermentables & hops & miscs verdelen over primary/secondary/teriary - - // 'Toevoegingen tijdens bottelen/op fust zetten' + $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(); } } @@ -876,22 +834,27 @@ $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); } -if ($row['stage'] == 1 || $row['stage'] == 2) { - // Checklist - $pdf->Checklist($row); +if ($row['stage'] > 2) { + $pdf->Brewday($row); } -if ($row['stage'] > 2) { - // Brouw rapport -} + if ($row['stage'] > 3) { // Vergisting gegevens } @@ -902,5 +865,4 @@ // Taste notes } - $pdf->Output();