Tue, 06 Nov 2018 22:55:55 +0100
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
30
f5ab22446aa5
Inventory fermentables and hops to standard weight format.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | <?php |
f5ab22446aa5
Inventory fermentables and hops to standard weight format.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php'); |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
3 | require_once($_SERVER['DOCUMENT_ROOT'].'/fpdf/fpdf.php'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
4 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
5 | define('EURO', chr(128) ); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
6 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
7 | $link = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
8 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
9 | class PDF_MySQL_Table extends FPDF |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
10 | { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
11 | protected $ProcessingTable=false; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
12 | protected $aCols=array(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
13 | protected $TableX; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
14 | protected $HeaderColor; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
15 | protected $RowColors; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
16 | protected $TotalColor; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
17 | protected $ColorIndex; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
18 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
19 | function Header() { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
20 | // Print the table header if necessary |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
21 | if ($this->ProcessingTable) |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
22 | $this->TableHeader(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
23 | } |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
24 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
25 | function TableHeader() { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
26 | $this->SetFont('Helvetica','B',9); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
27 | $this->SetX($this->TableX); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
28 | $this->SetFillColor($this->HeaderColor[0],$this->HeaderColor[1],$this->HeaderColor[2]); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
29 | foreach($this->aCols as $col) |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
30 | $this->Cell($col['w'],5,$col['c'],0,0,$col['a'],true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
31 | $this->Ln(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
32 | } |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
33 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
34 | function CalcWidths($width, $align) { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
35 | // Compute the widths of the columns |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
36 | $TableWidth=0; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
37 | foreach($this->aCols as $i=>$col) { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
38 | $w=$col['w']; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
39 | if($w==-1) |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
40 | $w=$width/count($this->aCols); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
41 | elseif(substr($w,-1)=='%') |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
42 | $w=$w/100*$width; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
43 | $this->aCols[$i]['w']=$w; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
44 | $TableWidth+=$w; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
45 | } |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
46 | // Compute the abscissa of the table |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
47 | if($align=='C') |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
48 | $this->TableX=max(($this->w-$TableWidth)/2,0); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
49 | elseif($align=='R') |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
50 | $this->TableX=max($this->w-$this->rMargin-$TableWidth,0); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
51 | else |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
52 | $this->TableX=$this->lMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
53 | } |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
54 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
55 | function AddCol($width=-1, $caption='', $align='L') { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
56 | $this->aCols[]=array('c'=>$caption,'w'=>$width,'a'=>$align); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
57 | } |
30
f5ab22446aa5
Inventory fermentables and hops to standard weight format.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
58 | |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
59 | function TableFermentables($link,$prop) { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
60 | $this->AddCol(100,'Vergistbaar ingredient','L'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
61 | $this->AddCol( 28,'Voorraad','R'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
62 | $this->AddCol( 20, 'Prijs/kg', 'R'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
63 | $this->AddCol( 20, 'Waarde', 'R'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
64 | $prop['width']=$this->w-$this->lMargin-$this->rMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
65 | $prop['align']='L'; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
66 | $cMargin=$this->cMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
67 | $this->cMargin=$prop['padding']; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
68 | $this->HeaderColor=$prop['HeaderColor']; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
69 | $this->TotalColor=$prop['TotalColor']; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
70 | $this->RowColors=array($prop['color1'],$prop['color2']); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
71 | $this->CalcWidths($prop['width'],$prop['align']); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
72 | $this->TableHeader(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
73 | $this->SetFont('Helvetica','',9); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
74 | $this->ColorIndex=0; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
75 | $this->ProcessingTable=true; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
76 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
77 | $result = mysqli_query($link, "SELECT name,inventory,cost FROM inventory_fermentables WHERE inventory > 0"); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
78 | $tot_fermentables = 0.0; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
79 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
80 | while($row=mysqli_fetch_array($result)) { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
81 | $value = $row['inventory'] * $row['cost']; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
82 | $tot_fermentables += $value; |
30
f5ab22446aa5
Inventory fermentables and hops to standard weight format.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
84 | $this->SetX($this->TableX); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
85 | $ci=$this->ColorIndex; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
86 | $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
87 | $this->Cell(100,5,$row['name'],0,0,'L',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
88 | $this->Cell(28,5,sprintf("%10.3f kg",$row['inventory']),0,0,'R',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
89 | $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
90 | $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
91 | $this->Ln(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
92 | $this->ColorIndex=1-$ci; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
93 | } |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
94 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
95 | $this->SetX($this->TableX); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
96 | $this->SetFillColor($this->TotalColor[0],$this->TotalColor[1],$this->TotalColor[2]); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
97 | $this->Cell(148,5,'Totaal',0,0,'L',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
98 | $this->Cell(20,5,sprintf("%8.2f ",$tot_fermentables).EURO,0,0,'R',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
99 | $this->Ln(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
100 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
101 | $this->ProcessingTable=false; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
102 | $this->cMargin=$cMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
103 | $this->aCols=array(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
104 | } |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
105 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
106 | function TableHops($link,$prop) { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
107 | $this->AddCol(100,'Hoppen','L'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
108 | $this->AddCol( 28,'Voorraad','R'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
109 | $this->AddCol( 20, 'Prijs/kg', 'R'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
110 | $this->AddCol( 20, 'Waarde', 'R'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
111 | $prop['width']=$this->w-$this->lMargin-$this->rMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
112 | $prop['align']='L'; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
113 | $cMargin=$this->cMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
114 | $this->cMargin=$prop['padding']; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
115 | $this->CalcWidths($prop['width'],$prop['align']); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
116 | $this->TableHeader(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
117 | $this->SetFont('Helvetica','',9); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
118 | $this->ColorIndex=0; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
119 | $this->ProcessingTable=true; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
120 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
121 | $result = mysqli_query($link, "SELECT name,form,origin,inventory,cost FROM inventory_hops WHERE inventory > 0"); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
122 | $tot_hops = 0.0; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
123 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
124 | while($row=mysqli_fetch_array($result)) { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
125 | $value = $row['inventory'] * $row['cost']; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
126 | $tot_hops += $value; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
127 | $hop = $row['form'] . " " . $row['origin'] . " - " . $row['name']; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
128 | $stock = floatval($row['inventory']) * 1000.0; |
30
f5ab22446aa5
Inventory fermentables and hops to standard weight format.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
129 | |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
130 | $this->SetX($this->TableX); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
131 | $ci=$this->ColorIndex; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
132 | $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
133 | $this->Cell(100,5,$hop,0,0,'L',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
134 | $this->Cell(28,5,sprintf("%10.1f gr",$stock),0,0,'R',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
135 | $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
136 | $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
137 | $this->Ln(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
138 | $this->ColorIndex=1-$ci; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
139 | } |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
140 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
141 | $this->SetX($this->TableX); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
142 | $this->SetFillColor($this->TotalColor[0],$this->TotalColor[1],$this->TotalColor[2]); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
143 | $this->Cell(148,5,'Totaal',0,0,'L',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
144 | $this->Cell(20,5,sprintf("%8.2f ",$tot_hops).EURO,0,0,'R',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
145 | $this->Ln(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
146 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
147 | $this->ProcessingTable=false; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
148 | $this->cMargin=$cMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
149 | $this->aCols=array(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
150 | } |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
151 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
152 | function TableYeasts($link,$prop) { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
153 | $this->AddCol( 30,'Laboratorium','L'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
154 | $this->AddCol( 20,'Product','L'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
155 | $this->AddCol( 70,'Gist','L'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
156 | $this->AddCol( 28,'Voorraad','R'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
157 | $this->AddCol( 20, 'Prijs/kg', 'R'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
158 | $this->AddCol( 20, 'Waarde', 'R'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
159 | $prop['width']=$this->w-$this->lMargin-$this->rMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
160 | $prop['align']='L'; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
161 | $cMargin=$this->cMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
162 | $this->cMargin=$prop['padding']; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
163 | $this->CalcWidths($prop['width'],$prop['align']); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
164 | $this->TableHeader(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
165 | $this->SetFont('Helvetica','',9); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
166 | $this->ColorIndex=0; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
167 | $this->ProcessingTable=true; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
168 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
169 | $result = mysqli_query($link, "SELECT name,laboratory,product_id,form,inventory,cost FROM inventory_yeasts WHERE inventory > 0"); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
170 | $tot_yeasts = 0.0; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
171 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
172 | while($row=mysqli_fetch_array($result)) { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
173 | $value = $row['inventory'] * $row['cost']; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
174 | $tot_yeasts += $value; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
175 | $stock = floatval($row['inventory']) * 1000.0; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
176 | ($row['form'] == 'Dry') ? $amount = "gr" : $amount = "ml"; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
177 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
178 | $this->SetX($this->TableX); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
179 | $ci=$this->ColorIndex; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
180 | $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
181 | $this->Cell(30,5,$row['laboratory'],0,0,'L',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
182 | $this->Cell(20,5,$row['product_id'],0,0,'L',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
183 | $this->Cell(70,5,$row['name'],0,0,'L',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
184 | $this->Cell(28,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
185 | $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
186 | $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
187 | $this->Ln(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
188 | $this->ColorIndex=1-$ci; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
189 | } |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
190 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
191 | $this->SetX($this->TableX); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
192 | $this->SetFillColor($this->TotalColor[0],$this->TotalColor[1],$this->TotalColor[2]); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
193 | $this->Cell(168,5,'Totaal',0,0,'L',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
194 | $this->Cell(20,5,sprintf("%8.2f ",$tot_yeasts).EURO,0,0,'R',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
195 | $this->Ln(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
196 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
197 | $this->ProcessingTable=false; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
198 | $this->cMargin=$cMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
199 | $this->aCols=array(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
200 | } |
33
2ee6ad5d6f14
More weight/volmes standards in the database.
Michiel Broek <mbroek@mbse.eu>
parents:
30
diff
changeset
|
201 | |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
202 | function TableMiscs($link,$prop) { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
203 | $this->AddCol( 30,'Type','L'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
204 | $this->AddCol( 70,'Ingredient','L'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
205 | $this->AddCol( 28,'Voorraad','R'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
206 | $this->AddCol( 20, 'Prijs/kg', 'R'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
207 | $this->AddCol( 20, 'Waarde', 'R'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
208 | $prop['width']=$this->w-$this->lMargin-$this->rMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
209 | $prop['align']='L'; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
210 | $cMargin=$this->cMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
211 | $this->cMargin=$prop['padding']; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
212 | $this->CalcWidths($prop['width'],$prop['align']); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
213 | $this->TableHeader(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
214 | $this->SetFont('Helvetica','',9); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
215 | $this->ColorIndex=0; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
216 | $this->ProcessingTable=true; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
217 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
218 | $result = mysqli_query($link, "SELECT name,type,amount_is_weight,inventory,cost FROM inventory_miscs WHERE inventory > 0"); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
219 | $tot_miscs = 0.0; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
220 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
221 | while($row=mysqli_fetch_array($result)) { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
222 | $value = $row['inventory'] * $row['cost']; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
223 | $tot_miscs += $value; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
224 | $stock = floatval($row['inventory']) * 1000.0; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
225 | ($row['amount_is_weight']) ? $amount = "gr" : $amount = "ml"; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
226 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
227 | $this->SetX($this->TableX); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
228 | $ci=$this->ColorIndex; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
229 | $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
230 | $this->Cell(30,5,$row['type'],0,0,'L',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
231 | $this->Cell(70,5,$row['name'],0,0,'L',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
232 | $this->Cell(28,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
233 | $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
234 | $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
235 | $this->Ln(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
236 | $this->ColorIndex=1-$ci; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
237 | } |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
238 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
239 | $this->SetX($this->TableX); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
240 | $this->SetFillColor($this->TotalColor[0],$this->TotalColor[1],$this->TotalColor[2]); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
241 | $this->Cell(168,5,'Totaal',0,0,'L',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
242 | $this->Cell(20,5,sprintf("%8.2f ",$tot_miscs).EURO,0,0,'R',true); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
243 | $this->Ln(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
244 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
245 | $this->ProcessingTable=false; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
246 | $this->cMargin=$cMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
247 | $this->aCols=array(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
248 | } |
30
f5ab22446aa5
Inventory fermentables and hops to standard weight format.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
249 | } |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
250 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
251 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
252 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
253 | class PDF extends PDF_MySQL_Table { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
254 | function Header() { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
255 | // Title |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
256 | $this->SetFont('Helvetica','',18); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
257 | $this->Cell(0,6,'Inventaris',0,1,'C'); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
258 | $this->Ln(10); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
259 | // Ensure table header is printed |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
260 | parent::Header(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
261 | } |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
262 | } |
30
f5ab22446aa5
Inventory fermentables and hops to standard weight format.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
263 | |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
264 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
265 | $pdf = new PDF(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
266 | $pdf->AddPage(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
267 | $prop = array('HeaderColor'=>array(255,150,100), 'color1'=>array(210,245,255), |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
268 | 'color2'=>array(255,255,210), 'TotalColor'=>array(255,150,100), 'padding'=>2); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
269 | $pdf->TableFermentables($link,$prop); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
270 | $pdf->Ln(10); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
271 | $pdf->TableHops($link,$prop); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
272 | $pdf->AddPage(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
273 | $pdf->TableYeasts($link,$prop); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
274 | $pdf->Ln(10); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
275 | $pdf->TableMiscs($link,$prop); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
276 | $pdf->Output(); |