119 $this->SetFillColor(250, 195, 65); |
120 $this->SetFillColor(250, 195, 65); |
120 $arr = json_decode($row['json_fermentables'], true); |
121 $arr = json_decode($row['json_fermentables'], true); |
121 foreach($arr as $item) { //foreach element in $arr |
122 foreach($arr as $item) { //foreach element in $arr |
122 $name = iconv('UTF-8','windows-1252',$item['f_name']); |
123 $name = iconv('UTF-8','windows-1252',$item['f_name']); |
123 $supplier = iconv('UTF-8','windows-1252',$item['f_supplier']); |
124 $supplier = iconv('UTF-8','windows-1252',$item['f_supplier']); |
124 $added = iconv('UTF-8','windows-1252',$item['f_added']); |
|
125 $type = iconv('UTF-8','windows-1252',$item['f_type']); |
|
126 $graintype = iconv('UTF-8','windows-1252',$item['f_graintype']); |
|
127 $amount = floatval($item['f_amount']); |
125 $amount = floatval($item['f_amount']); |
128 $costkg = floatval($item['f_cost']); |
126 $costkg = floatval($item['f_cost']); |
129 $yield = floatval($item['f_yield']); |
127 $yield = floatval($item['f_yield']); |
130 $moisture = floatval($item['f_moisture']); |
128 $moisture = floatval($item['f_moisture']); |
131 $color = floatval($item['f_color']); |
129 $color = floatval($item['f_color']); |
132 $percent = floatval($item['f_percentage']); |
130 $percent = floatval($item['f_percentage']); |
133 |
131 |
134 if ($type == "Sugar") |
132 if ($item['f_type'] == 1) // Sugar |
135 $pSugar += $percent; |
133 $pSugar += $percent; |
136 if ($graintype == "Crystal") |
134 if ($item['f_graintype'] == 2) // Crystal |
137 $pCara += $percent; |
135 $pCara += $percent; |
138 |
136 |
139 $cost = $amount * $costkg; |
137 $cost = $amount * $costkg; |
140 $cost_fermentables += $cost; |
138 $cost_fermentables += $cost; |
141 $total_fermentables += $amount; |
139 $total_fermentables += $amount; |
142 /* Calculate the amount of sugars */ |
140 /* Calculate the amount of sugars */ |
143 $d = $amount * ($yield / 100) * (1 - $moisture / 100); |
141 $d = $amount * ($yield / 100) * (1 - $moisture / 100); |
144 if ($added == "Mash") { |
142 if ($item['f_added'] == 0) { // Mash |
145 $d = floatval($row['efficiency']) / 100 * $d; |
143 $d = floatval($row['efficiency']) / 100 * $d; |
146 $sugarsm += $d; |
144 $sugarsm += $d; |
147 } |
145 } |
148 $sugarsf += $d; |
146 $sugarsf += $d; |
149 $colorw += ($amount * ebc_to_srm($color) / $row['batch_size']) * 8.34436; |
147 $colorw += ($amount * ebc_to_srm($color) / $row['batch_size']) * 8.34436; |
150 |
148 |
151 $this->Cell($vul,5,$name,0,0,'L',true); |
149 $this->Cell($vul,5,$name,0,0,'L',true); |
152 $this->Cell(30,5,$supplier,0,0,'L',true); |
150 $this->Cell(30,5,$supplier,0,0,'L',true); |
153 $this->Cell(15,5,sprintf("%.0f",$color),0,0,'R',true); |
151 $this->Cell(15,5,sprintf("%.0f",$color),0,0,'R',true); |
154 $this->Cell(17,5,added_type_names($added),0,0,'L',true); |
152 $this->Cell(17,5,$added[$item['f_added']],0,0,'L',true); |
155 $this->Cell(20,5,sprintf("%8.3f",$amount),0,0,'R',true); |
153 $this->Cell(20,5,sprintf("%8.3f",$amount),0,0,'R',true); |
156 $this->Cell(15,5,sprintf("%.1f%%",$percent),0,0,'R',true); |
154 $this->Cell(15,5,sprintf("%.1f%%",$percent),0,0,'R',true); |
157 $this->Cell(15,5,sprintf("%.1f%%",$yield),0,0,'R',true); |
155 $this->Cell(15,5,sprintf("%.1f%%",$yield),0,0,'R',true); |
158 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); |
156 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); |
159 $this->Ln(); |
157 $this->Ln(); |
175 function TableHops($row) { |
173 function TableHops($row) { |
176 global $total_hops; |
174 global $total_hops; |
177 global $total_ibus; |
175 global $total_ibus; |
178 global $cost_hops; |
176 global $cost_hops; |
179 global $preboil_sg; |
177 global $preboil_sg; |
|
178 // $hoptype = array( 'Bitterhop', 'Aromahop', 'Beide' ); |
|
179 $hopform = array( 'Pellets', 'Plugs', 'Bellen' ); |
|
180 $hopuse = array( 'Maischen', 'First wort', 'Koken', 'Vlamuit', 'Whirlpool', 'Koudhop' ); |
180 $vul = $this->w - $this->rMargin - $this->lMargin - 135; |
181 $vul = $this->w - $this->rMargin - $this->lMargin - 135; |
181 $this->AddCol($vul,'Hop','L'); |
182 $this->AddCol($vul,'Hop','L'); |
182 $this->AddCol(35,'Land','L'); |
183 $this->AddCol(35,'Land','L'); |
183 $this->AddCol(15,'Soort','L'); |
184 $this->AddCol(15,'Soort','L'); |
184 $this->AddCol(20,'Moment','L'); |
185 $this->AddCol(20,'Moment','L'); |
198 |
199 |
199 $arr = json_decode($row['json_hops'], true); |
200 $arr = json_decode($row['json_hops'], true); |
200 foreach($arr as $item) { //foreach element in $arr |
201 foreach($arr as $item) { //foreach element in $arr |
201 $name = iconv('UTF-8','windows-1252',$item['h_name']); |
202 $name = iconv('UTF-8','windows-1252',$item['h_name']); |
202 $origin = iconv('UTF-8','windows-1252',$item['h_origin']); |
203 $origin = iconv('UTF-8','windows-1252',$item['h_origin']); |
203 $useat = iconv('UTF-8','windows-1252',$item['h_useat']); |
|
204 $form = iconv('UTF-8','windows-1252',$item['h_form']); |
|
205 $amount = floatval($item['h_amount']) * 1000; |
204 $amount = floatval($item['h_amount']) * 1000; |
206 $mass = $amount; |
205 $mass = $amount; |
207 $costkg = floatval($item['h_cost']); |
206 $costkg = floatval($item['h_cost']); |
208 $time = floatval($item['h_time']); |
207 $time = floatval($item['h_time']); |
209 $alpha = floatval($item['h_alpha']); |
208 $alpha = floatval($item['h_alpha']); |
210 |
209 |
211 $cost = ($amount * $costkg) / 1000; |
210 $cost = ($amount * $costkg) / 1000; |
212 $cost_hops += $cost; |
211 $cost_hops += $cost; |
213 $total_hops += $amount; |
212 $total_hops += $amount; |
214 |
213 |
215 $moment = hop_useat_names($useat); |
214 $moment = $hopuse[$item['h_useat']]; |
216 if ($useat == "Boil") { |
215 if ($item['h_useat'] == 2) { // Boil |
217 $moment = "Kook@".$time; |
216 $moment = "Kook@".$time; |
218 } |
217 } |
219 $ibu = calc_IBU($useat, $form, /*floatval($row['est_og'])*/ $preboil_sg, floatval($row['batch_size']), $mass, $time, $alpha, $row['ibu_method']); |
218 $ibu = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $mass, $time, $alpha, $row['ibu_method']); |
220 $total_ibus += $ibu; |
219 $total_ibus += $ibu; |
221 |
220 |
222 $this->Cell($vul,5,$name,0,0,'L',true); |
221 $this->Cell($vul,5,$name,0,0,'L',true); |
223 $this->Cell(35,5,$origin,0,0,'L',true); |
222 $this->Cell(35,5,$origin,0,0,'L',true); |
224 $this->Cell(15,5,hop_form_names($form),0,0,'L',true); |
223 $this->Cell(15,5,$hopform[$item['h_form']],0,0,'L',true); |
225 $this->Cell(20,5,$moment,0,0,'L',true); |
224 $this->Cell(20,5,$moment,0,0,'L',true); |
226 $this->Cell(15,5,sprintf("%.1f%%",$alpha),0,0,'R',true); |
225 $this->Cell(15,5,sprintf("%.1f%%",$alpha),0,0,'R',true); |
227 $this->Cell(12,5,sprintf("%.1f",$ibu),0,0,'R',true); |
226 $this->Cell(12,5,sprintf("%.1f",$ibu),0,0,'R',true); |
228 $this->Cell(18,5,sprintf("%.1f",$amount),0,0,'R',true); |
227 $this->Cell(18,5,sprintf("%.1f",$amount),0,0,'R',true); |
229 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); |
228 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); |
266 $arr = json_decode($row['json_yeasts'], true); |
267 $arr = json_decode($row['json_yeasts'], true); |
267 foreach($arr as $item) { //foreach element in $arr |
268 foreach($arr as $item) { //foreach element in $arr |
268 $name = iconv('UTF-8','windows-1252',$item['y_name']); |
269 $name = iconv('UTF-8','windows-1252',$item['y_name']); |
269 $laboratory = iconv('UTF-8','windows-1252',$item['y_laboratory']); |
270 $laboratory = iconv('UTF-8','windows-1252',$item['y_laboratory']); |
270 $product_id = iconv('UTF-8','windows-1252',$item['y_product_id']); |
271 $product_id = iconv('UTF-8','windows-1252',$item['y_product_id']); |
271 $form = iconv('UTF-8','windows-1252',$item['y_form']); |
|
272 $use = iconv('UTF-8','windows-1252',$item['y_use']); |
|
273 $amount = floatval($item['y_amount']) * 1000; |
272 $amount = floatval($item['y_amount']) * 1000; |
274 $costg = floatval($item['y_cost']); |
273 $costg = floatval($item['y_cost']); |
275 $attenuation = floatval($item['y_attenuation']); |
274 $attenuation = floatval($item['y_attenuation']); |
276 $cost = $amount * $costg; |
275 $cost = $amount * $costg; |
277 $cost_yeasts += $cost; |
276 $cost_yeasts += $cost; |
278 |
277 |
279 if ($use == "Primary") |
278 if ($item['y_use'] == 0) // Primary |
280 $svg = $attenuation; |
279 $svg = $attenuation; |
281 |
280 |
282 $this->Cell(27,5,$laboratory,0,0,'L',true); |
281 $this->Cell(27,5,$laboratory,0,0,'L',true); |
283 $this->Cell(18,5,$product_id,0,0,'L',true); |
282 $this->Cell(18,5,$product_id,0,0,'L',true); |
284 $this->Cell($vul,5,$name,0,0,'L',true); |
283 $this->Cell($vul,5,$name,0,0,'L',true); |
285 $this->Cell(20,5,yeast_use_names($use),0,0,'L',true); |
284 $this->Cell(20,5,$yeastuse[$item['y_use']],0,0,'L',true); |
286 $this->Cell(15,5,sprintf("%.1f%%",$attenuation),0,0,'R',true); |
285 $this->Cell(15,5,sprintf("%.1f%%",$attenuation),0,0,'R',true); |
287 $this->Cell(22,5,yeast_form_names($form),0,0,'L',true); |
286 $this->Cell(22,5,$yeastform[$item['y_form']],0,0,'L',true); |
288 $this->Cell(18,5,sprintf("%.1f",$amount),0,0,'R',true); |
287 $this->Cell(18,5,sprintf("%.1f",$amount),0,0,'R',true); |
289 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); |
288 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); |
290 $this->Ln(); |
289 $this->Ln(); |
291 } |
290 } |
292 |
291 |
299 $this->aCols=array(); |
298 $this->aCols=array(); |
300 } |
299 } |
301 |
300 |
302 function TableMiscs($row) { |
301 function TableMiscs($row) { |
303 global $cost_miscs; |
302 global $cost_miscs; |
304 $vul = $this->w - $this->rMargin - $this->lMargin - 95; |
303 $misctype = array( 'Specerij', 'Kruid', 'Smaakstof', 'Klaringsmiddel', 'Brouwzout', 'Gistvoeding', 'Anders' ); |
|
304 $miscuse = array( 'Starter', 'Maischen', 'Koken', 'Hoofdvergisting', 'Nagisting/lagering', 'Bottelen' ); |
|
305 $vul = $this->w - $this->rMargin - $this->lMargin - 100; |
305 $this->AddCol($vul,'Naam','L'); |
306 $this->AddCol($vul,'Naam','L'); |
306 $this->AddCol(30,'Soort','L'); |
307 $this->AddCol(30,'Soort','L'); |
307 $this->AddCol(25,'Gebruik','L'); |
308 $this->AddCol(30,'Gebruik','L'); |
308 $this->AddCol(20,'Hoeveel','R'); |
309 $this->AddCol(20,'Hoeveel','R'); |
309 $this->AddCol(20,'Prijs','R'); |
310 $this->AddCol(20,'Prijs','R'); |
310 |
311 |
311 $cMargin=$this->cMargin; |
312 $cMargin=$this->cMargin; |
312 $this->cMargin=2; |
313 $this->cMargin=2; |
318 $this->SetFillColor(175, 175, 255); |
319 $this->SetFillColor(175, 175, 255); |
319 |
320 |
320 $arr = json_decode($row['json_miscs'], true); |
321 $arr = json_decode($row['json_miscs'], true); |
321 foreach($arr as $item) { |
322 foreach($arr as $item) { |
322 $name = iconv('UTF-8','windows-1252',$item['m_name']); |
323 $name = iconv('UTF-8','windows-1252',$item['m_name']); |
323 $type = iconv('UTF-8','windows-1252',$item['m_type']); |
324 $type = $item['m_type']; |
324 $use_use = iconv('UTF-8','windows-1252',$item['m_use_use']); |
325 $use_use = $item['m_use_use']; |
325 $amount = floatval($item['m_amount']) * 1000; |
326 $amount = floatval($item['m_amount']) * 1000; |
326 $costg = floatval($item['m_cost']) / 1000; |
327 $costg = floatval($item['m_cost']) / 1000; |
327 $time = floatval($item['m_time']); |
328 $time = floatval($item['m_time']); |
328 $aiw = $item['m_amount_is_weight']; |
329 $aiw = $item['m_amount_is_weight']; |
329 $cost = $amount * $costg; |
330 $cost = $amount * $costg; |
330 $cost_miscs += $cost; |
331 $cost_miscs += $cost; |
331 |
332 |
332 if ($type == "Water agent") |
333 if ($type == 4) // Water agent |
333 $this->SetFillColor(240,140,130); |
334 $this->SetFillColor(240,140,130); |
334 else if ($type == "Fining") |
335 else if ($type == 3) // Fining |
335 $this->SetFillColor(95,180,25); |
336 $this->SetFillColor(95,180,25); |
336 else if (($type == "Spice") || ($type == "Herb") || ($type == "Flavor") || ($type == "Yeast nutrient")) |
337 else if (($type == 0) || ($type == 1) || ($type == 2) || ($type == 5)) // Spice, Herb, Flavour, Yeast nutrient |
337 $this->SetFillColor(240,250,65); |
338 $this->SetFillColor(240,250,65); |
338 else |
339 else |
339 $this->SetFillColor(210,245,255); |
340 $this->SetFillColor(210,245,255); |
340 |
341 |
341 if ($use_use == "Boil") |
342 if ($use_use == 2) // Boil |
342 $gebruik = sprintf("%s %d min",misc_use_names($use_use),$time); |
343 $gebruik = sprintf("%s %d min",$miscuse[$use_use],$time); |
343 else |
344 else |
344 $gebruik = misc_use_names($use_use); |
345 $gebruik = $miscuse[$use_use]; |
345 |
346 |
346 $hoeveel = sprintf("%.1f %s",$amount,$aiw ? "gr":"ml"); |
347 $hoeveel = sprintf("%.1f %s",$amount,$aiw ? "gr":"ml"); |
347 $this->Cell($vul,5,$name,0,0,'L',true); |
348 $this->Cell($vul,5,$name,0,0,'L',true); |
348 $this->Cell(30,5,misc_type_names($type),0,0,'L',true); |
349 $this->Cell(30,5,$misctype[$type],0,0,'L',true); |
349 $this->Cell(25,5,$gebruik,0,0,'L',true); |
350 $this->Cell(30,5,$gebruik,0,0,'L',true); |
350 $this->Cell(20,5,$hoeveel,0,0,'R',true); |
351 $this->Cell(20,5,$hoeveel,0,0,'R',true); |
351 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); |
352 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); |
352 $this->Ln(); |
353 $this->Ln(); |
353 } |
354 } |
354 |
355 |
355 $this->SetFillColor(210,245,255); |
356 $this->SetFillColor(210,245,255); |
356 $this->Cell($vul+75,5,'',0,0,'L',false); |
357 $this->Cell($vul+80,5,'',0,0,'L',false); |
357 $this->Cell(20,5,sprintf("%8.3f",$cost_miscs).EURO,0,0,'R',true); |
358 $this->Cell(20,5,sprintf("%8.3f",$cost_miscs).EURO,0,0,'R',true); |
358 $this->Ln(10); |
359 $this->Ln(10); |
359 |
360 |
360 $this->ProcessingTable=false; |
361 $this->ProcessingTable=false; |
361 $this->cMargin=$cMargin; |
362 $this->cMargin=$cMargin; |