Tue, 19 May 2020 15:09:31 +0200
Removed some debug log messages. Fixed beer select during offline mode. Fixed block show temperature after offline.
111
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /***************************************************************************** |
609
e9b108569818
Testing, bottle carbonation pressure display without residential pressure
Michiel Broek <mbroek@mbse.eu>
parents:
607
diff
changeset
|
2 | * Copyright (C) 2018-2020 |
111
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * Michiel Broek <mbroek at mbse dot eu> |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * This file is part of BMS |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * This is free software; you can redistribute it and/or modify it |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * under the terms of the GNU General Public License as published by the |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * Free Software Foundation; either version 2, or (at your option) any |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * later version. |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * BrewCloud is distributed in the hope that it will be useful, but |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * General Public License for more details. |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | * along with ThermFerm; see the file COPYING. If not, write to the Free |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | *****************************************************************************/ |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | |
478 | 24 | function createDelElements() { |
25 | ||
26 | $('#eventWindow').jqxWindow({ | |
27 | theme: theme, | |
28 | position: { x: 490, y: 210 }, | |
29 | width: 300, | |
30 | height: 175, | |
31 | resizable: false, | |
32 | isModal: true, | |
33 | modalOpacity: 0.4, | |
646
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
34 | autoOpen: false, |
478 | 35 | okButton: $('#delOk'), |
36 | cancelButton: $('#delCancel'), | |
37 | initContent: function() { | |
38 | $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme }); | |
39 | $('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme }); | |
40 | $('#delCancel').focus(); | |
41 | } | |
42 | }); | |
43 | $('#eventWindow').jqxWindow('hide'); | |
646
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
44 | |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
45 | $('#volumeWindow').jqxWindow({ |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
46 | theme: theme, |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
47 | position: { x: 380, y: 210 }, |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
48 | width: 500, |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
49 | height: 200, |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
50 | resizable: false, |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
51 | isModal: true, |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
52 | modalOpacity: 0.4, |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
53 | autoOpen: false, |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
54 | cancelButton: $('#volumeReady') |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
55 | }); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
56 | $('#volumeWindow').jqxWindow('hide'); |
112
7ef48396f705
Added some buttons. Only allow product delete if it has no serious data.
Michiel Broek <mbroek@mbse.eu>
parents:
111
diff
changeset
|
57 | } |
7ef48396f705
Added some buttons. Only allow product delete if it has no serious data.
Michiel Broek <mbroek@mbse.eu>
parents:
111
diff
changeset
|
58 | |
7ef48396f705
Added some buttons. Only allow product delete if it has no serious data.
Michiel Broek <mbroek@mbse.eu>
parents:
111
diff
changeset
|
59 | |
7ef48396f705
Added some buttons. Only allow product delete if it has no serious data.
Michiel Broek <mbroek@mbse.eu>
parents:
111
diff
changeset
|
60 | |
478 | 61 | $(document).ready(function() { |
62 | ||
63 | var i, | |
64 | to_100 = false, // Fermentables adjust to 100% | |
65 | preboil_sg = 0, | |
66 | aboil_sg = 0, | |
67 | est_mash_sg = 0, | |
68 | psugar = 0, // Percentage real sugars | |
69 | pcara = 0, // Percentage cara/crystal malts | |
70 | svg = 77, // Default attenuation | |
71 | mashkg = 0, // Malt in mash weight | |
72 | pitchrate = 0.75, // Yeast pitch rate default | |
73 | initcells = 0, // Initial yeast cell count | |
74 | ||
75 | ok_fermentables = 1, // Fermentables are in stock | |
76 | ok_hops = 1, // Hops are in stock | |
77 | ok_miscs = 1, // Miscs are in stock | |
78 | ok_yeasts = 1, // Yeasts are in stock | |
79 | ok_waters = 1, // Waters are in stock | |
80 | ||
643
9ac2fb6b1311
Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
642
diff
changeset
|
81 | data_loaded = 0; |
642
9d1af81b20ef
Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
641
diff
changeset
|
82 | error_count = 0; |
646
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
83 | k_cm = 0; |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
84 | k_vol = 0; |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
85 | k_what = 0; |
642
9d1af81b20ef
Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
641
diff
changeset
|
86 | |
478 | 87 | hop_flavour = 0, |
88 | hop_aroma = 0, | |
89 | mash_infuse = 0, | |
90 | last_base = '', | |
91 | last_acid = '', | |
92 | ||
93 | MMCa = 40.048, | |
94 | MMMg = 24.305, | |
95 | MMNa = 22.98976928, | |
96 | MMCl = 35.453, | |
97 | MMSO4 = 96.0626, | |
98 | MMHCO3 = 61.01684, | |
99 | MMCaSO4 = 172.171, | |
100 | MMCaCl2 = 147.015, | |
101 | MMCaCO3 = 100.087, | |
102 | MMMgSO4 = 246.475, | |
103 | MMNaHCO3 = 84.007, | |
104 | MMNa2CO3 = 105.996, | |
105 | MMNaCl = 58.443, | |
106 | MMCaOH2 = 74.06268, | |
107 | ||
108 | fermentableRow = 0, | |
109 | fermentableData = {}, | |
110 | fermentableInit = 1, | |
111 | hopRow = 0, | |
112 | hopData = {}, | |
113 | miscRow = 0, | |
114 | miscData = {}, | |
115 | yeastRow = 0, | |
116 | yeastData = {}, | |
117 | mashRow = 0, | |
118 | mashData = {}, | |
119 | Ka1 = 0.0000004445, | |
120 | Ka2 = 0.0000000000468, | |
121 | dataRecord = {}, | |
122 | url = 'includes/db_product.php', | |
484
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
123 | MaltVolume = 0.87, // l/kg 0.688 volgens internetbronnen, gemeten 0.874 l/kg, na enige tijd maischen 0,715 l/kg (A3 Otten). |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
124 | SpecificHeatWater = 1.0, |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
125 | SpecificHeatMalt = 0.399, //cal/g.°C |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
126 | SlakingHeat = 10.318, //cal/g.°C |
478 | 127 | |
128 | // Prepare the data | |
129 | source = { | |
130 | datatype: 'json', | |
131 | cache: false, | |
638
736c8d29bc87
Binding the data earlier to try to prevent a race condition.
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
132 | async: true, |
478 | 133 | datafields: [ |
134 | // From prod_main | |
135 | { name: 'record', type: 'number' }, | |
136 | { name: 'uuid', type: 'string' }, | |
137 | { name: 'name', type: 'string' }, | |
138 | { name: 'code', type: 'string' }, | |
139 | { name: 'birth', type: 'string' }, | |
140 | { name: 'stage', type: 'int' }, | |
141 | { name: 'notes', type: 'string' }, | |
142 | { name: 'log_brew', type: 'int' }, | |
143 | { name: 'log_fermentation', type: 'int' }, | |
602
10b61aacb1c1
New products field log_ispindel. Add check for ispindel log to crontasks.php Added log_ispindel to prod_edit, pprod_divide, prod_new and prod_duplicate. Renamed some log_fermentation vergisting names into klimaatkast.
Michiel Broek <mbroek@mbse.eu>
parents:
586
diff
changeset
|
144 | { name: 'log_ispindel', type: 'int' }, |
615
9034e65b0d7a
Added CO2 carbonation log to the products database. Added button in the packaging tab.
Michiel Broek <mbroek@mbse.eu>
parents:
613
diff
changeset
|
145 | { name: 'log_co2pressure', type: 'int' }, |
478 | 146 | { name: 'inventory_reduced', type: 'int' }, |
147 | { name: 'locked', type: 'int' }, | |
148 | { name: 'eq_name', type: 'string' }, | |
149 | { name: 'eq_boil_size', type: 'float' }, | |
150 | { name: 'eq_batch_size', type: 'float' }, | |
151 | { name: 'eq_tun_volume', type: 'float' }, | |
152 | { name: 'eq_tun_weight', type: 'float' }, | |
153 | { name: 'eq_tun_specific_heat', type: 'float' }, | |
154 | { name: 'eq_tun_material', type: 'int' }, | |
155 | { name: 'eq_tun_height', type: 'float' }, | |
156 | { name: 'eq_top_up_water', type: 'float' }, | |
157 | { name: 'eq_trub_chiller_loss', type: 'float' }, | |
158 | { name: 'eq_evap_rate', type: 'float' }, | |
159 | { name: 'eq_boil_time', type: 'float' }, | |
160 | { name: 'eq_calc_boil_volume', type: 'int' }, | |
161 | { name: 'eq_top_up_kettle', type: 'float' }, | |
162 | { name: 'eq_hop_utilization', type: 'float' }, | |
163 | { name: 'eq_notes', type: 'string' }, | |
164 | { name: 'eq_lauter_volume', type: 'float' }, | |
165 | { name: 'eq_lauter_height', type: 'float' }, | |
166 | { name: 'eq_lauter_deadspace', type: 'float' }, | |
167 | { name: 'eq_kettle_volume', type: 'float' }, | |
168 | { name: 'eq_kettle_height', type: 'float' }, | |
169 | { name: 'eq_mash_volume', type: 'float' }, | |
170 | { name: 'eq_mash_max', type: 'float' }, | |
171 | { name: 'eq_efficiency', type: 'float' }, | |
172 | { name: 'brew_date_start', type: 'string' }, | |
173 | { name: 'brew_mash_ph', type: 'float' }, | |
174 | { name: 'brew_mash_sg', type: 'float' }, | |
175 | { name: 'brew_mash_efficiency', type: 'float' }, | |
176 | { name: 'brew_sparge_est', type: 'float' }, | |
177 | { name: 'brew_sparge_ph', type: 'float' }, | |
178 | { name: 'brew_preboil_volume', type: 'float' }, | |
179 | { name: 'brew_preboil_sg', type: 'float' }, | |
180 | { name: 'brew_preboil_ph', type: 'float' }, | |
181 | { name: 'brew_preboil_efficiency', type: 'float' }, | |
182 | { name: 'brew_aboil_volume', type: 'float' }, | |
183 | { name: 'brew_aboil_sg', type: 'float' }, | |
184 | { name: 'brew_aboil_ph', type: 'float' }, | |
185 | { name: 'brew_aboil_efficiency', type: 'float' }, | |
186 | { name: 'brew_cooling_method', type: 'int' }, | |
187 | { name: 'brew_cooling_time', type: 'float' }, | |
188 | { name: 'brew_cooling_to', type: 'float' }, | |
189 | { name: 'brew_whirlpool9', type: 'float' }, | |
190 | { name: 'brew_whirlpool7', type: 'float' }, | |
191 | { name: 'brew_whirlpool6', type: 'float' }, | |
192 | { name: 'brew_whirlpool2', type: 'float' }, | |
193 | { name: 'brew_fermenter_volume', type: 'float' }, | |
194 | { name: 'brew_fermenter_extrawater', type: 'float' }, | |
195 | { name: 'brew_fermenter_tcloss', type: 'float' }, | |
196 | { name: 'brew_aeration_time', type: 'float' }, | |
197 | { name: 'brew_aeration_speed', type: 'float' }, | |
198 | { name: 'brew_aeration_type', type: 'int' }, | |
199 | { name: 'brew_fermenter_sg', type: 'float' }, | |
200 | { name: 'brew_fermenter_ibu', type: 'float' }, | |
201 | { name: 'brew_fermenter_color', type: 'float' }, | |
202 | { name: 'brew_date_end', type: 'string' }, | |
203 | { name: 'og', type: 'float' }, | |
204 | { name: 'fg', type: 'float' }, | |
205 | { name: 'primary_start_temp', type: 'float' }, | |
206 | { name: 'primary_max_temp', type: 'float' }, | |
207 | { name: 'primary_end_temp', type: 'float' }, | |
208 | { name: 'primary_end_sg', type: 'float' }, | |
209 | { name: 'primary_end_date', type: 'string' }, | |
210 | { name: 'secondary_temp', type: 'float' }, | |
211 | { name: 'secondary_end_sg', type: 'float' }, | |
212 | { name: 'secondary_end_date', type: 'string' }, | |
213 | { name: 'tertiary_temp', type: 'float' }, | |
214 | { name: 'package_date', type: 'string' }, | |
215 | { name: 'package_volume', type: 'float' }, | |
216 | { name: 'package_infuse_amount', type: 'float' }, | |
217 | { name: 'package_infuse_abv', type: 'float' }, | |
218 | { name: 'package_infuse_notes', type: 'string' }, | |
219 | { name: 'package_abv', type: 'float' }, | |
220 | { name: 'package_ph', type: 'float' }, | |
221 | { name: 'bottle_amount', type: 'float' }, | |
222 | { name: 'bottle_carbonation', type: 'float' }, | |
223 | { name: 'bottle_priming_water', type: 'float' }, | |
224 | { name: 'bottle_priming_amount', type: 'float' }, | |
225 | { name: 'bottle_carbonation_temp', type: 'float' }, | |
226 | { name: 'keg_amount', type: 'float' }, | |
227 | { name: 'keg_carbonation', type: 'float' }, | |
228 | { name: 'keg_priming_water', type: 'float' }, | |
229 | { name: 'keg_priming_amount', type: 'float' }, | |
230 | { name: 'keg_carbonation_temp', type: 'float' }, | |
231 | { name: 'keg_forced_carb', type: 'int' }, | |
232 | { name: 'keg_pressure', type: 'float' }, | |
233 | { name: 'taste_notes', type: 'string' }, | |
234 | { name: 'taste_rate', type: 'float' }, | |
235 | { name: 'taste_date', type: 'string' }, | |
236 | { name: 'taste_color', type: 'string' }, | |
237 | { name: 'taste_transparency', type: 'string' }, | |
238 | { name: 'taste_head', type: 'string' }, | |
239 | { name: 'taste_aroma', type: 'string' }, | |
240 | { name: 'taste_taste', type: 'string' }, | |
241 | { name: 'taste_mouthfeel', type: 'string' }, | |
242 | { name: 'taste_aftertaste', type: 'string' }, | |
243 | { name: 'st_name', type: 'string' }, | |
244 | { name: 'st_letter', type: 'string' }, | |
245 | { name: 'st_guide', type: 'string' }, | |
246 | { name: 'st_category', type: 'string' }, | |
247 | { name: 'st_category_number', type: 'float' }, | |
248 | { name: 'st_type', type: 'int' }, | |
249 | { name: 'st_og_min', type: 'float' }, | |
250 | { name: 'st_og_max', type: 'float' }, | |
251 | { name: 'st_fg_min', type: 'float' }, | |
252 | { name: 'st_fg_max', type: 'float' }, | |
253 | { name: 'st_ibu_min', type: 'float' }, | |
254 | { name: 'st_ibu_max', type: 'float' }, | |
255 | { name: 'st_color_min', type: 'float' }, | |
256 | { name: 'st_color_max', type: 'float' }, | |
257 | { name: 'st_carb_min', type: 'float' }, | |
258 | { name: 'st_carb_max', type: 'float' }, | |
259 | { name: 'st_abv_min', type: 'float' }, | |
260 | { name: 'st_abv_max', type: 'float' }, | |
261 | { name: 'type', type: 'int' }, | |
262 | { name: 'batch_size', type: 'float' }, | |
263 | { name: 'boil_size', type: 'float' }, | |
264 | { name: 'boil_time', type: 'float' }, | |
265 | { name: 'efficiency', type: 'float' }, | |
266 | { name: 'est_og', type: 'float' }, | |
616
2cbf21bb9bdc
Added est_og3 field in the products database so that the checklist can use it.
Michiel Broek <mbroek@mbse.eu>
parents:
615
diff
changeset
|
267 | { name: 'est_og3', type: 'float' }, |
478 | 268 | { name: 'est_fg', type: 'float' }, |
269 | { name: 'est_abv', type: 'float' }, | |
270 | { name: 'est_color', type: 'float' }, | |
271 | { name: 'color_method', type: 'int' }, | |
272 | { name: 'est_ibu', type: 'float' }, | |
273 | { name: 'ibu_method', type: 'int' }, | |
274 | { name: 'est_carb', type: 'float' }, | |
275 | { name: 'sparge_temp', type: 'float' }, | |
276 | { name: 'sparge_ph', type: 'float' }, | |
277 | { name: 'sparge_volume', type: 'float' }, | |
278 | { name: 'sparge_source', type: 'int' }, | |
279 | { name: 'sparge_acid_type', type: 'int' }, | |
280 | { name: 'sparge_acid_perc', type: 'float' }, | |
281 | { name: 'sparge_acid_amount', type: 'float' }, | |
282 | { name: 'mash_ph', type: 'float' }, | |
283 | { name: 'mash_name', type: 'string' }, | |
284 | { name: 'calc_acid', type: 'int' }, | |
285 | { name: 'w1_name', type: 'string' }, | |
286 | { name: 'w1_amount', type: 'float' }, | |
287 | { name: 'w1_calcium', type: 'float' }, | |
288 | { name: 'w1_sulfate', type: 'float' }, | |
289 | { name: 'w1_chloride', type: 'float' }, | |
290 | { name: 'w1_sodium', type: 'float' }, | |
291 | { name: 'w1_magnesium', type: 'float' }, | |
292 | { name: 'w1_total_alkalinity', type: 'float' }, | |
293 | { name: 'w1_ph', type: 'float' }, | |
294 | { name: 'w1_cost', type: 'float' }, | |
295 | { name: 'w2_name', type: 'string' }, | |
296 | { name: 'w2_amount', type: 'float' }, | |
297 | { name: 'w2_calcium', type: 'float' }, | |
298 | { name: 'w2_sulfate', type: 'float' }, | |
299 | { name: 'w2_chloride', type: 'float' }, | |
300 | { name: 'w2_sodium', type: 'float' }, | |
301 | { name: 'w2_magnesium', type: 'float' }, | |
302 | { name: 'w2_total_alkalinity', type: 'float' }, | |
303 | { name: 'w2_ph', type: 'float' }, | |
304 | { name: 'w2_cost', type: 'float' }, | |
305 | { name: 'wg_amount', type: 'float' }, | |
306 | { name: 'wg_calcium', type: 'float' }, | |
307 | { name: 'wg_sulfate', type: 'float' }, | |
308 | { name: 'wg_chloride', type: 'float' }, | |
309 | { name: 'wg_sodium', type: 'float' }, | |
310 | { name: 'wg_magnesium', type: 'float' }, | |
311 | { name: 'wg_total_alkalinity', type: 'float' }, | |
312 | { name: 'wg_ph', type: 'float' }, | |
313 | { name: 'wb_calcium', type: 'float' }, | |
314 | { name: 'wb_sulfate', type: 'float' }, | |
315 | { name: 'wb_chloride', type: 'float' }, | |
316 | { name: 'wb_sodium', type: 'float' }, | |
317 | { name: 'wb_magnesium', type: 'float' }, | |
318 | { name: 'wb_total_alkalinity', type: 'float' }, | |
319 | { name: 'wb_ph', type: 'float' }, | |
320 | { name: 'wa_acid_name', type: 'int' }, | |
321 | { name: 'wa_acid_perc', type: 'int' }, | |
322 | { name: 'wa_base_name', type: 'int' }, | |
323 | { name: 'starter_enable', type: 'int' }, | |
324 | { name: 'starter_type', type: 'int' }, | |
325 | { name: 'starter_sg', type: 'float' }, | |
326 | { name: 'starter_viability', type: 'int' }, | |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
327 | { name: 'yeast_prod_date', type: 'string' }, |
478 | 328 | { name: 'prop1_type', type: 'int' }, |
329 | { name: 'prop1_volume', type: 'float' }, | |
330 | { name: 'prop2_type', type: 'int' }, | |
331 | { name: 'prop2_volume', type: 'float' }, | |
332 | { name: 'prop3_type', type: 'int' }, | |
333 | { name: 'prop3_volume', type: 'float' }, | |
334 | { name: 'prop4_type', type: 'int' }, | |
335 | { name: 'prop4_volume', type: 'float' }, | |
497
0fe366d953ab
Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents:
495
diff
changeset
|
336 | { name: 'divide_type', type: 'int' }, |
0fe366d953ab
Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents:
495
diff
changeset
|
337 | { name: 'divide_size', type: 'float' }, |
533
be8691b7d634
Added the product divide scripts. All parts have all the volumes and weights divided, including the master record. Splitted batches have their own records with the product code formatted as code-n. From this design, we can rebuild the print and checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
338 | { name: 'divide_factor', type: 'float' }, |
497
0fe366d953ab
Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents:
495
diff
changeset
|
339 | { name: 'divide_parts', type: 'int' }, |
533
be8691b7d634
Added the product divide scripts. All parts have all the volumes and weights divided, including the master record. Splitted batches have their own records with the product code formatted as code-n. From this design, we can rebuild the print and checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
340 | { name: 'divide_part', type: 'int' }, |
478 | 341 | { name: 'fermentables', type: 'array' }, |
342 | { name: 'hops', type: 'array' }, | |
343 | { name: 'miscs', type: 'array' }, | |
344 | { name: 'yeasts', type: 'array' }, | |
345 | { name: 'mashs', type: 'array' } | |
346 | ], | |
347 | id: 'record', | |
348 | url: url + '?record=' + my_record | |
349 | }, | |
350 | ||
351 | // Load data and select one record. | |
352 | dataAdapter = new $.jqx.dataAdapter(source, { | |
353 | loadComplete: function() { | |
354 | var records = dataAdapter.records; | |
355 | dataRecord = records[0]; | |
356 | // Hidden record uuid | |
357 | $('#name').val(dataRecord.name); | |
358 | $('#code').val(dataRecord.code); | |
359 | $('#birth').val(dataRecord.birth); | |
360 | $('#stage').val(StageData[dataRecord.stage].nl); | |
361 | $('#notes').val(dataRecord.notes); | |
362 | $('#locked').val(dataRecord.locked); | |
363 | $('#eq_name').val(dataRecord.eq_name); | |
364 | $('#eq_notes').val(dataRecord.eq_notes); | |
365 | $('#eq_boil_size').val(dataRecord.eq_boil_size); | |
366 | $('#eq_batch_size').val(dataRecord.eq_batch_size); | |
367 | $('#eq_tun_volume').val(dataRecord.eq_tun_volume); | |
368 | $('#eq_top_up_water').val(dataRecord.eq_top_up_water); | |
369 | $('#eq_trub_chiller_loss').val(dataRecord.eq_trub_chiller_loss); | |
370 | $('#eq_evap_rate').val(dataRecord.eq_evap_rate); | |
371 | $('#eq_boil_time').val(dataRecord.eq_boil_time); | |
372 | $('#eq_top_up_kettle').val(dataRecord.eq_top_up_kettle); | |
373 | $('#eq_hop_utilization').val(dataRecord.eq_hop_utilization); | |
374 | $('#eq_lauter_volume').val(dataRecord.eq_lauter_volume); | |
375 | $('#eq_lauter_deadspace').val(dataRecord.eq_lauter_deadspace); | |
376 | $('#eq_kettle_volume').val(dataRecord.eq_kettle_volume); | |
377 | $('#eq_mash_volume').val(dataRecord.eq_mash_volume); | |
378 | $('#eq_mash_max').val(dataRecord.eq_mash_max); | |
379 | $('#eq_efficiency').val(dataRecord.eq_efficiency); | |
380 | // Brewdate | |
381 | $('#brew_date_start').val(dataRecord.brew_date_start); | |
382 | $('#brew_mash_ph').val(dataRecord.brew_mash_ph); | |
383 | $('#brew_mash_sg').val(dataRecord.brew_mash_sg); | |
384 | $('#brew_mash_efficiency').val(dataRecord.brew_mash_efficiency); | |
385 | // Header Spoelen en filteren | |
386 | $('#brew_sparge_temperature').val(dataRecord.sparge_temp); | |
387 | $('#brew_sparge_volume').val(dataRecord.sparge_volume); | |
388 | $('#brew_sparge_est').val(dataRecord.brew_sparge_est); | |
389 | $('#brew_sparge_ph').val(dataRecord.brew_sparge_ph); | |
390 | // Header Beluchten | |
391 | $('#brew_aeration_type').val(dataRecord.brew_aeration_type); | |
392 | $('#brew_aeration_time').val(dataRecord.brew_aeration_time); | |
393 | $('#brew_aeration_speed').val(dataRecord.brew_aeration_speed); | |
394 | ||
395 | $('#brew_preboil_ph').val(dataRecord.brew_preboil_ph); | |
396 | $('#brew_preboil_sg').val(dataRecord.brew_preboil_sg); | |
397 | $('#brew_preboil_volume').val(dataRecord.brew_preboil_volume); | |
398 | $('#brew_preboil_efficiency').val(dataRecord.brew_preboil_efficiency); | |
399 | // Header Koelen en whirlpoolen | |
400 | $('#brew_whirlpool9').val(dataRecord.brew_whirlpool9); | |
401 | $('#brew_whirlpool7').val(dataRecord.brew_whirlpool7); | |
402 | $('#brew_whirlpool6').val(dataRecord.brew_whirlpool6); | |
403 | $('#brew_whirlpool2').val(dataRecord.brew_whirlpool2); | |
404 | // Header Naar gistvat | |
405 | $('#brew_fermenter_volume').val(dataRecord.brew_fermenter_volume); | |
406 | $('#brew_fermenter_sg').val(dataRecord.brew_fermenter_sg); | |
407 | $('#brew_fermenter_sg2').val(dataRecord.brew_fermenter_sg); | |
408 | $('#brew_fermenter_ibu').val(dataRecord.brew_fermenter_ibu); | |
409 | $('#brew_fermenter_color').val(dataRecord.brew_fermenter_color); | |
410 | $('#brew_fermenter_extrawater').val(dataRecord.brew_fermenter_extrawater); | |
411 | $('#brew_fermenter_tcloss').val(dataRecord.brew_fermenter_tcloss); | |
412 | ||
413 | $('#brew_aboil_ph').val(dataRecord.brew_aboil_ph); | |
414 | $('#brew_aboil_sg').val(dataRecord.brew_aboil_sg); | |
415 | $('#brew_aboil_volume').val(dataRecord.brew_aboil_volume); | |
416 | $('#brew_aboil_efficiency').val(dataRecord.brew_aboil_efficiency); | |
417 | // Header Koelen en whirlpoolen | |
418 | $('#brew_cooling_to').val(dataRecord.brew_cooling_to); | |
419 | $('#brew_cooling_method').val(dataRecord.brew_cooling_method); | |
420 | $('#brew_cooling_time').val(dataRecord.brew_cooling_time); | |
421 | // Niks | |
422 | $('#brew_date_end').val(dataRecord.brew_date_end); | |
423 | $('#og').val(dataRecord.og); | |
424 | $('#fg').val(dataRecord.fg); | |
425 | $('#primary_start_temp').val(dataRecord.primary_start_temp); | |
426 | $('#primary_max_temp').val(dataRecord.primary_max_temp); | |
427 | $('#primary_end_temp').val(dataRecord.primary_end_temp); | |
428 | $('#primary_end_sg').val(dataRecord.primary_end_sg); | |
429 | $('#primary_end_date').val(dataRecord.primary_end_date); | |
430 | $('#secondary_temp').val(dataRecord.secondary_temp); | |
431 | $('#secondary_end_sg').val(dataRecord.secondary_end_sg); | |
432 | $('#secondary_end_date').val(dataRecord.secondary_end_date); | |
433 | $('#tertiary_temp').val(dataRecord.tertiary_temp); | |
434 | $('#package_date').val(dataRecord.package_date); | |
435 | $('#package_volume').val(dataRecord.package_volume); | |
436 | $('#package_infuse_amount').val(dataRecord.package_infuse_amount); | |
437 | $('#package_infuse_abv').val(dataRecord.package_infuse_abv); | |
438 | $('#package_infuse_notes').val(dataRecord.package_infuse_notes); | |
439 | $('#package_abv').val(dataRecord.package_abv); | |
440 | $('#package_ph').val(dataRecord.package_ph); | |
441 | $('#bottle_amount').val(dataRecord.bottle_amount); | |
442 | $('#bottle_carbonation').val(dataRecord.bottle_carbonation); | |
443 | $('#bottle_priming_water').val(dataRecord.bottle_priming_water); | |
444 | $('#bottle_priming_amount').val(dataRecord.bottle_priming_amount); | |
445 | $('#bottle_carbonation_temp').val(dataRecord.bottle_carbonation_temp); | |
446 | $('#keg_amount').val(dataRecord.keg_amount); | |
447 | $('#keg_carbonation').val(dataRecord.keg_carbonation); | |
448 | $('#keg_priming_water').val(dataRecord.keg_priming_water); | |
449 | $('#keg_priming_amount').val(dataRecord.keg_priming_amount); | |
450 | $('#keg_carbonation_temp').val(dataRecord.keg_carbonation_temp); | |
451 | $('#keg_forced_carb').val(dataRecord.keg_forced_carb); | |
452 | $('#keg_pressure').val(dataRecord.keg_pressure); | |
453 | $('#taste_notes').val(dataRecord.taste_notes); | |
454 | $('#taste_rate').val(dataRecord.taste_rate); | |
455 | $('#taste_date').val(dataRecord.taste_date); | |
456 | $('#taste_color').val(dataRecord.taste_color); | |
457 | $('#taste_transparency').val(dataRecord.taste_transparency); | |
458 | $('#taste_head').val(dataRecord.taste_head); | |
459 | $('#taste_aroma').val(dataRecord.taste_aroma); | |
460 | $('#taste_taste').val(dataRecord.taste_taste); | |
461 | $('#taste_mouthfeel').val(dataRecord.taste_mouthfeel); | |
462 | $('#taste_aftertaste').val(dataRecord.taste_aftertaste); | |
463 | ||
464 | // Recipe | |
465 | $('#st_name').val(dataRecord.st_name); | |
466 | $('#st_letter').val(dataRecord.st_letter); | |
467 | $('#st_guide').val(dataRecord.st_guide); | |
468 | $('#st_category').val(dataRecord.st_category); | |
469 | $('#st_category_number').val(dataRecord.st_category_number); | |
470 | $('#st_type').val(StyleTypeData[dataRecord.st_type].nl); | |
471 | $('#st_og_min').val(dataRecord.st_og_min); | |
472 | $('#st_og_max').val(dataRecord.st_og_max); | |
473 | $('#st_fg_min').val(dataRecord.st_fg_min); | |
474 | $('#st_fg_max').val(dataRecord.st_fg_max); | |
475 | $('#st_abv_min').val(dataRecord.st_abv_min); | |
476 | $('#st_abv_max').val(dataRecord.st_abv_max); | |
477 | $('#st_color_min').val(dataRecord.st_color_min); | |
478 | $('#st_color_max').val(dataRecord.st_color_max); | |
479 | $('#st_ibu_min').val(dataRecord.st_ibu_min); | |
480 | $('#st_ibu_max').val(dataRecord.st_ibu_max); | |
481 | $('#st_carb_min').val(dataRecord.st_carb_min); | |
482 | $('#st_carb_min2').val(dataRecord.st_carb_min); | |
483 | $('#st_carb_max').val(dataRecord.st_carb_max); | |
484 | $('#st_carb_max2').val(dataRecord.st_carb_max); | |
485 | $('#type').val(dataRecord.type); | |
486 | $('#batch_size').val(dataRecord.batch_size); | |
487 | $('#est_a_vol').val(dataRecord.batch_size * 1.04); | |
488 | $('#boil_size').val(dataRecord.boil_size); | |
489 | $('#est_pre_vol').val(dataRecord.boil_size * 1.04); | |
490 | $('#boil_time').val(dataRecord.boil_time); | |
491 | $('#efficiency').val(dataRecord.efficiency); | |
492 | $('#est_og').val(dataRecord.est_og); | |
493 | $('#est_og2').val(dataRecord.est_og); | |
616
2cbf21bb9bdc
Added est_og3 field in the products database so that the checklist can use it.
Michiel Broek <mbroek@mbse.eu>
parents:
615
diff
changeset
|
494 | $('#est_og3').val(dataRecord.est_og3); |
478 | 495 | $('#est_fg').val(dataRecord.est_fg); |
496 | $('#est_fg2').val(dataRecord.est_fg); | |
497 | $('#est_fg3').val(dataRecord.est_fg); | |
498 | $('#est_color').val(dataRecord.est_color); | |
499 | $('#est_color2').val(dataRecord.est_color); | |
500 | $('#est_abv').val(dataRecord.est_abv); | |
501 | $('#color_method').val(dataRecord.color_method); | |
502 | $('#est_ibu').val(dataRecord.est_ibu); | |
503 | $('#est_ibu2').val(dataRecord.est_ibu); | |
504 | $('#ibu_method').val(dataRecord.ibu_method); | |
505 | $('#est_carb').val(dataRecord.est_carb); | |
506 | $('#mash_name').val(dataRecord.mash_name); | |
507 | $('#mash_ph').val(dataRecord.mash_ph); | |
508 | $('#sparge_temp').val(dataRecord.sparge_temp); | |
509 | $('#sparge_ph').val(dataRecord.sparge_ph); | |
510 | $('#sparge_volume').val(dataRecord.sparge_volume); | |
511 | $('#sparge_source').val(dataRecord.sparge_source); | |
512 | $('#sparge_acid_type').val(dataRecord.sparge_acid_type); | |
513 | $('#sparge_acid_perc').val(dataRecord.sparge_acid_perc); | |
514 | $('#sparge_acid_amount').val(dataRecord.sparge_acid_amount * 1000); | |
515 | $('#calc_acid').val(dataRecord.calc_acid); | |
516 | $('#w1_name').val(dataRecord.w1_name); | |
517 | $('#w1_amount').val(dataRecord.w1_amount); | |
518 | $('#w1_calcium').val(dataRecord.w1_calcium); | |
519 | $('#w1_sulfate').val(dataRecord.w1_sulfate); | |
520 | $('#w1_chloride').val(dataRecord.w1_chloride); | |
521 | $('#w1_sodium').val(dataRecord.w1_sodium); | |
522 | $('#w1_magnesium').val(dataRecord.w1_magnesium); | |
523 | $('#w1_total_alkalinity').val(dataRecord.w1_total_alkalinity); | |
524 | $('#w1_ph').val(dataRecord.w1_ph); | |
525 | $('#w1_cost').val(dataRecord.w1_cost); | |
526 | $('#w2_name').val(dataRecord.w2_name); | |
527 | $('#w2_amount').val(dataRecord.w2_amount); | |
528 | $('#w2_calcium').val(dataRecord.w2_calcium); | |
529 | $('#w2_sulfate').val(dataRecord.w2_sulfate); | |
530 | $('#w2_chloride').val(dataRecord.w2_chloride); | |
531 | $('#w2_sodium').val(dataRecord.w2_sodium); | |
532 | $('#w2_magnesium').val(dataRecord.w2_magnesium); | |
533 | $('#w2_total_alkalinity').val(dataRecord.w2_total_alkalinity); | |
534 | $('#w2_ph').val(dataRecord.w2_ph); | |
535 | $('#w2_cost').val(dataRecord.w2_cost); | |
536 | $('#wg_amount').val(dataRecord.wg_amount); | |
537 | $('#wg_calcium').val(dataRecord.wg_calcium); | |
538 | $('#wg_sulfate').val(dataRecord.wg_sulfate); | |
539 | $('#wg_chloride').val(dataRecord.wg_chloride); | |
540 | $('#wg_sodium').val(dataRecord.wg_sodium); | |
541 | $('#wg_magnesium').val(dataRecord.wg_magnesium); | |
542 | $('#wg_total_alkalinity').val(dataRecord.wg_total_alkalinity); | |
543 | $('#wg_ph').val(dataRecord.wg_ph); | |
544 | $('#wb_calcium').val(dataRecord.wb_calcium); | |
545 | $('#wb_sulfate').val(dataRecord.wb_sulfate); | |
546 | $('#wb_chloride').val(dataRecord.wb_chloride); | |
547 | $('#wb_sodium').val(dataRecord.wb_sodium); | |
548 | $('#wb_magnesium').val(dataRecord.wb_magnesium); | |
549 | $('#wb_total_alkalinity').val(dataRecord.wb_total_alkalinity); | |
550 | $('#wb_ph').val(dataRecord.wb_ph); | |
551 | $('#wa_acid_name').val(dataRecord.wa_acid_name); | |
552 | $('#wa_acid_perc').val(dataRecord.wa_acid_perc); | |
553 | $('#wa_base_name').val(dataRecord.wa_base_name); | |
554 | $('#starter_type').val(dataRecord.starter_type); | |
555 | $('#starter_sg').val(dataRecord.starter_sg); | |
556 | $('#starter_viability').val(dataRecord.starter_viability); | |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
557 | $('#yeast_prod_date').val(dataRecord.yeast_prod_date); |
478 | 558 | $('#prop1_type').val(dataRecord.prop1_type); |
559 | $('#prop1_volume').val(dataRecord.prop1_volume); | |
560 | $('#prop2_type').val(dataRecord.prop2_type); | |
561 | $('#prop2_volume').val(dataRecord.prop2_volume); | |
562 | $('#prop3_type').val(dataRecord.prop3_type); | |
563 | $('#prop3_volume').val(dataRecord.prop3_volume); | |
564 | $('#prop4_type').val(dataRecord.prop4_type); | |
565 | $('#prop4_volume').val(dataRecord.prop4_volume); | |
500
8d53ad389204
Reworked the splitted batches, the data is now in a separate table and there is only one product record.
Michiel Broek <mbroek@mbse.eu>
parents:
497
diff
changeset
|
566 | $('#divide_type').val(SplitData[dataRecord.divide_type].nl); |
545
f71079a45f5c
More screen improvements. Updated the design README.
Michiel Broek <mbroek@mbse.eu>
parents:
544
diff
changeset
|
567 | if (dataRecord.divide_type > 0) |
f71079a45f5c
More screen improvements. Updated the design README.
Michiel Broek <mbroek@mbse.eu>
parents:
544
diff
changeset
|
568 | $('#divide_batch').val((dataRecord.divide_part + 1) + ' van ' + (dataRecord.divide_parts + 1)); |
f71079a45f5c
More screen improvements. Updated the design README.
Michiel Broek <mbroek@mbse.eu>
parents:
544
diff
changeset
|
569 | else |
f71079a45f5c
More screen improvements. Updated the design README.
Michiel Broek <mbroek@mbse.eu>
parents:
544
diff
changeset
|
570 | $('#divide_batch').val('n.v.t.'); |
497
0fe366d953ab
Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents:
495
diff
changeset
|
571 | // hidden divide_size |
533
be8691b7d634
Added the product divide scripts. All parts have all the volumes and weights divided, including the master record. Splitted batches have their own records with the product code formatted as code-n. From this design, we can rebuild the print and checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
572 | // hidden divide_factor |
544
f3faa54581ff
Better way to show splitted batches. Added flameout calculations to the php scripts.
Michiel Broek <mbroek@mbse.eu>
parents:
542
diff
changeset
|
573 | // hidden divide_parts |
533
be8691b7d634
Added the product divide scripts. All parts have all the volumes and weights divided, including the master record. Splitted batches have their own records with the product code formatted as code-n. From this design, we can rebuild the print and checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
574 | // hidden divide_part |
478 | 575 | editFermentable(dataRecord); |
576 | editHop(dataRecord); | |
577 | editMisc(dataRecord); | |
578 | editYeast(dataRecord); | |
579 | editMash(dataRecord); | |
580 | calcStage(); | |
581 | $('#jqxTabs').jqxTabs('select', 2); | |
643
9ac2fb6b1311
Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
642
diff
changeset
|
582 | data_loaded = 1; |
478 | 583 | }, |
640 | 584 | loadError: function(jqXHR, status, error) { |
639 | 585 | console.log('main data load error: ' + status + ' ' + error); |
478 | 586 | } |
587 | }); | |
588 | ||
589 | // Inline fermentables editor | |
590 | var editFermentable = function(data) { | |
591 | var fermentableSource = { | |
592 | localdata: data.fermentables, | |
593 | datatype: 'local', | |
594 | cache: false, | |
641 | 595 | async: true, |
478 | 596 | datafields: [ |
597 | { name: 'f_name', type: 'string' }, | |
598 | { name: 'f_origin', type: 'string' }, | |
599 | { name: 'f_supplier', type: 'string' }, | |
600 | { name: 'f_amount', type: 'float' }, | |
601 | { name: 'f_cost', type: 'float' }, | |
602 | { name: 'f_type', type: 'int' }, | |
603 | { name: 'f_yield', type: 'float' }, | |
604 | { name: 'f_color', type: 'float' }, | |
605 | { name: 'f_coarse_fine_diff', type: 'float' }, | |
606 | { name: 'f_moisture', type: 'float' }, | |
607 | { name: 'f_diastatic_power', type: 'float' }, | |
608 | { name: 'f_protein', type: 'float' }, | |
609 | { name: 'f_max_in_batch', type: 'float' }, | |
610 | { name: 'f_graintype', type: 'int' }, | |
611 | { name: 'f_added', type: 'int' }, | |
612 | { name: 'f_dissolved_protein', type: 'float' }, | |
613 | { name: 'f_recommend_mash', type: 'int' }, | |
614 | { name: 'f_add_after_boil', type: 'int' }, | |
615 | { name: 'f_adjust_to_total_100', type: 'int' }, | |
616 | { name: 'f_percentage', type: 'float' }, | |
617 | { name: 'f_di_ph', type: 'float' }, | |
618 | { name: 'f_acid_to_ph_57', type: 'float' }, | |
619 | { name: 'f_inventory', type: 'float' }, | |
620 | { name: 'f_avail', type: 'int' } | |
621 | ], | |
644
4654b8ee4690
Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
643
diff
changeset
|
622 | addrow: function(rowid, rowdata, position, commit) { commit(true); }, |
4654b8ee4690
Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
643
diff
changeset
|
623 | deleterow: function(rowid, commit) { commit(true); }, |
4654b8ee4690
Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
643
diff
changeset
|
624 | updaterow: function(rowid, rowdata, commit) { commit(true); } |
478 | 625 | }, |
626 | fermentableAdapter = new $.jqx.dataAdapter(fermentableSource); | |
627 | ||
628 | $('#fermentableGrid').jqxGrid({ | |
629 | width: 1240, | |
630 | height: 470, | |
631 | source: fermentableAdapter, | |
632 | theme: theme, | |
633 | selectionmode: 'singlerow', | |
634 | showtoolbar: true, | |
635 | rendertoolbar: function(toolbar) { | |
636 | var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); | |
637 | toolbar.append(container); | |
638 | container.append('<div style="float: left; margin-left: 165px;" id="faddrowbutton"></div>'); | |
639 | container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); | |
640 | container.append('<div style="float: left; margin-left: 10px;" id="finstockbutton"></div>'); | |
641 | container.append('<input style="float: left; margin-left: 400px;" id="fdeleterowbutton" type="button" value="Verwijder mout" />'); | |
642 | // add fermentable from dropdownlist. | |
643 | $('#faddrowbutton').jqxDropDownList({ | |
644 | placeHolder: 'Kies mout:', | |
645 | theme: theme, | |
646 | template: 'primary', | |
647 | source: fermentablelist, | |
648 | displayMember: 'name', | |
649 | disabled: (dataRecord.stage > 3), | |
650 | width: 150, | |
651 | height: 27, | |
652 | dropDownWidth: 500, | |
653 | dropDownHeight: 500, | |
654 | renderer: function(index, label, value) { | |
655 | var datarecord = fermentablelist.records[index]; | |
564
d5fad7d80899
When adding fermentables or hops to a product, show the current inventory in the dropdownlist.
Michiel Broek <mbroek@mbse.eu>
parents:
561
diff
changeset
|
656 | return datarecord.supplier + ' / ' + datarecord.name + ' (' + datarecord.color + ' EBC) (' + Round(datarecord.inventory, 3) + ' kg)'; |
478 | 657 | } |
658 | }); | |
659 | $('#faddrowbutton').on('select', function(event) { | |
660 | if (event.args) { | |
661 | var index, datarecord, row = {}, rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount; | |
662 | index = event.args.index; | |
663 | datarecord = fermentablelist.records[index]; | |
664 | row['f_name'] = datarecord.name; | |
665 | row['f_origin'] = datarecord.origin; | |
666 | row['f_supplier'] = datarecord.supplier; | |
667 | row['f_amount'] = 0; | |
668 | row['f_cost'] = datarecord.cost; | |
669 | row['f_type'] = datarecord.type; | |
670 | row['f_yield'] = datarecord.yield; | |
671 | row['f_color'] = datarecord.color; | |
672 | row['f_coarse_fine_diff'] = datarecord.coarse_fine_diff; | |
673 | row['f_moisture'] = datarecord.moisture; | |
674 | row['f_diastatic_power'] = datarecord.diastatic_power; | |
675 | row['f_protein'] = datarecord.protein; | |
676 | row['f_max_in_batch'] = datarecord.max_in_batch; | |
677 | row['f_graintype'] = datarecord.graintype; | |
678 | if (datarecord.add_after_boil) { | |
679 | row['f_added'] = 2; // Fermentation | |
680 | } else if ((datarecord.type == 1) || (datarecord.type == 4)) { // Sugar or Adjunct | |
681 | row['f_added'] = 1; // Boil | |
682 | } else { | |
683 | row['f_added'] = 0; // Mash | |
684 | } | |
685 | row['f_dissolved_protein'] = datarecord.dissolved_protein; | |
686 | row['f_recommend_mash'] = datarecord.recommend_mash; | |
687 | row['f_add_after_boil'] = datarecord.add_after_boil; | |
688 | if (rowscount == 0) { | |
689 | // The first fermentable | |
690 | row['f_adjust_to_total_100'] = 1; | |
691 | row['f_percentage'] = 100; | |
692 | } else { | |
693 | row['f_adjust_to_total_100'] = 0; | |
694 | row['f_percentage'] = 0; | |
695 | } | |
696 | row['f_di_ph'] = datarecord.di_ph; | |
697 | row['f_acid_to_ph_57'] = datarecord.acid_to_ph_57; | |
698 | row['f_inventory'] = datarecord.inventory; | |
699 | $('#fermentableGrid').jqxGrid('addrow', null, row); | |
700 | } | |
701 | }); | |
702 | ||
703 | $('#finstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); | |
704 | $('#finstockbutton').on('change', function(event) { | |
705 | fermentableinstock = event.args.checked; | |
706 | fermentablelist.dataBind(); | |
707 | }); | |
708 | ||
709 | // delete selected fermentable. | |
710 | $('#fdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); | |
711 | $('#fdeleterowbutton').on('click', function() { | |
712 | var rowscount, id, percent, amount, i, rowdata, | |
713 | selectedrowindex = $('#fermentableGrid').jqxGrid('getselectedrowindex'); | |
714 | rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount; | |
715 | if (selectedrowindex >= 0 && selectedrowindex < rowscount) { | |
716 | id = $('#fermentableGrid').jqxGrid('getrowid', selectedrowindex); | |
717 | percent = $('#fermentableGrid').jqxGrid('getcellvalue', id, 'f_percentage'); | |
718 | amount = $('#fermentableGrid').jqxGrid('getcellvalue', id, 'f_amount'); | |
719 | $('#fermentableGrid').jqxGrid('deleterow', id); | |
720 | } | |
721 | rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount; | |
722 | if (rowscount > 1) { | |
723 | if (to_100) { | |
724 | for (i = 0; i < rowscount; i++) { | |
725 | rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i); | |
726 | if (rowdata.f_adjust_to_total_100) { | |
727 | rowdata.f_percentage += percent; | |
728 | rowdata.f_amount += amount; | |
729 | } | |
730 | } | |
731 | } else { | |
732 | calcPercentages(); | |
733 | } | |
734 | } else { | |
735 | $('#fermentableGrid').jqxGrid('setcellvalue', 0, 'f_percentage', 100); | |
736 | } | |
737 | calcFermentables(); | |
738 | calcIBUs(); | |
739 | }); | |
740 | }, | |
648 | 741 | ready: function() { calcFermentables(); $('#jqxTabs').jqxTabs('next'); }, |
478 | 742 | columns: [ |
743 | { text: 'Vergistbaar ingrediënt', datafield: 'f_name', | |
744 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
745 | return '<span style="margin: 3px; margin-top: 6px; float: left;">' + rowdata.f_supplier + ' / ' + | |
746 | rowdata.f_name + ' (' + rowdata.f_color + ' EBC)</span>'; | |
747 | } | |
748 | }, | |
749 | { text: 'Type', width: 100, datafield: 'f_type', | |
750 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
751 | return '<span style="margin: 3px; margin-top: 6px; float: left;">' + FermentableTypeData[value].nl + '</span>'; | |
752 | } | |
753 | }, | |
754 | { text: 'Moment', width: 110, datafield: 'f_added', | |
755 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
756 | return '<span style="margin: 3px; margin-top: 6px; float: left;">' + AddedData[value].nl + '</span>'; | |
757 | } | |
758 | }, | |
759 | { text: 'Maxinbatch', datafield: 'f_max_in_batch', hidden: true }, | |
760 | { text: 'Opbrengst', datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, | |
761 | { text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, | |
762 | { text: 'Voorraad Kg', datafield: 'f_inventory', width: 120, align: 'right', | |
763 | cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) { | |
764 | var color = '#ffffff'; | |
765 | if (((dataRecord.inventory_reduced <= 2) && (rowdata.f_added <= 1)) || // Mash or boil | |
766 | ((dataRecord.inventory_reduced <= 3) && (rowdata.f_added == 2)) || // Primary | |
767 | ((dataRecord.inventory_reduced <= 5) && (rowdata.f_added == 3)) || // Secondary or Tertiary | |
768 | ((dataRecord.inventory_reduced <= 6) && (rowdata.f_added == 4)) || // Bottle | |
769 | ((dataRecord.inventory_reduced <= 6) && (rowdata.f_added == 5))) { // Kegs | |
770 | if (value < rowdata.f_amount) | |
771 | color = '#ff4040'; | |
772 | return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + fermentableAdapter.formatNumber(value, 'f3') + '</span>'; | |
773 | } else { | |
774 | return '<span></span>'; | |
775 | } | |
776 | } | |
777 | }, | |
778 | { text: 'Procent', datafield: 'f_percentage', width: 90, align: 'right', | |
779 | cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) { | |
780 | if (rowdata.f_added >= 4) | |
781 | return '<span></span>'; | |
782 | var color = '#ffffff'; | |
783 | if (value > rowdata.f_max_in_batch) | |
784 | color = '#ff4040'; | |
785 | return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + fermentableAdapter.formatNumber(value, 'p1') + '</span>'; | |
786 | } | |
787 | }, | |
788 | { text: '100%', datafield: 'f_adjust_to_total_100', width: 70, align: 'center', cellsalign: 'center', | |
789 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
790 | if (value == 0) | |
791 | return '<span></span>'; | |
792 | return '<span><img style="float:left; margin-left:25px; margin-top:4px;" src="images/dialog-ok-apply.png"></span>'; | |
793 | } | |
794 | }, | |
795 | { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', | |
796 | cellsrenderer: function() { | |
797 | return 'Wijzig'; | |
798 | }, buttonclick: function(row) { | |
799 | fermentableRow = row; | |
800 | fermentableData = $('#fermentableGrid').jqxGrid('getrowdata', fermentableRow); | |
801 | if (fermentableData.f_added >= 4) { | |
802 | alert('Wijzig dit in de Verpakken tab'); | |
803 | } else if (dataRecord.stage > 3) { | |
804 | alert('Ingredieënt is al verwerkt.'); | |
805 | } else { | |
806 | $('#wf_name').val(fermentableData.f_name); | |
807 | $('#wf_amount').val(fermentableData.f_amount); | |
808 | $('#wf_percentage').val(fermentableData.f_percentage); | |
809 | $('#wf_max_in_batch').val(fermentableData.f_max_in_batch); | |
810 | $('#wf_adjust_to_total_100').val(fermentableData.f_adjust_to_total_100); | |
811 | $('#wf_added').val(fermentableData.f_added); | |
812 | // show the popup window. | |
813 | $('#popupFermentable').jqxWindow('open'); | |
814 | } | |
815 | } | |
816 | } | |
817 | ] | |
818 | }); | |
525
8bbc5730aaa8
Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents:
518
diff
changeset
|
819 | }; |
478 | 820 | |
821 | // Inline hops editor | |
525
8bbc5730aaa8
Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents:
518
diff
changeset
|
822 | var editHop = function(data) { |
478 | 823 | var hopSource = { |
824 | localdata: data.hops, | |
825 | datatype: 'local', | |
826 | cache: false, | |
641 | 827 | async: true, |
478 | 828 | datafields: [ |
829 | { name: 'h_name', type: 'string' }, | |
830 | { name: 'h_origin', type: 'string' }, | |
831 | { name: 'h_amount', type: 'float' }, | |
832 | { name: 'h_cost', type: 'float' }, | |
833 | { name: 'h_type', type: 'int' }, | |
834 | { name: 'h_form', type: 'int' }, | |
835 | { name: 'h_useat', type: 'int' }, | |
538
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
836 | { name: 'h_time', type: 'int' }, |
478 | 837 | { name: 'h_alpha', type: 'float' }, |
838 | { name: 'h_beta', type: 'float' }, | |
839 | { name: 'h_hsi', type: 'float' }, | |
840 | { name: 'h_humulene', type: 'float' }, | |
841 | { name: 'h_caryophyllene', type: 'float' }, | |
842 | { name: 'h_cohumulone', type: 'float' }, | |
843 | { name: 'h_myrcene', type: 'float' }, | |
844 | { name: 'h_total_oil', type: 'float' }, | |
845 | { name: 'h_inventory', type: 'float' }, | |
846 | { name: 'h_avail', type: 'int' } | |
847 | ], | |
641 | 848 | addrow: function(rowid, rowdata, position, commit) { commit(true); }, |
849 | deleterow: function(rowid, commit) { commit(true); }, | |
850 | updaterow: function(rowid, rowdata, commit) { commit(true); } | |
478 | 851 | }, |
852 | hopAdapter = new $.jqx.dataAdapter(hopSource); | |
853 | ||
854 | $('#hopGrid').jqxGrid({ | |
855 | width: 1240, | |
856 | height: 560, | |
857 | source: hopAdapter, | |
858 | theme: theme, | |
859 | selectionmode: 'singlerow', | |
860 | showtoolbar: true, | |
861 | rendertoolbar: function(toolbar) { | |
862 | var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); | |
863 | toolbar.append(container); | |
864 | container.append('<div style="float: left; margin-left: 165px;" id="haddrowbutton"></div>'); | |
865 | container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); | |
866 | container.append('<div style="float: left; margin-left: 10px;" id="hinstockbutton"></div>'); | |
867 | container.append('<input style="float: left; margin-left: 400px;" id="hdeleterowbutton" type="button" value="Verwijder hop" />'); | |
868 | // add hop from dropdownlist. | |
869 | $('#haddrowbutton').jqxDropDownList({ | |
870 | placeHolder: 'Kies hop:', | |
871 | theme: theme, | |
872 | template: 'primary', | |
873 | source: hoplist, | |
874 | disabled: (dataRecord.stage > 3), | |
875 | displayMember: 'name', | |
876 | width: 150, | |
877 | height: 27, | |
878 | dropDownWidth: 500, | |
879 | dropDownHeight: 500, | |
880 | renderer: function(index, label, value) { | |
881 | var datarecord = hoplist.records[index]; | |
564
d5fad7d80899
When adding fermentables or hops to a product, show the current inventory in the dropdownlist.
Michiel Broek <mbroek@mbse.eu>
parents:
561
diff
changeset
|
882 | return datarecord.origin + ' - ' + datarecord.name + ' / ' + HopFormData[datarecord.form].nl + ' (' + datarecord.alpha + '% α) (' + |
d5fad7d80899
When adding fermentables or hops to a product, show the current inventory in the dropdownlist.
Michiel Broek <mbroek@mbse.eu>
parents:
561
diff
changeset
|
883 | Round(datarecord.inventory * 1000.0, 1) + ' gr)'; |
478 | 884 | } |
885 | }); | |
886 | $('#haddrowbutton').on('select', function(event) { | |
887 | if (event.args) { | |
888 | var datarecord, row = {}, index = event.args.index; | |
889 | datarecord = hoplist.records[index]; | |
890 | row['h_name'] = datarecord.name; | |
891 | row['h_origin'] = datarecord.origin; | |
892 | row['h_amount'] = 0; | |
893 | row['h_cost'] = datarecord.cost; | |
894 | row['h_type'] = datarecord.type; | |
895 | row['h_form'] = datarecord.form; | |
896 | row['h_useat'] = 2; // Boil | |
897 | row['h_time'] = 0; | |
898 | row['h_alpha'] = datarecord.alpha; | |
899 | row['h_beta'] = datarecord.beta; | |
900 | row['h_hsi'] = datarecord.hsi; | |
901 | row['h_humulene'] = datarecord.humulene; | |
902 | row['h_caryophyllene'] = datarecord.caryophyllene; | |
903 | row['h_cohumulone'] = datarecord.cohumulone; | |
904 | row['h_myrcene'] = datarecord.myrcene; | |
905 | row['h_total_oil'] = datarecord.total_oil; | |
906 | row['h_inventory'] = datarecord.inventory; | |
907 | $('#hopGrid').jqxGrid('addrow', null, row); | |
908 | } | |
909 | $('#haddrowbutton').jqxDropDownList('clearSelection'); | |
910 | }); | |
911 | ||
912 | $('#hinstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); | |
913 | $('#hinstockbutton').on('change', function(event) { | |
914 | hopinstock = event.args.checked; | |
915 | hoplist.dataBind(); | |
916 | }); | |
917 | ||
918 | // delete selected hop. | |
919 | $('#hdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); | |
920 | $('#hdeleterowbutton').on('click', function() { | |
921 | var rowscount, id, selectedrowindex = $('#hopGrid').jqxGrid('getselectedrowindex'); | |
922 | rowscount = $('#hopGrid').jqxGrid('getdatainformation').rowscount; | |
923 | if (selectedrowindex >= 0 && selectedrowindex < rowscount) { | |
924 | id = $('#hopGrid').jqxGrid('getrowid', selectedrowindex); | |
925 | $('#hopGrid').jqxGrid('deleterow', id); | |
926 | } | |
927 | calcIBUs(); | |
928 | }); | |
929 | }, | |
648 | 930 | ready: function() { $('#jqxTabs').jqxTabs('next'); }, |
478 | 931 | columns: [ |
932 | { text: 'Hop', datafield: 'h_name', | |
933 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
934 | return '<span style="margin: 3px; margin-top: 6px; float: left;">' + rowdata.h_origin + ' / ' + rowdata.h_name + '</span>'; | |
935 | }, | |
936 | }, | |
937 | { text: 'Type', width: 90, datafield: 'h_type', | |
938 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
939 | return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopTypeData[value].nl + '</span>'; | |
940 | } | |
941 | }, | |
942 | { text: 'Vorm', width: 90, datafield: 'h_form', | |
943 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
944 | return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopFormData[value].nl + '</span>'; | |
945 | } | |
946 | }, | |
947 | { text: 'Alpha', datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, | |
948 | { text: 'Gebruik', width: 110, datafield: 'h_useat', | |
949 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
950 | return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopUseData[value].nl + '</span>'; | |
951 | } | |
952 | }, | |
953 | { text: 'Tijdsduur', datafield: 'h_time', width: 90, align: 'right', | |
954 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
955 | var duration = ''; | |
956 | if ((rowdata.h_useat == 2) || (rowdata.h_useat == 4)) // Boil, Whirlpool | |
957 | duration = dataAdapter.formatNumber(value, 'f0') + ' min.'; | |
958 | else if (rowdata.h_useat == 5) // Dry hop | |
959 | duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen'; | |
960 | return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>'; | |
961 | } | |
962 | }, | |
963 | { text: 'IBU', datafield: 'ibu', width: 80, align: 'right', | |
964 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
965 | var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')), | |
538
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
966 | parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time), parseFloat(rowdata.h_alpha), $('#ibu_method').val(), |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
967 | dataRecord.brew_whirlpool9, dataRecord.brew_whirlpool7, dataRecord.brew_whirlpool6); |
478 | 968 | return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(ibu, 'f1') + '</span>'; |
969 | } | |
970 | }, | |
971 | { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right', | |
972 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
973 | var amount = dataAdapter.formatNumber(value, 'f1') + ' kg'; | |
974 | if (value < 1) | |
975 | amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; | |
976 | return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>'; | |
977 | } | |
978 | }, | |
979 | { text: 'Voorraad', datafield: 'h_inventory', width: 110, align: 'right', | |
980 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
981 | if (((dataRecord.inventory_reduced <= 2) && (rowdata.h_useat <= 4)) || // Mash, FW, Boil, Aroma, Whirlpool | |
982 | ((dataRecord.inventory_reduced <= 6) && (rowdata.h_useat == 5))) { // Dry hop | |
983 | var amount, color = '#ffffff'; | |
984 | if (value < rowdata.h_amount) | |
985 | color = '#ff4040'; | |
986 | amount = dataAdapter.formatNumber(value, 'f1') + ' kg'; | |
987 | if (value < 1) | |
988 | amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; | |
989 | return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>'; | |
990 | } else { | |
991 | return '<span></span>'; | |
992 | } | |
993 | } | |
994 | }, | |
995 | { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', | |
996 | cellsrenderer: function() { | |
997 | return 'Wijzig'; | |
998 | }, buttonclick: function(row) { | |
999 | if (dataRecord.stage > 3) { | |
1000 | alert('Ingredieënt is al verwerkt.'); | |
1001 | } else { | |
1002 | console.log('edit button row ' + row); | |
1003 | hopRow = row; | |
1004 | hopData = $('#hopGrid').jqxGrid('getrowdata', hopRow); | |
1005 | $('#wh_name').val(hopData.h_name); | |
1006 | $('#wh_amount').val(hopData.h_amount * 1000); | |
1007 | var ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')), | |
538
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
1008 | parseFloat(hopData.h_amount), parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $('#ibu_method').val(), |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
1009 | dataRecord.brew_whirlpool9, dataRecord.brew_whirlpool7, dataRecord.brew_whirlpool6); |
478 | 1010 | $('#wh_ibu').val(ibu); |
1011 | if (hopData.h_useat == 5) // Dry hop | |
1012 | $('#wh_time').val(hopData.h_time / 1440); | |
1013 | else | |
1014 | $('#wh_time').val(hopData.h_time); | |
1015 | $('#wh_useat').val(hopData.h_useat); | |
1016 | // show the popup window. | |
1017 | $('#popupHop').jqxWindow('open'); | |
1018 | } | |
1019 | } | |
1020 | } | |
1021 | ] | |
1022 | }); | |
525
8bbc5730aaa8
Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents:
518
diff
changeset
|
1023 | }; |
478 | 1024 | |
1025 | // Inline miscs editor | |
525
8bbc5730aaa8
Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents:
518
diff
changeset
|
1026 | var editMisc = function(data) { |
478 | 1027 | var miscSource = { |
1028 | localdata: data.miscs, | |
1029 | datatype: 'local', | |
1030 | cache: false, | |
1031 | async: false, | |
1032 | datafields: [ | |
1033 | { name: 'm_name', type: 'string' }, | |
1034 | { name: 'm_amount', type: 'float' }, | |
1035 | { name: 'm_cost', type: 'float' }, | |
1036 | { name: 'm_type', type: 'int' }, | |
1037 | { name: 'm_use_use', type: 'int' }, | |
1038 | { name: 'm_time', type: 'float' }, | |
1039 | { name: 'm_amount_is_weight', type: 'int' }, | |
1040 | { name: 'm_inventory', type: 'float' }, | |
1041 | { name: 'm_avail', type: 'int' } | |
1042 | ], | |
641 | 1043 | addrow: function(rowid, rowdata, position, commit) { commit(true); }, |
1044 | deleterow: function(rowid, commit) { commit(true); }, | |
1045 | updaterow: function(rowid, rowdata, commit) { commit(true); } | |
478 | 1046 | }, |
1047 | miscAdapter = new $.jqx.dataAdapter(miscSource, { | |
1048 | beforeLoadComplete: function(records) { | |
1049 | var row, i, data = new Array(); | |
1050 | for (i = 0; i < records.length; i++) { | |
1051 | row = records[i]; | |
1052 | data.push(row); | |
1053 | // Initial set water agent values. | |
1054 | switch (row.m_name) { | |
1055 | case 'CaCl2': | |
1056 | $('#wa_cacl2').val(row.m_amount * 1000); | |
1057 | break; | |
1058 | case 'CaSO4': | |
1059 | $('#wa_caso4').val(row.m_amount * 1000); | |
1060 | break; | |
1061 | case 'MgSO4': | |
1062 | $('#wa_mgso4').val(row.m_amount * 1000); | |
1063 | break; | |
1064 | case 'NaCl': | |
1065 | $('#wa_nacl').val(row.m_amount * 1000); | |
1066 | break; | |
1067 | case 'Melkzuur': | |
1068 | $('#wa_acid_name').val(0); | |
1069 | $('#wa_acid').val(row.m_amount * 1000); | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
1070 | $('#wa_acid_perc').val(AcidTypeData[0].AcidPrc); // TODO: this ignores changed percentages. |
478 | 1071 | last_acid = 'Melkzuur'; |
1072 | break; | |
1073 | case 'Zoutzuur': | |
1074 | $('#wa_acid_name').val(1); | |
1075 | $('#wa_acid').val(row.m_amount * 1000); | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
1076 | $('#wa_acid_perc').val(AcidTypeData[1].AcidPrc); |
478 | 1077 | last_acid = 'Zoutzuur'; |
1078 | break; | |
1079 | case 'Fosforzuur': | |
1080 | $('#wa_acid_name').val(2); | |
1081 | $('#wa_acid').val(row.m_amount * 1000); | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
1082 | $('#wa_acid_perc').val(AcidTypeData[2].AcidPrc); |
478 | 1083 | last_acid = 'Fosforzuur'; |
1084 | break; | |
1085 | case 'Zwavelzuur': | |
1086 | $('#wa_acid_name').val(3); | |
1087 | $('#wa_acid').val(row.m_amount * 1000); | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
1088 | $('#wa_acid_perc').val(AcidTypeData[3].AcidPrc); |
478 | 1089 | last_acid = 'Zwavelzuur'; |
1090 | break; | |
1091 | case 'NaHCO3': | |
1092 | $('#wa_base_name').val(0); | |
1093 | $('#wa_base').val(row.m_amount * 1000); | |
1094 | last_base = 'NaHCO3'; | |
1095 | break; | |
1096 | case 'Na2CO3': | |
1097 | $('#wa_base_name').val(1); | |
1098 | $('#wa_base').val(row.m_amount * 1000); | |
1099 | last_base = 'Na2CO3'; | |
1100 | break; | |
1101 | case 'CaCO3': | |
1102 | $('#wa_base_name').val(2); | |
1103 | $('#wa_base').val(row.m_amount * 1000); | |
1104 | last_base = 'CaCO3'; | |
1105 | break; | |
1106 | case 'Ca(OH)2': | |
1107 | $('#wa_base_name').val(3); | |
1108 | $('#wa_base').val(row.m_amount * 1000); | |
1109 | last_base = 'Ca(OH)2'; | |
1110 | break; | |
1111 | } | |
1112 | } | |
1113 | return data; | |
1114 | }, | |
641 | 1115 | loadError: function(jqXHR, status, error) { console.log('miscs load error ' + status + ' ' + error); }, |
478 | 1116 | }); |
1117 | $('#miscGrid').jqxGrid({ | |
1118 | width: 1240, | |
1119 | height: 575, | |
1120 | source: miscAdapter, | |
1121 | theme: theme, | |
1122 | selectionmode: 'singlerow', | |
1123 | showtoolbar: true, | |
1124 | rendertoolbar: function(toolbar) { | |
1125 | var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); | |
1126 | toolbar.append(container); | |
1127 | container.append('<div style="float: left; margin-left: 165px;" id="maddrowbutton"></div>'); | |
1128 | container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); | |
1129 | container.append('<div style="float: left; margin-left: 10px;" id="minstockbutton"></div>'); | |
1130 | container.append('<input style="float: left; margin-left: 400px;" id="mdeleterowbutton" type="button" value="Verwijder ingredient" />'); | |
1131 | // add misc from dropdownlist. | |
1132 | $('#maddrowbutton').jqxDropDownList({ | |
1133 | placeHolder: 'Kies ingrediënt:', | |
1134 | theme: theme, | |
1135 | template: 'primary', | |
1136 | source: misclist, | |
1137 | disabled: (dataRecord.stage > 3), | |
1138 | displayMember: 'name', | |
1139 | width: 150, | |
1140 | height: 27, | |
1141 | dropDownWidth: 500, | |
1142 | dropDownHeight: 500 | |
1143 | }); | |
1144 | $('#maddrowbutton').on('select', function(event) { | |
1145 | if (event.args) { | |
1146 | var datarecord, row = {}, index = event.args.index; | |
1147 | datarecord = misclist.records[index]; | |
1148 | row['m_name'] = datarecord.name; | |
1149 | row['m_amount'] = 0; | |
1150 | row['m_cost'] = datarecord.cost; | |
1151 | row['m_type'] = datarecord.type; | |
1152 | row['m_use_use'] = datarecord.use_use; | |
1153 | row['m_time'] = 0; | |
1154 | row['m_amount_is_weight'] = datarecord.amount_is_weight; | |
1155 | row['m_inventory'] = datarecord.inventory; | |
1156 | $('#miscGrid').jqxGrid('addrow', null, row); | |
1157 | } | |
1158 | }); | |
1159 | $('#minstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); | |
1160 | $('#minstockbutton').on('change', function(event) { | |
1161 | miscinstock = event.args.checked; | |
1162 | misclist.dataBind(); | |
1163 | }); | |
1164 | // delete selected misc. | |
1165 | $('#mdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); | |
1166 | $('#mdeleterowbutton').on('click', function() { | |
1167 | var rowscount, type, id, selectedrowindex = $('#miscGrid').jqxGrid('getselectedrowindex'); | |
1168 | rowscount = $('#miscGrid').jqxGrid('getdatainformation').rowscount; | |
1169 | type = $('#miscGrid').jqxGrid('getcellvalue', selectedrowindex, 'm_type'); | |
1170 | if (selectedrowindex >= 0 && selectedrowindex < rowscount && type != 4) { // Water agent | |
1171 | id = $('#miscGrid').jqxGrid('getrowid', selectedrowindex); | |
1172 | $('#miscGrid').jqxGrid('deleterow', id); | |
1173 | } | |
1174 | }); | |
1175 | }, | |
648 | 1176 | ready: function() { $('#jqxTabs').jqxTabs('next'); }, |
478 | 1177 | columns: [ |
1178 | { text: 'Ingredient', datafield: 'm_name' }, | |
1179 | { text: 'Type', width: 140, datafield: 'm_type', | |
1180 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
1181 | return '<span style="margin: 3px; margin-top: 6px; float: left;">' + MiscTypeData[value].nl + '</span>'; | |
1182 | } | |
1183 | }, | |
1184 | { text: 'Gebruik', width: 140, datafield: 'm_use_use', | |
1185 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
1186 | return '<span style="margin: 3px; margin-top: 6px; float: left;">' + MiscUseData[value].nl + '</span>'; | |
1187 | } | |
1188 | }, | |
1189 | { text: 'Tijd', datafield: 'm_time', width: 90, align: 'right', | |
1190 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
1191 | var duration = ''; | |
1192 | if (rowdata.m_use_use == 2) // Boil | |
1193 | duration = dataAdapter.formatNumber(value, 'f0') + ' min.'; | |
1194 | else if ((rowdata.m_use_use == 3) || (rowdata.m_use_use == 4)) // Primary or Secondary | |
1195 | duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen'; | |
1196 | return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>'; | |
1197 | } | |
1198 | }, | |
1199 | { text: 'Hoeveel', datafield: 'm_amount', width: 110, align: 'right', | |
1200 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
1201 | var vstr = rowdata.m_amount_is_weight ? 'gr' : 'ml'; | |
1202 | return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr + '</span>'; | |
1203 | } | |
1204 | }, | |
1205 | { text: 'Voorraad', datafield: 'm_inventory', width: 110, align: 'right', | |
1206 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
1207 | var vstr, color, amount; | |
1208 | if (((dataRecord.inventory_reduced <= 2) && (rowdata.m_use_use <= 2)) || // Starter, Mash, Boil | |
1209 | ((dataRecord.inventory_reduced <= 3) && (rowdata.m_use_use == 3)) || // Primary | |
1210 | ((dataRecord.inventory_reduced <= 5) && (rowdata.m_use_use == 4)) || // Secondary, Teriary | |
1211 | ((dataRecord.inventory_reduced <= 6) && (rowdata.m_use_use == 5))) { // Bottle | |
1212 | vstr = rowdata.m_amount_is_weight ? 'gr' : 'ml'; | |
1213 | color = '#ffffff'; | |
1214 | if (value < rowdata.m_amount) | |
1215 | color = '#ff4040'; | |
1216 | amount = dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr; | |
1217 | return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>'; | |
1218 | } else { | |
1219 | return '<span></span>'; | |
1220 | } | |
1221 | } | |
1222 | }, | |
1223 | { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', | |
1224 | cellsrenderer: function() { | |
1225 | return 'Wijzig'; | |
1226 | }, buttonclick: function(row) { | |
1227 | miscRow = row; | |
1228 | miscData = $('#miscGrid').jqxGrid('getrowdata', miscRow); | |
1229 | if (dataRecord.stage > 3) { | |
1230 | alert('Ingredieënt is al verwerkt.'); | |
1231 | } else if (miscData.m_type == 4) { | |
1232 | alert('Brouwzouten wijzigen in de water tab.'); | |
1233 | } else { | |
1234 | console.log('edit button row ' + row); | |
1235 | if (miscData.m_amount_is_weight) | |
1236 | $('#wm_pmpt_amount').html('Gewicht gram:'); | |
1237 | else | |
1238 | $('#wm_pmpt_amount').html('Volume ml:'); | |
1239 | $('#wm_name').val(miscData.m_name); | |
1240 | $('#wm_amount').val(miscData.m_amount * 1000); | |
1241 | if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) // Primary or Secondary | |
1242 | $('#wm_time').val(miscData.m_time / 1440); | |
1243 | else | |
1244 | $('#wm_time').val(miscData.m_time); | |
1245 | $('#wm_use_use').val(miscData.m_use_use); | |
1246 | // show the popup window. | |
1247 | $('#popupMisc').jqxWindow('open'); | |
1248 | } | |
1249 | } | |
1250 | } | |
1251 | ] | |
1252 | }); | |
525
8bbc5730aaa8
Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents:
518
diff
changeset
|
1253 | }; |
478 | 1254 | |
1255 | // Inline yeasts editor | |
525
8bbc5730aaa8
Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents:
518
diff
changeset
|
1256 | var editYeast = function(data) { |
478 | 1257 | var yeastSource = { |
1258 | localdata: data.yeasts, | |
1259 | datatype: 'local', | |
1260 | cache: false, | |
1261 | async: false, | |
1262 | datafields: [ | |
1263 | { name: 'y_name', type: 'string' }, | |
1264 | { name: 'y_laboratory', type: 'string' }, | |
1265 | { name: 'y_product_id', type: 'string' }, | |
1266 | { name: 'y_amount', type: 'float' }, | |
1267 | { name: 'y_cost', type: 'float' }, | |
1268 | { name: 'y_type', type: 'int' }, | |
1269 | { name: 'y_form', type: 'int' }, | |
1270 | { name: 'y_flocculation', type: 'int' }, | |
1271 | { name: 'y_min_temperature', type: 'float' }, | |
1272 | { name: 'y_max_temperature', type: 'float' }, | |
1273 | { name: 'y_attenuation', type: 'float' }, | |
1274 | { name: 'y_use', type: 'int' }, | |
1275 | { name: 'y_cells', type: 'float' }, | |
1276 | { name: 'y_tolerance', type: 'float' }, | |
1277 | { name: 'y_inventory', type: 'float' }, | |
554
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
1278 | { name: 'y_sta1', type: 'int' }, |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
1279 | { name: 'y_bacteria', type: 'int' }, |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
1280 | { name: 'y_harvest_top', type: 'int' }, |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
1281 | { name: 'y_harvest_time', type: 'int' }, |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
1282 | { name: 'y_pitch_temperature', type: 'float' }, |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
1283 | { name: 'y_pofpos', type: 'int' }, |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
1284 | { name: 'y_zymocide', type: 'int' }, |
478 | 1285 | { name: 'y_avail', type: 'int' } |
1286 | ], | |
641 | 1287 | addrow: function(rowid, rowdata, position, commit) { commit(true); }, |
1288 | deleterow: function(rowid, commit) { commit(true); }, | |
1289 | updaterow: function(rowid, rowdata, commit) { commit(true); } | |
478 | 1290 | }, |
1291 | yeastAdapter = new $.jqx.dataAdapter(yeastSource); | |
1292 | ||
1293 | $('#yeastGrid').jqxGrid({ | |
1294 | width: 1240, | |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1295 | height: 325, |
478 | 1296 | source: yeastAdapter, |
1297 | theme: theme, | |
1298 | selectionmode: 'singlerow', | |
1299 | showtoolbar: true, | |
1300 | rendertoolbar: function(toolbar) { | |
1301 | var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); | |
1302 | toolbar.append(container); | |
1303 | container.append('<div style="float: left; margin-left: 165px;" id="yaddrowbutton"></div>'); | |
1304 | container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); | |
1305 | container.append('<div style="float: left; margin-left: 10px;" id="yinstockbutton"></div>'); | |
1306 | container.append('<input style="float: left; margin-left: 400px;" id="ydeleterowbutton" type="button" value="Verwijder gist" />'); | |
1307 | // add yeast from dropdownlist. | |
1308 | $('#yaddrowbutton').jqxDropDownList({ | |
1309 | placeHolder: 'Kies gist:', | |
1310 | theme: theme, | |
1311 | source: yeastlist, | |
1312 | disabled: (dataRecord.stage > 3), | |
1313 | template: 'primary', | |
1314 | displayMember: 'name', | |
1315 | width: 150, | |
1316 | height: 27, | |
1317 | dropDownWidth: 500, | |
1318 | dropDownHeight: 500, | |
1319 | renderer: function(index, label, value) { | |
1320 | var datarecord = yeastlist.records[index]; | |
1321 | return datarecord.laboratory + ' ' + datarecord.product_id + ' ' + datarecord.name; | |
1322 | } | |
1323 | }); | |
1324 | $('#yaddrowbutton').on('select', function(event) { | |
1325 | if (event.args) { | |
1326 | var datarecord, row = {}, index = event.args.index; | |
1327 | datarecord = yeastlist.records[index]; | |
1328 | row['y_name'] = datarecord.name; | |
1329 | row['y_laboratory'] = datarecord.laboratory; | |
1330 | row['y_product_id'] = datarecord.product_id; | |
1331 | row['y_type'] = datarecord.type; | |
1332 | row['y_form'] = datarecord.form; | |
1333 | row['y_amount'] = 0; | |
1334 | row['y_cost'] = datarecord.cost; | |
1335 | row['y_use'] = 0; | |
1336 | row['y_min_temperature'] = datarecord.min_temperature; | |
1337 | row['y_max_temperature'] = datarecord.max_temperature; | |
1338 | row['y_attenuation'] = datarecord.attenuation; | |
1339 | row['y_flocculation'] = datarecord.flocculation; | |
1340 | row['y_cells'] = datarecord.cells; | |
1341 | row['y_tolerance'] = datarecord.tolerance; | |
1342 | row['y_inventory'] = datarecord.inventory; | |
554
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
1343 | row['y_sta1'] = datarecord.sta1; |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
1344 | row['y_bacteria'] = datarecord.bacteria; |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
1345 | row['y_harvest_top'] = datarecord.harvest_top; |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
1346 | row['y_harvest_time'] = datarecord.harvest_time; |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
1347 | row['y_pitch_temperature'] = datarecord.pitch_temperature; |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
1348 | row['y_pofpos'] = datarecord.pofpos; |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
1349 | row['y_zymocide'] = datarecord.zymocide; |
478 | 1350 | $('#yeastGrid').jqxGrid('addrow', null, row); |
1351 | } | |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1352 | calcViability(); |
478 | 1353 | calcYeast(); |
1354 | $('#yaddrowbutton').jqxDropDownList('clearSelection'); | |
1355 | }); | |
1356 | $('#yinstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); | |
1357 | $('#yinstockbutton').on('change', function(event) { | |
1358 | yeastinstock = event.args.checked; | |
1359 | yeastlist.dataBind(); | |
1360 | }); | |
1361 | // delete selected yeast. | |
1362 | $('#ydeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); | |
1363 | $('#ydeleterowbutton').on('click', function() { | |
1364 | var id, rowscount, selectedrowindex = $('#yeastGrid').jqxGrid('getselectedrowindex'); | |
1365 | rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount; | |
1366 | if (selectedrowindex >= 0 && selectedrowindex < rowscount) { | |
1367 | id = $('#yeastGrid').jqxGrid('getrowid', selectedrowindex); | |
1368 | $('#yeastGrid').jqxGrid('deleterow', id); | |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1369 | calcViability(); |
478 | 1370 | calcYeast(); |
1371 | } | |
1372 | }); | |
1373 | }, | |
648 | 1374 | ready: function() { $('#jqxTabs').jqxTabs('next'); }, |
478 | 1375 | columns: [ |
1376 | { text: 'Gist', datafield: 'y_name' }, | |
1377 | { text: 'Laboratorium', width: 150, datafield: 'y_laboratory' }, | |
1378 | { text: 'Code', width: 90, datafield: 'y_product_id' }, | |
1379 | { text: 'Soort', width: 100, datafield: 'y_form', | |
1380 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
1381 | return '<span style="margin: 4px; margin-top: 6px; float: left;">' + YeastFormData[value].nl + '</span>'; | |
1382 | } | |
1383 | }, | |
1384 | { text: 'Min. °C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_min_temperature' }, | |
1385 | { text: 'Max. °C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_max_temperature' }, | |
1386 | { text: 'Tol. %', width: 60, align: 'right', cellsalign: 'right', datafield: 'y_tolerance', | |
1387 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
1388 | var amount = '', color = '#ffffff'; | |
1389 | if (value > 0) { | |
1390 | amount = dataAdapter.formatNumber(value, 'f1'); | |
1391 | if (dataRecord.est_abv > value) | |
1392 | color = '#ff4040'; | |
1393 | } | |
1394 | return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>'; | |
1395 | } | |
1396 | }, | |
1397 | { text: 'Attn. %', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_attenuation', cellsformat: 'f1' }, | |
1398 | { text: 'Voor', width: 120, datafield: 'y_use', | |
1399 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
1400 | return '<span style="margin: 4px; margin-top: 6px; float: left;">' + YeastUseData[value].nl + '</span>'; | |
1401 | } | |
1402 | }, | |
1403 | { text: 'Hoeveel', datafield: 'y_amount', width: 90, align: 'right', | |
1404 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
1405 | var amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml'; | |
1406 | if (rowdata.y_form == 0) // Liquid | |
1407 | amount = dataAdapter.formatNumber(value, 'f0') + ' pk'; | |
515
9d771385a8a0
Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.
Michiel Broek <mbroek@mbse.eu>
parents:
500
diff
changeset
|
1408 | else if (rowdata.y_form == 1 || rowdata.y_form == 6) // Dry |
478 | 1409 | amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; |
1410 | return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>'; | |
1411 | } | |
1412 | }, | |
1413 | { text: 'Voorraad', datafield: 'y_inventory', width: 90, align: 'right', | |
1414 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
1415 | var color, amount; | |
1416 | if (((dataRecord.inventory_reduced <= 3) && (rowdata.y_use == 0)) || // Primary | |
1417 | ((dataRecord.inventory_reduced <= 4) && (rowdata.y_use == 1)) || // Secondary | |
1418 | ((dataRecord.inventory_reduced <= 5) && (rowdata.y_use == 2)) || // Tertiary | |
1419 | ((dataRecord.inventory_reduced <= 6) && (rowdata.y_use == 3))) { // Bottle | |
1420 | color = '#ffffff'; | |
1421 | if (value < rowdata.y_amount) | |
1422 | color = '#ff4040'; | |
1423 | amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml'; | |
1424 | if (rowdata.y_form == 0) // Liquid | |
1425 | amount = dataAdapter.formatNumber(value, 'f0') + ' pk'; | |
515
9d771385a8a0
Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.
Michiel Broek <mbroek@mbse.eu>
parents:
500
diff
changeset
|
1426 | else if (rowdata.y_form == 1 || rowdata.y_form == 6) // Dry |
478 | 1427 | amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; |
1428 | return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>'; | |
1429 | } else { | |
1430 | return '<span></span>'; | |
1431 | } | |
1432 | } | |
1433 | }, | |
1434 | { text: '', datafield: 'Edit', columntype: 'button', width: 90, align: 'center', | |
1435 | cellsrenderer: function() { | |
1436 | return 'Wijzig'; | |
1437 | }, buttonclick: function(row) { | |
1438 | if (dataRecord.stage > 3) { | |
1439 | alert('Ingredieënt is al verwerkt.'); | |
1440 | } else { | |
1441 | yeastRow = row; | |
1442 | yeastData = $('#yeastGrid').jqxGrid('getrowdata', yeastRow); | |
1443 | if (yeastData.y_form == 0) { | |
1444 | $('#wy_pmpt_amount').html('Pak(ken):'); | |
1445 | $('#wy_amount').val(yeastData.y_amount); | |
1446 | $('#wy_amount').jqxNumberInput({ decimalDigits: 0 }); | |
515
9d771385a8a0
Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.
Michiel Broek <mbroek@mbse.eu>
parents:
500
diff
changeset
|
1447 | } else if (yeastData.y_form == 1 || yeastData.y_form == 6) { |
478 | 1448 | $('#wy_pmpt_amount').html('Gewicht gram:'); |
1449 | $('#wy_amount').val(yeastData.y_amount * 1000); | |
1450 | $('#wy_amount').jqxNumberInput({ decimalDigits: 1 }); | |
1451 | } else { | |
1452 | $('#wy_pmpt_amount').html('Volume ml:'); | |
1453 | $('#wy_amount').val(yeastData.y_amount * 1000); | |
1454 | $('#wy_amount').jqxNumberInput({ decimalDigits: 0 }); | |
1455 | } | |
1456 | $('#wy_name').val(yeastData.y_name); | |
1457 | $('#wy_laboratory').val(yeastData.y_laboratory); | |
1458 | $('#wy_product_id').val(yeastData.y_product_id); | |
1459 | $('#wy_use').val(yeastData.y_use); | |
1460 | // show the popup window. | |
1461 | $('#popupYeast').jqxWindow('open'); | |
1462 | } | |
1463 | } | |
1464 | } | |
1465 | ] | |
1466 | }); | |
525
8bbc5730aaa8
Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents:
518
diff
changeset
|
1467 | }; |
478 | 1468 | |
1469 | // inline mash editor | |
525
8bbc5730aaa8
Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents:
518
diff
changeset
|
1470 | var editMash = function(data) { |
478 | 1471 | var mashSource = { |
1472 | localdata: data.mashs, | |
1473 | datatype: 'local', | |
1474 | cache: false, | |
1475 | async: false, | |
1476 | datafields: [ | |
1477 | { name: 'step_name', type: 'string' }, | |
1478 | { name: 'step_type', type: 'int' }, | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1479 | { name: 'step_volume', type: 'float' }, |
478 | 1480 | { name: 'step_infuse_amount', type: 'float' }, |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1481 | { name: 'step_infuse_temp', type: 'float' }, |
478 | 1482 | { name: 'step_temp', type: 'float' }, |
1483 | { name: 'step_time', type: 'float' }, | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1484 | { name: 'step_wg_ratio', type: 'float' }, |
478 | 1485 | { name: 'ramp_time', type: 'float' }, |
1486 | { name: 'end_temp', type: 'float' } | |
1487 | ], | |
644
4654b8ee4690
Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
643
diff
changeset
|
1488 | addrow: function(rowid, rowdata, position, commit) { commit(true); }, |
4654b8ee4690
Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
643
diff
changeset
|
1489 | deleterow: function(rowid, commit) { commit(true); } |
478 | 1490 | }, |
1491 | mashAdapter = new $.jqx.dataAdapter(mashSource, { | |
1492 | beforeLoadComplete: function(records) { | |
1493 | mash_infuse = 0; | |
1494 | var i, row, data = new Array(); | |
1495 | for (i = 0; i < records.length; i++) { | |
1496 | row = records[i]; | |
1497 | if (row.step_type == 0) // Infusion | |
1498 | mash_infuse += parseFloat(row.step_infuse_amount); | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1499 | row.step_wg_ratio = 0; // Init this field. |
478 | 1500 | data.push(row); |
1501 | } | |
1502 | }, | |
1503 | }); | |
1504 | $('#mashGrid').jqxGrid({ | |
1505 | width: 1240, | |
1506 | height: 400, | |
1507 | source: mashAdapter, | |
1508 | theme: theme, | |
1509 | selectionmode: 'singlerow', | |
1510 | showtoolbar: true, | |
1511 | rendertoolbar: function(toolbar) { | |
1512 | var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); | |
1513 | toolbar.append(container); | |
1514 | container.append('<input style="float: left; margin-left: 165px;" id="saddrowbutton" type="button" value="Nieuwe stap" />'); | |
1515 | container.append('<input style="float: left; margin-left: 565px;" id="sdeleterowbutton" type="button" value="Verwijder stap" />'); | |
1516 | $('#saddrowbutton').jqxButton({ template: 'primary', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); | |
1517 | $('#saddrowbutton').on('click', function() { | |
1518 | var row = {}, rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount; | |
1519 | row['step_name'] = 'Stap ' + (rowscount + 1); | |
1520 | if (rowscount > 0) { | |
1521 | row['step_type'] = 1; | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1522 | row['step_infuse_amount'] = 0; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1523 | row['step_volume'] = mash_infuse; |
478 | 1524 | } else { |
1525 | row['step_type'] = 0; | |
1526 | row['step_infuse_amount'] = 15; | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1527 | row['step_volume'] = 15; |
478 | 1528 | } |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1529 | row['step_infuse_temp'] = 0; |
478 | 1530 | row['step_temp'] = 62.0; |
1531 | row['step_time'] = 20.0; | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1532 | row['step_wg_ratio'] = 0; |
478 | 1533 | row['ramp_time'] = 1.0; |
1534 | row['end_temp'] = 62.0; | |
1535 | $('#mashGrid').jqxGrid('addrow', null, row); | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1536 | calcMash(); |
478 | 1537 | }); |
1538 | // delete selected step. | |
1539 | $('#sdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); | |
1540 | $('#sdeleterowbutton').on('click', function() { | |
1541 | var rowscount, id, selectedrowindex = $('#mashGrid').jqxGrid('getselectedrowindex'); | |
1542 | rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount; | |
1543 | if (selectedrowindex >= 0 && selectedrowindex < rowscount) { | |
1544 | id = $('#mashGrid').jqxGrid('getrowid', selectedrowindex); | |
1545 | $('#mashGrid').jqxGrid('deleterow', id); | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1546 | calcMash(); |
478 | 1547 | } |
1548 | }); | |
1549 | }, | |
1550 | ready: function() { | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
1551 | /* Calculate the whole recipe */ |
641 | 1552 | console.log('ready mashs, start calculations'); |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
1553 | calcFermentables(); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
1554 | whirlpoolHops(); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
1555 | calcIBUs(); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
1556 | calcMiscs(); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
1557 | showStarter(); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
1558 | calcYeast(); |
478 | 1559 | calcInit(); |
1560 | calcMash(); | |
658
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
1561 | kookTijd(); |
641 | 1562 | console.log('calculations ready'); |
478 | 1563 | $('#jqxLoader').jqxLoader('close'); |
1564 | $('#jqxTabs').jqxTabs('first'); | |
1565 | }, | |
1566 | columns: [ | |
1567 | { text: 'Stap naam', datafield: 'step_name' }, | |
1568 | { text: 'Stap type', datafield: 'step_type', width: 175, | |
1569 | cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { | |
1570 | return '<span style="margin: 4px; margin-top: 6px; float: left;">' + MashStepTypeData[value].nl + '</span>'; | |
1571 | } | |
1572 | }, | |
1573 | { text: 'Start °C', datafield: 'step_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, | |
1574 | { text: 'Eind °C', datafield: 'end_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, | |
1575 | { text: 'Rust min.', datafield: 'step_time', width: 90, align: 'right', cellsalign: 'right' }, | |
1576 | { text: 'Stap min.', datafield: 'ramp_time', width: 90, align: 'right', cellsalign: 'right' }, | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1577 | { text: 'Inf/dec L.', datafield: 'step_infuse_amount', width: 90, align: 'right', |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1578 | cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1579 | if (rowdata.step_type == 1) |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1580 | return '<span></span>'; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1581 | var color = '#ffffff'; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1582 | var mvol = mashkg * MaltVolume; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1583 | if ((rowdata.step_wg_ratio * mashkg + mvol) > dataRecord.eq_tun_volume) |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1584 | color = '#ff4040'; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1585 | return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + dataAdapter.formatNumber(value, 'f1') + '</span>'; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1586 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1587 | }, |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1588 | { text: 'Inf/dec °C', datafield: 'step_infuse_temp', width: 90, align: 'right', |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1589 | cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1590 | if (rowdata.step_type == 1) |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1591 | return '<span></span>'; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1592 | return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(value, 'f2') + '</span>'; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1593 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1594 | }, |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1595 | { text: 'L/Kg.', datafield: 'step_wg_ratio', width: 90, align: 'right', |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1596 | cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1597 | var color = '#ffffff'; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1598 | if (value < 2.0 || value > 6.0) |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1599 | color = '#ff4040'; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1600 | return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + dataAdapter.formatNumber(value, 'f2') + '</span>'; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1601 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1602 | }, |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1603 | { text: '', columntype: 'button', width: 15, align: 'center', |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1604 | cellsrenderer: function(row) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1605 | if (row < 2) |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1606 | return ' '; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1607 | return 'â–´'; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1608 | }, buttonclick: function(row) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1609 | if (row >= 2) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1610 | swapMash(row, row-1); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1611 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1612 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1613 | }, |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1614 | { text: '', columntype: 'button', width: 15, align: 'center', |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1615 | cellsrenderer: function(row) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1616 | rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1617 | if (row < 1 || row > (rowscount -2)) |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1618 | return ' '; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1619 | return 'â–¾'; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1620 | }, buttonclick: function(row) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1621 | rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1622 | if (row >= 1 && row <= (rowscount -2)) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1623 | swapMash(row, row+1); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1624 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1625 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1626 | }, |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1627 | { text: '', datafield: 'Edit', columntype: 'button', width: 80, align: 'center', |
478 | 1628 | cellsrenderer: function() { |
1629 | return 'Wijzig'; | |
1630 | }, buttonclick: function(row) { | |
1631 | if (dataRecord.stage > 3) { | |
557 | 1632 | alert('Het maischen is al gedaan.'); |
478 | 1633 | } else { |
1634 | mashRow = row; | |
1635 | mashData = $('#mashGrid').jqxGrid('getrowdata', mashRow); | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1636 | if (mashRow == 0) |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1637 | $("#wstep_type").jqxDropDownList('disableAt', 2); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1638 | else |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1639 | $("#wstep_type").jqxDropDownList('enableAt', 2); |
478 | 1640 | $('#wstep_name').val(mashData.step_name); |
1641 | $('#wstep_type').val(mashData.step_type); | |
1642 | $('#wstep_infuse_amount').val(mashData.step_infuse_amount); | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1643 | $('#wstep_infuse_temp').val(mashData.step_infuse_temp); |
478 | 1644 | $('#wstep_temp').val(mashData.step_temp); |
1645 | $('#wend_temp').val(mashData.end_temp); | |
1646 | $('#wstep_time').val(mashData.step_time); | |
1647 | $('#wramp_time').val(mashData.ramp_time); | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1648 | $('#wstep_infuse_amount').hide(); // Hide all untile we need it. |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1649 | $('#wstep_infuse_temp').hide(); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1650 | $('#wstep_pmpt_amount').hide(); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1651 | $('#wstep_pmpt_temp').hide(); |
478 | 1652 | if (mashData.step_type == 0) { |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1653 | if (mashRow == 0) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1654 | $('#wstep_infuse_amount').show(); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1655 | $('#wstep_pmpt_amount').show(); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1656 | } else { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1657 | $('#wstep_infuse_temp').show(); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1658 | $('#wstep_pmpt_temp').show(); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1659 | } |
478 | 1660 | } |
1661 | // show the popup window. | |
1662 | $('#popupMash').jqxWindow('open'); | |
1663 | } | |
1664 | } | |
1665 | } | |
1666 | ] | |
1667 | }); | |
1668 | }; | |
1669 | ||
1670 | /* | |
1671 | * Remove the top menu so that we MUST use the buttons to leave the editor. | |
1672 | */ | |
1673 | $('#jqxMenu').jqxMenu('destroy'); | |
1674 | console.log('record:' + my_record + ' return:' + my_return + ' theme:' + theme); | |
557 | 1675 | $('#jqxLoader').jqxLoader({ width: 250, height: 150, isModal: true, text: 'Laden product ...', theme: theme }); |
640 | 1676 | $('#jqxLoader').jqxLoader('open'); |
478 | 1677 | |
638
736c8d29bc87
Binding the data earlier to try to prevent a race condition.
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
1678 | /* Moved to before all functions */ |
736c8d29bc87
Binding the data earlier to try to prevent a race condition.
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
1679 | dataAdapter.dataBind(); |
736c8d29bc87
Binding the data earlier to try to prevent a race condition.
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
1680 | |
478 | 1681 | /* |
1682 | * Generic functions | |
1683 | */ | |
658
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
1684 | function kookTijd() { |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
1685 | if (dataRecord.boil_time) { |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
1686 | $('#brew_pmpt_koken').html('Koken ' + dataRecord.boil_time + ' minuten'); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
1687 | } else { |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
1688 | $('#brew_pmpt_koken').html('Koken "no-boil"'); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
1689 | } |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
1690 | } |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
1691 | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1692 | function swapMash(r1, r2) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1693 | |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1694 | console.log('swap mash rows ' + r1 + ' ' + r2); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1695 | var row1 = $('#mashGrid').jqxGrid('getrowdata', r1); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1696 | var row2 = $('#mashGrid').jqxGrid('getrowdata', r2); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1697 | var obj1 = { step_name: row1.step_name, step_type: row1.step_type, step_volume: row1.step_volume, step_infuse_amount: row1.step_infuse_amount, |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1698 | step_infuse_temp: row1.step_infuse_temp, step_temp: row1.step_temp, step_time: row1.step_time, |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1699 | ramp_time: row1.ramp_time, end_temp: row1.end_temp, step_wg_ratio: row1.step_wg_ratio }; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1700 | var obj2 = { step_name: row2.step_name, step_type: row2.step_type, step_volume: row2.step_volume, step_infuse_amount: row2.step_infuse_amount, |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1701 | step_infuse_temp: row2.step_infuse_temp, step_temp: row2.step_temp, step_time: row2.step_time, |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1702 | ramp_time: row2.ramp_time, end_temp: row2.end_temp, step_wg_ratio: row2.step_wg_ratio }; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1703 | $("#mashGrid").jqxGrid('updaterow', r1, obj2); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1704 | $("#mashGrid").jqxGrid('updaterow', r2, obj1); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1705 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1706 | |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1707 | function infusionVol(step_infused, step_mashkg, infuse_temp, step_temp, last_temp) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1708 | var a = last_temp * (dataRecord.eq_tun_weight * dataRecord.eq_tun_specific_heat + step_infused * SpecificHeatWater + step_mashkg * SpecificHeatMalt); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1709 | var b = step_temp * (dataRecord.eq_tun_weight * dataRecord.eq_tun_specific_heat + step_infused * SpecificHeatWater + step_mashkg * SpecificHeatMalt); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1710 | //console.log('b - a: ' + (b - a) + ' t: ' + ((infuse_temp - step_temp) * SpecificHeatWater)); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1711 | //console.log('res: ' + ((b - a) / ((infuse_temp - step_temp) * SpecificHeatWater))); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1712 | var vol = Round(((b - a) / ((infuse_temp - step_temp) * SpecificHeatWater)), 2); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1713 | console.log('infusionVol(' + step_infused + ', ' + step_mashkg + ', ' + infuse_temp + ', ' + step_temp + ', ' + last_temp + '): ' + vol); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1714 | return vol; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1715 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1716 | |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1717 | function decoctionVol(step_volume, step_temp, prev_temp) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1718 | var a = (dataRecord.eq_tun_weight * dataRecord.eq_tun_specific_heat + step_volume * SpecificHeatWater) * (step_temp - prev_temp); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1719 | var b = SpecificHeatWater * (99 - step_temp); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1720 | var vol = 0; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1721 | if (b > 0) |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1722 | vol = Round(a / b, 6); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1723 | console.log('decoctionVol(' + step_volume + ', ' + step_temp + ', ' + prev_temp + '): ' + vol); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1724 | return vol; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1725 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
1726 | |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1727 | function calcViability() { |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1728 | var vpm = 1.00; |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1729 | var max = 100; |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1730 | var rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount; |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1731 | if (rowscount) { |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1732 | for (i = 0; i < rowscount; i++) { |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1733 | row = $('#yeastGrid').jqxGrid('getrowdata', i); |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1734 | if (row.y_use == 0) { |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1735 | if (row.y_form == 0) { // Liquid |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1736 | vpm = 0.80; |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1737 | max = 97; |
623
4aee10bcb94e
Better yeast viability for PurePitch yeast.
Michiel Broek <mbroek@mbse.eu>
parents:
622
diff
changeset
|
1738 | if (row.y_laboratory == 'White Labs') { // PurePitch |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1739 | vpm = 0.95; |
623
4aee10bcb94e
Better yeast viability for PurePitch yeast.
Michiel Broek <mbroek@mbse.eu>
parents:
622
diff
changeset
|
1740 | max = 100; |
4aee10bcb94e
Better yeast viability for PurePitch yeast.
Michiel Broek <mbroek@mbse.eu>
parents:
622
diff
changeset
|
1741 | } |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1742 | } else if (row.y_form == 1) { // dry yeast |
647
243be110285c
Adjusted the dry-yeast degradation to 4% per year.
Michiel Broek <mbroek@mbse.eu>
parents:
646
diff
changeset
|
1743 | vpm = 0.997; |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1744 | max = 100; |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1745 | } else if (row.y_form == 6) { // Dried kveik |
618
2712082437b0
Setting the dried Kveik viability to 8% per month.
Michiel Broek <mbroek@mbse.eu>
parents:
617
diff
changeset
|
1746 | vpm = 0.92; |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1747 | max = 100; |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1748 | } else { // Slant, Culture, Frozen, Bottle |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1749 | vpm = 0.99; |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1750 | max = 97; |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1751 | } |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1752 | } |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1753 | } |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1754 | } |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1755 | var base = max; |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1756 | var days = 0; |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1757 | |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1758 | if (parseFloat($('#yeast_prod_date').val()) > 2000) { |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1759 | console.log('calculate viability'); |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1760 | var d = new Date(); |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1761 | var date2 = $('#yeast_prod_date').val(); |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1762 | date2 = date2.split('-'); |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1763 | // Now we convert the array to a Date object |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1764 | var date1 = new Date(d.getFullYear(), d.getMonth(), d.getDate()); |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1765 | date2 = new Date(date2[0], date2[1] - 1, date2[2]); |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1766 | var diff = parseInt(date1.getTime()) - parseInt(date2.getTime()); |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1767 | days = Math.floor(diff/1000/60/60/24); |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1768 | |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1769 | var degrade = 1 - ((1 - vpm) / 30.41); // viability degradation per day. |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1770 | for (i = 0; i < days; i++) { |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1771 | base = base * degrade; |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1772 | } |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1773 | if (base > max) { |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1774 | base = max; |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1775 | } |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1776 | base = Math.round(base); |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1777 | } |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1778 | console.log('age:' + days + ' max:' + max + ' vpm:' + vpm + ' base:' + base); |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1779 | |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1780 | if (dataRecord.starter_viability != base) { |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1781 | dataRecord.starter_viability = base; |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1782 | $('#starter_viability').val(dataRecord.starter_viability); |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1783 | } |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1784 | } |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
1785 | |
478 | 1786 | function calcSupplies() { |
1787 | if (dataRecord.inventory_reduced > 6) { | |
1788 | $('#ok_pmpt').hide(); | |
1789 | return; | |
1790 | } | |
1791 | if (ok_fermentables && ok_hops && ok_miscs && ok_yeasts && ok_waters) | |
1792 | $('#ok_supplies').html("<img src='images/dialog-ok-apply.png'>"); | |
1793 | else | |
1794 | $('#ok_supplies').html("<img src='images/dialog-error.png'>"); | |
1795 | } | |
1796 | ||
1797 | function calcPercentages() { | |
1798 | ||
1799 | console.log('calcPercentages()'); | |
1800 | var tw = 0, rowdata, percentage, rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount; | |
1801 | if (rowscount > 1) { | |
1802 | for (i = 0; i < rowscount; i++) { | |
1803 | rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i); | |
1804 | if (rowdata.f_added < 4) | |
1805 | tw += Round(rowdata.f_amount, 3); | |
1806 | } | |
1807 | tw = Round(tw, 3); | |
1808 | ||
1809 | for (i = 0; i < rowscount; i++) { | |
1810 | rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i); | |
1811 | if (rowdata.f_added < 4) { | |
1812 | percentage = Round(rowdata.f_amount / tw * 100, 1); | |
1813 | $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', percentage); | |
1814 | } else { | |
1815 | $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', 0); | |
1816 | } | |
1817 | } | |
1818 | } else { | |
1819 | $('#fermentableGrid').jqxGrid('setcellvalue', 0, 'f_percentage', 100); | |
1820 | } | |
1821 | } | |
1822 | ||
1823 | /* | |
1824 | * All calculations that depend on changes in the fermentables, | |
1825 | * volumes and equipments. | |
1826 | */ | |
1827 | function calcFermentables() { | |
1828 | ||
1829 | var sugarsf = 0, // fermentable sugars mash + boil | |
1830 | sugarsm = 0, // fermentable sugars in mash | |
1831 | vol = 0, // Volume sugars after boil | |
1832 | addedS = 0, // Added sugars after boil | |
1833 | addedmass = 0, // Added mass after boil | |
1834 | mvol = 0, // mash volume | |
1835 | colort = 0, // Colors srm * vol totals | |
1836 | colorh = 0, // Colors ebc * vol * kt | |
1837 | colorn = 0, // Colors ebc * pt * pct | |
1838 | my_100 = false, | |
1839 | mashtime = 0, // Total mash time | |
1840 | mashtemp = 0, // Average mash temperature | |
1841 | bv = 0.925, // Bierverlies rendement | |
1842 | sr = 0.95, // Mash en spoel rendement | |
1843 | lintner = 0, // Total recipe lintner | |
1844 | i, row, rows, org, timem, aboil_volume, spoelw, ogx, topw, s = 0, d, v, x, | |
1845 | sug, alc, pt, cw, color, scolor, fig; | |
1846 | ||
1847 | /* Init global variables */ | |
1848 | psugar = 0; | |
1849 | pcara = 0; | |
1850 | mashkg = 0; | |
1851 | ok_fermentables = 1; // All is in stock. | |
1852 | ok_yeasts = 1; | |
1853 | ||
1854 | if ((rows = $('#mashGrid').jqxGrid('getrows'))) { | |
1855 | for (i = 0; i < rows.length; i++) { | |
1856 | row = rows[i]; | |
1857 | if (row.step_type == 0) // Infusion | |
1858 | mvol += parseFloat(row.step_infuse_amount); | |
1859 | if (row.step_temp <= 75) { // Ignore mashout | |
1860 | timem = row.step_time + row.ramp_time; | |
1861 | mashtime += timem; | |
1862 | mashtemp += timem * row.step_temp; | |
1863 | } | |
1864 | } | |
1865 | if (mashtime > 5) | |
1866 | mashtime -= 5; //Correct last ramp > 75 | |
1867 | mashtemp = Round(mashtemp / mashtime, 2); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
1868 | } else { |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
1869 | console.log("calcFermentables() mashGrid not loaded"); |
478 | 1870 | } |
1871 | ||
1872 | if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) { | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
1873 | console.log("calcFermentables() fermentableGrid not loaded"); |
478 | 1874 | return; // grid not yet loaded. |
1875 | } | |
1876 | ||
1877 | for (i = 0; i < rows.length; i++) { | |
1878 | row = rows[i]; | |
1879 | if (row.f_adjust_to_total_100) | |
1880 | my_100 = true; | |
1881 | if (row.f_type == 1 && row.f_added < 4) // Sugar | |
1882 | psugar += row.f_percentage; | |
1883 | if (row.f_graintype == 2 && row.f_added < 4) // Crystal | |
1884 | pcara += row.f_percentage; | |
1885 | d = row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100); | |
1886 | if (row.f_added == 0) { // Mash | |
1887 | if (mvol > 0) { // Only if mash already known. | |
1888 | mvol += row.f_amount * row.f_moisture / 100; | |
1889 | s += d; | |
1890 | } | |
1891 | d = parseFloat(dataRecord.efficiency) / 100 * d; | |
1892 | sugarsm += d; | |
1893 | mashkg += parseFloat(row.f_amount); | |
1894 | } | |
1895 | if (row.f_added == 0 || row.f_added == 1) // Mash or Boil | |
1896 | sugarsf += d; | |
1897 | if (row.f_added == 2 || row.f_added == 3) { // Fermentation or lagering | |
1898 | x = (row.f_yield / 100) * (1 - row.f_moisture / 100); | |
1899 | addedS += row.f_amount * x; | |
1900 | addedmass += row.f_amount; | |
1901 | vol += (x * sugardensity + (1 - x) * 1) * row.f_amount; | |
1902 | } | |
1903 | if (row.f_added < 4) { | |
1904 | colort += row.f_amount * ebc_to_srm(row.f_color); | |
1905 | colorh += row.f_amount * row.f_color * get_kt(row.f_color); | |
1906 | colorn += (row.f_percentage / 100) * row.f_color; // For 8.6 Pt wort. | |
1907 | } | |
1908 | if (fermentableInit) { | |
1909 | if (row.f_added == 4) { | |
1910 | $('#bottle_priming_total').val(row.f_amount * 1000); // Prevent clearing | |
1911 | $('#bottle_priming_sugar').jqxDropDownList('selectItem', row.f_name); | |
1912 | } | |
1913 | if (row.f_added == 5) { | |
1914 | $('#keg_priming_total').val(row.f_amount * 1000); | |
1915 | $('#keg_priming_sugar').jqxDropDownList('selectItem', row.f_name); | |
1916 | } | |
1917 | } | |
1918 | // Check supplies. | |
1919 | if ((((dataRecord.inventory_reduced <= 2) && (row.f_added <= 1)) || // Mash or boil | |
1920 | ((dataRecord.inventory_reduced <= 3) && (row.f_added == 2)) || // Primary | |
1921 | ((dataRecord.inventory_reduced <= 5) && (row.f_added == 3)) || // Secondary or Tertiary | |
1922 | ((dataRecord.inventory_reduced <= 6) && (row.f_added == 4)) || // Bottle | |
1923 | ((dataRecord.inventory_reduced <= 6) && (row.f_added == 5))) && row.f_inventory < row.f_amount) { | |
1924 | ok_fermentables = 0; | |
1925 | } | |
1926 | if (row.f_added == 0 && (row.f_type == 0 || row.f_type == 4) && row.f_color < 50) { // Mash and Grain/Adjunct and Color < 50 | |
1927 | lintner += row.f_diastatic_power * row.f_amount; | |
1928 | } | |
1929 | } | |
1930 | fermentableInit = 0; | |
1931 | $('#ferm_lintner').val(Math.round(parseFloat(lintner / mashkg))); | |
1932 | $('#mash_kg').val(mashkg); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
1933 | console.log('calcFermentables() supplies:' + ok_fermentables + ' moutsuiker:' + Round(sugarsm, 3) + '/' + Round(sugarsf, 3)); |
478 | 1934 | to_100 = my_100; |
1935 | if (to_100) { | |
1936 | $('#wf_amount').jqxNumberInput({ width: 90, readOnly: true, spinButtons: false }); | |
1937 | } else { | |
1938 | $('#wf_amount').jqxNumberInput({ width: 110, readOnly: false, spinButtons: true }); | |
1939 | } | |
1940 | ||
1941 | if (mvol > 0) { | |
1942 | v = s / sugardensity + mvol; | |
1943 | s = 1000 * s / (v * 10); //deg. Plato | |
1944 | est_mash_sg = Round(plato_to_sg(s), 5); | |
1945 | $('#est_mash_sg').val(est_mash_sg); | |
1946 | } | |
1947 | ||
1948 | // Estimate total recipe OG. | |
1949 | dataRecord.est_og = estimate_sg(sugarsf + addedS, parseFloat(dataRecord.batch_size)); | |
1950 | $('#est_og').val(dataRecord.est_og); | |
1951 | $('#est_og2').val(dataRecord.est_og); | |
1952 | org = dataRecord.est_og; | |
1953 | ||
1954 | // Estimate SG in kettle after boil | |
1955 | aboil_sg = estimate_sg(sugarsf, parseFloat(dataRecord.batch_size)); | |
1956 | $('#est_og3').val(aboil_sg); | |
1957 | ||
1958 | // Estimate SG in kettle before boil | |
1959 | preboil_sg = estimate_sg(sugarsm, parseFloat(dataRecord.boil_size)); | |
1960 | $('#est_pre_sg').val(preboil_sg); | |
1961 | ||
1962 | // Recalculate volumes. | |
1963 | aboil_volume = parseFloat(dataRecord.batch_size); | |
1964 | if (dataRecord.brew_aboil_volume > 0) | |
1965 | aboil_volume = dataRecord.brew_aboil_volume / 1.04; // volume @ 20 degrees | |
1966 | if (dataRecord.brew_fermenter_tcloss == 0) { | |
1967 | dataRecord.brew_fermenter_tcloss = dataRecord.eq_trub_chiller_loss; | |
1968 | $('#brew_fermenter_tcloss').val(dataRecord.brew_fermenter_tcloss); | |
1969 | } | |
1970 | dataRecord.brew_fermenter_volume = aboil_volume - dataRecord.brew_fermenter_tcloss + dataRecord.brew_fermenter_extrawater; | |
1971 | $('#brew_fermenter_volume').val(dataRecord.brew_fermenter_volume); | |
1972 | // Estimated needed sparge water corrected for the temperature. | |
1973 | spoelw = (dataRecord.boil_size - mash_infuse + (mashkg * my_grain_absorbtion) + dataRecord.eq_lauter_deadspace) * 1.03; | |
1974 | $('#brew_sparge_est').val(spoelw); | |
1975 | // Calculate SG in fermenter | |
1976 | ogx = dataRecord.brew_aboil_sg; | |
1977 | if (ogx < 1.002) | |
1978 | ogx = aboil_sg; | |
1979 | topw = dataRecord.brew_fermenter_extrawater; | |
1980 | ||
1981 | if (dataRecord.brew_fermenter_volume > 0) { | |
1982 | sug = sg_to_plato(ogx) * dataRecord.brew_fermenter_volume * ogx / 100; //kg of sugar in | |
1983 | sug += addedS; //kg | |
1984 | ||
1985 | if ((dataRecord.brew_fermenter_volume * ogx + addedmass) > 0) { | |
1986 | pt = 100 * sug / (dataRecord.brew_fermenter_volume * ogx + addedmass + topw); | |
577
b4bfed3684d0
In production archive lists show always the OG from the brew fermenter SG. Possible fix for the not used og field in the database.
Michiel Broek <mbroek@mbse.eu>
parents:
564
diff
changeset
|
1987 | dataRecord.og = dataRecord.brew_fermenter_sg = Round(plato_to_sg(pt), 4); |
478 | 1988 | $('#brew_fermenter_sg').val(dataRecord.brew_fermenter_sg); |
1989 | // color | |
1990 | if (dataRecord.color_method == 4) { | |
1991 | dataRecord.brew_fermenter_color = Math.round(((pt / 8.6) * colorn) + (dataRecord.boil_time / 60)); | |
1992 | } else if (dataRecord.color_method == 3) { | |
1993 | dataRecord.brew_fermenter_color = Math.round((4.46 * bv * sr) / (aboil_volume + topw) * colorh); | |
1994 | } else { | |
1995 | cw = colort / (aboil_volume + topw) * 8.34436; | |
1996 | dataRecord.brew_fermenter_color = kw_to_ebc(dataRecord.color_method, cw); | |
1997 | } | |
1998 | $('#brew_fermenter_color').val(dataRecord.brew_fermenter_color); | |
1999 | scolor = ebc_to_color(dataRecord.brew_fermenter_color); | |
2000 | $('#bcolorf').show(); | |
2001 | document.getElementById('bcolorf').style.background = scolor; | |
2002 | } | |
2003 | } else { | |
2004 | // Negative volume | |
2005 | dataRecord.brew_fermenter_sg = dataRecord.brew_fermenter_color = 0; | |
2006 | $('#brew_fermenter_sg').val(0); | |
2007 | $('#brew_fermenter_color').val(0); | |
2008 | $('#bcolorf').hide(); | |
2009 | } | |
2010 | ||
2011 | // Color of the wort | |
2012 | if (dataRecord.color_method == 4) { | |
2013 | color = Math.round(((sg_to_plato(dataRecord.est_og) / 8.6) * colorn) + (dataRecord.boil_time / 60)); | |
2014 | } else if (dataRecord.color_method == 3) { // Hans Halberstadt | |
2015 | color = Math.round((4.46 * bv * sr) / parseFloat(dataRecord.batch_size) * colorh); | |
2016 | } else { | |
2017 | cw = colort / parseFloat(dataRecord.batch_size) * 8.34436; | |
2018 | color = kw_to_ebc(dataRecord.color_method, cw); | |
2019 | } | |
2020 | dataRecord.est_color = color; | |
2021 | $('#est_color').val(color); | |
2022 | $('#est_color2').val(color); | |
2023 | scolor = ebc_to_color(color); | |
2024 | document.getElementById('bcolor').style.background = scolor; | |
2025 | document.getElementById('bcolor2').style.background = scolor; | |
2026 | ||
2027 | // Progress bars | |
2028 | pmalts = mashkg / dataRecord.eq_mash_max * 100; | |
2029 | $('#perc_malts').jqxProgressBar('val', pmalts); | |
2030 | $('#perc_sugars').jqxProgressBar('val', psugar); | |
2031 | $('#perc_cara').jqxProgressBar('val', pcara); | |
2032 | calcStage(); | |
2033 | ||
2034 | // Calculate estimated svg. | |
2035 | svg = 0; // default. | |
2036 | initcells = 0; | |
2037 | rows = $('#yeastGrid').jqxGrid('getrows'); | |
2038 | for (i = 0; i < rows.length; i++) { | |
2039 | row = rows[i]; | |
2040 | if (row.y_use == 0) { // Primary | |
2041 | if (parseFloat(row.y_attenuation) > svg) | |
2042 | svg = parseFloat(row.y_attenuation); // Take the highest if multiple yeasts. | |
2043 | if (row.y_form == 0) | |
2044 | initcells += (parseFloat(row.y_cells) / 1000000000) * parseFloat(row.y_amount) * (dataRecord.starter_viability / 100); | |
2045 | else | |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
2046 | initcells += (parseFloat(row.y_cells) / 1000000) * parseFloat(row.y_amount) * (dataRecord.starter_viability / 100); |
478 | 2047 | } |
2048 | // TODO: brett in secondary ?? | |
2049 | if ((((dataRecord.inventory_reduced <= 3) && (row.y_use == 0)) || // Primary | |
2050 | ((dataRecord.inventory_reduced <= 4) && (row.y_use == 1)) || // Secondary | |
2051 | ((dataRecord.inventory_reduced <= 5) && (row.y_use == 2)) || // Tertiary | |
2052 | ((dataRecord.inventory_reduced <= 6) && (row.y_use == 3))) && // Bottle | |
2053 | (row.y_inventory < row.y_amount)) { | |
2054 | ok_yeasts = 0; | |
2055 | } | |
2056 | } | |
2057 | calcSupplies(); | |
2058 | if (svg == 0) | |
2059 | svg = 77; | |
2060 | ||
2061 | if ((mashkg > 0) && (mash_infuse > 0) && (mashtime > 0) && (mashtemp > 0)) { | |
2062 | dataRecord.est_fg = estimate_fg(psugar, pcara, mash_infuse / mashkg, mashtime, mashtemp, svg, dataRecord.est_og); | |
2063 | } else { | |
2064 | dataRecord.est_fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, dataRecord.est_og); | |
2065 | } | |
2066 | $('#est_fg').val(dataRecord.est_fg); | |
2067 | $('#est_fg2').val(dataRecord.est_fg); | |
2068 | $('#est_fg3').val(dataRecord.est_fg); | |
2069 | fig = dataRecord.est_fg; | |
2070 | ||
2071 | dataRecord.est_abv = abvol(dataRecord.est_og, dataRecord.est_fg); | |
2072 | $('#est_abv').val(dataRecord.est_abv); | |
2073 | $('#est_abv2').val(dataRecord.est_abv); | |
2074 | ||
2075 | // Calculate the final svg if available use the real value. | |
2076 | if ((dataRecord.stage >= 6) && (dataRecord.fg > 0.990) && (dataRecord.fg < dataRecord.brew_fermenter_sg)) { | |
655
f4e00869f39f
Calculate the svg using Brew by the Numbers, Micahel L. Hall.
Michiel Broek <mbroek@mbse.eu>
parents:
651
diff
changeset
|
2077 | svg = calc_svg(dataRecord.brew_fermenter_sg, dataRecord.fg); |
478 | 2078 | org = dataRecord.brew_fermenter_sg; |
2079 | fig = dataRecord.fg; | |
2080 | } | |
2081 | ||
2082 | $('#yeast_cells').val(initcells); | |
2083 | $('#need_cells').val(getNeededYeastCells()); | |
2084 | ||
2085 | // Calculate the calories in kcal/l (from brouwhulp) | |
2086 | alc = 1881.22 * fig * (org - fig) / (1.775 - org); | |
2087 | sug = 3550 * fig * (0.1808 * org + 0.8192 * fig - 1.0004); | |
2088 | $('#kcal').val(Math.round((alc + sug) / (12 * 0.0295735296))); | |
2089 | }; | |
2090 | ||
2091 | function calcMash() { | |
2092 | ||
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2093 | var h, m, infused = 0, mashtime = 0, mashvol = 0, vol, i, j, n, a, b, row, temp; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2094 | var lasttemp = 18.0; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2095 | var graintemp = 18.0; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2096 | var tuntemp = 18.0; |
484
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
2097 | |
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
2098 | if ((rows = $('#mashGrid').jqxGrid('getrows')) && (mashkg > 0)) { |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2099 | console.log('calcMash()'); |
484
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
2100 | for (i = 0; i < rows.length; i++) { |
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
2101 | row = $('#mashGrid').jqxGrid('getrowdata', i); |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2102 | if (row.step_type == 0) { // Infusion |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2103 | if (i == 0) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2104 | // First mash step, temperature from the mashtun and malt. |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2105 | n = 20; // tun is preheated. |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2106 | tuntemp = row.step_temp; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2107 | for (j = 0; j < n; j++) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2108 | a = mashkg * graintemp * SpecificHeatMalt + dataRecord.eq_tun_weight * tuntemp * dataRecord.eq_tun_specific_heat; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2109 | b = row.step_temp * (dataRecord.eq_tun_weight * dataRecord.eq_tun_specific_heat + row.step_infuse_amount * SpecificHeatWater + mashkg * SpecificHeatMalt) - SlakingHeat * mashkg; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2110 | if (row.step_infuse_amount > 0) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2111 | temp = (b - a) / (row.step_infuse_amount * SpecificHeatWater); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2112 | } else { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2113 | temp = 99; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2114 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2115 | tuntemp += (temp - tuntemp) / 2; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2116 | row.step_infuse_temp = Round(temp, 6); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2117 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2118 | console.log('init infuse temp: ' + row.step_infuse_temp); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2119 | } else { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2120 | // Calculate amount of infusion water. |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2121 | row.step_infuse_amount = infusionVol(infused, mashkg, row.step_infuse_temp, row.step_temp, lasttemp); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2122 | //console.log('vol: ' + row.step_infuse_amount + ' temp: ' + row.step_infuse_temp); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2123 | } |
484
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
2124 | infused += row.step_infuse_amount; |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2125 | } else if (row.step_type == 1) { // Temperature |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2126 | if (i > 0) |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2127 | row.step_infuse_amount = 0; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2128 | row.step_infuse_temp = 0; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2129 | } else if (row.step_type == 2) { // Decoction |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2130 | row.step_infuse_amount = decoctionVol(infused, row.step_temp, lasttemp); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2131 | row.step_infuse_temp = 99; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2132 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2133 | row.step_volume = infused; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2134 | //console.log(i + ' type: ' + row.step_type + ' volume: ' + row.step_infuse_amount + ' temp: ' + row.step_infuse_temp); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2135 | lasttemp = row.step_temp; |
484
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
2136 | mashtime += row.step_time + row.ramp_time; |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2137 | row.step_wg_ratio = Round(infused / mashkg, 6); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
2138 | $('#mashGrid').jqxGrid('updaterow', i, row); |
484
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
2139 | } |
478 | 2140 | } |
484
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
2141 | mashvol = mashkg * MaltVolume + infused; |
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
2142 | $('#est_mashvol').val(mashvol); |
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
2143 | h = Math.floor(mashtime / 60); |
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
2144 | m = Math.floor(mashtime - (h * 60)); |
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
2145 | if (h < 10) |
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
2146 | h = '0' + h; |
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
2147 | if (m < 10) |
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
2148 | m = '0' + m; |
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
2149 | $('#est_mashtime').val(h + ':' + m); |
478 | 2150 | } |
2151 | ||
2152 | /* | |
2153 | * Change OG of recipe but keep the water volumes. | |
2154 | */ | |
2155 | function calcFermentablesFromOG(OG) { | |
2156 | ||
2157 | console.log('calcFermentablesFromOG(' + OG + ')'); | |
2158 | var amount, row, d, i, sug, tot = 0, totmass = 0, rowscount, efficiency = parseFloat($('#efficiency').jqxNumberInput('decimal')); | |
2159 | sug = sg_to_plato(OG) * parseFloat($('#batch_size').jqxNumberInput('decimal')) * OG / 100; //total amount of sugars in kg | |
2160 | rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount; | |
2161 | ||
2162 | for (i = 0; i < rowscount; i++) { | |
2163 | row = $('#fermentableGrid').jqxGrid('getrowdata', i); | |
2164 | if (row.f_added < 4) { | |
2165 | d = row.f_percentage / 100 * (row.f_yield / 100) * (1 - row.f_moisture / 100); | |
2166 | if (row.f_added == 0) // Mash | |
2167 | d = efficiency / 100 * d; | |
2168 | tot += d; | |
2169 | } | |
2170 | } | |
2171 | if (tot) | |
2172 | totmass = Round(sug / tot, 3); | |
2173 | ||
2174 | if (totmass) { | |
2175 | for (i = 0; i < rowscount; i++) { | |
2176 | row = $('#fermentableGrid').jqxGrid('getrowdata', i); | |
2177 | if (row.f_added < 4) { | |
2178 | amount = Math.round(row.f_percentage * 10 * totmass) / 1000; | |
2179 | $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', amount); | |
2180 | } | |
2181 | } | |
2182 | } | |
2183 | }; | |
2184 | ||
2185 | function getNeededYeastCells() { | |
2186 | ||
2187 | var plato, volume, sg = dataRecord.brew_fermenter_sg; | |
2188 | if (sg <= 1.0001 && dataRecord.fg > 1.000) | |
2189 | sg = dataRecord.fg; | |
2190 | else if (sg <= 1.0001) | |
2191 | sg = dataRecord.est_og; | |
2192 | plato = sg_to_plato(sg); | |
2193 | ||
2194 | volume = dataRecord.brew_fermenter_volume; | |
2195 | if (volume <= 0) | |
2196 | volume = dataRecord.batch_size - dataRecord.eq_trub_chiller_loss; | |
2197 | ||
2198 | return pitchrate * volume * plato; | |
2199 | } | |
2200 | ||
2201 | function hopFlavourContribution(bt, vol, use, amount) { | |
2202 | var result; | |
2203 | ||
538
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2204 | if (use == 4 || use == 5) // Whirlpool or Dry-hop |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2205 | return 0; |
478 | 2206 | if (use == 1) { // First wort |
2207 | result = 0.15; // assume 15% flavourcontribution for fwh | |
2208 | } else if (bt > 50) { | |
2209 | result = 0.10; // assume 10% flavourcontribution as a minimum | |
2210 | } else { | |
2211 | result = 15.25 / (6 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 21) / 6, 2)); | |
2212 | if (result < 0.10) | |
2213 | result = 0.10; // assume 10% flavourcontribution as a minimum | |
2214 | } | |
2215 | return (result * amount * 1000) / vol; | |
2216 | } | |
2217 | ||
2218 | function hopAromaContribution(bt, vol, use, amount) { | |
2219 | var result = 0; | |
2220 | ||
538
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2221 | if (use == 5) { // Dry hop |
478 | 2222 | result = 1.33; |
538
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2223 | } else if (use == 4) { // Whirlpool |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2224 | if (bt > 30) |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2225 | bt = 30; // Max 30 minutes |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2226 | result = 0.62 * bt / 30; |
478 | 2227 | } else if (bt > 20) { |
2228 | result = 0; | |
2229 | } else if (bt > 7.5) { | |
2230 | result = 10.03 / (4 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 7.5) / 4, 2)); | |
2231 | } else if (use == 2) { // Boil | |
2232 | result = 1; | |
2233 | } else if (use == 3) { // Aroma | |
2234 | result = 1.2; | |
2235 | } | |
538
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2236 | return (result * amount * 1000) / vol; |
478 | 2237 | } |
2238 | ||
2239 | function calcIBUs() { | |
2240 | var total_ibus = 0, ferm_ibus = 0, rows = {}, i, row; | |
2241 | hop_aroma = hop_flavour = 0; | |
2242 | if (!(rows = $('#hopGrid').jqxGrid('getrows'))) { | |
2243 | return; | |
2244 | } | |
2245 | ok_hops = 1; | |
2246 | for (i = 0; i < rows.length; i++) { | |
2247 | row = rows[i]; | |
2248 | total_ibus += toIBU(row.h_useat, row.h_form, preboil_sg, parseFloat(dataRecord.batch_size), | |
559
10cc2400b5d5
Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents:
557
diff
changeset
|
2249 | parseFloat(row.h_amount), parseFloat(row.h_time), parseFloat(row.h_alpha), dataRecord.ibu_method, |
10cc2400b5d5
Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents:
557
diff
changeset
|
2250 | dataRecord.brew_whirlpool9, dataRecord.brew_whirlpool7, dataRecord.brew_whirlpool6); |
478 | 2251 | ferm_ibus += toIBU(row.h_useat, row.h_form, preboil_sg, |
559
10cc2400b5d5
Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents:
557
diff
changeset
|
2252 | parseFloat(dataRecord.brew_fermenter_volume) + parseFloat(dataRecord.brew_fermenter_tcloss), |
10cc2400b5d5
Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents:
557
diff
changeset
|
2253 | parseFloat(row.h_amount), parseFloat(row.h_time), parseFloat(row.h_alpha), dataRecord.ibu_method, |
10cc2400b5d5
Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents:
557
diff
changeset
|
2254 | dataRecord.brew_whirlpool9, dataRecord.brew_whirlpool7, dataRecord.brew_whirlpool6); |
10cc2400b5d5
Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents:
557
diff
changeset
|
2255 | hop_flavour += hopFlavourContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size), row.h_useat, parseFloat(row.h_amount)); |
10cc2400b5d5
Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents:
557
diff
changeset
|
2256 | hop_aroma += hopAromaContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size), row.h_useat, parseFloat(row.h_amount)); |
478 | 2257 | if ((((dataRecord.inventory_reduced <= 2) && (row.h_useat <= 4)) || // Mash, FW, Boil, Aroma, Whirlpool |
2258 | ((dataRecord.inventory_reduced <= 6) && (row.h_useat == 5))) && // Dry-hop | |
2259 | (row.h_inventory < row.h_amount)) | |
2260 | ok_hops = 0; | |
2261 | } | |
557 | 2262 | total_ibus = Round(total_ibus, 1); |
2263 | ferm_ibus = Round(ferm_ibus, 1); | |
2264 | hop_flavour = Round(hop_flavour * 100 / 5, 1); | |
2265 | hop_aroma = Round(hop_aroma * 100 / 6, 1); | |
478 | 2266 | if (hop_flavour > 100) |
2267 | hop_flavour = 100; | |
2268 | if (hop_aroma > 100) | |
2269 | hop_aroma = 100; | |
2270 | console.log('calcIBUs(): ' + total_ibus + ' flavour: ' + hop_flavour + ' aroma: ' + hop_aroma + | |
2271 | ' fermenter:' + ferm_ibus + ' supplies:' + ok_hops); | |
2272 | dataRecord.est_ibu = total_ibus; | |
2273 | $('#est_ibu').val(total_ibus); | |
2274 | $('#est_ibu2').val(total_ibus); | |
2275 | $('#hop_flavour').jqxProgressBar('val', hop_flavour); | |
2276 | $('#hop_aroma').jqxProgressBar('val', hop_aroma); | |
2277 | $('#brew_fermenter_ibu').val(ferm_ibus); | |
2278 | calcStage(); | |
2279 | calcSupplies(); | |
2280 | }; | |
2281 | ||
2282 | /* | |
2283 | * http://braukaiser.com/blog/blog/2012/11/03/estimating-yeast-growth/ | |
2284 | * | |
2285 | * stype: 0=stirred, 1=shaken, 2=simple | |
2286 | * totcells: initial cells | |
2287 | * egrams: gram extract | |
2288 | */ | |
2289 | function getGrowthRate(stype, totcells, egrams) { | |
2290 | ||
2291 | /* Cells per grams extract (B/g) */ | |
2292 | var cpe = totcells / egrams; | |
2293 | ||
2294 | if (cpe > 3.5) | |
2295 | return 0; // no growth | |
2296 | if (stype == 2) | |
2297 | return 0.4; // simple starter | |
2298 | if (stype == 1) | |
2299 | return 0.62; // shaken starter | |
2300 | if (cpe <= 1.4) // stirred starter | |
2301 | return 1.4; | |
2302 | return 2.33 - (.67 * cpe); | |
2303 | }; | |
2304 | ||
2305 | function calcStep(svol, stype, start) { | |
2306 | ||
2307 | var gperpoint = 2.72715, //number of grams of extract per point of starter gravity per liter | |
2308 | prate = start / svol * 1000, | |
2309 | irate = Round(prate, 1), | |
2310 | egrams = (dataRecord.starter_sg - 1) * svol * gperpoint, | |
2311 | grate = getGrowthRate(stype, start, egrams), | |
2312 | ncells = Round(egrams * grate, 1), | |
2313 | totcells = parseFloat(ncells) + start; | |
2314 | ||
2315 | return { | |
2316 | svol: svol, | |
2317 | irate: irate, | |
2318 | prate: Round(prate, 1), | |
2319 | ncells: ncells, | |
2320 | totcells: totcells, | |
2321 | growf: Round(ncells / start, 2) | |
2322 | }; | |
2323 | } | |
2324 | ||
649
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2325 | function killstep2() { |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2326 | |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2327 | dataRecord.prop2_volume = 0; |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2328 | $('#prop2_volume').val(0); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2329 | $('#prop2_tcells').val(0); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2330 | $('#prop2_type,#prop2_volume,#prop2_irate,#prop2_ncells,#prop2_tcells,#prop2_growf').hide(); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2331 | $('#r2_pmpt').show(); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2332 | } |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2333 | |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2334 | function killstep3() { |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2335 | |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2336 | dataRecord.prop3_volume = 0; |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2337 | $('#prop3_volume').val(0); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2338 | $('#prop3_tcells').val(0); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2339 | $('#prop3_type,#prop3_volume,#prop3_irate,#prop3_ncells,#prop3_tcells,#prop3_growf').hide(); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2340 | $('#r3_pmpt').show(); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2341 | } |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2342 | |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2343 | function killstep4() { |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2344 | |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2345 | dataRecord.prop4_volume = 0; |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2346 | $('#prop4_volume').val(0); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2347 | $('#prop4_tcells').val(0); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2348 | $('#prop4_type,#prop4_volume,#prop4_irate,#prop4_ncells,#prop4_tcells,#prop4_growf').hide(); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2349 | $('#r4_pmpt').show(); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2350 | } |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2351 | |
478 | 2352 | /* |
2353 | * Calculate all starter steps. | |
2354 | * stype: final starter type: 0 = stirred, 1 = shaked, 2 = simple. | |
2355 | * start: initial cells in billions | |
2356 | * needed: needed cells in billions | |
2357 | * | |
2358 | * result: all values updated. | |
2359 | */ | |
2360 | function calcSteps(stype, start, needed) { | |
2361 | ||
2362 | var uvols = [20, 40, 60, 80, 100, 150, 200, 250, 375, 500, 625, 750, 875, 1000, 1250, 1500, 2000, 2500, 3000, 4000, 5000], | |
2363 | mvols = uvols.length, svol = 0, lasti = 0, result = {}, i; | |
2364 | ||
2365 | /* | |
2366 | * If no values are set, auto calculate the starter. | |
2367 | */ | |
2368 | if ((parseFloat($('#prop1_volume').jqxNumberInput('decimal')) + parseFloat($('#prop2_volume').jqxNumberInput('decimal')) + | |
2369 | parseFloat($('#prop3_volume').jqxNumberInput('decimal')) + parseFloat($('#prop4_volume').jqxNumberInput('decimal'))) == 0) { | |
2370 | // clear by default | |
2371 | for (i = 1; i < 5; i++) { | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
2372 | $('#prop' + i + '_type,#prop' + i + '_volume,#prop' + i + '_irate,#prop' + i + '_ncells,#prop' + i + '_tcells,#prop' + i + '_growf').hide(); |
478 | 2373 | $('#r' + i + '_pmpt').show(); |
2374 | $('#prop' + i + '_type').val(stype); | |
2375 | $('#prop' + i + '_volume').val(0); | |
2376 | } | |
2377 | if (start > needed) { | |
2378 | return; // no starter needed | |
2379 | } | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
2380 | $('#prop1_type,#prop1_volume,#prop1_irate,#prop1_ncells,#prop1_tcells,#prop1_growf').show(); |
478 | 2381 | $('#r1_pmpt').hide(); |
2382 | for (i = lasti; i <= mvols; i++) { | |
2383 | lasti = i; | |
2384 | svol = uvols[lasti]; | |
2385 | result = calcStep(svol, stype, start); | |
2386 | if (result.irate < 25) { | |
2387 | // inocculation rate too low, backup one step and break out. | |
2388 | lasti = i - 1; | |
2389 | svol = uvols[lasti]; | |
2390 | result = calcStep(svol, stype, start); | |
2391 | break; | |
2392 | } | |
2393 | if (result.totcells > needed || i == mvols) { // hit the target or loops done | |
2394 | break; | |
2395 | } | |
2396 | } | |
2397 | $('#prop1_volume').val(result.svol / 1000); // to liters | |
2398 | $('#prop1_irate').val(result.prate); | |
2399 | $('#prop1_ncells').val(result.ncells); | |
2400 | $('#prop1_tcells').val(result.totcells); | |
2401 | $('#prop1_growf').val(result.growf); | |
2402 | if (result.totcells > needed) | |
2403 | return; // hit the target | |
2404 | ||
2405 | // second stage | |
2406 | $('#r2_pmpt').hide(); | |
2407 | $('#prop2_type').val(stype); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
2408 | $('#prop2_type,#prop2_volume,#prop2_irate,#prop2_ncells,#prop2_tcells,#prop2_growf').show(); |
478 | 2409 | for (i = lasti; i <= mvols; i++) { |
2410 | lasti = i; | |
2411 | svol = uvols[lasti]; | |
2412 | result = calcStep(svol, stype, $('#prop1_tcells').val()); | |
2413 | if (result.irate < 25) { | |
2414 | lasti = i - 1; | |
2415 | svol = uvols[lasti]; | |
2416 | result = calcStep(svol, stype, $('#prop1_tcells').val()); | |
2417 | break; | |
2418 | } | |
2419 | if (result.totcells > needed || i == mvols) { // hit the target or loops done | |
2420 | break; | |
2421 | } | |
2422 | } | |
2423 | $('#prop2_volume').val(result.svol / 1000); // to liters | |
2424 | $('#prop2_irate').val(result.prate); | |
2425 | $('#prop2_ncells').val(result.ncells); | |
2426 | $('#prop2_tcells').val(result.totcells); | |
2427 | $('#prop2_growf').val(result.growf); | |
2428 | if (result.totcells > needed) | |
2429 | return; // hit the target | |
2430 | ||
2431 | // third stage | |
2432 | $('#r3_pmpt').hide(); | |
2433 | $('#prop3_type').val(stype); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
2434 | $('#prop3_type,#prop3_volume,#prop3_irate,#prop3_ncells,#prop3_tcells,#prop3_growf').show(); |
478 | 2435 | for (i = lasti; i <= mvols; i++) { |
2436 | lasti = i; | |
2437 | svol = uvols[lasti]; | |
2438 | result = calcStep(svol, stype, $('#prop2_tcells').val()); | |
2439 | if (result.irate < 25) { | |
2440 | lasti = i - 1; | |
2441 | svol = uvols[lasti]; | |
2442 | result = calcStep(svol, stype, $('#prop2_tcells').val()); | |
2443 | break; | |
2444 | } | |
2445 | if (result.totcells > needed || i == mvols) { // hit the target or loops done | |
2446 | break; | |
2447 | } | |
2448 | } | |
2449 | $('#prop3_volume').val(result.svol / 1000); // to liters | |
2450 | $('#prop3_irate').val(result.prate); | |
2451 | $('#prop3_ncells').val(result.ncells); | |
2452 | $('#prop3_tcells').val(result.totcells); | |
2453 | $('#prop3_growf').val(result.growf); | |
2454 | if (result.totcells > needed) | |
2455 | return; // hit the target | |
2456 | ||
2457 | // fourth stage | |
2458 | $('#r4_pmpt').hide(); | |
2459 | $('#prop4_type').val(stype); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
2460 | $('#prop4_type,#prop4_volume,#prop4_irate,#prop4_ncells,#prop4_tcells,#prop4_growf').show(); |
478 | 2461 | for (i = lasti; i <= mvols; i++) { |
2462 | lasti = i; | |
2463 | svol = uvols[lasti]; | |
2464 | result = calcStep(svol, stype, $('#prop3_tcells').val()); | |
2465 | if (result.totcells > needed || i == mvols) { // hit the target or loops done | |
2466 | $('#prop4_volume').val(result.svol / 1000); // to liters | |
2467 | $('#prop4_irate').val(result.prate); | |
2468 | $('#prop4_ncells').val(result.ncells); | |
2469 | $('#prop4_tcells').val(result.totcells); | |
2470 | $('#prop4_growf').val(result.growf); | |
2471 | return; | |
2472 | } | |
2473 | } | |
2474 | } else { | |
2475 | // recalculate | |
2476 | if (dataRecord.prop1_volume > 0) { | |
2477 | $('#r1_pmpt').hide(); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
2478 | $('#prop1_type,#prop1_volume,#prop1_irate,#prop1_ncells,#prop1_tcells,#prop1_growf').show(); |
478 | 2479 | result = calcStep($('#prop1_volume').val() * 1000, dataRecord.prop1_type, start); |
2480 | $('#prop1_irate').val(result.prate); | |
2481 | $('#prop1_ncells').val(result.ncells); | |
2482 | $('#prop1_tcells').val(result.totcells); | |
2483 | $('#prop1_growf').val(result.growf); | |
649
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2484 | if (result.totcells > needed) { |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2485 | killstep2(); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2486 | killstep3(); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2487 | killstep4(); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2488 | } else if (dataRecord.prop2_volume == 0) { |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2489 | dataRecord.prop2_volume = dataRecord.prop1_volume; /* Extra step needed, start with the same size */ |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2490 | dataRecord.prop2_type = dataRecord.prop1_type; |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2491 | $('#prop2_volume').val(dataRecord.prop2_volume); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2492 | $('#prop2_type').val(dataRecord.prop2_type); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2493 | } |
478 | 2494 | } |
2495 | if (dataRecord.prop2_volume > 0) { | |
2496 | $('#r2_pmpt').hide(); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
2497 | $('#prop2_type,#prop2_volume,#prop2_irate,#prop2_ncells,#prop2_tcells,#prop2_growf').show(); |
478 | 2498 | result = calcStep($('#prop2_volume').val() * 1000, dataRecord.prop2_type, $('#prop1_tcells').val()); |
2499 | $('#prop2_irate').val(result.prate); | |
2500 | $('#prop2_ncells').val(result.ncells); | |
2501 | $('#prop2_tcells').val(result.totcells); | |
2502 | $('#prop2_growf').val(result.growf); | |
649
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2503 | if (result.totcells > needed) { |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2504 | killstep3(); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2505 | killstep4(); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2506 | } else if (dataRecord.prop3_volume == 0) { |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2507 | dataRecord.prop3_volume = dataRecord.prop2_volume; /* Extra step needed, start with the same size */ |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2508 | dataRecord.prop3_type = dataRecord.prop2_type; |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2509 | $('#prop3_volume').val(dataRecord.prop3_volume); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2510 | $('#prop3_type').val(dataRecord.prop3_type); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2511 | } |
478 | 2512 | } |
2513 | if (dataRecord.prop3_volume > 0) { | |
2514 | $('#r3_pmpt').hide(); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
2515 | $('#prop3_type,#prop3_volume,#prop3_irate,#prop3_ncells,#prop3_tcells,#prop3_growf').show(); |
478 | 2516 | result = calcStep($('#prop3_volume').val() * 1000, dataRecord.prop3_type, $('#prop2_tcells').val()); |
2517 | $('#prop3_irate').val(result.prate); | |
2518 | $('#prop3_ncells').val(result.ncells); | |
2519 | $('#prop3_tcells').val(result.totcells); | |
2520 | $('#prop3_growf').val(result.growf); | |
649
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2521 | if (result.totcells > needed) { |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2522 | killstep4(); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2523 | } else if (dataRecord.prop4_volume == 0) { |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2524 | dataRecord.prop4_volume = dataRecord.prop3_volume; /* Extra step needed, start with the same size */ |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2525 | dataRecord.prop4_type = dataRecord.prop3_type; |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2526 | $('#prop4_volume').val(dataRecord.prop4_volume); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2527 | $('#prop4_type').val(dataRecord.prop4_type); |
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
2528 | } |
478 | 2529 | } |
2530 | if (dataRecord.prop4_volume > 0) { | |
2531 | $('#r4_pmpt').hide(); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
2532 | $('#prop4_type,#prop4_volume,#prop4_irate,#prop4_ncells,#prop4_tcells,#prop4_growf').show(); |
478 | 2533 | result = calcStep($('#prop4_volume').val() * 1000, dataRecord.prop4_type, $('#prop3_tcells').val()); |
2534 | $('#prop4_irate').val(result.prate); | |
2535 | $('#prop4_ncells').val(result.ncells); | |
2536 | $('#prop4_tcells').val(result.totcells); | |
2537 | $('#prop4_growf').val(result.growf); | |
2538 | } | |
2539 | } | |
2540 | } | |
2541 | ||
2542 | function calcYeast() { | |
2543 | ||
2544 | // Calculate needed cells. | |
2545 | var plato, volume, rows, rowscount, row, i, needed, use_cells, sg = dataRecord.brew_fermenter_sg; | |
2546 | if (sg <= 1.0001 && dataRecord.fg > 1.000) | |
2547 | sg = dataRecord.fg; | |
2548 | else if (sg <= 1.0001) | |
2549 | sg = dataRecord.est_og; | |
2550 | plato = sg_to_plato(sg); | |
2551 | ||
2552 | volume = dataRecord.brew_fermenter_volume; | |
2553 | if (volume > 0) { | |
2554 | if (dataRecord.brew_fermenter_extrawater > 0) | |
2555 | volume += dataRecord.brew_fermenter_extrawater; | |
2556 | } else { | |
2557 | volume = dataRecord.batch_size - dataRecord.eq_trub_chiller_loss; | |
2558 | } | |
2559 | ||
2560 | // Also in calcFermentables() | |
2561 | $('#yeast_cells').val(initcells); | |
2562 | ||
2563 | if (!(rows = $('#yeastGrid').jqxGrid('getrows'))) { | |
2564 | return; // grid not yet loaded. | |
2565 | } | |
2566 | rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount; | |
2567 | if (rowscount == 0) | |
2568 | return; // no yeast in recipe | |
2569 | ||
620
5dae36a2d5be
Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents:
619
diff
changeset
|
2570 | var maybe_starter = 0; |
478 | 2571 | for (i = 0; i < rowscount; i++) { |
2572 | row = $('#yeastGrid').jqxGrid('getrowdata', i); | |
2573 | if (row.y_use == 0) { // primary | |
2574 | // pitchrate see https://www.brewersfriend.com/yeast-pitch-rate-and-starter-calculator/ | |
2575 | // and http://braukaiser.com/blog/blog/2012/11/03/estimating-yeast-growth/ | |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
2576 | if (row.y_type == 0) { // lager yeast |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
2577 | pitchrate = 1.5; |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
2578 | if (dataRecord.est_og > 1.060) |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
2579 | pitchrate = 2.0; |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
2580 | } else if (row.y_type == 6) { // Kveik |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
2581 | pitchrate = 0.075; |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
2582 | } else { |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
2583 | pitchrate = 0.75; |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
2584 | if (dataRecord.est_og > 1.060) |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
2585 | pitchrate = 1.0; |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
2586 | } |
620
5dae36a2d5be
Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents:
619
diff
changeset
|
2587 | |
5dae36a2d5be
Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents:
619
diff
changeset
|
2588 | if (row.y_form != 1) { // Not dry yeast |
5dae36a2d5be
Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents:
619
diff
changeset
|
2589 | maybe_starter = 1; |
5dae36a2d5be
Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents:
619
diff
changeset
|
2590 | } |
478 | 2591 | } |
2592 | } | |
620
5dae36a2d5be
Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents:
619
diff
changeset
|
2593 | |
495
fdbb6bfae569
Disabled some console.log items.
Michiel Broek <mbroek@mbse.eu>
parents:
490
diff
changeset
|
2594 | needed = Round(pitchrate * volume * plato, 1); |
478 | 2595 | $('#need_cells').val(needed); |
2596 | use_cells = initcells; | |
620
5dae36a2d5be
Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents:
619
diff
changeset
|
2597 | if (needed <= initcells) |
5dae36a2d5be
Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents:
619
diff
changeset
|
2598 | maybe_starter = 0; |
5dae36a2d5be
Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents:
619
diff
changeset
|
2599 | console.log('calcYeast() pitchrate:' + pitchrate + ' start:' + initcells + ' needed:' + needed + ' volume:' + volume + ' maybe_starter:' + maybe_starter); |
5dae36a2d5be
Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents:
619
diff
changeset
|
2600 | |
5dae36a2d5be
Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents:
619
diff
changeset
|
2601 | if (maybe_starter != dataRecord.starter_enable) { |
5dae36a2d5be
Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents:
619
diff
changeset
|
2602 | dataRecord.starter_enable = maybe_starter; |
642
9d1af81b20ef
Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
641
diff
changeset
|
2603 | showStarter(); |
620
5dae36a2d5be
Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents:
619
diff
changeset
|
2604 | } |
478 | 2605 | |
2606 | if (dataRecord.starter_enable) { | |
2607 | calcSteps(dataRecord.starter_type, initcells, needed); | |
2608 | ||
2609 | for (i = 1; i < 5; i++) { | |
2610 | $('#r' + i + '_irate').html(''); | |
2611 | $('#r' + i + '_growf').html(''); | |
2612 | $('#r' + i + '_tcells').html(''); | |
2613 | if (parseFloat($('#prop' + i + '_volume').val()) > 0) { | |
2614 | if ((parseFloat($('#prop' + i + '_irate').val()) < 25) || (parseFloat($('#prop' + i + '_irate').val()) > 100)) { | |
2615 | $('#r' + i + '_irate').html("<img src='images/dialog-error.png'>"); | |
2616 | } else { | |
2617 | $('#r' + i + '_irate').html("<img src='images/dialog-ok-apply.png'>"); | |
2618 | } | |
2619 | if (parseFloat($('#prop' + i + '_growf').val()) < 1) | |
2620 | $('#r' + i + '_growf').html("<img src='images/dialog-error.png'>"); | |
2621 | if (($('#prop' + i + '_type').val() > 0) && (parseFloat($('#prop' + i + '_growf').val()) > 3)) | |
2622 | $('#r' + i + '_growf').html("<img src='images/dialog-error.png'>"); | |
2623 | if (parseFloat($('#prop' + i + '_tcells').val()) > needed) | |
2624 | $('#r' + i + '_tcells').html("<img src='images/dialog-ok-apply.png'>"); | |
2625 | use_cells = parseFloat($('#prop' + i + '_tcells').val()); | |
2626 | } else { | |
2627 | $('#r' + i + '_irate').html(''); | |
2628 | } | |
2629 | } | |
2630 | } | |
2631 | $('#plato_cells').val(parseFloat(use_cells / (volume * plato))); | |
2632 | }; | |
2633 | ||
2634 | function adjustHops(factor) { | |
2635 | ||
2636 | console.log('adjustHops(' + factor + ')'); | |
2637 | var row, i, amount, rowscount = $('#hopGrid').jqxGrid('getdatainformation').rowscount; | |
2638 | if (rowscount == 0) | |
2639 | return; | |
2640 | for (i = 0; i < rowscount; i++) { | |
2641 | row = $('#hopGrid').jqxGrid('getrowdata', i); | |
2642 | amount = row.h_amount * factor; | |
2643 | $('#hopGrid').jqxGrid('setcellvalue', i, 'h_amount', amount); | |
2644 | } | |
2645 | }; | |
2646 | ||
538
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2647 | function whirlpoolHops() { |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2648 | var row, i, time, rowscount; |
539
fe9ac6d49c4f
Printed outputs have IBUs for whirlpool hops. Removed some debug console logs.
Michiel Broek <mbroek@mbse.eu>
parents:
538
diff
changeset
|
2649 | if (!(rowscount = $('#hopGrid').jqxGrid('getdatainformation').rowscount)) |
538
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2650 | return; |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2651 | if (rowscount == 0) |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2652 | return; |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2653 | for (i = 0; i < rowscount; i++) { |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2654 | row = $('#hopGrid').jqxGrid('getrowdata', i); |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2655 | if (row.h_useat == 4) { |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2656 | time = parseFloat(dataRecord.brew_whirlpool9) + parseFloat(dataRecord.brew_whirlpool7) + parseFloat(dataRecord.brew_whirlpool6); |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2657 | $('#hopGrid').jqxGrid('setcellvalue', i, 'h_time', time); |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2658 | } |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2659 | } |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2660 | }; |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
2661 | |
478 | 2662 | function calcMiscs() { |
2663 | ||
2664 | ok_miscs = 1; | |
2665 | var row, i, rowscount = $('#miscGrid').jqxGrid('getdatainformation').rowscount; | |
2666 | if (rowscount == 0) | |
2667 | return; | |
2668 | for (i = 0; i < rowscount; i++) { | |
2669 | row = $('#miscGrid').jqxGrid('getrowdata', i); | |
2670 | if ((((dataRecord.inventory_reduced <= 2) && (row.m_use_use <= 2)) || // Starter, Mash, Boil | |
2671 | ((dataRecord.inventory_reduced <= 3) && (row.m_use_use == 3)) || // Primary | |
2672 | ((dataRecord.inventory_reduced <= 5) && (row.m_use_use == 4)) || // Secondary, Teriary | |
2673 | ((dataRecord.inventory_reduced <= 6) && (row.m_use_use == 5))) && // Bottle | |
2674 | (row.m_inventory < row.m_amount)) { | |
2675 | ok_miscs = 0; | |
2676 | } | |
2677 | } | |
2678 | calcSupplies(); | |
2679 | }; | |
2680 | ||
2681 | function adjustMiscs(factor) { | |
2682 | ||
2683 | console.log('adjustMiscs(' + factor + ')'); | |
2684 | var row, i, amount, rowscount = $('#miscGrid').jqxGrid('getdatainformation').rowscount; | |
2685 | if (rowscount == 0) | |
2686 | return; | |
2687 | for (i = 0; i < rowscount; i++) { | |
2688 | row = $('#miscGrid').jqxGrid('getrowdata', i); | |
2689 | amount = row.m_amount * factor; | |
2690 | $('#miscGrid').jqxGrid('setcellvalue', i, 'm_amount', amount); | |
2691 | switch (row.m_name) { | |
2692 | case 'CaCl2': | |
2693 | $('#wa_cacl2').val(row.m_amount * 1000); | |
2694 | break; | |
2695 | case 'CaSO4': | |
2696 | $('#wa_caso4').val(row.m_amount * 1000); | |
2697 | break; | |
2698 | case 'MgSO4': | |
2699 | $('#wa_mgso4').val(row.m_amount * 1000); | |
2700 | break; | |
2701 | case 'NaCl': | |
2702 | $('#wa_nacl').val(row.m_amount * 1000); | |
2703 | break; | |
2704 | case 'Melkzuur': | |
2705 | case 'Zoutzuur': | |
2706 | case 'Fosforzuur': | |
2707 | case 'Zwavelzuur': | |
2708 | $('#wa_acid').val(row.m_amount * 1000); | |
2709 | break; | |
2710 | case 'NaHCO3': | |
2711 | case 'Na2CO3': | |
2712 | case 'CaCO3': | |
2713 | case 'Ca(OH)2': | |
2714 | $('#wa_base').val(row.m_amount * 1000); | |
2715 | break; | |
2716 | } | |
2717 | } | |
2718 | }; | |
2719 | ||
2720 | function adjustYeasts(factor) { | |
2721 | ||
2722 | console.log('adjustYeasts(' + factor + ')'); | |
2723 | var row, i, amount, rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount; | |
2724 | if (rowscount == 0) | |
2725 | return; | |
2726 | for (i = 0; i < rowscount; i++) { | |
2727 | row = $('#yeastGrid').jqxGrid('getrowdata', i); | |
515
9d771385a8a0
Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.
Michiel Broek <mbroek@mbse.eu>
parents:
500
diff
changeset
|
2728 | if (! dataRecord.starter_enable) { // Only adjust without a starter |
478 | 2729 | amount = row.y_amount * factor; |
2730 | $('#yeastGrid').jqxGrid('setcellvalue', i, 'y_amount', amount); | |
2731 | } | |
2732 | } | |
2733 | calcYeast(); | |
2734 | }; | |
2735 | ||
2736 | function adjustWaters(factor) { | |
2737 | ||
2738 | console.log('adjustWaters(' + factor + ')'); | |
2739 | var amount, row, i, rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount; | |
2740 | if (rowscount == 0) | |
2741 | return; | |
2742 | mash_infuse = 0; | |
2743 | for (i = 0; i < rowscount; i++) { | |
2744 | row = $('#mashGrid').jqxGrid('getrowdata', i); | |
2745 | if (row.step_type == 0) { // Infusion | |
612
576128de01e3
Fixed mash infuse amount division
Michiel Broek <mbroek@mbse.eu>
parents:
610
diff
changeset
|
2746 | amount = Round(parseFloat(row.step_infuse_amount) * factor, 1); |
478 | 2747 | $('#mashGrid').jqxGrid('setcellvalue', i, 'step_infuse_amount', amount); |
2748 | mash_infuse += amount; | |
2749 | } | |
2750 | } | |
2751 | if (dataRecord.w2_amount == 0) { | |
2752 | dataRecord.w1_amount = mash_infuse; | |
2753 | $('#w1_amount').val(mash_infuse); | |
2754 | } else { | |
612
576128de01e3
Fixed mash infuse amount division
Michiel Broek <mbroek@mbse.eu>
parents:
610
diff
changeset
|
2755 | var w1_amount = (dataRecord.w1_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse; |
576128de01e3
Fixed mash infuse amount division
Michiel Broek <mbroek@mbse.eu>
parents:
610
diff
changeset
|
2756 | var w2_amount = (dataRecord.w2_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse; |
576128de01e3
Fixed mash infuse amount division
Michiel Broek <mbroek@mbse.eu>
parents:
610
diff
changeset
|
2757 | dataRecord.w1_amount = Round(w1_amount, 3); |
576128de01e3
Fixed mash infuse amount division
Michiel Broek <mbroek@mbse.eu>
parents:
610
diff
changeset
|
2758 | dataRecord.w2_amount = Round(w2_amount, 3); |
478 | 2759 | $('#w1_amount').val(dataRecord.w1_amount); |
2760 | $('#w2_amount').val(dataRecord.w2_amount); | |
2761 | } | |
2762 | $('#wg_amount').val(mash_infuse); | |
2763 | }; | |
2764 | ||
2765 | function calcMashEfficiency() { | |
2766 | var c, m; | |
2767 | if (parseFloat($('#brew_mash_sg').jqxNumberInput('decimal')) < 1.002) | |
2768 | return; | |
2769 | c = sg_to_plato(est_mash_sg); | |
2770 | m = sg_to_plato(parseFloat($('#brew_mash_sg').jqxNumberInput('decimal'))); | |
2771 | if (c > 0.5) | |
2772 | $('#brew_mash_efficiency').val(100 * m / c); | |
2773 | else | |
2774 | $('#brew_mash_efficiency').val(0); | |
2775 | }; | |
2776 | ||
2777 | function calcEfficiencyBeforeBoil() { | |
2778 | var m = 0, rows = {}, i, row, tot, result = 0; | |
2779 | if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) { | |
2780 | return; // grid not yet loaded. | |
2781 | } | |
2782 | for (i = 0; i < rows.length; i++) { | |
2783 | row = rows[i]; | |
2784 | if (row.f_added == 0) { // Mash | |
2785 | m += row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100); | |
2786 | } | |
2787 | } | |
2788 | tot = sg_to_plato(dataRecord.brew_preboil_sg) * (dataRecord.brew_preboil_volume / 1.04) * dataRecord.brew_preboil_sg * 10 / 1000; | |
2789 | if (m > 0) | |
2790 | result = Round((tot / m * 100), 1); | |
2791 | if (result < 0) | |
2792 | result = 0; | |
2793 | $('#brew_preboil_efficiency').val(result); | |
2794 | } | |
2795 | ||
2796 | function calcEfficiencyAfterBoil() { | |
2797 | var m = 0, // Sugars added at mash | |
2798 | b = 0, // Sugars added at boil | |
2799 | rows = {}, i, row, tot, result = 0; | |
2800 | if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) { | |
2801 | return; // grid not yet loaded. | |
2802 | } | |
2803 | for (i = 0; i < rows.length; i++) { | |
2804 | row = rows[i]; | |
2805 | if (row.f_added == 0) { // Mash | |
2806 | m += row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100); | |
2807 | } else if (row.f_added == 1) { // Boil | |
2808 | b += row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100); | |
2809 | } | |
2810 | } | |
2811 | tot = sg_to_plato(dataRecord.brew_aboil_sg) * (dataRecord.brew_aboil_volume / 1.04) * dataRecord.brew_aboil_sg * 10 / 1000; | |
2812 | tot -= b; // total sugars in wort minus added sugars. | |
2813 | if (m > 0) | |
2814 | result = Round((tot / m * 100), 1); | |
2815 | if (result < 0) | |
2816 | result = 0; | |
2817 | dataRecord.brew_aboil_efficiency = result; | |
2818 | $('#brew_aboil_efficiency').val(result); | |
2819 | } | |
2820 | ||
2821 | function GetBUGU() { | |
2822 | var gu = (dataRecord.est_og - 1) * 1000; | |
2823 | if (gu > 0) | |
2824 | return dataRecord.est_ibu / gu; | |
2825 | else | |
2826 | return 0.5; | |
2827 | } | |
2828 | ||
552
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
2829 | function GetOptSO4Clratio() { |
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
2830 | if (parseFloat($('#pr_sulfate').jqxNumberInput('decimal')) > 0 && parseFloat($('#pr_chloride').jqxNumberInput('decimal'))) { |
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
2831 | return (parseFloat($('#pr_sulfate').jqxNumberInput('decimal')) / parseFloat($('#pr_chloride').jqxNumberInput('decimal'))); |
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
2832 | } else { |
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
2833 | var BUGU = GetBUGU(); |
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
2834 | return (1.0 / (-1.2 * BUGU + 1.4)); |
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
2835 | } |
478 | 2836 | } |
2837 | ||
2838 | function setWaterAgent(name, amount) { | |
2839 | var row, i, id, found = false, miscs, rows = $('#miscGrid').jqxGrid('getrows'); | |
2840 | if (amount == 0) { | |
2841 | for (i = 0; i < rows.length; i++) { | |
2842 | row = rows[i]; | |
2843 | if (row.m_name == name) { | |
2844 | id = $('#miscGrid').jqxGrid('getrowid', i); | |
2845 | $('#miscGrid').jqxGrid('deleterow', id); | |
2846 | } | |
2847 | } | |
2848 | } else { | |
2849 | for (i = 0; i < rows.length; i++) { | |
2850 | row = rows[i]; | |
2851 | if (row.m_name == name) { | |
2852 | found = true; | |
2853 | $('#miscGrid').jqxGrid('setcellvalue', i, 'm_amount', amount / 1000); | |
2854 | break; | |
2855 | } | |
2856 | } | |
2857 | if (! found) { | |
2858 | miscs = new $.jqx.dataAdapter(miscInvSource, { | |
2859 | loadComplete: function() { | |
2860 | var record, i, row = {}, records = miscs.records; | |
2861 | for (i = 0; i < records.length; i++) { | |
2862 | record = records[i]; | |
2863 | if (record.name == name) { | |
2864 | row['m_name'] = record.name; | |
2865 | row['m_amount'] = amount / 1000; | |
2866 | row['m_cost'] = record.cost; | |
2867 | row['m_type'] = record.type; | |
2868 | row['m_use_use'] = record.use_use; | |
2869 | row['m_time'] = 0; | |
2870 | row['m_amount_is_weight'] = record.amount_is_weight; | |
2871 | row['m_inventory'] = record.inventory; | |
2872 | row['m_avail'] = 1; | |
2873 | $('#miscGrid').jqxGrid('addrow', null, row); | |
2874 | } | |
2875 | } | |
2876 | } | |
2877 | }); | |
2878 | miscs.dataBind(); | |
2879 | return; | |
2880 | } | |
2881 | } | |
2882 | } | |
2883 | ||
2884 | function setRangeIndicator(ion, rangeCode) { | |
2885 | if ((rangeCode == 'laag') || (rangeCode == 'hoog')) | |
2886 | $('#wr_' + ion).html("<img src='images/dialog-error.png'><span style='vertical-align: top; font-size: 10px; font-style: italic;'>" + rangeCode + '</span>'); | |
2887 | else | |
2888 | $('#wr_' + ion).html("<img src='images/dialog-ok-apply.png'>"); | |
2889 | } | |
2890 | ||
2891 | function mix(v1, v2, c1, c2) { | |
2892 | if ((v1 + v2) > 0) { | |
2893 | return ((v1 * c1) + (v2 * c2)) / (v1 + v2); | |
2894 | } | |
2895 | return 0; | |
2896 | } | |
2897 | ||
2898 | // mg/l as CaCO3 | |
2899 | function ResidualAlkalinity(total_alkalinity, calcium, magnesium) { | |
2900 | return total_alkalinity - (calcium / 1.4 + magnesium / 1.7); | |
2901 | } | |
2902 | ||
2903 | function PartCO3(pH) { | |
2904 | var H = Math.pow(10, -pH); | |
2905 | return 100 * Ka1 * Ka2 / (H * H + H * Ka1 + Ka1 * Ka2); | |
2906 | } | |
2907 | ||
2908 | function PartHCO3(pH) { | |
2909 | var H = Math.pow(10, -pH); | |
2910 | return 100 * Ka1 * H / (H * H + H * Ka1 + Ka1 * Ka2); | |
2911 | } | |
2912 | ||
2913 | function Charge(pH) { | |
2914 | return (-2 * PartCO3(pH) - PartHCO3(pH)); | |
2915 | } | |
2916 | ||
2917 | //Z alkalinity is the amount of acid (in mEq/l) needed to bring water to the target pH (Z pH) | |
2918 | function ZAlkalinity(pHZ) { | |
2919 | var C43 = Charge(4.3), | |
2920 | Cw = Charge(parseFloat($('#wg_ph').jqxNumberInput('decimal'))), | |
2921 | Cz = Charge(pHZ), | |
2922 | DeltaCNaught = -C43 + Cw, | |
2923 | CT = parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal')) / 50 / DeltaCNaught, | |
2924 | DeltaCZ = -Cz + Cw; | |
2925 | return CT * DeltaCZ; | |
2926 | } | |
2927 | ||
2928 | //Z Residual alkalinity is the amount of acid (in mEq/l) needed to bring the water in the mash to the target pH (Z pH) | |
2929 | function ZRA(pHZ) { | |
2930 | ||
2931 | var Magn, Z, Calc = parseFloat($('#wg_calcium').jqxNumberInput('decimal')) / (MMCa / 2); | |
2932 | Magn = parseFloat($('#wg_magnesium').jqxNumberInput('decimal')) / (MMMg / 2); | |
2933 | Z = ZAlkalinity(pHZ); | |
2934 | return Z - (Calc / 3.5 + Magn / 7); | |
2935 | } | |
2936 | ||
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2937 | function BufferCapacity(di_ph, acid_to_ph_57, ebc, graintype) { |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2938 | C1 = 0; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2939 | if ((di_ph != 5.7) && ((acid_to_ph_57 < - 0.1) || (acid_to_ph_57 > 0.1))) { |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2940 | C1 = acid_to_ph_57 / (di_ph - 5.7); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2941 | } else { |
622
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
2942 | // If the acid_to_ph_5.7 is unknown from the maltster, guess the required acid. |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2943 | switch (graintype) { |
622
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
2944 | case 0: // Base, Special, Kilned |
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
2945 | case 3: |
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
2946 | case 5: C1 = 0.014 * ebc - 34.192; |
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
2947 | break; |
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
2948 | case 2: C1 = -0.0597 * ebc - 32.457; // Crystal |
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
2949 | break; |
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
2950 | case 1: C1 = 0.0107 * ebc - 54.768; // Roast |
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
2951 | break; |
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
2952 | case 4: C1 = -149; // Sour malt |
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
2953 | break; |
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
2954 | } |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2955 | } |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2956 | return C1; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2957 | } |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2958 | |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2959 | function ProtonDeficit(pHZ) { |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2960 | |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2961 | var rows, i, C1, x, Result = ZRA(pHZ) * parseFloat($('#wg_amount').jqxNumberInput('decimal')); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2962 | // proton deficit for the grist |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2963 | if ((rows = $('#fermentableGrid').jqxGrid('getrows'))) { |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2964 | for (i = 0; i < rows.length; i++) { |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2965 | row = rows[i]; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2966 | if (row.f_added == 0 && row.f_graintype != 6) { // Added == Mash && graintype != No Malt |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2967 | C1 = BufferCapacity(row.f_di_ph, row.f_acid_to_ph_57, row.f_color, row.f_graintype); |
622
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
2968 | x = C1 * (pHZ - row.f_di_ph); // AcidRequired(ZpH) |
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
2969 | Result += x * row.f_amount; |
478 | 2970 | } |
2971 | } | |
622
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
2972 | } else { |
642
9d1af81b20ef
Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
641
diff
changeset
|
2973 | error_count++; |
9d1af81b20ef
Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
641
diff
changeset
|
2974 | if (error_count < 5) |
9d1af81b20ef
Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
641
diff
changeset
|
2975 | console.log('ProtonDeficit(' + pHZ + ') invalid grist, return ' + Result); |
478 | 2976 | } |
2977 | return Result; | |
2978 | } | |
2979 | ||
2980 | function MashpH() { | |
643
9ac2fb6b1311
Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
642
diff
changeset
|
2981 | |
478 | 2982 | var n = 0, pH = 5.4, deltapH = 0.001, deltapd = 0.1, pd = ProtonDeficit(pH); |
2983 | while (((pd < -deltapd) || (pd > deltapd)) && (n < 2000)) { | |
2984 | n++; | |
2985 | if (pd < -deltapd) | |
2986 | pH -= deltapH; | |
2987 | else if (pd > deltapd) | |
2988 | pH += deltapH; | |
2989 | pd = ProtonDeficit(pH); | |
2990 | } | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
2991 | pH = Round(pH, 6); |
644
4654b8ee4690
Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
643
diff
changeset
|
2992 | //console.log('MashpH() n: ' + n + ' pH: ' + pH); |
478 | 2993 | return pH; |
2994 | } | |
2995 | ||
2996 | function calcWater() { | |
2997 | ||
644
4654b8ee4690
Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
643
diff
changeset
|
2998 | /* Can be called during loading and building the screens */ |
643
9ac2fb6b1311
Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
642
diff
changeset
|
2999 | if (! data_loaded) { |
644
4654b8ee4690
Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
643
diff
changeset
|
3000 | console.log('calcWater() failsave'); |
643
9ac2fb6b1311
Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
642
diff
changeset
|
3001 | return; |
9ac2fb6b1311
Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
642
diff
changeset
|
3002 | } |
9ac2fb6b1311
Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
642
diff
changeset
|
3003 | |
478 | 3004 | var liters = 0, |
3005 | calcium = 0, | |
3006 | magnesium = 0, | |
3007 | sodium = 0, | |
3008 | total_alkalinity = 0, | |
3009 | chloride = 0, | |
3010 | sulfate = 0, | |
3011 | ph = 0, | |
3012 | RA = 0, | |
3013 | frac = 0, | |
3014 | TpH = 0, | |
3015 | protonDeficit = 0, | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3016 | AT, BT, |
478 | 3017 | r1d, r2d, f1d, f2d, f3d, |
3018 | deltapH, deltapd, pd, n, | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3019 | Res; |
478 | 3020 | |
3021 | if (dataRecord.w1_name == '') { | |
3022 | return; | |
3023 | } | |
3024 | ||
3025 | // If there is a dillute water source, mix the waters. | |
3026 | if (dataRecord.w2_name != '') { | |
3027 | liters = dataRecord.w1_amount + dataRecord.w2_amount; | |
3028 | calcium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_calcium, dataRecord.w2_calcium); | |
3029 | magnesium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_magnesium, dataRecord.w2_magnesium); | |
3030 | sodium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_sodium, dataRecord.w2_sodium); | |
3031 | chloride = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_chloride, dataRecord.w2_chloride); | |
3032 | sulfate = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_sulfate, dataRecord.w2_sulfate); | |
3033 | total_alkalinity = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_total_alkalinity, dataRecord.w2_total_alkalinity); | |
3034 | ph = -Math.log10(((Math.pow(10, -dataRecord.w1_ph) * dataRecord.w1_amount) + (Math.pow(10, -dataRecord.w2_ph) * dataRecord.w2_amount)) / liters); | |
3035 | } else { | |
3036 | liters = dataRecord.w1_amount; | |
3037 | calcium = dataRecord.w1_calcium; | |
3038 | magnesium = dataRecord.w1_magnesium; | |
3039 | sodium = dataRecord.w1_sodium; | |
3040 | chloride = dataRecord.w1_chloride; | |
3041 | sulfate = dataRecord.w1_sulfate; | |
3042 | total_alkalinity = dataRecord.w1_total_alkalinity; | |
3043 | ph = dataRecord.w1_ph; | |
3044 | } | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3045 | var bicarbonate = total_alkalinity * 1.22; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3046 | |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3047 | /* Save mixed water ions for later */ |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3048 | var wg_calcium = calcium; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3049 | var wg_sodium = sodium; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3050 | var wg_total_alkalinity = total_alkalinity; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3051 | var wg_chloride = chloride; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3052 | var wg_sulfate = sulfate; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3053 | var wg_bicarbonate = bicarbonate; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3054 | |
478 | 3055 | $('#wg_amount').val(liters); |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3056 | $('#wg_calcium').val(Round(calcium, 1)); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3057 | $('#wg_magnesium').val(Round(magnesium, 1)); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3058 | $('#wg_sodium').val(Round(sodium, 1)); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3059 | $('#wg_total_alkalinity').val(Round(total_alkalinity, 1)); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3060 | $('#wg_chloride').val(Round(chloride, 1)); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3061 | $('#wg_sulfate').val(Round(sulfate, 1)); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3062 | $('#wg_ph').val(Round(ph, 2)); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3063 | |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3064 | var mash_ph = Round(MashpH(), 3); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3065 | console.log('Distilled water mash pH: ' + mash_ph); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3066 | |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3067 | /* Calculate Salt additions */ |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3068 | if (liters > 0) { |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3069 | calcium += (parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 * 1000 + |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3070 | parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4 * 1000) / liters; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3071 | magnesium += (parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMMg / MMMgSO4 * 1000) / liters; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3072 | sodium += (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 1000 + |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3073 | parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMNa / MMNaHCO3 * 1000) / liters; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3074 | sulfate += (parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 * 1000 + |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3075 | parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 * 1000) / liters; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3076 | chloride += (2 * parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 * 1000 + |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3077 | parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl * 1000) / liters; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3078 | } |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3079 | |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3080 | if (dataRecord.wa_acid_name < 0 || dataRecord,wa_acid_name >= AcidTypeData.length) { |
478 | 3081 | $('#wa_acid_name').val(0); |
3082 | dataRecord.wa_acid_name = 0; | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3083 | dataRecord.wa_acid_perc = AcidTypeData[0].AcidPrc; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3084 | $('#wa_acid_perc').val(AcidTypeData[0].AcidPrc); |
478 | 3085 | } |
3086 | if (last_acid == '') | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3087 | last_acid = AcidTypeData[dataRecord.wa_acid_name].nl; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3088 | |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3089 | if (parseFloat(dataRecord.wa_acid_perc) == 0) { |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3090 | dataRecord.wa_acid_perc = AcidTypeData[AT].AcidPrc; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3091 | $('#wa_acid_perc').val(AcidTypeData[AT].AcidPrc); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3092 | } |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3093 | |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3094 | if (dataRecord.wa_base_name < 0 || dataRecord.wa_base_name > 3) { |
478 | 3095 | $('#wa_base_name').val(0); |
3096 | dataRecord.wa_base_name = 0; | |
3097 | } | |
3098 | if (last_base == '') | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3099 | last_base = BaseTypeData[dataRecord.wa_base_name].nl; |
478 | 3100 | |
3101 | AT = dataRecord.wa_acid_name; | |
3102 | BT = dataRecord.wa_base_name; | |
3103 | ||
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3104 | /* Note that the next calculations do not correct the pH change by the added salts. |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3105 | This pH change is at most 0.1 pH and is a minor difference in Acid amount. */ |
478 | 3106 | |
3107 | if (dataRecord.calc_acid) { | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3108 | /* Auto calculate pH */ |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3109 | $('.c_mashph').show(); |
478 | 3110 | TpH = parseFloat(dataRecord.mash_ph); |
3111 | protonDeficit = ProtonDeficit(TpH); | |
644
4654b8ee4690
Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
643
diff
changeset
|
3112 | //console.log('calc_acid tgt: ' + TpH + ' protonDeficit: ' + protonDeficit); |
478 | 3113 | if (protonDeficit > 0) { // Add acid |
3114 | $('#wa_base').val(0); | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3115 | dataRecord.wa_base = 0; |
478 | 3116 | setWaterAgent(last_base, 0); |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3117 | frac = CalcFrac(TpH, AcidTypeData[AT].pK1, AcidTypeData[AT].pK2, AcidTypeData[AT].pK3); |
478 | 3118 | Acid = protonDeficit / frac; |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3119 | Acid *= AcidTypeData[AT].MolWt; // mg |
478 | 3120 | Acidmg = Acid; |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3121 | Acid = Acid / AcidTypeData[AT].AcidSG; // ml |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3122 | Acid = Round(Acid / (parseFloat(dataRecord.wa_acid_perc) / 100), 2); // ml |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3123 | console.log('Mash auto Acid final ml: ' + Acid); |
495
fdbb6bfae569
Disabled some console.log items.
Michiel Broek <mbroek@mbse.eu>
parents:
490
diff
changeset
|
3124 | $('#wa_acid').val(Acid); |
fdbb6bfae569
Disabled some console.log items.
Michiel Broek <mbroek@mbse.eu>
parents:
490
diff
changeset
|
3125 | setWaterAgent(AcidTypeData[AT].nl, Acid); |
478 | 3126 | |
3127 | bicarbonate = bicarbonate - protonDeficit * frac / liters; | |
3128 | total_alkalinity = bicarbonate * 50 / 61; | |
3129 | } else if (protonDeficit < 0) { //Add base | |
3130 | $('#wa_acid').val(0); | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3131 | dataRecord.wa_acid = 0; |
478 | 3132 | setWaterAgent(last_acid, 0); |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3133 | r1d = Math.pow(10, (TpH - 6.35)); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3134 | r2d = Math.pow(10, (TpH - 10.33)); |
478 | 3135 | f1d = 1 / (1 + r1d + r1d * r2d); |
3136 | f2d = f1d * r1d; | |
3137 | f3d = f2d * r2d; | |
3138 | switch (BT) { | |
3139 | case 0: | |
3140 | RA = -protonDeficit / (f1d - f3d); // Sodiumbicarbonate, mmol totaal | |
3141 | RA = RA * MMNaHCO3 / 1000; //gram | |
3142 | $('#wa_base').val(Round(RA, 2)); | |
3143 | setWaterAgent('NaHCO3', Round(RA, 2)); | |
3144 | if (liters > 0) { | |
3145 | // Na | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3146 | RA = (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 1000 + |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3147 | parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMNa / MMNaHCO3 * 1000) / liters; |
478 | 3148 | sodium = wg_sodium + RA; |
3149 | // HCO3 | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3150 | RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3 * 1000) / liters; |
478 | 3151 | bicarbonate = wg_bicarbonate + RA; |
3152 | total_alkalinity = bicarbonate * 50 / 61; | |
3153 | RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); | |
3154 | } | |
3155 | break; | |
3156 | case 1: | |
3157 | RA = -protonDeficit / (2 * f1d + f2d); // Sodiumcarbonate, mmol totaal | |
3158 | RA = RA * MMNa2CO3 / 1000; //gram | |
3159 | $('#wa_base').val(Round(RA, 2)); | |
3160 | setWaterAgent('Na2CO3', Round(RA, 2)); | |
3161 | if (liters > 0) { | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3162 | RA = (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 1000+ |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3163 | parseFloat($('#wa_base').jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3 * 1000) / liters; |
478 | 3164 | sodium = wg_sodium + RA; |
3165 | // HCO3 | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3166 | RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3 * 1000) / liters; |
478 | 3167 | bicarbonate = wg_bicarbonate + RA; |
3168 | total_alkalinity = bicarbonate * 50 / 61; | |
3169 | RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); | |
3170 | } | |
3171 | break; | |
3172 | case 2: | |
3173 | RA = -protonDeficit * (f1d - f3d); // Calciumcarbonate, mmol totaal | |
3174 | RA = RA * MMCaCO3 / 1000; //gram | |
3175 | //but only 1/3 is effective, so add 3 times as much | |
3176 | RA = 3 * RA; | |
3177 | $('#wa_base').val(Round(RA, 2)); | |
3178 | setWaterAgent('CaCO3', Round(RA, 2)); | |
3179 | if (liters > 0) { | |
3180 | //Bicarbonate | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3181 | RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3 * 1000) / liters; |
478 | 3182 | bicarbonate = wg_bicarbonate + RA; |
3183 | total_alkalinity = bicarbonate * 50 / 61; | |
3184 | //Ca precipitates out as Ca10(PO4)6(OH)2 | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3185 | RA = (parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 * 1000 + |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3186 | parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4 * 1000 + |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3187 | parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMCa / MMCaCO3 * 1000) / liters; |
478 | 3188 | calcium = wg_calcium + RA; |
3189 | RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); | |
3190 | } | |
3191 | break; | |
3192 | case 3: | |
3193 | RA = -protonDeficit / 19.3; // Calciumhydroxide | |
3194 | $('#wa_base').val(Round(RA, 2)); | |
3195 | setWaterAgent('Ca(OH)2', Round(RA, 2)); | |
3196 | if (liters > 0) { | |
3197 | // Bicarbonate | |
3198 | RA = -protonDeficit / liters; | |
3199 | total_alkalinity = wg_total_alkalinity + RA; | |
3200 | bicarbonate = total_alkalinity * 61 / 50; | |
3201 | // Calcium | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3202 | RA = (parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 * 1000 + |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3203 | parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4 * 1000 + |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3204 | parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMCa / MMCaOH2 * 1000) / liters; |
478 | 3205 | calcium = wg_calcium + RA; |
3206 | RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); | |
3207 | } | |
3208 | break; | |
3209 | } | |
3210 | } | |
3211 | ph = TpH; | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3212 | $('#wb_ph').val(Round(ph, 2)); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3213 | $('#est_mash_ph').val(Round(ph, 2)); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3214 | } else { |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3215 | /* Manual calculate pH */ |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3216 | $('.c_mashph').hide(); |
478 | 3217 | console.log('calc_acid no'); |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3218 | if (parseFloat($('#wa_base').jqxNumberInput('decimal')) > 0 && liters > 0) { |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3219 | /* First add the base salts */ |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3220 | switch (BT) { |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3221 | case 0: // Sodiumbicarbonate, Na |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3222 | RA = (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 1000 + |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3223 | parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMNa / MMNaHCO3 * 1000) / liters; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3224 | sodium = wg_sodium + RA; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3225 | // HCO3 |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3226 | RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3 * 1000) / liters; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3227 | bicarbonate = wg_bicarbonate + RA; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3228 | total_alkalinity = bicarbonate * 50 / 61; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3229 | RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3230 | break; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3231 | case 1: // Sodiumcarbonate |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3232 | RA = (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 1000 + |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3233 | parseFloat($('#wa_base').jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3 * 1000) / liters; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3234 | sodium = wg_sodium + RA; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3235 | // HCO3 |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3236 | RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3 * 1000) / liters; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3237 | bicarbonate = wg_bicarbonate + RA; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3238 | total_alkalinity = bicarbonate * 50 / 61; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3239 | RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3240 | break; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3241 | case 2: // Calciumcarbonate: Bicarbonate |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3242 | RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) / 3 * MMHCO3 * 1000 / MMCaCO3) / liters; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3243 | bicarbonate = wg_bicarbonate + RA; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3244 | total_alkalinity = bicarbonate * 50 / 61; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3245 | RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3246 | // Ca |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3247 | RA = (parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa * 1000 / MMCaCl2 + |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3248 | parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa * 1000 / MMCaSO4 + |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3249 | parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMCa * 1000/ MMCaCO3) / liters; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3250 | calcium = wg_calcium + RA; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3251 | break; |
478 | 3252 | } |
3253 | } | |
3254 | ||
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3255 | pHa = Round(ph, 3); // Adjusted water pH |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3256 | // Then calculate the new pH with added acids and malts |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3257 | console.log('Mash pH: ' + pHa); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3258 | Acid = AcidTypeData[AT].AcidSG * (parseFloat(dataRecord.wa_acid_perc) / 100); // ml |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3259 | Acid *= parseFloat($('#wa_acid').jqxNumberInput('decimal')); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3260 | Acid /= AcidTypeData[AT].MolWt; // mg |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3261 | Acidmg = Acid; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3262 | |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3263 | //find the pH where the protondeficit = protondeficit by the acid |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3264 | frac = CalcFrac(pHa, AcidTypeData[AT].pK1, AcidTypeData[AT].pK2, AcidTypeData[AT].pK3); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3265 | protonDeficit = Round(Acid * frac, 3); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3266 | //console.log('protonDeficit Acid: ' + protonDeficit + ' frac: ' + frac + ' pH: ' + pHa); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3267 | |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3268 | deltapH = 0.001; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3269 | deltapd = 0.1; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3270 | pd = Round(ProtonDeficit(pHa), 6); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3271 | n = 0; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3272 | while (((pd < (protonDeficit - deltapd)) || (pd > (protonDeficit + deltapd))) && (n < 4000)) { |
478 | 3273 | n++; |
3274 | if (pd < (protonDeficit - deltapd)) | |
3275 | pHa -= deltapH; | |
3276 | else if (pd > (protonDeficit + deltapd)) | |
3277 | pHa += deltapH; | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3278 | frac = CalcFrac(pHa, AcidTypeData[AT].pK1, AcidTypeData[AT].pK2, AcidTypeData[AT].pK3); |
478 | 3279 | protonDeficit = Acid * frac; |
3280 | pd = ProtonDeficit(pHa); | |
3281 | } | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3282 | //console.log('n: ' + n + ' pd: ' + pd + ' protonDeficit: ' + protonDeficit + ' frac: ' + frac + ' pHa: ' + pHa); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3283 | RA = wg_bicarbonate - protonDeficit * frac / liters; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3284 | bicarbonate = RA; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3285 | total_alkalinity = RA * 50 / 61; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3286 | ph = pHa; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3287 | $('#wb_ph').val(Round(ph, 2)); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3288 | $('#est_mash_ph').val(Round(ph, 2)); |
478 | 3289 | } |
3290 | ||
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3291 | if ((AT == 3) && (liters > 0)) { // Sulfuric / Zwavelzuur |
478 | 3292 | RA = parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 + |
3293 | parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 + | |
3294 | Acidmg / 1000 * MMSO4 / (MMSO4 + 2); | |
3295 | RA = 1000 * RA / liters; | |
3296 | sulfate = wg_sulfate + RA; // Not add to sulfate?? | |
3297 | } else if ((AT == 1) && (liters > 0)) { // Hydrochloric, Zoutzuur | |
3298 | RA = parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 + | |
3299 | parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl + | |
3300 | Acidmg / 1000 * MMCl / (MMCl + 1); | |
3301 | RA = 1000 * RA / liters; | |
3302 | chloride = wg_chloride + RA; | |
3303 | } | |
3304 | ||
555
7c4f34b7e16f
A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents:
554
diff
changeset
|
3305 | var BUGU = GetBUGU(); |
7c4f34b7e16f
A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents:
554
diff
changeset
|
3306 | $('#tgt_bu').val(Round(BUGU, 2)); |
478 | 3307 | // From brouwhulp. |
555
7c4f34b7e16f
A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents:
554
diff
changeset
|
3308 | if (BUGU < 0.32) |
478 | 3309 | $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer moutig en zoet</span>"); |
555
7c4f34b7e16f
A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents:
554
diff
changeset
|
3310 | else if (BUGU < 0.43) |
478 | 3311 | $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Moutig, zoet</span>"); |
555
7c4f34b7e16f
A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents:
554
diff
changeset
|
3312 | else if (BUGU < 0.52) |
478 | 3313 | $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Evenwichtig</span>"); |
555
7c4f34b7e16f
A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents:
554
diff
changeset
|
3314 | else if (BUGU < 0.63) |
478 | 3315 | $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Licht hoppig, bitter</span>"); |
3316 | else | |
3317 | $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Extra hoppig, zeer bitter</span>"); | |
552
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
3318 | |
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
3319 | // Sulfate to Chloride ratio (Palmer). |
555
7c4f34b7e16f
A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents:
554
diff
changeset
|
3320 | var OptSO4Clratio = GetOptSO4Clratio(); |
7c4f34b7e16f
A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents:
554
diff
changeset
|
3321 | $('#tgt_so4_cl').val(Round(OptSO4Clratio, 1)); |
7c4f34b7e16f
A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents:
554
diff
changeset
|
3322 | if (OptSO4Clratio < 0.4) |
552
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
3323 | $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Te moutig</span>"); |
555
7c4f34b7e16f
A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents:
554
diff
changeset
|
3324 | else if (OptSO4Clratio < 0.6) |
552
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
3325 | $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer moutig</span>"); |
555
7c4f34b7e16f
A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents:
554
diff
changeset
|
3326 | else if (OptSO4Clratio < 0.8) |
552
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
3327 | $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Moutig</span>"); |
555
7c4f34b7e16f
A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents:
554
diff
changeset
|
3328 | else if (OptSO4Clratio < 1.5) |
552
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
3329 | $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Gebalanceerd</span>"); |
555
7c4f34b7e16f
A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents:
554
diff
changeset
|
3330 | else if (OptSO4Clratio < 2.0) |
552
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
3331 | $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Licht bitter</span>"); |
555
7c4f34b7e16f
A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents:
554
diff
changeset
|
3332 | else if (OptSO4Clratio < 4.0) |
552
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
3333 | $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Bitter</span>"); |
555
7c4f34b7e16f
A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents:
554
diff
changeset
|
3334 | else if (OptSO4Clratio < 9.0) |
552
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
3335 | $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer bitter</span>"); |
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
3336 | else |
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
3337 | $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Te bitter</span>"); |
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
3338 | if (chloride > 0) |
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
3339 | RA = sulfate / chloride; |
478 | 3340 | else |
3341 | RA = 10; | |
552
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
3342 | $('#got_so4_cl').val(Round(RA, 1)); |
478 | 3343 | Res = 'normaal'; |
555
7c4f34b7e16f
A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents:
554
diff
changeset
|
3344 | if (RA < (0.8 * OptSO4Clratio)) |
478 | 3345 | Res = 'laag'; |
555
7c4f34b7e16f
A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents:
554
diff
changeset
|
3346 | else if (RA > (1.2 * OptSO4Clratio)) |
478 | 3347 | Res = 'hoog'; |
552
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
3348 | setRangeIndicator('so4_cl', Res); |
478 | 3349 | |
3350 | $('#wb_calcium').val(Round(calcium, 1)); | |
3351 | $('#wb_magnesium').val(Round(magnesium, 1)); | |
3352 | $('#wb_sodium').val(Round(sodium, 1)); | |
3353 | $('#wb_sulfate').val(Round(sulfate, 1)); | |
3354 | $('#wb_chloride').val(Round(chloride, 1)); | |
3355 | $('#wb_total_alkalinity').val(Round(total_alkalinity, 1)); | |
3356 | ||
3357 | if (calcium < 40) { | |
3358 | setRangeIndicator('calcium', 'laag'); | |
3359 | } else if (calcium > 150) { | |
3360 | setRangeIndicator('calcium', 'hoog'); | |
3361 | } else { | |
3362 | setRangeIndicator('calcium', 'normaal'); | |
3363 | } | |
607
0efba09a694c
Added low limit for magnesium of 10 ppm
Michiel Broek <mbroek@mbse.eu>
parents:
602
diff
changeset
|
3364 | if (magnesium < 10) { |
0efba09a694c
Added low limit for magnesium of 10 ppm
Michiel Broek <mbroek@mbse.eu>
parents:
602
diff
changeset
|
3365 | setRangeIndicator('magnesium', 'laag'); |
0efba09a694c
Added low limit for magnesium of 10 ppm
Michiel Broek <mbroek@mbse.eu>
parents:
602
diff
changeset
|
3366 | } else if (magnesium > 30) { |
0efba09a694c
Added low limit for magnesium of 10 ppm
Michiel Broek <mbroek@mbse.eu>
parents:
602
diff
changeset
|
3367 | setRangeIndicator('magnesium', 'hoog'); |
0efba09a694c
Added low limit for magnesium of 10 ppm
Michiel Broek <mbroek@mbse.eu>
parents:
602
diff
changeset
|
3368 | } else { |
478 | 3369 | setRangeIndicator('magnesium', 'normaal'); |
3370 | } | |
3371 | if (sodium <= 150) { | |
3372 | setRangeIndicator('sodium', 'normaal'); | |
3373 | } else { | |
3374 | setRangeIndicator('sodium', 'hoog'); | |
3375 | } | |
3376 | // Both chloride and sulfate should be above 50 according to | |
3377 | // John Palmer. So the Cl/SO4 ratio calculation will work. | |
3378 | if (chloride <= 50) { | |
3379 | setRangeIndicator('chloride', 'laag'); | |
3380 | } else if (chloride <= 100) { | |
3381 | setRangeIndicator('chloride', 'normaal'); | |
3382 | } else { | |
3383 | setRangeIndicator('chloride', 'hoog'); | |
3384 | } | |
3385 | if (sulfate <= 50) { | |
3386 | setRangeIndicator('sulfate', 'laag'); | |
3387 | } else if (sulfate <= 350) { | |
3388 | setRangeIndicator('sulfate', 'normaal'); | |
3389 | } else { | |
3390 | setRangeIndicator('sulfate', 'hoog'); | |
3391 | } | |
3392 | if (ph < 5.2) { | |
3393 | setRangeIndicator('ph', 'laag'); | |
3394 | } else if (ph > 5.6) { | |
3395 | setRangeIndicator('ph', 'hoog'); | |
3396 | } else { | |
3397 | setRangeIndicator('ph', 'normaal'); | |
3398 | } | |
3399 | calcSparge(); | |
3400 | calcMiscs(); | |
3401 | calcSupplies(); | |
3402 | } | |
3403 | ||
3404 | function calcSparge() { | |
3405 | ||
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3406 | /* Based on the work of ajDeLange. */ |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3407 | var TargetpH = dataRecord.sparge_ph; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3408 | var Source_pH = dataRecord.w1_ph; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3409 | var Source_alkalinity = dataRecord.w1_total_alkalinity; |
478 | 3410 | // Select watersource or fallback to the first source. |
3411 | if (dataRecord.sparge_source == 1) { // Source 2 | |
3412 | if (dataRecord.w2_ph > 0.0) { | |
3413 | Source_pH = dataRecord.w2_ph; | |
3414 | Source_alkalinity = dataRecord.w2_total_alkalinity; | |
3415 | } else { | |
3416 | dataRecord.sparge_source = 0; // Source 1 | |
3417 | $('#sparge_source').val(0); | |
3418 | } | |
3419 | } else if (dataRecord.sparge_source == 2) { // Mixed | |
3420 | if (dataRecord.w2_ph > 0.0) { | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3421 | Source_pH = parseFloat(dataRecord.wg_ph); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3422 | Source_alkalinity = parseFloat(dataRecord.wg_total_alkalinity); |
478 | 3423 | } else { |
3424 | dataRecord.sparge_source = 0; | |
3425 | $('#sparge_source').val(0); | |
3426 | } | |
3427 | } | |
3428 | ||
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3429 | // Step 1: Compute the mole fractions of carbonic (f1) and carbonate(f3) at the source water pH |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3430 | var r1 = Math.pow(10, Source_pH - 6.35); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3431 | var r2 = Math.pow(10, Source_pH - 10.33); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3432 | var d = 1 + r1 + r1 * r2; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3433 | var f1 = 1 / d; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3434 | var f3 = r1 * r2 / d; |
478 | 3435 | |
3436 | //Step 2. Compute the mole fractions at pH = 4.3 (the pH which defines alkalinity) | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3437 | var r143 = Math.pow(10, 4.3 - 6.35); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3438 | var r243 = Math.pow(10, 4.3 - 10.33); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3439 | var d43 = 1 + r143 + r143 * r243; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3440 | var f143 = 1 / d43; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3441 | var f343 = r143 * r243 / d43; |
478 | 3442 | |
3443 | //Step 4. Solve | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3444 | var Ct = Source_alkalinity / 50 / ((f143 - f1) + (f3 - f343)); |
478 | 3445 | |
3446 | //Step 5. Compute mole fractions at desired pH | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3447 | var r1g = Math.pow(10, TargetpH - 6.35); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3448 | var r2g = Math.pow(10, TargetpH - 10.33); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3449 | var dg = 1 + r1g + r1g * r2g; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3450 | var f1g = 1 / dg; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3451 | var f3g = r1g * r2g / dg; |
478 | 3452 | |
3453 | //Step 6. Use these to compute the milliequivalents acid required per liter (mEq/L) | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3454 | var Acid = Ct * ((f1g - f1) + (f3 - f3g)) + Math.pow(10, -TargetpH) - Math.pow(10, -Source_pH); //mEq/l |
478 | 3455 | Acid += 0.01; // Add acid that would be required for distilled water. |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3456 | |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3457 | //Step 8. Get the acid data. |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3458 | var AT = dataRecord.sparge_acid_type; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3459 | if (AT < 0 || AT >= AcidTypeData.length) { |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3460 | AT = 0; |
478 | 3461 | dataRecord.sparge_acid_type = 0; |
3462 | $('#sparge_acid_type').val(0); | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3463 | dataRecord.sparge_acid_perc = AcidTypeData[0].AcidPrc; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3464 | $('#sparge_acid_perc').val(dataRecord.sparge_acid_perc); |
478 | 3465 | } |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3466 | var fract = CalcFrac(TargetpH, AcidTypeData[AT].pK1, AcidTypeData[AT].pK2, AcidTypeData[AT].pK3); |
478 | 3467 | |
3468 | //Step 9. Now divide the mEq required by the "fraction". This is the required number of moles of acid. | |
3469 | Acid /= fract; | |
3470 | ||
3471 | //Step 10. Multiply by molecular weight of the acid | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3472 | Acid *= AcidTypeData[AT].MolWt; //mg |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3473 | |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3474 | //Step 11. Divide by Specific Gravity and Percentage to get the final ml. |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3475 | Acid = Acid / AcidTypeData[AT].AcidSG / (dataRecord.sparge_acid_perc / 100); //ml |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
3476 | Acid *= dataRecord.sparge_volume; //ml acid total |
478 | 3477 | Acid = Round(Acid, 2); |
3478 | dataRecord.sparge_acid_amount = Acid / 1000; | |
3479 | $('#sparge_acid_amount').val(Acid); | |
3480 | } | |
3481 | ||
3482 | function calcFermentation() { | |
3483 | var primary_svg, secondary_svg, final_svg, ABV; | |
3484 | if (dataRecord.brew_fermenter_sg < 1.020) | |
3485 | return; | |
3486 | if ((dataRecord.primary_end_sg > 0.990) && (dataRecord.primary_end_sg < dataRecord.brew_fermenter_sg)) { | |
655
f4e00869f39f
Calculate the svg using Brew by the Numbers, Micahel L. Hall.
Michiel Broek <mbroek@mbse.eu>
parents:
651
diff
changeset
|
3487 | primary_svg = Round(calc_svg(dataRecord.brew_fermenter_sg, dataRecord.primary_end_sg), 1); |
478 | 3488 | $('#primary_svg').val(primary_svg); |
3489 | if ((dataRecord.secondary_end_sg > 0.990) && (dataRecord.secondary_end_sg < dataRecord.brew_fermenter_sg)) { | |
655
f4e00869f39f
Calculate the svg using Brew by the Numbers, Micahel L. Hall.
Michiel Broek <mbroek@mbse.eu>
parents:
651
diff
changeset
|
3490 | secondary_svg = Round(calc_svg(dataRecord.brew_fermenter_sg, dataRecord.secondary_end_sg), 1); |
478 | 3491 | $('#secondary_svg').val(secondary_svg); |
3492 | if ((dataRecord.fg > 0.990) && (dataRecord.fg < dataRecord.brew_fermenter_sg)) { | |
655
f4e00869f39f
Calculate the svg using Brew by the Numbers, Micahel L. Hall.
Michiel Broek <mbroek@mbse.eu>
parents:
651
diff
changeset
|
3493 | final_svg = Round(calc_svg(dataRecord.brew_fermenter_sg, dataRecord.fg), 1); |
478 | 3494 | $('#final_svg').val(final_svg); |
3495 | ABV = Round(abvol(dataRecord.brew_fermenter_sg, dataRecord.fg), 2); | |
3496 | $('#final_abv').val(ABV); | |
3497 | } | |
3498 | } | |
3499 | } | |
3500 | } | |
3501 | ||
651
6e89cb158153
Changed priming sugar calculation to Brew by the Numbers by Michael L. Hall. This gives a bit higher and better amount of sugar to use. Removed dead parameter from the ResCO2 function.
Michiel Broek <mbroek@mbse.eu>
parents:
649
diff
changeset
|
3502 | function ResCO2(T) { |
478 | 3503 | var F = T * 1.8 + 32; |
651
6e89cb158153
Changed priming sugar calculation to Brew by the Numbers by Michael L. Hall. This gives a bit higher and better amount of sugar to use. Removed dead parameter from the ResCO2 function.
Michiel Broek <mbroek@mbse.eu>
parents:
649
diff
changeset
|
3504 | return Round(3.0378 - 0.050062 * F + 0.00026555 * F * F, 6); |
478 | 3505 | } |
3506 | ||
3507 | function CarbCO2toS(CO2, T, SFactor) { | |
651
6e89cb158153
Changed priming sugar calculation to Brew by the Numbers by Michael L. Hall. This gives a bit higher and better amount of sugar to use. Removed dead parameter from the ResCO2 function.
Michiel Broek <mbroek@mbse.eu>
parents:
649
diff
changeset
|
3508 | //var sugar = SFactor * (CO2 - ResCO2(CO2, T)) / 0.286; |
6e89cb158153
Changed priming sugar calculation to Brew by the Numbers by Michael L. Hall. This gives a bit higher and better amount of sugar to use. Removed dead parameter from the ResCO2 function.
Michiel Broek <mbroek@mbse.eu>
parents:
649
diff
changeset
|
3509 | var sugar = Round(SFactor * (CO2 - ResCO2(T)) * 4.014094, 6); |
478 | 3510 | if (sugar < 0) |
3511 | sugar = 0; | |
3512 | return Round(sugar, 3); | |
3513 | } | |
3514 | ||
3515 | function GetPressure(CO2, T1, T2) { | |
651
6e89cb158153
Changed priming sugar calculation to Brew by the Numbers by Michael L. Hall. This gives a bit higher and better amount of sugar to use. Removed dead parameter from the ResCO2 function.
Michiel Broek <mbroek@mbse.eu>
parents:
649
diff
changeset
|
3516 | var P, V = CO2 - ResCO2(T1); |
609
e9b108569818
Testing, bottle carbonation pressure display without residential pressure
Michiel Broek <mbroek@mbse.eu>
parents:
607
diff
changeset
|
3517 | V = CO2; // TODO: temp only total pressure, testing |
478 | 3518 | if (V < 0) |
3519 | return 0; | |
3520 | P = -1.09145427669121 + 0.00800006989646477 * T2 + 0.000260276315484684 * T2 * T2 + 0.0215142075945119 * T2 * V + | |
3521 | 0.674996600795854 * V + -0.00471757220150754 * V * V; | |
3522 | if (P < 0) | |
3523 | P = 0; | |
609
e9b108569818
Testing, bottle carbonation pressure display without residential pressure
Michiel Broek <mbroek@mbse.eu>
parents:
607
diff
changeset
|
3524 | P = Round(P * 1.01325, 2); // atm to bar |
651
6e89cb158153
Changed priming sugar calculation to Brew by the Numbers by Michael L. Hall. This gives a bit higher and better amount of sugar to use. Removed dead parameter from the ResCO2 function.
Michiel Broek <mbroek@mbse.eu>
parents:
649
diff
changeset
|
3525 | console.log("GetPressure(" + CO2 + ", " + T1 + ", " + T2 + ") V:" + V + " Bar: " + P + " ignored ResCO2: " + ResCO2(T1)); |
609
e9b108569818
Testing, bottle carbonation pressure display without residential pressure
Michiel Broek <mbroek@mbse.eu>
parents:
607
diff
changeset
|
3526 | return P; |
478 | 3527 | } |
3528 | ||
3529 | function CarbCO2ToPressure(CO2, T) { | |
3530 | return (CO2 - (-0.000005594056 * Math.pow(T, 4) + 0.000144357886 * Math.pow(T, 3) + | |
3531 | 0.000362999168 * T * T - 0.064872987645 * T + 1.641145175049)) / | |
3532 | (0.00000498031 * Math.pow(T, 4) - 0.00024358267 * Math.pow(T, 3) + 0.00385867329 * T * T - 0.05671206825 * T + 1.53801423376); | |
3533 | } | |
3534 | ||
3535 | function calcCarbonation() { | |
3536 | ||
3537 | var TSec, ABV, bvol, balc, babv, mvol, malc, tvol, talc, i, row, SFactor, pvol, pabv, Pressure, kabv; | |
3538 | ||
3539 | TSec = dataRecord.secondary_temp; | |
3540 | if (TSec < 1) | |
3541 | TSec = dataRecord.primary_end_temp; | |
3542 | if (TSec < 1) | |
3543 | TSec = 18; | |
3544 | ||
3545 | if (dataRecord.fg == 0.000) | |
3546 | ABV = abvol(dataRecord.brew_fermenter_sg, parseFloat($('#est_fg').jqxNumberInput('decimal'))); | |
3547 | else | |
3548 | ABV = abvol(dataRecord.brew_fermenter_sg, dataRecord.fg); | |
3549 | ||
3550 | /* Calculate new volume and alcohol. */ | |
3551 | bvol = dataRecord.package_volume - (ABV * dataRecord.package_volume) / 100; | |
3552 | balc = dataRecord.package_volume - bvol; | |
3553 | mvol = dataRecord.package_infuse_amount - (dataRecord.package_infuse_abv * dataRecord.package_infuse_amount) / 100; | |
3554 | malc = dataRecord.package_infuse_amount - mvol; | |
3555 | talc = balc + malc; | |
3556 | tvol = bvol + mvol; | |
3557 | ABV = Round(talc / (tvol + talc) * 100, 2); | |
3558 | dataRecord.package_abv = ABV; | |
3559 | $('#package_abv').val(ABV); | |
3560 | ||
3561 | //console.log("calcCarbonation() TSec:"+TSec+" ABV:"+ABV); | |
3562 | if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) { | |
3563 | return; | |
3564 | } | |
3565 | ||
3566 | // Bottles | |
3567 | dataRecord.bottle_priming_amount = 0; | |
3568 | dataRecord.bottle_priming_total = 0; | |
3569 | for (i = 0; i < rows.length; i++) { | |
3570 | row = rows[i]; | |
3571 | if (row.f_added == 4) { | |
3572 | SFactor = 1 / ((row.f_yield / 100) * (1 - row.f_moisture / 100)); | |
3573 | dataRecord.bottle_priming_amount = CarbCO2toS(dataRecord.bottle_carbonation, TSec, SFactor); | |
3574 | dataRecord.bottle_priming_total = Round(dataRecord.bottle_amount * dataRecord.bottle_priming_amount, 2); | |
3575 | $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', dataRecord.bottle_priming_total / 1000); | |
3576 | } | |
3577 | } | |
3578 | $('#bottle_priming_amount').val(Round(dataRecord.bottle_priming_amount, 1)); | |
3579 | $('#bottle_priming_total').val(dataRecord.bottle_priming_total); | |
3580 | pabv = ABV + dataRecord.bottle_priming_amount * 0.47 / 7.907; | |
3581 | pvol = dataRecord.bottle_amount - (pabv * dataRecord.bottle_amount) / 100; | |
3582 | talc = dataRecord.bottle_amount - pvol; | |
3583 | tvol = pvol + dataRecord.bottle_priming_water; | |
3584 | babv = Round(talc / (tvol + talc) * 100, 2); | |
3585 | //console.log("bottle pabv:"+pabv+" pvol:"+pvol+" wvol:"+dataRecord.bottle_priming_water+" tvol:"+tvol+" talc:"+talc+" abv:"+babv); | |
3586 | $('#bottle_abv').val(babv); | |
3587 | $('#bottle_pressure').val(GetPressure(dataRecord.bottle_carbonation, TSec, dataRecord.bottle_carbonation_temp)); | |
3588 | ||
3589 | // Kegs | |
3590 | Pressure = CarbCO2ToPressure(dataRecord.keg_carbonation, dataRecord.keg_carbonation_temp); | |
3591 | if (Pressure < 0) | |
557 | 3592 | Pressure = 0; |
478 | 3593 | dataRecord.keg_pressure = Pressure; |
3594 | $('#keg_pressure').val(Round(Pressure, 1)); | |
3595 | ||
3596 | dataRecord.keg_priming_amount = 0; | |
3597 | dataRecord.keg_priming_total = 0; | |
3598 | if (!dataRecord.keg_forced_carb) { | |
557 | 3599 | for (i = 0; i < rows.length; i++) { |
3600 | row = rows[i]; | |
3601 | if (row.f_added == 5) { | |
3602 | SFactor = 1 / ((row.f_yield / 100) * (1 - row.f_moisture / 100)); | |
3603 | dataRecord.keg_priming_amount = CarbCO2toS(dataRecord.keg_carbonation, TSec, SFactor); | |
3604 | dataRecord.keg_priming_total = Round(dataRecord.keg_amount * dataRecord.keg_priming_amount, 2); | |
3605 | $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', dataRecord.keg_priming_total / 1000); | |
3606 | } | |
3607 | } | |
3608 | $('#keg_priming_amount').val(Round(dataRecord.keg_priming_amount, 1)); | |
3609 | $('#keg_priming_total').val(dataRecord.keg_priming_total); | |
3610 | pabv = ABV + dataRecord.keg_priming_amount * 0.47 / 7.907; | |
3611 | pvol = dataRecord.keg_amount - (pabv * dataRecord.keg_amount) / 100; | |
3612 | talc = dataRecord.keg_amount - pvol; | |
3613 | tvol = pvol + dataRecord.keg_priming_water; | |
3614 | kabv = Round(talc / (tvol + talc) * 100, 2); | |
3615 | //console.log("kegs pabv:"+pabv+" pvol:"+pvol+" wvol:"+dataRecord.keg_priming_water+" tvol:"+tvol+" talc:"+talc+" abv:"+kabv); | |
3616 | $('#keg_abv').val(kabv); | |
478 | 3617 | } else { |
557 | 3618 | $('#keg_priming_amount').val(0); |
3619 | $('#keg_priming_total').val(0); | |
3620 | $('#keg_abv').val(ABV); | |
478 | 3621 | } |
3622 | } | |
3623 | ||
3624 | function calcStage() { | |
3625 | ||
3626 | var newstage = dataRecord.stage, d, date1, date2, date1_unixtime, date2_unixtime, timeDifference, timeDifferenceInDays; | |
3627 | ||
3628 | if (newstage == 0 && dataRecord.est_og > 1.005 && dataRecord.est_color > 3 && dataRecord.est_ibu > 3) | |
3629 | newstage = 1; | |
3630 | if (newstage == 1 && parseFloat($('#brew_date_start').val()) > 2000) | |
3631 | newstage = 2; // Brewday | |
3632 | if (newstage == 2 && ($('#brew_date_start').val() == '')) | |
3633 | newstage = 1; // No brewday | |
3634 | if (newstage == 2 && parseFloat($('#brew_date_end').val()) > 2000) | |
3635 | newstage = 3; // Primary | |
3636 | if (newstage == 3 && parseFloat($('#primary_end_date').val()) > 2000) | |
3637 | newstage = 4; // Secondary | |
3638 | if (newstage == 4 && parseFloat($('#secondary_end_date').val()) > 2000) | |
3639 | newstage = 5; // Tertiary | |
3640 | if (newstage == 5 && parseFloat($('#package_date').val()) > 2000) | |
3641 | newstage = 6; // Package | |
3642 | if (newstage >= 6 && newstage < 9) { | |
3643 | d = new Date(); | |
3644 | date2 = $('#package_date').val(); | |
3645 | date2 = date2.split('-'); | |
3646 | // Now we convert the array to a Date object | |
3647 | date1 = new Date(d.getFullYear(), d.getMonth(), d.getDate()); | |
3648 | date2 = new Date(date2[0], date2[1] - 1, date2[2]); | |
3649 | // We use the getTime() method and get the unixtime | |
3650 | date1_unixtime = parseInt(date1.getTime() / 1000); | |
3651 | date2_unixtime = parseInt(date2.getTime() / 1000); | |
3652 | // This is the calculated difference in seconds | |
3653 | timeDifference = date1_unixtime - date2_unixtime; | |
3654 | timeDifferenceInDays = timeDifference / 60 / 60 / 24; | |
3655 | if (timeDifferenceInDays > 0) { // At least one day | |
3656 | if (timeDifferenceInDays >= 42) // 6 weeks | |
3657 | newstage = 9; // Ready to taste | |
3658 | else if (timeDifferenceInDays >= 14) // 14 days | |
3659 | newstage = 8; // Mature | |
3660 | else | |
3661 | newstage = 7; // Carbonation | |
3662 | } | |
3663 | } | |
3664 | if (newstage == 9 && parseFloat($('#taste_date').val()) > 2000) | |
3665 | newstage = 10; // Ready | |
3666 | ||
3667 | if (newstage != dataRecord.stage) { | |
3668 | console.log('calcStage() old: ' + dataRecord.stage + ' new: ' + newstage); | |
3669 | dataRecord.stage = newstage; | |
3670 | } | |
3671 | ||
3672 | /* | |
3673 | * Set stage and enable or disable parts of the screens. | |
3674 | */ | |
3675 | $('#stage').val(StageData[dataRecord.stage].nl); | |
3676 | if (dataRecord.stage >= 10) { | |
3677 | $('#locked').jqxCheckBox({ disabled: false }); | |
3678 | } | |
3679 | ||
3680 | /* | |
3681 | * When the brew is in progress or done, block equipment select and delete. | |
3682 | */ | |
3683 | if (dataRecord.stage > 1) { | |
3684 | $('#equipmentSelect').jqxDropDownList({ disabled: true }); | |
3685 | $('#Delete').jqxButton({ disabled: true }); | |
3686 | } | |
3687 | ||
3688 | if (dataRecord.stage < 1) // Planning, no ingredients | |
3689 | $('#jqxTabs').jqxTabs('disableAt', 8); // Brewday tab | |
3690 | else | |
3691 | $('#jqxTabs').jqxTabs('enableAt', 8); | |
3692 | ||
3693 | if (dataRecord.stage < 3) { // Primary | |
3694 | $('#jqxTabs').jqxTabs('disableAt', 9); // Fermentation tab | |
3695 | } else { | |
3696 | $('#jqxTabs').jqxTabs('enableAt', 9); | |
3697 | $('#name').jqxInput({ disabled: true }); | |
3698 | $('#code').jqxInput({ disabled: true }); | |
3699 | $('#batch_size').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3700 | $('#boil_size').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3701 | $('#boil_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3702 | $('#efficiency').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3703 | $('#est_og').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3704 | $('#type').jqxDropDownList({ disabled: true }); | |
3705 | $('#styleSelect').jqxDropDownList({ disabled: true }); | |
3706 | $('#color_method').jqxDropDownList({ disabled: true }); | |
3707 | $('#ibu_method').jqxDropDownList({ disabled: true }); | |
3708 | $('#mash_select').jqxDropDownList({ disabled: true }); | |
3709 | $('#w1_name').jqxDropDownList({ disabled: true }); | |
3710 | $('#w2_name').jqxDropDownList({ disabled: true }); | |
3711 | $('#w2_amount').jqxNumberInput({ readOnly: true }); | |
3712 | $('#pr_name').jqxDropDownList({ disabled: true }); | |
3713 | $('#wa_cacl2').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3714 | $('#wa_caso4').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3715 | $('#wa_mgso4').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3716 | $('#wa_nacl').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3717 | $('#mash_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3718 | $('#calc_acid').jqxCheckBox({ disabled: true }); | |
3719 | $('#wa_base_name').jqxDropDownList({ disabled: true }); | |
3720 | $('#wa_base').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3721 | $('#wa_acid_name').jqxDropDownList({ disabled: true }); | |
3722 | $('#wa_acid').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3723 | $('#wa_acid_perc').jqxNumberInput({ spinButtons: false, readOnly: true, width: 70 }); | |
3724 | $('#sparge_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3725 | $('#sparge_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3726 | $('#sparge_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3727 | $('#sparge_source').jqxDropDownList({ disabled: true }); | |
3728 | $('#sparge_acid_type').jqxDropDownList({ disabled: true }); | |
3729 | $('#sparge_acid_perc').jqxNumberInput({ spinButtons: false, readOnly: true, width: false }); | |
3730 | $('#starter_type').jqxDropDownList({ disabled: true }); | |
3731 | $('#starter_try').jqxButton({ disabled: true }); | |
3732 | $('#starter_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
3733 | $('#yeast_prod_date').jqxDateTimeInput({ disabled: true }); |
478 | 3734 | } |
3735 | if (dataRecord.stage > 3) { // Primary fermentation done | |
3736 | $('#brew_date_start').jqxDateTimeInput({ disabled: true }); | |
3737 | $('#brew_date_end').jqxDateTimeInput({ disabled: true }); | |
3738 | $('#brew_mash_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3739 | $('#brew_preboil_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3740 | $('#brew_aboil_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3741 | $('#brew_mash_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3742 | $('#brew_preboil_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3743 | $('#brew_aboil_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3744 | $('#brew_preboil_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3745 | $('#brew_aboil_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3746 | $('#brew_whirlpool9').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3747 | $('#brew_cooling_to').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3748 | $('#brew_whirlpool7').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3749 | $('#brew_cooling_method').jqxDropDownList({ disabled: true }); | |
3750 | $('#brew_whirlpool6').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3751 | $('#brew_cooling_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3752 | $('#brew_sparge_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3753 | $('#brew_whirlpool2').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3754 | $('#brew_aeration_type').jqxDropDownList({ disabled: true }); | |
3755 | $('#brew_fermenter_tcloss').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3756 | $('#brew_aeration_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3757 | $('#brew_fermenter_extrawater').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3758 | $('#brew_aeration_speed').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
646
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
3759 | $('#but_pre_boil').jqxButton({ disabled: true }); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
3760 | $('#but_after_boil').jqxButton({ disabled: true }); |
658
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3761 | } else { |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3762 | if (dataRecord.boil_time == 0) { |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3763 | $('#brew_preboil_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3764 | $('#brew_aboil_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3765 | $('#brew_preboil_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3766 | $('#brew_aboil_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3767 | $('#brew_preboil_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3768 | $('#brew_aboil_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3769 | $('#but_pre_boil').jqxButton({ disabled: true }); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3770 | $('#but_after_boil').jqxButton({ disabled: true }); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3771 | } else { |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3772 | $('#brew_preboil_ph').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3773 | $('#brew_aboil_ph').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3774 | $('#brew_preboil_sg').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3775 | $('#brew_aboil_sg').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3776 | $('#brew_preboil_volume').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3777 | $('#brew_aboil_volume').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3778 | $('#but_pre_boil').jqxButton({ disabled: false }); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3779 | $('#but_after_boil').jqxButton({ disabled: false }); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
3780 | } |
478 | 3781 | } |
3782 | if (dataRecord.stage == 5) // Lagering, allow packaging | |
3783 | $('#package_date').jqxDateTimeInput({ disabled: false }); | |
3784 | else | |
3785 | $('#package_date').jqxDateTimeInput({ disabled: true }); | |
3786 | if (dataRecord.stage >= 5) { // At least secondary | |
3787 | $('#primary_start_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3788 | $('#primary_max_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3789 | $('#primary_end_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3790 | $('#primary_end_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3791 | $('#primary_end_brix').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3792 | $('#primary_end_date').jqxDateTimeInput({ disabled: true }); | |
3793 | } | |
3794 | if (dataRecord.stage >= 6) { // Packaged | |
3795 | $('#secondary_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3796 | $('#secondary_end_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3797 | $('#secondary_end_date').jqxDateTimeInput({ disabled: true }); | |
3798 | $('#tertiary_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3799 | $('#fg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3800 | $('#final_brix').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3801 | $('#package_date').jqxDateTimeInput({ disabled: true }); | |
3802 | $('#package_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3803 | $('#package_infuse_amount').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3804 | $('#package_infuse_abv').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3805 | $('#package_infuse_notes').jqxInput({ disabled: true }); | |
3806 | $('#package_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3807 | $('#bottle_amount').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3808 | $('#bottle_priming_water').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3809 | $('#keg_priming_water').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3810 | $('#keg_amount').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3811 | $('#bottle_carbonation').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3812 | $('#keg_carbonation').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3813 | $('#bottle_priming_sugar').jqxDropDownList({ disabled: true }); | |
3814 | $('#keg_priming_sugar').jqxDropDownList({ disabled: true }); | |
3815 | $('#keg_forced_carb').jqxCheckBox({ disabled: true }); | |
3816 | $('#bottle_carbonation_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3817 | $('#keg_carbonation_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3818 | } | |
3819 | if (dataRecord.stage < 8) { // Taste when at least Mature. | |
3820 | $('#jqxTabs').jqxTabs('disableAt', 11); // Tasting tab | |
3821 | } else { | |
3822 | $('#jqxTabs').jqxTabs('enableAt', 11); | |
3823 | } | |
3824 | ||
3825 | if (dataRecord.stage == 11) { // Locked | |
3826 | $('#taste_date').jqxDateTimeInput({ disabled: true }); | |
3827 | $('#taste_rate').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3828 | $('#taste_color').jqxInput({ disabled: true }); | |
3829 | $('#taste_transparency').jqxInput({ disabled: true }); | |
3830 | $('#taste_head').jqxInput({ disabled: true }); | |
3831 | $('#taste_aroma').jqxInput({ disabled: true }); | |
3832 | $('#taste_taste').jqxInput({ disabled: true }); | |
3833 | $('#taste_aftertaste').jqxInput({ disabled: true }); | |
3834 | $('#taste_mouthfeel').jqxInput({ disabled: true }); | |
3835 | $('#taste_notes').jqxInput({ disabled: true }); | |
3836 | $('#notes').jqxInput({ disabled: true }); | |
3837 | } else { | |
3838 | $('#notes').jqxInput({ disabled: false }); | |
3839 | } | |
3840 | } | |
3841 | ||
3842 | function showStarter() { | |
3843 | ||
3844 | if (dataRecord.starter_enable) { | |
3845 | $('#propagator').show(); | |
3846 | $('#starter_type').jqxDropDownList({ disabled: false }); | |
3847 | $('#starter_try').jqxButton({ disabled: false }); | |
3848 | $('#starter_sg').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); | |
3849 | } else { | |
3850 | $('#propagator').hide(); | |
3851 | $('#starter_type').jqxDropDownList({ disabled: true }); | |
3852 | $('#starter_try').jqxButton({ disabled: true }); | |
3853 | $('#starter_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
3854 | } | |
3855 | } | |
3856 | ||
3857 | function calcInit() { | |
3858 | ||
3859 | calcMashEfficiency(); | |
3860 | calcEfficiencyBeforeBoil(); | |
3861 | calcEfficiencyAfterBoil(); | |
3862 | ||
3863 | $('#starter_try').click(function() { | |
642
9d1af81b20ef
Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
641
diff
changeset
|
3864 | $('#prop1_volume').val(0); |
9d1af81b20ef
Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
641
diff
changeset
|
3865 | $('#prop2_volume').val(0); |
9d1af81b20ef
Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
641
diff
changeset
|
3866 | $('#prop3_volume').val(0); |
9d1af81b20ef
Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
641
diff
changeset
|
3867 | $('#prop4_volume').val(0); |
9d1af81b20ef
Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
641
diff
changeset
|
3868 | dataRecord.prop1_volume = dataRecord.prop2_volume = dataRecord.prop3_volume = dataRecord.prop4_volume = 0; |
478 | 3869 | calcYeast(); |
3870 | }); | |
649
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
3871 | $('#starter_type').on('change', function(event) { |
478 | 3872 | if (event.args) { |
3873 | dataRecord.starter_type = event.args.index; | |
3874 | calcYeast(); | |
3875 | } | |
3876 | }); | |
3877 | $('#starter_sg').on('change', function(event) { | |
3878 | if (event.args) { | |
3879 | dataRecord.starter_sg = event.args.value; | |
3880 | calcYeast(); | |
3881 | } | |
3882 | }); | |
649
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
3883 | $('#prop1_type').on('change', function(event) { |
478 | 3884 | if (event.args) { |
3885 | dataRecord.prop1_type = event.args.index; | |
3886 | calcYeast(); | |
3887 | } | |
3888 | }); | |
3889 | $('#prop1_volume').on('change', function(event) { | |
3890 | if (event.args) { | |
3891 | dataRecord.prop1_volume = event.args.value; | |
3892 | calcYeast(); | |
3893 | } | |
3894 | }); | |
649
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
3895 | $('#prop2_type').on('change', function(event) { |
478 | 3896 | if (event.args) { |
3897 | dataRecord.prop2_type = event.args.index; | |
3898 | calcYeast(); | |
3899 | } | |
3900 | }); | |
3901 | $('#prop2_volume').on('change', function(event) { | |
3902 | if (event.args) { | |
3903 | dataRecord.prop2_volume = event.args.value; | |
3904 | calcYeast(); | |
3905 | } | |
3906 | }); | |
649
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
3907 | $('#prop3_type').on('change', function(event) { |
478 | 3908 | if (event.args) { |
3909 | dataRecord.prop3_type = event.args.index; | |
3910 | calcYeast(); | |
3911 | } | |
3912 | }); | |
3913 | $('#prop3_volume').on('change', function(event) { | |
3914 | if (event.args) { | |
3915 | dataRecord.prop3_volume = event.args.value; | |
3916 | calcYeast(); | |
3917 | } | |
3918 | }); | |
649
52053730f6e1
Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents:
648
diff
changeset
|
3919 | $('#prop4_type').on('change', function(event) { |
478 | 3920 | if (event.args) { |
3921 | dataRecord.prop4_type = event.args.index; | |
3922 | calcYeast(); | |
3923 | } | |
3924 | }); | |
3925 | $('#prop4_volume').on('change', function(event) { | |
3926 | if (event.args) { | |
3927 | dataRecord.prop4_volume = event.args.value; | |
3928 | calcYeast(); | |
3929 | } | |
3930 | }); | |
3931 | ||
3932 | $('#calc_acid').on('checked', function(event) { | |
3933 | dataRecord.calc_acid = 1; | |
3934 | calcWater(); | |
3935 | }); | |
3936 | $('#calc_acid').on('unchecked', function(event) { | |
3937 | dataRecord.calc_acid = 0; | |
3938 | calcWater(); | |
3939 | }); | |
3940 | $('#w1_name').jqxDropDownList('selectItem', dataRecord.w1_name); | |
3941 | $('#w2_name').jqxDropDownList('selectItem', dataRecord.w2_name); | |
3942 | // Fix tap water if zero using mash infuse amount. | |
3943 | if (parseFloat($('#w1_amount').jqxNumberInput('decimal')) == 0 && mash_infuse > 0) { | |
3944 | $('#w1_amount').val(mash_infuse); | |
3945 | dataRecord.w1_amount = mash_infuse; | |
3946 | $('#wg_amount').val(mash_infuse); | |
3947 | $('#w2_amount').val(0); | |
3948 | dataRecord.w2_amount = 0; | |
3949 | } | |
3950 | calcWater(); | |
3951 | $('#w2_amount').on('change', function(event) { | |
3952 | var newval = parseFloat(event.args.value); | |
3953 | ||
3954 | if (newval > mash_infuse) { | |
3955 | $('#w2_amount').val(dataRecord.w2_amount); | |
3956 | return; | |
3957 | } | |
3958 | dataRecord.w1_amount = parseFloat($('#wg_amount').jqxNumberInput('decimal')) - newval; | |
3959 | $('#w1_amount').val(dataRecord.w1_amount); | |
3960 | dataRecord.w2_amount = newval; | |
3961 | console.log('new: ' + event.args.value + ' w1: ' + dataRecord.w1_amount + ' w2: ' + dataRecord.w2_amount); | |
3962 | calcWater(); | |
3963 | }); | |
3964 | $('#wa_cacl2').on('change', function(event) { | |
3965 | if (event.args) { | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
3966 | setWaterAgent('CaCl2', 0); // This prevents double entries. |
478 | 3967 | setWaterAgent('CaCl2', event.args.value); |
3968 | calcWater(); | |
3969 | } | |
3970 | }); | |
3971 | $('#wa_caso4').on('change', function(event) { | |
3972 | if (event.args) { | |
3973 | setWaterAgent('CaSO4', 0); | |
3974 | setWaterAgent('CaSO4', event.args.value); | |
3975 | calcWater(); | |
3976 | } | |
3977 | }); | |
3978 | $('#wa_mgso4').on('change', function(event) { | |
3979 | if (event.args) { | |
3980 | setWaterAgent('MgSO4', 0); | |
3981 | setWaterAgent('MgSO4', event.args.value); | |
3982 | calcWater(); | |
3983 | } | |
3984 | }); | |
3985 | $('#wa_nacl').on('change', function(event) { | |
3986 | if (event.args) { | |
3987 | setWaterAgent('NaCl', 0); | |
3988 | setWaterAgent('NaCl', event.args.value); | |
3989 | calcWater(); | |
3990 | } | |
3991 | }); | |
642
9d1af81b20ef
Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
641
diff
changeset
|
3992 | $('#wa_base_name').on('select', function(event) { |
478 | 3993 | if (event.args) { |
3994 | var index = event.args.index; | |
3995 | console.log('wa_base_name ' + index); | |
3996 | setWaterAgent(last_base, 0); | |
3997 | last_base = BaseTypeData[index].nl; | |
3998 | setWaterAgent(last_base, parseFloat($('#wa_base').jqxNumberInput('decimal'))); | |
3999 | dataRecord.wa_base_name = index; | |
4000 | calcWater(); | |
4001 | } | |
4002 | }); | |
4003 | $('#wa_base').on('change', function(event) { | |
4004 | var name = BaseTypeData[$('#wa_base_name').val()].nl; | |
4005 | setWaterAgent(name, parseFloat(event.args.value)); | |
4006 | calcWater(); | |
4007 | }); | |
642
9d1af81b20ef
Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
641
diff
changeset
|
4008 | $('#wa_acid_name').on('select', function(event) { |
478 | 4009 | if (event.args) { |
4010 | var index = event.args.index; | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
4011 | console.log('wa_acid_name ' + index + ' last_acid: ' + last_acid); |
478 | 4012 | setWaterAgent(last_acid, 0); |
4013 | last_acid = AcidTypeData[index].nl; | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
4014 | dataRecord.wa_acid_name = index; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
4015 | dataRecord.wa_acid_perc = AcidTypeData[index].AcidPrc; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
4016 | $('#wa_acid_perc').val(dataRecord.wa_acid_perc); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
4017 | calcWater(); |
478 | 4018 | setWaterAgent(last_acid, parseFloat($('#wa_acid').jqxNumberInput('decimal'))); |
4019 | } | |
4020 | }); | |
4021 | $('#wa_acid').on('change', function(event) { | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
4022 | var name = AcidTypeData[dataRecord.wa_acid_name].nl; |
478 | 4023 | setWaterAgent(name, parseFloat(event.args.value)); |
4024 | calcWater(); | |
4025 | }); | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
4026 | $('#wa_acid_perc').on('change', function(event) { |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
4027 | dataRecord.wa_acid_perc = parseFloat(event.args.value); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
4028 | calcWater(); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
4029 | }); |
478 | 4030 | |
642
9d1af81b20ef
Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
641
diff
changeset
|
4031 | $('#color_method').on('select', function(event) { |
478 | 4032 | dataRecord.color_method = event.args.index; |
4033 | calcFermentables(); | |
4034 | }); | |
642
9d1af81b20ef
Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
641
diff
changeset
|
4035 | $('#ibu_method').on('select', function(event) { |
478 | 4036 | dataRecord.ibu_method = event.args.index; |
4037 | calcFermentables(); | |
4038 | calcIBUs(); | |
4039 | }); | |
4040 | ||
4041 | $('#batch_size').on('change', function(event) { | |
4042 | console.log('batch_size change:' + event.args.value + ' old:' + dataRecord.batch_size); | |
4043 | $('#est_a_vol').val(event.args.value * 1.04); | |
660
0e9a725354ac
Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents:
658
diff
changeset
|
4044 | var evap = parseFloat($('#eq_evap_rate').jqxNumberInput('decimal')) * dataRecord.boil_time / 60; |
0e9a725354ac
Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents:
658
diff
changeset
|
4045 | dataRecord.boil_size = parseFloat(event.args.value) + evap; |
0e9a725354ac
Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents:
658
diff
changeset
|
4046 | var factor = parseFloat(event.args.value) / dataRecord.batch_size; |
0e9a725354ac
Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents:
658
diff
changeset
|
4047 | $('#boil_size').val(Round(dataRecord.boil_size, 2)); |
0e9a725354ac
Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents:
658
diff
changeset
|
4048 | $('#est_pre_vol').val(Round(dataRecord.boil_size * 1.04, 2)); |
478 | 4049 | dataRecord.sparge_volume *= factor; |
4050 | $('#sparge_volume').val(dataRecord.sparge_volume); | |
4051 | $('#brew_sparge_volume').val(dataRecord.sparge_volume); | |
4052 | dataRecord.batch_size = parseFloat(event.args.value); | |
4053 | calcFermentablesFromOG(parseFloat($('#est_og').jqxNumberInput('decimal'))); // Keep the OG | |
4054 | adjustWaters(factor); | |
4055 | calcFermentables(); | |
4056 | adjustHops(factor); | |
4057 | adjustMiscs(factor); | |
4058 | adjustYeasts(factor); | |
4059 | calcIBUs(); | |
4060 | calcWater(); | |
4061 | calcSparge(); | |
4062 | calcMash(); | |
4063 | }); | |
4064 | $('#boil_time').on('change', function(event) { | |
660
0e9a725354ac
Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents:
658
diff
changeset
|
4065 | var new_time, old_time, new_evap; |
658
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
4066 | old_time = parseFloat(dataRecord.boil_time); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
4067 | new_time = parseFloat(event.args.value); |
660
0e9a725354ac
Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents:
658
diff
changeset
|
4068 | console.log('boil_time change:' + new_time + ' old:' + old_time); |
0e9a725354ac
Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents:
658
diff
changeset
|
4069 | new_evap = parseFloat($('#eq_evap_rate').jqxNumberInput('decimal')) * new_time / 60; |
0e9a725354ac
Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents:
658
diff
changeset
|
4070 | dataRecord.boil_size = parseFloat(dataRecord.batch_size) + new_evap; |
0e9a725354ac
Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents:
658
diff
changeset
|
4071 | dataRecord.boil_time = new_time; |
0e9a725354ac
Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents:
658
diff
changeset
|
4072 | $('#est_pre_vol').val(Round(dataRecord.boil_size * 1.04, 2)); |
0e9a725354ac
Fixed bugs in calculation of boil volume/batch or boiltime changes.
Michiel Broek <mbroek@mbse.eu>
parents:
658
diff
changeset
|
4073 | $('#boil_size').val(Round(dataRecord.boil_size, 2)); |
478 | 4074 | calcFermentables(); |
4075 | calcIBUs(); | |
4076 | calcYeast(); | |
658
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
4077 | calcStage(); |
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
4078 | kookTijd(); |
478 | 4079 | }); |
4080 | $('#efficiency').on('change', function(event) { | |
4081 | var estog = parseFloat($('#est_og').jqxNumberInput('decimal')); | |
4082 | dataRecord.efficiency = parseFloat(event.args.value); | |
4083 | console.log('efficiency change:' + dataRecord.efficiency + ' est_og:' + estog); | |
4084 | calcFermentablesFromOG(estog); // Keep the OG | |
4085 | calcFermentables(); | |
4086 | calcIBUs(); | |
4087 | calcYeast(); | |
4088 | }); | |
4089 | $('#est_og').on('change', function(event) { | |
4090 | dataRecord.est_og = parseFloat(event.args.value); | |
4091 | console.log('est_og change:' + dataRecord.est_og); | |
4092 | $('#est_og2').val(dataRecord.est_og); | |
4093 | calcFermentablesFromOG(dataRecord.est_og); // Adjust fermentables amounts | |
4094 | calcFermentables(); // Update the recipe details | |
4095 | calcIBUs(); // and the IBU's. | |
4096 | calcMash(); | |
4097 | calcYeast(); | |
4098 | }); | |
4099 | $('#mash_ph').on('change', function(event) { | |
4100 | dataRecord.mash_ph = parseFloat(event.args.value); | |
4101 | calcWater(); | |
4102 | }); | |
4103 | ||
4104 | $('#sparge_ph').on('change', function(event) { | |
4105 | dataRecord.sparge_ph = parseFloat(event.args.value); | |
4106 | calcSparge(); | |
4107 | }); | |
4108 | $('#sparge_volume').on('change', function(event) { | |
4109 | dataRecord.sparge_volume = parseFloat(event.args.value); | |
4110 | $('#brew_sparge_volume').val(dataRecord.sparge_volume); | |
4111 | calcSparge(); | |
4112 | }); | |
4113 | $('#sparge_temp').on('change', function(event) { | |
4114 | dataRecord.sparge_temp = parseFloat(event.args.value); | |
4115 | $('#brew_sparge_temperature').val(dataRecord.sparge_temp); | |
4116 | }); | |
642
9d1af81b20ef
Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
641
diff
changeset
|
4117 | $('#sparge_source').on('select', function(event) { |
478 | 4118 | if (event.args) { |
4119 | dataRecord.sparge_source = event.args.index; | |
4120 | calcSparge(); | |
4121 | } | |
4122 | }); | |
642
9d1af81b20ef
Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents:
641
diff
changeset
|
4123 | $('#sparge_acid_type').on('select', function(event) { |
478 | 4124 | if (event.args) { |
4125 | dataRecord.sparge_acid_type = event.args.index; | |
4126 | console.log('new sparge_acid_type: ' + dataRecord.sparge_acid_type); | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
4127 | dataRecord.sparge_acid_perc = AcidTypeData[event.args.index].AcidPrc; |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
4128 | $('#sparge_acid_perc').val(dataRecord.sparge_acid_perc); |
478 | 4129 | calcSparge(); |
4130 | } | |
4131 | }); | |
4132 | $('#sparge_acid_perc').on('change', function(event) { | |
4133 | dataRecord.sparge_acid_perc = parseFloat(event.args.value); | |
4134 | calcSparge(); | |
4135 | }); | |
4136 | ||
4137 | calcFermentation(); | |
4138 | calcCarbonation(); | |
4139 | $('#package_volume').on('change', function(event) { | |
4140 | var diff, tnew, told = dataRecord.package_volume + dataRecord.package_infuse_amount; | |
4141 | dataRecord.package_volume = parseFloat(event.args.value); | |
4142 | if (dataRecord.package_volume > dataRecord.brew_fermenter_volume) { | |
4143 | dataRecord.package_volume = dataRecord.brew_fermenter_volume; | |
4144 | $('#package_volume').val(dataRecord.package_volume); | |
4145 | } | |
4146 | tnew = dataRecord.package_volume + dataRecord.package_infuse_amount; | |
613
26a7a04acef3
Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents:
612
diff
changeset
|
4147 | diff = Round(tnew - told, 3); |
478 | 4148 | if (told > 0) { |
613
26a7a04acef3
Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents:
612
diff
changeset
|
4149 | dataRecord.bottle_amount = Round(dataRecord.bottle_amount + ((dataRecord.bottle_amount / told) * diff), 3); |
26a7a04acef3
Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents:
612
diff
changeset
|
4150 | dataRecord.keg_amount = Round(dataRecord.keg_amount + ((dataRecord.keg_amount / told) * diff), 3); |
478 | 4151 | } else { |
4152 | dataRecord.bottle_amount = tnew; | |
4153 | dataRecord.keg_amount = 0; | |
4154 | } | |
613
26a7a04acef3
Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents:
612
diff
changeset
|
4155 | $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount)); |
26a7a04acef3
Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents:
612
diff
changeset
|
4156 | $('#keg_amount').val(parseFloat(dataRecord.keg_amount)); |
478 | 4157 | calcCarbonation(); |
4158 | }); | |
4159 | $('#package_infuse_amount').on('change', function(event) { | |
4160 | var diff, tnew, told = dataRecord.package_volume + dataRecord.package_infuse_amount; | |
4161 | dataRecord.package_infuse_amount = parseFloat(event.args.value); | |
4162 | tnew = dataRecord.package_volume + dataRecord.package_infuse_amount; | |
613
26a7a04acef3
Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents:
612
diff
changeset
|
4163 | diff = Round(tnew - told, 3); |
478 | 4164 | if (told > 0) { |
613
26a7a04acef3
Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents:
612
diff
changeset
|
4165 | dataRecord.bottle_amount = Round(dataRecord.bottle_amount + ((dataRecord.bottle_amount / told) * diff), 3); |
26a7a04acef3
Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents:
612
diff
changeset
|
4166 | dataRecord.keg_amount = Round(dataRecord.keg_amount + ((dataRecord.keg_amount / told) * diff), 3); |
478 | 4167 | } else { |
4168 | dataRecord.bottle_amount = tnew; | |
4169 | dataRecord.keg_amount = 0; | |
4170 | } | |
613
26a7a04acef3
Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents:
612
diff
changeset
|
4171 | $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount)); |
26a7a04acef3
Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents:
612
diff
changeset
|
4172 | $('#keg_amount').val(parseFloat(dataRecord.keg_amount)); |
478 | 4173 | calcCarbonation(); |
4174 | }); | |
4175 | $('#package_infuse_abv').on('change', function(event) { | |
4176 | dataRecord.package_infuse_abv = parseFloat(event.args.value); | |
4177 | calcCarbonation(); | |
4178 | }); | |
4179 | $('#bottle_amount').on('change', function(event) { | |
613
26a7a04acef3
Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents:
612
diff
changeset
|
4180 | var vtot, vnew = parseFloat(event.args.value); |
26a7a04acef3
Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents:
612
diff
changeset
|
4181 | vtot = Round(dataRecord.package_volume + dataRecord.package_infuse_amount - dataRecord.keg_amount, 3); |
478 | 4182 | if (vnew > vtot) |
4183 | vnew = vtot; | |
613
26a7a04acef3
Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents:
612
diff
changeset
|
4184 | dataRecord.bottle_amount = Round(vnew, 3); |
478 | 4185 | $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount)); |
613
26a7a04acef3
Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents:
612
diff
changeset
|
4186 | console.log('vtot:' + vtot + ' vnew:' + vnew + ' bottle:' + dataRecord.bottle_amount + ' keg:' + dataRecord.keg_amount); |
478 | 4187 | calcCarbonation(); |
4188 | }); | |
4189 | $('#bottle_priming_water').on('change', function(event) { | |
4190 | dataRecord.bottle_priming_water = parseFloat(event.args.value); | |
4191 | calcCarbonation(); | |
4192 | }); | |
4193 | $('#keg_amount').on('change', function(event) { | |
613
26a7a04acef3
Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents:
612
diff
changeset
|
4194 | var vtot, vnew = parseFloat(event.args.value); |
26a7a04acef3
Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents:
612
diff
changeset
|
4195 | vtot = Round(dataRecord.package_volume + dataRecord.package_infuse_amount - dataRecord.bottle_amount, 3); |
478 | 4196 | if (vnew > vtot) |
4197 | vnew = vtot; | |
613
26a7a04acef3
Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents:
612
diff
changeset
|
4198 | dataRecord.keg_amount = Round(vnew, 3); |
478 | 4199 | $('#keg_amount').val(parseFloat(dataRecord.keg_amount)); |
613
26a7a04acef3
Fixed package bottles and kegs amount settings.
Michiel Broek <mbroek@mbse.eu>
parents:
612
diff
changeset
|
4200 | console.log('vtot:' + vtot + ' vnew:' + vnew + ' bottle:' + dataRecord.bottle_amount + ' keg:' + dataRecord.keg_amount); |
478 | 4201 | calcCarbonation(); |
4202 | }); | |
4203 | $('#keg_priming_water').on('change', function(event) { | |
4204 | dataRecord.keg_priming_water = parseFloat(event.args.value); | |
4205 | calcCarbonation(); | |
4206 | }); | |
4207 | $('#bottle_carbonation').on('change', function(event) { | |
4208 | dataRecord.bottle_carbonation = parseFloat(event.args.value); | |
4209 | calcCarbonation(); | |
4210 | }); | |
4211 | $('#bottle_carbonation_temp').on('change', function(event) { | |
4212 | dataRecord.bottle_carbonation_temp = parseFloat(event.args.value); | |
4213 | calcCarbonation(); | |
4214 | }); | |
4215 | $('#keg_carbonation').on('change', function(event) { | |
4216 | dataRecord.keg_carbonation = parseFloat(event.args.value); | |
4217 | calcCarbonation(); | |
4218 | }); | |
4219 | $('#keg_forced_carb').on('checked', function(event) { | |
4220 | dataRecord.keg_forced_carb = 1; | |
4221 | calcCarbonation(); | |
4222 | }); | |
4223 | $('#keg_forced_carb').on('unchecked', function(event) { | |
4224 | dataRecord.keg_forced_carb = 0; | |
4225 | calcCarbonation(); | |
4226 | }); | |
4227 | $('#keg_carbonation_temp').on('change', function(event) { | |
4228 | dataRecord.keg_carbonation_temp = parseFloat(event.args.value); | |
4229 | calcCarbonation(); | |
4230 | }); | |
4231 | ||
4232 | $('#brew_fermenter_extrawater').on('change', function(event) { | |
4233 | dataRecord.brew_fermenter_extrawater = parseFloat(event.args.value); | |
4234 | calcFermentables(); | |
4235 | calcIBUs(); | |
4236 | calcYeast(); | |
4237 | }); | |
4238 | $('#brew_fermenter_tcloss').on('change', function(event) { | |
4239 | dataRecord.brew_fermenter_tcloss = parseFloat(event.args.value); | |
4240 | calcFermentables(); | |
4241 | calcIBUs(); | |
4242 | calcYeast(); | |
4243 | }); | |
4244 | $('#primary_end_sg').on('change', function(event) { | |
4245 | dataRecord.primary_end_sg = parseFloat(event.args.value); | |
4246 | calcFermentation(); | |
4247 | }); | |
4248 | $('#primary_end_brix').on('change', function(event) { | |
4249 | var OBrix, FBrix, FG; | |
4250 | if (dataRecord.brew_fermenter_sg >= 1.020) { | |
4251 | OBrix = sg_to_brix(dataRecord.brew_fermenter_sg); | |
4252 | FBrix = parseFloat(event.args.value); | |
561
dc618b8a9552
Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents:
560
diff
changeset
|
4253 | FG = brix_to_fg(OBrix, FBrix); |
478 | 4254 | if (FBrix > 0.05) { |
561
dc618b8a9552
Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents:
560
diff
changeset
|
4255 | $('#primary_end_sg').val(FG); |
dc618b8a9552
Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents:
560
diff
changeset
|
4256 | dataRecord.primary_end_sg = FG; |
478 | 4257 | } |
4258 | calcFermentation(); | |
4259 | } | |
4260 | }); | |
4261 | $('#secondary_end_sg').on('change', function(event) { | |
4262 | dataRecord.secondary_end_sg = parseFloat(event.args.value); | |
4263 | calcFermentation(); | |
4264 | }); | |
4265 | $('#secondary_end_brix').on('change', function(event) { | |
4266 | var OBrix, FBrix, FG; | |
4267 | if (dataRecord.brew_fermenter_sg >= 1.020) { | |
4268 | OBrix = sg_to_brix(dataRecord.brew_fermenter_sg); | |
4269 | FBrix = parseFloat(event.args.value); | |
561
dc618b8a9552
Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents:
560
diff
changeset
|
4270 | FG = brix_to_fg(OBrix, FBrix); |
478 | 4271 | if (FBrix > 0.05) { |
561
dc618b8a9552
Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents:
560
diff
changeset
|
4272 | $('#secondary_end_sg').val(FG); |
dc618b8a9552
Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents:
560
diff
changeset
|
4273 | dataRecord.secondary_end_sg = FG; |
478 | 4274 | } |
4275 | calcFermentation(); | |
4276 | } | |
4277 | }); | |
4278 | $('#final_brix').on('change', function(event) { | |
4279 | var OBrix, FBrix, FG; | |
4280 | if (dataRecord.brew_fermenter_sg >= 1.020) { | |
560
850e82c1021d
Switched FG calculations from Brix to the new cubic method from http://seanterrill.com. This includes the brix correction factor and seems better then the Brouwhulp formula.
Michiel Broek <mbroek@mbse.eu>
parents:
559
diff
changeset
|
4281 | OBrix = sg_to_brix(dataRecord.brew_fermenter_sg); |
850e82c1021d
Switched FG calculations from Brix to the new cubic method from http://seanterrill.com. This includes the brix correction factor and seems better then the Brouwhulp formula.
Michiel Broek <mbroek@mbse.eu>
parents:
559
diff
changeset
|
4282 | FBrix = parseFloat(event.args.value); |
561
dc618b8a9552
Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents:
560
diff
changeset
|
4283 | FG = brix_to_fg(OBrix, FBrix); |
560
850e82c1021d
Switched FG calculations from Brix to the new cubic method from http://seanterrill.com. This includes the brix correction factor and seems better then the Brouwhulp formula.
Michiel Broek <mbroek@mbse.eu>
parents:
559
diff
changeset
|
4284 | if (FBrix > 0.05) { |
561
dc618b8a9552
Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents:
560
diff
changeset
|
4285 | $('#fg').val(FG); |
dc618b8a9552
Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents:
560
diff
changeset
|
4286 | dataRecord.fg = FG; |
478 | 4287 | } |
4288 | calcFermentation(); | |
4289 | } | |
4290 | }); | |
4291 | $('#fg').on('change', function(event) { | |
4292 | dataRecord.fg = parseFloat(event.args.value); | |
4293 | calcFermentation(); | |
4294 | }); | |
538
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
4295 | $('#brew_whirlpool9').on('valueChanged', function(event) { |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
4296 | dataRecord.brew_whirlpool9 = event.args.value; |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
4297 | whirlpoolHops(); |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
4298 | calcIBUs(); |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
4299 | }); |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
4300 | $('#brew_whirlpool7').on('valueChanged', function(event) { |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
4301 | dataRecord.brew_whirlpool7 = event.args.value; |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
4302 | whirlpoolHops(); |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
4303 | calcIBUs(); |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
4304 | }); |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
4305 | $('#brew_whirlpool6').on('valueChanged', function(event) { |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
4306 | dataRecord.brew_whirlpool6 = event.args.value; |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
4307 | whirlpoolHops(); |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
4308 | calcIBUs(); |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
4309 | }); |
478 | 4310 | $('#BLog').jqxButton({ disabled: (dataRecord.log_brew) ? false : true}); |
4311 | $('#FLog').jqxButton({ disabled: (dataRecord.log_fermentation) ? false : true}); | |
602
10b61aacb1c1
New products field log_ispindel. Add check for ispindel log to crontasks.php Added log_ispindel to prod_edit, pprod_divide, prod_new and prod_duplicate. Renamed some log_fermentation vergisting names into klimaatkast.
Michiel Broek <mbroek@mbse.eu>
parents:
586
diff
changeset
|
4312 | $('#ILog').jqxButton({ disabled: (dataRecord.log_ispindel) ? false : true}); |
615
9034e65b0d7a
Added CO2 carbonation log to the products database. Added button in the packaging tab.
Michiel Broek <mbroek@mbse.eu>
parents:
613
diff
changeset
|
4313 | $('#CLog').jqxButton({ disabled: (dataRecord.log_co2pressure) ? false : true}); |
478 | 4314 | } |
4315 | ||
4316 | $('#styleSelect').jqxDropDownList({ | |
4317 | placeHolder: 'Kies bierstijl:', | |
4318 | theme: theme, | |
4319 | source: styleslist, | |
4320 | displayMember: 'name', | |
4321 | width: 180, | |
4322 | height: 23, | |
4323 | dropDownVerticalAlignment: 'top', | |
4324 | dropDownWidth: 500, | |
4325 | dropDownHeight: 380, | |
4326 | renderer: function(index, label, value) { | |
4327 | var datarecord = styleslist.records[index]; | |
4328 | return datarecord.style_guide + ' ' + datarecord.style_letter + ' ' + datarecord.name; | |
4329 | } | |
4330 | }); | |
4331 | $('#styleSelect').on('select', function(event) { | |
4332 | if (event.args) { | |
4333 | var datarecord, index = event.args.index; | |
4334 | datarecord = styleslist.records[index]; | |
4335 | $('#st_name').val(datarecord.name); | |
4336 | $('#st_category').val(datarecord.category); | |
4337 | $('#st_category_number').val(datarecord.category_number); | |
4338 | $('#st_letter').val(datarecord.style_letter); | |
4339 | $('#st_guide').val(datarecord.style_guide); | |
4340 | $('#st_type').val(StyleTypeData[datarecord.type].nl); | |
4341 | $('#st_og_min').val(datarecord.og_min); | |
4342 | $('#st_og_max').val(datarecord.og_max); | |
4343 | $('#st_fg_min').val(datarecord.fg_min); | |
4344 | $('#st_fg_max').val(datarecord.fg_max); | |
4345 | $('#st_ibu_min').val(datarecord.ibu_min); | |
4346 | $('#st_ibu_max').val(datarecord.ibu_max); | |
4347 | $('#st_color_min').val(datarecord.color_min); | |
4348 | $('#st_color_max').val(datarecord.color_max); | |
4349 | $('#st_carb_min').val(datarecord.carb_min); | |
4350 | $('#st_carb_min2').val(datarecord.carb_min); | |
4351 | $('#st_carb_max').val(datarecord.carb_max); | |
4352 | $('#st_carb_max2').val(datarecord.carb_max); | |
4353 | $('#st_abv_min').val(datarecord.abv_min); | |
4354 | $('#st_abv_max').val(datarecord.abv_max); | |
4355 | } | |
4356 | }); | |
4357 | ||
4358 | // Equipemnt dropdown list | |
4359 | $('#equipmentSelect').jqxDropDownList({ | |
4360 | placeHolder: 'Kies apparatuur:', | |
4361 | theme: theme, | |
4362 | source: equipmentlist, | |
4363 | displayMember: 'name', | |
4364 | width: 170, | |
4365 | height: 23, | |
4366 | dropDownWidth: 300, | |
4367 | renderer: function(index, label, value) { | |
4368 | var datarecord = equipmentlist.records[index]; | |
4369 | return datarecord.batch_size + ' liter ' + datarecord.name; | |
4370 | } | |
4371 | }); | |
4372 | $('#equipmentSelect').on('select', function(event) { | |
4373 | if (event.args) { | |
4374 | var datarecord, factor, index = event.args.index; | |
4375 | datarecord = equipmentlist.records[index]; | |
4376 | factor = datarecord.batch_size / dataRecord.batch_size; | |
4377 | $('#eq_name').val(datarecord.name); | |
4378 | $('#eq_boil_size').val(datarecord.boil_size); | |
4379 | dataRecord.boil_size = datarecord.boil_size; | |
4380 | $('#boil_size').val(datarecord.boil_size); | |
4381 | $('#eq_batch_size').val(datarecord.batch_size); | |
4382 | dataRecord.batch_size = datarecord.batch_size; | |
4383 | $('#batch_size').val(datarecord.batch_size); | |
4384 | $('#est_a_vol').val(datarecord.batch_size * 1.04); | |
4385 | $('#eq_tun_volume').val(datarecord.tun_volume); | |
4386 | dataRecord.eq_tun_weight = datarecord.tun_weight; | |
4387 | dataRecord.eq_tun_specific_heat = datarecord.tun_specific_heat; | |
4388 | dataRecord.eq_tun_material = datarecord.tun_material; | |
4389 | dataRecord.eq_tun_height = datarecord.tun_height / 100.0; | |
4390 | $('#eq_top_up_water').val(datarecord.top_up_water); | |
4391 | dataRecord.eq_trub_chiller_loss = datarecord.trub_chiller_loss; | |
4392 | $('#eq_trub_chiller_loss').val(datarecord.trub_chiller_loss); | |
4393 | $('#eq_evap_rate').val(datarecord.evap_rate); | |
4394 | $('#eq_boil_time').val(datarecord.boil_time); | |
4395 | dataRecord.eq_calc_boil_volume = datarecord.calc_boil_volume; | |
4396 | $('#eq_top_up_kettle').val(datarecord.top_up_kettle); | |
4397 | $('#eq_hop_utilization').val(datarecord.hop_utilization); | |
4398 | $('#eq_notes').val(datarecord.notes); | |
4399 | $('#eq_lauter_volume').val(datarecord.lauter_volume); | |
4400 | dataRecord.eq_lauter_height = datarecord.lauter_height / 100.0; | |
4401 | $('#eq_lauter_deadspace').val(datarecord.lauter_deadspace); | |
4402 | $('#eq_kettle_volume').val(datarecord.kettle_volume); | |
4403 | dataRecord.eq_kettle_height = datarecord.kettle_height / 100.0; | |
4404 | $('#eq_mash_volume').val(datarecord.mash_volume); | |
4405 | $('#eq_mash_max').val(datarecord.mash_max); | |
4406 | dataRecord.eq_mash_max = datarecord.mash_max; | |
4407 | $('#mash_max').val(datarecord.mash_max); | |
4408 | $('#eq_efficiency').val(datarecord.efficiency); | |
4409 | dataRecord.efficiency = datarecord.efficiency; | |
4410 | $('#efficiency').val(datarecord.efficiency); | |
4411 | ||
4412 | dataRecord.sparge_volume = Math.round(datarecord.boil_size * 5) / 10; | |
4413 | $('#sparge_volume').val(dataRecord.sparge_volume); | |
4414 | $('#brew_sparge_volume').val(dataRecord.sparge_volume); | |
4415 | $('#est_pre_vol').val(datarecord.boil_size * 1.04); | |
4416 | calcFermentablesFromOG(parseFloat($('#est_og').jqxNumberInput('decimal'))); // Keep the OG | |
4417 | adjustWaters(factor); | |
4418 | calcFermentables(); | |
4419 | adjustHops(factor); | |
4420 | adjustMiscs(factor); | |
4421 | adjustYeasts(factor); | |
4422 | calcIBUs(); | |
4423 | calcWater(); | |
4424 | calcSparge(); | |
4425 | } | |
4426 | }); | |
4427 | ||
489
18e5cfe5d126
Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
4428 | function saveRecord(goback) { |
478 | 4429 | var row = { |
4430 | record: my_record, | |
4431 | uuid: dataRecord.uuid, | |
4432 | name: $('#name').val(), | |
4433 | code: $('#code').val(), | |
4434 | birth: $('#birth').val(), | |
4435 | stage: dataRecord.stage, | |
4436 | notes: $('#notes').val(), | |
4437 | log_brew: dataRecord.log_brew, | |
4438 | log_fermentation: dataRecord.log_fermentation, | |
602
10b61aacb1c1
New products field log_ispindel. Add check for ispindel log to crontasks.php Added log_ispindel to prod_edit, pprod_divide, prod_new and prod_duplicate. Renamed some log_fermentation vergisting names into klimaatkast.
Michiel Broek <mbroek@mbse.eu>
parents:
586
diff
changeset
|
4439 | log_ispindel: dataRecord.log_ispindel, |
615
9034e65b0d7a
Added CO2 carbonation log to the products database. Added button in the packaging tab.
Michiel Broek <mbroek@mbse.eu>
parents:
613
diff
changeset
|
4440 | log_co2pressure: dataRecord.log_co2pressure, |
478 | 4441 | inventory_reduced: dataRecord.inventory_reduced, |
4442 | locked: dataRecord.locked, | |
4443 | eq_name: $('#eq_name').val(), | |
4444 | eq_boil_size: parseFloat($('#eq_boil_size').jqxNumberInput('decimal')), | |
4445 | eq_batch_size: parseFloat($('#eq_batch_size').jqxNumberInput('decimal')), | |
4446 | eq_tun_volume: parseFloat($('#eq_tun_volume').jqxNumberInput('decimal')), | |
4447 | eq_tun_weight: dataRecord.eq_tun_weight, | |
4448 | eq_tun_specific_heat: dataRecord.eq_tun_specific_heat, | |
4449 | eq_tun_material: dataRecord.eq_tun_material, | |
4450 | eq_tun_height: dataRecord.eq_tun_height, | |
4451 | eq_top_up_water: parseFloat($('#eq_top_up_water').jqxNumberInput('decimal')), | |
4452 | eq_trub_chiller_loss: parseFloat($('#eq_trub_chiller_loss').jqxNumberInput('decimal')), | |
4453 | eq_evap_rate: parseFloat($('#eq_evap_rate').jqxNumberInput('decimal')), | |
4454 | eq_boil_time: parseFloat($('#eq_boil_time').jqxNumberInput('decimal')), | |
4455 | eq_calc_boil_volume: dataRecord.eq_calc_boil_volume, | |
4456 | eq_top_up_kettle: parseFloat($('#eq_top_up_kettle').jqxNumberInput('decimal')), | |
4457 | eq_hop_utilization: parseFloat($('#eq_hop_utilization').jqxNumberInput('decimal')), | |
4458 | eq_notes: $('#eq_notes').val(), | |
4459 | eq_lauter_volume: parseFloat($('#eq_lauter_volume').jqxNumberInput('decimal')), | |
4460 | eq_lauter_height: dataRecord.eq_lauter_height, | |
4461 | eq_lauter_deadspace: parseFloat($('#eq_lauter_deadspace').jqxNumberInput('decimal')), | |
4462 | eq_kettle_volume: parseFloat($('#eq_kettle_volume').jqxNumberInput('decimal')), | |
4463 | eq_kettle_height: dataRecord.eq_kettle_height, | |
4464 | eq_mash_volume: parseFloat($('#eq_mash_volume').jqxNumberInput('decimal')), | |
4465 | eq_mash_max: parseFloat($('#eq_mash_max').jqxNumberInput('decimal')), | |
4466 | eq_efficiency: parseFloat($('#eq_efficiency').jqxNumberInput('decimal')), | |
4467 | brew_date_start: $('#brew_date_start').val(), | |
4468 | brew_mash_ph: parseFloat($('#brew_mash_ph').jqxNumberInput('decimal')), | |
4469 | brew_mash_sg: parseFloat($('#brew_mash_sg').jqxNumberInput('decimal')), | |
4470 | brew_mash_efficiency: parseFloat($('#brew_mash_efficiency').jqxNumberInput('decimal')), | |
4471 | brew_sparge_est: parseFloat($('#brew_sparge_est').jqxNumberInput('decimal')), | |
4472 | brew_sparge_ph: parseFloat($('#brew_sparge_ph').jqxNumberInput('decimal')), | |
4473 | brew_preboil_volume: parseFloat($('#brew_preboil_volume').jqxNumberInput('decimal')), | |
4474 | brew_preboil_sg: parseFloat($('#brew_preboil_sg').jqxNumberInput('decimal')), | |
4475 | brew_preboil_ph: parseFloat($('#brew_preboil_ph').jqxNumberInput('decimal')), | |
4476 | brew_preboil_efficiency: parseFloat($('#brew_preboil_efficiency').jqxNumberInput('decimal')), | |
4477 | brew_aboil_volume: parseFloat($('#brew_aboil_volume').jqxNumberInput('decimal')), | |
4478 | brew_aboil_sg: parseFloat($('#brew_aboil_sg').jqxNumberInput('decimal')), | |
4479 | brew_aboil_ph: parseFloat($('#brew_aboil_ph').jqxNumberInput('decimal')), | |
4480 | brew_aboil_efficiency: parseFloat($('#brew_aboil_efficiency').jqxNumberInput('decimal')), | |
4481 | brew_cooling_method: $('#brew_cooling_method').val(), | |
4482 | brew_cooling_time: parseFloat($('#brew_cooling_time').jqxNumberInput('decimal')), | |
4483 | brew_cooling_to: parseFloat($('#brew_cooling_to').jqxNumberInput('decimal')), | |
4484 | brew_whirlpool9: parseFloat($('#brew_whirlpool9').jqxNumberInput('decimal')), | |
4485 | brew_whirlpool7: parseFloat($('#brew_whirlpool7').jqxNumberInput('decimal')), | |
4486 | brew_whirlpool6: parseFloat($('#brew_whirlpool6').jqxNumberInput('decimal')), | |
4487 | brew_whirlpool2: parseFloat($('#brew_whirlpool2').jqxNumberInput('decimal')), | |
4488 | brew_fermenter_volume: parseFloat($('#brew_fermenter_volume').jqxNumberInput('decimal')), | |
4489 | brew_fermenter_extrawater: parseFloat($('#brew_fermenter_extrawater').jqxNumberInput('decimal')), | |
4490 | brew_fermenter_tcloss: parseFloat($('#brew_fermenter_tcloss').jqxNumberInput('decimal')), | |
4491 | brew_aeration_time: parseFloat($('#brew_aeration_time').jqxNumberInput('decimal')), | |
4492 | brew_aeration_speed: parseFloat($('#brew_aeration_speed').jqxNumberInput('decimal')), | |
4493 | brew_aeration_type: $('#brew_aeration_type').val(), | |
4494 | brew_fermenter_sg: parseFloat($('#brew_fermenter_sg').jqxNumberInput('decimal')), | |
4495 | brew_fermenter_ibu: parseFloat($('#brew_fermenter_ibu').jqxNumberInput('decimal')), | |
4496 | brew_fermenter_color: parseFloat($('#brew_fermenter_color').jqxNumberInput('decimal')), | |
4497 | brew_date_end: $('#brew_date_end').val(), | |
4498 | og: dataRecord.og, | |
4499 | fg: parseFloat($('#fg').jqxNumberInput('decimal')), | |
4500 | primary_start_temp: parseFloat($('#primary_start_temp').jqxNumberInput('decimal')), | |
4501 | primary_max_temp: parseFloat($('#primary_max_temp').jqxNumberInput('decimal')), | |
4502 | primary_end_temp: parseFloat($('#primary_end_temp').jqxNumberInput('decimal')), | |
4503 | primary_end_sg: parseFloat($('#primary_end_sg').jqxNumberInput('decimal')), | |
4504 | primary_end_date: $('#primary_end_date').val(), | |
4505 | secondary_temp: parseFloat($('#secondary_temp').jqxNumberInput('decimal')), | |
4506 | secondary_end_sg: parseFloat($('#secondary_end_sg').jqxNumberInput('decimal')), | |
4507 | secondary_end_date: $('#secondary_end_date').val(), | |
4508 | tertiary_temp: parseFloat($('#tertiary_temp').jqxNumberInput('decimal')), | |
4509 | package_date: $('#package_date').val(), | |
4510 | package_volume: parseFloat($('#package_volume').jqxNumberInput('decimal')), | |
4511 | package_infuse_amount: parseFloat($('#package_infuse_amount').jqxNumberInput('decimal')), | |
4512 | package_infuse_abv: parseFloat($('#package_infuse_abv').jqxNumberInput('decimal')), | |
4513 | package_infuse_notes: $('#package_infuse_notes').val(), | |
4514 | package_abv: parseFloat($('#package_abv').jqxNumberInput('decimal')), | |
4515 | package_ph: parseFloat($('#package_ph').jqxNumberInput('decimal')), | |
4516 | bottle_amount: parseFloat($('#bottle_amount').jqxNumberInput('decimal')), | |
4517 | bottle_carbonation: parseFloat($('#bottle_carbonation').jqxNumberInput('decimal')), | |
4518 | bottle_priming_water: parseFloat($('#bottle_priming_water').jqxNumberInput('decimal')), | |
4519 | bottle_priming_amount: parseFloat($('#bottle_priming_amount').jqxNumberInput('decimal')), | |
4520 | bottle_carbonation_temp: parseFloat($('#bottle_carbonation_temp').jqxNumberInput('decimal')), | |
4521 | keg_amount: parseFloat($('#keg_amount').jqxNumberInput('decimal')), | |
4522 | keg_carbonation: parseFloat($('#keg_carbonation').jqxNumberInput('decimal')), | |
4523 | keg_priming_water: parseFloat($('#keg_priming_water').jqxNumberInput('decimal')), | |
4524 | keg_priming_amount: parseFloat($('#keg_priming_amount').jqxNumberInput('decimal')), | |
4525 | keg_carbonation_temp: parseFloat($('#keg_carbonation_temp').jqxNumberInput('decimal')), | |
4526 | keg_forced_carb: dataRecord.keg_forced_carb, | |
4527 | keg_pressure: parseFloat($('#keg_pressure').jqxNumberInput('decimal')), | |
4528 | taste_notes: $('#taste_notes').val(), | |
4529 | taste_rate: parseFloat($('#taste_rate').jqxNumberInput('decimal')), | |
4530 | taste_date: $('#taste_date').val(), | |
4531 | taste_color: $('#taste_color').val(), | |
4532 | taste_transparency: $('#taste_transparency').val(), | |
4533 | taste_head: $('#taste_head').val(), | |
4534 | taste_aroma: $('#taste_aroma').val(), | |
4535 | taste_taste: $('#taste_taste').val(), | |
4536 | taste_mouthfeel: $('#taste_mouthfeel').val(), | |
4537 | taste_aftertaste: $('#taste_aftertaste').val(), | |
4538 | st_name: $('#st_name').val(), | |
4539 | st_letter: $('#st_letter').val(), | |
4540 | st_guide: $('#st_guide').val(), | |
4541 | st_type: dataRecord.st_type, | |
4542 | st_category: $('#st_category').val(), | |
4543 | st_category_number: parseFloat($('#st_category_number').jqxNumberInput('decimal')), | |
4544 | st_og_min: parseFloat($('#st_og_min').jqxNumberInput('decimal')), | |
4545 | st_og_max: parseFloat($('#st_og_max').jqxNumberInput('decimal')), | |
4546 | st_fg_min: parseFloat($('#st_fg_min').jqxNumberInput('decimal')), | |
4547 | st_fg_max: parseFloat($('#st_fg_max').jqxNumberInput('decimal')), | |
4548 | st_ibu_min: parseFloat($('#st_ibu_min').jqxNumberInput('decimal')), | |
4549 | st_ibu_max: parseFloat($('#st_ibu_max').jqxNumberInput('decimal')), | |
4550 | st_color_min: parseFloat($('#st_color_min').jqxNumberInput('decimal')), | |
4551 | st_color_max: parseFloat($('#st_color_max').jqxNumberInput('decimal')), | |
4552 | st_carb_min: parseFloat($('#st_carb_min').jqxNumberInput('decimal')), | |
4553 | st_carb_max: parseFloat($('#st_carb_max').jqxNumberInput('decimal')), | |
4554 | st_abv_min: parseFloat($('#st_abv_min').jqxNumberInput('decimal')), | |
4555 | st_abv_max: parseFloat($('#st_abv_max').jqxNumberInput('decimal')), | |
4556 | type: $('#type').val(), | |
4557 | batch_size: parseFloat($('#batch_size').jqxNumberInput('decimal')), | |
4558 | boil_size: parseFloat($('#boil_size').jqxNumberInput('decimal')), | |
4559 | boil_time: parseFloat($('#boil_time').jqxNumberInput('decimal')), | |
4560 | efficiency: parseFloat($('#efficiency').jqxNumberInput('decimal')), | |
4561 | est_og: parseFloat($('#est_og').jqxNumberInput('decimal')), | |
616
2cbf21bb9bdc
Added est_og3 field in the products database so that the checklist can use it.
Michiel Broek <mbroek@mbse.eu>
parents:
615
diff
changeset
|
4562 | est_og3: parseFloat($('#est_og3').jqxNumberInput('decimal')), |
478 | 4563 | est_fg: parseFloat($('#est_fg').jqxNumberInput('decimal')), |
4564 | est_abv: parseFloat($('#est_abv').jqxNumberInput('decimal')), | |
4565 | est_color: parseFloat($('#est_color').jqxNumberInput('decimal')), | |
4566 | color_method: $('#color_method').val(), | |
4567 | est_ibu: parseFloat($('#est_ibu').jqxNumberInput('decimal')), | |
4568 | ibu_method: $('#ibu_method').val(), | |
4569 | est_carb: parseFloat($('#est_carb').jqxNumberInput('decimal')), | |
4570 | mash_name: $('#mash_name').val(), | |
4571 | mash_ph: parseFloat($('#mash_ph').jqxNumberInput('decimal')), | |
4572 | sparge_temp: parseFloat($('#sparge_temp').jqxNumberInput('decimal')), | |
4573 | sparge_ph: parseFloat($('#sparge_ph').jqxNumberInput('decimal')), | |
4574 | sparge_volume: parseFloat($('#sparge_volume').jqxNumberInput('decimal')), | |
4575 | sparge_source: $('#sparge_source').val(), | |
4576 | sparge_acid_type: $('#sparge_acid_type').val(), | |
4577 | sparge_acid_perc: parseFloat($('#sparge_acid_perc').jqxNumberInput('decimal')), | |
4578 | sparge_acid_amount: dataRecord.sparge_acid_amount, | |
4579 | calc_acid: dataRecord.calc_acid, | |
4580 | w1_name: $('#w1_name').val(), | |
4581 | w1_amount: parseFloat($('#w1_amount').jqxNumberInput('decimal')), | |
4582 | w1_calcium: parseFloat($('#w1_calcium').jqxNumberInput('decimal')), | |
4583 | w1_sulfate: parseFloat($('#w1_sulfate').jqxNumberInput('decimal')), | |
4584 | w1_chloride: parseFloat($('#w1_chloride').jqxNumberInput('decimal')), | |
4585 | w1_sodium: parseFloat($('#w1_sodium').jqxNumberInput('decimal')), | |
4586 | w1_magnesium: parseFloat($('#w1_magnesium').jqxNumberInput('decimal')), | |
4587 | w1_total_alkalinity: parseFloat($('#w1_total_alkalinity').jqxNumberInput('decimal')), | |
4588 | w1_ph: parseFloat($('#w1_ph').jqxNumberInput('decimal')), | |
4589 | w1_cost: dataRecord.w1_cost, | |
4590 | w2_name: $('#w2_name').val(), | |
4591 | w2_amount: parseFloat($('#w2_amount').jqxNumberInput('decimal')), | |
4592 | w2_calcium: parseFloat($('#w2_calcium').jqxNumberInput('decimal')), | |
4593 | w2_sulfate: parseFloat($('#w2_sulfate').jqxNumberInput('decimal')), | |
4594 | w2_chloride: parseFloat($('#w2_chloride').jqxNumberInput('decimal')), | |
4595 | w2_sodium: parseFloat($('#w2_sodium').jqxNumberInput('decimal')), | |
4596 | w2_magnesium: parseFloat($('#w2_magnesium').jqxNumberInput('decimal')), | |
4597 | w2_total_alkalinity: parseFloat($('#w2_total_alkalinity').jqxNumberInput('decimal')), | |
4598 | w2_ph: parseFloat($('#w2_ph').jqxNumberInput('decimal')), | |
4599 | w2_cost: dataRecord.w2_cost, | |
4600 | wg_amount: parseFloat($('#wg_amount').jqxNumberInput('decimal')), | |
4601 | wg_calcium: parseFloat($('#wg_calcium').jqxNumberInput('decimal')), | |
4602 | wg_sulfate: parseFloat($('#wg_sulfate').jqxNumberInput('decimal')), | |
4603 | wg_chloride: parseFloat($('#wg_chloride').jqxNumberInput('decimal')), | |
4604 | wg_sodium: parseFloat($('#wg_sodium').jqxNumberInput('decimal')), | |
4605 | wg_magnesium: parseFloat($('#wg_magnesium').jqxNumberInput('decimal')), | |
4606 | wg_total_alkalinity: parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal')), | |
4607 | wg_ph: parseFloat($('#wg_ph').jqxNumberInput('decimal')), | |
4608 | wb_calcium: parseFloat($('#wb_calcium').jqxNumberInput('decimal')), | |
4609 | wb_sulfate: parseFloat($('#wb_sulfate').jqxNumberInput('decimal')), | |
4610 | wb_chloride: parseFloat($('#wb_chloride').jqxNumberInput('decimal')), | |
4611 | wb_sodium: parseFloat($('#wb_sodium').jqxNumberInput('decimal')), | |
4612 | wb_magnesium: parseFloat($('#wb_magnesium').jqxNumberInput('decimal')), | |
4613 | wb_total_alkalinity: parseFloat($('#wb_total_alkalinity').jqxNumberInput('decimal')), | |
4614 | wb_ph: parseFloat($('#wb_ph').jqxNumberInput('decimal')), | |
638
736c8d29bc87
Binding the data earlier to try to prevent a race condition.
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
4615 | wa_acid_name: parseInt($('#wa_acid_name').val()), |
478 | 4616 | wa_acid_perc: parseFloat($('#wa_acid_perc').jqxNumberInput('decimal')), |
638
736c8d29bc87
Binding the data earlier to try to prevent a race condition.
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
4617 | wa_base_name: parseInt($('#wa_base_name').val()), |
478 | 4618 | starter_enable: dataRecord.starter_enable, |
4619 | starter_type: $('#starter_type').val(), | |
4620 | starter_sg: parseFloat($('#starter_sg').jqxNumberInput('decimal')), | |
4621 | starter_viability: parseFloat($('#starter_viability').jqxNumberInput('decimal')), | |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
4622 | yeast_prod_date: $('#yeast_prod_date').val(), |
478 | 4623 | prop1_type: $('#prop1_type').val(), |
4624 | prop1_volume: parseFloat($('#prop1_volume').jqxNumberInput('decimal')), | |
4625 | prop2_type: $('#prop2_type').val(), | |
4626 | prop2_volume: parseFloat($('#prop2_volume').jqxNumberInput('decimal')), | |
4627 | prop3_type: $('#prop3_type').val(), | |
4628 | prop3_volume: parseFloat($('#prop3_volume').jqxNumberInput('decimal')), | |
4629 | prop4_type: $('#prop4_type').val(), | |
4630 | prop4_volume: parseFloat($('#prop4_volume').jqxNumberInput('decimal')), | |
497
0fe366d953ab
Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents:
495
diff
changeset
|
4631 | divide_type: dataRecord.divide_type, |
0fe366d953ab
Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents:
495
diff
changeset
|
4632 | divide_size: dataRecord.divide_size, |
533
be8691b7d634
Added the product divide scripts. All parts have all the volumes and weights divided, including the master record. Splitted batches have their own records with the product code formatted as code-n. From this design, we can rebuild the print and checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
4633 | divide_factor: dataRecord.divide_factor, |
497
0fe366d953ab
Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents:
495
diff
changeset
|
4634 | divide_parts: dataRecord.divide_parts, |
533
be8691b7d634
Added the product divide scripts. All parts have all the volumes and weights divided, including the master record. Splitted batches have their own records with the product code formatted as code-n. From this design, we can rebuild the print and checklist.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
4635 | divide_part: dataRecord.divide_part, |
478 | 4636 | fermentables: $('#fermentableGrid').jqxGrid('getrows'), |
4637 | hops: $('#hopGrid').jqxGrid('getrows'), | |
4638 | miscs: $('#miscGrid').jqxGrid('getrows'), | |
4639 | yeasts: $('#yeastGrid').jqxGrid('getrows'), | |
4640 | mashs: $('#mashGrid').jqxGrid('getrows') | |
4641 | }, | |
4642 | data = 'update=true&' + $.param(row); | |
4643 | $.ajax({ | |
4644 | dataType: 'json', | |
4645 | url: url, | |
4646 | cache: false, | |
4647 | data: data, | |
4648 | async: false, | |
4649 | type: 'POST', | |
4650 | success: function(data, status, xhr) { | |
489
18e5cfe5d126
Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
4651 | console.log('saveRecord(' + goback + ') success'); |
18e5cfe5d126
Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
4652 | if (goback) |
18e5cfe5d126
Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
4653 | window.location.href = my_return; |
18e5cfe5d126
Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
4654 | else |
18e5cfe5d126
Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
4655 | window.location.href = |
497
0fe366d953ab
Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents:
495
diff
changeset
|
4656 | 'prod_export.php?record=' + my_record + '&return=' + my_return + '&select=' + my_select + '&code=' + dataRecord.code + '&name=' + dataRecord.name + |
0fe366d953ab
Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents:
495
diff
changeset
|
4657 | '&stage=' + dataRecord.stage + '&split=' + dataRecord.divide_type; |
478 | 4658 | }, |
4659 | error: function(jqXHR, textStatus, errorThrown) { | |
489
18e5cfe5d126
Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
4660 | console.log('saveRecord() ' + textStatus); |
478 | 4661 | } |
4662 | }); | |
4663 | }; | |
4664 | ||
4665 | // initialize the input fields. | |
4666 | // Tab 1, Algemeen | |
4667 | $('#name').jqxTooltip({ content: 'De naam voor dit product.' }); | |
4668 | $('#code').jqxTooltip({ content: 'Product code nummer.' }); | |
4669 | $('#birth').jqxTooltip({ content: 'De ontwerp datum van dit product.' }); | |
4670 | $('#stage').jqxTooltip({ content: 'De productie fase van dit product.' }); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4671 | $('#divide_batch').jqxTooltip({ content: 'Het aantal extra gesplitste batches.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4672 | $('#divide_type').jqxTooltip({ content: 'Het splitsing moment in het productie proces.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4673 | $('#notes').jqxTooltip({ content: 'De uitgebreide opmerkingen over dit product.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4674 | $('#type').jqxTooltip({ content: 'Het brouw type van dit recept.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4675 | $('#efficiency').jqxTooltip({ content: 'Het rendement van maischen en koken.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4676 | $('#batch_size').jqxTooltip({ content: 'Het volume van het gekoelde wort na het koken.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4677 | $('#boil_time').jqxTooltip({ content: 'De kooktijd in minuten.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4678 | $('#boil_size').jqxTooltip({ content: 'Het volume van het wort voor het koken.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4679 | $('#st_guide').jqxTooltip({ content: 'De bierstijl gids voor dit recept.'}); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4680 | $('#st_name').jqxTooltip({ content: 'De bierstijl naam voor dit recept.'}); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4681 | $('#st_letter').jqxTooltip({ content: 'De bierstijl letter voor dit recept.'}); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4682 | $('#st_letter').jqxInput({ theme: theme, width: 90, height: 23 }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4683 | $('#st_type').jqxTooltip({ content: 'Het bierstijl type.'}); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4684 | $('#st_category').jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'}); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4685 | $('#st_category_number').jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'}); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4686 | $('#est_og').jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4687 | $('#st_og_min').jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'}); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4688 | $('#st_og_max').jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'}); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4689 | $('#est_fg').jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4690 | $('#st_fg_min').jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'}); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4691 | $('#st_fg_max').jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'}); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4692 | $('#est_abv').jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4693 | $('#st_abv_min').jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'}); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4694 | $('#st_abv_max').jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'}); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4695 | $('#est_color').jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4696 | $('#st_color_min').jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'}); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4697 | $('#st_color_max').jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'}); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4698 | $('#est_ibu').jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4699 | $('#st_ibu_min').jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'}); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4700 | $('#st_ibu_max').jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'}); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4701 | $('#kcal').jqxTooltip({ content: 'Energie-inhoud in kcal/liter.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4702 | $('#est_carb').jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4703 | $('#st_carb_min').jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'}); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4704 | $('#st_carb_max').jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'}); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4705 | |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4706 | $('#name').jqxInput({ theme: theme, width: 640, height: 23 }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4707 | $('#code, #stage').jqxInput({ theme: theme, width: 100, height: 23 }); |
478 | 4708 | $('#locked').jqxCheckBox({ theme: theme, width: 120, height: 23, disabled: true }); |
4709 | $('#locked').on('checked', function(event) { | |
4710 | if (dataRecord.stage >= 10) { | |
4711 | dataRecord.locked = 1; | |
4712 | dataRecord.stage = 11; | |
4713 | calcStage(); | |
4714 | } | |
4715 | }); | |
4716 | $('#locked').on('unchecked', function(event) { | |
4717 | if (dataRecord.stage >= 10) { | |
4718 | dataRecord.locked = 0; | |
4719 | dataRecord.stage = 10; | |
4720 | calcStage(); | |
4721 | } | |
4722 | }); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4723 | $('#birth,#divide_batch,#divide_type').jqxInput({ theme: theme, width: 120, height: 23 }); |
478 | 4724 | $('#notes').jqxInput({ theme: theme, width: 960, height: 100 }); |
4725 | $('#type').jqxDropDownList({ | |
4726 | theme: theme, | |
4727 | source: RecipeTypeAdapter, | |
4728 | valueMember: 'id', | |
4729 | displayMember: 'nl', | |
4730 | width: 180, | |
4731 | height: 23, | |
4732 | autoDropDownHeight: true | |
4733 | }); | |
4734 | $('#efficiency').jqxNumberInput(Perc1dec); | |
4735 | $('#batch_size').jqxNumberInput(Spin1dec); | |
4736 | $('#batch_size').jqxNumberInput({ min: 4 }); | |
4737 | $('#boil_time').jqxNumberInput(PosInt); | |
658
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
4738 | $('#boil_time').jqxNumberInput({ min: 0, max: 360 }); |
478 | 4739 | $('#boil_size').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 2, readOnly: true }); |
610 | 4740 | $('#st_guide,#st_name,#st_type,#st_category').jqxInput({ theme: theme, width: 250, height: 23 }); |
478 | 4741 | $('#est_og').jqxNumberInput(SGopts); |
4742 | $('#est_fg').jqxNumberInput(Show3dec); | |
610 | 4743 | $('#st_og_min,#st_og_max,#st_fg_min,#st_fg_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4744 | $('#est_ibu,#est_color').jqxNumberInput(Show0dec); |
478 | 4745 | $('#color_method').jqxDropDownList({ |
4746 | theme: theme, | |
4747 | source: ColorMethodAdapter, | |
4748 | valueMember: 'id', | |
4749 | displayMember: 'nl', | |
4750 | width: 180, | |
4751 | height: 23, | |
4752 | autoDropDownHeight: true | |
4753 | }); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4754 | $('#st_color_min,#st_color_max,#st_category_number,#st_ibu_min,#st_ibu_max,#kcal').jqxNumberInput(Smal0dec); |
478 | 4755 | $('#ibu_method').jqxDropDownList({ |
4756 | theme: theme, | |
4757 | source: IBUmethodAdapter, | |
4758 | valueMember: 'id', | |
4759 | displayMember: 'nl', | |
4760 | width: 180, | |
4761 | height: 23, | |
4762 | autoDropDownHeight: true, | |
4763 | dropDownVerticalAlignment: 'top' | |
4764 | }); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4765 | $('#est_abv,#st_abv_min,#st_abv_max,#est_carb,#st_carb_min,#st_carb_max').jqxNumberInput(Smal1dec); |
478 | 4766 | |
4767 | // Tab 2, Equipment | |
4768 | $('#eq_name').jqxTooltip({ content: 'De naam van deze brouw apparatuur.' }); | |
4769 | $('#eq_boil_size').jqxTooltip({ content: 'Normaal kook volume in liters' }); | |
4770 | $('#eq_batch_size').jqxTooltip({ content: 'Berekende batch grootte in liters aan het eind van de kook.' }); | |
4771 | $('#eq_tun_volume').jqxTooltip({ content: 'Maisch ketel volume.' }); | |
4772 | $('#eq_top_up_water').jqxTooltip({ content: 'Extra water in het gistvat.' }); | |
4773 | $('#eq_trub_chiller_loss').jqxTooltip({ content: 'Standaard verlies bij het overbrengen naar het gistvat.' }); | |
4774 | $('#eq_evap_rate').jqxTooltip({ content: 'Verdamping in liters per uur.' }); | |
658
945d5eba869a
Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents:
655
diff
changeset
|
4775 | $('#eq_boil_time').jqxTooltip({ content: 'Normale kooktijd in minuten, 0 voor no-boil recepten.' }); |
478 | 4776 | $('#eq_top_up_kettle').jqxTooltip({ content: 'Extra water toevoegen tijdens de kook.' }); |
4777 | $('#eq_hop_utilization').jqxTooltip({ content: '100% voor kleine installaties, hoger voor grote brouwerijen.' }); | |
4778 | $('#eq_notes').jqxTooltip({ content: 'Opmerkingen over deze apparatuur.' }); | |
4779 | $('#eq_lauter_volume').jqxTooltip({ content: 'Filterkuip volume.' }); | |
4780 | $('#eq_lauter_deadspace').jqxTooltip({ content: 'Filterkuip verlies in liters.' }); | |
4781 | $('#eq_kettle_volume').jqxTooltip({ content: 'Kook ketel volume in liters.' }); | |
4782 | $('#eq_mash_volume').jqxTooltip({ content: 'Maisch water voor de eerste stap.' }); | |
4783 | $('#eq_mash_max').jqxTooltip({ content: 'De maximale moutstort in Kg.' }); | |
4784 | $('#eq_efficiency').jqxTooltip({ content: 'Gemiddeld brouwzaal rendement.' }); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4785 | |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4786 | $('#eq_name').jqxInput({ theme: theme, width: 250, height: 23 }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4787 | $('#eq_evap_rate').jqxNumberInput(Show2dec); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4788 | $('#eq_boil_time,#eq_hop_utilization').jqxNumberInput(Show0dec); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4789 | $('#eq_notes').jqxInput({ theme: theme, width: 960, height: 200 }); |
610 | 4790 | $('#eq_boil_size,#eq_batch_size,#eq_tun_volume,#eq_top_up_water,#eq_trub_chiller_loss,#eq_top_up_kettle').jqxNumberInput(Show1dec); |
4791 | $('#eq_lauter_volume,#eq_lauter_deadspace,#eq_kettle_volume,#eq_mash_volume,#eq_mash_max,#eq_efficiency').jqxNumberInput(Show1dec); | |
478 | 4792 | |
4793 | // Tab 3, Fermentables | |
4794 | $('#est_color2').jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' }); | |
4795 | $('#est_og2').jqxTooltip({ content: 'Het geschatte begin SG van dit product.' }); | |
4796 | $('#mash_kg').jqxTooltip({ content: 'Het gewicht van alle mouten in de maisch.' }); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4797 | |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4798 | $('#est_color2').jqxNumberInput(Show0dec); |
610 | 4799 | $('#est_og2,#mash_kg').jqxNumberInput(Show3dec); |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4800 | |
478 | 4801 | $('#perc_malts').jqxProgressBar({ |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4802 | width: 300, height: 23, theme: theme, showText: true, max: 120, animationDuration: 0, |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4803 | colorRanges: [{ stop: 90, color: '#008C00' },{ stop: 100, color: '#EB7331' },{ stop: 120, color: '#FF0000' }], |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4804 | renderText: function(text) { return (Math.round(parseInt(text) * 1.2)) + '%'; } |
478 | 4805 | }); |
4806 | $('#perc_sugars').jqxProgressBar({ | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4807 | width: 300, height: 23, theme: theme, showText: true, max: 50, animationDuration: 0, |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4808 | colorRanges: [{ stop: 20, color: '#008C00' },{ stop: 50, color: '#FF0000' }], |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4809 | renderText: function(text) { return (Math.round(parseInt(text) * 5) / 10) + '%'; } |
478 | 4810 | }); |
4811 | $('#perc_cara').jqxProgressBar({ | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4812 | width: 300, height: 23, theme: theme, showText: true, max: 50, animationDuration: 0, |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4813 | colorRanges: [{ stop: 25, color: '#008C00' },{ stop: 50, color: '#FF0000' }], |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4814 | renderText: function(text) { return (Math.round(parseInt(text) * 5) / 10) + '%'; } |
478 | 4815 | }); |
4816 | $('#ferm_lintner').jqxProgressBar({ | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4817 | width: 300, height: 23, theme: theme, showText: true, max: 200, animationDuration: 0, |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4818 | colorRanges: [{ stop: 30, color: '#FF0000' },{ stop: 40, color: '#EB7331' },{ stop: 200, color: '#008C00' }], |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
4819 | renderText: function(text) { return (parseInt(text) * 2) + ' lintner'; } |
478 | 4820 | }); |
4821 | $('#popupFermentable').jqxWindow({ | |
4822 | width: 800, | |
4823 | height: 300, | |
4824 | position: { x: 230, y: 100 }, | |
4825 | resizable: false, | |
4826 | theme: theme, | |
4827 | isModal: true, | |
4828 | autoOpen: false, | |
4829 | cancelButton: $('#FermentableReady'), | |
4830 | modalOpacity: 0.40 | |
4831 | }); | |
4832 | $('#FermentableReady').jqxButton({ template: 'success', width: '90px', theme: theme }); | |
4833 | $('#FermentableReady').click(function() { | |
4834 | var row, rowID = $('#fermentableGrid').jqxGrid('getrowid', fermentableRow); | |
4835 | console.log('FermentableReady row:' + fermentableRow + ' ID:' + rowID); | |
4836 | row = { | |
4837 | f_name: fermentableData.f_name, | |
4838 | f_origin: fermentableData.f_origin, | |
4839 | f_supplier: fermentableData.f_supplier, | |
4840 | f_amount: fermentableData.f_amount, | |
4841 | f_cost: fermentableData.f_cost, | |
4842 | f_type: fermentableData.f_type, | |
4843 | f_yield: fermentableData.f_yield, | |
4844 | f_color: fermentableData.f_color, | |
4845 | f_coarse_fine_diff: fermentableData.f_coarse_fine_diff, | |
4846 | f_moisture: fermentableData.f_moisture, | |
4847 | f_diastatic_power: fermentableData.f_diastatic_power, | |
4848 | f_protein: fermentableData.f_protein, | |
4849 | f_max_in_batch: fermentableData.f_max_in_batch, | |
4850 | f_graintype: fermentableData.f_graintype, | |
4851 | f_added: fermentableData.f_added, | |
4852 | f_dissolved_protein: fermentableData.f_dissolved_protein, | |
4853 | f_recommend_mash: fermentableData.f_recommend_mash, | |
4854 | f_add_after_boil: fermentableData.f_add_after_boil, | |
4855 | f_adjust_to_total_100: fermentableData.f_adjust_to_total_100, | |
4856 | f_percentage: fermentableData.f_percentage, | |
4857 | f_di_ph: fermentableData.f_di_ph, | |
4858 | f_acid_to_ph_57: fermentableData.f_acid_to_ph_57, | |
4859 | f_inventory: fermentableData.f_inventory, | |
4860 | f_avail: fermentableData.f_avail | |
4861 | }; | |
4862 | $('#fermentableGrid').jqxGrid('updaterow', rowID, row); | |
4863 | calcPercentages(); | |
4864 | calcFermentables(); | |
4865 | calcIBUs(); | |
4866 | calcMash(); | |
4867 | // Waters: yes there is impact. | |
4868 | }); | |
4869 | $('#wf_name').jqxInput({ theme: theme, width: 320, height: 23 }); | |
4870 | $('#wf_instock').jqxCheckBox({ theme: theme, height: 23 }); | |
4871 | $('#wf_instock').on('change', function(event) { | |
4872 | fermentableinstock = event.args.checked; | |
4873 | fermentablelist.dataBind(); | |
4874 | }); | |
4875 | $('#wf_select').jqxDropDownList({ | |
4876 | placeHolder: 'Kies mout:', | |
4877 | theme: theme, | |
4878 | source: fermentablelist, | |
4879 | displayMember: 'name', | |
4880 | width: 150, | |
4881 | height: 23, | |
4882 | dropDownWidth: 500, | |
4883 | dropDownHeight: 500, | |
4884 | renderer: function(index, label, value) { | |
4885 | var datarecord = fermentablelist.records[index]; | |
4886 | return datarecord.supplier + ' / ' + datarecord.name + ' (' + datarecord.color + ' EBC)'; | |
4887 | } | |
4888 | }); | |
4889 | $('#wf_select').on('select', function(event) { | |
4890 | if (event.args) { | |
4891 | var datarecord, index = event.args.index; | |
4892 | datarecord = fermentablelist.records[index]; | |
4893 | $('#wf_name').val(datarecord.name); | |
4894 | fermentableData.f_name = datarecord.name; | |
4895 | fermentableData.f_origin = datarecord.origin; | |
4896 | fermentableData.f_supplier = datarecord.supplier; | |
4897 | fermentableData.f_type = datarecord.type; | |
4898 | fermentableData.f_cost = datarecord.cost; | |
4899 | fermentableData.f_yield = datarecord.yield; | |
4900 | fermentableData.f_color = datarecord.color; | |
4901 | fermentableData.f_coarse_fine_diff = datarecord.coarse_fine_diff; | |
4902 | fermentableData.f_moisture = datarecord.moisture; | |
4903 | fermentableData.f_diastatic_power = datarecord.diastatic_power; | |
4904 | fermentableData.f_protein = datarecord.protein; | |
4905 | fermentableData.f_max_in_batch = datarecord.max_in_batch; | |
4906 | fermentableData.f_graintype = datarecord.graintype; | |
4907 | fermentableData.f_dissolved_protein = datarecord.dissolved_protein; | |
4908 | fermentableData.f_recommend_mash = datarecord.recommend_mash; | |
4909 | fermentableData.f_add_after_boil = datarecord.add_after_boil; | |
4910 | fermentableData.f_di_ph = datarecord.di_ph; | |
4911 | fermentableData.f_acid_to_ph_57 = datarecord.acid_to_ph_57; | |
4912 | fermentableData.f_inventory = datarecord.inventory; | |
4913 | } | |
4914 | }); | |
4915 | $('#wf_amount').jqxNumberInput(Spin3dec); | |
4916 | $('#wf_amount').on('change', function(event) { | |
4917 | console.log('amount changed: ' + event.args.value); | |
4918 | $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_amount', event.args.value); | |
4919 | fermentableData.f_amount = event.args.value; | |
4920 | if (! to_100) { | |
4921 | calcPercentages(); | |
4922 | calcFermentables(); | |
4923 | calcIBUs(); | |
4924 | calcMash(); | |
4925 | } | |
4926 | }); | |
4927 | $('#wf_percentage').jqxNumberInput(Perc1dec); | |
4928 | $('#wf_percentage').on('change', function(event) { | |
4929 | var newvalue, rowscount, rowdata, diff, tw, damount, namount, nw, newperc, | |
4930 | oldvalue = Math.round(fermentableData.f_percentage * 10) / 10.0; | |
4931 | newvalue = event.args.value; | |
4932 | console.log('percentage changed: ' + newvalue + ' old: ' + oldvalue); | |
4933 | fermentableData.f_percent = newvalue; | |
4934 | rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount; | |
4935 | if ((oldvalue != newvalue) && (rowscount > 1)) { | |
4936 | rowdata = $('#fermentableGrid').jqxGrid('getrowdata', fermentableRow); | |
4937 | if (rowdata.f_adjust_to_total_100) { | |
4938 | $('#wf_percentage').val(oldvalue); | |
4939 | } else { | |
4940 | diff = newvalue - oldvalue; | |
4941 | tw = 0; // total weight | |
4942 | for (i = 0; i < rowscount; i++) { | |
4943 | rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i); | |
4944 | if (rowdata.f_added < 4) | |
4945 | tw += Math.round(rowdata.f_amount * 1000) / 1000; | |
4946 | } | |
4947 | tw = Math.round(tw * 1000) / 1000; | |
4948 | if (to_100) { | |
4949 | // Adjust this row and the 100% row. | |
4950 | damount = Math.round(tw * diff * 10) / 1000; | |
4951 | rowdata = $('#fermentableGrid').jqxGrid('getrowdata', fermentableRow); | |
4952 | namount = Round(rowdata.f_amount + damount, 3); | |
4953 | $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_amount', namount); | |
4954 | $('#wf_amount').val(namount); | |
4955 | $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_percentage', rowdata.f_percentage + diff); | |
4956 | for (i = 0; i < rowscount; i++) { | |
4957 | rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i); | |
4958 | if (rowdata.f_adjust_to_total_100) { | |
4959 | namount = rowdata.f_amount - damount; | |
4960 | $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', rowdata.f_percentage - diff); | |
4961 | $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', namount); | |
4962 | } | |
4963 | } | |
4964 | calcFermentables(); | |
4965 | calcIBUs(); | |
4966 | calcMash(); | |
4967 | } else { | |
4968 | // Adjust all the rows. | |
4969 | nw = tw * diff / 100; | |
4970 | for (i = 0; i < rowscount; i++) { | |
4971 | rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i); | |
4972 | if (rowdata.f_added < 4) { | |
4973 | if (i == fermentableRow) { | |
4974 | namount = Math.round((rowdata.f_amount + nw) * 1000) / 1000; | |
4975 | $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', namount); | |
4976 | // $('#wf_amount').val(namount); // Will crash the script. | |
4977 | $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', newvalue); | |
4978 | } else { | |
4979 | namount = Math.round((rowdata.f_amount - (nw / (rowscount - 1))) * 1000) / 1000; | |
4980 | newperc = Math.round((namount / tw) * 1000) / 10.0; | |
4981 | $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', namount); | |
4982 | $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', newperc); | |
4983 | } | |
4984 | } else { | |
4985 | $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', 0); | |
4986 | } | |
4987 | } | |
4988 | calcFermentables(); | |
4989 | calcIBUs(); | |
4990 | calcMash(); | |
4991 | } | |
4992 | } | |
4993 | } | |
4994 | }); | |
4995 | $('#wf_max_in_batch').jqxNumberInput(Show1dec); | |
4996 | $('#wf_adjust_to_total_100').jqxCheckBox({ theme: theme, width: 120, height: 23 }); | |
4997 | $('#wf_adjust_to_total_100').on('checked', function(event) { | |
4998 | if (fermentableData.f_adjust_to_total_100 == 0) { | |
4999 | if (to_100) { | |
5000 | // Reset other flag first. | |
5001 | var i, rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount; | |
5002 | for (i = 0; i < rowscount; i++) { | |
5003 | if (i != fermentableRow) { | |
5004 | $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_adjust_to_total_100', 0); | |
5005 | } | |
5006 | } | |
5007 | } | |
5008 | $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 1); | |
5009 | calcFermentables(); | |
5010 | } | |
5011 | }); | |
5012 | $('#wf_adjust_to_total_100').on('unchecked', function(event) { | |
5013 | if (fermentableData.f_adjust_to_total_100 != 0) { | |
5014 | $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 0); | |
5015 | calcFermentables(); | |
5016 | } | |
5017 | }); | |
5018 | $('#wf_added').jqxDropDownList({ | |
5019 | theme: theme, | |
5020 | source: AddedAdapter, | |
5021 | valueMember: 'id', | |
5022 | displayMember: 'nl', | |
5023 | width: 180, | |
5024 | height: 23, | |
5025 | autoDropDownHeight: true, | |
5026 | dropDownVerticalAlignment: 'top' | |
5027 | }); | |
5028 | $('#wf_added').on('select', function(event) { | |
5029 | if (event.args) { | |
5030 | var index = event.args.index; | |
5031 | $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_added', index); | |
5032 | calcFermentables(); | |
5033 | calcIBUs(); | |
5034 | calcMash(); | |
5035 | } | |
5036 | }); | |
5037 | ||
5038 | // Tab 4, Hops | |
5039 | $('#est_ibu2').jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); | |
5040 | $('#est_ibu2').jqxNumberInput(Smal0dec); | |
5041 | $('#hop_flavour').jqxProgressBar({ | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5042 | width: 300, height: 23, theme: theme, showText: true, animationDuration: 0, |
478 | 5043 | colorRanges: [ |
5044 | { stop: 20, color: '#004D00' }, | |
5045 | { stop: 40, color: '#008C00' }, | |
5046 | { stop: 60, color: '#00BF00' }, | |
5047 | { stop: 80, color: '#00FF00' }, | |
5048 | { stop: 100, color: '#80FF80' } | |
5049 | ], | |
5050 | renderText: function(text) { | |
5051 | var val = parseInt(text); | |
5052 | if (val < 20) | |
5053 | return 'Weinig'; | |
5054 | else if (val < 40) | |
5055 | return 'Matig'; | |
5056 | else if (val < 60) | |
5057 | return 'Redelijk'; | |
5058 | else if (val < 80) | |
5059 | return 'Veel'; | |
5060 | else | |
5061 | return 'Zeer veel'; | |
5062 | } | |
5063 | }); | |
5064 | $('#hop_aroma').jqxProgressBar({ | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5065 | width: 300, height: 23, theme: theme, showText: true, animationDuration: 0, |
478 | 5066 | colorRanges: [ |
5067 | { stop: 20, color: '#004D00' }, | |
5068 | { stop: 40, color: '#008C00' }, | |
5069 | { stop: 60, color: '#00BF00' }, | |
5070 | { stop: 80, color: '#00FF00' }, | |
5071 | { stop: 100, color: '#80FF80' } | |
5072 | ], | |
5073 | renderText: function(text) { | |
5074 | var val = parseInt(text); | |
5075 | if (val < 20) | |
5076 | return 'Weinig'; | |
5077 | else if (val < 40) | |
5078 | return 'Matig'; | |
5079 | else if (val < 60) | |
5080 | return 'Redelijk'; | |
5081 | else if (val < 80) | |
5082 | return 'Veel'; | |
5083 | else | |
5084 | return 'Zeer veel'; | |
5085 | } | |
5086 | }); | |
5087 | $('#popupHop').jqxWindow({ | |
5088 | width: 800, | |
5089 | height: 300, | |
5090 | position: { x: 230, y: 100 }, | |
5091 | resizable: false, | |
5092 | theme: theme, | |
5093 | isModal: true, | |
5094 | autoOpen: false, | |
5095 | cancelButton: $('#HopReady'), | |
5096 | modalOpacity: 0.40 | |
5097 | }); | |
5098 | $('#HopReady').jqxButton({ template: 'success', width: '90px', theme: theme }); | |
5099 | $('#HopReady').click(function() { | |
5100 | var row, rowID = $('#hopGrid').jqxGrid('getrowid', hopRow); | |
5101 | row = { | |
5102 | h_name: $('#wh_name').val(), | |
5103 | h_origin: hopData.h_origin, | |
5104 | h_amount: parseFloat($('#wh_amount').jqxNumberInput('decimal')) / 1000, | |
5105 | h_cost: hopData.h_cost, | |
5106 | h_type: hopData.h_type, | |
5107 | h_form: hopData.h_form, | |
5108 | h_useat: $('#wh_useat').val(), | |
5109 | h_time: hopData.h_time, | |
5110 | h_alpha: hopData.h_alpha, | |
5111 | h_beta: hopData.h_beta, | |
5112 | h_hsi: hopData.h_hsi, | |
5113 | h_humulene: hopData.h_humulene, | |
5114 | h_caryophyllene: hopData.h_caryophyllene, | |
5115 | h_cohumulone: hopData.h_cohumulone, | |
5116 | h_myrcene: hopData.h_myrcene, | |
5117 | h_total_oil: hopData.h_total_oil, | |
5118 | h_inventory: hopData.h_inventory, | |
5119 | h_avail: hopData.h_avail | |
5120 | }; | |
5121 | $('#hopGrid').jqxGrid('updaterow', rowID, row); | |
5122 | calcIBUs(); | |
5123 | }); | |
5124 | $('#wh_name').jqxInput({ theme: theme, width: 320, height: 23 }); | |
5125 | $('#wh_instock').jqxCheckBox({ theme: theme, height: 23 }); | |
5126 | $('#wh_instock').on('change', function(event) { | |
5127 | hopinstock = event.args.checked; | |
5128 | hoplist.dataBind(); | |
5129 | }); | |
5130 | $('#wh_select').jqxDropDownList({ | |
5131 | placeHolder: 'Kies hop:', | |
5132 | theme: theme, | |
5133 | source: hoplist, | |
5134 | displayMember: 'name', | |
5135 | width: 150, | |
5136 | height: 23, | |
5137 | dropDownWidth: 500, | |
5138 | dropDownHeight: 500, | |
5139 | renderer: function(index, label, value) { | |
5140 | var datarecord = hoplist.records[index]; | |
5141 | return datarecord.origin + ' - ' + datarecord.name + ' / ' + HopFormData[datarecord.form].nl + ' (' + datarecord.alpha + ' % α)'; | |
5142 | } | |
5143 | }); | |
5144 | $('#wh_select').on('select', function(event) { | |
5145 | if (event.args) { | |
5146 | var datarecord, index = event.args.index; | |
5147 | datarecord = hoplist.records[index]; | |
5148 | $('#wh_name').val(datarecord.name); | |
5149 | hopData.h_name = datarecord.name; | |
5150 | hopData.h_origin = datarecord.origin; | |
5151 | hopData.h_cost = datarecord.cost; | |
5152 | hopData.h_type = datarecord.type; | |
5153 | hopData.h_form = datarecord.form; | |
5154 | hopData.h_alpha = datarecord.alpha; | |
5155 | hopData.h_beta = datarecord.beta; | |
5156 | hopData.h_hsi = datarecord.hsi; | |
5157 | hopData.h_humulene = datarecord.humulene; | |
5158 | hopData.h_caryophyllene = datarecord.caryophyllene; | |
5159 | hopData.h_cohumulone = datarecord.cohumulone; | |
5160 | hopData.h_myrcene = datarecord.myrcene; | |
5161 | hopData.h_total_oil = datarecord.total_oil; | |
5162 | hopData.h_inventory = datarecord.inventory; | |
5163 | } | |
5164 | }); | |
5165 | $('#wh_amount').jqxNumberInput(Spin1dec); | |
5166 | $('#wh_amount').on('change', function(event) { | |
5167 | console.log('amount changed: ' + event.args.value + ' time:' + hopData.h_time + ' alpha:' + hopData.h_alpha); | |
5168 | var ibu, amount = parseFloat(event.args.value) / 1000; | |
5169 | ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')), | |
538
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
5170 | amount, parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $('#ibu_method').val(), |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
5171 | dataRecord.brew_whirlpool9, dataRecord.brew_whirlpool7, dataRecord.brew_whirlpool6 |
478 | 5172 | ); |
5173 | hopData.h_amount = amount; | |
5174 | $('#wh_ibu').val(ibu); | |
5175 | }); | |
5176 | $('#wh_ibu').jqxNumberInput(Show1dec); | |
5177 | $('#wh_time').jqxNumberInput(PosInt); | |
5178 | $('#wh_time').on('change', function(event) { | |
5179 | var ibu, newtime = parseFloat(event.args.value); | |
5180 | // Check limits and correct | |
5181 | if (hopData.h_useat == 2) { // Boil | |
5182 | if (newtime > parseFloat($('#boil_time').jqxNumberInput('decimal'))) { | |
5183 | newtime = parseFloat($('#boil_time').jqxNumberInput('decimal')); | |
5184 | $('#wh_time').val(newtime); | |
5185 | } | |
5186 | hopData.h_time = newtime; | |
5187 | } else if (hopData.h_useat == 5) { // Dry hop | |
5188 | if (newtime > 21) { | |
5189 | newtime = 21; | |
5190 | $('#wh_time').val(newtime); | |
5191 | } | |
5192 | hopData.h_time = newtime * 1440; | |
5193 | } | |
5194 | ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')), | |
538
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
5195 | parseFloat(hopData.h_amount), parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $('#ibu_method').val(), |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
5196 | dataRecord.brew_whirlpool9, dataRecord.brew_whirlpool7, dataRecord.brew_whirlpool6); |
478 | 5197 | $('#wh_ibu').val(ibu); |
5198 | }); | |
5199 | $('#wh_useat').jqxDropDownList({ | |
5200 | theme: theme, | |
5201 | source: HopUseAdapter, | |
5202 | valueMember: 'id', | |
5203 | displayMember: 'nl', | |
5204 | width: 180, | |
5205 | height: 23, | |
5206 | autoDropDownHeight: true, | |
5207 | dropDownVerticalAlignment: 'top' | |
5208 | }); | |
5209 | $('#wh_useat').on('select', function(event) { | |
5210 | if (event.args) { | |
5211 | var index = event.args.index; | |
5212 | hopData.h_useat = index; | |
5213 | if ((index == 0) || (index == 1)) { // Mashhop or First wort hop | |
5214 | hopData.h_time = parseFloat(dataRecord.boil_time); | |
5215 | $('#wh_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
5216 | $('#wh_time').val(hopData.h_time); | |
5217 | } else if (index == 3) { // Aroma | |
5218 | hopData.h_time = 0; | |
5219 | $('#wh_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
5220 | $('#wh_time').val(0); | |
538
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
5221 | } else if (index == 4) { // Whirlpool |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
5222 | hopData.h_time = (parseFloat(dataRecord.brew_whirlpool9) + parseFloat(dataRecord.brew_whirlpool7) + parseFloat(dataRecord.brew_whirlpool6)); |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
5223 | $('#wh_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
5224 | $('#wh_time').val(hopData.h_time); |
41d21817608e
Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents:
525
diff
changeset
|
5225 | } else { // Boil, Dry hop |
478 | 5226 | $('#wh_time').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
5227 | } | |
5228 | if (index == 5) // Dry hop | |
5229 | $('#wh_pmpt_time').html('Tijd in dagen'); | |
5230 | else | |
5231 | $('#wh_pmpt_time').html('Tijd in minuten'); | |
5232 | } | |
5233 | }); | |
5234 | ||
5235 | // Tab 5, Miscs | |
5236 | $('#popupMisc').jqxWindow({ | |
5237 | width: 800, | |
5238 | height: 275, | |
5239 | position: { x: 230, y: 100 }, | |
5240 | resizable: false, | |
5241 | theme: theme, | |
5242 | isModal: true, | |
5243 | autoOpen: false, | |
5244 | cancelButton: $('#MiscReady'), | |
5245 | modalOpacity: 0.40 | |
5246 | }); | |
5247 | $('#MiscReady').jqxButton({ template: 'success', width: '90px', theme: theme }); | |
5248 | $('#MiscReady').click(function() { | |
5249 | var row, rowID = $('#miscGrid').jqxGrid('getrowid', miscRow); | |
5250 | console.log('MiscReady row:' + miscRow + ' ID:' + rowID); | |
5251 | row = { | |
5252 | m_name: miscData.m_name, | |
5253 | m_amount: miscData.m_amount, | |
5254 | m_cost: miscData.m_cost, | |
5255 | m_type: miscData.m_type, | |
5256 | m_use_use: miscData.m_use_use, | |
5257 | m_time: miscData.m_time, | |
5258 | m_amount_is_weight: miscData.m_amount_is_weight, | |
5259 | m_inventory: miscData.m_inventory, | |
5260 | m_avail: miscData.m_avail | |
5261 | }; | |
5262 | $('#miscGrid').jqxGrid('updaterow', rowID, row); | |
5263 | calcMiscs(); | |
5264 | }); | |
5265 | $('#wm_name').jqxInput({ theme: theme, width: 320, height: 23 }); | |
5266 | $('#wm_instock').jqxCheckBox({ theme: theme, height: 23 }); | |
5267 | $('#wm_instock').on('change', function(event) { | |
5268 | miscinstock = event.args.checked; | |
5269 | misclist.dataBind(); | |
5270 | }); | |
5271 | $('#wm_select').jqxDropDownList({ | |
5272 | placeHolder: 'Kies ingrediënt:', | |
5273 | theme: theme, | |
5274 | source: misclist, | |
5275 | displayMember: 'name', | |
5276 | width: 150, | |
5277 | height: 23, | |
5278 | dropDownWidth: 500, | |
5279 | dropDownHeight: 500 | |
5280 | }); | |
5281 | $('#wm_select').on('select', function(event) { | |
5282 | if (event.args) { | |
5283 | var datarecord, index = event.args.index; | |
5284 | datarecord = misclist.records[index]; | |
5285 | $('#wm_name').val(datarecord.name); | |
5286 | miscData.m_name = datarecord.name; | |
5287 | miscData.m_cost = datarecord.cost; | |
5288 | miscData.m_type = datarecord.type; | |
5289 | miscData.m_use_use = datarecord.use_use; | |
5290 | miscData.m_amount_is_weight = datarecord.amount_is_weight; | |
5291 | miscData.m_inventory = datarecord.inventory; | |
5292 | } | |
5293 | }); | |
5294 | $('#wm_amount').jqxNumberInput(Spin2dec); | |
5295 | $('#wm_amount').on('change', function(event) { | |
5296 | console.log('amount changed: ' + event.args.value); | |
5297 | miscData.m_amount = parseFloat(event.args.value) / 1000; | |
5298 | }); | |
5299 | $('#wm_time').jqxNumberInput(PosInt); | |
5300 | $('#wm_time').on('change', function(event) { | |
5301 | var newtime = parseFloat(event.args.value); | |
5302 | ||
5303 | if (miscData.m_use_use == 2) { // Boil | |
5304 | if (newtime > parseFloat($('#boil_time').jqxNumberInput('decimal'))) { | |
5305 | newtime = parseFloat($('#boil_time').jqxNumberInput('decimal')); | |
5306 | $('#wm_time').val(newtime); | |
5307 | } | |
5308 | miscData.m_time = newtime; | |
5309 | } else if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) { // Primary or Secondary | |
5310 | if (newtime > 21) { | |
5311 | newtime = 21; | |
5312 | $('#wm_time').val(newtime); | |
5313 | } | |
5314 | miscData.m_time = newtime * 1440; | |
5315 | } | |
5316 | }); | |
5317 | $('#wm_use_use').jqxDropDownList({ | |
5318 | theme: theme, | |
5319 | source: MiscUseAdapter, | |
5320 | valueMember: 'id', | |
5321 | displayMember: 'nl', | |
5322 | width: 180, | |
5323 | height: 23, | |
5324 | autoDropDownHeight: true, | |
5325 | dropDownVerticalAlignment: 'top' | |
5326 | }); | |
5327 | $('#wm_use_use').on('select', function(event) { | |
5328 | if (event.args) { | |
5329 | var index = event.args.index; | |
5330 | miscData.m_use_use = index; | |
5331 | if ((index == 2) || (index == 3) || (index == 4)) { // Boil, Primary or Secondary | |
5332 | $('#wm_time').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); | |
5333 | } else { | |
5334 | $('#wm_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); | |
5335 | $('#wm_time').val(0); | |
5336 | miscData.m_time = 0; | |
5337 | } | |
5338 | } | |
5339 | }); | |
5340 | ||
5341 | // Tab 6, Yeasts | |
5342 | $('#est_fg2').jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' }); | |
622
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
5343 | $('#est_abv2').jqxTooltip({ content: 'Verwacht alcohol volume %. Dit wordt automatisch berekend.' }); |
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
5344 | $('#yeast_cells').jqxTooltip({ content: 'Het aantal miljard beschikbare gistcellen zonder eventuele starter.' }); |
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
5345 | $('#need_cells').jqxTooltip({ content: 'Het aantal miljard nodige cellen is afhankelijk van het begin SG, biertype en volume.' }); |
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
5346 | $('#plato_cells').jqxTooltip({ content: 'De berekende pitchrate in miljard cellen per ml per graad Plato.' }); |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
5347 | $('#yeast_prod_date').jqxTooltip({ content: 'Bij korrelgisten is meestal "best voor" datum op het zakje gedrukt.<br>Gebruik die datum maar dan twee jaar eerder als productie datum.<br>Bij White Labs is de productie datum vier maanden voor de "Best by" datum die geprint op het buisje.<br>Bij Wyeast is dit de "manufacture date" die op het pak geprint is.<br>Voor schuine buis, slurry, opkweek en gedroogd is dit de datum dat je de gist geoogst hebt.' }); |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5348 | |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5349 | $('#est_fg2,#plato_cells').jqxNumberInput(Show3dec); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5350 | $('#est_abv2').jqxNumberInput(Show2dec); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5351 | $('#yeast_cells,#need_cells').jqxNumberInput(Show1dec); |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
5352 | $('#yeast_prod_date').jqxDateTimeInput(Dateopts); |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
5353 | $('#yeast_prod_date').on('close', function(event) { |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
5354 | calcViability(); |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
5355 | calcFermentables(); |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
5356 | calcYeast(); |
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
5357 | }); |
478 | 5358 | $('#popupYeast').jqxWindow({ |
5359 | width: 800, | |
5360 | height: 300, | |
5361 | position: { x: 230, y: 100 }, | |
5362 | resizable: false, | |
5363 | theme: theme, | |
5364 | isModal: true, | |
5365 | autoOpen: false, | |
5366 | cancelButton: $('#YeastReady'), | |
5367 | modalOpacity: 0.40 | |
5368 | }); | |
5369 | $('#YeastReady').jqxButton({ template: 'success', width: '90px', theme: theme }); | |
5370 | $('#YeastReady').click(function() { | |
5371 | var row, rowID = $('#yeastGrid').jqxGrid('getrowid', yeastRow); | |
5372 | console.log('YeastReady row:' + yeastRow + ' ID:' + rowID); | |
5373 | row = { | |
5374 | y_name: yeastData.y_name, | |
5375 | y_laboratory: yeastData.y_laboratory, | |
5376 | y_product_id: yeastData.y_product_id, | |
5377 | y_amount: yeastData.y_amount, | |
5378 | y_cost: yeastData.y_cost, | |
5379 | y_type: yeastData.y_type, | |
5380 | y_form: yeastData.y_form, | |
5381 | y_flocculation: yeastData.y_flocculation, | |
5382 | y_min_temperature: yeastData.y_min_temperature, | |
5383 | y_max_temperature: yeastData.y_max_temperature, | |
5384 | y_attenuation: yeastData.y_attenuation, | |
5385 | y_use: yeastData.y_use, | |
5386 | y_cells: yeastData.y_cells, | |
5387 | y_tolerance: yeastData.y_tolerance, | |
5388 | y_inventory: yeastData.y_inventory, | |
554
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
5389 | y_sta1: yeastData.y_sta1, |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
5390 | y_bacteria: yeastData.y_bacteria, |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
5391 | y_harvest_top: yeastData.y_harvest_top, |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
5392 | y_harvest_time: yeastData.y_harvest_time, |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
5393 | y_pitch_temperature: yeastData.y_pitch_temperature, |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
5394 | y_pofpos: yeastData.y_pofpos, |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
5395 | y_zymocide: yeastData.y_zymocide, |
478 | 5396 | y_avail: yeastData.y_avail |
5397 | }; | |
5398 | $('#yeastGrid').jqxGrid('updaterow', rowID, row); | |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
5399 | calcViability(); |
478 | 5400 | calcFermentables(); |
5401 | calcYeast(); | |
5402 | }); | |
610 | 5403 | $('#wy_name,#wy_laboratory,#wy_product_id').jqxInput({ theme: theme, width: 320, height: 23 }); |
478 | 5404 | $('#wy_instock').jqxCheckBox({ theme: theme, height: 23 }); |
5405 | $('#wy_instock').on('change', function(event) { | |
5406 | yeastinstock = event.args.checked; | |
5407 | yeastlist.dataBind(); | |
5408 | }); | |
5409 | $('#wy_select').jqxDropDownList({ | |
5410 | placeHolder: 'Kies gist:', | |
5411 | theme: theme, | |
5412 | source: yeastlist, | |
5413 | displayMember: 'name', | |
5414 | width: 150, | |
5415 | height: 23, | |
5416 | dropDownWidth: 500, | |
5417 | dropDownHeight: 500, | |
5418 | renderer: function(index, label, value) { | |
5419 | var datarecord = yeastlist.records[index]; | |
5420 | return datarecord.laboratory + ' ' + datarecord.product_id + ' ' + datarecord.name; | |
5421 | } | |
5422 | }); | |
5423 | $('#wy_select').on('select', function(event) { | |
5424 | if (event.args) { | |
5425 | var datarecord, index = event.args.index; | |
5426 | datarecord = yeastlist.records[index]; | |
5427 | $('#wy_name').val(datarecord.name); | |
5428 | $('#wy_laboratory').val(datarecord.laboratory); | |
5429 | $('#wy_product_id').val(datarecord.product_id); | |
5430 | yeastData.y_name = datarecord.name; | |
5431 | yeastData.y_cost = datarecord.cost; | |
5432 | yeastData.y_type = datarecord.type; | |
5433 | yeastData.y_form = datarecord.form; | |
5434 | yeastData.y_laboratory = datarecord.laboratory; | |
5435 | yeastData.y_product_id = datarecord.product_id; | |
5436 | yeastData.y_min_temperature = datarecord.min_temperature; | |
5437 | yeastData.y_max_temperature = datarecord.max_temperature; | |
5438 | yeastData.y_flocculation = datarecord.flocculation; | |
5439 | yeastData.y_attenuation = datarecord.attenuation; | |
5440 | yeastData.y_cells = datarecord.cells; | |
5441 | yeastData.y_inventory = datarecord.inventory; | |
554
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
5442 | yeastData.y_sta1 = datarecord.sta1; |
561
dc618b8a9552
Refracto calculation for FG is now a global function using the New Cubic method. Fixed to typos in the prod_edit en rec_edit yeastData varialbles.
Michiel Broek <mbroek@mbse.eu>
parents:
560
diff
changeset
|
5443 | yeastData.y_bacteria = datarecord.bacteria; |
554
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
5444 | yeastData.y_harvest_top = datarecord.harvest_top; |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
5445 | yeastData.y_harvest_time = datarecord.harvest_time; |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
5446 | yeastData.y_pitch_temperature = datarecord.pitch_temperature; |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
5447 | yeastData.y_pofpos = datarecord.pofpos; |
c62ff53cfc3d
Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
552
diff
changeset
|
5448 | yeastData.y_zymocide = datarecord.zymocide; |
478 | 5449 | if (yeastData.y_form == 0) { |
5450 | $('#wy_pmpt_amount').html('Pak(ken):'); | |
515
9d771385a8a0
Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.
Michiel Broek <mbroek@mbse.eu>
parents:
500
diff
changeset
|
5451 | } else if (yeastData.y_form == 1 || yeastData.y_form == 6) { |
478 | 5452 | $('#wy_pmpt_amount').html('Gewicht gram:'); |
5453 | } else { | |
5454 | $('#wy_pmpt_amount').html('Volume ml:'); | |
5455 | } | |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
5456 | calcViability(); |
478 | 5457 | calcFermentables(); |
5458 | calcYeast(); | |
5459 | } | |
5460 | }); | |
5461 | $('#wy_amount').jqxNumberInput(Spin1dec); | |
5462 | $('#wy_amount').on('change', function(event) { | |
5463 | var amount = parseFloat(event.args.value); | |
5464 | if (yeastData.y_form != 0) // not Liquid | |
5465 | amount = parseFloat(event.args.value) / 1000; | |
5466 | yeastData.y_amount = amount; | |
5467 | calcFermentables(); | |
5468 | calcYeast(); | |
5469 | }); | |
5470 | $('#wy_use').jqxDropDownList({ | |
5471 | theme: theme, | |
5472 | source: YeastUseAdapter, | |
5473 | valueMember: 'id', | |
5474 | displayMember: 'nl', | |
5475 | width: 180, | |
5476 | height: 23, | |
5477 | autoDropDownHeight: true, | |
5478 | dropDownVerticalAlignment: 'top' | |
5479 | }); | |
5480 | $('#wy_use').on('select', function(event) { | |
5481 | if (event.args) { | |
5482 | var index = event.args.index; | |
5483 | yeastData.y_use = index; | |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
5484 | calcViability(); |
478 | 5485 | calcFermentables(); |
5486 | calcYeast(); | |
5487 | } | |
5488 | }); | |
5489 | for (i = 1; i < 5; i++) { | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5490 | $('#prop' + i + '_volume').jqxTooltip({ content: 'Het volume van deze starter stap.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5491 | $('#prop' + i + '_irate').jqxTooltip({ content: 'Voor de beste gistgroei, houd de injectie factor tussen de 25 en 100 miljoen cellen per ml.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5492 | $('#prop' + i + '_ncells').jqxTooltip({ content: 'Het aantal miljard nieuwe gistcellen in deze stap.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5493 | $('#prop' + i + '_tcells').jqxTooltip({ content: 'Het totaal aantal miljard gistcellen na deze stap.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5494 | $('#prop' + i + '_growf').jqxTooltip({ content: 'De groeifactor, minstens 1. Ongeroerde starters komen meestal niet boven de 3.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5495 | |
478 | 5496 | $('#prop' + i + '_type').jqxDropDownList({ |
5497 | theme: theme, | |
5498 | source: StarterTypeAdapter, | |
5499 | valueMember: 'id', | |
5500 | displayMember: 'nl', | |
5501 | width: 120, | |
5502 | height: 23, | |
5503 | autoDropDownHeight: true | |
5504 | }); | |
5505 | $('#prop' + i + '_volume').jqxNumberInput(Spin3dec); | |
610 | 5506 | $('#prop' + i + '_irate,#prop' + i + '_ncells,#prop' + i + '_tcells').jqxNumberInput(Show1dec); |
478 | 5507 | $('#prop' + i + '_growf').jqxNumberInput(Show2dec); |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5508 | $('#prop' + i + '_type,#prop' + i + '_volume,#prop' + i + '_irate,#prop' + i + '_ncells,#prop' + i + '_tcells,#prop' + i + '_growf').hide(); |
478 | 5509 | } |
619
4938909df593
Fixed starter production date tooltip. Upgraded jqwidgets from version 8.1.4 to 9.0.0
Michiel Broek <mbroek@mbse.eu>
parents:
618
diff
changeset
|
5510 | $('#starter_type').jqxTooltip({ content: 'starter_type' }); |
478 | 5511 | $('#starter_type').jqxDropDownList({ |
5512 | theme: theme, | |
5513 | source: StarterTypeAdapter, | |
5514 | valueMember: 'id', | |
5515 | displayMember: 'nl', | |
5516 | width: 120, | |
5517 | height: 23, | |
5518 | autoDropDownHeight: true | |
5519 | }); | |
518
00e110567fee
The default starter SG changed to 1.037. Added several tooltips on the yeast tab.
Michiel Broek <mbroek@mbse.eu>
parents:
515
diff
changeset
|
5520 | $('#starter_sg').jqxTooltip({ content: 'Het ideale starter SG moet tussen de 1.030 en 1.040 zijn. Optimaal is 1.037.' }); |
478 | 5521 | $('#starter_sg').jqxNumberInput(SGopts); |
617
f962f1e5936e
Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents:
616
diff
changeset
|
5522 | $('#starter_viability').jqxTooltip({ content: 'De gist conditie.' }); |
622
39902353b159
Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents:
621
diff
changeset
|
5523 | $('#starter_viability').jqxNumberInput(Show0dec); |
478 | 5524 | $('#starter_try').jqxButton({ template: 'primary', width: '100px', height: 23, theme: theme }); |
5525 | ||
5526 | // Tab 7, Mashing | |
5527 | $('#mash_name').jqxTooltip({ content: 'De omschrijving van dit maisch profiel.' }); | |
5528 | $('#mash_name').jqxInput({ theme: theme, width: 320, height: 23 }); | |
5529 | $('#mash_select').jqxDropDownList({ | |
5530 | placeHolder: 'Kies schema:', | |
5531 | theme: theme, | |
5532 | source: mashlist, | |
5533 | displayMember: 'name', | |
5534 | width: 250, | |
5535 | height: 23, | |
5536 | dropDownWidth: 500, | |
5537 | dropDownHeight: 500, | |
5538 | dropDownHorizontalAlignment: 'right' | |
5539 | }); | |
5540 | $('#mash_select').on('select', function(event) { | |
5541 | if (event.args) { | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5542 | var infused = 0, data, datarecord, rowIDs, rows, i, row, index = event.args.index; |
478 | 5543 | // First delete all current steps |
5544 | rowIDs = new Array(); | |
5545 | rows = $('#mashGrid').jqxGrid('getdisplayrows'); | |
5546 | for (i = 0; i < rows.length; i++) { | |
5547 | row = rows[i]; | |
5548 | rowIDs.push(row.uid); | |
5549 | } | |
5550 | $('#mashGrid').jqxGrid('deleterow', rowIDs); | |
5551 | // Then add the new steps | |
5552 | datarecord = mashlist.records[index]; | |
5553 | $('#mash_name').val(datarecord.name); | |
5554 | for (i = 0; i < datarecord.steps.length; i++) { | |
5555 | data = datarecord.steps[i]; | |
5556 | row = {}; | |
5557 | row['step_name'] = data.step_name; | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5558 | row['step_type'] = parseInt(data.step_type); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5559 | row['step_temp'] = parseFloat(data.step_temp); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5560 | row['end_temp'] = parseFloat(data.end_temp); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5561 | row['step_time'] = parseFloat(data.step_time); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5562 | row['ramp_time'] = parseFloat(data.ramp_time); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5563 | row['step_infuse_temp'] = 0.0; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5564 | row['step_infuse_amount'] = 0.0; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5565 | if (mash_infuse == 0 && dataRecord.wg_amount > 0) |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5566 | mash_infuse = dataRecord.wg_amount; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5567 | if (data.step_type == 0) { // Infusion |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5568 | if (i == 0) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5569 | row['step_infuse_amount'] = parseFloat(mash_infuse); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5570 | } else { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5571 | row['step_infuse_temp'] = 99.0; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5572 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5573 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5574 | //console.log(i + ' type: ' + row['step_type'] + ' start infusion: ' + parseFloat(row['step_infuse_amount']) + ' mash_infuse: ' + mash_infuse); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5575 | infused += parseFloat(row['step_infuse_amount']); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5576 | row['step_volume'] = infused; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5577 | if (mashkg > 0) |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5578 | row['step_wg_ratio'] = Round(parseFloat(mash_infuse / mashkg), 2); |
478 | 5579 | else |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5580 | row['step_wg_ratio'] = 0; |
478 | 5581 | $('#mashGrid').jqxGrid('addrow', null, row); |
5582 | } | |
490
6c9ad1317f0a
Recalculate mash after changing mash parameters.
Michiel Broek <mbroek@mbse.eu>
parents:
489
diff
changeset
|
5583 | calcMash(); |
478 | 5584 | } |
5585 | }); | |
484
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
5586 | $('#est_mashvol').jqxTooltip({ content: 'Het totale volume van het maishwater en de mout in de maish pan.' }); |
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
5587 | $('#est_mashvol').jqxNumberInput(Show1dec); |
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
5588 | $('#est_mashtime').jqxTooltip({ content: 'De totale tijdsduur van het maischen.' }); |
2083c274b283
In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents:
479
diff
changeset
|
5589 | $('#est_mashtime').jqxInput({ theme: theme, width: 70, height: 23 }); |
478 | 5590 | $('#popupMash').jqxWindow({ |
5591 | width: 800, | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5592 | height: 375, |
478 | 5593 | position: { x: 230, y: 100 }, |
5594 | resizable: false, | |
5595 | theme: theme, | |
5596 | isModal: true, | |
5597 | autoOpen: false, | |
5598 | cancelButton: $('#MashReady'), | |
5599 | modalOpacity: 0.40 | |
5600 | }); | |
5601 | $('#MashReady').jqxButton({ template: 'success', width: '90px', theme: theme }); | |
5602 | $('#MashReady').click(function() { | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5603 | calcFermentables(); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5604 | calcWater(); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5605 | calcSparge(); |
478 | 5606 | calcMash(); |
5607 | }); | |
5608 | $('#wstep_name').jqxInput({ theme: theme, width: 320, height: 23 }); | |
5609 | $('#wstep_name').on('change', function(event) { | |
5610 | var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5611 | rowdata.step_name = $('#wstep_name').val(); |
478 | 5612 | }); |
5613 | $('#wstep_type').jqxDropDownList({ | |
5614 | theme: theme, | |
5615 | source: MashStepTypeAdapter, | |
5616 | valueMember: 'id', | |
5617 | displayMember: 'nl', | |
5618 | width: 180, | |
5619 | height: 23, | |
5620 | autoDropDownHeight: true | |
5621 | }); | |
5622 | $('#wstep_type').on('select', function(event) { | |
5623 | if (event.args) { | |
5624 | var rowdata, i, rows, row, index = event.args.index; | |
5625 | rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5626 | if (rowdata.step_type != index) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5627 | rowdata.step_type = index; |
478 | 5628 | $('#wstep_infuse_amount').hide(); |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5629 | $('#wstep_infuse_temp').hide(); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5630 | $('#wstep_pmpt_amount').hide(); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5631 | $('#wstep_pmpt_temp').hide(); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5632 | if (index == 0) { // Infusion |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5633 | if (mashRow == 0) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5634 | $('#wstep_infuse_amount').show(); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5635 | $('#wstep_pmpt_amount').show(); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5636 | } else { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5637 | $('#wstep_infuse_temp').show(); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5638 | $('#wstep_pmpt_temp').show(); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5639 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5640 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5641 | if (index == 1) { // Temperature |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5642 | if (mashRow > 0) |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5643 | rowdata.step_infuse_amount = 0; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5644 | rowdata.step_infuse_temp = 0; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5645 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5646 | if (index == 2) { // Decoction |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5647 | var rowprev = $('#mashGrid').jqxGrid('getrowdata', mashRow-1); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5648 | rowdata.step_infuse_temp = 99; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5649 | rowdata.step_infuse_amount = decoctionVol(rowdata.step_volume, rowdata.step_temp, rowprev.end_temp); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5650 | console.log('decoction: ' + rowdata.step_infuse_amount + '/' + rowdata.step_infuse_temp); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5651 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5652 | $('#mashGrid').jqxGrid('updaterow', mashRow, rowdata); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5653 | mash_infuse = 0; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5654 | rows = $('#mashGrid').jqxGrid('getrows'); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5655 | for (i = 0; i < rows.length; i++) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5656 | row = rows[i]; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5657 | if (row.step_type == 0) // Infusion |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5658 | mash_infuse += parseFloat(row.step_infuse_amount); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5659 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5660 | calcMash(); |
478 | 5661 | } |
5662 | } | |
5663 | }); | |
5664 | $('#wstep_temp').on('change', function(event) { | |
5665 | var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5666 | if (rowdata.step_type == 2) { // Decoction |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5667 | var rowprev = $('#mashGrid').jqxGrid('getrowdata', mashRow-1); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5668 | var a = (dataRecord.eq_tun_weight * dataRecord.eq_tun_specific_heat + rowdata.step_volume * SpecificHeatWater) * |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5669 | (parseFloat(event.args.value) - rowprev.end_temp); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5670 | var b = SpecificHeatWater * (99 - parseFloat(event.args.value)); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5671 | if (b > 0) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5672 | rowdata.step_temp = parseFloat(event.args.value); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5673 | rowdata.step_infuse_amount = Round(a / b, 2); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5674 | } else |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5675 | rowdata.step_infuse_amount = 0; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5676 | console.log('change temp ' + rowdata.step_temp + ' decoction: ' + rowdata.step_infuse_amount + '/' + rowdata.step_infuse_temp); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5677 | } else { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5678 | rowdata.step_temp = parseFloat(event.args.value); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5679 | } |
478 | 5680 | }); |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5681 | $('#wstep_temp,#wend_temp,#wstep_infuse_amount,#wstep_infuse_temp').jqxNumberInput(Spin1dec); |
478 | 5682 | $('#wend_temp').on('change', function(event) { |
5683 | var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); | |
5684 | rowdata.end_temp = parseFloat(event.args.value); | |
5685 | }); | |
610 | 5686 | $('#wstep_time,#wramp_time').jqxNumberInput(PosInt); |
478 | 5687 | $('#wstep_time').on('change', function(event) { |
5688 | var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); | |
5689 | rowdata.step_time = parseFloat(event.args.value); | |
490
6c9ad1317f0a
Recalculate mash after changing mash parameters.
Michiel Broek <mbroek@mbse.eu>
parents:
489
diff
changeset
|
5690 | calcMash(); |
478 | 5691 | }); |
5692 | $('#wramp_time').on('change', function(event) { | |
5693 | var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); | |
5694 | rowdata.ramp_time = parseFloat(event.args.value); | |
490
6c9ad1317f0a
Recalculate mash after changing mash parameters.
Michiel Broek <mbroek@mbse.eu>
parents:
489
diff
changeset
|
5695 | calcMash(); |
478 | 5696 | }); |
5697 | $('#wstep_infuse_amount').on('change', function(event) { | |
5698 | var row, i, rows, rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); | |
5699 | rowdata.step_infuse_amount = parseFloat(event.args.value); | |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5700 | if (mashRow == 0) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5701 | rowdata.step_infuse_amount = parseFloat(event.args.value); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5702 | mash_infuse = 0; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5703 | rows = $('#mashGrid').jqxGrid('getrows'); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5704 | for (i = 0; i < rows.length; i++) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5705 | row = rows[i]; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5706 | if (row.step_type == 0) // Infusion |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5707 | mash_infuse += parseFloat(row.step_infuse_amount); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5708 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5709 | if (dataRecord.w2_amount == 0) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5710 | dataRecord.w1_amount = mash_infuse; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5711 | $('#w1_amount').val(mash_infuse); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5712 | } else { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5713 | var w1_amount = (dataRecord.w1_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5714 | var w2_amount = (dataRecord.w2_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5715 | dataRecord.w1_amount = Round(w1_amount, 3); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5716 | dataRecord.w2_amount = Round(w2_amount, 3); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5717 | $('#w1_amount').val(dataRecord.w1_amount); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5718 | $('#w2_amount').val(dataRecord.w2_amount); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5719 | } |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5720 | $('#wg_amount').val(mash_infuse); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5721 | console.log('new infuse amount: ' + mash_infuse); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5722 | calcWater(); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5723 | // calcMash(); |
478 | 5724 | } |
667
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5725 | }); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5726 | $('#wstep_infuse_temp').on('change', function(event) { |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5727 | var prevdata = $('#mashGrid').jqxGrid('getrowdata', mashRow-1); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5728 | var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5729 | rowdata.step_infuse_temp = parseFloat(event.args.value); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5730 | var vol = infusionVol(prevdata.step_volume, mashkg, rowdata.step_infuse_temp, rowdata.step_temp, prevdata.end_temp); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5731 | console.log('new vol: ' + vol); |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5732 | rowdata.step_infuse_amount = vol; |
1246550451ca
Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents:
662
diff
changeset
|
5733 | $('#wstep_infuse_amount').val(vol); |
478 | 5734 | }); |
5735 | ||
5736 | // Tab 8, Water | |
5737 | $('#tgt_bu').jqxNumberInput(Show2wat); | |
610 | 5738 | $('#tgt_so4_cl,#got_so4_cl').jqxNumberInput(Show1wat); |
478 | 5739 | |
5740 | // Water source 1 | |
5741 | $('#w1_name').jqxDropDownList({ | |
5742 | placeHolder: 'Kies hoofd water:', | |
5743 | theme: theme, | |
5744 | source: waterlist, | |
5745 | displayMember: 'name', | |
5746 | width: 250, | |
5747 | height: 27, | |
5748 | dropDownWidth: 400, | |
5749 | dropDownHeight: 400 | |
5750 | }); | |
5751 | $('#w1_name').on('select', function(event) { | |
5752 | if (event.args) { | |
5753 | var datarecord, index = event.args.index; | |
5754 | datarecord = waterlist.records[index]; | |
5755 | dataRecord.w1_name = datarecord.name; | |
5756 | $('#w1_calcium').val(datarecord.calcium); | |
5757 | dataRecord.w1_calcium = datarecord.calcium; | |
5758 | $('#w1_sulfate').val(datarecord.sulfate); | |
5759 | dataRecord.w1_sulfate = datarecord.sulfate; | |
5760 | $('#w1_chloride').val(datarecord.chloride); | |
5761 | dataRecord.w1_chloride = datarecord.chloride; | |
5762 | $('#w1_sodium').val(datarecord.sodium); | |
5763 | dataRecord.w1_sodium = datarecord.sodium; | |
5764 | $('#w1_magnesium').val(datarecord.magnesium); | |
5765 | dataRecord.w1_magnesium = datarecord.magnesium; | |
5766 | $('#w1_total_alkalinity').val(datarecord.total_alkalinity); | |
5767 | dataRecord.w1_total_alkalinity = datarecord.total_alkalinity; | |
5768 | $('#w1_ph').val(datarecord.ph); | |
5769 | dataRecord.w1_ph = datarecord.ph; | |
5770 | $('#w1_cost').val(datarecord.cost); | |
5771 | dataRecord.w1_cost = datarecord.cost; | |
5772 | calcWater(); | |
5773 | } | |
5774 | }); | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
5775 | $('#w1_amount,#w1_calcium,#w1_magnesium,#w1_sodium,#w1_total_alkalinity,#w1_chloride,#w1_sulfate').jqxNumberInput(Show1wat); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
5776 | $('#w1_ph').jqxNumberInput(Show2wat); |
478 | 5777 | // Water source 2 |
5778 | $('#w2_name').jqxDropDownList({ | |
5779 | placeHolder: 'Kies meng water:', | |
5780 | theme: theme, | |
5781 | source: waterlist, | |
5782 | displayMember: 'name', | |
5783 | width: 250, | |
5784 | height: 27, | |
5785 | dropDownWidth: 400, | |
5786 | dropDownHeight: 400 | |
5787 | }); | |
5788 | $('#w2_name').on('select', function(event) { | |
5789 | if (event.args) { | |
5790 | var datarecord, index = event.args.index; | |
5791 | datarecord = waterlist.records[index]; | |
5792 | dataRecord.w2_name = datarecord.name; | |
5793 | $('#w2_calcium').val(datarecord.calcium); | |
5794 | dataRecord.w2_calcium = datarecord.calcium; | |
5795 | $('#w2_sulfate').val(datarecord.sulfate); | |
5796 | dataRecord.w2_sulfate = datarecord.sulfate; | |
5797 | $('#w2_chloride').val(datarecord.chloride); | |
5798 | dataRecord.w2_chloride = datarecord.chloride; | |
5799 | $('#w2_sodium').val(datarecord.sodium); | |
5800 | dataRecord.w2_sodium = datarecord.sodium; | |
5801 | $('#w2_magnesium').val(datarecord.magnesium); | |
5802 | dataRecord.w2_magnesium = datarecord.magnesium; | |
5803 | $('#w2_total_alkalinity').val(datarecord.total_alkalinity); | |
5804 | dataRecord.w2_total_alkalinity = datarecord.total_alkalinity; | |
5805 | $('#w2_ph').val(datarecord.ph); | |
5806 | dataRecord.w2_ph = datarecord.ph; | |
5807 | $('#w2_cost').val(datarecord.cost); | |
5808 | dataRecord.w2_cost = datarecord.cost; | |
5809 | $('#w2_amount').jqxNumberInput({ max: 100000, readOnly: false }); // Set high max to enable the spinbuttons. | |
5810 | calcWater(); | |
5811 | } | |
5812 | }); | |
5813 | $('#w2_amount').jqxTooltip({ content: 'De verdeling van het hoofd en meng water. Het totale maisch water volume blijft gelijk.'}); | |
5814 | $('#w2_amount').jqxNumberInput({ | |
5815 | inputMode: 'simple', spinMode: 'simple', theme: theme, width: 94, height: 23, min: 0, max: 0, decimalDigits: 1, | |
612
576128de01e3
Fixed mash infuse amount division
Michiel Broek <mbroek@mbse.eu>
parents:
610
diff
changeset
|
5816 | spinButtons: true, spinButtonsStep: 0.1, readOnly: true |
478 | 5817 | }); |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
5818 | $('#w2_calcium,#w2_magnesium,#w2_sodium,#w2_total_alkalinity,#w2_chloride,#w2_sulfate').jqxNumberInput(Show1wat); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
5819 | $('#w2_ph').jqxNumberInput(Show2wat); |
478 | 5820 | // Water mixed |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
5821 | $('#wg_amount,#wg_calcium,#wg_magnesium,#wg_sodium,#wg_total_alkalinity,#wg_chloride,#wg_sulfate').jqxNumberInput(Show1wat); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
5822 | $('#wg_ph').jqxNumberInput(Show2wat); |
478 | 5823 | // Water treated |
5824 | $('#wb_calcium').jqxTooltip({ content: 'De ideale hoeveelheid Calcium is tussen 40 en 150.'}); | |
607
0efba09a694c
Added low limit for magnesium of 10 ppm
Michiel Broek <mbroek@mbse.eu>
parents:
602
diff
changeset
|
5825 | $('#wb_magnesium').jqxTooltip({ content: 'De ideale hoeveelheid Magnesium is tusse 10 en 30.'}); |
478 | 5826 | $('#wb_sodium').jqxTooltip({ content: 'De ideale hoeveelheid Natrium is lager dan 150.'}); |
5827 | $('#wb_chloride').jqxTooltip({ content: 'De ideale hoeveelheid Chloride is tussen 50 en 100.'}); | |
5828 | $('#wb_sulfate').jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is tussen 50 en 350.'}); | |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
5829 | $('#wb_calcium,#wb_magnesium,#wb_sodium,#wb_total_alkalinity,#wb_chloride,#wb_sulfate').jqxNumberInput(Show1wat); |
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
5830 | $('#wb_ph').jqxNumberInput(Show2wat); |
478 | 5831 | // Water target profile |
5832 | $('#pr_name').jqxDropDownList({ | |
5833 | placeHolder: 'Kies doel profiel:', | |
5834 | theme: theme, | |
5835 | source: waterprofiles, | |
5836 | displayMember: 'name', | |
5837 | width: 250, | |
5838 | height: 27, | |
5839 | dropDownWidth: 400, | |
5840 | dropDownHeight: 300 | |
5841 | }); | |
5842 | $('#pr_name').on('select', function(event) { | |
5843 | if (event.args) { | |
5844 | var datarecord, index = event.args.index; | |
5845 | datarecord = waterprofiles.records[index]; | |
5846 | $('#pr_calcium').val(datarecord.calcium); | |
5847 | $('#pr_sulfate').val(datarecord.sulfate); | |
5848 | $('#pr_chloride').val(datarecord.chloride); | |
5849 | $('#pr_sodium').val(datarecord.sodium); | |
5850 | $('#pr_magnesium').val(datarecord.magnesium); | |
5851 | $('#pr_total_alkalinity').val(datarecord.total_alkalinity); | |
552
ee0db754111e
In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents:
545
diff
changeset
|
5852 | calcWater(); |
478 | 5853 | } |
5854 | }); | |
610 | 5855 | $('#pr_calcium,#pr_magnesium,#pr_sodium,#pr_total_alkalinity,#pr_chloride,#pr_sulfate').jqxNumberInput(Show1wat); |
478 | 5856 | |
5857 | // Water agents | |
5858 | $('#wa_cacl2').jqxTooltip({ content: 'Voor het maken van een ander waterprofiel. Voegt calcium en chloride toe. Voor het verbeteren van zoetere bieren.' }); | |
5859 | $('#wa_caso4').jqxTooltip({ | |
5860 | content: 'Gips. Voor het maken van een ander waterprofiel. Voegt calcium en sulfaat toe. Voor het verbeteren van bittere bieren.' | |
5861 | }); | |
5862 | $('#wa_mgso4').jqxTooltip({ content: 'Epsom zout. Voor het maken van een ander waterprofiel. Voegt magnesium en sulfaat toe. Gebruik spaarzaam!' }); | |
5863 | $('#wa_nacl').jqxTooltip({ | |
5864 | content: 'Keukenzout. Voor het maken van een ander waterprofiel. Voegt natrium en chloride toe. ' + | |
5865 | 'Voor het accentueren van zoetheid. Bij hoge dosering wordt het bier ziltig.' | |
5866 | }); | |
610 | 5867 | $('#wa_cacl2,#wa_caso4,#wa_mgso4,#wa_nacl').jqxNumberInput(Spin1dec); |
478 | 5868 | $('#mash_ph').jqxTooltip({ content: 'Maisch pH tussen 5.2 en 5.6. Gebruik 5.2 voor lichte en 5.5 voor donkere bieren.'}); |
5869 | $('#mash_ph').jqxNumberInput(SpinpH); | |
5870 | $('#calc_acid').jqxCheckBox({ theme: theme, width: 120, height: 23 }); | |
5871 | $('#wa_base_name').jqxDropDownList({ | |
5872 | theme: theme, | |
5873 | source: BaseTypeAdapter, | |
5874 | valueMember: 'id', | |
5875 | displayMember: 'nl', | |
5876 | width: 170, | |
5877 | height: 23, | |
5878 | autoDropDownHeight: true | |
5879 | }); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5880 | $('#wa_base,#wa_acid').jqxNumberInput(Spin2dec); |
478 | 5881 | $('#wa_base').jqxNumberInput({ symbol: ' gr', symbolPosition: 'right' }); |
5882 | $('#wa_acid_name').jqxDropDownList({ | |
5883 | theme: theme, | |
5884 | source: AcidTypeAdapter, | |
5885 | valueMember: 'id', | |
5886 | displayMember: 'nl', | |
5887 | width: 170, | |
5888 | height: 23, | |
5889 | autoDropDownHeight: true | |
5890 | }); | |
5891 | $('#wa_acid').jqxNumberInput({ symbol: ' ml', symbolPosition: 'right' }); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5892 | $('#wa_acid_perc,#sparge_acid_perc').jqxNumberInput(Perc0); |
478 | 5893 | $('#wa_acid_perc').jqxNumberInput({ width: 70, symbol: '%', symbolPosition: 'right' }); |
5894 | // Sparge water | |
610 | 5895 | $('#sparge_temp,#sparge_volume').jqxNumberInput(Spin1dec); |
478 | 5896 | $('#sparge_ph').jqxNumberInput(SpinpH); |
5897 | $('#sparge_source').jqxDropDownList({ | |
5898 | theme: theme, | |
5899 | source: SpargeSourceAdapter, | |
5900 | valueMember: 'id', | |
5901 | displayMember: 'nl', | |
5902 | width: 110, | |
5903 | height: 23, | |
5904 | autoDropDownHeight: true | |
5905 | }); | |
5906 | $('#sparge_acid_amount').jqxNumberInput(Spin2dec); | |
5907 | $('#sparge_acid_amount').jqxNumberInput({ spinButtons: false, readOnly: true, symbol: ' ml', symbolPosition: 'right' }); | |
5908 | $('#sparge_acid_type').jqxDropDownList({ | |
5909 | theme: theme, | |
5910 | source: AcidTypeAdapter, | |
5911 | valueMember: 'id', | |
5912 | displayMember: 'nl', | |
5913 | width: 110, | |
5914 | height: 23, | |
5915 | autoDropDownHeight: true | |
5916 | }); | |
5917 | $('#sparge_acid_perc').jqxNumberInput({ symbol: '%', symbolPosition: 'right' }); | |
5918 | ||
5919 | // Tab 9, Brewday | |
5920 | $('#brew_date_start').jqxTooltip({ content: 'Brouw datum en tijd. Voor planning laat de tijd op 00:00:00 staan.' }); | |
5921 | $('#brew_date_end').jqxTooltip({ content: 'End datum en tijd van de brouw. Leeg laten als er nog niet gebrouwen is.' }); | |
5922 | $('#brew_mash_ph').jqxTooltip({ content: 'De gemeten pH tijdens het maischen eventueel na correctie.' }); | |
5923 | $('#est_mash_ph').jqxTooltip({ content: 'De gewenste pH tijdens het maischen.' }); | |
5924 | $('#brew_preboil_ph').jqxTooltip({ content: 'De gemeten pH in de kookketel na het spoelen en voor de kook.' }); | |
5925 | $('#brew_aboil_ph').jqxTooltip({ content: 'De gemeten pH na het koken.' }); | |
5926 | $('#brew_mash_sg').jqxTooltip({ content: 'Het bereikte SG na het maischen.' }); | |
5927 | $('#est_mash_sg').jqxTooltip({ content: 'Het berekende verwachte SG na het maischen.' }); | |
5928 | $('#brew_preboil_sg').jqxTooltip({ content: 'Het gemeten SG in de kookketel na het spoelen en voor het koken.' }); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5929 | $('#est_pre_sg').jqxTooltip({ content: 'Het berekende SG in de kookketel na het spoelen en voor het koken.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5930 | $('#brew_aboil_sg').jqxTooltip({ content: 'Het gemeten SG in de kookketel na het koken.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5931 | $('#est_og3').jqxTooltip({ content: 'Het gewenste SG in de kookketel na het koken zonder eventuele suikers die tijdens de vergisting toegevoegd worden.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5932 | $('#brew_mash_efficiency').jqxTooltip({ content: 'Het behaalde maisch rendement.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5933 | $('#brew_preboil_volume').jqxTooltip({ content: 'Het gemeten volume van het wort voor het koken.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5934 | $('#est_pre_vol').jqxTooltip({ content: 'Het berekende volume van het wort voor het koken.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5935 | $('#brew_aboil_volume').jqxTooltip({ content: 'Het gemeten volume van het wort na het koken.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5936 | $('#est_a_vol').jqxTooltip({ content: 'Het gewenste volume na het koken.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5937 | $('#brew_preboil_efficiency').jqxTooltip({ content: 'Het berekende rendement voor het koken.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5938 | $('#brew_aboil_efficiency').jqxTooltip({ content: 'Het bereikte rendement na het koken.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5939 | $('#brew_sparge_temperature').jqxTooltip({ content: 'De spoelwater temperatuur, in te stellen in de Water tab.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5940 | $('#brew_sparge_volume').jqxTooltip({ content: 'Het spoelwater voorraad volume, in te stellen in de Water tab.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5941 | $('#brew_date_start,#brew_date_end').jqxDateTimeInput(DateTimeopts); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5942 | $('#brew_date_start,#brew_date_end').on('close', function(event) { calcStage(); }); |
662
4bb005694ce7
Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents:
660
diff
changeset
|
5943 | $('#est_mash_ph').jqxNumberInput(Show2wat); |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5944 | $('#brew_mash_ph,#brew_preboil_ph,#brew_aboil_ph').jqxNumberInput(SpinpH); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
5945 | $('#brew_mash_sg').on('valueChanged', function() { calcMashEfficiency(); }); |
478 | 5946 | $('#brew_preboil_sg').on('valueChanged', function(event) { |
5947 | dataRecord.brew_preboil_sg = event.args.value; | |
5948 | calcEfficiencyBeforeBoil(); | |
5949 | }); | |
610 | 5950 | $('#brew_mash_sg,#brew_preboil_sg,#brew_aboil_sg').jqxNumberInput(SGopts); |
478 | 5951 | $('#brew_aboil_sg').on('valueChanged', function(event) { |
5952 | dataRecord.brew_aboil_sg = event.args.value; | |
5953 | calcEfficiencyAfterBoil(); | |
5954 | calcFermentables(); | |
5955 | calcIBUs(); | |
5956 | }); | |
610 | 5957 | $('#est_mash_sg,#est_pre_sg,#est_og3').jqxNumberInput(Show3wat); |
478 | 5958 | $('#brew_mash_efficiency').jqxNumberInput(Show1dec); |
5959 | $('#brew_preboil_volume').on('valueChanged', function(event) { | |
5960 | dataRecord.brew_preboil_volume = event.args.value; | |
5961 | calcEfficiencyBeforeBoil(); | |
5962 | }); | |
610 | 5963 | $('#brew_preboil_volume,#brew_aboil_volume').jqxNumberInput(Spin1dec); |
478 | 5964 | $('#brew_aboil_volume').on('valueChanged', function(event) { |
5965 | dataRecord.brew_aboil_volume = event.args.value; | |
5966 | calcEfficiencyAfterBoil(); | |
5967 | calcFermentables(); | |
5968 | calcIBUs(); | |
5969 | }); | |
646
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5970 | $('#ketel_volume').jqxNumberInput(Show1dec); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5971 | $('#ketel_cm').jqxNumberInput(Spin1dec); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5972 | $('#ketel_cm').on('change', function(event) { |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5973 | k_cm = parseFloat(event.args.value); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5974 | k_vol = kettle_vol(k_cm, dataRecord.eq_kettle_volume, dataRecord.eq_kettle_height); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5975 | $('#ketel_volume').val(k_vol); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5976 | }); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5977 | $('#volumeReady').jqxButton({ template: 'success', width: '90px', theme: theme }); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5978 | $('#volumeReady').click(function() { |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5979 | /* Is it pre or after boil */ |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5980 | console.log('volumeReady ' + k_what + ' volume: ' + Round(k_vol, 1)); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5981 | if (k_what == 0) { |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5982 | dataRecord.brew_preboil_volume = Round(k_vol, 1); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5983 | $('#brew_preboil_volume').val(Round(k_vol, 1)); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5984 | } else if (k_what == 1) { |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5985 | dataRecord.brew_aboil_volume = Round(k_vol, 1); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5986 | $('#brew_aboil_volume').val(Round(k_vol, 1)); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5987 | } |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5988 | }); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5989 | $('#but_pre_boil').jqxButton({ template: 'success', width: '23px', height: 23, theme: theme }); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5990 | $('#but_pre_boil').bind('click', function() { |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5991 | /* If we already have measured a value, use that. Else use the estimated value. */ |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5992 | if (dataRecord.brew_preboil_volume > 0) |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5993 | k_cm = kettle_cm(dataRecord.brew_preboil_volume, dataRecord.eq_kettle_volume, dataRecord.eq_kettle_height); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5994 | else |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5995 | k_cm = kettle_cm(dataRecord.boil_size * 1.04, dataRecord.eq_kettle_volume, dataRecord.eq_kettle_height); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5996 | k_vol = kettle_vol(k_cm, dataRecord.eq_kettle_volume, dataRecord.eq_kettle_height); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5997 | k_what = 0; |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5998 | $('#ketel_cm').val(k_cm); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
5999 | $('#ketel_volume').val(k_vol); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
6000 | $('#volumeWindow').jqxWindow('open'); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
6001 | }); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
6002 | $('#but_after_boil').jqxButton({ template: 'success', width: 23, height: 23, theme: theme }); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
6003 | $('#but_after_boil').bind('click', function() { |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
6004 | if (dataRecord.brew_aboil_volume > 0) |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
6005 | k_cm = kettle_cm(dataRecord.brew_aboil_volume, dataRecord.eq_kettle_volume, dataRecord.eq_kettle_height); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
6006 | else |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
6007 | k_cm = kettle_cm(dataRecord.batch_size * 1.04, dataRecord.eq_kettle_volume, dataRecord.eq_kettle_height); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
6008 | k_vol = kettle_vol(k_cm, dataRecord.eq_kettle_volume, dataRecord.eq_kettle_height); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
6009 | k_what = 1; |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
6010 | $('#ketel_cm').val(k_cm); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
6011 | $('#ketel_volume').val(k_vol); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
6012 | $('#volumeWindow').jqxWindow('open'); |
2246d830a42a
Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents:
644
diff
changeset
|
6013 | }); |
610 | 6014 | $('#est_pre_vol,#est_a_vol').jqxNumberInput(Show1wat); |
6015 | $('#brew_preboil_efficiency,#brew_aboil_efficiency,#brew_sparge_temperature,#brew_sparge_volume,#brew_sparge_est').jqxNumberInput(Show1dec); | |
478 | 6016 | $('#brew_cooling_to').jqxNumberInput(Spin1dec); |
6017 | $('#brew_sparge_ph').jqxNumberInput(SpinpH); | |
6018 | $('#brew_cooling_method').jqxDropDownList({ | |
6019 | theme: theme, | |
6020 | source: CoolingTypeAdapter, | |
6021 | valueMember: 'id', | |
6022 | displayMember: 'nl', | |
6023 | width: 180, | |
6024 | height: 23, | |
6025 | autoDropDownHeight: true | |
6026 | }); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
6027 | $('#brew_cooling_time,#brew_whirlpool9,#brew_whirlpool7,#brew_whirlpool6,#brew_whirlpool2,#brew_aeration_time,#brew_aeration_speed').jqxNumberInput(PosInt); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
6028 | $('#brew_cooling_time,#brew_aeration_time,#brew_aeration_speed').jqxNumberInput({ max: 1440 }); |
610 | 6029 | $('#brew_whirlpool9,#brew_whirlpool7,#brew_whirlpool6,#brew_whirlpool2').jqxNumberInput({ max: 120 }); |
478 | 6030 | $('#brew_aeration_type').jqxDropDownList({ |
6031 | theme: theme, | |
6032 | source: AerationTypeAdapter, | |
6033 | valueMember: 'id', | |
6034 | displayMember: 'nl', | |
6035 | width: 180, | |
6036 | height: 23, | |
6037 | autoDropDownHeight: true | |
6038 | }); | |
6039 | $('#brew_fermenter_volume').jqxNumberInput(Show1dec); | |
6040 | $('#brew_fermenter_sg').jqxNumberInput(Show3dec); | |
610 | 6041 | $('#brew_fermenter_extrawater,#brew_fermenter_tcloss').jqxNumberInput(Spin1dec); |
6042 | $('#brew_fermenter_ibu,#brew_fermenter_color').jqxNumberInput(Show0dec); | |
478 | 6043 | $('#BLog').jqxButton({ template: 'info', width: '150px', theme: theme }); |
6044 | $('#BLog').click(function() { | |
6045 | // Open log in a new tab. | |
6046 | window.open('log_brew.php?code=' + dataRecord.code + '&name=' + dataRecord.name); | |
6047 | }); | |
6048 | ||
6049 | // Tab 10, Fermentation | |
6050 | // Note, fermentation temps changes must do calcCarbonation() | |
6051 | $('#brew_fermenter_sg2').jqxTooltip({ content: 'Het behaalde SG in het gistvat, overgenomen van de brouwdag.' }); | |
6052 | $('#primary_start_temp').jqxTooltip({ content: 'De begintemperatuur van de hoofdvergisting.' }); | |
6053 | $('#primary_max_temp').jqxTooltip({ content: 'De hoogst bereikte piek temperatuur tijdens de hoofgvergisting.' }); | |
6054 | $('#primary_end_temp').jqxTooltip({ content: 'De eind temperatuur van de hoofdvergisting.' }); | |
6055 | $('#primary_end_sg').jqxTooltip({ content: 'Het gemeten SG aan het eind van de hoofdvergisting.' }); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
6056 | $('#primary_end_brix,#secondary_end_brix,#final_brix').jqxTooltip({ content: 'Hulpfinctie: de afgelezen °Brix RI waarde met een refractometer.' }); |
478 | 6057 | $('#primary_svg').jqxTooltip({ content: 'De schijnbare vergisting graad behaald na de hoofdgisting.' }); |
6058 | $('#primary_end_date').jqxTooltip({ content: 'De eind datum van de hoofdvergisting en eventueel overhevelen.' }); | |
6059 | $('#secondary_end_sg').jqxTooltip({ content: 'Het gemeten SG aan het eind van de navergisting.' }); | |
6060 | $('#secondary_svg').jqxTooltip({ content: 'De schijnbare vergisting graad behaald na de nagisting.' }); | |
6061 | $('#secondary_end_date').jqxTooltip({ content: 'De eind datum van de navergisting en het begin van het lageren.' }); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
6062 | $('#est_fg3').jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
6063 | |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
6064 | $('#primary_end_sg,#secondary_end_sg').jqxNumberInput(SGopts); |
610 | 6065 | $('#primary_end_date,#secondary_end_date').jqxDateTimeInput(Dateopts); |
6066 | $('#primary_end_date,#secondary_end_date').on('close', function(event) { calcStage(); }); | |
6067 | $('#primary_start_temp,#primary_max_temp,#primary_end_temp,#secondary_temp,#tertiary_temp').jqxNumberInput(YeastT); | |
478 | 6068 | $('#fg').jqxNumberInput(Spin3dec); |
610 | 6069 | $('#brew_fermenter_sg2,#est_fg3').jqxNumberInput(Show3dec); |
6070 | $('#primary_end_brix,#secondary_end_brix,#final_brix').jqxNumberInput(Spin1dec); | |
478 | 6071 | $('#final_abv').jqxNumberInput(Show2dec); |
610 | 6072 | $('#primary_svg,#secondary_svg,#final_svg').jqxNumberInput(Show1dec); |
478 | 6073 | $('#FLog').jqxButton({ template: 'info', width: '150px', theme: theme }); |
6074 | $('#FLog').click(function() { | |
6075 | // Open log in a new tab. | |
6076 | window.open('log_fermentation.php?code=' + dataRecord.code + '&name=' + dataRecord.name); | |
6077 | }); | |
602
10b61aacb1c1
New products field log_ispindel. Add check for ispindel log to crontasks.php Added log_ispindel to prod_edit, pprod_divide, prod_new and prod_duplicate. Renamed some log_fermentation vergisting names into klimaatkast.
Michiel Broek <mbroek@mbse.eu>
parents:
586
diff
changeset
|
6078 | $('#ILog').jqxButton({ template: 'info', width: '150px', theme: theme }); |
10b61aacb1c1
New products field log_ispindel. Add check for ispindel log to crontasks.php Added log_ispindel to prod_edit, pprod_divide, prod_new and prod_duplicate. Renamed some log_fermentation vergisting names into klimaatkast.
Michiel Broek <mbroek@mbse.eu>
parents:
586
diff
changeset
|
6079 | $('#ILog').click(function() { |
10b61aacb1c1
New products field log_ispindel. Add check for ispindel log to crontasks.php Added log_ispindel to prod_edit, pprod_divide, prod_new and prod_duplicate. Renamed some log_fermentation vergisting names into klimaatkast.
Michiel Broek <mbroek@mbse.eu>
parents:
586
diff
changeset
|
6080 | // Open log in a new tab. |
10b61aacb1c1
New products field log_ispindel. Add check for ispindel log to crontasks.php Added log_ispindel to prod_edit, pprod_divide, prod_new and prod_duplicate. Renamed some log_fermentation vergisting names into klimaatkast.
Michiel Broek <mbroek@mbse.eu>
parents:
586
diff
changeset
|
6081 | window.open('log_ispindel.php?code=' + dataRecord.code + '&name=' + dataRecord.name); |
10b61aacb1c1
New products field log_ispindel. Add check for ispindel log to crontasks.php Added log_ispindel to prod_edit, pprod_divide, prod_new and prod_duplicate. Renamed some log_fermentation vergisting names into klimaatkast.
Michiel Broek <mbroek@mbse.eu>
parents:
586
diff
changeset
|
6082 | }); |
478 | 6083 | |
6084 | // Tab 11, Packaging | |
6085 | // TODO: high gravity packaging, extra water and recalc abv, color and ibu. | |
6086 | $('#package_date').jqxTooltip({ content: 'De verpakkings datum van dit bier.' }); | |
6087 | $('#package_volume').jqxTooltip({ content: 'Het beschikbare volume om te bottelen of op fust te zetten.' }); | |
6088 | $('#package_infuse_amount').jqxTooltip({ content: 'De hoeveelheid water of drank extra toe te voegen.' }); | |
6089 | $('#package_infuse_abv').jqxTooltip({ content: 'De hoeveelheid alcohol in de drank, of 0.0 als het water is.' }); | |
6090 | $('#package_infuse_notes').jqxTooltip({ content: 'Omschrijving van de extra toevoeging.' }); | |
6091 | $('#package_abv').jqxTooltip({ content: 'De uiteindelijke hoeveelheid alcohol volume %.' }); | |
6092 | $('#package_ph').jqxTooltip({ content: 'De gemeten pH vlak voor het verpakken.' }); | |
6093 | $('#st_carb_min2').jqxTooltip({ content: 'Het minimum aanbevolen koolzuur volume voor deze bierstijl.'}); | |
6094 | $('#st_carb_max2').jqxTooltip({ content: 'Het maximum aamnevolen koolzuur volume voor deze bierstijl.'}); | |
6095 | $('#bottle_amount').jqxTooltip({ content: 'De totale hoeveelheid te bottelen bier.' }); | |
6096 | $('#keg_amount').jqxTooltip({ content: 'De totale hoeveelheid op fust te zetten bier.' }); | |
6097 | $('#bottle_carbonation').jqxTooltip({ content: 'Het gewenste CO2 volume in de flessen.' }); | |
6098 | $('#keg_carbonation').jqxTooltip({ content: 'Het gewenste CO2 volume door de suiker in de fusten.' }); | |
633
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
6099 | $('#bottle_priming_water,#keg_priming_water').jqxTooltip({ content: 'De hoeveelheid water om de suiker op te lossen.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
6100 | $('#bottle_pressure').jqxTooltip({ content: 'De maximaal te verwachten druk tijdens het hergisten.' }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
6101 | $('#package_date').jqxDateTimeInput(Dateopts); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
6102 | $('#package_date').on('close', function(event) { calcStage(); }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
6103 | $('#package_infuse_amount').jqxNumberInput(Spin3dec); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
6104 | $('#package_infuse_notes').jqxInput({ theme: theme, width: 640, height: 23 }); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
6105 | $('#package_abv').jqxNumberInput(Show2dec); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
6106 | $('#package_ph').jqxNumberInput(SpinpH); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
6107 | $('#st_carb_min2,#st_carb_max2').jqxNumberInput(Smal1dec); |
ec4601ab3ed2
Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents:
623
diff
changeset
|
6108 | $('#package_volume,#package_infuse_abv,#bottle_amount,#keg_amount').jqxNumberInput(Spin1dec); |
610 | 6109 | $('#bottle_carbonation,#keg_carbonation').jqxNumberInput(Spin2dec); |
6110 | $('#bottle_carbonation,#keg_carbonation').jqxNumberInput({ max: 5 }); | |
478 | 6111 | $('#bottle_priming_sugar').jqxDropDownList({ |
6112 | placeHolder: 'Kies suiker:', | |
6113 | theme: theme, | |
6114 | source: fermentablesugars, | |
6115 | displayMember: 'name', | |
6116 | width: 200, | |
6117 | height: 23, | |
6118 | dropDownWidth: 300, | |
6119 | dropDownHeight: 400 | |
6120 | }); | |
6121 | $('#bottle_priming_sugar').on('select', function(event) { | |
6122 | if (event.args) { | |
6123 | var rowID, index, editrow = -1, datarecord, rows, i, row = {}; | |
6124 | index = event.args.index; | |
6125 | datarecord = fermentablesugars.records[index]; | |
6126 | rows = $('#fermentableGrid').jqxGrid('getrows'); | |
6127 | for (i = 0; i < rows.length; i++) { | |
6128 | if (rows[i].f_added == 4) { | |
6129 | editrow = i; | |
6130 | } | |
6131 | } | |
6132 | row['f_name'] = datarecord.name; | |
6133 | row['f_origin'] = datarecord.origin; | |
6134 | row['f_supplier'] = datarecord.supplier; | |
6135 | row['f_amount'] = parseFloat($('#bottle_priming_total').jqxNumberInput('decimal')) / 1000; | |
6136 | row['f_cost'] = datarecord.cost; | |
6137 | row['f_type'] = datarecord.type; | |
6138 | row['f_yield'] = datarecord.yield; | |
6139 | row['f_color'] = datarecord.color; | |
6140 | row['f_coarse_fine_diff'] = datarecord.coarse_fine_diff; | |
6141 | row['f_moisture'] = datarecord.moisture; | |
6142 | row['f_diastatic_power'] = datarecord.diastatic_power; | |
6143 | row['f_protein'] = datarecord.protein; | |
6144 | row['f_max_in_batch'] = datarecord.max_in_batch; | |
6145 | row['f_graintype'] = datarecord.graintype; | |
6146 | row['f_added'] = 4; | |
6147 | row['f_dissolved_protein'] = datarecord.dissolved_protein; | |
6148 | row['f_recommend_mash'] = datarecord.recommend_mash; | |
6149 | row['f_add_after_boil'] = 1; | |
6150 | row['f_adjust_to_total_100'] = 0; | |
6151 | row['f_percentage'] = 0; | |
6152 | row['f_di_ph'] = datarecord.di_ph; | |
6153 | row['f_acid_to_ph_57'] = datarecord.acid_to_ph_57; | |
6154 | row['f_inventory'] = datarecord.inventory; | |
6155 | if (editrow >= 0) { | |
6156 | rowID = $('#fermentableGrid').jqxGrid('getrowid', editrow); | |
6157 | $('#fermentableGrid').jqxGrid('updaterow', rowID, row); | |
6158 | } else { | |
6159 | $('#fermentableGrid').jqxGrid('addrow', null, row); | |
6160 | } | |
6161 | calcCarbonation(); | |
6162 | } | |
6163 | }); | |
6164 | $('#keg_priming_sugar').jqxDropDownList({ | |
6165 | placeHolder: 'Kies suiker:', | |
6166 | theme: theme, | |
6167 | source: fermentablesugars, | |
6168 | displayMember: 'name', | |
6169 | width: 200, | |
6170 | height: 23, | |
6171 | dropDownWidth: 300, | |
6172 | dropDownHeight: 400 | |
6173 | }); | |
6174 | $('#keg_priming_sugar').on('select', function(event) { | |
6175 | if (event.args) { | |
6176 | var rowID, index, editrow = -1, datarecord, rows, i, row = {}; | |
6177 | index = event.args.index; | |
6178 | datarecord = fermentablesugars.records[index]; | |
6179 | rows = $('#fermentableGrid').jqxGrid('getrows'); | |
6180 | for (i = 0; i < rows.length; i++) { | |
6181 | if (rows[i].f_added == 5) { | |
6182 | editrow = i; | |
6183 | } | |
6184 | } | |
6185 | row['f_name'] = datarecord.name; | |
6186 | row['f_origin'] = datarecord.origin; | |
6187 | row['f_supplier'] = datarecord.supplier; | |
6188 | row['f_amount'] = parseFloat($('#keg_priming_total').jqxNumberInput('decimal')) / 1000; | |
6189 | row['f_cost'] = datarecord.cost; | |
6190 | row['f_type'] = datarecord.type; | |
6191 | row['f_yield'] = datarecord.yield; | |
6192 | row['f_color'] = datarecord.color; | |
6193 | row['f_coarse_fine_diff'] = datarecord.coarse_fine_diff; | |
6194 | row['f_moisture'] = datarecord.moisture; | |
6195 | row['f_diastatic_power'] = datarecord.diastatic_power; | |
6196 | row['f_protein'] = datarecord.protein; | |
6197 | row['f_max_in_batch'] = datarecord.max_in_batch; | |
6198 | row['f_graintype'] = datarecord.graintype; | |
6199 | row['f_added'] = 5; | |
6200 | row['f_dissolved_protein'] = datarecord.dissolved_protein; | |
6201 | row['f_recommend_mash'] = datarecord.recommend_mash; | |
6202 | row['f_add_after_boil'] = 1; | |
6203 | row['f_adjust_to_total_100'] = 0; | |
6204 | row['f_percentage'] = 0; | |
6205 | row['f_di_ph'] = datarecord.di_ph; | |
6206 | row['f_acid_to_ph_57'] = datarecord.acid_to_ph_57; | |
6207 | row['f_inventory'] = datarecord.inventory; | |
6208 | if (editrow >= 0) { | |
6209 | rowID = $('#fermentableGrid').jqxGrid('getrowid', editrow); | |
6210 | $('#fermentableGrid').jqxGrid('updaterow', rowID, row); | |
6211 | } else { | |
6212 | $('#fermentableGrid').jqxGrid('addrow', null, row); | |
6213 | } | |
6214 | calcCarbonation(); | |
6215 | } | |
6216 | }); | |
610 | 6217 | $('#bottle_priming_water,#keg_priming_water').jqxNumberInput(Spin3dec); |
478 | 6218 | $('#keg_forced_carb').jqxCheckBox({ theme: theme, width: 120, height: 23 }); |
610 | 6219 | $('#bottle_priming_amount,#keg_priming_amount,#bottle_priming_total,#bottle_pressure,#keg_priming_total,#keg_pressure').jqxNumberInput(Show1dec); |
6220 | $('#bottle_abv,#keg_abv').jqxNumberInput(Show2dec); | |
6221 | $('#bottle_carbonation_temp,#keg_carbonation_temp').jqxNumberInput(YeastT); | |
615
9034e65b0d7a
Added CO2 carbonation log to the products database. Added button in the packaging tab.
Michiel Broek <mbroek@mbse.eu>
parents:
613
diff
changeset
|
6222 | $('#CLog').jqxButton({ template: 'info', width: '150px', theme: theme }); |
9034e65b0d7a
Added CO2 carbonation log to the products database. Added button in the packaging tab.
Michiel Broek <mbroek@mbse.eu>
parents:
613
diff
changeset
|
6223 | $('#CLog').click(function() { |
9034e65b0d7a
Added CO2 carbonation log to the products database. Added button in the packaging tab.
Michiel Broek <mbroek@mbse.eu>
parents:
613
diff
changeset
|
6224 | // Open log in a new tab. |
9034e65b0d7a
Added CO2 carbonation log to the products database. Added button in the packaging tab.
Michiel Broek <mbroek@mbse.eu>
parents:
613
diff
changeset
|
6225 | window.open('log_co2pressure.php?code=' + dataRecord.code + '&name=' + dataRecord.name); |
9034e65b0d7a
Added CO2 carbonation log to the products database. Added button in the packaging tab.
Michiel Broek <mbroek@mbse.eu>
parents:
613
diff
changeset
|
6226 | }); |
478 | 6227 | |
6228 | // Tab 12, Tasting | |
6229 | $('#taste_date').jqxTooltip({ content: 'De proef datum van dit bier.' }); | |
6230 | $('#taste_date').jqxDateTimeInput(Dateopts); | |
6231 | $('#taste_date').on('close', function(event) { calcStage(); }); | |
6232 | $('#taste_rate').jqxTooltip({ content: 'Het cijfer voor dit bier van 1 tot 10.' }); | |
6233 | $('#taste_rate').jqxNumberInput(Spin1dec); | |
6234 | $('#taste_rate').jqxNumberInput({ max: 10 }); | |
6235 | $('#taste_color').jqxTooltip({ content: 'De kleur van het bier.' }); | |
6236 | $('#taste_transparency').jqxTooltip({ content: 'De helderheid van het bier.' }); | |
6237 | $('#taste_head').jqxTooltip({ content: 'Het schuim op het bier.' }); | |
610 | 6238 | $('#taste_color,#taste_transparency,#taste_head').jqxInput({ theme: theme, width: 320, height: 23 }); |
478 | 6239 | $('#taste_aroma').jqxTooltip({ content: 'Het aroma van het bier.' }); |
6240 | $('#taste_taste').jqxTooltip({ content: 'De smaak van het bier.' }); | |
6241 | $('#taste_aftertaste').jqxTooltip({ content: 'De nasmaak van het bier.' }); | |
6242 | $('#taste_mouthfeel').jqxTooltip({ content: 'Het mondgevoelvan het bier.' }); | |
610 | 6243 | $('#taste_aroma,#taste_taste,#taste_aftertaste,#taste_mouthfeel').jqxInput({ theme: theme, width: 960, height: 23 }); |
478 | 6244 | $('#taste_notes').jqxTooltip({ content: 'Het oordeel en opmerkingen over dit bier.' }); |
6245 | $('#taste_notes').jqxInput({ theme: theme, width: 960, height: 100 }); | |
6246 | ||
6247 | $('#jqxTabs').jqxTabs({ | |
6248 | theme: theme, | |
6249 | width: 1280, | |
6250 | height: 660, | |
6251 | autoHeight: false, | |
6252 | position: 'top' | |
6253 | }); | |
6254 | ||
6255 | // Buttons below | |
6256 | $('#Export').jqxButton({ template: 'info', width: '80px', theme: theme }); | |
6257 | $('#Export').bind('click', function() { | |
489
18e5cfe5d126
Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
6258 | saveRecord(0); |
478 | 6259 | }); |
6260 | ||
6261 | $('#Delete').jqxButton({ template: 'danger', width: '80px', theme: theme }); | |
6262 | $('#Delete').bind('click', function() { | |
6263 | // Open a popup to confirm this action. | |
6264 | $('#eventWindow').jqxWindow('open'); | |
6265 | $('#delOk').click(function() { | |
6266 | var data = 'delete=true&' + $.param({ uuid: dataRecord.uuid }); | |
6267 | $.ajax({ | |
6268 | dataType: 'json', | |
6269 | url: url, | |
6270 | cache: false, | |
6271 | data: data, | |
6272 | type: 'POST', | |
6273 | success: function(data, status, xhr) { | |
6274 | // delete command is executed. | |
6275 | window.location.href = my_return; | |
6276 | }, | |
6277 | error: function(jqXHR, textStatus, errorThrown) { | |
6278 | } | |
6279 | }); | |
6280 | }); | |
6281 | }); | |
6282 | ||
6283 | $('#Cancel').jqxButton({ template: 'primary', width: '80px', theme: theme }); | |
6284 | $('#Cancel').bind('click', function() { | |
6285 | window.location.href = my_return; | |
6286 | }); | |
6287 | ||
6288 | $('#Save').jqxButton({ template: 'success', width: '80px', theme: theme }); | |
6289 | $('#Save').bind('click', function() { | |
489
18e5cfe5d126
Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents:
484
diff
changeset
|
6290 | saveRecord(1); |
478 | 6291 | }); |
6292 | createDelElements(); | |
111
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6293 | }); |
8c4ba91adf58
Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6294 |