71 $this->SetFont('Helvetica','',9); |
75 $this->SetFont('Helvetica','',9); |
72 $this->SetFillColor(210,245,255); |
76 $this->SetFillColor(210,245,255); |
73 |
77 |
74 $this->SetX($this->TableX); |
78 $this->SetX($this->TableX); |
75 $this->Cell(35,5,'Type',0,0,'L',true); |
79 $this->Cell(35,5,'Type',0,0,'L',true); |
76 $this->Cell(45,5,$row['type'],0,0,'L',true); |
80 $this->Cell(45,5,$recipetype[$row['type']],0,0,'L',true); |
77 $this->Cell($vul,5,'',0,0,'L',false); |
81 $this->Cell($vul,5,'',0,0,'L',false); |
78 $this->Cell(35,5,'Batch grootte',0,0,'L',true); |
82 $this->Cell(35,5,'Batch grootte',0,0,'L',true); |
79 $this->Cell(45,5,$row['batch_size'].' liter',0,0,'L',true); |
83 $this->Cell(45,5,$row['batch_size'].' liter',0,0,'L',true); |
80 $this->Ln(); |
84 $this->Ln(); |
81 |
85 |
127 $this->SetFillColor(250, 195, 65); |
132 $this->SetFillColor(250, 195, 65); |
128 $arr = json_decode($row['json_fermentables'], true); |
133 $arr = json_decode($row['json_fermentables'], true); |
129 foreach($arr as $item) { //foreach element in $arr |
134 foreach($arr as $item) { //foreach element in $arr |
130 $name = iconv('UTF-8','windows-1252',$item['f_name']); |
135 $name = iconv('UTF-8','windows-1252',$item['f_name']); |
131 $supplier = iconv('UTF-8','windows-1252',$item['f_supplier']); |
136 $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']); |
137 $amount = floatval($item['f_amount']); |
136 $costkg = floatval($item['f_cost']); |
138 $costkg = floatval($item['f_cost']); |
137 $yield = floatval($item['f_yield']); |
139 $yield = floatval($item['f_yield']); |
138 $moisture = floatval($item['f_moisture']); |
140 $moisture = floatval($item['f_moisture']); |
139 $color = floatval($item['f_color']); |
141 $color = floatval($item['f_color']); |
140 $percent = floatval($item['f_percentage']); |
142 $percent = floatval($item['f_percentage']); |
141 |
143 |
142 if ($type == "Sugar") |
144 if ($item['f_type'] == 1) // Sugar |
143 $pSugar += $percent; |
145 $pSugar += $percent; |
144 if ($graintype == "Crystal") |
146 if ($item['f_graintype'] == 2) // Crystal |
145 $pCara += $percent; |
147 $pCara += $percent; |
146 |
148 |
147 $cost = $amount * $costkg; |
149 $cost = $amount * $costkg; |
148 $cost_fermentables += $cost; |
150 $cost_fermentables += $cost; |
149 $total_fermentables += $amount; |
151 $total_fermentables += $amount; |
150 /* Calculate the amount of sugars */ |
152 /* Calculate the amount of sugars */ |
151 $d = $amount * ($yield / 100) * (1 - $moisture / 100); |
153 $d = $amount * ($yield / 100) * (1 - $moisture / 100); |
152 if ($added == "Mash") { |
154 if ($item['f_added'] == 0) { |
153 $d = floatval($row['efficiency']) / 100 * $d; |
155 $d = floatval($row['efficiency']) / 100 * $d; |
154 $sugarsm += $d; |
156 $sugarsm += $d; |
155 } |
157 } |
156 $sugarsf += $d; |
158 $sugarsf += $d; |
157 $colorw += ($amount * ebc_to_srm($color) / $row['batch_size']) * 8.34436; |
159 $colorw += ($amount * ebc_to_srm($color) / $row['batch_size']) * 8.34436; |
158 |
160 |
159 $this->Cell($vul,5,$name,0,0,'L',true); |
161 $this->Cell($vul,5,$name,0,0,'L',true); |
160 $this->Cell(30,5,$supplier,0,0,'L',true); |
162 $this->Cell(30,5,$supplier,0,0,'L',true); |
161 $this->Cell(15,5,sprintf("%.0f",$color),0,0,'R',true); |
163 $this->Cell(15,5,sprintf("%.0f",$color),0,0,'R',true); |
162 $this->Cell(17,5,added_type_names($added),0,0,'L',true); |
164 $this->Cell(17,5,$added[$item['f_added']],0,0,'L',true); |
163 $this->Cell(20,5,sprintf("%8.3f",$amount),0,0,'R',true); |
165 $this->Cell(20,5,sprintf("%8.3f",$amount),0,0,'R',true); |
164 $this->Cell(15,5,sprintf("%.1f%%",$percent),0,0,'R',true); |
166 $this->Cell(15,5,sprintf("%.1f%%",$percent),0,0,'R',true); |
165 $this->Cell(15,5,sprintf("%.1f%%",$yield),0,0,'R',true); |
167 $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); |
168 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); |
167 $this->Ln(); |
169 $this->Ln(); |
183 function TableHops($row) { |
185 function TableHops($row) { |
184 global $total_hops; |
186 global $total_hops; |
185 global $total_ibus; |
187 global $total_ibus; |
186 global $cost_hops; |
188 global $cost_hops; |
187 global $preboil_sg; |
189 global $preboil_sg; |
|
190 $hopform = array( 'Pellets', 'Plugs', 'Bellen' ); |
|
191 $hopuse = array( 'Maischen', 'First wort', 'Koken', 'Vlamuit', 'Whirlpool', 'Koudhop' ); |
188 $vul = $this->w - $this->rMargin - $this->lMargin - 135; |
192 $vul = $this->w - $this->rMargin - $this->lMargin - 135; |
189 $this->AddCol($vul,'Hop','L'); |
193 $this->AddCol($vul,'Hop','L'); |
190 $this->AddCol(35,'Land','L'); |
194 $this->AddCol(35,'Land','L'); |
191 $this->AddCol(15,'Soort','L'); |
195 $this->AddCol(15,'Soort','L'); |
192 $this->AddCol(20,'Moment','L'); |
196 $this->AddCol(20,'Moment','L'); |
206 |
210 |
207 $arr = json_decode($row['json_hops'], true); |
211 $arr = json_decode($row['json_hops'], true); |
208 foreach($arr as $item) { //foreach element in $arr |
212 foreach($arr as $item) { //foreach element in $arr |
209 $name = iconv('UTF-8','windows-1252',$item['h_name']); |
213 $name = iconv('UTF-8','windows-1252',$item['h_name']); |
210 $origin = iconv('UTF-8','windows-1252',$item['h_origin']); |
214 $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; |
215 $amount = floatval($item['h_amount']) * 1000; |
214 $mass = $amount; |
216 $mass = $amount; |
215 $costkg = floatval($item['h_cost']); |
217 $costkg = floatval($item['h_cost']); |
216 $time = floatval($item['h_time']); |
218 $time = floatval($item['h_time']); |
217 $alpha = floatval($item['h_alpha']); |
219 $alpha = floatval($item['h_alpha']); |
218 |
220 |
219 $cost = ($amount * $costkg) / 1000; |
221 $cost = ($amount * $costkg) / 1000; |
220 $cost_hops += $cost; |
222 $cost_hops += $cost; |
221 $total_hops += $amount; |
223 $total_hops += $amount; |
222 |
224 |
223 $moment = hop_useat_names($useat); |
225 $moment = $hopuse[$item['h_useat']]; |
224 if ($useat == "Boil") { |
226 if ($item['h_useat'] == 2) { // Boil |
225 $moment = "Kook@".$time; |
227 $moment = "Kook@".$time; |
226 } |
228 } |
227 $ibu = calc_IBU($useat, $form, /*floatval($row['est_og'])*/ $preboil_sg, floatval($row['batch_size']), $mass, $time, $alpha, $row['ibu_method']); |
229 $ibu = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $mass, $time, $alpha, $row['ibu_method']); |
228 $total_ibus += $ibu; |
230 $total_ibus += $ibu; |
229 |
231 |
230 $this->Cell($vul,5,$name,0,0,'L',true); |
232 $this->Cell($vul,5,$name,0,0,'L',true); |
231 $this->Cell(35,5,$origin,0,0,'L',true); |
233 $this->Cell(35,5,$origin,0,0,'L',true); |
232 $this->Cell(15,5,hop_form_names($form),0,0,'L',true); |
234 $this->Cell(15,5,$hopform[$item['h_form']],0,0,'L',true); |
233 $this->Cell(20,5,$moment,0,0,'L',true); |
235 $this->Cell(20,5,$moment,0,0,'L',true); |
234 $this->Cell(15,5,sprintf("%.1f%%",$alpha),0,0,'R',true); |
236 $this->Cell(15,5,sprintf("%.1f%%",$alpha),0,0,'R',true); |
235 $this->Cell(12,5,sprintf("%.1f",$ibu),0,0,'R',true); |
237 $this->Cell(12,5,sprintf("%.1f",$ibu),0,0,'R',true); |
236 $this->Cell(18,5,sprintf("%.1f",$amount),0,0,'R',true); |
238 $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); |
239 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); |
250 } |
252 } |
251 |
253 |
252 function TableYeasts($row) { |
254 function TableYeasts($row) { |
253 global $cost_yeasts; |
255 global $cost_yeasts; |
254 global $svg; |
256 global $svg; |
|
257 $yeastform = array( 'Vloeibaar', 'Droog', 'Schuine buis', 'Slurry', 'Ingevroren', 'Depot' ); |
|
258 $yeastuse = array( 'Hoofdgisting', 'Nagisting', 'Lagering', 'Bottelen' ); |
255 $vul = $this->w - $this->rMargin - $this->lMargin - 140; |
259 $vul = $this->w - $this->rMargin - $this->lMargin - 140; |
256 $this->AddCol(27,'Laboratorium','L'); |
260 $this->AddCol(27,'Laboratorium','L'); |
257 $this->AddCol(18,'Product','L'); |
261 $this->AddCol(18,'Product','L'); |
258 $this->AddCol($vul,'Gist','L'); |
262 $this->AddCol($vul,'Gist','L'); |
259 $this->AddCol(20,'Gebruik','L'); |
263 $this->AddCol(20,'Gebruik','L'); |
274 $arr = json_decode($row['json_yeasts'], true); |
278 $arr = json_decode($row['json_yeasts'], true); |
275 foreach($arr as $item) { //foreach element in $arr |
279 foreach($arr as $item) { //foreach element in $arr |
276 $name = iconv('UTF-8','windows-1252',$item['y_name']); |
280 $name = iconv('UTF-8','windows-1252',$item['y_name']); |
277 $laboratory = iconv('UTF-8','windows-1252',$item['y_laboratory']); |
281 $laboratory = iconv('UTF-8','windows-1252',$item['y_laboratory']); |
278 $product_id = iconv('UTF-8','windows-1252',$item['y_product_id']); |
282 $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']); |
283 $attenuation = floatval($item['y_attenuation']); |
284 $cost = $amount * $costg; |
284 $cost = floatval($item['y_amount']) * floatval($item['y_cost']); |
285 $cost_yeasts += $cost; |
285 $cost_yeasts += $cost; |
286 |
286 |
287 if ($use == "Primary") |
287 if ($item['y_use'] == 0) // Primary |
288 $svg = $attenuation; |
288 $svg = $attenuation; |
|
289 if ($item['y_form'] == 0) // Liquid |
|
290 $amount = sprintf("%.0f",floatval($item['y_amount']))." pak"; |
|
291 else if ($item['y_form'] == 1) // Dry |
|
292 $amount = sprintf("%.1f",floatval($item['y_amount'])*1000)." gr"; |
|
293 else |
|
294 $amount = sprintf("%.0f",floatval($item['y_amount'])*1000)." ml"; |
289 |
295 |
290 $this->Cell(27,5,$laboratory,0,0,'L',true); |
296 $this->Cell(27,5,$laboratory,0,0,'L',true); |
291 $this->Cell(18,5,$product_id,0,0,'L',true); |
297 $this->Cell(18,5,$product_id,0,0,'L',true); |
292 $this->Cell($vul,5,$name,0,0,'L',true); |
298 $this->Cell($vul,5,$name,0,0,'L',true); |
293 $this->Cell(20,5,yeast_use_names($use),0,0,'L',true); |
299 $this->Cell(20,5,$yeastuse[$item['y_use']],0,0,'L',true); |
294 $this->Cell(15,5,sprintf("%.1f%%",$attenuation),0,0,'R',true); |
300 $this->Cell(15,5,sprintf("%.1f%%",$attenuation),0,0,'R',true); |
295 $this->Cell(22,5,yeast_form_names($form),0,0,'L',true); |
301 $this->Cell(22,5,$yeastform[$item['y_form']],0,0,'L',true); |
296 $this->Cell(18,5,sprintf("%.1f",$amount),0,0,'R',true); |
302 $this->Cell(18,5,$amount,0,0,'R',true); |
297 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); |
303 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); |
298 $this->Ln(); |
304 $this->Ln(); |
299 } |
305 } |
300 |
306 |
301 $this->SetFillColor(210,245,255); |
307 $this->SetFillColor(210,245,255); |
307 $this->aCols=array(); |
313 $this->aCols=array(); |
308 } |
314 } |
309 |
315 |
310 function TableMiscs($row) { |
316 function TableMiscs($row) { |
311 global $cost_miscs; |
317 global $cost_miscs; |
312 $vul = $this->w - $this->rMargin - $this->lMargin - 95; |
318 $misctype = array( 'Specerij', 'Kruid', 'Smaakstof', 'Klaringsmiddel', 'Brouwzout', 'Gistvoeding', 'Anders' ); |
|
319 $miscuse = array( 'Starter', 'Maischen', 'Koken', 'Hoofdvergisting', 'Nagisting/lagering', 'Bottelen' ); |
|
320 $vul = $this->w - $this->rMargin - $this->lMargin - 100; |
313 $this->AddCol($vul,'Naam','L'); |
321 $this->AddCol($vul,'Naam','L'); |
314 $this->AddCol(30,'Soort','L'); |
322 $this->AddCol(30,'Soort','L'); |
315 $this->AddCol(25,'Gebruik','L'); |
323 $this->AddCol(30,'Gebruik','L'); |
316 $this->AddCol(20,'Hoeveel','R'); |
324 $this->AddCol(20,'Hoeveel','R'); |
317 $this->AddCol(20,'Prijs','R'); |
325 $this->AddCol(20,'Prijs','R'); |
318 |
326 |
319 $cMargin=$this->cMargin; |
327 $cMargin=$this->cMargin; |
320 $this->cMargin=2; |
328 $this->cMargin=2; |
326 $this->SetFillColor(175, 175, 255); |
334 $this->SetFillColor(175, 175, 255); |
327 |
335 |
328 $arr = json_decode($row['json_miscs'], true); |
336 $arr = json_decode($row['json_miscs'], true); |
329 foreach($arr as $item) { |
337 foreach($arr as $item) { |
330 $name = iconv('UTF-8','windows-1252',$item['m_name']); |
338 $name = iconv('UTF-8','windows-1252',$item['m_name']); |
331 $type = iconv('UTF-8','windows-1252',$item['m_type']); |
339 $type = $item['m_type']; |
332 $use_use = iconv('UTF-8','windows-1252',$item['m_use_use']); |
340 $use_use = $item['m_use_use']; |
333 $amount = floatval($item['m_amount']) * 1000; |
341 $amount = floatval($item['m_amount']) * 1000; |
334 $costg = floatval($item['m_cost']) / 1000; |
342 $costg = floatval($item['m_cost']) / 1000; |
335 $time = floatval($item['m_time']); |
343 $time = floatval($item['m_time']); |
336 $aiw = $item['m_amount_is_weight']; |
344 $aiw = $item['m_amount_is_weight']; |
337 $cost = $amount * $costg; |
345 $cost = $amount * $costg; |
338 $cost_miscs += $cost; |
346 $cost_miscs += $cost; |
339 |
347 |
340 if ($type == "Water agent") |
348 if ($type == 4) // Water agent |
341 $this->SetFillColor(240,140,130); |
349 $this->SetFillColor(240,140,130); |
342 else if ($type == "Fining") |
350 else if ($type == 3) // Fining |
343 $this->SetFillColor(95,180,25); |
351 $this->SetFillColor(95,180,25); |
344 else if (($type == "Spice") || ($type == "Herb") || ($type == "Flavor") || ($type == "Yeast nutrient")) |
352 else if (($type == 0) || ($type == 1) || ($type == 2) || ($type == 5)) // Spice, Herb, Flavour, Yeast nutrient |
345 $this->SetFillColor(240,250,65); |
353 $this->SetFillColor(240,250,65); |
346 else |
354 else |
347 $this->SetFillColor(210,245,255); |
355 $this->SetFillColor(210,245,255); |
348 |
356 |
349 if ($use_use == "Boil") |
357 if ($use_use == 2) // Boil |
350 $gebruik = sprintf("%s %d min",misc_use_names($use_use),$time); |
358 $gebruik = sprintf("%s %d min",$miscuse[$use_use],$time); |
351 else |
359 else |
352 $gebruik = misc_use_names($use_use); |
360 $gebruik = $miscuse[$use_use]; |
353 |
361 |
354 $hoeveel = sprintf("%.1f %s",$amount,$aiw ? "gr":"ml"); |
362 $hoeveel = sprintf("%.1f %s",$amount,$aiw ? "gr":"ml"); |
355 $this->Cell($vul,5,$name,0,0,'L',true); |
363 $this->Cell($vul,5,$name,0,0,'L',true); |
356 $this->Cell(30,5,misc_type_names($type),0,0,'L',true); |
364 $this->Cell(30,5,$misctype[$type],0,0,'L',true); |
357 $this->Cell(25,5,$gebruik,0,0,'L',true); |
365 $this->Cell(30,5,$gebruik,0,0,'L',true); |
358 $this->Cell(20,5,$hoeveel,0,0,'R',true); |
366 $this->Cell(20,5,$hoeveel,0,0,'R',true); |
359 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); |
367 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); |
360 $this->Ln(); |
368 $this->Ln(); |
361 } |
369 } |
362 |
370 |
451 |
459 |
452 |
460 |
453 class PDF extends PDF_MySQL_Table { |
461 class PDF extends PDF_MySQL_Table { |
454 function Header() { |
462 function Header() { |
455 global $row; |
463 global $row; |
|
464 global $prdate; |
|
465 $stage = array( 'Plan', 'Wacht', 'Brouwen', 'Hoofdgisting', 'Nagisting', 'Lagering', 'Afvullen', 'Hergisten', 'Rijpen', 'Proeven', 'Gereed', 'Afgesloten' ); |
456 $this->Image('images/logo.png',10,6,30); |
466 $this->Image('images/logo.png',10,6,30); |
457 // Title |
467 // Title |
458 $this->SetFont('Helvetica','B',18); |
468 $this->SetFont('Helvetica','B',18); |
459 $this->SetX(45); |
469 $this->SetX(45); |
460 $this->Cell(0,8,$row['name'],1,1,'L'); |
470 $this->Cell(0,8,$row['name'],0,1,'L'); |
461 $this->Ln(20); |
471 $this->Ln(1); |
|
472 $this->SetFont('Helvetica','',10); |
|
473 $this->SetX(45); |
|
474 $this->Cell(17,5,'Datum:',0,0,'L'); |
|
475 $this->Cell(0,5,$prdate,0,1,'L'); |
|
476 $this->SetX(45); |
|
477 $this->Cell(17,5,'Stijl:',0,0,'L'); |
|
478 $this->Cell(0,5,$row['st_name'],0,1,'L'); |
|
479 $this->SetX(45); |
|
480 $this->Cell(17,5,'Fase:',0,0,'L'); |
|
481 $this->Cell(0,5,$stage[$row['stage']],0,1,'L'); |
|
482 $this->Ln(6); |
462 // Ensure table header is printed |
483 // Ensure table header is printed |
463 parent::Header(); |
484 parent::Header(); |
464 } |
485 } |
465 } |
486 } |
466 |
487 |
481 $pdf->Cell(0, 5, 'Recept opmerkingen',0,0,'C',true); |
502 $pdf->Cell(0, 5, 'Recept opmerkingen',0,0,'C',true); |
482 $pdf->Ln(); |
503 $pdf->Ln(); |
483 $pdf->SetFillColor(210,245,255); |
504 $pdf->SetFillColor(210,245,255); |
484 $pdf->MultiCell(0,4,$row['notes'],0,'L',true); |
505 $pdf->MultiCell(0,4,$row['notes'],0,'L',true); |
485 } |
506 } |
486 // Disclaimer toevoegen dat dit alleen recept ontwikkeling is. Uitkomsten zoals IBU zijn een berekende schatting. |
507 |
487 // Footer sectie met berekende/geschatte uitkomsten zoals ABV, kostprijs per liter enz. |
508 if ($row['stage'] == 2) { |
|
509 // Checklist |
|
510 } |
|
511 if ($row['stage'] > 2) { |
|
512 // Brouw rapport |
|
513 } |
|
514 if ($row['stage'] > 3) { |
|
515 // Vergisting gegevens |
|
516 } |
|
517 if ($row['stage'] > 6) { |
|
518 // Package report |
|
519 } |
|
520 if ($row['stage'] > 9) { |
|
521 // Taste notes |
|
522 } |
|
523 |
|
524 |
488 $pdf->Output(); |
525 $pdf->Output(); |