3 require_once($_SERVER['DOCUMENT_ROOT'].'/fpdf/fpdf.php'); |
3 require_once($_SERVER['DOCUMENT_ROOT'].'/fpdf/fpdf.php'); |
4 |
4 |
5 define('EURO', chr(128) ); |
5 define('EURO', chr(128) ); |
6 |
6 |
7 $link = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME); |
7 $link = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME); |
|
8 if (! $link) { |
|
9 die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error()); |
|
10 } |
|
11 if (! mysqli_set_charset($link, "utf8" )) { |
|
12 echo "error"; |
|
13 return 1; |
|
14 } |
|
15 |
8 setlocale ( LC_ALL, 'nl_NL.UTF-8'); |
16 setlocale ( LC_ALL, 'nl_NL.UTF-8'); |
9 |
17 |
10 class PDF_MySQL_Table extends FPDF |
18 class PDF_MySQL_Table extends FPDF |
11 { |
19 { |
12 protected $ProcessingTable=false; |
20 protected $ProcessingTable=false; |
84 $tot_fermentables += $value; |
92 $tot_fermentables += $value; |
85 |
93 |
86 $this->SetX($this->TableX); |
94 $this->SetX($this->TableX); |
87 $ci=$this->ColorIndex; |
95 $ci=$this->ColorIndex; |
88 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); |
96 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); |
89 $this->Cell(30,5,$row['supplier'],0,0,'L',true); |
97 $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['supplier']),0,0,'L',true); |
90 $this->Cell(90,5,$row['name'],0,0,'L',true); |
98 $this->Cell(90,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); |
91 $this->Cell(30,5,sprintf("%10.3f kg",$row['inventory']),0,0,'R',true); |
99 $this->Cell(30,5,sprintf("%10.3f kg",$row['inventory']),0,0,'R',true); |
92 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); |
100 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); |
93 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); |
101 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); |
94 $this->Ln(); |
102 $this->Ln(); |
95 $this->ColorIndex=1-$ci; |
103 $this->ColorIndex=1-$ci; |
132 $stock = floatval($row['inventory']) * 1000.0; |
140 $stock = floatval($row['inventory']) * 1000.0; |
133 |
141 |
134 $this->SetX($this->TableX); |
142 $this->SetX($this->TableX); |
135 $ci=$this->ColorIndex; |
143 $ci=$this->ColorIndex; |
136 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); |
144 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); |
137 $this->Cell(30,5,$row['origin'],0,0,'L',true); |
145 $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['origin']),0,0,'L',true); |
138 $this->Cell(75,5,$row['name'],0,0,'L',true); |
146 $this->Cell(75,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); |
139 $this->Cell(15,5,$row['form'],0,0,'L',true); |
147 $this->Cell(15,5,iconv('UTF-8','windows-1252',$row['form']),0,0,'L',true); |
140 $this->Cell(30,5,sprintf("%10.1f gr",$stock),0,0,'R',true); |
148 $this->Cell(30,5,sprintf("%10.1f gr",$stock),0,0,'R',true); |
141 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); |
149 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); |
142 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); |
150 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); |
143 $this->Ln(); |
151 $this->Ln(); |
144 $this->ColorIndex=1-$ci; |
152 $this->ColorIndex=1-$ci; |
182 ($row['form'] == 'Dry') ? $amount = "gr" : $amount = "ml"; |
190 ($row['form'] == 'Dry') ? $amount = "gr" : $amount = "ml"; |
183 |
191 |
184 $this->SetX($this->TableX); |
192 $this->SetX($this->TableX); |
185 $ci=$this->ColorIndex; |
193 $ci=$this->ColorIndex; |
186 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); |
194 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); |
187 $this->Cell(30,5,$row['laboratory'],0,0,'L',true); |
195 $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['laboratory']),0,0,'L',true); |
188 $this->Cell(20,5,$row['product_id'],0,0,'L',true); |
196 $this->Cell(20,5,iconv('UTF-8','windows-1252',$row['product_id']),0,0,'L',true); |
189 $this->Cell(70,5,$row['name'],0,0,'L',true); |
197 $this->Cell(70,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); |
190 $this->Cell(30,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true); |
198 $this->Cell(30,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true); |
191 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); |
199 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); |
192 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); |
200 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); |
193 $this->Ln(); |
201 $this->Ln(); |
194 $this->ColorIndex=1-$ci; |
202 $this->ColorIndex=1-$ci; |
231 ($row['amount_is_weight']) ? $amount = "gr" : $amount = "ml"; |
239 ($row['amount_is_weight']) ? $amount = "gr" : $amount = "ml"; |
232 |
240 |
233 $this->SetX($this->TableX); |
241 $this->SetX($this->TableX); |
234 $ci=$this->ColorIndex; |
242 $ci=$this->ColorIndex; |
235 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); |
243 $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); |
236 $this->Cell(30,5,$row['type'],0,0,'L',true); |
244 $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['type']),0,0,'L',true); |
237 $this->Cell(90,5,$row['name'],0,0,'L',true); |
245 $this->Cell(90,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); |
238 $this->Cell(30,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true); |
246 $this->Cell(30,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true); |
239 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); |
247 $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); |
240 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); |
248 $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); |
241 $this->Ln(); |
249 $this->Ln(); |
242 $this->ColorIndex=1-$ci; |
250 $this->ColorIndex=1-$ci; |