Sun, 03 Feb 2019 21:26:23 +0100
Added calcStage function that will be used to increase the brew process stage.
165 | 1 | <?php |
2 | require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php'); | |
3 | require_once($_SERVER['DOCUMENT_ROOT'].'/includes/formulas.php'); | |
4 | require_once($_SERVER['DOCUMENT_ROOT'].'/fpdf/fpdf.php'); | |
5 | ||
6 | ||
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 | ||
16 | setlocale ( LC_ALL, 'nl_NL.UTF-8'); | |
17 | $record = $_GET["record"]; | |
18 | $result = mysqli_query($link, "SELECT * FROM products WHERE record='".$record."'"); | |
19 | $row = mysqli_fetch_array($result); | |
20 | ||
21 | $total_fermentables = 0.0; | |
22 | $cost_fermentables = 0.0; | |
23 | $total_hops = 0.0; | |
24 | $cost_hops = 0.0; | |
25 | $cost_yeasts = 0.0; | |
26 | $cost_miscs = 0.0; | |
27 | $pSugar = 0; | |
28 | $pCara = 0; | |
29 | $svg = 77; | |
30 | $colorw = 0; | |
31 | $total_ibus = 0; | |
32 | $preboil_sg = 0; | |
33 | ||
34 | class PDF_MySQL_Table extends FPDF | |
35 | { | |
36 | protected $ProcessingTable=false; | |
37 | protected $aCols=array(); | |
38 | protected $TableX; | |
39 | ||
40 | function Header() { | |
41 | // Print the table header if necessary | |
42 | if ($this->ProcessingTable) | |
43 | $this->TableHeader(); | |
44 | } | |
45 | ||
46 | function TableHeader() { | |
47 | $this->SetFont('Helvetica','B',9); | |
48 | $this->SetX($this->TableX); | |
49 | $this->SetFillColor(255,150,100); | |
50 | foreach($this->aCols as $col) | |
51 | $this->Cell($col['w'],5,$col['c'],0,0,$col['a'],true); | |
52 | $this->Ln(); | |
53 | } | |
54 | ||
55 | function AddCol($width=-1, $caption='', $align='L') { | |
56 | $this->aCols[]=array('c'=>$caption,'w'=>$width,'a'=>$align); | |
57 | } | |
58 | ||
59 | function TableGlobal($row) { | |
60 | /* 2 Columns */ | |
61 | $vul = $this->w - $this->rMargin - $this->lMargin - 160; | |
62 | $cMargin=$this->cMargin; | |
63 | $this->cMargin=2; | |
64 | $this->TableX=$this->lMargin; | |
65 | $this->SetFont('Helvetica','B',9); | |
66 | $this->SetX($this->TableX); | |
67 | $this->SetFillColor(255,150,100); | |
68 | $this->Cell(0, 5, 'Recept overzicht',0,0,'C',true); | |
69 | $this->Ln(); | |
70 | ||
71 | $this->SetFont('Helvetica','',9); | |
72 | $this->SetFillColor(210,245,255); | |
73 | ||
74 | $this->SetX($this->TableX); | |
75 | $this->Cell(35,5,'Type',0,0,'L',true); | |
76 | $this->Cell(45,5,$row['type'],0,0,'L',true); | |
77 | $this->Cell($vul,5,'',0,0,'L',false); | |
78 | $this->Cell(35,5,'Batch grootte',0,0,'L',true); | |
79 | $this->Cell(45,5,$row['batch_size'].' liter',0,0,'L',true); | |
80 | $this->Ln(); | |
81 | ||
82 | $this->SetX($this->TableX); | |
83 | $this->Cell(35,5,'Kooktijd',0,0,'L',true); | |
84 | $this->Cell(45,5,$row['boil_time'].' minuten',0,0,'L',true); | |
85 | $this->Cell($vul,5,'',0,0,'L',false); | |
86 | $this->Cell(35,5,'Brouwzaal rendement',0,0,'L',true); | |
87 | $this->Cell(45,5,$row['efficiency'].' %',0,0,'L',true); | |
88 | $this->Ln(); | |
89 | ||
90 | $this->SetX($this->TableX); | |
91 | $this->Cell(35,5,'Bierstijl',0,0,'L',true); | |
92 | $this->Cell(45,5,$row['st_name'],0,0,'L',true); | |
93 | $this->Cell($vul,5,'',0,0,'L',false); | |
94 | $this->Cell(35,5,'Installatie',0,0,'L',true); | |
95 | $this->Cell(45,5,$row['eq_name'],0,0,'L',true); | |
96 | $this->Ln(10); | |
97 | ||
98 | $this->cMargin=$cMargin; | |
99 | } | |
100 | ||
101 | function TableFermentables($row) { | |
102 | global $cost_fermentables; | |
103 | global $total_fermentables; | |
104 | global $pSugar; | |
105 | global $pCara; | |
106 | global $colorw; | |
107 | global $preboil_sg; | |
108 | $vul = $this->w - $this->rMargin - $this->lMargin - 132; | |
109 | $this->AddCol($vul,'Grondstof','L'); | |
110 | $this->AddCol(30,'Leverancier','L'); | |
111 | $this->AddCol(15,'EBC','R'); | |
112 | $this->AddCol(17,'Moment','L'); | |
113 | $this->AddCol(20,'Kg','R'); | |
114 | $this->AddCol(15,'Procent','R'); | |
115 | $this->AddCol(15,'Opbr.','R'); | |
116 | $this->AddCol(20,'Prijs','R'); | |
117 | ||
118 | $cMargin=$this->cMargin; | |
119 | $this->cMargin=2; | |
120 | $this->TableX=$this->lMargin; | |
121 | $this->TableHeader(); | |
122 | $this->ProcessingTable=true; | |
123 | ||
124 | $sugarsf = 0; | |
125 | $sugarsm = 0; | |
126 | $this->SetFont('Helvetica','',9); | |
127 | $this->SetFillColor(250, 195, 65); | |
128 | $arr = json_decode($row['json_fermentables'], true); | |
129 | foreach($arr as $item) { //foreach element in $arr | |
130 | $name = iconv('UTF-8','windows-1252',$item['f_name']); | |
131 | $supplier = iconv('UTF-8','windows-1252',$item['f_supplier']); | |
132 | $added = iconv('UTF-8','windows-1252',$item['f_added']); | |
133 | $type = iconv('UTF-8','windows-1252',$item['f_type']); | |
134 | $graintype = iconv('UTF-8','windows-1252',$item['f_graintype']); | |
135 | $amount = floatval($item['f_amount']); | |
136 | $costkg = floatval($item['f_cost']); | |
137 | $yield = floatval($item['f_yield']); | |
138 | $moisture = floatval($item['f_moisture']); | |
139 | $color = floatval($item['f_color']); | |
140 | $percent = floatval($item['f_percentage']); | |
141 | ||
142 | if ($type == "Sugar") | |
143 | $pSugar += $percent; | |
144 | if ($graintype == "Crystal") | |
145 | $pCara += $percent; | |
146 | ||
147 | $cost = $amount * $costkg; | |
148 | $cost_fermentables += $cost; | |
149 | $total_fermentables += $amount; | |
150 | /* Calculate the amount of sugars */ | |
151 | $d = $amount * ($yield / 100) * (1 - $moisture / 100); | |
152 | if ($added == "Mash") { | |
153 | $d = floatval($row['efficiency']) / 100 * $d; | |
154 | $sugarsm += $d; | |
155 | } | |
156 | $sugarsf += $d; | |
157 | $colorw += ($amount * ebc_to_srm($color) / $row['batch_size']) * 8.34436; | |
158 | ||
159 | $this->Cell($vul,5,$name,0,0,'L',true); | |
160 | $this->Cell(30,5,$supplier,0,0,'L',true); | |
161 | $this->Cell(15,5,sprintf("%.0f",$color),0,0,'R',true); | |
162 | $this->Cell(17,5,added_type_names($added),0,0,'L',true); | |
163 | $this->Cell(20,5,sprintf("%8.3f",$amount),0,0,'R',true); | |
164 | $this->Cell(15,5,sprintf("%.1f%%",$percent),0,0,'R',true); | |
165 | $this->Cell(15,5,sprintf("%.1f%%",$yield),0,0,'R',true); | |
166 | $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); | |
167 | $this->Ln(); | |
168 | } | |
169 | ||
170 | $row['est_og'] = estimate_sg($sugarsf, floatval($row['batch_size'])); | |
171 | $preboil_sg = estimate_sg($sugarsm, floatval($row['boil_size'])); | |
172 | $this->SetFillColor(210,245,255); | |
173 | $this->Cell($vul+62,5,'',0,0,'L',false); | |
174 | $this->Cell(20,5,sprintf("%8.3f",$total_fermentables),0,0,'R',true); | |
175 | $this->Cell(30,5,'',0,0,'L',false); | |
176 | $this->Cell(20,5,sprintf("%8.3f",$cost_fermentables).EURO,0,0,'R',true); | |
177 | $this->Ln(10); | |
178 | $this->ProcessingTable=false; | |
179 | $this->cMargin=$cMargin; | |
180 | $this->aCols=array(); | |
181 | } | |
182 | ||
183 | function TableHops($row) { | |
184 | global $total_hops; | |
185 | global $total_ibus; | |
186 | global $cost_hops; | |
187 | global $preboil_sg; | |
188 | $vul = $this->w - $this->rMargin - $this->lMargin - 135; | |
189 | $this->AddCol($vul,'Hop','L'); | |
190 | $this->AddCol(35,'Land','L'); | |
191 | $this->AddCol(15,'Soort','L'); | |
192 | $this->AddCol(20,'Moment','L'); | |
193 | $this->AddCol(15,'Alpha','R'); | |
194 | $this->AddCol(12,'IBU','R'); | |
195 | $this->AddCol(18,'Gram','R'); | |
196 | $this->AddCol(20,'Prijs','R'); | |
197 | ||
198 | $cMargin=$this->cMargin; | |
199 | $this->cMargin=2; | |
200 | $this->TableX=$this->lMargin; | |
201 | $this->TableHeader(); | |
202 | $this->ProcessingTable=true; | |
203 | ||
204 | $this->SetFont('Helvetica','',9); | |
205 | $this->SetFillColor(100, 250, 65); | |
206 | ||
207 | $arr = json_decode($row['json_hops'], true); | |
208 | foreach($arr as $item) { //foreach element in $arr | |
209 | $name = iconv('UTF-8','windows-1252',$item['h_name']); | |
210 | $origin = iconv('UTF-8','windows-1252',$item['h_origin']); | |
211 | $useat = iconv('UTF-8','windows-1252',$item['h_useat']); | |
212 | $form = iconv('UTF-8','windows-1252',$item['h_form']); | |
213 | $amount = floatval($item['h_amount']) * 1000; | |
214 | $mass = $amount; | |
215 | $costkg = floatval($item['h_cost']); | |
216 | $time = floatval($item['h_time']); | |
217 | $alpha = floatval($item['h_alpha']); | |
218 | ||
219 | $cost = ($amount * $costkg) / 1000; | |
220 | $cost_hops += $cost; | |
221 | $total_hops += $amount; | |
222 | ||
223 | $moment = hop_useat_names($useat); | |
224 | if ($useat == "Boil") { | |
225 | $moment = "Kook@".$time; | |
226 | } | |
227 | $ibu = calc_IBU($useat, $form, /*floatval($row['est_og'])*/ $preboil_sg, floatval($row['batch_size']), $mass, $time, $alpha, $row['ibu_method']); | |
228 | $total_ibus += $ibu; | |
229 | ||
230 | $this->Cell($vul,5,$name,0,0,'L',true); | |
231 | $this->Cell(35,5,$origin,0,0,'L',true); | |
232 | $this->Cell(15,5,hop_form_names($form),0,0,'L',true); | |
233 | $this->Cell(20,5,$moment,0,0,'L',true); | |
234 | $this->Cell(15,5,sprintf("%.1f%%",$alpha),0,0,'R',true); | |
235 | $this->Cell(12,5,sprintf("%.1f",$ibu),0,0,'R',true); | |
236 | $this->Cell(18,5,sprintf("%.1f",$amount),0,0,'R',true); | |
237 | $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); | |
238 | $this->Ln(); | |
239 | } | |
240 | ||
241 | $this->SetFillColor(210,245,255); | |
242 | $this->Cell($vul+85,5,'',0,0,'L',false); | |
243 | $this->Cell(12,5,sprintf("%.1f",$total_ibus),0,0,'R',true); | |
244 | $this->Cell(18,5,sprintf("%.1f",$total_hops),0,0,'R',true); | |
245 | $this->Cell(20,5,sprintf("%8.3f",$cost_hops).EURO,0,0,'R',true); | |
246 | $this->Ln(10); | |
247 | $this->ProcessingTable=false; | |
248 | $this->cMargin=$cMargin; | |
249 | $this->aCols=array(); | |
250 | } | |
251 | ||
252 | function TableYeasts($row) { | |
253 | global $cost_yeasts; | |
254 | global $svg; | |
255 | $vul = $this->w - $this->rMargin - $this->lMargin - 140; | |
256 | $this->AddCol(27,'Laboratorium','L'); | |
257 | $this->AddCol(18,'Product','L'); | |
258 | $this->AddCol($vul,'Gist','L'); | |
259 | $this->AddCol(20,'Gebruik','L'); | |
260 | $this->AddCol(15,'Attn','R'); | |
261 | $this->AddCol(22,'Vorm','L'); | |
262 | $this->AddCol(18,'Gram','R'); | |
263 | $this->AddCol(20,'Prijs','R'); | |
264 | ||
265 | $cMargin=$this->cMargin; | |
266 | $this->cMargin=2; | |
267 | $this->TableX=$this->lMargin; | |
268 | $this->TableHeader(); | |
269 | $this->ProcessingTable=true; | |
270 | ||
271 | $this->SetFont('Helvetica','',9); | |
272 | $this->SetFillColor(175, 175, 255); | |
273 | ||
274 | $arr = json_decode($row['json_yeasts'], true); | |
275 | foreach($arr as $item) { //foreach element in $arr | |
276 | $name = iconv('UTF-8','windows-1252',$item['y_name']); | |
277 | $laboratory = iconv('UTF-8','windows-1252',$item['y_laboratory']); | |
278 | $product_id = iconv('UTF-8','windows-1252',$item['y_product_id']); | |
279 | $form = iconv('UTF-8','windows-1252',$item['y_form']); | |
280 | $use = iconv('UTF-8','windows-1252',$item['y_use']); | |
281 | $amount = floatval($item['y_amount']) * 1000; | |
282 | $costg = floatval($item['y_cost']); | |
283 | $attenuation = floatval($item['y_attenuation']); | |
284 | $cost = $amount * $costg; | |
285 | $cost_yeasts += $cost; | |
286 | ||
287 | if ($use == "Primary") | |
288 | $svg = $attenuation; | |
289 | ||
290 | $this->Cell(27,5,$laboratory,0,0,'L',true); | |
291 | $this->Cell(18,5,$product_id,0,0,'L',true); | |
292 | $this->Cell($vul,5,$name,0,0,'L',true); | |
293 | $this->Cell(20,5,yeast_use_names($use),0,0,'L',true); | |
294 | $this->Cell(15,5,sprintf("%.1f%%",$attenuation),0,0,'R',true); | |
295 | $this->Cell(22,5,yeast_form_names($form),0,0,'L',true); | |
296 | $this->Cell(18,5,sprintf("%.1f",$amount),0,0,'R',true); | |
297 | $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); | |
298 | $this->Ln(); | |
299 | } | |
300 | ||
301 | $this->SetFillColor(210,245,255); | |
302 | $this->Cell($vul+120,5,'',0,0,'L',false); | |
303 | $this->Cell(20,5,sprintf("%8.3f",$cost_yeasts).EURO,0,0,'R',true); | |
304 | $this->Ln(10); | |
305 | $this->ProcessingTable=false; | |
306 | $this->cMargin=$cMargin; | |
307 | $this->aCols=array(); | |
308 | } | |
309 | ||
310 | function TableMiscs($row) { | |
311 | global $cost_miscs; | |
312 | $vul = $this->w - $this->rMargin - $this->lMargin - 95; | |
313 | $this->AddCol($vul,'Naam','L'); | |
314 | $this->AddCol(30,'Soort','L'); | |
315 | $this->AddCol(25,'Gebruik','L'); | |
316 | $this->AddCol(20,'Hoeveel','R'); | |
317 | $this->AddCol(20,'Prijs','R'); | |
318 | ||
319 | $cMargin=$this->cMargin; | |
320 | $this->cMargin=2; | |
321 | $this->TableX=$this->lMargin; | |
322 | $this->TableHeader(); | |
323 | $this->ProcessingTable=true; | |
324 | ||
325 | $this->SetFont('Helvetica','',9); | |
326 | $this->SetFillColor(175, 175, 255); | |
327 | ||
328 | $arr = json_decode($row['json_miscs'], true); | |
329 | foreach($arr as $item) { | |
330 | $name = iconv('UTF-8','windows-1252',$item['m_name']); | |
331 | $type = iconv('UTF-8','windows-1252',$item['m_type']); | |
332 | $use_use = iconv('UTF-8','windows-1252',$item['m_use_use']); | |
333 | $amount = floatval($item['m_amount']) * 1000; | |
334 | $costg = floatval($item['m_cost']) / 1000; | |
335 | $time = floatval($item['m_time']); | |
336 | $aiw = $item['m_amount_is_weight']; | |
337 | $cost = $amount * $costg; | |
338 | $cost_miscs += $cost; | |
339 | ||
340 | if ($type == "Water agent") | |
341 | $this->SetFillColor(240,140,130); | |
342 | else if ($type == "Fining") | |
343 | $this->SetFillColor(95,180,25); | |
344 | else if (($type == "Spice") || ($type == "Herb") || ($type == "Flavor") || ($type == "Yeast nutrient")) | |
345 | $this->SetFillColor(240,250,65); | |
346 | else | |
347 | $this->SetFillColor(210,245,255); | |
348 | ||
349 | if ($use_use == "Boil") | |
350 | $gebruik = sprintf("%s %d min",misc_use_names($use_use),$time); | |
351 | else | |
352 | $gebruik = misc_use_names($use_use); | |
353 | ||
354 | $hoeveel = sprintf("%.1f %s",$amount,$aiw ? "gr":"ml"); | |
355 | $this->Cell($vul,5,$name,0,0,'L',true); | |
356 | $this->Cell(30,5,misc_type_names($type),0,0,'L',true); | |
357 | $this->Cell(25,5,$gebruik,0,0,'L',true); | |
358 | $this->Cell(20,5,$hoeveel,0,0,'R',true); | |
359 | $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); | |
360 | $this->Ln(); | |
361 | } | |
362 | ||
363 | $this->SetFillColor(210,245,255); | |
364 | $this->Cell($vul+75,5,'',0,0,'L',false); | |
365 | $this->Cell(20,5,sprintf("%8.3f",$cost_miscs).EURO,0,0,'R',true); | |
366 | $this->Ln(10); | |
367 | ||
368 | $this->ProcessingTable=false; | |
369 | $this->cMargin=$cMargin; | |
370 | $this->aCols=array(); | |
371 | } | |
372 | ||
373 | // Watercolor $this->SetFillColor(120,255,250); | |
374 | ||
375 | function TableSummary($row) { | |
376 | global $pSugar; | |
377 | global $pCara; | |
378 | global $svg; | |
379 | global $colorw; | |
380 | global $cost_fermentables; | |
381 | global $cost_hops; | |
382 | global $cost_miscs; | |
383 | global $cost_yeasts; | |
384 | /* 2 Columns */ | |
385 | $vul = $this->w - $this->rMargin - $this->lMargin - 170; | |
386 | $cMargin=$this->cMargin; | |
387 | $this->cMargin=2; | |
388 | $this->TableX=$this->lMargin; | |
389 | $this->SetFont('Helvetica','B',9); | |
390 | $this->SetX($this->TableX); | |
391 | $this->SetFillColor(255,150,100); | |
392 | $this->Cell(0, 5, 'Recept samenvatting',0,0,'C',true); | |
393 | $this->Ln(); | |
394 | ||
395 | $this->SetFont('Helvetica','',9); | |
396 | $this->SetFillColor(210,245,255); | |
397 | ||
398 | $row['est_fg'] = estimate_fg($pSugar, $pCara, 0, 0, 0, $svg, $row['est_og']); | |
399 | ||
400 | $this->SetX($this->TableX); | |
401 | $this->Cell(35,5,'Start SG',0,0,'L',true); | |
402 | $this->Cell(25,5,sprintf("%.3f",$row['est_og']),0,0,'L',true); | |
403 | $this->Cell(25,5,'('.sprintf("%.3f",$row['st_og_min']).' - '.sprintf("%.3f",$row['st_og_max']).')',0,0,'L',true); | |
404 | $this->Cell($vul,5,'',0,0,'L',false); | |
405 | $this->Cell(35,5,'Eind SG',0,0,'L',true); | |
406 | $this->Cell(25,5,sprintf("%.3f",$row['est_fg']),0,0,'L',true); | |
407 | $this->Cell(25,5,'('.sprintf("%.3f",$row['st_fg_min']).' - '.sprintf("%.3f",$row['st_fg_max']).')',0,0,'L',true); | |
408 | $this->Ln(); | |
409 | ||
410 | $row['est_abv'] = abvol($row['est_og'], $row['est_fg']); | |
411 | $this->SetX($this->TableX); | |
412 | $this->Cell(35,5,'Geschat alcohol',0,0,'L',true); | |
413 | $this->Cell(25,5,sprintf("%.1f",$row['est_abv']).'%',0,0,'L',true); | |
414 | $this->Cell(25,5,'('.sprintf("%.1f",$row['st_abv_min']).' - '.sprintf("%.1f",$row['st_abv_max']).'%)',0,0,'L',true); | |
415 | $this->Cell($vul,5,'',0,0,'L',false); | |
416 | $this->Cell(35,5,'CO2',0,0,'L',true); | |
417 | $this->Cell(25,5,sprintf("%.1f",$row['est_carb']).'%',0,0,'L',true); | |
418 | $this->Cell(25,5,'('.sprintf("%.1f",$row['st_carb_min']).' - '.sprintf("%.1f",$row['st_carb_max']).'%)',0,0,'L',true); | |
419 | $this->Ln(); | |
420 | ||
421 | $row['est_color'] = kw_to_ebc($row['color_method'], $colorw); | |
422 | $this->SetX($this->TableX); | |
423 | $this->Cell(35,5,'Kleur ('.$row['color_method'].')',0,0,'L',true); | |
424 | $beercolor = ebc_to_color($row['est_color']); | |
425 | if ($row['est_color'] > 30) | |
426 | $this->SetTextColor(250); | |
427 | $this->SetFillColor($beercolor[0],$beercolor[1],$beercolor[2]); | |
428 | $this->Cell(25,5,$row['est_color'].' EBC',0,0,'L',true); | |
429 | $this->Cell(25,5,'('.$row['st_color_min'].' - '.$row['st_color_max'].' EBC)',0,0,'L',true); | |
430 | $this->SetTextColor(0); | |
431 | $this->SetFillColor(210,245,255); | |
432 | $this->Cell($vul,5,'',0,0,'L',false); | |
433 | $this->Cell(35,5,'Bitterheid ('.$row['ibu_method'].')',0,0,'L',true); | |
434 | $this->Cell(25,5,sprintf("%.0f",$row['est_ibu']).' IBU',0,0,'L',true); | |
435 | $this->Cell(25,5,'('.$row['st_ibu_min'].' - '.$row['st_ibu_max'].' IBU)',0,0,'L',true); | |
436 | $this->Ln(); | |
437 | ||
438 | $this->SetX($this->TableX); | |
439 | $cost_total = $cost_fermentables + $cost_hops + $cost_miscs + $cost_yeasts; | |
440 | $this->Cell(35,5,'Kosten',0,0,'L',true); | |
441 | $this->Cell(25,5,sprintf("%.2f",$cost_total).EURO,0,0,'L',true); | |
442 | $this->Cell(25,5,sprintf("%.2f",$cost_total/$row['batch_size']).EURO.' / liter',0,0,'L',true); | |
443 | $this->Ln(10); | |
444 | ||
445 | ||
446 | // Kostprijs per liter, calorieren | |
447 | $this->cMargin=$cMargin; | |
448 | } | |
449 | } | |
450 | ||
451 | ||
452 | ||
453 | class PDF extends PDF_MySQL_Table { | |
454 | function Header() { | |
455 | global $row; | |
456 | $this->Image('images/logo.png',10,6,30); | |
457 | // Title | |
458 | $this->SetFont('Helvetica','B',18); | |
459 | $this->SetX(45); | |
460 | $this->Cell(0,8,$row['name'],1,1,'L'); | |
461 | $this->Ln(20); | |
462 | // Ensure table header is printed | |
463 | parent::Header(); | |
464 | } | |
465 | } | |
466 | ||
467 | ||
468 | /* | |
469 | * Generate PDF from recipe data | |
470 | */ | |
471 | $pdf = new PDF(); | |
472 | $pdf->AddPage(); | |
473 | $pdf->TableGlobal($row); | |
474 | $pdf->TableFermentables($row); | |
475 | $pdf->TableHops($row); | |
476 | $pdf->TableYeasts($row); | |
477 | $pdf->TableMiscs($row); | |
478 | $pdf->TableSummary($row); | |
479 | if (strlen($row['notes'])) { | |
480 | $pdf->SetFillColor(255,150,100); | |
481 | $pdf->Cell(0, 5, 'Recept opmerkingen',0,0,'C',true); | |
482 | $pdf->Ln(); | |
483 | $pdf->SetFillColor(210,245,255); | |
484 | $pdf->MultiCell(0,4,$row['notes'],0,'L',true); | |
485 | } | |
486 | // Disclaimer toevoegen dat dit alleen recept ontwikkeling is. Uitkomsten zoals IBU zijn een berekende schatting. | |
487 | // Footer sectie met berekende/geschatte uitkomsten zoals ABV, kostprijs per liter enz. | |
488 | $pdf->Output(); |