www/prod_print.php

changeset 392
544d7d0183b2
parent 391
a1bcebc61ddd
child 396
804800d8e885
equal deleted inserted replaced
391:a1bcebc61ddd 392:544d7d0183b2
109 global $pSugar; 109 global $pSugar;
110 global $pCara; 110 global $pCara;
111 global $colorw; 111 global $colorw;
112 global $preboil_sg; 112 global $preboil_sg;
113 global $mashkg; 113 global $mashkg;
114 $added = array( 'Maischen', 'Koken', 'Vergisten', 'Nagisten/lageren', 'Bottelen' ); 114 $added = array( 'Maischen', 'Koken 10 min', 'Vergisten', 'Nagisten/lageren', 'Bottelen' );
115 $vul = $this->w - $this->rMargin - $this->lMargin - 132; 115 $ftype = array( 'Mout', 'Suiker', 'Vloeibaar extract', 'Droog extract', 'Ongemout graan' );
116 $this->Ln(); 116 $mtype = array( 'Basismout', 'Geroosterde mout', 'Cara- of crystalmout', 'Geƫeste mout', 'Zuurmout', 'Speciale mout', 'Geen mout' );
117 $this->AddCol($vul,'Grondstof','L'); 117 $vul = $this->w - $this->rMargin - $this->lMargin - 125;
118 $this->AddCol(30,'Leverancier','L'); 118 $this->Ln();
119 $this->AddCol(15,'EBC','R'); 119 $this->AddCol($vul,'Mout, granen en suikers','L');
120 $this->AddCol(17,'Moment','L');
121 $this->AddCol(20,'Kg','R');
122 $this->AddCol(15,'Procent','R'); 120 $this->AddCol(15,'Procent','R');
123 $this->AddCol(15,'Opbr.','R'); 121 $this->AddCol(15,'Opbr.','R');
122 $this->AddCol(25,'Soort', 'L');
123 $this->AddCol(30,'Gebruik moment','L');
124 $this->AddCol(20,'Hoeveel','R');
124 $this->AddCol(20,'Prijs','R'); 125 $this->AddCol(20,'Prijs','R');
125 126
126 $cMargin=$this->cMargin; 127 $cMargin=$this->cMargin;
127 $this->cMargin=2; 128 $this->cMargin=2;
128 $this->TableX=$this->lMargin; 129 $this->TableX=$this->lMargin;
148 if ($item['f_type'] == 1) // Sugar 149 if ($item['f_type'] == 1) // Sugar
149 $pSugar += $percent; 150 $pSugar += $percent;
150 if ($item['f_graintype'] == 2) // Crystal 151 if ($item['f_graintype'] == 2) // Crystal
151 $pCara += $percent; 152 $pCara += $percent;
152 153
154 if ($item['f_type'] == 0)
155 $soort = iconv('UTF-8','windows-1252',$mtype[$item['f_graintype']]);
156 else
157 $soort = iconv('UTF-8','windows-1252',$ftype[$item['f_type']]);
158
153 $cost = $amount * $costkg; 159 $cost = $amount * $costkg;
154 $cost_fermentables += $cost; 160 $cost_fermentables += $cost;
155 $total_fermentables += $amount; 161 $total_fermentables += $amount;
156 /* Calculate the amount of sugars */ 162 /* Calculate the amount of sugars */
157 $d = $amount * ($yield / 100) * (1 - $moisture / 100); 163 $d = $amount * ($yield / 100) * (1 - $moisture / 100);
161 $mashkg += $amount; 167 $mashkg += $amount;
162 } 168 }
163 $sugarsf += $d; 169 $sugarsf += $d;
164 $colorw += ($amount * ebc_to_srm($color) / $row['batch_size']) * 8.34436; 170 $colorw += ($amount * ebc_to_srm($color) / $row['batch_size']) * 8.34436;
165 171
166 $this->Cell($vul,5,$name,0,0,'L',true); 172 if ($amount > 100)
167 $this->Cell(30,5,$supplier,0,0,'L',true); 173 $amount = sprintf("%.1f",$amount).' kg';
168 $this->Cell(15,5,sprintf("%.0f",$color),0,0,'R',true); 174 else if ($amount > 10)
169 $this->Cell(17,5,$added[$item['f_added']],0,0,'L',true); 175 $amount = sprintf("%.2f",$amount).' kg';
170 $this->Cell(20,5,sprintf("%8.3f",$amount),0,0,'R',true); 176 else
177 $amount = sprintf("%.0f",$amount * 1000).' gr';
178 $this->Cell($vul,5,$name.' ('.$supplier.') '.sprintf("%.0f",$color).' EBC',0,0,'L',true);
171 $this->Cell(15,5,sprintf("%.1f%%",$percent),0,0,'R',true); 179 $this->Cell(15,5,sprintf("%.1f%%",$percent),0,0,'R',true);
172 $this->Cell(15,5,sprintf("%.1f%%",$yield),0,0,'R',true); 180 $this->Cell(15,5,sprintf("%.1f%%",$yield),0,0,'R',true);
173 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); 181 $this->Cell(25,5,$soort,0,0,'L',true);
182 $this->Cell(30,5,$added[$item['f_added']],0,0,'L',true);
183 $this->Cell(20,5,$amount,0,0,'R',true);
184 $this->Cell(20,5,sprintf("%.3f",$cost).EURO,0,0,'R',true);
174 $this->Ln(); 185 $this->Ln();
175 } 186 }
176 187
177 $row['est_og'] = estimate_sg($sugarsf, floatval($row['batch_size'])); 188 $row['est_og'] = estimate_sg($sugarsf, floatval($row['batch_size']));
178 $preboil_sg = estimate_sg($sugarsm, floatval($row['boil_size'])); 189 $preboil_sg = estimate_sg($sugarsm, floatval($row['boil_size']));
179 $this->SetFillColor(210,245,255); 190 $this->SetFillColor(210,245,255);
180 $this->Cell($vul+62,5,'',0,0,'L',false); 191 $this->Cell($vul+105,5,'',0,0,'L',false);
181 $this->Cell(20,5,sprintf("%8.3f",$total_fermentables),0,0,'R',true); 192 $this->Cell(20,5,sprintf("%.3f",$cost_fermentables).EURO,0,0,'R',true);
182 $this->Cell(30,5,'',0,0,'L',false);
183 $this->Cell(20,5,sprintf("%8.3f",$cost_fermentables).EURO,0,0,'R',true);
184 $this->ProcessingTable=false; 193 $this->ProcessingTable=false;
185 $this->cMargin=$cMargin; 194 $this->cMargin=$cMargin;
186 $this->aCols=array(); 195 $this->aCols=array();
187 $this->Ln(); 196 $this->Ln();
188 } 197 }
192 global $total_ibus; 201 global $total_ibus;
193 global $cost_hops; 202 global $cost_hops;
194 global $preboil_sg; 203 global $preboil_sg;
195 $hopform = array( 'Pellets', 'Plugs', 'Bellen', 'Hop nat' ); 204 $hopform = array( 'Pellets', 'Plugs', 'Bellen', 'Hop nat' );
196 $hopuse = array( 'Maischen', 'First wort', 'Koken', 'Vlamuit', 'Whirlpool', 'Koudhop' ); 205 $hopuse = array( 'Maischen', 'First wort', 'Koken', 'Vlamuit', 'Whirlpool', 'Koudhop' );
197 $vul = $this->w - $this->rMargin - $this->lMargin - 135; 206 $vul = $this->w - $this->rMargin - $this->lMargin - 122;
198 $this->Ln(); 207 $this->Ln();
199 $this->AddCol($vul,'Hop','L'); 208 $this->AddCol($vul,'Hop','L');
200 $this->AddCol(35,'Land','L');
201 $this->AddCol(15,'Soort','L');
202 $this->AddCol(20,'Moment','L');
203 $this->AddCol(15,'Alpha','R'); 209 $this->AddCol(15,'Alpha','R');
204 $this->AddCol(12,'IBU','R'); 210 $this->AddCol(12,'IBU','R');
205 $this->AddCol(18,'Gram','R'); 211 $this->AddCol(25,'Soort','L');
212 $this->AddCol(30,'Gebruik moment','L');
213 $this->AddCol(20,'Hoeveel','R');
206 $this->AddCol(20,'Prijs','R'); 214 $this->AddCol(20,'Prijs','R');
207 215
208 $cMargin=$this->cMargin; 216 $cMargin=$this->cMargin;
209 $this->cMargin=2; 217 $this->cMargin=2;
210 $this->TableX=$this->lMargin; 218 $this->TableX=$this->lMargin;
216 224
217 $arr = json_decode($row['json_hops'], true); 225 $arr = json_decode($row['json_hops'], true);
218 foreach($arr as $item) { //foreach element in $arr 226 foreach($arr as $item) { //foreach element in $arr
219 $name = iconv('UTF-8','windows-1252',$item['h_name']); 227 $name = iconv('UTF-8','windows-1252',$item['h_name']);
220 $origin = iconv('UTF-8','windows-1252',$item['h_origin']); 228 $origin = iconv('UTF-8','windows-1252',$item['h_origin']);
221 $amount = floatval($item['h_amount']) * 1000; 229 $amount = floatval($item['h_amount']);
222 $mass = $amount; 230 $mass = $amount * 1000;
223 $costkg = floatval($item['h_cost']); 231 $costkg = floatval($item['h_cost']);
224 $time = floatval($item['h_time']); 232 $time = floatval($item['h_time']);
225 $alpha = floatval($item['h_alpha']); 233 $alpha = floatval($item['h_alpha']);
226 234
227 $cost = ($amount * $costkg) / 1000; 235 $cost = ($amount * $costkg);
228 $cost_hops += $cost; 236 $cost_hops += $cost;
229 $total_hops += $amount; 237 $total_hops += $amount;
230 238
231 $moment = $hopuse[$item['h_useat']]; 239 $moment = $hopuse[$item['h_useat']];
232 if ($item['h_useat'] == 2) { // Boil 240 if ($item['h_useat'] == 2) { // Boil
233 $moment = "Kook@".$time; 241 $moment = "Koken ".$time." min";
242 } else if ($item['h_useat'] == 5) { // Dryhop
243 $moment = 'Koudhop '.sprintf("%.0f", $time / 1440).' dagen';
234 } 244 }
235 $ibu = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $mass, $time, $alpha, $row['ibu_method']); 245 $ibu = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $mass, $time, $alpha, $row['ibu_method']);
236 $total_ibus += $ibu; 246 $total_ibus += $ibu;
237 247
238 $this->Cell($vul,5,$name,0,0,'L',true); 248 if ($amount > 1)
239 $this->Cell(35,5,$origin,0,0,'L',true); 249 $amount = sprintf("%.3f",$amount).' kg';
240 $this->Cell(15,5,$hopform[$item['h_form']],0,0,'L',true); 250 else
241 $this->Cell(20,5,$moment,0,0,'L',true); 251 $amount = sprintf("%.1f",$amount * 1000).' gr';
252
253 $this->Cell($vul,5,$name.' ('.$origin.')',0,0,'L',true);
242 $this->Cell(15,5,sprintf("%.1f%%",$alpha),0,0,'R',true); 254 $this->Cell(15,5,sprintf("%.1f%%",$alpha),0,0,'R',true);
243 $this->Cell(12,5,sprintf("%.1f",$ibu),0,0,'R',true); 255 $this->Cell(12,5,sprintf("%.1f",$ibu),0,0,'R',true);
244 $this->Cell(18,5,sprintf("%.1f",$amount),0,0,'R',true); 256 $this->Cell(25,5,$hopform[$item['h_form']],0,0,'L',true);
245 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); 257 $this->Cell(30,5,$moment,0,0,'L',true);
258 $this->Cell(20,5,$amount,0,0,'R',true);
259 $this->Cell(20,5,sprintf("%.3f",$cost).EURO,0,0,'R',true);
246 $this->Ln(); 260 $this->Ln();
247 } 261 }
248 262
249 $this->SetFillColor(210,245,255); 263 $this->SetFillColor(210,245,255);
250 $this->Cell($vul+85,5,'',0,0,'L',false); 264 $this->Cell($vul+102,5,'',0,0,'L',false);
251 $this->Cell(12,5,sprintf("%.1f",$total_ibus),0,0,'R',true); 265 $this->Cell(20,5,sprintf("%.3f",$cost_hops).EURO,0,0,'R',true);
252 $this->Cell(18,5,sprintf("%.1f",$total_hops),0,0,'R',true);
253 $this->Cell(20,5,sprintf("%8.3f",$cost_hops).EURO,0,0,'R',true);
254 $this->ProcessingTable=false; 266 $this->ProcessingTable=false;
255 $this->cMargin=$cMargin; 267 $this->cMargin=$cMargin;
256 $this->aCols=array(); 268 $this->aCols=array();
257 $this->Ln(); 269 $this->Ln();
258 } 270 }
260 function TableYeasts($row) { 272 function TableYeasts($row) {
261 global $cost_yeasts; 273 global $cost_yeasts;
262 global $svg; 274 global $svg;
263 $yeastform = array( 'Vloeibaar', 'Droog', 'Schuine buis', 'Slurry', 'Ingevroren', 'Depot' ); 275 $yeastform = array( 'Vloeibaar', 'Droog', 'Schuine buis', 'Slurry', 'Ingevroren', 'Depot' );
264 $yeastuse = array( 'Hoofdgisting', 'Nagisting', 'Lagering', 'Bottelen' ); 276 $yeastuse = array( 'Hoofdgisting', 'Nagisting', 'Lagering', 'Bottelen' );
265 $vul = $this->w - $this->rMargin - $this->lMargin - 140; 277 $vul = $this->w - $this->rMargin - $this->lMargin - 110;
266 $this->Ln(); 278 $this->Ln();
267 $this->AddCol(27,'Laboratorium','L');
268 $this->AddCol(18,'Product','L');
269 $this->AddCol($vul,'Gist','L'); 279 $this->AddCol($vul,'Gist','L');
270 $this->AddCol(20,'Gebruik','L');
271 $this->AddCol(15,'Attn','R'); 280 $this->AddCol(15,'Attn','R');
272 $this->AddCol(22,'Vorm','L'); 281 $this->AddCol(25,'Soort','L');
273 $this->AddCol(18,'Gram','R'); 282 $this->AddCol(30,'Gebruik moment','L');
283 $this->AddCol(20,'Hoeveel','R');
274 $this->AddCol(20,'Prijs','R'); 284 $this->AddCol(20,'Prijs','R');
275 285
276 $cMargin=$this->cMargin; 286 $cMargin=$this->cMargin;
277 $this->cMargin=2; 287 $this->cMargin=2;
278 $this->TableX=$this->lMargin; 288 $this->TableX=$this->lMargin;
298 else if ($item['y_form'] == 1) // Dry 308 else if ($item['y_form'] == 1) // Dry
299 $amount = sprintf("%.1f",floatval($item['y_amount'])*1000)." gr"; 309 $amount = sprintf("%.1f",floatval($item['y_amount'])*1000)." gr";
300 else 310 else
301 $amount = sprintf("%.0f",floatval($item['y_amount'])*1000)." ml"; 311 $amount = sprintf("%.0f",floatval($item['y_amount'])*1000)." ml";
302 312
303 $this->Cell(27,5,$laboratory,0,0,'L',true); 313 $this->Cell($vul,5,$laboratory.' '.$product_id.' ('.$name.')',0,0,'L',true);
304 $this->Cell(18,5,$product_id,0,0,'L',true);
305 $this->Cell($vul,5,$name,0,0,'L',true);
306 $this->Cell(20,5,$yeastuse[$item['y_use']],0,0,'L',true);
307 $this->Cell(15,5,sprintf("%.1f%%",$attenuation),0,0,'R',true); 314 $this->Cell(15,5,sprintf("%.1f%%",$attenuation),0,0,'R',true);
308 $this->Cell(22,5,$yeastform[$item['y_form']],0,0,'L',true); 315 $this->Cell(25,5,$yeastform[$item['y_form']],0,0,'L',true);
309 $this->Cell(18,5,$amount,0,0,'R',true); 316 $this->Cell(30,5,$yeastuse[$item['y_use']],0,0,'L',true);
317 $this->Cell(20,5,$amount,0,0,'R',true);
310 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); 318 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true);
311 $this->Ln(); 319 $this->Ln();
312 } 320 }
313 if ($row['starter_enable']) { 321 if ($row['starter_enable'] && $row['prop1_volume']) {
314 $v = floatval($row['prop1_volume']) + floatval($row['prop2_volume']) + floatval($row['prop3_volume']) + floatval($row['prop4_volume']); 322 $sv = 0;
315 if ($v) { 323 $st = 0;
316 $this->Cell(45,5,'',0,0,'L',true); 324 for ($i = 1; $i < 5; $i++) {
317 $this->Cell($vul,5,"Giststarter ".sprintf("%.2f",$v)." liter",0,0,'L',true); 325 $pv = "prop".$i."_volume";
318 $this->Cell(20,5,"Tevoren",0,0,'L',true); 326 if (floatval($row[$pv])) {
319 $this->Cell(75,5,'',0,0,'L',true); 327 $st++;
320 $this->Ln(); 328 if (floatval($row[$pv]) > $sv)
321 } 329 $sv = floatval($row[$pv]);
330 }
331 }
332 $this->Cell($vul,5,$st." staps giststarter",0,0,'L',true);
333 $this->Cell(40,5,'',0,0,'R',true);
334 $this->Cell(30,5,"Vooraf",0,0,'L',true);
335 $this->Cell(20,5,sprintf("%.2f",$sv)." L",0,0,'R',true);
336 $this->Cell(20,5,'',0,0,'R',true);
337 $this->Ln();
322 } 338 }
323 339
324 $this->SetFillColor(210,245,255); 340 $this->SetFillColor(210,245,255);
325 $this->Cell($vul+120,5,'',0,0,'L',false); 341 $this->Cell($vul+90,5,'',0,0,'L',false);
326 $this->Cell(20,5,sprintf("%8.3f",$cost_yeasts).EURO,0,0,'R',true); 342 $this->Cell(20,5,sprintf("%8.3f",$cost_yeasts).EURO,0,0,'R',true);
327 $this->ProcessingTable=false; 343 $this->ProcessingTable=false;
328 $this->cMargin=$cMargin; 344 $this->cMargin=$cMargin;
329 $this->aCols=array(); 345 $this->aCols=array();
330 $this->Ln(); 346 $this->Ln();
332 348
333 function TableMiscs($row) { 349 function TableMiscs($row) {
334 global $cost_miscs; 350 global $cost_miscs;
335 $misctype = array( 'Specerij', 'Kruid', 'Smaakstof', 'Klaringsmiddel', 'Brouwzout', 'Gistvoeding', 'Anders' ); 351 $misctype = array( 'Specerij', 'Kruid', 'Smaakstof', 'Klaringsmiddel', 'Brouwzout', 'Gistvoeding', 'Anders' );
336 $miscuse = array( 'Starter', 'Maischen', 'Koken', 'Hoofdvergisting', 'Nagisting/lagering', 'Bottelen' ); 352 $miscuse = array( 'Starter', 'Maischen', 'Koken', 'Hoofdvergisting', 'Nagisting/lagering', 'Bottelen' );
337 $vul = $this->w - $this->rMargin - $this->lMargin - 100; 353 $vul = $this->w - $this->rMargin - $this->lMargin - 95;
338 if ($this->GetY() > 200) 354 if ($this->GetY() > 200)
339 $this->AddPage(); 355 $this->AddPage();
340 else 356 else
341 $this->Ln(); 357 $this->Ln();
342 $this->AddCol($vul,'Diversen naam','L'); 358 $this->AddCol($vul,'Diversen naam','L');
343 $this->AddCol(30,'Soort','L'); 359 $this->AddCol(25,'Soort','L');
344 $this->AddCol(30,'Gebruik','L'); 360 $this->AddCol(30,'Gebruik moment','L');
345 $this->AddCol(20,'Hoeveel','R'); 361 $this->AddCol(20,'Hoeveel','R');
346 $this->AddCol(20,'Prijs','R'); 362 $this->AddCol(20,'Prijs','R');
347 363
348 $cMargin=$this->cMargin; 364 $cMargin=$this->cMargin;
349 $this->cMargin=2; 365 $this->cMargin=2;
380 else 396 else
381 $gebruik = $miscuse[$use_use]; 397 $gebruik = $miscuse[$use_use];
382 398
383 $hoeveel = sprintf("%.2f %s",$amount,$aiw ? "gr":"ml"); 399 $hoeveel = sprintf("%.2f %s",$amount,$aiw ? "gr":"ml");
384 $this->Cell($vul,5,$name,0,0,'L',true); 400 $this->Cell($vul,5,$name,0,0,'L',true);
385 $this->Cell(30,5,$misctype[$type],0,0,'L',true); 401 $this->Cell(25,5,$misctype[$type],0,0,'L',true);
386 $this->Cell(30,5,$gebruik,0,0,'L',true); 402 $this->Cell(30,5,$gebruik,0,0,'L',true);
387 $this->Cell(20,5,$hoeveel,0,0,'R',true); 403 $this->Cell(20,5,$hoeveel,0,0,'R',true);
388 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); 404 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true);
389 $this->Ln(); 405 $this->Ln();
390 } 406 }
391 407
392 $this->SetFillColor(210,245,255); 408 $this->SetFillColor(210,245,255);
393 $this->Cell($vul+80,5,'',0,0,'L',false); 409 $this->Cell($vul+75,5,'',0,0,'L',false);
394 $this->Cell(20,5,sprintf("%8.3f",$cost_miscs).EURO,0,0,'R',true); 410 $this->Cell(20,5,sprintf("%8.3f",$cost_miscs).EURO,0,0,'R',true);
395 411
396 $this->ProcessingTable=false; 412 $this->ProcessingTable=false;
397 $this->cMargin=$cMargin; 413 $this->cMargin=$cMargin;
398 $this->aCols=array(); 414 $this->aCols=array();
451 $this->cMargin=$cMargin; 467 $this->cMargin=$cMargin;
452 $this->aCols=array(); 468 $this->aCols=array();
453 $this->Ln(); 469 $this->Ln();
454 } 470 }
455 471
456 // Watercolor $this->SetFillColor(120,255,250); 472 function TableWaters($row) {
473
474 $vul = $this->w - $this->rMargin - $this->lMargin - 137;
475 if ($this->GetY() > 250)
476 $this->AddPage();
477 else
478 $this->Ln();
479 $this->AddCol($vul,'Water bron','L');
480 $this->AddCol(20,'Volume','R');
481 $this->AddCol(15,'Ca','R');
482 $this->AddCol(15,'Mg','R');
483 $this->AddCol(15,'Na','R');
484 $this->AddCol(15,'CaCO3','R');
485 $this->AddCol(15,'Cl','R');
486 $this->AddCol(15,'SO4','R');
487 $this->AddCol(15,'pH','R');
488
489 $cMargin=$this->cMargin;
490 $this->cMargin=2;
491 $this->TableX=$this->lMargin;
492 $this->TableHeader();
493 $this->ProcessingTable=true;
494
495 $this->SetFont('Helvetica','',9);
496 $this->SetFillColor(120, 255, 250);
497
498 $this->Cell($vul,5,$row['w1_name'],0,0,'L',true);
499 $this->Cell(20,5,sprintf("%.1f", $row['w1_amount']).' L',0,0,'R',true);
500 $this->Cell(15,5,sprintf("%.1f", $row['w1_calcium']),0,0,'R',true);
501 $this->Cell(15,5,sprintf("%.1f", $row['w1_magnesium']),0,0,'R',true);
502 $this->Cell(15,5,sprintf("%.1f", $row['w1_sodium']),0,0,'R',true);
503 $this->Cell(15,5,sprintf("%.1f", $row['w1_total_alkalinity']),0,0,'R',true);
504 $this->Cell(15,5,sprintf("%.1f", $row['w1_chloride']),0,0,'R',true);
505 $this->Cell(15,5,sprintf("%.1f", $row['w1_sulfate']),0,0,'R',true);
506 $this->Cell(15,5,sprintf("%.1f", $row['w1_ph']),0,0,'R',true);
507 $this->Ln();
508 $this->Cell($vul,5,$row['w2_name'],0,0,'L',true);
509 $this->Cell(20,5,sprintf("%.1f", $row['w2_amount']).' L',0,0,'R',true);
510 $this->Cell(15,5,sprintf("%.1f", $row['w2_calcium']),0,0,'R',true);
511 $this->Cell(15,5,sprintf("%.1f", $row['w2_magnesium']),0,0,'R',true);
512 $this->Cell(15,5,sprintf("%.1f", $row['w2_sodium']),0,0,'R',true);
513 $this->Cell(15,5,sprintf("%.1f", $row['w2_total_alkalinity']),0,0,'R',true);
514 $this->Cell(15,5,sprintf("%.1f", $row['w2_chloride']),0,0,'R',true);
515 $this->Cell(15,5,sprintf("%.1f", $row['w2_sulfate']),0,0,'R',true);
516 $this->Cell(15,5,sprintf("%.1f", $row['w2_ph']),0,0,'R',true);
517 $this->Ln();
518 $this->Cell($vul,5,'Gemengd water',0,0,'L',true);
519 $this->Cell(20,5,sprintf("%.1f", $row['wg_amount']).' L',0,0,'R',true);
520 $this->Cell(15,5,sprintf("%.1f", $row['wg_calcium']),0,0,'R',true);
521 $this->Cell(15,5,sprintf("%.1f", $row['wg_magnesium']),0,0,'R',true);
522 $this->Cell(15,5,sprintf("%.1f", $row['wg_sodium']),0,0,'R',true);
523 $this->Cell(15,5,sprintf("%.1f", $row['wg_total_alkalinity']),0,0,'R',true);
524 $this->Cell(15,5,sprintf("%.1f", $row['wg_chloride']),0,0,'R',true);
525 $this->Cell(15,5,sprintf("%.1f", $row['wg_sulfate']),0,0,'R',true);
526 $this->Cell(15,5,sprintf("%.1f", $row['wg_ph']),0,0,'R',true);
527 $this->Ln();
528 $this->Cell($vul,5,'Behandeld water',0,0,'L',true);
529 $this->Cell(20,5,'',0,0,'R',true);
530 $this->Cell(15,5,sprintf("%.1f", $row['wb_calcium']),0,0,'R',true);
531 $this->Cell(15,5,sprintf("%.1f", $row['wb_magnesium']),0,0,'R',true);
532 $this->Cell(15,5,sprintf("%.1f", $row['wb_sodium']),0,0,'R',true);
533 $this->Cell(15,5,sprintf("%.1f", $row['wb_total_alkalinity']),0,0,'R',true);
534 $this->Cell(15,5,sprintf("%.1f", $row['wb_chloride']),0,0,'R',true);
535 $this->Cell(15,5,sprintf("%.1f", $row['wb_sulfate']),0,0,'R',true);
536 $this->Cell(15,5,sprintf("%.1f", $row['wb_ph']),0,0,'R',true);
537 $this->ProcessingTable=false;
538 $this->cMargin=$cMargin;
539 $this->aCols=array();
540 $this->Ln();
541 }
457 542
458 function TableSummary($row) { 543 function TableSummary($row) {
459 global $pSugar; 544 global $pSugar;
460 global $pCara; 545 global $pCara;
461 global $svg; 546 global $svg;
716 } 801 }
717 $sugardensity = 1.611; 802 $sugardensity = 1.611;
718 $v = $msugars / $sugardensity + $mvol; 803 $v = $msugars / $sugardensity + $mvol;
719 $plato = 1000 * $msugars / ($v * 10); // deg. Plato 804 $plato = 1000 * $msugars / ($v * 10); // deg. Plato
720 $mash_sg = plato_to_sg($plato); 805 $mash_sg = plato_to_sg($plato);
721 $brix = $plato * $my_brix_correction; 806 $this->Checkline('doel SG eind maischen: '.density_str($mash_sg));
722 $s = 'doel sg eind maischen: '.sprintf("%.3f",$mash_sg);
723 $s .= ' SG ('.sprintf("%.1f",$brix).' '.DEG.'Brix, '.sprintf("%.1f",$plato).' '.DEG.'P)';
724 $this->Checkline($s);
725 } 807 }
726 if ($this->GetY() > 200) 808 if ($this->GetY() > 200)
727 $this->AddPage(); 809 $this->AddPage();
728 else 810 else
729 $this->Ln(5); 811 $this->Ln(5);
739 $this->Checkline('spoelen met ongeveer '.sprintf("%.1f",$spoelw).' liter spoelwater'); 821 $this->Checkline('spoelen met ongeveer '.sprintf("%.1f",$spoelw).' liter spoelwater');
740 $s = 'doelvolume in kookketel: '.sprintf("%.1f",$row['boil_size'] * 1.04).' liter ('; 822 $s = 'doelvolume in kookketel: '.sprintf("%.1f",$row['boil_size'] * 1.04).' liter (';
741 $s .= sprintf("%.1f",kettle_cm($row['boil_size'] * 1.04,$row['eq_kettle_volume'],$row['eq_kettle_height'])).' cm onder de rand)'; 823 $s .= sprintf("%.1f",kettle_cm($row['boil_size'] * 1.04,$row['eq_kettle_volume'],$row['eq_kettle_height'])).' cm onder de rand)';
742 $this->Checkline($s); 824 $this->Checkline($s);
743 $pre_sg = estimate_sg($msugars * floatval($row['efficiency']) / 100,floatval($row['boil_size'])); 825 $pre_sg = estimate_sg($msugars * floatval($row['efficiency']) / 100,floatval($row['boil_size']));
744 $plato = sg_to_plato($pre_sg); 826 $this->Checkline('doel SG in kookketel: '.density_str($pre_sg));
745 $brix = $plato * $my_brix_correction;
746 $s = 'doel SG in kookketel: '.sprintf("%.3f",$pre_sg).' SG ('.sprintf("%.1f",$brix).' '.DEG.'Brix, '.sprintf("%.1f",$plato).' '.DEG.'P)';
747 $this->Checkline($s);
748 $hops = json_decode($row['json_hops'], true); 827 $hops = json_decode($row['json_hops'], true);
749 foreach($hops as $item2) { 828 foreach($hops as $item2) {
750 if ($item2['h_useat'] == 1) { 829 if ($item2['h_useat'] == 1) {
751 $s = sprintf("%.1f",$item2['h_amount']*1000).' gr '; 830 $s = sprintf("%.1f",$item2['h_amount']*1000).' gr ';
752 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).' toevoegen na het spoelen'; 831 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).' toevoegen na het spoelen';
801 } 880 }
802 $s = 'doelvolume einde koken: '.sprintf("%.1f",$row['batch_size']*1.04).' liter ('; 881 $s = 'doelvolume einde koken: '.sprintf("%.1f",$row['batch_size']*1.04).' liter (';
803 $s .= sprintf("%.1f",kettle_cm($row['batch_size']*1.04,$row['eq_kettle_volume'],$row['eq_kettle_height'])); 882 $s .= sprintf("%.1f",kettle_cm($row['batch_size']*1.04,$row['eq_kettle_volume'],$row['eq_kettle_height']));
804 $s .= ' cm onder de rand)'; 883 $s .= ' cm onder de rand)';
805 $this->Checkline($s); 884 $this->Checkline($s);
806 $plato = sg_to_plato($row['est_og']); 885 $this->Checkline('doel SG einde koken: '.density_str($row['est_og']));
807 $brix = $plato * $my_brix_correction;
808 $s = 'doel SG einde koken: '.sprintf("%.3f",$row['est_og']).' SG (';
809 $s .= sprintf("%.1f",$brix).' '.DEG.'Brix, '.sprintf("%.1f",$plato).' '.DEG.'P)';
810 $this->Checkline($s);
811 if ($this->GetY() > 200) 886 if ($this->GetY() > 200)
812 $this->AddPage(); 887 $this->AddPage();
813 else 888 else
814 $this->Ln(5); 889 $this->Ln(5);
815 890
932 $this->SetX($this->TableX); 1007 $this->SetX($this->TableX);
933 $this->Cell(35,5,'Datum eind',0,0,'L',true); 1008 $this->Cell(35,5,'Datum eind',0,0,'L',true);
934 $this->Cell(50,5,$row['brew_date_end'],0,0,'L',true); 1009 $this->Cell(50,5,$row['brew_date_end'],0,0,'L',true);
935 $this->Cell($vul,5,'',0,0,'L',false); 1010 $this->Cell($vul,5,'',0,0,'L',false);
936 $this->Cell(35,5,'Maisch densiteit',0,0,'L',true); 1011 $this->Cell(35,5,'Maisch densiteit',0,0,'L',true);
937 $plato = sg_to_plato(floatval($row['brew_mash_sg'])); 1012 $this->Cell(50,5,density_str(floatval($row['brew_mash_sg'])),0,0,'L',true);
938 $brix = $plato * $my_brix_correction; 1013 $this->Ln();
939 $this->Cell(50,5,sprintf("%.3f", floatval($row['brew_mash_sg']))." SG ".sprintf("%.1f",$brix).DEG.'Brix '.sprintf("%.1f",$plato).DEG.'P',0,0,'L',true); 1014
940 $this->Ln();
941
942 $infuse = $mvol = floatval($row['w1_amount']) + floatval($row['w2_amount']);
943 $msugars = 0;
944 $bsugars = 0;
945 $mashkg = 0;
946 $ferms = json_decode($row['json_fermentables'], true);
947 foreach($ferms as $item) {
948 if ($item['f_added'] == 0) { // Mash
949 $msugars += floatval($item['f_amount']) * (floatval($item['f_yield']) / 100) * (1 - floatval($item['f_moisture']) / 100);
950 $mvol += floatval($item['f_amount']) * floatval($item['f_moisture']) / 100;
951 $mashkg += floatval($item['f_amount']);
952 }
953 if ($item['f_added'] == 1) { // Boil
954 $bsugars += floatval($item['f_amount']) * (floatval($item['f_yield']) / 100) * (1 - floatval($item['f_moisture']) / 100);
955 }
956 }
957 $sugardensity = 1.611;
958 $v = $msugars / $sugardensity + $mvol;
959 $plato = 1000 * $msugars / ($v * 10);
960 if ($plato > 0.5)
961 $e = 100 * sg_to_plato(floatval($row['brew_mash_sg'])) / $plato;
962 else
963 $e = 0;
964 $this->SetX($this->TableX); 1015 $this->SetX($this->TableX);
965 $this->Cell(85+$vul,5,'',0,0,'L',false); 1016 $this->Cell(85+$vul,5,'',0,0,'L',false);
966 $this->Cell(35,5,'Maisch rendement',0,0,'L',true); 1017 $this->Cell(35,5,'Maisch rendement',0,0,'L',true);
967 $this->Cell(50,5,sprintf("%.1f", $e)."%",0,0,'L',true); 1018 $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_mash_efficiency']))."%",0,0,'L',true);
968 $this->Ln(7); 1019 $this->Ln(7);
969 1020
970 $this->SetX($this->TableX); 1021 $this->SetX($this->TableX);
971 $this->Cell(35,5,'Voor koken zuurgraad',0,0,'L',true); 1022 $this->Cell(35,5,'Voor koken zuurgraad',0,0,'L',true);
972 $this->Cell(50,5,sprintf("%.1f", $row['brew_preboil_ph'])." pH",0,0,'L',true); 1023 $this->Cell(50,5,sprintf("%.1f", $row['brew_preboil_ph'])." pH",0,0,'L',true);
975 $this->Cell(50,5,sprintf("%.1f", $row['brew_aboil_ph'])." pH",0,0,'L',true); 1026 $this->Cell(50,5,sprintf("%.1f", $row['brew_aboil_ph'])." pH",0,0,'L',true);
976 $this->Ln(); 1027 $this->Ln();
977 1028
978 $this->SetX($this->TableX); 1029 $this->SetX($this->TableX);
979 $this->Cell(35,5,'Voor koken densiteit',0,0,'L',true); 1030 $this->Cell(35,5,'Voor koken densiteit',0,0,'L',true);
980 $plato = sg_to_plato(floatval($row['brew_preboil_sg'])); 1031 $this->Cell(50,5,density_str(floatval($row['brew_preboil_sg'])),0,0,'L',true);
981 $brix = $plato * $my_brix_correction;
982 $this->Cell(50,5,sprintf("%.3f", floatval($row['brew_preboil_sg']))." SG ".sprintf("%.1f",$brix).DEG.'Brix '.sprintf("%.1f",$plato).DEG.'P',0,0,'L',true);
983 $this->Cell($vul,5,'',0,0,'L',false); 1032 $this->Cell($vul,5,'',0,0,'L',false);
984 $this->Cell(35,5,'Na koken densiteit',0,0,'L',true); 1033 $this->Cell(35,5,'Na koken densiteit',0,0,'L',true);
985 $plato = sg_to_plato(floatval($row['brew_aboil_sg'])); 1034 $this->Cell(50,5,density_str(floatval($row['brew_aboil_sg'])),0,0,'L',true);
986 $brix = $plato * $my_brix_correction;
987 $this->Cell(50,5,sprintf("%.3f", floatval($row['brew_aboil_sg']))." SG ".sprintf("%.1f",$brix).DEG.'Brix '.sprintf("%.1f",$plato).DEG.'P',0,0,'L',true);
988 $this->Ln(); 1035 $this->Ln();
989 1036
990 $this->SetX($this->TableX); 1037 $this->SetX($this->TableX);
991 $this->Cell(35,5,'Voor koken volume',0,0,'L',true); 1038 $this->Cell(35,5,'Voor koken volume',0,0,'L',true);
992 $this->Cell(50,5,sprintf("%.1f", $row['brew_preboil_volume'])." liter",0,0,'L',true); 1039 $this->Cell(50,5,sprintf("%.1f", $row['brew_preboil_volume'])." liter",0,0,'L',true);
995 $this->Cell(50,5,sprintf("%.1f", $row['brew_aboil_volume'])." liter",0,0,'L',true); 1042 $this->Cell(50,5,sprintf("%.1f", $row['brew_aboil_volume'])." liter",0,0,'L',true);
996 $this->Ln(); 1043 $this->Ln();
997 1044
998 $this->SetX($this->TableX); 1045 $this->SetX($this->TableX);
999 $this->Cell(35,5,'Voor koken rendement',0,0,'L',true); 1046 $this->Cell(35,5,'Voor koken rendement',0,0,'L',true);
1000 $tot = sg_to_plato(floatval($row['brew_preboil_sg'])) * (floatval($row['brew_preboil_volume']) / 1.04) * floatval($row['brew_preboil_sg']) * 10 / 1000; 1047 $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_preboil_efficiency']))."%",0,0,'L',true);
1001 $result = 0;
1002 if ($msugars > 0)
1003 $result = (($tot / $msugars * 100) * 10) / 10;
1004 if ($result < 0)
1005 $result = 0;
1006 $this->Cell(50,5,sprintf("%.1f", $result)."%",0,0,'L',true);
1007 $this->Cell($vul,5,'',0,0,'L',false); 1048 $this->Cell($vul,5,'',0,0,'L',false);
1008 $this->Cell(35,5,'Na koken rendement',0,0,'L',true); 1049 $this->Cell(35,5,'Na koken rendement',0,0,'L',true);
1009 $tot = sg_to_plato(floatval($row['brew_aboil_sg'])) * (floatval($row['brew_aboil_volume']) / 1.04) * floatval($row['brew_aboil_sg']) * 10 / 1000; 1050 $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_aboil_efficiency']))."%",0,0,'L',true);
1010 $tot -= $bsugars;
1011 $result = 0;
1012 if ($msugars > 0)
1013 $result = (($tot / $msugars * 100) * 10) / 10;
1014 if ($result < 0)
1015 $result = 0;
1016 $this->Cell(50,5,sprintf("%.1f", $result)."%",0,0,'L',true);
1017 $this->Ln(7); 1051 $this->Ln(7);
1018 1052
1019 $coolingtype = array( '-', 'Dompelkoeler', 'Tegenstroomkoeler', 'Au bain marie', 'Laten afkoelen' ); 1053 $coolingtype = array( '-', 'Dompelkoeler', 'Tegenstroomkoeler', 'Au bain marie', 'Laten afkoelen' );
1020 $this->SetX($this->TableX); 1054 $this->SetX($this->TableX);
1021 $this->Cell(35,5,'Spoelwater temperatuur',0,0,'L',true); 1055 $this->Cell(35,5,'Spoelwater temperatuur',0,0,'L',true);
1023 $this->Cell($vul,5,'',0,0,'L',false); 1057 $this->Cell($vul,5,'',0,0,'L',false);
1024 $this->Cell(35,5,'Koel methode',0,0,'L',true); 1058 $this->Cell(35,5,'Koel methode',0,0,'L',true);
1025 $this->Cell(50,5,$coolingtype[$row['brew_cooling_method']],0,0,'L',true); 1059 $this->Cell(50,5,$coolingtype[$row['brew_cooling_method']],0,0,'L',true);
1026 $this->Ln(); 1060 $this->Ln();
1027 1061
1028 $spoelw = (floatval($row['boil_size']) - $infuse + ($mashkg * $my_grain_absorbtion) + floatval($row['eq_lauter_deadspace'])) * 1.03; 1062 $this->SetX($this->TableX);
1029 $this->SetX($this->TableX); 1063 $this->Cell(35,5,'Spoelwater geschat',0,0,'L',true);
1030 $this->Cell(35,5,'Spoelwater volume',0,0,'L',true); 1064 $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_sparge_est'])).' liter',0,0,'L',true);
1031 $this->Cell(50,5,sprintf("%.1f", $spoelw).' liter',0,0,'L',true);
1032 $this->Cell($vul,5,'',0,0,'L',false); 1065 $this->Cell($vul,5,'',0,0,'L',false);
1033 $this->Cell(35,5,'Koel temperatuur',0,0,'L',true); 1066 $this->Cell(35,5,'Koel temperatuur',0,0,'L',true);
1034 $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_cooling_to'])).DEG.'C',0,0,'L',true); 1067 $this->Cell(50,5,sprintf("%.1f", floatval($row['brew_cooling_to'])).DEG.'C',0,0,'L',true);
1035 $this->Ln(); 1068 $this->Ln();
1036 1069
1069 $this->SetX($this->TableX); 1102 $this->SetX($this->TableX);
1070 $this->Cell(35,5,'Whirlpool koud',0,0,'L',true); 1103 $this->Cell(35,5,'Whirlpool koud',0,0,'L',true);
1071 $this->Cell(50,5,sprintf("%.0f", $row['brew_whirlpool2']).' minuten',0,0,'L',true); 1104 $this->Cell(50,5,sprintf("%.0f", $row['brew_whirlpool2']).' minuten',0,0,'L',true);
1072 $this->Cell($vul,5,'',0,0,'L',false); 1105 $this->Cell($vul,5,'',0,0,'L',false);
1073 $this->Cell(35,5,'Densiteit in gistvat',0,0,'L',true); 1106 $this->Cell(35,5,'Densiteit in gistvat',0,0,'L',true);
1074 $this->Cell(50,5,sprintf("%.3f", floatval($row['brew_fermenter_sg'])).' SG',0,0,'L',true); 1107 $this->Cell(50,5,density_str(floatval($row['brew_fermenter_sg'])),0,0,'L',true);
1075 $this->Ln(7); 1108 $this->Ln(7);
1076 1109
1077 $aerationtype = array( 'Geen', 'Lucht', 'Zuurstof' ); 1110 $aerationtype = array( 'Geen', 'Lucht', 'Zuurstof' );
1078 $this->SetX($this->TableX); 1111 $this->SetX($this->TableX);
1079 $this->Cell(35,5,'Beluchten met',0,0,'L',true); 1112 $this->Cell(35,5,'Beluchten met',0,0,'L',true);
1132 $pdf->TableFermentables($row); 1165 $pdf->TableFermentables($row);
1133 $pdf->TableHops($row); 1166 $pdf->TableHops($row);
1134 $pdf->TableYeasts($row); 1167 $pdf->TableYeasts($row);
1135 $pdf->TableMiscs($row); 1168 $pdf->TableMiscs($row);
1136 $pdf->TableMashs($row); 1169 $pdf->TableMashs($row);
1170 $pdf->TableWaters($row);
1137 $pdf->TableSummary($row); 1171 $pdf->TableSummary($row);
1138 if (strlen($row['notes'])) { 1172 if (strlen($row['notes'])) {
1139 if ($pdf->GetY() > 200) 1173 if ($pdf->GetY() > 200)
1140 $pdf->AddPage(); 1174 $pdf->AddPage();
1141 else 1175 else

mercurial