242 $mash .= ',"step_infuse_amount":' . $item['step_infuse_amount']; |
242 $mash .= ',"step_infuse_amount":' . $item['step_infuse_amount']; |
243 else |
243 else |
244 $mash .= ',"step_infuse_amount":0'; |
244 $mash .= ',"step_infuse_amount":0'; |
245 $mash .= ',"step_temp":' . $item['step_temp']; |
245 $mash .= ',"step_temp":' . $item['step_temp']; |
246 $mash .= ',"step_time":' . $item['step_time']; |
246 $mash .= ',"step_time":' . $item['step_time']; |
|
247 $mash .= ',"step_thickness":' . $item['step_thickness']; |
247 $mash .= ',"ramp_time":' . $item['ramp_time']; |
248 $mash .= ',"ramp_time":' . $item['ramp_time']; |
248 $mash .= ',"end_temp":' . $item['end_temp'] . '}'; |
249 $mash .= ',"end_temp":' . $item['end_temp'] . '}'; |
249 //syslog(LOG_NOTICE, $mash); |
|
250 $mashs .= $mash; |
250 $mashs .= $mash; |
251 } |
251 } |
252 } |
252 } |
253 $mashs .= ']'; |
253 $mashs .= ']'; |
254 $sql .= "', json_mashs='" . $mashs; |
254 $sql .= "', json_mashs='" . $mashs; |
373 $recipes .= ',"wa_base_name":' . $row['wa_base_name']; |
374 $recipes .= ',"wa_base_name":' . $row['wa_base_name']; |
374 if (isset($_GET['record'])) { |
375 if (isset($_GET['record'])) { |
375 // Append stock information. |
376 // Append stock information. |
376 $fermentables = json_decode($row['json_fermentables'], true); |
377 $fermentables = json_decode($row['json_fermentables'], true); |
377 for ($i = 0; $i < count($fermentables); $i++) { |
378 for ($i = 0; $i < count($fermentables); $i++) { |
|
379 if ($fermentables[$i]['f_added'] == 0) { |
|
380 $mashkg += $fermentables[$i]['f_amount']; |
|
381 } |
378 $fermentables[$i]['f_inventory'] = 0; // Not in stock |
382 $fermentables[$i]['f_inventory'] = 0; // Not in stock |
379 $fermentables[$i]['f_avail'] = 0; // Ingredient not in db |
383 $fermentables[$i]['f_avail'] = 0; // Ingredient not in db |
380 $sql2 = "SELECT inventory FROM inventory_fermentables "; |
384 $sql2 = "SELECT inventory FROM inventory_fermentables "; |
381 $sql2 .= "WHERE name='".str_replace($rescapers, $rreplacements, $fermentables[$i]['f_name'])."' AND"; |
385 $sql2 .= "WHERE name='".str_replace($rescapers, $rreplacements, $fermentables[$i]['f_name'])."' AND"; |
382 $sql2 .= " supplier='".str_replace($rescapers, $rreplacements, $fermentables[$i]['f_supplier'])."'"; |
386 $sql2 .= " supplier='".str_replace($rescapers, $rreplacements, $fermentables[$i]['f_supplier'])."'"; |
451 $recipes .= ',"fermentables":' . $row['json_fermentables']; |
455 $recipes .= ',"fermentables":' . $row['json_fermentables']; |
452 $recipes .= ',"hops":' . $row['json_hops']; |
456 $recipes .= ',"hops":' . $row['json_hops']; |
453 $recipes .= ',"miscs":' . $row['json_miscs']; |
457 $recipes .= ',"miscs":' . $row['json_miscs']; |
454 $recipes .= ',"yeasts":' . $row['json_yeasts']; |
458 $recipes .= ',"yeasts":' . $row['json_yeasts']; |
455 } |
459 } |
456 $recipes .= ',"mashs":' . $row['json_mashs']; |
460 if (isset($_GET['record'])) { |
|
461 $volume = 0; |
|
462 $mashs = json_decode($row['json_mashs'], true); |
|
463 for ($i = 0; $i < count($mashs); $i++) { |
|
464 $volume += $mashs[$i]['step_infuse_amount']; |
|
465 if ($mashkg > 0) |
|
466 $mashs[$i]['step_thickness'] = floatval(sprintf("%.3f", $volume / $mashkg)); |
|
467 else |
|
468 $mashs[$i]['step_thickness'] = 0; |
|
469 } |
|
470 $recipes .= ',"mashs":' . json_encode($mashs, JSON_UNESCAPED_UNICODE); |
|
471 } else { |
|
472 $recipes .= ',"mashs":' . $row['json_mashs']; |
|
473 } |
457 $recipes .= '}'; |
474 $recipes .= '}'; |
458 } |
475 } |
459 $recipes .= ']'; |
476 $recipes .= ']'; |
460 header("Content-type: application/json"); |
477 header("Content-type: application/json"); |
461 echo $recipes; |
478 echo $recipes; |