Finish inventory list.

Wed, 07 Nov 2018 14:42:25 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 07 Nov 2018 14:42:25 +0100
changeset 78
f35a38e8c16f
parent 77
a9f8de2d7b2b
child 79
f3adf543f698

Finish inventory list.

www/images/logo.png file | annotate | diff | comparison | revisions
www/inv_instock.php file | annotate | diff | comparison | revisions
www/js/inv_miscs.js file | annotate | diff | comparison | revisions
Binary file www/images/logo.png has changed
--- a/www/inv_instock.php	Tue Nov 06 22:55:55 2018 +0100
+++ b/www/inv_instock.php	Wed Nov 07 14:42:25 2018 +0100
@@ -5,6 +5,7 @@
 define('EURO', chr(128) );
 
 $link = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME);
+setlocale ( LC_ALL, 'nl_NL.UTF-8');
 
 class PDF_MySQL_Table extends FPDF
 {
@@ -57,8 +58,9 @@
 	}
 
 	function TableFermentables($link,$prop) {
-		$this->AddCol(100,'Vergistbaar ingredient','L');
-		$this->AddCol( 28,'Voorraad','R');
+		$this->AddCol( 30,'Leverancier','L');
+		$this->AddCol( 90,'Vergistbaar ingredient','L');
+		$this->AddCol( 30,'Voorraad','R');
 		$this->AddCol( 20, 'Prijs/kg', 'R');
 		$this->AddCol( 20, 'Waarde', 'R');
 		$prop['width']=$this->w-$this->lMargin-$this->rMargin;
@@ -74,7 +76,7 @@
 		$this->ColorIndex=0;
 		$this->ProcessingTable=true;
 
-		$result = mysqli_query($link, "SELECT name,inventory,cost FROM inventory_fermentables WHERE inventory > 0");
+		$result = mysqli_query($link, "SELECT name,supplier,inventory,cost FROM inventory_fermentables WHERE inventory > 0 ORDER BY supplier,name");
 		$tot_fermentables = 0.0;
 
 		while($row=mysqli_fetch_array($result)) {
@@ -84,8 +86,9 @@
 			$this->SetX($this->TableX);
 			$ci=$this->ColorIndex;
 			$this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]);
-			$this->Cell(100,5,$row['name'],0,0,'L',true);
-			$this->Cell(28,5,sprintf("%10.3f kg",$row['inventory']),0,0,'R',true);
+			$this->Cell(30,5,$row['supplier'],0,0,'L',true);
+			$this->Cell(90,5,$row['name'],0,0,'L',true);
+			$this->Cell(30,5,sprintf("%10.3f kg",$row['inventory']),0,0,'R',true);
 			$this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true);
 			$this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true);
 			$this->Ln();
@@ -94,7 +97,7 @@
 
 		$this->SetX($this->TableX);
 		$this->SetFillColor($this->TotalColor[0],$this->TotalColor[1],$this->TotalColor[2]);
-		$this->Cell(148,5,'Totaal',0,0,'L',true);
+		$this->Cell(170,5,'Totaal',0,0,'L',true);
 		$this->Cell(20,5,sprintf("%8.2f ",$tot_fermentables).EURO,0,0,'R',true);
 		$this->Ln();
 
@@ -104,8 +107,10 @@
 	}
 
 	function TableHops($link,$prop) {
-		$this->AddCol(100,'Hoppen','L');
-		$this->AddCol( 28,'Voorraad','R');
+		$this->AddCol( 30,'Land','L');
+		$this->AddCol( 75,'Hoppen','L');
+		$this->AddCol( 15,'Soort','L');
+		$this->AddCol( 30,'Voorraad','R');
 		$this->AddCol( 20, 'Prijs/kg', 'R');
 		$this->AddCol( 20, 'Waarde', 'R');
 		$prop['width']=$this->w-$this->lMargin-$this->rMargin;
@@ -118,20 +123,21 @@
 		$this->ColorIndex=0;
 		$this->ProcessingTable=true;
 
-		$result = mysqli_query($link, "SELECT name,form,origin,inventory,cost FROM inventory_hops WHERE inventory > 0");
+		$result = mysqli_query($link, "SELECT name,form,origin,inventory,cost FROM inventory_hops WHERE inventory > 0 ORDER BY origin,name");
 		$tot_hops = 0.0;
 
 		while($row=mysqli_fetch_array($result)) {
 			$value = $row['inventory'] * $row['cost'];
 			$tot_hops += $value;
-			$hop = $row['form'] . " " . $row['origin'] . " - " . $row['name'];
 			$stock = floatval($row['inventory']) * 1000.0;
 
 			$this->SetX($this->TableX);
 			$ci=$this->ColorIndex;
 			$this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]);
-			$this->Cell(100,5,$hop,0,0,'L',true);
-			$this->Cell(28,5,sprintf("%10.1f gr",$stock),0,0,'R',true);
+			$this->Cell(30,5,$row['origin'],0,0,'L',true);
+			$this->Cell(75,5,$row['name'],0,0,'L',true);
+			$this->Cell(15,5,$row['form'],0,0,'L',true);
+			$this->Cell(30,5,sprintf("%10.1f gr",$stock),0,0,'R',true);
 			$this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true);
 			$this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true);
 			$this->Ln();
@@ -140,7 +146,7 @@
 
 		$this->SetX($this->TableX);
 		$this->SetFillColor($this->TotalColor[0],$this->TotalColor[1],$this->TotalColor[2]);
-		$this->Cell(148,5,'Totaal',0,0,'L',true);
+		$this->Cell(170,5,'Totaal',0,0,'L',true);
 		$this->Cell(20,5,sprintf("%8.2f ",$tot_hops).EURO,0,0,'R',true);
 		$this->Ln();
 
@@ -153,7 +159,7 @@
 		$this->AddCol( 30,'Laboratorium','L');
 		$this->AddCol( 20,'Product','L');
 		$this->AddCol( 70,'Gist','L');
-		$this->AddCol( 28,'Voorraad','R');
+		$this->AddCol( 30,'Voorraad','R');
 		$this->AddCol( 20, 'Prijs/kg', 'R');
 		$this->AddCol( 20, 'Waarde', 'R');
 		$prop['width']=$this->w-$this->lMargin-$this->rMargin;
@@ -166,7 +172,7 @@
 		$this->ColorIndex=0;
 		$this->ProcessingTable=true;
 
-		$result = mysqli_query($link, "SELECT name,laboratory,product_id,form,inventory,cost FROM inventory_yeasts WHERE inventory > 0");
+		$result = mysqli_query($link, "SELECT name,laboratory,product_id,form,inventory,cost FROM inventory_yeasts WHERE inventory > 0 ORDER BY laboratory,product_id");
 		$tot_yeasts = 0.0;
 
 		while($row=mysqli_fetch_array($result)) {
@@ -181,7 +187,7 @@
 			$this->Cell(30,5,$row['laboratory'],0,0,'L',true);
 			$this->Cell(20,5,$row['product_id'],0,0,'L',true);
 			$this->Cell(70,5,$row['name'],0,0,'L',true);
-			$this->Cell(28,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true);
+			$this->Cell(30,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true);
 			$this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true);
 			$this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true);
 			$this->Ln();
@@ -190,7 +196,7 @@
 
 		$this->SetX($this->TableX);
 		$this->SetFillColor($this->TotalColor[0],$this->TotalColor[1],$this->TotalColor[2]);
-		$this->Cell(168,5,'Totaal',0,0,'L',true);
+		$this->Cell(170,5,'Totaal',0,0,'L',true);
 		$this->Cell(20,5,sprintf("%8.2f ",$tot_yeasts).EURO,0,0,'R',true);
 		$this->Ln();
 
@@ -201,8 +207,8 @@
 
 	function TableMiscs($link,$prop) {
 		$this->AddCol( 30,'Type','L');
-		$this->AddCol( 70,'Ingredient','L');
-		$this->AddCol( 28,'Voorraad','R');
+		$this->AddCol( 90,'Ingredient','L');
+		$this->AddCol( 30,'Voorraad','R');
 		$this->AddCol( 20, 'Prijs/kg', 'R');
 		$this->AddCol( 20, 'Waarde', 'R');
 		$prop['width']=$this->w-$this->lMargin-$this->rMargin;
@@ -215,7 +221,7 @@
 		$this->ColorIndex=0;
 		$this->ProcessingTable=true;
 
-		$result = mysqli_query($link, "SELECT name,type,amount_is_weight,inventory,cost FROM inventory_miscs WHERE inventory > 0");
+		$result = mysqli_query($link, "SELECT name,type,amount_is_weight,inventory,cost FROM inventory_miscs WHERE inventory > 0 ORDER BY type,name");
 		$tot_miscs = 0.0;
 
 		while($row=mysqli_fetch_array($result)) {
@@ -228,8 +234,8 @@
 			$ci=$this->ColorIndex;
 			$this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]);
 			$this->Cell(30,5,$row['type'],0,0,'L',true);
-			$this->Cell(70,5,$row['name'],0,0,'L',true);
-			$this->Cell(28,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true);
+			$this->Cell(90,5,$row['name'],0,0,'L',true);
+			$this->Cell(30,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true);
 			$this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true);
 			$this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true);
 			$this->Ln();
@@ -238,7 +244,7 @@
 
 		$this->SetX($this->TableX);
 		$this->SetFillColor($this->TotalColor[0],$this->TotalColor[1],$this->TotalColor[2]);
-		$this->Cell(168,5,'Totaal',0,0,'L',true);
+		$this->Cell(170,5,'Totaal',0,0,'L',true);
 		$this->Cell(20,5,sprintf("%8.2f ",$tot_miscs).EURO,0,0,'R',true);
 		$this->Ln();
 
@@ -252,10 +258,11 @@
 
 class PDF extends PDF_MySQL_Table {
 	function Header() {
+		$this->Image('images/logo.png',10,6,30);
 		// Title
 		$this->SetFont('Helvetica','',18);
-		$this->Cell(0,6,'Inventaris',0,1,'C');
-		$this->Ln(10);
+		$this->Cell(0,10,'Inventaris',0,1,'C');
+		$this->Ln(20);
 		// Ensure table header is printed
 		parent::Header();
 	}
--- a/www/js/inv_miscs.js	Tue Nov 06 22:55:55 2018 +0100
+++ b/www/js/inv_miscs.js	Wed Nov 07 14:42:25 2018 +0100
@@ -113,11 +113,11 @@
 			});
 		}
 	};
-	var srcType = [ "Spice", "Fining", "Water Agent", "Herb", "Flavor", "Other" ];
+	var srcType = [ "Spice", "Fining", "Water Agent", "Herb", "Flavor", "Yeast nutrient", "Other" ];
 	var srcUse = [ "Boil", "Mash", "Primary", "Secondary", "Bottling" ];
 	// initialize the input fields.
 	$("#name").jqxInput({ theme: theme, width: 250, height: 23 });
-	$("#type").jqxDropDownList({ theme: theme, source: srcType, width: 130, height: 23, dropDownHeight: 188 });
+	$("#type").jqxDropDownList({ theme: theme, source: srcType, width: 130, height: 23, dropDownHeight: 220 });
 	$("#use_use").jqxDropDownList({ theme: theme, source: srcUse, width: 90, height: 23, dropDownHeight: 156 });
 	$("#time").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 2, spinButtons: true });
 	$("#amount_is_weight").jqxCheckBox({ theme: theme, width: 120, height: 23 });
@@ -168,7 +168,7 @@
 		filtermode: 'excel',
 		columns: [
 			{ text: 'Ingredient naam', datafield: 'name', width: 525 },
-			{ text: 'Soort', datafield: 'type', align: 'center', cellsalign: 'center', width: 100 },
+			{ text: 'Soort', datafield: 'type', align: 'center', cellsalign: 'center', width: 110 },
 			{ text: 'Gebruik', datafield: 'use_use', align: 'center', cellsalign: 'center', width: 100 },
 			{ text: 'Tijd', datafield: 'time', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f2' },
 			{ text: 'Voor. gr/ml.', datafield: 'inventory', width: 110, align: 'right', cellsalign: 'right' },

mercurial