# HG changeset patch # User Michiel Broek # Date 1541879767 -3600 # Node ID 3e5e87f1818dde9310a7b9075364729fc53041d2 # Parent 85521c6e00224e80ef0e2583f8b4cd5b25316764 Added miscs ingredients to the recipe print. diff -r 85521c6e0022 -r 3e5e87f1818d www/includes/global.inc.php --- a/www/includes/global.inc.php Sat Nov 10 17:23:53 2018 +0100 +++ b/www/includes/global.inc.php Sat Nov 10 20:56:07 2018 +0100 @@ -199,4 +199,118 @@ diff -r 85521c6e0022 -r 3e5e87f1818d www/rec_print.php --- a/www/rec_print.php Sat Nov 10 17:23:53 2018 +0100 +++ b/www/rec_print.php Sat Nov 10 20:56:07 2018 +0100 @@ -117,7 +117,7 @@ $this->Cell(35,5,'Bitterheid ('.$row['ibu_method'].')',0,0,'L',true); $this->Cell(25,5,sprintf("%.0f",$row['est_ibu']).' IBU',0,0,'L',true); $this->Cell(25,5,'('.$row['st_ibu_min'].' - '.$row['st_ibu_max'].' IBU)',0,0,'L',true); - $this->Ln(); + $this->Ln(10); $this->cMargin=$cMargin; } @@ -125,11 +125,11 @@ function TableFermentables($row) { global $cost_fermentables; global $total_fermentables; - $vul = $this->w - $this->rMargin - $this->lMargin - 130; + $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(15,'Moment','L'); + $this->AddCol(17,'Moment','L'); $this->AddCol(20,'Kg','R'); $this->AddCol(15,'Procent','R'); $this->AddCol(15,'Opbr.','R'); @@ -148,24 +148,19 @@ foreach($arr as $item) { //foreach element in $arr $name = iconv('UTF-8','windows-1252',$item['f_name']); $supplier = iconv('UTF-8','windows-1252',$item['f_supplier']); + $added = iconv('UTF-8','windows-1252',$item['f_added']); $amount = floatval($item['f_amount']); $costkg = floatval($item['f_cost']); $yield = floatval($item['f_yield']); $color = floatval($item['f_color']); $percent = floatval($item['f_percentage']); - if ($item['f_added'] == "Boil") - $add = "Koken"; - else if ($item['f_added'] == "Mash") - $add = "Maisch"; - else - $add = $item['f_added']; $cost = $amount * $costkg; $cost_fermentables += $cost; $total_fermentables += $amount; $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(15,5,$add,0,0,'L',true); + $this->Cell(17,5,added_type_names($added),0,0,'L',true); $this->Cell(20,5,sprintf("%8.3f",$amount),0,0,'R',true); $this->Cell(15,5,sprintf("%.1f%%",$percent),0,0,'R',true); $this->Cell(15,5,sprintf("%.1f%%",$yield),0,0,'R',true); @@ -174,11 +169,11 @@ } $this->SetFillColor(210,245,255); - $this->Cell($vul+60,5,'',0,0,'L',false); + $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(); + $this->Ln(10); $this->ProcessingTable=false; $this->cMargin=$cMargin; $this->aCols=array(); @@ -223,22 +218,20 @@ $total_hops += $amount; $fmoment = 1.0; - $moment = "Kook@".$time; + $moment = hop_useat_names($useat); if (($useat == "Dry Hop") || ($useat == "Dry hop")) { $fmoment = 0.0; - $moment = "Dry-hop"; } else if ($useat == "Whirlpool") { $fmoment = 0.0; - $moment = "Whirlpool"; } else if ($useat == "Mash") { $fmoment = 0.7; // Brouwhulp - $moment = "Maischen"; } else if (($useat == "First Wort") || ($useat == "First wort")) { $fmoment = 1.1; // Brouwhulp, Louis, Ozzie - $moment = "First wort"; } else if ($useat == "Aroma") { $fmoment = 0.0; // Brouwhulp 1.0 redeneert vlamuit. - $moment = "Vlamuit"; + } else if ($useat == "Boil") { + $fmoment = 1.0; + $moment = "Kook@".$time; } $pfactor = 1.0; @@ -255,7 +248,7 @@ $this->Cell($vul,5,$name,0,0,'L',true); $this->Cell(35,5,$origin,0,0,'L',true); - $this->Cell(15,5,$form,0,0,'L',true); + $this->Cell(15,5,hop_form_names($form),0,0,'L',true); $this->Cell(20,5,$moment,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); @@ -268,7 +261,7 @@ $this->Cell($vul+97,5,'',0,0,'L',false); $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(); + $this->Ln(10); $this->ProcessingTable=false; $this->cMargin=$cMargin; $this->aCols=array(); @@ -309,35 +302,15 @@ $cost = $amount * $costg; $cost_yeasts += $cost; - if ($use == "Primary") { + if ($use == "Primary") $svg = $attenuation; - $gebruik = 'Hoofdgist'; - } else if ($use == "Bottle") - $gebruik = 'Bottelgist'; - else - $gebruik = $use; - - if ($form == "Liquid") - $vorm = 'Vloeibaar'; - else if ($form == "Dry") - $vorm = 'Droog'; - else if ($form == "Slant") - $vorm = 'Schuine buis'; - else if ($form == "Culture") - $vorm = 'Slurry'; - else if ($form == "Frozen") - $vorm = 'Ingevroren'; - else if ($form == "Bottel") - $vorm = 'Depot'; - else - $vorm = $form; $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,$gebruik,0,0,'L',true); + $this->Cell(20,5,yeast_use_names($use),0,0,'L',true); $this->Cell(15,5,sprintf("%.1f%%",$attenuation),0,0,'R',true); - $this->Cell(22,5,$vorm,0,0,'L',true); + $this->Cell(22,5,yeast_form_names($form),0,0,'L',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->Ln(); @@ -351,22 +324,76 @@ $og = floatval($row['est_og']); $fg = $og - ($svg * ($og - 1.0)) / 100; $this->Cell(0,5,'FG: '.sprintf("%5.3f",$fg),0,0,'L',false); - $this->Ln(); + $this->Ln(10); $this->ProcessingTable=false; $this->cMargin=$cMargin; $this->aCols=array(); } - /* - MiscColor:= RGBtoColor(240, 250, 65); - WaterAgentColor:= RGBtoColor(240, 140, 130); - FiningColor:= RGBtoColor(95, 180, 25); - WaterColor:= RGBtoColor(120, 255, 250); - */ function TableMiscs($row) { global $cost_miscs; - $vul = $this->w - $this->rMargin - $this->lMargin - 135; + $vul = $this->w - $this->rMargin - $this->lMargin - 95; + $this->AddCol($vul,'Naam','L'); + $this->AddCol(30,'Soort','L'); + $this->AddCol(25,'Gebruik','L'); + $this->AddCol(20,'Hoeveel','R'); + $this->AddCol(20,'Prijs','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); + + $arr = json_decode($row['json_miscs'], true); + foreach($arr as $item) { + $name = iconv('UTF-8','windows-1252',$item['m_name']); + $type = iconv('UTF-8','windows-1252',$item['m_type']); + $use_use = iconv('UTF-8','windows-1252',$item['m_use_use']); + $amount = floatval($item['m_amount']) * 1000; + $costg = floatval($item['m_cost']) / 1000; + $time = floatval($item['m_time']); + $aiw = $item['m_amount_is_weight']; + $cost = $amount * $costg; + $cost_miscs += $cost; + + if ($type == "Water agent") + $this->SetFillColor(240,140,130); + else if ($type == "Fining") + $this->SetFillColor(95,180,25); + else if (($type == "Spice") || ($type == "Herb") || ($type == "Flavor") || ($type == "Yeast nutrient")) + $this->SetFillColor(240,250,65); + else + $this->SetFillColor(210,245,255); + + if ($use_use == "Boil") + $gebruik = sprintf("%s %d min",misc_use_names($use_use),$time); + else + $gebruik = misc_use_names($use_use); + + $hoeveel = sprintf("%.1f %s",$amount,$aiw ? "gr":"ml"); + $this->Cell($vul,5,$name,0,0,'L',true); + $this->Cell(30,5,misc_type_names($type),0,0,'L',true); + $this->Cell(25,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); + $this->Ln(); + } + + $this->SetFillColor(210,245,255); + $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(); } + + // Watercolor $this->SetFillColor(120,255,250); } @@ -392,13 +419,9 @@ $pdf = new PDF(); $pdf->AddPage(); $pdf->TableGlobal($row); -$pdf->Ln(10); $pdf->TableFermentables($row); -$pdf->Ln(10); $pdf->TableHops($row); -$pdf->Ln(10); $pdf->TableYeasts($row); -$pdf->Ln(10); $pdf->TableMiscs($row); //$pdf->SetFont('Helvetica','',10);