www/js/global.js

Wed, 02 Jan 2019 17:34:53 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 02 Jan 2019 17:34:53 +0100
changeset 164
0a5abea575a9
parent 149
ff45488d480e
child 167
dabcd35f8f92
permissions
-rw-r--r--

Added the last tab, fermentation to the product editer.

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
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
60 // dropdownlist datasource from inventory_fermentables
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
61 var fermentableInvSource = {
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
62 datatype: "json",
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
63 datafields: [
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
64 { name: 'record', type: 'number' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
65 { name: 'name', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
66 { name: 'type', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
67 { name: 'yield', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
68 { name: 'color', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
69 { name: 'add_after_boil', type: 'bool' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
70 { name: 'origin', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
71 { name: 'supplier', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
72 { name: 'coarse_fine_diff', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
73 { name: 'moisture', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
74 { name: 'diastatic_power', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
75 { name: 'protein', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
76 { name: 'max_in_batch', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
77 { name: 'recommend_mash', type: 'bool' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
78 { name: 'graintype', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
79 { name: 'di_ph', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
80 { name: 'inventory', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
81 { name: 'cost', type: 'float' }
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
82 ],
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
83 url: "getfermentablesources.php",
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
84 async: true
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
85 };
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
86 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
87 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
88 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
89 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
90 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
91 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
92 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
93 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
94 }
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
95 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
96 },
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
97 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
98 $('#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
99 },
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
100 });
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
101
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
102 // dropdownlist datasource from inventory_hops
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
103 var hopInvSource = {
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
104 datatype: "json",
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
105 datafields: [
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
106 { name: 'record', type: 'number' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
107 { name: 'name', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
108 { name: 'origin', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
109 { name: 'type', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
110 { name: 'alpha', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
111 { name: 'beta', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
112 { name: 'humulene', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
113 { name: 'caryophyllene', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
114 { name: 'cohumulone', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
115 { name: 'myrcene', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
116 { name: 'hsi', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
117 { name: 'useat', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
118 { name: 'form', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
119 { 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
120 { name: 'inventory', type: 'float' },
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
121 { name: 'cost', type: 'float' }
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
122 ],
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
123 url: "gethopsources.php",
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
124 async: true
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
125 };
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
126 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
127 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
128 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
129 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
130 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
131 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
132 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
133 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
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 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
136 },
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
137 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
138 $('#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
139 },
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
140 });
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
141
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
142 // dropdownlist datasource from inventory_miscs
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
143 var miscInvSource = {
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
144 datatype: "json",
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
145 datafields: [
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
146 { name: 'record', type: 'number' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
147 { name: 'name', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
148 { name: 'type', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
149 { name: 'use_use', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
150 { name: 'amount_is_weight', type: 'bool' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
151 { 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
152 { name: 'inventory', type: 'float' },
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
153 { name: 'cost', type: 'float' }
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
154 ],
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 url: "getmiscsources.php",
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
156 async: true
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 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
159 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
160 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
161 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
162 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
163 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
164 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
165 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
166 }
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 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
168 },
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 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
170 $('#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
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 });
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
173
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
174 // dropdownlist datasource from inventory_yeasts
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
175 var yeastInvSource = {
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
176 datatype: "json",
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
177 datafields: [
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
178 { name: 'record', type: 'number' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
179 { name: 'name', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
180 { name: 'type', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
181 { name: 'form', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
182 { name: 'laboratory', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
183 { name: 'product_id', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
184 { name: 'min_temperature', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
185 { name: 'max_temperature', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
186 { 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
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: "getyeastsources.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 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
194 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
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 || ! 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
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_waters
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
210 var waterInvSource = {
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: 'unlimited_stock', type: 'bool' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
216 { name: 'calcium', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
217 { name: 'sulfate', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
218 { name: 'chloride', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
219 { name: 'sodium', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
220 { name: 'magnesium', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
221 { name: 'ph', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
222 { 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
223 { name: 'inventory', type: 'float' },
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
224 { name: 'cost', type: 'float' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
225 ],
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
226 url: "getwatersources.php",
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
227 async: true
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
228 };
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
229 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
230 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
231 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
232 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
233 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
234 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
235 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
236 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
237 }
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 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
239 },
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 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
241 $('#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
242 },
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
243 });
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
244
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
245 // 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
246 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
247 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
248 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
249 { 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
250 { 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
251 { 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
252 { 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
253 { 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
254 { 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
255 { 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
256 { 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
257 { 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
258 { 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
259 ],
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
260 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
261 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
262 };
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
263 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
264
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
265 // dropdownlist datasource from profile_mash
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
266 var mashInvSource = {
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
267 datatype: "json",
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
268 datafields: [
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
269 { name: 'record', type: 'number' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
270 { name: 'name', type: 'string' },
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
271 { name: 'steps', type: 'array' }
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
272 ],
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
273 url: "include/db_profile_mash.php",
144
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
274 async: true
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
275 };
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
276 var mashlist = new $.jqx.dataAdapter(mashInvSource);
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
277
ae15cfe5f008 Moved inventory dropdown lists to global.js
Michiel Broek <mbroek@mbse.eu>
parents: 139
diff changeset
278
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
279
13
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
280 function getLocalization() {
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
281 var localizationobj = {};
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
282 localizationobj.pagerGoToPageString = "Gehe zu:";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
283 localizationobj.pagerShowRowsString = "Zeige Zeile:";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
284 localizationobj.pagerRangeString = " von ";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
285 localizationobj.pagerNextButtonString = "voriger";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
286 localizationobj.pagerFirstButtonString = "first";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
287 localizationobj.pagerLastButtonString = "last";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
288 localizationobj.pagerPreviousButtonString = "nächster";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
289 localizationobj.sortAscendingString = "Sortiere aufsteigend";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
290 localizationobj.sortDescendingString = "Sortiere absteigend";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
291 localizationobj.sortRemoveString = "Entferne Sortierung";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
292 localizationobj.firstDay = 1;
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
293 localizationobj.percentSymbol = "%";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
294 localizationobj.currencySymbol = "€";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
295 localizationobj.currencySymbolPosition = "after";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
296 localizationobj.decimalSeparator = ",";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
297 localizationobj.thousandsSeparator = ".";
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
298 var days = {
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
299 // full day names
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
300 names: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"],
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
301 // abbreviated day names
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
302 namesAbbr: ["Sonn", "Mon", "Dien", "Mitt", "Donn", "Fre", "Sams"],
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
303 // shortest day names
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
304 namesShort: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"]
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
305 };
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
306 localizationobj.days = days;
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
307 var months = {
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
308 // 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
309 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
310 // abbreviated month names
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
311 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
312 };
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
313 var patterns = {
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
314 d: "dd.MM.yyyy",
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
315 D: "dddd, d. MMMM yyyy",
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
316 t: "HH:mm",
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
317 T: "HH:mm:ss",
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
318 f: "dddd, d. MMMM yyyy HH:mm",
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
319 F: "dddd, d. MMMM yyyy HH:mm:ss",
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
320 M: "dd MMMM",
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
321 Y: "MMMM yyyy"
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
322 }
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
323 localizationobj.patterns = patterns;
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
324 localizationobj.months = months;
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
325 return localizationobj;
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
326 }
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
327
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
328
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
329
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
330 $(document).ready(function () {
34
a720353fada9 Formatting and measurements
Michiel Broek <mbroek@mbse.eu>
parents: 13
diff changeset
331
13
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
332 $("#jqxMenu").jqxMenu({
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
333 width: 1280,
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
334 height: '30px',
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
335 theme: theme
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
336 });
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
337 $("#jqxWidget").css('visibility', 'visible');
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
338 });
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
339
59
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
340
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
341
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
342 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
343 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
344 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
345 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
346 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
347 }
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
348
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
349
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
350
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
351 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
352 {
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
353 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
354 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
355 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
356 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
357 }
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
358
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
359
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
360
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
361 /*
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
362 * 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
363 */
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
364 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
365
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
366 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
367 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
368 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
369 }
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
370
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
371
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
372
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
373 /*
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
374 * 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
375 */
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
376 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
377
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
378 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
379 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
380 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
381 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
382 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
383 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
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
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
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
388 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
389 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
390 }
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
391
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
59
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
394 /*
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
395 * 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
396 */
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
397 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
398 {
59
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
399 var gravity = parseFloat(SG);
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
400 var liters = parseFloat(Volume);
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
401 var alpha = parseFloat(Alpha)/100;
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
402 var mass = parseFloat(Amount) * 1000;
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
403 var time = parseFloat(Boiltime);
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
404 var fmoment = 1.0;
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
405 var pfactor = 1.0;
92
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
406 var ibu = 0;
59
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
407
92
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
408 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
409 fmoment = 0.0;
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
410 } 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
411 fmoment += my_factor_mashhop / 100; // Brouwhulp
59
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
412 } 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
413 fmoment += my_factor_fwh / 100; // Brouwhulp, Louis, Ozzie
59
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
414 }
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
415
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
416 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
417 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
418 }
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
419 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
420 pfactor += my_factor_plug / 100;
59
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
421 }
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
422
92
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
423 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
424 /* 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
425 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
426 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
427 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
428 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
429 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
430 }
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
431 if (Method == "Daniels") {
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
432 var boilfactor;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
433 var sgfactor;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
434 if (Form == "Leaf")
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
435 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
436 else
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
437 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
438 if (gravity < 1050)
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
439 sgfactor = 0;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
440 else
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
441 sgfactor = (gravity - 1050) / 200;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
442 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
443 }
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
444 if (Method == "Rager") {
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
445 var boilfactor;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
446 var sgfactor;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
447 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
448 if (gravity < 1050)
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
449 sgfactor = 0;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
450 else
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
451 sgfactor = (gravity - 1050) / 200;
fab98e5c86fc Added Rager and Daniels IBU calculations to javascript formula.
Michiel Broek <mbroek@mbse.eu>
parents: 70
diff changeset
452 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
453 }
59
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
454
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
455 // 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
456 return ibu;
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
457 }
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
458
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
459
ad28e09e3abd Added Tinseth IBU calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
460
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
461 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
462 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
463 }
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
464
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
465
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
466
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
467 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
468
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
469 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
470 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
471 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
472 }
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
473 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
474 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
475 }
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
476
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
477 /* 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
478 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
479 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
480 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
481 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
482 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
483 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
484 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
485 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
486 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
487 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
488 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
489 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
490 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
491 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
492 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
493
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
494 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
495 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
496 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
497 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
498 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
499 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
500 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
501 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
502 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
503 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
504 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
505 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
506 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
507 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
508 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
509
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 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
511 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
512 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
513 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
514 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
515 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
516 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
517 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
518 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
519 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
520 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
521 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
522 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
523 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
524 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
525
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 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
527 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
528 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
529 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
530 }
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 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
532 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
533 }
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
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
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
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
537 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
538 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
539 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
540 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
541 }
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
542
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
543
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
544
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
545 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
546 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
547 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
548 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
549 }
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
550
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
551
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
552
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
553 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
554 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
555
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
556 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
557 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
558 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
559 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
560 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
561 }
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
562 // 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
563 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
564 }
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
565
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
566
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
567
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
568 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
569
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
570 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
571
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
572 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
573
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
574 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
575 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
576 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
577 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
578 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
579 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
580 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
581 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
582 } 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
583 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
584 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
585 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
586 }
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
587 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
588 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
589
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
590 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
591 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
592 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
593 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
594 }
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
595
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
596
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
597 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
598
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
599 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
600 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
601 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
602 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
603 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
604 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
605 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
606 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
607 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
608 }
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
609
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
610

mercurial