# HG changeset patch # User Michiel Broek # Date 1559336283 -7200 # Node ID a1bcebc61ddd6767c3ca6f5e865546ede760c081 # Parent 1c52a68759605d96661bddd2baffee283d973dfc Added mash schedule and brewday data to the product print pages. diff -r 1c52a6875960 -r a1bcebc61ddd README.design --- a/README.design Fri May 31 14:24:08 2019 +0200 +++ b/README.design Fri May 31 22:58:03 2019 +0200 @@ -20,3 +20,5 @@ Beerxml cool tot temp toevoegen. +Koolzuurdruk tabel inbouwen. + diff -r 1c52a6875960 -r a1bcebc61ddd www/prod_print.php --- a/www/prod_print.php Fri May 31 14:24:08 2019 +0200 +++ b/www/prod_print.php Fri May 31 22:58:03 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; } @@ -113,6 +113,7 @@ 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'); @@ -180,10 +181,10 @@ $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->ProcessingTable=false; $this->cMargin=$cMargin; $this->aCols=array(); + $this->Ln(); } function TableHops($row) { @@ -194,6 +195,7 @@ $hopform = array( 'Pellets', 'Plugs', 'Bellen', 'Hop nat' ); $hopuse = array( 'Maischen', 'First wort', 'Koken', 'Vlamuit', 'Whirlpool', 'Koudhop' ); $vul = $this->w - $this->rMargin - $this->lMargin - 135; + $this->Ln(); $this->AddCol($vul,'Hop','L'); $this->AddCol(35,'Land','L'); $this->AddCol(15,'Soort','L'); @@ -249,10 +251,10 @@ $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->ProcessingTable=false; $this->cMargin=$cMargin; $this->aCols=array(); + $this->Ln(); } function TableYeasts($row) { @@ -261,6 +263,7 @@ $yeastform = array( 'Vloeibaar', 'Droog', 'Schuine buis', 'Slurry', 'Ingevroren', 'Depot' ); $yeastuse = array( 'Hoofdgisting', 'Nagisting', 'Lagering', 'Bottelen' ); $vul = $this->w - $this->rMargin - $this->lMargin - 140; + $this->Ln(); $this->AddCol(27,'Laboratorium','L'); $this->AddCol(18,'Product','L'); $this->AddCol($vul,'Gist','L'); @@ -321,10 +324,10 @@ $this->SetFillColor(210,245,255); $this->Cell($vul+120,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) { @@ -332,7 +335,11 @@ $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'); + 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(20,'Hoeveel','R'); @@ -385,11 +392,65 @@ $this->SetFillColor(210,245,255); $this->Cell($vul+80,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); @@ -407,6 +468,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,11 +548,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(); } function Checkheader($text) { @@ -498,11 +564,8 @@ } 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); } @@ -834,6 +897,200 @@ // 'Toevoegingen tijdens bottelen/op fust zetten' } + + function Brewday($row) { + + global $my_brix_correction; + global $my_grain_absorbtion; + + if ($this->GetY() > 180) + $this->AddPage(); + else + $this->Ln(10); + + $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->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->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); + $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->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->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->Ln(); + + $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($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->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); + $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($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->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(); + + $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($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(); + + $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,sprintf("%.3f", floatval($row['brew_fermenter_sg'])).' SG',0,0,'L',true); + $this->Ln(7); + + $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(); + + $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 +1133,26 @@ $pdf->TableHops($row); $pdf->TableYeasts($row); $pdf->TableMiscs($row); +$pdf->TableMashs($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 } @@ -901,6 +1162,9 @@ if ($row['stage'] > 9) { // Taste notes } +if ($row['stage'] == 1 || $row['stage'] == 2) { + $pdf->Checklist($row); +} $pdf->Output();