Fri, 28 Dec 2018 23:18:42 +0100
Some pH calculations cane use twice as much loops, probably because we have better float precision then the original pascal code. More variables to prevent html reads. Use predicted mash pH (the grist in demi water) to calculate the pH shift from the tapwater to the target pH. It's better but not right yet. Or it is right and brouwhulp is far off.
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); |
82
7af1d472475a
Inventory PDF now properly handles UTF8 encoding.
Michiel Broek <mbroek@mbse.eu>
parents:
78
diff
changeset
|
8 | if (! $link) { |
7af1d472475a
Inventory PDF now properly handles UTF8 encoding.
Michiel Broek <mbroek@mbse.eu>
parents:
78
diff
changeset
|
9 | die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error()); |
7af1d472475a
Inventory PDF now properly handles UTF8 encoding.
Michiel Broek <mbroek@mbse.eu>
parents:
78
diff
changeset
|
10 | } |
7af1d472475a
Inventory PDF now properly handles UTF8 encoding.
Michiel Broek <mbroek@mbse.eu>
parents:
78
diff
changeset
|
11 | if (! mysqli_set_charset($link, "utf8" )) { |
7af1d472475a
Inventory PDF now properly handles UTF8 encoding.
Michiel Broek <mbroek@mbse.eu>
parents:
78
diff
changeset
|
12 | echo "error"; |
7af1d472475a
Inventory PDF now properly handles UTF8 encoding.
Michiel Broek <mbroek@mbse.eu>
parents:
78
diff
changeset
|
13 | return 1; |
7af1d472475a
Inventory PDF now properly handles UTF8 encoding.
Michiel Broek <mbroek@mbse.eu>
parents:
78
diff
changeset
|
14 | } |
7af1d472475a
Inventory PDF now properly handles UTF8 encoding.
Michiel Broek <mbroek@mbse.eu>
parents:
78
diff
changeset
|
15 | |
78 | 16 | setlocale ( LC_ALL, 'nl_NL.UTF-8'); |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
17 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
18 | 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
|
19 | { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
20 | protected $ProcessingTable=false; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
21 | protected $aCols=array(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
22 | protected $TableX; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
23 | protected $HeaderColor; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
24 | protected $RowColors; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
25 | protected $TotalColor; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
26 | protected $ColorIndex; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
27 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
28 | function Header() { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
29 | // 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
|
30 | if ($this->ProcessingTable) |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
31 | $this->TableHeader(); |
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 TableHeader() { |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
35 | $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
|
36 | $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
|
37 | $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
|
38 | 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
|
39 | $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
|
40 | $this->Ln(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
41 | } |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
42 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
43 | 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
|
44 | // 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
|
45 | $TableWidth=0; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
46 | 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
|
47 | $w=$col['w']; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
48 | if($w==-1) |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
49 | $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
|
50 | 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
|
51 | $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
|
52 | $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
|
53 | $TableWidth+=$w; |
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 | // 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
|
56 | if($align=='C') |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
57 | $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
|
58 | elseif($align=='R') |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
59 | $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
|
60 | else |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
61 | $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
|
62 | } |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
63 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
64 | 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
|
65 | $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
|
66 | } |
30
f5ab22446aa5
Inventory fermentables and hops to standard weight format.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
67 | |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
68 | function TableFermentables($link,$prop) { |
78 | 69 | $this->AddCol( 30,'Leverancier','L'); |
70 | $this->AddCol( 90,'Vergistbaar ingredient','L'); | |
71 | $this->AddCol( 30,'Voorraad','R'); | |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
72 | $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
|
73 | $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
|
74 | $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
|
75 | $prop['align']='L'; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
76 | $cMargin=$this->cMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
77 | $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
|
78 | $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
|
79 | $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
|
80 | $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
|
81 | $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
|
82 | $this->TableHeader(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
83 | $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
|
84 | $this->ColorIndex=0; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
85 | $this->ProcessingTable=true; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
86 | |
78 | 87 | $result = mysqli_query($link, "SELECT name,supplier,inventory,cost FROM inventory_fermentables WHERE inventory > 0 ORDER BY supplier,name"); |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
88 | $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
|
89 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
90 | 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
|
91 | $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
|
92 | $tot_fermentables += $value; |
30
f5ab22446aa5
Inventory fermentables and hops to standard weight format.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
93 | |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
94 | $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
|
95 | $ci=$this->ColorIndex; |
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->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); |
82
7af1d472475a
Inventory PDF now properly handles UTF8 encoding.
Michiel Broek <mbroek@mbse.eu>
parents:
78
diff
changeset
|
97 | $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['supplier']),0,0,'L',true); |
7af1d472475a
Inventory PDF now properly handles UTF8 encoding.
Michiel Broek <mbroek@mbse.eu>
parents:
78
diff
changeset
|
98 | $this->Cell(90,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); |
78 | 99 | $this->Cell(30,5,sprintf("%10.3f kg",$row['inventory']),0,0,'R',true); |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
100 | $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
|
101 | $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
|
102 | $this->Ln(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
103 | $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
|
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 | $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
|
107 | $this->SetFillColor($this->TotalColor[0],$this->TotalColor[1],$this->TotalColor[2]); |
78 | 108 | $this->Cell(170,5,'Totaal',0,0,'L',true); |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
109 | $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
|
110 | $this->Ln(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
111 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
112 | $this->ProcessingTable=false; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
113 | $this->cMargin=$cMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
114 | $this->aCols=array(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
115 | } |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
116 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
117 | function TableHops($link,$prop) { |
78 | 118 | $this->AddCol( 30,'Land','L'); |
119 | $this->AddCol( 75,'Hoppen','L'); | |
120 | $this->AddCol( 15,'Soort','L'); | |
121 | $this->AddCol( 30,'Voorraad','R'); | |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
122 | $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
|
123 | $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
|
124 | $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
|
125 | $prop['align']='L'; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
126 | $cMargin=$this->cMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
127 | $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
|
128 | $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
|
129 | $this->TableHeader(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
130 | $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
|
131 | $this->ColorIndex=0; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
132 | $this->ProcessingTable=true; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
133 | |
78 | 134 | $result = mysqli_query($link, "SELECT name,form,origin,inventory,cost FROM inventory_hops WHERE inventory > 0 ORDER BY origin,name"); |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
135 | $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
|
136 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
137 | 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
|
138 | $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
|
139 | $tot_hops += $value; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
140 | $stock = floatval($row['inventory']) * 1000.0; |
30
f5ab22446aa5
Inventory fermentables and hops to standard weight format.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
141 | |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
142 | $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
|
143 | $ci=$this->ColorIndex; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
144 | $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); |
82
7af1d472475a
Inventory PDF now properly handles UTF8 encoding.
Michiel Broek <mbroek@mbse.eu>
parents:
78
diff
changeset
|
145 | $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['origin']),0,0,'L',true); |
7af1d472475a
Inventory PDF now properly handles UTF8 encoding.
Michiel Broek <mbroek@mbse.eu>
parents:
78
diff
changeset
|
146 | $this->Cell(75,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); |
7af1d472475a
Inventory PDF now properly handles UTF8 encoding.
Michiel Broek <mbroek@mbse.eu>
parents:
78
diff
changeset
|
147 | $this->Cell(15,5,iconv('UTF-8','windows-1252',$row['form']),0,0,'L',true); |
78 | 148 | $this->Cell(30,5,sprintf("%10.1f gr",$stock),0,0,'R',true); |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
149 | $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
|
150 | $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
|
151 | $this->Ln(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
152 | $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
|
153 | } |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
154 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
155 | $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
|
156 | $this->SetFillColor($this->TotalColor[0],$this->TotalColor[1],$this->TotalColor[2]); |
78 | 157 | $this->Cell(170,5,'Totaal',0,0,'L',true); |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
158 | $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
|
159 | $this->Ln(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
160 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
161 | $this->ProcessingTable=false; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
162 | $this->cMargin=$cMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
163 | $this->aCols=array(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
164 | } |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
165 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
166 | 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
|
167 | $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
|
168 | $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
|
169 | $this->AddCol( 70,'Gist','L'); |
78 | 170 | $this->AddCol( 30,'Voorraad','R'); |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
171 | $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
|
172 | $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
|
173 | $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
|
174 | $prop['align']='L'; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
175 | $cMargin=$this->cMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
176 | $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
|
177 | $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
|
178 | $this->TableHeader(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
179 | $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
|
180 | $this->ColorIndex=0; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
181 | $this->ProcessingTable=true; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
182 | |
78 | 183 | $result = mysqli_query($link, "SELECT name,laboratory,product_id,form,inventory,cost FROM inventory_yeasts WHERE inventory > 0 ORDER BY laboratory,product_id"); |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
184 | $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
|
185 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
186 | 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
|
187 | $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
|
188 | $tot_yeasts += $value; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
189 | $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
|
190 | ($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
|
191 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
192 | $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
|
193 | $ci=$this->ColorIndex; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
194 | $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); |
82
7af1d472475a
Inventory PDF now properly handles UTF8 encoding.
Michiel Broek <mbroek@mbse.eu>
parents:
78
diff
changeset
|
195 | $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['laboratory']),0,0,'L',true); |
7af1d472475a
Inventory PDF now properly handles UTF8 encoding.
Michiel Broek <mbroek@mbse.eu>
parents:
78
diff
changeset
|
196 | $this->Cell(20,5,iconv('UTF-8','windows-1252',$row['product_id']),0,0,'L',true); |
7af1d472475a
Inventory PDF now properly handles UTF8 encoding.
Michiel Broek <mbroek@mbse.eu>
parents:
78
diff
changeset
|
197 | $this->Cell(70,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); |
78 | 198 | $this->Cell(30,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true); |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
199 | $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
|
200 | $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
|
201 | $this->Ln(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
202 | $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
|
203 | } |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
204 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
205 | $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
|
206 | $this->SetFillColor($this->TotalColor[0],$this->TotalColor[1],$this->TotalColor[2]); |
78 | 207 | $this->Cell(170,5,'Totaal',0,0,'L',true); |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
208 | $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
|
209 | $this->Ln(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
210 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
211 | $this->ProcessingTable=false; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
212 | $this->cMargin=$cMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
213 | $this->aCols=array(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
214 | } |
33
2ee6ad5d6f14
More weight/volmes standards in the database.
Michiel Broek <mbroek@mbse.eu>
parents:
30
diff
changeset
|
215 | |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
216 | 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
|
217 | $this->AddCol( 30,'Type','L'); |
78 | 218 | $this->AddCol( 90,'Ingredient','L'); |
219 | $this->AddCol( 30,'Voorraad','R'); | |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
220 | $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
|
221 | $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
|
222 | $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
|
223 | $prop['align']='L'; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
224 | $cMargin=$this->cMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
225 | $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
|
226 | $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
|
227 | $this->TableHeader(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
228 | $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
|
229 | $this->ColorIndex=0; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
230 | $this->ProcessingTable=true; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
231 | |
78 | 232 | $result = mysqli_query($link, "SELECT name,type,amount_is_weight,inventory,cost FROM inventory_miscs WHERE inventory > 0 ORDER BY type,name"); |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
233 | $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
|
234 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
235 | 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
|
236 | $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
|
237 | $tot_miscs += $value; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
238 | $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
|
239 | ($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
|
240 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
241 | $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
|
242 | $ci=$this->ColorIndex; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
243 | $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); |
82
7af1d472475a
Inventory PDF now properly handles UTF8 encoding.
Michiel Broek <mbroek@mbse.eu>
parents:
78
diff
changeset
|
244 | $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['type']),0,0,'L',true); |
7af1d472475a
Inventory PDF now properly handles UTF8 encoding.
Michiel Broek <mbroek@mbse.eu>
parents:
78
diff
changeset
|
245 | $this->Cell(90,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); |
78 | 246 | $this->Cell(30,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true); |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
247 | $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
|
248 | $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
|
249 | $this->Ln(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
250 | $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
|
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 | $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
|
254 | $this->SetFillColor($this->TotalColor[0],$this->TotalColor[1],$this->TotalColor[2]); |
78 | 255 | $this->Cell(170,5,'Totaal',0,0,'L',true); |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
256 | $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
|
257 | $this->Ln(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
258 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
259 | $this->ProcessingTable=false; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
260 | $this->cMargin=$cMargin; |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
261 | $this->aCols=array(); |
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 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
266 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
267 | 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
|
268 | function Header() { |
78 | 269 | $this->Image('images/logo.png',10,6,30); |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
270 | // Title |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
271 | $this->SetFont('Helvetica','',18); |
78 | 272 | $this->Cell(0,10,'Inventaris',0,1,'C'); |
273 | $this->Ln(20); | |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
274 | // 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
|
275 | parent::Header(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
276 | } |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
277 | } |
30
f5ab22446aa5
Inventory fermentables and hops to standard weight format.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
278 | |
77
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
279 | |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
280 | $pdf = new PDF(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
281 | $pdf->AddPage(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
282 | $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
|
283 | '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
|
284 | $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
|
285 | $pdf->Ln(10); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
286 | $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
|
287 | $pdf->AddPage(); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
288 | $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
|
289 | $pdf->Ln(10); |
a9f8de2d7b2b
Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
33
diff
changeset
|
290 | $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
|
291 | $pdf->Output(); |