www/prod_print.php

branch
stable
changeset 665
4d01937ae7af
parent 655
f4e00869f39f
child 667
1246550451ca
equal deleted inserted replaced
521:9d1aa6f3a4da 665:4d01937ae7af
37 $bottle_sugar = ''; 37 $bottle_sugar = '';
38 $keg_sugar = ''; 38 $keg_sugar = '';
39 $bottle_sugar_amount = 0; 39 $bottle_sugar_amount = 0;
40 $keg_sugar_amount = 0; 40 $keg_sugar_amount = 0;
41 41
42 $divide_parts = $row['divide_parts'];
43 $divide_part = $row['divide_part'];
44 $divide_factor = floatval($row['divide_factor']);
42 45
43 class PDF_MySQL_Table extends FPDF 46 class PDF_MySQL_Table extends FPDF
44 { 47 {
45 protected $ProcessingTable=false; 48 protected $ProcessingTable=false;
46 protected $aCols=array(); 49 protected $aCols=array();
65 $this->aCols[]=array('c'=>$caption,'w'=>$width,'a'=>$align); 68 $this->aCols[]=array('c'=>$caption,'w'=>$width,'a'=>$align);
66 } 69 }
67 70
68 function TableGlobal($row) { 71 function TableGlobal($row) {
69 global $recipetype; 72 global $recipetype;
73 global $divide_parts;
74 global $divide_part;
75 global $divide_factor;
76 global $splitat;
70 /* 2 Columns */ 77 /* 2 Columns */
71 $vul = $this->w - $this->rMargin - $this->lMargin - 160; 78 $vul = $this->w - $this->rMargin - $this->lMargin - 160;
72 $cMargin=$this->cMargin; 79 $cMargin=$this->cMargin;
73 $this->cMargin=2; 80 $this->cMargin=2;
74 $this->TableX=$this->lMargin; 81 $this->TableX=$this->lMargin;
80 87
81 $this->SetFont('Helvetica','',9); 88 $this->SetFont('Helvetica','',9);
82 $this->SetFillColor(210,245,255); 89 $this->SetFillColor(210,245,255);
83 90
84 $this->SetX($this->TableX); 91 $this->SetX($this->TableX);
85 $this->Cell(35,5,'Type',0,0,'L',true); 92 $this->Cell(35,5,'Brouw type',0,0,'L',true);
86 $this->Cell(45,5,$recipetype[$row['type']],0,0,'L',true); 93 $this->Cell(45,5,$recipetype[$row['type']],0,0,'L',true);
87 $this->Cell($vul,5,'',0,0,'L',false); 94 $this->Cell($vul,5,'',0,0,'L',false);
88 $this->Cell(35,5,'Batch grootte',0,0,'L',true); 95 $this->Cell(35,5,'Batch grootte',0,0,'L',true);
89 $this->Cell(45,5,$row['batch_size'].' liter',0,0,'L',true); 96 if ($divide_parts == 0)
97 $this->Cell(45,5,$row['batch_size'].' liter',0,0,'L',true);
98 else
99 $this->Cell(45,5,$row['batch_size'].' van '.sprintf("%.2f", ($row['batch_size'] * (1 / $divide_factor))).' liter',0,0,'L',true);
90 $this->Ln(); 100 $this->Ln();
91 101
92 $this->SetX($this->TableX); 102 $this->SetX($this->TableX);
93 $this->Cell(35,5,'Kooktijd',0,0,'L',true); 103 $this->Cell(35,5,'Kooktijd',0,0,'L',true);
94 $this->Cell(45,5,$row['boil_time'].' minuten',0,0,'L',true); 104 $this->Cell(45,5,$row['boil_time'].' minuten',0,0,'L',true);
97 $this->Cell(45,5,$row['efficiency'].' %',0,0,'L',true); 107 $this->Cell(45,5,$row['efficiency'].' %',0,0,'L',true);
98 $this->Ln(); 108 $this->Ln();
99 109
100 $this->SetX($this->TableX); 110 $this->SetX($this->TableX);
101 $this->Cell(35,5,'Bierstijl',0,0,'L',true); 111 $this->Cell(35,5,'Bierstijl',0,0,'L',true);
102 $this->Cell(45,5,$row['st_name'],0,0,'L',true); 112 $st_name = iconv('UTF-8','windows-1252',$row['st_name']);
113 $this->Cell(45,5,$st_name,0,0,'L',true);
103 $this->Cell($vul,5,'',0,0,'L',false); 114 $this->Cell($vul,5,'',0,0,'L',false);
104 $this->Cell(35,5,'Installatie',0,0,'L',true); 115 $this->Cell(35,5,'Installatie',0,0,'L',true);
105 $this->Cell(45,5,$row['eq_name'],0,0,'L',true); 116 $this->Cell(45,5,$row['eq_name'],0,0,'L',true);
106 $this->Ln(); 117 $this->Ln();
118
119 if ($divide_parts) {
120 $this->SetX($this->TableX);
121 $this->Cell(35,5,'Batch splits moment',0,0,'L',true);
122 $this->Cell(45,5,$splitat[$row['divide_type']],0,0,'L',true);
123 $this->Ln();
124 }
107 125
108 $this->cMargin=$cMargin; 126 $this->cMargin=$cMargin;
109 } 127 }
110 128
111 function TableFermentables($row) { 129 function TableFermentables($row) {
153 $yield = floatval($item['f_yield']); 171 $yield = floatval($item['f_yield']);
154 $moisture = floatval($item['f_moisture']); 172 $moisture = floatval($item['f_moisture']);
155 $color = floatval($item['f_color']); 173 $color = floatval($item['f_color']);
156 $percent = floatval($item['f_percentage']); 174 $percent = floatval($item['f_percentage']);
157 175
158 if ($item['f_type'] == 1) // Sugar 176 if ($item['f_type'] == 1) // Sugar
159 $pSugar += $percent; 177 $pSugar += $percent;
160 if ($item['f_graintype'] == 2) // Crystal 178 if ($item['f_graintype'] == 2) // Crystal
161 $pCara += $percent; 179 $pCara += $percent;
162 180
163 if ($item['f_type'] == 0) 181 if ($item['f_type'] == 0)
258 if (($item['h_useat'] == 2) || ($item['h_useat'] == 4)) { // Boil or Whirlpool 276 if (($item['h_useat'] == 2) || ($item['h_useat'] == 4)) { // Boil or Whirlpool
259 $moment = $hopuse[$item['h_useat']].' '.$time." min"; 277 $moment = $hopuse[$item['h_useat']].' '.$time." min";
260 } else if ($item['h_useat'] == 5) { // Dryhop 278 } else if ($item['h_useat'] == 5) { // Dryhop
261 $moment = $hopuse[$item['h_useat']].' '.sprintf("%.0f", $time / 1440).' dagen'; 279 $moment = $hopuse[$item['h_useat']].' '.sprintf("%.0f", $time / 1440).' dagen';
262 } 280 }
263 $ibu = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $mass, $time, $alpha, $row['ibu_method']); 281 $ibu = calc_IBU($item['h_useat'], $item['h_form'], $preboil_sg, floatval($row['batch_size']), $mass, $time, $alpha,
282 $row['ibu_method'], $row['brew_whirlpool9'], $row['brew_whirlpool7'], $row['brew_whirlpool6']);
264 $total_ibus += $ibu; 283 $total_ibus += $ibu;
265 284
266 if ($amount > 1) 285 if ($amount > 1)
267 $amount = sprintf("%.3f",$amount).' kg'; 286 $amount = sprintf("%.3f",$amount).' kg';
268 else 287 else
348 } 367 }
349 } 368 }
350 $this->Cell($vul,5,$st." staps giststarter",0,0,'L',true); 369 $this->Cell($vul,5,$st." staps giststarter",0,0,'L',true);
351 $this->Cell(40,5,'',0,0,'R',true); 370 $this->Cell(40,5,'',0,0,'R',true);
352 $this->Cell(30,5,"Vooraf",0,0,'L',true); 371 $this->Cell(30,5,"Vooraf",0,0,'L',true);
353 $this->Cell(20,5,sprintf("%.2f",$sv)." L",0,0,'R',true); 372 $this->Cell(20,5,sprintf("%.3f",$sv)." L",0,0,'R',true);
354 $this->Cell(20,5,'',0,0,'R',true); 373 $this->Cell(20,5,'',0,0,'R',true);
355 $this->Ln(); 374 $this->Ln();
356 } 375 }
357 376
358 $this->SetFillColor(210,245,255); 377 $this->SetFillColor(210,245,255);
875 894
876 $this->SetX($this->TableX); 895 $this->SetX($this->TableX);
877 $this->Cell(45,5,'Lageren einde',0,0,'L',true); 896 $this->Cell(45,5,'Lageren einde',0,0,'L',true);
878 $this->Cell(45,5,$row['package_date'],0,0,'L',true); 897 $this->Cell(45,5,$row['package_date'],0,0,'L',true);
879 $this->Cell($vul,5,'',0,0,'L',false); 898 $this->Cell($vul,5,'',0,0,'L',false);
880 $svg = 100 * (floatval($row['brew_fermenter_sg']) - floatval($row['fg'])) / (floatval($row['brew_fermenter_sg']) - 1); 899 $svg = calc_svg(floatval($row['brew_fermenter_sg']), floatval($row['fg']));
881 $this->Cell(45,5,'Schijnbare vergistingsgraad',0,0,'L',true); 900 $this->Cell(45,5,'Schijnbare vergistingsgraad',0,0,'L',true);
882 $this->Cell(45,5,sprintf("%.1f",$svg).'%',0,0,'L',true); 901 $this->Cell(45,5,sprintf("%.1f",$svg).'%',0,0,'L',true);
883 $this->Ln(); 902 $this->Ln();
884 } 903 }
885 904
1092 class PDF extends PDF_MySQL_Table { 1111 class PDF extends PDF_MySQL_Table {
1093 function Header() { 1112 function Header() {
1094 global $row; 1113 global $row;
1095 global $prdate; 1114 global $prdate;
1096 global $stage; 1115 global $stage;
1116 global $divide_parts;
1117 global $divide_part;
1097 $this->Image('images/logo.png',10,10,30); 1118 $this->Image('images/logo.png',10,10,30);
1098 // Title 1119 // Title
1099 $this->SetFont('Helvetica','B',18); 1120 $this->SetFont('Helvetica','B',18);
1100 $this->SetX(45); 1121 $this->SetX(45);
1101 $this->Cell(0,8,$row['code'].' '.$row['name'],0,1,'L'); 1122 $this->Cell(0,8,$row['code'].' '.$row['name'],0,1,'L');
1104 $this->SetX(45); 1125 $this->SetX(45);
1105 $this->Cell(17,5,'Datum:',0,0,'L'); 1126 $this->Cell(17,5,'Datum:',0,0,'L');
1106 $this->Cell(0,5,$prdate,0,1,'L'); 1127 $this->Cell(0,5,$prdate,0,1,'L');
1107 $this->SetX(45); 1128 $this->SetX(45);
1108 $this->Cell(17,5,'Stijl:',0,0,'L'); 1129 $this->Cell(17,5,'Stijl:',0,0,'L');
1109 $this->Cell(0,5,$row['st_name'],0,1,'L'); 1130 $st_name = iconv('UTF-8','windows-1252',$row['st_name']);
1131 $this->Cell(0,5,$st_name,0,1,'L');
1110 $this->SetX(45); 1132 $this->SetX(45);
1111 $this->Cell(17,5,'Fase:',0,0,'L'); 1133 $this->Cell(17,5,'Fase:',0,0,'L');
1112 $this->Cell(0,5,$stage[$row['stage']],0,1,'L'); 1134 $this->Cell(0,5,$stage[$row['stage']],0,1,'L');
1113 $this->Ln(6); 1135 $this->SetX(45);
1136 $this->Cell(17,5,'Batch:',0,0,'L');
1137 if ($divide_parts == 0)
1138 $this->Cell(0,5,"Niet gespitst",0,1,'L');
1139 else
1140 $this->Cell(0,5,"Split batch ".($divide_part + 1)." van ".($divide_parts + 1),0,1,'L');
1141 $this->Ln(2);
1114 // Ensure table header is printed 1142 // Ensure table header is printed
1115 parent::Header(); 1143 parent::Header();
1116 } 1144 }
1117 } 1145 }
1118 1146

mercurial