www/rec_print.php

changeset 89
082c23b26055
parent 88
0a39cbdcf085
child 90
d4246abee34e
--- a/www/rec_print.php	Mon Nov 12 11:32:16 2018 +0100
+++ b/www/rec_print.php	Mon Nov 12 16:34:43 2018 +0100
@@ -27,6 +27,7 @@
 $pSugar = 0;
 $pCara = 0;
 $svg = 77;
+$colorw = 0;
 
 
 class PDF_MySQL_Table extends FPDF
@@ -56,7 +57,7 @@
 
 	function TableGlobal($row) {
 		/* 2 Columns */
-		$vul = $this->w - $this->rMargin - $this->lMargin - 170;
+		$vul = $this->w - $this->rMargin - $this->lMargin - 120;
 		$cMargin=$this->cMargin;
 		$this->cMargin=2;
 		$this->TableX=$this->lMargin;
@@ -72,21 +73,17 @@
 		$this->SetX($this->TableX);
 		$this->Cell(35,5,'Type',0,0,'L',true);
 		$this->Cell(25,5,$row['type'],0,0,'L',true);
-		$this->Cell(25,5,'',0,0,'L',true);
 		$this->Cell($vul,5,'',0,0,'L',false);
 		$this->Cell(35,5,'Batch grootte',0,0,'L',true);
 		$this->Cell(25,5,$row['batch_size'].' liter',0,0,'L',true);
-		$this->Cell(25,5,'',0,0,'L',true);
 		$this->Ln();
 
 		$this->SetX($this->TableX);
 		$this->Cell(35,5,'Kooktijd',0,0,'L',true);
 		$this->Cell(25,5,$row['boil_time'].' minuten',0,0,'L',true);
-		$this->Cell(25,5,'',0,0,'L',true);
 		$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->Cell(25,5,'',0,0,'L',true);
 		$this->Ln(10);
 
 		$this->cMargin=$cMargin;
@@ -97,6 +94,7 @@
 		global $total_fermentables;
 		global $pSugar;
 		global $pCara;
+		global $colorw;
 		$vul = $this->w - $this->rMargin - $this->lMargin - 132;
 		$this->AddCol($vul,'Grondstof','L');
 		$this->AddCol(30,'Leverancier','L');
@@ -143,6 +141,7 @@
 			if ($added == "Mash")
 				$d = floatval($row['efficiency']) / 100 * $d;
 			$sugf += $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);
@@ -382,6 +381,7 @@
 		global $pSugar;
 		global $pCara;
 		global $svg;
+		global $colorw;
 		/* 2 Columns */
 		$vul = $this->w - $this->rMargin - $this->lMargin - 170;
 		$cMargin=$this->cMargin;
@@ -419,12 +419,16 @@
 		$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 ('.$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,'Bitterheid ('.$row['ibu_method'].')',0,0,'L',true);

mercurial