diff -r d76f623d487c -r 6ee186182c70 www/prod_print.php --- a/www/prod_print.php Fri Aug 05 11:02:01 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1293 +0,0 @@ -ProcessingTable) - $this->TableHeader(); - } - - function TableHeader() { - $this->SetFont('Helvetica','B',9); - $this->SetX($this->TableX); - $this->SetFillColor(255,150,100); - foreach($this->aCols as $col) - $this->Cell($col['w'],5,$col['c'],0,0,$col['a'],true); - $this->Ln(); - } - - function AddCol($width=-1, $caption='', $align='L') { - $this->aCols[]=array('c'=>$caption,'w'=>$width,'a'=>$align); - } - - function TableGlobal($row) { - global $recipetype; - global $divide_parts; - global $divide_part; - global $divide_factor; - global $splitat; - /* 2 Columns */ - $vul = $this->w - $this->rMargin - $this->lMargin - 160; - $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, 'Recept overzicht',0,0,'C',true); - $this->Ln(); - - $this->SetFont('Helvetica','',9); - $this->SetFillColor(210,245,255); - - $this->SetX($this->TableX); - $this->Cell(35,5,'Brouw type',0,0,'L',true); - $this->Cell(45,5,$recipetype[$row['type']],0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(35,5,'Batch grootte',0,0,'L',true); - if ($divide_parts == 0) - $this->Cell(45,5,$row['batch_size'].' liter',0,0,'L',true); - else - $this->Cell(45,5,$row['batch_size'].' van '.sprintf("%.2f", ($row['batch_size'] * (1 / $divide_factor))).' liter',0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(35,5,'Kooktijd',0,0,'L',true); - $this->Cell(45,5,$row['boil_time'].' minuten',0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(35,5,'Brouwzaal rendement',0,0,'L',true); - $this->Cell(45,5,$row['efficiency'].' %',0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(35,5,'Bierstijl',0,0,'L',true); - $st_name = iconv('UTF-8','windows-1252',$row['st_name']); - $this->Cell(45,5,$st_name,0,0,'L',true); - $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(); - - if ($divide_parts) { - $this->SetX($this->TableX); - $this->Cell(35,5,'Batch splits moment',0,0,'L',true); - $this->Cell(45,5,$splitat[$row['divide_type']],0,0,'L',true); - $this->Ln(); - } - - $this->cMargin=$cMargin; - } - - function TableFermentables($row) { - global $cost_fermentables; - global $total_fermentables; - global $pSugar; - global $pCara; - global $colorw; - global $preboil_sg; - global $mashkg; - global $bottle_sugar; - global $bottle_sugar_amount; - global $keg_sugar; - global $keg_sugar_amount; - global $added; - global $fermentabletype; - global $graintype; - global $est_mash_sg; - $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; - $this->cMargin=2; - $this->TableX=$this->lMargin; - $this->TableHeader(); - $this->ProcessingTable=true; - - $sugarsf = 0; - $sugarsm = 0; - $mashkg = 0; - $s = 0; - $this->SetFont('Helvetica','',9); - $this->SetFillColor(250, 195, 65); - $arr = json_decode($row['json_fermentables'], true); - 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']); - $amount = floatval($item['f_amount']); - $costkg = floatval($item['f_cost']); - $yield = floatval($item['f_yield']); - $moisture = floatval($item['f_moisture']); - $color = floatval($item['f_color']); - $percent = floatval($item['f_percentage']); - - if ($item['f_type'] == 1) // Sugar - $pSugar += $percent; - if ($item['f_graintype'] == 2) // Crystal - $pCara += $percent; - - if ($item['f_type'] == 0) - $soort = iconv('UTF-8','windows-1252',$graintype[$item['f_graintype']]); - else - $soort = iconv('UTF-8','windows-1252',$fermentabletype[$item['f_type']]); - - if ($item['f_added'] == 4) { - $bottle_sugar = $name; - $bottle_sugar_amount = $amount; - } - if ($item['f_added'] == 5) { - $keg_sugar = $name; - $keg_sugar_amount = $amount; - } - - $cost = $amount * $costkg; - $cost_fermentables += $cost; - $total_fermentables += $amount; - /* Calculate the amount of sugars */ - $d = $amount * ($yield / 100) * (1 - $moisture / 100); - if ($item['f_added'] == 0) { - $s += $d; - $d = floatval($row['efficiency']) / 100 * $d; - $sugarsm += $d; - $mashkg += $amount; - } - $sugarsf += $d; - $colorw += ($amount * ebc_to_srm($color) / $row['batch_size']) * 8.34436; - - 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); - if ($item['f_added'] < 4) - $this->Cell(15,5,sprintf("%.1f%%",$percent),0,0,'R',true); - else - $this->Cell(15,5,' ',0,0,'R',true); - $this->Cell(15,5,sprintf("%.1f%%",$yield),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(); - } - $v = $s / 1.611 + $row['wg_amount']; - $s = 1000 * $s / ($v * 10); //deg. Plato - $est_mash_sg = plato_to_sg($s); - $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+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) { - global $total_hops; - global $total_ibus; - global $cost_hops; - global $preboil_sg; - global $hopform; - global $hopuse; - $vul = $this->w - $this->rMargin - $this->lMargin - 122; - $this->Ln(); - $this->AddCol($vul,'Hop','L'); - $this->AddCol(15,'Alpha','R'); - $this->AddCol(12,'IBU','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; - $this->cMargin=2; - $this->TableX=$this->lMargin; - $this->TableHeader(); - $this->ProcessingTable=true; - - $this->SetFont('Helvetica','',9); - $this->SetFillColor(100, 250, 65); - - $arr = json_decode($row['json_hops'], true); - 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']); - $mass = $amount * 1000; - $costkg = floatval($item['h_cost']); - $time = floatval($item['h_time']); - $alpha = floatval($item['h_alpha']); - - $cost = ($amount * $costkg); - $cost_hops += $cost; - $total_hops += $amount; - - $moment = $hopuse[$item['h_useat']]; - 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'], $row['brew_whirlpool9'], $row['brew_whirlpool7'], $row['brew_whirlpool6']); - $total_ibus += $ibu; - - 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(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+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) { - global $cost_yeasts; - global $svg; - global $yeastform; - global $yeastuse; - $vul = $this->w - $this->rMargin - $this->lMargin - 110; - $this->Ln(); - $this->AddCol($vul,'Gist','L'); - $this->AddCol(15,'Attn','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; - $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_yeasts'], true); - foreach($arr as $item) { //foreach element in $arr - $name = iconv('UTF-8','windows-1252',$item['y_name']); - $laboratory = iconv('UTF-8','windows-1252',$item['y_laboratory']); - $product_id = iconv('UTF-8','windows-1252',$item['y_product_id']); - $attenuation = floatval($item['y_attenuation']); - $cost = floatval($item['y_amount']) * floatval($item['y_cost']); - $cost_yeasts += $cost; - - if ($item['y_use'] == 0) // Primary - $svg = $attenuation; - if ($item['y_form'] == 0) // Liquid - $amount = sprintf("%.0f",floatval($item['y_amount']))." pak"; - else if ($item['y_form'] == 1 || $item['y_form'] == 6) // Dry - $amount = sprintf("%.1f",floatval($item['y_amount'])*1000)." gr"; - else - $amount = sprintf("%.0f",floatval($item['y_amount'])*1000)." ml"; - - $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(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'] && $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("%.3f",$sv)." L",0,0,'R',true); - $this->Cell(20,5,'',0,0,'R',true); - $this->Ln(); - } - - $this->SetFillColor(210,245,255); - $this->Cell($vul+90,5,'',0,0,'L',false); - $this->Cell(20,5,sprintf("%8.3f",$cost_yeasts).EURO,0,0,'R',true); - $this->ProcessingTable=false; - $this->cMargin=$cMargin; - $this->aCols=array(); - $this->Ln(); - } - - function TableMiscs($row) { - global $cost_miscs; - global $misctype; - global $miscuse; - $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'); - - $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 = $item['m_type']; - $use_use = $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 == 4) // Water agent - $this->SetFillColor(240,140,130); - else if ($type == 3) // Fining - $this->SetFillColor(95,180,25); - else if (($type == 0) || ($type == 1) || ($type == 2) || ($type == 5)) // Spice, Herb, Flavour, Yeast nutrient - $this->SetFillColor(240,250,65); - else - $this->SetFillColor(210,245,255); - - if ($use_use == 2) // Boil - $gebruik = sprintf("%s %d min",$miscuse[$use_use],$time); - else - $gebruik = $miscuse[$use_use]; - - $hoeveel = sprintf("%.2f %s",$amount,$aiw ? "gr":"ml"); - $this->Cell($vul,5,$name,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); - $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->ProcessingTable=false; - $this->cMargin=$cMargin; - $this->aCols=array(); - $this->Ln(); - } - - function TableMashs($row) { - global $cost_yeasts; - global $svg; - global $mashkg; - global $mashtype; - $vul = $this->w - $this->rMargin - $this->lMargin - 138; - if ($this->GetY() > 250) - $this->AddPage(); - else - $this->Ln(); - $this->AddCol($vul,'Maisch stap naam','L'); - $this->AddCol(25,'Stap type','L'); - $this->AddCol(16,'Start '.DEG.'C','R'); - $this->AddCol(16,'Eind '.DEG.'C','R'); - $this->AddCol(15,'Rust min','R'); - $this->AddCol(15,'Stap min','R'); - $this->AddCol(15,'L/Kg','R'); - $this->AddCol(18,'Inf/dec L','R'); - $this->AddCol(18,'Inf/dec '.DEG.'C','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(16,5,sprintf("%.1f",$item['step_temp']),0,0,'R',true); - $this->Cell(16,5,sprintf("%.1f",$item['end_temp']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.0f",$item['step_time']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.0f",$item['ramp_time']),0,0,'R',true); - $this->Cell(15,5,sprintf("%.2f",$thick),0,0,'R',true); - if ($item['step_type'] == 1) { - $this->Cell(18,5,' ',0,0,'R',true); - $this->Cell(18,5,' ',0,0,'R',true); - } else { - $this->Cell(18,5,sprintf("%.1f",$item['step_infuse_amount']),0,0,'R',true); - $this->Cell(18,5,sprintf("%.1f",$item['step_infuse_temp']),0,0,'R',true); - } - $this->Ln(); - } - $this->ProcessingTable=false; - $this->cMargin=$cMargin; - $this->aCols=array(); - $this->Ln(); - } - - 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(); - if ($row['w2_name'] && floatval($row['w2_amount'])) { - $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; - global $pCara; - global $svg; - global $colorw; - global $cost_fermentables; - global $cost_hops; - global $cost_miscs; - global $cost_yeasts; - global $mashkg; - global $colormethod; - global $ibumethod; - /* 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; - $this->TableX=$this->lMargin; - $this->SetFont('Helvetica','B',9); - $this->SetX($this->TableX); - $this->SetFillColor(255,150,100); - $this->Cell(0, 5, 'Recept samenvatting',0,0,'C',true); - $this->Ln(); - - $this->SetFont('Helvetica','',9); - $this->SetFillColor(210,245,255); - - $mashtime = 0; - $mashtemp = 0; - $mash_infuse = 0; - $arr = json_decode($row['json_mashs'], true); - foreach($arr as $item) { - if ($item['step_type'] == 0) { // infusion - $mash_infuse += floatval($item['step_infuse_amount']); - } - if ($item['step_temp'] < 75) { // ignore mashout temps - $mashtime += floatval($item['step_time']); - $mashtemp += floatval($item['step_time']) * floatval($item['step_temp']); - } - } - $mashtemp = $mashtemp / $mashtime; - if (($mashkg > 0) && ($mash_infuse > 0) && ($mashtime > 0) && ($mashtemp > 0)) { - $row['est_fg'] = estimate_fg($pSugar, $pCara, $mash_infuse / $mashkg, $mashtime, $mashtemp, $svg, $row['est_og']); - } else { - $row['est_fg'] = estimate_fg($pSugar, $pCara, 0, 0, 0, $svg, $row['est_og']); - } - - $this->SetX($this->TableX); - $this->Cell(35,5,'Start SG',0,0,'L',true); - $this->Cell(25,5,sprintf("%.3f",$row['est_og']),0,0,'L',true); - $this->Cell(25,5,'('.sprintf("%.3f",$row['st_og_min']).' - '.sprintf("%.3f",$row['st_og_max']).')',0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(35,5,'Eind SG',0,0,'L',true); - $this->Cell(25,5,sprintf("%.3f",$row['est_fg']),0,0,'L',true); - $this->Cell(25,5,'('.sprintf("%.3f",$row['st_fg_min']).' - '.sprintf("%.3f",$row['st_fg_max']).')',0,0,'L',true); - $this->Ln(); - - $row['est_abv'] = abvol($row['est_og'], $row['est_fg']); - $this->SetX($this->TableX); - $this->Cell(35,5,'Geschat alcohol',0,0,'L',true); - $this->Cell(25,5,sprintf("%.1f",$row['est_abv']).'%',0,0,'L',true); - $this->Cell(25,5,'('.sprintf("%.1f",$row['st_abv_min']).' - '.sprintf("%.1f",$row['st_abv_max']).'%)',0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(35,5,'Flessen CO2',0,0,'L',true); - $this->Cell(25,5,sprintf("%.1f",$row['bottle_carbonation']).'%',0,0,'L',true); - $this->Cell(25,5,'('.sprintf("%.1f",$row['st_carb_min']).' - '.sprintf("%.1f",$row['st_carb_max']).'%)',0,0,'L',true); - $this->Ln(); - - $row['est_color'] = kw_to_ebc($row['color_method'], $colorw); - $this->SetX($this->TableX); - $this->Cell(35,5,'Kleur ('.$colormethod[$row['color_method']].')',0,0,'L',true); - $beercolor = ebc_to_color($row['est_color']); - if ($row['est_color'] > 30) - $this->SetTextColor(250); - $this->SetFillColor($beercolor[0],$beercolor[1],$beercolor[2]); - $this->Cell(25,5,$row['est_color'].' EBC',0,0,'L',true); - $this->Cell(25,5,'('.$row['st_color_min'].' - '.$row['st_color_max'].' EBC)',0,0,'L',true); - $this->SetTextColor(0); - $this->SetFillColor(210,245,255); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(35,5,'Fusten CO2',0,0,'L',true); - $this->Cell(25,5,sprintf("%.1f",$row['keg_carbonation']).'%',0,0,'L',true); - $this->Cell(25,5,'('.sprintf("%.1f",$row['st_carb_min']).' - '.sprintf("%.1f",$row['st_carb_max']).'%)',0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(35,5,'Bitterheid ('.$ibumethod[$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->Cell($vul,5,'',0,0,'L',false); - $cost_total = $cost_fermentables + $cost_hops + $cost_miscs + $cost_yeasts; - $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); - - // calorieen - $this->ProcessingTable=false; - $this->cMargin=$cMargin; - $this->aCols=array(); - $this->Ln(); - } - - function PrintDiff($v1, $v2, $decimals, $un) { - - $val1 = floatval($v1); - $val2 = floatval($v2); - if ($val2 > $val1) - $diff = '+' . number_format($val2 - $val1, $decimals) . $un; - else - $diff = number_format($val2 - $val1, $decimals) . $un; - $this->Cell(30,5,$diff,0,0,'L',true); - } - - function Brewday($row) { - - global $my_brix_correction; - global $my_grain_absorbtion; - global $coolingtype; - global $aerationtype; - global $est_mash_sg; - global $mashtype; - if ($this->GetY() > 100) - $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,'Datum eind',0,0,'L',true); - $this->Cell(50,5,$row['brew_date_end'],0,0,'L',true); - $this->Ln(10); - - $domash = 0; - $arr = json_decode($row['json_mashs'], true); - foreach($arr as $item) { - if ($item['step_sg'] > 1.005) - $domash = 1; - } - if ($domash) { - $this->SetX($this->TableX); - $this->SetFont('Helvetica','B',9); - $this->SetFillColor(175,175,255); - $vul = $this->w - $this->rMargin - $this->lMargin - 125; - $this->Cell(5, 5, '',0,0,'L',true); - $this->Cell($vul,5, 'Maisch stap',0,0,'L',true); - $this->Cell(30,5, 'Type',0,0,'L',true); - $this->Cell(30,5, 'Temperatuur',0,0,'L',true); - $this->Cell(30,5, 'SG',0,0,'L',true); - $this->Cell(30,5, 'pH',0,0,'L',true); - $this->Ln(); - $this->SetFont('Helvetica','',9); - $this->SetFillColor(210,245,255); - $arr = json_decode($row['json_mashs'], true); - $step = 0; - foreach($arr as $item) { - $step++; - $this->Cell(5,5,$step,0,0,'L',true); - $this->Cell($vul,5,$item['step_name'],0,0,'L',true); - $this->Cell(30,5,$mashtype[$item['step_type']],0,0,'L',true); - $this->Cell(30,5,sprintf("%.1f",$item['step_temp']).'-'.sprintf("%.1f",$item['end_temp']).DEG.'C',0,0,'L',true); - $this->Cell(30,5,sprintf("%.3f",$item['step_sg']),0,0,'L',true); - $this->Cell(30,5,sprintf("%.2f",$item['step_ph']),0,0,'L',true); - $this->Ln(); - } - $this->Ln(); - } - - $this->SetX($this->TableX); - $this->SetFont('Helvetica','B',9); - $this->SetFillColor(175,175,255); - $vul = $this->w - $this->rMargin - $this->lMargin - 130; - $this->Cell($vul, 5, 'Gegeven',0,0,'L',true); - $this->Cell(50, 5, 'Gewenst',0,0,'L',true); - $this->Cell(50, 5, 'Werkelijk',0,0,'L',true); - $this->Cell(30, 5, 'Verschil',0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->SetFont('Helvetica','',9); - $this->SetFillColor(210,245,255); - $this->Cell($vul,5,'Maisch zuurgraad',0,0,'L',true); - $this->Cell(50,5,sprintf("%.1f", $row['mash_ph']).' pH',0,0,'L',true); - $this->Cell(50,5,sprintf("%.2f", $row['brew_mash_ph']).' pH',0,0,'L',true); - $this->PrintDiff($row['mash_ph'], $row['brew_mash_ph'], 2, ' pH'); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Maisch densiteit',0,0,'L',true); - $this->Cell(50,5,density_str(floatval($est_mash_sg)),0,0,'L',true); - $this->Cell(50,5,density_str(floatval($row['brew_mash_sg'])),0,0,'L',true); - $this->PrintDiff($est_mash_sg, $row['brew_mash_sg'], 3, ' SG'); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Maisch rendement',0,0,'L',true); - $this->Cell(50,5,'100.0%',0,0,'L',true); - $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_mash_efficiency']))."%",0,0,'L',true); - $this->PrintDiff(100.0, $row['brew_mash_efficiency'], 1, '%'); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Spoelwater zuurgraad',0,0,'L',true); - $this->Cell(50,5,sprintf("%.1f", $row['sparge_ph']).' pH',0,0,'L',true); - $this->Cell(50,5,sprintf("%.2f", $row['brew_sparge_ph']).' pH',0,0,'L',true); - $this->PrintDiff($row['sparge_ph'], $row['brew_sparge_ph'], 2, ' pH'); - $this->Ln(7); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Voor koken zuurgraad',0,0,'L',true); - $this->Cell(50,5,'',0,0,'L',true); - $this->Cell(50,5,sprintf("%.2f", $row['brew_preboil_ph'])." pH",0,0,'L',true); - $this->Cell(30,5,'',0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Voor koken densiteit',0,0,'L',true); - $this->Cell(50,5,'',0,0,'L',true); - $this->Cell(50,5,density_str(floatval($row['brew_preboil_sg'])),0,0,'L',true); - $this->Cell(30,5,'',0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Voor koken volume',0,0,'L',true); - $this->Cell(50,5,sprintf("%.1f", $row['boil_size'] * 1.04)." liter",0,0,'L',true); - $this->Cell(50,5,sprintf("%.1f", $row['brew_preboil_volume'])." liter",0,0,'L',true); - $this->PrintDiff($row['boil_size'] * 1.04, $row['brew_preboil_volume'], 1, ' liter'); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Voor koken rendement',0,0,'L',true); - $this->Cell(50,5,sprintf("%.1f", floatval($row['efficiency']))."%",0,0,'L',true); - $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_preboil_efficiency']))."%",0,0,'L',true); - $this->PrintDiff($row['efficiency'], $row['brew_preboil_efficiency'], 1, '%'); - $this->Ln(7); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Na koken zuurgraad',0,0,'L',true); - $this->Cell(50,5,'',0,0,'L',true); - $this->Cell(50,5,sprintf("%.2f", $row['brew_aboil_ph'])." pH",0,0,'L',true); - $this->Cell(30,5,'',0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Na koken densiteit',0,0,'L',true); - $this->Cell(50,5,density_str(floatval($row['est_og'])),0,0,'L',true); - $this->Cell(50,5,density_str(floatval($row['brew_aboil_sg'])),0,0,'L',true); - $this->PrintDiff($row['est_og'], $row['brew_aboil_sg'], 3, ' SG'); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Na koken volume',0,0,'L',true); - $this->Cell(50,5,sprintf("%.1f", $row['batch_size'] * 1.04)." liter",0,0,'L',true); - $this->Cell(50,5,sprintf("%.1f", $row['brew_aboil_volume'])." liter",0,0,'L',true); - $this->PrintDiff($row['batch_size'] * 1.04, $row['brew_aboil_volume'], 1, ' liter'); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Na koken rendement',0,0,'L',true); - $this->Cell(50,5,sprintf("%.1f", floatval($row['efficiency']))."%",0,0,'L',true); - $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_aboil_efficiency']))."%",0,0,'L',true); - $this->PrintDiff($row['efficiency'], $row['brew_aboil_efficiency'], 1, '%'); - $this->Ln(7); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Koeler & trub verlies',0,0,'L',true); - $this->Cell(50,5,sprintf("%.1f", floatval($row['eq_trub_chiller_loss'])).' liter',0,0,'L',true); - $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_fermenter_tcloss'])).' liter',0,0,'L',true); - $this->PrintDiff($row['eq_trub_chiller_loss'], $row['brew_fermenter_tcloss'], 1, ' lter'); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Extra water in gistvat',0,0,'L',true); - $this->Cell(50,5,sprintf("%.1f", floatval($row['eq_top_up_water'])).' liter',0,0,'L',true); - $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_fermenter_extrawater'])).' liter',0,0,'L',true); - $this->PrintDiff($row['eq_top_up_water'], $row['brew_fermenter_extrawater'], 1, ' liter'); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Volume naar gistvat',0,0,'L',true); - $this->Cell(50,5,sprintf("%.1f", floatval($row['batch_size']) - floatval($row['eq_trub_chiller_loss'])).' liter',0,0,'L',true); - $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_fermenter_volume'])).' liter',0,0,'L',true); - $this->PrintDiff(floatval($row['batch_size']) - floatval($row['eq_trub_chiller_loss']), $row['brew_fermenter_volume'], 1, ' liter'); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Densiteit in gistvat',0,0,'L',true); - $this->Cell(50,5,density_str(floatval($row['est_og'])),0,0,'L',true); - $this->Cell(50,5,density_str(floatval($row['brew_fermenter_sg'])),0,0,'L',true); - $this->PrintDiff($row['est_og'], $row['brew_fermenter_sg'], 3, ' SG'); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Kleur in gistvat',0,0,'L',true); - $this->Cell(50,5,sprintf("%.0f", floatval($row['est_color'])).' EBC',0,0,'L',true); - $this->Cell(50,5,sprintf("%.0f", floatval($row['brew_fermenter_color'])).' EBC',0,0,'L',true); - $this->PrintDiff($row['est_color'], $row['brew_fermenter_color'], 0, ' EBC'); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Bitterheid in gistvat',0,0,'L',true); - $this->Cell(50,5,sprintf("%.0f", floatval($row['est_ibu'])).' IBU',0,0,'L',true); - $this->Cell(50,5,sprintf("%.0f", floatval($row['brew_fermenter_ibu'])).' IBU',0,0,'L',true); - $this->PrintDiff($row['est_ibu'], $row['brew_fermenter_ibu'], 0, ' IBU'); - $this->Ln(7); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Koelen methode',0,0,'L',true); - $this->Cell(50,5,$coolingtype[$row['brew_cooling_method']],0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell($vul,5,'Koelen 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($vul,5,'Koelen tijdsduur',0,0,'L',true); - $this->Cell(50,5,sprintf("%.0f", floatval($row['brew_cooling_time'])).' minuten',0,0,'L',true); - $this->Ln(7); - } - - function Fermentation($row) { - - if ($this->GetY() > 230) - $this->AddPage(); - else - $this->Ln(10); - - $vul = $this->w - $this->rMargin - $this->lMargin - 180; - $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, 'Vergisting gegevens',0,0,'C',true); - $this->Ln(); - - $this->SetFont('Helvetica','',9); - $this->SetFillColor(210,245,255); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Hoofdvergisting start temp.',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f",$row['primary_start_temp']).DEG.'C',0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(45,5,'Hoofdvergisting piek temp.',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f",$row['primary_max_temp']).DEG.'C',0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Hoofdvergisting eind temp.',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f",$row['primary_end_temp']).DEG.'C',0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(45,5,'Hoofdvergisting densiteit',0,0,'L',true); - $this->Cell(45,5,sprintf("%.3f",floatval($row['primary_end_sg'])).' SG',0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Hoofdvergisting einde',0,0,'L',true); - $this->Cell(45,5,$row['primary_end_date'],0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Navergisting tempertuur',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f", $row['secondary_temp']).DEG.'C',0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(45,5,'Nagisten densiteit',0,0,'L',true); - $this->Cell(45,5,sprintf("%.3f",floatval($row['secondary_end_sg'])).' SG',0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Nagisten einde',0,0,'L',true); - $this->Cell(45,5,$row['secondary_end_date'],0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Lageren temperatuur',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f",$row['tertiary_temp']).DEG.'C',0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(45,5,'Lageren densiteit',0,0,'L',true); - $this->Cell(45,5,sprintf("%.3f",floatval($row['fg'])).' SG',0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Lageren einde',0,0,'L',true); - $this->Cell(45,5,$row['package_date'],0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $svg = calc_svg(floatval($row['brew_fermenter_sg']), floatval($row['fg'])); - $this->Cell(45,5,'Schijnbare vergistingsgraad',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f",$svg).'%',0,0,'L',true); - $this->Ln(); - } - - function Packaging($row) { - - global $bottle_sugar; - global $bottle_sugar_amount; - global $keg_sugar; - global $keg_sugar_amount; - - if ($this->GetY() > 230) - $this->AddPage(); - else - $this->Ln(10); - - $vul = $this->w - $this->rMargin - $this->lMargin - 180; - $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, 'Verpakken',0,0,'C',true); - $this->Ln(); - - $this->SetFont('Helvetica','',9); - $this->SetFillColor(210,245,255); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Datum verpakken',0,0,'L',true); - $this->Cell(45,5,$row['package_date'],0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(45,5,'Hoeveelheid',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f", $row['package_volume']).' liter',0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Alcohol volume',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f",$row['package_abv']).'%',0,0,'L',true); - if (($row['package_infuse_amount'] > 0) && ($row['package_infuse_abv'] == 0)) { - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(45,5,'Water toevoegen',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f", $row['package_infuse_amount']).' liter',0,0,'L',true); - } - $this->Ln(7); - - if (($row['package_infuse_amount'] > 0) && ($row['package_infuse_abv'] > 0)) { - $this->SetX($this->TableX); - $this->Cell(45,5,'Drank toevoegen',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f",$row['package_infuse_amount']).' liter',0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(45,5,'Bevat alcohol volume',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f", $row['package_infuse_abv']).'%',0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(180,5,iconv('UTF-8','windows-1252',$row['package_infuse_notes']),0,0,'L',true); - $this->Ln(7); - } - - $this->SetX($this->TableX); - $this->Cell(45,5,'Flessen volume',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f",$row['bottle_amount']).' liter',0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(45,5,'Fusten volume',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f", $row['keg_amount']).' liter',0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'CO2 volumes',0,0,'L',true); - $this->Cell(45,5,sprintf("%.2f",$row['bottle_carbonation']),0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(45,5,'CO2 volumes',0,0,'L',true); - $this->Cell(45,5,sprintf("%.2f", $row['keg_carbonation']),0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Suiker',0,0,'L',true); - $this->Cell(45,5,$bottle_sugar,0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(45,5,'Suiker',0,0,'L',true); - $this->Cell(45,5,$keg_sugar,0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Hoeveelheid',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f",$row['bottle_priming_amount']).' gram/liter',0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - if ($row['keg_forced_carb']) { - $this->Cell(45,5,'Geforceerd op druk zetten',0,0,'L',true); - $this->Cell(45,5,'Ja',0,0,'L',true); - } else { - $this->Cell(45,5,'Hoeveelheid',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f", $row['keg_priming_amount']).' gram/liter',0,0,'L',true); - } - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Totaal suiker',0,0,'L',true); - $this->Cell(45,5,sprintf("%.3f",$bottle_sugar_amount).' kg',0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - if ($row['keg_forced_carb']) { - $this->Cell(45,5,'Druk op fust',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f",$row['keg_pressure']).' bar',0,0,'L',true); - } else { - $this->Cell(45,5,'Totaal suiker',0,0,'L',true); - $this->Cell(45,5,sprintf("%.3f",$keg_sugar_amount).' kg',0,0,'L',true); - } - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Water oplossen',0,0,'L',true); - $this->Cell(45,5,sprintf("%.3f",$row['bottle_priming_water']).' liter',0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - if (! $row['keg_forced_carb']) { - $this->Cell(45,5,'Water oplossen',0,0,'L',true); - $this->Cell(45,5,sprintf("%.3f",$row['keg_priming_water']).' liter',0,0,'L',true); - } - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Alcohol volume',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f",$row['package_abv'] + $row['bottle_priming_amount'] * 0.47 / 7.907).'%',0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(45,5,'Alcohol volume',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f",$row['package_abv'] + $row['keg_priming_amount'] * 0.47 / 7.907).'%',0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Hergisting temperatuur',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f",$row['bottle_carbonation_temp']).DEG.'C',0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(45,5,'Hergisting temperatuur',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f", $row['keg_carbonation_temp']).DEG.'C',0,0,'L',true); - $this->Ln(); - } - - function Tasting($row) { - - if ($this->GetY() > 200) - $this->AddPage(); - else - $this->Ln(10); - - $vul = $this->w - $this->rMargin - $this->lMargin - 180; - $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, 'Proef notities',0,0,'C',true); - $this->Ln(); - - $this->SetFont('Helvetica','',9); - $this->SetFillColor(210,245,255); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Proeven datum',0,0,'L',true); - $this->Cell(45,5,$row['taste_date'],0,0,'L',true); - $this->Cell($vul,5,'',0,0,'L',false); - $this->Cell(45,5,'Waardering',0,0,'L',true); - $this->Cell(45,5,sprintf("%.1f", $row['taste_rate']),0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Kleur',0,0,'L',true); - $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_color']),0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Helderheid',0,0,'L',true); - $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_transparency']),0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Schuim',0,0,'L',true); - $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_head']),0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Aroma',0,0,'L',true); - $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_aroma']),0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Smaak',0,0,'L',true); - $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_taste']),0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Mondgevoel',0,0,'L',true); - $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_mouthfeel']),0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Nasmaak',0,0,'L',true); - $this->Cell($vul+135,5,iconv('UTF-8','windows-1252',$row['taste_aftertaste']),0,0,'L',true); - $this->Ln(); - - $this->SetX($this->TableX); - $this->Cell(45,5,'Notities',0,0,'L',true); - $this->MultiCell(0,5,iconv('UTF-8','windows-1252',$row['taste_notes']),0,'L',true); - $this->Ln(); - } -} - - - -class PDF extends PDF_MySQL_Table { - function Header() { - global $row; - global $prdate; - global $stage; - global $divide_parts; - global $divide_part; - $this->Image('images/logo.png',10,10,30); - // Title - $this->SetFont('Helvetica','B',18); - $this->SetX(45); - $this->Cell(0,8,$row['code'].' '.$row['name'],0,1,'L'); - $this->Ln(1); - $this->SetFont('Helvetica','',10); - $this->SetX(45); - $this->Cell(17,5,'Datum:',0,0,'L'); - $this->Cell(0,5,$prdate,0,1,'L'); - $this->SetX(45); - $this->Cell(17,5,'Stijl:',0,0,'L'); - $st_name = iconv('UTF-8','windows-1252',$row['st_name']); - $this->Cell(0,5,$st_name,0,1,'L'); - $this->SetX(45); - $this->Cell(17,5,'Fase:',0,0,'L'); - $this->Cell(0,5,$stage[$row['stage']],0,1,'L'); - $this->SetX(45); - $this->Cell(17,5,'Batch:',0,0,'L'); - if ($divide_parts == 0) - $this->Cell(0,5,"Niet gespitst",0,1,'L'); - else - $this->Cell(0,5,"Split batch ".($divide_part + 1)." van ".($divide_parts + 1),0,1,'L'); - $this->Ln(2); - // Ensure table header is printed - parent::Header(); - } -} - - -/* - * Generate PDF from recipe data - */ -$pdf = new PDF(); -$pdf->AddPage(); -$pdf->TableGlobal($row); -$pdf->TableFermentables($row); -$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,iconv('UTF-8','windows-1252',$row['notes']),0,'L',true); -} - -if ($row['stage'] > 2) { - $pdf->Brewday($row); -} - -if ($row['stage'] > 3) { - $pdf->Fermentation($row); -} -if ($row['stage'] > 6) { - $pdf->Packaging($row); -} -if ($row['stage'] > 9) { - $pdf->Tasting($row); -} - -$pdf->Output();