www/prod_checklist.php

branch
stable
changeset 665
4d01937ae7af
parent 658
945d5eba869a
child 667
1246550451ca
equal deleted inserted replaced
521:9d1aa6f3a4da 665:4d01937ae7af
1 <?php 1 <?php
2 require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php'); 2 require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
3 require_once($_SERVER['DOCUMENT_ROOT'].'/includes/formulas.php'); 3 require_once($_SERVER['DOCUMENT_ROOT'].'/includes/formulas.php');
4 require_once($_SERVER['DOCUMENT_ROOT'].'/includes/constants.php');
4 require_once($_SERVER['DOCUMENT_ROOT'].'/fpdf/fpdf.php'); 5 require_once($_SERVER['DOCUMENT_ROOT'].'/fpdf/fpdf.php');
5 6
6 7
7 $link = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME); 8 $link = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME);
8 if (! $link) { 9 if (! $link) {
36 $this->Cell(4, 4,' ',1,0,'L',true); 37 $this->Cell(4, 4,' ',1,0,'L',true);
37 $this->Cell(0, 4,' '.$text,0,1,'L',true); 38 $this->Cell(0, 4,' '.$text,0,1,'L',true);
38 $this->Ln(1); 39 $this->Ln(1);
39 } 40 }
40 41
42 function Checksplit($moment, $row) {
43 global $splitat;
44 if ($row['divide_type'] && $row['divide_type'] == $moment) {
45 $this->Ln(2);
46 $this->SetFont('Helvetica','B',14);
47 $this->Cell(0, 4,$splitat[$row['divide_type']]." splits de batch hier!",0,0,'C',true);
48 $this->SetFont('Arial','',10);
49 $this->AddPage();
50 return true;
51 }
52 return false;
53 }
54
41 function Checklist($row) { 55 function Checklist($row) {
42 56
43 global $my_grain_absorbtion; 57 global $my_grain_absorbtion;
44 global $my_brix_correction; 58 global $my_brix_correction;
59 global $acidtype;
45 $mashwater = 0; 60 $mashwater = 0;
46 $numsalts = 0; 61 $numsalts = 0;
62 $factor = 1 / $row['divide_factor'];
47 63
48 $this->AddPage(); 64 $this->AddPage();
49 $this->SetFillColor(255,255,255); 65 $this->SetFillColor(255,255,255);
50 66
51 $ferms = json_decode($row['json_fermentables'], true); 67 $ferms = json_decode($row['json_fermentables'], true);
99 $this->Ln(5); 115 $this->Ln(5);
100 } 116 }
101 117
102 $this->Checkheader('Water en -behandeling'); 118 $this->Checkheader('Water en -behandeling');
103 if ($row['w1_name']) { 119 if ($row['w1_name']) {
104 $this->Checkline(sprintf("%.1f",floatval($row['w1_amount'])).' liter water '.$row['w1_name']); 120 $this->Checkline(sprintf("%.1f",floatval($row['w1_amount'] * $factor)).' liter water '.$row['w1_name']);
105 $mashwater += floatval($row['w1_amount']); 121 $mashwater += floatval($row['w1_amount'] * $factor);
106 } 122 }
107 if ($row['w2_name']) { 123 if ($row['w2_name']) {
108 $this->Checkline(sprintf("%.1f",floatval($row['w2_amount'])).' liter water '.$row['w2_name']); 124 $this->Checkline(sprintf("%.1f",floatval($row['w2_amount'] * $factor)).' liter water '.$row['w2_name']);
109 $mashwater += floatval($row['w2_amount']); 125 $mashwater += floatval($row['w2_amount'] * $factor);
110 } 126 }
111 foreach($miscs as $item) { 127 foreach($miscs as $item) {
112 if ($item['m_type'] == 4) { // Only the water agents 128 if ($item['m_type'] == 4) { // Only the water agents
113 $unit = ($item['m_amount_is_weight']) ? " gr ":" ml "; 129 $unit = ($item['m_amount_is_weight']) ? " gr ":" ml ";
114 $this->Checkline(sprintf("%.1f",floatval($item['m_amount'] * 1000)).$unit.$item['m_name']); 130 $this->Checkline(sprintf("%.2f",floatval($item['m_amount'] * 1000 * $factor)).$unit.$item['m_name']);
115 $numsalts++; 131 $numsalts++;
116 } 132 }
117 } 133 }
118 $this->Ln(5); 134 $this->Ln(5);
119 135
120 $this->Checkheader('Mout afwegen en schroten'); 136 $this->Checkheader('Mout afwegen en schroten');
121 foreach($ferms as $item) { 137 foreach($ferms as $item) {
122 if ($item['f_added'] == 0) { // to mash 138 if ($item['f_added'] == 0) { // to mash
123 $s = sprintf("%.3f",floatval($item['f_amount'])).' kg `'; 139 $s = sprintf("%.3f",floatval($item['f_amount'] * $factor)).' kg `';
124 $s .= iconv('UTF-8','windows-1252',$item['f_name']); 140 $s .= iconv('UTF-8','windows-1252',$item['f_name']);
125 $s .= '` ('.iconv('UTF-8','windows-1252',$item['f_supplier']).')'; 141 $s .= '` ('.iconv('UTF-8','windows-1252',$item['f_supplier']).')';
126 $this->Checkline($s); 142 $this->Checkline($s);
127 } 143 }
128 } 144 }
136 $arr = json_decode($row['json_mashs'], true); 152 $arr = json_decode($row['json_mashs'], true);
137 if (count($arr) > 0) { 153 if (count($arr) > 0) {
138 $loop = 0; 154 $loop = 0;
139 foreach($arr as $item) { 155 foreach($arr as $item) {
140 if ($item['step_type'] == 0) 156 if ($item['step_type'] == 0)
141 $mvol += $item['step_infuse_amount']; // We need this later. 157 $mvol += $item['step_infuse_amount'] * $factor; // We need this later.
142 if ($loop == 0) { 158 if ($loop == 0) {
143 if ($item['step_type'] == 0) 159 if ($item['step_type'] == 0)
144 $l = $item['step_infuse_amount']; 160 $l = $item['step_infuse_amount'] * $factor;
145 else 161 else
146 $l = $mashwater; 162 $l = $mashwater;
147 $s = sprintf("%.1f",$l).' liter water opwarmen tot '; 163 $s = sprintf("%.1f",$l).' liter water opwarmen tot ';
148 $s .= sprintf("%.1f",$item['step_temp']).' '.DEG.'C ('; 164 $s .= sprintf("%.1f",$item['step_temp']).' '.DEG.'C (';
149 $s .= sprintf("%.1f",kettle_cm($l,$row['eq_tun_volume'],$row['eq_tun_height'])); 165 $s .= sprintf("%.1f",kettle_cm($l,$row['eq_tun_volume'],$row['eq_tun_height']));
152 if ($numsalts > 0) 168 if ($numsalts > 0)
153 $this->Checkline('brouwzouten en -zuren toevoegen'); 169 $this->Checkline('brouwzouten en -zuren toevoegen');
154 $this->Checkline('mout storten en inmaischen'); 170 $this->Checkline('mout storten en inmaischen');
155 foreach($hops as $item2) { 171 foreach($hops as $item2) {
156 if ($item2['h_useat'] == 0) { 172 if ($item2['h_useat'] == 0) {
157 $s = sprintf("%.1f",$item2['h_amount']*1000).' gr `'; 173 $s = sprintf("%.1f",$item2['h_amount']*1000 * $factor).' gr `';
158 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` toevoegen'; 174 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` toevoegen';
159 $this->Checkline($s); 175 $this->Checkline($s);
160 } 176 }
161 } 177 }
162 foreach($miscs as $item3) { 178 foreach($miscs as $item3) {
163 if ($item3['m_use_use'] == 1 && $item3['m_type'] != 4) { // Only if not a water agent 179 if ($item3['m_use_use'] == 1 && $item3['m_type'] != 4) { // Only if not a water agent
164 $unit = ($item3['m_amount_is_weight']) ? " gr ":" ml "; 180 $unit = ($item3['m_amount_is_weight']) ? " gr ":" ml ";
165 $s = sprintf("%.2f",$item3['m_amount']*1000).$unit.'`'; 181 $s = sprintf("%.2f",$item3['m_amount']*1000 * $factor).$unit.'`';
166 $s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` toevoegen'; 182 $s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` toevoegen';
167 $this->Checkline($s); 183 $this->Checkline($s);
168 } 184 }
169 } 185 }
170 $this->Checkline($item['step_time'].' min. bij '.$item['step_temp'].' '.DEG.'C'); 186 $this->Checkline($item['step_time'].' min. bij '.$item['step_temp'].' '.DEG.'C');
171 $this->Checkline('pH meten en bijstellen (doel pH beslag: '.sprintf("%.1f",$row['mash_ph']).' pH)'); 187 $this->Checkline('pH meten en bijstellen (doel pH beslag: '.sprintf("%.1f",$row['mash_ph']).' pH)');
172 } else { 188 } else {
173 if ($item['step_type'] == 0) { // Infusion 189 if ($item['step_type'] == 0) { // Infusion
174 $s = 'toevoegen '.$item['step_infuse_amount'].' liter water van xx '.DEG.'C'; 190 $s = 'toevoegen '.($item['step_infuse_amount'] * $factor).' liter water van xx '.DEG.'C';
175 } else if ($item['step_type'] == 1) { // Direct heat 191 } else if ($item['step_type'] == 1) { // Direct heat
176 $s = 'opwarmen tot '.$item['step_temp'].' '.DEG.'C'; 192 $s = 'opwarmen tot '.$item['step_temp'].' '.DEG.'C';
177 } else { // Decoction 193 } else { // Decoction
178 $s = 'uitnemen, opwarmen, koken en terugstorten van '.$item['step_infuse_amount'].' liter deelbeslag'; 194 $s = 'uitnemen, opwarmen, koken en terugstorten van '.($item['step_infuse_amount']*$factor).' liter deelbeslag';
179 } 195 }
180 $this->Checkline($s); 196 $this->Checkline($s);
181 $this->Checkline($item['step_time'].' min. bij '.$item['step_temp'].' '.DEG.'C'); 197 $this->Checkline($item['step_time'].' min. bij '.$item['step_temp'].' '.DEG.'C');
182 } 198 }
183 $loop++; 199 $loop++;
184 } 200 }
185 $est_mash_sg = 0; 201 $est_mash_sg = 0;
186 foreach($ferms as $item) { 202 foreach($ferms as $item) {
187 if ($item['f_added'] == 0) { 203 if ($item['f_added'] == 0) {
188 $d = $item['f_amount'] * ($item['f_yield'] / 100) * (1 - $item['f_moisture'] / 100); 204 $d = $item['f_amount'] * $factor * ($item['f_yield'] / 100) * (1 - $item['f_moisture'] / 100);
189 $mvol += $item['f_amount'] * $item['f_moisture'] / 100; 205 $mvol += $item['f_amount'] * $factor * $item['f_moisture'] / 100;
190 $grainabsorbtion += $my_grain_absorbtion * $item['f_amount']; 206 $grainabsorbtion += $my_grain_absorbtion * $item['f_amount'] * $factor;
191 $msugars += $d; 207 $msugars += $d;
192 } 208 }
193 } 209 }
194 $sugardensity = 1.611; 210 $sugardensity = 1.611;
195 $v = $msugars / $sugardensity + $mvol; 211 $v = $msugars / $sugardensity + $mvol;
200 if ($this->GetY() > 200) 216 if ($this->GetY() > 200)
201 $this->AddPage(); 217 $this->AddPage();
202 else 218 else
203 $this->Ln(5); 219 $this->Ln(5);
204 220
205 $acidtype = array( 'Melkzuur', 'Zoutzuur', 'Fosforzuur', 'Zwavelzuur' );
206 $this->Checkheader('Filteren en spoelen'); 221 $this->Checkheader('Filteren en spoelen');
207 $s = sprintf("%.1f",$row['sparge_volume']).' liter spoelwater opwarmen tot '.sprintf("%.1f",$row['sparge_temp']).' '.DEG.'C'; 222 $s = sprintf("%.1f",$row['sparge_volume'] * $factor).' liter spoelwater opwarmen tot '.sprintf("%.1f",$row['sparge_temp']).' '.DEG.'C';
208 $this->Checkline($s); 223 $this->Checkline($s);
209 $s = 'spoelwater aanzuren tot pH <= '.sprintf("%.1f",$row['sparge_ph']).' met '; 224 $s = 'spoelwater aanzuren tot pH <= '.sprintf("%.1f",$row['sparge_ph']).' met ';
210 $s .= sprintf("%.1f",$row['sparge_acid_amount']*1000).' ml. '.$acidtype[$row['sparge_acid_type']]; 225 $s .= sprintf("%.2f",$row['sparge_acid_amount']*1000*$factor).' ml. '.$acidtype[$row['sparge_acid_type']];
211 $this->Checkline($s); 226 $this->Checkline($s);
212 $spoelw = ($row['boil_size'] - $mashwater + $grainabsorbtion + $row['eq_lauter_deadspace']) * 1.03; // A small heat correction 227 $spoelw = (($row['boil_size']*$factor) - $mashwater + $grainabsorbtion + $row['eq_lauter_deadspace']) * 1.03; // A small heat correction
213 $this->Checkline('spoelen met ongeveer '.sprintf("%.1f",$spoelw).' liter spoelwater'); 228 $this->Checkline('spoelen met ongeveer '.sprintf("%.1f",$spoelw).' liter spoelwater');
214 $s = 'doelvolume in kookketel: '.sprintf("%.1f",$row['boil_size'] * 1.04).' liter ('; 229 $s = 'doelvolume in kookketel: '.sprintf("%.1f",$row['boil_size'] * $factor * 1.04).' liter (';
215 $s .= sprintf("%.1f",kettle_cm($row['boil_size'] * 1.04,$row['eq_kettle_volume'],$row['eq_kettle_height'])).' cm onder de rand)'; 230 $s .= sprintf("%.1f",kettle_cm($row['boil_size'] * $factor * 1.04,$row['eq_kettle_volume'],$row['eq_kettle_height'])).' cm onder de rand)';
216 $this->Checkline($s); 231 $this->Checkline($s);
217 $pre_sg = estimate_sg($msugars * floatval($row['efficiency']) / 100,floatval($row['boil_size'])); 232 $pre_sg = estimate_sg($msugars * floatval($row['efficiency']) / 100,floatval($row['boil_size'] * $factor));
218 $this->Checkline('doel SG in kookketel: '.density_str($pre_sg)); 233 $this->Checkline('doel SG in kookketel: '.density_str($pre_sg));
219 foreach($hops as $item2) { 234 foreach($hops as $item2) {
220 if ($item2['h_useat'] == 1) { 235 if ($item2['h_useat'] == 1) {
221 $s = sprintf("%.1f",$item2['h_amount']*1000).' gr `'; 236 $s = sprintf("%.1f",$item2['h_amount']*1000*$factor).' gr `';
222 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` toevoegen na het spoelen'; 237 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` toevoegen na het spoelen';
223 $this->Checkline($s); 238 $this->Checkline($s);
224 } 239 }
240 }
241 if ($this->Checksplit(1, $row))
242 $factor = 1;
243 if ($this->GetY() > 200 && $row['boil_time'] > 0)
244 $this->AddPage();
245 else if ($this->GetY() > 270 && $row['boil_time'] == 0)
246 $this->AddPage();
247 else
248 $this->Ln(5);
249
250 $this->Checkheader('Koken');
251 if ($row['boil_time'] > 0) {
252 $this->Checkline('totale kooktijd: '.$row['boil_time'].' min.');
253 for ($i = $row['boil_time']; $i >= 0; $i--) {
254 if ($i == 10) {
255 foreach($ferms as $item1) {
256 if ($item1['f_added'] == 1) {
257 $s = sprintf("%.3f",$item1['f_amount']*$factor).' kg `';
258 $s .= iconv('UTF-8','windows-1252',$item1['f_name']).'` bij 10 minuten voor einde koken';
259 $this->Checkline($s);
260 }
261 }
262 if ($row['brew_cooling_method'] == 1)
263 $this->Checkline('Plaats dompelkoeler bij 10 minuten voor einde koken');
264 }
265 foreach($hops as $item2) {
266 if (($item2['h_useat'] == 2 || $item2['h_useat'] == 3) && ($item2['h_time'] == $i)) {
267 $s = sprintf("%.2f",$item2['h_amount']*1000*$factor).' gr `';
268 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` bij ';
269 if ($i > 0)
270 $s .= $i.' minuten voor einde koken';
271 else
272 $s .= 'vlamuit';
273 $this->Checkline($s);
274 }
275 }
276 foreach($miscs as $item3) {
277 if ($item3['m_use_use'] == 2 && $item3['m_time'] == $i) {
278 $unit = ($item3['m_amount_is_weight']) ? " gr ":" ml ";
279 $s = sprintf("%.2f",$item3['m_amount']*1000*$factor).$unit.'`';
280 $s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` bij ';
281 if ($i > 0)
282 $s .= $i.' minuten voor einde koken';
283 else
284 $s .= 'vlamuit';
285 $this->Checkline($s);
286 }
287 }
288
289 }
290 $s = 'doelvolume einde koken: '.sprintf("%.1f",$row['batch_size']*$factor*1.04).' liter (';
291 $s .= sprintf("%.1f",kettle_cm($row['batch_size']*$factor*1.04,$row['eq_kettle_volume'],$row['eq_kettle_height']));
292 $s .= ' cm onder de rand)';
293 $this->Checkline($s);
294 $this->Checkline('doel SG einde koken: '.density_str($row['est_og3']));
295 if ($this->Checksplit(2, $row))
296 $factor = 1;
297 } else {
298 $this->Checkline('Dit is een `no-boil\' recept');
225 } 299 }
226 if ($this->GetY() > 200) 300 if ($this->GetY() > 200)
227 $this->AddPage(); 301 $this->AddPage();
228 else 302 else
229 $this->Ln(5); 303 $this->Ln(5);
230 304
231 $this->Checkheader('Koken');
232 $this->Checkline('totale kooktijd: '.$row['boil_time'].' min.');
233 for ($i = $row['boil_time']; $i >= 0; $i--) {
234 if ($i == 10) {
235 foreach($ferms as $item1) {
236 if ($item1['f_added'] == 1) {
237 $s = sprintf("%.3f",$item1['f_amount']).' kg `';
238 $s .= iconv('UTF-8','windows-1252',$item1['f_name']).'` bij 10 minuten voor einde koken';
239 $this->Checkline($s);
240 }
241 }
242 if ($row['brew_cooling_method'] == 1)
243 $this->Checkline('Plaats dompelkoeler bij 10 minuten voor einde koken');
244 }
245 foreach($hops as $item2) {
246 if (($item2['h_useat'] == 2 || $item2['h_useat'] == 3) && ($item2['h_time'] == $i)) {
247 $s = sprintf("%.1f",$item2['h_amount']*1000).' gr `';
248 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` bij ';
249 if ($i > 0)
250 $s .= $i.' minuten voor einde koken';
251 else
252 $s .= 'vlamuit';
253 $this->Checkline($s);
254 }
255 }
256 foreach($miscs as $item3) {
257 if ($item3['m_use_use'] == 2 && $item3['m_time'] == $i) {
258 $unit = ($item3['m_amount_is_weight']) ? " gr ":" ml ";
259 $s = sprintf("%.1f",$item3['m_amount']*1000).$unit.'`';
260 $s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` bij ';
261 if ($i > 0)
262 $s .= $i.' minuten voor einde koken';
263 else
264 $s .= 'vlamuit';
265 $this->Checkline($s);
266 }
267 }
268
269 }
270 $s = 'doelvolume einde koken: '.sprintf("%.1f",$row['batch_size']*1.04).' liter (';
271 $s .= sprintf("%.1f",kettle_cm($row['batch_size']*1.04,$row['eq_kettle_volume'],$row['eq_kettle_height']));
272 $s .= ' cm onder de rand)';
273 $this->Checkline($s);
274 $this->Checkline('doel SG einde koken: '.density_str($row['est_og']));
275 if ($this->GetY() > 200)
276 $this->AddPage();
277 else
278 $this->Ln(5);
279
280 if (($row['brew_whirlpool9'] + $row['brew_whirlpool7'] + $row['brew_whirlpool6'] + $row['brew_whirlpool2']) > 0) { 305 if (($row['brew_whirlpool9'] + $row['brew_whirlpool7'] + $row['brew_whirlpool6'] + $row['brew_whirlpool2']) > 0) {
281 $this->Checkheader('Whirlpool en koelen'); 306 $this->Checkheader('Whirlpool en koelen');
282 if ($row['brew_whirlpool9'] > 0) { 307 if ($row['brew_whirlpool9'] > 0) {
283 $s = 'Whirlpool voor '.$row['brew_whirlpool9'].' min. Temperatuur boven 85 '.DEG.'C houden'; 308 $s = 'Whirlpool voor '.$row['brew_whirlpool9'].' min. Temperatuur boven 85 '.DEG.'C houden';
284 $this->Checkline($s); 309 $this->Checkline($s);
293 $s = 'Whirlpool voor '.$row['brew_whirlpool6'].' min. Temperatuur tussen 60 en 66 '.DEG.'C houden'; 318 $s = 'Whirlpool voor '.$row['brew_whirlpool6'].' min. Temperatuur tussen 60 en 66 '.DEG.'C houden';
294 $this->Checkline($s); 319 $this->Checkline($s);
295 } 320 }
296 foreach($hops as $item2) { 321 foreach($hops as $item2) {
297 if ($item2['h_useat'] == 4) { 322 if ($item2['h_useat'] == 4) {
298 $s = sprintf("%.1f",$item2['h_amount']*1000).' gr `'; 323 $s = sprintf("%.1f",$item2['h_amount']*1000*$factor).' gr `';
299 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` voor '; 324 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` voor ';
300 $s .= $item2['h_time'].' minuten in de whirlpool'; 325 $s .= $item2['h_time'].' minuten in de whirlpool';
301 $this->Checkline($s); 326 $this->Checkline($s);
302 } 327 }
303 } 328 }
310 $this->Checkheader('Koelen'); 335 $this->Checkheader('Koelen');
311 $this->Checkline('koelen tot '.sprintf("%.1f",$row['brew_cooling_to']).' '.DEG.'C'); 336 $this->Checkline('koelen tot '.sprintf("%.1f",$row['brew_cooling_to']).' '.DEG.'C');
312 } 337 }
313 $this->Checkline('gistvat ontsmetten en evt. pomp en slangen ontsmetten'); 338 $this->Checkline('gistvat ontsmetten en evt. pomp en slangen ontsmetten');
314 $this->Checkline('wort naar gistvat overbrengen'); 339 $this->Checkline('wort naar gistvat overbrengen');
315 340 if ($this->Checksplit(3, $row))
341 $factor = 1;
316 if ($this->GetY() > 240) 342 if ($this->GetY() > 240)
317 $this->AddPage(); 343 $this->AddPage();
318 else 344 else
319 $this->Ln(5); 345 $this->Ln(5);
346
347 $climate = $row['brew_cooling_to'];
320 $this->Checkheader('Gist enten'); 348 $this->Checkheader('Gist enten');
321 $dry = 0; 349 $dry = 0;
322 foreach ($yeasts as $item) { 350 foreach ($yeasts as $item) {
351 $name = iconv('UTF-8','windows-1252',$item['y_name']);
352 $product_id = iconv('UTF-8','windows-1252',$item['y_product_id']);
323 if ($item['y_use'] == 0) { // primary 353 if ($item['y_use'] == 0) { // primary
324 if ($item['y_form'] == 0) { // Liquid 354 if ($item['y_form'] == 0) { // Liquid
325 $this->Checkline($item['y_amount'].' pak '.$item['y_product_id'].', '.$item['y_name'].' gist'); 355 $this->Checkline(($item['y_amount']*$factor).' pak '.$product_id.', '.$name.' gist');
326 } else if ($item['y_form'] == 1 || $item['y_form'] == 6) { // Dry 356 } else if ($item['y_form'] == 1 || $item['y_form'] == 6) { // Dry or dried Kveik
327 $s = sprintf("%.1f",$item['y_amount']*1000).' gram '.$item['y_product_id'].', '.$item['y_name']; 357 $s = sprintf("%.1f",$item['y_amount']*$factor*1000).' gram '.$product_id.', '.$name;
328 $s .= ' gist'; 358 $s .= ' gist';
329 $dry += $item['y_amount']*10000; 359 if ($item['y_form'] == 1)
360 $dry += $item['y_amount']*$factor*10000;
330 $this->Checkline($s); 361 $this->Checkline($s);
331 } else { // Slant/Culture/Frozen/Bottle 362 } else { // Slant/Culture/Frozen/Bottle
332 $s = sprintf("%.0f",$item['y_amount']*1000).' ml '.$item['y_product_id'].', '.$item['y_name'].' gist'; 363 $s = sprintf("%.0f",$item['y_amount']*$factor*1000).' ml '.$product_id.', '.$name.' gist';
333 $this->Checkline($s); 364 $this->Checkline($s);
365 }
366 if ($item['y_type'] == 6 && floatval($item['y_pitch_temperature']) > 0) {
367 $s = 'Gist enten bij ' . sprintf("%.1f",floatval($item['y_pitch_temperature'])) . DEG . 'C';
368 $this->Checkline($s);
369 $climate = $item['y_pitch_temperature'];
334 } 370 }
335 } 371 }
336 } 372 }
337 if ($dry > 0) { 373 if ($dry > 0) {
338 $this->Checkline(' gist hydrateren in '.$dry.' ml gedesinfecteerd water van 32 '.DEG.'C'); 374 $this->Checkline(' gist hydrateren in '.$dry.' ml gedesinfecteerd water van 32 '.DEG.'C');
346 $this->Checkline('giststarter toevoegen'); 382 $this->Checkline('giststarter toevoegen');
347 else 383 else
348 $this->Checkline('gist toevoegen'); 384 $this->Checkline('gist toevoegen');
349 } 385 }
350 if ($row['brew_fermenter_extrawater'] > 0) 386 if ($row['brew_fermenter_extrawater'] > 0)
351 $this->Checkline(sprintf("%.1f", $row['brew_fermenter_extrawater']).' liter water toevoegen in gistvat'); 387 $this->Checkline(sprintf("%.1f", $row['brew_fermenter_extrawater']*$factor).' liter water toevoegen in gistvat');
352 if ($row['brew_aeration_type'] > 0) { 388 if ($row['brew_aeration_type'] > 0) {
353 $s = 'wort '.$row['brew_aeration_time'].' minuten beluchten met '; 389 $s = 'wort '.$row['brew_aeration_time'].' minuten beluchten met ';
354 $s .= ($row['brew_aeration_type'] == 1) ? "lucht":"zuurstof"; 390 $s .= ($row['brew_aeration_type'] == 1) ? "lucht":"zuurstof";
355 $this->Checkline($s); 391 $this->Checkline($s);
356 } 392 }
358 $this->AddPage(); 394 $this->AddPage();
359 else 395 else
360 $this->Ln(5); 396 $this->Ln(5);
361 397
362 $this->Checkheader('Vergisting starten'); 398 $this->Checkheader('Vergisting starten');
363 $this->Checkline('klimaatkast instellen op '.sprintf("%.1f",$row['brew_cooling_to']).' '.DEG.'C'); 399 $this->Checkline('klimaatkast instellen op '.sprintf("%.1f",$climate).' '.DEG.'C');
364 400
365 /* 401 /*
366 * During primary fermentation: fermentables, misc 402 * During primary fermentation: fermentables, misc
367 */ 403 */
368 $lines = 0; 404 $lines = 0;
381 $this->Ln(5); 417 $this->Ln(5);
382 $this->Checkheader('Hoofdgisting'); 418 $this->Checkheader('Hoofdgisting');
383 } 419 }
384 foreach($ferms as $item1) { 420 foreach($ferms as $item1) {
385 if ($item1['f_added'] == 2) { 421 if ($item1['f_added'] == 2) {
386 $s = sprintf("%.3f",$item1['f_amount']).' kg `'; 422 $s = sprintf("%.3f",$item1['f_amount']*$factor).' kg `';
387 $s .= iconv('UTF-8','windows-1252',$item1['f_name']).'` op dag 3 of 4 toevoegen'; 423 $s .= iconv('UTF-8','windows-1252',$item1['f_name']).'` op dag 3 of 4 toevoegen';
388 $this->Checkline($s); 424 $this->Checkline($s);
389 } 425 }
390 } 426 }
391 foreach($miscs as $item3) { 427 foreach($miscs as $item3) {
392 if ($item3['m_use_use'] == 3) { 428 if ($item3['m_use_use'] == 3) {
393 $unit = ($item3['m_amount_is_weight']) ? " gr ":" ml "; 429 $unit = ($item3['m_amount_is_weight']) ? " gr ":" ml ";
394 $s = sprintf("%.1f",$item3['m_amount']*1000).$unit.'`'; 430 $s = sprintf("%.1f",$item3['m_amount']*$factor*1000).$unit.'`';
395 $s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` op dag 3 of 4 toevoegen'; 431 $s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` op dag 3 of 4 toevoegen';
396 $this->Checkline($s); 432 $this->Checkline($s);
397 } 433 }
398 } 434 }
435 if ($this->Checksplit(4, $row))
436 $factor = 1;
399 437
400 /* 438 /*
401 * During secondary fermentation: yeast 439 * During secondary fermentation: yeast
402 */ 440 */
403 $lines = 0; 441 $lines = 0;
404 foreach ($yeasts as $item4) { 442 foreach ($yeasts as $item4) {
405 if ($item4['y_use'] == 1) 443 if ($item4['y_use'] == 1)
406 $lines++; 444 $lines++;
445 if ($item4['y_harvest_time'] > 0)
446 $lines++;
407 } 447 }
408 if ($lines) { 448 if ($lines) {
409 if ($this->GetY() > (270 - (5 * $lines))) 449 if ($this->GetY() > (270 - (5 * $lines)))
410 $this->AddPage(); 450 $this->AddPage();
411 else 451 else
412 $this->Ln(5); 452 $this->Ln(5);
413 $this->Checkheader('Nagisting'); 453 $this->Checkheader('Nagisting');
414 } 454 }
415 foreach ($yeasts as $item4) { 455 foreach ($yeasts as $item4) {
416 if ($item4['y_use'] == 1) { 456 if ($item4['y_use'] == 1) {
457 $name = iconv('UTF-8','windows-1252',$item4['y_name']);
458 $product_id = iconv('UTF-8','windows-1252',$item4['y_product_id']);
417 if ($item4['y_form'] == 0) { // Liquid 459 if ($item4['y_form'] == 0) { // Liquid
418 $this->Checkline($item4['y_amount'].' pak '.$item4['y_product_id'].', '.$item4['y_name'].' gist (eventueel met starter)'); 460 $this->Checkline(($item4['y_amount']*$factor).' pak '.$product_id.', '.$name.' gist (eventueel met starter)');
419 } else if ($item['y_form'] == 1) { // Dry 461 } else if ($item['y_form'] == 1) { // Dry
420 $s = sprintf("%.1f",$item4['y_amount']*1000).' gram '.$item4['y_product_id'].', '.$item4['y_name']; 462 $s = sprintf("%.1f",$item4['y_amount']*$factor*1000).' gram '.$product_id.', '.$name;
421 $s .= ' gist'; 463 $s .= ' gist';
422 $this->Checkline($s); 464 $this->Checkline($s);
423 } else { // Slant/Culture/Frozen/Bottle 465 } else { // Slant/Culture/Frozen/Bottle
424 $s = sprintf("%.0f",$item4['y_amount']*1000).' ml '.$item4['y_product_id'].', '.$item4['y_name'].' gist (eventueel met starter)'; 466 $s = sprintf("%.0f",$item4['y_amount']*$factor*1000).' ml '.$product_id.', '.$name.' gist (eventueel met starter)';
425 $this->Checkline($s); 467 $this->Checkline($s);
426 } 468 }
427 } 469 }
428 } 470 if ($item4['y_harvest_time'] > 0) {
471 $s = 'Na ' . $item4['y_harvest_time'] . ' uur gist oogsten vanaf de ';
472 if ($item4['y_harvest_top'] > 0)
473 $s .= 'bovenzijde';
474 else
475 $s .= 'bodem';
476 $this->Checkline($s);
477 }
478 }
479 if ($this->Checksplit(5, $row))
480 $factor = 1;
429 481
430 /* 482 /*
431 * During tertiary fermentation: fermentables, hop, yeast, misc 483 * During tertiary fermentation: fermentables, hop, yeast, misc
432 */ 484 */
433 $lines = 0; 485 $lines = 0;
454 $this->Ln(5); 506 $this->Ln(5);
455 $this->Checkheader('Lagering'); 507 $this->Checkheader('Lagering');
456 } 508 }
457 foreach($ferms as $item1) { 509 foreach($ferms as $item1) {
458 if ($item1['f_added'] == 3) { 510 if ($item1['f_added'] == 3) {
459 $s = sprintf("%.3f",$item1['f_amount']).' kg `'; 511 $s = sprintf("%.3f",$item1['f_amount']*$factor).' kg `';
460 $s .= iconv('UTF-8','windows-1252',$item1['f_name']).'` toevoegen'; 512 $s .= iconv('UTF-8','windows-1252',$item1['f_name']).'` toevoegen';
461 $this->Checkline($s); 513 $this->Checkline($s);
462 } 514 }
463 } 515 }
464 foreach($hops as $item2) { 516 foreach($hops as $item2) {
465 if ($item2['h_useat'] == 5) { 517 if ($item2['h_useat'] == 5) {
466 $s = sprintf("%.1f",$item2['h_amount']*1000).' gr `'; 518 $s = sprintf("%.1f",$item2['h_amount']*$factor*1000).' gr `';
467 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` voor '; 519 $s .= iconv('UTF-8','windows-1252',$item2['h_name']).'` voor ';
468 $s .= sprintf("%.0f",$item2['h_time']/1440).' dagen toevoegen'; 520 $s .= sprintf("%.0f",$item2['h_time']/1440).' dagen toevoegen';
469 $this->Checkline($s); 521 $this->Checkline($s);
470 } 522 }
471 } 523 }
472 foreach ($yeasts as $item4) { 524 foreach ($yeasts as $item4) {
473 if ($item4['y_use'] == 2) { 525 if ($item4['y_use'] == 2) {
526 $name = iconv('UTF-8','windows-1252',$item4['y_name']);
527 $product_id = iconv('UTF-8','windows-1252',$item4['y_product_id']);
474 if ($item4['y_form'] == 0) { // Liquid 528 if ($item4['y_form'] == 0) { // Liquid
475 $s = $item4['y_amount'].' pak '.$item4['y_product_id'].', '.$item4['y_name'].' gist (eventueel met starter)'; 529 $s = ($item4['y_amount']*$factor).' pak '.$product_id.', '.$name.' gist (eventueel met starter)';
476 } else if ($item4['y_form'] == 1) { // Dry 530 } else if ($item4['y_form'] == 1) { // Dry
477 $s = sprintf("%.1f",$item4['y_amount']*1000).' gram '.$item4['y_product_id'].', '.$item4['y_name']; 531 $s = sprintf("%.1f",$item4['y_amount']*$factor*1000).' gram '.$product_id.', '.$name;
478 $s .= ' gist'; 532 $s .= ' gist';
479 } else { // Slant/Culture/Frozen/Bottle 533 } else { // Slant/Culture/Frozen/Bottle
480 $s = sprintf("%.0f",$item4['y_amount']*1000).' ml '.$item4['y_product_id'].', '.$item4['y_name']; 534 $s = sprintf("%.0f",$item4['y_amount']*$factor*1000).' ml '.$product_id.', '.$name;
481 $s .= ' gist (eventueel met starter)'; 535 $s .= ' gist (eventueel met starter)';
482 } 536 }
483 $this->Checkline($s); 537 $this->Checkline($s);
484 } 538 }
485 } 539 }
486 foreach($miscs as $item3) { 540 foreach($miscs as $item3) {
487 if ($item3['m_use_use'] == 4) { 541 if ($item3['m_use_use'] == 4) {
488 $unit = ($item3['m_amount_is_weight']) ? " gr ":" ml "; 542 $unit = ($item3['m_amount_is_weight']) ? " gr ":" ml ";
489 $s = sprintf("%.1f",$item3['m_amount']*1000).$unit.'`'; 543 $s = sprintf("%.1f",$item3['m_amount']*$factor*1000).$unit.'`';
490 $s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` voor '; 544 $s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` voor ';
491 $s .= sprintf("%.0f",$item3['m_time']/1440).' dagen toevoegen'; 545 $s .= sprintf("%.0f",$item3['m_time']/1440).' dagen toevoegen';
492 $this->Checkline($s); 546 $this->Checkline($s);
493 } 547 }
494 } 548 }
549 if ($this->Checksplit(6, $row))
550 $factor = 1;
495 551
496 /* 552 /*
497 * During packaging: fermentables, yeast, misc 553 * During packaging: fermentables, yeast, misc
498 */ 554 */
499 $lines = 0; 555 $lines = 0;
518 $this->Ln(5); 574 $this->Ln(5);
519 $this->Checkheader('Verpakken'); 575 $this->Checkheader('Verpakken');
520 } 576 }
521 foreach($ferms as $item1) { 577 foreach($ferms as $item1) {
522 if ($item1['f_added'] == 4) { 578 if ($item1['f_added'] == 4) {
523 $s = sprintf("%.3f",$item1['f_amount']).' kg `'; 579 $s = sprintf("%.3f",$item1['f_amount']*$factor).' kg `';
524 $s .= iconv('UTF-8','windows-1252',$item1['f_name']).'`'; 580 $s .= iconv('UTF-8','windows-1252',$item1['f_name']).'`';
525 if ($row['bottle_priming_water'] > 0) 581 if ($row['bottle_priming_water'] > 0)
526 $s .= ' met '.sprintf("%.3f",$row['bottle_priming_water']).' liter water'; 582 $s .= ' met '.sprintf("%.3f",$row['bottle_priming_water']*$factor).' liter water';
527 $s .= ' bij bottelen'; 583 $s .= ' bij bottelen';
528 $this->Checkline($s); 584 $this->Checkline($s);
529 } 585 }
530 if ($item1['f_added'] == 5) { 586 if ($item1['f_added'] == 5) {
531 $s = sprintf("%.3f",$item1['f_amount']).' kg `'; 587 $s = sprintf("%.3f",$item1['f_amount']*$factor).' kg `';
532 $s .= iconv('UTF-8','windows-1252',$item1['f_name']).'`'; 588 $s .= iconv('UTF-8','windows-1252',$item1['f_name']).'`';
533 if ($row['keg_priming_water'] > 0) 589 if ($row['keg_priming_water'] > 0)
534 $s .= ' met '.sprintf("%.3f",$row['keg_priming_water']).' liter water'; 590 $s .= ' met '.sprintf("%.3f",$row['keg_priming_water']*$factor).' liter water';
535 $s .= ' bij op fust zetten'; 591 $s .= ' bij op fust zetten';
536 $this->Checkline($s); 592 $this->Checkline($s);
537 } 593 }
538 } 594 }
539 foreach ($yeasts as $item4) { 595 foreach ($yeasts as $item4) {
540 if ($item4['y_use'] == 3) { 596 if ($item4['y_use'] == 3) {
597 $name = iconv('UTF-8','windows-1252',$item4['y_name']);
598 $product_id = iconv('UTF-8','windows-1252',$item4['y_product_id']);
541 if ($item4['y_form'] == 0) { // Liquid 599 if ($item4['y_form'] == 0) { // Liquid
542 $s = '`'.$item4['y_product_id'].', '.$item4['y_name']; 600 $s = '`'.$product_id.', '.$name;
543 } else if ($item4['y_form'] == 1) { // Dry 601 } else if ($item4['y_form'] == 1) { // Dry
544 $s = sprintf("%.1f",$item4['y_amount']*1000).' gram `'.$item4['y_product_id'].', '.$item4['y_name']; 602 $s = sprintf("%.1f",$item4['y_amount']*$factor*1000).' gram `'.$product_id.', '.$name;
545 } else { // Slant/Culture/Frozen/Bottle 603 } else { // Slant/Culture/Frozen/Bottle
546 $s = sprintf("%.0f",$item4['y_amount']*1000).' ml `'.$item4['y_product_id'].', '.$item4['y_name']; 604 $s = sprintf("%.0f",$item4['y_amount']*$factor*1000).' ml `'.$product_id.', '.$name;
547 } 605 }
548 $s .= '` als bottelgist'; 606 $s .= '` als bottelgist';
549 $this->Checkline($s); 607 $this->Checkline($s);
550 } 608 }
551 } 609 }
552 foreach($miscs as $item3) { 610 foreach($miscs as $item3) {
553 if ($item3['m_use_use'] == 5) { 611 if ($item3['m_use_use'] == 5) {
554 $unit = ($item3['m_amount_is_weight']) ? " gr ":" ml "; 612 $unit = ($item3['m_amount_is_weight']) ? " gr ":" ml ";
555 $s = sprintf("%.1f",$item3['m_amount']*1000).$unit.'`'; 613 $s = sprintf("%.1f",$item3['m_amount']*$factor*1000).$unit.'`';
556 $s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` bij bottelen toevoegen'; 614 $s .= iconv('UTF-8','windows-1252',$item3['m_name']).'` bij bottelen toevoegen';
557 $this->Checkline($s); 615 $this->Checkline($s);
558 } 616 }
559 } 617 }
560 } 618 }
561
562 } 619 }
563 620
564 621
565 622
566 class PDF extends PDF_MySQL_Table { 623 class PDF extends PDF_MySQL_Table {
567 function Header() { 624 function Header() {
568 global $row; 625 global $row;
569 global $prdate; 626 global $prdate;
570 $stage = array( 'Plan', 'Wacht', 'Brouwen', 'Hoofdgisting', 'Nagisting', 'Lagering', 'Afvullen', 'Hergisten', 'Rijpen', 'Proeven', 'Gereed', 'Afgesloten' ); 627 global $stage;
571 $this->Image('images/logo.png',10,10,30); 628 $this->Image('images/logo.png',10,10,30);
572 // Title 629 // Title
573 $this->SetFont('Helvetica','B',18); 630 $this->SetFont('Helvetica','B',18);
574 $this->SetX(45); 631 $this->SetX(45);
575 $this->Cell(0,8,$row['code'].' '.$row['name'],0,1,'L'); 632 $this->Cell(0,8,$row['code'].' '.$row['name'],0,1,'L');
578 $this->SetX(45); 635 $this->SetX(45);
579 $this->Cell(17,5,'Datum:',0,0,'L'); 636 $this->Cell(17,5,'Datum:',0,0,'L');
580 $this->Cell(0,5,$prdate,0,1,'L'); 637 $this->Cell(0,5,$prdate,0,1,'L');
581 $this->SetX(45); 638 $this->SetX(45);
582 $this->Cell(17,5,'Stijl:',0,0,'L'); 639 $this->Cell(17,5,'Stijl:',0,0,'L');
583 $this->Cell(0,5,$row['st_name'],0,1,'L'); 640 $st_name = iconv('UTF-8','windows-1252',$row['st_name']);
641 $this->Cell(0,5,$st_name,0,1,'L');
584 $this->SetX(45); 642 $this->SetX(45);
585 $this->Cell(17,5,'Fase:',0,0,'L'); 643 $this->Cell(17,5,'Fase:',0,0,'L');
586 $this->Cell(0,5,$stage[$row['stage']],0,1,'L'); 644 $this->Cell(0,5,$stage[$row['stage']],0,1,'L');
587 $this->Ln(6); 645 $this->SetX(45);
646 $this->Cell(17,5,'Batch:',0,0,'L');
647 if ($row['divide_parts'] == 0)
648 $this->Cell(0,5,"Niet gespitst",0,1,'L');
649 else
650 $this->Cell(0,5,"Split batch ".($row['divide_part'] + 1)." van ".($row['divide_parts'] + 1),0,1,'L');
651 $this->Ln(2);
588 // Ensure table header is printed 652 // Ensure table header is printed
589 parent::Header(); 653 parent::Header();
590 } 654 }
591 } 655 }
592 656

mercurial