www/js/global.js

Thu, 03 Jan 2019 20:56:47 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 03 Jan 2019 20:56:47 +0100
changeset 167
dabcd35f8f92
parent 164
0a5abea575a9
child 170
71850ebe5a1c
permissions
-rw-r--r--

Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.

13
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
2 * Copyright (C) 2014-2019
13
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of BrewCloud
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * BrewCloud is distributed in the hope that it will be useful, but
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
121
875aeb365e1c Added sparge pH during import. Added several calculations. Added calculated estimates to the brewday screen.
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
24 var sugardensity = 1.611; //kg/l in solution
875aeb365e1c Added sparge pH during import. Added several calculations. Added calculated estimates to the brewday screen.
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
25
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
26 // Styles dropdown list
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
27 var stylesUrl = "includes/db_profile_styles.php";
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
28 var stylesSource = {
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
29 datatype: "json",
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
30 datafields: [
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
31 { name: 'record', type: 'number' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
32 { name: 'name', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
33 { name: 'category', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
34 { name: 'category_number', type: 'number' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
35 { name: 'style_letter', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
36 { name: 'style_guide', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
37 { name: 'type', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
38 { name: 'og_min', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
39 { name: 'og_max', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
40 { name: 'fg_min', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
41 { name: 'fg_max', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
42 { name: 'ibu_min', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
43 { name: 'ibu_max', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
44 { name: 'color_min', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
45 { name: 'color_max', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
46 { name: 'carb_min', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
47 { name: 'carb_max', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
48 { name: 'abv_min', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
49 { name: 'abv_max', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
50 { name: 'notes', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
51 { name: 'profile', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
52 { name: 'ingredients', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
53 { name: 'examples', type: 'string' }
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
54 ],
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
55 url: stylesUrl,
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
56 async: true
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
57 };
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
58 var styleslist = new $.jqx.dataAdapter(stylesSource);
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
59
167
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
60 // Equipemnt dropdown list
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
61 var equipmentUrl = "includes/db_inventory_equipments.php";
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
62 var equipmentSource = {
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
63 datatype: "json",
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
64 datafields: [
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
65 { name: 'name', type: 'string' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
66 { name: 'boil_size', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
67 { name: 'batch_size', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
68 { name: 'tun_volume', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
69 { name: 'tun_weight', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
70 { name: 'tun_specific_heat', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
71 { name: 'tun_material', type: 'string' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
72 { name: 'tun_height', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
73 { name: 'top_up_water', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
74 { name: 'trub_chiller_loss', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
75 { name: 'evap_rate', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
76 { name: 'boil_time', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
77 { name: 'calc_boil_volume', type: 'bool' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
78 { name: 'top_up_kettle', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
79 { name: 'hop_utilization', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
80 { name: 'notes', type: 'string' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
81 { name: 'lauter_volume', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
82 { name: 'lauter_height', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
83 { name: 'lauter_deadspace', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
84 { name: 'kettle_volume', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
85 { name: 'kettle_height', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
86 { name: 'mash_volume', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
87 { name: 'mash_max', type: 'float' },
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
88 { name: 'efficiency', type: 'float' }
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
89 ],
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
90 url: equipmentUrl,
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
91 async: true
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
92 };
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
93 var equipmentlist = new $.jqx.dataAdapter(equipmentSource);
dabcd35f8f92 Added new brew project wizzard. Moved equipment dropdown to global script. The project birth date is allways read-only, so it can never be changed.
Michiel Broek <mbroek@mbse.eu>
parents: 164
diff changeset
94
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
95 // dropdownlist datasource from inventory_fermentables
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
96 var fermentableInvSource = {
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
97 datatype: "json",
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
98 datafields: [
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
99 { name: 'record', type: 'number' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
100 { name: 'name', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
101 { name: 'type', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
102 { name: 'yield', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
103 { name: 'color', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
104 { name: 'add_after_boil', type: 'bool' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
105 { name: 'origin', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
106 { name: 'supplier', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
107 { name: 'coarse_fine_diff', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
108 { name: 'moisture', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
109 { name: 'diastatic_power', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
110 { name: 'protein', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
111 { name: 'max_in_batch', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
112 { name: 'recommend_mash', type: 'bool' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
113 { name: 'graintype', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
114 { name: 'di_ph', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
115 { name: 'inventory', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
116 { name: 'cost', type: 'float' }
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
117 ],
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
118 url: "getfermentablesources.php",
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
119 async: true
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
120 };
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
121 var fermentableinstock = false;
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
122 var fermentablelist = new $.jqx.dataAdapter(fermentableInvSource, {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
123 beforeLoadComplete: function (records) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
124 var data = new Array();
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
125 for (var i = 0; i < records.length; i++) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
126 var row = records[i];
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
127 if (row.inventory || ! fermentableinstock)
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
128 data.push(row);
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
129 }
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
130 return data;
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
131 },
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
132 loadError: function(jqXHR, status, error) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
133 $('#err').text(status + ' ' + error);
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
134 },
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
135 });
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
136
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
137 // dropdownlist datasource from inventory_hops
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
138 var hopInvSource = {
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
139 datatype: "json",
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
140 datafields: [
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
141 { name: 'record', type: 'number' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
142 { name: 'name', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
143 { name: 'origin', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
144 { name: 'type', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
145 { name: 'alpha', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
146 { name: 'beta', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
147 { name: 'humulene', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
148 { name: 'caryophyllene', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
149 { name: 'cohumulone', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
150 { name: 'myrcene', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
151 { name: 'hsi', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
152 { name: 'useat', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
153 { name: 'form', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
154 { name: 'total_oil', type: 'float' },
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
155 { name: 'inventory', type: 'float' },
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
156 { name: 'cost', type: 'float' }
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
157 ],
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
158 url: "gethopsources.php",
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
159 async: true
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
160 };
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
161 var hopinstock = false;
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
162 var hoplist = new $.jqx.dataAdapter(hopInvSource, {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
163 beforeLoadComplete: function (records) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
164 var data = new Array();
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
165 for (var i = 0; i < records.length; i++) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
166 var row = records[i];
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
167 if (row.inventory || ! hopinstock)
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
168 data.push(row);
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
169 }
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
170 return data;
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
171 },
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
172 loadError: function(jqXHR, status, error) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
173 $('#err').text(status + ' ' + error);
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
174 },
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
175 });
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
176
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
177 // dropdownlist datasource from inventory_miscs
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
178 var miscInvSource = {
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
179 datatype: "json",
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
180 datafields: [
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
181 { name: 'record', type: 'number' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
182 { name: 'name', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
183 { name: 'type', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
184 { name: 'use_use', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
185 { name: 'amount_is_weight', type: 'bool' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
186 { name: 'time', type: 'float' },
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
187 { name: 'inventory', type: 'float' },
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
188 { name: 'cost', type: 'float' }
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
189 ],
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
190 url: "getmiscsources.php",
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
191 async: true
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
192 };
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
193 var miscinstock = false;
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
194 var misclist = new $.jqx.dataAdapter(miscInvSource, {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
195 beforeLoadComplete: function (records) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
196 var data = new Array();
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
197 for (var i = 0; i < records.length; i++) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
198 var row = records[i];
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
199 if (row.inventory || ! miscinstock)
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
200 data.push(row);
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
201 }
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
202 return data;
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
203 },
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
204 loadError: function(jqXHR, status, error) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
205 $('#err').text(status + ' ' + error);
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
206 },
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
207 });
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
208
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
209 // dropdownlist datasource from inventory_yeasts
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
210 var yeastInvSource = {
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
211 datatype: "json",
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
212 datafields: [
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
213 { name: 'record', type: 'number' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
214 { name: 'name', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
215 { name: 'type', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
216 { name: 'form', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
217 { name: 'laboratory', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
218 { name: 'product_id', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
219 { name: 'min_temperature', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
220 { name: 'max_temperature', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
221 { name: 'attenuation', type: 'float' },
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
222 { name: 'inventory', type: 'float' },
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
223 { name: 'cost', type: 'float' }
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
224 ],
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
225 url: "getyeastsources.php",
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
226 async: true
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
227 };
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
228 var yeastinstock = false;
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
229 var yeastlist = new $.jqx.dataAdapter(yeastInvSource, {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
230 beforeLoadComplete: function (records) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
231 var data = new Array();
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
232 for (var i = 0; i < records.length; i++) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
233 var row = records[i];
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
234 if (row.inventory || ! yeastinstock)
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
235 data.push(row);
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
236 }
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
237 return data;
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
238 },
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
239 loadError: function(jqXHR, status, error) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
240 $('#err').text(status + ' ' + error);
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
241 },
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
242 });
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
243
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
244 // dropdownlist datasource from inventory_waters
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
245 var waterInvSource = {
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
246 datatype: "json",
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
247 datafields: [
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
248 { name: 'record', type: 'number' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
249 { name: 'name', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
250 { name: 'unlimited_stock', type: 'bool' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
251 { name: 'calcium', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
252 { name: 'sulfate', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
253 { name: 'chloride', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
254 { name: 'sodium', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
255 { name: 'magnesium', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
256 { name: 'ph', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
257 { name: 'total_alkalinity', type: 'float' },
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
258 { name: 'inventory', type: 'float' },
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
259 { name: 'cost', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
260 ],
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
261 url: "getwatersources.php",
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
262 async: true
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
263 };
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
264 var waterinstock = false;
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
265 var waterlist = new $.jqx.dataAdapter(waterInvSource, {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
266 beforeLoadComplete: function (records) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
267 var data = new Array();
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
268 for (var i = 0; i < records.length; i++) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
269 var row = records[i];
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
270 if (row.inventory || row.unlimited_stock || ! waterinstock)
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
271 data.push(row);
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
272 }
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
273 return data;
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
274 },
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
275 loadError: function(jqXHR, status, error) {
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
276 $('#err').text(status + ' ' + error);
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
277 },
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
278 });
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
279
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
280 // dropdownlist datasource from profile_water
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
281 var waterProfileSource = {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
282 datatype: "json",
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
283 datafields: [
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
284 { name: 'record', type: 'number' },
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
285 { name: 'name', type: 'string' },
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
286 { name: 'calcium', type: 'float' },
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
287 { name: 'bicarbonate', type: 'float' },
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
288 { name: 'sulfate', type: 'float' },
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
289 { name: 'chloride', type: 'float' },
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
290 { name: 'sodium', type: 'float' },
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
291 { name: 'magnesium', type: 'float' },
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
292 { name: 'ph', type: 'float' },
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
293 { name: 'total_alkalinity', type: 'float' },
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
294 ],
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
295 url: "includes/db_profile_water.php",
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
296 async: true
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
297 };
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
298 var waterprofiles = new $.jqx.dataAdapter(waterProfileSource);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
299
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
300 // dropdownlist datasource from profile_mash
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
301 var mashInvSource = {
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
302 datatype: "json",
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
303 datafields: [
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
304 { name: 'record', type: 'number' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
305 { name: 'name', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
306 { name: 'steps', type: 'array' }
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
307 ],
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 144
diff changeset
308 url: "include/db_profile_mash.php",
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
309 async: true
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
310 };
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
311 var mashlist = new $.jqx.dataAdapter(mashInvSource);
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
312
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
313
121
875aeb365e1c Added sparge pH during import. Added several calculations. Added calculated estimates to the brewday screen.
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
314
13
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
315 function getLocalization() {
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
316 var localizationobj = {};
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
317 localizationobj.pagerGoToPageString = "Gehe zu:";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
318 localizationobj.pagerShowRowsString = "Zeige Zeile:";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
319 localizationobj.pagerRangeString = " von ";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
320 localizationobj.pagerNextButtonString = "voriger";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
321 localizationobj.pagerFirstButtonString = "first";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
322 localizationobj.pagerLastButtonString = "last";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
323 localizationobj.pagerPreviousButtonString = "nächster";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
324 localizationobj.sortAscendingString = "Sortiere aufsteigend";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
325 localizationobj.sortDescendingString = "Sortiere absteigend";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
326 localizationobj.sortRemoveString = "Entferne Sortierung";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
327 localizationobj.firstDay = 1;
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
328 localizationobj.percentSymbol = "%";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
329 localizationobj.currencySymbol = "€";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
330 localizationobj.currencySymbolPosition = "after";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
331 localizationobj.decimalSeparator = ",";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
332 localizationobj.thousandsSeparator = ".";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
333 var days = {
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
334 // full day names
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
335 names: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"],
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
336 // abbreviated day names
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
337 namesAbbr: ["Sonn", "Mon", "Dien", "Mitt", "Donn", "Fre", "Sams"],
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
338 // shortest day names
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
339 namesShort: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"]
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
340 };
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
341 localizationobj.days = days;
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
342 var months = {
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
343 // full month names (13 months for lunar calendards -- 13th month should be "" if not lunar)
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
344 names: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember", ""],
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
345 // abbreviated month names
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
346 namesAbbr: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dez", ""]
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
347 };
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
348 var patterns = {
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
349 d: "dd.MM.yyyy",
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
350 D: "dddd, d. MMMM yyyy",
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
351 t: "HH:mm",
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
352 T: "HH:mm:ss",
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
353 f: "dddd, d. MMMM yyyy HH:mm",
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
354 F: "dddd, d. MMMM yyyy HH:mm:ss",
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
355 M: "dd MMMM",
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
356 Y: "MMMM yyyy"
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
357 }
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
358 localizationobj.patterns = patterns;
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
359 localizationobj.months = months;
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
360 return localizationobj;
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
361 }
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
362
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
363
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
364
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
365 $(document).ready(function () {
34
a720353fada9 Formatting and measurements
Michiel Broek <mbroek@mbse.eu>
parents: 13
diff changeset
366
13
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
367 $("#jqxMenu").jqxMenu({
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
368 width: 1280,
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
369 height: '30px',
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
370 theme: theme
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
371 });
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
372 $("#jqxWidget").css('visibility', 'visible');
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
373 });
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
374
59
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
375
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
376
98
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
377 function ebc_to_srm(ebc) {
100
08c92cb740b9 Fix for missing coor info on fermentables during recipes import. Log when srm or ebc values are negatie during conversions. Load setup record in global.inc.php and make some variables available for PHP and JS.
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
378 var srm = -1.32303E-12 * Math.pow(ebc, 4) - 0.00000000291515 * Math.pow(ebc, 3) + 0.00000818515 * Math.pow(ebc, 2) + 0.372038 * ebc + 0.596351;
08c92cb740b9 Fix for missing coor info on fermentables during recipes import. Log when srm or ebc values are negatie during conversions. Load setup record in global.inc.php and make some variables available for PHP and JS.
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
379 if ((ebc < 0) || (srm < 0))
08c92cb740b9 Fix for missing coor info on fermentables during recipes import. Log when srm or ebc values are negatie during conversions. Load setup record in global.inc.php and make some variables available for PHP and JS.
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
380 console.log("ebc_to_srm("+ebc+") = "+srm);
08c92cb740b9 Fix for missing coor info on fermentables during recipes import. Log when srm or ebc values are negatie during conversions. Load setup record in global.inc.php and make some variables available for PHP and JS.
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
381 return srm
98
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
382 }
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
383
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
384
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
385
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
386 function srm_to_ebc(srm)
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
387 {
100
08c92cb740b9 Fix for missing coor info on fermentables during recipes import. Log when srm or ebc values are negatie during conversions. Load setup record in global.inc.php and make some variables available for PHP and JS.
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
388 var ebc = Math.round(0.000000000176506 * Math.pow(srm, 4) + 0.000000154529 * Math.pow(srm, 3) - 0.000159428 * Math.pow(srm, 2) + 2.68837 * srm - 1.6004);
08c92cb740b9 Fix for missing coor info on fermentables during recipes import. Log when srm or ebc values are negatie during conversions. Load setup record in global.inc.php and make some variables available for PHP and JS.
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
389 if ((ebc < 0) || (srm < 0))
08c92cb740b9 Fix for missing coor info on fermentables during recipes import. Log when srm or ebc values are negatie during conversions. Load setup record in global.inc.php and make some variables available for PHP and JS.
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
390 console.log("srm_to_ebc("+srm+") = "+ebc);
08c92cb740b9 Fix for missing coor info on fermentables during recipes import. Log when srm or ebc values are negatie during conversions. Load setup record in global.inc.php and make some variables available for PHP and JS.
Michiel Broek <mbroek@mbse.eu>
parents: 98
diff changeset
391 return ebc;
98
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
392 }
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
393
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
394
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
395
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
396 /*
133
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 121
diff changeset
397 * Alcohol By Volume
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 121
diff changeset
398 */
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 121
diff changeset
399 function abvol(og, fg) {
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 121
diff changeset
400
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 121
diff changeset
401 if ((4.749804 - fg) != 0)
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 121
diff changeset
402 return 486.8693 * (og - fg) / (4.749804 - fg);
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 121
diff changeset
403 return 0;
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 121
diff changeset
404 }
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 121
diff changeset
405
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 121
diff changeset
406
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 121
diff changeset
407
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 121
diff changeset
408 /*
98
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
409 * Kleurwerking naar SRM
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
410 */
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
411 function kw_to_srm(colormethod, c) {
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
412
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
413 if (colormethod == "Morey")
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
414 return 1.4922 * Math.pow(c, 0.6859);
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
415 if (colormethod == "Mosher")
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
416 return 0.3 * c + 4.7;
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
417 if (colormethod == "Daniels")
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
418 return 0.2 * c + 8.4;
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
419 }
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
420
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
421
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
422
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
423 function kw_to_ebc(colormethod, c) {
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
424 return srm_to_ebc(kw_to_srm(colormethod, c));
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
425 }
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
426
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
427
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
428
59
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
429 /*
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
430 * Berekeningen uit https://www.hobbybrouwen.nl/forum/index.php/topic,6079.msg69464.html#msg69464
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
431 */
101
5b6bb99bc52a IBU calculations now use the setup values. All setup values are now global available.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
432 function toIBU(Use, Form, SG, Volume, Amount, Boiltime, Alpha, Method)
5b6bb99bc52a IBU calculations now use the setup values. All setup values are now global available.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
433 {
59
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
434 var gravity = parseFloat(SG);
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
435 var liters = parseFloat(Volume);
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
436 var alpha = parseFloat(Alpha)/100;
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
437 var mass = parseFloat(Amount) * 1000;
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
438 var time = parseFloat(Boiltime);
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
439 var fmoment = 1.0;
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
440 var pfactor = 1.0;
92
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
441 var ibu = 0;
59
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
442
92
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
443 if ((Use == "Dry Hop") || (Use == "Dry hop") || (Use == "Whirlpool") || (Use == "Aroma")) {
59
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
444 fmoment = 0.0;
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
445 } else if (Use == "Mash") {
101
5b6bb99bc52a IBU calculations now use the setup values. All setup values are now global available.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
446 fmoment += my_factor_mashhop / 100; // Brouwhulp
59
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
447 } else if ((Use == "First Wort") || (Use == "First wort")) {
101
5b6bb99bc52a IBU calculations now use the setup values. All setup values are now global available.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
448 fmoment += my_factor_fwh / 100; // Brouwhulp, Louis, Ozzie
59
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
449 }
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
450
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
451 if (Form == "Pellet") {
101
5b6bb99bc52a IBU calculations now use the setup values. All setup values are now global available.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
452 pfactor += my_factor_pellet / 100;
92
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
453 }
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
454 if (Form == "Plug" ) {
101
5b6bb99bc52a IBU calculations now use the setup values. All setup values are now global available.
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
455 pfactor += my_factor_plug / 100;
59
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
456 }
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
457
92
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
458 if (Method == "Tinseth") {
98
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
459 /* http://realbeer.com/hops/research.html */
92
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
460 var AddedAlphaAcids = (alpha * mass * 1000) / liters;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
461 var Bigness_factor = 1.65 * Math.pow( 0.000125, gravity - 1);
98
92d6bc8a4cdd Added javascript formulas for color calculations. Added IBU total calculation. Better IBI calculation for the hop entries. Blocked selection of IBU calculation for Garetz, Mosher and Noonan. Better sg calculation in the recipe print.
Michiel Broek <mbroek@mbse.eu>
parents: 96
diff changeset
462 var BoilTime_factor = ((1 - Math.exp(-0.04 * time)) / 4.15);
92
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
463 var utiisation = Bigness_factor * BoilTime_factor;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
464 ibu = Math.round(utiisation * AddedAlphaAcids * fmoment * pfactor * 10) / 10.0;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
465 }
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
466 if (Method == "Daniels") {
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
467 var boilfactor;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
468 var sgfactor;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
469 if (Form == "Leaf")
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
470 boilfactor = -(0.0041*time*time)+(0.6162*time)+1.5779;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
471 else
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
472 boilfactor = -(0.0051*time*time)+(0.7835*time)+1.9348;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
473 if (gravity < 1050)
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
474 sgfactor = 0;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
475 else
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
476 sgfactor = (gravity - 1050) / 200;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
477 ibu = Math.round(fmoment * ((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor))) * 10) / 10;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
478 }
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
479 if (Method == "Rager") {
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
480 var boilfactor;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
481 var sgfactor;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
482 boilfactor = fmoment * 18.11 + 13.86 * Math.tanh((time * 31.32) / 18.27);
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
483 if (gravity < 1050)
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
484 sgfactor = 0;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
485 else
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
486 sgfactor = (gravity - 1050) / 200;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
487 ibu = Math.round((mass * (alpha * 100) * boilfactor * 0.1) / (liters * (1 + sgfactor)) * 10) / 10;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
488 }
59
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
489
133
22d28dd9c041 Added ABV calculation. Added calculate fermentables from OG calculation. Scale fermentables when the OG changes.
Michiel Broek <mbroek@mbse.eu>
parents: 121
diff changeset
490 // console.log("toIBU("+Use+","+Form+","+SG+","+Volume+","+Amount+","+Boiltime+","+Alpha+","+Method+"):"+ibu+" fm:"+fmoment+" pf:"+pfactor);
59
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
491 return ibu;
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
492 }
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
493
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
494
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
495
139
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
496 function ebc_to_color(ebc) {
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
497 return srm_to_color(ebc_to_srm(ebc));
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
498 }
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
499
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
500
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
501
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
502 function srm_to_color(srm) {
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
503
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
504 i = Math.round(srm * 10);
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
505 if (i < 0) {
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
506 i = 0;
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
507 }
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
508 if (i > 299) {
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
509 i = 299;
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
510 }
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
511
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
512 /* Table copied from Brouwhulp/BrewBuddy */
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
513 var R = [ 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, // 0
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
514 250, 250, 250, 250, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, // 2
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
515 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, // 4
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
516 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 200, 199, 199, 198, 198, // 6
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
517 197, 197, 196, 196, 195, 195, 194, 194, 193, 193, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, // 8
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
518 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, // 10
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
519 192, 192, 192, 192, 192, 192, 192, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, // 12
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
520 179, 178, 177, 175, 174, 172, 171, 169, 168, 167, 195, 164, 162, 161, 159, 158, 157, 155, 154, 152, // 14
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
521 151, 149, 148, 147, 145, 144, 142, 141, 139, 138, 137, 135, 134, 132, 131, 129, 128, 127, 125, 124, // 16
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
522 122, 121, 119, 118, 117, 115, 114, 112, 111, 109, 108, 107, 105, 104, 102, 101, 99, 98, 97, 95, // 18
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
523 94, 92, 91, 89, 88, 87, 85, 84, 82, 81, 79, 78, 77, 75, 74, 72, 71, 69, 68, 67, // 20
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
524 65, 64, 62, 61, 59, 58, 57, 55, 54, 52, 51, 49, 48, 47, 45, 44, 43, 41, 39, 38, // 22
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
525 37, 37, 36, 36, 35, 35, 34, 34, 33, 33, 32, 32, 31, 31, 30, 30, 29, 29, 28, 28, // 24
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
526 27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 19, 18, 18, // 26
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
527 17, 17, 16, 16, 15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8 ];
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
528
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
529 var G = [ 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
530 250, 250, 250, 250, 250, 250, 249, 248, 247, 246, 245, 244, 242, 240, 238, 236, 234, 232, 230, 228,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
531 226, 224, 222, 220, 218, 216, 214, 212, 210, 208, 206, 204, 202, 200, 198, 196, 194, 192, 190, 188,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
532 186, 184, 182, 180, 178, 176, 174, 172, 170, 168, 166, 164, 162, 160, 158, 156, 154, 152, 150, 148,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
533 146, 144, 142, 141, 140, 139, 139, 138, 137, 136, 136, 135, 134, 133, 133, 132, 131, 130, 130, 129,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
534 128, 127, 127, 126, 125, 124, 124, 123, 122, 121, 121, 120, 119, 118, 118, 117, 116, 115, 115, 114,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
535 113, 112, 112, 111, 110, 109, 109, 108, 107, 106, 106, 105, 104, 103, 103, 102, 101, 100, 100, 99,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
536 98, 97, 97, 96, 95, 94, 94, 93, 92, 91, 91, 90, 89, 88, 88, 87, 86, 85, 85, 84,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
537 83, 82, 82, 81, 80, 79, 78, 77, 76, 75, 75, 74, 73, 72, 72, 71, 70, 69, 69, 68,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
538 67, 66, 66, 65, 64, 63, 63, 62, 61, 60, 60, 59, 58, 57, 57, 56, 55, 54, 54, 53,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
539 52, 51, 51, 50, 49, 48, 48, 47, 46, 45, 45, 44, 43, 42, 42, 41, 40, 39, 39, 38,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
540 37, 36, 36, 35, 34, 33, 33, 32, 31, 30, 30, 29, 28, 27, 27, 26, 25, 24, 24, 23,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
541 22, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 16, 16,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
542 16, 15, 15, 15, 14, 14, 14, 13, 13, 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 9,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
543 9, 9, 8, 8, 8, 7, 7, 7, 6, 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3 ];
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
544
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
545 var B = [ 210, 204, 199, 193, 188, 182, 177, 171, 166, 160, 155, 149, 144, 138, 133, 127, 122, 116, 111, 105,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
546 100, 94, 89, 83, 78, 72, 67, 61, 56, 50, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
547 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
548 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
549 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
550 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
551 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
552 56, 56, 56, 55, 55, 55, 55, 54, 54, 54, 54, 53, 53, 53, 53, 52, 52, 52, 52, 51,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
553 51, 51, 51, 50, 50, 50, 50, 49, 49, 48, 47, 47, 46, 45, 45, 44, 43, 43, 42, 41,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
554 41, 40, 39, 39, 38, 37, 37, 36, 35, 34, 33, 32, 31, 29, 28, 27, 26, 25, 24, 23,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
555 21, 20, 19, 18, 17, 16, 15, 13, 12, 11, 10, 9, 8, 9, 9, 10, 10, 11, 11, 12,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
556 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
557 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 17, 16, 16, 15, 15,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
558 15, 14, 14, 14, 13, 13, 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 9, 9, 9, 8,
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
559 8, 8, 7, 7, 7, 6, 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2 ];
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
560
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
561 var color = R[i] * 65536 + G[i] * 256 + B[i];
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
562 var result = color.toString(16).toUpperCase();
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
563 if (result.length < 6) {
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
564 result = '0' + result;
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
565 }
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
566 result = '#' + result;
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
567 return result;
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
568 }
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
569
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
570
eb1ac7487710 Added EBC color examples. Added simple progessbars for hop flavour and aroma contribution. We need something better. In the fermentables tab, above the grid display the malt color and OG estimates. Display supplier as well in the fermentables grid.
Michiel Broek <mbroek@mbse.eu>
parents: 136
diff changeset
571
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
572 function sg_to_plato(sg) {
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
573 if (sg > 0.5)
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
574 return 259 - 259 / sg;
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
575 return 0;
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
576 }
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
577
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
578
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
579
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
580 function plato_to_sg(plato) {
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
581 if (plato < 259)
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
582 return 259 / (259 - plato);
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
583 return 1.000;
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
584 }
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
585
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
586
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
587
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
588 function estimate_sg(sugars, batch_size) {
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
589 var plato = 100 * sugars / batch_size;
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
590
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
591 var sg = plato_to_sg(plato);
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
592 for (var i = 0; i < 20; i++) {
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
593 if (sg > 0)
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
594 plato = 100 * sugars / (batch_size * sg);
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
595 sg = plato_to_sg(plato);
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
596 }
121
875aeb365e1c Added sparge pH during import. Added several calculations. Added calculated estimates to the brewday screen.
Michiel Broek <mbroek@mbse.eu>
parents: 101
diff changeset
597 // console.log("estimate_sg(" + sugars + "," + batch_size + ") : " + sg);
96
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
598 return sg;
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
599 }
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
600
107c12c3e49d Renamed estimate_og() to estimate_sg() formula. Updated the formulas in javascript. The calcFermenter() function now only calculates the gravities. The colors still need to be added. When a recept is loaded in the editor, all tabs are selected once to load all subgrid data. Ugly and slow but it at least it works.
Michiel Broek <mbroek@mbse.eu>
parents: 94
diff changeset
601
136
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
602
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
603 function estimate_fg(percSugar, percCara, WGratio, TotTme, Temp, attenuation, og) {
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
604
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
605 var BD;
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
606
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
607 console.log("estimate_fg("+percSugar+","+percCara+","+WGratio+","+TotTme+","+Temp+","+attenuation+","+og+")");
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
608
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
609 if (percSugar > 40)
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
610 percSugar = 0;
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
611 if (percCara > 50)
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
612 percCara = 0;
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
613 if ((WGratio > 0) && (TotTme > 0)) {
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
614 BD = WGratio;
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
615 BD = max(2, min(5.5, BD));
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
616 Temp = max(60, min(72, Temp));
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
617 } else {
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
618 BD = 3.5;
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
619 Temp = 67;
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
620 TotTme = 75;
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
621 }
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
622 if (attenuation < 30)
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
623 attenuation = 77;
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
624
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
625 var AttBeer = 0.00825 * attenuation + 0.00817 * BD - 0.00684 * Temp + 0.00026 * TotTme - 0.00356 * percCara + 0.00553 * percSugar + 0.547;
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
626 var fg = Math.round((1 + (1 - AttBeer) * (og - 1)) * 1000) / 1000;
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
627 console.log("fg:"+fg);
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
628 return fg;
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
629 }
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
630
bcc4583fd013 Fixed estimate FG calculation during recipes import. Added estimate FG calculation in the recipe editor but do not yet update the recipe. Added SVG calculation to the recipes editor. Added calculations for hop aroma and flavour contribution.
Michiel Broek <mbroek@mbse.eu>
parents: 133
diff changeset
631
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
632 function CalcFrac(TpH, pK1, pK2, pK3) {
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
633
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
634 var r1d = Math.pow(10, TpH - pK1);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
635 var r2d = Math.pow(10, TpH - pK2);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
636 var r3d = Math.pow(10, TpH - pK3);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
637 var dd = 1/(1 + r1d + r1d*r2d + r1d*r2d*r3d);
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
638 var f1d = dd;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
639 var f2d = r1d*dd;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
640 var f3d = r1d*r2d*dd;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
641 var f4d = r1d*r2d*r3d*dd;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
642 return f2d + 2*f3d + 3*f4d;
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
643 }
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
644
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
645

mercurial