# HG changeset patch # User Michiel Broek # Date 1583439554 -3600 # Node ID 571473f62c1ef9c133429ba9ee4321740118f279 # Parent 57bc32b5f4115c0819406a7be8835ad063788c56 Added private yeastlab pdf list diff -r 57bc32b5f411 -r 571473f62c1e www/Makefile --- a/www/Makefile Thu Mar 05 16:34:03 2020 +0100 +++ b/www/Makefile Thu Mar 05 21:19:14 2020 +0100 @@ -12,7 +12,7 @@ getwatersources.php getyeastsources.php getispindel.php getispindellog.php \ import_ingredients.php index.php \ inv_equipments.php inv_fermentables.php inv_hops.php inv_instock.php \ - inv_miscs.php inv_suppliers.php inv_waters.php inv_yeasts.php \ + inv_miscs.php inv_suppliers.php inv_waters.php inv_yeasts.php inv_yeastlab.php \ log_brew.php log_co2pressure.php log_fermentation.php log_ispindel.php \ mon_brewer.php mon_co2meter.php mon_fermenter.php mon_ispindel.php mon_node.php \ prod_archive_code.php prod_archive_date.php prod_archive_name.php prod_beerxml.php \ diff -r 57bc32b5f411 -r 571473f62c1e www/images/science.png Binary file www/images/science.png has changed diff -r 57bc32b5f411 -r 571473f62c1e www/includes/global.inc.php --- a/www/includes/global.inc.php Thu Mar 05 16:34:03 2020 +0100 +++ b/www/includes/global.inc.php Thu Mar 05 21:19:14 2020 +0100 @@ -305,6 +305,7 @@
  • Brouwwater
  • Brouw apparatuur
  • Voorraad lijst
  • +
  • Gistbank lijst
  • Instellingen diff -r 57bc32b5f411 -r 571473f62c1e www/inv_yeastlab.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/www/inv_yeastlab.php Thu Mar 05 21:19:14 2020 +0100 @@ -0,0 +1,162 @@ +ProcessingTable) + $this->TableHeader(); + } + + function TableHeader() { + $this->SetFont('Helvetica','B',9); + $this->SetX($this->TableX); + $this->SetFillColor($this->HeaderColor[0],$this->HeaderColor[1],$this->HeaderColor[2]); + foreach($this->aCols as $col) + $this->Cell($col['w'],5,$col['c'],0,0,$col['a'],true); + $this->Ln(); + } + + function CalcWidths($width, $align) { + // Compute the widths of the columns + $TableWidth=0; + foreach($this->aCols as $i=>$col) { + $w=$col['w']; + if($w==-1) + $w=$width/count($this->aCols); + elseif(substr($w,-1)=='%') + $w=$w/100*$width; + $this->aCols[$i]['w']=$w; + $TableWidth+=$w; + } + // Compute the abscissa of the table + if($align=='C') + $this->TableX=max(($this->w-$TableWidth)/2,0); + elseif($align=='R') + $this->TableX=max($this->w-$this->rMargin-$TableWidth,0); + else + $this->TableX=$this->lMargin; + } + + function AddCol($width=-1, $caption='', $align='L') { + $this->aCols[]=array('c'=>$caption,'w'=>$width,'a'=>$align); + } + + function TableYeasts($link,$prop) { + global $yeasttype; + global $yeastform; + global $my_lab; + $this->AddCol( 20,'Product','L'); + $this->AddCol( 70,'Gist','L'); + $this->AddCol( 18,'Soort','L'); + $this->AddCol( 18,'Vorm','L'); + $this->AddCol( 20,'Voorraad','R'); + $this->AddCol( 25,'Datum','L'); + $prop['width']=$this->w-$this->lMargin-$this->rMargin; + $prop['align']='L'; + $cMargin=$this->cMargin; + $this->cMargin=$prop['padding']; + $this->HeaderColor=$prop['HeaderColor']; + $this->TotalColor=$prop['TotalColor']; + $this->RowColors=array($prop['color1'],$prop['color2']); + $this->CalcWidths($prop['width'],$prop['align']); + $this->TableHeader(); + $this->SetFont('Helvetica','',9); + $this->ColorIndex=0; + $this->ProcessingTable=true; + + $sql = "SELECT name,product_id,type,form,inventory,production_date FROM inventory_yeasts "; + $sql .= "WHERE inventory > 0 AND laboratory = '".$my_lab."' ORDER BY product_id"; + $result = mysqli_query($link, $sql); + + while ($row=mysqli_fetch_array($result)) { + if ($row['form'] == 0) + $stock = floatval($row['inventory']); + else + $stock = floatval($row['inventory']) * 1000.0; + $form = array( 'pak', 'gr', 'ml', 'ml', 'ml', 'ml', 'gr' ); + + $this->SetX($this->TableX); + $ci=$this->ColorIndex; + $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); + $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(18,5,iconv('UTF-8','windows-1252',$yeasttype[$row['type']]),0,0,'L',true); + $this->Cell(18,5,iconv('UTF-8','windows-1252',$yeastform[$row['form']]),0,0,'L',true); + $this->Cell(20,5,sprintf("%10.1f ",$stock).$form[$row['form']],0,0,'R',true); + $this->Cell(25,5,$row['production_date'],0,0,'L',true); + $this->Ln(); + $this->ColorIndex=1-$ci; + } + + $this->ProcessingTable=false; + $this->cMargin=$cMargin; + $this->aCols=array(); + } +} + + + +class PDF extends PDF_MySQL_Table { + function Header() { + global $prdate; + global $my_brewery; + $this->Image('images/logo.png',10,6,30); + // Title + $this->SetFont('Helvetica','',18); + $this->SetX(45); + $this->Cell(0,10,'Gistbank van '.$my_brewery,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->Ln(18); + // Ensure table header is printed + parent::Header(); + } +} + + +$pdf = new PDF(); +$pdf->AddPage(); +$prop = array('HeaderColor'=>array(255,150,100), 'color1'=>array(210,245,255), + 'color2'=>array(255,255,210), 'TotalColor'=>array(255,150,100), 'padding'=>2); +$pdf->TableYeasts($link,$prop); +$pdf->Output();