Sat, 11 May 2019 23:13:40 +0200
Added flags for each ingredient group for the supplies state. On the main screen show the state of the supplies if the product stage is not yet packaged. Calculate the state of the supplies for fermentables, hops, yeasts and miscs. In the grids don't show the inventory values after they are used and reduced. On the fermentables tab show the weight of the grains to mash.
294
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | <?php |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | require_once('config.php'); |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | if (isset($_GET["code"])) |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | $code = $_GET["code"]; |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | else |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | $code = "CB0011"; |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | $connect = mysqli_connect(DBASE_HOST, DBASE_USER, DBASE_PASS, DBASE_NAME); |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | if (! $connect) { |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error()); |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | } |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | mysqli_set_charset($connect, "utf8" ); |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | |
297
5e2424bfbc4a
Added import brew json logfiles
Michiel Broek <mbroek@mbse.eu>
parents:
296
diff
changeset
|
16 | $query = "SELECT * FROM log_brews WHERE code='".$code."' ORDER BY datetime;"; |
294
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect)); |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | $lines[] = array( |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | 'record' => $row['record'], |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | 'date' => substr($row['datetime'],0,16), |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | 'version' => $row['version'], |
297
5e2424bfbc4a
Added import brew json logfiles
Michiel Broek <mbroek@mbse.eu>
parents:
296
diff
changeset
|
23 | 'code' => $row['code'], |
5e2424bfbc4a
Added import brew json logfiles
Michiel Broek <mbroek@mbse.eu>
parents:
296
diff
changeset
|
24 | 'name' => $row['name'], |
5e2424bfbc4a
Added import brew json logfiles
Michiel Broek <mbroek@mbse.eu>
parents:
296
diff
changeset
|
25 | 'pv_mlt' => $row['pv_mlt'], |
5e2424bfbc4a
Added import brew json logfiles
Michiel Broek <mbroek@mbse.eu>
parents:
296
diff
changeset
|
26 | 'pv_hlt' => $row['pv_hlt'], |
5e2424bfbc4a
Added import brew json logfiles
Michiel Broek <mbroek@mbse.eu>
parents:
296
diff
changeset
|
27 | 'pv_room' => $row['pv_room'], |
5e2424bfbc4a
Added import brew json logfiles
Michiel Broek <mbroek@mbse.eu>
parents:
296
diff
changeset
|
28 | 'sp_mlt' => $row['sp_mlt'], |
5e2424bfbc4a
Added import brew json logfiles
Michiel Broek <mbroek@mbse.eu>
parents:
296
diff
changeset
|
29 | 'sp_hlt' => $row['sp_hlt'], |
5e2424bfbc4a
Added import brew json logfiles
Michiel Broek <mbroek@mbse.eu>
parents:
296
diff
changeset
|
30 | 'pwm_mlt' => $row['pwm_mlt'], |
5e2424bfbc4a
Added import brew json logfiles
Michiel Broek <mbroek@mbse.eu>
parents:
296
diff
changeset
|
31 | 'pwm_hlt' => $row['pwm_hlt'], |
294
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | 'event' => $row['event'] |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | ); |
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | } |
296
69fadd1aded2
Updated design document. Add content header application/json to all scripts that produce json output. Chart prints show the beer code and name in the header. Charts don't display the menu anymore.
Michiel Broek <mbroek@mbse.eu>
parents:
294
diff
changeset
|
35 | header("Content-type: application/json"); |
294
1e09d1d102a8
Updated crontask to check for fermentation logs and update the products. Added initial brew log graph.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | echo json_encode($lines); |