diff -r 578c78abf058 -r dc30801e6961 www/inv_instock.php --- a/www/inv_instock.php Sat Jan 26 11:59:15 2019 +0100 +++ b/www/inv_instock.php Sat Jan 26 15:03:09 2019 +0100 @@ -66,8 +66,9 @@ } function TableFermentables($link,$prop) { - $this->AddCol( 30,'Leverancier','L'); - $this->AddCol( 90,'Vergistbaar ingredient','L'); + $this->AddCol( 26,'Type','L'); + $this->AddCol( 26,'Leverancier','L'); + $this->AddCol( 68,'Vergistbaar ingredient','L'); $this->AddCol( 30,'Voorraad','R'); $this->AddCol( 20, 'Prijs/kg', 'R'); $this->AddCol( 20, 'Waarde', 'R'); @@ -84,7 +85,9 @@ $this->ColorIndex=0; $this->ProcessingTable=true; - $result = mysqli_query($link, "SELECT name,supplier,inventory,cost FROM inventory_fermentables WHERE inventory > 0 ORDER BY supplier,name"); + $type = array( 'Mout', 'Suiker', 'V Extract', 'Extract', 'Ongemout graan' ); + $sql = "SELECT type,name,supplier,inventory,cost FROM inventory_fermentables WHERE inventory > 0 ORDER BY type,supplier,name"; + $result = mysqli_query($link, $sql); $tot_fermentables = 0.0; while($row=mysqli_fetch_array($result)) { @@ -94,8 +97,9 @@ $this->SetX($this->TableX); $ci=$this->ColorIndex; $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); - $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['supplier']),0,0,'L',true); - $this->Cell(90,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); + $this->Cell(26,5,$type[$row['type']],0,0,'L',true); + $this->Cell(26,5,iconv('UTF-8','windows-1252',$row['supplier']),0,0,'L',true); + $this->Cell(68,5,iconv('UTF-8','windows-1252',$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); @@ -131,6 +135,7 @@ $this->ColorIndex=0; $this->ProcessingTable=true; + $type = array( 'Pellets', 'Plugs', 'Bellen' ); $result = mysqli_query($link, "SELECT name,form,origin,inventory,cost FROM inventory_hops WHERE inventory > 0 ORDER BY origin,name"); $tot_hops = 0.0; @@ -144,7 +149,7 @@ $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['origin']),0,0,'L',true); $this->Cell(75,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); - $this->Cell(15,5,iconv('UTF-8','windows-1252',$row['form']),0,0,'L',true); + $this->Cell(15,5,$type[$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); @@ -180,14 +185,18 @@ $this->ColorIndex=0; $this->ProcessingTable=true; - $result = mysqli_query($link, "SELECT name,laboratory,product_id,form,inventory,cost FROM inventory_yeasts WHERE inventory > 0 ORDER BY laboratory,product_id"); + $sql = "SELECT name,laboratory,product_id,form,inventory,cost FROM inventory_yeasts WHERE inventory > 0 ORDER BY laboratory,product_id"; + $result = mysqli_query($link, $sql); $tot_yeasts = 0.0; while($row=mysqli_fetch_array($result)) { $value = $row['inventory'] * $row['cost']; $tot_yeasts += $value; - $stock = floatval($row['inventory']) * 1000.0; - ($row['form'] == 'Dry') ? $amount = "gr" : $amount = "ml"; + if ($row['form'] == 0) + $stock = floatval($row['inventory']); + else + $stock = floatval($row['inventory']) * 1000.0; + $form = array( 'pak', 'gr', 'ml', 'ml', 'ml', 'ml' ); $this->SetX($this->TableX); $ci=$this->ColorIndex; @@ -195,7 +204,7 @@ $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['laboratory']),0,0,'L',true); $this->Cell(20,5,iconv('UTF-8','windows-1252',$row['product_id']),0,0,'L',true); $this->Cell(70,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); - $this->Cell(30,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true); + $this->Cell(30,5,sprintf("%10.1f ",$stock).$form[$row['form']],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(); @@ -231,6 +240,7 @@ $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; + $type = array( 'Specerij', 'Kruid', 'Smaakstof', 'Klaringsmiddel', 'Brouwzout', 'Gistvoeding', 'Anders' ); while($row=mysqli_fetch_array($result)) { $value = $row['inventory'] * $row['cost']; @@ -241,7 +251,7 @@ $this->SetX($this->TableX); $ci=$this->ColorIndex; $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); - $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['type']),0,0,'L',true); + $this->Cell(30,5,$type[$row['type']],0,0,'L',true); $this->Cell(90,5,iconv('UTF-8','windows-1252',$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);