diff -r a9f8de2d7b2b -r f35a38e8c16f www/inv_instock.php --- 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(); }