diff -r a1bcebc61ddd -r 544d7d0183b2 www/rec_print.php --- a/www/rec_print.php Fri May 31 22:58:03 2019 +0200 +++ b/www/rec_print.php Sun Jun 02 12:48:54 2019 +0200 @@ -88,7 +88,7 @@ $this->Cell($vul,5,'',0,0,'L',false); $this->Cell(35,5,'Brouwzaal rendement',0,0,'L',true); $this->Cell(25,5,$row['efficiency'].' %',0,0,'L',true); - $this->Ln(10); + $this->Ln(); $this->cMargin=$cMargin; } @@ -100,15 +100,17 @@ global $pCara; global $colorw; global $preboil_sg; - $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; @@ -137,6 +139,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; @@ -149,28 +156,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) { @@ -178,17 +188,16 @@ global $total_ibus; global $cost_hops; global $preboil_sg; -// $hoptype = array( 'Bitterhop', 'Aromahop', 'Beide' ); $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; @@ -204,43 +213,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; + $moment = "Koken ".$time." min"; + } else if ($item['h_useat'] == 5) { // Dryhop + $moment = 'Koudhop '.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) { @@ -248,14 +261,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,'Hoeveel','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; @@ -285,34 +297,36 @@ $amount = sprintf("%.1f",floatval($item['y_amount'])*1000)." gr"; 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(); } $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; + $vul = $this->w - $this->rMargin - $this->lMargin - 95; + if ($this->GetY() > 200) + $this->AddPage(); + else + $this->Ln(); $this->AddCol($vul,'Naam','L'); - $this->AddCol(30,'Soort','L'); - $this->AddCol(30,'Gebruik','L'); + $this->AddCol(25,'Soort','L'); + $this->AddCol(30,'Gebruik moment','L'); $this->AddCol(20,'Hoeveel','R'); $this->AddCol(20,'Prijs','R'); @@ -353,7 +367,7 @@ $hoeveel = sprintf("%.1f %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); @@ -361,16 +375,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; @@ -384,6 +521,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; @@ -442,11 +583,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(); } } @@ -486,11 +628,19 @@ $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); }