diff -r 97c237654ddd -r b43214d218c0 www/prod_print.php --- a/www/prod_print.php Mon Feb 04 20:56:44 2019 +0100 +++ b/www/prod_print.php Tue Feb 05 21:55:22 2019 +0100 @@ -454,6 +454,259 @@ // 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->Rect(10,$this->GetY(),4,4); + $this->SetX(15); + $this->Cell(0, 4,$text,0,1,'L',true); + $this->Ln(1); + } + + function Checklist($row) { + + global $my_grain_absorbtion; + global $my_brix_correction; + $mashwater = 0; + $numsalts = 0; + + $this->AddPage(); + $this->SetFillColor(255,255,255); + $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 + $this->Checkline(sprintf("%.1f",floatval($item['m_amount'] * 1000)).' gram '.$item['m_name']); + $numsalts++; + } + } + $this->Ln(5); + + $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->Checkheader('Maischen'); + $mvol = 0; + $grainabsortion = 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) { + $s = sprintf("%.1f",$mashwater).' liter water opwarmen tot '; + $s .= sprintf("%.1f",$item['step_temp']).' '.DEG.'C ('; + $s .= sprintf("%.1f",kettle_cm($mashwater,$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; + $s = 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']; + $s += $d; + } + } + $sugardensity = 1.611; + $v = $s / $sugardensity + $mvol; + $plato = 1000 * $s / ($v * 10); // deg. Plato + $mash_sg = plato_to_sg($plato); + $brix = $plato * $my_brix_correction; + $s = 'doel sg eind maischen: '.sprintf("%.3f",$mash_sg); + $s .= ' SG ('.sprintf("%.1f",$brix).' '.DEG.'Brix, '.sprintf("%.1f",$plato).' '.DEG.'P)'; + $this->Checkline($s); + } + $this->Ln(5); + + $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 to 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); +// TODO: doel SG in kookketel: 1.053 SG (13.4 Brix, 13.0 P) + $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); + } + } + $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) { + $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); + } + } + + } + $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->GetY(); + $this->Checkline($s); + if ($this->GetY() > 200) + $this->AddPage(); + else + $this->Ln(5); + + 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->Checkheader('Gist enten'); + // 'wort beluchten' + // 'evt. giststarter afgieten' + // 'gist hydrateren in ' ' ml gedesinfecteerd water van ' + // '15 minuten laten staan bij ' + // 'gistmengsel voorzichtig roeren' + // 'langzaam laten afkoelen tot ' 'temperatuur wort' + // 'gist toevoegen' + // ' water toevoegen in gistvat' (topupwater) + if ($this->GetY() > 200) + $this->AddPage(); + else + $this->Ln(5); + + $this->Checkheader('Vergisting starten'); + $this->Checkline('klimaatkast instellen op '.sprintf("%.1f",$row['brew_cooling_to']).' '.DEG.'C'); + + // 'Toevoegingen tijdens vergisting' + // 'Toevoegingen tijdens nagisting/lagering' + // fermentables & hops & miscs verdelen over primary/secondary/teriary + + // 'Toevoegingen tijdens bottelen/op fust zetten' + } } @@ -463,11 +716,11 @@ global $row; global $prdate; $stage = array( 'Plan', 'Wacht', 'Brouwen', 'Hoofdgisting', 'Nagisting', 'Lagering', 'Afvullen', 'Hergisten', 'Rijpen', 'Proeven', 'Gereed', 'Afgesloten' ); - $this->Image('images/logo.png',10,6,30); + $this->Image('images/logo.png',10,10,30); // Title $this->SetFont('Helvetica','B',18); $this->SetX(45); - $this->Cell(0,8,$row['name'],0,1,'L'); + $this->Cell(0,8,$row['code'].' '.$row['name'],0,1,'L'); $this->Ln(1); $this->SetFont('Helvetica','',10); $this->SetX(45); @@ -505,8 +758,9 @@ $pdf->MultiCell(0,4,$row['notes'],0,'L',true); } -if ($row['stage'] == 2) { +if ($row['stage'] == 1 || $row['stage'] == 2) { // Checklist + $pdf->Checklist($row); } if ($row['stage'] > 2) { // Brouw rapport