Print fermentation summary

Thu, 20 Jun 2019 16:52:31 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 20 Jun 2019 16:52:31 +0200
changeset 421
0bc45502144b
parent 420
3df93a77cd1d
child 422
7943afc0fcde

Print fermentation summary

www/prod_print.php file | annotate | diff | comparison | revisions
--- a/www/prod_print.php	Thu Jun 20 15:21:29 2019 +0200
+++ b/www/prod_print.php	Thu Jun 20 16:52:31 2019 +0200
@@ -792,6 +792,86 @@
                 $this->Cell(50,5,sprintf("%.0f", floatval($row['brew_fermenter_ibu'])).' IBU',0,0,'L',true);
                 $this->Ln();
 	}
+
+	function Fermentation($row) {
+/*
+ * primary_start_temp primary_max_temp primary_end_temp primary_end_sg  primary_end_date
+ * secondary_temp secondary_end_date
+ * tertiary_temp package_date
+ */
+		if ($this->GetY() > 180)
+                        $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,'Navergisting tempertuur',0,0,'L',true);
+                $this->Cell(45,5,sprintf("%.1f", $row['secondary_temp']).DEG.'C',0,0,'L',true);
+                $this->Ln();
+
+		$this->SetX($this->TableX);
+                $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->Cell($vul,5,'',0,0,'L',false);
+                $this->Cell(45,5,'Navergisting 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,'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,'Lageren temperatuur',0,0,'L',true);
+                $this->Cell(45,5,sprintf("%.1f",$row['tertiary_temp']).DEG.'C',0,0,'L',true);
+                $this->Ln();
+
+		$this->SetX($this->TableX);
+                $this->Cell(45,5,'Hoofdvergisting densiteit',0,0,'L',true);
+                $this->Cell(45,5,density_str(floatval($row['primary_end_sg'])),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,density_str(floatval($row['fg'])),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->Cell($vul,5,'',0,0,'L',false);
+                $this->Cell(45,5,'Lageren einde',0,0,'L',true);
+                $this->Cell(45,5,$row['package_date'],0,0,'L',true);
+                $this->Ln();
+
+		$svg = 100 * (floatval($row['brew_fermenter_sg']) - floatval($row['fg'])) / (floatval($row['brew_fermenter_sg']) - 1);
+		$this->SetX($this->TableX);
+                $this->Cell($vul+90,5,'',0,0,'L',false);
+                $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) {
+
+	}
+
+	function Tasting($row) {
+
+	}
 }
 
 
@@ -848,7 +928,7 @@
 	$pdf->Ln();
 	$pdf->SetFont('Helvetica','',9);
 	$pdf->SetFillColor(210,245,255);
-	$pdf->MultiCell(0,4,$row['notes'],0,'L',true);
+	$pdf->MultiCell(0,4,iconv('UTF-8','windows-1252',$row['notes']),0,'L',true);
 }
 
 if ($row['stage'] > 2) {
@@ -856,13 +936,13 @@
 }
 
 if ($row['stage'] > 3) {
-	// Vergisting gegevens
+	$pdf->Fermentation($row);
 }
 if ($row['stage'] > 6) {
-	// Package report
+	$pdf->Packaging($row);
 }
 if ($row['stage'] > 9) {
-	// Taste notes
+	$pdf->Tasting($row);
 }
 
 $pdf->Output();

mercurial