Added IBU and cost totals.

Wed, 14 Nov 2018 20:49:19 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 14 Nov 2018 20:49:19 +0100
changeset 93
357d59d8ec5e
parent 92
fab98e5c86fc
child 94
295c3af2a421

Added IBU and cost totals.

www/rec_print.php file | annotate | diff | comparison | revisions
--- a/www/rec_print.php	Wed Nov 14 16:49:56 2018 +0100
+++ b/www/rec_print.php	Wed Nov 14 20:49:19 2018 +0100
@@ -28,6 +28,7 @@
 $pCara = 0;
 $svg = 77;
 $colorw = 0;
+$total_ibus = 0;
 
 
 class PDF_MySQL_Table extends FPDF
@@ -168,6 +169,7 @@
 
 	function TableHops($row) {
 		global $total_hops;
+		global $total_ibus;
 		global $cost_hops;
 		$vul = $this->w - $this->rMargin - $this->lMargin - 135;
 		$this->AddCol($vul,'Hop','L');
@@ -209,6 +211,7 @@
 				$moment   = "Kook@".$time;
 			}
 			$ibu = calc_IBU($useat, $form, floatval($row['est_og']), 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);
@@ -222,7 +225,8 @@
 		}
 
 		$this->SetFillColor(210,245,255);
-		$this->Cell($vul+97,5,'',0,0,'L',false);
+		$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);
@@ -359,6 +363,10 @@
 		global $pCara;
 		global $svg;
 		global $colorw;
+		global $cost_fermentables;
+		global $cost_hops;
+		global $cost_miscs;
+		global $cost_yeasts;
 		/* 2 Columns */
 		$vul = $this->w - $this->rMargin - $this->lMargin - 170;
 		$cMargin=$this->cMargin;
@@ -411,7 +419,16 @@
 		$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->SetX($this->TableX);
+		$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);
 		$this->Ln(10);
+
+
 		// Kostprijs per liter, calorieren
 		$this->cMargin=$cMargin;
 	}

mercurial