www/prod_print.php

changeset 275
fb1e88f1c643
parent 247
792b5ba77a1f
child 276
08c824a5ffd8
equal deleted inserted replaced
274:65ca75fc4af8 275:fb1e88f1c643
28 $pCara = 0; 28 $pCara = 0;
29 $svg = 77; 29 $svg = 77;
30 $colorw = 0; 30 $colorw = 0;
31 $total_ibus = 0; 31 $total_ibus = 0;
32 $preboil_sg = 0; 32 $preboil_sg = 0;
33 $mashkg = 0;
33 date_default_timezone_set('Europe/Amsterdam'); 34 date_default_timezone_set('Europe/Amsterdam');
34 $prdate = date(DATE_RFC2822); 35 $prdate = date(DATE_RFC2822);
35 36
36 37
37 class PDF_MySQL_Table extends FPDF 38 class PDF_MySQL_Table extends FPDF
107 global $total_fermentables; 108 global $total_fermentables;
108 global $pSugar; 109 global $pSugar;
109 global $pCara; 110 global $pCara;
110 global $colorw; 111 global $colorw;
111 global $preboil_sg; 112 global $preboil_sg;
113 global $mashkg;
112 $added = array( 'Maischen', 'Koken', 'Vergisten', 'Nagisten/lageren', 'Bottelen' ); 114 $added = array( 'Maischen', 'Koken', 'Vergisten', 'Nagisten/lageren', 'Bottelen' );
113 $vul = $this->w - $this->rMargin - $this->lMargin - 132; 115 $vul = $this->w - $this->rMargin - $this->lMargin - 132;
114 $this->AddCol($vul,'Grondstof','L'); 116 $this->AddCol($vul,'Grondstof','L');
115 $this->AddCol(30,'Leverancier','L'); 117 $this->AddCol(30,'Leverancier','L');
116 $this->AddCol(15,'EBC','R'); 118 $this->AddCol(15,'EBC','R');
126 $this->TableHeader(); 128 $this->TableHeader();
127 $this->ProcessingTable=true; 129 $this->ProcessingTable=true;
128 130
129 $sugarsf = 0; 131 $sugarsf = 0;
130 $sugarsm = 0; 132 $sugarsm = 0;
133 $mashkg = 0;
131 $this->SetFont('Helvetica','',9); 134 $this->SetFont('Helvetica','',9);
132 $this->SetFillColor(250, 195, 65); 135 $this->SetFillColor(250, 195, 65);
133 $arr = json_decode($row['json_fermentables'], true); 136 $arr = json_decode($row['json_fermentables'], true);
134 foreach($arr as $item) { //foreach element in $arr 137 foreach($arr as $item) { //foreach element in $arr
135 $name = iconv('UTF-8','windows-1252',$item['f_name']); 138 $name = iconv('UTF-8','windows-1252',$item['f_name']);
152 /* Calculate the amount of sugars */ 155 /* Calculate the amount of sugars */
153 $d = $amount * ($yield / 100) * (1 - $moisture / 100); 156 $d = $amount * ($yield / 100) * (1 - $moisture / 100);
154 if ($item['f_added'] == 0) { 157 if ($item['f_added'] == 0) {
155 $d = floatval($row['efficiency']) / 100 * $d; 158 $d = floatval($row['efficiency']) / 100 * $d;
156 $sugarsm += $d; 159 $sugarsm += $d;
160 $mashkg += $amount;
157 } 161 }
158 $sugarsf += $d; 162 $sugarsf += $d;
159 $colorw += ($amount * ebc_to_srm($color) / $row['batch_size']) * 8.34436; 163 $colorw += ($amount * ebc_to_srm($color) / $row['batch_size']) * 8.34436;
160 164
161 $this->Cell($vul,5,$name,0,0,'L',true); 165 $this->Cell($vul,5,$name,0,0,'L',true);
387 global $colorw; 391 global $colorw;
388 global $cost_fermentables; 392 global $cost_fermentables;
389 global $cost_hops; 393 global $cost_hops;
390 global $cost_miscs; 394 global $cost_miscs;
391 global $cost_yeasts; 395 global $cost_yeasts;
396 global $mashkg;
392 /* 2 Columns */ 397 /* 2 Columns */
393 $vul = $this->w - $this->rMargin - $this->lMargin - 170; 398 $vul = $this->w - $this->rMargin - $this->lMargin - 170;
394 $cMargin=$this->cMargin; 399 $cMargin=$this->cMargin;
395 $this->cMargin=2; 400 $this->cMargin=2;
396 $this->TableX=$this->lMargin; 401 $this->TableX=$this->lMargin;
401 $this->Ln(); 406 $this->Ln();
402 407
403 $this->SetFont('Helvetica','',9); 408 $this->SetFont('Helvetica','',9);
404 $this->SetFillColor(210,245,255); 409 $this->SetFillColor(210,245,255);
405 410
406 $row['est_fg'] = estimate_fg($pSugar, $pCara, 0, 0, 0, $svg, $row['est_og']); 411 $mashtime = 0;
412 $mashtemp = 0;
413 $mash_infuse = 0;
414 $arr = json_decode($row['json_mashs'], true);
415 foreach($arr as $item) {
416 if ($item['step_type'] == 0) { // infusion
417 $mash_infuse += floatval($item['step_infuse_amount']);
418 }
419 if ($item['step_temp'] < 75) { // ignore mashout temps
420 $mashtime += floatval($item['step_time']);
421 $mashtemp += floatval($item['step_time']) * floatval($item['step_temp']);
422 }
423 }
424 $mashtemp = $mashtemp / $mashtime;
425 if (($mashkg > 0) && ($mash_infuse > 0) && ($mashtime > 0) && ($mashtemp > 0)) {
426 $row['est_fg'] = estimate_fg($pSugar, $pCara, $mash_infuse / $mashkg, $mashtime, $mashtemp, $svg, $row['est_og']);
427 } else {
428 $row['est_fg'] = estimate_fg($pSugar, $pCara, 0, 0, 0, $svg, $row['est_og']);
429 }
407 430
408 $this->SetX($this->TableX); 431 $this->SetX($this->TableX);
409 $this->Cell(35,5,'Start SG',0,0,'L',true); 432 $this->Cell(35,5,'Start SG',0,0,'L',true);
410 $this->Cell(25,5,sprintf("%.3f",$row['est_og']),0,0,'L',true); 433 $this->Cell(25,5,sprintf("%.3f",$row['est_og']),0,0,'L',true);
411 $this->Cell(25,5,'('.sprintf("%.3f",$row['st_og_min']).' - '.sprintf("%.3f",$row['st_og_max']).')',0,0,'L',true); 434 $this->Cell(25,5,'('.sprintf("%.3f",$row['st_og_min']).' - '.sprintf("%.3f",$row['st_og_max']).')',0,0,'L',true);

mercurial