www/prod_print.php

branch
stable
changeset 665
4d01937ae7af
parent 655
f4e00869f39f
child 667
1246550451ca
--- a/www/prod_print.php	Fri Oct 18 13:20:35 2019 +0200
+++ b/www/prod_print.php	Fri May 01 16:37:31 2020 +0200
@@ -39,6 +39,9 @@
 $bottle_sugar_amount = 0;
 $keg_sugar_amount = 0;
 
+$divide_parts = $row['divide_parts'];
+$divide_part = $row['divide_part'];
+$divide_factor = floatval($row['divide_factor']);
 
 class PDF_MySQL_Table extends FPDF
 {
@@ -67,6 +70,10 @@
 
 	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;
@@ -82,11 +89,14 @@
 		$this->SetFillColor(210,245,255);
 
 		$this->SetX($this->TableX);
-		$this->Cell(35,5,'Type',0,0,'L',true);
+		$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);
-		$this->Cell(45,5,$row['batch_size'].' liter',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);
@@ -99,12 +109,20 @@
 
 		$this->SetX($this->TableX);
 		$this->Cell(35,5,'Bierstijl',0,0,'L',true);
-		$this->Cell(45,5,$row['st_name'],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;
 	}
 
@@ -155,7 +173,7 @@
 			$color    = floatval($item['f_color']);
 			$percent  = floatval($item['f_percentage']);
 
-			if ($item['f_type'] == 1)			// Sugar
+			if ($item['f_type'] == 1)		// Sugar
 				$pSugar += $percent;
 			if ($item['f_graintype'] == 2)		// Crystal
 				$pCara += $percent;
@@ -260,7 +278,8 @@
 			} 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']);
+			$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)
@@ -350,7 +369,7 @@
 			$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("%.2f",$sv)." L",0,0,'R',true);
+			$this->Cell(20,5,sprintf("%.3f",$sv)." L",0,0,'R',true);
 			$this->Cell(20,5,'',0,0,'R',true);
 			$this->Ln();
 		}
@@ -877,7 +896,7 @@
                 $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 = 100 * (floatval($row['brew_fermenter_sg']) - floatval($row['fg'])) / (floatval($row['brew_fermenter_sg']) - 1);
+		$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();
@@ -1094,6 +1113,8 @@
 		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);
@@ -1106,11 +1127,18 @@
 		$this->Cell(0,5,$prdate,0,1,'L');
 		$this->SetX(45);
 		$this->Cell(17,5,'Stijl:',0,0,'L');
-		$this->Cell(0,5,$row['st_name'],0,1,'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->Ln(6);
+		$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();
 	}

mercurial