www/rec_print.php

changeset 84
3e5e87f1818d
parent 83
85521c6e0022
child 85
ca7a37586551
equal deleted inserted replaced
83:85521c6e0022 84:3e5e87f1818d
115 $this->SetFillColor(210,245,255); 115 $this->SetFillColor(210,245,255);
116 $this->Cell($vul,5,'',0,0,'L',false); 116 $this->Cell($vul,5,'',0,0,'L',false);
117 $this->Cell(35,5,'Bitterheid ('.$row['ibu_method'].')',0,0,'L',true); 117 $this->Cell(35,5,'Bitterheid ('.$row['ibu_method'].')',0,0,'L',true);
118 $this->Cell(25,5,sprintf("%.0f",$row['est_ibu']).' IBU',0,0,'L',true); 118 $this->Cell(25,5,sprintf("%.0f",$row['est_ibu']).' IBU',0,0,'L',true);
119 $this->Cell(25,5,'('.$row['st_ibu_min'].' - '.$row['st_ibu_max'].' IBU)',0,0,'L',true); 119 $this->Cell(25,5,'('.$row['st_ibu_min'].' - '.$row['st_ibu_max'].' IBU)',0,0,'L',true);
120 $this->Ln(); 120 $this->Ln(10);
121 121
122 $this->cMargin=$cMargin; 122 $this->cMargin=$cMargin;
123 } 123 }
124 124
125 function TableFermentables($row) { 125 function TableFermentables($row) {
126 global $cost_fermentables; 126 global $cost_fermentables;
127 global $total_fermentables; 127 global $total_fermentables;
128 $vul = $this->w - $this->rMargin - $this->lMargin - 130; 128 $vul = $this->w - $this->rMargin - $this->lMargin - 132;
129 $this->AddCol($vul,'Grondstof','L'); 129 $this->AddCol($vul,'Grondstof','L');
130 $this->AddCol(30,'Leverancier','L'); 130 $this->AddCol(30,'Leverancier','L');
131 $this->AddCol(15,'EBC','R'); 131 $this->AddCol(15,'EBC','R');
132 $this->AddCol(15,'Moment','L'); 132 $this->AddCol(17,'Moment','L');
133 $this->AddCol(20,'Kg','R'); 133 $this->AddCol(20,'Kg','R');
134 $this->AddCol(15,'Procent','R'); 134 $this->AddCol(15,'Procent','R');
135 $this->AddCol(15,'Opbr.','R'); 135 $this->AddCol(15,'Opbr.','R');
136 $this->AddCol(20,'Prijs','R'); 136 $this->AddCol(20,'Prijs','R');
137 137
146 146
147 $arr = json_decode($row['json_fermentables'], true); 147 $arr = json_decode($row['json_fermentables'], true);
148 foreach($arr as $item) { //foreach element in $arr 148 foreach($arr as $item) { //foreach element in $arr
149 $name = iconv('UTF-8','windows-1252',$item['f_name']); 149 $name = iconv('UTF-8','windows-1252',$item['f_name']);
150 $supplier = iconv('UTF-8','windows-1252',$item['f_supplier']); 150 $supplier = iconv('UTF-8','windows-1252',$item['f_supplier']);
151 $added = iconv('UTF-8','windows-1252',$item['f_added']);
151 $amount = floatval($item['f_amount']); 152 $amount = floatval($item['f_amount']);
152 $costkg = floatval($item['f_cost']); 153 $costkg = floatval($item['f_cost']);
153 $yield = floatval($item['f_yield']); 154 $yield = floatval($item['f_yield']);
154 $color = floatval($item['f_color']); 155 $color = floatval($item['f_color']);
155 $percent = floatval($item['f_percentage']); 156 $percent = floatval($item['f_percentage']);
156 if ($item['f_added'] == "Boil")
157 $add = "Koken";
158 else if ($item['f_added'] == "Mash")
159 $add = "Maisch";
160 else
161 $add = $item['f_added'];
162 $cost = $amount * $costkg; 157 $cost = $amount * $costkg;
163 $cost_fermentables += $cost; 158 $cost_fermentables += $cost;
164 $total_fermentables += $amount; 159 $total_fermentables += $amount;
165 $this->Cell($vul,5,$name,0,0,'L',true); 160 $this->Cell($vul,5,$name,0,0,'L',true);
166 $this->Cell(30,5,$supplier,0,0,'L',true); 161 $this->Cell(30,5,$supplier,0,0,'L',true);
167 $this->Cell(15,5,sprintf("%.0f",$color),0,0,'R',true); 162 $this->Cell(15,5,sprintf("%.0f",$color),0,0,'R',true);
168 $this->Cell(15,5,$add,0,0,'L',true); 163 $this->Cell(17,5,added_type_names($added),0,0,'L',true);
169 $this->Cell(20,5,sprintf("%8.3f",$amount),0,0,'R',true); 164 $this->Cell(20,5,sprintf("%8.3f",$amount),0,0,'R',true);
170 $this->Cell(15,5,sprintf("%.1f%%",$percent),0,0,'R',true); 165 $this->Cell(15,5,sprintf("%.1f%%",$percent),0,0,'R',true);
171 $this->Cell(15,5,sprintf("%.1f%%",$yield),0,0,'R',true); 166 $this->Cell(15,5,sprintf("%.1f%%",$yield),0,0,'R',true);
172 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); 167 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true);
173 $this->Ln(); 168 $this->Ln();
174 } 169 }
175 170
176 $this->SetFillColor(210,245,255); 171 $this->SetFillColor(210,245,255);
177 $this->Cell($vul+60,5,'',0,0,'L',false); 172 $this->Cell($vul+62,5,'',0,0,'L',false);
178 $this->Cell(20,5,sprintf("%8.3f",$total_fermentables),0,0,'R',true); 173 $this->Cell(20,5,sprintf("%8.3f",$total_fermentables),0,0,'R',true);
179 $this->Cell(30,5,'',0,0,'L',false); 174 $this->Cell(30,5,'',0,0,'L',false);
180 $this->Cell(20,5,sprintf("%8.3f",$cost_fermentables).EURO,0,0,'R',true); 175 $this->Cell(20,5,sprintf("%8.3f",$cost_fermentables).EURO,0,0,'R',true);
181 $this->Ln(); 176 $this->Ln(10);
182 $this->ProcessingTable=false; 177 $this->ProcessingTable=false;
183 $this->cMargin=$cMargin; 178 $this->cMargin=$cMargin;
184 $this->aCols=array(); 179 $this->aCols=array();
185 } 180 }
186 181
221 $cost = ($amount * $costkg) / 1000; 216 $cost = ($amount * $costkg) / 1000;
222 $cost_hops += $cost; 217 $cost_hops += $cost;
223 $total_hops += $amount; 218 $total_hops += $amount;
224 219
225 $fmoment = 1.0; 220 $fmoment = 1.0;
226 $moment = "Kook@".$time; 221 $moment = hop_useat_names($useat);
227 if (($useat == "Dry Hop") || ($useat == "Dry hop")) { 222 if (($useat == "Dry Hop") || ($useat == "Dry hop")) {
228 $fmoment = 0.0; 223 $fmoment = 0.0;
229 $moment = "Dry-hop";
230 } else if ($useat == "Whirlpool") { 224 } else if ($useat == "Whirlpool") {
231 $fmoment = 0.0; 225 $fmoment = 0.0;
232 $moment = "Whirlpool";
233 } else if ($useat == "Mash") { 226 } else if ($useat == "Mash") {
234 $fmoment = 0.7; // Brouwhulp 227 $fmoment = 0.7; // Brouwhulp
235 $moment = "Maischen";
236 } else if (($useat == "First Wort") || ($useat == "First wort")) { 228 } else if (($useat == "First Wort") || ($useat == "First wort")) {
237 $fmoment = 1.1; // Brouwhulp, Louis, Ozzie 229 $fmoment = 1.1; // Brouwhulp, Louis, Ozzie
238 $moment = "First wort";
239 } else if ($useat == "Aroma") { 230 } else if ($useat == "Aroma") {
240 $fmoment = 0.0; // Brouwhulp 1.0 redeneert vlamuit. 231 $fmoment = 0.0; // Brouwhulp 1.0 redeneert vlamuit.
241 $moment = "Vlamuit"; 232 } else if ($useat == "Boil") {
233 $fmoment = 1.0;
234 $moment = "Kook@".$time;
242 } 235 }
243 236
244 $pfactor = 1.0; 237 $pfactor = 1.0;
245 if ($form == "Pellet") { 238 if ($form == "Pellet") {
246 $pfactor = 1.1; 239 $pfactor = 1.1;
253 $utiisation = $Bigness_factor * $BoilTime_factor; 246 $utiisation = $Bigness_factor * $BoilTime_factor;
254 $ibu = (round($utiisation * $AddedAlphaAcids * $fmoment * $pfactor * 10) / 10.0); 247 $ibu = (round($utiisation * $AddedAlphaAcids * $fmoment * $pfactor * 10) / 10.0);
255 248
256 $this->Cell($vul,5,$name,0,0,'L',true); 249 $this->Cell($vul,5,$name,0,0,'L',true);
257 $this->Cell(35,5,$origin,0,0,'L',true); 250 $this->Cell(35,5,$origin,0,0,'L',true);
258 $this->Cell(15,5,$form,0,0,'L',true); 251 $this->Cell(15,5,hop_form_names($form),0,0,'L',true);
259 $this->Cell(20,5,$moment,0,0,'L',true); 252 $this->Cell(20,5,$moment,0,0,'L',true);
260 $this->Cell(15,5,sprintf("%.1f%%",$alpha),0,0,'R',true); 253 $this->Cell(15,5,sprintf("%.1f%%",$alpha),0,0,'R',true);
261 $this->Cell(12,5,sprintf("%.1f",$ibu),0,0,'R',true); 254 $this->Cell(12,5,sprintf("%.1f",$ibu),0,0,'R',true);
262 $this->Cell(18,5,sprintf("%.1f",$amount),0,0,'R',true); 255 $this->Cell(18,5,sprintf("%.1f",$amount),0,0,'R',true);
263 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); 256 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true);
266 259
267 $this->SetFillColor(210,245,255); 260 $this->SetFillColor(210,245,255);
268 $this->Cell($vul+97,5,'',0,0,'L',false); 261 $this->Cell($vul+97,5,'',0,0,'L',false);
269 $this->Cell(18,5,sprintf("%.1f",$total_hops),0,0,'R',true); 262 $this->Cell(18,5,sprintf("%.1f",$total_hops),0,0,'R',true);
270 $this->Cell(20,5,sprintf("%8.3f",$cost_hops).EURO,0,0,'R',true); 263 $this->Cell(20,5,sprintf("%8.3f",$cost_hops).EURO,0,0,'R',true);
271 $this->Ln(); 264 $this->Ln(10);
272 $this->ProcessingTable=false; 265 $this->ProcessingTable=false;
273 $this->cMargin=$cMargin; 266 $this->cMargin=$cMargin;
274 $this->aCols=array(); 267 $this->aCols=array();
275 } 268 }
276 269
307 $costg = floatval($item['y_cost']); 300 $costg = floatval($item['y_cost']);
308 $attenuation = floatval($item['y_attenuation']); 301 $attenuation = floatval($item['y_attenuation']);
309 $cost = $amount * $costg; 302 $cost = $amount * $costg;
310 $cost_yeasts += $cost; 303 $cost_yeasts += $cost;
311 304
312 if ($use == "Primary") { 305 if ($use == "Primary")
313 $svg = $attenuation; 306 $svg = $attenuation;
314 $gebruik = 'Hoofdgist';
315 } else if ($use == "Bottle")
316 $gebruik = 'Bottelgist';
317 else
318 $gebruik = $use;
319
320 if ($form == "Liquid")
321 $vorm = 'Vloeibaar';
322 else if ($form == "Dry")
323 $vorm = 'Droog';
324 else if ($form == "Slant")
325 $vorm = 'Schuine buis';
326 else if ($form == "Culture")
327 $vorm = 'Slurry';
328 else if ($form == "Frozen")
329 $vorm = 'Ingevroren';
330 else if ($form == "Bottel")
331 $vorm = 'Depot';
332 else
333 $vorm = $form;
334 307
335 $this->Cell(27,5,$laboratory,0,0,'L',true); 308 $this->Cell(27,5,$laboratory,0,0,'L',true);
336 $this->Cell(18,5,$product_id,0,0,'L',true); 309 $this->Cell(18,5,$product_id,0,0,'L',true);
337 $this->Cell($vul,5,$name,0,0,'L',true); 310 $this->Cell($vul,5,$name,0,0,'L',true);
338 $this->Cell(20,5,$gebruik,0,0,'L',true); 311 $this->Cell(20,5,yeast_use_names($use),0,0,'L',true);
339 $this->Cell(15,5,sprintf("%.1f%%",$attenuation),0,0,'R',true); 312 $this->Cell(15,5,sprintf("%.1f%%",$attenuation),0,0,'R',true);
340 $this->Cell(22,5,$vorm,0,0,'L',true); 313 $this->Cell(22,5,yeast_form_names($form),0,0,'L',true);
341 $this->Cell(18,5,sprintf("%.1f",$amount),0,0,'R',true); 314 $this->Cell(18,5,sprintf("%.1f",$amount),0,0,'R',true);
342 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true); 315 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true);
343 $this->Ln(); 316 $this->Ln();
344 } 317 }
345 318
349 $this->Ln(); 322 $this->Ln();
350 323
351 $og = floatval($row['est_og']); 324 $og = floatval($row['est_og']);
352 $fg = $og - ($svg * ($og - 1.0)) / 100; 325 $fg = $og - ($svg * ($og - 1.0)) / 100;
353 $this->Cell(0,5,'FG: '.sprintf("%5.3f",$fg),0,0,'L',false); 326 $this->Cell(0,5,'FG: '.sprintf("%5.3f",$fg),0,0,'L',false);
354 $this->Ln(); 327 $this->Ln(10);
355 $this->ProcessingTable=false; 328 $this->ProcessingTable=false;
356 $this->cMargin=$cMargin; 329 $this->cMargin=$cMargin;
357 $this->aCols=array(); 330 $this->aCols=array();
358 } 331 }
359 332
360 /*
361 MiscColor:= RGBtoColor(240, 250, 65);
362 WaterAgentColor:= RGBtoColor(240, 140, 130);
363 FiningColor:= RGBtoColor(95, 180, 25);
364 WaterColor:= RGBtoColor(120, 255, 250);
365 */
366 function TableMiscs($row) { 333 function TableMiscs($row) {
367 global $cost_miscs; 334 global $cost_miscs;
368 $vul = $this->w - $this->rMargin - $this->lMargin - 135; 335 $vul = $this->w - $this->rMargin - $this->lMargin - 95;
369 } 336 $this->AddCol($vul,'Naam','L');
337 $this->AddCol(30,'Soort','L');
338 $this->AddCol(25,'Gebruik','L');
339 $this->AddCol(20,'Hoeveel','R');
340 $this->AddCol(20,'Prijs','R');
341
342 $cMargin=$this->cMargin;
343 $this->cMargin=2;
344 $this->TableX=$this->lMargin;
345 $this->TableHeader();
346 $this->ProcessingTable=true;
347
348 $this->SetFont('Helvetica','',9);
349 $this->SetFillColor(175, 175, 255);
350
351 $arr = json_decode($row['json_miscs'], true);
352 foreach($arr as $item) {
353 $name = iconv('UTF-8','windows-1252',$item['m_name']);
354 $type = iconv('UTF-8','windows-1252',$item['m_type']);
355 $use_use = iconv('UTF-8','windows-1252',$item['m_use_use']);
356 $amount = floatval($item['m_amount']) * 1000;
357 $costg = floatval($item['m_cost']) / 1000;
358 $time = floatval($item['m_time']);
359 $aiw = $item['m_amount_is_weight'];
360 $cost = $amount * $costg;
361 $cost_miscs += $cost;
362
363 if ($type == "Water agent")
364 $this->SetFillColor(240,140,130);
365 else if ($type == "Fining")
366 $this->SetFillColor(95,180,25);
367 else if (($type == "Spice") || ($type == "Herb") || ($type == "Flavor") || ($type == "Yeast nutrient"))
368 $this->SetFillColor(240,250,65);
369 else
370 $this->SetFillColor(210,245,255);
371
372 if ($use_use == "Boil")
373 $gebruik = sprintf("%s %d min",misc_use_names($use_use),$time);
374 else
375 $gebruik = misc_use_names($use_use);
376
377 $hoeveel = sprintf("%.1f %s",$amount,$aiw ? "gr":"ml");
378 $this->Cell($vul,5,$name,0,0,'L',true);
379 $this->Cell(30,5,misc_type_names($type),0,0,'L',true);
380 $this->Cell(25,5,$gebruik,0,0,'L',true);
381 $this->Cell(20,5,$hoeveel,0,0,'R',true);
382 $this->Cell(20,5,sprintf("%8.3f",$cost).EURO,0,0,'R',true);
383 $this->Ln();
384 }
385
386 $this->SetFillColor(210,245,255);
387 $this->Cell($vul+75,5,'',0,0,'L',false);
388 $this->Cell(20,5,sprintf("%8.3f",$cost_miscs).EURO,0,0,'R',true);
389 $this->Ln(10);
390
391 $this->ProcessingTable=false;
392 $this->cMargin=$cMargin;
393 $this->aCols=array();
394 }
395
396 // Watercolor $this->SetFillColor(120,255,250);
370 } 397 }
371 398
372 399
373 400
374 class PDF extends PDF_MySQL_Table { 401 class PDF extends PDF_MySQL_Table {
390 * Generate PDF from recipe data 417 * Generate PDF from recipe data
391 */ 418 */
392 $pdf = new PDF(); 419 $pdf = new PDF();
393 $pdf->AddPage(); 420 $pdf->AddPage();
394 $pdf->TableGlobal($row); 421 $pdf->TableGlobal($row);
395 $pdf->Ln(10);
396 $pdf->TableFermentables($row); 422 $pdf->TableFermentables($row);
397 $pdf->Ln(10);
398 $pdf->TableHops($row); 423 $pdf->TableHops($row);
399 $pdf->Ln(10);
400 $pdf->TableYeasts($row); 424 $pdf->TableYeasts($row);
401 $pdf->Ln(10);
402 $pdf->TableMiscs($row); 425 $pdf->TableMiscs($row);
403 426
404 //$pdf->SetFont('Helvetica','',10); 427 //$pdf->SetFont('Helvetica','',10);
405 //$pdf->Cell(0,10,'Receptje '.$record,0,1,'C'); 428 //$pdf->Cell(0,10,'Receptje '.$record,0,1,'C');
406 // Disclaimer toeveogen dat dit alleen recept ontwikkeling is. 429 // Disclaimer toeveogen dat dit alleen recept ontwikkeling is.

mercurial