In recipe report added the date and beer style to the page header.

Sat, 02 Feb 2019 17:07:22 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 02 Feb 2019 17:07:22 +0100
changeset 233
14a84d42031d
parent 232
daf2d9d6fa18
child 234
b8b5efa495bb

In recipe report added the date and beer style to the page header.

www/includes/db_recipes.php file | annotate | diff | comparison | revisions
www/rec_print.php file | annotate | diff | comparison | revisions
--- a/www/includes/db_recipes.php	Sat Feb 02 14:57:41 2019 +0100
+++ b/www/includes/db_recipes.php	Sat Feb 02 17:07:22 2019 +0100
@@ -220,7 +220,7 @@
 			$yeast .= ',"y_inventory":' . $item['y_inventory'];
 			$yeast .= ',"y_use":' . $item['y_use'];
 			$yeast .= ',"y_cost":' . $item['y_cost'] . '}';
-			syslog(LOG_NOTICE, $yeast);
+			//syslog(LOG_NOTICE, $yeast);
 			$yeasts .= $yeast;
 		}
 	}
@@ -245,7 +245,7 @@
 			$mash .= ',"step_time":' . $item['step_time'];
 			$mash .= ',"ramp_time":' . $item['ramp_time'];
 			$mash .= ',"end_temp":' . $item['end_temp'] . '}';
-			syslog(LOG_NOTICE, $mash);
+			//syslog(LOG_NOTICE, $mash);
 			$mashs .= $mash;
 		}
 	}
@@ -405,7 +405,6 @@
 					mysqli_free_result($result2);
 				}
 			}
-	//		syslog(LOG_NOTICE, json_encode($hops, JSON_UNESCAPED_UNICODE));
 			$recipes .= ',"hops":' . json_encode($hops, JSON_UNESCAPED_UNICODE);
 
 			$miscs = json_decode($row['json_miscs'], true);
@@ -423,7 +422,6 @@
 					mysqli_free_result($result2);
 				}
 			}
-	//		syslog(LOG_NOTICE, json_encode($miscs, JSON_UNESCAPED_UNICODE));
 			$recipes .= ',"miscs":' . json_encode($miscs, JSON_UNESCAPED_UNICODE);
 
 			$yeasts = json_decode($row['json_yeasts'], true);
@@ -435,7 +433,6 @@
 			       	$sql2 .= " form='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_form'])."' AND";
 				$sql2 .= " laboratory='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_laboratory'])."' AND";
 			        $sql2 .= " product_id='".str_replace($rescapers, $rreplacements, $yeasts[$i]['y_product_id'])."'";
-	//			syslog(LOG_NOTICE, $sql2);
 				if ($result2 = mysqli_query($connect, $sql2)) {
 					if ($obj = mysqli_fetch_object($result2)) {
 						$yeasts[$i]['y_inventory'] = floatval($obj->inventory);
@@ -444,7 +441,6 @@
 					mysqli_free_result($result2);
 				}
 			}
-	//		syslog(LOG_NOTICE, json_encode($yeasts, JSON_UNESCAPED_UNICODE));
 			$recipes .= ',"yeasts":' . json_encode($yeasts, JSON_UNESCAPED_UNICODE);
 		} else {
 			// Just leave it.
--- a/www/rec_print.php	Sat Feb 02 14:57:41 2019 +0100
+++ b/www/rec_print.php	Sat Feb 02 17:07:22 2019 +0100
@@ -30,6 +30,8 @@
 $colorw = 0;
 $total_ibus = 0;
 $preboil_sg = 0;
+date_default_timezone_set('Europe/Amsterdam');
+$prdate = date(DATE_RFC2822);
 
 class PDF_MySQL_Table extends FPDF
 {
@@ -58,6 +60,7 @@
 
 	function TableGlobal($row) {
 		/* 2 Columns */
+		$recipetype = array( 'Extract', 'Deelmaisch', 'Mout' );
 		$vul = $this->w - $this->rMargin - $this->lMargin - 120;
 		$cMargin=$this->cMargin;
 		$this->cMargin=2;
@@ -73,7 +76,7 @@
 
 		$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,$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(25,5,$row['batch_size'].' liter',0,0,'L',true);
@@ -450,12 +453,21 @@
 class PDF extends PDF_MySQL_Table {
 	function Header() {
 		global $row;
+		global $prdate;
 		$this->Image('images/logo.png',10,6,30);
 		// Title
 		$this->SetFont('Helvetica','B',18);
 		$this->SetX(45);
-		$this->Cell(0,8,$row['name'],1,1,'L');
-		$this->Ln(20);
+		$this->Cell(0,8,$row['name'],0,1,'L');
+		$this->Ln(1);
+		$this->SetFont('Helvetica','',10);
+		$this->SetX(45);
+		$this->Cell(17,5,'Datum:',0,0,'L');
+		$this->Cell(0,5,$prdate,0,1,'L');
+		$this->SetX(45);
+		$this->Cell(17,5,'Styl:',0,0,'L');
+		$this->Cell(0,5,$row['st_name'],0,1,'L');
+		$this->Ln(7);
 		// Ensure table header is printed
 		parent::Header();
 	}

mercurial