307 result = 1.2; |
307 result = 1.2; |
308 } else if (use == 4) { // Whirlpool |
308 } else if (use == 4) { // Whirlpool |
309 result = 1.2; |
309 result = 1.2; |
310 } |
310 } |
311 return (result * amount * 1000) / vol; |
311 return (result * amount * 1000) / vol; |
|
312 } |
|
313 |
|
314 function calcMash() { |
|
315 |
|
316 if (!(rows = $('#mashGrid').jqxGrid('getrows'))) |
|
317 return; |
|
318 if (mashkg == 0) |
|
319 return; |
|
320 |
|
321 var infused = 0; |
|
322 for (var i = 0; i < rows.length; i++) { |
|
323 var row = $("#mashGrid").jqxGrid('getrowdata', i); |
|
324 if (row.step_type == 0) // Infusion |
|
325 infused += row.step_infuse_amount; |
|
326 $("#mashGrid").jqxGrid('setcellvalue', i, "step_thickness", infused / mashkg); |
|
327 } |
312 } |
328 } |
313 |
329 |
314 function calcIBUs() { |
330 function calcIBUs() { |
315 var total_ibus = 0; |
331 var total_ibus = 0; |
316 hop_aroma = hop_flavour = 0; |
332 hop_aroma = hop_flavour = 0; |
1302 adjustMiscs(factor); |
1318 adjustMiscs(factor); |
1303 adjustYeasts(factor); |
1319 adjustYeasts(factor); |
1304 calcIBUs(); |
1320 calcIBUs(); |
1305 calcWater(); |
1321 calcWater(); |
1306 calcSparge(); |
1322 calcSparge(); |
|
1323 calcMash(); |
1307 }); |
1324 }); |
1308 $('#boil_time').on('change', function (event) { |
1325 $('#boil_time').on('change', function (event) { |
1309 console.log("boil_time change:"+parseFloat(event.args.value)+" old:"+dataRecord.boil_time); |
1326 console.log("boil_time change:"+parseFloat(event.args.value)+" old:"+dataRecord.boil_time); |
1310 var old_evap = parseFloat(dataRecord.boil_size) - parseFloat(dataRecord.batch_size); |
1327 var old_evap = parseFloat(dataRecord.boil_size) - parseFloat(dataRecord.batch_size); |
1311 var new_evap = old_evap * (parseFloat(event.args.value) / dataRecord.boil_time); |
1328 var new_evap = old_evap * (parseFloat(event.args.value) / dataRecord.boil_time); |
1330 dataRecord.est_og = parseFloat(event.args.value); |
1347 dataRecord.est_og = parseFloat(event.args.value); |
1331 console.log("est_og change:"+dataRecord.est_og); |
1348 console.log("est_og change:"+dataRecord.est_og); |
1332 calcFermentablesFromOG(dataRecord.est_og); // Adjust fermentables amounts |
1349 calcFermentablesFromOG(dataRecord.est_og); // Adjust fermentables amounts |
1333 calcFermentables(); // Update the recipe details |
1350 calcFermentables(); // Update the recipe details |
1334 calcIBUs(); // and the IBU's. |
1351 calcIBUs(); // and the IBU's. |
|
1352 calcMash(); |
1335 }); |
1353 }); |
1336 $('#mash_ph').on('change', function (event) { |
1354 $('#mash_ph').on('change', function (event) { |
1337 dataRecord.mash_ph = parseFloat(event.args.value); |
1355 dataRecord.mash_ph = parseFloat(event.args.value); |
1338 calcWater(); |
1356 calcWater(); |
1339 }); |
1357 }); |
2561 var data = new Array(); |
2579 var data = new Array(); |
2562 for (var i = 0; i < records.length; i++) { |
2580 for (var i = 0; i < records.length; i++) { |
2563 var row = records[i]; |
2581 var row = records[i]; |
2564 if (row.step_type == 0) // Infusion |
2582 if (row.step_type == 0) // Infusion |
2565 mash_infuse += parseFloat(row.step_infuse_amount); |
2583 mash_infuse += parseFloat(row.step_infuse_amount); |
|
2584 row.step_thickness = 0; // Init this field. |
|
2585 data.push(row); |
2566 } |
2586 } |
2567 }, |
2587 }, |
2568 }); |
2588 }); |
2569 $("#mashGrid").jqxGrid({ |
2589 $("#mashGrid").jqxGrid({ |
2570 width: 1240, |
2590 width: 1240, |
2797 $("#FermentableReady").click(function () { |
2818 $("#FermentableReady").click(function () { |
2798 $("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc'); |
2819 $("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc'); |
2799 // Recalc percentages |
2820 // Recalc percentages |
2800 calcFermentables(); |
2821 calcFermentables(); |
2801 calcIBUs(); |
2822 calcIBUs(); |
|
2823 calcMash(); |
2802 // Waters: yes there is impact. |
2824 // Waters: yes there is impact. |
2803 }); |
2825 }); |
2804 $("#wf_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
2826 $("#wf_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
2805 $("#wf_instock").jqxCheckBox({ theme: theme, height: 23 }); |
2827 $("#wf_instock").jqxCheckBox({ theme: theme, height: 23 }); |
2806 $("#wf_instock").on('change', function (event) { |
2828 $("#wf_instock").on('change', function (event) { |
2871 }; |
2893 }; |
2872 } else { |
2894 } else { |
2873 $("#fermentableGrid").jqxGrid('setcellvalue', 0, "f_percentage", 100); |
2895 $("#fermentableGrid").jqxGrid('setcellvalue', 0, "f_percentage", 100); |
2874 } |
2896 } |
2875 calcFermentables(); |
2897 calcFermentables(); |
|
2898 calcMash(); |
2876 }; |
2899 }; |
2877 }); |
2900 }); |
2878 $("#wf_percentage").jqxNumberInput( Perc1dec ); |
2901 $("#wf_percentage").jqxNumberInput( Perc1dec ); |
2879 $("#wf_percentage").on('change', function (event) { |
2902 $("#wf_percentage").on('change', function (event) { |
2880 var oldvalue = Math.round(fermentableData.f_percentage * 10) / 10.0; |
2903 var oldvalue = Math.round(fermentableData.f_percentage * 10) / 10.0; |
2907 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_percentage', rowdata.f_percentage - diff); |
2930 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_percentage', rowdata.f_percentage - diff); |
2908 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_amount', namount); |
2931 $("#fermentableGrid").jqxGrid('setcellvalue', i, 'f_amount', namount); |
2909 } |
2932 } |
2910 } |
2933 } |
2911 calcFermentables(); |
2934 calcFermentables(); |
|
2935 cacMash(); |
2912 } else { |
2936 } else { |
2913 // Adjust all the rows. |
2937 // Adjust all the rows. |
2914 var nw = tw * diff / 100; |
2938 var nw = tw * diff / 100; |
2915 for (i = 0; i < rowscount; i++) { |
2939 for (i = 0; i < rowscount; i++) { |
2916 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
2940 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', i); |
3408 modalOpacity: 0.40 |
3434 modalOpacity: 0.40 |
3409 }); |
3435 }); |
3410 $("#MashReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
3436 $("#MashReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
3411 $("#MashReady").click(function () { |
3437 $("#MashReady").click(function () { |
3412 $("#mashGrid").jqxGrid('sortby', 'step_temp', 'asc'); |
3438 $("#mashGrid").jqxGrid('sortby', 'step_temp', 'asc'); |
3413 mash_infuse = 0; |
3439 calcMash(); |
3414 var rows = $('#mashGrid').jqxGrid('getrows'); |
|
3415 for (var i = 0; i < rows.length; i++) { |
|
3416 var row = rows[i]; |
|
3417 if (row.step_type == 0) // Infusion |
|
3418 mash_infuse += parseFloat(row.step_infuse_amount); |
|
3419 var rowdata = $("#mashGrid").jqxGrid('getrowdata', i); |
|
3420 if (mashkg > 0) |
|
3421 rowdata.step_thickness = parseFloat(mash_infuse / mashkg); |
|
3422 else |
|
3423 rowdata.step_thickness = 0; |
|
3424 } |
|
3425 }); |
3440 }); |
3426 $("#wstep_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
3441 $("#wstep_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
3427 $("#wstep_name").on('change', function (event) { |
3442 $("#wstep_name").on('change', function (event) { |
3428 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
3443 var rowdata = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
3429 rowdata.step_name = event.args.value; |
3444 rowdata.step_name = event.args.value; |