Product print shows split batch information. All calculations are done on the split batch data, not the whole batch. divide

Wed, 23 Oct 2019 16:52:39 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 23 Oct 2019 16:52:39 +0200
branch
divide
changeset 534
01fa81a33b70
parent 533
be8691b7d634
child 535
1f0059cfb6fe

Product print shows split batch information. All calculations are done on the split batch data, not the whole batch.

www/includes/constants.php file | annotate | diff | comparison | revisions
www/prod_print.php file | annotate | diff | comparison | revisions
--- a/www/includes/constants.php	Wed Oct 23 14:20:50 2019 +0200
+++ b/www/includes/constants.php	Wed Oct 23 16:52:39 2019 +0200
@@ -6,6 +6,7 @@
 $ibumethod = array( 'Tinseth', 'Rager', 'Daniels' );
 $coolingtype = array( '-', 'Dompelkoeler', 'Tegenstroomkoeler', 'Au bain marie', 'Laten afkoelen' );
 $aerationtype = array( 'Geen', 'Lucht', 'Zuurstof' );
+$splitat = array( 'Niet', 'Na maischen', 'Na koken', 'Na koelen', 'Na hoofdgisting', 'Na nagisting', 'Na lageren' );
 
 $added = array( 'Maischen', 'Koken', 'Vergisten', 'Nagisten/lageren', 'Bottelen', 'Fust' );
 $fermentabletype = array( 'Mout', 'Suiker', 'Vloeibaar extract', 'Droog extract', 'Ongemout graan' );
--- a/www/prod_print.php	Wed Oct 23 14:20:50 2019 +0200
+++ b/www/prod_print.php	Wed Oct 23 16:52:39 2019 +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 '.($row['batch_size'] * (1 / $divide_factor)).' liter',0,0,'L',true);
 		$this->Ln();
 
 		$this->SetX($this->TableX);
@@ -105,6 +115,13 @@
 		$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 +172,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;
@@ -1094,6 +1111,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);
@@ -1110,7 +1129,13 @@
 		$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