19 * along with ThermFerm; see the file COPYING. If not, write to the Free |
19 * along with ThermFerm; see the file COPYING. If not, write to the Free |
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
21 *****************************************************************************/ |
21 *****************************************************************************/ |
22 |
22 |
23 |
23 |
24 function createDelElements(){ |
24 function createDelElements() { |
25 |
25 |
26 $('#eventWindow').jqxWindow({ |
26 $('#eventWindow').jqxWindow({ |
27 theme:theme, |
27 theme: theme, |
28 position:{x:490,y:210}, |
28 position: { x: 490, y: 210 }, |
29 width:300, |
29 width: 300, |
30 height:175, |
30 height: 175, |
31 resizable:false, |
31 resizable: false, |
32 isModal:true, |
32 isModal: true, |
33 modalOpacity:0.4, |
33 modalOpacity: 0.4, |
34 okButton:$('#delOk'), |
34 okButton: $('#delOk'), |
35 cancelButton:$('#delCancel'), |
35 cancelButton: $('#delCancel'), |
36 initContent:function(){ |
36 initContent: function() { |
37 $('#delOk').jqxButton({template:"danger",width:'65px',theme:theme}); |
37 $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme }); |
38 $('#delCancel').jqxButton({template:"success",width:'65px',theme:theme}); |
38 $('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme }); |
39 $('#delCancel').focus(); |
39 $('#delCancel').focus(); |
40 } |
40 } |
41 }); |
41 }); |
42 $('#eventWindow').jqxWindow('hide'); |
42 $('#eventWindow').jqxWindow('hide'); |
43 } |
43 } |
44 |
44 |
45 |
45 |
46 |
46 |
47 $(document).ready(function () { |
47 $(document).ready(function() { |
48 |
48 |
49 var i, |
49 var i, |
50 to_100 = false, // Fermentables adjust to 100% |
50 to_100 = false, // Fermentables adjust to 100% |
51 preboil_sg = 0, |
51 preboil_sg = 0, |
52 aboil_sg = 0, |
52 aboil_sg = 0, |
53 est_mash_sg = 0, |
53 est_mash_sg = 0, |
54 psugar = 0, // Percentage real sugars |
54 psugar = 0, // Percentage real sugars |
55 pcara = 0, // Percentage cara/crystal malts |
55 pcara = 0, // Percentage cara/crystal malts |
56 svg = 77, // Default attenuation |
56 svg = 77, // Default attenuation |
57 mashkg = 0, // Malt in mash weight |
57 mashkg = 0, // Malt in mash weight |
58 pitchrate = 0.75, // Yeast pitch rate default |
58 pitchrate = 0.75, // Yeast pitch rate default |
59 initcells = 0, // Initial yeast cell count |
59 initcells = 0, // Initial yeast cell count |
60 |
60 |
61 ok_fermentables = 1, // Fermentables are in stock |
61 ok_fermentables = 1, // Fermentables are in stock |
62 ok_hops = 1, // Hops are in stock |
62 ok_hops = 1, // Hops are in stock |
63 ok_miscs = 1, // Miscs are in stock |
63 ok_miscs = 1, // Miscs are in stock |
64 ok_yeasts = 1, // Yeasts are in stock |
64 ok_yeasts = 1, // Yeasts are in stock |
65 ok_waters = 1, // Waters are in stock |
65 ok_waters = 1, // Waters are in stock |
66 |
66 |
67 hop_flavour = 0, |
67 hop_flavour = 0, |
68 hop_aroma = 0, |
68 hop_aroma = 0, |
69 mash_infuse = 0, |
69 mash_infuse = 0, |
70 last_base = '', |
70 last_base = '', |
71 last_acid = '', |
71 last_acid = '', |
72 |
72 |
73 MMCa = 40.048, |
73 MMCa = 40.048, |
74 MMMg = 24.305, |
74 MMMg = 24.305, |
75 MMNa = 22.98976928, |
75 MMNa = 22.98976928, |
76 MMCl = 35.453, |
76 MMCl = 35.453, |
77 MMSO4 = 96.0626, |
77 MMSO4 = 96.0626, |
78 MMHCO3 = 61.01684, |
78 MMHCO3 = 61.01684, |
79 MMCaSO4 = 172.171, |
79 MMCaSO4 = 172.171, |
80 MMCaCl2 = 147.015, |
80 MMCaCl2 = 147.015, |
81 MMCaCO3 = 100.087, |
81 MMCaCO3 = 100.087, |
82 MMMgSO4 = 246.475, |
82 MMMgSO4 = 246.475, |
83 MMNaHCO3 = 84.007, |
83 MMNaHCO3 = 84.007, |
84 MMNa2CO3 = 105.996, |
84 MMNa2CO3 = 105.996, |
85 MMNaCl = 58.443, |
85 MMNaCl = 58.443, |
86 MMCaOH2 = 74.06268, |
86 MMCaOH2 = 74.06268, |
87 |
87 |
88 fermentableRow = 0, |
88 fermentableRow = 0, |
89 fermentableData = {}, |
89 fermentableData = {}, |
90 fermentableInit = 1, |
90 fermentableInit = 1, |
91 hopRow = 0, |
91 hopRow = 0, |
92 hopData = {}, |
92 hopData = {}, |
93 miscRow = 0, |
93 miscRow = 0, |
94 miscData = {}, |
94 miscData = {}, |
95 yeastRow = 0, |
95 yeastRow = 0, |
96 yeastData = {}, |
96 yeastData = {}, |
97 mashRow = 0, |
97 mashRow = 0, |
98 mashData = {}, |
98 mashData = {}, |
99 Ka1 = 0.0000004445, |
99 Ka1 = 0.0000004445, |
100 Ka2 = 0.0000000000468, |
100 Ka2 = 0.0000000000468, |
101 dataRecord = {}, |
101 dataRecord = {}, |
102 url = "includes/db_product.php", |
102 url = 'includes/db_product.php', |
103 |
103 |
104 // Prepare the data |
104 // Prepare the data |
105 source = { |
105 source = { |
106 datatype: "json", |
106 datatype: 'json', |
107 cache: false, |
107 cache: false, |
108 datafields: [ |
108 datafields: [ |
109 // From prod_main |
109 // From prod_main |
110 { name: 'record', type: 'number' }, |
110 { name: 'record', type: 'number' }, |
111 { name: 'uuid', type: 'string' }, |
111 { name: 'uuid', type: 'string' }, |
112 { name: 'name', type: 'string' }, |
112 { name: 'name', type: 'string' }, |
113 { name: 'code', type: 'string' }, |
113 { name: 'code', type: 'string' }, |
114 { name: 'birth', type: 'string' }, |
114 { name: 'birth', type: 'string' }, |
115 { name: 'stage', type: 'int' }, |
115 { name: 'stage', type: 'int' }, |
116 { name: 'notes', type: 'string' }, |
116 { name: 'notes', type: 'string' }, |
117 { name: 'log_brew', type: 'int' }, |
117 { name: 'log_brew', type: 'int' }, |
118 { name: 'log_fermentation', type: 'int' }, |
118 { name: 'log_fermentation', type: 'int' }, |
119 { name: 'inventory_reduced', type: 'int' }, |
119 { name: 'inventory_reduced', type: 'int' }, |
120 { name: 'locked', type: 'int' }, |
120 { name: 'locked', type: 'int' }, |
121 { name: 'eq_name', type: 'string' }, |
121 { name: 'eq_name', type: 'string' }, |
122 { name: 'eq_boil_size', type: 'float' }, |
122 { name: 'eq_boil_size', type: 'float' }, |
123 { name: 'eq_batch_size', type: 'float' }, |
123 { name: 'eq_batch_size', type: 'float' }, |
124 { name: 'eq_tun_volume', type: 'float' }, |
124 { name: 'eq_tun_volume', type: 'float' }, |
125 { name: 'eq_tun_weight', type: 'float' }, |
125 { name: 'eq_tun_weight', type: 'float' }, |
126 { name: 'eq_tun_specific_heat', type: 'float' }, |
126 { name: 'eq_tun_specific_heat', type: 'float' }, |
127 { name: 'eq_tun_material', type: 'int' }, |
127 { name: 'eq_tun_material', type: 'int' }, |
128 { name: 'eq_tun_height', type: 'float' }, |
128 { name: 'eq_tun_height', type: 'float' }, |
129 { name: 'eq_top_up_water', type: 'float' }, |
129 { name: 'eq_top_up_water', type: 'float' }, |
130 { name: 'eq_trub_chiller_loss', type: 'float' }, |
130 { name: 'eq_trub_chiller_loss', type: 'float' }, |
131 { name: 'eq_evap_rate', type: 'float' }, |
131 { name: 'eq_evap_rate', type: 'float' }, |
132 { name: 'eq_boil_time', type: 'float' }, |
132 { name: 'eq_boil_time', type: 'float' }, |
133 { name: 'eq_calc_boil_volume', type: 'int' }, |
133 { name: 'eq_calc_boil_volume', type: 'int' }, |
134 { name: 'eq_top_up_kettle', type: 'float' }, |
134 { name: 'eq_top_up_kettle', type: 'float' }, |
135 { name: 'eq_hop_utilization', type: 'float' }, |
135 { name: 'eq_hop_utilization', type: 'float' }, |
136 { name: 'eq_notes', type: 'string' }, |
136 { name: 'eq_notes', type: 'string' }, |
137 { name: 'eq_lauter_volume', type: 'float' }, |
137 { name: 'eq_lauter_volume', type: 'float' }, |
138 { name: 'eq_lauter_height', type: 'float' }, |
138 { name: 'eq_lauter_height', type: 'float' }, |
139 { name: 'eq_lauter_deadspace', type: 'float' }, |
139 { name: 'eq_lauter_deadspace', type: 'float' }, |
140 { name: 'eq_kettle_volume', type: 'float' }, |
140 { name: 'eq_kettle_volume', type: 'float' }, |
141 { name: 'eq_kettle_height', type: 'float' }, |
141 { name: 'eq_kettle_height', type: 'float' }, |
142 { name: 'eq_mash_volume', type: 'float' }, |
142 { name: 'eq_mash_volume', type: 'float' }, |
143 { name: 'eq_mash_max', type: 'float' }, |
143 { name: 'eq_mash_max', type: 'float' }, |
144 { name: 'eq_efficiency', type: 'float' }, |
144 { name: 'eq_efficiency', type: 'float' }, |
145 { name: 'brew_date_start', type: 'string' }, |
145 { name: 'brew_date_start', type: 'string' }, |
146 { name: 'brew_mash_ph', type: 'float' }, |
146 { name: 'brew_mash_ph', type: 'float' }, |
147 { name: 'brew_mash_sg', type: 'float' }, |
147 { name: 'brew_mash_sg', type: 'float' }, |
148 { name: 'brew_mash_efficiency', type: 'float' }, |
148 { name: 'brew_mash_efficiency', type: 'float' }, |
149 { name: 'brew_sparge_est', type: 'float' }, |
149 { name: 'brew_sparge_est', type: 'float' }, |
150 { name: 'brew_sparge_ph', type: 'float' }, |
150 { name: 'brew_sparge_ph', type: 'float' }, |
151 { name: 'brew_preboil_volume', type: 'float' }, |
151 { name: 'brew_preboil_volume', type: 'float' }, |
152 { name: 'brew_preboil_sg', type: 'float' }, |
152 { name: 'brew_preboil_sg', type: 'float' }, |
153 { name: 'brew_preboil_ph', type: 'float' }, |
153 { name: 'brew_preboil_ph', type: 'float' }, |
154 { name: 'brew_preboil_efficiency', type: 'float' }, |
154 { name: 'brew_preboil_efficiency', type: 'float' }, |
155 { name: 'brew_aboil_volume', type: 'float' }, |
155 { name: 'brew_aboil_volume', type: 'float' }, |
156 { name: 'brew_aboil_sg', type: 'float' }, |
156 { name: 'brew_aboil_sg', type: 'float' }, |
157 { name: 'brew_aboil_ph', type: 'float' }, |
157 { name: 'brew_aboil_ph', type: 'float' }, |
158 { name: 'brew_aboil_efficiency', type: 'float' }, |
158 { name: 'brew_aboil_efficiency', type: 'float' }, |
159 { name: 'brew_cooling_method', type: 'int' }, |
159 { name: 'brew_cooling_method', type: 'int' }, |
160 { name: 'brew_cooling_time', type: 'float' }, |
160 { name: 'brew_cooling_time', type: 'float' }, |
161 { name: 'brew_cooling_to', type: 'float' }, |
161 { name: 'brew_cooling_to', type: 'float' }, |
162 { name: 'brew_whirlpool9', type: 'float' }, |
162 { name: 'brew_whirlpool9', type: 'float' }, |
163 { name: 'brew_whirlpool7', type: 'float' }, |
163 { name: 'brew_whirlpool7', type: 'float' }, |
164 { name: 'brew_whirlpool6', type: 'float' }, |
164 { name: 'brew_whirlpool6', type: 'float' }, |
165 { name: 'brew_whirlpool2', type: 'float' }, |
165 { name: 'brew_whirlpool2', type: 'float' }, |
166 { name: 'brew_fermenter_volume', type: 'float' }, |
166 { name: 'brew_fermenter_volume', type: 'float' }, |
167 { name: 'brew_fermenter_extrawater', type: 'float' }, |
167 { name: 'brew_fermenter_extrawater', type: 'float' }, |
168 { name: 'brew_fermenter_tcloss', type: 'float' }, |
168 { name: 'brew_fermenter_tcloss', type: 'float' }, |
169 { name: 'brew_aeration_time', type: 'float' }, |
169 { name: 'brew_aeration_time', type: 'float' }, |
170 { name: 'brew_aeration_speed', type: 'float' }, |
170 { name: 'brew_aeration_speed', type: 'float' }, |
171 { name: 'brew_aeration_type', type: 'int' }, |
171 { name: 'brew_aeration_type', type: 'int' }, |
172 { name: 'brew_fermenter_sg', type: 'float' }, |
172 { name: 'brew_fermenter_sg', type: 'float' }, |
173 { name: 'brew_fermenter_ibu', type: 'float' }, |
173 { name: 'brew_fermenter_ibu', type: 'float' }, |
174 { name: 'brew_fermenter_color', type: 'float' }, |
174 { name: 'brew_fermenter_color', type: 'float' }, |
175 { name: 'brew_date_end', type: 'string' }, |
175 { name: 'brew_date_end', type: 'string' }, |
176 { name: 'og', type: 'float' }, |
176 { name: 'og', type: 'float' }, |
177 { name: 'fg', type: 'float' }, |
177 { name: 'fg', type: 'float' }, |
178 { name: 'primary_start_temp', type: 'float' }, |
178 { name: 'primary_start_temp', type: 'float' }, |
179 { name: 'primary_max_temp', type: 'float' }, |
179 { name: 'primary_max_temp', type: 'float' }, |
180 { name: 'primary_end_temp', type: 'float' }, |
180 { name: 'primary_end_temp', type: 'float' }, |
181 { name: 'primary_end_sg', type: 'float' }, |
181 { name: 'primary_end_sg', type: 'float' }, |
182 { name: 'primary_end_date', type: 'string' }, |
182 { name: 'primary_end_date', type: 'string' }, |
183 { name: 'secondary_temp', type: 'float' }, |
183 { name: 'secondary_temp', type: 'float' }, |
184 { name: 'secondary_end_sg', type: 'float' }, |
184 { name: 'secondary_end_sg', type: 'float' }, |
185 { name: 'secondary_end_date', type: 'string' }, |
185 { name: 'secondary_end_date', type: 'string' }, |
186 { name: 'tertiary_temp', type: 'float' }, |
186 { name: 'tertiary_temp', type: 'float' }, |
187 { name: 'package_date', type: 'string' }, |
187 { name: 'package_date', type: 'string' }, |
188 { name: 'package_volume', type: 'float' }, |
188 { name: 'package_volume', type: 'float' }, |
189 { name: 'package_infuse_amount', type: 'float' }, |
189 { name: 'package_infuse_amount', type: 'float' }, |
190 { name: 'package_infuse_abv', type: 'float' }, |
190 { name: 'package_infuse_abv', type: 'float' }, |
191 { name: 'package_infuse_notes', type: 'string' }, |
191 { name: 'package_infuse_notes', type: 'string' }, |
192 { name: 'package_abv', type: 'float' }, |
192 { name: 'package_abv', type: 'float' }, |
193 { name: 'package_ph', type: 'float' }, |
193 { name: 'package_ph', type: 'float' }, |
194 { name: 'bottle_amount', type: 'float' }, |
194 { name: 'bottle_amount', type: 'float' }, |
195 { name: 'bottle_carbonation', type: 'float' }, |
195 { name: 'bottle_carbonation', type: 'float' }, |
196 { name: 'bottle_priming_water', type: 'float' }, |
196 { name: 'bottle_priming_water', type: 'float' }, |
197 { name: 'bottle_priming_amount', type: 'float' }, |
197 { name: 'bottle_priming_amount', type: 'float' }, |
198 { name: 'bottle_carbonation_temp', type: 'float' }, |
198 { name: 'bottle_carbonation_temp', type: 'float' }, |
199 { name: 'keg_amount', type: 'float' }, |
199 { name: 'keg_amount', type: 'float' }, |
200 { name: 'keg_carbonation', type: 'float' }, |
200 { name: 'keg_carbonation', type: 'float' }, |
201 { name: 'keg_priming_water', type: 'float' }, |
201 { name: 'keg_priming_water', type: 'float' }, |
202 { name: 'keg_priming_amount', type: 'float' }, |
202 { name: 'keg_priming_amount', type: 'float' }, |
203 { name: 'keg_carbonation_temp', type: 'float' }, |
203 { name: 'keg_carbonation_temp', type: 'float' }, |
204 { name: 'keg_forced_carb', type: 'int' }, |
204 { name: 'keg_forced_carb', type: 'int' }, |
205 { name: 'keg_pressure', type: 'float' }, |
205 { name: 'keg_pressure', type: 'float' }, |
206 { name: 'taste_notes', type: 'string' }, |
206 { name: 'taste_notes', type: 'string' }, |
207 { name: 'taste_rate', type: 'float' }, |
207 { name: 'taste_rate', type: 'float' }, |
208 { name: 'taste_date', type: 'string' }, |
208 { name: 'taste_date', type: 'string' }, |
209 { name: 'taste_color', type: 'string' }, |
209 { name: 'taste_color', type: 'string' }, |
210 { name: 'taste_transparency', type: 'string' }, |
210 { name: 'taste_transparency', type: 'string' }, |
211 { name: 'taste_head', type: 'string' }, |
211 { name: 'taste_head', type: 'string' }, |
212 { name: 'taste_aroma', type: 'string' }, |
212 { name: 'taste_aroma', type: 'string' }, |
213 { name: 'taste_taste', type: 'string' }, |
213 { name: 'taste_taste', type: 'string' }, |
214 { name: 'taste_mouthfeel', type: 'string' }, |
214 { name: 'taste_mouthfeel', type: 'string' }, |
215 { name: 'taste_aftertaste', type: 'string' }, |
215 { name: 'taste_aftertaste', type: 'string' }, |
216 { name: 'st_name', type: 'string' }, |
216 { name: 'st_name', type: 'string' }, |
217 { name: 'st_letter', type: 'string' }, |
217 { name: 'st_letter', type: 'string' }, |
218 { name: 'st_guide', type: 'string' }, |
218 { name: 'st_guide', type: 'string' }, |
219 { name: 'st_category', type: 'string' }, |
219 { name: 'st_category', type: 'string' }, |
220 { name: 'st_category_number', type: 'float' }, |
220 { name: 'st_category_number', type: 'float' }, |
221 { name: 'st_type', type: 'int' }, |
221 { name: 'st_type', type: 'int' }, |
222 { name: 'st_og_min', type: 'float' }, |
222 { name: 'st_og_min', type: 'float' }, |
223 { name: 'st_og_max', type: 'float' }, |
223 { name: 'st_og_max', type: 'float' }, |
224 { name: 'st_fg_min', type: 'float' }, |
224 { name: 'st_fg_min', type: 'float' }, |
225 { name: 'st_fg_max', type: 'float' }, |
225 { name: 'st_fg_max', type: 'float' }, |
226 { name: 'st_ibu_min', type: 'float' }, |
226 { name: 'st_ibu_min', type: 'float' }, |
227 { name: 'st_ibu_max', type: 'float' }, |
227 { name: 'st_ibu_max', type: 'float' }, |
228 { name: 'st_color_min', type: 'float' }, |
228 { name: 'st_color_min', type: 'float' }, |
229 { name: 'st_color_max', type: 'float' }, |
229 { name: 'st_color_max', type: 'float' }, |
230 { name: 'st_carb_min', type: 'float' }, |
230 { name: 'st_carb_min', type: 'float' }, |
231 { name: 'st_carb_max', type: 'float' }, |
231 { name: 'st_carb_max', type: 'float' }, |
232 { name: 'st_abv_min', type: 'float' }, |
232 { name: 'st_abv_min', type: 'float' }, |
233 { name: 'st_abv_max', type: 'float' }, |
233 { name: 'st_abv_max', type: 'float' }, |
234 { name: 'type', type: 'int' }, |
234 { name: 'type', type: 'int' }, |
235 { name: 'batch_size', type: 'float' }, |
235 { name: 'batch_size', type: 'float' }, |
236 { name: 'boil_size', type: 'float' }, |
236 { name: 'boil_size', type: 'float' }, |
237 { name: 'boil_time', type: 'float' }, |
237 { name: 'boil_time', type: 'float' }, |
238 { name: 'efficiency', type: 'float' }, |
238 { name: 'efficiency', type: 'float' }, |
239 { name: 'est_og', type: 'float' }, |
239 { name: 'est_og', type: 'float' }, |
240 { name: 'est_fg', type: 'float' }, |
240 { name: 'est_fg', type: 'float' }, |
241 { name: 'est_abv', type: 'float' }, |
241 { name: 'est_abv', type: 'float' }, |
242 { name: 'est_color', type: 'float' }, |
242 { name: 'est_color', type: 'float' }, |
243 { name: 'color_method', type: 'int' }, |
243 { name: 'color_method', type: 'int' }, |
244 { name: 'est_ibu', type: 'float' }, |
244 { name: 'est_ibu', type: 'float' }, |
245 { name: 'ibu_method', type: 'int' }, |
245 { name: 'ibu_method', type: 'int' }, |
246 { name: 'est_carb', type: 'float' }, |
246 { name: 'est_carb', type: 'float' }, |
247 { name: 'sparge_temp', type: 'float' }, |
247 { name: 'sparge_temp', type: 'float' }, |
248 { name: 'sparge_ph', type: 'float' }, |
248 { name: 'sparge_ph', type: 'float' }, |
249 { name: 'sparge_volume', type: 'float' }, |
249 { name: 'sparge_volume', type: 'float' }, |
250 { name: 'sparge_source', type: 'int' }, |
250 { name: 'sparge_source', type: 'int' }, |
251 { name: 'sparge_acid_type', type: 'int' }, |
251 { name: 'sparge_acid_type', type: 'int' }, |
252 { name: 'sparge_acid_perc', type: 'float' }, |
252 { name: 'sparge_acid_perc', type: 'float' }, |
253 { name: 'sparge_acid_amount', type: 'float' }, |
253 { name: 'sparge_acid_amount', type: 'float' }, |
254 { name: 'mash_ph', type: 'float' }, |
254 { name: 'mash_ph', type: 'float' }, |
255 { name: 'mash_name', type: 'string' }, |
255 { name: 'mash_name', type: 'string' }, |
256 { name: 'calc_acid', type: 'int' }, |
256 { name: 'calc_acid', type: 'int' }, |
257 { name: 'w1_name', type: 'string' }, |
257 { name: 'w1_name', type: 'string' }, |
258 { name: 'w1_amount', type: 'float' }, |
258 { name: 'w1_amount', type: 'float' }, |
259 { name: 'w1_calcium', type: 'float' }, |
259 { name: 'w1_calcium', type: 'float' }, |
260 { name: 'w1_sulfate', type: 'float' }, |
260 { name: 'w1_sulfate', type: 'float' }, |
261 { name: 'w1_chloride', type: 'float' }, |
261 { name: 'w1_chloride', type: 'float' }, |
262 { name: 'w1_sodium', type: 'float' }, |
262 { name: 'w1_sodium', type: 'float' }, |
263 { name: 'w1_magnesium', type: 'float' }, |
263 { name: 'w1_magnesium', type: 'float' }, |
264 { name: 'w1_total_alkalinity', type: 'float' }, |
264 { name: 'w1_total_alkalinity', type: 'float' }, |
265 { name: 'w1_ph', type: 'float' }, |
265 { name: 'w1_ph', type: 'float' }, |
266 { name: 'w1_cost', type: 'float' }, |
266 { name: 'w1_cost', type: 'float' }, |
267 { name: 'w2_name', type: 'string' }, |
267 { name: 'w2_name', type: 'string' }, |
268 { name: 'w2_amount', type: 'float' }, |
268 { name: 'w2_amount', type: 'float' }, |
269 { name: 'w2_calcium', type: 'float' }, |
269 { name: 'w2_calcium', type: 'float' }, |
270 { name: 'w2_sulfate', type: 'float' }, |
270 { name: 'w2_sulfate', type: 'float' }, |
271 { name: 'w2_chloride', type: 'float' }, |
271 { name: 'w2_chloride', type: 'float' }, |
272 { name: 'w2_sodium', type: 'float' }, |
272 { name: 'w2_sodium', type: 'float' }, |
273 { name: 'w2_magnesium', type: 'float' }, |
273 { name: 'w2_magnesium', type: 'float' }, |
274 { name: 'w2_total_alkalinity', type: 'float' }, |
274 { name: 'w2_total_alkalinity', type: 'float' }, |
275 { name: 'w2_ph', type: 'float' }, |
275 { name: 'w2_ph', type: 'float' }, |
276 { name: 'w2_cost', type: 'float' }, |
276 { name: 'w2_cost', type: 'float' }, |
277 { name: 'wg_amount', type: 'float' }, |
277 { name: 'wg_amount', type: 'float' }, |
278 { name: 'wg_calcium', type: 'float' }, |
278 { name: 'wg_calcium', type: 'float' }, |
279 { name: 'wg_sulfate', type: 'float' }, |
279 { name: 'wg_sulfate', type: 'float' }, |
280 { name: 'wg_chloride', type: 'float' }, |
280 { name: 'wg_chloride', type: 'float' }, |
281 { name: 'wg_sodium', type: 'float' }, |
281 { name: 'wg_sodium', type: 'float' }, |
282 { name: 'wg_magnesium', type: 'float' }, |
282 { name: 'wg_magnesium', type: 'float' }, |
283 { name: 'wg_total_alkalinity', type: 'float' }, |
283 { name: 'wg_total_alkalinity', type: 'float' }, |
284 { name: 'wg_ph', type: 'float' }, |
284 { name: 'wg_ph', type: 'float' }, |
285 { name: 'wb_calcium', type: 'float' }, |
285 { name: 'wb_calcium', type: 'float' }, |
286 { name: 'wb_sulfate', type: 'float' }, |
286 { name: 'wb_sulfate', type: 'float' }, |
287 { name: 'wb_chloride', type: 'float' }, |
287 { name: 'wb_chloride', type: 'float' }, |
288 { name: 'wb_sodium', type: 'float' }, |
288 { name: 'wb_sodium', type: 'float' }, |
289 { name: 'wb_magnesium', type: 'float' }, |
289 { name: 'wb_magnesium', type: 'float' }, |
290 { name: 'wb_total_alkalinity', type: 'float' }, |
290 { name: 'wb_total_alkalinity', type: 'float' }, |
291 { name: 'wb_ph', type: 'float' }, |
291 { name: 'wb_ph', type: 'float' }, |
292 { name: 'wa_acid_name', type: 'int' }, |
292 { name: 'wa_acid_name', type: 'int' }, |
293 { name: 'wa_acid_perc', type: 'int' }, |
293 { name: 'wa_acid_perc', type: 'int' }, |
294 { name: 'wa_base_name', type: 'int' }, |
294 { name: 'wa_base_name', type: 'int' }, |
295 { name: 'starter_enable', type: 'int' }, |
295 { name: 'starter_enable', type: 'int' }, |
296 { name: 'starter_type', type: 'int' }, |
296 { name: 'starter_type', type: 'int' }, |
297 { name: 'starter_sg', type: 'float' }, |
297 { name: 'starter_sg', type: 'float' }, |
298 { name: 'starter_viability', type: 'int' }, |
298 { name: 'starter_viability', type: 'int' }, |
299 { name: 'prop1_type', type: 'int' }, |
299 { name: 'prop1_type', type: 'int' }, |
300 { name: 'prop1_volume', type: 'float' }, |
300 { name: 'prop1_volume', type: 'float' }, |
301 { name: 'prop2_type', type: 'int' }, |
301 { name: 'prop2_type', type: 'int' }, |
302 { name: 'prop2_volume', type: 'float' }, |
302 { name: 'prop2_volume', type: 'float' }, |
303 { name: 'prop3_type', type: 'int' }, |
303 { name: 'prop3_type', type: 'int' }, |
304 { name: 'prop3_volume', type: 'float' }, |
304 { name: 'prop3_volume', type: 'float' }, |
305 { name: 'prop4_type', type: 'int' }, |
305 { name: 'prop4_type', type: 'int' }, |
306 { name: 'prop4_volume', type: 'float' }, |
306 { name: 'prop4_volume', type: 'float' }, |
307 { name: 'fermentables', type: 'array' }, |
307 { name: 'fermentables', type: 'array' }, |
308 { name: 'hops', type: 'array' }, |
308 { name: 'hops', type: 'array' }, |
309 { name: 'miscs', type: 'array' }, |
309 { name: 'miscs', type: 'array' }, |
310 { name: 'yeasts', type: 'array' }, |
310 { name: 'yeasts', type: 'array' }, |
311 { name: 'mashs', type: 'array' } |
311 { name: 'mashs', type: 'array' } |
312 ], |
312 ], |
313 id: 'record', |
313 id: 'record', |
314 url: url + '?record=' + my_record |
314 url: url + '?record=' + my_record |
315 }, |
315 }, |
316 // Load data and select one record. |
316 |
317 dataAdapter = new $.jqx.dataAdapter(source, { |
317 // Load data and select one record. |
318 loadComplete: function () { |
318 dataAdapter = new $.jqx.dataAdapter(source, { |
319 var records = dataAdapter.records; |
319 loadComplete: function() { |
320 dataRecord = records[0]; |
320 var records = dataAdapter.records; |
321 // Hidden record uuid |
321 dataRecord = records[0]; |
322 $("#name").val(dataRecord.name); |
322 // Hidden record uuid |
323 $("#code").val(dataRecord.code); |
323 $('#name').val(dataRecord.name); |
324 $("#birth").val(dataRecord.birth); |
324 $('#code').val(dataRecord.code); |
325 $("#stage").val(StageData[dataRecord.stage].nl); |
325 $('#birth').val(dataRecord.birth); |
326 $("#notes").val(dataRecord.notes); |
326 $('#stage').val(StageData[dataRecord.stage].nl); |
327 $("#locked").val(dataRecord.locked); |
327 $('#notes').val(dataRecord.notes); |
328 $("#eq_name").val(dataRecord.eq_name); |
328 $('#locked').val(dataRecord.locked); |
329 $("#eq_notes").val(dataRecord.eq_notes); |
329 $('#eq_name').val(dataRecord.eq_name); |
330 $("#eq_boil_size").val(dataRecord.eq_boil_size); |
330 $('#eq_notes').val(dataRecord.eq_notes); |
331 $("#eq_batch_size").val(dataRecord.eq_batch_size); |
331 $('#eq_boil_size').val(dataRecord.eq_boil_size); |
332 $("#eq_tun_volume").val(dataRecord.eq_tun_volume); |
332 $('#eq_batch_size').val(dataRecord.eq_batch_size); |
333 $("#eq_top_up_water").val(dataRecord.eq_top_up_water); |
333 $('#eq_tun_volume').val(dataRecord.eq_tun_volume); |
334 $("#eq_trub_chiller_loss").val(dataRecord.eq_trub_chiller_loss); |
334 $('#eq_top_up_water').val(dataRecord.eq_top_up_water); |
335 $("#eq_evap_rate").val(dataRecord.eq_evap_rate); |
335 $('#eq_trub_chiller_loss').val(dataRecord.eq_trub_chiller_loss); |
336 $("#eq_boil_time").val(dataRecord.eq_boil_time); |
336 $('#eq_evap_rate').val(dataRecord.eq_evap_rate); |
337 $("#eq_top_up_kettle").val(dataRecord.eq_top_up_kettle); |
337 $('#eq_boil_time').val(dataRecord.eq_boil_time); |
338 $("#eq_hop_utilization").val(dataRecord.eq_hop_utilization); |
338 $('#eq_top_up_kettle').val(dataRecord.eq_top_up_kettle); |
339 $("#eq_lauter_volume").val(dataRecord.eq_lauter_volume); |
339 $('#eq_hop_utilization').val(dataRecord.eq_hop_utilization); |
340 $("#eq_lauter_deadspace").val(dataRecord.eq_lauter_deadspace); |
340 $('#eq_lauter_volume').val(dataRecord.eq_lauter_volume); |
341 $("#eq_kettle_volume").val(dataRecord.eq_kettle_volume); |
341 $('#eq_lauter_deadspace').val(dataRecord.eq_lauter_deadspace); |
342 $("#eq_mash_volume").val(dataRecord.eq_mash_volume); |
342 $('#eq_kettle_volume').val(dataRecord.eq_kettle_volume); |
343 $("#eq_mash_max").val(dataRecord.eq_mash_max); |
343 $('#eq_mash_volume').val(dataRecord.eq_mash_volume); |
344 $("#eq_efficiency").val(dataRecord.eq_efficiency); |
344 $('#eq_mash_max').val(dataRecord.eq_mash_max); |
345 // Brewdate |
345 $('#eq_efficiency').val(dataRecord.eq_efficiency); |
346 $("#brew_date_start").val(dataRecord.brew_date_start); |
346 // Brewdate |
347 $("#brew_mash_ph").val(dataRecord.brew_mash_ph); |
347 $('#brew_date_start').val(dataRecord.brew_date_start); |
348 $("#brew_mash_sg").val(dataRecord.brew_mash_sg); |
348 $('#brew_mash_ph').val(dataRecord.brew_mash_ph); |
349 $("#brew_mash_efficiency").val(dataRecord.brew_mash_efficiency); |
349 $('#brew_mash_sg').val(dataRecord.brew_mash_sg); |
350 // Header Spoelen en filteren |
350 $('#brew_mash_efficiency').val(dataRecord.brew_mash_efficiency); |
351 $("#brew_sparge_temperature").val(dataRecord.sparge_temp); |
351 // Header Spoelen en filteren |
352 $("#brew_sparge_volume").val(dataRecord.sparge_volume); |
352 $('#brew_sparge_temperature').val(dataRecord.sparge_temp); |
353 $("#brew_sparge_est").val(dataRecord.brew_sparge_est); |
353 $('#brew_sparge_volume').val(dataRecord.sparge_volume); |
354 $("#brew_sparge_ph").val(dataRecord.brew_sparge_ph); |
354 $('#brew_sparge_est').val(dataRecord.brew_sparge_est); |
355 // Header Beluchten |
355 $('#brew_sparge_ph').val(dataRecord.brew_sparge_ph); |
356 $("#brew_aeration_type").val(dataRecord.brew_aeration_type); |
356 // Header Beluchten |
357 $("#brew_aeration_time").val(dataRecord.brew_aeration_time); |
357 $('#brew_aeration_type').val(dataRecord.brew_aeration_type); |
358 $("#brew_aeration_speed").val(dataRecord.brew_aeration_speed); |
358 $('#brew_aeration_time').val(dataRecord.brew_aeration_time); |
359 |
359 $('#brew_aeration_speed').val(dataRecord.brew_aeration_speed); |
360 $("#brew_preboil_ph").val(dataRecord.brew_preboil_ph); |
360 |
361 $("#brew_preboil_sg").val(dataRecord.brew_preboil_sg); |
361 $('#brew_preboil_ph').val(dataRecord.brew_preboil_ph); |
362 $("#brew_preboil_volume").val(dataRecord.brew_preboil_volume); |
362 $('#brew_preboil_sg').val(dataRecord.brew_preboil_sg); |
363 $("#brew_preboil_efficiency").val(dataRecord.brew_preboil_efficiency); |
363 $('#brew_preboil_volume').val(dataRecord.brew_preboil_volume); |
364 // Header Koelen en whirlpoolen |
364 $('#brew_preboil_efficiency').val(dataRecord.brew_preboil_efficiency); |
365 $("#brew_whirlpool9").val(dataRecord.brew_whirlpool9); |
365 // Header Koelen en whirlpoolen |
366 $("#brew_whirlpool7").val(dataRecord.brew_whirlpool7); |
366 $('#brew_whirlpool9').val(dataRecord.brew_whirlpool9); |
367 $("#brew_whirlpool6").val(dataRecord.brew_whirlpool6); |
367 $('#brew_whirlpool7').val(dataRecord.brew_whirlpool7); |
368 $("#brew_whirlpool2").val(dataRecord.brew_whirlpool2); |
368 $('#brew_whirlpool6').val(dataRecord.brew_whirlpool6); |
369 // Header Naar gistvat |
369 $('#brew_whirlpool2').val(dataRecord.brew_whirlpool2); |
370 $("#brew_fermenter_volume").val(dataRecord.brew_fermenter_volume); |
370 // Header Naar gistvat |
371 $("#brew_fermenter_sg").val(dataRecord.brew_fermenter_sg); |
371 $('#brew_fermenter_volume').val(dataRecord.brew_fermenter_volume); |
372 $("#brew_fermenter_sg2").val(dataRecord.brew_fermenter_sg); |
372 $('#brew_fermenter_sg').val(dataRecord.brew_fermenter_sg); |
373 $("#brew_fermenter_ibu").val(dataRecord.brew_fermenter_ibu); |
373 $('#brew_fermenter_sg2').val(dataRecord.brew_fermenter_sg); |
374 $("#brew_fermenter_color").val(dataRecord.brew_fermenter_color); |
374 $('#brew_fermenter_ibu').val(dataRecord.brew_fermenter_ibu); |
375 $("#brew_fermenter_extrawater").val(dataRecord.brew_fermenter_extrawater); |
375 $('#brew_fermenter_color').val(dataRecord.brew_fermenter_color); |
376 $("#brew_fermenter_tcloss").val(dataRecord.brew_fermenter_tcloss); |
376 $('#brew_fermenter_extrawater').val(dataRecord.brew_fermenter_extrawater); |
377 |
377 $('#brew_fermenter_tcloss').val(dataRecord.brew_fermenter_tcloss); |
378 $("#brew_aboil_ph").val(dataRecord.brew_aboil_ph); |
378 |
379 $("#brew_aboil_sg").val(dataRecord.brew_aboil_sg); |
379 $('#brew_aboil_ph').val(dataRecord.brew_aboil_ph); |
380 $("#brew_aboil_volume").val(dataRecord.brew_aboil_volume); |
380 $('#brew_aboil_sg').val(dataRecord.brew_aboil_sg); |
381 $("#brew_aboil_efficiency").val(dataRecord.brew_aboil_efficiency); |
381 $('#brew_aboil_volume').val(dataRecord.brew_aboil_volume); |
382 // Header Koelen en whirlpoolen |
382 $('#brew_aboil_efficiency').val(dataRecord.brew_aboil_efficiency); |
383 $("#brew_cooling_to").val(dataRecord.brew_cooling_to); |
383 // Header Koelen en whirlpoolen |
384 $("#brew_cooling_method").val(dataRecord.brew_cooling_method); |
384 $('#brew_cooling_to').val(dataRecord.brew_cooling_to); |
385 $("#brew_cooling_time").val(dataRecord.brew_cooling_time); |
385 $('#brew_cooling_method').val(dataRecord.brew_cooling_method); |
386 // Niks |
386 $('#brew_cooling_time').val(dataRecord.brew_cooling_time); |
387 $("#brew_date_end").val(dataRecord.brew_date_end); |
387 // Niks |
388 $("#og").val(dataRecord.og); |
388 $('#brew_date_end').val(dataRecord.brew_date_end); |
389 $("#fg").val(dataRecord.fg); |
389 $('#og').val(dataRecord.og); |
390 $("#primary_start_temp").val(dataRecord.primary_start_temp); |
390 $('#fg').val(dataRecord.fg); |
391 $("#primary_max_temp").val(dataRecord.primary_max_temp); |
391 $('#primary_start_temp').val(dataRecord.primary_start_temp); |
392 $("#primary_end_temp").val(dataRecord.primary_end_temp); |
392 $('#primary_max_temp').val(dataRecord.primary_max_temp); |
393 $("#primary_end_sg").val(dataRecord.primary_end_sg); |
393 $('#primary_end_temp').val(dataRecord.primary_end_temp); |
394 $("#primary_end_date").val(dataRecord.primary_end_date); |
394 $('#primary_end_sg').val(dataRecord.primary_end_sg); |
395 $("#secondary_temp").val(dataRecord.secondary_temp); |
395 $('#primary_end_date').val(dataRecord.primary_end_date); |
396 $("#secondary_end_sg").val(dataRecord.secondary_end_sg); |
396 $('#secondary_temp').val(dataRecord.secondary_temp); |
397 $("#secondary_end_date").val(dataRecord.secondary_end_date); |
397 $('#secondary_end_sg').val(dataRecord.secondary_end_sg); |
398 $("#tertiary_temp").val(dataRecord.tertiary_temp); |
398 $('#secondary_end_date').val(dataRecord.secondary_end_date); |
399 $("#package_date").val(dataRecord.package_date); |
399 $('#tertiary_temp').val(dataRecord.tertiary_temp); |
400 $("#package_volume").val(dataRecord.package_volume); |
400 $('#package_date').val(dataRecord.package_date); |
401 $("#package_infuse_amount").val(dataRecord.package_infuse_amount); |
401 $('#package_volume').val(dataRecord.package_volume); |
402 $("#package_infuse_abv").val(dataRecord.package_infuse_abv); |
402 $('#package_infuse_amount').val(dataRecord.package_infuse_amount); |
403 $("#package_infuse_notes").val(dataRecord.package_infuse_notes); |
403 $('#package_infuse_abv').val(dataRecord.package_infuse_abv); |
404 $("#package_abv").val(dataRecord.package_abv); |
404 $('#package_infuse_notes').val(dataRecord.package_infuse_notes); |
405 $("#package_ph").val(dataRecord.package_ph); |
405 $('#package_abv').val(dataRecord.package_abv); |
406 $("#bottle_amount").val(dataRecord.bottle_amount); |
406 $('#package_ph').val(dataRecord.package_ph); |
407 $("#bottle_carbonation").val(dataRecord.bottle_carbonation); |
407 $('#bottle_amount').val(dataRecord.bottle_amount); |
408 $("#bottle_priming_water").val(dataRecord.bottle_priming_water); |
408 $('#bottle_carbonation').val(dataRecord.bottle_carbonation); |
409 $("#bottle_priming_amount").val(dataRecord.bottle_priming_amount); |
409 $('#bottle_priming_water').val(dataRecord.bottle_priming_water); |
410 $("#bottle_carbonation_temp").val(dataRecord.bottle_carbonation_temp); |
410 $('#bottle_priming_amount').val(dataRecord.bottle_priming_amount); |
411 $("#keg_amount").val(dataRecord.keg_amount); |
411 $('#bottle_carbonation_temp').val(dataRecord.bottle_carbonation_temp); |
412 $("#keg_carbonation").val(dataRecord.keg_carbonation); |
412 $('#keg_amount').val(dataRecord.keg_amount); |
413 $("#keg_priming_water").val(dataRecord.keg_priming_water); |
413 $('#keg_carbonation').val(dataRecord.keg_carbonation); |
414 $("#keg_priming_amount").val(dataRecord.keg_priming_amount); |
414 $('#keg_priming_water').val(dataRecord.keg_priming_water); |
415 $("#keg_carbonation_temp").val(dataRecord.keg_carbonation_temp); |
415 $('#keg_priming_amount').val(dataRecord.keg_priming_amount); |
416 $("#keg_forced_carb").val(dataRecord.keg_forced_carb); |
416 $('#keg_carbonation_temp').val(dataRecord.keg_carbonation_temp); |
417 $("#keg_pressure").val(dataRecord.keg_pressure); |
417 $('#keg_forced_carb').val(dataRecord.keg_forced_carb); |
418 $("#taste_notes").val(dataRecord.taste_notes); |
418 $('#keg_pressure').val(dataRecord.keg_pressure); |
419 $("#taste_rate").val(dataRecord.taste_rate); |
419 $('#taste_notes').val(dataRecord.taste_notes); |
420 $("#taste_date").val(dataRecord.taste_date); |
420 $('#taste_rate').val(dataRecord.taste_rate); |
421 $("#taste_color").val(dataRecord.taste_color); |
421 $('#taste_date').val(dataRecord.taste_date); |
422 $("#taste_transparency").val(dataRecord.taste_transparency); |
422 $('#taste_color').val(dataRecord.taste_color); |
423 $("#taste_head").val(dataRecord.taste_head); |
423 $('#taste_transparency').val(dataRecord.taste_transparency); |
424 $("#taste_aroma").val(dataRecord.taste_aroma); |
424 $('#taste_head').val(dataRecord.taste_head); |
425 $("#taste_taste").val(dataRecord.taste_taste); |
425 $('#taste_aroma').val(dataRecord.taste_aroma); |
426 $("#taste_mouthfeel").val(dataRecord.taste_mouthfeel); |
426 $('#taste_taste').val(dataRecord.taste_taste); |
427 $("#taste_aftertaste").val(dataRecord.taste_aftertaste); |
427 $('#taste_mouthfeel').val(dataRecord.taste_mouthfeel); |
428 |
428 $('#taste_aftertaste').val(dataRecord.taste_aftertaste); |
429 // Recipe |
429 |
430 $("#st_name").val(dataRecord.st_name); |
430 // Recipe |
431 $("#st_letter").val(dataRecord.st_letter); |
431 $('#st_name').val(dataRecord.st_name); |
432 $("#st_guide").val(dataRecord.st_guide); |
432 $('#st_letter').val(dataRecord.st_letter); |
433 $("#st_category").val(dataRecord.st_category); |
433 $('#st_guide').val(dataRecord.st_guide); |
434 $("#st_category_number").val(dataRecord.st_category_number); |
434 $('#st_category').val(dataRecord.st_category); |
435 $("#st_type").val(StyleTypeData[dataRecord.st_type].nl); |
435 $('#st_category_number').val(dataRecord.st_category_number); |
436 $("#st_og_min").val(dataRecord.st_og_min); |
436 $('#st_type').val(StyleTypeData[dataRecord.st_type].nl); |
437 $("#st_og_max").val(dataRecord.st_og_max); |
437 $('#st_og_min').val(dataRecord.st_og_min); |
438 $("#st_fg_min").val(dataRecord.st_fg_min); |
438 $('#st_og_max').val(dataRecord.st_og_max); |
439 $("#st_fg_max").val(dataRecord.st_fg_max); |
439 $('#st_fg_min').val(dataRecord.st_fg_min); |
440 $("#st_abv_min").val(dataRecord.st_abv_min); |
440 $('#st_fg_max').val(dataRecord.st_fg_max); |
441 $("#st_abv_max").val(dataRecord.st_abv_max); |
441 $('#st_abv_min').val(dataRecord.st_abv_min); |
442 $("#st_color_min").val(dataRecord.st_color_min); |
442 $('#st_abv_max').val(dataRecord.st_abv_max); |
443 $("#st_color_max").val(dataRecord.st_color_max); |
443 $('#st_color_min').val(dataRecord.st_color_min); |
444 $("#st_ibu_min").val(dataRecord.st_ibu_min); |
444 $('#st_color_max').val(dataRecord.st_color_max); |
445 $("#st_ibu_max").val(dataRecord.st_ibu_max); |
445 $('#st_ibu_min').val(dataRecord.st_ibu_min); |
446 $("#st_carb_min").val(dataRecord.st_carb_min); |
446 $('#st_ibu_max').val(dataRecord.st_ibu_max); |
447 $("#st_carb_min2").val(dataRecord.st_carb_min); |
447 $('#st_carb_min').val(dataRecord.st_carb_min); |
448 $("#st_carb_max").val(dataRecord.st_carb_max); |
448 $('#st_carb_min2').val(dataRecord.st_carb_min); |
449 $("#st_carb_max2").val(dataRecord.st_carb_max); |
449 $('#st_carb_max').val(dataRecord.st_carb_max); |
450 $("#type").val(dataRecord.type); |
450 $('#st_carb_max2').val(dataRecord.st_carb_max); |
451 $("#batch_size").val(dataRecord.batch_size); |
451 $('#type').val(dataRecord.type); |
452 $("#est_a_vol").val(dataRecord.batch_size * 1.04); |
452 $('#batch_size').val(dataRecord.batch_size); |
453 $("#boil_size").val(dataRecord.boil_size); |
453 $('#est_a_vol').val(dataRecord.batch_size * 1.04); |
454 $("#est_pre_vol").val(dataRecord.boil_size * 1.04); |
454 $('#boil_size').val(dataRecord.boil_size); |
455 $("#boil_time").val(dataRecord.boil_time); |
455 $('#est_pre_vol').val(dataRecord.boil_size * 1.04); |
456 $("#efficiency").val(dataRecord.efficiency); |
456 $('#boil_time').val(dataRecord.boil_time); |
457 $("#est_og").val(dataRecord.est_og); |
457 $('#efficiency').val(dataRecord.efficiency); |
458 $("#est_og2").val(dataRecord.est_og); |
458 $('#est_og').val(dataRecord.est_og); |
459 $("#est_og3").val(0); |
459 $('#est_og2').val(dataRecord.est_og); |
460 $("#est_fg").val(dataRecord.est_fg); |
460 $('#est_og3').val(0); |
461 $("#est_fg2").val(dataRecord.est_fg); |
461 $('#est_fg').val(dataRecord.est_fg); |
462 $("#est_fg3").val(dataRecord.est_fg); |
462 $('#est_fg2').val(dataRecord.est_fg); |
463 $("#est_color").val(dataRecord.est_color); |
463 $('#est_fg3').val(dataRecord.est_fg); |
464 $("#est_color2").val(dataRecord.est_color); |
464 $('#est_color').val(dataRecord.est_color); |
465 $("#est_abv").val(dataRecord.est_abv); |
465 $('#est_color2').val(dataRecord.est_color); |
466 $("#color_method").val(dataRecord.color_method); |
466 $('#est_abv').val(dataRecord.est_abv); |
467 $("#est_ibu").val(dataRecord.est_ibu); |
467 $('#color_method').val(dataRecord.color_method); |
468 $("#est_ibu2").val(dataRecord.est_ibu); |
468 $('#est_ibu').val(dataRecord.est_ibu); |
469 $("#ibu_method").val(dataRecord.ibu_method); |
469 $('#est_ibu2').val(dataRecord.est_ibu); |
470 $("#est_carb").val(dataRecord.est_carb); |
470 $('#ibu_method').val(dataRecord.ibu_method); |
471 $("#mash_name").val(dataRecord.mash_name); |
471 $('#est_carb').val(dataRecord.est_carb); |
472 $("#mash_ph").val(dataRecord.mash_ph); |
472 $('#mash_name').val(dataRecord.mash_name); |
473 $("#sparge_temp").val(dataRecord.sparge_temp); |
473 $('#mash_ph').val(dataRecord.mash_ph); |
474 $("#sparge_ph").val(dataRecord.sparge_ph); |
474 $('#sparge_temp').val(dataRecord.sparge_temp); |
475 $("#sparge_volume").val(dataRecord.sparge_volume); |
475 $('#sparge_ph').val(dataRecord.sparge_ph); |
476 $("#sparge_source").val(dataRecord.sparge_source); |
476 $('#sparge_volume').val(dataRecord.sparge_volume); |
477 $("#sparge_acid_type").val(dataRecord.sparge_acid_type); |
477 $('#sparge_source').val(dataRecord.sparge_source); |
478 $("#sparge_acid_perc").val(dataRecord.sparge_acid_perc); |
478 $('#sparge_acid_type').val(dataRecord.sparge_acid_type); |
479 $("#sparge_acid_amount").val(dataRecord.sparge_acid_amount * 1000); |
479 $('#sparge_acid_perc').val(dataRecord.sparge_acid_perc); |
480 $("#calc_acid").val(dataRecord.calc_acid); |
480 $('#sparge_acid_amount').val(dataRecord.sparge_acid_amount * 1000); |
481 $("#w1_name").val(dataRecord.w1_name); |
481 $('#calc_acid').val(dataRecord.calc_acid); |
482 $("#w1_amount").val(dataRecord.w1_amount); |
482 $('#w1_name').val(dataRecord.w1_name); |
483 $("#w1_calcium").val(dataRecord.w1_calcium); |
483 $('#w1_amount').val(dataRecord.w1_amount); |
484 $("#w1_sulfate").val(dataRecord.w1_sulfate); |
484 $('#w1_calcium').val(dataRecord.w1_calcium); |
485 $("#w1_chloride").val(dataRecord.w1_chloride); |
485 $('#w1_sulfate').val(dataRecord.w1_sulfate); |
486 $("#w1_sodium").val(dataRecord.w1_sodium); |
486 $('#w1_chloride').val(dataRecord.w1_chloride); |
487 $("#w1_magnesium").val(dataRecord.w1_magnesium); |
487 $('#w1_sodium').val(dataRecord.w1_sodium); |
488 $("#w1_total_alkalinity").val(dataRecord.w1_total_alkalinity); |
488 $('#w1_magnesium').val(dataRecord.w1_magnesium); |
489 $("#w1_ph").val(dataRecord.w1_ph); |
489 $('#w1_total_alkalinity').val(dataRecord.w1_total_alkalinity); |
490 $("#w1_cost").val(dataRecord.w1_cost); |
490 $('#w1_ph').val(dataRecord.w1_ph); |
491 $("#w2_name").val(dataRecord.w2_name); |
491 $('#w1_cost').val(dataRecord.w1_cost); |
492 $("#w2_amount").val(dataRecord.w2_amount); |
492 $('#w2_name').val(dataRecord.w2_name); |
493 $("#w2_calcium").val(dataRecord.w2_calcium); |
493 $('#w2_amount').val(dataRecord.w2_amount); |
494 $("#w2_sulfate").val(dataRecord.w2_sulfate); |
494 $('#w2_calcium').val(dataRecord.w2_calcium); |
495 $("#w2_chloride").val(dataRecord.w2_chloride); |
495 $('#w2_sulfate').val(dataRecord.w2_sulfate); |
496 $("#w2_sodium").val(dataRecord.w2_sodium); |
496 $('#w2_chloride').val(dataRecord.w2_chloride); |
497 $("#w2_magnesium").val(dataRecord.w2_magnesium); |
497 $('#w2_sodium').val(dataRecord.w2_sodium); |
498 $("#w2_total_alkalinity").val(dataRecord.w2_total_alkalinity); |
498 $('#w2_magnesium').val(dataRecord.w2_magnesium); |
499 $("#w2_ph").val(dataRecord.w2_ph); |
499 $('#w2_total_alkalinity').val(dataRecord.w2_total_alkalinity); |
500 $("#w2_cost").val(dataRecord.w2_cost); |
500 $('#w2_ph').val(dataRecord.w2_ph); |
501 $("#wg_amount").val(dataRecord.wg_amount); |
501 $('#w2_cost').val(dataRecord.w2_cost); |
502 $("#wg_calcium").val(dataRecord.wg_calcium); |
502 $('#wg_amount').val(dataRecord.wg_amount); |
503 $("#wg_sulfate").val(dataRecord.wg_sulfate); |
503 $('#wg_calcium').val(dataRecord.wg_calcium); |
504 $("#wg_chloride").val(dataRecord.wg_chloride); |
504 $('#wg_sulfate').val(dataRecord.wg_sulfate); |
505 $("#wg_sodium").val(dataRecord.wg_sodium); |
505 $('#wg_chloride').val(dataRecord.wg_chloride); |
506 $("#wg_magnesium").val(dataRecord.wg_magnesium); |
506 $('#wg_sodium').val(dataRecord.wg_sodium); |
507 $("#wg_total_alkalinity").val(dataRecord.wg_total_alkalinity); |
507 $('#wg_magnesium').val(dataRecord.wg_magnesium); |
508 $("#wg_ph").val(dataRecord.wg_ph); |
508 $('#wg_total_alkalinity').val(dataRecord.wg_total_alkalinity); |
509 $("#wb_calcium").val(dataRecord.wb_calcium); |
509 $('#wg_ph').val(dataRecord.wg_ph); |
510 $("#wb_sulfate").val(dataRecord.wb_sulfate); |
510 $('#wb_calcium').val(dataRecord.wb_calcium); |
511 $("#wb_chloride").val(dataRecord.wb_chloride); |
511 $('#wb_sulfate').val(dataRecord.wb_sulfate); |
512 $("#wb_sodium").val(dataRecord.wb_sodium); |
512 $('#wb_chloride').val(dataRecord.wb_chloride); |
513 $("#wb_magnesium").val(dataRecord.wb_magnesium); |
513 $('#wb_sodium').val(dataRecord.wb_sodium); |
514 $("#wb_total_alkalinity").val(dataRecord.wb_total_alkalinity); |
514 $('#wb_magnesium').val(dataRecord.wb_magnesium); |
515 $("#wb_ph").val(dataRecord.wb_ph); |
515 $('#wb_total_alkalinity').val(dataRecord.wb_total_alkalinity); |
516 $("#wa_acid_name").val(dataRecord.wa_acid_name); |
516 $('#wb_ph').val(dataRecord.wb_ph); |
517 $("#wa_acid_perc").val(dataRecord.wa_acid_perc); |
517 $('#wa_acid_name').val(dataRecord.wa_acid_name); |
518 $("#wa_base_name").val(dataRecord.wa_base_name); |
518 $('#wa_acid_perc').val(dataRecord.wa_acid_perc); |
519 $("#starter_enable").val(dataRecord.starter_enable); |
519 $('#wa_base_name').val(dataRecord.wa_base_name); |
520 $("#starter_type").val(dataRecord.starter_type); |
520 $('#starter_enable').val(dataRecord.starter_enable); |
521 $("#starter_sg").val(dataRecord.starter_sg); |
521 $('#starter_type').val(dataRecord.starter_type); |
522 $("#starter_viability").val(dataRecord.starter_viability); |
522 $('#starter_sg').val(dataRecord.starter_sg); |
523 $("#prop1_type").val(dataRecord.prop1_type); |
523 $('#starter_viability').val(dataRecord.starter_viability); |
524 $("#prop1_volume").val(dataRecord.prop1_volume); |
524 $('#prop1_type').val(dataRecord.prop1_type); |
525 $("#prop2_type").val(dataRecord.prop2_type); |
525 $('#prop1_volume').val(dataRecord.prop1_volume); |
526 $("#prop2_volume").val(dataRecord.prop2_volume); |
526 $('#prop2_type').val(dataRecord.prop2_type); |
527 $("#prop3_type").val(dataRecord.prop3_type); |
527 $('#prop2_volume').val(dataRecord.prop2_volume); |
528 $("#prop3_volume").val(dataRecord.prop3_volume); |
528 $('#prop3_type').val(dataRecord.prop3_type); |
529 $("#prop4_type").val(dataRecord.prop4_type); |
529 $('#prop3_volume').val(dataRecord.prop3_volume); |
530 $("#prop4_volume").val(dataRecord.prop4_volume); |
530 $('#prop4_type').val(dataRecord.prop4_type); |
531 editFermentable(dataRecord); |
531 $('#prop4_volume').val(dataRecord.prop4_volume); |
532 editHop(dataRecord); |
532 editFermentable(dataRecord); |
533 editMisc(dataRecord); |
533 editHop(dataRecord); |
534 editYeast(dataRecord); |
534 editMisc(dataRecord); |
535 editMash(dataRecord); |
535 editYeast(dataRecord); |
536 calcStage(); |
536 editMash(dataRecord); |
537 $('#jqxTabs').jqxTabs('select', 2); |
537 calcStage(); |
538 }, |
538 $('#jqxTabs').jqxTabs('select', 2); |
539 loadError: function (jqXHR, status, error) { |
539 }, |
540 }, |
540 loadError: function(jqXHR, status, error) { |
541 beforeLoadComplete: function (records) { |
541 }, |
542 $('#jqxLoader').jqxLoader('open'); |
542 beforeLoadComplete: function(records) { |
543 } |
543 $('#jqxLoader').jqxLoader('open'); |
544 }), |
544 } |
545 |
545 }); |
546 // Inline fermentables editor |
546 |
547 editFermentable = function (data) { |
547 // Inline fermentables editor |
548 var fermentableSource = { |
548 var editFermentable = function(data) { |
549 localdata: data.fermentables, |
549 var fermentableSource = { |
550 datatype: "local", |
550 localdata: data.fermentables, |
551 cache: false, |
551 datatype: 'local', |
552 async: false, |
552 cache: false, |
553 datafields: [ |
553 async: false, |
554 { name: 'f_name', type: 'string' }, |
554 datafields: [ |
555 { name: 'f_origin', type: 'string' }, |
555 { name: 'f_name', type: 'string' }, |
556 { name: 'f_supplier', type: 'string' }, |
556 { name: 'f_origin', type: 'string' }, |
557 { name: 'f_amount', type: 'float' }, |
557 { name: 'f_supplier', type: 'string' }, |
558 { name: 'f_cost', type: 'float' }, |
558 { name: 'f_amount', type: 'float' }, |
559 { name: 'f_type', type: 'int' }, |
559 { name: 'f_cost', type: 'float' }, |
560 { name: 'f_yield', type: 'float' }, |
560 { name: 'f_type', type: 'int' }, |
561 { name: 'f_color', type: 'float' }, |
561 { name: 'f_yield', type: 'float' }, |
562 { name: 'f_coarse_fine_diff', type: 'float' }, |
562 { name: 'f_color', type: 'float' }, |
563 { name: 'f_moisture', type: 'float' }, |
563 { name: 'f_coarse_fine_diff', type: 'float' }, |
564 { name: 'f_diastatic_power', type: 'float' }, |
564 { name: 'f_moisture', type: 'float' }, |
565 { name: 'f_protein', type: 'float' }, |
565 { name: 'f_diastatic_power', type: 'float' }, |
566 { name: 'f_max_in_batch', type: 'float' }, |
566 { name: 'f_protein', type: 'float' }, |
567 { name: 'f_graintype', type: 'int' }, |
567 { name: 'f_max_in_batch', type: 'float' }, |
568 { name: 'f_added', type: 'int' }, |
568 { name: 'f_graintype', type: 'int' }, |
569 { name: 'f_dissolved_protein', type: 'float' }, |
569 { name: 'f_added', type: 'int' }, |
570 { name: 'f_recommend_mash', type: 'int' }, |
570 { name: 'f_dissolved_protein', type: 'float' }, |
571 { name: 'f_add_after_boil', type: 'int' }, |
571 { name: 'f_recommend_mash', type: 'int' }, |
572 { name: 'f_adjust_to_total_100', type: 'int' }, |
572 { name: 'f_add_after_boil', type: 'int' }, |
573 { name: 'f_percentage', type: 'float' }, |
573 { name: 'f_adjust_to_total_100', type: 'int' }, |
574 { name: 'f_di_ph', type: 'float' }, |
574 { name: 'f_percentage', type: 'float' }, |
575 { name: 'f_acid_to_ph_57', type: 'float' }, |
575 { name: 'f_di_ph', type: 'float' }, |
576 { name: 'f_inventory', type: 'float' }, |
576 { name: 'f_acid_to_ph_57', type: 'float' }, |
577 { name: 'f_avail', type: 'int' } |
577 { name: 'f_inventory', type: 'float' }, |
578 ], |
578 { name: 'f_avail', type: 'int' } |
579 addrow: function (rowid, rowdata, position, commit) { |
579 ], |
580 //console.log("fermentable addrow "+rowid); |
580 addrow: function(rowid, rowdata, position, commit) { |
581 commit(true); |
581 //console.log("fermentable addrow "+rowid); |
582 }, |
582 commit(true); |
583 deleterow: function (rowid, commit) { |
583 }, |
584 //console.log("fermentable deleterow "+rowid); |
584 deleterow: function(rowid, commit) { |
585 commit(true); |
585 //console.log("fermentable deleterow "+rowid); |
586 }, |
586 commit(true); |
587 updaterow: function (rowid, rowdata, commit) { |
587 }, |
588 //console.log("fermentable updaterow "+rowid); |
588 updaterow: function(rowid, rowdata, commit) { |
589 commit(true); |
589 //console.log("fermentable updaterow "+rowid); |
590 } |
590 commit(true); |
591 }, |
591 } |
592 fermentableAdapter = new $.jqx.dataAdapter(fermentableSource); |
592 }, |
593 |
593 fermentableAdapter = new $.jqx.dataAdapter(fermentableSource); |
594 $("#fermentableGrid").jqxGrid({ |
594 |
595 width: 1240, |
595 $('#fermentableGrid').jqxGrid({ |
596 height: 470, |
596 width: 1240, |
597 source: fermentableAdapter, |
597 height: 470, |
598 theme: theme, |
598 source: fermentableAdapter, |
599 selectionmode: 'singlerow', |
599 theme: theme, |
600 showtoolbar: true, |
600 selectionmode: 'singlerow', |
601 rendertoolbar: function (toolbar) { |
601 showtoolbar: true, |
602 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
602 rendertoolbar: function(toolbar) { |
603 toolbar.append(container); |
603 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
604 container.append('<div style="float: left; margin-left: 165px;" id="faddrowbutton"></div>'); |
604 toolbar.append(container); |
605 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
605 container.append('<div style="float: left; margin-left: 165px;" id="faddrowbutton"></div>'); |
606 container.append('<div style="float: left; margin-left: 10px;" id="finstockbutton"></div>'); |
606 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
607 container.append('<input style="float: left; margin-left: 400px;" id="fdeleterowbutton" type="button" value="Verwijder mout" />'); |
607 container.append('<div style="float: left; margin-left: 10px;" id="finstockbutton"></div>'); |
608 // add fermentable from dropdownlist. |
608 container.append('<input style="float: left; margin-left: 400px;" id="fdeleterowbutton" type="button" value="Verwijder mout" />'); |
609 $("#faddrowbutton").jqxDropDownList({ |
609 // add fermentable from dropdownlist. |
610 placeHolder: "Kies mout:", |
610 $('#faddrowbutton').jqxDropDownList({ |
611 theme: theme, |
611 placeHolder: 'Kies mout:', |
612 template: "primary", |
612 theme: theme, |
613 source: fermentablelist, |
613 template: 'primary', |
614 displayMember: "name", |
614 source: fermentablelist, |
615 disabled: (dataRecord.stage > 3), |
615 displayMember: 'name', |
616 width: 150, |
616 disabled: (dataRecord.stage > 3), |
617 height: 27, |
617 width: 150, |
618 dropDownWidth: 500, |
618 height: 27, |
619 dropDownHeight: 500, |
619 dropDownWidth: 500, |
620 renderer: function (index, label, value) { |
620 dropDownHeight: 500, |
621 var datarecord = fermentablelist.records[index]; |
621 renderer: function(index, label, value) { |
622 return datarecord.supplier+ " / " + datarecord.name + " (" + datarecord.color + " EBC)"; |
622 var datarecord = fermentablelist.records[index]; |
623 } |
623 return datarecord.supplier + ' / ' + datarecord.name + ' (' + datarecord.color + ' EBC)'; |
624 }); |
624 } |
625 $("#faddrowbutton").on('select', function (event) { |
625 }); |
626 if (event.args) { |
626 $('#faddrowbutton').on('select', function(event) { |
627 var index, datarecord, row = {}, rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
627 if (event.args) { |
628 index = event.args.index; |
628 var index, datarecord, row = {}, rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount; |
629 datarecord = fermentablelist.records[index]; |
629 index = event.args.index; |
630 row["f_name"] = datarecord.name; |
630 datarecord = fermentablelist.records[index]; |
631 row["f_origin"] = datarecord.origin; |
631 row['f_name'] = datarecord.name; |
632 row["f_supplier"] = datarecord.supplier; |
632 row['f_origin'] = datarecord.origin; |
633 row["f_amount"] = 0; |
633 row['f_supplier'] = datarecord.supplier; |
634 row["f_cost"] = datarecord.cost; |
634 row['f_amount'] = 0; |
635 row["f_type"] = datarecord.type; |
635 row['f_cost'] = datarecord.cost; |
636 row["f_yield"] = datarecord.yield; |
636 row['f_type'] = datarecord.type; |
637 row["f_color"] = datarecord.color; |
637 row['f_yield'] = datarecord.yield; |
638 row["f_coarse_fine_diff"] = datarecord.coarse_fine_diff; |
638 row['f_color'] = datarecord.color; |
639 row["f_moisture"] = datarecord.moisture; |
639 row['f_coarse_fine_diff'] = datarecord.coarse_fine_diff; |
640 row["f_diastatic_power"] = datarecord.diastatic_power; |
640 row['f_moisture'] = datarecord.moisture; |
641 row["f_protein"] = datarecord.protein; |
641 row['f_diastatic_power'] = datarecord.diastatic_power; |
642 row["f_max_in_batch"] = datarecord.max_in_batch; |
642 row['f_protein'] = datarecord.protein; |
643 row["f_graintype"] = datarecord.graintype; |
643 row['f_max_in_batch'] = datarecord.max_in_batch; |
644 if (datarecord.add_after_boil) { |
644 row['f_graintype'] = datarecord.graintype; |
645 row["f_added"] = 2; // Fermentation |
645 if (datarecord.add_after_boil) { |
646 } else if ((datarecord.type == 1) || (datarecord.type == 4)) { // Sugar or Adjunct |
646 row['f_added'] = 2; // Fermentation |
647 row["f_added"] = 1; // Boil |
647 } else if ((datarecord.type == 1) || (datarecord.type == 4)) { // Sugar or Adjunct |
648 } else { |
648 row['f_added'] = 1; // Boil |
649 row["f_added"] = 0; // Mash |
649 } else { |
650 } |
650 row['f_added'] = 0; // Mash |
651 row["f_dissolved_protein"] = datarecord.dissolved_protein; |
651 } |
652 row["f_recommend_mash"] = datarecord.recommend_mash; |
652 row['f_dissolved_protein'] = datarecord.dissolved_protein; |
653 row["f_add_after_boil"] = datarecord.add_after_boil; |
653 row['f_recommend_mash'] = datarecord.recommend_mash; |
654 if (rowscount == 0) { |
654 row['f_add_after_boil'] = datarecord.add_after_boil; |
655 // The first fermentable |
655 if (rowscount == 0) { |
656 row["f_adjust_to_total_100"] = 1; |
656 // The first fermentable |
657 row["f_percentage"] = 100; |
657 row['f_adjust_to_total_100'] = 1; |
658 } else { |
658 row['f_percentage'] = 100; |
659 row["f_adjust_to_total_100"] = 0; |
659 } else { |
660 row["f_percentage"] = 0; |
660 row['f_adjust_to_total_100'] = 0; |
661 } |
661 row['f_percentage'] = 0; |
662 row["f_di_ph"] = datarecord.di_ph; |
662 } |
663 row["f_acid_to_ph_57"] = datarecord.acid_to_ph_57; |
663 row['f_di_ph'] = datarecord.di_ph; |
664 row["f_inventory"] = datarecord.inventory; |
664 row['f_acid_to_ph_57'] = datarecord.acid_to_ph_57; |
665 $("#fermentableGrid").jqxGrid('addrow', null, row); |
665 row['f_inventory'] = datarecord.inventory; |
666 } |
666 $('#fermentableGrid').jqxGrid('addrow', null, row); |
667 }); |
667 } |
668 |
668 }); |
669 $("#finstockbutton").jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); |
669 |
670 $("#finstockbutton").on('change', function (event) { |
670 $('#finstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); |
671 fermentableinstock = event.args.checked; |
671 $('#finstockbutton').on('change', function(event) { |
672 fermentablelist.dataBind(); |
672 fermentableinstock = event.args.checked; |
673 }); |
673 fermentablelist.dataBind(); |
674 |
674 }); |
675 // delete selected fermentable. |
675 |
676 $("#fdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); |
676 // delete selected fermentable. |
677 $("#fdeleterowbutton").on('click', function () { |
677 $('#fdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); |
678 var rowscount, id, percent, amount, i, rowdata, |
678 $('#fdeleterowbutton').on('click', function() { |
679 selectedrowindex = $("#fermentableGrid").jqxGrid('getselectedrowindex'); |
679 var rowscount, id, percent, amount, i, rowdata, |
680 rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
680 selectedrowindex = $('#fermentableGrid').jqxGrid('getselectedrowindex'); |
681 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
681 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount; |
682 id = $("#fermentableGrid").jqxGrid('getrowid', selectedrowindex); |
682 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
683 percent = $('#fermentableGrid').jqxGrid('getcellvalue', id, "f_percentage"); |
683 id = $('#fermentableGrid').jqxGrid('getrowid', selectedrowindex); |
684 amount = $('#fermentableGrid').jqxGrid('getcellvalue', id, "f_amount"); |
684 percent = $('#fermentableGrid').jqxGrid('getcellvalue', id, 'f_percentage'); |
685 $("#fermentableGrid").jqxGrid('deleterow', id); |
685 amount = $('#fermentableGrid').jqxGrid('getcellvalue', id, 'f_amount'); |
686 } |
686 $('#fermentableGrid').jqxGrid('deleterow', id); |
687 rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
687 } |
688 if (rowscount > 1) { |
688 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount; |
689 if (to_100) { |
689 if (rowscount > 1) { |
690 for (i = 0; i < rowscount; i++) { |
690 if (to_100) { |
691 rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
691 for (i = 0; i < rowscount; i++) { |
692 if (rowdata.f_adjust_to_total_100) { |
692 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i); |
693 rowdata.f_percentage += percent; |
693 if (rowdata.f_adjust_to_total_100) { |
694 rowdata.f_amount += amount; |
694 rowdata.f_percentage += percent; |
695 } |
695 rowdata.f_amount += amount; |
696 } |
696 } |
697 } else { |
697 } |
698 calcPercentages(); |
698 } else { |
699 } |
699 calcPercentages(); |
700 } else { |
700 } |
701 $("#fermentableGrid").jqxGrid('setcellvalue', 0, "f_percentage", 100); |
701 } else { |
702 } |
702 $('#fermentableGrid').jqxGrid('setcellvalue', 0, 'f_percentage', 100); |
703 calcFermentables(); |
703 } |
704 calcIBUs(); |
704 calcFermentables(); |
705 }); |
705 calcIBUs(); |
706 }, |
706 }); |
707 ready: function() { |
707 }, |
708 calcFermentables(); |
708 ready: function() { |
709 $('#jqxTabs').jqxTabs('next'); |
709 calcFermentables(); |
710 }, |
710 $('#jqxTabs').jqxTabs('next'); |
711 columns: [ |
711 }, |
712 { text: 'Vergistbaar ingrediënt', datafield: 'f_name', |
712 columns: [ |
713 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
713 { text: 'Vergistbaar ingrediënt', datafield: 'f_name', |
714 return "<span style='margin: 3px; margin-top: 6px; float: left;'>" + |
714 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
715 rowdata.f_supplier+" / "+rowdata.f_name+" ("+rowdata.f_color+" EBC)</span>"; |
715 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + rowdata.f_supplier + ' / ' + |
716 } |
716 rowdata.f_name + ' (' + rowdata.f_color + ' EBC)</span>'; |
717 }, |
717 } |
718 { text: 'Type', width: 100, datafield: 'f_type', |
718 }, |
719 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
719 { text: 'Type', width: 100, datafield: 'f_type', |
720 return "<span style='margin: 3px; margin-top: 6px; float: left;'>" + FermentableTypeData[value].nl + "</span>"; |
720 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
721 } |
721 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + FermentableTypeData[value].nl + '</span>'; |
722 }, |
722 } |
723 { text: 'Moment', width: 110, datafield: 'f_added', |
723 }, |
724 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
724 { text: 'Moment', width: 110, datafield: 'f_added', |
725 return "<span style='margin: 3px; margin-top: 6px; float: left;'>" + AddedData[value].nl + "</span>"; |
725 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
726 } |
726 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + AddedData[value].nl + '</span>'; |
727 }, |
727 } |
728 { text:'Maxinbatch', datafield: 'f_max_in_batch', hidden: true }, |
728 }, |
729 { text: 'Opbrengst', datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
729 { text: 'Maxinbatch', datafield: 'f_max_in_batch', hidden: true }, |
730 { text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, |
730 { text: 'Opbrengst', datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
731 { text: 'Voorraad Kg', datafield: 'f_inventory', width: 120, align: 'right', |
731 { text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, |
732 cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties, rowdata) { |
732 { text: 'Voorraad Kg', datafield: 'f_inventory', width: 120, align: 'right', |
733 var color = '#ffffff'; |
733 cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) { |
734 if (((dataRecord.inventory_reduced <= 2) && (rowdata.f_added <= 1)) || // Mash or boil |
734 var color = '#ffffff'; |
735 ((dataRecord.inventory_reduced <= 3) && (rowdata.f_added == 2)) || // Primary |
735 if (((dataRecord.inventory_reduced <= 2) && (rowdata.f_added <= 1)) || // Mash or boil |
736 ((dataRecord.inventory_reduced <= 5) && (rowdata.f_added == 3)) || // Secondary or Tertiary |
736 ((dataRecord.inventory_reduced <= 3) && (rowdata.f_added == 2)) || // Primary |
737 ((dataRecord.inventory_reduced <= 6) && (rowdata.f_added == 4)) || // Bottle |
737 ((dataRecord.inventory_reduced <= 5) && (rowdata.f_added == 3)) || // Secondary or Tertiary |
738 ((dataRecord.inventory_reduced <= 6) && (rowdata.f_added == 5))) { // Kegs |
738 ((dataRecord.inventory_reduced <= 6) && (rowdata.f_added == 4)) || // Bottle |
739 if (value < rowdata.f_amount) |
739 ((dataRecord.inventory_reduced <= 6) && (rowdata.f_added == 5))) { // Kegs |
740 color = '#ff4040'; |
740 if (value < rowdata.f_amount) |
741 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + |
741 color = '#ff4040'; |
742 color + ';">' +fermentableAdapter.formatNumber(value, "f3") + '</span>'; |
742 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + fermentableAdapter.formatNumber(value, 'f3') + '</span>'; |
743 } else { |
743 } else { |
744 return '<span></span>'; |
744 return '<span></span>'; |
745 } |
745 } |
746 } |
746 } |
747 }, |
747 }, |
748 { text: 'Procent', datafield: 'f_percentage', width: 90, align: 'right', |
748 { text: 'Procent', datafield: 'f_percentage', width: 90, align: 'right', |
749 cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties, rowdata) { |
749 cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) { |
750 if (rowdata.f_added >= 4) |
750 if (rowdata.f_added >= 4) |
751 return '<span></span>'; |
751 return '<span></span>'; |
752 var color = '#ffffff'; |
752 var color = '#ffffff'; |
753 if (value > rowdata.f_max_in_batch) |
753 if (value > rowdata.f_max_in_batch) |
754 color = '#ff4040'; |
754 color = '#ff4040'; |
755 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + |
755 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + fermentableAdapter.formatNumber(value, 'p1') + '</span>'; |
756 color + ';">' +fermentableAdapter.formatNumber(value, "p1") + '</span>'; |
756 } |
757 } |
757 }, |
758 }, |
758 { text: '100%', datafield: 'f_adjust_to_total_100', width: 70, align: 'center', cellsalign: 'center', |
759 { text: '100%', datafield: 'f_adjust_to_total_100', width: 70, align: 'center', cellsalign: 'center', |
759 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
760 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
760 if (value == 0) |
761 if (value == 0) |
761 return '<span></span>'; |
762 return '<span></span>'; |
762 return '<span><img style="float:left; margin-left:25px; margin-top:4px;" src="images/dialog-ok-apply.png"></span>'; |
763 return '<span><img style="float:left; margin-left:25px; margin-top:4px;" src="images/dialog-ok-apply.png"></span>'; |
763 } |
764 } |
764 }, |
765 }, |
765 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', |
766 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { |
766 cellsrenderer: function() { |
767 return "Wijzig"; |
767 return 'Wijzig'; |
768 }, buttonclick: function (row) { |
768 }, buttonclick: function(row) { |
769 fermentableRow = row; |
769 fermentableRow = row; |
770 fermentableData = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow); |
770 fermentableData = $('#fermentableGrid').jqxGrid('getrowdata', fermentableRow); |
771 if (fermentableData.f_added >= 4) { |
771 if (fermentableData.f_added >= 4) { |
772 alert("Wijzig dit in de Verpakken tab"); |
772 alert('Wijzig dit in de Verpakken tab'); |
773 } else if (dataRecord.stage > 3) { |
773 } else if (dataRecord.stage > 3) { |
774 alert("Ingredieënt is al verwerkt."); |
774 alert('Ingredieënt is al verwerkt.'); |
775 } else { |
775 } else { |
776 $("#wf_name").val(fermentableData.f_name); |
776 $('#wf_name').val(fermentableData.f_name); |
777 $("#wf_amount").val(fermentableData.f_amount); |
777 $('#wf_amount').val(fermentableData.f_amount); |
778 $("#wf_percentage").val(fermentableData.f_percentage); |
778 $('#wf_percentage').val(fermentableData.f_percentage); |
779 $("#wf_max_in_batch").val(fermentableData.f_max_in_batch); |
779 $('#wf_max_in_batch').val(fermentableData.f_max_in_batch); |
780 $("#wf_adjust_to_total_100").val(fermentableData.f_adjust_to_total_100); |
780 $('#wf_adjust_to_total_100').val(fermentableData.f_adjust_to_total_100); |
781 $("#wf_added").val(fermentableData.f_added); |
781 $('#wf_added').val(fermentableData.f_added); |
782 // show the popup window. |
782 // show the popup window. |
783 $("#popupFermentable").jqxWindow('open'); |
783 $('#popupFermentable').jqxWindow('open'); |
784 } |
784 } |
785 } |
785 } |
786 } |
786 } |
787 ] |
787 ] |
788 }); |
788 }); |
789 }, |
789 }, |
790 |
790 |
791 // Inline hops editor |
791 // Inline hops editor |
792 editHop = function (data) { |
792 editHop = function(data) { |
793 var hopSource = { |
793 var hopSource = { |
794 localdata: data.hops, |
794 localdata: data.hops, |
795 datatype: "local", |
795 datatype: 'local', |
796 cache: false, |
796 cache: false, |
797 async: false, |
797 async: false, |
798 datafields: [ |
798 datafields: [ |
799 { name: 'h_name', type: 'string' }, |
799 { name: 'h_name', type: 'string' }, |
800 { name: 'h_origin', type: 'string' }, |
800 { name: 'h_origin', type: 'string' }, |
801 { name: 'h_amount', type: 'float' }, |
801 { name: 'h_amount', type: 'float' }, |
802 { name: 'h_cost', type: 'float' }, |
802 { name: 'h_cost', type: 'float' }, |
803 { name: 'h_type', type: 'int' }, |
803 { name: 'h_type', type: 'int' }, |
804 { name: 'h_form', type: 'int' }, |
804 { name: 'h_form', type: 'int' }, |
805 { name: 'h_useat', type: 'int' }, |
805 { name: 'h_useat', type: 'int' }, |
806 { name: 'h_time', type: 'float' }, |
806 { name: 'h_time', type: 'float' }, |
807 { name: 'h_alpha', type: 'float' }, |
807 { name: 'h_alpha', type: 'float' }, |
808 { name: 'h_beta', type: 'float' }, |
808 { name: 'h_beta', type: 'float' }, |
809 { name: 'h_hsi', type: 'float' }, |
809 { name: 'h_hsi', type: 'float' }, |
810 { name: 'h_humulene', type: 'float' }, |
810 { name: 'h_humulene', type: 'float' }, |
811 { name: 'h_caryophyllene', type: 'float' }, |
811 { name: 'h_caryophyllene', type: 'float' }, |
812 { name: 'h_cohumulone', type: 'float' }, |
812 { name: 'h_cohumulone', type: 'float' }, |
813 { name: 'h_myrcene', type: 'float' }, |
813 { name: 'h_myrcene', type: 'float' }, |
814 { name: 'h_total_oil', type: 'float' }, |
814 { name: 'h_total_oil', type: 'float' }, |
815 { name: 'h_inventory', type: 'float' }, |
815 { name: 'h_inventory', type: 'float' }, |
816 { name: 'h_avail', type: 'int' } |
816 { name: 'h_avail', type: 'int' } |
817 ], |
817 ], |
818 addrow: function (rowid, rowdata, position, commit) { |
818 addrow: function(rowid, rowdata, position, commit) { |
819 console.log("hop addrow "+rowid); |
819 console.log('hop addrow ' + rowid); |
820 commit(true); |
820 commit(true); |
821 }, |
821 }, |
822 deleterow: function (rowid, commit) { |
822 deleterow: function(rowid, commit) { |
823 console.log("hop deleterow "+rowid); |
823 console.log('hop deleterow ' + rowid); |
824 commit(true); |
824 commit(true); |
825 }, |
825 }, |
826 updaterow: function (rowid, rowdata, commit) { |
826 updaterow: function(rowid, rowdata, commit) { |
827 console.log("hop updaterow "+rowid); |
827 console.log('hop updaterow ' + rowid); |
828 commit(true); |
828 commit(true); |
829 } |
829 } |
830 }, |
830 }, |
831 hopAdapter = new $.jqx.dataAdapter(hopSource); |
831 hopAdapter = new $.jqx.dataAdapter(hopSource); |
832 |
832 |
833 $("#hopGrid").jqxGrid({ |
833 $('#hopGrid').jqxGrid({ |
834 width: 1240, |
834 width: 1240, |
835 height: 560, |
835 height: 560, |
836 source: hopAdapter, |
836 source: hopAdapter, |
837 theme: theme, |
837 theme: theme, |
838 selectionmode: 'singlerow', |
838 selectionmode: 'singlerow', |
839 showtoolbar: true, |
839 showtoolbar: true, |
840 rendertoolbar: function (toolbar) { |
840 rendertoolbar: function(toolbar) { |
841 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
841 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
842 toolbar.append(container); |
842 toolbar.append(container); |
843 container.append('<div style="float: left; margin-left: 165px;" id="haddrowbutton"></div>'); |
843 container.append('<div style="float: left; margin-left: 165px;" id="haddrowbutton"></div>'); |
844 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
844 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
845 container.append('<div style="float: left; margin-left: 10px;" id="hinstockbutton"></div>'); |
845 container.append('<div style="float: left; margin-left: 10px;" id="hinstockbutton"></div>'); |
846 container.append('<input style="float: left; margin-left: 400px;" id="hdeleterowbutton" type="button" value="Verwijder hop" />'); |
846 container.append('<input style="float: left; margin-left: 400px;" id="hdeleterowbutton" type="button" value="Verwijder hop" />'); |
847 // add hop from dropdownlist. |
847 // add hop from dropdownlist. |
848 $("#haddrowbutton").jqxDropDownList({ |
848 $('#haddrowbutton').jqxDropDownList({ |
849 placeHolder: "Kies hop:", |
849 placeHolder: 'Kies hop:', |
850 theme: theme, |
850 theme: theme, |
851 template: "primary", |
851 template: 'primary', |
852 source: hoplist, |
852 source: hoplist, |
853 disabled: (dataRecord.stage > 3), |
853 disabled: (dataRecord.stage > 3), |
854 displayMember: "name", |
854 displayMember: 'name', |
855 width: 150, |
855 width: 150, |
856 height: 27, |
856 height: 27, |
857 dropDownWidth: 500, |
857 dropDownWidth: 500, |
858 dropDownHeight: 500, |
858 dropDownHeight: 500, |
859 renderer: function (index, label, value) { |
859 renderer: function(index, label, value) { |
860 var datarecord = hoplist.records[index]; |
860 var datarecord = hoplist.records[index]; |
861 return datarecord.origin+ " - " + datarecord.name + " / " + HopFormData[datarecord.form].nl + |
861 return datarecord.origin + ' - ' + datarecord.name + ' / ' + HopFormData[datarecord.form].nl + ' (' + datarecord.alpha + '% α)'; |
862 " (" + datarecord.alpha + "% α)"; |
862 } |
863 } |
863 }); |
864 }); |
864 $('#haddrowbutton').on('select', function(event) { |
865 $("#haddrowbutton").on('select', function (event) { |
865 if (event.args) { |
866 if (event.args) { |
866 var datarecord, row = {}, index = event.args.index; |
867 var datarecord, row = {}, index = event.args.index; |
867 datarecord = hoplist.records[index]; |
868 datarecord = hoplist.records[index]; |
868 row['h_name'] = datarecord.name; |
869 row["h_name"] = datarecord.name; |
869 row['h_origin'] = datarecord.origin; |
870 row["h_origin"] = datarecord.origin; |
870 row['h_amount'] = 0; |
871 row["h_amount"] = 0; |
871 row['h_cost'] = datarecord.cost; |
872 row["h_cost"] = datarecord.cost; |
872 row['h_type'] = datarecord.type; |
873 row["h_type"] = datarecord.type; |
873 row['h_form'] = datarecord.form; |
874 row["h_form"] = datarecord.form; |
874 row['h_useat'] = 2; // Boil |
875 row["h_useat"] = 2; // Boil |
875 row['h_time'] = 0; |
876 row["h_time"] = 0; |
876 row['h_alpha'] = datarecord.alpha; |
877 row["h_alpha"] = datarecord.alpha; |
877 row['h_beta'] = datarecord.beta; |
878 row["h_beta"] = datarecord.beta; |
878 row['h_hsi'] = datarecord.hsi; |
879 row["h_hsi"] = datarecord.hsi; |
879 row['h_humulene'] = datarecord.humulene; |
880 row["h_humulene"] = datarecord.humulene; |
880 row['h_caryophyllene'] = datarecord.caryophyllene; |
881 row["h_caryophyllene"] = datarecord.caryophyllene; |
881 row['h_cohumulone'] = datarecord.cohumulone; |
882 row["h_cohumulone"] = datarecord.cohumulone; |
882 row['h_myrcene'] = datarecord.myrcene; |
883 row["h_myrcene"] = datarecord.myrcene; |
883 row['h_total_oil'] = datarecord.total_oil; |
884 row["h_total_oil"] = datarecord.total_oil; |
884 row['h_inventory'] = datarecord.inventory; |
885 row["h_inventory"] = datarecord.inventory; |
885 $('#hopGrid').jqxGrid('addrow', null, row); |
886 $("#hopGrid").jqxGrid('addrow', null, row); |
886 } |
887 } |
887 $('#haddrowbutton').jqxDropDownList('clearSelection'); |
888 $("#haddrowbutton").jqxDropDownList('clearSelection'); |
888 }); |
889 }); |
889 |
890 |
890 $('#hinstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); |
891 $("#hinstockbutton").jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); |
891 $('#hinstockbutton').on('change', function(event) { |
892 $("#hinstockbutton").on('change', function (event) { |
892 hopinstock = event.args.checked; |
893 hopinstock = event.args.checked; |
893 hoplist.dataBind(); |
894 hoplist.dataBind(); |
894 }); |
895 }); |
895 |
896 |
896 // delete selected hop. |
897 // delete selected hop. |
897 $('#hdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); |
898 $("#hdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); |
898 $('#hdeleterowbutton').on('click', function() { |
899 $("#hdeleterowbutton").on('click', function () { |
899 var rowscount, id, selectedrowindex = $('#hopGrid').jqxGrid('getselectedrowindex'); |
900 var rowscount, id, selectedrowindex = $("#hopGrid").jqxGrid('getselectedrowindex'); |
900 rowscount = $('#hopGrid').jqxGrid('getdatainformation').rowscount; |
901 rowscount = $("#hopGrid").jqxGrid('getdatainformation').rowscount; |
901 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
902 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
902 id = $('#hopGrid').jqxGrid('getrowid', selectedrowindex); |
903 id = $("#hopGrid").jqxGrid('getrowid', selectedrowindex); |
903 $('#hopGrid').jqxGrid('deleterow', id); |
904 $("#hopGrid").jqxGrid('deleterow', id); |
904 } |
905 } |
905 calcIBUs(); |
906 calcIBUs(); |
906 }); |
907 }); |
907 }, |
908 }, |
908 ready: function() { |
909 ready: function() { |
909 calcIBUs(); |
910 calcIBUs(); |
910 $('#jqxTabs').jqxTabs('next'); |
911 $('#jqxTabs').jqxTabs('next'); |
911 }, |
912 }, |
912 columns: [ |
913 columns: [ |
913 { text: 'Hop', datafield: 'h_name', |
914 { text: 'Hop', datafield: 'h_name', |
914 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
915 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
915 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + rowdata.h_origin + ' / ' + rowdata.h_name + '</span>'; |
916 return "<span style='margin: 3px; margin-top: 6px; float: left;'>" +rowdata.h_origin+" / "+rowdata.h_name+"</span>"; |
916 }, |
917 }, |
917 }, |
918 }, |
918 { text: 'Type', width: 90, datafield: 'h_type', |
919 { text: 'Type', width: 90, datafield: 'h_type', |
919 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
920 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
920 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopTypeData[value].nl + '</span>'; |
921 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopTypeData[value].nl + '</span>'; |
921 } |
922 } |
922 }, |
923 }, |
923 { text: 'Vorm', width: 90, datafield: 'h_form', |
924 { text: 'Vorm', width: 90, datafield: 'h_form', |
924 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
925 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
925 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopFormData[value].nl + '</span>'; |
926 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopFormData[value].nl + '</span>'; |
926 } |
927 } |
927 }, |
928 }, |
928 { text: 'Alpha', datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
929 { text: 'Alpha', datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
929 { text: 'Gebruik', width: 110, datafield: 'h_useat', |
930 { text: 'Gebruik', width: 110, datafield: 'h_useat', |
930 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
931 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
931 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopUseData[value].nl + '</span>'; |
932 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopUseData[value].nl + '</span>'; |
932 } |
933 } |
933 }, |
934 }, |
934 { text: 'Tijdsduur', datafield: 'h_time', width: 90, align: 'right', |
935 { text: 'Tijdsduur', datafield: 'h_time', width: 90, align: 'right', |
935 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
936 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
936 var duration = ''; |
937 var duration = ''; |
937 if ((rowdata.h_useat == 2) || (rowdata.h_useat == 4)) // Boil, Whirlpool |
938 if ((rowdata.h_useat == 2) || (rowdata.h_useat == 4)) // Boil, Whirlpool |
938 duration = dataAdapter.formatNumber(value, 'f0') + ' min.'; |
939 duration = dataAdapter.formatNumber(value, "f0")+" min."; |
939 else if (rowdata.h_useat == 5) // Dry hop |
940 else if (rowdata.h_useat == 5) // Dry hop |
940 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen'; |
941 duration = dataAdapter.formatNumber(value/1440, "f0")+" dagen"; |
941 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>'; |
942 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>'; |
942 } |
943 } |
943 }, |
944 }, |
944 { text: 'IBU', datafield: 'ibu', width: 80, align: 'right', |
945 { text: 'IBU', datafield: 'ibu', width: 80, align: 'right', |
945 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
946 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
946 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')), |
947 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat($("#batch_size").jqxNumberInput('decimal')), |
947 parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time), parseFloat(rowdata.h_alpha), $('#ibu_method').val()); |
948 parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time), |
948 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(ibu, 'f1') + '</span>'; |
949 parseFloat(rowdata.h_alpha), $("#ibu_method").val()); |
949 } |
950 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(ibu, "f1") + '</span>'; |
950 }, |
951 } |
951 { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right', |
952 }, |
952 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
953 { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right', |
953 var amount = dataAdapter.formatNumber(value, 'f1') + ' kg'; |
954 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
954 if (value < 1) |
955 var amount = dataAdapter.formatNumber(value, "f1") + ' kg'; |
955 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; |
956 if (value < 1) |
956 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>'; |
957 amount = dataAdapter.formatNumber(value * 1000, "f1") + ' gr'; |
957 } |
958 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>'; |
958 }, |
959 } |
959 { text: 'Voorraad', datafield: 'h_inventory', width: 110, align: 'right', |
960 }, |
960 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
961 { text: 'Voorraad', datafield: 'h_inventory', width: 110, align: 'right', |
961 if (((dataRecord.inventory_reduced <= 2) && (rowdata.h_useat <= 4)) || // Mash, FW, Boil, Aroma, Whirlpool |
962 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
962 ((dataRecord.inventory_reduced <= 6) && (rowdata.h_useat == 5))) { // Dry hop |
963 if (((dataRecord.inventory_reduced <= 2) && (rowdata.h_useat <= 4)) || // Mash, FW, Boil, Aroma, Whirlpool |
963 var amount, color = '#ffffff'; |
964 ((dataRecord.inventory_reduced <= 6) && (rowdata.h_useat == 5))) { // Dry hop |
964 if (value < rowdata.h_amount) |
965 var amount, color = '#ffffff'; |
965 color = '#ff4040'; |
966 if (value < rowdata.h_amount) |
966 amount = dataAdapter.formatNumber(value, 'f1') + ' kg'; |
967 color = '#ff4040'; |
967 if (value < 1) |
968 amount = dataAdapter.formatNumber(value, "f1") + ' kg'; |
968 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; |
969 if (value < 1) |
969 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>'; |
970 amount = dataAdapter.formatNumber(value * 1000, "f1") + ' gr'; |
970 } else { |
971 return '<span style="margin: 4px; margin-top: 6px; float: right; color: '+color+';">'+amount+'</span>'; |
971 return '<span></span>'; |
972 } else { |
972 } |
973 return '<span></span>'; |
973 } |
974 } |
974 }, |
975 } |
975 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', |
976 }, |
976 cellsrenderer: function() { |
977 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { |
977 return 'Wijzig'; |
978 return "Wijzig"; |
978 }, buttonclick: function(row) { |
979 }, buttonclick: function (row) { |
979 if (dataRecord.stage > 3) { |
980 if (dataRecord.stage > 3) { |
980 alert('Ingredieënt is al verwerkt.'); |
981 alert("Ingredieënt is al verwerkt."); |
981 } else { |
982 } else { |
982 console.log('edit button row ' + row); |
983 console.log("edit button row "+row); |
983 hopRow = row; |
984 hopRow = row; |
984 hopData = $('#hopGrid').jqxGrid('getrowdata', hopRow); |
985 hopData = $("#hopGrid").jqxGrid('getrowdata', hopRow); |
985 $('#wh_name').val(hopData.h_name); |
986 $("#wh_name").val(hopData.h_name); |
986 $('#wh_amount').val(hopData.h_amount * 1000); |
987 $("#wh_amount").val(hopData.h_amount * 1000); |
987 var ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')), |
988 var ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, |
988 parseFloat(hopData.h_amount), parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $('#ibu_method').val()); |
989 parseFloat($("#batch_size").jqxNumberInput('decimal')), |
989 $('#wh_ibu').val(ibu); |
990 parseFloat(hopData.h_amount), parseFloat(hopData.h_time), |
990 if (hopData.h_useat == 5) // Dry hop |
991 parseFloat(hopData.h_alpha), $("#ibu_method").val() |
991 $('#wh_time').val(hopData.h_time / 1440); |
992 ); |
992 else |
993 $("#wh_ibu").val(ibu); |
993 $('#wh_time').val(hopData.h_time); |
994 if (hopData.h_useat == 5) // Dry hop |
994 $('#wh_useat').val(hopData.h_useat); |
995 $("#wh_time").val(hopData.h_time / 1440); |
995 // show the popup window. |
996 else |
996 $('#popupHop').jqxWindow('open'); |
997 $("#wh_time").val(hopData.h_time); |
997 } |
998 $("#wh_useat").val(hopData.h_useat); |
998 } |
999 // show the popup window. |
999 } |
1000 $("#popupHop").jqxWindow('open'); |
1000 ] |
1001 } |
1001 }); |
1002 } |
1002 }, |
1003 } |
1003 |
1004 ] |
1004 // Inline miscs editor |
1005 }); |
1005 editMisc = function(data) { |
1006 }, |
1006 var miscSource = { |
1007 |
1007 localdata: data.miscs, |
1008 // Inline miscs editor |
1008 datatype: 'local', |
1009 editMisc = function (data) { |
1009 cache: false, |
1010 var miscSource = { |
1010 async: false, |
1011 localdata: data.miscs, |
1011 datafields: [ |
1012 datatype: "local", |
1012 { name: 'm_name', type: 'string' }, |
1013 cache: false, |
1013 { name: 'm_amount', type: 'float' }, |
1014 async: false, |
1014 { name: 'm_cost', type: 'float' }, |
1015 datafields: [ |
1015 { name: 'm_type', type: 'int' }, |
1016 { name: 'm_name', type: 'string' }, |
1016 { name: 'm_use_use', type: 'int' }, |
1017 { name: 'm_amount', type: 'float' }, |
1017 { name: 'm_time', type: 'float' }, |
1018 { name: 'm_cost', type: 'float' }, |
1018 { name: 'm_amount_is_weight', type: 'int' }, |
1019 { name: 'm_type', type: 'int' }, |
1019 { name: 'm_inventory', type: 'float' }, |
1020 { name: 'm_use_use', type: 'int' }, |
1020 { name: 'm_avail', type: 'int' } |
1021 { name: 'm_time', type: 'float' }, |
1021 ], |
1022 { name: 'm_amount_is_weight', type: 'int' }, |
1022 addrow: function(rowid, rowdata, position, commit) { |
1023 { name: 'm_inventory', type: 'float' }, |
1023 console.log('misc addrow ' + rowid); |
1024 { name: 'm_avail', type: 'int' } |
1024 commit(true); |
1025 ], |
1025 }, |
1026 addrow: function (rowid, rowdata, position, commit) { |
1026 deleterow: function(rowid, commit) { |
1027 console.log("misc addrow "+rowid); |
1027 console.log('misc deleterow ' + rowid); |
1028 commit(true); |
1028 commit(true); |
1029 }, |
1029 }, |
1030 deleterow: function (rowid, commit) { |
1030 updaterow: function(rowid, rowdata, commit) { |
1031 console.log("misc deleterow "+rowid); |
1031 console.log('misc updaterow ' + rowid); |
1032 commit(true); |
1032 commit(true); |
1033 }, |
1033 } |
1034 updaterow: function (rowid, rowdata, commit) { |
1034 }, |
1035 console.log("misc updaterow "+rowid); |
1035 miscAdapter = new $.jqx.dataAdapter(miscSource, { |
1036 commit(true); |
1036 beforeLoadComplete: function(records) { |
1037 } |
1037 var row, i, data = new Array(); |
1038 }, |
1038 for (i = 0; i < records.length; i++) { |
1039 miscAdapter = new $.jqx.dataAdapter(miscSource, { |
1039 row = records[i]; |
1040 beforeLoadComplete: function (records) { |
1040 data.push(row); |
1041 var row, i, data = new Array(); |
1041 // Initial set water agent values. |
1042 for (i = 0; i < records.length; i++) { |
1042 switch (row.m_name) { |
1043 row = records[i]; |
1043 case 'CaCl2': |
1044 data.push(row); |
1044 $('#wa_cacl2').val(row.m_amount * 1000); |
1045 // Initial set water agent values. |
1045 break; |
1046 switch (row.m_name) { |
1046 case 'CaSO4': |
1047 case 'CaCl2': $("#wa_cacl2").val(row.m_amount * 1000); |
1047 $('#wa_caso4').val(row.m_amount * 1000); |
1048 break; |
1048 break; |
1049 case 'CaSO4': $("#wa_caso4").val(row.m_amount * 1000); |
1049 case 'MgSO4': |
1050 break; |
1050 $('#wa_mgso4').val(row.m_amount * 1000); |
1051 case 'MgSO4': $("#wa_mgso4").val(row.m_amount * 1000); |
1051 break; |
1052 break; |
1052 case 'NaCl': |
1053 case 'NaCl': $("#wa_nacl").val(row.m_amount * 1000); |
1053 $('#wa_nacl').val(row.m_amount * 1000); |
1054 break; |
1054 break; |
1055 case 'Melkzuur': $("#wa_acid_name").val(0); |
1055 case 'Melkzuur': |
1056 $("#wa_acid").val(row.m_amount * 1000); |
1056 $('#wa_acid_name').val(0); |
1057 $("#wa_acid_perc").val(80); |
1057 $('#wa_acid').val(row.m_amount * 1000); |
1058 last_acid = 'Melkzuur'; |
1058 $('#wa_acid_perc').val(80); |
1059 break; |
1059 last_acid = 'Melkzuur'; |
1060 case 'Zoutzuur': $("#wa_acid_name").val(1); |
1060 break; |
1061 $("#wa_acid").val(row.m_amount * 1000); |
1061 case 'Zoutzuur': |
1062 $("#wa_acid_perc").val(80); |
1062 $('#wa_acid_name').val(1); |
1063 last_acid = 'Zoutzuur'; |
1063 $('#wa_acid').val(row.m_amount * 1000); |
1064 break; |
1064 $('#wa_acid_perc').val(80); |
1065 case 'Fosforzuur': $("#wa_acid_name").val(2); |
1065 last_acid = 'Zoutzuur'; |
1066 $("#wa_acid").val(row.m_amount * 1000); |
1066 break; |
1067 $("#wa_acid_perc").val(80); |
1067 case 'Fosforzuur': |
1068 last_acid = 'Fosforzuur'; |
1068 $('#wa_acid_name').val(2); |
1069 break; |
1069 $('#wa_acid').val(row.m_amount * 1000); |
1070 case 'Zwavelzuur': $("#wa_acid_name").val(3); |
1070 $('#wa_acid_perc').val(80); |
1071 $("#wa_acid").val(row.m_amount * 1000); |
1071 last_acid = 'Fosforzuur'; |
1072 $("#wa_acid_perc").val(80); |
1072 break; |
1073 last_acid = 'Zwavelzuur'; |
1073 case 'Zwavelzuur': |
1074 break; |
1074 $('#wa_acid_name').val(3); |
1075 case 'NaHCO3': $("#wa_base_name").val(0); |
1075 $('#wa_acid').val(row.m_amount * 1000); |
1076 $("#wa_base").val(row.m_amount * 1000); |
1076 $('#wa_acid_perc').val(80); |
1077 last_base = 'NaHCO3'; |
1077 last_acid = 'Zwavelzuur'; |
1078 break; |
1078 break; |
1079 case 'Na2CO3': $("#wa_base_name").val(1); |
1079 case 'NaHCO3': |
1080 $("#wa_base").val(row.m_amount * 1000); |
1080 $('#wa_base_name').val(0); |
1081 last_base = 'Na2CO3'; |
1081 $('#wa_base').val(row.m_amount * 1000); |
1082 break; |
1082 last_base = 'NaHCO3'; |
1083 case 'CaCO3': $("#wa_base_name").val(2); |
1083 break; |
1084 $("#wa_base").val(row.m_amount * 1000); |
1084 case 'Na2CO3': |
1085 last_base = 'CaCO3'; |
1085 $('#wa_base_name').val(1); |
1086 break; |
1086 $('#wa_base').val(row.m_amount * 1000); |
1087 case 'Ca(OH)2': $("#wa_base_name").val(3); |
1087 last_base = 'Na2CO3'; |
1088 $("#wa_base").val(row.m_amount * 1000); |
1088 break; |
1089 last_base = 'Ca(OH)2'; |
1089 case 'CaCO3': |
1090 break; |
1090 $('#wa_base_name').val(2); |
1091 } |
1091 $('#wa_base').val(row.m_amount * 1000); |
1092 } |
1092 last_base = 'CaCO3'; |
1093 return data; |
1093 break; |
1094 }, |
1094 case 'Ca(OH)2': |
1095 loadError: function(jqXHR, status, error) { |
1095 $('#wa_base_name').val(3); |
|
1096 $('#wa_base').val(row.m_amount * 1000); |
|
1097 last_base = 'Ca(OH)2'; |
|
1098 break; |
|
1099 } |
|
1100 } |
|
1101 return data; |
|
1102 }, |
|
1103 loadError: function(jqXHR, status, error) { |
1096 $('#err').text(status + ' ' + error); |
1104 $('#err').text(status + ' ' + error); |
1097 }, |
1105 }, |
1098 }); |
1106 }); |
1099 $("#miscGrid").jqxGrid({ |
1107 $('#miscGrid').jqxGrid({ |
1100 width: 1240, |
1108 width: 1240, |
1101 height: 575, |
1109 height: 575, |
1102 source: miscAdapter, |
1110 source: miscAdapter, |
1103 theme: theme, |
1111 theme: theme, |
1104 selectionmode: 'singlerow', |
1112 selectionmode: 'singlerow', |
1105 showtoolbar: true, |
1113 showtoolbar: true, |
1106 rendertoolbar: function (toolbar) { |
1114 rendertoolbar: function(toolbar) { |
1107 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
1115 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
1108 toolbar.append(container); |
1116 toolbar.append(container); |
1109 container.append('<div style="float: left; margin-left: 165px;" id="maddrowbutton"></div>'); |
1117 container.append('<div style="float: left; margin-left: 165px;" id="maddrowbutton"></div>'); |
1110 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
1118 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
1111 container.append('<div style="float: left; margin-left: 10px;" id="minstockbutton"></div>'); |
1119 container.append('<div style="float: left; margin-left: 10px;" id="minstockbutton"></div>'); |
1112 container.append('<input style="float: left; margin-left: 400px;" id="mdeleterowbutton" type="button" value="Verwijder ingredient" />'); |
1120 container.append('<input style="float: left; margin-left: 400px;" id="mdeleterowbutton" type="button" value="Verwijder ingredient" />'); |
1113 // add misc from dropdownlist. |
1121 // add misc from dropdownlist. |
1114 $("#maddrowbutton").jqxDropDownList({ |
1122 $('#maddrowbutton').jqxDropDownList({ |
1115 placeHolder: "Kies ingrediënt:", |
1123 placeHolder: 'Kies ingrediënt:', |
1116 theme: theme, |
1124 theme: theme, |
1117 template: "primary", |
1125 template: 'primary', |
1118 source: misclist, |
1126 source: misclist, |
1119 disabled: (dataRecord.stage > 3), |
1127 disabled: (dataRecord.stage > 3), |
1120 displayMember: "name", |
1128 displayMember: 'name', |
1121 width: 150, |
1129 width: 150, |
1122 height: 27, |
1130 height: 27, |
1123 dropDownWidth: 500, |
1131 dropDownWidth: 500, |
1124 dropDownHeight: 500 |
1132 dropDownHeight: 500 |
1125 }); |
1133 }); |
1126 $("#maddrowbutton").on('select', function (event) { |
1134 $('#maddrowbutton').on('select', function(event) { |
1127 if (event.args) { |
1135 if (event.args) { |
1128 var datarecord, row = {}, index = event.args.index; |
1136 var datarecord, row = {}, index = event.args.index; |
1129 datarecord = misclist.records[index]; |
1137 datarecord = misclist.records[index]; |
1130 row["m_name"] = datarecord.name; |
1138 row['m_name'] = datarecord.name; |
1131 row["m_amount"] = 0; |
1139 row['m_amount'] = 0; |
1132 row["m_cost"] = datarecord.cost; |
1140 row['m_cost'] = datarecord.cost; |
1133 row["m_type"] = datarecord.type; |
1141 row['m_type'] = datarecord.type; |
1134 row["m_use_use"] = datarecord.use_use; |
1142 row['m_use_use'] = datarecord.use_use; |
1135 row["m_time"] = 0; |
1143 row['m_time'] = 0; |
1136 row["m_amount_is_weight"] = datarecord.amount_is_weight; |
1144 row['m_amount_is_weight'] = datarecord.amount_is_weight; |
1137 row["m_inventory"] = datarecord.inventory; |
1145 row['m_inventory'] = datarecord.inventory; |
1138 $("#miscGrid").jqxGrid('addrow', null, row); |
1146 $('#miscGrid').jqxGrid('addrow', null, row); |
1139 } |
1147 } |
1140 }); |
1148 }); |
1141 $("#minstockbutton").jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); |
1149 $('#minstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); |
1142 $("#minstockbutton").on('change', function (event) { |
1150 $('#minstockbutton').on('change', function(event) { |
1143 miscinstock = event.args.checked; |
1151 miscinstock = event.args.checked; |
1144 misclist.dataBind(); |
1152 misclist.dataBind(); |
1145 }); |
1153 }); |
1146 // delete selected misc. |
1154 // delete selected misc. |
1147 $("#mdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); |
1155 $('#mdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); |
1148 $("#mdeleterowbutton").on('click', function () { |
1156 $('#mdeleterowbutton').on('click', function() { |
1149 var rowscount, type, id, selectedrowindex = $("#miscGrid").jqxGrid('getselectedrowindex'); |
1157 var rowscount, type, id, selectedrowindex = $('#miscGrid').jqxGrid('getselectedrowindex'); |
1150 rowscount = $("#miscGrid").jqxGrid('getdatainformation').rowscount; |
1158 rowscount = $('#miscGrid').jqxGrid('getdatainformation').rowscount; |
1151 type = $("#miscGrid").jqxGrid('getcellvalue', selectedrowindex, "m_type"); |
1159 type = $('#miscGrid').jqxGrid('getcellvalue', selectedrowindex, 'm_type'); |
1152 if (selectedrowindex >= 0 && selectedrowindex < rowscount && type != 4) { // Water agent |
1160 if (selectedrowindex >= 0 && selectedrowindex < rowscount && type != 4) { // Water agent |
1153 id = $("#miscGrid").jqxGrid('getrowid', selectedrowindex); |
1161 id = $('#miscGrid').jqxGrid('getrowid', selectedrowindex); |
1154 $("#miscGrid").jqxGrid('deleterow', id); |
1162 $('#miscGrid').jqxGrid('deleterow', id); |
1155 } |
1163 } |
1156 }); |
1164 }); |
1157 }, |
1165 }, |
1158 ready: function() { |
1166 ready: function() { |
1159 calcMiscs(); |
1167 calcMiscs(); |
1160 $('#jqxTabs').jqxTabs('next'); |
1168 $('#jqxTabs').jqxTabs('next'); |
1161 }, |
1169 }, |
1162 columns: [ |
1170 columns: [ |
1163 { text: 'Ingredient', datafield: 'm_name' }, |
1171 { text: 'Ingredient', datafield: 'm_name' }, |
1164 { text: 'Type', width: 140, datafield: 'm_type', |
1172 { text: 'Type', width: 140, datafield: 'm_type', |
1165 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
1173 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1166 return "<span style='margin: 3px; margin-top: 6px; float: left;'>" + MiscTypeData[value].nl + "</span>"; |
1174 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + MiscTypeData[value].nl + '</span>'; |
1167 } |
1175 } |
1168 }, |
1176 }, |
1169 { text: 'Gebruik', width: 140, datafield: 'm_use_use', |
1177 { text: 'Gebruik', width: 140, datafield: 'm_use_use', |
1170 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
1178 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1171 return "<span style='margin: 3px; margin-top: 6px; float: left;'>" + MiscUseData[value].nl + "</span>"; |
1179 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + MiscUseData[value].nl + '</span>'; |
1172 } |
1180 } |
1173 }, |
1181 }, |
1174 { text: 'Tijd', datafield: 'm_time', width: 90, align: 'right', |
1182 { text: 'Tijd', datafield: 'm_time', width: 90, align: 'right', |
1175 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
1183 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1176 var duration = ''; |
1184 var duration = ''; |
1177 if (rowdata.m_use_use == 2) // Boil |
1185 if (rowdata.m_use_use == 2) // Boil |
1178 duration = dataAdapter.formatNumber(value, "f0")+" min."; |
1186 duration = dataAdapter.formatNumber(value, 'f0') + ' min.'; |
1179 else if ((rowdata.m_use_use == 3) || (rowdata.m_use_use == 4)) // Primary or Secondary |
1187 else if ((rowdata.m_use_use == 3) || (rowdata.m_use_use == 4)) // Primary or Secondary |
1180 duration = dataAdapter.formatNumber(value/1440, "f0")+" dagen"; |
1188 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen'; |
1181 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>'; |
1189 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>'; |
1182 }, |
1190 } |
1183 }, |
1191 }, |
1184 { text: 'Hoeveel', datafield: 'm_amount', width: 110, align: 'right', |
1192 { text: 'Hoeveel', datafield: 'm_amount', width: 110, align: 'right', |
1185 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
1193 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1186 var vstr = rowdata.m_amount_is_weight ? "gr":"ml"; |
1194 var vstr = rowdata.m_amount_is_weight ? 'gr' : 'ml'; |
1187 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + |
1195 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr + '</span>'; |
1188 dataAdapter.formatNumber(value * 1000,"f2")+" "+vstr + '</span>'; |
1196 } |
1189 } |
1197 }, |
1190 }, |
1198 { text: 'Voorraad', datafield: 'm_inventory', width: 110, align: 'right', |
1191 { text: 'Voorraad', datafield: 'm_inventory', width: 110, align: 'right', |
1199 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1192 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
1200 var vstr, color, amount; |
1193 var vstr, color, amount; |
1201 if (((dataRecord.inventory_reduced <= 2) && (rowdata.m_use_use <= 2)) || // Starter, Mash, Boil |
1194 if (((dataRecord.inventory_reduced <= 2) && (rowdata.m_use_use <= 2)) || // Starter, Mash, Boil |
1202 ((dataRecord.inventory_reduced <= 3) && (rowdata.m_use_use == 3)) || // Primary |
1195 ((dataRecord.inventory_reduced <= 3) && (rowdata.m_use_use == 3)) || // Primary |
1203 ((dataRecord.inventory_reduced <= 5) && (rowdata.m_use_use == 4)) || // Secondary, Teriary |
1196 ((dataRecord.inventory_reduced <= 5) && (rowdata.m_use_use == 4)) || // Secondary, Teriary |
1204 ((dataRecord.inventory_reduced <= 6) && (rowdata.m_use_use == 5))) { // Bottle |
1197 ((dataRecord.inventory_reduced <= 6) && (rowdata.m_use_use == 5))) { // Bottle |
1205 vstr = rowdata.m_amount_is_weight ? 'gr' : 'ml'; |
1198 vstr = rowdata.m_amount_is_weight ? "gr":"ml"; |
1206 color = '#ffffff'; |
1199 color = '#ffffff'; |
1207 if (value < rowdata.m_amount) |
1200 if (value < rowdata.m_amount) |
1208 color = '#ff4040'; |
1201 color = '#ff4040'; |
1209 amount = dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr; |
1202 amount = dataAdapter.formatNumber(value * 1000,"f2")+" "+vstr; |
1210 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>'; |
1203 return '<span style="margin: 4px; margin-top: 6px; float: right; color: '+color+';">'+amount+'</span>'; |
1211 } else { |
1204 } else { |
1212 return '<span></span>'; |
1205 return '<span></span>'; |
1213 } |
1206 } |
1214 } |
1207 } |
1215 }, |
1208 }, |
1216 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', |
1209 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { |
1217 cellsrenderer: function() { |
1210 return "Wijzig"; |
1218 return 'Wijzig'; |
1211 }, buttonclick: function (row) { |
1219 }, buttonclick: function(row) { |
1212 miscRow = row; |
1220 miscRow = row; |
1213 miscData = $("#miscGrid").jqxGrid('getrowdata', miscRow); |
1221 miscData = $('#miscGrid').jqxGrid('getrowdata', miscRow); |
1214 if (dataRecord.stage > 3) { |
1222 if (dataRecord.stage > 3) { |
1215 alert("Ingredieënt is al verwerkt."); |
1223 alert('Ingredieënt is al verwerkt.'); |
1216 } else if (miscData.m_type == 4) { |
1224 } else if (miscData.m_type == 4) { |
1217 alert("Brouwzouten wijzigen in de water tab."); |
1225 alert('Brouwzouten wijzigen in de water tab.'); |
1218 } else { |
1226 } else { |
1219 console.log("edit button row "+row); |
1227 console.log('edit button row ' + row); |
1220 if (miscData.m_amount_is_weight) |
1228 if (miscData.m_amount_is_weight) |
1221 $("#wm_pmpt_amount").html("Gewicht gram:"); |
1229 $('#wm_pmpt_amount').html('Gewicht gram:'); |
1222 else |
1230 else |
1223 $("#wm_pmpt_amount").html("Volume ml:"); |
1231 $('#wm_pmpt_amount').html('Volume ml:'); |
1224 $("#wm_name").val(miscData.m_name); |
1232 $('#wm_name').val(miscData.m_name); |
1225 $("#wm_amount").val(miscData.m_amount * 1000); |
1233 $('#wm_amount').val(miscData.m_amount * 1000); |
1226 if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) // Primary or Secondary |
1234 if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) // Primary or Secondary |
1227 $("#wm_time").val(miscData.m_time / 1440); |
1235 $('#wm_time').val(miscData.m_time / 1440); |
1228 else |
1236 else |
1229 $("#wm_time").val(miscData.m_time); |
1237 $('#wm_time').val(miscData.m_time); |
1230 $("#wm_use_use").val(miscData.m_use_use); |
1238 $('#wm_use_use').val(miscData.m_use_use); |
1231 // show the popup window. |
1239 // show the popup window. |
1232 $("#popupMisc").jqxWindow('open'); |
1240 $('#popupMisc').jqxWindow('open'); |
1233 } |
1241 } |
1234 } |
1242 } |
1235 } |
1243 } |
1236 ] |
1244 ] |
1237 }); |
1245 }); |
1238 }, |
1246 }, |
1239 |
1247 |
1240 // Inline yeasts editor |
1248 // Inline yeasts editor |
1241 editYeast = function (data) { |
1249 editYeast = function(data) { |
1242 var yeastSource = { |
1250 var yeastSource = { |
1243 localdata: data.yeasts, |
1251 localdata: data.yeasts, |
1244 datatype: "local", |
1252 datatype: 'local', |
1245 cache: false, |
1253 cache: false, |
1246 async: false, |
1254 async: false, |
1247 datafields: [ |
1255 datafields: [ |
1248 { name: 'y_name', type: 'string' }, |
1256 { name: 'y_name', type: 'string' }, |
1249 { name: 'y_laboratory', type: 'string' }, |
1257 { name: 'y_laboratory', type: 'string' }, |
1250 { name: 'y_product_id', type: 'string' }, |
1258 { name: 'y_product_id', type: 'string' }, |
1251 { name: 'y_amount', type: 'float' }, |
1259 { name: 'y_amount', type: 'float' }, |
1252 { name: 'y_cost', type: 'float' }, |
1260 { name: 'y_cost', type: 'float' }, |
1253 { name: 'y_type', type: 'int' }, |
1261 { name: 'y_type', type: 'int' }, |
1254 { name: 'y_form', type: 'int' }, |
1262 { name: 'y_form', type: 'int' }, |
1255 { name: 'y_flocculation', type: 'int' }, |
1263 { name: 'y_flocculation', type: 'int' }, |
1256 { name: 'y_min_temperature', type: 'float' }, |
1264 { name: 'y_min_temperature', type: 'float' }, |
1257 { name: 'y_max_temperature', type: 'float' }, |
1265 { name: 'y_max_temperature', type: 'float' }, |
1258 { name: 'y_attenuation', type: 'float' }, |
1266 { name: 'y_attenuation', type: 'float' }, |
1259 { name: 'y_use', type: 'int' }, |
1267 { name: 'y_use', type: 'int' }, |
1260 { name: 'y_cells', type: 'float' }, |
1268 { name: 'y_cells', type: 'float' }, |
1261 { name: 'y_tolerance', type: 'float' }, |
1269 { name: 'y_tolerance', type: 'float' }, |
1262 { name: 'y_inventory', type: 'float' }, |
1270 { name: 'y_inventory', type: 'float' }, |
1263 { name: 'y_avail', type: 'int' } |
1271 { name: 'y_avail', type: 'int' } |
1264 ], |
1272 ], |
1265 addrow: function (rowid, rowdata, position, commit) { |
1273 addrow: function(rowid, rowdata, position, commit) { |
1266 console.log("yeast addrow "+rowid); |
1274 console.log('yeast addrow ' + rowid); |
1267 commit(true); |
1275 commit(true); |
1268 }, |
1276 }, |
1269 deleterow: function (rowid, commit) { |
1277 deleterow: function(rowid, commit) { |
1270 console.log("yeast deleterow "+rowid); |
1278 console.log('yeast deleterow ' + rowid); |
1271 commit(true); |
1279 commit(true); |
1272 }, |
1280 }, |
1273 updaterow: function (rowid, rowdata, commit) { |
1281 updaterow: function(rowid, rowdata, commit) { |
1274 console.log("yeast updaterow "+rowid); |
1282 console.log('yeast updaterow ' + rowid); |
1275 commit(true); |
1283 commit(true); |
1276 } |
1284 } |
1277 }, |
1285 }, |
1278 yeastAdapter = new $.jqx.dataAdapter(yeastSource); |
1286 yeastAdapter = new $.jqx.dataAdapter(yeastSource); |
1279 |
1287 |
1280 $("#yeastGrid").jqxGrid({ |
1288 $('#yeastGrid').jqxGrid({ |
1281 width: 1240, |
1289 width: 1240, |
1282 height: 350, |
1290 height: 350, |
1283 source: yeastAdapter, |
1291 source: yeastAdapter, |
1284 theme: theme, |
1292 theme: theme, |
1285 selectionmode: 'singlerow', |
1293 selectionmode: 'singlerow', |
1286 showtoolbar: true, |
1294 showtoolbar: true, |
1287 rendertoolbar: function (toolbar) { |
1295 rendertoolbar: function(toolbar) { |
1288 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
1296 var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); |
1289 toolbar.append(container); |
1297 toolbar.append(container); |
1290 container.append('<div style="float: left; margin-left: 165px;" id="yaddrowbutton"></div>'); |
1298 container.append('<div style="float: left; margin-left: 165px;" id="yaddrowbutton"></div>'); |
1291 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
1299 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
1292 container.append('<div style="float: left; margin-left: 10px;" id="yinstockbutton"></div>'); |
1300 container.append('<div style="float: left; margin-left: 10px;" id="yinstockbutton"></div>'); |
1293 container.append('<input style="float: left; margin-left: 400px;" id="ydeleterowbutton" type="button" value="Verwijder gist" />'); |
1301 container.append('<input style="float: left; margin-left: 400px;" id="ydeleterowbutton" type="button" value="Verwijder gist" />'); |
1294 // add yeast from dropdownlist. |
1302 // add yeast from dropdownlist. |
1295 $("#yaddrowbutton").jqxDropDownList({ |
1303 $('#yaddrowbutton').jqxDropDownList({ |
1296 placeHolder: "Kies gist:", |
1304 placeHolder: 'Kies gist:', |
1297 theme: theme, |
1305 theme: theme, |
1298 source: yeastlist, |
1306 source: yeastlist, |
1299 disabled: (dataRecord.stage > 3), |
1307 disabled: (dataRecord.stage > 3), |
1300 template: "primary", |
1308 template: 'primary', |
1301 displayMember: "name", |
1309 displayMember: 'name', |
1302 width: 150, |
1310 width: 150, |
1303 height: 27, |
1311 height: 27, |
1304 dropDownWidth: 500, |
1312 dropDownWidth: 500, |
1305 dropDownHeight: 500, |
1313 dropDownHeight: 500, |
1306 renderer: function (index, label, value) { |
1314 renderer: function(index, label, value) { |
1307 var datarecord = yeastlist.records[index]; |
1315 var datarecord = yeastlist.records[index]; |
1308 return datarecord.laboratory+" "+datarecord.product_id+" "+datarecord.name; |
1316 return datarecord.laboratory + ' ' + datarecord.product_id + ' ' + datarecord.name; |
1309 } |
1317 } |
1310 }); |
1318 }); |
1311 $("#yaddrowbutton").on('select', function (event) { |
1319 $('#yaddrowbutton').on('select', function(event) { |
1312 if (event.args) { |
1320 if (event.args) { |
1313 var datarecord, row = {}, index = event.args.index; |
1321 var datarecord, row = {}, index = event.args.index; |
1314 datarecord = yeastlist.records[index]; |
1322 datarecord = yeastlist.records[index]; |
1315 row["y_name"] = datarecord.name; |
1323 row['y_name'] = datarecord.name; |
1316 row["y_laboratory"] = datarecord.laboratory; |
1324 row['y_laboratory'] = datarecord.laboratory; |
1317 row["y_product_id"] = datarecord.product_id; |
1325 row['y_product_id'] = datarecord.product_id; |
1318 row["y_type"] = datarecord.type; |
1326 row['y_type'] = datarecord.type; |
1319 row["y_form"] = datarecord.form; |
1327 row['y_form'] = datarecord.form; |
1320 row["y_amount"] = 0; |
1328 row['y_amount'] = 0; |
1321 row["y_cost"] = datarecord.cost; |
1329 row['y_cost'] = datarecord.cost; |
1322 row["y_use"] = 0; |
1330 row['y_use'] = 0; |
1323 row["y_min_temperature"] = datarecord.min_temperature; |
1331 row['y_min_temperature'] = datarecord.min_temperature; |
1324 row["y_max_temperature"] = datarecord.max_temperature; |
1332 row['y_max_temperature'] = datarecord.max_temperature; |
1325 row["y_attenuation"] = datarecord.attenuation; |
1333 row['y_attenuation'] = datarecord.attenuation; |
1326 row["y_flocculation"] = datarecord.flocculation; |
1334 row['y_flocculation'] = datarecord.flocculation; |
1327 row["y_cells"] = datarecord.cells; |
1335 row['y_cells'] = datarecord.cells; |
1328 row["y_tolerance"] = datarecord.tolerance; |
1336 row['y_tolerance'] = datarecord.tolerance; |
1329 row["y_inventory"] = datarecord.inventory; |
1337 row['y_inventory'] = datarecord.inventory; |
1330 $("#yeastGrid").jqxGrid('addrow', null, row); |
1338 $('#yeastGrid').jqxGrid('addrow', null, row); |
1331 } |
1339 } |
1332 calcYeast(); |
1340 calcYeast(); |
1333 $("#yaddrowbutton").jqxDropDownList('clearSelection'); |
1341 $('#yaddrowbutton').jqxDropDownList('clearSelection'); |
1334 }); |
1342 }); |
1335 $("#yinstockbutton").jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); |
1343 $('#yinstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); |
1336 $("#yinstockbutton").on('change', function (event) { |
1344 $('#yinstockbutton').on('change', function(event) { |
1337 yeastinstock = event.args.checked; |
1345 yeastinstock = event.args.checked; |
1338 yeastlist.dataBind(); |
1346 yeastlist.dataBind(); |
1339 }); |
1347 }); |
1340 // delete selected yeast. |
1348 // delete selected yeast. |
1341 $("#ydeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); |
1349 $('#ydeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); |
1342 $("#ydeleterowbutton").on('click', function () { |
1350 $('#ydeleterowbutton').on('click', function() { |
1343 var id, rowscount, selectedrowindex = $("#yeastGrid").jqxGrid('getselectedrowindex'); |
1351 var id, rowscount, selectedrowindex = $('#yeastGrid').jqxGrid('getselectedrowindex'); |
1344 rowscount = $("#yeastGrid").jqxGrid('getdatainformation').rowscount; |
1352 rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount; |
1345 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
1353 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
1346 id = $("#yeastGrid").jqxGrid('getrowid', selectedrowindex); |
1354 id = $('#yeastGrid').jqxGrid('getrowid', selectedrowindex); |
1347 $("#yeastGrid").jqxGrid('deleterow', id); |
1355 $('#yeastGrid').jqxGrid('deleterow', id); |
1348 calcYeast(); |
1356 calcYeast(); |
1349 } |
1357 } |
1350 }); |
1358 }); |
1351 }, |
1359 }, |
1352 ready: function() { |
1360 ready: function() { |
1353 calcFermentables(); |
1361 calcFermentables(); |
1354 showStarter(); |
1362 showStarter(); |
1355 calcYeast(); |
1363 calcYeast(); |
1356 $('#jqxTabs').jqxTabs('next'); |
1364 $('#jqxTabs').jqxTabs('next'); |
1357 }, |
1365 }, |
1358 columns: [ |
1366 columns: [ |
1359 { text: 'Gist', datafield: 'y_name' }, |
1367 { text: 'Gist', datafield: 'y_name' }, |
1360 { text: 'Laboratorium', width: 150, datafield: 'y_laboratory' }, |
1368 { text: 'Laboratorium', width: 150, datafield: 'y_laboratory' }, |
1361 { text: 'Code', width: 90, datafield: 'y_product_id' }, |
1369 { text: 'Code', width: 90, datafield: 'y_product_id' }, |
1362 { text: 'Soort', width: 100, datafield: 'y_form', |
1370 { text: 'Soort', width: 100, datafield: 'y_form', |
1363 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
1371 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1364 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + YeastFormData[value].nl + '</span>'; |
1372 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + YeastFormData[value].nl + '</span>'; |
1365 } |
1373 } |
1366 }, |
1374 }, |
1367 { text: 'Min. °C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_min_temperature' }, |
1375 { text: 'Min. °C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_min_temperature' }, |
1368 { text: 'Max. °C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_max_temperature' }, |
1376 { text: 'Max. °C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_max_temperature' }, |
1369 { text: 'Tol. %', width: 60, align: 'right', cellsalign: 'right', datafield: 'y_tolerance', |
1377 { text: 'Tol. %', width: 60, align: 'right', cellsalign: 'right', datafield: 'y_tolerance', |
1370 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
1378 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1371 var amount = "", color = '#ffffff'; |
1379 var amount = '', color = '#ffffff'; |
1372 if (value > 0) { |
1380 if (value > 0) { |
1373 amount = dataAdapter.formatNumber(value, "f1"); |
1381 amount = dataAdapter.formatNumber(value, 'f1'); |
1374 if (dataRecord.est_abv > value) |
1382 if (dataRecord.est_abv > value) |
1375 color = '#ff4040'; |
1383 color = '#ff4040'; |
1376 } |
1384 } |
1377 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>'; |
1385 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>'; |
1378 } |
1386 } |
1379 }, |
1387 }, |
1380 { text: 'Attn. %', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_attenuation', cellsformat: 'f1' }, |
1388 { text: 'Attn. %', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_attenuation', cellsformat: 'f1' }, |
1381 { text: 'Voor', width: 120, datafield: 'y_use', |
1389 { text: 'Voor', width: 120, datafield: 'y_use', |
1382 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
1390 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1383 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + YeastUseData[value].nl + '</span>'; |
1391 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + YeastUseData[value].nl + '</span>'; |
1384 } |
1392 } |
1385 }, |
1393 }, |
1386 { text: 'Hoeveel', datafield: 'y_amount', width: 90, align: 'right', |
1394 { text: 'Hoeveel', datafield: 'y_amount', width: 90, align: 'right', |
1387 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
1395 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1388 var amount = dataAdapter.formatNumber(value*1000, "f0")+" ml"; |
1396 var amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml'; |
1389 if (rowdata.y_form == 0) // Liquid |
1397 if (rowdata.y_form == 0) // Liquid |
1390 amount = dataAdapter.formatNumber(value, "f0")+" pk"; |
1398 amount = dataAdapter.formatNumber(value, 'f0') + ' pk'; |
1391 else if (rowdata.y_form == 1) // Dry |
1399 else if (rowdata.y_form == 1) // Dry |
1392 amount = dataAdapter.formatNumber(value*1000, "f1")+" gr"; |
1400 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; |
1393 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>'; |
1401 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>'; |
1394 } |
1402 } |
1395 }, |
1403 }, |
1396 { text: 'Voorraad', datafield: 'y_inventory', width: 90, align: 'right', |
1404 { text: 'Voorraad', datafield: 'y_inventory', width: 90, align: 'right', |
1397 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
1405 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1398 var color, amount; |
1406 var color, amount; |
1399 if (((dataRecord.inventory_reduced <= 3) && (rowdata.y_use == 0)) || // Primary |
1407 if (((dataRecord.inventory_reduced <= 3) && (rowdata.y_use == 0)) || // Primary |
1400 ((dataRecord.inventory_reduced <= 4) && (rowdata.y_use == 1)) || // Secondary |
1408 ((dataRecord.inventory_reduced <= 4) && (rowdata.y_use == 1)) || // Secondary |
1401 ((dataRecord.inventory_reduced <= 5) && (rowdata.y_use == 2)) || // Tertiary |
1409 ((dataRecord.inventory_reduced <= 5) && (rowdata.y_use == 2)) || // Tertiary |
1402 ((dataRecord.inventory_reduced <= 6) && (rowdata.y_use == 3))) { // Bottle |
1410 ((dataRecord.inventory_reduced <= 6) && (rowdata.y_use == 3))) { // Bottle |
1403 color = '#ffffff'; |
1411 color = '#ffffff'; |
1404 if (value < rowdata.y_amount) |
1412 if (value < rowdata.y_amount) |
1405 color = '#ff4040'; |
1413 color = '#ff4040'; |
1406 amount = dataAdapter.formatNumber(value*1000, "f0")+" ml"; |
1414 amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml'; |
1407 if (rowdata.y_form == 0) // Liquid |
1415 if (rowdata.y_form == 0) // Liquid |
1408 amount = dataAdapter.formatNumber(value, "f0")+" pk"; |
1416 amount = dataAdapter.formatNumber(value, 'f0') + ' pk'; |
1409 else if (rowdata.y_form == 1) // Dry |
1417 else if (rowdata.y_form == 1) // Dry |
1410 amount = dataAdapter.formatNumber(value*1000, "f1")+" gr"; |
1418 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; |
1411 return '<span style="margin: 4px; margin-top: 6px; float: right; color: '+color+';">'+amount+'</span>'; |
1419 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>'; |
1412 } else { |
1420 } else { |
1413 return '<span></span>'; |
1421 return '<span></span>'; |
1414 } |
1422 } |
1415 } |
1423 } |
1416 }, |
1424 }, |
1417 { text: '', datafield: 'Edit', columntype: 'button', width: 90, align: 'center', cellsrenderer: function () { |
1425 { text: '', datafield: 'Edit', columntype: 'button', width: 90, align: 'center', |
1418 return "Wijzig"; |
1426 cellsrenderer: function() { |
1419 }, buttonclick: function (row) { |
1427 return 'Wijzig'; |
1420 if (dataRecord.stage > 3) { |
1428 }, buttonclick: function(row) { |
1421 alert("Ingredieënt is al verwerkt."); |
1429 if (dataRecord.stage > 3) { |
1422 } else { |
1430 alert('Ingredieënt is al verwerkt.'); |
1423 yeastRow = row; |
1431 } else { |
1424 yeastData = $("#yeastGrid").jqxGrid('getrowdata', yeastRow); |
1432 yeastRow = row; |
1425 if (yeastData.y_form == 0) { |
1433 yeastData = $('#yeastGrid').jqxGrid('getrowdata', yeastRow); |
1426 $("#wy_pmpt_amount").html("Pak(ken):"); |
1434 if (yeastData.y_form == 0) { |
1427 $("#wy_amount").val(yeastData.y_amount); |
1435 $('#wy_pmpt_amount').html('Pak(ken):'); |
1428 $("#wy_amount").jqxNumberInput({ decimalDigits: 0 }); |
1436 $('#wy_amount').val(yeastData.y_amount); |
1429 } else if (yeastData.y_form == 1) { |
1437 $('#wy_amount').jqxNumberInput({ decimalDigits: 0 }); |
1430 $("#wy_pmpt_amount").html("Gewicht gram:"); |
1438 } else if (yeastData.y_form == 1) { |
1431 $("#wy_amount").val(yeastData.y_amount * 1000); |
1439 $('#wy_pmpt_amount').html('Gewicht gram:'); |
1432 $("#wy_amount").jqxNumberInput({ decimalDigits: 1 }); |
1440 $('#wy_amount').val(yeastData.y_amount * 1000); |
1433 } else { |
1441 $('#wy_amount').jqxNumberInput({ decimalDigits: 1 }); |
1434 $("#wy_pmpt_amount").html("Volume ml:"); |
1442 } else { |
1435 $("#wy_amount").val(yeastData.y_amount * 1000); |
1443 $('#wy_pmpt_amount').html('Volume ml:'); |
1436 $("#wy_amount").jqxNumberInput({ decimalDigits: 0 }); |
1444 $('#wy_amount').val(yeastData.y_amount * 1000); |
1437 } |
1445 $('#wy_amount').jqxNumberInput({ decimalDigits: 0 }); |
1438 $("#wy_name").val(yeastData.y_name); |
1446 } |
1439 $("#wy_laboratory").val(yeastData.y_laboratory); |
1447 $('#wy_name').val(yeastData.y_name); |
1440 $("#wy_product_id").val(yeastData.y_product_id); |
1448 $('#wy_laboratory').val(yeastData.y_laboratory); |
1441 $("#wy_use").val(yeastData.y_use); |
1449 $('#wy_product_id').val(yeastData.y_product_id); |
1442 // show the popup window. |
1450 $('#wy_use').val(yeastData.y_use); |
1443 $("#popupYeast").jqxWindow('open'); |
1451 // show the popup window. |
1444 } |
1452 $('#popupYeast').jqxWindow('open'); |
1445 } |
1453 } |
1446 } |
1454 } |
1447 ] |
1455 } |
1448 }); |
1456 ] |
1449 }, |
1457 }); |
1450 // inline mash editor |
1458 }, |
1451 editMash = function (data) { |
1459 |
1452 var mashSource = { |
1460 // inline mash editor |
1453 localdata: data.mashs, |
1461 editMash = function(data) { |
1454 datatype: "local", |
1462 var mashSource = { |
1455 cache: false, |
1463 localdata: data.mashs, |
1456 async: false, |
1464 datatype: 'local', |
1457 datafields: [ |
1465 cache: false, |
1458 { name: 'step_name', type: 'string' }, |
1466 async: false, |
1459 { name: 'step_type', type: 'int' }, |
1467 datafields: [ |
1460 { name: 'step_infuse_amount', type: 'float' }, |
1468 { name: 'step_name', type: 'string' }, |
1461 { name: 'step_temp', type: 'float' }, |
1469 { name: 'step_type', type: 'int' }, |
1462 { name: 'step_time', type: 'float' }, |
1470 { name: 'step_infuse_amount', type: 'float' }, |
1463 { name: 'step_thickness', type: 'float' }, |
1471 { name: 'step_temp', type: 'float' }, |
1464 { name: 'ramp_time', type: 'float' }, |
1472 { name: 'step_time', type: 'float' }, |
1465 { name: 'end_temp', type: 'float' } |
1473 { name: 'step_thickness', type: 'float' }, |
1466 ], |
1474 { name: 'ramp_time', type: 'float' }, |
1467 addrow: function (rowid, rowdata, position, commit) { |
1475 { name: 'end_temp', type: 'float' } |
1468 commit(true); |
1476 ], |
1469 }, |
1477 addrow: function(rowid, rowdata, position, commit) { |
1470 deleterow: function (rowid, commit) { |
1478 console.log('mash addrow ' + rowid); |
1471 commit(true); |
1479 commit(true); |
1472 } |
1480 }, |
1473 }, |
1481 deleterow: function(rowid, commit) { |
1474 mashAdapter = new $.jqx.dataAdapter(mashSource, { |
1482 console.log('mash deleterow ' + rowid); |
1475 beforeLoadComplete: function (records) { |
1483 commit(true); |
1476 mash_infuse = 0; |
1484 } |
1477 var i, row, data = new Array(); |
1485 }, |
1478 for (i = 0; i < records.length; i++) { |
1486 mashAdapter = new $.jqx.dataAdapter(mashSource, { |
1479 row = records[i]; |
1487 beforeLoadComplete: function(records) { |
1480 if (row.step_type == 0) // Infusion |
1488 mash_infuse = 0; |
1481 mash_infuse += parseFloat(row.step_infuse_amount); |
1489 var i, row, data = new Array(); |
1482 row.step_thickness = 0; // Init this field. |
1490 for (i = 0; i < records.length; i++) { |
1483 data.push(row); |
1491 row = records[i]; |
1484 } |
1492 if (row.step_type == 0) // Infusion |
1485 }, |
1493 mash_infuse += parseFloat(row.step_infuse_amount); |
1486 }); |
1494 row.step_thickness = 0; // Init this field. |
1487 $("#mashGrid").jqxGrid({ |
1495 data.push(row); |
1488 width: 1240, |
1496 } |
1489 height: 400, |
1497 }, |
1490 source: mashAdapter, |
1498 }); |
1491 theme: theme, |
1499 $('#mashGrid').jqxGrid({ |
1492 selectionmode: 'singlerow', |
1500 width: 1240, |
1493 showtoolbar: true, |
1501 height: 400, |
1494 rendertoolbar: function (toolbar) { |
1502 source: mashAdapter, |
1495 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
1503 theme: theme, |
1496 toolbar.append(container); |
1504 selectionmode: 'singlerow', |
1497 container.append('<input style="float: left; margin-left: 165px;" id="saddrowbutton" type="button" value="Nieuwe stap" />'); |
1505 showtoolbar: true, |
1498 container.append('<input style="float: left; margin-left: 565px;" id="sdeleterowbutton" type="button" value="Verwijder stap" />'); |
1506 rendertoolbar: function(toolbar) { |
1499 $("#saddrowbutton").jqxButton({ template: "primary", theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); |
1507 var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); |
1500 $("#saddrowbutton").on('click', function () { |
1508 toolbar.append(container); |
1501 var row = {}, rowscount = $("#mashGrid").jqxGrid('getdatainformation').rowscount; |
1509 container.append('<input style="float: left; margin-left: 165px;" id="saddrowbutton" type="button" value="Nieuwe stap" />'); |
1502 row["step_name"] = "Stap " + (rowscount + 1); |
1510 container.append('<input style="float: left; margin-left: 565px;" id="sdeleterowbutton" type="button" value="Verwijder stap" />'); |
1503 if (rowscount > 0) { |
1511 $('#saddrowbutton').jqxButton({ template: 'primary', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); |
1504 row["step_type"] = 1; |
1512 $('#saddrowbutton').on('click', function() { |
1505 } else { |
1513 var row = {}, rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount; |
1506 row["step_type"] = 0; |
1514 row['step_name'] = 'Stap ' + (rowscount + 1); |
1507 row["step_infuse_amount"] = 15; |
1515 if (rowscount > 0) { |
1508 } |
1516 row['step_type'] = 1; |
1509 row["step_temp"] = 62.0; |
1517 } else { |
1510 row['step_time'] = 20.0; |
1518 row['step_type'] = 0; |
1511 row['step_thickness'] = 0; |
1519 row['step_infuse_amount'] = 15; |
1512 row['ramp_time'] = 1.0; |
1520 } |
1513 row['end_temp'] = 62.0; |
1521 row['step_temp'] = 62.0; |
1514 $("#mashGrid").jqxGrid('addrow', null, row); |
1522 row['step_time'] = 20.0; |
1515 }); |
1523 row['step_thickness'] = 0; |
1516 // delete selected step. |
1524 row['ramp_time'] = 1.0; |
1517 $("#sdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); |
1525 row['end_temp'] = 62.0; |
1518 $("#sdeleterowbutton").on('click', function () { |
1526 $('#mashGrid').jqxGrid('addrow', null, row); |
1519 var rowscount, id, selectedrowindex = $("#mashGrid").jqxGrid('getselectedrowindex'); |
1527 }); |
1520 rowscount = $("#mashGrid").jqxGrid('getdatainformation').rowscount; |
1528 // delete selected step. |
1521 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
1529 $('#sdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); |
1522 id = $("#mashGrid").jqxGrid('getrowid', selectedrowindex); |
1530 $('#sdeleterowbutton').on('click', function() { |
1523 $("#mashGrid").jqxGrid('deleterow', id); |
1531 var rowscount, id, selectedrowindex = $('#mashGrid').jqxGrid('getselectedrowindex'); |
1524 } |
1532 rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount; |
1525 }); |
1533 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
1526 }, |
1534 id = $('#mashGrid').jqxGrid('getrowid', selectedrowindex); |
1527 ready: function() { |
1535 $('#mashGrid').jqxGrid('deleterow', id); |
1528 calcInit(); |
1536 } |
1529 calcMash(); |
1537 }); |
1530 $('#jqxLoader').jqxLoader('close'); |
1538 }, |
1531 $('#jqxTabs').jqxTabs('first'); |
1539 ready: function() { |
1532 }, |
1540 calcInit(); |
1533 columns: [ |
1541 calcMash(); |
1534 { text: 'Stap naam', datafield: 'step_name' }, |
1542 $('#jqxLoader').jqxLoader('close'); |
1535 { text: 'Stap type', datafield: 'step_type', width: 175, |
1543 $('#jqxTabs').jqxTabs('first'); |
1536 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
1544 }, |
1537 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + MashStepTypeData[value].nl + '</span>'; |
1545 columns: [ |
1538 } |
1546 { text: 'Stap naam', datafield: 'step_name' }, |
1539 }, |
1547 { text: 'Stap type', datafield: 'step_type', width: 175, |
1540 { text: 'Start °C', datafield: 'step_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
1548 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
1541 { text: 'Eind °C', datafield: 'end_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
1549 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + MashStepTypeData[value].nl + '</span>'; |
1542 { text: 'Rust min.', datafield: 'step_time', width: 90, align: 'right', cellsalign: 'right' }, |
1550 } |
1543 { text: 'Stap min.', datafield: 'ramp_time', width: 90, align: 'right', cellsalign: 'right' }, |
1551 }, |
1544 { text: 'Infuse L.', datafield: 'step_infuse_amount', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
1552 { text: 'Start °C', datafield: 'step_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
1545 { text: 'L/Kg.', datafield: 'step_thickness', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f2' }, |
1553 { text: 'Eind °C', datafield: 'end_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
1546 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { |
1554 { text: 'Rust min.', datafield: 'step_time', width: 90, align: 'right', cellsalign: 'right' }, |
1547 return "Wijzig"; |
1555 { text: 'Stap min.', datafield: 'ramp_time', width: 90, align: 'right', cellsalign: 'right' }, |
1548 }, buttonclick: function (row) { |
1556 { text: 'Infuse L.', datafield: 'step_infuse_amount', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
1549 if (dataRecord.stage > 3) { |
1557 { text: 'L/Kg.', datafield: 'step_thickness', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f2' }, |
1550 alert("Het maichen is al gedaan."); |
1558 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', |
1551 } else { |
1559 cellsrenderer: function() { |
1552 mashRow = row; |
1560 return 'Wijzig'; |
1553 mashData = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
1561 }, buttonclick: function(row) { |
1554 $("#wstep_name").val(mashData.step_name); |
1562 if (dataRecord.stage > 3) { |
1555 $("#wstep_type").val(mashData.step_type); |
1563 alert('Het maichen is al gedaan.'); |
1556 $("#wstep_infuse_amount").val(mashData.step_infuse_amount); |
1564 } else { |
1557 $("#wstep_temp").val(mashData.step_temp); |
1565 mashRow = row; |
1558 $("#wend_temp").val(mashData.end_temp); |
1566 mashData = $('#mashGrid').jqxGrid('getrowdata', mashRow); |
1559 $("#wstep_time").val(mashData.step_time); |
1567 $('#wstep_name').val(mashData.step_name); |
1560 $("#wramp_time").val(mashData.ramp_time); |
1568 $('#wstep_type').val(mashData.step_type); |
1561 if (mashData.step_type == 0) { |
1569 $('#wstep_infuse_amount').val(mashData.step_infuse_amount); |
1562 $("#wstep_infuse_amount").show(); |
1570 $('#wstep_temp').val(mashData.step_temp); |
1563 $("#wstep_pmpt").show(); |
1571 $('#wend_temp').val(mashData.end_temp); |
1564 } else { |
1572 $('#wstep_time').val(mashData.step_time); |
1565 $("#wstep_infuse_amount").hide(); |
1573 $('#wramp_time').val(mashData.ramp_time); |
1566 $("#wstep_pmpt").hide(); |
1574 if (mashData.step_type == 0) { |
1567 } |
1575 $('#wstep_infuse_amount').show(); |
1568 // show the popup window. |
1576 $('#wstep_pmpt').show(); |
1569 $("#popupMash").jqxWindow('open'); |
1577 } else { |
1570 } |
1578 $('#wstep_infuse_amount').hide(); |
1571 } |
1579 $('#wstep_pmpt').hide(); |
1572 } |
1580 } |
1573 ] |
1581 // show the popup window. |
1574 }); |
1582 $('#popupMash').jqxWindow('open'); |
1575 }; |
1583 } |
1576 |
1584 } |
1577 /* |
1585 } |
1578 * Remove the top menu so that we MUST use the buttons to leave the editor. |
1586 ] |
1579 */ |
1587 }); |
1580 $('#jqxMenu').jqxMenu('destroy'); |
1588 }; |
1581 console.log("record:" + my_record + " return:" + my_return + " theme:" + theme); |
1589 |
1582 $("#jqxLoader").jqxLoader({width:250,height:150,isModal:true,text:"Laden product ...",theme:theme}); |
1590 /* |
1583 // dataAdapter.dataBind(); |
1591 * Remove the top menu so that we MUST use the buttons to leave the editor. |
1584 |
1592 */ |
1585 /* |
1593 $('#jqxMenu').jqxMenu('destroy'); |
1586 * Generic functions |
1594 console.log('record:' + my_record + ' return:' + my_return + ' theme:' + theme); |
1587 */ |
1595 $('#jqxLoader').jqxLoader({ |
1588 function calcSupplies() { |
1596 width: 250, |
1589 if (dataRecord.inventory_reduced > 6) { |
1597 height: 150, |
1590 $("#ok_pmpt").hide(); |
1598 isModal: true, |
1591 return; |
1599 text: 'Laden product ...', |
1592 } |
1600 theme: theme |
1593 if (ok_fermentables && ok_hops && ok_miscs && ok_yeasts && ok_waters) |
1601 }); |
1594 $("#ok_supplies").html("<img src='images/dialog-ok-apply.png'>"); |
1602 |
1595 else |
1603 /* |
1596 $("#ok_supplies").html("<img src='images/dialog-error.png'>"); |
1604 * Generic functions |
1597 } |
1605 */ |
1598 |
1606 function calcSupplies() { |
1599 function calcPercentages() { |
1607 if (dataRecord.inventory_reduced > 6) { |
1600 |
1608 $('#ok_pmpt').hide(); |
1601 console.log("calcPercentages()"); |
1609 return; |
1602 var tw = 0, rowdata, percentage, rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
1610 } |
1603 if (rowscount > 1) { |
1611 if (ok_fermentables && ok_hops && ok_miscs && ok_yeasts && ok_waters) |
1604 for (i = 0; i < rowscount; i++) { |
1612 $('#ok_supplies').html("<img src='images/dialog-ok-apply.png'>"); |
1605 rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
1613 else |
1606 if (rowdata.f_added < 4) |
1614 $('#ok_supplies').html("<img src='images/dialog-error.png'>"); |
1607 tw += Round(rowdata.f_amount, 3); |
1615 } |
1608 }; |
1616 |
1609 tw = Round(tw, 3); |
1617 function calcPercentages() { |
1610 |
1618 |
1611 for (i = 0; i < rowscount; i++) { |
1619 console.log('calcPercentages()'); |
1612 rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
1620 var tw = 0, rowdata, percentage, rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount; |
1613 if (rowdata.f_added < 4) { |
1621 if (rowscount > 1) { |
1614 percentage = Round(rowdata.f_amount / tw * 100, 1); |
1622 for (i = 0; i < rowscount; i++) { |
1615 $("#fermentableGrid").jqxGrid('setcellvalue', i, "f_percentage", percentage); |
1623 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i); |
1616 } else { |
1624 if (rowdata.f_added < 4) |
1617 $("#fermentableGrid").jqxGrid('setcellvalue', i, "f_percentage", 0); |
1625 tw += Round(rowdata.f_amount, 3); |
1618 } |
1626 } |
1619 }; |
1627 tw = Round(tw, 3); |
1620 } else { |
1628 |
1621 $("#fermentableGrid").jqxGrid('setcellvalue', 0, "f_percentage", 100); |
1629 for (i = 0; i < rowscount; i++) { |
1622 } |
1630 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i); |
1623 } |
1631 if (rowdata.f_added < 4) { |
1624 |
1632 percentage = Round(rowdata.f_amount / tw * 100, 1); |
1625 /* |
1633 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', percentage); |
1626 * All calculations that depend on changes in the fermentables, |
1634 } else { |
1627 * volumes and equipments. |
1635 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', 0); |
1628 */ |
1636 } |
1629 function calcFermentables() { |
1637 } |
1630 |
1638 } else { |
1631 var sugarsf = 0, // fermentable sugars mash + boil |
1639 $('#fermentableGrid').jqxGrid('setcellvalue', 0, 'f_percentage', 100); |
1632 sugarsm = 0, // fermentable sugars in mash |
1640 } |
1633 vol = 0, // Volume sugars after boil |
1641 } |
1634 addedS = 0, // Added sugars after boil |
1642 |
1635 addedmass = 0, // Added mass after boil |
1643 /* |
1636 mvol = 0, // mash volume |
1644 * All calculations that depend on changes in the fermentables, |
1637 colort = 0, // Colors srm * vol totals |
1645 * volumes and equipments. |
1638 colorh = 0, // Colors ebc * vol * kt |
1646 */ |
1639 colorn = 0, // Colors ebc * pt * pct |
1647 function calcFermentables() { |
1640 my_100 = false, |
1648 |
1641 mashtime = 0, // Total mash time |
1649 var sugarsf = 0, // fermentable sugars mash + boil |
1642 mashtemp = 0, // Average mash temperature |
1650 sugarsm = 0, // fermentable sugars in mash |
1643 bv = 0.925, // Bierverlies rendement |
1651 vol = 0, // Volume sugars after boil |
1644 sr = 0.95, // Mash en spoel rendement |
1652 addedS = 0, // Added sugars after boil |
1645 lintner = 0, // Total recipe lintner |
1653 addedmass = 0, // Added mass after boil |
1646 i, row, rows, org, timem, aboil_volume, spoelw, ogx, topw, s = 0, d, v, x, |
1654 mvol = 0, // mash volume |
1647 sug, alc, pt, cw, color, scolor, fig; |
1655 colort = 0, // Colors srm * vol totals |
1648 |
1656 colorh = 0, // Colors ebc * vol * kt |
1649 /* Init global variables */ |
1657 colorn = 0, // Colors ebc * pt * pct |
1650 psugar = 0; |
1658 my_100 = false, |
1651 pcara = 0; |
1659 mashtime = 0, // Total mash time |
1652 mashkg = 0; |
1660 mashtemp = 0, // Average mash temperature |
1653 ok_fermentables = 1; // All is in stock. |
1661 bv = 0.925, // Bierverlies rendement |
1654 ok_yeasts = 1; |
1662 sr = 0.95, // Mash en spoel rendement |
1655 |
1663 lintner = 0, // Total recipe lintner |
1656 if ((rows = $('#mashGrid').jqxGrid('getrows'))){ |
1664 i, row, rows, org, timem, aboil_volume, spoelw, ogx, topw, s = 0, d, v, x, |
1657 for (i = 0; i <rows.length; i++){ |
1665 sug, alc, pt, cw, color, scolor, fig; |
1658 row=rows[i]; |
1666 |
1659 if(row.step_type==0) // Infusion |
1667 /* Init global variables */ |
1660 mvol+=parseFloat(row.step_infuse_amount); |
1668 psugar = 0; |
1661 if(row.step_temp<=75){ // Ignore mashout |
1669 pcara = 0; |
1662 timem=row.step_time+row.ramp_time; |
1670 mashkg = 0; |
1663 mashtime+=timem; |
1671 ok_fermentables = 1; // All is in stock. |
1664 mashtemp+=timem*row.step_temp; |
1672 ok_yeasts = 1; |
|
1673 |
|
1674 if ((rows = $('#mashGrid').jqxGrid('getrows'))) { |
|
1675 for (i = 0; i < rows.length; i++) { |
|
1676 row = rows[i]; |
|
1677 if (row.step_type == 0) // Infusion |
|
1678 mvol += parseFloat(row.step_infuse_amount); |
|
1679 if (row.step_temp <= 75) { // Ignore mashout |
|
1680 timem = row.step_time + row.ramp_time; |
|
1681 mashtime += timem; |
|
1682 mashtemp += timem * row.step_temp; |
|
1683 } |
|
1684 } |
|
1685 if (mashtime > 5) |
|
1686 mashtime -= 5; //Correct last ramp > 75 |
|
1687 mashtemp = Round(mashtemp / mashtime, 2); |
|
1688 } |
|
1689 |
|
1690 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) { |
|
1691 return; // grid not yet loaded. |
|
1692 } |
|
1693 |
|
1694 for (i = 0; i < rows.length; i++) { |
|
1695 row = rows[i]; |
|
1696 if (row.f_adjust_to_total_100) |
|
1697 my_100 = true; |
|
1698 if (row.f_type == 1 && row.f_added < 4) // Sugar |
|
1699 psugar += row.f_percentage; |
|
1700 if (row.f_graintype == 2 && row.f_added < 4) // Crystal |
|
1701 pcara += row.f_percentage; |
|
1702 d = row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100); |
|
1703 if (row.f_added == 0) { // Mash |
|
1704 if (mvol > 0) { // Only if mash already known. |
|
1705 mvol += row.f_amount * row.f_moisture / 100; |
|
1706 s += d; |
|
1707 } |
|
1708 d = parseFloat(dataRecord.efficiency) / 100 * d; |
|
1709 sugarsm += d; |
|
1710 mashkg += parseFloat(row.f_amount); |
|
1711 } |
|
1712 if (row.f_added == 0 || row.f_added == 1) // Mash or Boil |
|
1713 sugarsf += d; |
|
1714 if (row.f_added == 2 || row.f_added == 3) { // Fermentation or lagering |
|
1715 x = (row.f_yield / 100) * (1 - row.f_moisture / 100); |
|
1716 addedS += row.f_amount * x; |
|
1717 addedmass += row.f_amount; |
|
1718 vol += (x * sugardensity + (1 - x) * 1) * row.f_amount; |
|
1719 } |
|
1720 if (row.f_added < 4) { |
|
1721 colort += row.f_amount * ebc_to_srm(row.f_color); |
|
1722 colorh += row.f_amount * row.f_color * get_kt(row.f_color); |
|
1723 colorn += (row.f_percentage / 100) * row.f_color; // For 8.6 Pt wort. |
|
1724 } |
|
1725 if (fermentableInit) { |
|
1726 if (row.f_added == 4) { |
|
1727 $('#bottle_priming_total').val(row.f_amount * 1000); // Prevent clearing |
|
1728 $('#bottle_priming_sugar').jqxDropDownList('selectItem', row.f_name); |
|
1729 } |
|
1730 if (row.f_added == 5) { |
|
1731 $('#keg_priming_total').val(row.f_amount * 1000); |
|
1732 $('#keg_priming_sugar').jqxDropDownList('selectItem', row.f_name); |
|
1733 } |
|
1734 } |
|
1735 // Check supplies. |
|
1736 if ((((dataRecord.inventory_reduced <= 2) && (row.f_added <= 1)) || // Mash or boil |
|
1737 ((dataRecord.inventory_reduced <= 3) && (row.f_added == 2)) || // Primary |
|
1738 ((dataRecord.inventory_reduced <= 5) && (row.f_added == 3)) || // Secondary or Tertiary |
|
1739 ((dataRecord.inventory_reduced <= 6) && (row.f_added == 4)) || // Bottle |
|
1740 ((dataRecord.inventory_reduced <= 6) && (row.f_added == 5))) && row.f_inventory < row.f_amount) { |
|
1741 ok_fermentables = 0; |
|
1742 } |
|
1743 if (row.f_added == 0 && (row.f_type == 0 || row.f_type == 4) && row.f_color < 50) { // Mash and Grain/Adjunct and Color < 50 |
|
1744 lintner += row.f_diastatic_power * row.f_amount; |
|
1745 } |
|
1746 } |
|
1747 fermentableInit = 0; |
|
1748 $('#ferm_lintner').val(Math.round(parseFloat(lintner / mashkg))); |
|
1749 $('#mash_kg').val(mashkg); |
|
1750 console.log('calcFermentables() supplies:' + ok_fermentables + ' moutsuiker:' + sugarsm + '/' + sugarsf); |
|
1751 to_100 = my_100; |
|
1752 if (to_100) { |
|
1753 $('#wf_amount').jqxNumberInput({ width: 90, readOnly: true, spinButtons: false }); |
|
1754 } else { |
|
1755 $('#wf_amount').jqxNumberInput({ width: 110, readOnly: false, spinButtons: true }); |
|
1756 } |
|
1757 |
|
1758 if (mvol > 0) { |
|
1759 v = s / sugardensity + mvol; |
|
1760 s = 1000 * s / (v * 10); //deg. Plato |
|
1761 est_mash_sg = Round(plato_to_sg(s), 5); |
|
1762 $('#est_mash_sg').val(est_mash_sg); |
|
1763 } |
|
1764 |
|
1765 // Estimate total recipe OG. |
|
1766 dataRecord.est_og = estimate_sg(sugarsf + addedS, parseFloat(dataRecord.batch_size)); |
|
1767 $('#est_og').val(dataRecord.est_og); |
|
1768 $('#est_og2').val(dataRecord.est_og); |
|
1769 org = dataRecord.est_og; |
|
1770 |
|
1771 // Estimate SG in kettle after boil |
|
1772 aboil_sg = estimate_sg(sugarsf, parseFloat(dataRecord.batch_size)); |
|
1773 $('#est_og3').val(aboil_sg); |
|
1774 |
|
1775 // Estimate SG in kettle before boil |
|
1776 preboil_sg = estimate_sg(sugarsm, parseFloat(dataRecord.boil_size)); |
|
1777 $('#est_pre_sg').val(preboil_sg); |
|
1778 |
|
1779 // Recalculate volumes. |
|
1780 aboil_volume = parseFloat(dataRecord.batch_size); |
|
1781 if (dataRecord.brew_aboil_volume > 0) |
|
1782 aboil_volume = dataRecord.brew_aboil_volume / 1.04; // volume @ 20 degrees |
|
1783 if (dataRecord.brew_fermenter_tcloss == 0) { |
|
1784 dataRecord.brew_fermenter_tcloss = dataRecord.eq_trub_chiller_loss; |
|
1785 $('#brew_fermenter_tcloss').val(dataRecord.brew_fermenter_tcloss); |
|
1786 } |
|
1787 dataRecord.brew_fermenter_volume = aboil_volume - dataRecord.brew_fermenter_tcloss + dataRecord.brew_fermenter_extrawater; |
|
1788 $('#brew_fermenter_volume').val(dataRecord.brew_fermenter_volume); |
|
1789 // Estimated needed sparge water corrected for the temperature. |
|
1790 spoelw = (dataRecord.boil_size - mash_infuse + (mashkg * my_grain_absorbtion) + dataRecord.eq_lauter_deadspace) * 1.03; |
|
1791 $('#brew_sparge_est').val(spoelw); |
|
1792 // Calculate SG in fermenter |
|
1793 ogx = dataRecord.brew_aboil_sg; |
|
1794 if (ogx < 1.002) |
|
1795 ogx = aboil_sg; |
|
1796 topw = dataRecord.brew_fermenter_extrawater; |
|
1797 |
|
1798 if (dataRecord.brew_fermenter_volume > 0) { |
|
1799 sug = sg_to_plato(ogx) * dataRecord.brew_fermenter_volume * ogx / 100; //kg of sugar in |
|
1800 sug += addedS; //kg |
|
1801 |
|
1802 if ((dataRecord.brew_fermenter_volume * ogx + addedmass) > 0) { |
|
1803 pt = 100 * sug / (dataRecord.brew_fermenter_volume * ogx + addedmass + topw); |
|
1804 dataRecord.brew_fermenter_sg = Round(plato_to_sg(pt), 4); |
|
1805 $('#brew_fermenter_sg').val(dataRecord.brew_fermenter_sg); |
|
1806 // color |
|
1807 if (dataRecord.color_method == 4) { |
|
1808 dataRecord.brew_fermenter_color = Math.round(((pt / 8.6) * colorn) + (dataRecord.boil_time / 60)); |
|
1809 } else if (dataRecord.color_method == 3) { |
|
1810 dataRecord.brew_fermenter_color = Math.round((4.46 * bv * sr) / (aboil_volume + topw) * colorh); |
|
1811 } else { |
|
1812 cw = colort / (aboil_volume + topw) * 8.34436; |
|
1813 dataRecord.brew_fermenter_color = kw_to_ebc(dataRecord.color_method, cw); |
|
1814 } |
|
1815 $('#brew_fermenter_color').val(dataRecord.brew_fermenter_color); |
|
1816 scolor = ebc_to_color(dataRecord.brew_fermenter_color); |
|
1817 $('#bcolorf').show(); |
|
1818 document.getElementById('bcolorf').style.background = scolor; |
|
1819 } |
|
1820 } else { |
|
1821 // Negative volume |
|
1822 dataRecord.brew_fermenter_sg = dataRecord.brew_fermenter_color = 0; |
|
1823 $('#brew_fermenter_sg').val(0); |
|
1824 $('#brew_fermenter_color').val(0); |
|
1825 $('#bcolorf').hide(); |
|
1826 } |
|
1827 |
|
1828 // Color of the wort |
|
1829 if (dataRecord.color_method == 4) { |
|
1830 color = Math.round(((sg_to_plato(dataRecord.est_og) / 8.6) * colorn) + (dataRecord.boil_time / 60)); |
|
1831 } else if (dataRecord.color_method == 3) { // Hans Halberstadt |
|
1832 color = Math.round((4.46 * bv * sr) / parseFloat(dataRecord.batch_size) * colorh); |
|
1833 } else { |
|
1834 cw = colort / parseFloat(dataRecord.batch_size) * 8.34436; |
|
1835 color = kw_to_ebc(dataRecord.color_method, cw); |
|
1836 } |
|
1837 dataRecord.est_color = color; |
|
1838 $('#est_color').val(color); |
|
1839 $('#est_color2').val(color); |
|
1840 scolor = ebc_to_color(color); |
|
1841 document.getElementById('bcolor').style.background = scolor; |
|
1842 document.getElementById('bcolor2').style.background = scolor; |
|
1843 |
|
1844 // Progress bars |
|
1845 pmalts = mashkg / dataRecord.eq_mash_max * 100; |
|
1846 $('#perc_malts').jqxProgressBar('val', pmalts); |
|
1847 $('#perc_sugars').jqxProgressBar('val', psugar); |
|
1848 $('#perc_cara').jqxProgressBar('val', pcara); |
|
1849 calcStage(); |
|
1850 |
|
1851 // Calculate estimated svg. |
|
1852 svg = 0; // default. |
|
1853 initcells = 0; |
|
1854 rows = $('#yeastGrid').jqxGrid('getrows'); |
|
1855 for (i = 0; i < rows.length; i++) { |
|
1856 row = rows[i]; |
|
1857 if (row.y_use == 0) { // Primary |
|
1858 if (parseFloat(row.y_attenuation) > svg) |
|
1859 svg = parseFloat(row.y_attenuation); // Take the highest if multiple yeasts. |
|
1860 if (row.y_form == 0) |
|
1861 initcells += (parseFloat(row.y_cells) / 1000000000) * parseFloat(row.y_amount) * (dataRecord.starter_viability / 100); |
|
1862 else |
|
1863 initcells += (parseFloat(row.y_cells) / 1000000) * parseFloat(row.y_amount); |
|
1864 } |
|
1865 // TODO: brett in secondary ?? |
|
1866 if ((((dataRecord.inventory_reduced <= 3) && (row.y_use == 0)) || // Primary |
|
1867 ((dataRecord.inventory_reduced <= 4) && (row.y_use == 1)) || // Secondary |
|
1868 ((dataRecord.inventory_reduced <= 5) && (row.y_use == 2)) || // Tertiary |
|
1869 ((dataRecord.inventory_reduced <= 6) && (row.y_use == 3))) && // Bottle |
|
1870 (row.y_inventory < row.y_amount)) { |
|
1871 ok_yeasts = 0; |
|
1872 } |
|
1873 } |
|
1874 calcSupplies(); |
|
1875 if (svg == 0) |
|
1876 svg = 77; |
|
1877 |
|
1878 if ((mashkg > 0) && (mash_infuse > 0) && (mashtime > 0) && (mashtemp > 0)) { |
|
1879 dataRecord.est_fg = estimate_fg(psugar, pcara, mash_infuse / mashkg, mashtime, mashtemp, svg, dataRecord.est_og); |
|
1880 } else { |
|
1881 dataRecord.est_fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, dataRecord.est_og); |
|
1882 } |
|
1883 $('#est_fg').val(dataRecord.est_fg); |
|
1884 $('#est_fg2').val(dataRecord.est_fg); |
|
1885 $('#est_fg3').val(dataRecord.est_fg); |
|
1886 fig = dataRecord.est_fg; |
|
1887 |
|
1888 dataRecord.est_abv = abvol(dataRecord.est_og, dataRecord.est_fg); |
|
1889 $('#est_abv').val(dataRecord.est_abv); |
|
1890 $('#est_abv2').val(dataRecord.est_abv); |
|
1891 |
|
1892 // Calculate the final svg if available use the real value. |
|
1893 if ((dataRecord.stage >= 6) && (dataRecord.fg > 0.990) && (dataRecord.fg < dataRecord.brew_fermenter_sg)) { |
|
1894 svg = 100 * (dataRecord.brew_fermenter_sg - dataRecord.fg) / (dataRecord.brew_fermenter_sg - 1); |
|
1895 org = dataRecord.brew_fermenter_sg; |
|
1896 fig = dataRecord.fg; |
|
1897 } |
|
1898 |
|
1899 $('#yeast_cells').val(initcells); |
|
1900 $('#need_cells').val(getNeededYeastCells()); |
|
1901 |
|
1902 // Calculate the calories in kcal/l (from brouwhulp) |
|
1903 alc = 1881.22 * fig * (org - fig) / (1.775 - org); |
|
1904 sug = 3550 * fig * (0.1808 * org + 0.8192 * fig - 1.0004); |
|
1905 $('#kcal').val(Math.round((alc + sug) / (12 * 0.0295735296))); |
|
1906 }; |
|
1907 |
|
1908 function calcMash() { |
|
1909 |
|
1910 var infused = 0, i, row; |
|
1911 |
|
1912 if (!(rows = $('#mashGrid').jqxGrid('getrows'))) |
|
1913 return; |
|
1914 if (mashkg == 0) |
|
1915 return; |
|
1916 |
|
1917 for (i = 0; i < rows.length; i++) { |
|
1918 row = $('#mashGrid').jqxGrid('getrowdata', i); |
|
1919 if (row.step_type == 0) // Infusion |
|
1920 infused += row.step_infuse_amount; |
|
1921 $('#mashGrid').jqxGrid('setcellvalue', i, 'step_thickness', infused / mashkg); |
|
1922 } |
|
1923 } |
|
1924 |
|
1925 /* |
|
1926 * Change OG of recipe but keep the water volumes. |
|
1927 */ |
|
1928 function calcFermentablesFromOG(OG) { |
|
1929 |
|
1930 console.log('calcFermentablesFromOG(' + OG + ')'); |
|
1931 var amount, row, d, i, sug, tot = 0, totmass = 0, rowscount, efficiency = parseFloat($('#efficiency').jqxNumberInput('decimal')); |
|
1932 sug = sg_to_plato(OG) * parseFloat($('#batch_size').jqxNumberInput('decimal')) * OG / 100; //total amount of sugars in kg |
|
1933 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount; |
|
1934 |
|
1935 for (i = 0; i < rowscount; i++) { |
|
1936 row = $('#fermentableGrid').jqxGrid('getrowdata', i); |
|
1937 if (row.f_added < 4) { |
|
1938 d = row.f_percentage / 100 * (row.f_yield / 100) * (1 - row.f_moisture / 100); |
|
1939 if (row.f_added == 0) // Mash |
|
1940 d = efficiency / 100 * d; |
|
1941 tot += d; |
|
1942 } |
|
1943 } |
|
1944 if (tot) |
|
1945 totmass = Round(sug / tot, 3); |
|
1946 |
|
1947 if (totmass) { |
|
1948 for (i = 0; i < rowscount; i++) { |
|
1949 row = $('#fermentableGrid').jqxGrid('getrowdata', i); |
|
1950 if (row.f_added < 4) { |
|
1951 amount = Math.round(row.f_percentage * 10 * totmass) / 1000; |
|
1952 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', amount); |
|
1953 } |
|
1954 } |
|
1955 } |
|
1956 }; |
|
1957 |
|
1958 function getNeededYeastCells() { |
|
1959 |
|
1960 var plato, volume, sg = dataRecord.brew_fermenter_sg; |
|
1961 if (sg <= 1.0001 && dataRecord.fg > 1.000) |
|
1962 sg = dataRecord.fg; |
|
1963 else if (sg <= 1.0001) |
|
1964 sg = dataRecord.est_og; |
|
1965 plato = sg_to_plato(sg); |
|
1966 |
|
1967 volume = dataRecord.brew_fermenter_volume; |
|
1968 if (volume <= 0) |
|
1969 volume = dataRecord.batch_size - dataRecord.eq_trub_chiller_loss; |
|
1970 |
|
1971 return pitchrate * volume * plato; |
|
1972 } |
|
1973 |
|
1974 function hopFlavourContribution(bt, vol, use, amount) { |
|
1975 var result; |
|
1976 |
|
1977 if (use == 1) { // First wort |
|
1978 result = 0.15; // assume 15% flavourcontribution for fwh |
|
1979 } else if (bt > 50) { |
|
1980 result = 0.10; // assume 10% flavourcontribution as a minimum |
|
1981 } else { |
|
1982 result = 15.25 / (6 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 21) / 6, 2)); |
|
1983 if (result < 0.10) |
|
1984 result = 0.10; // assume 10% flavourcontribution as a minimum |
|
1985 } |
|
1986 return (result * amount * 1000) / vol; |
|
1987 } |
|
1988 |
|
1989 function hopAromaContribution(bt, vol, use, amount) { |
|
1990 var result = 0; |
|
1991 |
|
1992 if (use == 5) { // Dry hop |
|
1993 result = 1.33; |
|
1994 } else if (bt > 20) { |
|
1995 result = 0; |
|
1996 } else if (bt > 7.5) { |
|
1997 result = 10.03 / (4 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 7.5) / 4, 2)); |
|
1998 } else if (use == 2) { // Boil |
|
1999 result = 1; |
|
2000 } else if (use == 3) { // Aroma |
|
2001 result = 1.2; |
|
2002 } else if (use == 4) { // Whirlpool |
|
2003 result = 1.2; |
|
2004 } |
|
2005 return (result * amount * 1000) / vol; |
|
2006 } |
|
2007 |
|
2008 function calcIBUs() { |
|
2009 var total_ibus = 0, ferm_ibus = 0, rows = {}, i, row; |
|
2010 hop_aroma = hop_flavour = 0; |
|
2011 if (!(rows = $('#hopGrid').jqxGrid('getrows'))) { |
|
2012 return; |
|
2013 } |
|
2014 ok_hops = 1; |
|
2015 for (i = 0; i < rows.length; i++) { |
|
2016 row = rows[i]; |
|
2017 total_ibus += toIBU(row.h_useat, row.h_form, preboil_sg, parseFloat(dataRecord.batch_size), |
|
2018 parseFloat(row.h_amount), parseFloat(row.h_time), parseFloat(row.h_alpha), dataRecord.ibu_method); |
|
2019 ferm_ibus += toIBU(row.h_useat, row.h_form, preboil_sg, |
|
2020 parseFloat(dataRecord.brew_fermenter_volume) + parseFloat(dataRecord.brew_fermenter_tcloss), |
|
2021 parseFloat(row.h_amount), parseFloat(row.h_time), parseFloat(row.h_alpha), dataRecord.ibu_method); |
|
2022 hop_flavour += hopFlavourContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size), |
|
2023 row.h_useat, parseFloat(row.h_amount)); |
|
2024 hop_aroma += hopAromaContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size), |
|
2025 row.h_useat, parseFloat(row.h_amount)); |
|
2026 if ((((dataRecord.inventory_reduced <= 2) && (row.h_useat <= 4)) || // Mash, FW, Boil, Aroma, Whirlpool |
|
2027 ((dataRecord.inventory_reduced <= 6) && (row.h_useat == 5))) && // Dry-hop |
|
2028 (row.h_inventory < row.h_amount)) |
|
2029 ok_hops = 0; |
|
2030 } |
|
2031 total_ibus = Math.round(total_ibus * 10) / 10; |
|
2032 ferm_ibus = Math.round(ferm_ibus * 10) / 10; |
|
2033 hop_flavour = Math.round(hop_flavour * 1000 / 5) / 10; |
|
2034 hop_aroma = Math.round(hop_aroma * 1000 / 6) / 10; |
|
2035 if (hop_flavour > 100) |
|
2036 hop_flavour = 100; |
|
2037 if (hop_aroma > 100) |
|
2038 hop_aroma = 100; |
|
2039 console.log('calcIBUs(): ' + total_ibus + ' flavour: ' + hop_flavour + ' aroma: ' + hop_aroma + |
|
2040 ' fermenter:' + ferm_ibus + ' supplies:' + ok_hops); |
|
2041 dataRecord.est_ibu = total_ibus; |
|
2042 $('#est_ibu').val(total_ibus); |
|
2043 $('#est_ibu2').val(total_ibus); |
|
2044 $('#hop_flavour').jqxProgressBar('val', hop_flavour); |
|
2045 $('#hop_aroma').jqxProgressBar('val', hop_aroma); |
|
2046 $('#brew_fermenter_ibu').val(ferm_ibus); |
|
2047 calcStage(); |
|
2048 calcSupplies(); |
|
2049 }; |
|
2050 |
|
2051 /* |
|
2052 * http://braukaiser.com/blog/blog/2012/11/03/estimating-yeast-growth/ |
|
2053 * |
|
2054 * stype: 0=stirred, 1=shaken, 2=simple |
|
2055 * totcells: initial cells |
|
2056 * egrams: gram extract |
|
2057 */ |
|
2058 function getGrowthRate(stype, totcells, egrams) { |
|
2059 |
|
2060 /* Cells per grams extract (B/g) */ |
|
2061 var cpe = totcells / egrams; |
|
2062 |
|
2063 if (cpe > 3.5) |
|
2064 return 0; // no growth |
|
2065 if (stype == 2) |
|
2066 return 0.4; // simple starter |
|
2067 if (stype == 1) |
|
2068 return 0.62; // shaken starter |
|
2069 if (cpe <= 1.4) // stirred starter |
|
2070 return 1.4; |
|
2071 return 2.33 - (.67 * cpe); |
|
2072 }; |
|
2073 |
|
2074 function calcStep(svol, stype, start) { |
|
2075 |
|
2076 var gperpoint = 2.72715, //number of grams of extract per point of starter gravity per liter |
|
2077 prate = start / svol * 1000, |
|
2078 irate = Round(prate, 1), |
|
2079 egrams = (dataRecord.starter_sg - 1) * svol * gperpoint, |
|
2080 grate = getGrowthRate(stype, start, egrams), |
|
2081 ncells = Round(egrams * grate, 1), |
|
2082 totcells = parseFloat(ncells) + start; |
|
2083 |
|
2084 console.log('svol:' + svol + ' start:' + start + ' irate:' + irate + ' egrams:' + egrams + ' grate:' + grate + ' ncells:' + ncells); |
|
2085 return { |
|
2086 svol: svol, |
|
2087 irate: irate, |
|
2088 prate: Round(prate, 1), |
|
2089 ncells: ncells, |
|
2090 totcells: totcells, |
|
2091 growf: Round(ncells / start, 2) |
|
2092 }; |
|
2093 } |
|
2094 |
|
2095 /* |
|
2096 * Calculate all starter steps. |
|
2097 * stype: final starter type: 0 = stirred, 1 = shaked, 2 = simple. |
|
2098 * start: initial cells in billions |
|
2099 * needed: needed cells in billions |
|
2100 * |
|
2101 * result: all values updated. |
|
2102 */ |
|
2103 function calcSteps(stype, start, needed) { |
|
2104 |
|
2105 var uvols = [20, 40, 60, 80, 100, 150, 200, 250, 375, 500, 625, 750, 875, 1000, 1250, 1500, 2000, 2500, 3000, 4000, 5000], |
|
2106 mvols = uvols.length, svol = 0, lasti = 0, result = {}, i; |
|
2107 |
|
2108 /* |
|
2109 * If no values are set, auto calculate the starter. |
|
2110 */ |
|
2111 if ((parseFloat($('#prop1_volume').jqxNumberInput('decimal')) + parseFloat($('#prop2_volume').jqxNumberInput('decimal')) + |
|
2112 parseFloat($('#prop3_volume').jqxNumberInput('decimal')) + parseFloat($('#prop4_volume').jqxNumberInput('decimal'))) == 0) { |
|
2113 // clear by default |
|
2114 for (i = 1; i < 5; i++) { |
|
2115 $('#prop' + i + '_type').hide(); |
|
2116 $('#r' + i + '_pmpt').show(); |
|
2117 $('#prop' + i + '_type').val(stype); |
|
2118 $('#prop' + i + '_volume').hide(); |
|
2119 $('#prop' + i + '_volume').val(0); |
|
2120 $('#prop' + i + '_irate').hide(); |
|
2121 $('#prop' + i + '_ncells').hide(); |
|
2122 $('#prop' + i + '_tcells').hide(); |
|
2123 $('#prop' + i + '_growf').hide(); |
|
2124 } |
|
2125 if (start > needed) { |
|
2126 return; // no starter needed |
|
2127 } |
|
2128 $('#prop1_type').show(); |
|
2129 $('#r1_pmpt').hide(); |
|
2130 $('#prop1_volume').show(); |
|
2131 $('#prop1_irate').show(); |
|
2132 $('#prop1_ncells').show(); |
|
2133 $('#prop1_tcells').show(); |
|
2134 $('#prop1_growf').show(); |
|
2135 for (i = lasti; i <= mvols; i++) { |
|
2136 lasti = i; |
|
2137 svol = uvols[lasti]; |
|
2138 result = calcStep(svol, stype, start); |
|
2139 if (result.irate < 25) { |
|
2140 // inocculation rate too low, backup one step and break out. |
|
2141 lasti = i - 1; |
|
2142 svol = uvols[lasti]; |
|
2143 result = calcStep(svol, stype, start); |
|
2144 break; |
|
2145 } |
|
2146 if (result.totcells > needed || i == mvols) { // hit the target or loops done |
|
2147 break; |
|
2148 } |
|
2149 } |
|
2150 $('#prop1_volume').val(result.svol / 1000); // to liters |
|
2151 $('#prop1_irate').val(result.prate); |
|
2152 $('#prop1_ncells').val(result.ncells); |
|
2153 $('#prop1_tcells').val(result.totcells); |
|
2154 $('#prop1_growf').val(result.growf); |
|
2155 if (result.totcells > needed) |
|
2156 return; // hit the target |
|
2157 |
|
2158 // second stage |
|
2159 $('#r2_pmpt').hide(); |
|
2160 $('#prop2_type').val(stype); |
|
2161 $('#prop2_type').show(); |
|
2162 $('#prop2_volume').show(); |
|
2163 $('#prop2_irate').show(); |
|
2164 $('#prop2_ncells').show(); |
|
2165 $('#prop2_tcells').show(); |
|
2166 $('#prop2_growf').show(); |
|
2167 for (i = lasti; i <= mvols; i++) { |
|
2168 lasti = i; |
|
2169 svol = uvols[lasti]; |
|
2170 result = calcStep(svol, stype, $('#prop1_tcells').val()); |
|
2171 if (result.irate < 25) { |
|
2172 lasti = i - 1; |
|
2173 svol = uvols[lasti]; |
|
2174 result = calcStep(svol, stype, $('#prop1_tcells').val()); |
|
2175 break; |
|
2176 } |
|
2177 if (result.totcells > needed || i == mvols) { // hit the target or loops done |
|
2178 break; |
|
2179 } |
|
2180 } |
|
2181 $('#prop2_volume').val(result.svol / 1000); // to liters |
|
2182 $('#prop2_irate').val(result.prate); |
|
2183 $('#prop2_ncells').val(result.ncells); |
|
2184 $('#prop2_tcells').val(result.totcells); |
|
2185 $('#prop2_growf').val(result.growf); |
|
2186 if (result.totcells > needed) |
|
2187 return; // hit the target |
|
2188 |
|
2189 // third stage |
|
2190 $('#r3_pmpt').hide(); |
|
2191 $('#prop3_type').val(stype); |
|
2192 $('#prop3_type').show(); |
|
2193 $('#prop3_volume').show(); |
|
2194 $('#prop3_irate').show(); |
|
2195 $('#prop3_ncells').show(); |
|
2196 $('#prop3_tcells').show(); |
|
2197 $('#prop3_growf').show(); |
|
2198 for (i = lasti; i <= mvols; i++) { |
|
2199 lasti = i; |
|
2200 svol = uvols[lasti]; |
|
2201 result = calcStep(svol, stype, $('#prop2_tcells').val()); |
|
2202 if (result.irate < 25) { |
|
2203 lasti = i - 1; |
|
2204 svol = uvols[lasti]; |
|
2205 result = calcStep(svol, stype, $('#prop2_tcells').val()); |
|
2206 break; |
|
2207 } |
|
2208 if (result.totcells > needed || i == mvols) { // hit the target or loops done |
|
2209 break; |
|
2210 } |
|
2211 } |
|
2212 $('#prop3_volume').val(result.svol / 1000); // to liters |
|
2213 $('#prop3_irate').val(result.prate); |
|
2214 $('#prop3_ncells').val(result.ncells); |
|
2215 $('#prop3_tcells').val(result.totcells); |
|
2216 $('#prop3_growf').val(result.growf); |
|
2217 if (result.totcells > needed) |
|
2218 return; // hit the target |
|
2219 |
|
2220 // fourth stage |
|
2221 $('#r4_pmpt').hide(); |
|
2222 $('#prop4_type').val(stype); |
|
2223 $('#prop4_type').show(); |
|
2224 $('#prop4_volume').show(); |
|
2225 $('#prop4_irate').show(); |
|
2226 $('#prop4_ncells').show(); |
|
2227 $('#prop4_tcells').show(); |
|
2228 $('#prop4_growf').show(); |
|
2229 for (i = lasti; i <= mvols; i++) { |
|
2230 lasti = i; |
|
2231 svol = uvols[lasti]; |
|
2232 result = calcStep(svol, stype, $('#prop3_tcells').val()); |
|
2233 if (result.totcells > needed || i == mvols) { // hit the target or loops done |
|
2234 $('#prop4_volume').val(result.svol / 1000); // to liters |
|
2235 $('#prop4_irate').val(result.prate); |
|
2236 $('#prop4_ncells').val(result.ncells); |
|
2237 $('#prop4_tcells').val(result.totcells); |
|
2238 $('#prop4_growf').val(result.growf); |
|
2239 return; |
|
2240 } |
|
2241 } |
|
2242 } else { |
|
2243 // recalculate |
|
2244 if (dataRecord.prop1_volume > 0) { |
|
2245 $('#r1_pmpt').hide(); |
|
2246 $('#prop1_type').show(); |
|
2247 $('#prop1_volume').show(); |
|
2248 $('#prop1_irate').show(); |
|
2249 $('#prop1_ncells').show(); |
|
2250 $('#prop1_tcells').show(); |
|
2251 $('#prop1_growf').show(); |
|
2252 result = calcStep($('#prop1_volume').val() * 1000, dataRecord.prop1_type, start); |
|
2253 $('#prop1_irate').val(result.prate); |
|
2254 $('#prop1_ncells').val(result.ncells); |
|
2255 $('#prop1_tcells').val(result.totcells); |
|
2256 $('#prop1_growf').val(result.growf); |
|
2257 } |
|
2258 if (dataRecord.prop2_volume > 0) { |
|
2259 $('#r2_pmpt').hide(); |
|
2260 $('#prop2_type').show(); |
|
2261 $('#prop2_volume').show(); |
|
2262 $('#prop2_irate').show(); |
|
2263 $('#prop2_ncells').show(); |
|
2264 $('#prop2_tcells').show(); |
|
2265 $('#prop2_growf').show(); |
|
2266 result = calcStep($('#prop2_volume').val() * 1000, dataRecord.prop2_type, $('#prop1_tcells').val()); |
|
2267 $('#prop2_irate').val(result.prate); |
|
2268 $('#prop2_ncells').val(result.ncells); |
|
2269 $('#prop2_tcells').val(result.totcells); |
|
2270 $('#prop2_growf').val(result.growf); |
|
2271 } |
|
2272 if (dataRecord.prop3_volume > 0) { |
|
2273 $('#r3_pmpt').hide(); |
|
2274 $('#prop3_type').show(); |
|
2275 $('#prop3_volume').show(); |
|
2276 $('#prop3_irate').show(); |
|
2277 $('#prop3_ncells').show(); |
|
2278 $('#prop3_tcells').show(); |
|
2279 $('#prop3_growf').show(); |
|
2280 result = calcStep($('#prop3_volume').val() * 1000, dataRecord.prop3_type, $('#prop2_tcells').val()); |
|
2281 $('#prop3_irate').val(result.prate); |
|
2282 $('#prop3_ncells').val(result.ncells); |
|
2283 $('#prop3_tcells').val(result.totcells); |
|
2284 $('#prop3_growf').val(result.growf); |
|
2285 } |
|
2286 if (dataRecord.prop4_volume > 0) { |
|
2287 $('#r4_pmpt').hide(); |
|
2288 $('#prop4_type').show(); |
|
2289 $('#prop4_volume').show(); |
|
2290 $('#prop4_irate').show(); |
|
2291 $('#prop4_ncells').show(); |
|
2292 $('#prop4_tcells').show(); |
|
2293 $('#prop4_growf').show(); |
|
2294 result = calcStep($('#prop4_volume').val() * 1000, dataRecord.prop4_type, $('#prop3_tcells').val()); |
|
2295 $('#prop4_irate').val(result.prate); |
|
2296 $('#prop4_ncells').val(result.ncells); |
|
2297 $('#prop4_tcells').val(result.totcells); |
|
2298 $('#prop4_growf').val(result.growf); |
|
2299 } |
|
2300 } |
|
2301 } |
|
2302 |
|
2303 function calcYeast() { |
|
2304 |
|
2305 // Calculate needed cells. |
|
2306 var plato, volume, rows, rowscount, row, i, needed, use_cells, sg = dataRecord.brew_fermenter_sg; |
|
2307 if (sg <= 1.0001 && dataRecord.fg > 1.000) |
|
2308 sg = dataRecord.fg; |
|
2309 else if (sg <= 1.0001) |
|
2310 sg = dataRecord.est_og; |
|
2311 plato = sg_to_plato(sg); |
|
2312 |
|
2313 volume = dataRecord.brew_fermenter_volume; |
|
2314 if (volume > 0) { |
|
2315 if (dataRecord.brew_fermenter_extrawater > 0) |
|
2316 volume += dataRecord.brew_fermenter_extrawater; |
|
2317 } else { |
|
2318 volume = dataRecord.batch_size - dataRecord.eq_trub_chiller_loss; |
|
2319 } |
|
2320 |
|
2321 // Also in calcFermentables() |
|
2322 $('#yeast_cells').val(initcells); |
|
2323 |
|
2324 if (!(rows = $('#yeastGrid').jqxGrid('getrows'))) { |
|
2325 return; // grid not yet loaded. |
|
2326 } |
|
2327 rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount; |
|
2328 if (rowscount == 0) |
|
2329 return; // no yeast in recipe |
|
2330 |
|
2331 for (i = 0; i < rowscount; i++) { |
|
2332 row = $('#yeastGrid').jqxGrid('getrowdata', i); |
|
2333 if (row.y_use == 0) { // primary |
|
2334 // pitchrate see https://www.brewersfriend.com/yeast-pitch-rate-and-starter-calculator/ |
|
2335 // and http://braukaiser.com/blog/blog/2012/11/03/estimating-yeast-growth/ |
|
2336 pitchrate = 0.75; |
|
2337 if (dataRecord.est_og > 1.060) |
|
2338 pitchrate = 1.0; |
|
2339 // if (dataRecord.est_og > 1.076) |
|
2340 // pitchrate = 1.25; // Wyeast labs. http://www.wyeastlab.com/hb_pitchrates.cfm |
|
2341 if (row.y_type == 0) // lager yeast |
|
2342 pitchrate *= 2; |
|
2343 |
|
2344 // if (row.y_form == 1) { // dry yeast |
|
2345 // } else { // possible starter needed |
|
2346 // } |
|
2347 } |
|
2348 } |
|
2349 needed = pitchrate * volume * plato; |
|
2350 console.log('calcYeast() pitchrate:' + pitchrate + ' start:' + initcells + ' needed:' + needed + ' volume:' + volume); |
|
2351 $('#need_cells').val(needed); |
|
2352 use_cells = initcells; |
|
2353 |
|
2354 if (dataRecord.starter_enable) { |
|
2355 calcSteps(dataRecord.starter_type, initcells, needed); |
|
2356 |
|
2357 for (i = 1; i < 5; i++) { |
|
2358 $('#r' + i + '_irate').html(''); |
|
2359 $('#r' + i + '_growf').html(''); |
|
2360 $('#r' + i + '_tcells').html(''); |
|
2361 if (parseFloat($('#prop' + i + '_volume').val()) > 0) { |
|
2362 if ((parseFloat($('#prop' + i + '_irate').val()) < 25) || (parseFloat($('#prop' + i + '_irate').val()) > 100)) { |
|
2363 $('#r' + i + '_irate').html("<img src='images/dialog-error.png'>"); |
|
2364 } else { |
|
2365 $('#r' + i + '_irate').html("<img src='images/dialog-ok-apply.png'>"); |
|
2366 } |
|
2367 if (parseFloat($('#prop' + i + '_growf').val()) < 1) |
|
2368 $('#r' + i + '_growf').html("<img src='images/dialog-error.png'>"); |
|
2369 if (($('#prop' + i + '_type').val() > 0) && (parseFloat($('#prop' + i + '_growf').val()) > 3)) |
|
2370 $('#r' + i + '_growf').html("<img src='images/dialog-error.png'>"); |
|
2371 if (parseFloat($('#prop' + i + '_tcells').val()) > needed) |
|
2372 $('#r' + i + '_tcells').html("<img src='images/dialog-ok-apply.png'>"); |
|
2373 use_cells = parseFloat($('#prop' + i + '_tcells').val()); |
|
2374 } else { |
|
2375 $('#r' + i + '_irate').html(''); |
|
2376 } |
|
2377 } |
|
2378 } |
|
2379 $('#plato_cells').val(parseFloat(use_cells / (volume * plato))); |
|
2380 }; |
|
2381 |
|
2382 function adjustHops(factor) { |
|
2383 |
|
2384 console.log('adjustHops(' + factor + ')'); |
|
2385 var row, i, amount, rowscount = $('#hopGrid').jqxGrid('getdatainformation').rowscount; |
|
2386 if (rowscount == 0) |
|
2387 return; |
|
2388 for (i = 0; i < rowscount; i++) { |
|
2389 row = $('#hopGrid').jqxGrid('getrowdata', i); |
|
2390 amount = row.h_amount * factor; |
|
2391 $('#hopGrid').jqxGrid('setcellvalue', i, 'h_amount', amount); |
|
2392 } |
|
2393 }; |
|
2394 |
|
2395 function calcMiscs() { |
|
2396 |
|
2397 ok_miscs = 1; |
|
2398 var row, i, rowscount = $('#miscGrid').jqxGrid('getdatainformation').rowscount; |
|
2399 if (rowscount == 0) |
|
2400 return; |
|
2401 for (i = 0; i < rowscount; i++) { |
|
2402 row = $('#miscGrid').jqxGrid('getrowdata', i); |
|
2403 if ((((dataRecord.inventory_reduced <= 2) && (row.m_use_use <= 2)) || // Starter, Mash, Boil |
|
2404 ((dataRecord.inventory_reduced <= 3) && (row.m_use_use == 3)) || // Primary |
|
2405 ((dataRecord.inventory_reduced <= 5) && (row.m_use_use == 4)) || // Secondary, Teriary |
|
2406 ((dataRecord.inventory_reduced <= 6) && (row.m_use_use == 5))) && // Bottle |
|
2407 (row.m_inventory < row.m_amount)) { |
|
2408 ok_miscs = 0; |
|
2409 } |
|
2410 } |
|
2411 calcSupplies(); |
|
2412 }; |
|
2413 |
|
2414 function adjustMiscs(factor) { |
|
2415 |
|
2416 console.log('adjustMiscs(' + factor + ')'); |
|
2417 var row, i, amount, rowscount = $('#miscGrid').jqxGrid('getdatainformation').rowscount; |
|
2418 if (rowscount == 0) |
|
2419 return; |
|
2420 for (i = 0; i < rowscount; i++) { |
|
2421 row = $('#miscGrid').jqxGrid('getrowdata', i); |
|
2422 amount = row.m_amount * factor; |
|
2423 $('#miscGrid').jqxGrid('setcellvalue', i, 'm_amount', amount); |
|
2424 switch (row.m_name) { |
|
2425 case 'CaCl2': |
|
2426 $('#wa_cacl2').val(row.m_amount * 1000); |
|
2427 break; |
|
2428 case 'CaSO4': |
|
2429 $('#wa_caso4').val(row.m_amount * 1000); |
|
2430 break; |
|
2431 case 'MgSO4': |
|
2432 $('#wa_mgso4').val(row.m_amount * 1000); |
|
2433 break; |
|
2434 case 'NaCl': |
|
2435 $('#wa_nacl').val(row.m_amount * 1000); |
|
2436 break; |
|
2437 case 'Melkzuur': |
|
2438 case 'Zoutzuur': |
|
2439 case 'Fosforzuur': |
|
2440 case 'Zwavelzuur': |
|
2441 $('#wa_acid').val(row.m_amount * 1000); |
|
2442 break; |
|
2443 case 'NaHCO3': |
|
2444 case 'Na2CO3': |
|
2445 case 'CaCO3': |
|
2446 case 'Ca(OH)2': |
|
2447 $('#wa_base').val(row.m_amount * 1000); |
|
2448 break; |
|
2449 } |
|
2450 } |
|
2451 }; |
|
2452 |
|
2453 function adjustYeasts(factor) { |
|
2454 |
|
2455 console.log('adjustYeasts(' + factor + ')'); |
|
2456 var row, i, amount, rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount; |
|
2457 if (rowscount == 0) |
|
2458 return; |
|
2459 for (i = 0; i < rowscount; i++) { |
|
2460 row = $('#yeastGrid').jqxGrid('getrowdata', i); |
|
2461 if (row.y_form == 1) { // Only adjust dry yeast |
|
2462 amount = row.y_amount * factor; |
|
2463 $('#yeastGrid').jqxGrid('setcellvalue', i, 'y_amount', amount); |
|
2464 } |
|
2465 } |
|
2466 calcYeast(); |
|
2467 }; |
|
2468 |
|
2469 function adjustWaters(factor) { |
|
2470 |
|
2471 console.log('adjustWaters(' + factor + ')'); |
|
2472 var amount, row, i, rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount; |
|
2473 if (rowscount == 0) |
|
2474 return; |
|
2475 mash_infuse = 0; |
|
2476 for (i = 0; i < rowscount; i++) { |
|
2477 row = $('#mashGrid').jqxGrid('getrowdata', i); |
|
2478 if (row.step_type == 0) { // Infusion |
|
2479 amount = Round(row.step_infuse_amount * factor, 1); |
|
2480 $('#mashGrid').jqxGrid('setcellvalue', i, 'step_infuse_amount', amount); |
|
2481 mash_infuse += amount; |
|
2482 } |
|
2483 } |
|
2484 if (dataRecord.w2_amount == 0) { |
|
2485 dataRecord.w1_amount = mash_infuse; |
|
2486 $('#w1_amount').val(mash_infuse); |
|
2487 } else { |
|
2488 dataRecord.w1_amount = (dataRecord.w1_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse; |
|
2489 dataRecord.w2_amount = (dataRecord.w2_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse; |
|
2490 $('#w1_amount').val(dataRecord.w1_amount); |
|
2491 $('#w2_amount').val(dataRecord.w2_amount); |
|
2492 } |
|
2493 $('#wg_amount').val(mash_infuse); |
|
2494 }; |
|
2495 |
|
2496 function calcMashEfficiency() { |
|
2497 var c, m; |
|
2498 if (parseFloat($('#brew_mash_sg').jqxNumberInput('decimal')) < 1.002) |
|
2499 return; |
|
2500 c = sg_to_plato(est_mash_sg); |
|
2501 m = sg_to_plato(parseFloat($('#brew_mash_sg').jqxNumberInput('decimal'))); |
|
2502 if (c > 0.5) |
|
2503 $('#brew_mash_efficiency').val(100 * m / c); |
|
2504 else |
|
2505 $('#brew_mash_efficiency').val(0); |
|
2506 }; |
|
2507 |
|
2508 function calcEfficiencyBeforeBoil() { |
|
2509 var m = 0, rows = {}, i, row, tot, result = 0; |
|
2510 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) { |
|
2511 return; // grid not yet loaded. |
|
2512 } |
|
2513 for (i = 0; i < rows.length; i++) { |
|
2514 row = rows[i]; |
|
2515 if (row.f_added == 0) { // Mash |
|
2516 m += row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100); |
|
2517 } |
|
2518 } |
|
2519 tot = sg_to_plato(dataRecord.brew_preboil_sg) * (dataRecord.brew_preboil_volume / 1.04) * dataRecord.brew_preboil_sg * 10 / 1000; |
|
2520 if (m > 0) |
|
2521 result = Round((tot / m * 100), 1); |
|
2522 if (result < 0) |
|
2523 result = 0; |
|
2524 $('#brew_preboil_efficiency').val(result); |
|
2525 } |
|
2526 |
|
2527 function calcEfficiencyAfterBoil() { |
|
2528 var m = 0, // Sugars added at mash |
|
2529 b = 0, // Sugars added at boil |
|
2530 rows = {}, i, row, tot, result = 0; |
|
2531 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) { |
|
2532 return; // grid not yet loaded. |
|
2533 } |
|
2534 for (i = 0; i < rows.length; i++) { |
|
2535 row = rows[i]; |
|
2536 if (row.f_added == 0) { // Mash |
|
2537 m += row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100); |
|
2538 } else if (row.f_added == 1) { // Boil |
|
2539 b += row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100); |
|
2540 } |
|
2541 } |
|
2542 tot = sg_to_plato(dataRecord.brew_aboil_sg) * (dataRecord.brew_aboil_volume / 1.04) * dataRecord.brew_aboil_sg * 10 / 1000; |
|
2543 tot -= b; // total sugars in wort minus added sugars. |
|
2544 if (m > 0) |
|
2545 result = Round((tot / m * 100), 1); |
|
2546 if (result < 0) |
|
2547 result = 0; |
|
2548 dataRecord.brew_aboil_efficiency = result; |
|
2549 $('#brew_aboil_efficiency').val(result); |
|
2550 } |
|
2551 |
|
2552 function GetBUGU() { |
|
2553 var gu = (dataRecord.est_og - 1) * 1000; |
|
2554 if (gu > 0) |
|
2555 return dataRecord.est_ibu / gu; |
|
2556 else |
|
2557 return 0.5; |
|
2558 } |
|
2559 |
|
2560 function GetOptClSO4ratio() { |
|
2561 var BUGU = GetBUGU(); |
|
2562 return (-1.2 * BUGU + 1.4); |
|
2563 } |
|
2564 |
|
2565 function setWaterAgent(name, amount) { |
|
2566 var row, i, id, found = false, miscs, rows = $('#miscGrid').jqxGrid('getrows'); |
|
2567 if (amount == 0) { |
|
2568 for (i = 0; i < rows.length; i++) { |
|
2569 row = rows[i]; |
|
2570 if (row.m_name == name) { |
|
2571 id = $('#miscGrid').jqxGrid('getrowid', i); |
|
2572 $('#miscGrid').jqxGrid('deleterow', id); |
|
2573 } |
|
2574 } |
|
2575 } else { |
|
2576 for (i = 0; i < rows.length; i++) { |
|
2577 row = rows[i]; |
|
2578 if (row.m_name == name) { |
|
2579 found = true; |
|
2580 $('#miscGrid').jqxGrid('setcellvalue', i, 'm_amount', amount / 1000); |
|
2581 break; |
|
2582 } |
|
2583 } |
|
2584 if (! found) { |
|
2585 miscs = new $.jqx.dataAdapter(miscInvSource, { |
|
2586 loadComplete: function() { |
|
2587 var record, i, row = {}, records = miscs.records; |
|
2588 for (i = 0; i < records.length; i++) { |
|
2589 record = records[i]; |
|
2590 if (record.name == name) { |
|
2591 row['m_name'] = record.name; |
|
2592 row['m_amount'] = amount / 1000; |
|
2593 row['m_cost'] = record.cost; |
|
2594 row['m_type'] = record.type; |
|
2595 row['m_use_use'] = record.use_use; |
|
2596 row['m_time'] = 0; |
|
2597 row['m_amount_is_weight'] = record.amount_is_weight; |
|
2598 row['m_inventory'] = record.inventory; |
|
2599 row['m_avail'] = 1; |
|
2600 $('#miscGrid').jqxGrid('addrow', null, row); |
|
2601 } |
|
2602 } |
|
2603 } |
|
2604 }); |
|
2605 miscs.dataBind(); |
|
2606 return; |
|
2607 } |
|
2608 } |
|
2609 } |
|
2610 |
|
2611 function setRangeIndicator(ion, rangeCode) { |
|
2612 if ((rangeCode == 'laag') || (rangeCode == 'hoog')) |
|
2613 $('#wr_' + ion).html("<img src='images/dialog-error.png'><span style='vertical-align: top; font-size: 10px; font-style: italic;'>" + rangeCode + '</span>'); |
|
2614 else |
|
2615 $('#wr_' + ion).html("<img src='images/dialog-ok-apply.png'>"); |
|
2616 } |
|
2617 |
|
2618 function mix(v1, v2, c1, c2) { |
|
2619 if ((v1 + v2) > 0) { |
|
2620 return ((v1 * c1) + (v2 * c2)) / (v1 + v2); |
|
2621 } |
|
2622 return 0; |
|
2623 } |
|
2624 |
|
2625 // mg/l as CaCO3 |
|
2626 function ResidualAlkalinity(total_alkalinity, calcium, magnesium) { |
|
2627 return total_alkalinity - (calcium / 1.4 + magnesium / 1.7); |
|
2628 } |
|
2629 |
|
2630 function PartCO3(pH) { |
|
2631 var H = Math.pow(10, -pH); |
|
2632 return 100 * Ka1 * Ka2 / (H * H + H * Ka1 + Ka1 * Ka2); |
|
2633 } |
|
2634 |
|
2635 function PartHCO3(pH) { |
|
2636 var H = Math.pow(10, -pH); |
|
2637 return 100 * Ka1 * H / (H * H + H * Ka1 + Ka1 * Ka2); |
|
2638 } |
|
2639 |
|
2640 function Charge(pH) { |
|
2641 return (-2 * PartCO3(pH) - PartHCO3(pH)); |
|
2642 } |
|
2643 |
|
2644 //Z alkalinity is the amount of acid (in mEq/l) needed to bring water to the target pH (Z pH) |
|
2645 function ZAlkalinity(pHZ) { |
|
2646 var C43 = Charge(4.3), |
|
2647 Cw = Charge(parseFloat($('#wg_ph').jqxNumberInput('decimal'))), |
|
2648 Cz = Charge(pHZ), |
|
2649 DeltaCNaught = -C43 + Cw, |
|
2650 CT = parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal')) / 50 / DeltaCNaught, |
|
2651 DeltaCZ = -Cz + Cw; |
|
2652 return CT * DeltaCZ; |
|
2653 } |
|
2654 |
|
2655 //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) |
|
2656 function ZRA(pHZ) { |
|
2657 |
|
2658 var Magn, Z, Calc = parseFloat($('#wg_calcium').jqxNumberInput('decimal')) / (MMCa / 2); |
|
2659 Magn = parseFloat($('#wg_magnesium').jqxNumberInput('decimal')) / (MMMg / 2); |
|
2660 Z = ZAlkalinity(pHZ); |
|
2661 return Z - (Calc / 3.5 + Magn / 7); |
|
2662 } |
|
2663 |
|
2664 function ProtonDeficit(pHZ) { |
|
2665 |
|
2666 var rows, i, C1, ebc, x, Result = ZRA(pHZ) * parseFloat($('#wg_amount').jqxNumberInput('decimal')); |
|
2667 // proton deficit for the grist |
|
2668 rows = $('#fermentableGrid').jqxGrid('getrows'); |
|
2669 for (i = 0; i < rows.length; i++) { |
|
2670 row = rows[i]; |
|
2671 if (row.f_added == 0 && row.f_graintype != 6) { // Added == Mash && graintype != No Malt |
|
2672 // Check if acid is required |
|
2673 C1 = 0; |
|
2674 if ((row.f_di_ph != 5.7) && ((row.f_acid_to_ph_57 < - 0.1) || (row.f_acid_to_ph_57 > 0.1))) { |
|
2675 C1 = row.f_acid_to_ph_57 / (row.f_di_ph - 5.7); |
|
2676 } else { |
|
2677 // If the acid_to_ph_5.7 is unknown from the maltster, guess the required acid. |
|
2678 ebc = row.f_color; |
|
2679 switch (row.f_graintype) { |
|
2680 case 0: // Base, Special, Kilned |
|
2681 case 3: |
|
2682 case 5: C1 = 0.014 * ebc - 34.192; |
|
2683 break; |
|
2684 case 2: C1 = -0.0597 * ebc - 32.457; // Crystal |
|
2685 break; |
|
2686 case 1: C1 = 0.0107 * ebc - 54.768; // Roast |
|
2687 break; |
|
2688 case 4: C1 = -149; // Sour malt |
|
2689 break; |
|
2690 } |
|
2691 } |
|
2692 x = C1 * (pHZ - row.f_di_ph); // AcidRequired(ZpH) |
|
2693 Result += x * row.f_amount; |
|
2694 } |
|
2695 } |
|
2696 return Result; |
|
2697 } |
|
2698 |
|
2699 function MashpH() { |
|
2700 var n = 0, pH = 5.4, deltapH = 0.001, deltapd = 0.1, pd = ProtonDeficit(pH); |
|
2701 while (((pd < -deltapd) || (pd > deltapd)) && (n < 2000)) { |
|
2702 n++; |
|
2703 if (pd < -deltapd) |
|
2704 pH -= deltapH; |
|
2705 else if (pd > deltapd) |
|
2706 pH += deltapH; |
|
2707 pd = ProtonDeficit(pH); |
|
2708 } |
|
2709 console.log('MashpH() n: ' + n + ' pH: ' + pH); |
|
2710 return pH; |
|
2711 } |
|
2712 |
|
2713 function GetAcidSpecs(AT) { |
|
2714 switch (AT) { |
|
2715 case 0: // Melkzuur |
|
2716 return { pK1: 3.86, pK2: 20, pK3: 20, MolWt: 90.08, AcidSG: 1214, AcidPrc: 0.88 }; |
|
2717 case 1: // Zoutzuur |
|
2718 return { pK1: -7, pK2: 20, pK3: 20, MolWt: 36.46, AcidSG: 1142, AcidPrc: 0.28 }; |
|
2719 case 2: // Fosforzuur |
|
2720 return { pK1: 2.12, pK2: 7.20, pK3: 12.44, MolWt: 98.00, AcidSG: 1170, AcidPrc: 0.25 }; |
|
2721 case 3: // Zwavelzuur |
|
2722 return { pK1: -1, pK2: 1.92, pK3: 20, MolWt: 98.07, AcidSG: 1700, AcidPrc: 0.93 }; |
|
2723 } |
|
2724 } |
|
2725 |
|
2726 function calcWater() { |
|
2727 |
|
2728 console.log('calcWater()'); |
|
2729 var liters = 0, |
|
2730 calcium = 0, |
|
2731 magnesium = 0, |
|
2732 sodium = 0, |
|
2733 total_alkalinity = 0, |
|
2734 bicarbonate = 0, |
|
2735 chloride = 0, |
|
2736 sulfate = 0, |
|
2737 ph = 0, |
|
2738 RA = 0, |
|
2739 frac = 0, |
|
2740 TpH = 0, |
|
2741 protonDeficit = 0, |
|
2742 AT, BT, result, pK1, pK2, pK3, MolWt, AcidSG, AcidPrc, |
|
2743 r1d, r2d, f1d, f2d, f3d, |
|
2744 deltapH, deltapd, pd, n, |
|
2745 piCLSO4_low, piCLSO4_high, Res, |
|
2746 wg_calcium, wg_sodium, wg_total_alkalinity, wg_chloride, wg_sulfate, wg_bicarbonate; |
|
2747 |
|
2748 if (dataRecord.w1_name == '') { |
|
2749 return; |
|
2750 } |
|
2751 |
|
2752 // If there is a dillute water source, mix the waters. |
|
2753 if (dataRecord.w2_name != '') { |
|
2754 liters = dataRecord.w1_amount + dataRecord.w2_amount; |
|
2755 calcium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_calcium, dataRecord.w2_calcium); |
|
2756 magnesium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_magnesium, dataRecord.w2_magnesium); |
|
2757 sodium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_sodium, dataRecord.w2_sodium); |
|
2758 chloride = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_chloride, dataRecord.w2_chloride); |
|
2759 sulfate = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_sulfate, dataRecord.w2_sulfate); |
|
2760 total_alkalinity = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_total_alkalinity, dataRecord.w2_total_alkalinity); |
|
2761 ph = -Math.log10(((Math.pow(10, -dataRecord.w1_ph) * dataRecord.w1_amount) + (Math.pow(10, -dataRecord.w2_ph) * dataRecord.w2_amount)) / liters); |
|
2762 } else { |
|
2763 liters = dataRecord.w1_amount; |
|
2764 calcium = dataRecord.w1_calcium; |
|
2765 magnesium = dataRecord.w1_magnesium; |
|
2766 sodium = dataRecord.w1_sodium; |
|
2767 chloride = dataRecord.w1_chloride; |
|
2768 sulfate = dataRecord.w1_sulfate; |
|
2769 total_alkalinity = dataRecord.w1_total_alkalinity; |
|
2770 ph = dataRecord.w1_ph; |
|
2771 } |
|
2772 $('#wg_amount').val(liters); |
|
2773 wg_calcium = calcium; |
|
2774 $('#wg_calcium').val(Math.round(calcium * 10) / 10); |
|
2775 //var wg_magnesium = magnesium; |
|
2776 $('#wg_magnesium').val(Math.round(magnesium * 10) / 10); |
|
2777 wg_sodium = sodium; |
|
2778 $('#wg_sodium').val(Math.round(sodium * 10) / 10); |
|
2779 wg_total_alkalinity = total_alkalinity; |
|
2780 $('#wg_total_alkalinity').val(Math.round(total_alkalinity * 10) / 10); |
|
2781 wg_chloride = chloride; |
|
2782 $('#wg_chloride').val(Math.round(chloride * 10) / 10); |
|
2783 wg_sulfate = sulfate; |
|
2784 $('#wg_sulfate').val(Math.round(sulfate * 10) / 10); |
|
2785 // Note: brouwhulp has the malts included here in the result. |
|
2786 //var wg_ph = ph; |
|
2787 $('#wg_ph').val(Round(ph, 1)); |
|
2788 $('#wb_ph').val(Round(MashpH(), 1)); |
|
2789 $('#est_mash_ph').val(Round(MashpH(), 1)); |
|
2790 bicarbonate = total_alkalinity * 1.22; |
|
2791 wg_bicarbonate = bicarbonate; |
|
2792 |
|
2793 // Noot: de volgende berekeningen geven bijna gelijke resultaten in Brun'water. |
|
2794 // Calculate Ca |
|
2795 RA = parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 + |
|
2796 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4; |
|
2797 calcium += 1000 * RA / liters; |
|
2798 |
|
2799 // Calculate Mg |
|
2800 RA = parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMMg / MMMgSO4; |
|
2801 magnesium += 1000 * RA / liters; |
|
2802 |
|
2803 // Calculate Na |
|
2804 RA = parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl + |
|
2805 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMNa / MMNaHCO3; |
|
2806 sodium += 1000 * RA / liters; |
|
2807 |
|
2808 // Calculate SO4 |
|
2809 RA = parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 + |
|
2810 parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMSO4 / MMMgSO4; |
|
2811 sulfate += 1000 * RA / liters; |
|
2812 |
|
2813 // Calculate Cl |
|
2814 RA = 2 * parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 + |
|
2815 parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl; |
|
2816 chloride += 1000 * RA / liters; |
|
2817 // Einde noot. |
|
2818 |
|
2819 if ($('#wa_acid_name').val() < 0 || $('#wa_acid_name').val() > 3) { |
|
2820 $('#wa_acid_name').val(0); |
|
2821 dataRecord.wa_acid_name = 0; |
|
2822 } |
|
2823 if (last_acid == '') |
|
2824 last_acid = AcidTypeData[$('#wa_acid_name').val()].nl; |
|
2825 |
|
2826 if ($('#wa_base_name').val() < 0 || $('#wa_base_name').val() > 3) { |
|
2827 $('#wa_base_name').val(0); |
|
2828 dataRecord.wa_base_name = 0; |
|
2829 } |
|
2830 if (last_base == '') |
|
2831 last_base = BaseTypeData[$('#wa_base_name').val()].nl; |
|
2832 |
|
2833 AT = dataRecord.wa_acid_name; |
|
2834 BT = dataRecord.wa_base_name; |
|
2835 |
|
2836 result = GetAcidSpecs(AT); |
|
2837 pK1 = result.pK1; |
|
2838 pK2 = result.pK2; |
|
2839 pK3 = result.pK3; |
|
2840 MolWt = result.MolWt; |
|
2841 AcidSG = result.AcidSG; |
|
2842 AcidPrc = result.AcidPrc; |
|
2843 |
|
2844 if (dataRecord.calc_acid) { |
|
2845 TpH = parseFloat(dataRecord.mash_ph); |
|
2846 protonDeficit = ProtonDeficit(TpH); |
|
2847 console.log('calc_acid tgt: ' + TpH + ' protonDeficit: ' + protonDeficit); |
|
2848 if (protonDeficit > 0) { // Add acid |
|
2849 $('#wa_base').val(0); |
|
2850 setWaterAgent(last_base, 0); |
|
2851 frac = CalcFrac(TpH, pK1, pK2, pK3); |
|
2852 Acid = protonDeficit / frac; |
|
2853 Acid *= MolWt; // mg |
|
2854 Acidmg = Acid; |
|
2855 Acid = Acid / AcidSG; // ml |
|
2856 |
|
2857 if (parseFloat($('#wa_acid_perc').jqxNumberInput('decimal')) == 0) |
|
2858 $('#wa_acid_perc').val(AcidPrc); |
|
2859 Acid = Acid * AcidPrc / (parseFloat($('#wa_acid_perc').jqxNumberInput('decimal')) / 100); // ml |
|
2860 console.log('Final ml: ' + Acid); |
|
2861 $('#wa_acid').val(Round(Acid, 2)); |
|
2862 setWaterAgent(AcidTypeData[AT].nl, Round(Acid, 2)); |
|
2863 |
|
2864 bicarbonate = bicarbonate - protonDeficit * frac / liters; |
|
2865 total_alkalinity = bicarbonate * 50 / 61; |
|
2866 } else if (protonDeficit < 0) { //Add base |
|
2867 $('#wa_acid').val(0); |
|
2868 setWaterAgent(last_acid, 0); |
|
2869 r1d = Math.pow(10, (TpH - 6.38)); |
|
2870 r2d = Math.pow(10, (TpH - 10.38)); |
|
2871 f1d = 1 / (1 + r1d + r1d * r2d); |
|
2872 f2d = f1d * r1d; |
|
2873 f3d = f2d * r2d; |
|
2874 switch (BT) { |
|
2875 case 0: |
|
2876 RA = -protonDeficit / (f1d - f3d); // Sodiumbicarbonate, mmol totaal |
|
2877 RA = RA * MMNaHCO3 / 1000; //gram |
|
2878 $('#wa_base').val(Round(RA, 2)); |
|
2879 setWaterAgent('NaHCO3', Round(RA, 2)); |
|
2880 if (liters > 0) { |
|
2881 // Na |
|
2882 RA = parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl + |
|
2883 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMNa / MMNaHCO3; |
|
2884 RA = 1000 * RA / liters; |
|
2885 sodium = wg_sodium + RA; |
|
2886 // HCO3 |
|
2887 RA = parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3; |
|
2888 RA = 1000 * RA / liters; |
|
2889 bicarbonate = wg_bicarbonate + RA; |
|
2890 total_alkalinity = bicarbonate * 50 / 61; |
|
2891 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
|
2892 } |
|
2893 break; |
|
2894 case 1: |
|
2895 RA = -protonDeficit / (2 * f1d + f2d); // Sodiumcarbonate, mmol totaal |
|
2896 RA = RA * MMNa2CO3 / 1000; //gram |
|
2897 $('#wa_base').val(Round(RA, 2)); |
|
2898 setWaterAgent('Na2CO3', Round(RA, 2)); |
|
2899 if (liters > 0) { |
|
2900 RA = parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl + |
|
2901 parseFloat($('#wa_base').jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3; |
|
2902 RA = 1000 * RA / liters; |
|
2903 sodium = wg_sodium + RA; |
|
2904 // HCO3 |
|
2905 RA = parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3; |
|
2906 RA = 1000 * RA / liters; |
|
2907 bicarbonate = wg_bicarbonate + RA; |
|
2908 total_alkalinity = bicarbonate * 50 / 61; |
|
2909 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
|
2910 } |
|
2911 break; |
|
2912 case 2: |
|
2913 RA = -protonDeficit * (f1d - f3d); // Calciumcarbonate, mmol totaal |
|
2914 RA = RA * MMCaCO3 / 1000; //gram |
|
2915 //but only 1/3 is effective, so add 3 times as much |
|
2916 RA = 3 * RA; |
|
2917 $('#wa_base').val(Round(RA, 2)); |
|
2918 setWaterAgent('CaCO3', Round(RA, 2)); |
|
2919 if (liters > 0) { |
|
2920 //Bicarbonate |
|
2921 RA = parseFloat($('#wa_base').jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3; |
|
2922 RA = 1000 * RA / liters; |
|
2923 bicarbonate = wg_bicarbonate + RA; |
|
2924 total_alkalinity = bicarbonate * 50 / 61; |
|
2925 //Ca precipitates out as Ca10(PO4)6(OH)2 |
|
2926 RA = parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 + |
|
2927 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4 + |
|
2928 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMCa / MMCaCO3; |
|
2929 RA = 1000 * RA / liters; |
|
2930 calcium = wg_calcium + RA; |
|
2931 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
|
2932 } |
|
2933 break; |
|
2934 case 3: |
|
2935 RA = -protonDeficit / 19.3; // Calciumhydroxide |
|
2936 $('#wa_base').val(Round(RA, 2)); |
|
2937 setWaterAgent('Ca(OH)2', Round(RA, 2)); |
|
2938 if (liters > 0) { |
|
2939 // Bicarbonate |
|
2940 RA = -protonDeficit / liters; |
|
2941 total_alkalinity = wg_total_alkalinity + RA; |
|
2942 bicarbonate = total_alkalinity * 61 / 50; |
|
2943 // Calcium |
|
2944 RA = parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 + |
|
2945 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4 + |
|
2946 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMCa / MMCaOH2; |
|
2947 RA = 1000 * RA / liters; |
|
2948 calcium = wg_calcium + RA; |
|
2949 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
|
2950 } |
|
2951 break; |
|
2952 } |
|
2953 } |
|
2954 ph = TpH; |
|
2955 $('#wb_ph').val(Round(ph, 1)); |
|
2956 $('#est_mash_ph').val(Round(ph, 1)); |
|
2957 } else { // Manual |
|
2958 console.log('calc_acid no'); |
|
2959 // First add base salts |
|
2960 if (parseFloat($('#wa_base').jqxNumberInput('decimal')) > 0) { |
|
2961 if (liters > 0) { |
|
2962 switch (BT) { |
|
2963 case 0: // Sodiumbicarbonate, Na |
|
2964 RA = parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl + |
|
2965 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMNa / MMNaHCO3; |
|
2966 RA = 1000 * RA / liters; |
|
2967 sodium = wg_sodium + RA; |
|
2968 // HCO3 |
|
2969 RA = parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3; |
|
2970 RA = 1000 * RA / liters; |
|
2971 bicarbonate = wg_bicarbonate + RA; |
|
2972 total_alkalinity = bicarbonate * 50 / 61; |
|
2973 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
|
2974 break; |
|
2975 case 1: // Sodiumcarbonate |
|
2976 RA = parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl + |
|
2977 parseFloat($('#wa_base').jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3; |
|
2978 RA = 1000 * RA / liters; |
|
2979 sodium = wg_sodium + RA; |
|
2980 // HCO3 |
|
2981 RA = parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3; |
|
2982 RA = 1000 * RA / liters; |
|
2983 bicarbonate = wg_bicarbonate + RA; |
|
2984 total_alkalinity = bicarbonate * 50 / 61; |
|
2985 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
|
2986 break; |
|
2987 case 2: // Calciumcarbonate: Bicarbonate |
|
2988 RA = parseFloat($('#wa_base').jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3; |
|
2989 RA = 1000 * RA / liters; |
|
2990 bicarbonate = wg_bicarbonate + RA; |
|
2991 total_alkalinity = bicarbonate * 50 / 61; |
|
2992 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
|
2993 // Ca |
|
2994 RA = parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 + |
|
2995 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4 + |
|
2996 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMCa / MMCaCO3; |
|
2997 RA = 1000 * RA / liters; |
|
2998 calcium = wg_calcium + RA; |
|
2999 break; |
|
3000 } |
|
3001 } |
|
3002 } |
|
3003 |
|
3004 TpH = parseFloat(dataRecord.mash_ph); |
|
3005 pHa = MashpH(); // This one is in demi water, should be in adjusted water??? |
|
3006 // Then calculate the new pH with added acids |
|
3007 if (parseFloat($('#wa_acid').jqxNumberInput('decimal')) > 0) { |
|
3008 console.log('TpH: ' + TpH + ' water: ' + pHa); |
|
3009 Acid = parseFloat($('#wa_acid').jqxNumberInput('decimal')); |
|
3010 if (parseFloat($('#wa_acid_perc').jqxNumberInput('decimal')) == 0) |
|
3011 $('#wa_acid_perc').val(AcidPrc); |
|
3012 Acid = Acid / AcidPrc * (parseFloat($('#wa_acid_perc').jqxNumberInput('decimal')) / 100); // ml |
|
3013 Acid *= AcidSG; // ml |
|
3014 Acid /= MolWt; // mg |
|
3015 Acidmg = Acid; |
|
3016 |
|
3017 //find the pH where the protondeficit = protondeficit by the acid |
|
3018 frac = CalcFrac(pHa, pK1, pK2, pK3); |
|
3019 protonDeficit = Acid * frac; |
|
3020 |
|
3021 deltapH = 0.001; |
|
3022 deltapd = 0.1; |
|
3023 pd = ProtonDeficit(pHa); |
|
3024 n = 0; |
|
3025 while (((pd < (protonDeficit - deltapd)) || (pd > (protonDeficit + deltapd))) && (n < 2000)) { |
|
3026 n++; |
|
3027 if (pd < (protonDeficit - deltapd)) |
|
3028 pHa -= deltapH; |
|
3029 else if (pd > (protonDeficit + deltapd)) |
|
3030 pHa += deltapH; |
|
3031 frac = CalcFrac(pHa, pK1, pK2, pK3); |
|
3032 protonDeficit = Acid * frac; |
|
3033 pd = ProtonDeficit(pHa); |
|
3034 } |
|
3035 console.log('n: ' + n + ' pd: ' + pd + ' protonDeficit: ' + protonDeficit + ' frac: ' + frac + ' pHa: ' + pHa); |
|
3036 RA = wg_bicarbonate - protonDeficit * frac / liters; |
|
3037 bicarbonate = RA; |
|
3038 total_alkalinity = RA * 50 / 61; |
|
3039 ph = pHa; |
|
3040 $('#wb_ph').val(Round(ph, 1)); |
|
3041 $('#est_mash_ph').val(Round(ph, 1)); |
|
3042 } |
|
3043 } |
|
3044 |
|
3045 if ((AT == 3) && (liters > 0)) { // Sulfuctic / Zwavelzuur |
|
3046 RA = parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 + |
|
3047 parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 + |
|
3048 Acidmg / 1000 * MMSO4 / (MMSO4 + 2); |
|
3049 RA = 1000 * RA / liters; |
|
3050 sulfate = wg_sulfate + RA; // Not add to sulfate?? |
|
3051 } else if ((AT == 1) && (liters > 0)) { // Hydrochloric, Zoutzuur |
|
3052 RA = parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 + |
|
3053 parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl + |
|
3054 Acidmg / 1000 * MMCl / (MMCl + 1); |
|
3055 RA = 1000 * RA / liters; |
|
3056 chloride = wg_chloride + RA; |
|
3057 } |
|
3058 |
|
3059 // 2:1 Sulfate to Chroride IPA's, Pale Ales. |
|
3060 // 1:1 Sulfate to Chloride Balanced |
|
3061 // 1:2 Sulfate to Chloride Malty |
|
3062 // Note, values below are the other way, cl to so4! |
|
3063 // So: 0.5 is IPA's, Pale Ales. |
|
3064 // 1 Balanced |
|
3065 // 2 Malty. |
|
3066 $('#tgt_bu').val(Round(GetBUGU(), 2)); |
|
3067 // From brouwhulp. |
|
3068 if (GetBUGU() < 0.32) |
|
3069 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer moutig en zoet</span>"); |
|
3070 else if (GetBUGU() < 0.43) |
|
3071 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Moutig, zoet</span>"); |
|
3072 else if (GetBUGU() < 0.52) |
|
3073 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Evenwichtig</span>"); |
|
3074 else if (GetBUGU() < 0.63) |
|
3075 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Licht hoppig, bitter</span>"); |
|
3076 else |
|
3077 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Extra hoppig, zeer bitter</span>"); |
|
3078 $('#tgt_cl_so4').val(Round(GetOptClSO4ratio(), 1)); |
|
3079 if (sulfate > 0) |
|
3080 RA = chloride / sulfate; |
|
3081 else |
|
3082 RA = 10; |
|
3083 $('#got_cl_so4').val(Round(RA, 1)); |
|
3084 piCLSO4_low = 0.8 * GetOptClSO4ratio(); |
|
3085 piCLSO4_high = 1.2 * GetOptClSO4ratio(); |
|
3086 Res = 'normaal'; |
|
3087 if (RA < piCLSO4_low) |
|
3088 Res = 'laag'; |
|
3089 else if (RA > piCLSO4_high) |
|
3090 Res = 'hoog'; |
|
3091 setRangeIndicator('cl_so4', Res); |
|
3092 |
|
3093 $('#wb_calcium').val(Round(calcium, 1)); |
|
3094 $('#wb_magnesium').val(Round(magnesium, 1)); |
|
3095 $('#wb_sodium').val(Round(sodium, 1)); |
|
3096 $('#wb_sulfate').val(Round(sulfate, 1)); |
|
3097 $('#wb_chloride').val(Round(chloride, 1)); |
|
3098 $('#wb_total_alkalinity').val(Round(total_alkalinity, 1)); |
|
3099 |
|
3100 if (calcium < 40) { |
|
3101 setRangeIndicator('calcium', 'laag'); |
|
3102 } else if (calcium > 150) { |
|
3103 setRangeIndicator('calcium', 'hoog'); |
|
3104 } else { |
|
3105 setRangeIndicator('calcium', 'normaal'); |
|
3106 } |
|
3107 if (magnesium >= 0 && magnesium <= 30) { |
|
3108 setRangeIndicator('magnesium', 'normaal'); |
|
3109 } else { |
|
3110 setRangeIndicator('magnesium', 'hoog'); |
|
3111 } |
|
3112 if (sodium <= 150) { |
|
3113 setRangeIndicator('sodium', 'normaal'); |
|
3114 } else { |
|
3115 setRangeIndicator('sodium', 'hoog'); |
|
3116 } |
|
3117 // Both chloride and sulfate should be above 50 according to |
|
3118 // John Palmer. So the Cl/SO4 ratio calculation will work. |
|
3119 if (chloride <= 50) { |
|
3120 setRangeIndicator('chloride', 'laag'); |
|
3121 } else if (chloride <= 100) { |
|
3122 setRangeIndicator('chloride', 'normaal'); |
|
3123 } else { |
|
3124 setRangeIndicator('chloride', 'hoog'); |
|
3125 } |
|
3126 if (sulfate <= 50) { |
|
3127 setRangeIndicator('sulfate', 'laag'); |
|
3128 } else if (sulfate <= 350) { |
|
3129 setRangeIndicator('sulfate', 'normaal'); |
|
3130 } else { |
|
3131 setRangeIndicator('sulfate', 'hoog'); |
|
3132 } |
|
3133 if (ph < 5.2) { |
|
3134 setRangeIndicator('ph', 'laag'); |
|
3135 } else if (ph > 5.6) { |
|
3136 setRangeIndicator('ph', 'hoog'); |
|
3137 } else { |
|
3138 setRangeIndicator('ph', 'normaal'); |
|
3139 } |
|
3140 calcSparge(); |
|
3141 calcMiscs(); |
|
3142 calcSupplies(); |
|
3143 } |
|
3144 |
|
3145 function calcSparge() { |
|
3146 |
|
3147 var TargetpH, Source_pH, Source_alkalinity, r1, r2, d, f1, f3, r143, r243, d43, f143, f343, |
|
3148 alkalinity, Ct, r1g, r2g, dg, f1g, f3g, Acid, AT, result, pK1, pK2, pK3, MolWt, AcidSG, AcidPrc, fract; |
|
3149 |
|
3150 // Code from BrewBuddy/Brouwhulp, who got it from http://www.brewery.org/brewery/library/Acidi0,00fWaterAJD0497.html |
|
3151 TargetpH = dataRecord.sparge_ph; |
|
3152 Source_pH = dataRecord.w1_ph; |
|
3153 Source_alkalinity = dataRecord.w1_total_alkalinity; |
|
3154 // Select watersource or fallback to the first source. |
|
3155 if (dataRecord.sparge_source == 1) { // Source 2 |
|
3156 if (dataRecord.w2_ph > 0.0) { |
|
3157 Source_pH = dataRecord.w2_ph; |
|
3158 Source_alkalinity = dataRecord.w2_total_alkalinity; |
|
3159 } else { |
|
3160 dataRecord.sparge_source = 0; // Source 1 |
|
3161 $('#sparge_source').val(0); |
|
3162 } |
|
3163 } else if (dataRecord.sparge_source == 2) { // Mixed |
|
3164 if (dataRecord.w2_ph > 0.0) { |
|
3165 Source_pH = parseFloat($('#wg_ph').jqxNumberInput('decimal')); |
|
3166 Source_alkalinity = parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal')); |
|
3167 } else { |
|
3168 dataRecord.sparge_source = 0; |
|
3169 $('#sparge_source').val(0); |
|
3170 } |
|
3171 } |
|
3172 |
|
3173 // Step 1: Compute the mole fractions of carbonic (f1o), bicarbonate (f2o) and carbonate(f3o) at the water pH |
|
3174 r1 = Math.pow(10, Source_pH - 6.38); |
|
3175 r2 = Math.pow(10, Source_pH - 10.373); |
|
3176 d = 1 + r1 + r1 * r2; |
|
3177 f1 = 1 / d; |
|
3178 f3 = r1 * r2 / d; |
|
3179 |
|
3180 //Step 2. Compute the mole fractions at pH = 4.3 (the pH which defines alkalinity) |
|
3181 r143 = Math.pow(10, 4.3 - 6.38); |
|
3182 r243 = Math.pow(10, 4.3 - 10.373); |
|
3183 d43 = 1 + r143 + r143 * r243; |
|
3184 f143 = 1 / d43; |
|
3185 f343 = r143 * r243 / d43; |
|
3186 |
|
3187 //Step 3. Convert the water alkalinity to milliequivalents/L |
|
3188 alkalinity = Source_alkalinity / 50; |
|
3189 |
|
3190 //Step 4. Solve |
|
3191 Ct = (alkalinity - 1000 * (Math.pow(10, -4.3) - Math.pow(10, -Source_pH))) / ((f143 - f1) + (f3 - f343)); |
|
3192 |
|
3193 //Step 5. Compute mole fractions at desired pH |
|
3194 r1g = Math.pow(10, TargetpH - 6.38); |
|
3195 r2g = Math.pow(10, TargetpH - 10.373); |
|
3196 dg = 1 + r1g + r1g * r2g; |
|
3197 f1g = 1 / dg; |
|
3198 f3g = r1g * r2g / dg; |
|
3199 |
|
3200 //Step 6. Use these to compute the milliequivalents acid required per liter (mEq/L) |
|
3201 Acid = Ct * ((f1g - f1) + (f3 - f3g)) + Math.pow(10, -TargetpH) - Math.pow(10, -Source_pH); //mEq/l |
|
3202 Acid += 0.01; // Add acid that would be required for distilled water. |
|
3203 if (dataRecord.sparge_acid_type < 0 || dataRecord.sparge_acid_type > 3) { |
|
3204 dataRecord.sparge_acid_type = 0; |
|
3205 $('#sparge_acid_type').val(0); |
|
3206 } |
|
3207 |
|
3208 //Step 8. Get the acid data. |
|
3209 AT = dataRecord.sparge_acid_type; |
|
3210 result = GetAcidSpecs(AT); |
|
3211 pK1 = result.pK1; |
|
3212 pK2 = result.pK2; |
|
3213 pK3 = result.pK3; |
|
3214 MolWt = result.MolWt; |
|
3215 AcidSG = result.AcidSG; |
|
3216 AcidPrc = result.AcidPrc; |
|
3217 fract = CalcFrac(TargetpH, pK1, pK2, pK3); |
|
3218 |
|
3219 //Step 9. Now divide the mEq required by the "fraction". This is the required number of moles of acid. |
|
3220 Acid /= fract; |
|
3221 |
|
3222 //Step 10. Multiply by molecular weight of the acid |
|
3223 Acid *= MolWt; //mg |
|
3224 |
|
3225 Acid = Acid / AcidSG; //ml ; 88% lactic solution |
|
3226 f1 = dataRecord.sparge_acid_perc; |
|
3227 if (f1 <= 0.1) |
|
3228 f1 = AcidPrc; |
|
3229 Acid = Acid * AcidPrc / (f1 / 100); |
|
3230 |
|
3231 Acid *= dataRecord.sparge_volume; //ml lactic acid total |
|
3232 Acid = Round(Acid, 2); |
|
3233 dataRecord.sparge_acid_amount = Acid / 1000; |
|
3234 $('#sparge_acid_amount').val(Acid); |
|
3235 } |
|
3236 |
|
3237 function calcFermentation() { |
|
3238 var primary_svg, secondary_svg, final_svg, ABV; |
|
3239 if (dataRecord.brew_fermenter_sg < 1.020) |
|
3240 return; |
|
3241 if ((dataRecord.primary_end_sg > 0.990) && (dataRecord.primary_end_sg < dataRecord.brew_fermenter_sg)) { |
|
3242 primary_svg = Round(100 * (dataRecord.brew_fermenter_sg - dataRecord.primary_end_sg) / (dataRecord.brew_fermenter_sg - 1), 1); |
|
3243 $('#primary_svg').val(primary_svg); |
|
3244 if ((dataRecord.secondary_end_sg > 0.990) && (dataRecord.secondary_end_sg < dataRecord.brew_fermenter_sg)) { |
|
3245 secondary_svg = Round(100 * (dataRecord.brew_fermenter_sg - dataRecord.secondary_end_sg) / (dataRecord.brew_fermenter_sg - 1), 1); |
|
3246 $('#secondary_svg').val(secondary_svg); |
|
3247 if ((dataRecord.fg > 0.990) && (dataRecord.fg < dataRecord.brew_fermenter_sg)) { |
|
3248 final_svg = Round(100 * (dataRecord.brew_fermenter_sg - dataRecord.fg) / (dataRecord.brew_fermenter_sg - 1), 1); |
|
3249 $('#final_svg').val(final_svg); |
|
3250 ABV = Round(abvol(dataRecord.brew_fermenter_sg, dataRecord.fg), 2); |
|
3251 $('#final_abv').val(ABV); |
|
3252 } |
|
3253 } |
|
3254 } |
|
3255 } |
|
3256 |
|
3257 function ResCO2(CO2, T) { |
|
3258 var F = T * 1.8 + 32; |
|
3259 return 3.0378 - 0.050062 * F + 0.00026555 * F * F; |
|
3260 } |
|
3261 |
|
3262 function CarbCO2toS(CO2, T, SFactor) { |
|
3263 var sugar = SFactor * (CO2 - ResCO2(CO2, T)) / 0.286; |
|
3264 if (sugar < 0) |
|
3265 sugar = 0; |
|
3266 return Round(sugar, 3); |
|
3267 } |
|
3268 |
|
3269 function GetPressure(CO2, T1, T2) { |
|
3270 var P, V = CO2 - ResCO2(CO2, T1); |
|
3271 if (V < 0) |
|
3272 return 0; |
|
3273 P = -1.09145427669121 + 0.00800006989646477 * T2 + 0.000260276315484684 * T2 * T2 + 0.0215142075945119 * T2 * V + |
|
3274 0.674996600795854 * V + -0.00471757220150754 * V * V; |
|
3275 //console.log("CO2: "+CO2+" "+V+" Temp: "+T1+" "+T2+" Pressure: "+P); |
|
3276 if (P < 0) |
|
3277 P = 0; |
|
3278 P = P * 1.01325; // atm to bar |
|
3279 return Round(P, 1); |
|
3280 } |
|
3281 |
|
3282 function CarbCO2ToPressure(CO2, T) { |
|
3283 return (CO2 - (-0.000005594056 * Math.pow(T, 4) + 0.000144357886 * Math.pow(T, 3) + |
|
3284 0.000362999168 * T * T - 0.064872987645 * T + 1.641145175049)) / |
|
3285 (0.00000498031 * Math.pow(T, 4) - 0.00024358267 * Math.pow(T, 3) + 0.00385867329 * T * T - 0.05671206825 * T + 1.53801423376); |
|
3286 } |
|
3287 |
|
3288 function calcCarbonation() { |
|
3289 |
|
3290 var TSec, ABV, bvol, balc, babv, mvol, malc, tvol, talc, i, row, SFactor, pvol, pabv, Pressure, kabv; |
|
3291 |
|
3292 TSec = dataRecord.secondary_temp; |
|
3293 if (TSec < 1) |
|
3294 TSec = dataRecord.primary_end_temp; |
|
3295 if (TSec < 1) |
|
3296 TSec = 18; |
|
3297 |
|
3298 if (dataRecord.fg == 0.000) |
|
3299 ABV = abvol(dataRecord.brew_fermenter_sg, parseFloat($('#est_fg').jqxNumberInput('decimal'))); |
|
3300 else |
|
3301 ABV = abvol(dataRecord.brew_fermenter_sg, dataRecord.fg); |
|
3302 |
|
3303 /* Calculate new volume and alcohol. */ |
|
3304 bvol = dataRecord.package_volume - (ABV * dataRecord.package_volume) / 100; |
|
3305 balc = dataRecord.package_volume - bvol; |
|
3306 mvol = dataRecord.package_infuse_amount - (dataRecord.package_infuse_abv * dataRecord.package_infuse_amount) / 100; |
|
3307 malc = dataRecord.package_infuse_amount - mvol; |
|
3308 talc = balc + malc; |
|
3309 tvol = bvol + mvol; |
|
3310 ABV = Round(talc / (tvol + talc) * 100, 2); |
|
3311 dataRecord.package_abv = ABV; |
|
3312 $('#package_abv').val(ABV); |
|
3313 |
|
3314 //console.log("calcCarbonation() TSec:"+TSec+" ABV:"+ABV); |
|
3315 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) { |
|
3316 return; |
|
3317 } |
|
3318 |
|
3319 // Bottles |
|
3320 dataRecord.bottle_priming_amount = 0; |
|
3321 dataRecord.bottle_priming_total = 0; |
|
3322 for (i = 0; i < rows.length; i++) { |
|
3323 row = rows[i]; |
|
3324 if (row.f_added == 4) { |
|
3325 SFactor = 1 / ((row.f_yield / 100) * (1 - row.f_moisture / 100)); |
|
3326 dataRecord.bottle_priming_amount = CarbCO2toS(dataRecord.bottle_carbonation, TSec, SFactor); |
|
3327 dataRecord.bottle_priming_total = Round(dataRecord.bottle_amount * dataRecord.bottle_priming_amount, 2); |
|
3328 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', dataRecord.bottle_priming_total / 1000); |
|
3329 } |
|
3330 } |
|
3331 $('#bottle_priming_amount').val(Round(dataRecord.bottle_priming_amount, 1)); |
|
3332 $('#bottle_priming_total').val(dataRecord.bottle_priming_total); |
|
3333 pabv = ABV + dataRecord.bottle_priming_amount * 0.47 / 7.907; |
|
3334 pvol = dataRecord.bottle_amount - (pabv * dataRecord.bottle_amount) / 100; |
|
3335 talc = dataRecord.bottle_amount - pvol; |
|
3336 tvol = pvol + dataRecord.bottle_priming_water; |
|
3337 babv = Round(talc / (tvol + talc) * 100, 2); |
|
3338 //console.log("bottle pabv:"+pabv+" pvol:"+pvol+" wvol:"+dataRecord.bottle_priming_water+" tvol:"+tvol+" talc:"+talc+" abv:"+babv); |
|
3339 $('#bottle_abv').val(babv); |
|
3340 $('#bottle_pressure').val(GetPressure(dataRecord.bottle_carbonation, TSec, dataRecord.bottle_carbonation_temp)); |
|
3341 |
|
3342 // Kegs |
|
3343 Pressure = CarbCO2ToPressure(dataRecord.keg_carbonation, dataRecord.keg_carbonation_temp); |
|
3344 if (Pressure < 0) |
|
3345 Pressure = 0; |
|
3346 dataRecord.keg_pressure = Pressure; |
|
3347 $('#keg_pressure').val(Round(Pressure, 1)); |
|
3348 |
|
3349 dataRecord.keg_priming_amount = 0; |
|
3350 dataRecord.keg_priming_total = 0; |
|
3351 if (!dataRecord.keg_forced_carb) { |
|
3352 for (i = 0; i < rows.length; i++) { |
|
3353 row = rows[i]; |
|
3354 if (row.f_added == 5) { |
|
3355 SFactor = 1 / ((row.f_yield / 100) * (1 - row.f_moisture / 100)); |
|
3356 dataRecord.keg_priming_amount = CarbCO2toS(dataRecord.keg_carbonation, TSec, SFactor); |
|
3357 dataRecord.keg_priming_total = Round(dataRecord.keg_amount * dataRecord.keg_priming_amount, 2); |
|
3358 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', dataRecord.keg_priming_total / 1000); |
1665 } |
3359 } |
1666 } |
3360 } |
1667 if(mashtime>5) |
3361 $('#keg_priming_amount').val(Round(dataRecord.keg_priming_amount, 1)); |
1668 mashtime-=5;//Correct last ramp > 75 |
3362 $('#keg_priming_total').val(dataRecord.keg_priming_total); |
1669 mashtemp=Round(mashtemp/mashtime,2); |
3363 pabv = ABV + dataRecord.keg_priming_amount * 0.47 / 7.907; |
1670 } |
3364 pvol = dataRecord.keg_amount - (pabv * dataRecord.keg_amount) / 100; |
1671 |
3365 talc = dataRecord.keg_amount - pvol; |
1672 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) { |
3366 tvol = pvol + dataRecord.keg_priming_water; |
1673 return; // grid not yet loaded. |
3367 kabv = Round(talc / (tvol + talc) * 100, 2); |
1674 } |
|
1675 |
|
1676 for (i = 0; i < rows.length; i++) { |
|
1677 row = rows[i]; |
|
1678 if (row.f_adjust_to_total_100) |
|
1679 my_100 = true; |
|
1680 if (row.f_type == 1 && row.f_added < 4) // Sugar |
|
1681 psugar += row.f_percentage; |
|
1682 if (row.f_graintype == 2 && row.f_added < 4) // Crystal |
|
1683 pcara += row.f_percentage; |
|
1684 d = row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100); |
|
1685 if (row.f_added == 0) { // Mash |
|
1686 if (mvol > 0) { // Only if mash already known. |
|
1687 mvol += row.f_amount * row.f_moisture / 100; |
|
1688 s += d; |
|
1689 } |
|
1690 d = parseFloat(dataRecord.efficiency) / 100 * d; |
|
1691 sugarsm += d; |
|
1692 mashkg += parseFloat(row.f_amount); |
|
1693 } |
|
1694 if (row.f_added == 0 || row.f_added == 1) // Mash or Boil |
|
1695 sugarsf += d; |
|
1696 if (row.f_added == 2 || row.f_added == 3) { // Fermentation or lagering |
|
1697 x = (row.f_yield / 100) * (1 - row.f_moisture / 100); |
|
1698 addedS += row.f_amount * x; |
|
1699 addedmass += row.f_amount; |
|
1700 vol += (x * sugardensity + (1 - x) * 1) * row.f_amount; |
|
1701 } |
|
1702 if (row.f_added < 4) { |
|
1703 colort += row.f_amount * ebc_to_srm(row.f_color); |
|
1704 colorh += row.f_amount * row.f_color * get_kt(row.f_color); |
|
1705 colorn += (row.f_percentage / 100) * row.f_color; // For 8.6 Pt wort. |
|
1706 } |
|
1707 if (fermentableInit) { |
|
1708 if (row.f_added == 4) { |
|
1709 $("#bottle_priming_total").val(row.f_amount * 1000); // Prevent clearing |
|
1710 $("#bottle_priming_sugar").jqxDropDownList('selectItem', row.f_name); |
|
1711 } |
|
1712 if (row.f_added == 5) { |
|
1713 $("#keg_priming_total").val(row.f_amount * 1000); |
|
1714 $("#keg_priming_sugar").jqxDropDownList('selectItem', row.f_name); |
|
1715 } |
|
1716 } |
|
1717 // Check supplies. |
|
1718 if ((((dataRecord.inventory_reduced <= 2) && (row.f_added <= 1)) || // Mash or boil |
|
1719 ((dataRecord.inventory_reduced <= 3) && (row.f_added == 2)) || // Primary |
|
1720 ((dataRecord.inventory_reduced <= 5) && (row.f_added == 3)) || // Secondary or Tertiary |
|
1721 ((dataRecord.inventory_reduced <= 6) && (row.f_added == 4)) || // Bottle |
|
1722 ((dataRecord.inventory_reduced <= 6) && (row.f_added == 5))) && row.f_inventory < row.f_amount) { |
|
1723 ok_fermentables = 0; |
|
1724 } |
|
1725 if (row.f_added == 0 && (row.f_type == 0 || row.f_type == 4) && row.f_color < 50) { // Mash and Grain/Adjunct and Color < 50 |
|
1726 lintner += row.f_diastatic_power * row.f_amount; |
|
1727 } |
|
1728 } |
|
1729 fermentableInit = 0; |
|
1730 $("#ferm_lintner").val(Math.round(parseFloat(lintner / mashkg))); |
|
1731 $("#mash_kg").val(mashkg); |
|
1732 console.log("calcFermentables() supplies:"+ok_fermentables+" moutsuiker:"+sugarsm+"/"+sugarsf); |
|
1733 to_100 = my_100; |
|
1734 if (to_100) { |
|
1735 $("#wf_amount").jqxNumberInput({ width: 90, readOnly: true, spinButtons: false }); |
|
1736 } else { |
|
1737 $("#wf_amount").jqxNumberInput({ width: 110, readOnly: false, spinButtons: true }); |
|
1738 } |
|
1739 |
|
1740 if (mvol > 0) { |
|
1741 v = s / sugardensity + mvol; |
|
1742 s = 1000 * s / (v * 10); //deg. Plato |
|
1743 est_mash_sg = Round(plato_to_sg(s), 5); |
|
1744 $('#est_mash_sg').val(est_mash_sg); |
|
1745 } |
|
1746 |
|
1747 // Estimate total recipe OG. |
|
1748 dataRecord.est_og = estimate_sg(sugarsf + addedS, parseFloat(dataRecord.batch_size)); |
|
1749 $('#est_og').val(dataRecord.est_og); |
|
1750 $('#est_og2').val(dataRecord.est_og); |
|
1751 org = dataRecord.est_og; |
|
1752 |
|
1753 // Estimate SG in kettle after boil |
|
1754 aboil_sg = estimate_sg(sugarsf, parseFloat(dataRecord.batch_size)); |
|
1755 $('#est_og3').val(aboil_sg); |
|
1756 |
|
1757 // Estimate SG in kettle before boil |
|
1758 preboil_sg = estimate_sg(sugarsm, parseFloat(dataRecord.boil_size)); |
|
1759 $('#est_pre_sg').val(preboil_sg); |
|
1760 |
|
1761 // Recalculate volumes. |
|
1762 aboil_volume = parseFloat(dataRecord.batch_size); |
|
1763 if (dataRecord.brew_aboil_volume > 0) |
|
1764 aboil_volume = dataRecord.brew_aboil_volume / 1.04; // volume @ 20 degrees |
|
1765 if (dataRecord.brew_fermenter_tcloss == 0) { |
|
1766 dataRecord.brew_fermenter_tcloss = dataRecord.eq_trub_chiller_loss; |
|
1767 $("#brew_fermenter_tcloss").val(dataRecord.brew_fermenter_tcloss); |
|
1768 } |
|
1769 dataRecord.brew_fermenter_volume = aboil_volume - dataRecord.brew_fermenter_tcloss + dataRecord.brew_fermenter_extrawater; |
|
1770 $("#brew_fermenter_volume").val(dataRecord.brew_fermenter_volume); |
|
1771 // Estimated needed sparge water corrected for the temperature. |
|
1772 spoelw = (dataRecord.boil_size - mash_infuse + (mashkg * my_grain_absorbtion) + dataRecord.eq_lauter_deadspace) * 1.03; |
|
1773 $("#brew_sparge_est").val(spoelw); |
|
1774 // Calculate SG in fermenter |
|
1775 ogx = dataRecord.brew_aboil_sg; |
|
1776 if (ogx < 1.002) |
|
1777 ogx = aboil_sg; |
|
1778 topw = dataRecord.brew_fermenter_extrawater; |
|
1779 |
|
1780 if (dataRecord.brew_fermenter_volume > 0) { |
|
1781 sug = sg_to_plato(ogx) * dataRecord.brew_fermenter_volume * ogx / 100; //kg of sugar in |
|
1782 sug += addedS; //kg |
|
1783 |
|
1784 if ((dataRecord.brew_fermenter_volume * ogx + addedmass) > 0) { |
|
1785 pt = 100 * sug / (dataRecord.brew_fermenter_volume * ogx + addedmass + topw); |
|
1786 dataRecord.brew_fermenter_sg = Round(plato_to_sg(pt),4); |
|
1787 $("#brew_fermenter_sg").val(dataRecord.brew_fermenter_sg); |
|
1788 // color |
|
1789 if (dataRecord.color_method == 4) { |
|
1790 dataRecord.brew_fermenter_color = Math.round(((pt / 8.6) * colorn) + (dataRecord.boil_time / 60)); |
|
1791 } else if (dataRecord.color_method == 3) { |
|
1792 dataRecord.brew_fermenter_color = Math.round((4.46 * bv * sr) / (aboil_volume + topw) * colorh); |
|
1793 } else { |
|
1794 cw = colort / (aboil_volume + topw) * 8.34436; |
|
1795 dataRecord.brew_fermenter_color = kw_to_ebc(dataRecord.color_method, cw); |
|
1796 } |
|
1797 $("#brew_fermenter_color").val(dataRecord.brew_fermenter_color); |
|
1798 scolor = ebc_to_color(dataRecord.brew_fermenter_color); |
|
1799 $("#bcolorf").show(); |
|
1800 document.getElementById("bcolorf").style.background = scolor; |
|
1801 } |
|
1802 } else { |
|
1803 // Negative volume |
|
1804 dataRecord.brew_fermenter_sg = dataRecord.brew_fermenter_color = 0; |
|
1805 $("#brew_fermenter_sg").val(0); |
|
1806 $("#brew_fermenter_color").val(0); |
|
1807 $("#bcolorf").hide(); |
|
1808 } |
|
1809 |
|
1810 // Color of the wort |
|
1811 if (dataRecord.color_method == 4) { |
|
1812 color = Math.round(((sg_to_plato(dataRecord.est_og) / 8.6) * colorn) + (dataRecord.boil_time / 60)); |
|
1813 } else if (dataRecord.color_method == 3) { // Hans Halberstadt |
|
1814 color = Math.round((4.46 * bv * sr) / parseFloat(dataRecord.batch_size) * colorh); |
|
1815 } else { |
|
1816 cw = colort / parseFloat(dataRecord.batch_size) * 8.34436; |
|
1817 color = kw_to_ebc(dataRecord.color_method, cw); |
|
1818 } |
|
1819 dataRecord.est_color = color; |
|
1820 $('#est_color').val(color); |
|
1821 $('#est_color2').val(color); |
|
1822 scolor = ebc_to_color(color); |
|
1823 document.getElementById("bcolor").style.background= scolor; |
|
1824 document.getElementById("bcolor2").style.background= scolor; |
|
1825 |
|
1826 // Progress bars |
|
1827 pmalts = mashkg / dataRecord.eq_mash_max * 100; |
|
1828 $("#perc_malts").jqxProgressBar('val', pmalts); |
|
1829 $("#perc_sugars").jqxProgressBar('val', psugar); |
|
1830 $("#perc_cara").jqxProgressBar('val', pcara); |
|
1831 calcStage(); |
|
1832 |
|
1833 // Calculate estimated svg. |
|
1834 svg = 0; // default. |
|
1835 initcells = 0; |
|
1836 rows = $('#yeastGrid').jqxGrid('getrows'); |
|
1837 for (i = 0; i < rows.length; i++) { |
|
1838 row = rows[i]; |
|
1839 if (row.y_use == 0) { // Primary |
|
1840 if (parseFloat(row.y_attenuation) > svg) |
|
1841 svg = parseFloat(row.y_attenuation); // Take the highest if multiple yeasts. |
|
1842 if (row.y_form == 0) |
|
1843 initcells += (parseFloat(row.y_cells) / 1000000000) * parseFloat(row.y_amount) * (dataRecord.starter_viability / 100); |
|
1844 else |
|
1845 initcells += (parseFloat(row.y_cells) / 1000000) * parseFloat(row.y_amount); |
|
1846 } |
|
1847 // TODO: brett in secondary ?? |
|
1848 if ((((dataRecord.inventory_reduced <= 3) && (row.y_use == 0)) || // Primary |
|
1849 ((dataRecord.inventory_reduced <= 4) && (row.y_use == 1)) || // Secondary |
|
1850 ((dataRecord.inventory_reduced <= 5) && (row.y_use == 2)) || // Tertiary |
|
1851 ((dataRecord.inventory_reduced <= 6) && (row.y_use == 3))) && // Bottle |
|
1852 (row.y_inventory < row.y_amount)) { |
|
1853 ok_yeasts = 0; |
|
1854 } |
|
1855 } |
|
1856 calcSupplies(); |
|
1857 if (svg == 0) |
|
1858 svg = 77; |
|
1859 |
|
1860 if ((mashkg > 0) && (mash_infuse > 0) && (mashtime > 0) && (mashtemp > 0)) { |
|
1861 dataRecord.est_fg = estimate_fg(psugar, pcara, mash_infuse / mashkg, mashtime, mashtemp, svg, dataRecord.est_og); |
|
1862 } else { |
|
1863 dataRecord.est_fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, dataRecord.est_og); |
|
1864 } |
|
1865 $('#est_fg').val(dataRecord.est_fg); |
|
1866 $('#est_fg2').val(dataRecord.est_fg); |
|
1867 $('#est_fg3').val(dataRecord.est_fg); |
|
1868 fig = dataRecord.est_fg; |
|
1869 |
|
1870 dataRecord.est_abv = abvol(dataRecord.est_og, dataRecord.est_fg); |
|
1871 $("#est_abv").val(dataRecord.est_abv); |
|
1872 $("#est_abv2").val(dataRecord.est_abv); |
|
1873 |
|
1874 // Calculate the final svg if available use the real value. |
|
1875 if ((dataRecord.stage >= 6) && (dataRecord.fg > 0.990) && (dataRecord.fg < dataRecord.brew_fermenter_sg)) { |
|
1876 svg = 100 * (dataRecord.brew_fermenter_sg - dataRecord.fg) / (dataRecord.brew_fermenter_sg - 1); |
|
1877 org = dataRecord.brew_fermenter_sg; |
|
1878 fig = dataRecord.fg; |
|
1879 } |
|
1880 |
|
1881 $("#yeast_cells").val(initcells); |
|
1882 $("#need_cells").val(getNeededYeastCells()); |
|
1883 |
|
1884 // Calculate the calories in kcal/l (from brouwhulp) |
|
1885 alc = 1881.22 * fig * (org - fig) / (1.775 - org); |
|
1886 sug = 3550 * fig * (0.1808 * org + 0.8192 * fig - 1.0004); |
|
1887 $("#kcal").val(Math.round((alc + sug) / (12 * 0.0295735296))); |
|
1888 }; |
|
1889 |
|
1890 function calcMash() { |
|
1891 |
|
1892 var infused = 0, i, row; |
|
1893 |
|
1894 if (!(rows = $('#mashGrid').jqxGrid('getrows'))) |
|
1895 return; |
|
1896 if (mashkg == 0) |
|
1897 return; |
|
1898 |
|
1899 for (i = 0; i < rows.length; i++) { |
|
1900 row = $("#mashGrid").jqxGrid('getrowdata', i); |
|
1901 if (row.step_type == 0) // Infusion |
|
1902 infused += row.step_infuse_amount; |
|
1903 $("#mashGrid").jqxGrid('setcellvalue', i, "step_thickness", infused / mashkg); |
|
1904 } |
|
1905 } |
|
1906 |
|
1907 /* |
|
1908 * Change OG of recipe but keep the water volumes. |
|
1909 */ |
|
1910 function calcFermentablesFromOG(OG) { |
|
1911 |
|
1912 console.log("calcFermentablesFromOG("+OG+")"); |
|
1913 var amount, row, d, i, sug, tot = 0, totmass = 0, rowscount, efficiency = parseFloat($("#efficiency").jqxNumberInput('decimal')); |
|
1914 sug = sg_to_plato(OG) * parseFloat($("#batch_size").jqxNumberInput('decimal')) * OG / 100; //total amount of sugars in kg |
|
1915 rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
|
1916 |
|
1917 for (i = 0; i < rowscount; i++) { |
|
1918 row = $("#fermentableGrid").jqxGrid('getrowdata', i); |
|
1919 if (row.f_added < 4) { |
|
1920 d = row.f_percentage / 100 * (row.f_yield / 100) * (1 - row.f_moisture / 100); |
|
1921 if (row.f_added == 0) // Mash |
|
1922 d = efficiency / 100 * d; |
|
1923 tot += d; |
|
1924 } |
|
1925 } |
|
1926 if (tot) |
|
1927 totmass = Round(sug / tot,3); |
|
1928 |
|
1929 if (totmass) { |
|
1930 for (i = 0; i < rowscount; i++) { |
|
1931 row = $("#fermentableGrid").jqxGrid('getrowdata', i); |
|
1932 if (row.f_added < 4) { |
|
1933 amount = Math.round(row.f_percentage * 10 * totmass) / 1000; |
|
1934 $("#fermentableGrid").jqxGrid('setcellvalue', i, "f_amount", amount); |
|
1935 } |
|
1936 } |
|
1937 } |
|
1938 }; |
|
1939 |
|
1940 function getNeededYeastCells() { |
|
1941 |
|
1942 var plato, volume, sg = dataRecord.brew_fermenter_sg; |
|
1943 if (sg <= 1.0001 && dataRecord.fg > 1.000) |
|
1944 sg = dataRecord.fg; |
|
1945 else if (sg <= 1.0001) |
|
1946 sg = dataRecord.est_og; |
|
1947 plato = sg_to_plato(sg); |
|
1948 |
|
1949 volume = dataRecord.brew_fermenter_volume; |
|
1950 if (volume <= 0) |
|
1951 volume = dataRecord.batch_size - dataRecord.eq_trub_chiller_loss; |
|
1952 |
|
1953 return pitchrate * volume * plato; |
|
1954 } |
|
1955 |
|
1956 function hopFlavourContribution(bt, vol, use, amount) { |
|
1957 var result; |
|
1958 |
|
1959 if (use == 1) { // First wort |
|
1960 result = 0.15; // assume 15% flavourcontribution for fwh |
|
1961 } else if (bt > 50) { |
|
1962 result = 0.10; // assume 10% flavourcontribution as a minimum |
|
1963 } else { |
|
1964 result = 15.25 / (6 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 21) /6, 2)); |
|
1965 if (result < 0.10) |
|
1966 result = 0.10; // assume 10% flavourcontribution as a minimum |
|
1967 } |
|
1968 return (result * amount * 1000) / vol; |
|
1969 } |
|
1970 |
|
1971 function hopAromaContribution(bt, vol, use, amount) { |
|
1972 var result = 0; |
|
1973 |
|
1974 if (use == 5) { // Dry hop |
|
1975 result = 1.33; |
|
1976 } else if (bt > 20) { |
|
1977 result = 0; |
|
1978 } else if (bt > 7.5) { |
|
1979 result = 10.03 / (4 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 7.5) /4, 2)); |
|
1980 } else if (use == 2) { // Boil |
|
1981 result = 1; |
|
1982 } else if (use == 3) { // Aroma |
|
1983 result = 1.2; |
|
1984 } else if (use == 4) { // Whirlpool |
|
1985 result = 1.2; |
|
1986 } |
|
1987 return (result * amount * 1000) / vol; |
|
1988 } |
|
1989 |
|
1990 function calcIBUs() { |
|
1991 var total_ibus = 0, ferm_ibus = 0, rows = {}, i, row; |
|
1992 hop_aroma = hop_flavour = 0; |
|
1993 if (!(rows = $('#hopGrid').jqxGrid('getrows'))) { |
|
1994 return; |
|
1995 } |
|
1996 ok_hops = 1; |
|
1997 for (i = 0; i < rows.length; i++) { |
|
1998 row = rows[i]; |
|
1999 total_ibus += toIBU(row.h_useat, row.h_form, preboil_sg, parseFloat(dataRecord.batch_size), |
|
2000 parseFloat(row.h_amount), parseFloat(row.h_time), parseFloat(row.h_alpha), dataRecord.ibu_method); |
|
2001 ferm_ibus += toIBU(row.h_useat, row.h_form, preboil_sg, |
|
2002 parseFloat(dataRecord.brew_fermenter_volume) + parseFloat(dataRecord.brew_fermenter_tcloss), |
|
2003 parseFloat(row.h_amount), parseFloat(row.h_time), parseFloat(row.h_alpha), dataRecord.ibu_method); |
|
2004 hop_flavour += hopFlavourContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size), |
|
2005 row.h_useat, parseFloat(row.h_amount)); |
|
2006 hop_aroma += hopAromaContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size), |
|
2007 row.h_useat, parseFloat(row.h_amount)); |
|
2008 if ((((dataRecord.inventory_reduced <= 2) && (row.h_useat <= 4)) || // Mash, FW, Boil, Aroma, Whirlpool |
|
2009 ((dataRecord.inventory_reduced <= 6) && (row.h_useat == 5))) && // Dry-hop |
|
2010 (row.h_inventory < row.h_amount)) |
|
2011 ok_hops = 0; |
|
2012 } |
|
2013 total_ibus = Math.round(total_ibus * 10) / 10; |
|
2014 ferm_ibus = Math.round(ferm_ibus * 10) / 10; |
|
2015 hop_flavour = Math.round(hop_flavour * 1000 / 5) / 10; |
|
2016 hop_aroma = Math.round(hop_aroma * 1000 / 6) / 10; |
|
2017 if (hop_flavour > 100) |
|
2018 hop_flavour = 100; |
|
2019 if (hop_aroma > 100) |
|
2020 hop_aroma = 100; |
|
2021 console.log("calcIBUs(): " + total_ibus + " flavour: " + hop_flavour + " aroma: " + hop_aroma+" fermenter:"+ferm_ibus+" supplies:"+ok_hops); |
|
2022 dataRecord.est_ibu = total_ibus; |
|
2023 $('#est_ibu').val(total_ibus); |
|
2024 $('#est_ibu2').val(total_ibus); |
|
2025 $("#hop_flavour").jqxProgressBar('val', hop_flavour); |
|
2026 $("#hop_aroma").jqxProgressBar('val', hop_aroma); |
|
2027 $("#brew_fermenter_ibu").val(ferm_ibus); |
|
2028 calcStage(); |
|
2029 calcSupplies(); |
|
2030 }; |
|
2031 |
|
2032 /* |
|
2033 * http://braukaiser.com/blog/blog/2012/11/03/estimating-yeast-growth/ |
|
2034 * |
|
2035 * stype: 0=stirred, 1=shaken, 2=simple |
|
2036 * totcells: initial cells |
|
2037 * egrams: gram extract |
|
2038 */ |
|
2039 function getGrowthRate(stype, totcells, egrams){ |
|
2040 |
|
2041 /* Cells per grams extract (B/g) */ |
|
2042 var cpe = totcells / egrams; |
|
2043 |
|
2044 if (cpe > 3.5) |
|
2045 return 0; // no growth |
|
2046 if (stype == 2) |
|
2047 return 0.4; // simple starter |
|
2048 if (stype == 1) |
|
2049 return 0.62; // shaken starter |
|
2050 if (cpe <= 1.4) // stirred starter |
|
2051 return 1.4; |
|
2052 return 2.33 - (.67 * cpe ); |
|
2053 }; |
|
2054 |
|
2055 function calcStep(svol, stype, start) { |
|
2056 |
|
2057 var gperpoint = 2.72715, //number of grams of extract per point of starter gravity per liter |
|
2058 prate = start/svol * 1000, |
|
2059 irate = Round(prate,1), |
|
2060 egrams = (dataRecord.starter_sg - 1) * svol * gperpoint; |
|
2061 grate = getGrowthRate(stype, start, egrams), |
|
2062 ncells = Round(egrams * grate, 1), |
|
2063 totcells = parseFloat(ncells) + start; |
|
2064 |
|
2065 console.log("svol:"+svol+" start:"+start+" irate:"+irate+" egrams:"+egrams+" grate:"+grate+" ncells:"+ncells); |
|
2066 return { |
|
2067 svol: svol, |
|
2068 irate: irate, |
|
2069 prate: Round(prate,1), |
|
2070 ncells: ncells, |
|
2071 totcells: totcells, |
|
2072 growf: Round(ncells/start, 2) |
|
2073 }; |
|
2074 } |
|
2075 |
|
2076 /* |
|
2077 * Calculate all starter steps. |
|
2078 * stype: final starter type: 0 = stirred, 1 = shaked, 2 = simple. |
|
2079 * start: initial cells in billions |
|
2080 * needed: needed cells in billions |
|
2081 * |
|
2082 * result: all values updated. |
|
2083 */ |
|
2084 function calcSteps(stype, start, needed) { |
|
2085 |
|
2086 var uvols = [ 20, 40, 60, 80, 100, 150, 200, 250, 375, 500, 625, 750, 875, 1000, 1250, 1500, 2000, 2500, 3000, 4000, 5000 ], |
|
2087 mvols = uvols.length, svol = 0, lasti = 0, result = {}, i; |
|
2088 |
|
2089 /* |
|
2090 * If no values are set, auto calculate the starter. |
|
2091 */ |
|
2092 if ((parseFloat($("#prop1_volume").jqxNumberInput('decimal')) + parseFloat($("#prop2_volume").jqxNumberInput('decimal')) + |
|
2093 parseFloat($("#prop3_volume").jqxNumberInput('decimal')) + parseFloat($("#prop4_volume").jqxNumberInput('decimal'))) == 0) { |
|
2094 // clear by default |
|
2095 for (i = 1; i < 5; i++) { |
|
2096 $("#prop"+i+"_type").hide(); |
|
2097 $("#r"+i+"_pmpt").show(); |
|
2098 $("#prop"+i+"_type").val(stype); |
|
2099 $("#prop"+i+"_volume").hide(); |
|
2100 $("#prop"+i+"_volume").val(0); |
|
2101 $("#prop"+i+"_irate").hide(); |
|
2102 $("#prop"+i+"_ncells").hide(); |
|
2103 $("#prop"+i+"_tcells").hide(); |
|
2104 $("#prop"+i+"_growf").hide(); |
|
2105 } |
|
2106 if (start > needed) { |
|
2107 return; // no starter needed |
|
2108 } |
|
2109 $("#prop1_type").show(); |
|
2110 $("#r1_pmpt").hide(); |
|
2111 $("#prop1_volume").show(); |
|
2112 $("#prop1_irate").show(); |
|
2113 $("#prop1_ncells").show(); |
|
2114 $("#prop1_tcells").show(); |
|
2115 $("#prop1_growf").show(); |
|
2116 for (i = lasti; i <= mvols; i++) { |
|
2117 lasti = i; |
|
2118 svol = uvols[lasti]; |
|
2119 result = calcStep(svol, stype, start); |
|
2120 if (result.irate < 25) { |
|
2121 // inocculation rate too low, backup one step and break out. |
|
2122 lasti = i - 1; |
|
2123 svol = uvols[lasti]; |
|
2124 result = calcStep(svol, stype, start); |
|
2125 break; |
|
2126 } |
|
2127 if (result.totcells > needed || i == mvols) { // hit the target or loops done |
|
2128 break; |
|
2129 } |
|
2130 } |
|
2131 $("#prop1_volume").val(result.svol / 1000); // to liters |
|
2132 $("#prop1_irate").val(result.prate); |
|
2133 $("#prop1_ncells").val(result.ncells); |
|
2134 $("#prop1_tcells").val(result.totcells); |
|
2135 $("#prop1_growf").val(result.growf); |
|
2136 if (result.totcells > needed) |
|
2137 return; // hit the target |
|
2138 |
|
2139 // second stage |
|
2140 $("#r2_pmpt").hide(); |
|
2141 $("#prop2_type").val(stype); |
|
2142 $("#prop2_type").show(); |
|
2143 $("#prop2_volume").show(); |
|
2144 $("#prop2_irate").show(); |
|
2145 $("#prop2_ncells").show(); |
|
2146 $("#prop2_tcells").show(); |
|
2147 $("#prop2_growf").show(); |
|
2148 for (i = lasti; i <= mvols; i++) { |
|
2149 lasti = i; |
|
2150 svol = uvols[lasti]; |
|
2151 result = calcStep(svol, stype, $("#prop1_tcells").val()); |
|
2152 if (result.irate < 25) { |
|
2153 lasti = i - 1; |
|
2154 svol = uvols[lasti]; |
|
2155 result = calcStep(svol, stype, $("#prop1_tcells").val()); |
|
2156 break; |
|
2157 } |
|
2158 if (result.totcells > needed || i == mvols) { // hit the target or loops done |
|
2159 break; |
|
2160 } |
|
2161 } |
|
2162 $("#prop2_volume").val(result.svol / 1000); // to liters |
|
2163 $("#prop2_irate").val(result.prate); |
|
2164 $("#prop2_ncells").val(result.ncells); |
|
2165 $("#prop2_tcells").val(result.totcells); |
|
2166 $("#prop2_growf").val(result.growf); |
|
2167 if (result.totcells > needed) |
|
2168 return; // hit the target |
|
2169 |
|
2170 // third stage |
|
2171 $("#r3_pmpt").hide(); |
|
2172 $("#prop3_type").val(stype); |
|
2173 $("#prop3_type").show(); |
|
2174 $("#prop3_volume").show(); |
|
2175 $("#prop3_irate").show(); |
|
2176 $("#prop3_ncells").show(); |
|
2177 $("#prop3_tcells").show(); |
|
2178 $("#prop3_growf").show(); |
|
2179 for (i = lasti; i <= mvols; i++) { |
|
2180 lasti = i; |
|
2181 svol = uvols[lasti]; |
|
2182 result = calcStep(svol, stype, $("#prop2_tcells").val()); |
|
2183 if (result.irate < 25) { |
|
2184 lasti = i - 1; |
|
2185 svol = uvols[lasti]; |
|
2186 result = calcStep(svol, stype, $("#prop2_tcells").val()); |
|
2187 break; |
|
2188 } |
|
2189 if (result.totcells > needed || i == mvols) { // hit the target or loops done |
|
2190 break; |
|
2191 } |
|
2192 } |
|
2193 $("#prop3_volume").val(result.svol / 1000); // to liters |
|
2194 $("#prop3_irate").val(result.prate); |
|
2195 $("#prop3_ncells").val(result.ncells); |
|
2196 $("#prop3_tcells").val(result.totcells); |
|
2197 $("#prop3_growf").val(result.growf); |
|
2198 if (result.totcells > needed) |
|
2199 return; // hit the target |
|
2200 |
|
2201 // fourth stage |
|
2202 $("#r4_pmpt").hide(); |
|
2203 $("#prop4_type").val(stype); |
|
2204 $("#prop4_type").show(); |
|
2205 $("#prop4_volume").show(); |
|
2206 $("#prop4_irate").show(); |
|
2207 $("#prop4_ncells").show(); |
|
2208 $("#prop4_tcells").show(); |
|
2209 $("#prop4_growf").show(); |
|
2210 for (i = lasti; i <= mvols; i++) { |
|
2211 lasti = i; |
|
2212 svol = uvols[lasti]; |
|
2213 result = calcStep(svol, stype, $("#prop3_tcells").val()); |
|
2214 if (result.totcells > needed || i == mvols) { // hit the target or loops done |
|
2215 $("#prop4_volume").val(result.svol / 1000); // to liters |
|
2216 $("#prop4_irate").val(result.prate); |
|
2217 $("#prop4_ncells").val(result.ncells); |
|
2218 $("#prop4_tcells").val(result.totcells); |
|
2219 $("#prop4_growf").val(result.growf); |
|
2220 return; |
|
2221 } |
|
2222 } |
|
2223 } else { |
|
2224 // recalculate |
|
2225 if (dataRecord.prop1_volume > 0) { |
|
2226 $("#r1_pmpt").hide(); |
|
2227 $("#prop1_type").show(); |
|
2228 $("#prop1_volume").show(); |
|
2229 $("#prop1_irate").show(); |
|
2230 $("#prop1_ncells").show(); |
|
2231 $("#prop1_tcells").show(); |
|
2232 $("#prop1_growf").show(); |
|
2233 result = calcStep($("#prop1_volume").val() * 1000, dataRecord.prop1_type, start); |
|
2234 $("#prop1_irate").val(result.prate); |
|
2235 $("#prop1_ncells").val(result.ncells); |
|
2236 $("#prop1_tcells").val(result.totcells); |
|
2237 $("#prop1_growf").val(result.growf); |
|
2238 } |
|
2239 if (dataRecord.prop2_volume > 0) { |
|
2240 $("#r2_pmpt").hide(); |
|
2241 $("#prop2_type").show(); |
|
2242 $("#prop2_volume").show(); |
|
2243 $("#prop2_irate").show(); |
|
2244 $("#prop2_ncells").show(); |
|
2245 $("#prop2_tcells").show(); |
|
2246 $("#prop2_growf").show(); |
|
2247 result = calcStep($("#prop2_volume").val() * 1000, dataRecord.prop2_type, $("#prop1_tcells").val()); |
|
2248 $("#prop2_irate").val(result.prate); |
|
2249 $("#prop2_ncells").val(result.ncells); |
|
2250 $("#prop2_tcells").val(result.totcells); |
|
2251 $("#prop2_growf").val(result.growf); |
|
2252 } |
|
2253 if (dataRecord.prop3_volume > 0) { |
|
2254 $("#r3_pmpt").hide(); |
|
2255 $("#prop3_type").show(); |
|
2256 $("#prop3_volume").show(); |
|
2257 $("#prop3_irate").show(); |
|
2258 $("#prop3_ncells").show(); |
|
2259 $("#prop3_tcells").show(); |
|
2260 $("#prop3_growf").show(); |
|
2261 result = calcStep($("#prop3_volume").val() * 1000, dataRecord.prop3_type, $("#prop2_tcells").val()); |
|
2262 $("#prop3_irate").val(result.prate); |
|
2263 $("#prop3_ncells").val(result.ncells); |
|
2264 $("#prop3_tcells").val(result.totcells); |
|
2265 $("#prop3_growf").val(result.growf); |
|
2266 } |
|
2267 if (dataRecord.prop4_volume > 0) { |
|
2268 $("#r4_pmpt").hide(); |
|
2269 $("#prop4_type").show(); |
|
2270 $("#prop4_volume").show(); |
|
2271 $("#prop4_irate").show(); |
|
2272 $("#prop4_ncells").show(); |
|
2273 $("#prop4_tcells").show(); |
|
2274 $("#prop4_growf").show(); |
|
2275 result = calcStep($("#prop4_volume").val() * 1000, dataRecord.prop4_type, $("#prop3_tcells").val()); |
|
2276 $("#prop4_irate").val(result.prate); |
|
2277 $("#prop4_ncells").val(result.ncells); |
|
2278 $("#prop4_tcells").val(result.totcells); |
|
2279 $("#prop4_growf").val(result.growf); |
|
2280 } |
|
2281 |
|
2282 } |
|
2283 } |
|
2284 |
|
2285 function calcYeast() { |
|
2286 |
|
2287 // Calculate needed cells. |
|
2288 var plato, volume, rows, rowscount, row, i, needed, use_cells, |
|
2289 sg = dataRecord.brew_fermenter_sg; |
|
2290 if (sg <= 1.0001 && dataRecord.fg > 1.000) |
|
2291 sg = dataRecord.fg; |
|
2292 else if (sg <= 1.0001) |
|
2293 sg = dataRecord.est_og; |
|
2294 plato = sg_to_plato(sg); |
|
2295 |
|
2296 volume = dataRecord.brew_fermenter_volume; |
|
2297 if (volume > 0) { |
|
2298 if (dataRecord.brew_fermenter_extrawater > 0) |
|
2299 volume += dataRecord.brew_fermenter_extrawater; |
|
2300 } else { |
|
2301 volume = dataRecord.batch_size - dataRecord.eq_trub_chiller_loss; |
|
2302 } |
|
2303 |
|
2304 // Also in calcFermentables() |
|
2305 $("#yeast_cells").val(initcells); |
|
2306 |
|
2307 if (!(rows = $('#yeastGrid').jqxGrid('getrows'))) { |
|
2308 return; // grid not yet loaded. |
|
2309 } |
|
2310 rowscount = $("#yeastGrid").jqxGrid('getdatainformation').rowscount; |
|
2311 if (rowscount == 0) |
|
2312 return; // no yeast in recipe |
|
2313 |
|
2314 for (i = 0; i < rowscount; i++) { |
|
2315 row = $("#yeastGrid").jqxGrid('getrowdata', i); |
|
2316 if (row.y_use == 0) { // primary |
|
2317 // pitchrate see https://www.brewersfriend.com/yeast-pitch-rate-and-starter-calculator/ |
|
2318 // and http://braukaiser.com/blog/blog/2012/11/03/estimating-yeast-growth/ |
|
2319 pitchrate = 0.75; |
|
2320 if (dataRecord.est_og > 1.060) |
|
2321 pitchrate = 1.0; |
|
2322 // if (dataRecord.est_og > 1.076) |
|
2323 // pitchrate = 1.25; // Wyeast labs. http://www.wyeastlab.com/hb_pitchrates.cfm |
|
2324 if (row.y_type == 0) // lager yeast |
|
2325 pitchrate *= 2; |
|
2326 |
|
2327 if (row.y_form == 1) { // dry yeast |
|
2328 } else { // possible starter needed |
|
2329 } |
|
2330 } |
|
2331 } |
|
2332 needed = pitchrate * volume * plato; |
|
2333 console.log("calcYeast() pitchrate:"+pitchrate+" start:"+initcells+" needed:"+needed+" volume:"+volume); |
|
2334 $("#need_cells").val(needed); |
|
2335 use_cells = initcells; |
|
2336 |
|
2337 if (dataRecord.starter_enable) { |
|
2338 calcSteps(dataRecord.starter_type, initcells, needed); |
|
2339 |
|
2340 for (i = 1; i < 5; i++) { |
|
2341 $("#r"+i+"_irate").html(""); |
|
2342 $("#r"+i+"_growf").html(""); |
|
2343 $("#r"+i+"_tcells").html(""); |
|
2344 if (parseFloat($("#prop"+i+"_volume").val()) > 0) { |
|
2345 if ((parseFloat($("#prop"+i+"_irate").val()) < 25) || (parseFloat($("#prop"+i+"_irate").val()) > 100)) { |
|
2346 $("#r"+i+"_irate").html("<img src='images/dialog-error.png'>"); |
|
2347 } else { |
|
2348 $("#r"+i+"_irate").html("<img src='images/dialog-ok-apply.png'>"); |
|
2349 } |
|
2350 if (parseFloat($("#prop"+i+"_growf").val()) < 1) |
|
2351 $("#r"+i+"_growf").html("<img src='images/dialog-error.png'>"); |
|
2352 if (($("#prop"+i+"_type").val() > 0) && (parseFloat($("#prop"+i+"_growf").val()) > 3)) |
|
2353 $("#r"+i+"_growf").html("<img src='images/dialog-error.png'>"); |
|
2354 if (parseFloat($("#prop"+i+"_tcells").val()) > needed) |
|
2355 $("#r"+i+"_tcells").html("<img src='images/dialog-ok-apply.png'>"); |
|
2356 use_cells = parseFloat($("#prop"+i+"_tcells").val()); |
|
2357 } else { |
|
2358 $("#r"+i+"_irate").html(""); |
|
2359 } |
|
2360 } |
|
2361 } |
|
2362 $("#plato_cells").val(parseFloat(use_cells / (volume * plato) )); |
|
2363 }; |
|
2364 |
|
2365 function adjustHops(factor) { |
|
2366 |
|
2367 console.log("adjustHops("+factor+")"); |
|
2368 var row, i, amount, rowscount = $("#hopGrid").jqxGrid('getdatainformation').rowscount; |
|
2369 if (rowscount == 0) |
|
2370 return; |
|
2371 for (i = 0; i < rowscount; i++) { |
|
2372 row = $("#hopGrid").jqxGrid('getrowdata', i); |
|
2373 amount = row.h_amount * factor; |
|
2374 $("#hopGrid").jqxGrid('setcellvalue', i, "h_amount", amount); |
|
2375 } |
|
2376 }; |
|
2377 |
|
2378 function calcMiscs() { |
|
2379 |
|
2380 ok_miscs = 1; |
|
2381 var row, i, rowscount = $("#miscGrid").jqxGrid('getdatainformation').rowscount; |
|
2382 if (rowscount == 0) |
|
2383 return; |
|
2384 for (i = 0; i < rowscount; i++) { |
|
2385 row = $("#miscGrid").jqxGrid('getrowdata', i); |
|
2386 if ((((dataRecord.inventory_reduced <= 2) && (row.m_use_use <= 2)) || // Starter, Mash, Boil |
|
2387 ((dataRecord.inventory_reduced <= 3) && (row.m_use_use == 3)) || // Primary |
|
2388 ((dataRecord.inventory_reduced <= 5) && (row.m_use_use == 4)) || // Secondary, Teriary |
|
2389 ((dataRecord.inventory_reduced <= 6) && (row.m_use_use == 5))) && // Bottle |
|
2390 (row.m_inventory < row.m_amount)) { |
|
2391 ok_miscs = 0; |
|
2392 } |
|
2393 } |
|
2394 calcSupplies(); |
|
2395 }; |
|
2396 |
|
2397 function adjustMiscs(factor) { |
|
2398 |
|
2399 console.log("adjustMiscs("+factor+")"); |
|
2400 var row, i, amount, rowscount = $("#miscGrid").jqxGrid('getdatainformation').rowscount; |
|
2401 if (rowscount == 0) |
|
2402 return; |
|
2403 for (i = 0; i < rowscount; i++) { |
|
2404 row = $("#miscGrid").jqxGrid('getrowdata', i); |
|
2405 amount = row.m_amount * factor; |
|
2406 $("#miscGrid").jqxGrid('setcellvalue', i, "m_amount", amount); |
|
2407 switch (row.m_name) { |
|
2408 case 'CaCl2': $("#wa_cacl2").val(row.m_amount * 1000); |
|
2409 break; |
|
2410 case 'CaSO4': $("#wa_caso4").val(row.m_amount * 1000); |
|
2411 break; |
|
2412 case 'MgSO4': $("#wa_mgso4").val(row.m_amount * 1000); |
|
2413 break; |
|
2414 case 'NaCl': $("#wa_nacl").val(row.m_amount * 1000); |
|
2415 break; |
|
2416 case 'Melkzuur': |
|
2417 case 'Zoutzuur': |
|
2418 case 'Fosforzuur': |
|
2419 case 'Zwavelzuur': $("#wa_acid").val(row.m_amount * 1000); |
|
2420 break; |
|
2421 case 'NaHCO3': |
|
2422 case 'Na2CO3': |
|
2423 case 'CaCO3': |
|
2424 case 'Ca(OH)2': $("#wa_base").val(row.m_amount * 1000); |
|
2425 break; |
|
2426 } |
|
2427 } |
|
2428 }; |
|
2429 |
|
2430 function adjustYeasts(factor) { |
|
2431 |
|
2432 console.log("adjustYeasts("+factor+")"); |
|
2433 var row, i, amount, rowscount = $("#yeastGrid").jqxGrid('getdatainformation').rowscount; |
|
2434 if (rowscount == 0) |
|
2435 return; |
|
2436 for (i = 0; i < rowscount; i++) { |
|
2437 row = $("#yeastGrid").jqxGrid('getrowdata', i); |
|
2438 if (row.y_form == 1) { // Only adjust dry yeast |
|
2439 amount = row.y_amount * factor; |
|
2440 $("#yeastGrid").jqxGrid('setcellvalue', i, "y_amount", amount); |
|
2441 } |
|
2442 } |
|
2443 calcYeast(); |
|
2444 }; |
|
2445 |
|
2446 function adjustWaters(factor) { |
|
2447 |
|
2448 console.log("adjustWaters("+factor+")"); |
|
2449 var amount, row, i, rowscount = $("#mashGrid").jqxGrid('getdatainformation').rowscount; |
|
2450 if (rowscount == 0) |
|
2451 return; |
|
2452 mash_infuse = 0; |
|
2453 for (i = 0; i < rowscount; i++) { |
|
2454 row = $("#mashGrid").jqxGrid('getrowdata', i); |
|
2455 if (row.step_type == 0) { // Infusion |
|
2456 amount = Round(row.step_infuse_amount * factor, 1); |
|
2457 $("#mashGrid").jqxGrid('setcellvalue', i, "step_infuse_amount", amount); |
|
2458 mash_infuse += amount; |
|
2459 } |
|
2460 } |
|
2461 if (dataRecord.w2_amount == 0) { |
|
2462 dataRecord.w1_amount = mash_infuse; |
|
2463 $("#w1_amount").val(mash_infuse); |
|
2464 } else { |
|
2465 dataRecord.w1_amount = (dataRecord.w1_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse; |
|
2466 dataRecord.w2_amount = (dataRecord.w2_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse; |
|
2467 $("#w1_amount").val(dataRecord.w1_amount); |
|
2468 $("#w2_amount").val(dataRecord.w2_amount); |
|
2469 } |
|
2470 $('#wg_amount').val(mash_infuse); |
|
2471 }; |
|
2472 |
|
2473 function calcMashEfficiency() { |
|
2474 var c, m; |
|
2475 if (parseFloat($("#brew_mash_sg").jqxNumberInput('decimal')) < 1.002) |
|
2476 return; |
|
2477 c = sg_to_plato(est_mash_sg); |
|
2478 m = sg_to_plato(parseFloat($("#brew_mash_sg").jqxNumberInput('decimal'))); |
|
2479 if (c > 0.5) |
|
2480 $("#brew_mash_efficiency").val(100 * m / c); |
|
2481 else |
|
2482 $("#brew_mash_efficiency").val(0); |
|
2483 }; |
|
2484 |
|
2485 function calcEfficiencyBeforeBoil() { |
|
2486 var m = 0, rows = {}, i, row, tot, result = 0; |
|
2487 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) { |
|
2488 return; // grid not yet loaded. |
|
2489 } |
|
2490 for (i = 0; i < rows.length; i++) { |
|
2491 row = rows[i]; |
|
2492 if (row.f_added == 0) { // Mash |
|
2493 m += row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100); |
|
2494 } |
|
2495 } |
|
2496 tot = sg_to_plato(dataRecord.brew_preboil_sg) * (dataRecord.brew_preboil_volume / 1.04) * dataRecord.brew_preboil_sg * 10 / 1000; |
|
2497 if (m > 0) |
|
2498 result = Round((tot / m * 100), 1); |
|
2499 if (result < 0) |
|
2500 result = 0; |
|
2501 $("#brew_preboil_efficiency").val(result); |
|
2502 } |
|
2503 |
|
2504 function calcEfficiencyAfterBoil() { |
|
2505 var m = 0, // Sugars added at mash |
|
2506 b = 0, // Sugars added at boil |
|
2507 rows = {}, i, row, tot, result = 0; |
|
2508 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) { |
|
2509 return; // grid not yet loaded. |
|
2510 } |
|
2511 for (i = 0; i < rows.length; i++) { |
|
2512 row = rows[i]; |
|
2513 if (row.f_added == 0) { // Mash |
|
2514 m += row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100); |
|
2515 } else if (row.f_added == 1) { // Boil |
|
2516 b += row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100); |
|
2517 } |
|
2518 } |
|
2519 tot = sg_to_plato(dataRecord.brew_aboil_sg) * (dataRecord.brew_aboil_volume / 1.04) * dataRecord.brew_aboil_sg * 10 / 1000; |
|
2520 tot -= b; // total sugars in wort minus added sugars. |
|
2521 if (m > 0) |
|
2522 result = Round((tot / m * 100), 1); |
|
2523 if (result < 0) |
|
2524 result = 0; |
|
2525 dataRecord.brew_aboil_efficiency = result; |
|
2526 $("#brew_aboil_efficiency").val(result); |
|
2527 |
|
2528 } |
|
2529 |
|
2530 function GetBUGU() { |
|
2531 var gu = (dataRecord.est_og - 1) * 1000; |
|
2532 if (gu > 0) |
|
2533 return dataRecord.est_ibu / gu; |
|
2534 else |
|
2535 return 0.5; |
|
2536 } |
|
2537 |
|
2538 function GetOptClSO4ratio() { |
|
2539 var BUGU = GetBUGU(); |
|
2540 return (-1.2 * BUGU + 1.4); |
|
2541 } |
|
2542 |
|
2543 function setWaterAgent(name, amount) { |
|
2544 var row, i, id, found = false, miscs, rows = $('#miscGrid').jqxGrid('getrows'); |
|
2545 if (amount == 0) { |
|
2546 for (i = 0; i < rows.length; i++) { |
|
2547 row = rows[i]; |
|
2548 if (row.m_name == name) { |
|
2549 id = $("#miscGrid").jqxGrid('getrowid', i); |
|
2550 $("#miscGrid").jqxGrid('deleterow', id); |
|
2551 } |
|
2552 } |
|
2553 } else { |
|
2554 for (i = 0; i < rows.length; i++) { |
|
2555 row = rows[i]; |
|
2556 if (row.m_name == name) { |
|
2557 found = true; |
|
2558 $("#miscGrid").jqxGrid('setcellvalue', i, 'm_amount', amount / 1000); |
|
2559 break; |
|
2560 } |
|
2561 } |
|
2562 if (! found) { |
|
2563 miscs = new $.jqx.dataAdapter(miscInvSource, { |
|
2564 loadComplete: function () { |
|
2565 var record, i, row = {}, records = miscs.records; |
|
2566 for (i = 0; i < records.length; i++) { |
|
2567 record = records[i]; |
|
2568 if (record.name == name) { |
|
2569 row["m_name"] = record.name; |
|
2570 row["m_amount"] = amount / 1000; |
|
2571 row["m_cost"] = record.cost; |
|
2572 row["m_type"] = record.type; |
|
2573 row["m_use_use"] = record.use_use; |
|
2574 row["m_time"] = 0; |
|
2575 row["m_amount_is_weight"] = record.amount_is_weight; |
|
2576 row["m_inventory"] = record.inventory; |
|
2577 row["m_avail"] = 1; |
|
2578 $("#miscGrid").jqxGrid('addrow', null, row); |
|
2579 } |
|
2580 } |
|
2581 } |
|
2582 }); |
|
2583 miscs.dataBind(); |
|
2584 return; |
|
2585 } |
|
2586 } |
|
2587 } |
|
2588 |
|
2589 function setRangeIndicator(ion, rangeCode) { |
|
2590 if ((rangeCode == "laag") || (rangeCode == "hoog")) |
|
2591 $("#wr_"+ion).html("<img src='images/dialog-error.png'><span style='vertical-align: top; font-size: 10px; font-style: italic;'>"+rangeCode + "</span>"); |
|
2592 else |
|
2593 $("#wr_"+ion).html("<img src='images/dialog-ok-apply.png'>"); |
|
2594 } |
|
2595 |
|
2596 function mix(v1, v2, c1, c2) { |
|
2597 if ((v1 + v2) > 0) { |
|
2598 return ((v1 * c1) + (v2 * c2)) / (v1 + v2); |
|
2599 } |
|
2600 return 0; |
|
2601 } |
|
2602 |
|
2603 // mg/l as CaCO3 |
|
2604 function ResidualAlkalinity(total_alkalinity, calcium, magnesium) { |
|
2605 return total_alkalinity - (calcium / 1.4 + magnesium / 1.7); |
|
2606 } |
|
2607 |
|
2608 function PartCO3(pH) { |
|
2609 var H = Math.pow(10, -pH); |
|
2610 return 100 * Ka1 * Ka2 / (H*H + H * Ka1 + Ka1 * Ka2); |
|
2611 } |
|
2612 |
|
2613 function PartHCO3(pH) { |
|
2614 var H = Math.pow(10, -pH); |
|
2615 return 100 * Ka1 * H / (H*H + H * Ka1 + Ka1 * Ka2); |
|
2616 } |
|
2617 |
|
2618 function Charge(pH) { |
|
2619 return (-2 * PartCO3(pH) - PartHCO3(pH)); |
|
2620 } |
|
2621 |
|
2622 //Z alkalinity is the amount of acid (in mEq/l) needed to bring water to the target pH (Z pH) |
|
2623 function ZAlkalinity(pHZ) { |
|
2624 var C43 = Charge(4.3), |
|
2625 Cw = Charge(parseFloat($("#wg_ph").jqxNumberInput('decimal'))), |
|
2626 Cz = Charge(pHZ), |
|
2627 DeltaCNaught = -C43+Cw, |
|
2628 CT = parseFloat($("#wg_total_alkalinity").jqxNumberInput('decimal')) / 50 / DeltaCNaught, |
|
2629 DeltaCZ = -Cz+Cw; |
|
2630 return CT * DeltaCZ; |
|
2631 } |
|
2632 |
|
2633 //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) |
|
2634 function ZRA(pHZ) { |
|
2635 |
|
2636 var Magn, Z, Calc = parseFloat($("#wg_calcium").jqxNumberInput('decimal')) / (MMCa / 2); |
|
2637 Magn = parseFloat($("#wg_magnesium").jqxNumberInput('decimal')) / (MMMg / 2); |
|
2638 Z = ZAlkalinity(pHZ); |
|
2639 return Z - (Calc / 3.5 + Magn / 7); |
|
2640 } |
|
2641 |
|
2642 function ProtonDeficit(pHZ) { |
|
2643 |
|
2644 var rows, i, C1, ebc, x, Result = ZRA(pHZ) * parseFloat($("#wg_amount").jqxNumberInput('decimal')); |
|
2645 // proton deficit for the grist |
|
2646 rows = $('#fermentableGrid').jqxGrid('getrows'); |
|
2647 for (i = 0; i < rows.length; i++) { |
|
2648 row = rows[i]; |
|
2649 if (row.f_added == 0 && row.f_graintype != 6) { // Added == Mash && graintype != No Malt |
|
2650 // Check if acid is required |
|
2651 C1 = 0; |
|
2652 if ((row.f_di_ph != 5.7) && ((row.f_acid_to_ph_57 < - 0.1) || (row.f_acid_to_ph_57 > 0.1))) { |
|
2653 C1 = row.f_acid_to_ph_57 / (row.f_di_ph - 5.7); |
|
2654 } else { |
|
2655 // If the acid_to_ph_5.7 is unknown from the maltster, guess the required acid. |
|
2656 ebc = row.f_color; |
|
2657 switch (row.f_graintype) { |
|
2658 case 0: // Base, Special, Kilned |
|
2659 case 3: |
|
2660 case 5: C1 = 0.014 * ebc - 34.192; |
|
2661 break; |
|
2662 case 2: C1 = -0.0597 * ebc - 32.457; // Crystal |
|
2663 break; |
|
2664 case 1: C1 = 0.0107 * ebc - 54.768; // Roast |
|
2665 break; |
|
2666 case 4: C1 = -149; // Sour malt |
|
2667 break; |
|
2668 } |
|
2669 } |
|
2670 x = C1 * (pHZ - row.f_di_ph); // AcidRequired(ZpH) |
|
2671 Result += x * row.f_amount; |
|
2672 } |
|
2673 } |
|
2674 return Result; |
|
2675 } |
|
2676 |
|
2677 function MashpH() { |
|
2678 var n = 0, pH = 5.4, deltapH = 0.001, deltapd = 0.1, pd = ProtonDeficit(pH); |
|
2679 while (((pd < -deltapd) || (pd > deltapd)) && (n < 2000)) { |
|
2680 n++; |
|
2681 if (pd < -deltapd) |
|
2682 pH -= deltapH; |
|
2683 else if (pd > deltapd) |
|
2684 pH += deltapH; |
|
2685 pd = ProtonDeficit(pH); |
|
2686 } |
|
2687 console.log("MashpH() n: "+n+" pH: "+pH); |
|
2688 return pH; |
|
2689 } |
|
2690 |
|
2691 function GetAcidSpecs(AT) { |
|
2692 switch(AT) { |
|
2693 case 0: return { // Melkzuur |
|
2694 pK1: 3.86, |
|
2695 pK2: 20, |
|
2696 pK3: 20, |
|
2697 MolWt: 90.08, |
|
2698 AcidSG: 1214, // 1214 1209 |
|
2699 AcidPrc: 0.88 // 0.88 0.80 |
|
2700 }; |
|
2701 case 1: return { // Zoutzuur |
|
2702 pK1: -7, |
|
2703 pK2: 20, |
|
2704 pK3: 20, |
|
2705 MolWt: 36.46, |
|
2706 AcidSG: 1142, |
|
2707 AcidPrc: 0.28 |
|
2708 }; |
|
2709 case 2: return { // Fosforzuur |
|
2710 pK1: 2.12, |
|
2711 pK2: 7.20, |
|
2712 pK3: 12.44, |
|
2713 MolWt: 98.00, |
|
2714 AcidSG: 1170, |
|
2715 AcidPrc: 0.25 |
|
2716 }; |
|
2717 case 3: return { // Zwavelzuur |
|
2718 pK1: -1, |
|
2719 pK2: 1.92, |
|
2720 pK3: 20, |
|
2721 MolWt: 98.07, |
|
2722 AcidSG: 1700, |
|
2723 AcidPrc: 0.93 |
|
2724 }; |
|
2725 } |
|
2726 } |
|
2727 |
|
2728 function calcWater() { |
|
2729 |
|
2730 console.log("calcWater()"); |
|
2731 var liters = 0, |
|
2732 calcium = 0, |
|
2733 magnesium = 0, |
|
2734 sodium = 0, |
|
2735 total_alkalinity = 0, |
|
2736 bicarbonate = 0, |
|
2737 chloride = 0, |
|
2738 sulfate = 0, |
|
2739 ph = 0, |
|
2740 RA = 0, |
|
2741 frac = 0, |
|
2742 TpH = 0, |
|
2743 protonDeficit = 0, |
|
2744 AT, BT, result, pK1, pK2, pK3, MolWt, AcidSG, AcidPrc, |
|
2745 r1d, r2d, f1d, f2d, f3d, |
|
2746 deltapH, deltapd, pd, n, |
|
2747 piCLSO4_low, piCLSO4_high, Res, |
|
2748 wg_calcium, wg_sodium, wg_total_alkalinity, wg_chloride, wg_sulfate, wg_bicarbonate; |
|
2749 |
|
2750 if (dataRecord.w1_name == "") { |
|
2751 return; |
|
2752 } |
|
2753 |
|
2754 // If there is a dillute water source, mix the waters. |
|
2755 if (dataRecord.w2_name != "") { |
|
2756 liters = dataRecord.w1_amount + dataRecord.w2_amount; |
|
2757 calcium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_calcium, dataRecord.w2_calcium); |
|
2758 magnesium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_magnesium, dataRecord.w2_magnesium); |
|
2759 sodium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_sodium, dataRecord.w2_sodium); |
|
2760 chloride = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_chloride, dataRecord.w2_chloride); |
|
2761 sulfate = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_sulfate, dataRecord.w2_sulfate); |
|
2762 total_alkalinity = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_total_alkalinity, dataRecord.w2_total_alkalinity); |
|
2763 ph = -Math.log10(((Math.pow(10, -dataRecord.w1_ph) * dataRecord.w1_amount) + (Math.pow(10, -dataRecord.w2_ph) * dataRecord.w2_amount)) / liters); |
|
2764 } else { |
|
2765 liters = dataRecord.w1_amount; |
|
2766 calcium = dataRecord.w1_calcium; |
|
2767 magnesium = dataRecord.w1_magnesium; |
|
2768 sodium = dataRecord.w1_sodium; |
|
2769 chloride = dataRecord.w1_chloride; |
|
2770 sulfate = dataRecord.w1_sulfate; |
|
2771 total_alkalinity = dataRecord.w1_total_alkalinity; |
|
2772 ph = dataRecord.w1_ph; |
|
2773 } |
|
2774 $('#wg_amount').val(liters); |
|
2775 wg_calcium = calcium; |
|
2776 $('#wg_calcium').val(Math.round(calcium * 10) / 10); |
|
2777 //var wg_magnesium = magnesium; |
|
2778 $('#wg_magnesium').val(Math.round(magnesium * 10) / 10); |
|
2779 wg_sodium = sodium; |
|
2780 $('#wg_sodium').val(Math.round(sodium * 10) / 10); |
|
2781 wg_total_alkalinity = total_alkalinity; |
|
2782 $('#wg_total_alkalinity').val(Math.round(total_alkalinity * 10) / 10); |
|
2783 wg_chloride = chloride; |
|
2784 $('#wg_chloride').val(Math.round(chloride * 10) / 10); |
|
2785 wg_sulfate = sulfate; |
|
2786 $('#wg_sulfate').val(Math.round(sulfate * 10) / 10); |
|
2787 // Note: brouwhulp has the malts included here in the result. |
|
2788 //var wg_ph = ph; |
|
2789 $('#wg_ph').val(Round(ph,1)); |
|
2790 $('#wb_ph').val(Round(MashpH(), 1)); |
|
2791 $('#est_mash_ph').val(Round(MashpH(), 1)); |
|
2792 bicarbonate = total_alkalinity * 1.22; |
|
2793 wg_bicarbonate = bicarbonate; |
|
2794 |
|
2795 // Noot: de volgende berekeningen geven bijna gelijke resultaten in Brun'water. |
|
2796 // Calculate Ca |
|
2797 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCa / MMCaCl2 + |
|
2798 parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMCa / MMCaSO4; |
|
2799 calcium += 1000 * RA / liters; |
|
2800 |
|
2801 // Calculate Mg |
|
2802 RA = parseFloat($("#wa_mgso4").jqxNumberInput('decimal')) * MMMg / MMMgSO4; |
|
2803 magnesium += 1000 * RA / liters; |
|
2804 |
|
2805 // Calculate Na |
|
2806 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl + |
|
2807 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMNa / MMNaHCO3; |
|
2808 sodium += 1000 * RA / liters; |
|
2809 |
|
2810 // Calculate SO4 |
|
2811 RA = parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 + |
|
2812 parseFloat($("#wa_mgso4").jqxNumberInput('decimal')) * MMSO4 / MMMgSO4; |
|
2813 sulfate += 1000 * RA / liters; |
|
2814 |
|
2815 // Calculate Cl |
|
2816 RA = 2 * parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCl / MMCaCl2 + |
|
2817 parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMCl / MMNaCl; |
|
2818 chloride += 1000 * RA / liters; |
|
2819 // Einde noot. |
|
2820 |
|
2821 if ($("#wa_acid_name").val() < 0 || $("#wa_acid_name").val() > 3) { |
|
2822 $("#wa_acid_name").val(0); |
|
2823 dataRecord.wa_acid_name = 0; |
|
2824 } |
|
2825 if (last_acid == '') |
|
2826 last_acid = AcidTypeData[$("#wa_acid_name").val()].nl; |
|
2827 |
|
2828 if ($("#wa_base_name").val() < 0 || $("#wa_base_name").val() > 3) { |
|
2829 $("#wa_base_name").val(0); |
|
2830 dataRecord.wa_base_name = 0; |
|
2831 } |
|
2832 if (last_base == '') |
|
2833 last_base = BaseTypeData[$("#wa_base_name").val()].nl; |
|
2834 |
|
2835 AT = dataRecord.wa_acid_name; |
|
2836 BT = dataRecord.wa_base_name; |
|
2837 |
|
2838 result = GetAcidSpecs(AT); |
|
2839 pK1 = result.pK1; |
|
2840 pK2 = result.pK2; |
|
2841 pK3 = result.pK3; |
|
2842 MolWt = result.MolWt; |
|
2843 AcidSG = result.AcidSG; |
|
2844 AcidPrc = result.AcidPrc; |
|
2845 |
|
2846 if (dataRecord.calc_acid) { |
|
2847 TpH = parseFloat(dataRecord.mash_ph); |
|
2848 protonDeficit = ProtonDeficit(TpH); |
|
2849 console.log("calc_acid tgt: "+TpH+" protonDeficit: "+protonDeficit); |
|
2850 if (protonDeficit > 0) { // Add acid |
|
2851 $("#wa_base").val(0); |
|
2852 setWaterAgent(last_base, 0); |
|
2853 frac = CalcFrac(TpH, pK1, pK2, pK3); |
|
2854 Acid = protonDeficit / frac; |
|
2855 Acid *= MolWt; // mg |
|
2856 Acidmg = Acid; |
|
2857 Acid = Acid / AcidSG; // ml |
|
2858 |
|
2859 if (parseFloat($("#wa_acid_perc").jqxNumberInput('decimal')) == 0) |
|
2860 $("#wa_acid_perc").val(AcidPrc); |
|
2861 Acid = Acid * AcidPrc / (parseFloat($("#wa_acid_perc").jqxNumberInput('decimal')) / 100); // ml |
|
2862 console.log("Final ml: "+Acid); |
|
2863 $("#wa_acid").val(Round(Acid, 2)); |
|
2864 setWaterAgent(AcidTypeData[AT].nl, Round(Acid, 2)); |
|
2865 |
|
2866 bicarbonate = bicarbonate - protonDeficit * frac / liters; |
|
2867 total_alkalinity = bicarbonate * 50 / 61; |
|
2868 } else if (protonDeficit < 0) { //Add base |
|
2869 $("#wa_acid").val(0); |
|
2870 setWaterAgent(last_acid, 0); |
|
2871 r1d = Math.pow(10, (TpH - 6.38)); |
|
2872 r2d = Math.pow(10, (TpH - 10.38)); |
|
2873 f1d = 1 / (1 + r1d + r1d * r2d); |
|
2874 f2d = f1d * r1d; |
|
2875 f3d = f2d * r2d; |
|
2876 switch (BT) { |
|
2877 case 0: RA = -protonDeficit / (f1d - f3d); // Sodiumbicarbonate, mmol totaal |
|
2878 RA = RA * MMNaHCO3/1000; //gram |
|
2879 $("#wa_base").val(Round(RA, 2)); |
|
2880 setWaterAgent('NaHCO3', Round(RA, 2)); |
|
2881 if (liters > 0) { |
|
2882 // Na |
|
2883 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl + |
|
2884 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMNa / MMNaHCO3; |
|
2885 RA = 1000 * RA / liters; |
|
2886 sodium = wg_sodium + RA; |
|
2887 // HCO3 |
|
2888 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3; |
|
2889 RA = 1000 * RA / liters; |
|
2890 bicarbonate = wg_bicarbonate + RA; |
|
2891 total_alkalinity = bicarbonate * 50 / 61; |
|
2892 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
|
2893 } |
|
2894 break; |
|
2895 case 1: RA = -protonDeficit / (2 * f1d + f2d); // Sodiumcarbonate, mmol totaal |
|
2896 RA = RA * MMNa2CO3/1000; //gram |
|
2897 $("#wa_base").val(Round(RA, 2)); |
|
2898 setWaterAgent('Na2CO3', Round(RA, 2)); |
|
2899 if (liters > 0) { |
|
2900 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl + |
|
2901 parseFloat($("#wa_base").jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3; |
|
2902 RA = 1000 * RA / liters; |
|
2903 sodium = wg_sodium + RA; |
|
2904 // HCO3 |
|
2905 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3; |
|
2906 RA = 1000 * RA / liters; |
|
2907 bicarbonate = wg_bicarbonate + RA; |
|
2908 total_alkalinity = bicarbonate * 50 / 61; |
|
2909 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
|
2910 } |
|
2911 break; |
|
2912 case 2: RA = -protonDeficit * (f1d - f3d); // Calciumcarbonate, mmol totaal |
|
2913 RA = RA * MMCaCO3/1000; //gram |
|
2914 //but only 1/3 is effective, so add 3 times as much |
|
2915 RA = 3 * RA; |
|
2916 $("#wa_base").val(Round(RA, 2)); |
|
2917 setWaterAgent('CaCO3', Round(RA, 2)); |
|
2918 if (liters > 0) { |
|
2919 //Bicarbonate |
|
2920 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3; |
|
2921 RA = 1000 * RA / liters; |
|
2922 bicarbonate = wg_bicarbonate + RA; |
|
2923 total_alkalinity = bicarbonate * 50 / 61; |
|
2924 //Ca precipitates out as Ca10(PO4)6(OH)2 |
|
2925 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCa / MMCaCl2 + |
|
2926 parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMCa / MMCaSO4 + |
|
2927 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMCa / MMCaCO3; |
|
2928 RA = 1000 * RA / liters; |
|
2929 calcium = wg_calcium + RA; |
|
2930 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
|
2931 } |
|
2932 break; |
|
2933 case 3: RA = -protonDeficit / 19.3; // Calciumhydroxide |
|
2934 $("#wa_base").val(Round(RA, 2)); |
|
2935 setWaterAgent('Ca(OH)2', Round(RA, 2)); |
|
2936 if (liters > 0) { |
|
2937 // Bicarbonate |
|
2938 RA = -protonDeficit / liters; |
|
2939 total_alkalinity = wg_total_alkalinity + RA; |
|
2940 bicarbonate = total_alkalinity * 61 / 50; |
|
2941 // Calcium |
|
2942 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCa / MMCaCl2 + |
|
2943 parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMCa / MMCaSO4 + |
|
2944 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMCa / MMCaOH2; |
|
2945 RA = 1000 * RA / liters; |
|
2946 calcium = wg_calcium + RA; |
|
2947 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
|
2948 } |
|
2949 break; |
|
2950 } |
|
2951 } |
|
2952 ph = TpH; |
|
2953 $('#wb_ph').val(Round(ph, 1)); |
|
2954 $('#est_mash_ph').val(Round(ph, 1)); |
|
2955 } else { // Manual |
|
2956 console.log("calc_acid no"); |
|
2957 // First add base salts |
|
2958 if (parseFloat($("#wa_base").jqxNumberInput('decimal')) > 0) { |
|
2959 if (liters > 0) { |
|
2960 switch (BT) { |
|
2961 case 0: // Sodiumbicarbonate, Na |
|
2962 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl + |
|
2963 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMNa / MMNaHCO3; |
|
2964 RA = 1000 * RA / liters; |
|
2965 sodium = wg_sodium + RA; |
|
2966 // HCO3 |
|
2967 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3; |
|
2968 RA = 1000 * RA / liters; |
|
2969 bicarbonate = wg_bicarbonate + RA; |
|
2970 total_alkalinity = bicarbonate * 50 / 61; |
|
2971 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
|
2972 break; |
|
2973 case 1: // Sodiumcarbonate |
|
2974 RA = parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMNa / MMNaCl + |
|
2975 parseFloat($("#wa_base").jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3; |
|
2976 RA = 1000 * RA / liters; |
|
2977 sodium = wg_sodium + RA; |
|
2978 // HCO3 |
|
2979 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3; |
|
2980 RA = 1000 * RA / liters; |
|
2981 bicarbonate = wg_bicarbonate + RA; |
|
2982 total_alkalinity = bicarbonate * 50 / 61; |
|
2983 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
|
2984 break; |
|
2985 case 2: // Calciumcarbonate: Bicarbonate |
|
2986 RA = parseFloat($("#wa_base").jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3; |
|
2987 RA = 1000 * RA / liters; |
|
2988 bicarbonate = wg_bicarbonate + RA; |
|
2989 total_alkalinity = bicarbonate * 50 / 61; |
|
2990 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium); |
|
2991 // Ca |
|
2992 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCa / MMCaCl2 + |
|
2993 parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMCa / MMCaSO4 + |
|
2994 parseFloat($("#wa_base").jqxNumberInput('decimal')) * MMCa / MMCaCO3; |
|
2995 RA = 1000 * RA / liters; |
|
2996 calcium = wg_calcium + RA; |
|
2997 break; |
|
2998 } |
|
2999 } |
|
3000 } |
|
3001 |
|
3002 TpH = parseFloat(dataRecord.mash_ph); |
|
3003 pHa = MashpH(); // This one is in demi water, should be in adjusted water??? |
|
3004 // Then calculate the new pH with added acids |
|
3005 if (parseFloat($("#wa_acid").jqxNumberInput('decimal')) > 0) { |
|
3006 console.log("TpH: "+TpH+" water: "+pHa); |
|
3007 Acid = parseFloat($("#wa_acid").jqxNumberInput('decimal')); |
|
3008 if (parseFloat($("#wa_acid_perc").jqxNumberInput('decimal')) == 0) |
|
3009 $("#wa_acid_perc").val(AcidPrc); |
|
3010 Acid = Acid / AcidPrc * (parseFloat($("#wa_acid_perc").jqxNumberInput('decimal')) / 100); // ml |
|
3011 Acid *= AcidSG; // ml |
|
3012 Acid /= MolWt; // mg |
|
3013 Acidmg = Acid; |
|
3014 |
|
3015 //find the pH where the protondeficit = protondeficit by the acid |
|
3016 frac = CalcFrac(pHa, pK1, pK2, pK3); |
|
3017 protonDeficit = Acid * frac; |
|
3018 |
|
3019 deltapH = 0.001; |
|
3020 deltapd = 0.1; |
|
3021 pd = ProtonDeficit(pHa); |
|
3022 n = 0; |
|
3023 while (((pd < (protonDeficit - deltapd)) || (pd > (protonDeficit + deltapd))) && (n < 2000)) { |
|
3024 n++; |
|
3025 if (pd < (protonDeficit-deltapd)) |
|
3026 pHa -= deltapH; |
|
3027 else if (pd > (protonDeficit+deltapd)) |
|
3028 pHa += deltapH; |
|
3029 frac = CalcFrac(pHa, pK1, pK2, pK3); |
|
3030 protonDeficit = Acid * frac; |
|
3031 pd = ProtonDeficit(pHa); |
|
3032 } |
|
3033 console.log("n: "+n+" pd: "+pd+" protonDeficit: "+protonDeficit+" frac: "+frac+" pHa: "+pHa); |
|
3034 RA = wg_bicarbonate - protonDeficit * frac / liters; |
|
3035 bicarbonate = RA; |
|
3036 total_alkalinity = RA * 50 / 61; |
|
3037 ph = pHa; |
|
3038 $('#wb_ph').val(Round(ph, 1)); |
|
3039 $('#est_mash_ph').val(Round(ph, 1)); |
|
3040 } |
|
3041 } |
|
3042 |
|
3043 if ((AT == 3) && (liters > 0)) { // Sulfuctic / Zwavelzuur |
|
3044 RA = parseFloat($("#wa_caso4").jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 + |
|
3045 parseFloat($("#wa_mgso4").jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 + |
|
3046 Acidmg / 1000 * MMSO4 / (MMSO4 + 2); |
|
3047 RA = 1000 * RA / liters; |
|
3048 sulfate = wg_sulfate + RA; // Not add to sulfate?? |
|
3049 } else if ((AT == 1) && (liters > 0)) { // Hydrochloric, Zoutzuur |
|
3050 RA = parseFloat($("#wa_cacl2").jqxNumberInput('decimal')) * MMCl / MMCaCl2 + |
|
3051 parseFloat($("#wa_nacl").jqxNumberInput('decimal')) * MMCl / MMNaCl + |
|
3052 Acidmg / 1000 * MMCl / (MMCl + 1); |
|
3053 RA = 1000 * RA / liters; |
|
3054 chloride = wg_chloride + RA; |
|
3055 } |
|
3056 |
|
3057 // 2:1 Sulfate to Chroride IPA's, Pale Ales. |
|
3058 // 1:1 Sulfate to Chloride Balanced |
|
3059 // 1:2 Sulfate to Chloride Malty |
|
3060 // Note, values below are the other way, cl to so4! |
|
3061 // So: 0.5 is IPA's, Pale Ales. |
|
3062 // 1 Balanced |
|
3063 // 2 Malty. |
|
3064 $('#tgt_bu').val(Round(GetBUGU(), 2)); |
|
3065 // From brouwhulp. |
|
3066 if (GetBUGU() < 0.32) |
|
3067 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer moutig en zoet</span>"); |
|
3068 else if (GetBUGU() < 0.43) |
|
3069 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Moutig, zoet</span>"); |
|
3070 else if (GetBUGU() < 0.52) |
|
3071 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Evenwichtig</span>"); |
|
3072 else if (GetBUGU() < 0.63) |
|
3073 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Licht hoppig, bitter</span>"); |
|
3074 else |
|
3075 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Extra hoppig, zeer bitter</span>"); |
|
3076 $('#tgt_cl_so4').val(Round(GetOptClSO4ratio(), 1)); |
|
3077 if (sulfate > 0) |
|
3078 RA = chloride / sulfate; |
|
3079 else |
|
3080 RA = 10; |
|
3081 $('#got_cl_so4').val(Round(RA, 1)); |
|
3082 piCLSO4_low = 0.8 * GetOptClSO4ratio(); |
|
3083 piCLSO4_high = 1.2 * GetOptClSO4ratio(); |
|
3084 Res = 'normaal'; |
|
3085 if (RA < piCLSO4_low) |
|
3086 Res = 'laag'; |
|
3087 else if (RA > piCLSO4_high) |
|
3088 Res = 'hoog'; |
|
3089 setRangeIndicator('cl_so4', Res); |
|
3090 |
|
3091 $('#wb_calcium').val(Round(calcium, 1)); |
|
3092 $('#wb_magnesium').val(Round(magnesium, 1)); |
|
3093 $('#wb_sodium').val(Round(sodium, 1)); |
|
3094 $('#wb_sulfate').val(Round(sulfate, 1)); |
|
3095 $('#wb_chloride').val(Round(chloride, 1)); |
|
3096 $('#wb_total_alkalinity').val(Round(total_alkalinity, 1)); |
|
3097 |
|
3098 if (calcium < 40) { |
|
3099 setRangeIndicator("calcium", "laag"); |
|
3100 } else if (calcium > 150) { |
|
3101 setRangeIndicator("calcium", "hoog"); |
|
3102 } else { |
|
3103 setRangeIndicator("calcium", "normaal"); |
|
3104 } |
|
3105 if (magnesium >= 0 && magnesium <= 30) { |
|
3106 setRangeIndicator("magnesium", "normaal"); |
|
3107 } else { |
|
3108 setRangeIndicator("magnesium", "hoog"); |
|
3109 } |
|
3110 if (sodium <= 150) { |
|
3111 setRangeIndicator("sodium", "normaal"); |
|
3112 } else { |
|
3113 setRangeIndicator("sodium", "hoog"); |
|
3114 } |
|
3115 // Both chloride and sulfate should be above 50 according to |
|
3116 // John Palmer. So the Cl/SO4 ratio calculation will work. |
|
3117 if (chloride <= 50) { |
|
3118 setRangeIndicator("chloride", "laag"); |
|
3119 } else if (chloride <= 100) { |
|
3120 setRangeIndicator("chloride", "normaal"); |
|
3121 } else { |
|
3122 setRangeIndicator("chloride", "hoog"); |
|
3123 } |
|
3124 if (sulfate <= 50) { |
|
3125 setRangeIndicator("sulfate", "laag"); |
|
3126 } else if (sulfate <= 350) { |
|
3127 setRangeIndicator("sulfate", "normaal"); |
|
3128 } else { |
|
3129 setRangeIndicator("sulfate", "hoog"); |
|
3130 } |
|
3131 if (ph < 5.2) { |
|
3132 setRangeIndicator("ph", "laag"); |
|
3133 } else if (ph > 5.6) { |
|
3134 setRangeIndicator("ph", "hoog"); |
|
3135 } else { |
|
3136 setRangeIndicator("ph", "normaal"); |
|
3137 } |
|
3138 calcSparge(); |
|
3139 calcMiscs(); |
|
3140 calcSupplies(); |
|
3141 } |
|
3142 |
|
3143 function calcSparge() { |
|
3144 |
|
3145 var TargetpH, Source_pH, Source_alkalinity, r1, r2, d, f1, f3, |
|
3146 r143, r243, d43, f143, f343, alkalinity, Ct, r1g, r2g, dg, f1g, f3g, |
|
3147 Acid, AT, result, pK1, pK2, pK3, MolWt, AcidSG, AcidPrc, fract; |
|
3148 |
|
3149 // Code from BrewBuddy/Brouwhulp, who got it from http://www.brewery.org/brewery/library/Acidi0,00fWaterAJD0497.html |
|
3150 TargetpH = dataRecord.sparge_ph; |
|
3151 Source_pH = dataRecord.w1_ph; |
|
3152 Source_alkalinity = dataRecord.w1_total_alkalinity; |
|
3153 // Select watersource or fallback to the first source. |
|
3154 if (dataRecord.sparge_source == 1) { // Source 2 |
|
3155 if (dataRecord.w2_ph > 0.0) { |
|
3156 Source_pH = dataRecord.w2_ph; |
|
3157 Source_alkalinity = dataRecord.w2_total_alkalinity; |
|
3158 } else { |
|
3159 dataRecord.sparge_source = 0; // Source 1 |
|
3160 $("#sparge_source").val(0); |
|
3161 } |
|
3162 } else if (dataRecord.sparge_source == 2) { // Mixed |
|
3163 if (dataRecord.w2_ph > 0.0) { |
|
3164 Source_pH = parseFloat($("#wg_ph").jqxNumberInput('decimal')); |
|
3165 Source_alkalinity = parseFloat($("#wg_total_alkalinity").jqxNumberInput('decimal')); |
|
3166 } else { |
|
3167 dataRecord.sparge_source = 0; |
|
3168 $("#sparge_source").val(0); |
|
3169 } |
|
3170 } |
|
3171 |
|
3172 // Step 1: Compute the mole fractions of carbonic (f1o), bicarbonate (f2o) and carbonate(f3o) at the water pH |
|
3173 r1 = Math.pow(10, Source_pH - 6.38); |
|
3174 r2 = Math.pow(10, Source_pH - 10.373); |
|
3175 d = 1 + r1 + r1*r2; |
|
3176 f1 = 1/d; |
|
3177 f3 = r1 * r2 / d; |
|
3178 |
|
3179 //Step 2. Compute the mole fractions at pH = 4.3 (the pH which defines alkalinity) |
|
3180 r143 = Math.pow(10, 4.3 - 6.38); |
|
3181 r243 = Math.pow(10, 4.3 - 10.373); |
|
3182 d43 = 1 + r143 + r143*r243; |
|
3183 f143 = 1/d43; |
|
3184 f343 = r143 * r243 / d43; |
|
3185 |
|
3186 //Step 3. Convert the water alkalinity to milliequivalents/L |
|
3187 alkalinity = Source_alkalinity / 50; |
|
3188 |
|
3189 //Step 4. Solve |
|
3190 Ct = (alkalinity - 1000 * (Math.pow(10, -4.3) - Math.pow(10, -Source_pH))) / ((f143-f1)+(f3-f343)); |
|
3191 |
|
3192 //Step 5. Compute mole fractions at desired pH |
|
3193 r1g = Math.pow(10, TargetpH - 6.38); |
|
3194 r2g = Math.pow(10, TargetpH - 10.373); |
|
3195 dg = 1 + r1g + r1g*r2g; |
|
3196 f1g = 1/dg; |
|
3197 f3g = r1g * r2g / dg; |
|
3198 |
|
3199 //Step 6. Use these to compute the milliequivalents acid required per liter (mEq/L) |
|
3200 Acid = Ct * ((f1g-f1)+(f3-f3g)) + Math.pow(10, -TargetpH) - Math.pow(10, -Source_pH); //mEq/l |
|
3201 Acid += 0.01; // Add acid that would be required for distilled water. |
|
3202 if (dataRecord.sparge_acid_type < 0 || dataRecord.sparge_acid_type > 3) { |
|
3203 dataRecord.sparge_acid_type = 0; |
|
3204 $("#sparge_acid_type").val(0); |
|
3205 } |
|
3206 |
|
3207 //Step 8. Get the acid data. |
|
3208 AT = dataRecord.sparge_acid_type; |
|
3209 result = GetAcidSpecs(AT); |
|
3210 pK1 = result.pK1; |
|
3211 pK2 = result.pK2; |
|
3212 pK3 = result.pK3; |
|
3213 MolWt = result.MolWt; |
|
3214 AcidSG = result.AcidSG; |
|
3215 AcidPrc = result.AcidPrc; |
|
3216 fract = CalcFrac(TargetpH, pK1, pK2, pK3); |
|
3217 |
|
3218 //Step 9. Now divide the mEq required by the "fraction". This is the required number of moles of acid. |
|
3219 Acid /= fract; |
|
3220 |
|
3221 //Step 10. Multiply by molecular weight of the acid |
|
3222 Acid *= MolWt; //mg |
|
3223 |
|
3224 Acid = Acid / AcidSG; //ml ; 88% lactic solution |
|
3225 f1 = dataRecord.sparge_acid_perc; |
|
3226 if (f1 <= 0.1) |
|
3227 f1 = AcidPrc; |
|
3228 Acid = Acid * AcidPrc / (f1 / 100); |
|
3229 |
|
3230 Acid *= dataRecord.sparge_volume; //ml lactic acid total |
|
3231 Acid = Round(Acid, 2); |
|
3232 dataRecord.sparge_acid_amount = Acid / 1000; |
|
3233 $("#sparge_acid_amount").val(Acid); |
|
3234 } |
|
3235 |
|
3236 function calcFermentation(){ |
|
3237 |
|
3238 var primary_svg, secondary_svg, final_svg, ABV; |
|
3239 if (dataRecord.brew_fermenter_sg<1.020) |
|
3240 return; |
|
3241 |
|
3242 if ((dataRecord.primary_end_sg > 0.990) && (dataRecord.primary_end_sg < dataRecord.brew_fermenter_sg)) { |
|
3243 primary_svg = Round(100*(dataRecord.brew_fermenter_sg-dataRecord.primary_end_sg)/(dataRecord.brew_fermenter_sg-1),1); |
|
3244 $("#primary_svg").val(primary_svg); |
|
3245 if ((dataRecord.secondary_end_sg > 0.990) && (dataRecord.secondary_end_sg < dataRecord.brew_fermenter_sg)) { |
|
3246 secondary_svg = Round(100*(dataRecord.brew_fermenter_sg-dataRecord.secondary_end_sg)/(dataRecord.brew_fermenter_sg-1),1); |
|
3247 $("#secondary_svg").val(secondary_svg); |
|
3248 if ((dataRecord.fg > 0.990) && (dataRecord.fg < dataRecord.brew_fermenter_sg)) { |
|
3249 final_svg = Round(100*(dataRecord.brew_fermenter_sg-dataRecord.fg)/(dataRecord.brew_fermenter_sg-1),1); |
|
3250 $("#final_svg").val(final_svg); |
|
3251 ABV = Round(abvol(dataRecord.brew_fermenter_sg,dataRecord.fg),2); |
|
3252 $("#final_abv").val(ABV); |
|
3253 } |
|
3254 } |
|
3255 } |
|
3256 } |
|
3257 |
|
3258 function ResCO2(CO2,T){ |
|
3259 |
|
3260 var F=T*1.8+32; |
|
3261 return 3.0378-0.050062*F+0.00026555*F*F; |
|
3262 } |
|
3263 |
|
3264 function CarbCO2toS(CO2,T,SFactor){ |
|
3265 var sugar=SFactor*(CO2-ResCO2(CO2,T))/0.286; |
|
3266 if(sugar<0) |
|
3267 sugar=0; |
|
3268 return Round(sugar,3); |
|
3269 } |
|
3270 |
|
3271 function GetPressure(CO2, T1, T2) { |
|
3272 var P, V = CO2 - ResCO2(CO2, T1); |
|
3273 if (V < 0) |
|
3274 return 0; |
|
3275 P = -1.09145427669121 + 0.00800006989646477 * T2 + 0.000260276315484684 * T2 * T2 + 0.0215142075945119 * T2 * V + |
|
3276 0.674996600795854 * V + -0.00471757220150754 * V * V; |
|
3277 //console.log("CO2: "+CO2+" "+V+" Temp: "+T1+" "+T2+" Pressure: "+P); |
|
3278 if (P < 0) |
|
3279 P = 0; |
|
3280 P = P * 1.01325; // atm to bar |
|
3281 return Round(P,1); |
|
3282 } |
|
3283 |
|
3284 function CarbCO2ToPressure(CO2, T) { |
|
3285 return (CO2-(-0.000005594056*Math.pow(T,4)+0.000144357886*Math.pow(T,3)+0.000362999168*T*T-0.064872987645*T+1.641145175049)) / |
|
3286 (0.00000498031*Math.pow(T,4)-0.00024358267*Math.pow(T,3)+0.00385867329*T*T-0.05671206825*T+1.53801423376); |
|
3287 } |
|
3288 |
|
3289 function calcCarbonation() { |
|
3290 |
|
3291 var TSec, ABV, bvol, balc, babv, mvol, malc, tvol, talc, |
|
3292 i, row, SFactor, pvol, pabv, Pressure, kabv; |
|
3293 |
|
3294 TSec=dataRecord.secondary_temp; |
|
3295 if(TSec<1) |
|
3296 TSec=dataRecord.primary_end_temp; |
|
3297 if(TSec<1) |
|
3298 TSec=18; |
|
3299 |
|
3300 if(dataRecord.fg==0.000) |
|
3301 ABV=abvol(dataRecord.brew_fermenter_sg,parseFloat($("#est_fg").jqxNumberInput('decimal'))); |
|
3302 else |
|
3303 ABV=abvol(dataRecord.brew_fermenter_sg,dataRecord.fg); |
|
3304 |
|
3305 /* Calculate new volume and alcohol. */ |
|
3306 bvol = dataRecord.package_volume-(ABV*dataRecord.package_volume)/100; |
|
3307 balc = dataRecord.package_volume-bvol; |
|
3308 mvol = dataRecord.package_infuse_amount-(dataRecord.package_infuse_abv*dataRecord.package_infuse_amount)/100; |
|
3309 malc = dataRecord.package_infuse_amount-mvol; |
|
3310 talc = balc+malc; |
|
3311 tvol = bvol+mvol; |
|
3312 ABV = Round(talc/(tvol+talc)*100,2); |
|
3313 dataRecord.package_abv=ABV; |
|
3314 $("#package_abv").val(ABV); |
|
3315 |
|
3316 // console.log("calcCarbonation() TSec:"+TSec+" ABV:"+ABV); |
|
3317 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))){ |
|
3318 return; |
|
3319 } |
|
3320 |
|
3321 // Bottles |
|
3322 dataRecord.bottle_priming_amount=0; |
|
3323 dataRecord.bottle_priming_total=0; |
|
3324 for (i = 0; i < rows.length; i++) { |
|
3325 row = rows[i]; |
|
3326 if(row.f_added==4){ |
|
3327 SFactor=1/((row.f_yield/100)*(1-row.f_moisture/100)); |
|
3328 dataRecord.bottle_priming_amount=CarbCO2toS(dataRecord.bottle_carbonation,TSec,SFactor); |
|
3329 dataRecord.bottle_priming_total=Round(dataRecord.bottle_amount*dataRecord.bottle_priming_amount,2); |
|
3330 $("#fermentableGrid").jqxGrid('setcellvalue',i,'f_amount',dataRecord.bottle_priming_total/1000); |
|
3331 } |
|
3332 } |
|
3333 $("#bottle_priming_amount").val(Round(dataRecord.bottle_priming_amount,1)); |
|
3334 $("#bottle_priming_total").val(dataRecord.bottle_priming_total); |
|
3335 pabv=ABV+dataRecord.bottle_priming_amount*0.47/7.907; |
|
3336 pvol=dataRecord.bottle_amount-(pabv*dataRecord.bottle_amount)/100; |
|
3337 talc=dataRecord.bottle_amount-pvol; |
|
3338 tvol=pvol+dataRecord.bottle_priming_water; |
|
3339 babv = Round(talc/(tvol+talc)*100,2); |
|
3340 //console.log("bottle pabv:"+pabv+" pvol:"+pvol+" wvol:"+dataRecord.bottle_priming_water+" tvol:"+tvol+" talc:"+talc+" abv:"+babv); |
|
3341 $("#bottle_abv").val(babv); |
|
3342 $("#bottle_pressure").val(GetPressure(dataRecord.bottle_carbonation,TSec,dataRecord.bottle_carbonation_temp)); |
|
3343 |
|
3344 // Kegs |
|
3345 Pressure=CarbCO2ToPressure(dataRecord.keg_carbonation,dataRecord.keg_carbonation_temp); |
|
3346 if(Pressure<0)Pressure=0; |
|
3347 dataRecord.keg_pressure=Pressure; |
|
3348 $("#keg_pressure").val(Round(Pressure,1)); |
|
3349 |
|
3350 dataRecord.keg_priming_amount=0; |
|
3351 dataRecord.keg_priming_total=0; |
|
3352 if(!dataRecord.keg_forced_carb){ |
|
3353 for(i = 0; i < rows.length; i++){ |
|
3354 row=rows[i]; |
|
3355 if(row.f_added==5){ |
|
3356 SFactor=1/((row.f_yield/100)*(1-row.f_moisture/100)); |
|
3357 dataRecord.keg_priming_amount=CarbCO2toS(dataRecord.keg_carbonation,TSec,SFactor); |
|
3358 dataRecord.keg_priming_total=Round(dataRecord.keg_amount*dataRecord.keg_priming_amount,2); |
|
3359 $("#fermentableGrid").jqxGrid('setcellvalue',i,'f_amount',dataRecord.keg_priming_total/1000); |
|
3360 } |
|
3361 } |
|
3362 $("#keg_priming_amount").val(Round(dataRecord.keg_priming_amount,1)); |
|
3363 $("#keg_priming_total").val(dataRecord.keg_priming_total); |
|
3364 pabv=ABV+dataRecord.keg_priming_amount*0.47/7.907; |
|
3365 pvol=dataRecord.keg_amount-(pabv*dataRecord.keg_amount)/100; |
|
3366 talc=dataRecord.keg_amount-pvol; |
|
3367 tvol=pvol+dataRecord.keg_priming_water; |
|
3368 kabv=Round(talc/(tvol+talc)*100,2); |
|
3369 //console.log("kegs pabv:"+pabv+" pvol:"+pvol+" wvol:"+dataRecord.keg_priming_water+" tvol:"+tvol+" talc:"+talc+" abv:"+kabv); |
3368 //console.log("kegs pabv:"+pabv+" pvol:"+pvol+" wvol:"+dataRecord.keg_priming_water+" tvol:"+tvol+" talc:"+talc+" abv:"+kabv); |
3370 $("#keg_abv").val(kabv); |
3369 $('#keg_abv').val(kabv); |
3371 } else { |
3370 } else { |
3372 $("#keg_priming_amount").val(0); |
3371 $('#keg_priming_amount').val(0); |
3373 $("#keg_priming_total").val(0); |
3372 $('#keg_priming_total').val(0); |
3374 $("#keg_abv").val(ABV); |
3373 $('#keg_abv').val(ABV); |
3375 } |
3374 } |
3376 } |
3375 } |
3377 |
3376 |
3378 function calcStage() { |
3377 function calcStage() { |
3379 |
3378 |
3380 var newstage = dataRecord.stage, d, date1, date2, date1_unixtime, date2_unixtime, |
3379 var newstage = dataRecord.stage, d, date1, date2, date1_unixtime, date2_unixtime, timeDifference, timeDifferenceInDays; |
3381 timeDifference, timeDifferenceInDays; |
3380 |
3382 |
3381 if (newstage == 0 && dataRecord.est_og > 1.005 && dataRecord.est_color > 3 && dataRecord.est_ibu > 3) |
3383 if (newstage == 0 && dataRecord.est_og > 1.005 && dataRecord.est_color > 3 && dataRecord.est_ibu > 3) |
3382 newstage = 1; |
3384 newstage = 1; |
3383 if (newstage == 1 && parseFloat($('#brew_date_start').val()) > 2000) |
3385 if (newstage == 1 && parseFloat($("#brew_date_start").val()) > 2000) |
3384 newstage = 2; // Brewday |
3386 newstage = 2; // Brewday |
3385 if (newstage == 2 && ($('#brew_date_start').val() == '')) |
3387 if (newstage == 2 && ($("#brew_date_start").val() == '')) |
3386 newstage = 1; // No brewday |
3388 newstage = 1; // No brewday |
3387 if (newstage == 2 && parseFloat($('#brew_date_end').val()) > 2000) |
3389 if (newstage == 2 && parseFloat($("#brew_date_end").val()) > 2000) |
3388 newstage = 3; // Primary |
3390 newstage = 3; // Primary |
3389 if (newstage == 3 && parseFloat($('#primary_end_date').val()) > 2000) |
3391 if (newstage == 3 && parseFloat($("#primary_end_date").val()) > 2000) |
3390 newstage = 4; // Secondary |
3392 newstage = 4; // Secondary |
3391 if (newstage == 4 && parseFloat($('#secondary_end_date').val()) > 2000) |
3393 if (newstage == 4 && parseFloat($("#secondary_end_date").val()) > 2000) |
3392 newstage = 5; // Tertiary |
3394 newstage = 5; // Tertiary |
3393 if (newstage == 5 && parseFloat($('#package_date').val()) > 2000) |
3395 if (newstage == 5 && parseFloat($("#package_date").val()) > 2000) |
3394 newstage = 6; // Package |
3396 newstage = 6; // Package |
3395 if (newstage >= 6 && newstage < 9) { |
3397 if (newstage >= 6 && newstage < 9) { |
3396 d = new Date(); |
3398 d = new Date(); |
3397 date2 = $('#package_date').val(); |
3399 date2 = $("#package_date").val(); |
3398 date2 = date2.split('-'); |
3400 date2 = date2.split('-'); |
3399 // Now we convert the array to a Date object |
3401 // Now we convert the array to a Date object |
3400 date1 = new Date(d.getFullYear(), d.getMonth(), d.getDate()); |
3402 date1 = new Date(d.getFullYear(), d.getMonth(), d.getDate()); |
3401 date2 = new Date(date2[0], date2[1] - 1, date2[2]); |
3403 date2 = new Date(date2[0], date2[1]-1, date2[2]); |
3402 // We use the getTime() method and get the unixtime |
3404 // We use the getTime() method and get the unixtime |
3403 date1_unixtime = parseInt(date1.getTime() / 1000); |
3405 date1_unixtime = parseInt(date1.getTime() / 1000); |
3404 date2_unixtime = parseInt(date2.getTime() / 1000); |
3406 date2_unixtime = parseInt(date2.getTime() / 1000); |
3405 // This is the calculated difference in seconds |
3407 // This is the calculated difference in seconds |
3406 timeDifference = date1_unixtime - date2_unixtime; |
3408 timeDifference = date1_unixtime - date2_unixtime; |
3407 timeDifferenceInDays = timeDifference / 60 / 60 / 24; |
3409 timeDifferenceInDays = timeDifference / 60 / 60 / 24; |
3408 if (timeDifferenceInDays > 0) { // At least one day |
3410 if (timeDifferenceInDays > 0) { // At least one day |
3409 if (timeDifferenceInDays >= 42) // 6 weeks |
3411 if (timeDifferenceInDays >= 42) // 6 weeks |
3410 newstage = 9; // Ready to taste |
3412 newstage = 9; // Ready to taste |
3411 else if (timeDifferenceInDays >= 14) // 14 days |
3413 else if (timeDifferenceInDays >= 14) // 14 days |
3412 newstage = 8; // Mature |
3414 newstage = 8; // Mature |
3413 else |
3415 else |
3414 newstage = 7; // Carbonation |
3416 newstage = 7; // Carbonation |
3415 } |
3417 } |
3416 } |
3418 } |
3417 if (newstage == 9 && parseFloat($('#taste_date').val()) > 2000) |
3419 if (newstage == 9 && parseFloat($("#taste_date").val()) > 2000) |
3418 newstage = 10; // Ready |
3420 newstage = 10; // Ready |
3419 |
3421 |
3420 if (newstage != dataRecord.stage) { |
3422 if (newstage != dataRecord.stage) { |
3421 console.log('calcStage() old: ' + dataRecord.stage + ' new: ' + newstage); |
3423 console.log("calcStage() old: "+dataRecord.stage+" new: "+newstage); |
3422 dataRecord.stage = newstage; |
3424 dataRecord.stage = newstage; |
3423 } |
3425 } |
3424 |
3426 |
3425 /* |
3427 /* |
3426 * Set stage and enable or disable parts of the screens. |
3428 * Set stage and enable or disable parts of the screens. |
3427 */ |
3429 */ |
3428 $('#stage').val(StageData[dataRecord.stage].nl); |
3430 $("#stage").val(StageData[dataRecord.stage].nl); |
3429 if (dataRecord.stage >= 10) { |
3431 if (dataRecord.stage >= 10) { |
3430 $('#locked').jqxCheckBox({ disabled: false }); |
3432 $("#locked").jqxCheckBox({ disabled:false }); |
3431 } |
3433 } |
3432 |
3434 |
3433 /* |
3435 /* |
3434 * When the brew is in progress or done, block equipment select and delete. |
3436 * When the brew is in progress or done, block equipment select and delete. |
3435 */ |
3437 */ |
3436 if (dataRecord.stage > 1) { |
3438 if (dataRecord.stage > 1) { |
3437 $('#equipmentSelect').jqxDropDownList({ disabled: true }); |
3439 $("#equipmentSelect").jqxDropDownList({ disabled: true }); |
3438 $('#Delete').jqxButton({ disabled: true }); |
3440 $("#Delete").jqxButton({ disabled: true }); |
3439 } |
3441 } |
3440 |
3442 |
3441 if (dataRecord.stage < 1) // Planning, no ingredients |
3443 if (dataRecord.stage < 1) // Planning, no ingredients |
3442 $('#jqxTabs').jqxTabs('disableAt', 8); // Brewday tab |
3444 $('#jqxTabs').jqxTabs('disableAt', 8); // Brewday tab |
3443 else |
3445 else |
3444 $('#jqxTabs').jqxTabs('enableAt', 8); |
3446 $('#jqxTabs').jqxTabs('enableAt', 8); |
3445 |
3447 |
3446 if (dataRecord.stage < 3) { // Primary |
3448 if (dataRecord.stage < 3) { // Primary |
3447 $('#jqxTabs').jqxTabs('disableAt', 9); // Fermentation tab |
3449 $('#jqxTabs').jqxTabs('disableAt', 9); // Fermentation tab |
3448 } else { |
3450 } else { |
3449 $('#jqxTabs').jqxTabs('enableAt', 9); |
3451 $('#jqxTabs').jqxTabs('enableAt', 9); |
3450 $('#name').jqxInput({ disabled: true }); |
3452 $("#name").jqxInput({ disabled: true }); |
3451 $('#code').jqxInput({ disabled: true }); |
3453 $("#code").jqxInput({ disabled: true }); |
3452 $('#batch_size').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3454 $("#batch_size").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3453 $('#boil_size').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3455 $("#boil_size").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3454 $('#boil_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3456 $("#boil_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3455 $('#efficiency').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3457 $("#efficiency").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3456 $('#est_og').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3458 $("#est_og").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3457 $('#type').jqxDropDownList({ disabled: true }); |
3459 $("#type").jqxDropDownList({ disabled: true }); |
3458 $('#styleSelect').jqxDropDownList({ disabled: true }); |
3460 $("#styleSelect").jqxDropDownList({ disabled: true }); |
3459 $('#color_method').jqxDropDownList({ disabled: true }); |
3461 $("#color_method").jqxDropDownList({ disabled: true }); |
3460 $('#ibu_method').jqxDropDownList({ disabled: true }); |
3462 $("#ibu_method").jqxDropDownList({ disabled: true }); |
3461 $('#mash_select').jqxDropDownList({ disabled: true }); |
3463 $("#mash_select").jqxDropDownList({ disabled: true }); |
3462 $('#w1_name').jqxDropDownList({ disabled: true }); |
3464 $("#w1_name").jqxDropDownList({ disabled: true }); |
3463 $('#w2_name').jqxDropDownList({ disabled: true }); |
3465 $("#w2_name").jqxDropDownList({ disabled: true }); |
3464 $('#w2_amount').jqxNumberInput({ readOnly: true }); |
3466 $("#w2_amount").jqxNumberInput({ readOnly: true }); |
3465 $('#pr_name').jqxDropDownList({ disabled: true }); |
3467 $("#pr_name").jqxDropDownList({ disabled: true }); |
3466 $('#wa_cacl2').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3468 $("#wa_cacl2").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3467 $('#wa_caso4').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3469 $("#wa_caso4").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3468 $('#wa_mgso4').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3470 $("#wa_mgso4").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3469 $('#wa_nacl').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3471 $("#wa_nacl").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3470 $('#mash_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3472 $("#mash_ph").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3471 $('#calc_acid').jqxCheckBox({ disabled: true }); |
3473 $("#calc_acid").jqxCheckBox({ disabled: true }); |
3472 $('#wa_base_name').jqxDropDownList({ disabled: true }); |
3474 $("#wa_base_name").jqxDropDownList({ disabled: true }); |
3473 $('#wa_base').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3475 $("#wa_base").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3474 $('#wa_acid_name').jqxDropDownList({ disabled: true }); |
3476 $("#wa_acid_name").jqxDropDownList({ disabled: true }); |
3475 $('#wa_acid').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3477 $("#wa_acid").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3476 $('#wa_acid_perc').jqxNumberInput({ spinButtons: false, readOnly: true, width: 70 }); |
3478 $("#wa_acid_perc").jqxNumberInput({ spinButtons: false, readOnly: true, width: 70 }); |
3477 $('#sparge_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3479 $("#sparge_temp").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3478 $('#sparge_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3480 $("#sparge_volume").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3479 $('#sparge_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3481 $("#sparge_ph").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3480 $('#sparge_source').jqxDropDownList({ disabled: true }); |
3482 $("#sparge_source").jqxDropDownList({ disabled: true }); |
3481 $('#sparge_acid_type').jqxDropDownList({ disabled: true }); |
3483 $("#sparge_acid_type").jqxDropDownList({ disabled: true }); |
3482 $('#sparge_acid_perc').jqxNumberInput({ spinButtons: false, readOnly: true, width: false }); |
3484 $("#sparge_acid_perc").jqxNumberInput({ spinButtons: false, readOnly: true, width: false }); |
3483 $('#starter_enable').jqxCheckBox({ disabled: true }); |
3485 $("#starter_enable").jqxCheckBox({ disabled: true }); |
3484 $('#starter_type').jqxDropDownList({ disabled: true }); |
3486 $("#starter_type").jqxDropDownList({ disabled: true }); |
3485 $('#starter_try').jqxButton({ disabled: true }); |
3487 $("#starter_try").jqxButton({ disabled: true }); |
3486 $('#starter_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3488 $("#starter_sg").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3487 $('#starter_viability').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3489 $("#starter_viability").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3488 } |
3490 } |
3489 if (dataRecord.stage > 3) { // Primary fermentation done |
3491 if (dataRecord.stage > 3) { // Primary fermentation done |
3490 $('#brew_date_start').jqxDateTimeInput({ disabled: true }); |
3492 $("#brew_date_start").jqxDateTimeInput({ disabled: true }); |
3491 $('#brew_date_end').jqxDateTimeInput({ disabled: true }); |
3493 $("#brew_date_end").jqxDateTimeInput({ disabled: true }); |
3492 $('#brew_mash_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3494 $("#brew_mash_ph").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3493 $('#brew_preboil_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3495 $("#brew_preboil_ph").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3494 $('#brew_aboil_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3496 $("#brew_aboil_ph").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3495 $('#brew_mash_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3497 $("#brew_mash_sg").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3496 $('#brew_preboil_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3498 $("#brew_preboil_sg").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3497 $('#brew_aboil_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3499 $("#brew_aboil_sg").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3498 $('#brew_preboil_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3500 $("#brew_preboil_volume").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3499 $('#brew_aboil_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3501 $("#brew_aboil_volume").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3500 $('#brew_whirlpool9').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3502 $("#brew_whirlpool9").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3501 $('#brew_cooling_to').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3503 $("#brew_cooling_to").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3502 $('#brew_whirlpool7').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3504 $("#brew_whirlpool7").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3503 $('#brew_cooling_method').jqxDropDownList({ disabled: true }); |
3505 $("#brew_cooling_method").jqxDropDownList({ disabled: true }); |
3504 $('#brew_whirlpool6').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3506 $("#brew_whirlpool6").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3505 $('#brew_cooling_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3507 $("#brew_cooling_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3506 $('#brew_sparge_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3508 $("#brew_sparge_ph").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3507 $('#brew_whirlpool2').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3509 $("#brew_whirlpool2").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3508 $('#brew_aeration_type').jqxDropDownList({ disabled: true }); |
3510 $("#brew_aeration_type").jqxDropDownList({ disabled: true }); |
3509 $('#brew_fermenter_tcloss').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3511 $("#brew_fermenter_tcloss").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3510 $('#brew_aeration_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3512 $("#brew_aeration_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3511 $('#brew_fermenter_extrawater').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3513 $("#brew_fermenter_extrawater").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3512 $('#brew_aeration_speed').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3514 $("#brew_aeration_speed").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3513 } |
3515 } |
3514 if (dataRecord.stage == 5) // Lagering, allow packaging |
3516 if (dataRecord.stage == 5) // Lagering, allow packaging |
3515 $('#package_date').jqxDateTimeInput({ disabled: false }); |
3517 $("#package_date").jqxDateTimeInput({ disabled: false }); |
3516 else |
3518 else |
3517 $('#package_date').jqxDateTimeInput({ disabled: true }); |
3519 $("#package_date").jqxDateTimeInput({ disabled: true }); |
3518 if (dataRecord.stage >= 5) { // At least secondary |
3520 if (dataRecord.stage >= 5) { // At least secondary |
3519 $('#primary_start_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3521 $("#primary_start_temp").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3520 $('#primary_max_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3522 $("#primary_max_temp").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3521 $('#primary_end_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3523 $("#primary_end_temp").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3522 $('#primary_end_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3524 $("#primary_end_sg").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3523 $('#primary_end_brix').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3525 $("#primary_end_brix").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3524 $('#primary_end_date').jqxDateTimeInput({ disabled: true }); |
3526 $("#primary_end_date").jqxDateTimeInput({ disabled: true }); |
3525 } |
3527 } |
3526 if (dataRecord.stage >= 6) { // Packaged |
3528 if (dataRecord.stage >= 6) { // Packaged |
3527 $('#secondary_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3529 $("#secondary_temp").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3528 $('#secondary_end_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3530 $("#secondary_end_sg").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3529 $('#secondary_end_date').jqxDateTimeInput({ disabled: true }); |
3531 $("#secondary_end_date").jqxDateTimeInput({ disabled: true }); |
3530 $('#tertiary_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3532 $("#tertiary_temp").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3531 $('#fg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3533 $("#fg").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3532 $('#final_brix').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3534 $("#final_brix").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3533 $('#package_date').jqxDateTimeInput({ disabled: true }); |
3535 $("#package_date").jqxDateTimeInput({ disabled: true }); |
3534 $('#package_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3536 $("#package_volume").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3535 $('#package_infuse_amount').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3537 $("#package_infuse_amount").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3536 $('#package_infuse_abv').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3538 $("#package_infuse_abv").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3537 $('#package_infuse_notes').jqxInput({ disabled: true }); |
3539 $("#package_infuse_notes").jqxInput({ disabled: true }); |
3538 $('#package_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3540 $("#package_ph").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3539 $('#bottle_amount').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3541 $("#bottle_amount").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3540 $('#bottle_priming_water').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3542 $("#bottle_priming_water").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3541 $('#keg_priming_water').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3543 $("#keg_priming_water").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3542 $('#keg_amount').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3544 $("#keg_amount").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3543 $('#bottle_carbonation').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3545 $("#bottle_carbonation").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3544 $('#keg_carbonation').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3546 $("#keg_carbonation").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3545 $('#bottle_priming_sugar').jqxDropDownList({ disabled: true }); |
3547 $("#bottle_priming_sugar").jqxDropDownList({ disabled: true }); |
3546 $('#keg_priming_sugar').jqxDropDownList({ disabled: true }); |
3548 $("#keg_priming_sugar").jqxDropDownList({ disabled: true }); |
3547 $('#keg_forced_carb').jqxCheckBox({ disabled: true }); |
3549 $("#keg_forced_carb").jqxCheckBox({ disabled : true }); |
3548 $('#bottle_carbonation_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3550 $("#bottle_carbonation_temp").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3549 $('#keg_carbonation_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3551 $("#keg_carbonation_temp").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3550 } |
3552 } |
3551 if (dataRecord.stage < 8) { // Taste when at least Mature. |
3553 if (dataRecord.stage < 8) { // Taste when at least Mature. |
3552 $('#jqxTabs').jqxTabs('disableAt', 11); // Tasting tab |
3554 $('#jqxTabs').jqxTabs('disableAt', 11); // Tasting tab |
3553 } else { |
3555 } else { |
3554 $('#jqxTabs').jqxTabs('enableAt', 11); |
3556 $('#jqxTabs').jqxTabs('enableAt', 11); |
3555 } |
3557 } |
3556 |
3558 |
3557 if (dataRecord.stage == 11) { // Locked |
3559 if (dataRecord.stage == 11) { // Locked |
3558 $('#taste_date').jqxDateTimeInput({ disabled: true }); |
3560 $("#taste_date").jqxDateTimeInput({ disabled: true }); |
3559 $('#taste_rate').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3561 $("#taste_rate").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3560 $('#taste_color').jqxInput({ disabled: true }); |
3562 $("#taste_color").jqxInput({ disabled: true }); |
3561 $('#taste_transparency').jqxInput({ disabled: true }); |
3563 $("#taste_transparency").jqxInput({ disabled: true }); |
3562 $('#taste_head').jqxInput({ disabled: true }); |
3564 $("#taste_head").jqxInput({ disabled: true }); |
3563 $('#taste_aroma').jqxInput({ disabled: true }); |
3565 $("#taste_aroma").jqxInput({ disabled: true }); |
3564 $('#taste_taste').jqxInput({ disabled: true }); |
3566 $("#taste_taste").jqxInput({ disabled: true }); |
3565 $('#taste_aftertaste').jqxInput({ disabled: true }); |
3567 $("#taste_aftertaste").jqxInput({ disabled: true }); |
3566 $('#taste_mouthfeel').jqxInput({ disabled: true }); |
3568 $("#taste_mouthfeel").jqxInput({ disabled: true }); |
3567 $('#taste_notes').jqxInput({ disabled: true }); |
3569 $("#taste_notes").jqxInput({ disabled: true }); |
3568 $('#notes').jqxInput({ disabled: true }); |
3570 $("#notes").jqxInput({ disabled: true }); |
3569 } else { |
3571 } else { |
3570 $('#notes').jqxInput({ disabled: false }); |
3572 $("#notes").jqxInput({ disabled: false }); |
3571 } |
3573 } |
3572 } |
3574 } |
3573 |
3575 |
3574 function showStarter() { |
3576 function showStarter() { |
3575 |
3577 |
3576 if (dataRecord.starter_enable) { |
3578 if (dataRecord.starter_enable) { |
3577 $('#propagator').show(); |
3579 $("#propagator").show(); |
3578 $('#starter_type').jqxDropDownList({ disabled: false }); |
3580 $("#starter_type").jqxDropDownList( {disabled: false }); |
3579 $('#starter_try').jqxButton({ disabled: false }); |
3581 $("#starter_try").jqxButton({ disabled: false }); |
3580 $('#starter_sg').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
3582 $("#starter_sg").jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
3581 $('#starter_viability').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
3583 $("#starter_viability").jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
3582 } else { |
3584 } else { |
3583 $('#propagator').hide(); |
3585 $("#propagator").hide(); |
3584 $('#starter_type').jqxDropDownList({ disabled: true }); |
3586 $("#starter_type").jqxDropDownList( {disabled: true }); |
3585 $('#starter_try').jqxButton({ disabled: true }); |
3587 $("#starter_try").jqxButton({ disabled: true }); |
3586 $('#starter_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3588 $("#starter_sg").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3587 $('#starter_viability').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3589 $("#starter_viability").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
3588 } |
3590 } |
3589 } |
3591 } |
3590 |
3592 |
3591 function calcInit() { |
3593 function calcInit () { |
3592 console.log('calcInit()'); |
3594 console.log("calcInit()"); |
3593 |
3595 |
3594 calcMashEfficiency(); |
3596 calcMashEfficiency(); |
3595 calcEfficiencyBeforeBoil(); |
3597 calcEfficiencyBeforeBoil(); |
3596 calcEfficiencyAfterBoil(); |
3598 calcEfficiencyAfterBoil(); |
3597 |
3599 |
3598 $('#starter_enable').on('checked', function(event) { |
3600 $("#starter_enable").on('checked', function (event) { |
3599 dataRecord.starter_enable = 1; |
3601 dataRecord.starter_enable = 1; |
3600 showStarter(); |
3602 showStarter(); |
3601 calcYeast(); |
3603 calcYeast(); |
3602 }); |
3604 }); |
3603 $('#starter_enable').on('unchecked', function(event) { |
3605 $("#starter_enable").on('unchecked', function (event) { |
3604 dataRecord.starter_enable = 0; |
3606 dataRecord.starter_enable = 0; |
3605 showStarter(); |
3607 showStarter(); |
3606 calcYeast(); |
3608 calcYeast(); |
3607 }); |
3609 }); |
3608 $('#starter_try').click(function() { |
3610 $("#starter_try").click(function () { |
3609 $('#prop1_volume').val(0); |
3611 $("#prop1_volume").val(0); |
3610 $('#prop2_volume').val(0); |
3612 $("#prop2_volume").val(0); |
3611 $('#prop3_volume').val(0); |
3613 $("#prop3_volume").val(0); |
3612 $('#prop4_volume').val(0); |
3614 $("#prop4_volume").val(0); |
3613 calcYeast(); |
3615 calcYeast(); |
3614 }); |
3616 }); |
3615 $('#starter_type').on('change', function(event) { |
3617 $('#starter_type').on('change', function (event) { |
3616 if (event.args) { |
3618 if (event.args) { |
3617 dataRecord.starter_type = event.args.index; |
3619 var index = event.args.index; |
3618 calcYeast(); |
3620 dataRecord.starter_type = index; |
3619 } |
3621 calcYeast(); |
3620 }); |
3622 } |
3621 $('#starter_sg').on('change', function(event) { |
3623 }); |
3622 if (event.args) { |
3624 $('#starter_sg').on('change', function (event) { |
3623 dataRecord.starter_sg = event.args.value; |
3625 if (event.args) { |
3624 calcYeast(); |
3626 dataRecord.starter_sg = event.args.value; |
3625 } |
3627 calcYeast(); |
3626 }); |
3628 } |
3627 $('#starter_viability').on('change', function(event) { |
3629 }); |
3628 if (event.args) { |
3630 $('#starter_viability').on('change', function (event) { |
3629 dataRecord.starter_viability = event.args.value; |
3631 if (event.args) { |
3630 calcFermentables(); |
3632 dataRecord.starter_viability = event.args.value; |
3631 calcYeast(); |
3633 calcFermentables(); |
3632 } |
3634 calcYeast(); |
3633 }); |
3635 } |
3634 $('#prop1_type').on('change', function(event) { |
3636 }); |
3635 if (event.args) { |
3637 $('#prop1_type').on('change', function (event) { |
3636 dataRecord.prop1_type = event.args.index; |
3638 if (event.args) { |
3637 calcYeast(); |
3639 var index = event.args.index; |
3638 } |
3640 dataRecord.prop1_type = index; |
3639 }); |
3641 calcYeast(); |
3640 $('#prop1_volume').on('change', function(event) { |
3642 } |
3641 if (event.args) { |
3643 }); |
3642 dataRecord.prop1_volume = event.args.value; |
3644 $('#prop1_volume').on('change', function (event) { |
3643 calcYeast(); |
3645 if (event.args) { |
3644 } |
3646 dataRecord.prop1_volume = event.args.value; |
3645 }); |
3647 calcYeast(); |
3646 $('#prop2_type').on('change', function(event) { |
3648 } |
3647 if (event.args) { |
3649 }); |
3648 dataRecord.prop2_type = event.args.index; |
3650 $('#prop2_type').on('change', function (event) { |
3649 calcYeast(); |
3651 if (event.args) { |
3650 } |
3652 var index = event.args.index; |
3651 }); |
3653 dataRecord.prop2_type = index; |
3652 $('#prop2_volume').on('change', function(event) { |
3654 calcYeast(); |
3653 if (event.args) { |
3655 } |
3654 dataRecord.prop2_volume = event.args.value; |
3656 }); |
3655 calcYeast(); |
3657 $('#prop2_volume').on('change', function (event) { |
3656 } |
3658 if (event.args) { |
3657 }); |
3659 dataRecord.prop2_volume = event.args.value; |
3658 $('#prop3_type').on('change', function(event) { |
3660 calcYeast(); |
3659 if (event.args) { |
3661 } |
3660 dataRecord.prop3_type = event.args.index; |
3662 }); |
3661 calcYeast(); |
3663 $('#prop3_type').on('change', function (event) { |
3662 } |
3664 if (event.args) { |
3663 }); |
3665 var index = event.args.index; |
3664 $('#prop3_volume').on('change', function(event) { |
3666 dataRecord.prop3_type = index; |
3665 if (event.args) { |
3667 calcYeast(); |
3666 dataRecord.prop3_volume = event.args.value; |
3668 } |
3667 calcYeast(); |
3669 }); |
3668 } |
3670 $('#prop3_volume').on('change', function (event) { |
3669 }); |
3671 if (event.args) { |
3670 $('#prop4_type').on('change', function(event) { |
3672 dataRecord.prop3_volume = event.args.value; |
3671 if (event.args) { |
3673 calcYeast(); |
3672 dataRecord.prop4_type = event.args.index; |
3674 } |
3673 calcYeast(); |
3675 }); |
3674 } |
3676 $('#prop4_type').on('change', function (event) { |
3675 }); |
3677 if (event.args) { |
3676 $('#prop4_volume').on('change', function(event) { |
3678 var index = event.args.index; |
3677 if (event.args) { |
3679 dataRecord.prop4_type = index; |
3678 dataRecord.prop4_volume = event.args.value; |
3680 calcYeast(); |
3679 calcYeast(); |
3681 } |
3680 } |
3682 }); |
3681 }); |
3683 $('#prop4_volume').on('change', function (event) { |
3682 |
3684 if (event.args) { |
3683 $('#calc_acid').on('checked', function(event) { |
3685 dataRecord.prop4_volume = event.args.value; |
3684 dataRecord.calc_acid = 1; |
3686 calcYeast(); |
3685 calcWater(); |
3687 } |
3686 }); |
3688 }); |
3687 $('#calc_acid').on('unchecked', function(event) { |
3689 |
3688 dataRecord.calc_acid = 0; |
3690 $("#calc_acid").on('checked', function (event) { |
3689 calcWater(); |
3691 dataRecord.calc_acid = 1; |
3690 }); |
3692 calcWater(); |
3691 $('#w1_name').jqxDropDownList('selectItem', dataRecord.w1_name); |
3693 }); |
3692 $('#w2_name').jqxDropDownList('selectItem', dataRecord.w2_name); |
3694 $("#calc_acid").on('unchecked', function (event) { |
3693 // Fix tap water if zero using mash infuse amount. |
3695 dataRecord.calc_acid = 0; |
3694 if (parseFloat($('#w1_amount').jqxNumberInput('decimal')) == 0 && mash_infuse > 0) { |
3696 calcWater(); |
3695 $('#w1_amount').val(mash_infuse); |
3697 }); |
3696 dataRecord.w1_amount = mash_infuse; |
3698 $("#w1_name").jqxDropDownList('selectItem', dataRecord.w1_name); |
3697 $('#wg_amount').val(mash_infuse); |
3699 $("#w2_name").jqxDropDownList('selectItem', dataRecord.w2_name); |
3698 $('#w2_amount').val(0); |
3700 // Fix tap water if zero using mash infuse amount. |
3699 dataRecord.w2_amount = 0; |
3701 if (parseFloat($("#w1_amount").jqxNumberInput('decimal')) == 0 && mash_infuse > 0) { |
3700 } |
3702 $("#w1_amount").val(mash_infuse); |
3701 calcWater(); |
3703 dataRecord.w1_amount = mash_infuse; |
3702 $('#w2_amount').on('change', function(event) { |
3704 $("#wg_amount").val(mash_infuse); |
3703 var newval = parseFloat(event.args.value); |
3705 $("#w2_amount").val(0); |
3704 |
3706 dataRecord.w2_amount = 0; |
3705 if (newval > mash_infuse) { |
3707 } |
3706 $('#w2_amount').val(dataRecord.w2_amount); |
3708 calcWater(); |
3707 return; |
3709 $("#w2_amount").on('change', function (event) { |
3708 } |
3710 var newval = parseFloat(event.args.value); |
3709 dataRecord.w1_amount = parseFloat($('#wg_amount').jqxNumberInput('decimal')) - newval; |
3711 |
3710 $('#w1_amount').val(dataRecord.w1_amount); |
3712 if (newval > mash_infuse) { |
3711 dataRecord.w2_amount = newval; |
3713 $("#w2_amount").val(dataRecord.w2_amount); |
3712 console.log('new: ' + event.args.value + ' w1: ' + dataRecord.w1_amount + ' w2: ' + dataRecord.w2_amount); |
3714 return; |
3713 calcWater(); |
3715 } |
3714 }); |
3716 dataRecord.w1_amount = parseFloat($("#wg_amount").jqxNumberInput('decimal')) - newval; |
3715 $('#wa_cacl2').on('change', function(event) { |
3717 $("#w1_amount").val(dataRecord.w1_amount); |
3716 if (event.args) { |
3718 dataRecord.w2_amount = newval; |
3717 setWaterAgent('CaCl2', 0); // This can prevent double entries. |
3719 console.log("new: "+event.args.value+" w1: "+dataRecord.w1_amount+" w2: "+dataRecord.w2_amount); |
3718 setWaterAgent('CaCl2', event.args.value); |
3720 calcWater(); |
3719 calcWater(); |
3721 }); |
3720 } |
3722 $('#wa_cacl2').on('change', function (event) { |
3721 }); |
3723 if (event.args) { |
3722 $('#wa_caso4').on('change', function(event) { |
3724 setWaterAgent('CaCl2', 0); // This can prevent double entries. |
3723 if (event.args) { |
3725 setWaterAgent('CaCl2', event.args.value); |
3724 setWaterAgent('CaSO4', 0); |
3726 calcWater(); |
3725 setWaterAgent('CaSO4', event.args.value); |
3727 } |
3726 calcWater(); |
3728 }); |
3727 } |
3729 $('#wa_caso4').on('change', function (event) { |
3728 }); |
3730 if (event.args) { |
3729 $('#wa_mgso4').on('change', function(event) { |
3731 setWaterAgent('CaSO4', 0); |
3730 if (event.args) { |
3732 setWaterAgent('CaSO4', event.args.value); |
3731 setWaterAgent('MgSO4', 0); |
3733 calcWater(); |
3732 setWaterAgent('MgSO4', event.args.value); |
3734 } |
3733 calcWater(); |
3735 }); |
3734 } |
3736 $('#wa_mgso4').on('change', function (event) { |
3735 }); |
3737 if (event.args) { |
3736 $('#wa_nacl').on('change', function(event) { |
3738 setWaterAgent('MgSO4', 0); |
3737 if (event.args) { |
3739 setWaterAgent('MgSO4', event.args.value); |
3738 setWaterAgent('NaCl', 0); |
3740 calcWater(); |
3739 setWaterAgent('NaCl', event.args.value); |
3741 } |
3740 calcWater(); |
3742 }); |
3741 } |
3743 $('#wa_nacl').on('change', function (event) { |
3742 }); |
3744 if (event.args) { |
3743 $('#wa_base_name').on('change', function(event) { |
3745 setWaterAgent('NaCl', 0); |
3744 if (event.args) { |
3746 setWaterAgent('NaCl', event.args.value); |
3745 var index = event.args.index; |
3747 calcWater(); |
3746 console.log('wa_base_name ' + index); |
3748 } |
3747 setWaterAgent(last_base, 0); |
3749 }); |
3748 last_base = BaseTypeData[index].nl; |
3750 $('#wa_base_name').on('change', function (event) { |
3749 setWaterAgent(last_base, parseFloat($('#wa_base').jqxNumberInput('decimal'))); |
3751 if (event.args) { |
3750 dataRecord.wa_base_name = index; |
3752 var index = event.args.index; |
3751 calcWater(); |
3753 console.log("wa_base_name "+index); |
3752 } |
3754 setWaterAgent(last_base, 0); |
3753 }); |
3755 last_base = BaseTypeData[index].nl; |
3754 $('#wa_base').on('change', function(event) { |
3756 setWaterAgent(last_base, parseFloat($("#wa_base").jqxNumberInput('decimal'))); |
3755 var name = BaseTypeData[$('#wa_base_name').val()].nl; |
3757 dataRecord.wa_base_name = index; |
3756 setWaterAgent(name, parseFloat(event.args.value)); |
3758 calcWater(); |
3757 calcWater(); |
3759 } |
3758 }); |
3760 }); |
3759 $('#wa_acid_name').on('change', function(event) { |
3761 $('#wa_base').on('change', function (event) { |
3760 if (event.args) { |
3762 var name = BaseTypeData[$("#wa_base_name").val()].nl; |
3761 var index = event.args.index; |
3763 setWaterAgent(name, parseFloat(event.args.value)); |
3762 console.log('wa_acid_name ' + index); |
3764 calcWater(); |
3763 setWaterAgent(last_acid, 0); |
3765 }); |
3764 last_acid = AcidTypeData[index].nl; |
3766 $('#wa_acid_name').on('change', function (event) { |
3765 setWaterAgent(last_acid, parseFloat($('#wa_acid').jqxNumberInput('decimal'))); |
3767 if (event.args) { |
3766 dataRecord.wa_acid_name = index; |
3768 var index = event.args.index; |
3767 calcWater(); |
3769 console.log("wa_acid_name "+index); |
3768 } |
3770 setWaterAgent(last_acid, 0); |
3769 }); |
3771 last_acid = AcidTypeData[index].nl; |
3770 $('#wa_acid').on('change', function(event) { |
3772 setWaterAgent(last_acid, parseFloat($("#wa_acid").jqxNumberInput('decimal'))); |
3771 var name = AcidTypeData[$('#wa_acid_name').val()].nl; |
3773 dataRecord.wa_acid_name = index; |
3772 setWaterAgent(name, parseFloat(event.args.value)); |
3774 calcWater(); |
3773 calcWater(); |
3775 } |
3774 }); |
3776 }); |
3775 $('#wa_acid_perc').on('change', function(event) { calcWater(); }); |
3777 $('#wa_acid').on('change', function (event) { |
3776 |
3778 var name = AcidTypeData[$("#wa_acid_name").val()].nl; |
3777 $('#color_method').on('change', function(event) { |
3779 setWaterAgent(name, parseFloat(event.args.value)); |
3778 dataRecord.color_method = event.args.index; |
3780 calcWater(); |
3779 calcFermentables(); |
3781 }); |
3780 }); |
3782 $('#wa_acid_perc').on('change', function (event) { calcWater(); }); |
3781 $('#ibu_method').on('change', function(event) { |
3783 |
3782 dataRecord.ibu_method = event.args.index; |
3784 $('#color_method').on('change', function (event) { |
3783 calcFermentables(); |
3785 dataRecord.color_method = event.args.index; |
3784 calcIBUs(); |
3786 calcFermentables(); |
3785 }); |
3787 }); |
3786 |
3788 $('#ibu_method').on('change', function (event) { |
3787 $('#batch_size').on('change', function(event) { |
3789 dataRecord.ibu_method = event.args.index; |
3788 console.log('batch_size change:' + event.args.value + ' old:' + dataRecord.batch_size); |
3790 calcFermentables(); |
3789 $('#est_a_vol').val(event.args.value * 1.04); |
3791 calcIBUs(); |
3790 var factor, new_boil = parseFloat(event.args.value) + dataRecord.boil_size - dataRecord.batch_size; |
3792 }); |
3791 factor = parseFloat(event.args.value) / dataRecord.batch_size; |
3793 |
3792 dataRecord.boil_size = new_boil; |
3794 $('#batch_size').on('change', function (event) { |
3793 $('#boil_size').val(Round(new_boil, 2)); |
3795 console.log("batch_size change:"+event.args.value+" old:"+dataRecord.batch_size); |
3794 $('#est_pre_vol').val(Round(new_boil * 1.04, 2)); |
3796 $("#est_a_vol").val(event.args.value * 1.04); |
3795 dataRecord.sparge_volume *= factor; |
3797 var factor, new_boil = parseFloat(event.args.value) + dataRecord.boil_size - dataRecord.batch_size; |
3796 $('#sparge_volume').val(dataRecord.sparge_volume); |
3798 factor = parseFloat(event.args.value) / dataRecord.batch_size; |
3797 $('#brew_sparge_volume').val(dataRecord.sparge_volume); |
3799 dataRecord.boil_size = new_boil; |
3798 dataRecord.batch_size = parseFloat(event.args.value); |
3800 $("#boil_size").val(Round(new_boil, 2)); |
3799 calcFermentablesFromOG(parseFloat($('#est_og').jqxNumberInput('decimal'))); // Keep the OG |
3801 $("#est_pre_vol").val(Round(new_boil * 1.04, 2)); |
3800 adjustWaters(factor); |
3802 dataRecord.sparge_volume *= factor; |
3801 calcFermentables(); |
3803 $("#sparge_volume").val(dataRecord.sparge_volume); |
3802 adjustHops(factor); |
3804 $("#brew_sparge_volume").val(dataRecord.sparge_volume); |
3803 adjustMiscs(factor); |
3805 dataRecord.batch_size = parseFloat(event.args.value); |
3804 adjustYeasts(factor); |
3806 calcFermentablesFromOG(parseFloat($("#est_og").jqxNumberInput('decimal'))); // Keep the OG |
3805 calcIBUs(); |
3807 adjustWaters(factor); |
3806 calcWater(); |
3808 calcFermentables(); |
3807 calcSparge(); |
3809 adjustHops(factor); |
3808 calcMash(); |
3810 adjustMiscs(factor); |
3809 }); |
3811 adjustYeasts(factor); |
3810 $('#boil_time').on('change', function(event) { |
3812 calcIBUs(); |
3811 console.log('boil_time change:' + parseFloat(event.args.value) + ' old:' + dataRecord.boil_time); |
3813 calcWater(); |
3812 var new_boil, new_evap, old_evap = parseFloat(dataRecord.boil_size) - parseFloat(dataRecord.batch_size); |
3814 calcSparge(); |
3813 new_evap = old_evap * (parseFloat(event.args.value) / dataRecord.boil_time); |
3815 calcMash(); |
3814 new_boil = parseFloat(dataRecord.batch_size) + new_evap; |
3816 }); |
3815 dataRecord.boil_time = parseFloat(event.args.value); |
3817 $('#boil_time').on('change', function (event) { |
3816 dataRecord.boil_size = new_boil; |
3818 console.log("boil_time change:"+parseFloat(event.args.value)+" old:"+dataRecord.boil_time); |
3817 $('#est_pre_vol').val(Round(new_boil * 1.04, 2)); |
3819 var new_boil, new_evap, old_evap = parseFloat(dataRecord.boil_size) - parseFloat(dataRecord.batch_size); |
3818 $('#boil_size').val(Round(new_boil, 2)); |
3820 new_evap = old_evap * (parseFloat(event.args.value) / dataRecord.boil_time); |
3819 calcFermentables(); |
3821 new_boil = parseFloat(dataRecord.batch_size) + new_evap; |
3820 calcIBUs(); |
3822 dataRecord.boil_time = parseFloat(event.args.value); |
3821 calcYeast(); |
3823 dataRecord.boil_size = new_boil; |
3822 }); |
3824 $("#est_pre_vol").val(Round(new_boil * 1.04, 2)); |
3823 $('#efficiency').on('change', function(event) { |
3825 $("#boil_size").val(Round(new_boil, 2)); |
3824 var estog = parseFloat($('#est_og').jqxNumberInput('decimal')); |
3826 calcFermentables(); |
3825 dataRecord.efficiency = parseFloat(event.args.value); |
3827 calcIBUs(); |
3826 console.log('efficiency change:' + dataRecord.efficiency + ' est_og:' + estog); |
3828 calcYeast(); |
3827 calcFermentablesFromOG(estog); // Keep the OG |
3829 }); |
3828 calcFermentables(); |
3830 $('#efficiency').on('change', function (event) { |
3829 calcIBUs(); |
3831 var estog = parseFloat($("#est_og").jqxNumberInput('decimal')); |
3830 calcYeast(); |
3832 dataRecord.efficiency = parseFloat(event.args.value); |
3831 }); |
3833 console.log("efficiency change:"+dataRecord.efficiency+" est_og:"+estog); |
3832 $('#est_og').on('change', function(event) { |
3834 calcFermentablesFromOG(estog); // Keep the OG |
3833 dataRecord.est_og = parseFloat(event.args.value); |
3835 calcFermentables(); |
3834 console.log('est_og change:' + dataRecord.est_og); |
3836 calcIBUs(); |
3835 $('#est_og2').val(dataRecord.est_og); |
3837 calcYeast(); |
3836 calcFermentablesFromOG(dataRecord.est_og); // Adjust fermentables amounts |
3838 }); |
3837 calcFermentables(); // Update the recipe details |
3839 $('#est_og').on('change', function (event) { |
3838 calcIBUs(); // and the IBU's. |
3840 dataRecord.est_og = parseFloat(event.args.value); |
3839 calcMash(); |
3841 console.log("est_og change:"+dataRecord.est_og); |
3840 calcYeast(); |
3842 $('#est_og2').val(dataRecord.est_og); |
3841 }); |
3843 calcFermentablesFromOG(dataRecord.est_og); // Adjust fermentables amounts |
3842 $('#mash_ph').on('change', function(event) { |
3844 calcFermentables(); // Update the recipe details |
3843 dataRecord.mash_ph = parseFloat(event.args.value); |
3845 calcIBUs(); // and the IBU's. |
3844 calcWater(); |
3846 calcMash(); |
3845 }); |
3847 calcYeast(); |
3846 |
3848 }); |
3847 $('#sparge_ph').on('change', function(event) { |
3849 $('#mash_ph').on('change', function (event) { |
3848 dataRecord.sparge_ph = parseFloat(event.args.value); |
3850 dataRecord.mash_ph = parseFloat(event.args.value); |
3849 calcSparge(); |
3851 calcWater(); |
3850 }); |
3852 }); |
3851 $('#sparge_volume').on('change', function(event) { |
3853 |
3852 dataRecord.sparge_volume = parseFloat(event.args.value); |
3854 $('#sparge_ph').on('change', function (event) { |
3853 $('#brew_sparge_volume').val(dataRecord.sparge_volume); |
3855 dataRecord.sparge_ph = parseFloat(event.args.value); |
3854 calcSparge(); |
3856 calcSparge(); |
3855 }); |
3857 }); |
3856 $('#sparge_temp').on('change', function(event) { |
3858 $('#sparge_volume').on('change', function (event) { |
3857 dataRecord.sparge_temp = parseFloat(event.args.value); |
3859 dataRecord.sparge_volume = parseFloat(event.args.value); |
3858 $('#brew_sparge_temperature').val(dataRecord.sparge_temp); |
3860 $('#brew_sparge_volume').val(dataRecord.sparge_volume); |
3859 }); |
3861 calcSparge(); |
3860 $('#sparge_source').on('change', function(event) { |
3862 }); |
3861 if (event.args) { |
3863 $("#sparge_temp").on('change', function (event) { |
3862 dataRecord.sparge_source = event.args.index; |
3864 dataRecord.sparge_temp = parseFloat(event.args.value); |
3863 calcSparge(); |
3865 $('#brew_sparge_temperature').val(dataRecord.sparge_temp); |
3864 } |
3866 }); |
3865 }); |
3867 $('#sparge_source').on('change', function (event) { |
3866 $('#sparge_acid_type').on('change', function(event) { |
3868 if (event.args) { |
3867 if (event.args) { |
3869 var index = event.args.index; |
3868 dataRecord.sparge_acid_type = event.args.index; |
3870 dataRecord.sparge_source= index; |
3869 console.log('new sparge_acid_type: ' + dataRecord.sparge_acid_type); |
3871 calcSparge(); |
3870 calcSparge(); |
3872 } |
3871 } |
3873 }); |
3872 }); |
3874 $('#sparge_acid_type').on('change', function (event) { |
3873 $('#sparge_acid_perc').on('change', function(event) { |
3875 if (event.args) { |
3874 dataRecord.sparge_acid_perc = parseFloat(event.args.value); |
3876 var index = event.args.index; |
3875 calcSparge(); |
3877 dataRecord.sparge_acid_type = index; |
3876 }); |
3878 console.log("new sparge_acid_type: "+dataRecord.sparge_acid_type); |
3877 |
3879 calcSparge(); |
3878 calcFermentation(); |
3880 } |
3879 calcCarbonation(); |
3881 }); |
3880 $('#package_volume').on('change', function(event) { |
3882 $('#sparge_acid_perc').on('change', function (event) { |
3881 var diff, tnew, told = dataRecord.package_volume + dataRecord.package_infuse_amount; |
3883 dataRecord.sparge_acid_perc = parseFloat(event.args.value); |
3882 dataRecord.package_volume = parseFloat(event.args.value); |
3884 calcSparge(); |
3883 if (dataRecord.package_volume > dataRecord.brew_fermenter_volume) { |
3885 }); |
3884 dataRecord.package_volume = dataRecord.brew_fermenter_volume; |
3886 |
3885 $('#package_volume').val(dataRecord.package_volume); |
3887 calcFermentation(); |
3886 } |
3888 calcCarbonation(); |
3887 tnew = dataRecord.package_volume + dataRecord.package_infuse_amount; |
3889 $('#package_volume').on('change', function (event) { |
3888 diff = tnew - told; |
3890 var diff, tnew, told = dataRecord.package_volume + dataRecord.package_infuse_amount; |
3889 if (told > 0) { |
3891 dataRecord.package_volume = parseFloat(event.args.value); |
3890 dataRecord.bottle_amount += (dataRecord.bottle_amount / told) * diff; |
3892 if (dataRecord.package_volume > dataRecord.brew_fermenter_volume) { |
3891 dataRecord.keg_amount += (dataRecord.keg_amount / told) * diff; |
3893 dataRecord.package_volume = dataRecord.brew_fermenter_volume; |
3892 } else { |
3894 $('#package_volume').val(dataRecord.package_volume); |
3893 dataRecord.bottle_amount = tnew; |
3895 } |
3894 dataRecord.keg_amount = 0; |
3896 tnew = dataRecord.package_volume + dataRecord.package_infuse_amount; |
3895 } |
3897 diff = tnew - told; |
3896 console.log('diff:' + diff + ' old:' + told + ' bottle:' + dataRecord.bottle_amount + ' keg:' + dataRecord.keg_amount); |
3898 if (told > 0) { |
3897 $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount * 1000) / 1000); |
3899 dataRecord.bottle_amount += (dataRecord.bottle_amount / told) * diff; |
3898 $('#keg_amount').val(parseFloat(dataRecord.keg_amount * 1000) / 1000); |
3900 dataRecord.keg_amount += (dataRecord.keg_amount / told) * diff; |
3899 calcCarbonation(); |
3901 } else { |
3900 }); |
3902 dataRecord.bottle_amount = tnew; |
3901 $('#package_infuse_amount').on('change', function(event) { |
3903 dataRecord.keg_amount = 0; |
3902 var diff, tnew, told = dataRecord.package_volume + dataRecord.package_infuse_amount; |
3904 } |
3903 dataRecord.package_infuse_amount = parseFloat(event.args.value); |
3905 console.log("diff:"+diff+" old:"+told+" bottle:"+dataRecord.bottle_amount+" keg:"+dataRecord.keg_amount); |
3904 tnew = dataRecord.package_volume + dataRecord.package_infuse_amount; |
3906 $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount * 1000) / 1000); |
3905 diff = tnew - told; |
3907 $('#keg_amount').val(parseFloat(dataRecord.keg_amount * 1000) / 1000); |
3906 if (told > 0) { |
3908 calcCarbonation(); |
3907 dataRecord.bottle_amount += (dataRecord.bottle_amount / told) * diff; |
3909 }); |
3908 dataRecord.keg_amount += (dataRecord.keg_amount / told) * diff; |
3910 $('#package_infuse_amount').on('change', function (event) { |
3909 } else { |
3911 var diff, tnew, told = dataRecord.package_volume + dataRecord.package_infuse_amount; |
3910 dataRecord.bottle_amount = tnew; |
3912 dataRecord.package_infuse_amount = parseFloat(event.args.value); |
3911 dataRecord.keg_amount = 0; |
3913 tnew = dataRecord.package_volume + dataRecord.package_infuse_amount; |
3912 } |
3914 diff = tnew - told; |
3913 console.log('diff:' + diff + ' old:' + told + ' bottle:' + dataRecord.bottle_amount + ' keg:' + dataRecord.keg_amount); |
3915 if (told > 0) { |
3914 $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount * 1000) / 1000); |
3916 dataRecord.bottle_amount += (dataRecord.bottle_amount / told) * diff; |
3915 $('#keg_amount').val(parseFloat(dataRecord.keg_amount * 1000) / 1000); |
3917 dataRecord.keg_amount += (dataRecord.keg_amount / told) * diff; |
3916 calcCarbonation(); |
3918 } else { |
3917 }); |
3919 dataRecord.bottle_amount = tnew; |
3918 $('#package_infuse_abv').on('change', function(event) { |
3920 dataRecord.keg_amount = 0; |
3919 dataRecord.package_infuse_abv = parseFloat(event.args.value); |
3921 } |
3920 calcCarbonation(); |
3922 console.log("diff:"+diff+" old:"+told+" bottle:"+dataRecord.bottle_amount+" keg:"+dataRecord.keg_amount); |
3921 }); |
3923 $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount * 1000) / 1000); |
3922 $('#bottle_amount').on('change', function(event) { |
3924 $('#keg_amount').val(parseFloat(dataRecord.keg_amount * 1000) / 1000); |
3923 var vtot, diff, vnew = parseFloat(event.args.value); |
3925 calcCarbonation(); |
3924 vtot = dataRecord.package_volume + dataRecord.package_infuse_amount; |
3926 }); |
3925 if (vnew > vtot) |
3927 $('#package_infuse_abv').on('change', function (event) { |
3926 vnew = vtot; |
3928 dataRecord.package_infuse_abv = parseFloat(event.args.value); |
3927 diff = dataRecord.bottle_amount - vnew; |
3929 calcCarbonation(); |
3928 dataRecord.bottle_amount = Math.round((dataRecord.bottle_amount - diff) * 1000) / 1000; |
3930 }); |
3929 dataRecord.keg_amount = Math.round((dataRecord.keg_amount + diff) * 1000) / 1000; |
3931 $('#bottle_amount').on('change', function (event) { |
3930 $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount)); |
3932 var vtot, diff, vnew = parseFloat(event.args.value); |
3931 $('#keg_amount').val(parseFloat(dataRecord.keg_amount)); |
3933 vtot = dataRecord.package_volume + dataRecord.package_infuse_amount; |
3932 calcCarbonation(); |
3934 if (vnew > vtot) |
3933 }); |
3935 vnew = vtot; |
3934 $('#bottle_priming_water').on('change', function(event) { |
3936 diff = dataRecord.bottle_amount - vnew; |
3935 dataRecord.bottle_priming_water = parseFloat(event.args.value); |
3937 dataRecord.bottle_amount = Math.round((dataRecord.bottle_amount - diff) * 1000) / 1000; |
3936 calcCarbonation(); |
3938 dataRecord.keg_amount = Math.round((dataRecord.keg_amount + diff) * 1000) / 1000; |
3937 }); |
3939 $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount)); |
3938 $('#keg_amount').on('change', function(event) { |
3940 $('#keg_amount').val(parseFloat(dataRecord.keg_amount)); |
3939 var diff, vtot, vnew = parseFloat(event.args.value); |
3941 calcCarbonation(); |
3940 vtot = dataRecord.package_volume + dataRecord.package_infuse_amount; |
3942 }); |
3941 if (vnew > vtot) |
3943 $("#bottle_priming_water").on('change', function (event) { |
3942 vnew = vtot; |
3944 dataRecord.bottle_priming_water = parseFloat(event.args.value); |
3943 diff = dataRecord.keg_amount - vnew; |
3945 calcCarbonation(); |
3944 dataRecord.bottle_amount = Math.round((dataRecord.bottle_amount + diff) * 1000) / 1000; |
3946 }); |
3945 dataRecord.keg_amount = Math.round((dataRecord.keg_amount - diff) * 1000) / 1000; |
3947 $('#keg_amount').on('change', function (event) { |
3946 $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount)); |
3948 var diff, vtot, vnew = parseFloat(event.args.value); |
3947 $('#keg_amount').val(parseFloat(dataRecord.keg_amount)); |
3949 vtot = dataRecord.package_volume + dataRecord.package_infuse_amount; |
3948 calcCarbonation(); |
3950 if (vnew > vtot) |
3949 }); |
3951 vnew = vtot; |
3950 $('#keg_priming_water').on('change', function(event) { |
3952 diff = dataRecord.keg_amount - vnew; |
3951 dataRecord.keg_priming_water = parseFloat(event.args.value); |
3953 dataRecord.bottle_amount = Math.round((dataRecord.bottle_amount + diff) * 1000) / 1000; |
3952 calcCarbonation(); |
3954 dataRecord.keg_amount = Math.round((dataRecord.keg_amount - diff) * 1000) / 1000; |
3953 }); |
3955 $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount)); |
3954 $('#bottle_carbonation').on('change', function(event) { |
3956 $('#keg_amount').val(parseFloat(dataRecord.keg_amount)); |
3955 dataRecord.bottle_carbonation = parseFloat(event.args.value); |
3957 calcCarbonation(); |
3956 calcCarbonation(); |
3958 }); |
3957 }); |
3959 $("#keg_priming_water").on('change', function (event) { |
3958 $('#bottle_carbonation_temp').on('change', function(event) { |
3960 dataRecord.keg_priming_water = parseFloat(event.args.value); |
3959 dataRecord.bottle_carbonation_temp = parseFloat(event.args.value); |
3961 calcCarbonation(); |
3960 calcCarbonation(); |
3962 }); |
3961 }); |
3963 $('#bottle_carbonation').on('change', function (event) { |
3962 $('#keg_carbonation').on('change', function(event) { |
3964 dataRecord.bottle_carbonation = parseFloat(event.args.value); |
3963 dataRecord.keg_carbonation = parseFloat(event.args.value); |
3965 calcCarbonation(); |
3964 calcCarbonation(); |
3966 }); |
3965 }); |
3967 $('#bottle_carbonation_temp').on('change', function (event) { |
3966 $('#keg_forced_carb').on('checked', function(event) { |
3968 dataRecord.bottle_carbonation_temp = parseFloat(event.args.value); |
3967 dataRecord.keg_forced_carb = 1; |
3969 calcCarbonation(); |
3968 calcCarbonation(); |
3970 }); |
3969 }); |
3971 $('#keg_carbonation').on('change', function (event) { |
3970 $('#keg_forced_carb').on('unchecked', function(event) { |
3972 dataRecord.keg_carbonation = parseFloat(event.args.value); |
3971 dataRecord.keg_forced_carb = 0; |
3973 calcCarbonation(); |
3972 calcCarbonation(); |
3974 }); |
3973 }); |
3975 $("#keg_forced_carb").on('checked', function (event) { |
3974 $('#keg_carbonation_temp').on('change', function(event) { |
3976 dataRecord.keg_forced_carb = 1; |
3975 dataRecord.keg_carbonation_temp = parseFloat(event.args.value); |
3977 calcCarbonation(); |
3976 calcCarbonation(); |
3978 }); |
3977 }); |
3979 $("#keg_forced_carb").on('unchecked', function (event) { |
3978 |
3980 dataRecord.keg_forced_carb = 0; |
3979 $('#brew_fermenter_extrawater').on('change', function(event) { |
3981 calcCarbonation(); |
3980 dataRecord.brew_fermenter_extrawater = parseFloat(event.args.value); |
3982 }); |
3981 calcFermentables(); |
3983 $('#keg_carbonation_temp').on('change', function (event) { |
3982 calcIBUs(); |
3984 dataRecord.keg_carbonation_temp = parseFloat(event.args.value); |
3983 calcYeast(); |
3985 calcCarbonation(); |
3984 }); |
3986 }); |
3985 $('#brew_fermenter_tcloss').on('change', function(event) { |
3987 |
3986 dataRecord.brew_fermenter_tcloss = parseFloat(event.args.value); |
3988 $("#brew_fermenter_extrawater").on('change',function (event){ |
3987 calcFermentables(); |
3989 dataRecord.brew_fermenter_extrawater=parseFloat(event.args.value);calcFermentables();calcIBUs();calcYeast(); |
3988 calcIBUs(); |
3990 }); |
3989 calcYeast(); |
3991 $("#brew_fermenter_tcloss").on('change',function (event){ |
3990 }); |
3992 dataRecord.brew_fermenter_tcloss=parseFloat(event.args.value);calcFermentables();calcIBUs();calcYeast(); |
3991 $('#primary_end_sg').on('change', function(event) { |
3993 }); |
3992 dataRecord.primary_end_sg = parseFloat(event.args.value); |
3994 $("#primary_end_sg").on('change',function (event){dataRecord.primary_end_sg=parseFloat(event.args.value);calcFermentation();}); |
3993 calcFermentation(); |
3995 $("#primary_end_brix").on('change', function (event) { |
3994 }); |
3996 var OBrix, FBrix, FG; |
3995 $('#primary_end_brix').on('change', function(event) { |
3997 if(dataRecord.brew_fermenter_sg>=1.020){ |
3996 var OBrix, FBrix, FG; |
3998 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg); |
3997 if (dataRecord.brew_fermenter_sg >= 1.020) { |
3999 FBrix = parseFloat(event.args.value); |
3998 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg); |
4000 FG = Round(1.0031 - 0.002318474*OBrix - 0.000007775*(OBrix*OBrix) - 0.000000034*Math.pow(OBrix,3) + |
3999 FBrix = parseFloat(event.args.value); |
4001 0.00574*(FBrix) + 0.00003344*(FBrix*FBrix) + 0.000000086*Math.pow(FBrix,3), 4); |
4000 FG = Round(1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) - 0.000000034 * Math.pow(OBrix, 3) + |
4002 //console.log("OBrix:"+OBrix+" FBrix:"+FBrix+" FG:"+FG); |
4001 0.00574 * (FBrix) + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3), 4); |
4003 if (FBrix > 0.05) { |
4002 //console.log("OBrix:"+OBrix+" FBrix:"+FBrix+" FG:"+FG); |
4004 $("#primary_end_sg").val(FG); |
4003 if (FBrix > 0.05) { |
4005 dataRecord.primary_end_sg=FG; |
4004 $('#primary_end_sg').val(FG); |
4006 } |
4005 dataRecord.primary_end_sg = FG; |
4007 calcFermentation(); |
4006 } |
4008 } |
4007 calcFermentation(); |
4009 }); |
4008 } |
4010 $("#secondary_end_sg").on('change',function (event){dataRecord.secondary_end_sg=parseFloat(event.args.value);calcFermentation();}); |
4009 }); |
4011 $("#secondary_end_brix").on('change', function (event) { |
4010 $('#secondary_end_sg').on('change', function(event) { |
4012 var OBrix, FBrix, FG; |
4011 dataRecord.secondary_end_sg = parseFloat(event.args.value); |
4013 if(dataRecord.brew_fermenter_sg>=1.020){ |
4012 calcFermentation(); |
4014 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg); |
4013 }); |
4015 FBrix = parseFloat(event.args.value); |
4014 $('#secondary_end_brix').on('change', function(event) { |
4016 FG = Round(1.0031 - 0.002318474*OBrix - 0.000007775*(OBrix*OBrix) - 0.000000034*Math.pow(OBrix,3) + |
4015 var OBrix, FBrix, FG; |
4017 0.00574*(FBrix) + 0.00003344*(FBrix*FBrix) + 0.000000086*Math.pow(FBrix,3), 4); |
4016 if (dataRecord.brew_fermenter_sg >= 1.020) { |
4018 //console.log("OBrix:"+OBrix+" FBrix:"+FBrix+" FG:"+FG); |
4017 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg); |
4019 if (FBrix > 0.05) { |
4018 FBrix = parseFloat(event.args.value); |
4020 $("#secondary_end_sg").val(FG); |
4019 FG = Round(1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) - 0.000000034 * Math.pow(OBrix, 3) + |
4021 dataRecord.secondary_end_sg=FG; |
4020 0.00574 * (FBrix) + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3), 4); |
4022 } |
4021 //console.log("OBrix:"+OBrix+" FBrix:"+FBrix+" FG:"+FG); |
4023 calcFermentation(); |
4022 if (FBrix > 0.05) { |
4024 } |
4023 $('#secondary_end_sg').val(FG); |
4025 }); |
4024 dataRecord.secondary_end_sg = FG; |
4026 $("#final_brix").on('change',function (event){ |
4025 } |
4027 var OBrix, FBrix, FG; |
4026 calcFermentation(); |
4028 if(dataRecord.brew_fermenter_sg>=1.020){ |
4027 } |
4029 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg); |
4028 }); |
4030 FBrix = parseFloat(event.args.value); |
4029 $('#final_brix').on('change', function(event) { |
4031 FG = Round(1.0031 - 0.002318474*OBrix - 0.000007775*(OBrix*OBrix) - 0.000000034*Math.pow(OBrix,3) + |
4030 var OBrix, FBrix, FG; |
4032 0.00574*(FBrix) + 0.00003344*(FBrix*FBrix) + 0.000000086*Math.pow(FBrix,3), 4); |
4031 if (dataRecord.brew_fermenter_sg >= 1.020) { |
4033 //console.log("OBrix:"+OBrix+" FBrix:"+FBrix+" FG:"+FG); |
4032 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg); |
4034 if (FBrix > 0.05) { |
4033 FBrix = parseFloat(event.args.value); |
4035 $("#fg").val(FG); |
4034 FG = Round(1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) - 0.000000034 * Math.pow(OBrix, 3) + |
4036 dataRecord.fg=FG; |
4035 0.00574 * (FBrix) + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3), 4); |
4037 } |
4036 //console.log("OBrix:"+OBrix+" FBrix:"+FBrix+" FG:"+FG); |
4038 calcFermentation(); |
4037 if (FBrix > 0.05) { |
4039 } |
4038 $('#fg').val(FG); |
4040 }); |
4039 dataRecord.fg = FG; |
4041 $("#fg").on('change',function (event){dataRecord.fg=parseFloat(event.args.value);calcFermentation();}); |
4040 } |
4042 $("#BLog").jqxButton({disabled:(dataRecord.log_brew)?false:true}); |
4041 calcFermentation(); |
4043 $("#FLog").jqxButton({disabled:(dataRecord.log_fermentation)?false:true}); |
4042 } |
4044 } |
4043 }); |
4045 |
4044 $('#fg').on('change', function(event) { |
4046 $("#styleSelect").jqxDropDownList({ |
4045 dataRecord.fg = parseFloat(event.args.value); |
4047 placeHolder: "Kies bierstijl:", |
4046 calcFermentation(); |
4048 theme: theme, |
4047 }); |
4049 source: styleslist, |
4048 $('#BLog').jqxButton({ disabled: (dataRecord.log_brew) ? false : true}); |
4050 displayMember: "name", |
4049 $('#FLog').jqxButton({ disabled: (dataRecord.log_fermentation) ? false : true}); |
4051 width: 180, |
4050 } |
4052 height: 23, |
4051 |
4053 dropDownVerticalAlignment: 'top', |
4052 $('#styleSelect').jqxDropDownList({ |
4054 dropDownWidth: 500, |
4053 placeHolder: 'Kies bierstijl:', |
4055 dropDownHeight: 380, |
4054 theme: theme, |
4056 renderer: function (index, label, value) { |
4055 source: styleslist, |
4057 var datarecord = styleslist.records[index]; |
4056 displayMember: 'name', |
4058 return datarecord.style_guide + " " + datarecord.style_letter+ " " + datarecord.name; |
4057 width: 180, |
4059 } |
4058 height: 23, |
4060 }); |
4059 dropDownVerticalAlignment: 'top', |
4061 $("#styleSelect").on('select', function (event) { |
4060 dropDownWidth: 500, |
4062 if (event.args) { |
4061 dropDownHeight: 380, |
4063 var datarecord, index = event.args.index; |
4062 renderer: function(index, label, value) { |
4064 datarecord = styleslist.records[index]; |
4063 var datarecord = styleslist.records[index]; |
4065 $("#st_name").val(datarecord.name); |
4064 return datarecord.style_guide + ' ' + datarecord.style_letter + ' ' + datarecord.name; |
4066 $("#st_category").val(datarecord.category); |
4065 } |
4067 $("#st_category_number").val(datarecord.category_number); |
4066 }); |
4068 $("#st_letter").val(datarecord.style_letter); |
4067 $('#styleSelect').on('select', function(event) { |
4069 $("#st_guide").val(datarecord.style_guide); |
4068 if (event.args) { |
4070 $("#st_type").val(StyleTypeData[datarecord.type].nl); |
4069 var datarecord, index = event.args.index; |
4071 $("#st_og_min").val(datarecord.og_min); |
4070 datarecord = styleslist.records[index]; |
4072 $("#st_og_max").val(datarecord.og_max); |
4071 $('#st_name').val(datarecord.name); |
4073 $("#st_fg_min").val(datarecord.fg_min); |
4072 $('#st_category').val(datarecord.category); |
4074 $("#st_fg_max").val(datarecord.fg_max); |
4073 $('#st_category_number').val(datarecord.category_number); |
4075 $("#st_ibu_min").val(datarecord.ibu_min); |
4074 $('#st_letter').val(datarecord.style_letter); |
4076 $("#st_ibu_max").val(datarecord.ibu_max); |
4075 $('#st_guide').val(datarecord.style_guide); |
4077 $("#st_color_min").val(datarecord.color_min); |
4076 $('#st_type').val(StyleTypeData[datarecord.type].nl); |
4078 $("#st_color_max").val(datarecord.color_max); |
4077 $('#st_og_min').val(datarecord.og_min); |
4079 $("#st_carb_min").val(datarecord.carb_min); |
4078 $('#st_og_max').val(datarecord.og_max); |
4080 $("#st_carb_min2").val(datarecord.carb_min); |
4079 $('#st_fg_min').val(datarecord.fg_min); |
4081 $("#st_carb_max").val(datarecord.carb_max); |
4080 $('#st_fg_max').val(datarecord.fg_max); |
4082 $("#st_carb_max2").val(datarecord.carb_max); |
4081 $('#st_ibu_min').val(datarecord.ibu_min); |
4083 $("#st_abv_min").val(datarecord.abv_min); |
4082 $('#st_ibu_max').val(datarecord.ibu_max); |
4084 $("#st_abv_max").val(datarecord.abv_max); |
4083 $('#st_color_min').val(datarecord.color_min); |
4085 } |
4084 $('#st_color_max').val(datarecord.color_max); |
4086 }); |
4085 $('#st_carb_min').val(datarecord.carb_min); |
4087 |
4086 $('#st_carb_min2').val(datarecord.carb_min); |
4088 // Equipemnt dropdown list |
4087 $('#st_carb_max').val(datarecord.carb_max); |
4089 $("#equipmentSelect").jqxDropDownList({ |
4088 $('#st_carb_max2').val(datarecord.carb_max); |
4090 placeHolder: "Kies apparatuur:", |
4089 $('#st_abv_min').val(datarecord.abv_min); |
4091 theme: theme, |
4090 $('#st_abv_max').val(datarecord.abv_max); |
4092 source: equipmentlist, |
4091 } |
4093 displayMember: "name", |
4092 }); |
4094 width: 170, |
4093 |
4095 height: 23, |
4094 // Equipemnt dropdown list |
4096 dropDownWidth: 300, |
4095 $('#equipmentSelect').jqxDropDownList({ |
4097 renderer: function (index, label, value) { |
4096 placeHolder: 'Kies apparatuur:', |
4098 var datarecord = equipmentlist.records[index]; |
4097 theme: theme, |
4099 return datarecord.batch_size + " liter " + datarecord.name; |
4098 source: equipmentlist, |
4100 } |
4099 displayMember: 'name', |
4101 }); |
4100 width: 170, |
4102 $("#equipmentSelect").on('select', function (event) { |
4101 height: 23, |
4103 if (event.args) { |
4102 dropDownWidth: 300, |
4104 var datarecord, factor, index = event.args.index; |
4103 renderer: function(index, label, value) { |
4105 datarecord = equipmentlist.records[index]; |
4104 var datarecord = equipmentlist.records[index]; |
4106 factor = datarecord.batch_size / dataRecord.batch_size; |
4105 return datarecord.batch_size + ' liter ' + datarecord.name; |
4107 $("#eq_name").val(datarecord.name); |
4106 } |
4108 $("#eq_boil_size").val(datarecord.boil_size); |
4107 }); |
4109 dataRecord.boil_size = datarecord.boil_size; |
4108 $('#equipmentSelect').on('select', function(event) { |
4110 $("#boil_size").val(datarecord.boil_size); |
4109 if (event.args) { |
4111 $("#eq_batch_size").val(datarecord.batch_size); |
4110 var datarecord, factor, index = event.args.index; |
4112 dataRecord.batch_size = datarecord.batch_size; |
4111 datarecord = equipmentlist.records[index]; |
4113 $("#batch_size").val(datarecord.batch_size); |
4112 factor = datarecord.batch_size / dataRecord.batch_size; |
4114 $("#est_a_vol").val(datarecord.batch_size * 1.04); |
4113 $('#eq_name').val(datarecord.name); |
4115 $("#eq_tun_volume").val(datarecord.tun_volume); |
4114 $('#eq_boil_size').val(datarecord.boil_size); |
4116 dataRecord.eq_tun_weight = datarecord.tun_weight; |
4115 dataRecord.boil_size = datarecord.boil_size; |
4117 dataRecord.eq_tun_specific_heat = datarecord.tun_specific_heat; |
4116 $('#boil_size').val(datarecord.boil_size); |
4118 dataRecord.eq_tun_material = datarecord.tun_material; |
4117 $('#eq_batch_size').val(datarecord.batch_size); |
4119 dataRecord.eq_tun_height = datarecord.tun_height / 100.0; |
4118 dataRecord.batch_size = datarecord.batch_size; |
4120 $("#eq_top_up_water").val(datarecord.top_up_water); |
4119 $('#batch_size').val(datarecord.batch_size); |
4121 dataRecord.eq_trub_chiller_loss = datarecord.trub_chiller_loss; |
4120 $('#est_a_vol').val(datarecord.batch_size * 1.04); |
4122 $("#eq_trub_chiller_loss").val(datarecord.trub_chiller_loss); |
4121 $('#eq_tun_volume').val(datarecord.tun_volume); |
4123 $("#eq_evap_rate").val(datarecord.evap_rate); |
4122 dataRecord.eq_tun_weight = datarecord.tun_weight; |
4124 $("#eq_boil_time").val(datarecord.boil_time); |
4123 dataRecord.eq_tun_specific_heat = datarecord.tun_specific_heat; |
4125 dataRecord.eq_calc_boil_volume = datarecord.calc_boil_volume; |
4124 dataRecord.eq_tun_material = datarecord.tun_material; |
4126 $("#eq_top_up_kettle").val(datarecord.top_up_kettle); |
4125 dataRecord.eq_tun_height = datarecord.tun_height / 100.0; |
4127 $("#eq_hop_utilization").val(datarecord.hop_utilization); |
4126 $('#eq_top_up_water').val(datarecord.top_up_water); |
4128 $("#eq_notes").val(datarecord.notes); |
4127 dataRecord.eq_trub_chiller_loss = datarecord.trub_chiller_loss; |
4129 $("#eq_lauter_volume").val(datarecord.lauter_volume); |
4128 $('#eq_trub_chiller_loss').val(datarecord.trub_chiller_loss); |
4130 dataRecord.eq_lauter_height = datarecord.lauter_height / 100.0; |
4129 $('#eq_evap_rate').val(datarecord.evap_rate); |
4131 $("#eq_lauter_deadspace").val(datarecord.lauter_deadspace); |
4130 $('#eq_boil_time').val(datarecord.boil_time); |
4132 $("#eq_kettle_volume").val(datarecord.kettle_volume); |
4131 dataRecord.eq_calc_boil_volume = datarecord.calc_boil_volume; |
4133 dataRecord.eq_kettle_height = datarecord.kettle_height / 100.0; |
4132 $('#eq_top_up_kettle').val(datarecord.top_up_kettle); |
4134 $("#eq_mash_volume").val(datarecord.mash_volume); |
4133 $('#eq_hop_utilization').val(datarecord.hop_utilization); |
4135 $("#eq_mash_max").val(datarecord.mash_max); |
4134 $('#eq_notes').val(datarecord.notes); |
4136 dataRecord.eq_mash_max = datarecord.mash_max; |
4135 $('#eq_lauter_volume').val(datarecord.lauter_volume); |
4137 $("#mash_max").val(datarecord.mash_max); |
4136 dataRecord.eq_lauter_height = datarecord.lauter_height / 100.0; |
4138 $("#eq_efficiency").val(datarecord.efficiency); |
4137 $('#eq_lauter_deadspace').val(datarecord.lauter_deadspace); |
4139 dataRecord.efficiency = datarecord.efficiency; |
4138 $('#eq_kettle_volume').val(datarecord.kettle_volume); |
4140 $("#efficiency").val(datarecord.efficiency); |
4139 dataRecord.eq_kettle_height = datarecord.kettle_height / 100.0; |
4141 |
4140 $('#eq_mash_volume').val(datarecord.mash_volume); |
4142 dataRecord.sparge_volume = Math.round(datarecord.boil_size * 5) / 10; |
4141 $('#eq_mash_max').val(datarecord.mash_max); |
4143 $("#sparge_volume").val(dataRecord.sparge_volume); |
4142 dataRecord.eq_mash_max = datarecord.mash_max; |
4144 $("#brew_sparge_volume").val(dataRecord.sparge_volume); |
4143 $('#mash_max').val(datarecord.mash_max); |
4145 $("#est_pre_vol").val(datarecord.boil_size * 1.04); |
4144 $('#eq_efficiency').val(datarecord.efficiency); |
4146 calcFermentablesFromOG(parseFloat($("#est_og").jqxNumberInput('decimal'))); // Keep the OG |
4145 dataRecord.efficiency = datarecord.efficiency; |
4147 adjustWaters(factor); |
4146 $('#efficiency').val(datarecord.efficiency); |
4148 calcFermentables(); |
4147 |
4149 adjustHops(factor); |
4148 dataRecord.sparge_volume = Math.round(datarecord.boil_size * 5) / 10; |
4150 adjustMiscs(factor); |
4149 $('#sparge_volume').val(dataRecord.sparge_volume); |
4151 adjustYeasts(factor); |
4150 $('#brew_sparge_volume').val(dataRecord.sparge_volume); |
4152 calcIBUs(); |
4151 $('#est_pre_vol').val(datarecord.boil_size * 1.04); |
4153 calcWater(); |
4152 calcFermentablesFromOG(parseFloat($('#est_og').jqxNumberInput('decimal'))); // Keep the OG |
4154 calcSparge(); |
4153 adjustWaters(factor); |
4155 } |
4154 calcFermentables(); |
4156 }); |
4155 adjustHops(factor); |
4157 |
4156 adjustMiscs(factor); |
4158 function saveRecord() { |
4157 adjustYeasts(factor); |
4159 console.log("saveRecord()"); |
4158 calcIBUs(); |
4160 var row = { |
4159 calcWater(); |
4161 record: my_record, |
4160 calcSparge(); |
4162 uuid: dataRecord.uuid, |
4161 } |
4163 name: $("#name").val(), |
4162 }); |
4164 code: $("#code").val(), |
4163 |
4165 birth: $("#birth").val(), |
4164 function saveRecord() { |
4166 stage: dataRecord.stage, |
4165 console.log('saveRecord()'); |
4167 notes: $("#notes").val(), |
4166 var row = { |
4168 log_brew: dataRecord.log_brew, |
4167 record: my_record, |
4169 log_fermentation: dataRecord.log_fermentation, |
4168 uuid: dataRecord.uuid, |
4170 inventory_reduced: dataRecord.inventory_reduced, |
4169 name: $('#name').val(), |
4171 locked: dataRecord.locked, |
4170 code: $('#code').val(), |
4172 eq_name: $("#eq_name").val(), |
4171 birth: $('#birth').val(), |
4173 eq_boil_size: parseFloat($("#eq_boil_size").jqxNumberInput('decimal')), |
4172 stage: dataRecord.stage, |
4174 eq_batch_size: parseFloat($("#eq_batch_size").jqxNumberInput('decimal')), |
4173 notes: $('#notes').val(), |
4175 eq_tun_volume: parseFloat($("#eq_tun_volume").jqxNumberInput('decimal')), |
4174 log_brew: dataRecord.log_brew, |
4176 eq_tun_weight: dataRecord.eq_tun_weight, |
4175 log_fermentation: dataRecord.log_fermentation, |
4177 eq_tun_specific_heat: dataRecord.eq_tun_specific_heat, |
4176 inventory_reduced: dataRecord.inventory_reduced, |
4178 eq_tun_material: dataRecord.eq_tun_material, |
4177 locked: dataRecord.locked, |
4179 eq_tun_height: dataRecord.eq_tun_height, |
4178 eq_name: $('#eq_name').val(), |
4180 eq_top_up_water: parseFloat($("#eq_top_up_water").jqxNumberInput('decimal')), |
4179 eq_boil_size: parseFloat($('#eq_boil_size').jqxNumberInput('decimal')), |
4181 eq_trub_chiller_loss: parseFloat($("#eq_trub_chiller_loss").jqxNumberInput('decimal')), |
4180 eq_batch_size: parseFloat($('#eq_batch_size').jqxNumberInput('decimal')), |
4182 eq_evap_rate: parseFloat($("#eq_evap_rate").jqxNumberInput('decimal')), |
4181 eq_tun_volume: parseFloat($('#eq_tun_volume').jqxNumberInput('decimal')), |
4183 eq_boil_time: parseFloat($("#eq_boil_time").jqxNumberInput('decimal')), |
4182 eq_tun_weight: dataRecord.eq_tun_weight, |
4184 eq_calc_boil_volume: dataRecord.eq_calc_boil_volume, |
4183 eq_tun_specific_heat: dataRecord.eq_tun_specific_heat, |
4185 eq_top_up_kettle: parseFloat($("#eq_top_up_kettle").jqxNumberInput('decimal')), |
4184 eq_tun_material: dataRecord.eq_tun_material, |
4186 eq_hop_utilization: parseFloat($("#eq_hop_utilization").jqxNumberInput('decimal')), |
4185 eq_tun_height: dataRecord.eq_tun_height, |
4187 eq_notes: $("#eq_notes").val(), |
4186 eq_top_up_water: parseFloat($('#eq_top_up_water').jqxNumberInput('decimal')), |
4188 eq_lauter_volume: parseFloat($("#eq_lauter_volume").jqxNumberInput('decimal')), |
4187 eq_trub_chiller_loss: parseFloat($('#eq_trub_chiller_loss').jqxNumberInput('decimal')), |
4189 eq_lauter_height: dataRecord.eq_lauter_height, |
4188 eq_evap_rate: parseFloat($('#eq_evap_rate').jqxNumberInput('decimal')), |
4190 eq_lauter_deadspace: parseFloat($("#eq_lauter_deadspace").jqxNumberInput('decimal')), |
4189 eq_boil_time: parseFloat($('#eq_boil_time').jqxNumberInput('decimal')), |
4191 eq_kettle_volume: parseFloat($("#eq_kettle_volume").jqxNumberInput('decimal')), |
4190 eq_calc_boil_volume: dataRecord.eq_calc_boil_volume, |
4192 eq_kettle_height: dataRecord.eq_kettle_height, |
4191 eq_top_up_kettle: parseFloat($('#eq_top_up_kettle').jqxNumberInput('decimal')), |
4193 eq_mash_volume: parseFloat($("#eq_mash_volume").jqxNumberInput('decimal')), |
4192 eq_hop_utilization: parseFloat($('#eq_hop_utilization').jqxNumberInput('decimal')), |
4194 eq_mash_max: parseFloat($("#eq_mash_max").jqxNumberInput('decimal')), |
4193 eq_notes: $('#eq_notes').val(), |
4195 eq_efficiency: parseFloat($("#eq_efficiency").jqxNumberInput('decimal')), |
4194 eq_lauter_volume: parseFloat($('#eq_lauter_volume').jqxNumberInput('decimal')), |
4196 brew_date_start: $("#brew_date_start").val(), |
4195 eq_lauter_height: dataRecord.eq_lauter_height, |
4197 brew_mash_ph: parseFloat($("#brew_mash_ph").jqxNumberInput('decimal')), |
4196 eq_lauter_deadspace: parseFloat($('#eq_lauter_deadspace').jqxNumberInput('decimal')), |
4198 brew_mash_sg: parseFloat($("#brew_mash_sg").jqxNumberInput('decimal')), |
4197 eq_kettle_volume: parseFloat($('#eq_kettle_volume').jqxNumberInput('decimal')), |
4199 brew_mash_efficiency: parseFloat($("#brew_mash_efficiency").jqxNumberInput('decimal')), |
4198 eq_kettle_height: dataRecord.eq_kettle_height, |
4200 brew_sparge_est: parseFloat($("#brew_sparge_est").jqxNumberInput('decimal')), |
4199 eq_mash_volume: parseFloat($('#eq_mash_volume').jqxNumberInput('decimal')), |
4201 brew_sparge_ph: parseFloat($("#brew_sparge_ph").jqxNumberInput('decimal')), |
4200 eq_mash_max: parseFloat($('#eq_mash_max').jqxNumberInput('decimal')), |
4202 brew_preboil_volume: parseFloat($("#brew_preboil_volume").jqxNumberInput('decimal')), |
4201 eq_efficiency: parseFloat($('#eq_efficiency').jqxNumberInput('decimal')), |
4203 brew_preboil_sg: parseFloat($("#brew_preboil_sg").jqxNumberInput('decimal')), |
4202 brew_date_start: $('#brew_date_start').val(), |
4204 brew_preboil_ph: parseFloat($("#brew_preboil_ph").jqxNumberInput('decimal')), |
4203 brew_mash_ph: parseFloat($('#brew_mash_ph').jqxNumberInput('decimal')), |
4205 brew_preboil_efficiency: parseFloat($("#brew_preboil_efficiency").jqxNumberInput('decimal')), |
4204 brew_mash_sg: parseFloat($('#brew_mash_sg').jqxNumberInput('decimal')), |
4206 brew_aboil_volume: parseFloat($("#brew_aboil_volume").jqxNumberInput('decimal')), |
4205 brew_mash_efficiency: parseFloat($('#brew_mash_efficiency').jqxNumberInput('decimal')), |
4207 brew_aboil_sg: parseFloat($("#brew_aboil_sg").jqxNumberInput('decimal')), |
4206 brew_sparge_est: parseFloat($('#brew_sparge_est').jqxNumberInput('decimal')), |
4208 brew_aboil_ph: parseFloat($("#brew_aboil_ph").jqxNumberInput('decimal')), |
4207 brew_sparge_ph: parseFloat($('#brew_sparge_ph').jqxNumberInput('decimal')), |
4209 brew_aboil_efficiency: parseFloat($("#brew_aboil_efficiency").jqxNumberInput('decimal')), |
4208 brew_preboil_volume: parseFloat($('#brew_preboil_volume').jqxNumberInput('decimal')), |
4210 brew_cooling_method: $("#brew_cooling_method").val(), |
4209 brew_preboil_sg: parseFloat($('#brew_preboil_sg').jqxNumberInput('decimal')), |
4211 brew_cooling_time: parseFloat($("#brew_cooling_time").jqxNumberInput('decimal')), |
4210 brew_preboil_ph: parseFloat($('#brew_preboil_ph').jqxNumberInput('decimal')), |
4212 brew_cooling_to: parseFloat($("#brew_cooling_to").jqxNumberInput('decimal')), |
4211 brew_preboil_efficiency: parseFloat($('#brew_preboil_efficiency').jqxNumberInput('decimal')), |
4213 brew_whirlpool9: parseFloat($("#brew_whirlpool9").jqxNumberInput('decimal')), |
4212 brew_aboil_volume: parseFloat($('#brew_aboil_volume').jqxNumberInput('decimal')), |
4214 brew_whirlpool7: parseFloat($("#brew_whirlpool7").jqxNumberInput('decimal')), |
4213 brew_aboil_sg: parseFloat($('#brew_aboil_sg').jqxNumberInput('decimal')), |
4215 brew_whirlpool6: parseFloat($("#brew_whirlpool6").jqxNumberInput('decimal')), |
4214 brew_aboil_ph: parseFloat($('#brew_aboil_ph').jqxNumberInput('decimal')), |
4216 brew_whirlpool2: parseFloat($("#brew_whirlpool2").jqxNumberInput('decimal')), |
4215 brew_aboil_efficiency: parseFloat($('#brew_aboil_efficiency').jqxNumberInput('decimal')), |
4217 brew_fermenter_volume: parseFloat($("#brew_fermenter_volume").jqxNumberInput('decimal')), |
4216 brew_cooling_method: $('#brew_cooling_method').val(), |
4218 brew_fermenter_extrawater: parseFloat($("#brew_fermenter_extrawater").jqxNumberInput('decimal')), |
4217 brew_cooling_time: parseFloat($('#brew_cooling_time').jqxNumberInput('decimal')), |
4219 brew_fermenter_tcloss: parseFloat($("#brew_fermenter_tcloss").jqxNumberInput('decimal')), |
4218 brew_cooling_to: parseFloat($('#brew_cooling_to').jqxNumberInput('decimal')), |
4220 brew_aeration_time: parseFloat($("#brew_aeration_time").jqxNumberInput('decimal')), |
4219 brew_whirlpool9: parseFloat($('#brew_whirlpool9').jqxNumberInput('decimal')), |
4221 brew_aeration_speed: parseFloat($("#brew_aeration_speed").jqxNumberInput('decimal')), |
4220 brew_whirlpool7: parseFloat($('#brew_whirlpool7').jqxNumberInput('decimal')), |
4222 brew_aeration_type: $("#brew_aeration_type").val(), |
4221 brew_whirlpool6: parseFloat($('#brew_whirlpool6').jqxNumberInput('decimal')), |
4223 brew_fermenter_sg: parseFloat($("#brew_fermenter_sg").jqxNumberInput('decimal')), |
4222 brew_whirlpool2: parseFloat($('#brew_whirlpool2').jqxNumberInput('decimal')), |
4224 brew_fermenter_ibu: parseFloat($("#brew_fermenter_ibu").jqxNumberInput('decimal')), |
4223 brew_fermenter_volume: parseFloat($('#brew_fermenter_volume').jqxNumberInput('decimal')), |
4225 brew_fermenter_color: parseFloat($("#brew_fermenter_color").jqxNumberInput('decimal')), |
4224 brew_fermenter_extrawater: parseFloat($('#brew_fermenter_extrawater').jqxNumberInput('decimal')), |
4226 brew_date_end: $("#brew_date_end").val(), |
4225 brew_fermenter_tcloss: parseFloat($('#brew_fermenter_tcloss').jqxNumberInput('decimal')), |
4227 og: dataRecord.og, |
4226 brew_aeration_time: parseFloat($('#brew_aeration_time').jqxNumberInput('decimal')), |
4228 fg: parseFloat($("#fg").jqxNumberInput('decimal')), |
4227 brew_aeration_speed: parseFloat($('#brew_aeration_speed').jqxNumberInput('decimal')), |
4229 primary_start_temp: parseFloat($("#primary_start_temp").jqxNumberInput('decimal')), |
4228 brew_aeration_type: $('#brew_aeration_type').val(), |
4230 primary_max_temp: parseFloat($("#primary_max_temp").jqxNumberInput('decimal')), |
4229 brew_fermenter_sg: parseFloat($('#brew_fermenter_sg').jqxNumberInput('decimal')), |
4231 primary_end_temp: parseFloat($("#primary_end_temp").jqxNumberInput('decimal')), |
4230 brew_fermenter_ibu: parseFloat($('#brew_fermenter_ibu').jqxNumberInput('decimal')), |
4232 primary_end_sg: parseFloat($("#primary_end_sg").jqxNumberInput('decimal')), |
4231 brew_fermenter_color: parseFloat($('#brew_fermenter_color').jqxNumberInput('decimal')), |
4233 primary_end_date: $("#primary_end_date").val(), |
4232 brew_date_end: $('#brew_date_end').val(), |
4234 secondary_temp: parseFloat($("#secondary_temp").jqxNumberInput('decimal')), |
4233 og: dataRecord.og, |
4235 secondary_end_sg: parseFloat($("#secondary_end_sg").jqxNumberInput('decimal')), |
4234 fg: parseFloat($('#fg').jqxNumberInput('decimal')), |
4236 secondary_end_date: $("#secondary_end_date").val(), |
4235 primary_start_temp: parseFloat($('#primary_start_temp').jqxNumberInput('decimal')), |
4237 tertiary_temp: parseFloat($("#tertiary_temp").jqxNumberInput('decimal')), |
4236 primary_max_temp: parseFloat($('#primary_max_temp').jqxNumberInput('decimal')), |
4238 package_date: $("#package_date").val(), |
4237 primary_end_temp: parseFloat($('#primary_end_temp').jqxNumberInput('decimal')), |
4239 package_volume: parseFloat($("#package_volume").jqxNumberInput('decimal')), |
4238 primary_end_sg: parseFloat($('#primary_end_sg').jqxNumberInput('decimal')), |
4240 package_infuse_amount: parseFloat($("#package_infuse_amount").jqxNumberInput('decimal')), |
4239 primary_end_date: $('#primary_end_date').val(), |
4241 package_infuse_abv: parseFloat($("#package_infuse_abv").jqxNumberInput('decimal')), |
4240 secondary_temp: parseFloat($('#secondary_temp').jqxNumberInput('decimal')), |
4242 package_infuse_notes: $("#package_infuse_notes").val(), |
4241 secondary_end_sg: parseFloat($('#secondary_end_sg').jqxNumberInput('decimal')), |
4243 package_abv: parseFloat($("#package_abv").jqxNumberInput('decimal')), |
4242 secondary_end_date: $('#secondary_end_date').val(), |
4244 package_ph: parseFloat($("#package_ph").jqxNumberInput('decimal')), |
4243 tertiary_temp: parseFloat($('#tertiary_temp').jqxNumberInput('decimal')), |
4245 bottle_amount: parseFloat($("#bottle_amount").jqxNumberInput('decimal')), |
4244 package_date: $('#package_date').val(), |
4246 bottle_carbonation: parseFloat($("#bottle_carbonation").jqxNumberInput('decimal')), |
4245 package_volume: parseFloat($('#package_volume').jqxNumberInput('decimal')), |
4247 bottle_priming_water: parseFloat($("#bottle_priming_water").jqxNumberInput('decimal')), |
4246 package_infuse_amount: parseFloat($('#package_infuse_amount').jqxNumberInput('decimal')), |
4248 bottle_priming_amount: parseFloat($("#bottle_priming_amount").jqxNumberInput('decimal')), |
4247 package_infuse_abv: parseFloat($('#package_infuse_abv').jqxNumberInput('decimal')), |
4249 bottle_carbonation_temp: parseFloat($("#bottle_carbonation_temp").jqxNumberInput('decimal')), |
4248 package_infuse_notes: $('#package_infuse_notes').val(), |
4250 keg_amount: parseFloat($("#keg_amount").jqxNumberInput('decimal')), |
4249 package_abv: parseFloat($('#package_abv').jqxNumberInput('decimal')), |
4251 keg_carbonation: parseFloat($("#keg_carbonation").jqxNumberInput('decimal')), |
4250 package_ph: parseFloat($('#package_ph').jqxNumberInput('decimal')), |
4252 keg_priming_water: parseFloat($("#keg_priming_water").jqxNumberInput('decimal')), |
4251 bottle_amount: parseFloat($('#bottle_amount').jqxNumberInput('decimal')), |
4253 keg_priming_amount: parseFloat($("#keg_priming_amount").jqxNumberInput('decimal')), |
4252 bottle_carbonation: parseFloat($('#bottle_carbonation').jqxNumberInput('decimal')), |
4254 keg_carbonation_temp: parseFloat($("#keg_carbonation_temp").jqxNumberInput('decimal')), |
4253 bottle_priming_water: parseFloat($('#bottle_priming_water').jqxNumberInput('decimal')), |
4255 keg_forced_carb: dataRecord.keg_forced_carb, |
4254 bottle_priming_amount: parseFloat($('#bottle_priming_amount').jqxNumberInput('decimal')), |
4256 keg_pressure: parseFloat($("#keg_pressure").jqxNumberInput('decimal')), |
4255 bottle_carbonation_temp: parseFloat($('#bottle_carbonation_temp').jqxNumberInput('decimal')), |
4257 taste_notes: $("#taste_notes").val(), |
4256 keg_amount: parseFloat($('#keg_amount').jqxNumberInput('decimal')), |
4258 taste_rate: parseFloat($("#taste_rate").jqxNumberInput('decimal')), |
4257 keg_carbonation: parseFloat($('#keg_carbonation').jqxNumberInput('decimal')), |
4259 taste_date: $("#taste_date").val(), |
4258 keg_priming_water: parseFloat($('#keg_priming_water').jqxNumberInput('decimal')), |
4260 taste_color: $("#taste_color").val(), |
4259 keg_priming_amount: parseFloat($('#keg_priming_amount').jqxNumberInput('decimal')), |
4261 taste_transparency: $("#taste_transparency").val(), |
4260 keg_carbonation_temp: parseFloat($('#keg_carbonation_temp').jqxNumberInput('decimal')), |
4262 taste_head: $("#taste_head").val(), |
4261 keg_forced_carb: dataRecord.keg_forced_carb, |
4263 taste_aroma: $("#taste_aroma").val(), |
4262 keg_pressure: parseFloat($('#keg_pressure').jqxNumberInput('decimal')), |
4264 taste_taste: $("#taste_taste").val(), |
4263 taste_notes: $('#taste_notes').val(), |
4265 taste_mouthfeel: $("#taste_mouthfeel").val(), |
4264 taste_rate: parseFloat($('#taste_rate').jqxNumberInput('decimal')), |
4266 taste_aftertaste: $("#taste_aftertaste").val(), |
4265 taste_date: $('#taste_date').val(), |
4267 st_name: $('#st_name').val(), |
4266 taste_color: $('#taste_color').val(), |
4268 st_letter: $('#st_letter').val(), |
4267 taste_transparency: $('#taste_transparency').val(), |
4269 st_guide: $('#st_guide').val(), |
4268 taste_head: $('#taste_head').val(), |
4270 st_type: dataRecord.st_type, |
4269 taste_aroma: $('#taste_aroma').val(), |
4271 st_category: $('#st_category').val(), |
4270 taste_taste: $('#taste_taste').val(), |
4272 st_category_number: parseFloat($("#st_category_number").jqxNumberInput('decimal')), |
4271 taste_mouthfeel: $('#taste_mouthfeel').val(), |
4273 st_og_min: parseFloat($("#st_og_min").jqxNumberInput('decimal')), |
4272 taste_aftertaste: $('#taste_aftertaste').val(), |
4274 st_og_max: parseFloat($("#st_og_max").jqxNumberInput('decimal')), |
4273 st_name: $('#st_name').val(), |
4275 st_fg_min: parseFloat($("#st_fg_min").jqxNumberInput('decimal')), |
4274 st_letter: $('#st_letter').val(), |
4276 st_fg_max: parseFloat($("#st_fg_max").jqxNumberInput('decimal')), |
4275 st_guide: $('#st_guide').val(), |
4277 st_ibu_min: parseFloat($("#st_ibu_min").jqxNumberInput('decimal')), |
4276 st_type: dataRecord.st_type, |
4278 st_ibu_max: parseFloat($("#st_ibu_max").jqxNumberInput('decimal')), |
4277 st_category: $('#st_category').val(), |
4279 st_color_min: parseFloat($("#st_color_min").jqxNumberInput('decimal')), |
4278 st_category_number: parseFloat($('#st_category_number').jqxNumberInput('decimal')), |
4280 st_color_max: parseFloat($("#st_color_max").jqxNumberInput('decimal')), |
4279 st_og_min: parseFloat($('#st_og_min').jqxNumberInput('decimal')), |
4281 st_carb_min: parseFloat($("#st_carb_min").jqxNumberInput('decimal')), |
4280 st_og_max: parseFloat($('#st_og_max').jqxNumberInput('decimal')), |
4282 st_carb_max: parseFloat($("#st_carb_max").jqxNumberInput('decimal')), |
4281 st_fg_min: parseFloat($('#st_fg_min').jqxNumberInput('decimal')), |
4283 st_abv_min: parseFloat($("#st_abv_min").jqxNumberInput('decimal')), |
4282 st_fg_max: parseFloat($('#st_fg_max').jqxNumberInput('decimal')), |
4284 st_abv_max: parseFloat($("#st_abv_max").jqxNumberInput('decimal')), |
4283 st_ibu_min: parseFloat($('#st_ibu_min').jqxNumberInput('decimal')), |
4285 type: $("#type").val(), |
4284 st_ibu_max: parseFloat($('#st_ibu_max').jqxNumberInput('decimal')), |
4286 batch_size: parseFloat($("#batch_size").jqxNumberInput('decimal')), |
4285 st_color_min: parseFloat($('#st_color_min').jqxNumberInput('decimal')), |
4287 boil_size: parseFloat($("#boil_size").jqxNumberInput('decimal')), |
4286 st_color_max: parseFloat($('#st_color_max').jqxNumberInput('decimal')), |
4288 boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')), |
4287 st_carb_min: parseFloat($('#st_carb_min').jqxNumberInput('decimal')), |
4289 efficiency: parseFloat($("#efficiency").jqxNumberInput('decimal')), |
4288 st_carb_max: parseFloat($('#st_carb_max').jqxNumberInput('decimal')), |
4290 est_og: parseFloat($("#est_og").jqxNumberInput('decimal')), |
4289 st_abv_min: parseFloat($('#st_abv_min').jqxNumberInput('decimal')), |
4291 est_fg: parseFloat($("#est_fg").jqxNumberInput('decimal')), |
4290 st_abv_max: parseFloat($('#st_abv_max').jqxNumberInput('decimal')), |
4292 est_abv: parseFloat($("#est_abv").jqxNumberInput('decimal')), |
4291 type: $('#type').val(), |
4293 est_color: parseFloat($("#est_color").jqxNumberInput('decimal')), |
4292 batch_size: parseFloat($('#batch_size').jqxNumberInput('decimal')), |
4294 color_method: $("#color_method").val(), |
4293 boil_size: parseFloat($('#boil_size').jqxNumberInput('decimal')), |
4295 est_ibu: parseFloat($("#est_ibu").jqxNumberInput('decimal')), |
4294 boil_time: parseFloat($('#boil_time').jqxNumberInput('decimal')), |
4296 ibu_method: $("#ibu_method").val(), |
4295 efficiency: parseFloat($('#efficiency').jqxNumberInput('decimal')), |
4297 est_carb: parseFloat($("#est_carb").jqxNumberInput('decimal')), |
4296 est_og: parseFloat($('#est_og').jqxNumberInput('decimal')), |
4298 mash_name: $("#mash_name").val(), |
4297 est_fg: parseFloat($('#est_fg').jqxNumberInput('decimal')), |
4299 mash_ph: parseFloat($("#mash_ph").jqxNumberInput('decimal')), |
4298 est_abv: parseFloat($('#est_abv').jqxNumberInput('decimal')), |
4300 sparge_temp: parseFloat($("#sparge_temp").jqxNumberInput('decimal')), |
4299 est_color: parseFloat($('#est_color').jqxNumberInput('decimal')), |
4301 sparge_ph: parseFloat($("#sparge_ph").jqxNumberInput('decimal')), |
4300 color_method: $('#color_method').val(), |
4302 sparge_volume: parseFloat($("#sparge_volume").jqxNumberInput('decimal')), |
4301 est_ibu: parseFloat($('#est_ibu').jqxNumberInput('decimal')), |
4303 sparge_source: $("#sparge_source").val(), |
4302 ibu_method: $('#ibu_method').val(), |
4304 sparge_acid_type: $("#sparge_acid_type").val(), |
4303 est_carb: parseFloat($('#est_carb').jqxNumberInput('decimal')), |
4305 sparge_acid_perc: parseFloat($("#sparge_acid_perc").jqxNumberInput('decimal')), |
4304 mash_name: $('#mash_name').val(), |
4306 sparge_acid_amount: dataRecord.sparge_acid_amount, |
4305 mash_ph: parseFloat($('#mash_ph').jqxNumberInput('decimal')), |
4307 calc_acid: dataRecord.calc_acid, |
4306 sparge_temp: parseFloat($('#sparge_temp').jqxNumberInput('decimal')), |
4308 w1_name: $("#w1_name").val(), |
4307 sparge_ph: parseFloat($('#sparge_ph').jqxNumberInput('decimal')), |
4309 w1_amount: parseFloat($("#w1_amount").jqxNumberInput('decimal')), |
4308 sparge_volume: parseFloat($('#sparge_volume').jqxNumberInput('decimal')), |
4310 w1_calcium: parseFloat($("#w1_calcium").jqxNumberInput('decimal')), |
4309 sparge_source: $('#sparge_source').val(), |
4311 w1_sulfate: parseFloat($("#w1_sulfate").jqxNumberInput('decimal')), |
4310 sparge_acid_type: $('#sparge_acid_type').val(), |
4312 w1_chloride: parseFloat($("#w1_chloride").jqxNumberInput('decimal')), |
4311 sparge_acid_perc: parseFloat($('#sparge_acid_perc').jqxNumberInput('decimal')), |
4313 w1_sodium: parseFloat($("#w1_sodium").jqxNumberInput('decimal')), |
4312 sparge_acid_amount: dataRecord.sparge_acid_amount, |
4314 w1_magnesium: parseFloat($("#w1_magnesium").jqxNumberInput('decimal')), |
4313 calc_acid: dataRecord.calc_acid, |
4315 w1_total_alkalinity: parseFloat($("#w1_total_alkalinity").jqxNumberInput('decimal')), |
4314 w1_name: $('#w1_name').val(), |
4316 w1_ph: parseFloat($("#w1_ph").jqxNumberInput('decimal')), |
4315 w1_amount: parseFloat($('#w1_amount').jqxNumberInput('decimal')), |
4317 w1_cost: dataRecord.w1_cost, |
4316 w1_calcium: parseFloat($('#w1_calcium').jqxNumberInput('decimal')), |
4318 w2_name: $("#w2_name").val(), |
4317 w1_sulfate: parseFloat($('#w1_sulfate').jqxNumberInput('decimal')), |
4319 w2_amount: parseFloat($("#w2_amount").jqxNumberInput('decimal')), |
4318 w1_chloride: parseFloat($('#w1_chloride').jqxNumberInput('decimal')), |
4320 w2_calcium: parseFloat($("#w2_calcium").jqxNumberInput('decimal')), |
4319 w1_sodium: parseFloat($('#w1_sodium').jqxNumberInput('decimal')), |
4321 w2_sulfate: parseFloat($("#w2_sulfate").jqxNumberInput('decimal')), |
4320 w1_magnesium: parseFloat($('#w1_magnesium').jqxNumberInput('decimal')), |
4322 w2_chloride: parseFloat($("#w2_chloride").jqxNumberInput('decimal')), |
4321 w1_total_alkalinity: parseFloat($('#w1_total_alkalinity').jqxNumberInput('decimal')), |
4323 w2_sodium: parseFloat($("#w2_sodium").jqxNumberInput('decimal')), |
4322 w1_ph: parseFloat($('#w1_ph').jqxNumberInput('decimal')), |
4324 w2_magnesium: parseFloat($("#w2_magnesium").jqxNumberInput('decimal')), |
4323 w1_cost: dataRecord.w1_cost, |
4325 w2_total_alkalinity: parseFloat($("#w2_total_alkalinity").jqxNumberInput('decimal')), |
4324 w2_name: $('#w2_name').val(), |
4326 w2_ph: parseFloat($("#w2_ph").jqxNumberInput('decimal')), |
4325 w2_amount: parseFloat($('#w2_amount').jqxNumberInput('decimal')), |
4327 w2_cost: dataRecord.w2_cost, |
4326 w2_calcium: parseFloat($('#w2_calcium').jqxNumberInput('decimal')), |
4328 wg_amount: parseFloat($("#wg_amount").jqxNumberInput('decimal')), |
4327 w2_sulfate: parseFloat($('#w2_sulfate').jqxNumberInput('decimal')), |
4329 wg_calcium: parseFloat($("#wg_calcium").jqxNumberInput('decimal')), |
4328 w2_chloride: parseFloat($('#w2_chloride').jqxNumberInput('decimal')), |
4330 wg_sulfate: parseFloat($("#wg_sulfate").jqxNumberInput('decimal')), |
4329 w2_sodium: parseFloat($('#w2_sodium').jqxNumberInput('decimal')), |
4331 wg_chloride: parseFloat($("#wg_chloride").jqxNumberInput('decimal')), |
4330 w2_magnesium: parseFloat($('#w2_magnesium').jqxNumberInput('decimal')), |
4332 wg_sodium: parseFloat($("#wg_sodium").jqxNumberInput('decimal')), |
4331 w2_total_alkalinity: parseFloat($('#w2_total_alkalinity').jqxNumberInput('decimal')), |
4333 wg_magnesium: parseFloat($("#wg_magnesium").jqxNumberInput('decimal')), |
4332 w2_ph: parseFloat($('#w2_ph').jqxNumberInput('decimal')), |
4334 wg_total_alkalinity: parseFloat($("#wg_total_alkalinity").jqxNumberInput('decimal')), |
4333 w2_cost: dataRecord.w2_cost, |
4335 wg_ph: parseFloat($("#wg_ph").jqxNumberInput('decimal')), |
4334 wg_amount: parseFloat($('#wg_amount').jqxNumberInput('decimal')), |
4336 wb_calcium: parseFloat($("#wb_calcium").jqxNumberInput('decimal')), |
4335 wg_calcium: parseFloat($('#wg_calcium').jqxNumberInput('decimal')), |
4337 wb_sulfate: parseFloat($("#wb_sulfate").jqxNumberInput('decimal')), |
4336 wg_sulfate: parseFloat($('#wg_sulfate').jqxNumberInput('decimal')), |
4338 wb_chloride: parseFloat($("#wb_chloride").jqxNumberInput('decimal')), |
4337 wg_chloride: parseFloat($('#wg_chloride').jqxNumberInput('decimal')), |
4339 wb_sodium: parseFloat($("#wb_sodium").jqxNumberInput('decimal')), |
4338 wg_sodium: parseFloat($('#wg_sodium').jqxNumberInput('decimal')), |
4340 wb_magnesium: parseFloat($("#wb_magnesium").jqxNumberInput('decimal')), |
4339 wg_magnesium: parseFloat($('#wg_magnesium').jqxNumberInput('decimal')), |
4341 wb_total_alkalinity: parseFloat($("#wb_total_alkalinity").jqxNumberInput('decimal')), |
4340 wg_total_alkalinity: parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal')), |
4342 wb_ph: parseFloat($("#wb_ph").jqxNumberInput('decimal')), |
4341 wg_ph: parseFloat($('#wg_ph').jqxNumberInput('decimal')), |
4343 wa_acid_name: $("#wa_acid_name").val(), |
4342 wb_calcium: parseFloat($('#wb_calcium').jqxNumberInput('decimal')), |
4344 wa_acid_perc: parseFloat($("#wa_acid_perc").jqxNumberInput('decimal')), |
4343 wb_sulfate: parseFloat($('#wb_sulfate').jqxNumberInput('decimal')), |
4345 wa_base_name: $("#wa_base_name").val(), |
4344 wb_chloride: parseFloat($('#wb_chloride').jqxNumberInput('decimal')), |
4346 starter_enable: dataRecord.starter_enable, |
4345 wb_sodium: parseFloat($('#wb_sodium').jqxNumberInput('decimal')), |
4347 starter_type: $("#starter_type").val(), |
4346 wb_magnesium: parseFloat($('#wb_magnesium').jqxNumberInput('decimal')), |
4348 starter_sg: parseFloat($("#starter_sg").jqxNumberInput('decimal')), |
4347 wb_total_alkalinity: parseFloat($('#wb_total_alkalinity').jqxNumberInput('decimal')), |
4349 starter_viability: parseFloat($("#starter_viability").jqxNumberInput('decimal')), |
4348 wb_ph: parseFloat($('#wb_ph').jqxNumberInput('decimal')), |
4350 prop1_type: $("#prop1_type").val(), |
4349 wa_acid_name: $('#wa_acid_name').val(), |
4351 prop1_volume: parseFloat($("#prop1_volume").jqxNumberInput('decimal')), |
4350 wa_acid_perc: parseFloat($('#wa_acid_perc').jqxNumberInput('decimal')), |
4352 prop2_type: $("#prop2_type").val(), |
4351 wa_base_name: $('#wa_base_name').val(), |
4353 prop2_volume: parseFloat($("#prop2_volume").jqxNumberInput('decimal')), |
4352 starter_enable: dataRecord.starter_enable, |
4354 prop3_type: $("#prop3_type").val(), |
4353 starter_type: $('#starter_type').val(), |
4355 prop3_volume: parseFloat($("#prop3_volume").jqxNumberInput('decimal')), |
4354 starter_sg: parseFloat($('#starter_sg').jqxNumberInput('decimal')), |
4356 prop4_type: $("#prop4_type").val(), |
4355 starter_viability: parseFloat($('#starter_viability').jqxNumberInput('decimal')), |
4357 prop4_volume: parseFloat($("#prop4_volume").jqxNumberInput('decimal')), |
4356 prop1_type: $('#prop1_type').val(), |
4358 fermentables: $('#fermentableGrid').jqxGrid('getrows'), |
4357 prop1_volume: parseFloat($('#prop1_volume').jqxNumberInput('decimal')), |
4359 hops: $('#hopGrid').jqxGrid('getrows'), |
4358 prop2_type: $('#prop2_type').val(), |
4360 miscs: $('#miscGrid').jqxGrid('getrows'), |
4359 prop2_volume: parseFloat($('#prop2_volume').jqxNumberInput('decimal')), |
4361 yeasts: $('#yeastGrid').jqxGrid('getrows'), |
4360 prop3_type: $('#prop3_type').val(), |
4362 mashs: $('#mashGrid').jqxGrid('getrows') |
4361 prop3_volume: parseFloat($('#prop3_volume').jqxNumberInput('decimal')), |
4363 }, |
4362 prop4_type: $('#prop4_type').val(), |
4364 data = "update=true&" + $.param(row); |
4363 prop4_volume: parseFloat($('#prop4_volume').jqxNumberInput('decimal')), |
4365 $.ajax({ |
4364 fermentables: $('#fermentableGrid').jqxGrid('getrows'), |
4366 dataType: 'json', |
4365 hops: $('#hopGrid').jqxGrid('getrows'), |
4367 url: url, |
4366 miscs: $('#miscGrid').jqxGrid('getrows'), |
4368 cache: false, |
4367 yeasts: $('#yeastGrid').jqxGrid('getrows'), |
4369 data: data, |
4368 mashs: $('#mashGrid').jqxGrid('getrows') |
4370 async: false, |
4369 }, |
4371 type: "POST", |
4370 data = 'update=true&' + $.param(row); |
4372 success: function (data, status, xhr) { |
4371 $.ajax({ |
4373 console.log("saveRecord() success"); |
4372 dataType: 'json', |
4374 }, |
4373 url: url, |
4375 error: function(jqXHR, textStatus, errorThrown) { |
4374 cache: false, |
4376 console.log("saveRecord() error"); |
4375 data: data, |
4377 } |
4376 async: false, |
4378 }); |
4377 type: 'POST', |
4379 }; |
4378 success: function(data, status, xhr) { |
4380 |
4379 console.log('saveRecord() success'); |
4381 dataAdapter.dataBind(); |
4380 }, |
4382 // initialize the input fields. |
4381 error: function(jqXHR, textStatus, errorThrown) { |
4383 // Tab 1, Algemeen |
4382 console.log('saveRecord() error'); |
4384 $("#name").jqxTooltip({ content: 'De naam voor dit product.' }); |
4383 } |
4385 $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); |
4384 }); |
4386 $("#code").jqxTooltip({ content: 'Product code nummer.' }); |
4385 }; |
4387 $("#code").jqxInput({ theme: theme, width: 100, height: 23 }); |
4386 |
4388 $("#birth").jqxTooltip({ content: 'De ontwerp datum van dit product.' }); |
4387 dataAdapter.dataBind(); |
4389 $("#birth").jqxInput({ theme: theme, width: 120, height: 23 }); |
4388 |
4390 $("#stage").jqxTooltip({ content: 'De productie fase van dit product.' }); |
4389 // initialize the input fields. |
4391 $("#stage").jqxInput({ theme: theme, width: 100, height: 23 }); |
4390 // Tab 1, Algemeen |
4392 $("#locked").jqxCheckBox({ theme: theme, width: 120, height: 23, disabled : true }); |
4391 $('#name').jqxTooltip({ content: 'De naam voor dit product.' }); |
4393 $('#locked').on('checked', function (event) { |
4392 $('#name').jqxInput({ theme: theme, width: 640, height: 23 }); |
4394 if (dataRecord.stage >= 10) { |
4393 $('#code').jqxTooltip({ content: 'Product code nummer.' }); |
4395 dataRecord.locked = 1; |
4394 $('#code').jqxInput({ theme: theme, width: 100, height: 23 }); |
4396 dataRecord.stage = 11; |
4395 $('#birth').jqxTooltip({ content: 'De ontwerp datum van dit product.' }); |
4397 calcStage(); |
4396 $('#birth').jqxInput({ theme: theme, width: 120, height: 23 }); |
4398 } |
4397 $('#stage').jqxTooltip({ content: 'De productie fase van dit product.' }); |
4399 }); |
4398 $('#stage').jqxInput({ theme: theme, width: 100, height: 23 }); |
4400 $('#locked').on('unchecked', function (event) { |
4399 $('#locked').jqxCheckBox({ theme: theme, width: 120, height: 23, disabled: true }); |
4401 if (dataRecord.stage >= 10) { |
4400 $('#locked').on('checked', function(event) { |
4402 dataRecord.locked = 0; |
4401 if (dataRecord.stage >= 10) { |
4403 dataRecord.stage = 10; |
4402 dataRecord.locked = 1; |
4404 calcStage(); |
4403 dataRecord.stage = 11; |
4405 } |
4404 calcStage(); |
4406 }); |
4405 } |
4407 $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit product.' }); |
4406 }); |
4408 $("#notes").jqxInput({ theme: theme, width: 960, height: 100 }); |
4407 $('#locked').on('unchecked', function(event) { |
4409 $("#type").jqxTooltip({ content: 'Het brouw type van dit recept.' }); |
4408 if (dataRecord.stage >= 10) { |
4410 $("#type").jqxDropDownList({ |
4409 dataRecord.locked = 0; |
4411 theme: theme, |
4410 dataRecord.stage = 10; |
4412 source: RecipeTypeAdapter, |
4411 calcStage(); |
4413 valueMember: 'id', |
4412 } |
4414 displayMember: 'nl', |
4413 }); |
4415 width: 180, |
4414 $('#notes').jqxTooltip({ content: 'De uitgebreide opmerkingen over dit product.' }); |
4416 height: 23, |
4415 $('#notes').jqxInput({ theme: theme, width: 960, height: 100 }); |
4417 autoDropDownHeight: true |
4416 $('#type').jqxTooltip({ content: 'Het brouw type van dit recept.' }); |
4418 }); |
4417 $('#type').jqxDropDownList({ |
4419 $("#efficiency").jqxTooltip({ content: 'Het rendement van maischen en koken.' }); |
4418 theme: theme, |
4420 $("#efficiency").jqxNumberInput( Perc1dec ); |
4419 source: RecipeTypeAdapter, |
4421 $("#batch_size").jqxTooltip({ content: 'Het volume van het gekoelde wort na het koken.' }); |
4420 valueMember: 'id', |
4422 $("#batch_size").jqxNumberInput( Spin1dec ); |
4421 displayMember: 'nl', |
4423 $("#batch_size").jqxNumberInput({ min: 4 }); |
4422 width: 180, |
4424 $("#boil_time").jqxTooltip({ content: 'De kooktijd in minuten.' }); |
4423 height: 23, |
4425 $("#boil_time").jqxNumberInput( PosInt ); |
4424 autoDropDownHeight: true |
4426 $("#boil_time").jqxNumberInput({ min: 4, max: 360 }); |
4425 }); |
4427 $("#boil_size").jqxTooltip({ content: 'Het volume van het wort voor het koken.' }); |
4426 $('#efficiency').jqxTooltip({ content: 'Het rendement van maischen en koken.' }); |
4428 $("#boil_size").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 2, readOnly: true }); |
4427 $('#efficiency').jqxNumberInput(Perc1dec); |
4429 |
4428 $('#batch_size').jqxTooltip({ content: 'Het volume van het gekoelde wort na het koken.' }); |
4430 $("#st_guide").jqxTooltip({ content: 'De bierstijl gids voor dit recept.'}); |
4429 $('#batch_size').jqxNumberInput(Spin1dec); |
4431 $("#st_guide").jqxInput({ theme: theme, width: 250, height: 23 }); |
4430 $('#batch_size').jqxNumberInput({ min: 4 }); |
4432 $("#st_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'}); |
4431 $('#boil_time').jqxTooltip({ content: 'De kooktijd in minuten.' }); |
4433 $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 }); |
4432 $('#boil_time').jqxNumberInput(PosInt); |
4434 $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'}); |
4433 $('#boil_time').jqxNumberInput({ min: 4, max: 360 }); |
4435 $("#st_letter").jqxInput({ theme: theme, width: 90, height: 23 }); |
4434 $('#boil_size').jqxTooltip({ content: 'Het volume van het wort voor het koken.' }); |
4436 $("#st_type").jqxTooltip({ content: 'Het bierstijl type.'}); |
4435 $('#boil_size').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 2, readOnly: true }); |
4437 $("#st_type").jqxInput({ theme: theme, width: 250, height: 23 }); |
4436 |
4438 $("#st_category").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'}); |
4437 $('#st_guide').jqxTooltip({ content: 'De bierstijl gids voor dit recept.'}); |
4439 $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 }); |
4438 $('#st_guide').jqxInput({ theme: theme, width: 250, height: 23 }); |
4440 $("#st_category_number").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'}); |
4439 $('#st_name').jqxTooltip({ content: 'De bierstijl naam voor dit recept.'}); |
4441 $("#st_category_number").jqxNumberInput(Smal0dec); |
4440 $('#st_name').jqxInput({ theme: theme, width: 250, height: 23 }); |
4442 |
4441 $('#st_letter').jqxTooltip({ content: 'De bierstijl letter voor dit recept.'}); |
4443 $("#est_og").jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' }); |
4442 $('#st_letter').jqxInput({ theme: theme, width: 90, height: 23 }); |
4444 $("#est_og").jqxNumberInput( SGopts ); |
4443 $('#st_type').jqxTooltip({ content: 'Het bierstijl type.'}); |
4445 $("#st_og_min").jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'}); |
4444 $('#st_type').jqxInput({ theme: theme, width: 250, height: 23 }); |
4446 $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
4445 $('#st_category').jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'}); |
4447 $("#st_og_max").jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'}); |
4446 $('#st_category').jqxInput({ theme: theme, width: 250, height: 23 }); |
4448 $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
4447 $('#st_category_number').jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'}); |
4449 |
4448 $('#st_category_number').jqxNumberInput(Smal0dec); |
4450 $("#est_fg").jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' }); |
4449 |
4451 $("#est_fg").jqxNumberInput( Show3dec ); |
4450 $('#est_og').jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' }); |
4452 $("#st_fg_min").jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'}); |
4451 $('#est_og').jqxNumberInput(SGopts); |
4453 $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
4452 $('#st_og_min').jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'}); |
4454 $("#st_fg_max").jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'}); |
4453 $('#st_og_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
4455 $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
4454 $('#st_og_max').jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'}); |
4456 |
4455 $('#st_og_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
4457 $("#est_abv").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); |
4456 |
4458 $("#est_abv").jqxNumberInput(Smal1dec); |
4457 $('#est_fg').jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' }); |
4459 $("#st_abv_min").jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'}); |
4458 $('#est_fg').jqxNumberInput(Show3dec); |
4460 $("#st_abv_min").jqxNumberInput(Smal1dec); |
4459 $('#st_fg_min').jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'}); |
4461 $("#st_abv_max").jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'}); |
4460 $('#st_fg_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
4462 $("#st_abv_max").jqxNumberInput(Smal1dec); |
4461 $('#st_fg_max').jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'}); |
4463 |
4462 $('#st_fg_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); |
4464 $("#est_color").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' }); |
4463 |
4465 $("#est_color").jqxNumberInput( Show0dec ); |
4464 $('#est_abv').jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); |
4466 $("#st_color_min").jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'}); |
4465 $('#est_abv').jqxNumberInput(Smal1dec); |
4467 $("#st_color_min").jqxNumberInput(Smal0dec); |
4466 $('#st_abv_min').jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'}); |
4468 $("#st_color_max").jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'}); |
4467 $('#st_abv_min').jqxNumberInput(Smal1dec); |
4469 $("#st_color_max").jqxNumberInput(Smal0dec); |
4468 $('#st_abv_max').jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'}); |
4470 $("#color_method").jqxDropDownList({ |
4469 $('#st_abv_max').jqxNumberInput(Smal1dec); |
4471 theme: theme, |
4470 |
4472 source: ColorMethodAdapter, |
4471 $('#est_color').jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' }); |
4473 valueMember: 'id', |
4472 $('#est_color').jqxNumberInput(Show0dec); |
4474 displayMember: 'nl', |
4473 $('#st_color_min').jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'}); |
4475 width: 180, |
4474 $('#st_color_min').jqxNumberInput(Smal0dec); |
4476 height: 23, |
4475 $('#st_color_max').jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'}); |
4477 autoDropDownHeight: true |
4476 $('#st_color_max').jqxNumberInput(Smal0dec); |
4478 }); |
4477 $('#color_method').jqxDropDownList({ |
4479 $("#est_ibu").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); |
4478 theme: theme, |
4480 $("#est_ibu").jqxNumberInput( Show0dec ); |
4479 source: ColorMethodAdapter, |
4481 $("#st_ibu_min").jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'}); |
4480 valueMember: 'id', |
4482 $("#st_ibu_min").jqxNumberInput(Smal0dec); |
4481 displayMember: 'nl', |
4483 $("#st_ibu_max").jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'}); |
4482 width: 180, |
4484 $("#st_ibu_max").jqxNumberInput(Smal0dec); |
4483 height: 23, |
4485 $("#ibu_method").jqxDropDownList({ |
4484 autoDropDownHeight: true |
4486 theme: theme, |
4485 }); |
4487 source: IBUmethodAdapter, |
4486 $('#est_ibu').jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); |
4488 valueMember: 'id', |
4487 $('#est_ibu').jqxNumberInput(Show0dec); |
4489 displayMember: 'nl', |
4488 $('#st_ibu_min').jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'}); |
4490 width: 180, |
4489 $('#st_ibu_min').jqxNumberInput(Smal0dec); |
4491 height: 23, |
4490 $('#st_ibu_max').jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'}); |
4492 autoDropDownHeight: true, |
4491 $('#st_ibu_max').jqxNumberInput(Smal0dec); |
4493 dropDownVerticalAlignment: 'top' |
4492 $('#ibu_method').jqxDropDownList({ |
4494 }); |
4493 theme: theme, |
4495 $("#kcal").jqxTooltip({ content: 'Energie-inhoud in kcal/liter.' }); |
4494 source: IBUmethodAdapter, |
4496 $("#kcal").jqxNumberInput( Smal0dec ); |
4495 valueMember: 'id', |
4497 $("#est_carb").jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' }); |
4496 displayMember: 'nl', |
4498 $("#est_carb").jqxNumberInput(Smal1dec); |
4497 width: 180, |
4499 $("#st_carb_min").jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'}); |
4498 height: 23, |
4500 $("#st_carb_min").jqxNumberInput(Smal1dec); |
4499 autoDropDownHeight: true, |
4501 $("#st_carb_max").jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'}); |
4500 dropDownVerticalAlignment: 'top' |
4502 $("#st_carb_max").jqxNumberInput(Smal1dec); |
4501 }); |
4503 |
4502 $('#kcal').jqxTooltip({ content: 'Energie-inhoud in kcal/liter.' }); |
4504 // Tab 2, Equipment |
4503 $('#kcal').jqxNumberInput(Smal0dec); |
4505 $("#eq_name").jqxTooltip({ content: 'De naam van deze brouw apparatuur.' }); |
4504 $('#est_carb').jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' }); |
4506 $("#eq_name").jqxInput({ theme: theme, width: 250, height: 23 }); |
4505 $('#est_carb').jqxNumberInput(Smal1dec); |
4507 $("#eq_boil_size").jqxTooltip({ content: 'Normaal kook volume in liters' }); |
4506 $('#st_carb_min').jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'}); |
4508 $("#eq_boil_size").jqxNumberInput( Show1dec ); |
4507 $('#st_carb_min').jqxNumberInput(Smal1dec); |
4509 $("#eq_batch_size").jqxTooltip({ content: 'Berekende batch grootte in liters aan het eind van de kook.' }); |
4508 $('#st_carb_max').jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'}); |
4510 $("#eq_batch_size").jqxNumberInput( Show1dec ); |
4509 $('#st_carb_max').jqxNumberInput(Smal1dec); |
4511 $("#eq_tun_volume").jqxTooltip({ content: 'Maisch ketel volume.' }); |
4510 |
4512 $("#eq_tun_volume").jqxNumberInput( Show1dec ); |
4511 // Tab 2, Equipment |
4513 $("#eq_top_up_water").jqxTooltip({ content: 'Extra water in het gistvat.' }); |
4512 $('#eq_name').jqxTooltip({ content: 'De naam van deze brouw apparatuur.' }); |
4514 $("#eq_top_up_water").jqxNumberInput( Show1dec ); |
4513 $('#eq_name').jqxInput({ theme: theme, width: 250, height: 23 }); |
4515 $("#eq_trub_chiller_loss").jqxTooltip({ content: 'Standaard verlies bij het overbrengen naar het gistvat.' }); |
4514 $('#eq_boil_size').jqxTooltip({ content: 'Normaal kook volume in liters' }); |
4516 $("#eq_trub_chiller_loss").jqxNumberInput( Show1dec ); |
4515 $('#eq_boil_size').jqxNumberInput(Show1dec); |
4517 $("#eq_evap_rate").jqxTooltip({ content: 'Verdamping in liters per uur.' }); |
4516 $('#eq_batch_size').jqxTooltip({ content: 'Berekende batch grootte in liters aan het eind van de kook.' }); |
4518 $("#eq_evap_rate").jqxNumberInput( Show2dec ); |
4517 $('#eq_batch_size').jqxNumberInput(Show1dec); |
4519 $("#eq_boil_time").jqxTooltip({ content: 'Normale kooktijd in minuten.' }); |
4518 $('#eq_tun_volume').jqxTooltip({ content: 'Maisch ketel volume.' }); |
4520 $("#eq_boil_time").jqxNumberInput( Show0dec ); |
4519 $('#eq_tun_volume').jqxNumberInput(Show1dec); |
4521 $("#eq_top_up_kettle").jqxTooltip({ content: 'Extra water toevoegen tijdens de kook.' }); |
4520 $('#eq_top_up_water').jqxTooltip({ content: 'Extra water in het gistvat.' }); |
4522 $("#eq_top_up_kettle").jqxNumberInput( Show1dec ); |
4521 $('#eq_top_up_water').jqxNumberInput(Show1dec); |
4523 $("#eq_hop_utilization").jqxTooltip({ content: '100% voor kleine installaties, hoger voor grote brouwerijen.' }); |
4522 $('#eq_trub_chiller_loss').jqxTooltip({ content: 'Standaard verlies bij het overbrengen naar het gistvat.' }); |
4524 $("#eq_hop_utilization").jqxNumberInput( Show0dec ); |
4523 $('#eq_trub_chiller_loss').jqxNumberInput(Show1dec); |
4525 $("#eq_notes").jqxTooltip({ content: 'Opmerkingen over deze apparatuur.' }); |
4524 $('#eq_evap_rate').jqxTooltip({ content: 'Verdamping in liters per uur.' }); |
4526 $("#eq_notes").jqxInput({ theme: theme, width: 960, height: 200 }); |
4525 $('#eq_evap_rate').jqxNumberInput(Show2dec); |
4527 $("#eq_lauter_volume").jqxTooltip({ content: 'Filterkuip volume.' }); |
4526 $('#eq_boil_time').jqxTooltip({ content: 'Normale kooktijd in minuten.' }); |
4528 $("#eq_lauter_volume").jqxNumberInput( Show1dec ); |
4527 $('#eq_boil_time').jqxNumberInput(Show0dec); |
4529 $("#eq_lauter_deadspace").jqxTooltip({ content: 'Filterkuip verlies in liters.' }); |
4528 $('#eq_top_up_kettle').jqxTooltip({ content: 'Extra water toevoegen tijdens de kook.' }); |
4530 $("#eq_lauter_deadspace").jqxNumberInput( Show1dec ); |
4529 $('#eq_top_up_kettle').jqxNumberInput(Show1dec); |
4531 $("#eq_kettle_volume").jqxTooltip({ content: 'Kook ketel volume in liters.' }); |
4530 $('#eq_hop_utilization').jqxTooltip({ content: '100% voor kleine installaties, hoger voor grote brouwerijen.' }); |
4532 $("#eq_kettle_volume").jqxNumberInput( Show1dec ); |
4531 $('#eq_hop_utilization').jqxNumberInput(Show0dec); |
4533 $("#eq_mash_volume").jqxTooltip({ content: 'Maisch water voor de eerste stap.' }); |
4532 $('#eq_notes').jqxTooltip({ content: 'Opmerkingen over deze apparatuur.' }); |
4534 $("#eq_mash_volume").jqxNumberInput( Show1dec ); |
4533 $('#eq_notes').jqxInput({ theme: theme, width: 960, height: 200 }); |
4535 $("#eq_mash_max").jqxTooltip({ content: 'De maximale moutstort in Kg.' }); |
4534 $('#eq_lauter_volume').jqxTooltip({ content: 'Filterkuip volume.' }); |
4536 $("#eq_mash_max").jqxNumberInput( Show1dec ); |
4535 $('#eq_lauter_volume').jqxNumberInput(Show1dec); |
4537 $("#eq_efficiency").jqxTooltip({ content: 'Gemiddeld brouwzaal rendement.' }); |
4536 $('#eq_lauter_deadspace').jqxTooltip({ content: 'Filterkuip verlies in liters.' }); |
4538 $("#eq_efficiency").jqxNumberInput( Show1dec ); |
4537 $('#eq_lauter_deadspace').jqxNumberInput(Show1dec); |
4539 |
4538 $('#eq_kettle_volume').jqxTooltip({ content: 'Kook ketel volume in liters.' }); |
4540 // Tab 3, Fermentables |
4539 $('#eq_kettle_volume').jqxNumberInput(Show1dec); |
4541 $("#est_color2").jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' }); |
4540 $('#eq_mash_volume').jqxTooltip({ content: 'Maisch water voor de eerste stap.' }); |
4542 $("#est_color2").jqxNumberInput( Show0dec ); |
4541 $('#eq_mash_volume').jqxNumberInput(Show1dec); |
4543 $("#est_og2").jqxTooltip({ content: 'Het geschatte begin SG van dit product.' }); |
4542 $('#eq_mash_max').jqxTooltip({ content: 'De maximale moutstort in Kg.' }); |
4544 $("#est_og2").jqxNumberInput( Show3dec ); |
4543 $('#eq_mash_max').jqxNumberInput(Show1dec); |
4545 $("#mash_kg").jqxTooltip({ content: 'Het gewicht van alle mouten in de maisch.' }); |
4544 $('#eq_efficiency').jqxTooltip({ content: 'Gemiddeld brouwzaal rendement.' }); |
4546 $("#mash_kg").jqxNumberInput( Show3dec ); |
4545 $('#eq_efficiency').jqxNumberInput(Show1dec); |
4547 $("#perc_malts").jqxProgressBar({ |
4546 |
4548 width: 300, |
4547 // Tab 3, Fermentables |
4549 height: 23, |
4548 $('#est_color2').jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' }); |
4550 theme: theme, |
4549 $('#est_color2').jqxNumberInput(Show0dec); |
4551 showText: true, |
4550 $('#est_og2').jqxTooltip({ content: 'Het geschatte begin SG van dit product.' }); |
4552 max: 120, |
4551 $('#est_og2').jqxNumberInput(Show3dec); |
4553 animationDuration: 0, |
4552 $('#mash_kg').jqxTooltip({ content: 'Het gewicht van alle mouten in de maisch.' }); |
4554 colorRanges: [ |
4553 $('#mash_kg').jqxNumberInput(Show3dec); |
4555 { stop: 90, color: '#008C00' }, |
4554 $('#perc_malts').jqxProgressBar({ |
4556 { stop: 100, color: '#EB7331' }, |
4555 width: 300, |
4557 { stop: 120, color: '#FF0000' } |
4556 height: 23, |
4558 ], |
4557 theme: theme, |
4559 renderText: function (text) { |
4558 showText: true, |
4560 return (Math.round(parseInt(text) * 1.2)) + '%'; |
4559 max: 120, |
4561 } |
4560 animationDuration: 0, |
4562 }); |
4561 colorRanges: [ |
4563 $("#perc_sugars").jqxProgressBar({ |
4562 { stop: 90, color: '#008C00' }, |
4564 width: 300, |
4563 { stop: 100, color: '#EB7331' }, |
4565 height: 23, |
4564 { stop: 120, color: '#FF0000' } |
4566 theme: theme, |
4565 ], |
4567 showText: true, |
4566 renderText: function(text) { |
4568 max: 50, |
4567 return (Math.round(parseInt(text) * 1.2)) + '%'; |
4569 animationDuration: 0, |
4568 } |
4570 colorRanges: [ |
4569 }); |
4571 { stop: 20, color: '#008C00' }, |
4570 $('#perc_sugars').jqxProgressBar({ |
4572 { stop: 50, color: '#FF0000' } |
4571 width: 300, |
4573 ], |
4572 height: 23, |
4574 renderText: function (text) { |
4573 theme: theme, |
4575 return (Math.round(parseInt(text) * 5) / 10) + '%'; |
4574 showText: true, |
4576 } |
4575 max: 50, |
4577 }); |
4576 animationDuration: 0, |
4578 $("#perc_cara").jqxProgressBar({ |
4577 colorRanges: [ |
4579 width: 300, |
4578 { stop: 20, color: '#008C00' }, |
4580 height: 23, |
4579 { stop: 50, color: '#FF0000' } |
4581 theme: theme, |
4580 ], |
4582 showText: true, |
4581 renderText: function(text) { |
4583 max: 50, |
4582 return (Math.round(parseInt(text) * 5) / 10) + '%'; |
4584 animationDuration: 0, |
4583 } |
4585 colorRanges: [ |
4584 }); |
4586 { stop: 25, color: '#008C00' }, |
4585 $('#perc_cara').jqxProgressBar({ |
4587 { stop: 50, color: '#FF0000' } |
4586 width: 300, |
4588 ], |
4587 height: 23, |
4589 renderText: function (text) { |
4588 theme: theme, |
4590 return (Math.round(parseInt(text) * 5) / 10) + '%'; |
4589 showText: true, |
4591 } |
4590 max: 50, |
4592 }); |
4591 animationDuration: 0, |
4593 $("#ferm_lintner").jqxProgressBar({ |
4592 colorRanges: [ |
4594 width: 300, |
4593 { stop: 25, color: '#008C00' }, |
4595 height: 23, |
4594 { stop: 50, color: '#FF0000' } |
4596 theme: theme, |
4595 ], |
4597 showText: true, |
4596 renderText: function(text) { |
4598 max: 200, |
4597 return (Math.round(parseInt(text) * 5) / 10) + '%'; |
4599 animationDuration: 0, |
4598 } |
4600 colorRanges: [ |
4599 }); |
4601 { stop: 30, color: '#FF0000' }, |
4600 $('#ferm_lintner').jqxProgressBar({ |
4602 { stop: 40, color: '#EB7331' }, |
4601 width: 300, |
4603 { stop: 200, color: '#008C00' } |
4602 height: 23, |
4604 ], |
4603 theme: theme, |
4605 renderText: function (text) { |
4604 showText: true, |
4606 return (parseInt(text) * 2) + ' lintner'; |
4605 max: 200, |
4607 } |
4606 animationDuration: 0, |
4608 }); |
4607 colorRanges: [ |
4609 $("#popupFermentable").jqxWindow({ |
4608 { stop: 30, color: '#FF0000' }, |
4610 width: 800, |
4609 { stop: 40, color: '#EB7331' }, |
4611 height: 300, |
4610 { stop: 200, color: '#008C00' } |
4612 position: { x: 230, y: 100 }, |
4611 ], |
4613 resizable: false, |
4612 renderText: function(text) { |
4614 theme: theme, |
4613 return (parseInt(text) * 2) + ' lintner'; |
4615 isModal: true, |
4614 } |
4616 autoOpen: false, |
4615 }); |
4617 cancelButton: $("#FermentableReady"), |
4616 $('#popupFermentable').jqxWindow({ |
4618 modalOpacity: 0.40 |
4617 width: 800, |
4619 }); |
4618 height: 300, |
4620 $("#FermentableReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
4619 position: { x: 230, y: 100 }, |
4621 $("#FermentableReady").click(function () { |
4620 resizable: false, |
4622 var row, rowID = $("#fermentableGrid").jqxGrid('getrowid', fermentableRow); |
4621 theme: theme, |
4623 console.log("FermentableReady row:"+fermentableRow+" ID:"+rowID); |
4622 isModal: true, |
4624 row = { |
4623 autoOpen: false, |
4625 f_name: fermentableData.f_name, |
4624 cancelButton: $('#FermentableReady'), |
4626 f_origin: fermentableData.f_origin, |
4625 modalOpacity: 0.40 |
4627 f_supplier: fermentableData.f_supplier, |
4626 }); |
4628 f_amount: fermentableData.f_amount, |
4627 $('#FermentableReady').jqxButton({ template: 'success', width: '90px', theme: theme }); |
4629 f_cost: fermentableData.f_cost, |
4628 $('#FermentableReady').click(function() { |
4630 f_type: fermentableData.f_type, |
4629 var row, rowID = $('#fermentableGrid').jqxGrid('getrowid', fermentableRow); |
4631 f_yield: fermentableData.f_yield, |
4630 console.log('FermentableReady row:' + fermentableRow + ' ID:' + rowID); |
4632 f_color: fermentableData.f_color, |
4631 row = { |
4633 f_coarse_fine_diff: fermentableData.f_coarse_fine_diff, |
4632 f_name: fermentableData.f_name, |
4634 f_moisture: fermentableData.f_moisture, |
4633 f_origin: fermentableData.f_origin, |
4635 f_diastatic_power: fermentableData.f_diastatic_power, |
4634 f_supplier: fermentableData.f_supplier, |
4636 f_protein: fermentableData.f_protein, |
4635 f_amount: fermentableData.f_amount, |
4637 f_max_in_batch: fermentableData.f_max_in_batch, |
4636 f_cost: fermentableData.f_cost, |
4638 f_graintype: fermentableData.f_graintype, |
4637 f_type: fermentableData.f_type, |
4639 f_added: fermentableData.f_added, |
4638 f_yield: fermentableData.f_yield, |
4640 f_dissolved_protein: fermentableData.f_dissolved_protein, |
4639 f_color: fermentableData.f_color, |
4641 f_recommend_mash: fermentableData.f_recommend_mash, |
4640 f_coarse_fine_diff: fermentableData.f_coarse_fine_diff, |
4642 f_add_after_boil: fermentableData.f_add_after_boil, |
4641 f_moisture: fermentableData.f_moisture, |
4643 f_adjust_to_total_100: fermentableData.f_adjust_to_total_100, |
4642 f_diastatic_power: fermentableData.f_diastatic_power, |
4644 f_percentage: fermentableData.f_percentage, |
4643 f_protein: fermentableData.f_protein, |
4645 f_di_ph: fermentableData.f_di_ph, |
4644 f_max_in_batch: fermentableData.f_max_in_batch, |
4646 f_acid_to_ph_57: fermentableData.f_acid_to_ph_57, |
4645 f_graintype: fermentableData.f_graintype, |
4647 f_inventory: fermentableData.f_inventory, |
4646 f_added: fermentableData.f_added, |
4648 f_avail: fermentableData.f_avail |
4647 f_dissolved_protein: fermentableData.f_dissolved_protein, |
4649 }; |
4648 f_recommend_mash: fermentableData.f_recommend_mash, |
4650 $("#fermentableGrid").jqxGrid('updaterow', rowID, row); |
4649 f_add_after_boil: fermentableData.f_add_after_boil, |
4651 calcPercentages(); |
4650 f_adjust_to_total_100: fermentableData.f_adjust_to_total_100, |
4652 calcFermentables(); |
4651 f_percentage: fermentableData.f_percentage, |
4653 calcIBUs(); |
4652 f_di_ph: fermentableData.f_di_ph, |
4654 calcMash(); |
4653 f_acid_to_ph_57: fermentableData.f_acid_to_ph_57, |
4655 // Waters: yes there is impact. |
4654 f_inventory: fermentableData.f_inventory, |
4656 }); |
4655 f_avail: fermentableData.f_avail |
4657 $("#wf_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
4656 }; |
4658 $("#wf_instock").jqxCheckBox({ theme: theme, height: 23 }); |
4657 $('#fermentableGrid').jqxGrid('updaterow', rowID, row); |
4659 $("#wf_instock").on('change', function (event) { |
4658 calcPercentages(); |
4660 fermentableinstock = event.args.checked; |
4659 calcFermentables(); |
4661 fermentablelist.dataBind(); |
4660 calcIBUs(); |
4662 }); |
4661 calcMash(); |
4663 $("#wf_select").jqxDropDownList({ |
4662 // Waters: yes there is impact. |
4664 placeHolder: "Kies mout:", |
4663 }); |
4665 theme: theme, |
4664 $('#wf_name').jqxInput({ theme: theme, width: 320, height: 23 }); |
4666 source: fermentablelist, |
4665 $('#wf_instock').jqxCheckBox({ theme: theme, height: 23 }); |
4667 displayMember: "name", |
4666 $('#wf_instock').on('change', function(event) { |
4668 width: 150, |
4667 fermentableinstock = event.args.checked; |
4669 height: 23, |
4668 fermentablelist.dataBind(); |
4670 dropDownWidth: 500, |
4669 }); |
4671 dropDownHeight: 500, |
4670 $('#wf_select').jqxDropDownList({ |
4672 renderer: function (index, label, value) { |
4671 placeHolder: 'Kies mout:', |
4673 var datarecord = fermentablelist.records[index]; |
4672 theme: theme, |
4674 return datarecord.supplier+ " / " + datarecord.name + " (" + datarecord.color + " EBC)"; |
4673 source: fermentablelist, |
4675 } |
4674 displayMember: 'name', |
4676 }); |
4675 width: 150, |
4677 $("#wf_select").on('select', function (event) { |
4676 height: 23, |
4678 if (event.args) { |
4677 dropDownWidth: 500, |
4679 var datarecord, index = event.args.index; |
4678 dropDownHeight: 500, |
4680 datarecord = fermentablelist.records[index]; |
4679 renderer: function(index, label, value) { |
4681 $("#wf_name").val(datarecord.name); |
4680 var datarecord = fermentablelist.records[index]; |
4682 fermentableData.f_name = datarecord.name; |
4681 return datarecord.supplier + ' / ' + datarecord.name + ' (' + datarecord.color + ' EBC)'; |
4683 fermentableData.f_origin = datarecord.origin; |
4682 } |
4684 fermentableData.f_supplier = datarecord.supplier; |
4683 }); |
4685 fermentableData.f_type = datarecord.type; |
4684 $('#wf_select').on('select', function(event) { |
4686 fermentableData.f_cost = datarecord.cost; |
4685 if (event.args) { |
4687 fermentableData.f_yield = datarecord.yield; |
4686 var datarecord, index = event.args.index; |
4688 fermentableData.f_color = datarecord.color; |
4687 datarecord = fermentablelist.records[index]; |
4689 fermentableData.f_coarse_fine_diff = datarecord.coarse_fine_diff; |
4688 $('#wf_name').val(datarecord.name); |
4690 fermentableData.f_moisture = datarecord.moisture; |
4689 fermentableData.f_name = datarecord.name; |
4691 fermentableData.f_diastatic_power = datarecord.diastatic_power; |
4690 fermentableData.f_origin = datarecord.origin; |
4692 fermentableData.f_protein = datarecord.protein; |
4691 fermentableData.f_supplier = datarecord.supplier; |
4693 fermentableData.f_max_in_batch = datarecord.max_in_batch; |
4692 fermentableData.f_type = datarecord.type; |
4694 fermentableData.f_graintype = datarecord.graintype; |
4693 fermentableData.f_cost = datarecord.cost; |
4695 fermentableData.f_dissolved_protein = datarecord.dissolved_protein; |
4694 fermentableData.f_yield = datarecord.yield; |
4696 fermentableData.f_recommend_mash = datarecord.recommend_mash; |
4695 fermentableData.f_color = datarecord.color; |
4697 fermentableData.f_add_after_boil = datarecord.add_after_boil; |
4696 fermentableData.f_coarse_fine_diff = datarecord.coarse_fine_diff; |
4698 fermentableData.f_di_ph = datarecord.di_ph; |
4697 fermentableData.f_moisture = datarecord.moisture; |
4699 fermentableData.f_acid_to_ph_57 = datarecord.acid_to_ph_57; |
4698 fermentableData.f_diastatic_power = datarecord.diastatic_power; |
4700 fermentableData.f_inventory = datarecord.inventory; |
4699 fermentableData.f_protein = datarecord.protein; |
4701 } |
4700 fermentableData.f_max_in_batch = datarecord.max_in_batch; |
4702 }); |
4701 fermentableData.f_graintype = datarecord.graintype; |
4703 $("#wf_amount").jqxNumberInput( Spin3dec ); |
4702 fermentableData.f_dissolved_protein = datarecord.dissolved_protein; |
4704 $('#wf_amount').on('change', function (event) { |
4703 fermentableData.f_recommend_mash = datarecord.recommend_mash; |
4705 console.log("amount changed: "+event.args.value); |
4704 fermentableData.f_add_after_boil = datarecord.add_after_boil; |
4706 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_amount', event.args.value); |
4705 fermentableData.f_di_ph = datarecord.di_ph; |
4707 fermentableData.f_amount = event.args.value; |
4706 fermentableData.f_acid_to_ph_57 = datarecord.acid_to_ph_57; |
4708 if (! to_100) { |
4707 fermentableData.f_inventory = datarecord.inventory; |
4709 calcPercentages(); |
4708 } |
4710 calcFermentables(); |
4709 }); |
4711 calcIBUs(); |
4710 $('#wf_amount').jqxNumberInput(Spin3dec); |
4712 calcMash(); |
4711 $('#wf_amount').on('change', function(event) { |
4713 }; |
4712 console.log('amount changed: ' + event.args.value); |
4714 }); |
4713 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_amount', event.args.value); |
4715 $("#wf_percentage").jqxNumberInput( Perc1dec ); |
4714 fermentableData.f_amount = event.args.value; |
4716 $("#wf_percentage").on('change', function (event) { |
4715 if (! to_100) { |
4717 var newvalue, rowscount, rowdata, diff, tw, damount, namount, nw, newperc, |
4716 calcPercentages(); |
4718 oldvalue = Math.round(fermentableData.f_percentage * 10) / 10.0; |
4717 calcFermentables(); |
4719 newvalue = event.args.value; |
4718 calcIBUs(); |
4720 console.log("percentage changed: "+newvalue+" old: "+oldvalue); |
4719 calcMash(); |
4721 fermentableData.f_percent = newvalue; |
4720 } |
4722 rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
4721 }); |
4723 if ((oldvalue != newvalue) && (rowscount > 1)) { |
4722 $('#wf_percentage').jqxNumberInput(Perc1dec); |
4724 rowdata = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow); |
4723 $('#wf_percentage').on('change', function(event) { |
4725 if (rowdata.f_adjust_to_total_100) { |
4724 var newvalue, rowscount, rowdata, diff, tw, damount, namount, nw, newperc, |
4726 $("#wf_percentage").val(oldvalue); |
4725 oldvalue = Math.round(fermentableData.f_percentage * 10) / 10.0; |
4727 } else { |
4726 newvalue = event.args.value; |
4728 diff = newvalue - oldvalue; |
4727 console.log('percentage changed: ' + newvalue + ' old: ' + oldvalue); |
4729 tw = 0; // total weight |
4728 fermentableData.f_percent = newvalue; |
4730 for (i = 0; i < rowscount; i++) { |
4729 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount; |
4731 rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
4730 if ((oldvalue != newvalue) && (rowscount > 1)) { |
4732 if (rowdata.f_added < 4) |
4731 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', fermentableRow); |
4733 tw += Math.round(rowdata.f_amount * 1000) / 1000; |
4732 if (rowdata.f_adjust_to_total_100) { |
4734 } |
4733 $('#wf_percentage').val(oldvalue); |
4735 tw = Math.round(tw * 1000) / 1000; |
4734 } else { |
4736 if (to_100) { |
4735 diff = newvalue - oldvalue; |
4737 // Adjust this row and the 100% row. |
4736 tw = 0; // total weight |
4738 damount = Math.round(tw * diff *10) / 1000; |
4737 for (i = 0; i < rowscount; i++) { |
4739 rowdata = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow); |
4738 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i); |
4740 namount = Math.round((rowdata.f_amount + damount) * 1000) / 1000; |
4739 if (rowdata.f_added < 4) |
4741 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_amount', namount); |
4740 tw += Math.round(rowdata.f_amount * 1000) / 1000; |
4742 $("#wf_amount").val(namount); |
4741 } |
4743 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_percentage', rowdata.f_percentage + diff); |
4742 tw = Math.round(tw * 1000) / 1000; |
4744 for (i = 0; i < rowscount; i++) { |
4743 if (to_100) { |
4745 rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
4744 // Adjust this row and the 100% row. |
4746 if (rowdata.f_adjust_to_total_100) { |
4745 damount = Math.round(tw * diff * 10) / 1000; |
4747 namount = rowdata.f_amount - damount; |
4746 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', fermentableRow); |
4748 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_percentage', rowdata.f_percentage - diff); |
4747 namount = Round(rowdata.f_amount + damount, 3); |
4749 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_amount', namount); |
4748 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_amount', namount); |
4750 } |
4749 $('#wf_amount').val(namount); |
4751 } |
4750 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_percentage', rowdata.f_percentage + diff); |
4752 calcFermentables(); |
4751 for (i = 0; i < rowscount; i++) { |
4753 calcIBUs(); |
4752 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i); |
4754 calcMash(); |
4753 if (rowdata.f_adjust_to_total_100) { |
4755 } else { |
4754 namount = rowdata.f_amount - damount; |
4756 // Adjust all the rows. |
4755 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', rowdata.f_percentage - diff); |
4757 nw = tw * diff / 100; |
4756 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', namount); |
4758 for (i = 0; i < rowscount; i++) { |
4757 } |
4759 rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
4758 } |
4760 if (rowdata.f_added < 4) { |
4759 calcFermentables(); |
4761 if (i == fermentableRow) { |
4760 calcIBUs(); |
4762 namount = Math.round((rowdata.f_amount + nw) * 1000) / 1000; |
4761 calcMash(); |
4763 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_amount', namount); |
4762 } else { |
4764 // $("#wf_amount").val(namount); // Will crash the script. |
4763 // Adjust all the rows. |
4765 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_percentage', newvalue); |
4764 nw = tw * diff / 100; |
4766 } else { |
4765 for (i = 0; i < rowscount; i++) { |
4767 namount = Math.round((rowdata.f_amount - (nw / (rowscount - 1))) * 1000) / 1000; |
4766 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i); |
4768 newperc = Math.round((namount / tw) * 1000) / 10.0; |
4767 if (rowdata.f_added < 4) { |
4769 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_amount', namount); |
4768 if (i == fermentableRow) { |
4770 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_percentage', newperc); |
4769 namount = Math.round((rowdata.f_amount + nw) * 1000) / 1000; |
4771 } |
4770 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', namount); |
4772 } else { |
4771 // $('#wf_amount').val(namount); // Will crash the script. |
4773 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_percentage', 0); |
4772 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', newvalue); |
4774 } |
4773 } else { |
4775 } |
4774 namount = Math.round((rowdata.f_amount - (nw / (rowscount - 1))) * 1000) / 1000; |
4776 calcFermentables(); |
4775 newperc = Math.round((namount / tw) * 1000) / 10.0; |
4777 calcIBUs(); |
4776 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', namount); |
4778 calcMash(); |
4777 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', newperc); |
4779 } |
4778 } |
4780 } |
4779 } else { |
4781 } |
4780 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', 0); |
4782 }); |
4781 } |
4783 $("#wf_max_in_batch").jqxNumberInput( Show1dec ); |
4782 } |
4784 $("#wf_adjust_to_total_100").jqxCheckBox({ theme: theme, width: 120, height: 23 }); |
4783 calcFermentables(); |
4785 $("#wf_adjust_to_total_100").on('checked', function (event) { |
4784 calcIBUs(); |
4786 if (fermentableData.f_adjust_to_total_100 == 0) { |
4785 calcMash(); |
4787 if (to_100) { |
4786 } |
4788 // Reset other flag first. |
4787 } |
4789 var i, rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
4788 } |
4790 for (i = 0; i < rowscount; i++) { |
4789 }); |
4791 if (i != fermentableRow) { |
4790 $('#wf_max_in_batch').jqxNumberInput(Show1dec); |
4792 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_adjust_to_total_100', 0); |
4791 $('#wf_adjust_to_total_100').jqxCheckBox({ theme: theme, width: 120, height: 23 }); |
4793 } |
4792 $('#wf_adjust_to_total_100').on('checked', function(event) { |
4794 } |
4793 if (fermentableData.f_adjust_to_total_100 == 0) { |
4795 } |
4794 if (to_100) { |
4796 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 1); |
4795 // Reset other flag first. |
4797 calcFermentables(); |
4796 var i, rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount; |
4798 } |
4797 for (i = 0; i < rowscount; i++) { |
4799 }); |
4798 if (i != fermentableRow) { |
4800 $("#wf_adjust_to_total_100").on('unchecked', function (event) { |
4799 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_adjust_to_total_100', 0); |
4801 if (fermentableData.f_adjust_to_total_100 != 0) { |
4800 } |
4802 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 0); |
4801 } |
4803 calcFermentables(); |
4802 } |
4804 } |
4803 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 1); |
4805 }); |
4804 calcFermentables(); |
4806 $("#wf_added").jqxDropDownList({ |
4805 } |
4807 theme: theme, |
4806 }); |
4808 source: AddedAdapter, |
4807 $('#wf_adjust_to_total_100').on('unchecked', function(event) { |
4809 valueMember: 'id', |
4808 if (fermentableData.f_adjust_to_total_100 != 0) { |
4810 displayMember: 'nl', |
4809 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 0); |
4811 width: 180, |
4810 calcFermentables(); |
4812 height: 23, |
4811 } |
4813 autoDropDownHeight: true, |
4812 }); |
4814 dropDownVerticalAlignment: 'top' |
4813 $('#wf_added').jqxDropDownList({ |
4815 }); |
4814 theme: theme, |
4816 $("#wf_added").on('select', function (event) { |
4815 source: AddedAdapter, |
4817 if (event.args) { |
4816 valueMember: 'id', |
4818 var index = event.args.index; |
4817 displayMember: 'nl', |
4819 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_added', index); |
4818 width: 180, |
4820 calcFermentables(); |
4819 height: 23, |
4821 calcIBUs(); |
4820 autoDropDownHeight: true, |
4822 calcMash(); |
4821 dropDownVerticalAlignment: 'top' |
4823 } |
4822 }); |
4824 }); |
4823 $('#wf_added').on('select', function(event) { |
4825 |
4824 if (event.args) { |
4826 // Tab 4, Hops |
4825 var index = event.args.index; |
4827 $("#est_ibu2").jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); |
4826 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_added', index); |
4828 $("#est_ibu2").jqxNumberInput(Smal0dec); |
4827 calcFermentables(); |
4829 $("#hop_flavour").jqxProgressBar({ |
4828 calcIBUs(); |
4830 width: 300, |
4829 calcMash(); |
4831 height: 23, |
4830 } |
4832 theme: theme, |
4831 }); |
4833 showText: true, |
4832 |
4834 animationDuration: 0, |
4833 // Tab 4, Hops |
4835 colorRanges: [ |
4834 $('#est_ibu2').jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' }); |
4836 { stop: 20, color: '#004D00' }, |
4835 $('#est_ibu2').jqxNumberInput(Smal0dec); |
4837 { stop: 40, color: '#008C00' }, |
4836 $('#hop_flavour').jqxProgressBar({ |
4838 { stop: 60, color: '#00BF00' }, |
4837 width: 300, |
4839 { stop: 80, color: '#00FF00' }, |
4838 height: 23, |
4840 { stop: 100, color: '#80FF80' } |
4839 theme: theme, |
4841 ], |
4840 showText: true, |
4842 renderText: function (text) { |
4841 animationDuration: 0, |
4843 var val = parseInt(text); |
4842 colorRanges: [ |
4844 if (val < 20) |
4843 { stop: 20, color: '#004D00' }, |
4845 return 'Weinig'; |
4844 { stop: 40, color: '#008C00' }, |
4846 else if (val < 40) |
4845 { stop: 60, color: '#00BF00' }, |
4847 return 'Matig'; |
4846 { stop: 80, color: '#00FF00' }, |
4848 else if (val < 60) |
4847 { stop: 100, color: '#80FF80' } |
4849 return 'Redelijk'; |
4848 ], |
4850 else if (val < 80) |
4849 renderText: function(text) { |
4851 return 'Veel'; |
4850 var val = parseInt(text); |
4852 else |
4851 if (val < 20) |
4853 return 'Zeer veel'; |
4852 return 'Weinig'; |
4854 } |
4853 else if (val < 40) |
4855 }); |
4854 return 'Matig'; |
4856 $("#hop_aroma").jqxProgressBar({ |
4855 else if (val < 60) |
4857 width: 300, height: 23, theme: theme, showText: true, |
4856 return 'Redelijk'; |
4858 animationDuration: 0, |
4857 else if (val < 80) |
4859 colorRanges: [ |
4858 return 'Veel'; |
4860 { stop: 20, color: '#004D00' }, |
4859 else |
4861 { stop: 40, color: '#008C00' }, |
4860 return 'Zeer veel'; |
4862 { stop: 60, color: '#00BF00' }, |
4861 } |
4863 { stop: 80, color: '#00FF00' }, |
4862 }); |
4864 { stop: 100, color: '#80FF80' } |
4863 $('#hop_aroma').jqxProgressBar({ |
4865 ], |
4864 width: 300, height: 23, theme: theme, showText: true, |
4866 renderText: function (text) { |
4865 animationDuration: 0, |
4867 var val = parseInt(text); |
4866 colorRanges: [ |
4868 if (val < 20) |
4867 { stop: 20, color: '#004D00' }, |
4869 return 'Weinig'; |
4868 { stop: 40, color: '#008C00' }, |
4870 else if (val < 40) |
4869 { stop: 60, color: '#00BF00' }, |
4871 return 'Matig'; |
4870 { stop: 80, color: '#00FF00' }, |
4872 else if (val < 60) |
4871 { stop: 100, color: '#80FF80' } |
4873 return 'Redelijk'; |
4872 ], |
4874 else if (val < 80) |
4873 renderText: function(text) { |
4875 return 'Veel'; |
4874 var val = parseInt(text); |
4876 else |
4875 if (val < 20) |
4877 return 'Zeer veel'; |
4876 return 'Weinig'; |
4878 } |
4877 else if (val < 40) |
4879 }); |
4878 return 'Matig'; |
4880 $("#popupHop").jqxWindow({ |
4879 else if (val < 60) |
4881 width: 800, |
4880 return 'Redelijk'; |
4882 height: 300, |
4881 else if (val < 80) |
4883 position: { x: 230, y: 100 }, |
4882 return 'Veel'; |
4884 resizable: false, |
4883 else |
4885 theme: theme, |
4884 return 'Zeer veel'; |
4886 isModal: true, |
4885 } |
4887 autoOpen: false, |
4886 }); |
4888 cancelButton: $("#HopReady"), |
4887 $('#popupHop').jqxWindow({ |
4889 modalOpacity: 0.40 |
4888 width: 800, |
4890 }); |
4889 height: 300, |
4891 $("#HopReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
4890 position: { x: 230, y: 100 }, |
4892 $("#HopReady").click(function () { |
4891 resizable: false, |
4893 var row, rowID = $("#hopGrid").jqxGrid('getrowid', hopRow); |
4892 theme: theme, |
4894 row = { |
4893 isModal: true, |
4895 h_name: $("#wh_name").val(), |
4894 autoOpen: false, |
4896 h_origin: hopData.h_origin, |
4895 cancelButton: $('#HopReady'), |
4897 h_amount: parseFloat($("#wh_amount").jqxNumberInput('decimal')) / 1000, |
4896 modalOpacity: 0.40 |
4898 h_cost: hopData.h_cost, |
4897 }); |
4899 h_type: hopData.h_type, |
4898 $('#HopReady').jqxButton({ template: 'success', width: '90px', theme: theme }); |
4900 h_form: hopData.h_form, |
4899 $('#HopReady').click(function() { |
4901 h_useat: $("#wh_useat").val(), |
4900 var row, rowID = $('#hopGrid').jqxGrid('getrowid', hopRow); |
4902 h_time: hopData.h_time, |
4901 row = { |
4903 h_alpha: hopData.h_alpha, |
4902 h_name: $('#wh_name').val(), |
4904 h_beta: hopData.h_beta, |
4903 h_origin: hopData.h_origin, |
4905 h_hsi: hopData.h_hsi, |
4904 h_amount: parseFloat($('#wh_amount').jqxNumberInput('decimal')) / 1000, |
4906 h_humulene: hopData.h_humulene, |
4905 h_cost: hopData.h_cost, |
4907 h_caryophyllene: hopData.h_caryophyllene, |
4906 h_type: hopData.h_type, |
4908 h_cohumulone: hopData.h_cohumulone, |
4907 h_form: hopData.h_form, |
4909 h_myrcene: hopData.h_myrcene, |
4908 h_useat: $('#wh_useat').val(), |
4910 h_total_oil: hopData.h_total_oil, |
4909 h_time: hopData.h_time, |
4911 h_inventory: hopData.h_inventory, |
4910 h_alpha: hopData.h_alpha, |
4912 h_avail: hopData.h_avail |
4911 h_beta: hopData.h_beta, |
4913 }; |
4912 h_hsi: hopData.h_hsi, |
4914 $("#hopGrid").jqxGrid('updaterow', rowID, row); |
4913 h_humulene: hopData.h_humulene, |
4915 calcIBUs(); |
4914 h_caryophyllene: hopData.h_caryophyllene, |
4916 }); |
4915 h_cohumulone: hopData.h_cohumulone, |
4917 $("#wh_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
4916 h_myrcene: hopData.h_myrcene, |
4918 $("#wh_instock").jqxCheckBox({ theme: theme, height: 23 }); |
4917 h_total_oil: hopData.h_total_oil, |
4919 $("#wh_instock").on('change', function (event) { |
4918 h_inventory: hopData.h_inventory, |
4920 hopinstock = event.args.checked; |
4919 h_avail: hopData.h_avail |
4921 hoplist.dataBind(); |
4920 }; |
4922 }); |
4921 $('#hopGrid').jqxGrid('updaterow', rowID, row); |
4923 $("#wh_select").jqxDropDownList({ |
4922 calcIBUs(); |
4924 placeHolder: "Kies hop:", |
4923 }); |
4925 theme: theme, |
4924 $('#wh_name').jqxInput({ theme: theme, width: 320, height: 23 }); |
4926 source: hoplist, |
4925 $('#wh_instock').jqxCheckBox({ theme: theme, height: 23 }); |
4927 displayMember: "name", |
4926 $('#wh_instock').on('change', function(event) { |
4928 width: 150, |
4927 hopinstock = event.args.checked; |
4929 height: 23, |
4928 hoplist.dataBind(); |
4930 dropDownWidth: 500, |
4929 }); |
4931 dropDownHeight: 500, |
4930 $('#wh_select').jqxDropDownList({ |
4932 renderer: function (index, label, value) { |
4931 placeHolder: 'Kies hop:', |
4933 var datarecord = hoplist.records[index]; |
4932 theme: theme, |
4934 return datarecord.origin+ " - " + datarecord.name + " / " + HopFormData[datarecord.form].nl + " (" + datarecord.alpha + " % α)"; |
4933 source: hoplist, |
4935 } |
4934 displayMember: 'name', |
4936 }); |
4935 width: 150, |
4937 $("#wh_select").on('select', function (event) { |
4936 height: 23, |
4938 if (event.args) { |
4937 dropDownWidth: 500, |
4939 var datarecord, index = event.args.index; |
4938 dropDownHeight: 500, |
4940 datarecord = hoplist.records[index]; |
4939 renderer: function(index, label, value) { |
4941 $("#wh_name").val(datarecord.name); |
4940 var datarecord = hoplist.records[index]; |
4942 hopData.h_name = datarecord.name; |
4941 return datarecord.origin + ' - ' + datarecord.name + ' / ' + HopFormData[datarecord.form].nl + ' (' + datarecord.alpha + ' % α)'; |
4943 hopData.h_origin = datarecord.origin; |
4942 } |
4944 hopData.h_cost = datarecord.cost; |
4943 }); |
4945 hopData.h_type = datarecord.type; |
4944 $('#wh_select').on('select', function(event) { |
4946 hopData.h_form = datarecord.form; |
4945 if (event.args) { |
4947 hopData.h_alpha = datarecord.alpha; |
4946 var datarecord, index = event.args.index; |
4948 hopData.h_beta = datarecord.beta; |
4947 datarecord = hoplist.records[index]; |
4949 hopData.h_hsi = datarecord.hsi; |
4948 $('#wh_name').val(datarecord.name); |
4950 hopData.h_humulene = datarecord.humulene; |
4949 hopData.h_name = datarecord.name; |
4951 hopData.h_caryophyllene = datarecord.caryophyllene; |
4950 hopData.h_origin = datarecord.origin; |
4952 hopData.h_cohumulone = datarecord.cohumulone; |
4951 hopData.h_cost = datarecord.cost; |
4953 hopData.h_myrcene = datarecord.myrcene; |
4952 hopData.h_type = datarecord.type; |
4954 hopData.h_total_oil = datarecord.total_oil; |
4953 hopData.h_form = datarecord.form; |
4955 hopData.h_inventory = datarecord.inventory; |
4954 hopData.h_alpha = datarecord.alpha; |
4956 } |
4955 hopData.h_beta = datarecord.beta; |
4957 }); |
4956 hopData.h_hsi = datarecord.hsi; |
4958 $("#wh_amount").jqxNumberInput( Spin1dec ); |
4957 hopData.h_humulene = datarecord.humulene; |
4959 $('#wh_amount').on('change', function (event) { |
4958 hopData.h_caryophyllene = datarecord.caryophyllene; |
4960 console.log("amount changed: "+event.args.value+" time:"+hopData.h_time+" alpha:"+hopData.h_alpha); |
4959 hopData.h_cohumulone = datarecord.cohumulone; |
4961 var ibu, amount = parseFloat(event.args.value) / 1000; |
4960 hopData.h_myrcene = datarecord.myrcene; |
4962 ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, |
4961 hopData.h_total_oil = datarecord.total_oil; |
4963 parseFloat($("#batch_size").jqxNumberInput('decimal')), |
4962 hopData.h_inventory = datarecord.inventory; |
4964 amount, parseFloat(hopData.h_time), |
4963 } |
4965 parseFloat(hopData.h_alpha), $("#ibu_method").val() |
4964 }); |
4966 ); |
4965 $('#wh_amount').jqxNumberInput(Spin1dec); |
4967 hopData.h_amount = amount; |
4966 $('#wh_amount').on('change', function(event) { |
4968 $("#wh_ibu").val(ibu); |
4967 console.log('amount changed: ' + event.args.value + ' time:' + hopData.h_time + ' alpha:' + hopData.h_alpha); |
4969 }); |
4968 var ibu, amount = parseFloat(event.args.value) / 1000; |
4970 $("#wh_ibu").jqxNumberInput( Show1dec ); |
4969 ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')), |
4971 $("#wh_time").jqxNumberInput( PosInt ); |
4970 amount, parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $('#ibu_method').val() |
4972 $("#wh_time").on('change', function (event) { |
4971 ); |
4973 var ibu, newtime = parseFloat(event.args.value); |
4972 hopData.h_amount = amount; |
4974 // Check limits and correct |
4973 $('#wh_ibu').val(ibu); |
4975 if (hopData.h_useat == 2) { // Boil |
4974 }); |
4976 if (newtime > parseFloat($("#boil_time").jqxNumberInput('decimal'))) { |
4975 $('#wh_ibu').jqxNumberInput(Show1dec); |
4977 newtime = parseFloat($("#boil_time").jqxNumberInput('decimal')); |
4976 $('#wh_time').jqxNumberInput(PosInt); |
4978 $("#wh_time").val(newtime); |
4977 $('#wh_time').on('change', function(event) { |
4979 } |
4978 var ibu, newtime = parseFloat(event.args.value); |
4980 hopData.h_time = newtime; |
4979 // Check limits and correct |
4981 } else if (hopData.h_useat == 4) { // Whirlpool |
4980 if (hopData.h_useat == 2) { // Boil |
4982 if (newtime > 120) { |
4981 if (newtime > parseFloat($('#boil_time').jqxNumberInput('decimal'))) { |
4983 newtime = 120; |
4982 newtime = parseFloat($('#boil_time').jqxNumberInput('decimal')); |
4984 $("#wh_time").val(newtime); |
4983 $('#wh_time').val(newtime); |
4985 } |
4984 } |
4986 hopData.h_time = newtime; |
4985 hopData.h_time = newtime; |
4987 } else if (hopData.h_useat == 5) { // Dry hop |
4986 } else if (hopData.h_useat == 4) { // Whirlpool |
4988 if (newtime > 21) { |
4987 if (newtime > 120) { |
4989 newtime = 21; |
4988 newtime = 120; |
4990 $("#wh_time").val(newtime); |
4989 $('#wh_time').val(newtime); |
4991 } |
4990 } |
4992 hopData.h_time = newtime * 1440; |
4991 hopData.h_time = newtime; |
4993 } |
4992 } else if (hopData.h_useat == 5) { // Dry hop |
4994 ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($("#batch_size").jqxNumberInput('decimal')), |
4993 if (newtime > 21) { |
4995 parseFloat(hopData.h_amount), parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $("#ibu_method").val()); |
4994 newtime = 21; |
4996 // console.log("time changed: "+newtime+" final:"+hopData.h_time+" ibu:"+ibu); |
4995 $('#wh_time').val(newtime); |
4997 $("#wh_ibu").val(ibu); |
4996 } |
4998 }); |
4997 hopData.h_time = newtime * 1440; |
4999 $("#wh_useat").jqxDropDownList({ |
4998 } |
5000 theme: theme, |
4999 ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')), |
5001 source: HopUseAdapter, |
5000 parseFloat(hopData.h_amount), parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $('#ibu_method').val()); |
5002 valueMember: 'id', |
5001 // console.log("time changed: "+newtime+" final:"+hopData.h_time+" ibu:"+ibu); |
5003 displayMember: 'nl', |
5002 $('#wh_ibu').val(ibu); |
5004 width: 180, |
5003 }); |
5005 height: 23, |
5004 $('#wh_useat').jqxDropDownList({ |
5006 autoDropDownHeight: true, |
5005 theme: theme, |
5007 dropDownVerticalAlignment: 'top' |
5006 source: HopUseAdapter, |
5008 }); |
5007 valueMember: 'id', |
5009 $("#wh_useat").on('select', function (event) { |
5008 displayMember: 'nl', |
5010 if (event.args) { |
5009 width: 180, |
5011 var index = event.args.index; |
5010 height: 23, |
5012 hopData.h_useat = index; |
5011 autoDropDownHeight: true, |
5013 if ((index == 0) || (index == 1)) { // Mashhop or First wort hop |
5012 dropDownVerticalAlignment: 'top' |
5014 hopData.h_time = parseFloat(dataRecord.boil_time); |
5013 }); |
5015 $("#wh_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
5014 $('#wh_useat').on('select', function(event) { |
5016 $("#wh_time").val(hopData.h_time); |
5015 if (event.args) { |
5017 } else if (index == 3) { // Aroma |
5016 var index = event.args.index; |
5018 hopData.h_time = 0; |
5017 hopData.h_useat = index; |
5019 $("#wh_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
5018 if ((index == 0) || (index == 1)) { // Mashhop or First wort hop |
5020 $("#wh_time").val(0); |
5019 hopData.h_time = parseFloat(dataRecord.boil_time); |
5021 } else { // Boil, Whirlpool or Dry hop |
5020 $('#wh_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
5022 $("#wh_time").jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
5021 $('#wh_time').val(hopData.h_time); |
5023 } |
5022 } else if (index == 3) { // Aroma |
5024 if (index == 5) // Dry hop |
5023 hopData.h_time = 0; |
5025 $("#wh_pmpt_time").html("Tijd in dagen"); |
5024 $('#wh_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
5026 else |
5025 $('#wh_time').val(0); |
5027 $("#wh_pmpt_time").html("Tijd in minuten"); |
5026 } else { // Boil, Whirlpool or Dry hop |
5028 } |
5027 $('#wh_time').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
5029 }); |
5028 } |
5030 |
5029 if (index == 5) // Dry hop |
5031 // Tab 5, Miscs |
5030 $('#wh_pmpt_time').html('Tijd in dagen'); |
5032 $("#popupMisc").jqxWindow({ |
5031 else |
5033 width: 800, |
5032 $('#wh_pmpt_time').html('Tijd in minuten'); |
5034 height: 275, |
5033 } |
5035 position: { x: 230, y: 100 }, |
5034 }); |
5036 resizable: false, |
5035 |
5037 theme: theme, |
5036 // Tab 5, Miscs |
5038 isModal: true, |
5037 $('#popupMisc').jqxWindow({ |
5039 autoOpen: false, |
5038 width: 800, |
5040 cancelButton: $("#MiscReady"), |
5039 height: 275, |
5041 modalOpacity: 0.40 |
5040 position: { x: 230, y: 100 }, |
5042 }); |
5041 resizable: false, |
5043 $("#MiscReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
5042 theme: theme, |
5044 $("#MiscReady").click(function () { |
5043 isModal: true, |
5045 var row, rowID = $("#miscGrid").jqxGrid('getrowid', miscRow); |
5044 autoOpen: false, |
5046 console.log("MiscReady row:"+miscRow+" ID:"+rowID); |
5045 cancelButton: $('#MiscReady'), |
5047 row = { |
5046 modalOpacity: 0.40 |
5048 m_name: miscData.m_name, |
5047 }); |
5049 m_amount: miscData.m_amount, |
5048 $('#MiscReady').jqxButton({ template: 'success', width: '90px', theme: theme }); |
5050 m_cost: miscData.m_cost, |
5049 $('#MiscReady').click(function() { |
5051 m_type: miscData.m_type, |
5050 var row, rowID = $('#miscGrid').jqxGrid('getrowid', miscRow); |
5052 m_use_use: miscData.m_use_use, |
5051 console.log('MiscReady row:' + miscRow + ' ID:' + rowID); |
5053 m_time: miscData.m_time, |
5052 row = { |
5054 m_amount_is_weight: miscData.m_amount_is_weight, |
5053 m_name: miscData.m_name, |
5055 m_inventory: miscData.m_inventory, |
5054 m_amount: miscData.m_amount, |
5056 m_avail: miscData.m_avail |
5055 m_cost: miscData.m_cost, |
5057 }; |
5056 m_type: miscData.m_type, |
5058 $("#miscGrid").jqxGrid('updaterow', rowID, row); |
5057 m_use_use: miscData.m_use_use, |
5059 calcMiscs(); |
5058 m_time: miscData.m_time, |
5060 }); |
5059 m_amount_is_weight: miscData.m_amount_is_weight, |
5061 $("#wm_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
5060 m_inventory: miscData.m_inventory, |
5062 $("#wm_instock").jqxCheckBox({ theme: theme, height: 23 }); |
5061 m_avail: miscData.m_avail |
5063 $("#wm_instock").on('change', function (event) { |
5062 }; |
5064 miscinstock = event.args.checked; |
5063 $('#miscGrid').jqxGrid('updaterow', rowID, row); |
5065 misclist.dataBind(); |
5064 calcMiscs(); |
5066 }); |
5065 }); |
5067 $("#wm_select").jqxDropDownList({ |
5066 $('#wm_name').jqxInput({ theme: theme, width: 320, height: 23 }); |
5068 placeHolder: "Kies ingrediënt:", |
5067 $('#wm_instock').jqxCheckBox({ theme: theme, height: 23 }); |
5069 theme: theme, |
5068 $('#wm_instock').on('change', function(event) { |
5070 source: misclist, |
5069 miscinstock = event.args.checked; |
5071 displayMember: "name", |
5070 misclist.dataBind(); |
5072 width: 150, |
5071 }); |
5073 height: 23, |
5072 $('#wm_select').jqxDropDownList({ |
5074 dropDownWidth: 500, |
5073 placeHolder: 'Kies ingrediënt:', |
5075 dropDownHeight: 500 |
5074 theme: theme, |
5076 }); |
5075 source: misclist, |
5077 $("#wm_select").on('select', function (event) { |
5076 displayMember: 'name', |
5078 if (event.args) { |
5077 width: 150, |
5079 var datarecord, index = event.args.index; |
5078 height: 23, |
5080 datarecord = misclist.records[index]; |
5079 dropDownWidth: 500, |
5081 $("#wm_name").val(datarecord.name); |
5080 dropDownHeight: 500 |
5082 miscData.m_name = datarecord.name; |
5081 }); |
5083 miscData.m_cost = datarecord.cost; |
5082 $('#wm_select').on('select', function(event) { |
5084 miscData.m_type = datarecord.type; |
5083 if (event.args) { |
5085 miscData.m_use_use = datarecord.use_use; |
5084 var datarecord, index = event.args.index; |
5086 miscData.m_amount_is_weight = datarecord.amount_is_weight; |
5085 datarecord = misclist.records[index]; |
5087 miscData.m_inventory = datarecord.inventory; |
5086 $('#wm_name').val(datarecord.name); |
5088 } |
5087 miscData.m_name = datarecord.name; |
5089 }); |
5088 miscData.m_cost = datarecord.cost; |
5090 $("#wm_amount").jqxNumberInput( Spin2dec ); |
5089 miscData.m_type = datarecord.type; |
5091 $('#wm_amount').on('change', function (event) { |
5090 miscData.m_use_use = datarecord.use_use; |
5092 console.log("amount changed: "+event.args.value); |
5091 miscData.m_amount_is_weight = datarecord.amount_is_weight; |
5093 miscData.m_amount = parseFloat(event.args.value) / 1000; |
5092 miscData.m_inventory = datarecord.inventory; |
5094 }); |
5093 } |
5095 $("#wm_time").jqxNumberInput( PosInt ); |
5094 }); |
5096 $("#wm_time").on('change', function (event) { |
5095 $('#wm_amount').jqxNumberInput(Spin2dec); |
5097 var newtime = parseFloat(event.args.value); |
5096 $('#wm_amount').on('change', function(event) { |
5098 |
5097 console.log('amount changed: ' + event.args.value); |
5099 if (miscData.m_use_use == 2) { // Boil |
5098 miscData.m_amount = parseFloat(event.args.value) / 1000; |
5100 if (newtime > parseFloat($("#boil_time").jqxNumberInput('decimal'))) { |
5099 }); |
5101 newtime = parseFloat($("#boil_time").jqxNumberInput('decimal')); |
5100 $('#wm_time').jqxNumberInput(PosInt); |
5102 $("#wm_time").val(newtime); |
5101 $('#wm_time').on('change', function(event) { |
5103 } |
5102 var newtime = parseFloat(event.args.value); |
5104 miscData.m_time = newtime; |
5103 |
5105 } else if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) { // Primary or Secondary |
5104 if (miscData.m_use_use == 2) { // Boil |
5106 if (newtime > 21) { |
5105 if (newtime > parseFloat($('#boil_time').jqxNumberInput('decimal'))) { |
5107 newtime = 21; |
5106 newtime = parseFloat($('#boil_time').jqxNumberInput('decimal')); |
5108 $("#wm_time").val(newtime); |
5107 $('#wm_time').val(newtime); |
5109 } |
5108 } |
5110 miscData.m_time = newtime * 1440; |
5109 miscData.m_time = newtime; |
5111 } |
5110 } else if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) { // Primary or Secondary |
5112 }); |
5111 if (newtime > 21) { |
5113 $("#wm_use_use").jqxDropDownList({ |
5112 newtime = 21; |
5114 theme: theme, |
5113 $('#wm_time').val(newtime); |
5115 source: MiscUseAdapter, |
5114 } |
5116 valueMember: 'id', |
5115 miscData.m_time = newtime * 1440; |
5117 displayMember: 'nl', |
5116 } |
5118 width: 180, |
5117 }); |
5119 height: 23, |
5118 $('#wm_use_use').jqxDropDownList({ |
5120 autoDropDownHeight: true, |
5119 theme: theme, |
5121 dropDownVerticalAlignment: 'top' |
5120 source: MiscUseAdapter, |
5122 }); |
5121 valueMember: 'id', |
5123 $("#wm_use_use").on('select', function (event) { |
5122 displayMember: 'nl', |
5124 if (event.args) { |
5123 width: 180, |
5125 var index = event.args.index; |
5124 height: 23, |
5126 miscData.m_use_use = index; |
5125 autoDropDownHeight: true, |
5127 if ((index == 2) || (index == 3) || (index == 4)) { // Boil, Primary or Secondary |
5126 dropDownVerticalAlignment: 'top' |
5128 $("#wm_time").jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
5127 }); |
5129 } else { |
5128 $('#wm_use_use').on('select', function(event) { |
5130 $("#wm_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
5129 if (event.args) { |
5131 $("#wm_time").val(0); |
5130 var index = event.args.index; |
5132 miscData.m_time = 0; |
5131 miscData.m_use_use = index; |
5133 } |
5132 if ((index == 2) || (index == 3) || (index == 4)) { // Boil, Primary or Secondary |
5134 } |
5133 $('#wm_time').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
5135 }); |
5134 } else { |
5136 |
5135 $('#wm_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
5137 // Tab 6, Yeasts |
5136 $('#wm_time').val(0); |
5138 $("#est_fg2").jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' }); |
5137 miscData.m_time = 0; |
5139 $("#est_fg2").jqxNumberInput( Show3dec ); |
5138 } |
5140 $("#est_abv2").jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); |
5139 } |
5141 $("#est_abv2").jqxNumberInput(Smal1dec); |
5140 }); |
5142 $("#yeast_cells").jqxNumberInput( Show1dec ); |
5141 |
5143 $("#need_cells").jqxNumberInput( Show1dec ); |
5142 // Tab 6, Yeasts |
5144 $("#plato_cells").jqxNumberInput( Show2dec ); |
5143 $('#est_fg2').jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' }); |
5145 $("#popupYeast").jqxWindow({ |
5144 $('#est_fg2').jqxNumberInput(Show3dec); |
5146 width: 800, |
5145 $('#est_abv2').jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); |
5147 height: 300, |
5146 $('#est_abv2').jqxNumberInput(Smal1dec); |
5148 position: { x: 230, y: 100 }, |
5147 $('#yeast_cells').jqxNumberInput(Show1dec); |
5149 resizable: false, |
5148 $('#need_cells').jqxNumberInput(Show1dec); |
5150 theme: theme, |
5149 $('#plato_cells').jqxNumberInput(Show2dec); |
5151 isModal: true, |
5150 $('#popupYeast').jqxWindow({ |
5152 autoOpen: false, |
5151 width: 800, |
5153 cancelButton: $("#YeastReady"), |
5152 height: 300, |
5154 modalOpacity: 0.40 |
5153 position: { x: 230, y: 100 }, |
5155 }); |
5154 resizable: false, |
5156 $("#YeastReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
5155 theme: theme, |
5157 $("#YeastReady").click(function () { |
5156 isModal: true, |
5158 var row, rowID = $("#yeastGrid").jqxGrid('getrowid', yeastRow); |
5157 autoOpen: false, |
5159 console.log("YeastReady row:"+yeastRow+" ID:"+rowID); |
5158 cancelButton: $('#YeastReady'), |
5160 row = { |
5159 modalOpacity: 0.40 |
5161 y_name: yeastData.y_name, |
5160 }); |
5162 y_laboratory: yeastData.y_laboratory, |
5161 $('#YeastReady').jqxButton({ template: 'success', width: '90px', theme: theme }); |
5163 y_product_id: yeastData.y_product_id, |
5162 $('#YeastReady').click(function() { |
5164 y_amount: yeastData.y_amount, |
5163 var row, rowID = $('#yeastGrid').jqxGrid('getrowid', yeastRow); |
5165 y_cost: yeastData.y_cost, |
5164 console.log('YeastReady row:' + yeastRow + ' ID:' + rowID); |
5166 y_type: yeastData.y_type, |
5165 row = { |
5167 y_form: yeastData.y_form, |
5166 y_name: yeastData.y_name, |
5168 y_flocculation: yeastData.y_flocculation, |
5167 y_laboratory: yeastData.y_laboratory, |
5169 y_min_temperature: yeastData.y_min_temperature, |
5168 y_product_id: yeastData.y_product_id, |
5170 y_max_temperature: yeastData.y_max_temperature, |
5169 y_amount: yeastData.y_amount, |
5171 y_attenuation: yeastData.y_attenuation, |
5170 y_cost: yeastData.y_cost, |
5172 y_use: yeastData.y_use, |
5171 y_type: yeastData.y_type, |
5173 y_cells: yeastData.y_cells, |
5172 y_form: yeastData.y_form, |
5174 y_tolerance: yeastData.y_tolerance, |
5173 y_flocculation: yeastData.y_flocculation, |
5175 y_inventory: yeastData.y_inventory, |
5174 y_min_temperature: yeastData.y_min_temperature, |
5176 y_avail: yeastData.y_avail |
5175 y_max_temperature: yeastData.y_max_temperature, |
5177 }; |
5176 y_attenuation: yeastData.y_attenuation, |
5178 $("#yeastGrid").jqxGrid('updaterow', rowID, row); |
5177 y_use: yeastData.y_use, |
5179 calcFermentables(); |
5178 y_cells: yeastData.y_cells, |
5180 calcYeast(); |
5179 y_tolerance: yeastData.y_tolerance, |
5181 }); |
5180 y_inventory: yeastData.y_inventory, |
5182 $("#wy_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
5181 y_avail: yeastData.y_avail |
5183 $("#wy_laboratory").jqxInput({ theme: theme, width: 320, height: 23 }); |
5182 }; |
5184 $("#wy_product_id").jqxInput({ theme: theme, width: 320, height: 23 }); |
5183 $('#yeastGrid').jqxGrid('updaterow', rowID, row); |
5185 $("#wy_instock").jqxCheckBox({ theme: theme, height: 23 }); |
5184 calcFermentables(); |
5186 $("#wy_instock").on('change', function (event) { |
5185 calcYeast(); |
5187 yeastinstock = event.args.checked; |
5186 }); |
5188 yeastlist.dataBind(); |
5187 $('#wy_name').jqxInput({ theme: theme, width: 320, height: 23 }); |
5189 }); |
5188 $('#wy_laboratory').jqxInput({ theme: theme, width: 320, height: 23 }); |
5190 $("#wy_select").jqxDropDownList({ |
5189 $('#wy_product_id').jqxInput({ theme: theme, width: 320, height: 23 }); |
5191 placeHolder: "Kies gist:", |
5190 $('#wy_instock').jqxCheckBox({ theme: theme, height: 23 }); |
5192 theme: theme, |
5191 $('#wy_instock').on('change', function(event) { |
5193 source: yeastlist, |
5192 yeastinstock = event.args.checked; |
5194 displayMember: "name", |
5193 yeastlist.dataBind(); |
5195 width: 150, |
5194 }); |
5196 height: 23, |
5195 $('#wy_select').jqxDropDownList({ |
5197 dropDownWidth: 500, |
5196 placeHolder: 'Kies gist:', |
5198 dropDownHeight: 500, |
5197 theme: theme, |
5199 renderer: function (index, label, value) { |
5198 source: yeastlist, |
5200 var datarecord = yeastlist.records[index]; |
5199 displayMember: 'name', |
5201 return datarecord.laboratory+" "+datarecord.product_id+" "+datarecord.name; |
5200 width: 150, |
5202 } |
5201 height: 23, |
5203 }); |
5202 dropDownWidth: 500, |
5204 $("#wy_select").on('select', function (event) { |
5203 dropDownHeight: 500, |
5205 if (event.args) { |
5204 renderer: function(index, label, value) { |
5206 var datarecord, index = event.args.index; |
5205 var datarecord = yeastlist.records[index]; |
5207 datarecord = yeastlist.records[index]; |
5206 return datarecord.laboratory + ' ' + datarecord.product_id + ' ' + datarecord.name; |
5208 $("#wy_name").val(datarecord.name); |
5207 } |
5209 $("#wy_laboratory").val(datarecord.laboratory); |
5208 }); |
5210 $("#wy_product_id").val(datarecord.product_id); |
5209 $('#wy_select').on('select', function(event) { |
5211 yeastData.y_name = datarecord.name; |
5210 if (event.args) { |
5212 yeastData.y_cost = datarecord.cost; |
5211 var datarecord, index = event.args.index; |
5213 yeastData.y_type = datarecord.type; |
5212 datarecord = yeastlist.records[index]; |
5214 yeastData.y_form = datarecord.form; |
5213 $('#wy_name').val(datarecord.name); |
5215 yeastData.y_laboratory = datarecord.laboratory; |
5214 $('#wy_laboratory').val(datarecord.laboratory); |
5216 yeastData.y_product_id = datarecord.product_id; |
5215 $('#wy_product_id').val(datarecord.product_id); |
5217 yeastData.y_min_temperature = datarecord.min_temperature; |
5216 yeastData.y_name = datarecord.name; |
5218 yeastData.y_max_temperature = datarecord.max_temperature; |
5217 yeastData.y_cost = datarecord.cost; |
5219 yeastData.y_flocculation = datarecord.flocculation; |
5218 yeastData.y_type = datarecord.type; |
5220 yeastData.y_attenuation = datarecord.attenuation; |
5219 yeastData.y_form = datarecord.form; |
5221 yeastData.y_cells = datarecord.cells; |
5220 yeastData.y_laboratory = datarecord.laboratory; |
5222 yeastData.y_inventory = datarecord.inventory; |
5221 yeastData.y_product_id = datarecord.product_id; |
5223 if (yeastData.y_form == 0) { |
5222 yeastData.y_min_temperature = datarecord.min_temperature; |
5224 $("#wy_pmpt_amount").html("Pak(ken):"); |
5223 yeastData.y_max_temperature = datarecord.max_temperature; |
5225 } else if (yeastData.y_form == 1) { |
5224 yeastData.y_flocculation = datarecord.flocculation; |
5226 $("#wy_pmpt_amount").html("Gewicht gram:"); |
5225 yeastData.y_attenuation = datarecord.attenuation; |
5227 } else { |
5226 yeastData.y_cells = datarecord.cells; |
5228 $("#wy_pmpt_amount").html("Volume ml:"); |
5227 yeastData.y_inventory = datarecord.inventory; |
5229 } |
5228 if (yeastData.y_form == 0) { |
5230 calcFermentables(); |
5229 $('#wy_pmpt_amount').html('Pak(ken):'); |
5231 calcYeast(); |
5230 } else if (yeastData.y_form == 1) { |
5232 } |
5231 $('#wy_pmpt_amount').html('Gewicht gram:'); |
5233 }); |
5232 } else { |
5234 $("#wy_amount").jqxNumberInput( Spin1dec ); |
5233 $('#wy_pmpt_amount').html('Volume ml:'); |
5235 $('#wy_amount').on('change', function (event) { |
5234 } |
5236 var amount = parseFloat(event.args.value); |
5235 calcFermentables(); |
5237 if (yeastData.y_form != 0) // not Liquid |
5236 calcYeast(); |
5238 amount = parseFloat(event.args.value) / 1000; |
5237 } |
5239 yeastData.y_amount = amount; |
5238 }); |
5240 calcFermentables(); |
5239 $('#wy_amount').jqxNumberInput(Spin1dec); |
5241 calcYeast(); |
5240 $('#wy_amount').on('change', function(event) { |
5242 }); |
5241 var amount = parseFloat(event.args.value); |
5243 $("#wy_use").jqxDropDownList({ |
5242 if (yeastData.y_form != 0) // not Liquid |
5244 theme: theme, |
5243 amount = parseFloat(event.args.value) / 1000; |
5245 source: YeastUseAdapter, |
5244 yeastData.y_amount = amount; |
5246 valueMember: 'id', |
5245 calcFermentables(); |
5247 displayMember: 'nl', |
5246 calcYeast(); |
5248 width: 180, |
5247 }); |
5249 height: 23, |
5248 $('#wy_use').jqxDropDownList({ |
5250 autoDropDownHeight: true, |
5249 theme: theme, |
5251 dropDownVerticalAlignment: 'top' |
5250 source: YeastUseAdapter, |
5252 }); |
5251 valueMember: 'id', |
5253 $("#wy_use").on('select', function (event) { |
5252 displayMember: 'nl', |
5254 if (event.args) { |
5253 width: 180, |
5255 var index = event.args.index; |
5254 height: 23, |
5256 yeastData.y_use = index; |
5255 autoDropDownHeight: true, |
5257 calcFermentables(); |
5256 dropDownVerticalAlignment: 'top' |
5258 calcYeast(); |
5257 }); |
5259 } |
5258 $('#wy_use').on('select', function(event) { |
5260 }); |
5259 if (event.args) { |
5261 for (i = 1; i < 5; i++) { |
5260 var index = event.args.index; |
5262 $("#prop"+i+"_type").jqxDropDownList({ |
5261 yeastData.y_use = index; |
5263 theme: theme, |
5262 calcFermentables(); |
5264 source: StarterTypeAdapter, |
5263 calcYeast(); |
5265 valueMember: 'id', |
5264 } |
5266 displayMember: 'nl', |
5265 }); |
5267 width: 120, |
5266 for (i = 1; i < 5; i++) { |
5268 height: 23, |
5267 $('#prop' + i + '_type').jqxDropDownList({ |
5269 autoDropDownHeight: true |
5268 theme: theme, |
5270 }); |
5269 source: StarterTypeAdapter, |
5271 $("#prop"+i+"_type").hide(); |
5270 valueMember: 'id', |
5272 $("#prop"+i+"_volume").jqxNumberInput( Spin3dec ); |
5271 displayMember: 'nl', |
5273 $("#prop"+i+"_volume").hide(); |
5272 width: 120, |
5274 $("#prop"+i+"_irate").jqxNumberInput( Show1dec ); |
5273 height: 23, |
5275 $("#prop"+i+"_irate").hide(); |
5274 autoDropDownHeight: true |
5276 $("#prop"+i+"_ncells").jqxNumberInput( Show1dec ); |
5275 }); |
5277 $("#prop"+i+"_ncells").hide(); |
5276 $('#prop' + i + '_type').hide(); |
5278 $("#prop"+i+"_tcells").jqxNumberInput( Show1dec ); |
5277 $('#prop' + i + '_volume').jqxNumberInput(Spin3dec); |
5279 $("#prop"+i+"_tcells").hide(); |
5278 $('#prop' + i + '_volume').hide(); |
5280 $("#prop"+i+"_growf").jqxNumberInput( Show2dec ); |
5279 $('#prop' + i + '_irate').jqxNumberInput(Show1dec); |
5281 $("#prop"+i+"_growf").hide(); |
5280 $('#prop' + i + '_irate').hide(); |
5282 } |
5281 $('#prop' + i + '_ncells').jqxNumberInput(Show1dec); |
5283 $("#starter_enable").jqxCheckBox({ theme: theme, height: 23 }); |
5282 $('#prop' + i + '_ncells').hide(); |
5284 $("#starter_type").jqxDropDownList({ |
5283 $('#prop' + i + '_tcells').jqxNumberInput(Show1dec); |
5285 theme: theme, |
5284 $('#prop' + i + '_tcells').hide(); |
5286 source: StarterTypeAdapter, |
5285 $('#prop' + i + '_growf').jqxNumberInput(Show2dec); |
5287 valueMember: 'id', |
5286 $('#prop' + i + '_growf').hide(); |
5288 displayMember: 'nl', |
5287 } |
5289 width: 120, |
5288 $('#starter_enable').jqxCheckBox({ theme: theme, height: 23 }); |
5290 height: 23, |
5289 $('#starter_type').jqxDropDownList({ |
5291 autoDropDownHeight: true |
5290 theme: theme, |
5292 }); |
5291 source: StarterTypeAdapter, |
5293 $("#starter_sg").jqxNumberInput( SGopts ); |
5292 valueMember: 'id', |
5294 $("#starter_viability").jqxNumberInput( Perc0 ); |
5293 displayMember: 'nl', |
5295 $("#starter_try").jqxButton({ template: "primary", width: '100px', height: 23, theme: theme }); |
5294 width: 120, |
5296 |
5295 height: 23, |
5297 // Tab 7, Mashing |
5296 autoDropDownHeight: true |
5298 $("#mash_name").jqxTooltip({ content: 'De omschrijving van dit maisch profiel.' }); |
5297 }); |
5299 $("#mash_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
5298 $('#starter_sg').jqxNumberInput(SGopts); |
5300 $("#mash_select").jqxDropDownList({ |
5299 $('#starter_viability').jqxNumberInput(Perc0); |
5301 placeHolder: "Kies schema:", |
5300 $('#starter_try').jqxButton({ template: 'primary', width: '100px', height: 23, theme: theme }); |
5302 theme: theme, |
5301 |
5303 source: mashlist, |
5302 // Tab 7, Mashing |
5304 displayMember: "name", |
5303 $('#mash_name').jqxTooltip({ content: 'De omschrijving van dit maisch profiel.' }); |
5305 width: 250, |
5304 $('#mash_name').jqxInput({ theme: theme, width: 320, height: 23 }); |
5306 height: 23, |
5305 $('#mash_select').jqxDropDownList({ |
5307 dropDownWidth: 500, |
5306 placeHolder: 'Kies schema:', |
5308 dropDownHeight: 500, |
5307 theme: theme, |
5309 dropDownHorizontalAlignment: 'right' |
5308 source: mashlist, |
5310 }); |
5309 displayMember: 'name', |
5311 $("#mash_select").on('select', function (event) { |
5310 width: 250, |
5312 if (event.args) { |
5311 height: 23, |
5313 var data, datarecord, rowIDs, rows, i, row = {}, index = event.args.index; |
5312 dropDownWidth: 500, |
5314 // First delete all current steps |
5313 dropDownHeight: 500, |
5315 rowIDs = new Array(); |
5314 dropDownHorizontalAlignment: 'right' |
5316 rows = $("#mashGrid").jqxGrid('getdisplayrows'); |
5315 }); |
5317 for (i = 0; i < rows.length; i++) { |
5316 $('#mash_select').on('select', function(event) { |
5318 row = rows[i]; |
5317 if (event.args) { |
5319 rowIDs.push(row.uid); |
5318 var data, datarecord, rowIDs, rows, i, row, index = event.args.index; |
5320 } |
5319 // First delete all current steps |
5321 $("#mashGrid").jqxGrid('deleterow', rowIDs); |
5320 rowIDs = new Array(); |
5322 // Then add the new steps |
5321 rows = $('#mashGrid').jqxGrid('getdisplayrows'); |
5323 datarecord = mashlist.records[index]; |
5322 for (i = 0; i < rows.length; i++) { |
5324 $("#mash_name").val(datarecord.name); |
5323 row = rows[i]; |
5325 for (i = 0; i < datarecord.steps.length; i++) { |
5324 rowIDs.push(row.uid); |
5326 data = datarecord.steps[i]; |
5325 } |
5327 row["step_name"] = data.step_name; |
5326 $('#mashGrid').jqxGrid('deleterow', rowIDs); |
5328 row["step_type"] = data.step_type; |
5327 // Then add the new steps |
5329 // For now, but this must be smarter. |
5328 datarecord = mashlist.records[index]; |
5330 if (mash_infuse == 0 && dataRecord.w1_amount > 0) |
5329 $('#mash_name').val(datarecord.name); |
5331 mash_infuse = dataRecord.w1_amount; |
5330 for (i = 0; i < datarecord.steps.length; i++) { |
5332 if (i == 0) |
5331 data = datarecord.steps[i]; |
5333 row["step_infuse_amount"] = mash_infuse; |
5332 row = {}; |
5334 else |
5333 row['step_name'] = data.step_name; |
5335 row["step_infuse_amount"] = 0; |
5334 row['step_type'] = data.step_type; |
5336 if (mashkg > 0) |
5335 // For now, but this must be smarter. |
5337 row['step_thickness'] = parseFloat(mash_infuse / mashkg); |
5336 if (mash_infuse == 0 && dataRecord.w1_amount > 0) |
5338 else |
5337 mash_infuse = dataRecord.w1_amount; |
5339 row['step_thickness'] = 0; |
5338 if (i == 0) |
5340 row["step_temp"] = data.step_temp; |
5339 row['step_infuse_amount'] = mash_infuse; |
5341 row["end_temp"] = data.end_temp; |
5340 else |
5342 row["step_time"] = data.step_time; |
5341 row['step_infuse_amount'] = 0; |
5343 row["ramp_time"] = data.ramp_time; |
5342 if (mashkg > 0) |
5344 $("#mashGrid").jqxGrid('addrow', null, row); |
5343 row['step_thickness'] = parseFloat(mash_infuse / mashkg); |
5345 } |
5344 else |
5346 } |
5345 row['step_thickness'] = 0; |
5347 }); |
5346 row['step_temp'] = data.step_temp; |
5348 $("#popupMash").jqxWindow({ |
5347 row['end_temp'] = data.end_temp; |
5349 width: 800, |
5348 row['step_time'] = data.step_time; |
5350 height: 350, |
5349 row['ramp_time'] = data.ramp_time; |
5351 position: { x: 230, y: 100 }, |
5350 $('#mashGrid').jqxGrid('addrow', null, row); |
5352 resizable: false, |
5351 } |
5353 theme: theme, |
5352 } |
5354 isModal: true, |
5353 }); |
5355 autoOpen: false, |
5354 $('#popupMash').jqxWindow({ |
5356 cancelButton: $("#MashReady"), |
5355 width: 800, |
5357 modalOpacity: 0.40 |
5356 height: 350, |
5358 }); |
5357 position: { x: 230, y: 100 }, |
5359 $("#MashReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
5358 resizable: false, |
5360 $("#MashReady").click(function () { |
5359 theme: theme, |
5361 calcMash(); |
5360 isModal: true, |
5362 }); |
5361 autoOpen: false, |
5363 $("#wstep_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
5362 cancelButton: $('#MashReady'), |
5364 $("#wstep_name").on('change', function (event) { |
5363 modalOpacity: 0.40 |
5365 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
5364 }); |
5366 rowdata.step_name = event.args.value; |
5365 $('#MashReady').jqxButton({ template: 'success', width: '90px', theme: theme }); |
5367 }); |
5366 $('#MashReady').click(function() { |
5368 $("#wstep_type").jqxDropDownList({ |
5367 calcMash(); |
5369 theme: theme, |
5368 }); |
5370 source: MashStepTypeAdapter, |
5369 $('#wstep_name').jqxInput({ theme: theme, width: 320, height: 23 }); |
5371 valueMember: 'id', |
5370 $('#wstep_name').on('change', function(event) { |
5372 displayMember: 'nl', |
5371 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); |
5373 width: 180, |
5372 rowdata.step_name = event.args.value; |
5374 height: 23, |
5373 }); |
5375 autoDropDownHeight: true |
5374 $('#wstep_type').jqxDropDownList({ |
5376 }); |
5375 theme: theme, |
5377 $("#wstep_type").on('select', function (event) { |
5376 source: MashStepTypeAdapter, |
5378 if (event.args) { |
5377 valueMember: 'id', |
5379 var rowdata, i, rows, row, index = event.args.index; |
5378 displayMember: 'nl', |
5380 rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
5379 width: 180, |
5381 rowdata.step_type = index; |
5380 height: 23, |
5382 if (index == 0) { |
5381 autoDropDownHeight: true |
5383 $("#wstep_infuse_amount").show(); |
5382 }); |
5384 $("#wstep_pmpt").show(); |
5383 $('#wstep_type').on('select', function(event) { |
5385 } else { |
5384 if (event.args) { |
5386 rowdata.step_infuse_amount = 0; |
5385 var rowdata, i, rows, row, index = event.args.index; |
5387 $("#wstep_infuse_amount").hide(); |
5386 rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); |
5388 $("#wstep_pmpt").hide(); |
5387 rowdata.step_type = index; |
5389 } |
5388 if (index == 0) { |
5390 mash_infuse = 0; |
5389 $('#wstep_infuse_amount').show(); |
5391 rows = $('#mashGrid').jqxGrid('getrows'); |
5390 $('#wstep_pmpt').show(); |
5392 for (i = 0; i < rows.length; i++) { |
5391 } else { |
5393 row = rows[i]; |
5392 rowdata.step_infuse_amount = 0; |
5394 if (row.step_type == 0) // Infusion |
5393 $('#wstep_infuse_amount').hide(); |
5395 mash_infuse += parseFloat(row.step_infuse_amount); |
5394 $('#wstep_pmpt').hide(); |
5396 } |
5395 } |
5397 } |
5396 mash_infuse = 0; |
5398 }); |
5397 rows = $('#mashGrid').jqxGrid('getrows'); |
5399 $("#wstep_temp").jqxNumberInput( Spin1dec ); |
5398 for (i = 0; i < rows.length; i++) { |
5400 $('#wstep_temp').on('change', function (event) { |
5399 row = rows[i]; |
5401 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
5400 if (row.step_type == 0) // Infusion |
5402 rowdata.step_temp = parseFloat(event.args.value); |
5401 mash_infuse += parseFloat(row.step_infuse_amount); |
5403 }); |
5402 } |
5404 $("#wend_temp").jqxNumberInput( Spin1dec ); |
5403 } |
5405 $('#wend_temp').on('change', function (event) { |
5404 }); |
5406 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
5405 $('#wstep_temp').jqxNumberInput(Spin1dec); |
5407 rowdata.end_temp = parseFloat(event.args.value); |
5406 $('#wstep_temp').on('change', function(event) { |
5408 }); |
5407 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); |
5409 $("#wstep_time").jqxNumberInput( PosInt ); |
5408 rowdata.step_temp = parseFloat(event.args.value); |
5410 $('#wstep_time').on('change', function (event) { |
5409 }); |
5411 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
5410 $('#wend_temp').jqxNumberInput(Spin1dec); |
5412 rowdata.step_time = parseFloat(event.args.value); |
5411 $('#wend_temp').on('change', function(event) { |
5413 }); |
5412 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); |
5414 $("#wramp_time").jqxNumberInput( PosInt ); |
5413 rowdata.end_temp = parseFloat(event.args.value); |
5415 $('#wramp_time').on('change', function (event) { |
5414 }); |
5416 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
5415 $('#wstep_time').jqxNumberInput(PosInt); |
5417 rowdata.ramp_time = parseFloat(event.args.value); |
5416 $('#wstep_time').on('change', function(event) { |
5418 }); |
5417 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); |
5419 $("#wstep_infuse_amount").jqxNumberInput( Spin1dec ); |
5418 rowdata.step_time = parseFloat(event.args.value); |
5420 $('#wstep_infuse_amount').on('change', function (event) { |
5419 }); |
5421 var row, i, rows, rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
5420 $('#wramp_time').jqxNumberInput(PosInt); |
5422 rowdata.step_infuse_amount = parseFloat(event.args.value); |
5421 $('#wramp_time').on('change', function(event) { |
5423 mash_infuse = 0; |
5422 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); |
5424 rows = $('#mashGrid').jqxGrid('getrows'); |
5423 rowdata.ramp_time = parseFloat(event.args.value); |
5425 for (i = 0; i < rows.length; i++) { |
5424 }); |
5426 row = rows[i]; |
5425 $('#wstep_infuse_amount').jqxNumberInput(Spin1dec); |
5427 if (row.step_type == 0) // Infusion |
5426 $('#wstep_infuse_amount').on('change', function(event) { |
5428 mash_infuse += parseFloat(row.step_infuse_amount); |
5427 var row, i, rows, rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); |
5429 } |
5428 rowdata.step_infuse_amount = parseFloat(event.args.value); |
5430 if (dataRecord.w2_amount == 0) { |
5429 mash_infuse = 0; |
5431 dataRecord.w1_amount = mash_infuse; |
5430 rows = $('#mashGrid').jqxGrid('getrows'); |
5432 $("#w1_amount").val(mash_infuse); |
5431 for (i = 0; i < rows.length; i++) { |
5433 } else { |
5432 row = rows[i]; |
5434 dataRecord.w1_amount = (dataRecord.w1_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse; |
5433 if (row.step_type == 0) // Infusion |
5435 dataRecord.w2_amount = (dataRecord.w2_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse; |
5434 mash_infuse += parseFloat(row.step_infuse_amount); |
5436 $("#w1_amount").val(dataRecord.w1_amount); |
5435 } |
5437 $("#w2_amount").val(dataRecord.w2_amount); |
5436 if (dataRecord.w2_amount == 0) { |
5438 } |
5437 dataRecord.w1_amount = mash_infuse; |
5439 $('#wg_amount').val(mash_infuse); |
5438 $('#w1_amount').val(mash_infuse); |
5440 }); |
5439 } else { |
5441 |
5440 dataRecord.w1_amount = (dataRecord.w1_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse; |
5442 // Tab 8, Water |
5441 dataRecord.w2_amount = (dataRecord.w2_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse; |
5443 $("#tgt_bu").jqxNumberInput( Show2wat ); |
5442 $('#w1_amount').val(dataRecord.w1_amount); |
5444 $("#tgt_cl_so4").jqxNumberInput( Show1wat ); |
5443 $('#w2_amount').val(dataRecord.w2_amount); |
5445 $("#got_cl_so4").jqxNumberInput( Show1wat ); |
5444 } |
5446 |
5445 $('#wg_amount').val(mash_infuse); |
5447 // Water source 1 |
5446 }); |
5448 $("#w1_name").jqxDropDownList({ |
5447 |
5449 placeHolder: "Kies hoofd water:", |
5448 // Tab 8, Water |
5450 theme: theme, |
5449 $('#tgt_bu').jqxNumberInput(Show2wat); |
5451 source: waterlist, |
5450 $('#tgt_cl_so4').jqxNumberInput(Show1wat); |
5452 displayMember: "name", |
5451 $('#got_cl_so4').jqxNumberInput(Show1wat); |
5453 width: 250, |
5452 |
5454 height: 27, |
5453 // Water source 1 |
5455 dropDownWidth: 400, |
5454 $('#w1_name').jqxDropDownList({ |
5456 dropDownHeight: 400 |
5455 placeHolder: 'Kies hoofd water:', |
5457 }); |
5456 theme: theme, |
5458 $("#w1_name").on('select', function (event) { |
5457 source: waterlist, |
5459 if (event.args) { |
5458 displayMember: 'name', |
5460 var datarecord, index = event.args.index; |
5459 width: 250, |
5461 datarecord = waterlist.records[index]; |
5460 height: 27, |
5462 dataRecord.w1_name = datarecord.name; |
5461 dropDownWidth: 400, |
5463 $("#w1_calcium").val(datarecord.calcium); |
5462 dropDownHeight: 400 |
5464 dataRecord.w1_calcium = datarecord.calcium; |
5463 }); |
5465 $("#w1_sulfate").val(datarecord.sulfate); |
5464 $('#w1_name').on('select', function(event) { |
5466 dataRecord.w1_sulfate = datarecord.sulfate; |
5465 if (event.args) { |
5467 $("#w1_chloride").val(datarecord.chloride); |
5466 var datarecord, index = event.args.index; |
5468 dataRecord.w1_chloride = datarecord.chloride; |
5467 datarecord = waterlist.records[index]; |
5469 $("#w1_sodium").val(datarecord.sodium); |
5468 dataRecord.w1_name = datarecord.name; |
5470 dataRecord.w1_sodium = datarecord.sodium; |
5469 $('#w1_calcium').val(datarecord.calcium); |
5471 $("#w1_magnesium").val(datarecord.magnesium); |
5470 dataRecord.w1_calcium = datarecord.calcium; |
5472 dataRecord.w1_magnesium = datarecord.magnesium; |
5471 $('#w1_sulfate').val(datarecord.sulfate); |
5473 $("#w1_total_alkalinity").val(datarecord.total_alkalinity); |
5472 dataRecord.w1_sulfate = datarecord.sulfate; |
5474 dataRecord.w1_total_alkalinity = datarecord.total_alkalinity; |
5473 $('#w1_chloride').val(datarecord.chloride); |
5475 $("#w1_ph").val(datarecord.ph); |
5474 dataRecord.w1_chloride = datarecord.chloride; |
5476 dataRecord.w1_ph = datarecord.ph; |
5475 $('#w1_sodium').val(datarecord.sodium); |
5477 $("#w1_cost").val(datarecord.cost); |
5476 dataRecord.w1_sodium = datarecord.sodium; |
5478 dataRecord.w1_cost = datarecord.cost; |
5477 $('#w1_magnesium').val(datarecord.magnesium); |
5479 calcWater(); |
5478 dataRecord.w1_magnesium = datarecord.magnesium; |
5480 } |
5479 $('#w1_total_alkalinity').val(datarecord.total_alkalinity); |
5481 }); |
5480 dataRecord.w1_total_alkalinity = datarecord.total_alkalinity; |
5482 $("#w1_amount").jqxNumberInput( Show1wat ); |
5481 $('#w1_ph').val(datarecord.ph); |
5483 $("#w1_calcium").jqxNumberInput( Show1wat ); |
5482 dataRecord.w1_ph = datarecord.ph; |
5484 $("#w1_magnesium").jqxNumberInput( Show1wat ); |
5483 $('#w1_cost').val(datarecord.cost); |
5485 $("#w1_sodium").jqxNumberInput( Show1wat ); |
5484 dataRecord.w1_cost = datarecord.cost; |
5486 $("#w1_total_alkalinity").jqxNumberInput( Show1wat ); |
5485 calcWater(); |
5487 $("#w1_chloride").jqxNumberInput( Show1wat ); |
5486 } |
5488 $("#w1_sulfate").jqxNumberInput( Show1wat ); |
5487 }); |
5489 $("#w1_ph").jqxNumberInput( Show1wat ); |
5488 $('#w1_amount').jqxNumberInput(Show1wat); |
5490 // Water source 2 |
5489 $('#w1_calcium').jqxNumberInput(Show1wat); |
5491 $("#w2_name").jqxDropDownList({ |
5490 $('#w1_magnesium').jqxNumberInput(Show1wat); |
5492 placeHolder: "Kies meng water:", |
5491 $('#w1_sodium').jqxNumberInput(Show1wat); |
5493 theme: theme, |
5492 $('#w1_total_alkalinity').jqxNumberInput(Show1wat); |
5494 source: waterlist, |
5493 $('#w1_chloride').jqxNumberInput(Show1wat); |
5495 displayMember: "name", |
5494 $('#w1_sulfate').jqxNumberInput(Show1wat); |
5496 width: 250, |
5495 $('#w1_ph').jqxNumberInput(Show1wat); |
5497 height: 27, |
5496 // Water source 2 |
5498 dropDownWidth: 400, |
5497 $('#w2_name').jqxDropDownList({ |
5499 dropDownHeight: 400 |
5498 placeHolder: 'Kies meng water:', |
5500 }); |
5499 theme: theme, |
5501 $("#w2_name").on('select', function (event) { |
5500 source: waterlist, |
5502 if (event.args) { |
5501 displayMember: 'name', |
5503 var datarecord, index = event.args.index; |
5502 width: 250, |
5504 datarecord = waterlist.records[index]; |
5503 height: 27, |
5505 dataRecord.w2_name = datarecord.name; |
5504 dropDownWidth: 400, |
5506 $("#w2_calcium").val(datarecord.calcium); |
5505 dropDownHeight: 400 |
5507 dataRecord.w2_calcium = datarecord.calcium; |
5506 }); |
5508 $("#w2_sulfate").val(datarecord.sulfate); |
5507 $('#w2_name').on('select', function(event) { |
5509 dataRecord.w2_sulfate = datarecord.sulfate; |
5508 if (event.args) { |
5510 $("#w2_chloride").val(datarecord.chloride); |
5509 var datarecord, index = event.args.index; |
5511 dataRecord.w2_chloride = datarecord.chloride; |
5510 datarecord = waterlist.records[index]; |
5512 $("#w2_sodium").val(datarecord.sodium); |
5511 dataRecord.w2_name = datarecord.name; |
5513 dataRecord.w2_sodium = datarecord.sodium; |
5512 $('#w2_calcium').val(datarecord.calcium); |
5514 $("#w2_magnesium").val(datarecord.magnesium); |
5513 dataRecord.w2_calcium = datarecord.calcium; |
5515 dataRecord.w2_magnesium = datarecord.magnesium; |
5514 $('#w2_sulfate').val(datarecord.sulfate); |
5516 $("#w2_total_alkalinity").val(datarecord.total_alkalinity); |
5515 dataRecord.w2_sulfate = datarecord.sulfate; |
5517 dataRecord.w2_total_alkalinity = datarecord.total_alkalinity; |
5516 $('#w2_chloride').val(datarecord.chloride); |
5518 $("#w2_ph").val(datarecord.ph); |
5517 dataRecord.w2_chloride = datarecord.chloride; |
5519 dataRecord.w2_ph = datarecord.ph; |
5518 $('#w2_sodium').val(datarecord.sodium); |
5520 $("#w2_cost").val(datarecord.cost); |
5519 dataRecord.w2_sodium = datarecord.sodium; |
5521 dataRecord.w2_cost = datarecord.cost; |
5520 $('#w2_magnesium').val(datarecord.magnesium); |
5522 $("#w2_amount").jqxNumberInput({ max: 100000, readOnly: false }); // Set high max to enable the spinbuttons. |
5521 dataRecord.w2_magnesium = datarecord.magnesium; |
5523 calcWater(); |
5522 $('#w2_total_alkalinity').val(datarecord.total_alkalinity); |
5524 } |
5523 dataRecord.w2_total_alkalinity = datarecord.total_alkalinity; |
5525 }); |
5524 $('#w2_ph').val(datarecord.ph); |
5526 $("#w2_amount").jqxTooltip({ content: 'De verdeling van het hoofd en meng water. Het totale maisch water volume blijft gelijk.'}); |
5525 dataRecord.w2_ph = datarecord.ph; |
5527 $("#w2_amount").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 94, height: 23, min: 0, max: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5, readOnly: true }); |
5526 $('#w2_cost').val(datarecord.cost); |
5528 $("#w2_calcium").jqxNumberInput( Show1wat ); |
5527 dataRecord.w2_cost = datarecord.cost; |
5529 $("#w2_magnesium").jqxNumberInput( Show1wat ); |
5528 $('#w2_amount').jqxNumberInput({ max: 100000, readOnly: false }); // Set high max to enable the spinbuttons. |
5530 $("#w2_sodium").jqxNumberInput( Show1wat ); |
5529 calcWater(); |
5531 $("#w2_total_alkalinity").jqxNumberInput( Show1wat ); |
5530 } |
5532 $("#w2_chloride").jqxNumberInput( Show1wat ); |
5531 }); |
5533 $("#w2_sulfate").jqxNumberInput( Show1wat ); |
5532 $('#w2_amount').jqxTooltip({ content: 'De verdeling van het hoofd en meng water. Het totale maisch water volume blijft gelijk.'}); |
5534 $("#w2_ph").jqxNumberInput( Show1wat ); |
5533 $('#w2_amount').jqxNumberInput({ |
5535 // Water mixed |
5534 inputMode: 'simple', spinMode: 'simple', theme: theme, width: 94, height: 23, min: 0, max: 0, decimalDigits: 1, |
5536 $("#wg_amount").jqxNumberInput( Show1wat ); |
5535 spinButtons: true, spinButtonsStep: 0.5, readOnly: true |
5537 $("#wg_calcium").jqxNumberInput( Show1wat ); |
5536 }); |
5538 $("#wg_magnesium").jqxNumberInput( Show1wat ); |
5537 $('#w2_calcium').jqxNumberInput(Show1wat); |
5539 $("#wg_sodium").jqxNumberInput( Show1wat ); |
5538 $('#w2_magnesium').jqxNumberInput(Show1wat); |
5540 $("#wg_total_alkalinity").jqxNumberInput( Show1wat ); |
5539 $('#w2_sodium').jqxNumberInput(Show1wat); |
5541 $("#wg_chloride").jqxNumberInput( Show1wat ); |
5540 $('#w2_total_alkalinity').jqxNumberInput(Show1wat); |
5542 $("#wg_sulfate").jqxNumberInput( Show1wat ); |
5541 $('#w2_chloride').jqxNumberInput(Show1wat); |
5543 $("#wg_ph").jqxNumberInput( Show1wat ); |
5542 $('#w2_sulfate').jqxNumberInput(Show1wat); |
5544 // Water treated |
5543 $('#w2_ph').jqxNumberInput(Show1wat); |
5545 $("#wb_calcium").jqxTooltip({ content: 'De ideale hoeveelheid Calcium is tussen 40 en 150.'}); |
5544 // Water mixed |
5546 $("#wb_calcium").jqxNumberInput( Show1wat ); |
5545 $('#wg_amount').jqxNumberInput(Show1wat); |
5547 $("#wb_magnesium").jqxTooltip({ content: 'De ideale hoeveelheid Magnesium is lager dan 30.'}); |
5546 $('#wg_calcium').jqxNumberInput(Show1wat); |
5548 $("#wb_magnesium").jqxNumberInput( Show1wat ); |
5547 $('#wg_magnesium').jqxNumberInput(Show1wat); |
5549 $("#wb_sodium").jqxTooltip({ content: 'De ideale hoeveelheid Natrium is lager dan 150.'}); |
5548 $('#wg_sodium').jqxNumberInput(Show1wat); |
5550 $("#wb_sodium").jqxNumberInput( Show1wat ); |
5549 $('#wg_total_alkalinity').jqxNumberInput(Show1wat); |
5551 $("#wb_total_alkalinity").jqxNumberInput( Show1wat ); |
5550 $('#wg_chloride').jqxNumberInput(Show1wat); |
5552 $("#wb_chloride").jqxTooltip({ content: 'De ideale hoeveelheid Chloride is tussen 50 en 100.'}); |
5551 $('#wg_sulfate').jqxNumberInput(Show1wat); |
5553 $("#wb_chloride").jqxNumberInput( Show1wat ); |
5552 $('#wg_ph').jqxNumberInput(Show1wat); |
5554 $("#wb_sulfate").jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is tussen 50 en 350.'}); |
5553 // Water treated |
5555 $("#wb_sulfate").jqxNumberInput( Show1wat ); |
5554 $('#wb_calcium').jqxTooltip({ content: 'De ideale hoeveelheid Calcium is tussen 40 en 150.'}); |
5556 $("#wb_ph").jqxNumberInput( Show1wat ); |
5555 $('#wb_calcium').jqxNumberInput(Show1wat); |
5557 // Water target profile |
5556 $('#wb_magnesium').jqxTooltip({ content: 'De ideale hoeveelheid Magnesium is lager dan 30.'}); |
5558 $("#pr_name").jqxDropDownList({ |
5557 $('#wb_magnesium').jqxNumberInput(Show1wat); |
5559 placeHolder: "Kies doel profiel:", |
5558 $('#wb_sodium').jqxTooltip({ content: 'De ideale hoeveelheid Natrium is lager dan 150.'}); |
5560 theme: theme, |
5559 $('#wb_sodium').jqxNumberInput(Show1wat); |
5561 source: waterprofiles, |
5560 $('#wb_total_alkalinity').jqxNumberInput(Show1wat); |
5562 displayMember: "name", |
5561 $('#wb_chloride').jqxTooltip({ content: 'De ideale hoeveelheid Chloride is tussen 50 en 100.'}); |
5563 width: 250, |
5562 $('#wb_chloride').jqxNumberInput(Show1wat); |
5564 height: 27, |
5563 $('#wb_sulfate').jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is tussen 50 en 350.'}); |
5565 dropDownWidth: 400, |
5564 $('#wb_sulfate').jqxNumberInput(Show1wat); |
5566 dropDownHeight: 300 |
5565 $('#wb_ph').jqxNumberInput(Show1wat); |
5567 }); |
5566 // Water target profile |
5568 $("#pr_name").on('select', function (event) { |
5567 $('#pr_name').jqxDropDownList({ |
5569 if (event.args) { |
5568 placeHolder: 'Kies doel profiel:', |
5570 var datarecord, index = event.args.index; |
5569 theme: theme, |
5571 datarecord = waterprofiles.records[index]; |
5570 source: waterprofiles, |
5572 $("#pr_calcium").val(datarecord.calcium); |
5571 displayMember: 'name', |
5573 $("#pr_sulfate").val(datarecord.sulfate); |
5572 width: 250, |
5574 $("#pr_chloride").val(datarecord.chloride); |
5573 height: 27, |
5575 $("#pr_sodium").val(datarecord.sodium); |
5574 dropDownWidth: 400, |
5576 $("#pr_magnesium").val(datarecord.magnesium); |
5575 dropDownHeight: 300 |
5577 $("#pr_total_alkalinity").val(datarecord.total_alkalinity); |
5576 }); |
5578 } |
5577 $('#pr_name').on('select', function(event) { |
5579 }); |
5578 if (event.args) { |
5580 $("#pr_calcium").jqxNumberInput( Show1wat ); |
5579 var datarecord, index = event.args.index; |
5581 $("#pr_magnesium").jqxNumberInput( Show1wat ); |
5580 datarecord = waterprofiles.records[index]; |
5582 $("#pr_sodium").jqxNumberInput( Show1wat ); |
5581 $('#pr_calcium').val(datarecord.calcium); |
5583 $("#pr_total_alkalinity").jqxNumberInput( Show1wat ); |
5582 $('#pr_sulfate').val(datarecord.sulfate); |
5584 $("#pr_chloride").jqxNumberInput( Show1wat ); |
5583 $('#pr_chloride').val(datarecord.chloride); |
5585 $("#pr_sulfate").jqxNumberInput( Show1wat ); |
5584 $('#pr_sodium').val(datarecord.sodium); |
5586 |
5585 $('#pr_magnesium').val(datarecord.magnesium); |
5587 // Water agents |
5586 $('#pr_total_alkalinity').val(datarecord.total_alkalinity); |
5588 $("#wa_cacl2").jqxTooltip({ content: 'Voor het maken van een ander waterprofiel. Voegt calcium en chloride toe. Voor het verbeteren van zoetere bieren.' }); |
5587 } |
5589 $("#wa_cacl2").jqxNumberInput( Spin1dec ); |
5588 }); |
5590 $("#wa_caso4").jqxTooltip({ content: 'Gips. Voor het maken van een ander waterprofiel. Voegt calcium en sulfaat toe. Voor het verbeteren van bittere bieren.' }); |
5589 $('#pr_calcium').jqxNumberInput(Show1wat); |
5591 $("#wa_caso4").jqxNumberInput( Spin1dec ); |
5590 $('#pr_magnesium').jqxNumberInput(Show1wat); |
5592 $("#wa_mgso4").jqxTooltip({ content: 'Epsom zout. Voor het maken van een ander waterprofiel. Voegt magnesium en sulfaat toe. Gebruik spaarzaam!' }); |
5591 $('#pr_sodium').jqxNumberInput(Show1wat); |
5593 $("#wa_mgso4").jqxNumberInput( Spin1dec ); |
5592 $('#pr_total_alkalinity').jqxNumberInput(Show1wat); |
5594 $("#wa_nacl").jqxTooltip({ content: 'Keukenzout. Voor het maken van een ander waterprofiel. Voegt natrium en chloride toe. Voor het accentueren van zoetheid. Bij hoge dosering wordt het bier ziltig.' }); |
5593 $('#pr_chloride').jqxNumberInput(Show1wat); |
5595 $("#wa_nacl").jqxNumberInput( Spin1dec ); |
5594 $('#pr_sulfate').jqxNumberInput(Show1wat); |
5596 $("#mash_ph").jqxTooltip({ content: 'Maisch pH tussen 5.2 en 5.6. Gebruik 5.2 voor lichte en 5.5 voor donkere bieren.'}); |
5595 |
5597 $("#mash_ph").jqxNumberInput( SpinpH ); |
5596 // Water agents |
5598 $("#calc_acid").jqxCheckBox({ theme: theme, width: 120, height: 23 }); |
5597 $('#wa_cacl2').jqxTooltip({ content: 'Voor het maken van een ander waterprofiel. Voegt calcium en chloride toe. Voor het verbeteren van zoetere bieren.' }); |
5599 $("#wa_base_name").jqxDropDownList({ |
5598 $('#wa_cacl2').jqxNumberInput(Spin1dec); |
5600 theme: theme, |
5599 $('#wa_caso4').jqxTooltip({ |
5601 source: BaseTypeAdapter, |
5600 content: 'Gips. Voor het maken van een ander waterprofiel. Voegt calcium en sulfaat toe. Voor het verbeteren van bittere bieren.' |
5602 valueMember: 'id', |
5601 }); |
5603 displayMember: 'nl', |
5602 $('#wa_caso4').jqxNumberInput(Spin1dec); |
5604 width: 170, |
5603 $('#wa_mgso4').jqxTooltip({ content: 'Epsom zout. Voor het maken van een ander waterprofiel. Voegt magnesium en sulfaat toe. Gebruik spaarzaam!' }); |
5605 height: 23, |
5604 $('#wa_mgso4').jqxNumberInput(Spin1dec); |
5606 autoDropDownHeight: true |
5605 $('#wa_nacl').jqxTooltip({ |
5607 }); |
5606 content: 'Keukenzout. Voor het maken van een ander waterprofiel. Voegt natrium en chloride toe. ' + |
5608 $("#wa_base").jqxNumberInput( Spin2dec ); |
5607 'Voor het accentueren van zoetheid. Bij hoge dosering wordt het bier ziltig.' |
5609 $("#wa_base").jqxNumberInput({ symbol: ' gr', symbolPosition: 'right' }); |
5608 }); |
5610 $("#wa_acid_name").jqxDropDownList({ |
5609 $('#wa_nacl').jqxNumberInput(Spin1dec); |
5611 theme: theme, |
5610 $('#mash_ph').jqxTooltip({ content: 'Maisch pH tussen 5.2 en 5.6. Gebruik 5.2 voor lichte en 5.5 voor donkere bieren.'}); |
5612 source: AcidTypeAdapter, |
5611 $('#mash_ph').jqxNumberInput(SpinpH); |
5613 valueMember: 'id', |
5612 $('#calc_acid').jqxCheckBox({ theme: theme, width: 120, height: 23 }); |
5614 displayMember: 'nl', |
5613 $('#wa_base_name').jqxDropDownList({ |
5615 width: 170, |
5614 theme: theme, |
5616 height: 23, |
5615 source: BaseTypeAdapter, |
5617 autoDropDownHeight: true |
5616 valueMember: 'id', |
5618 }) |
5617 displayMember: 'nl', |
5619 $("#wa_acid").jqxNumberInput( Spin2dec ); |
5618 width: 170, |
5620 $("#wa_acid").jqxNumberInput({ symbol: ' ml', symbolPosition: 'right' }); |
5619 height: 23, |
5621 $("#wa_acid_perc").jqxNumberInput( Perc0 ); |
5620 autoDropDownHeight: true |
5622 $("#wa_acid_perc").jqxNumberInput({ width: 70, symbol: '%', symbolPosition: 'right' }); |
5621 }); |
5623 // Sparge water |
5622 $('#wa_base').jqxNumberInput(Spin2dec); |
5624 $("#sparge_temp").jqxNumberInput( Spin1dec ); |
5623 $('#wa_base').jqxNumberInput({ symbol: ' gr', symbolPosition: 'right' }); |
5625 $("#sparge_volume").jqxNumberInput( Spin1dec ); |
5624 $('#wa_acid_name').jqxDropDownList({ |
5626 $("#sparge_ph").jqxNumberInput( SpinpH ); |
5625 theme: theme, |
5627 $("#sparge_source").jqxDropDownList({ |
5626 source: AcidTypeAdapter, |
5628 theme: theme, |
5627 valueMember: 'id', |
5629 source: SpargeSourceAdapter, |
5628 displayMember: 'nl', |
5630 valueMember: 'id', |
5629 width: 170, |
5631 displayMember: 'nl', |
5630 height: 23, |
5632 width: 110, |
5631 autoDropDownHeight: true |
5633 height: 23, |
5632 }); |
5634 autoDropDownHeight: true |
5633 $('#wa_acid').jqxNumberInput(Spin2dec); |
5635 }); |
5634 $('#wa_acid').jqxNumberInput({ symbol: ' ml', symbolPosition: 'right' }); |
5636 $("#sparge_acid_amount").jqxNumberInput( Spin2dec ); |
5635 $('#wa_acid_perc').jqxNumberInput(Perc0); |
5637 $("#sparge_acid_amount").jqxNumberInput({ spinButtons: false, readOnly: true, symbol: ' ml', symbolPosition: 'right' }); |
5636 $('#wa_acid_perc').jqxNumberInput({ width: 70, symbol: '%', symbolPosition: 'right' }); |
5638 $("#sparge_acid_type").jqxDropDownList({ |
5637 // Sparge water |
5639 theme: theme, |
5638 $('#sparge_temp').jqxNumberInput(Spin1dec); |
5640 source: AcidTypeAdapter, |
5639 $('#sparge_volume').jqxNumberInput(Spin1dec); |
5641 valueMember: 'id', |
5640 $('#sparge_ph').jqxNumberInput(SpinpH); |
5642 displayMember: 'nl', |
5641 $('#sparge_source').jqxDropDownList({ |
5643 width: 110, |
5642 theme: theme, |
5644 height: 23, |
5643 source: SpargeSourceAdapter, |
5645 autoDropDownHeight: true |
5644 valueMember: 'id', |
5646 }); |
5645 displayMember: 'nl', |
5647 $("#sparge_acid_perc").jqxNumberInput( Perc0 ); |
5646 width: 110, |
5648 $("#sparge_acid_perc").jqxNumberInput({ symbol: '%', symbolPosition: 'right' }); |
5647 height: 23, |
5649 |
5648 autoDropDownHeight: true |
5650 // Tab 9, Brewday |
5649 }); |
5651 $("#brew_date_start").jqxTooltip({ content: 'Brouw datum en tijd. Voor planning laat de tijd op 00:00:00 staan.' }); |
5650 $('#sparge_acid_amount').jqxNumberInput(Spin2dec); |
5652 $("#brew_date_start").jqxDateTimeInput( DateTimeopts ); |
5651 $('#sparge_acid_amount').jqxNumberInput({ spinButtons: false, readOnly: true, symbol: ' ml', symbolPosition: 'right' }); |
5653 $('#brew_date_start').on('close', function (event) { calcStage(); }); |
5652 $('#sparge_acid_type').jqxDropDownList({ |
5654 $("#brew_date_end").jqxTooltip({ content: 'End datum en tijd van de brouw. Leeg laten als er nog niet gebrouwen is.' }); |
5653 theme: theme, |
5655 $("#brew_date_end").jqxDateTimeInput( DateTimeopts ); |
5654 source: AcidTypeAdapter, |
5656 $('#brew_date_end').on('close', function (event) { calcStage(); }); |
5655 valueMember: 'id', |
5657 $("#brew_mash_ph").jqxTooltip({ content: 'De gemeten pH tijdens het maischen eventueel na correctie.' }); |
5656 displayMember: 'nl', |
5658 $("#brew_mash_ph").jqxNumberInput( SpinpH ); |
5657 width: 110, |
5659 $("#est_mash_ph").jqxTooltip({ content: 'De gewenste pH tijdens het maischen.' }); |
5658 height: 23, |
5660 $("#est_mash_ph").jqxNumberInput( Show1wat ); |
5659 autoDropDownHeight: true |
5661 $("#brew_preboil_ph").jqxTooltip({ content: 'De gemeten pH in de kookketel na het spoelen en voor de kook.' }); |
5660 }); |
5662 $("#brew_preboil_ph").jqxNumberInput( SpinpH ); |
5661 $('#sparge_acid_perc').jqxNumberInput(Perc0); |
5663 // est_preboil_ph |
5662 $('#sparge_acid_perc').jqxNumberInput({ symbol: '%', symbolPosition: 'right' }); |
5664 $("#brew_aboil_ph").jqxTooltip({ content: 'De gemeten pH na het koken.' }); |
5663 |
5665 $("#brew_aboil_ph").jqxNumberInput( SpinpH ); |
5664 // Tab 9, Brewday |
5666 // est_aboil_ph |
5665 $('#brew_date_start').jqxTooltip({ content: 'Brouw datum en tijd. Voor planning laat de tijd op 00:00:00 staan.' }); |
5667 $("#brew_mash_sg").jqxTooltip({ content: 'Het bereikte SG na het maischen.' }); |
5666 $('#brew_date_start').jqxDateTimeInput(DateTimeopts); |
5668 $("#brew_mash_sg").jqxNumberInput( SGopts ); |
5667 $('#brew_date_start').on('close', function(event) { calcStage(); }); |
5669 $("#brew_mash_sg").on('valueChanged', function () { calcMashEfficiency(); }); |
5668 $('#brew_date_end').jqxTooltip({ content: 'End datum en tijd van de brouw. Leeg laten als er nog niet gebrouwen is.' }); |
5670 $("#est_mash_sg").jqxTooltip({ content: 'Het berekende verwachte SG na het maischen.' }); |
5669 $('#brew_date_end').jqxDateTimeInput(DateTimeopts); |
5671 $("#est_mash_sg").jqxNumberInput( Show3wat ); |
5670 $('#brew_date_end').on('close', function(event) { calcStage(); }); |
5672 $("#brew_preboil_sg").jqxTooltip({ content: 'Het gemeten SG in de kookketel na het spoelen en voor het koken.' }); |
5671 $('#brew_mash_ph').jqxTooltip({ content: 'De gemeten pH tijdens het maischen eventueel na correctie.' }); |
5673 $("#brew_preboil_sg").jqxNumberInput( SGopts ); |
5672 $('#brew_mash_ph').jqxNumberInput(SpinpH); |
5674 $("#brew_preboil_sg").on('valueChanged', function (event) { |
5673 $('#est_mash_ph').jqxTooltip({ content: 'De gewenste pH tijdens het maischen.' }); |
5675 dataRecord.brew_preboil_sg = event.args.value; |
5674 $('#est_mash_ph').jqxNumberInput(Show1wat); |
5676 calcEfficiencyBeforeBoil(); |
5675 $('#brew_preboil_ph').jqxTooltip({ content: 'De gemeten pH in de kookketel na het spoelen en voor de kook.' }); |
5677 }); |
5676 $('#brew_preboil_ph').jqxNumberInput(SpinpH); |
5678 $("#est_pre_sg").jqxTooltip({ content: 'Het berekende SG in de kookketel na het spoelen en voor het koken.' }); |
5677 // est_preboil_ph |
5679 $("#est_pre_sg").jqxNumberInput( Show3wat ); |
5678 $('#brew_aboil_ph').jqxTooltip({ content: 'De gemeten pH na het koken.' }); |
5680 $("#brew_aboil_sg").jqxTooltip({ content: 'Het gemeten SG in de kookketel na het koken.' }); |
5679 $('#brew_aboil_ph').jqxNumberInput(SpinpH); |
5681 $("#brew_aboil_sg").jqxNumberInput( SGopts ); |
5680 // est_aboil_ph |
5682 $("#brew_aboil_sg").on('valueChanged', function (event) { |
5681 $('#brew_mash_sg').jqxTooltip({ content: 'Het bereikte SG na het maischen.' }); |
5683 dataRecord.brew_aboil_sg = event.args.value; |
5682 $('#brew_mash_sg').jqxNumberInput(SGopts); |
5684 calcEfficiencyAfterBoil(); |
5683 $('#brew_mash_sg').on('valueChanged', function() { calcMashEfficiency(); }); |
5685 calcFermentables(); |
5684 $('#est_mash_sg').jqxTooltip({ content: 'Het berekende verwachte SG na het maischen.' }); |
5686 calcIBUs(); |
5685 $('#est_mash_sg').jqxNumberInput(Show3wat); |
5687 }); |
5686 $('#brew_preboil_sg').jqxTooltip({ content: 'Het gemeten SG in de kookketel na het spoelen en voor het koken.' }); |
5688 $("#est_og3").jqxTooltip({ content: 'Het gewenste SG in de kookketel na het koken.' }); |
5687 $('#brew_preboil_sg').jqxNumberInput(SGopts); |
5689 $("#est_og3").jqxNumberInput( Show3wat ); |
5688 $('#brew_preboil_sg').on('valueChanged', function(event) { |
5690 $("#brew_mash_efficiency").jqxTooltip({ content: 'Het behaalde maisch rendement.' }); |
5689 dataRecord.brew_preboil_sg = event.args.value; |
5691 $("#brew_mash_efficiency").jqxNumberInput( Show1dec ); |
5690 calcEfficiencyBeforeBoil(); |
5692 $("#brew_preboil_volume").jqxTooltip({ content: 'Het gemeten volume van het wort voor het koken.' }); |
5691 }); |
5693 $("#brew_preboil_volume").jqxNumberInput( Spin1dec ); |
5692 $('#est_pre_sg').jqxTooltip({ content: 'Het berekende SG in de kookketel na het spoelen en voor het koken.' }); |
5694 $("#brew_preboil_volume").on('valueChanged', function (event) { |
5693 $('#est_pre_sg').jqxNumberInput(Show3wat); |
5695 dataRecord.brew_preboil_volume = event.args.value; |
5694 $('#brew_aboil_sg').jqxTooltip({ content: 'Het gemeten SG in de kookketel na het koken.' }); |
5696 calcEfficiencyBeforeBoil(); |
5695 $('#brew_aboil_sg').jqxNumberInput(SGopts); |
5697 }); |
5696 $('#brew_aboil_sg').on('valueChanged', function(event) { |
5698 $("#est_pre_vol").jqxTooltip({ content: 'Het berekende volume van het wort voor het koken.' }); |
5697 dataRecord.brew_aboil_sg = event.args.value; |
5699 $("#est_pre_vol").jqxNumberInput( Show1wat ); |
5698 calcEfficiencyAfterBoil(); |
5700 $("#brew_aboil_volume").jqxTooltip({ content: 'Het gemeten volume van het wort na het koken.' }); |
5699 calcFermentables(); |
5701 $("#brew_aboil_volume").jqxNumberInput( Spin1dec ); |
5700 calcIBUs(); |
5702 $("#brew_aboil_volume").on('valueChanged', function (event) { |
5701 }); |
5703 dataRecord.brew_aboil_volume = event.args.value; |
5702 $('#est_og3').jqxTooltip({ content: 'Het gewenste SG in de kookketel na het koken.' }); |
5704 calcEfficiencyAfterBoil(); |
5703 $('#est_og3').jqxNumberInput(Show3wat); |
5705 calcFermentables(); |
5704 $('#brew_mash_efficiency').jqxTooltip({ content: 'Het behaalde maisch rendement.' }); |
5706 calcIBUs(); |
5705 $('#brew_mash_efficiency').jqxNumberInput(Show1dec); |
5707 }); |
5706 $('#brew_preboil_volume').jqxTooltip({ content: 'Het gemeten volume van het wort voor het koken.' }); |
5708 $("#est_a_vol").jqxTooltip({ content: 'Het gewenste volume na het koken.' }); |
5707 $('#brew_preboil_volume').jqxNumberInput(Spin1dec); |
5709 $("#est_a_vol").jqxNumberInput( Show1wat ); |
5708 $('#brew_preboil_volume').on('valueChanged', function(event) { |
5710 $("#brew_preboil_efficiency").jqxTooltip({ content: 'Het berekende rendement voor het koken.' }); |
5709 dataRecord.brew_preboil_volume = event.args.value; |
5711 $("#brew_preboil_efficiency").jqxNumberInput( Show1dec ); |
5710 calcEfficiencyBeforeBoil(); |
5712 $("#brew_aboil_efficiency").jqxTooltip({ content: 'Het bereikte rendement na het koken.' }); |
5711 }); |
5713 $("#brew_aboil_efficiency").jqxNumberInput( Show1dec ); |
5712 $('#est_pre_vol').jqxTooltip({ content: 'Het berekende volume van het wort voor het koken.' }); |
5714 $("#brew_sparge_temperature").jqxTooltip({ content: 'De spoelwater temperatuur, in te stellen in de Water tab.' }); |
5713 $('#est_pre_vol').jqxNumberInput(Show1wat); |
5715 $("#brew_sparge_temperature").jqxNumberInput( Show1dec ); |
5714 $('#brew_aboil_volume').jqxTooltip({ content: 'Het gemeten volume van het wort na het koken.' }); |
5716 $("#brew_sparge_volume").jqxTooltip({ content: 'Het spoelwater voorraad volume, in te stellen in de Water tab.' }); |
5715 $('#brew_aboil_volume').jqxNumberInput(Spin1dec); |
5717 $("#brew_sparge_volume").jqxNumberInput( Show1dec ); |
5716 $('#brew_aboil_volume').on('valueChanged', function(event) { |
5718 $("#brew_sparge_est").jqxNumberInput( Show1dec ); |
5717 dataRecord.brew_aboil_volume = event.args.value; |
5719 $("#brew_whirlpool9").jqxNumberInput( PosInt ); |
5718 calcEfficiencyAfterBoil(); |
5720 $("#brew_whirlpool9").jqxNumberInput({ max: 120 }); |
5719 calcFermentables(); |
5721 $("#brew_cooling_to").jqxNumberInput( Spin1dec ); |
5720 calcIBUs(); |
5722 $("#brew_sparge_ph").jqxNumberInput( SpinpH ); |
5721 }); |
5723 $("#brew_whirlpool7").jqxNumberInput( PosInt ); |
5722 $('#est_a_vol').jqxTooltip({ content: 'Het gewenste volume na het koken.' }); |
5724 $("#brew_whirlpool7").jqxNumberInput({ max: 120 }); |
5723 $('#est_a_vol').jqxNumberInput(Show1wat); |
5725 $("#brew_cooling_method").jqxDropDownList({ |
5724 $('#brew_preboil_efficiency').jqxTooltip({ content: 'Het berekende rendement voor het koken.' }); |
5726 theme: theme, |
5725 $('#brew_preboil_efficiency').jqxNumberInput(Show1dec); |
5727 source: CoolingTypeAdapter, |
5726 $('#brew_aboil_efficiency').jqxTooltip({ content: 'Het bereikte rendement na het koken.' }); |
5728 valueMember: 'id', |
5727 $('#brew_aboil_efficiency').jqxNumberInput(Show1dec); |
5729 displayMember: 'nl', |
5728 $('#brew_sparge_temperature').jqxTooltip({ content: 'De spoelwater temperatuur, in te stellen in de Water tab.' }); |
5730 width: 180, |
5729 $('#brew_sparge_temperature').jqxNumberInput(Show1dec); |
5731 height: 23, |
5730 $('#brew_sparge_volume').jqxTooltip({ content: 'Het spoelwater voorraad volume, in te stellen in de Water tab.' }); |
5732 autoDropDownHeight: true |
5731 $('#brew_sparge_volume').jqxNumberInput(Show1dec); |
5733 }); |
5732 $('#brew_sparge_est').jqxNumberInput(Show1dec); |
5734 $("#brew_whirlpool6").jqxNumberInput( PosInt ); |
5733 $('#brew_whirlpool9').jqxNumberInput(PosInt); |
5735 $("#brew_whirlpool6").jqxNumberInput({ max: 120 }); |
5734 $('#brew_whirlpool9').jqxNumberInput({ max: 120 }); |
5736 $("#brew_cooling_time").jqxNumberInput( PosInt ); |
5735 $('#brew_cooling_to').jqxNumberInput(Spin1dec); |
5737 $("#brew_cooling_time").jqxNumberInput({ max: 1440 }); |
5736 $('#brew_sparge_ph').jqxNumberInput(SpinpH); |
5738 $("#brew_whirlpool2").jqxNumberInput( PosInt ); |
5737 $('#brew_whirlpool7').jqxNumberInput(PosInt); |
5739 $("#brew_whirlpool2").jqxNumberInput({ max: 120 }); |
5738 $('#brew_whirlpool7').jqxNumberInput({ max: 120 }); |
5740 $("#brew_aeration_type").jqxDropDownList({ |
5739 $('#brew_cooling_method').jqxDropDownList({ |
5741 theme: theme, |
5740 theme: theme, |
5742 source: AerationTypeAdapter, |
5741 source: CoolingTypeAdapter, |
5743 valueMember: 'id', |
5742 valueMember: 'id', |
5744 displayMember: 'nl', |
5743 displayMember: 'nl', |
5745 width: 180, |
5744 width: 180, |
5746 height: 23, |
5745 height: 23, |
5747 autoDropDownHeight: true |
5746 autoDropDownHeight: true |
5748 }); |
5747 }); |
5749 $("#brew_aeration_time").jqxNumberInput( PosInt ); |
5748 $('#brew_whirlpool6').jqxNumberInput(PosInt); |
5750 $("#brew_aeration_time").jqxNumberInput({ max: 1440 }); |
5749 $('#brew_whirlpool6').jqxNumberInput({ max: 120 }); |
5751 $("#brew_aeration_speed").jqxNumberInput( PosInt ); |
5750 $('#brew_cooling_time').jqxNumberInput(PosInt); |
5752 $("#brew_aeration_speed").jqxNumberInput({ max: 1440 }); |
5751 $('#brew_cooling_time').jqxNumberInput({ max: 1440 }); |
5753 $("#brew_fermenter_volume").jqxNumberInput( Show1dec ); |
5752 $('#brew_whirlpool2').jqxNumberInput(PosInt); |
5754 $("#brew_fermenter_extrawater").jqxNumberInput( Spin1dec ); |
5753 $('#brew_whirlpool2').jqxNumberInput({ max: 120 }); |
5755 $("#brew_fermenter_sg").jqxNumberInput( Show3dec ); |
5754 $('#brew_aeration_type').jqxDropDownList({ |
5756 $("#brew_fermenter_tcloss").jqxNumberInput( Spin1dec ); |
5755 theme: theme, |
5757 $("#brew_fermenter_ibu").jqxNumberInput( Show0dec ); |
5756 source: AerationTypeAdapter, |
5758 $("#brew_fermenter_color").jqxNumberInput( Show0dec ); |
5757 valueMember: 'id', |
5759 $("#BLog").jqxButton({ template: "info", width: '150px', theme: theme }); |
5758 displayMember: 'nl', |
5760 $("#BLog").click(function () { |
5759 width: 180, |
5761 // Open log in a new tab. |
5760 height: 23, |
5762 window.open("log_brew.php?code=" + dataRecord.code + "&name=" + dataRecord.name); |
5761 autoDropDownHeight: true |
5763 }); |
5762 }); |
5764 |
5763 $('#brew_aeration_time').jqxNumberInput(PosInt); |
5765 // Tab 10, Fermentation |
5764 $('#brew_aeration_time').jqxNumberInput({ max: 1440 }); |
5766 // Note, fermentation temps changes must do calcCarbonation() |
5765 $('#brew_aeration_speed').jqxNumberInput(PosInt); |
5767 $("#brew_fermenter_sg2").jqxTooltip({ content: 'Het behaalde SG in het gistvat, overgenomen van de brouwdag.' }); |
5766 $('#brew_aeration_speed').jqxNumberInput({ max: 1440 }); |
5768 $("#brew_fermenter_sg2").jqxNumberInput( Show3dec ); |
5767 $('#brew_fermenter_volume').jqxNumberInput(Show1dec); |
5769 $("#primary_start_temp").jqxTooltip({ content: 'De begintemperatuur van de hoofdvergisting.' }); |
5768 $('#brew_fermenter_extrawater').jqxNumberInput(Spin1dec); |
5770 $("#primary_start_temp").jqxNumberInput( YeastT ); |
5769 $('#brew_fermenter_sg').jqxNumberInput(Show3dec); |
5771 $("#primary_max_temp").jqxTooltip({ content: 'De hoogst bereikte piek temperatuur tijdens de hoofgvergisting.' }); |
5770 $('#brew_fermenter_tcloss').jqxNumberInput(Spin1dec); |
5772 $("#primary_max_temp").jqxNumberInput( YeastT ); |
5771 $('#brew_fermenter_ibu').jqxNumberInput(Show0dec); |
5773 $("#primary_end_temp").jqxTooltip({ content: 'De eind temperatuur van de hoofdvergisting.' }); |
5772 $('#brew_fermenter_color').jqxNumberInput(Show0dec); |
5774 $("#primary_end_temp").jqxNumberInput( YeastT ); |
5773 $('#BLog').jqxButton({ template: 'info', width: '150px', theme: theme }); |
5775 $("#primary_end_sg").jqxTooltip({ content: 'Het gemeten SG aan het eind van de hoofdvergisting.' }); |
5774 $('#BLog').click(function() { |
5776 $("#primary_end_sg").jqxNumberInput( SGopts ); |
5775 // Open log in a new tab. |
5777 $("#primary_end_brix").jqxTooltip({ content: 'Hulpfinctie: de afgelezen °Brix RI waarde met een refractometer.' }); |
5776 window.open('log_brew.php?code=' + dataRecord.code + '&name=' + dataRecord.name); |
5778 $("#primary_end_brix").jqxNumberInput( Spin1dec ); |
5777 }); |
5779 $("#primary_svg").jqxTooltip({ content: 'De schijnbare vergisting graad behaald na de hoofdgisting.' }); |
5778 |
5780 $("#primary_svg").jqxNumberInput( Show1dec ); |
5779 // Tab 10, Fermentation |
5781 $("#primary_end_date").jqxTooltip({ content: 'De eind datum van de hoofdvergisting en eventueel overhevelen.' }); |
5780 // Note, fermentation temps changes must do calcCarbonation() |
5782 $("#primary_end_date").jqxDateTimeInput( Dateopts ); |
5781 $('#brew_fermenter_sg2').jqxTooltip({ content: 'Het behaalde SG in het gistvat, overgenomen van de brouwdag.' }); |
5783 $('#primary_end_date').on('close', function (event) { calcStage(); }); |
5782 $('#brew_fermenter_sg2').jqxNumberInput(Show3dec); |
5784 $("#secondary_temp").jqxNumberInput( YeastT ); |
5783 $('#primary_start_temp').jqxTooltip({ content: 'De begintemperatuur van de hoofdvergisting.' }); |
5785 $("#secondary_end_sg").jqxTooltip({ content: 'Het gemeten SG aan het eind van de navergisting.' }); |
5784 $('#primary_start_temp').jqxNumberInput(YeastT); |
5786 $("#secondary_end_sg").jqxNumberInput( SGopts ); |
5785 $('#primary_max_temp').jqxTooltip({ content: 'De hoogst bereikte piek temperatuur tijdens de hoofgvergisting.' }); |
5787 $("#secondary_end_brix").jqxTooltip({ content: 'Hulpfinctie: de afgelezen °Brix RI waarde met een refractometer.' }); |
5786 $('#primary_max_temp').jqxNumberInput(YeastT); |
5788 $("#secondary_end_brix").jqxNumberInput( Spin1dec ); |
5787 $('#primary_end_temp').jqxTooltip({ content: 'De eind temperatuur van de hoofdvergisting.' }); |
5789 $("#secondary_svg").jqxTooltip({ content: 'De schijnbare vergisting graad behaald na de nagisting.' }); |
5788 $('#primary_end_temp').jqxNumberInput(YeastT); |
5790 $("#secondary_svg").jqxNumberInput( Show1dec ); |
5789 $('#primary_end_sg').jqxTooltip({ content: 'Het gemeten SG aan het eind van de hoofdvergisting.' }); |
5791 $("#secondary_end_date").jqxTooltip({ content: 'De eind datum van de navergisting en het begin van het lageren.' }); |
5790 $('#primary_end_sg').jqxNumberInput(SGopts); |
5792 $("#secondary_end_date").jqxDateTimeInput( Dateopts ); |
5791 $('#primary_end_brix').jqxTooltip({ content: 'Hulpfinctie: de afgelezen °Brix RI waarde met een refractometer.' }); |
5793 $('#secondary_end_date').on('close', function (event) { calcStage(); }); |
5792 $('#primary_end_brix').jqxNumberInput(Spin1dec); |
5794 $("#tertiary_temp").jqxNumberInput( YeastT ); |
5793 $('#primary_svg').jqxTooltip({ content: 'De schijnbare vergisting graad behaald na de hoofdgisting.' }); |
5795 $("#fg").jqxNumberInput( Spin3dec ); |
5794 $('#primary_svg').jqxNumberInput(Show1dec); |
5796 $("#est_fg3").jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' }); |
5795 $('#primary_end_date').jqxTooltip({ content: 'De eind datum van de hoofdvergisting en eventueel overhevelen.' }); |
5797 $("#est_fg3").jqxNumberInput( Show3dec ); |
5796 $('#primary_end_date').jqxDateTimeInput(Dateopts); |
5798 $("#final_brix").jqxTooltip({ content: 'Hulpfinctie: de afgelezen °Brix RI waarde met een refractometer.' }); |
5797 $('#primary_end_date').on('close', function(event) { calcStage(); }); |
5799 $("#final_brix").jqxNumberInput( Spin1dec ); |
5798 $('#secondary_temp').jqxNumberInput(YeastT); |
5800 $("#final_abv").jqxNumberInput( Show2dec ); |
5799 $('#secondary_end_sg').jqxTooltip({ content: 'Het gemeten SG aan het eind van de navergisting.' }); |
5801 $("#final_svg").jqxNumberInput( Show1dec ); |
5800 $('#secondary_end_sg').jqxNumberInput(SGopts); |
5802 $("#FLog").jqxButton({ template: "info", width: '150px', theme: theme }); |
5801 $('#secondary_end_brix').jqxTooltip({ content: 'Hulpfinctie: de afgelezen °Brix RI waarde met een refractometer.' }); |
5803 $("#FLog").click(function () { |
5802 $('#secondary_end_brix').jqxNumberInput(Spin1dec); |
5804 // Open log in a new tab. |
5803 $('#secondary_svg').jqxTooltip({ content: 'De schijnbare vergisting graad behaald na de nagisting.' }); |
5805 var url="log_fermentation.php?code=" + dataRecord.code + "&name=" + dataRecord.name; |
5804 $('#secondary_svg').jqxNumberInput(Show1dec); |
5806 window.open(url); |
5805 $('#secondary_end_date').jqxTooltip({ content: 'De eind datum van de navergisting en het begin van het lageren.' }); |
5807 }); |
5806 $('#secondary_end_date').jqxDateTimeInput(Dateopts); |
5808 |
5807 $('#secondary_end_date').on('close', function(event) { calcStage(); }); |
5809 // Tab 11, Packaging |
5808 $('#tertiary_temp').jqxNumberInput(YeastT); |
5810 // TODO: high gravity packaging, extra water and recalc abv, color and ibu. |
5809 $('#fg').jqxNumberInput(Spin3dec); |
5811 $("#package_date").jqxTooltip({ content: 'De verpakkings datum van dit bier.' }); |
5810 $('#est_fg3').jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' }); |
5812 $("#package_date").jqxDateTimeInput( Dateopts ); |
5811 $('#est_fg3').jqxNumberInput(Show3dec); |
5813 $('#package_date').on('close', function (event) { calcStage(); }); |
5812 $('#final_brix').jqxTooltip({ content: 'Hulpfinctie: de afgelezen °Brix RI waarde met een refractometer.' }); |
5814 $('#package_volume').jqxTooltip({ content: 'Het beschikbare volume om te bottelen of op fust te zetten.' }); |
5813 $('#final_brix').jqxNumberInput(Spin1dec); |
5815 $('#package_volume').jqxNumberInput( Spin1dec ); |
5814 $('#final_abv').jqxNumberInput(Show2dec); |
5816 $('#package_infuse_amount').jqxTooltip({ content: 'De hoeveelheid water of drank extra toe te voegen.' }); |
5815 $('#final_svg').jqxNumberInput(Show1dec); |
5817 $('#package_infuse_amount').jqxNumberInput( Spin3dec ); |
5816 $('#FLog').jqxButton({ template: 'info', width: '150px', theme: theme }); |
5818 $('#package_infuse_abv').jqxTooltip({ content: 'De hoeveelheid alcohol in de drank, of 0.0 als het water is.' }); |
5817 $('#FLog').click(function() { |
5819 $('#package_infuse_abv').jqxNumberInput( Spin1dec ); |
5818 // Open log in a new tab. |
5820 $('#package_infuse_notes').jqxTooltip({ content: 'Omschrijving van de extra toevoeging.' }); |
5819 window.open('log_fermentation.php?code=' + dataRecord.code + '&name=' + dataRecord.name); |
5821 $('#package_infuse_notes').jqxInput({ theme: theme, width: 640, height: 23 }); |
5820 }); |
5822 $('#package_abv').jqxTooltip({ content: 'De uiteindelijke hoeveelheid alcohol volume %.' }); |
5821 |
5823 $('#package_abv').jqxNumberInput( Show2dec ); |
5822 // Tab 11, Packaging |
5824 $('#package_ph').jqxTooltip({ content: 'De gemeten pH vlak voor het verpakken.' }); |
5823 // TODO: high gravity packaging, extra water and recalc abv, color and ibu. |
5825 $('#package_ph').jqxNumberInput( SpinpH ); |
5824 $('#package_date').jqxTooltip({ content: 'De verpakkings datum van dit bier.' }); |
5826 $("#st_carb_min2").jqxTooltip({ content: 'Het minimum aanbevolen koolzuur volume voor deze bierstijl.'}); |
5825 $('#package_date').jqxDateTimeInput(Dateopts); |
5827 $("#st_carb_min2").jqxNumberInput(Smal1dec); |
5826 $('#package_date').on('close', function(event) { calcStage(); }); |
5828 $("#st_carb_max2").jqxTooltip({ content: 'Het maximum aamnevolen koolzuur volume voor deze bierstijl.'}); |
5827 $('#package_volume').jqxTooltip({ content: 'Het beschikbare volume om te bottelen of op fust te zetten.' }); |
5829 $("#st_carb_max2").jqxNumberInput(Smal1dec); |
5828 $('#package_volume').jqxNumberInput(Spin1dec); |
5830 $("#bottle_amount").jqxTooltip({ content: 'De totale hoeveelheid te bottelen bier.' }); |
5829 $('#package_infuse_amount').jqxTooltip({ content: 'De hoeveelheid water of drank extra toe te voegen.' }); |
5831 $("#bottle_amount").jqxNumberInput( Spin1dec ); |
5830 $('#package_infuse_amount').jqxNumberInput(Spin3dec); |
5832 $("#keg_amount").jqxTooltip({ content: 'De totale hoeveelheid op fust te zetten bier.' }); |
5831 $('#package_infuse_abv').jqxTooltip({ content: 'De hoeveelheid alcohol in de drank, of 0.0 als het water is.' }); |
5833 $("#keg_amount").jqxNumberInput( Spin1dec ); |
5832 $('#package_infuse_abv').jqxNumberInput(Spin1dec); |
5834 $("#bottle_carbonation").jqxTooltip({ content: 'Het gewenste CO2 volume in de flessen.' }); |
5833 $('#package_infuse_notes').jqxTooltip({ content: 'Omschrijving van de extra toevoeging.' }); |
5835 $("#bottle_carbonation").jqxNumberInput( Spin2dec ); |
5834 $('#package_infuse_notes').jqxInput({ theme: theme, width: 640, height: 23 }); |
5836 $("#bottle_carbonation").jqxNumberInput({ max: 5 }); |
5835 $('#package_abv').jqxTooltip({ content: 'De uiteindelijke hoeveelheid alcohol volume %.' }); |
5837 $("#keg_carbonation").jqxTooltip({ content: 'Het gewenste CO2 volume door de suiker in de fusten.' }); |
5836 $('#package_abv').jqxNumberInput(Show2dec); |
5838 $("#keg_carbonation").jqxNumberInput( Spin2dec ); |
5837 $('#package_ph').jqxTooltip({ content: 'De gemeten pH vlak voor het verpakken.' }); |
5839 $("#keg_carbonation").jqxNumberInput({ max: 5 }); |
5838 $('#package_ph').jqxNumberInput(SpinpH); |
5840 $("#bottle_priming_sugar").jqxDropDownList({ |
5839 $('#st_carb_min2').jqxTooltip({ content: 'Het minimum aanbevolen koolzuur volume voor deze bierstijl.'}); |
5841 placeHolder: "Kies suiker:", |
5840 $('#st_carb_min2').jqxNumberInput(Smal1dec); |
5842 theme: theme, |
5841 $('#st_carb_max2').jqxTooltip({ content: 'Het maximum aamnevolen koolzuur volume voor deze bierstijl.'}); |
5843 source: fermentablesugars, |
5842 $('#st_carb_max2').jqxNumberInput(Smal1dec); |
5844 displayMember: 'name', |
5843 $('#bottle_amount').jqxTooltip({ content: 'De totale hoeveelheid te bottelen bier.' }); |
5845 width: 200, |
5844 $('#bottle_amount').jqxNumberInput(Spin1dec); |
5846 height: 23, |
5845 $('#keg_amount').jqxTooltip({ content: 'De totale hoeveelheid op fust te zetten bier.' }); |
5847 dropDownWidth: 300, |
5846 $('#keg_amount').jqxNumberInput(Spin1dec); |
5848 dropDownHeight: 400 |
5847 $('#bottle_carbonation').jqxTooltip({ content: 'Het gewenste CO2 volume in de flessen.' }); |
5849 }); |
5848 $('#bottle_carbonation').jqxNumberInput(Spin2dec); |
5850 $("#bottle_priming_sugar").on('select', function (event) { |
5849 $('#bottle_carbonation').jqxNumberInput({ max: 5 }); |
5851 if (event.args) { |
5850 $('#keg_carbonation').jqxTooltip({ content: 'Het gewenste CO2 volume door de suiker in de fusten.' }); |
5852 var rowID, index, editrow = -1, datarecord, rows, i, row = {}; |
5851 $('#keg_carbonation').jqxNumberInput(Spin2dec); |
5853 index = event.args.index; |
5852 $('#keg_carbonation').jqxNumberInput({ max: 5 }); |
5854 datarecord = fermentablesugars.records[index]; |
5853 $('#bottle_priming_sugar').jqxDropDownList({ |
5855 rows = $('#fermentableGrid').jqxGrid('getrows'); |
5854 placeHolder: 'Kies suiker:', |
5856 for (i = 0; i < rows.length; i++) { |
5855 theme: theme, |
5857 if (rows[i].f_added == 4) { |
5856 source: fermentablesugars, |
5858 editrow = i; |
5857 displayMember: 'name', |
5859 } |
5858 width: 200, |
5860 } |
5859 height: 23, |
5861 row["f_name"] = datarecord.name; |
5860 dropDownWidth: 300, |
5862 row["f_origin"] = datarecord.origin; |
5861 dropDownHeight: 400 |
5863 row["f_supplier"] = datarecord.supplier; |
5862 }); |
5864 row["f_amount"] = parseFloat($("#bottle_priming_total").jqxNumberInput('decimal')) / 1000; |
5863 $('#bottle_priming_sugar').on('select', function(event) { |
5865 row["f_cost"] = datarecord.cost; |
5864 if (event.args) { |
5866 row["f_type"] = datarecord.type; |
5865 var rowID, index, editrow = -1, datarecord, rows, i, row = {}; |
5867 row["f_yield"] = datarecord.yield; |
5866 index = event.args.index; |
5868 row["f_color"] = datarecord.color; |
5867 datarecord = fermentablesugars.records[index]; |
5869 row["f_coarse_fine_diff"] = datarecord.coarse_fine_diff; |
5868 rows = $('#fermentableGrid').jqxGrid('getrows'); |
5870 row["f_moisture"] = datarecord.moisture; |
5869 for (i = 0; i < rows.length; i++) { |
5871 row["f_diastatic_power"] = datarecord.diastatic_power; |
5870 if (rows[i].f_added == 4) { |
5872 row["f_protein"] = datarecord.protein; |
5871 editrow = i; |
5873 row["f_max_in_batch"] = datarecord.max_in_batch; |
5872 } |
5874 row["f_graintype"] = datarecord.graintype; |
5873 } |
5875 row["f_added"] = 4; |
5874 row['f_name'] = datarecord.name; |
5876 row["f_dissolved_protein"] = datarecord.dissolved_protein; |
5875 row['f_origin'] = datarecord.origin; |
5877 row["f_recommend_mash"] = datarecord.recommend_mash; |
5876 row['f_supplier'] = datarecord.supplier; |
5878 row["f_add_after_boil"] = 1; |
5877 row['f_amount'] = parseFloat($('#bottle_priming_total').jqxNumberInput('decimal')) / 1000; |
5879 row["f_adjust_to_total_100"] = 0; |
5878 row['f_cost'] = datarecord.cost; |
5880 row["f_percentage"] = 0; |
5879 row['f_type'] = datarecord.type; |
5881 row["f_di_ph"] = datarecord.di_ph; |
5880 row['f_yield'] = datarecord.yield; |
5882 row["f_acid_to_ph_57"] = datarecord.acid_to_ph_57; |
5881 row['f_color'] = datarecord.color; |
5883 row["f_inventory"] = datarecord.inventory; |
5882 row['f_coarse_fine_diff'] = datarecord.coarse_fine_diff; |
5884 if (editrow >= 0) { |
5883 row['f_moisture'] = datarecord.moisture; |
5885 rowID = $('#fermentableGrid').jqxGrid('getrowid', editrow); |
5884 row['f_diastatic_power'] = datarecord.diastatic_power; |
5886 $('#fermentableGrid').jqxGrid('updaterow', rowID, row); |
5885 row['f_protein'] = datarecord.protein; |
5887 } else { |
5886 row['f_max_in_batch'] = datarecord.max_in_batch; |
5888 $("#fermentableGrid").jqxGrid('addrow', null, row); |
5887 row['f_graintype'] = datarecord.graintype; |
5889 } |
5888 row['f_added'] = 4; |
5890 calcCarbonation(); |
5889 row['f_dissolved_protein'] = datarecord.dissolved_protein; |
5891 } |
5890 row['f_recommend_mash'] = datarecord.recommend_mash; |
5892 }); |
5891 row['f_add_after_boil'] = 1; |
5893 $("#keg_priming_sugar").jqxDropDownList({ |
5892 row['f_adjust_to_total_100'] = 0; |
5894 placeHolder: "Kies suiker:", |
5893 row['f_percentage'] = 0; |
5895 theme: theme, |
5894 row['f_di_ph'] = datarecord.di_ph; |
5896 source: fermentablesugars, |
5895 row['f_acid_to_ph_57'] = datarecord.acid_to_ph_57; |
5897 displayMember: 'name', |
5896 row['f_inventory'] = datarecord.inventory; |
5898 width: 200, |
5897 if (editrow >= 0) { |
5899 height: 23, |
5898 rowID = $('#fermentableGrid').jqxGrid('getrowid', editrow); |
5900 dropDownWidth: 300, |
5899 $('#fermentableGrid').jqxGrid('updaterow', rowID, row); |
5901 dropDownHeight: 400 |
5900 } else { |
5902 }); |
5901 $('#fermentableGrid').jqxGrid('addrow', null, row); |
5903 $("#keg_priming_sugar").on('select', function (event) { |
5902 } |
5904 if (event.args) { |
5903 calcCarbonation(); |
5905 var rowID, index, editrow = -1, datarecord, rows, i, row = {}; |
5904 } |
5906 index = event.args.index; |
5905 }); |
5907 datarecord = fermentablesugars.records[index]; |
5906 $('#keg_priming_sugar').jqxDropDownList({ |
5908 rows = $('#fermentableGrid').jqxGrid('getrows'); |
5907 placeHolder: 'Kies suiker:', |
5909 for (i = 0; i < rows.length; i++) { |
5908 theme: theme, |
5910 if (rows[i].f_added == 5) { |
5909 source: fermentablesugars, |
5911 editrow = i; |
5910 displayMember: 'name', |
5912 } |
5911 width: 200, |
5913 } |
5912 height: 23, |
5914 row["f_name"] = datarecord.name; |
5913 dropDownWidth: 300, |
5915 row["f_origin"] = datarecord.origin; |
5914 dropDownHeight: 400 |
5916 row["f_supplier"] = datarecord.supplier; |
5915 }); |
5917 row["f_amount"] = parseFloat($("#keg_priming_total").jqxNumberInput('decimal')) / 1000; |
5916 $('#keg_priming_sugar').on('select', function(event) { |
5918 row["f_cost"] = datarecord.cost; |
5917 if (event.args) { |
5919 row["f_type"] = datarecord.type; |
5918 var rowID, index, editrow = -1, datarecord, rows, i, row = {}; |
5920 row["f_yield"] = datarecord.yield; |
5919 index = event.args.index; |
5921 row["f_color"] = datarecord.color; |
5920 datarecord = fermentablesugars.records[index]; |
5922 row["f_coarse_fine_diff"] = datarecord.coarse_fine_diff; |
5921 rows = $('#fermentableGrid').jqxGrid('getrows'); |
5923 row["f_moisture"] = datarecord.moisture; |
5922 for (i = 0; i < rows.length; i++) { |
5924 row["f_diastatic_power"] = datarecord.diastatic_power; |
5923 if (rows[i].f_added == 5) { |
5925 row["f_protein"] = datarecord.protein; |
5924 editrow = i; |
5926 row["f_max_in_batch"] = datarecord.max_in_batch; |
5925 } |
5927 row["f_graintype"] = datarecord.graintype; |
5926 } |
5928 row["f_added"] = 5; |
5927 row['f_name'] = datarecord.name; |
5929 row["f_dissolved_protein"] = datarecord.dissolved_protein; |
5928 row['f_origin'] = datarecord.origin; |
5930 row["f_recommend_mash"] = datarecord.recommend_mash; |
5929 row['f_supplier'] = datarecord.supplier; |
5931 row["f_add_after_boil"] = 1; |
5930 row['f_amount'] = parseFloat($('#keg_priming_total').jqxNumberInput('decimal')) / 1000; |
5932 row["f_adjust_to_total_100"] = 0; |
5931 row['f_cost'] = datarecord.cost; |
5933 row["f_percentage"] = 0; |
5932 row['f_type'] = datarecord.type; |
5934 row["f_di_ph"] = datarecord.di_ph; |
5933 row['f_yield'] = datarecord.yield; |
5935 row["f_acid_to_ph_57"] = datarecord.acid_to_ph_57; |
5934 row['f_color'] = datarecord.color; |
5936 row["f_inventory"] = datarecord.inventory; |
5935 row['f_coarse_fine_diff'] = datarecord.coarse_fine_diff; |
5937 if (editrow >= 0) { |
5936 row['f_moisture'] = datarecord.moisture; |
5938 rowID = $('#fermentableGrid').jqxGrid('getrowid', editrow); |
5937 row['f_diastatic_power'] = datarecord.diastatic_power; |
5939 $('#fermentableGrid').jqxGrid('updaterow', rowID, row); |
5938 row['f_protein'] = datarecord.protein; |
5940 } else { |
5939 row['f_max_in_batch'] = datarecord.max_in_batch; |
5941 $("#fermentableGrid").jqxGrid('addrow', null, row); |
5940 row['f_graintype'] = datarecord.graintype; |
5942 } |
5941 row['f_added'] = 5; |
5943 calcCarbonation(); |
5942 row['f_dissolved_protein'] = datarecord.dissolved_protein; |
5944 } |
5943 row['f_recommend_mash'] = datarecord.recommend_mash; |
5945 }); |
5944 row['f_add_after_boil'] = 1; |
5946 $("#bottle_priming_amount").jqxNumberInput( Show1dec ); |
5945 row['f_adjust_to_total_100'] = 0; |
5947 $("#bottle_priming_water").jqxTooltip({ content: 'De hoeveelheid water om de suiker op te lossen.' }); |
5946 row['f_percentage'] = 0; |
5948 $("#bottle_priming_water").jqxNumberInput( Spin3dec ); |
5947 row['f_di_ph'] = datarecord.di_ph; |
5949 $("#keg_priming_amount").jqxNumberInput( Show1dec ); |
5948 row['f_acid_to_ph_57'] = datarecord.acid_to_ph_57; |
5950 $("#keg_priming_water").jqxTooltip({ content: 'De hoeveelheid water om de suiker op te lossen.' }); |
5949 row['f_inventory'] = datarecord.inventory; |
5951 $("#keg_priming_water").jqxNumberInput( Spin3dec ); |
5950 if (editrow >= 0) { |
5952 $("#bottle_priming_total").jqxNumberInput( Show1dec ); |
5951 rowID = $('#fermentableGrid').jqxGrid('getrowid', editrow); |
5953 $("#bottle_pressure").jqxTooltip({ content: 'De maximaal te verwachten druk tijdens het hergisten.' }); |
5952 $('#fermentableGrid').jqxGrid('updaterow', rowID, row); |
5954 $("#bottle_pressure").jqxNumberInput( Show1dec ); |
5953 } else { |
5955 $("#keg_priming_total").jqxNumberInput( Show1dec ); |
5954 $('#fermentableGrid').jqxGrid('addrow', null, row); |
5956 $("#keg_forced_carb").jqxCheckBox({ theme: theme, width: 120, height: 23 }); |
5955 } |
5957 $("#keg_pressure").jqxNumberInput( Show1dec ); |
5956 calcCarbonation(); |
5958 $("#bottle_abv").jqxNumberInput( Show2dec ); |
5957 } |
5959 $("#keg_abv").jqxNumberInput( Show2dec ); |
5958 }); |
5960 $("#bottle_carbonation_temp").jqxNumberInput( YeastT ); |
5959 $('#bottle_priming_amount').jqxNumberInput(Show1dec); |
5961 $("#keg_carbonation_temp").jqxNumberInput( YeastT ); |
5960 $('#bottle_priming_water').jqxTooltip({ content: 'De hoeveelheid water om de suiker op te lossen.' }); |
5962 |
5961 $('#bottle_priming_water').jqxNumberInput(Spin3dec); |
5963 // Tab 12, Tasting |
5962 $('#keg_priming_amount').jqxNumberInput(Show1dec); |
5964 $("#taste_date").jqxTooltip({ content: 'De proef datum van dit bier.' }); |
5963 $('#keg_priming_water').jqxTooltip({ content: 'De hoeveelheid water om de suiker op te lossen.' }); |
5965 $("#taste_date").jqxDateTimeInput( Dateopts ); |
5964 $('#keg_priming_water').jqxNumberInput(Spin3dec); |
5966 $('#taste_date').on('close', function (event) { calcStage(); }); |
5965 $('#bottle_priming_total').jqxNumberInput(Show1dec); |
5967 $("#taste_rate").jqxTooltip({ content: 'Het cijfer voor dit bier van 1 tot 10.' }); |
5966 $('#bottle_pressure').jqxTooltip({ content: 'De maximaal te verwachten druk tijdens het hergisten.' }); |
5968 $("#taste_rate").jqxNumberInput( Spin1dec ); |
5967 $('#bottle_pressure').jqxNumberInput(Show1dec); |
5969 $("#taste_rate").jqxNumberInput({ max: 10 }); |
5968 $('#keg_priming_total').jqxNumberInput(Show1dec); |
5970 $("#taste_color").jqxTooltip({ content: 'De kleur van het bier.' }); |
5969 $('#keg_forced_carb').jqxCheckBox({ theme: theme, width: 120, height: 23 }); |
5971 $("#taste_color").jqxInput({ theme: theme, width: 320, height: 23 }); |
5970 $('#keg_pressure').jqxNumberInput(Show1dec); |
5972 $("#taste_transparency").jqxTooltip({ content: 'De helderheid van het bier.' }); |
5971 $('#bottle_abv').jqxNumberInput(Show2dec); |
5973 $("#taste_transparency").jqxInput({ theme: theme, width: 320, height: 23 }); |
5972 $('#keg_abv').jqxNumberInput(Show2dec); |
5974 $("#taste_head").jqxTooltip({ content: 'Het schuim op het bier.' }); |
5973 $('#bottle_carbonation_temp').jqxNumberInput(YeastT); |
5975 $("#taste_head").jqxInput({ theme: theme, width: 320, height: 23 }); |
5974 $('#keg_carbonation_temp').jqxNumberInput(YeastT); |
5976 $("#taste_aroma").jqxTooltip({ content: 'Het aroma van het bier.' }); |
5975 |
5977 $("#taste_aroma").jqxInput({ theme: theme, width: 960, height: 23 }); |
5976 // Tab 12, Tasting |
5978 $("#taste_taste").jqxTooltip({ content: 'De smaak van het bier.' }); |
5977 $('#taste_date').jqxTooltip({ content: 'De proef datum van dit bier.' }); |
5979 $("#taste_taste").jqxInput({ theme: theme, width: 960, height: 23 }); |
5978 $('#taste_date').jqxDateTimeInput(Dateopts); |
5980 $("#taste_aftertaste").jqxTooltip({ content: 'De nasmaak van het bier.' }); |
5979 $('#taste_date').on('close', function(event) { calcStage(); }); |
5981 $("#taste_aftertaste").jqxInput({ theme: theme, width: 960, height: 23 }); |
5980 $('#taste_rate').jqxTooltip({ content: 'Het cijfer voor dit bier van 1 tot 10.' }); |
5982 $("#taste_mouthfeel").jqxTooltip({ content: 'Het mondgevoelvan het bier.' }); |
5981 $('#taste_rate').jqxNumberInput(Spin1dec); |
5983 $("#taste_mouthfeel").jqxInput({ theme: theme, width: 960, height: 23 }); |
5982 $('#taste_rate').jqxNumberInput({ max: 10 }); |
5984 $("#taste_notes").jqxTooltip({ content: 'Het oordeel en opmerkingen over dit bier.' }); |
5983 $('#taste_color').jqxTooltip({ content: 'De kleur van het bier.' }); |
5985 $("#taste_notes").jqxInput({ theme: theme, width: 960, height: 100 }); |
5984 $('#taste_color').jqxInput({ theme: theme, width: 320, height: 23 }); |
5986 |
5985 $('#taste_transparency').jqxTooltip({ content: 'De helderheid van het bier.' }); |
5987 $('#jqxTabs').jqxTabs({ |
5986 $('#taste_transparency').jqxInput({ theme: theme, width: 320, height: 23 }); |
5988 theme: theme, |
5987 $('#taste_head').jqxTooltip({ content: 'Het schuim op het bier.' }); |
5989 width: 1280, |
5988 $('#taste_head').jqxInput({ theme: theme, width: 320, height: 23 }); |
5990 height: 660, |
5989 $('#taste_aroma').jqxTooltip({ content: 'Het aroma van het bier.' }); |
5991 autoHeight: false, |
5990 $('#taste_aroma').jqxInput({ theme: theme, width: 960, height: 23 }); |
5992 position: 'top' |
5991 $('#taste_taste').jqxTooltip({ content: 'De smaak van het bier.' }); |
5993 }); |
5992 $('#taste_taste').jqxInput({ theme: theme, width: 960, height: 23 }); |
5994 |
5993 $('#taste_aftertaste').jqxTooltip({ content: 'De nasmaak van het bier.' }); |
5995 // Buttons below |
5994 $('#taste_aftertaste').jqxInput({ theme: theme, width: 960, height: 23 }); |
5996 $("#Export").jqxButton({ template: "info", width: '80px', theme: theme }); |
5995 $('#taste_mouthfeel').jqxTooltip({ content: 'Het mondgevoelvan het bier.' }); |
5997 $("#Export").bind('click', function () { |
5996 $('#taste_mouthfeel').jqxInput({ theme: theme, width: 960, height: 23 }); |
5998 saveRecord(); |
5997 $('#taste_notes').jqxTooltip({ content: 'Het oordeel en opmerkingen over dit bier.' }); |
5999 var url="prod_export.php?record=" + my_record + "&return=" + my_return + "&select=" + my_select + |
5998 $('#taste_notes').jqxInput({ theme: theme, width: 960, height: 100 }); |
6000 "&code=" + dataRecord.code + "&name=" + dataRecord.name; |
5999 |
6001 window.location.href = url; |
6000 $('#jqxTabs').jqxTabs({ |
6002 }); |
6001 theme: theme, |
6003 |
6002 width: 1280, |
6004 $("#Delete").jqxButton({ template: "danger", width: '80px', theme: theme }); |
6003 height: 660, |
6005 $("#Delete").bind('click', function () { |
6004 autoHeight: false, |
6006 // Open a popup to confirm this action. |
6005 position: 'top' |
6007 $('#eventWindow').jqxWindow('open'); |
6006 }); |
6008 $("#delOk").click(function () { |
6007 |
6009 var data = "delete=true&" + $.param({ uuid: dataRecord.uuid }); |
6008 // Buttons below |
6010 $.ajax({ |
6009 $('#Export').jqxButton({ template: 'info', width: '80px', theme: theme }); |
6011 dataType: 'json', |
6010 $('#Export').bind('click', function() { |
6012 url: url, |
6011 saveRecord(); |
6013 cache: false, |
6012 window.location.href = |
6014 data: data, |
6013 'prod_export.php?record=' + my_record + '&return=' + my_return + '&select=' + my_select + '&code=' + dataRecord.code + '&name=' + dataRecord.name; |
6015 type: "POST", |
6014 }); |
6016 success: function (data, status, xhr) { |
6015 |
6017 // delete command is executed. |
6016 $('#Delete').jqxButton({ template: 'danger', width: '80px', theme: theme }); |
6018 window.location.href = my_return; |
6017 $('#Delete').bind('click', function() { |
6019 }, |
6018 // Open a popup to confirm this action. |
6020 error: function (jqXHR, textStatus, errorThrown) { |
6019 $('#eventWindow').jqxWindow('open'); |
6021 } |
6020 $('#delOk').click(function() { |
6022 }); |
6021 var data = 'delete=true&' + $.param({ uuid: dataRecord.uuid }); |
6023 }); |
6022 $.ajax({ |
6024 }); |
6023 dataType: 'json', |
6025 |
6024 url: url, |
6026 $("#Cancel").jqxButton({ template: "primary", width: '80px', theme: theme }); |
6025 cache: false, |
6027 $("#Cancel").bind('click', function () { |
6026 data: data, |
6028 window.location.href = my_return; |
6027 type: 'POST', |
6029 }); |
6028 success: function(data, status, xhr) { |
6030 |
6029 // delete command is executed. |
6031 $("#Save").jqxButton({ template: "success", width: '80px', theme: theme }); |
6030 window.location.href = my_return; |
6032 $("#Save").bind('click', function () { |
6031 }, |
6033 saveRecord(); |
6032 error: function(jqXHR, textStatus, errorThrown) { |
6034 window.location.href = my_return; |
6033 } |
6035 }); |
6034 }); |
6036 createDelElements(); |
6035 }); |
|
6036 }); |
|
6037 |
|
6038 $('#Cancel').jqxButton({ template: 'primary', width: '80px', theme: theme }); |
|
6039 $('#Cancel').bind('click', function() { |
|
6040 window.location.href = my_return; |
|
6041 }); |
|
6042 |
|
6043 $('#Save').jqxButton({ template: 'success', width: '80px', theme: theme }); |
|
6044 $('#Save').bind('click', function() { |
|
6045 saveRecord(); |
|
6046 window.location.href = my_return; |
|
6047 }); |
|
6048 createDelElements(); |
6037 }); |
6049 }); |
6038 |
6050 |