www/js/rec_edit.js

Thu, 04 Aug 2022 20:04:52 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 04 Aug 2022 20:04:52 +0200
changeset 810
1f2ca835fe9d
parent 809
8b30068497a9
child 811
4e3409cfd2b1
permissions
-rw-r--r--

The last part to make a vieuwer from the recipe editor.

68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
2 * Copyright (C) 2018-2022
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of BMS
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * BrewCloud is distributed in the hope that it will be useful, but
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
23 var psugar = 0, // Percentage real sugars
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
24 pcara = 0, // Percentage cara/crystal malts
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
25 svg = 77, // Default attenuation
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
26 mashkg = 0, // Malt in mash weight
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
27 mash_infuse = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
28 dataRecord = {}, // Main recipe record
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
29 hop_flavour = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
30 hop_aroma = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
31 preboil_sg = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
32 last_base = '',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
33 last_acid = '',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
34 Ka1 = 0.0000004445,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
35 Ka2 = 0.0000000000468,
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
36 error_count = 0,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
37 MMCa = 40.048,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
38 MMMg = 24.305,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
39 MMNa = 22.98976928,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
40 MMCl = 35.453,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
41 MMSO4 = 96.0626,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
42 MMCO3 = 60.01684,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
43 MMHCO3 = 61.01684,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
44 MMCaSO4 = 172.171,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
45 MMCaCl2 = 147.015,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
46 MMCaCO3 = 100.087,
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
47 MMMgCl2 = 95.211, /* Since 27-06-2021 */
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
48 MMMgSO4 = 246.475,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
49 MMNaHCO3 = 84.007,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
50 MMNa2CO3 = 105.996,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
51 MMNaCl = 58.443,
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
52 MMCaOH2 = 74.06268,
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
53 SpecificHeatWater = 1.0,
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
54 SpecificHeatMalt = 0.399, //cal/g.°C
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
55 SlakingHeat = 10.318, //cal/g.°C
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
56 eq_tun_weight = 2.0, // 2 Kg pot
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
57 eq_tun_specific_heat = 0.110, // Stainless Steel
643
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
58 data_loaded = 0;
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
60 function hopFlavourContribution(bt, vol, use, amount) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
61 var result;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
62
540
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
63 if (use == 4 || use == 5) // Whirlpool or Dry-hop
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
64 return 0;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
65 if (use == 1) { // First wort
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
66 result = 0.15; // assume 15% flavourcontribution for fwh
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
67 } else if (bt > 50) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
68 result = 0.10; // assume 10% flavourcontribution as a minimum
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
69 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
70 result = 15.25 / (6 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 21) / 6, 2));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
71 if (result < 0.10)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
72 result = 0.10; // assume 10% flavourcontribution as a minimum
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
73 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
74 return (result * amount * 1000) / vol;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
75 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
76
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
77
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
78 function hopAromaContribution(bt, vol, use, amount) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
79 var result = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
80
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
81 if (use == 5) { // Dry hop
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
82 result = 1.33;
540
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
83 } else if (use == 4) { // Whirlpool
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
84 if (bt > 30)
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
85 bt = 30; // Max 30 minutes
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
86 result = 0.62 * bt / 30;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
87 } else if (bt > 20) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
88 result = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
89 } else if (bt > 7.5) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
90 result = 10.03 / (4 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 7.5) / 4, 2));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
91 } else if (use == 2) { // Boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
92 result = 1;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
93 } else if (use == 3) { // Aroma
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
94 result = 1.2;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
95 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
96 return (result * amount * 1000) / vol;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
97 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
98
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
99
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
100 function calcPercentages() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
101
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
102 console.log('calcPercentages()');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
103 var tw, rowdata, percentage, i, rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
104 if (rowscount > 1) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
105 tw = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
106 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
107 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
108 if (rowdata.f_added < 4)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
109 tw += Round(rowdata.f_amount, 3);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
110 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
111 tw = Round(tw, 3);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
112
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
113 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
114 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
115 if (rowdata.f_added < 4) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
116 percentage = Round(rowdata.f_amount / tw * 100, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
117 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', percentage);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
118 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
119 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', 0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
120 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
121 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
122 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
123 $('#fermentableGrid').jqxGrid('setcellvalue', 0, 'f_percentage', 100);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
124 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
125 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
126
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
127
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
128 function calcFermentables() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
129 console.log('calcFermentables()');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
130 var i, row, rows, org, s = 0, d, x,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
131 sug, alc, cw, color, scolor, fig,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
132 sugarsf = 0, // fermentable sugars mash + boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
133 sugarsm = 0; // fermentable sugars in mash
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
134 vol = 0, // Volume sugars after boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
135 addedS = 0, // Added sugars after boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
136 addedmass = 0, // Added mass after boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
137 mvol = 0, // mash volume
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
138 colort = 0, // Colors srm * vol totals
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
139 colorh = 0, // Colors ebc * vol * kt
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
140 colorn = 0, // Colors ebc * pt * pct
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
141 my_100 = false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
142 mashtime = 0, // Total mash time
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
143 mashtemp = 0, // Average mash temperature
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
144 bv = 0.925, // Bierverlies rendement
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
145 sr = 0.95, // Mash en spoel rendement
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
146 lintner = 0; // Total recipe lintner
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
147 /* Init global variables */
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
148 psugar = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
149 pcara = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
150 mashkg = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
151
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
152 if ((rows = $('#mashGrid').jqxGrid('getrows'))) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
153 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
154 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
155 if (row.step_type == 0) // Infusion
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
156 mvol += parseFloat(row.step_infuse_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
157 if (row.step_temp <= 75) { // Ignore mashout
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
158 mashtime += row.step_time;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
159 mashtemp += row.step_time * row.step_temp;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
160 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
161 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
162 mashtemp = mashtemp / mashtime;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
163 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
164
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
165 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
166 return; // grid not yet loaded.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
167 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
168
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
169 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
170 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
171 if (row.f_adjust_to_total_100)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
172 my_100 = true;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
173 if (row.f_type == 1 && row.f_added < 4) // Sugar
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
174 psugar += row.f_percentage;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
175 if (row.f_graintype == 2 && row.f_added < 4) // Crystal
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
176 pcara += row.f_percentage;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
177 d = row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
178 if (row.f_added == 0) { // Mash
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
179 if (mvol > 0) { // Only if mash already known
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
180 mvol += row.f_amount * row.f_moisture / 100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
181 s += d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
182 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
183 d = parseFloat(dataRecord.efficiency) / 100 * d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
184 sugarsm += d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
185 mashkg += row.f_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
186 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
187 if (row.f_added == 0 || row.f_added == 1) // Mash or Boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
188 sugarsf += d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
189 if (row.f_added == 2 || row.f_added == 3) { // Fermentation or lagering
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
190 x = (row.f_yield / 100) * (1 - row.f_moisture / 100);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
191 addedS += row.f_amount * x;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
192 addedmass += row.f_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
193 vol += (x * sugardensity + (1 - x) * 1) * row.f_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
194 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
195 if (row.f_added == 0 && (row.f_type == 0 || row.f_type == 4) && row.f_color < 50) { // Mash and Grain/Adjunct and Color < 50
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
196 lintner += row.f_diastatic_power * row.f_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
197 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
198 if (row.f_added < 4) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
199 colort += row.f_amount * ebc_to_srm(row.f_color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
200 colorh += row.f_amount * row.f_color * get_kt(row.f_color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
201 colorn += (row.f_percentage / 100) * row.f_color; // For 8.6 Pt wort.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
202 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
203 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
204 $('#ferm_lintner').val(Math.round(parseFloat(lintner / mashkg)));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
205 to_100 = my_100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
206
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
207 // Estimate total recipe OG.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
208 dataRecord.est_og = estimate_sg(sugarsf + addedS, parseFloat(dataRecord.batch_size));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
209 $('#est_og').val(dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
210 $('#est_og2').val(dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
211 org = dataRecord.est_og;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
212
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
213 // Estimate SG in kettle before boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
214 preboil_sg = estimate_sg(sugarsm, parseFloat(dataRecord.boil_size));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
215
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
216 // Color of the wort
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
217 if (dataRecord.color_method == 4) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
218 color = Math.round(((sg_to_plato(dataRecord.est_og) / 8.6) * colorn) + (dataRecord.boil_time / 60));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
219 } else if (dataRecord.color_method == 3) { // Hans Halberstadt
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
220 color = Math.round((4.46 * bv * sr) / parseFloat(dataRecord.batch_size) * colorh);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
221 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
222 cw = colort / parseFloat(dataRecord.batch_size) * 8.34436;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
223 color = kw_to_ebc(dataRecord.color_method, cw);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
224 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
225 dataRecord.est_color = color;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
226 $('#est_color').val(color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
227 $('#est_color2').val(color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
228 scolor = ebc_to_color(color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
229 document.getElementById('bcolor').style.background = scolor;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
230 document.getElementById('bcolor2').style.background = scolor;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
231
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
232 // Progress bars
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
233 pmalts = mashkg / (dataRecord.boil_size / 3) * 100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
234 $('#perc_malts').jqxProgressBar('val', pmalts);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
235 $('#perc_sugars').jqxProgressBar('val', psugar);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
236 $('#perc_cara').jqxProgressBar('val', pcara);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
237
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
238 // Calculate estimated svg.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
239 svg = 0; // default.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
240 rows = $('#yeastGrid').jqxGrid('getrows');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
241 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
242 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
243 if (row.y_use == 0) { // Primary
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
244 if (parseFloat(row.y_attenuation) > svg)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
245 svg = parseFloat(row.y_attenuation); // Take the highest if multiple yeasts.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
246 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
247 // TODO: brett in secondary ??
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
248 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
249 if (svg == 0)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
250 svg = 77;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
251
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
252 if ((mashkg > 0) && (mash_infuse > 0) && (mashtime > 0) && (mashtemp > 0)) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
253 dataRecord.est_fg = estimate_fg(psugar, pcara, mash_infuse / mashkg, mashtime, mashtemp, svg, dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
254 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
255 dataRecord.est_fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
256 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
257 $('#est_fg').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
258 $('#est_fg2').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
259 fig = dataRecord.est_fg;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
260
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
261 dataRecord.est_abv = abvol(dataRecord.est_og, dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
262 $('#est_abv').val(dataRecord.est_abv);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
263 $('#est_abv2').val(dataRecord.est_abv);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
264
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
265 // Calculate the calories in kcal/l (from brouwhulp)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
266 alc = 1881.22 * fig * (org - fig) / (1.775 - org);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
267 sug = 3550 * fig * (0.1808 * org + 0.8192 * fig - 1.0004);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
268 $('#kcal').val(Math.round((alc + sug) / (12 * 0.0295735296)));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
269 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
270
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
271
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
272 function infusionVol(step_infused, step_mashkg, infuse_temp, step_temp, last_temp) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
273 var a = last_temp * (eq_tun_weight * eq_tun_specific_heat + step_infused * SpecificHeatWater + step_mashkg * SpecificHeatMalt);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
274 var b = step_temp * (eq_tun_weight * eq_tun_specific_heat + step_infused * SpecificHeatWater + step_mashkg * SpecificHeatMalt);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
275 var vol = Round(((b - a) / ((infuse_temp - step_temp) * SpecificHeatWater)), 2);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
276 console.log('infusionVol(' + step_infused + ', ' + step_mashkg + ', ' + infuse_temp + ', ' + step_temp + ', ' + last_temp + '): ' + vol);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
277 return vol;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
278 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
279
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
280
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
281 function decoctionVol(step_volume, step_temp, prev_temp) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
282 var a = (eq_tun_weight * eq_tun_specific_heat + step_volume * SpecificHeatWater) * (step_temp - prev_temp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
283 var b = SpecificHeatWater * (99 - step_temp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
284 var vol = 0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
285 if (b > 0)
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
286 vol = Round(a / b, 6);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
287 console.log('decoctionVol(' + step_volume + ', ' + step_temp + ', ' + prev_temp + '): ' + vol);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
288 return vol;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
289 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
290
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
291
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
292 function calcMash() {
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
293 var infused = 0, vol, i, j, n, a, b, row, rows, temp;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
294 var lasttemp = 18.0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
295 var graintemp = 18.0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
296 var tuntemp = 18.0;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
297
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
298 if ((rows = $('#mashGrid').jqxGrid('getrows')) && (mashkg > 0)) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
299 console.log('calcMash()');
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
300 for (i = 0; i < rows.length; i++) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
301 row = $('#mashGrid').jqxGrid('getrowdata', i);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
302 if (row.step_type == 0) { // Infusion
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
303 if (i == 0) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
304 // First mash step, temperature from the mashtun and malt.
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
305 n = 20; // tun is preheated.
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
306 tuntemp = row.step_temp;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
307 for (j = 0; j < n; j++) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
308 a = mashkg * graintemp * SpecificHeatMalt + eq_tun_weight * tuntemp * eq_tun_specific_heat;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
309 b = row.step_temp * (eq_tun_weight * eq_tun_specific_heat + row.step_infuse_amount * SpecificHeatWater + mashkg * SpecificHeatMalt) - SlakingHeat * mashkg;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
310 if (row.step_infuse_amount > 0) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
311 temp = (b - a) / (row.step_infuse_amount * SpecificHeatWater);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
312 } else {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
313 temp = 99;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
314 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
315 tuntemp += (temp - tuntemp) / 2;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
316 row.step_infuse_temp = Round(temp, 6);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
317 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
318 console.log('init infuse temp: ' + row.step_infuse_temp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
319 } else {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
320 // Calculate amount of infusion water.
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
321 row.step_infuse_amount = infusionVol(infused, mashkg, row.step_infuse_temp, row.step_temp, lasttemp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
322 //console.log('vol: ' + row.step_infuse_amount + ' temp: ' + row.step_infuse_temp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
323 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
324 infused += row.step_infuse_amount;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
325 } else if (row.step_type == 1) { // Temperature
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
326 if (i > 0)
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
327 row.step_infuse_amount = 0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
328 row.step_infuse_temp = 0;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
329 } else if (row.step_type == 2) { // Decoction
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
330 row.step_infuse_amount = decoctionVol(infused, row.step_temp, lasttemp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
331 row.step_infuse_temp = 99;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
332 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
333 row.step_volume = infused;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
334 //console.log(i + ' type: ' + row.step_type + ' volume: ' + row.step_infuse_amount + ' temp: ' + row.step_infuse_temp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
335 lasttemp = row.step_temp;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
336 mashtime += row.step_time + row.ramp_time;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
337 row.step_wg_ratio = Round(infused / mashkg, 6);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
338 $('#mashGrid').jqxGrid('updaterow', i, row);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
339 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
340 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
341 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
342
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
343
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
344 function calcIBUs() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
345 var total_ibus = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
346 rows = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
347 i, row;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
348
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
349 hop_aroma = hop_flavour = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
350 if (!(rows = $('#hopGrid').jqxGrid('getrows'))) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
351 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
352 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
353 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
354 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
355 total_ibus += toIBU(row.h_useat, row.h_form, preboil_sg, parseFloat(dataRecord.batch_size),
540
756fe9afe72b Recipes editor handles whirlpool hop IBUs.
Michiel Broek <mbroek@mbse.eu>
parents: 524
diff changeset
356 parseFloat(row.h_amount), parseFloat(row.h_time), parseFloat(row.h_alpha), dataRecord.ibu_method, 0, parseFloat(row.h_time), 0);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
357 hop_flavour += hopFlavourContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size), row.h_useat, parseFloat(row.h_amount));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
358 hop_aroma += hopAromaContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size), row.h_useat, parseFloat(row.h_amount));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
359 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
360 total_ibus = Round(total_ibus, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
361 hop_flavour = Round(hop_flavour * 100 / 5, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
362 hop_aroma = Round(hop_aroma * 100 / 6, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
363 if (hop_flavour > 100)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
364 hop_flavour = 100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
365 if (hop_aroma > 100)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
366 hop_aroma = 100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
367 console.log('calcIBUs(): ' + total_ibus + ' flavour: ' + hop_flavour + ' aroma: ' + hop_aroma);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
368 dataRecord.est_ibu = total_ibus;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
369 $('#est_ibu').val(total_ibus);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
370 $('#est_ibu2').val(total_ibus);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
371 $('#hop_flavour').jqxProgressBar('val', hop_flavour);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
372 $('#hop_aroma').jqxProgressBar('val', hop_aroma);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
373 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
374
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
375
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
376 function adjustYeasts(factor) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
377
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
378 var i, row, amount, rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
379 if (rowscount == 0)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
380 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
381
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
382 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
383 row = $('#yeastGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
384 if (row.y_form == 1) { // Only adjust dry yeast
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
385 amount = row.y_amount * factor;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
386 $('#yeastGrid').jqxGrid('setcellvalue', i, 'y_amount', amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
387 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
388 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
389 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
390
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
391
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
392 function adjustWaters(factor) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
393
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
394 var i, row, amount, rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
395 if (rowscount == 0)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
396 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
397 mash_infuse = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
398 for (i = 0; i < rowscount; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
399 row = $('#mashGrid').jqxGrid('getrowdata', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
400 if (row.step_type == 0) { // Infusion
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
401 amount = Round(row.step_infuse_amount * factor, 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
402 $('#mashGrid').jqxGrid('setcellvalue', i, 'step_infuse_amount', amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
403 mash_infuse += amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
404 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
405 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
406 if (dataRecord.w2_amount == 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
407 dataRecord.w1_amount = mash_infuse;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
408 $('#w1_amount').val(mash_infuse);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
409 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
410 dataRecord.w1_amount = (dataRecord.w1_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
411 dataRecord.w2_amount = (dataRecord.w2_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
412 $('#w1_amount').val(dataRecord.w1_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
413 $('#w2_amount').val(dataRecord.w2_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
414 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
415 $('#wg_amount').val(mash_infuse);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
416 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
417
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
418
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
419 function GetBUGU() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
420 var gu = (dataRecord.est_og - 1) * 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
421 if (gu > 0)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
422 return dataRecord.est_ibu / gu;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
423 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
424 return 0.5;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
425 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
426
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
427
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
428 function GetOptSO4Clratio() {
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
429 var BUGU = GetBUGU();
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
430 return (-1.2 * BUGU + 1.4);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
431 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
432
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
433
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
434
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
435 function setRangeIndicator(ion, rangeCode) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
436 if ((rangeCode == 'laag') || (rangeCode == 'hoog'))
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
437 $('#wr_' + ion).html('<img src="images/dialog-error.png"><span style="vertical-align: top; font-size: 10px; font-style: italic;">' + rangeCode + '</span>');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
438 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
439 $('#wr_' + ion).html('<img src="images/dialog-ok-apply.png">');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
440 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
441
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
442
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
443 function mix(v1, v2, c1, c2) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
444 if ((v1 + v2) > 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
445 return ((v1 * c1) + (v2 * c2)) / (v1 + v2);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
446 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
447 return 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
448 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
449
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
450
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
451 // mg/l as CaCO3
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
452 function ResidualAlkalinity(total_alkalinity, calcium, magnesium) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
453 return total_alkalinity - (calcium / 1.4 + magnesium / 1.7);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
454 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
455
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
456
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
457 function PartCO3(pH) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
458 var H = Math.pow(10, -pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
459 return 100 * Ka1 * Ka2 / (H * H + H * Ka1 + Ka1 * Ka2);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
460 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
461
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
462
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
463 function PartHCO3(pH) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
464 var H = Math.pow(10, -pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
465 return 100 * Ka1 * H / (H * H + H * Ka1 + Ka1 * Ka2);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
466 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
467
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
468
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
469 function Charge(pH) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
470 return (-2 * PartCO3(pH) - PartHCO3(pH));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
471 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
472
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
473
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
474 //Z alkalinity is the amount of acid (in mEq/l) needed to bring water to the target pH (Z pH)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
475 function ZAlkalinity(pHZ) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
476 var C43 = Charge(4.3),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
477 Cw = Charge(parseFloat($('#wg_ph').jqxNumberInput('decimal'))),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
478 Cz = Charge(pHZ),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
479 DeltaCNaught = -C43 + Cw,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
480 CT = parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal')) / 50 / DeltaCNaught,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
481 DeltaCZ = -Cz + Cw;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
482 return CT * DeltaCZ;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
483 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
484
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
485
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
486 //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)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
487 function ZRA(pHZ) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
488 var Calc = parseFloat($('#wg_calcium').jqxNumberInput('decimal')) / (MMCa / 2),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
489 Magn = parseFloat($('#wg_magnesium').jqxNumberInput('decimal')) / (MMMg / 2),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
490 Z = ZAlkalinity(pHZ);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
491 return Z - (Calc / 3.5 + Magn / 7);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
492 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
493
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
494
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
495 function BufferCapacity(di_ph, acid_to_ph_57, ebc, graintype) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
496 C1 = 0;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
497 if ((di_ph != 5.7) && ((acid_to_ph_57 < - 0.1) || (acid_to_ph_57 > 0.1))) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
498 C1 = acid_to_ph_57 / (di_ph - 5.7);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
499 } else {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
500 // If the acid_to_ph_5.7 is unknown from the maltster, guess the required acid.
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
501 switch (graintype) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
502 case 0: // Base, Special, Kilned
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
503 case 3:
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
504 case 5: C1 = 0.014 * ebc - 34.192;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
505 break;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
506 case 2: C1 = -0.0597 * ebc - 32.457; // Crystal
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
507 break;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
508 case 1: C1 = 0.0107 * ebc - 54.768; // Roast
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
509 break;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
510 case 4: C1 = -149; // Sour malt
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
511 break;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
512 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
513 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
514 return C1;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
515 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
516
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
517
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
518 function ProtonDeficit(pHZ) {
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
519 var C1, i, rows, row, Result = ZRA(pHZ) * parseFloat($('#wg_amount').jqxNumberInput('decimal'));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
520 // proton deficit for the grist
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
521 if ((rows = $('#fermentableGrid').jqxGrid('getrows'))) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
522 for (i = 0; i < rows.length; i++) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
523 row = rows[i];
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
524 if (row.f_added == 0 && row.f_graintype != 6) { // Added == Mash && graintype != No Malt
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
525 C1 = BufferCapacity(row.f_di_ph, row.f_acid_to_ph_57, row.f_color, row.f_graintype);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
526 x = C1 * (pHZ - row.f_di_ph); // AcidRequired(ZpH)
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
527 Result += x * row.f_amount;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
528 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
529 }
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
530 } else {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
531 error_count++;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
532 if (error_count < 5)
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
533 console.log('ProtonDeficit(' + pHZ + ') invalid grist, return ' + Result);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
534 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
535 return Result;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
536 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
537
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
538
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
539 function MashpH() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
540 var n = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
541 pH = 5.4,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
542 deltapH = 0.001,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
543 deltapd = 0.1,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
544 pd = ProtonDeficit(pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
545 while (((pd < -deltapd) || (pd > deltapd)) && (n < 2000)) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
546 n++;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
547 if (pd < -deltapd)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
548 pH -= deltapH;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
549 else if (pd > deltapd)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
550 pH += deltapH;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
551 pd = ProtonDeficit(pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
552 }
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
553 pH = Round(pH, 6);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
554 //console.log('MashpH() n: ' + n + ' pH: ' + pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
555 return pH;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
556 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
557
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
558
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
559
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
560
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
561 $(document).ready(function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
562
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
563 var to_100 = false, // Fermentables adjust to 100%
168
ce92dc75cb09 Added locked setting to the recipes. Is not working well when a recipe is loaded and locked. Added uuid load and save for recipes. Mad a lot of variables local in functions. The subgrids are loaded async.
Michiel Broek <mbroek@mbse.eu>
parents: 166
diff changeset
564
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
565 fermentableRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
566 fermentableData = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
567 hopRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
568 hopData = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
569 miscRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
570 miscData = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
571 yeastRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
572 yeastData = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
573 mashRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
574 mashData = {},
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
575
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
576 url = 'includes/db_recipes.php',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
577 // prepare the data
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
578 source = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
579 datatype: 'json',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
580 cache: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
581 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
582 { name: 'record', type: 'number' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
583 { name: 'uuid', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
584 { name: 'locked', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
585 { name: 'st_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
586 { name: 'st_letter', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
587 { name: 'st_guide', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
588 { name: 'st_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
589 { name: 'st_category', type: 'string' },
710
9646123ea063 Fixed st_category_namber to be an integer value instead of float. The calc_acid in a new recipe is integer. Added missing wg_ and wb_ fields in a new recipe.
Michiel Broek <mbroek@mbse.eu>
parents: 667
diff changeset
590 { name: 'st_category_number', type: 'int' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
591 { name: 'st_og_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
592 { name: 'st_og_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
593 { name: 'st_fg_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
594 { name: 'st_fg_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
595 { name: 'st_ibu_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
596 { name: 'st_ibu_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
597 { name: 'st_color_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
598 { name: 'st_color_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
599 { name: 'st_carb_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
600 { name: 'st_carb_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
601 { name: 'st_abv_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
602 { name: 'st_abv_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
603 { name: 'name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
604 { name: 'notes', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
605 { name: 'type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
606 { name: 'batch_size', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
607 { name: 'boil_size', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
608 { name: 'boil_time', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
609 { name: 'efficiency', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
610 { name: 'est_og', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
611 { name: 'est_fg', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
612 { name: 'est_abv', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
613 { name: 'est_color', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
614 { name: 'color_method', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
615 { name: 'est_ibu', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
616 { name: 'ibu_method', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
617 { name: 'est_carb', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
618 { name: 'sparge_temp', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
619 { name: 'sparge_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
620 { name: 'sparge_volume', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
621 { name: 'sparge_source', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
622 { name: 'sparge_acid_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
623 { name: 'sparge_acid_perc', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
624 { name: 'sparge_acid_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
625 { name: 'mash_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
626 { name: 'mash_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
627 { name: 'calc_acid', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
628 { name: 'w1_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
629 { name: 'w1_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
630 { name: 'w1_calcium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
631 { name: 'w1_sulfate', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
632 { name: 'w1_chloride', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
633 { name: 'w1_sodium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
634 { name: 'w1_magnesium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
635 { name: 'w1_total_alkalinity', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
636 { name: 'w1_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
637 { name: 'w1_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
638 { name: 'w2_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
639 { name: 'w2_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
640 { name: 'w2_calcium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
641 { name: 'w2_sulfate', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
642 { name: 'w2_chloride', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
643 { name: 'w2_sodium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
644 { name: 'w2_magnesium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
645 { name: 'w2_total_alkalinity', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
646 { name: 'w2_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
647 { name: 'w2_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
648 { name: 'wg_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
649 { name: 'wg_calcium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
650 { name: 'wg_sulfate', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
651 { name: 'wg_chloride', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
652 { name: 'wg_sodium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
653 { name: 'wg_magnesium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
654 { name: 'wg_total_alkalinity', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
655 { name: 'wg_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
656 { name: 'wb_calcium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
657 { name: 'wb_sulfate', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
658 { name: 'wb_chloride', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
659 { name: 'wb_sodium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
660 { name: 'wb_magnesium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
661 { name: 'wb_total_alkalinity', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
662 { name: 'wb_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
663 { name: 'wa_acid_name', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
664 { name: 'wa_acid_perc', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
665 { name: 'wa_base_name', type: 'int' },
775
3f2f6e483a4e Same array fix for recipes
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
666 { name: 'fermentables', type: 'string' },
3f2f6e483a4e Same array fix for recipes
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
667 { name: 'hops', type: 'string' },
3f2f6e483a4e Same array fix for recipes
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
668 { name: 'miscs', type: 'string' },
3f2f6e483a4e Same array fix for recipes
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
669 { name: 'yeasts', type: 'string' },
3f2f6e483a4e Same array fix for recipes
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
670 { name: 'mashs', type: 'string' }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
671 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
672 id: 'record',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
673 url: url + '?record=' + my_record
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
674 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
675 // Load data and select one record.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
676 dataAdapter = new $.jqx.dataAdapter(source, {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
677 loadComplete: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
678 var records = dataAdapter.records;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
679 dataRecord = records[0];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
680 // Hidden record uuid
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
681 $('#name').val(dataRecord.name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
682 $('#notes').val(dataRecord.notes);
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
683 // Hidden record locked
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
684 $('#st_name').val(dataRecord.st_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
685 $('#st_letter').val(dataRecord.st_letter);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
686 $('#st_guide').val(dataRecord.st_guide);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
687 $('#st_category').val(dataRecord.st_category);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
688 $('#st_category_number').val(dataRecord.st_category_number);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
689 $('#st_type').val(StyleTypeData[dataRecord.st_type].nl);
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
690 $('#type').val(RecipeTypeData[dataRecord.type].nl);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
691 $('#batch_size').val(dataRecord.batch_size);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
692 $('#boil_size').val(dataRecord.boil_size);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
693 $('#boil_time').val(dataRecord.boil_time);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
694 $('#efficiency').val(dataRecord.efficiency);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
695 $('#est_og').val(dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
696 $('#est_og2').val(dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
697 $('#st_og_min').val(dataRecord.st_og_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
698 $('#st_og_max').val(dataRecord.st_og_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
699 $('#est_fg').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
700 $('#est_fg2').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
701 $('#st_fg_min').val(dataRecord.st_fg_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
702 $('#st_fg_max').val(dataRecord.st_fg_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
703 $('#est_fg').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
704 $('#est_fg2').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
705 $('#st_fg_min').val(dataRecord.st_fg_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
706 $('#st_fg_max').val(dataRecord.st_fg_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
707 $('#est_color').val(dataRecord.est_color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
708 $('#est_color2').val(dataRecord.est_color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
709 $('#est_abv').val(dataRecord.est_abv);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
710 $('#est_abv2').val(dataRecord.est_abv);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
711 $('#st_abv_min').val(dataRecord.st_abv_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
712 $('#st_abv_max').val(dataRecord.st_abv_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
713 $('#st_color_min').val(dataRecord.st_color_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
714 $('#st_color_max').val(dataRecord.st_color_max);
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
715 $('#color_method').val(ColorMethodData[dataRecord.color_method].nl);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
716 $('#est_ibu').val(dataRecord.est_ibu);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
717 $('#est_ibu2').val(dataRecord.est_ibu);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
718 $('#st_ibu_min').val(dataRecord.st_ibu_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
719 $('#st_ibu_max').val(dataRecord.st_ibu_max);
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
720 $('#ibu_method').val(IBUmethodData[dataRecord.ibu_method].nl);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
721 $('#est_carb').val(dataRecord.est_carb);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
722 $('#st_carb_min').val(dataRecord.st_carb_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
723 $('#st_carb_max').val(dataRecord.st_carb_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
724 $('#mash_name').val(dataRecord.mash_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
725 $('#mash_ph').val(dataRecord.mash_ph);
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
726 // Hidden record sparge_temp
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
727 $('#sparge_ph').val(dataRecord.sparge_ph);
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
728 $('#sw_amount').val(dataRecord.sparge_volume);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
729 // Hidden record sparge_source
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
730 $('#sparge_acid_type').val(AcidTypeData[dataRecord.sparge_acid_type].nl);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
731 $('#sparge_acid_perc').val(dataRecord.sparge_acid_perc);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
732 $('#sparge_acid_amount').val(dataRecord.sparge_acid_amount * 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
733 $('#calc_acid').val(dataRecord.calc_acid);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
734 $('#w1_name').val(dataRecord.w1_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
735 $('#w1_amount').val(dataRecord.w1_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
736 $('#w1_calcium').val(dataRecord.w1_calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
737 $('#w1_sulfate').val(dataRecord.w1_sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
738 $('#w1_chloride').val(dataRecord.w1_chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
739 $('#w1_sodium').val(dataRecord.w1_sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
740 $('#w1_magnesium').val(dataRecord.w1_magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
741 $('#w1_total_alkalinity').val(dataRecord.w1_total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
742 $('#w1_ph').val(dataRecord.w1_ph);
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
743 $('#w1_bicarbonate').val(Bicarbonate(dataRecord.w1_total_alkalinity, dataRecord.w1_ph));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
744 $('#w1_cost').val(dataRecord.w1_cost);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
745 $('#w2_name').val(dataRecord.w2_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
746 $('#w2_amount').val(dataRecord.w2_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
747 $('#w2_calcium').val(dataRecord.w2_calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
748 $('#w2_sulfate').val(dataRecord.w2_sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
749 $('#w2_chloride').val(dataRecord.w2_chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
750 $('#w2_sodium').val(dataRecord.w2_sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
751 $('#w2_magnesium').val(dataRecord.w2_magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
752 $('#w2_total_alkalinity').val(dataRecord.w2_total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
753 $('#w2_ph').val(dataRecord.w2_ph);
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
754 $('#w2_bicarbonate').val(Bicarbonate(dataRecord.w2_total_alkalinity, dataRecord.w2_ph));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
755 $('#w2_cost').val(dataRecord.w2_cost);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
756 $('#wg_amount').val(dataRecord.wg_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
757 $('#wg_calcium').val(dataRecord.wg_calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
758 $('#wg_sulfate').val(dataRecord.wg_sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
759 $('#wg_chloride').val(dataRecord.wg_chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
760 $('#wg_sodium').val(dataRecord.wg_sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
761 $('#wg_magnesium').val(dataRecord.wg_magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
762 $('#wg_total_alkalinity').val(dataRecord.wg_total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
763 $('#wg_ph').val(dataRecord.wg_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
764 $('#wb_calcium').val(dataRecord.wb_calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
765 $('#wb_sulfate').val(dataRecord.wb_sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
766 $('#wb_chloride').val(dataRecord.wb_chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
767 $('#wb_sodium').val(dataRecord.wb_sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
768 $('#wb_magnesium').val(dataRecord.wb_magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
769 $('#wb_total_alkalinity').val(dataRecord.wb_total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
770 $('#wb_ph').val(dataRecord.wb_ph);
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
771 $('#wa_acid_name').val(AcidTypeData[dataRecord.wa_acid_name].nl);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
772 $('#wa_acid_perc').val(dataRecord.wa_acid_perc);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
773 editFermentable(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
774 editHop(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
775 editMisc(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
776 editYeast(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
777 editMash(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
778 $('#jqxTabs').jqxTabs('next');
643
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
779 data_loaded = 1;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
780 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
781 loadError: function(jqXHR, status, error) {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
782 beforeLoadComplete: function(records) { $('#jqxLoader').jqxLoader('open'); }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
783 }),
352
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
784
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
785 // Inline fermentables editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
786 editFermentable = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
787 var fermentableSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
788 localdata: data.fermentables,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
789 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
790 { name: 'f_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
791 { name: 'f_origin', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
792 { name: 'f_supplier', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
793 { name: 'f_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
794 { name: 'f_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
795 { name: 'f_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
796 { name: 'f_yield', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
797 { name: 'f_color', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
798 { name: 'f_coarse_fine_diff', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
799 { name: 'f_moisture', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
800 { name: 'f_diastatic_power', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
801 { name: 'f_protein', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
802 { name: 'f_max_in_batch', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
803 { name: 'f_graintype', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
804 { name: 'f_added', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
805 { name: 'f_dissolved_protein', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
806 { name: 'f_recommend_mash', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
807 { name: 'f_add_after_boil', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
808 { name: 'f_adjust_to_total_100', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
809 { name: 'f_percentage', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
810 { name: 'f_di_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
811 { name: 'f_acid_to_ph_57', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
812 { name: 'f_inventory', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
813 { name: 'f_avail', type: 'int' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
814 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
815 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
816 fermentableAdapter = new $.jqx.dataAdapter(fermentableSource);
263
ed22ac46404b Adjust water, hops, yeasts and miscs when the batch size or equipment changes.
Michiel Broek <mbroek@mbse.eu>
parents: 262
diff changeset
817
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
818 $('#fermentableGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
819 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
820 height: 470,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
821 source: fermentableAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
822 theme: theme,
805
488613f30789 Phase 2, fermentables tab is a viewer only.
Michiel Broek <mbroek@mbse.eu>
parents: 804
diff changeset
823 editable: false,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
824 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
825 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
826 $('#jqxTabs').jqxTabs('next');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
827 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
828 columns: [
805
488613f30789 Phase 2, fermentables tab is a viewer only.
Michiel Broek <mbroek@mbse.eu>
parents: 804
diff changeset
829 { text: 'Vergistbaar ingredi&euml;nt', datafield: 'f_name' },
488613f30789 Phase 2, fermentables tab is a viewer only.
Michiel Broek <mbroek@mbse.eu>
parents: 804
diff changeset
830 { text: 'Leverancier', datafield: 'f_supplier', width: 180 },
488613f30789 Phase 2, fermentables tab is a viewer only.
Michiel Broek <mbroek@mbse.eu>
parents: 804
diff changeset
831 { text: 'Kleur', datafield: 'f_color', width: 90, align: 'right',
488613f30789 Phase 2, fermentables tab is a viewer only.
Michiel Broek <mbroek@mbse.eu>
parents: 804
diff changeset
832 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
488613f30789 Phase 2, fermentables tab is a viewer only.
Michiel Broek <mbroek@mbse.eu>
parents: 804
diff changeset
833 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(value, 'f0') + ' EBC</span>';
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
834 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
835 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
836 { text: 'Type', width: 100, datafield: 'f_type',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
837 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
838 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + FermentableTypeData[value].nl + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
839 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
840 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
841 { text: 'Moment', width: 110, datafield: 'f_added',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
842 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
843 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + AddedData[value].nl + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
844 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
845 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
846 { text: 'Maxinbatch', datafield: 'f_max_in_batch', hidden: true },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
847 { text: 'Opbrengst', editable: false, datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
848 { text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
849 { text: 'Procent', datafield: 'f_percentage', width: 90, align: 'right',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
850 cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
851 var color = '#ffffff';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
852 if (value > rowdata.f_max_in_batch)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
853 color = '#ff4040';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
854 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
855 color + ';">' + fermentableAdapter.formatNumber(value, 'p1') + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
856 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
857 },
805
488613f30789 Phase 2, fermentables tab is a viewer only.
Michiel Broek <mbroek@mbse.eu>
parents: 804
diff changeset
858 { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 70 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
859 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
860 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
861 };
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
862
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
863 // Inline hops editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
864 var editHop = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
865 var hopSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
866 localdata: data.hops,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
867 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
868 { name: 'h_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
869 { name: 'h_origin', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
870 { name: 'h_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
871 { name: 'h_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
872 { name: 'h_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
873 { name: 'h_form', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
874 { name: 'h_useat', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
875 { name: 'h_time', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
876 { name: 'h_alpha', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
877 { name: 'h_beta', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
878 { name: 'h_hsi', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
879 { name: 'h_humulene', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
880 { name: 'h_caryophyllene', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
881 { name: 'h_cohumulone', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
882 { name: 'h_myrcene', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
883 { name: 'h_total_oil', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
884 { name: 'h_inventory', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
885 { name: 'h_avail', type: 'int' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
886 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
887 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
888 hopAdapter = new $.jqx.dataAdapter(hopSource);
149
ff45488d480e Added some icons from Brewersfriend. They should be replaced someday. Added maximum mash weight setting to the equipment database. Usefull for brew automate and RIMS systems. During recipes import acid and base additions are translated. Brews and recipes now have 2 water sources. Added water mixer. Added basic water treatment, but not for pH yet. Redesigned the fermentables and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 148
diff changeset
889
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
890 $('#hopGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
891 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
892 height: 560,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
893 source: hopAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
894 theme: theme,
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
895 editable: false,
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
896 ready: function() { $('#jqxTabs').jqxTabs('next'); },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
897 columns: [
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
898 { text: 'Hop', datafield: 'h_name' },
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
899 { text: 'Origin', width: 180, datafield: 'h_origin' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
900 { text: 'Type', width: 90, datafield: 'h_type',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
901 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
902 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopTypeData[value].nl + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
903 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
904 },
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
905 { text: 'Vorm', width: 110, datafield: 'h_form',
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
906 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
907 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopFormData[value].nl + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
908 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
909 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
910 { text: 'Alpha', datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
911 { text: 'Gebruik', width: 110, datafield: 'h_useat',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
912 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
913 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopUseData[value].nl + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
914 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
915 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
916 { text: 'Tijdsduur', datafield: 'h_time', width: 90, align: 'right',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
917 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
918 var duration = '';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
919 if ((rowdata.h_useat == 2) || (rowdata.h_useat == 4)) // Boil, Whirlpool
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
920 duration = dataAdapter.formatNumber(value, 'f0') + ' min.';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
921 else if (rowdata.h_useat == 5) // Dry hop
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
922 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
923 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
924 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
925 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
926 { text: 'IBU', datafield: 'ibu', width: 80, align: 'right',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
927 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
928 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat(dataRecord.batch_size),
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
929 parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time),
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
930 parseFloat(rowdata.h_alpha), dataRecord.ibu_method, 0, parseFloat(rowdata.h_time), 0);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
931 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(ibu, 'f1') + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
932 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
933 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
934 { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
935 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
936 var amount = dataAdapter.formatNumber(value, 'f1') + ' kg';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
937 if (value < 1)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
938 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
939 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
940 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
941 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
942 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
943 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
944 };
154
ef298b5aa994 Added f_acid_to_ph_57 to the fermentables json in the recipes. The protonDeficit now processes the grist. Water pH calculations are partly in place. Added simple BU and Cl/So4 indicators. Redesign of the water screen.
Michiel Broek <mbroek@mbse.eu>
parents: 150
diff changeset
945
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
946 // Inline miscs editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
947 var editMisc = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
948 var miscSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
949 localdata: data.miscs,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
950 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
951 { name: 'm_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
952 { name: 'm_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
953 { name: 'm_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
954 { name: 'm_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
955 { name: 'm_use_use', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
956 { name: 'm_time', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
957 { name: 'm_amount_is_weight', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
958 { name: 'm_inventory', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
959 { name: 'm_avail', type: 'int' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
960 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
961 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
962 miscAdapter = new $.jqx.dataAdapter(miscSource, {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
963 beforeLoadComplete: function(records) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
964 var i, row, data = new Array();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
965 for (i = 0; i < records.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
966 row = records[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
967 data.push(row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
968 // Initial set water agent values.
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
969 if (row.m_use_use == 1) { // Mash
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
970 switch (row.m_name) {
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
971 case 'CaCl2':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
972 $('#wa_cacl2').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
973 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
974 case 'CaSO4':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
975 $('#wa_caso4').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
976 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
977 case 'MgSO4':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
978 $('#wa_mgso4').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
979 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
980 case 'NaCl':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
981 $('#wa_nacl').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
982 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
983 case 'MgCl2':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
984 $('#wa_mgcl2').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
985 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
986 case 'NaHCO3':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
987 $('#wa_nahco3').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
988 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
989 case 'CaCO3':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
990 $('#wa_caco3').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
991 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
992 case 'Melkzuur':
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
993 $('#wa_acid_name').val(AcidTypeData[0].nl);
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
994 $('#wa_acid').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
995 $('#wa_acid_perc').val(AcidTypeData[0].AcidPrc);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
996 last_acid = 'Melkzuur';
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
997 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
998 case 'Zoutzuur':
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
999 $('#wa_acid_name').val(AcidTypeData[1].nl);
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1000 $('#wa_acid').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1001 $('#wa_acid_perc').val(AcidTypeData[1].AcidPrc);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1002 last_acid = 'Zoutzuur';
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1003 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1004 case 'Fosforzuur':
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1005 $('#wa_acid_name').val(AcidTypeData[2].nl);
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1006 $('#wa_acid').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1007 $('#wa_acid_perc').val(AcidTypeData[2].AcidPrc);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1008 last_acid = 'Fosforzuur';
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1009 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1010 case 'Zwavelzuur':
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1011 $('#wa_acid_name').val(AcidTypeData[3].nl);
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1012 $('#wa_acid').val(row.m_amount * 1000);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1013 $('#wa_acid_perc').val(AcidTypeData[3].AcidPrc);
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1014 last_acid = 'Zwavelzuur';
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1015 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1016 }
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1017 }
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1018 if (row.m_use_use == 6) { // Sparge
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1019 switch (row.m_name) {
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1020 case 'CaCl2':
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1021 $('#ss_cacl2').val(row.m_amount * 1000);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1022 break;
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1023 case 'CaSO4':
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1024 $('#ss_caso4').val(row.m_amount * 1000);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1025 break;
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1026 case 'MgSO4':
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1027 $('#ss_mgso4').val(row.m_amount * 1000);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1028 break;
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1029 case 'NaCl':
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1030 $('#ss_nacl').val(row.m_amount * 1000);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1031 break;
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1032 case 'MgCl2':
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1033 $('#ss_mgcl2').val(row.m_amount * 1000);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1034 break;
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1035 case 'Melkzuur':
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1036 // $('#wa_acid_name').val(0);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1037 // $('#wa_acid').val(row.m_amount * 1000);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1038 // $('#wa_acid_perc').val(AcidTypeData[0].AcidPrc); // TODO: this ignores changed percentages.
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1039 // last_acid = 'Melkzuur';
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1040 break;
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1041 case 'Zoutzuur':
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1042 // $('#wa_acid_name').val(1);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1043 // $('#wa_acid').val(row.m_amount * 1000);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1044 // $('#wa_acid_perc').val(AcidTypeData[1].AcidPrc);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1045 // last_acid = 'Zoutzuur';
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1046 break;
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1047 case 'Fosforzuur':
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1048 // $('#wa_acid_name').val(2);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1049 // $('#wa_acid').val(row.m_amount * 1000);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1050 // $('#wa_acid_perc').val(AcidTypeData[2].AcidPrc);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1051 // last_acid = 'Fosforzuur';
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1052 break;
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1053 case 'Zwavelzuur':
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1054 // $('#wa_acid_name').val(3);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1055 // $('#wa_acid').val(row.m_amount * 1000);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1056 // $('#wa_acid_perc').val(AcidTypeData[3].AcidPrc);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1057 // last_acid = 'Zwavelzuur';
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1058 break;
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1059 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1060 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1061 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1062 return data;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1063 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1064 loadError: function(jqXHR, status, error) {}
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1065 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1066 $('#miscGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1067 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1068 height: 575,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1069 source: miscAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1070 theme: theme,
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1071 editable: false,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1072 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1073 $('#jqxTabs').jqxTabs('next');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1074 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1075 columns: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1076 { text: 'Ingredient', datafield: 'm_name' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1077 { text: 'Type', width: 140, datafield: 'm_type',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1078 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1079 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + MiscTypeData[value].nl + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1080 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1081 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1082 { text: 'Gebruik', width: 140, datafield: 'm_use_use',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1083 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1084 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + MiscUseData[value].nl + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1085 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1086 },
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1087 { text: 'Tijd', datafield: 'm_time', width: 140, align: 'right',
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1088 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1089 var duration = '';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1090 if (rowdata.m_use_use == 2) // Boil
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
1091 duration = dataAdapter.formatNumber(value, 'f0') + ' minuten';
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1092 else if ((rowdata.m_use_use == 3) || (rowdata.m_use_use == 4)) // Primary or Secondary
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1093 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1094 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1095 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1096 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1097 { text: 'Hoeveel', datafield: 'm_amount', width: 110, align: 'right',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1098 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1099 var vstr = rowdata.m_amount_is_weight ? 'gr' : 'ml';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1100 return '<span style="margin: 4px; margin-top: 6px; float: right;">' +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1101 dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1102 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1103 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1104 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1105 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1106 };
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
1107
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1108 // Inline yeasts editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1109 var editYeast = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1110 var yeastSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1111 localdata: data.yeasts,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1112 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1113 { name: 'y_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1114 { name: 'y_laboratory', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1115 { name: 'y_product_id', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1116 { name: 'y_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1117 { name: 'y_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1118 { name: 'y_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1119 { name: 'y_form', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1120 { name: 'y_flocculation', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1121 { name: 'y_min_temperature', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1122 { name: 'y_max_temperature', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1123 { name: 'y_attenuation', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1124 { name: 'y_use', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1125 { name: 'y_cells', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1126 { name: 'y_tolerance', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1127 { name: 'y_inventory', type: 'float' },
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1128 { name: 'y_sta1', type: 'int' },
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1129 { name: 'y_bacteria', type: 'int' },
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1130 { name: 'y_harvest_top', type: 'int' },
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1131 { name: 'y_harvest_time', type: 'int' },
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1132 { name: 'y_pitch_temperature', type: 'float' },
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1133 { name: 'y_pofpos', type: 'int' },
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1134 { name: 'y_zymocide', type: 'int' },
735
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
1135 { name: 'y_gr_hl_lo', type: 'int' },
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
1136 { name: 'y_sg_lo', type: 'float' },
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
1137 { name: 'y_gr_hl_hi', type: 'int' },
23d972f5d784 Added new dry-yeast parameters to the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 710
diff changeset
1138 { name: 'y_sg_hi', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1139 { name: 'y_avail', type: 'int' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1140 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1141 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1142 yeastAdapter = new $.jqx.dataAdapter(yeastSource);
148
c0f0bbfefd63 Source waters are fixed, removed grid editor. Redesigned the water screen. Made a simple visual if water treatments are out of range. Water mixer for standard and dillute water works. Swapped the mash and water tabs.
Michiel Broek <mbroek@mbse.eu>
parents: 147
diff changeset
1143
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1144 $('#yeastGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1145 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1146 height: 350,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1147 source: yeastAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1148 theme: theme,
807
ffb16dafbc93 Phase 4, yeasts as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 806
diff changeset
1149 editable: false,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1150 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1151 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1152 $('#jqxTabs').jqxTabs('next');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1153 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1154 columns: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1155 { text: 'Gist', datafield: 'y_name' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1156 { text: 'Laboratorium', width: 150, datafield: 'y_laboratory' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1157 { text: 'Code', width: 90, datafield: 'y_product_id' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1158 { text: 'Soort', width: 100, datafield: 'y_form',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1159 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1160 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + YeastFormData[value].nl + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1161 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1162 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1163 { text: 'Min. &deg;C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_min_temperature' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1164 { text: 'Max. &deg;C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_max_temperature' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1165 { text: 'Tol. %', width: 60, align: 'right', cellsalign: 'right', datafield: 'y_tolerance',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1166 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1167 var amount = '', color = '#ffffff';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1168 if (value > 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1169 amount = dataAdapter.formatNumber(value, 'f1');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1170 if (dataRecord.est_abv > value)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1171 color = '#ff4040';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1172 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1173 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1174 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1175 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1176 { text: 'Attn. %', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_attenuation', cellsformat: 'f1' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1177 { text: 'Voor', width: 120, datafield: 'y_use',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1178 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1179 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + YeastUseData[value].nl + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1180 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1181 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1182 { text: 'Hoeveel', datafield: 'y_amount', width: 90, align: 'right',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1183 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1184 var amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1185 if (rowdata.y_form == 0) // Liquid
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1186 amount = dataAdapter.formatNumber(value, 'f0') + ' pk';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1187 else if (rowdata.y_form == 1) // Dry
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1188 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1189 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1190 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1191 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1192 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1193 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1194 };
73
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1195
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1196 // inline mash editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1197 var editMash = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1198 var mashSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1199 localdata: data.mashs,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1200 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1201 { name: 'step_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1202 { name: 'step_type', type: 'int' },
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1203 { name: 'step_volume', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1204 { name: 'step_infuse_amount', type: 'float' },
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1205 { name: 'step_infuse_temp', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1206 { name: 'step_temp', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1207 { name: 'step_time', type: 'float' },
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1208 { name: 'step_wg_ratio', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1209 { name: 'ramp_time', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1210 { name: 'end_temp', type: 'float' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1211 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1212 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1213 mashAdapter = new $.jqx.dataAdapter(mashSource, {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1214 beforeLoadComplete: function(records) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1215 mash_infuse = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1216 var row, i, data = new Array();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1217 for (i = 0; i < records.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1218 row = records[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1219 if (row.step_type == 0) // Infusion
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1220 mash_infuse += parseFloat(row.step_infuse_amount);
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1221 row.step_wg_ratio = 0; // Init this field.
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1222 data.push(row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1223 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1224 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1225 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1226 $('#mashGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1227 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1228 height: 400,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1229 source: mashAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1230 theme: theme,
808
f6dcde592a7b Phase 5, ,ash tab is a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 807
diff changeset
1231 editable: false,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1232 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1233 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1234 calcInit();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1235 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1236 $('#jqxLoader').jqxLoader('close');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1237 $('#jqxTabs').jqxTabs('first');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1238 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1239 columns: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1240 { text: 'Stap naam', datafield: 'step_name' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1241 { text: 'Stap type', datafield: 'step_type', width: 175,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1242 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1243 return '<div style="margin: 4px;">' + MashStepTypeData[value].nl + '</div>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1244 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1245 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1246 { text: 'Start &deg;C', datafield: 'step_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1247 { text: 'Eind &deg;C', datafield: 'end_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1248 { text: 'Rust min.', datafield: 'step_time', width: 90, align: 'right', cellsalign: 'right' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1249 { text: 'Stap min.', datafield: 'ramp_time', width: 90, align: 'right', cellsalign: 'right' },
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1250 { text: 'Inf/dec L.', datafield: 'step_infuse_amount', width: 90, align: 'right',
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1251 cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1252 if (rowdata.step_type == 1)
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1253 return '<span></span>';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1254 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(value, 'f1') + '</span>';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1255 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1256 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1257 { text: 'Inf/dec &deg;C', datafield: 'step_infuse_temp', width: 90, align: 'right',
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1258 cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1259 if (rowdata.step_type == 1)
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1260 return '<span></span>';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1261 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(value, 'f2') + '</span>';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1262 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1263 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1264 { text: 'L/Kg.', datafield: 'step_wg_ratio', width: 90, align: 'right',
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1265 cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1266 var color = '#ffffff';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1267 if (value < 2.0 || value > 6.0)
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1268 color = '#ff4040';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1269 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + dataAdapter.formatNumber(value, 'f2') + '</span>';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1270 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1271 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1272 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1273 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1274 };
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1275
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1276
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1277 /*
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1278 * Remove the top menu so that we MUST use the buttons to leave the editor.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1279 */
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1280 $('#jqxMenu').jqxMenu('destroy');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1281
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1282 console.log('record:' + my_record + ' return:' + my_return + ' theme:' + theme);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1283 $('#jqxLoader').jqxLoader({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1284 width: 250,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1285 height: 150,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1286 isModal: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1287 text: 'Laden recept ...',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1288 theme: theme
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1289 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1290
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1291 function setWaterAgent(name, amount) {
73
454fc4558609 Added style selector in recipe editer. Better formatting of cellsrenderer fields. Added When field to the fermentables list. Attempts to calculate the fermentables.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
1292
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1293 var record, records, miscs, i, id, row, found = false, rows = $('#miscGrid').jqxGrid('getrows');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1294 if (amount == 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1295 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1296 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1297 if (row.m_name == name) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1298 id = $('#miscGrid').jqxGrid('getrowid', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1299 $('#miscGrid').jqxGrid('deleterow', id);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1300 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1301 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1302 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1303 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1304 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1305 if (row.m_name == name) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1306 found = true;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1307 $('#miscGrid').jqxGrid('setcellvalue', i, 'm_amount', amount / 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1308 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1309 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1310 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1311 if (! found) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1312 miscs = new $.jqx.dataAdapter(miscInvSource, {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1313 loadComplete: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1314 records = miscs.records;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1315 for (i = 0; i < records.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1316 record = records[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1317 if (record.name == name) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1318 row = {};
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1319 row['m_name'] = record.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1320 row['m_amount'] = amount / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1321 row['m_cost'] = record.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1322 row['m_type'] = record.type;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1323 row['m_use_use'] = record.use_use;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1324 row['m_time'] = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1325 row['m_amount_is_weight'] = record.amount_is_weight;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1326 row['m_inventory'] = record.inventory;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1327 row['m_avail'] = 1;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1328 $('#miscGrid').jqxGrid('addrow', null, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1329 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1330 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1331 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1332 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1333 miscs.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1334 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1335 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1336 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1337 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1338
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1339
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1340 // Procedure TFrmWaterAdjustment.CalcWater2;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1341 function calcWater() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1342
643
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
1343 if (! data_loaded) {
648
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
1344 console.log('calcWater(): failsave');
643
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
1345 return;
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
1346 }
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
1347
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1348 var liters = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1349 calcium = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1350 magnesium = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1351 sodium = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1352 total_alkalinity = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1353 bicarbonate = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1354 chloride = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1355 sulfate = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1356 ph = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1357 RA = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1358 frac = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1359 TpH = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1360 protonDeficit = 0,
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1361 AT, BT,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1362 r1d, r2d, f1d, f2d, f3d,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1363 deltapH, deltapd, pd, n,
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1364 Res;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1365
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1366 if (dataRecord.w1_name == '') {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1367 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1368 }
271
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1369
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1370 $('#w1_hardness').val(Hardness(dataRecord.w1_calcium, dataRecord.w1_magnesium));
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1371 $('#w1_ra').val(ResidualAlkalinity(dataRecord.w1_total_alkalinity, dataRecord.w1_calcium, dataRecord.w1_magnesium));
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1372
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1373 // If there is a dillute water source, mix the waters.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1374 if (dataRecord.w2_name != '') {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1375 liters = dataRecord.w1_amount + dataRecord.w2_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1376 calcium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_calcium, dataRecord.w2_calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1377 magnesium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_magnesium, dataRecord.w2_magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1378 sodium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_sodium, dataRecord.w2_sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1379 chloride = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_chloride, dataRecord.w2_chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1380 sulfate = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_sulfate, dataRecord.w2_sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1381 total_alkalinity = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_total_alkalinity, dataRecord.w2_total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1382 ph = -Math.log10(((Math.pow(10, -dataRecord.w1_ph) * dataRecord.w1_amount) + (Math.pow(10, -dataRecord.w2_ph) * dataRecord.w2_amount)) / liters);
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1383 $('#w2_hardness').val(Hardness(dataRecord.w2_calcium, dataRecord.w2_magnesium));
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1384 $('#w2_ra').val(ResidualAlkalinity(dataRecord.w2_total_alkalinity, dataRecord.w2_calcium, dataRecord.w2_magnesium));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1385 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1386 liters = dataRecord.w1_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1387 calcium = dataRecord.w1_calcium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1388 magnesium = dataRecord.w1_magnesium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1389 sodium = dataRecord.w1_sodium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1390 chloride = dataRecord.w1_chloride;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1391 sulfate = dataRecord.w1_sulfate;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1392 total_alkalinity = dataRecord.w1_total_alkalinity;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1393 ph = dataRecord.w1_ph;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1394 }
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1395 var bicarbonate = Bicarbonate(total_alkalinity, ph);
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1396
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1397 /* Save mixed water ions for later */
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1398 var wg_calcium = calcium;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1399 var wg_sodium = sodium;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1400 var wg_total_alkalinity = total_alkalinity;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1401 var wg_chloride = chloride;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1402 var wg_sulfate = sulfate;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1403 var wg_bicarbonate = bicarbonate;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1404
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1405 dataRecord.wg_amount = liters;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1406 dataRecord.wg_ph = ph;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1407
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1408 $('#wg_amount').val(liters);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1409 $('#wg_calcium').val(Round(calcium, 1));
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1410 $('#wg_magnesium').val(Round(magnesium, 1));
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1411 $('#wg_sodium').val(Round(sodium, 1));
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1412 $('#wg_bicarbonate').val(Round(bicarbonate, 1));
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1413 $('#wg_total_alkalinity').val(Round(total_alkalinity, 1));
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1414 $('#wg_chloride').val(Round(chloride, 1));
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1415 $('#wg_sulfate').val(Round(sulfate, 1));
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1416 $('#wg_ph').val(Round(ph, 2));
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1417 $('#wg_hardness').val(Round(Hardness(calcium, magnesium), 1));
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1418 $('#wg_ra').val(Round(ResidualAlkalinity(total_alkalinity, calcium, magnesium), 1));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1419
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1420 var mash_ph = Round(MashpH(), 3);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1421 console.log('Distilled water mash pH: ' + mash_ph);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1422
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1423 /* Calculate Salt additions */
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1424 if (liters > 0) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1425 calcium += (parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 * 1000 +
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1426 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4 * 1000 +
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1427 parseFloat($('#wa_caco3').jqxNumberInput('decimal')) * MMCa / MMCaCO3 * 1000) / liters;
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1428 magnesium += (parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMMg / MMMgSO4 * 1000 +
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1429 parseFloat($('#wa_mgcl2').jqxNumberInput('decimal')) * MMMg / MMMgCl2 * 1000) / liters;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1430 sodium += (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 1000 +
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1431 parseFloat($('#wa_nahco3').jqxNumberInput('decimal')) * MMNa / MMNaHCO3 * 1000) / liters;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1432 sulfate += (parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 * 1000 +
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1433 parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 * 1000) / liters;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1434 chloride += (2 * parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 * 1000 +
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1435 parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl * 1000 +
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1436 parseFloat($('#wa_mgcl2').jqxNumberInput('decimal')) * MMCl / MMMgCl2 * 1000) / liters;
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1437 bicarbonate += (parseFloat($('#wa_nahco3').jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3 * 1000 +
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1438 parseFloat($('#wa_caco3').jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3 * 1000) / liters;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1439 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1440
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1441 if (dataRecord.wa_acid_name < 0 || dataRecord,wa_acid_name >= AcidTypeData.length) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1442 $('#wa_acid_name').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1443 dataRecord.wa_acid_name = 0;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1444 dataRecord.wa_acid_perc = AcidTypeData[0].AcidPrc;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1445 $('#wa_acid_perc').val(AcidTypeData[0].AcidPrc);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1446 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1447 if (last_acid == '')
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1448 last_acid = AcidTypeData[dataRecord.wa_acid_name].nl;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1449
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1450 if (parseFloat(dataRecord.wa_acid_perc) == 0) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1451 dataRecord.wa_acid_perc = AcidTypeData[AT].AcidPrc;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1452 $('#wa_acid_perc').val(AcidTypeData[AT].AcidPrc);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1453 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1454
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1455 AT = dataRecord.wa_acid_name;
150
159d7a89fcef Better stage detection during product import from brouwhulp. Added tooltips for treated water.
Michiel Broek <mbroek@mbse.eu>
parents: 149
diff changeset
1456
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1457 /* Note that the next calculations do not correct the pH change by the added salts.
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1458 This pH change is at most 0.1 pH and is a minor difference in Acid amount. */
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1459
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1460 if (dataRecord.calc_acid) {
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1461 $('.c_mashph').show();
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1462 /* Auto calculate pH */
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1463 TpH = parseFloat(dataRecord.mash_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1464 protonDeficit = ProtonDeficit(TpH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1465 console.log('calc_acid tgt: ' + TpH + ' protonDeficit: ' + protonDeficit);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1466 if (protonDeficit > 0) { // Add acid
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1467 frac = CalcFrac(TpH, AcidTypeData[AT].pK1, AcidTypeData[AT].pK2, AcidTypeData[AT].pK3);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1468 Acid = protonDeficit / frac;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1469 Acid *= AcidTypeData[AT].MolWt; // mg
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1470 Acidmg = Acid;
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1471 var RealSG = Round(((AcidTypeData[AT].AcidSG - 1000) * (parseFloat(dataRecord.wa_acid_perc) / 100)) + 1000, 2);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1472 Acid /= RealSG;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1473 Acid /= AcidTypeData[AT].AcidPrc / 100;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1474 Acid = Round(Acid, 2);
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1475 console.log('Mash auto Acid final ml: ' + Acid);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1476 $('#wa_acid').val(Acid);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1477 setWaterAgent(AcidTypeData[AT].nl, Acid);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1478
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1479 bicarbonate = bicarbonate - protonDeficit * frac / liters;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1480 total_alkalinity = bicarbonate * 50 / 61;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1481 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1482 ph = TpH;
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1483 dataRecord.wb_ph = ph;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1484 $('#wb_ph').val(Round(ph, 2));
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1485 $('#est_mash_ph').val(Round(ph, 2));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1486 } else { // Manual
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1487 /* Manual calculate pH */
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1488 $('.c_mashph').hide();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1489 console.log('calc_acid no');
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1490 pHa = Round(ph, 3); // Adjusted water pH
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1491 // Then calculate the new pH with added acids and malts
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1492 console.log('Mash pH: ' + pHa);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1493 Acid = AcidTypeData[AT].AcidSG * (parseFloat(dataRecord.wa_acid_perc) / 100); // ml
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1494 Acid *= parseFloat($('#wa_acid').jqxNumberInput('decimal'));
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1495 Acid /= AcidTypeData[AT].MolWt; // mg
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1496 Acidmg = Acid;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1497
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1498 //find the pH where the protondeficit = protondeficit by the acid
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1499 frac = CalcFrac(pHa, AcidTypeData[AT].pK1, AcidTypeData[AT].pK2, AcidTypeData[AT].pK3);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1500 protonDeficit = Round(Acid * frac, 3);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1501 //console.log('protonDeficit Acid: ' + protonDeficit + ' frac: ' + frac + ' pH: ' + pHa);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1502
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1503 deltapH = 0.001;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1504 deltapd = 0.1;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1505 pd = Round(ProtonDeficit(pHa), 6);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1506 n = 0;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1507 while (((pd < (protonDeficit - deltapd)) || (pd > (protonDeficit + deltapd))) && (n < 4000)) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1508 n++;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1509 if (pd < (protonDeficit - deltapd))
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1510 pHa -= deltapH;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1511 else if (pd > (protonDeficit + deltapd))
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1512 pHa += deltapH;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1513 frac = CalcFrac(pHa, AcidTypeData[AT].pK1, AcidTypeData[AT].pK2, AcidTypeData[AT].pK3);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1514 protonDeficit = Acid * frac;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1515 pd = ProtonDeficit(pHa);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1516 }
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1517 //console.log('n: ' + n + ' pd: ' + pd + ' protonDeficit: ' + protonDeficit + ' frac: ' + frac + ' pHa: ' + pHa);
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1518 bicarbonate = wg_bicarbonate - protonDeficit * frac / liters;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1519 total_alkalinity = RA * 50 / 61;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1520 ph = pHa;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1521 $('#wb_ph').val(Round(ph, 2));
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1522 $('#est_mash_ph').val(Round(ph, 2));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1523 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1524
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1525 if ((AT == 3) && (liters > 0)) { // Sulfuctic / Zwavelzuur
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1526 RA = parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1527 parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1528 Acidmg / 1000 * MMSO4 / (MMSO4 + 2);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1529 RA = 1000 * RA / liters;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1530 sulfate = wg_sulfate + RA; // Not add to sulfate??
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1531 } else if ((AT == 1) && (liters > 0)) { // Hydrochloric, Zoutzuur
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1532 RA = parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1533 parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1534 Acidmg / 1000 * MMCl / (MMCl + 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1535 RA = 1000 * RA / liters;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1536 chloride = wg_chloride + RA;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1537 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1538
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1539 var BUGU = GetBUGU();
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1540 $('#tgt_bu').val(Round(BUGU, 2));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1541 // From brouwhulp.
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1542 if (BUGU < 0.32)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1543 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer moutig en zoet</span>");
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1544 else if (BUGU < 0.43)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1545 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Moutig, zoet</span>");
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1546 else if (BUGU < 0.52)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1547 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Evenwichtig</span>");
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1548 else if (BUGU < 0.63)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1549 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Licht hoppig, bitter</span>");
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1550 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1551 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Extra hoppig, zeer bitter</span>");
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1552
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1553 // Sulfate to Chloride ratio (Palmer).
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1554 var OptSO4Clratio = GetOptSO4Clratio();
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1555 $('#tgt_so4_cl').val(Round(OptSO4Clratio, 1));
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1556 if (OptSO4Clratio < 0.4)
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1557 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Te moutig</span>");
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1558 else if (OptSO4Clratio < 0.6)
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1559 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer moutig</span>");
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1560 else if (OptSO4Clratio < 0.8)
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1561 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Moutig</span>");
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1562 else if (OptSO4Clratio < 1.5)
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1563 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Gebalanceerd</span>");
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1564 else if (OptSO4Clratio < 2.0)
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1565 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Licht bitter</span>");
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1566 else if (OptSO4Clratio < 4.0)
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1567 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Bitter</span>");
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1568 else if (OptSO4Clratio < 9.0)
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1569 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer bitter</span>");
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1570 else
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1571 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Te bitter</span>");
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1572 if (chloride > 0)
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1573 RA = sulfate / chloride;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1574 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1575 RA = 10;
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1576 $('#got_so4_cl').val(Round(RA, 1));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1577 Res = 'normaal';
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1578 if (RA < (0.8 * OptSO4Clratio))
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1579 Res = 'laag';
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1580 else if (RA > (1.2 * OptSO4Clratio))
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1581 Res = 'hoog';
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1582 setRangeIndicator('so4_cl', Res);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1583
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1584 $('#wb_calcium').val(Round(calcium, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1585 $('#wb_magnesium').val(Round(magnesium, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1586 $('#wb_sodium').val(Round(sodium, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1587 $('#wb_sulfate').val(Round(sulfate, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1588 $('#wb_chloride').val(Round(chloride, 1));
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1589 $('#wb_bicarbonate').val(Round(bicarbonate, 1));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1590 $('#wb_total_alkalinity').val(Round(total_alkalinity, 1));
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1591 $('#wb_hardness').val(Hardness(calcium, magnesium));
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1592 $('#wb_ra').val(ResidualAlkalinity(total_alkalinity, calcium, magnesium));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1593
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1594 if (calcium < 40) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1595 setRangeIndicator('calcium', 'laag');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1596 } else if (calcium > 150) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1597 setRangeIndicator('calcium', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1598 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1599 setRangeIndicator('calcium', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1600 }
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1601 if (magnesium < 5) {
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1602 setRangeIndicator('magnesium', 'laag');
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1603 } else if (magnesium > 40) {
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1604 setRangeIndicator('magnesium', 'hoog');
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1605 } else {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1606 setRangeIndicator('magnesium', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1607 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1608 if (sodium <= 150) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1609 setRangeIndicator('sodium', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1610 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1611 setRangeIndicator('sodium', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1612 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1613 // Both chloride and sulfate should be above 50 according to
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1614 // John Palmer. So the Cl/SO4 ratio calculation will work.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1615 if (chloride <= 50) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1616 setRangeIndicator('chloride', 'laag');
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1617 } else if (chloride <= 150) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1618 setRangeIndicator('chloride', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1619 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1620 setRangeIndicator('chloride', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1621 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1622 if (sulfate <= 50) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1623 setRangeIndicator('sulfate', 'laag');
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1624 } else if (sulfate <= 400) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1625 setRangeIndicator('sulfate', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1626 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1627 setRangeIndicator('sulfate', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1628 }
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1629 // (cloride + sulfate) > 500 is too high
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1630 if ((chloride + sulfate) > 500) {
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1631 setRangeIndicator('chloride', 'hoog');
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1632 setRangeIndicator('sulfate', 'hoog');
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1633 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1634 if (ph < 5.2) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1635 setRangeIndicator('ph', 'laag');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1636 } else if (ph > 5.6) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1637 setRangeIndicator('ph', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1638 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1639 setRangeIndicator('ph', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1640 }
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1641 if (bicarbonate > 250) {
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1642 setRangeIndicator('bicarbonate', 'hoog');
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1643 } else {
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1644 setRangeIndicator('bicarbonate', 'normaal');
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
1645 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1646 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1647 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1648
146
2a6c00d325b2 In dropdown inventory lists you can now choose to display only ingredients that rae on stock or all. Fix the hops amount editor that loses the decimal digits.
Michiel Broek <mbroek@mbse.eu>
parents: 145
diff changeset
1649
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1650 function calcSparge() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1651
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1652 /* Based on the work of ajDeLange. */
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1653 var ws_calcium, ws_magnesium, ws_total_alkalinity, ws_sodium, ws_chloride;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1654 var ws_sulfate, ws_ph, ws_hardness, ws_ra;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1655 var TargetpH = dataRecord.sparge_ph;
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1656 var Source_pH = 7.0;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1657
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1658 // Select watersource or fallback to the first source.
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1659 if ((dataRecord.sparge_source == 1) && (dataRecord.w2_ph > 0.0)) { // Source 2
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1660 ws_calcium = dataRecord.w2_calcium;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1661 ws_magnesium = dataRecord.w2_magnesium;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1662 ws_total_alkalinity = dataRecord.w2_total_alkalinity;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1663 ws_sodium = dataRecord.w2_sodium;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1664 ws_chloride = dataRecord.w2_chloride;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1665 ws_sulfate = dataRecord.w2_sulfate;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1666 Source_pH = dataRecord.w2_ph;
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1667 $('#w2_button').jqxRadioButton({ checked: true });
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1668 } else if ((dataRecord.sparge_source == 2) && (dataRecord.w2_ph > 0.0)) { // Mixed
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1669 ws_calcium = dataRecord.wg_calcium;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1670 ws_magnesium = dataRecord.wg_magnesium;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1671 ws_total_alkalinity = dataRecord.wg_total_alkalinity;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1672 ws_sodium = dataRecord.wg_sodium;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1673 ws_chloride = dataRecord.wg_chloride;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1674 ws_sulfate = dataRecord.wg_sulfate;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1675 Source_pH = dataRecord.wg_ph;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1676 $('#wg_button').jqxRadioButton({ checked: true });
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1677 } else {
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1678 ws_calcium = dataRecord.w1_calcium;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1679 ws_magnesium = dataRecord.w1_magnesium;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1680 ws_total_alkalinity = dataRecord.w1_total_alkalinity;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1681 ws_sodium = dataRecord.w1_sodium;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1682 ws_chloride = dataRecord.w1_chloride;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1683 ws_sulfate = dataRecord.w1_sulfate;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1684 Source_pH = dataRecord.w1_ph;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1685 $('#w1_button').jqxRadioButton({ checked: true });
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1686 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1687
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1688 if (dataRecord.sparge_volume > 0) {
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1689 ws_calcium += (parseFloat($('#ss_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 * 1000 +
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1690 parseFloat($('#ss_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4 * 1000) / dataRecord.sparge_volume;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1691 ws_magnesium += (parseFloat($('#ss_mgso4').jqxNumberInput('decimal')) * MMMg / MMMgSO4 * 1000 +
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1692 parseFloat($('#ss_mgcl2').jqxNumberInput('decimal')) * MMMg / MMMgCl2 * 1000) / dataRecord.sparge_volume;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1693 ws_sodium += (parseFloat($('#ss_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 1000) / dataRecord.sparge_volume;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1694 ws_sulfate += (parseFloat($('#ss_caso4').jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 * 1000 +
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1695 parseFloat($('#ss_mgso4').jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 * 1000) / dataRecord.sparge_volume;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1696 ws_chloride += (2 * parseFloat($('#ss_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 * 1000 +
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1697 parseFloat($('#ss_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl * 1000 +
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1698 parseFloat($('#ss_mgcl2').jqxNumberInput('decimal')) * MMCl / MMMgCl2 * 1000) / dataRecord.sparge_volume;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1699 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1700
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1701 /* Show the spargewate with salt additions */
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1702 $('#sw_calcium').val(Round(ws_calcium, 1));
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1703 $('#sw_magnesium').val(Round(ws_magnesium, 1));
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1704 $('#sw_sodium').val(Round(ws_sodium, 1));
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1705 $('#sw_sulfate').val(Round(ws_sulfate, 1));
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1706 $('#sw_chloride').val(Round(ws_chloride, 1));
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1707 $('#sw_bicarbonate').val(Round(Bicarbonate(ws_total_alkalinity, Source_pH), 1));
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1708 $('#sw_total_alkalinity').val(Round(ws_total_alkalinity, 1));
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1709 $('#sw_ph').val(dataRecord.sparge_ph);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1710 $('#sw_hardness').val(Hardness(ws_calcium, ws_magnesium));
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1711 $('#sw_ra').val(ResidualAlkalinity(ws_total_alkalinity, ws_calcium, ws_magnesium));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1712
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1713 AT = dataRecord.sparge_acid_type;
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1714 if (AT < 0 || AT >= AcidTypeData.length) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1715 AT = 0;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1716 dataRecord.sparge_acid_type = 0;
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1717 $('#sparge_acid_type').val(AcidTypeData[0].nl);
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1718 dataRecord.sparge_acid_perc = AcidTypeData[0].AcidPrc;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1719 $('#sparge_acid_perc').val(dataRecord.sparge_acid_perc);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1720 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1721
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1722 /*
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1723 * Auto calculate the required acid
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1724 */
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1725 if (dataRecord.calc_acid) {
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1726 // Step 1: Compute the mole fractions of carbonic (f1o), bicarbonate (f2o) and carbonate(f3o) at the water pH
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1727 var r1 = Math.pow(10, Source_pH - 6.35);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1728 var r2 = Math.pow(10, Source_pH - 10.33);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1729 var d = 1 + r1 + r1 * r2;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1730 var f1 = 1 / d;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1731 var f3 = r1 * r2 / d;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1732
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1733 //Step 2. Compute the mole fractions at pH = 4.3 (the pH which defines alkalinity)
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1734 var r143 = Math.pow(10, 4.3 - 6.35);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1735 var r243 = Math.pow(10, 4.3 - 10.33);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1736 var d43 = 1 + r143 + r143 * r243;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1737 var f143 = 1 / d43;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1738 var f343 = r143 * r243 / d43;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1739
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1740 //Step 4. Solve
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1741 var Ct = ws_total_alkalinity / 50 / ((f143 - f1) + (f3 - f343));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1742
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1743 //Step 5. Compute mole fractions at desired pH
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1744 var r1g = Math.pow(10, TargetpH - 6.35);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1745 var r2g = Math.pow(10, TargetpH - 10.33);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1746 var dg = 1 + r1g + r1g * r2g;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1747 var f1g = 1 / dg;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1748 var f3g = r1g * r2g / dg;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1749
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1750 //Step 6. Use these to compute the milliequivalents acid required per liter (mEq/L)
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1751 var Acid = Ct * ((f1g - f1) + (f3 - f3g)) + Math.pow(10, -TargetpH) - Math.pow(10, -Source_pH); //mEq/l
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1752 Acid += 0.01; // Add acid that would be required for distilled water.
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1753
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1754 //Step 8. Get the acid data.
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1755 var fract = CalcFrac(TargetpH, AcidTypeData[AT].pK1, AcidTypeData[AT].pK2, AcidTypeData[AT].pK3);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1756
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1757 //Step 9. Now divide the mEq required by the "fraction". This is the required number of moles of acid.
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1758 Acid /= fract;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1759
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1760 //Step 10. Multiply by molecular weight of the acid
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1761 Acid *= AcidTypeData[AT].MolWt; //mg
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1762
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1763 //Step 11. Divide by Specific Gravity and Percentage to get the final ml.
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1764 var RealSG = Round(((AcidTypeData[AT].AcidSG - 1000) * (dataRecord.sparge_acid_perc / 100)) + 1000, 2);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1765 Acid = Acid / RealSG; //ml
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1766 Acid *= dataRecord.sparge_volume; //ml acid total at 100%
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1767 Acid /= AcidTypeData[AT].AcidPrc / 100; //ml acid at supplied strength
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1768 Acid = Round(Acid, 2);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1769 dataRecord.sparge_acid_amount = Acid / 1000;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1770 $('#sparge_acid_amount').val(Acid);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1771 }
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1772
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1773 // Finally calculate the estimate preboil pH
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1774 var ph = -Math.log10(((Math.pow(10, -dataRecord.wb_ph) * dataRecord.wg_amount) + (Math.pow(10, -dataRecord.sparge_ph) * dataRecord.sparge_volume)) /
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1775 (dataRecord.wg_amount + dataRecord.sparge_volume));
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1776 $('#preboil_ph').val(ph);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1777 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1778
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1779 function calcInit() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1780 console.log('calc.init()');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1781
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1782 calcWater();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1783 $('#w1_name').jqxDropDownList('selectItem', dataRecord.w1_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1784 $('#w2_name').jqxDropDownList('selectItem', dataRecord.w2_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1785 // Fix tap water if zero using mash infuse amount.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1786 if (parseFloat($('#w1_amount').jqxNumberInput('decimal')) == 0 && mash_infuse > 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1787 $('#w1_amount').val(mash_infuse);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1788 dataRecord.w1_amount = mash_infuse;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1789 $('#wg_amount').val(mash_infuse);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1790 $('#w2_amount').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1791 dataRecord.w2_amount = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1792 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1793 calcWater();
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1794
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1795 };
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1796
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
1797 function saveRecord(goback) {
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1798 window.location.href = my_return;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1799 };
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1800
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1801 dataAdapter.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1802
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1803 // initialize the input fields.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1804 // Tab 1, Algemeen
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1805 $('#name').jqxTooltip({ content: 'De naam voor dit recept.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1806 $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1807 $('#notes').jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1808 $('#notes').jqxInput({ theme: theme, width: 960, height: 200 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1809 $('#type').jqxTooltip({ content: 'Het brouw type van dit recept.' });
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
1810 $('#type').jqxInput({ theme: theme, width: 180, height: 23 });
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1811 $('#efficiency').jqxTooltip({ content: 'Het rendement van maischen en koken.' });
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
1812 $('#efficiency').jqxNumberInput(Show1dec);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1813 $('#batch_size').jqxTooltip({ content: 'Het volume van het gekoelde wort na het koken.' });
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
1814 $('#batch_size').jqxNumberInput(Show1dec);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1815 $('#batch_size').jqxNumberInput({ min: 4 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1816 $('#boil_size').jqxTooltip({ content: 'Het volume van het wort voor het koken.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1817 $('#boil_size').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 2, readOnly: true });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1818 $('#boil_time').jqxTooltip({ content: 'De kooktijd in minuten.' });
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
1819 $('#boil_time').jqxNumberInput(Show0dec);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1820 $('#boil_time').jqxNumberInput({ min: 4, max: 360 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1821
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1822 $('#st_name').jqxTooltip({ content: 'De bierstijl naam voor dit recept.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1823 $('#st_name').jqxInput({ theme: theme, width: 250, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1824 $('#st_letter').jqxTooltip({ content: 'De bierstijl letter voor dit recept.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1825 $('#st_letter').jqxInput({ theme: theme, width: 90, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1826 $('#st_guide').jqxTooltip({ content: 'De bierstijl gids voor dit recept.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1827 $('#st_guide').jqxInput({ theme: theme, width: 250, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1828 $('#st_category').jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1829 $('#st_category').jqxInput({ theme: theme, width: 250, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1830 $('#st_category_number').jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1831 $('#st_category_number').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1832 $('#st_type').jqxTooltip({ content: 'Het bierstijl type.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1833 $('#st_type').jqxInput({ theme: theme, width: 250, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1834
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1835 $('#est_og').jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
1836 $('#est_og').jqxNumberInput(Show3dec);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1837 $('#st_og_min').jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1838 $('#st_og_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1839 $('#st_og_max').jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1840 $('#st_og_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1841
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1842 $('#est_fg').jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1843 $('#est_fg').jqxNumberInput(Show3dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1844 $('#st_fg_min').jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1845 $('#st_fg_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1846 $('#st_fg_max').jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1847 $('#st_fg_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1848
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1849 $('#est_abv').jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1850 $('#est_abv').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1851 $('#st_abv_min').jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1852 $('#st_abv_min').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1853 $('#st_abv_max').jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1854 $('#st_abv_max').jqxNumberInput(Smal1dec);
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1855
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1856 $('#est_color').jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1857 $('#est_color').jqxNumberInput(Show0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1858 $('#st_color_min').jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1859 $('#st_color_min').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1860 $('#st_color_max').jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1861 $('#st_color_max').jqxNumberInput(Smal0dec);
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
1862 $('#color_method').jqxInput({ theme: theme, width: 180, height: 23 });
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1863 $('#est_ibu').jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1864 $('#est_ibu').jqxNumberInput(Show0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1865 $('#st_ibu_min').jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1866 $('#st_ibu_min').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1867 $('#st_ibu_max').jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1868 $('#st_ibu_max').jqxNumberInput(Smal0dec);
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
1869
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
1870 $('#ibu_method').jqxInput({ theme: theme, width: 180, height: 23 });
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1871 $('#kcal').jqxTooltip({ content: 'Energie-inhoud in kcal/liter.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1872 $('#kcal').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1873 $('#est_carb').jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1874 $('#est_carb').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1875 $('#st_carb_min').jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1876 $('#st_carb_min').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1877 $('#st_carb_max').jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1878 $('#st_carb_max').jqxNumberInput(Smal1dec);
72
93a0be4f5be3 Added category and type to the recipe style. Added tooltips in the edit screen. Added Alcohol and Carbonation to the recipe style. Redesigned the main edit window and added the style limits.
Michiel Broek <mbroek@mbse.eu>
parents: 71
diff changeset
1879
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1880 // Tab 2, Vergistbaar
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1881 $('#est_color2').jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1882 $('#est_color2').jqxNumberInput(Show0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1883 $('#est_og2').jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1884 $('#est_og2').jqxNumberInput(Show3dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1885 $('#perc_malts').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1886 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1887 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1888 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1889 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1890 max: 120,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1891 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1892 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1893 { stop: 90, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1894 { stop: 100, color: '#EB7331' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1895 { stop: 120, color: '#FF0000' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1896 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1897 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1898 return (Math.round(parseInt(text) * 1.2)) + '%';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1899 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1900 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1901 $('#perc_sugars').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1902 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1903 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1904 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1905 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1906 max: 50,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1907 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1908 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1909 { stop: 20, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1910 { stop: 50, color: '#FF0000' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1911 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1912 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1913 return (Math.round(parseInt(text) * 5) / 10) + '%';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1914 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1915 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1916 $('#perc_cara').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1917 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1918 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1919 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1920 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1921 max: 50,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1922 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1923 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1924 { stop: 25, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1925 { stop: 50, color: '#FF0000' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1926 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1927 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1928 return (Math.round(parseInt(text) * 5) / 10) + '%';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1929 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1930 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1931 $('#ferm_lintner').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1932 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1933 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1934 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1935 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1936 max: 200,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1937 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1938 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1939 { stop: 30, color: '#FF0000' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1940 { stop: 40, color: '#EB7331' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1941 { stop: 200, color: '#008C00' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1942 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1943 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1944 return (parseInt(text) * 2) + ' lintner';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1945 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1946 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
1947
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1948 // Tab 3, Hoppen
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1949 $('#est_ibu2').jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1950 $('#est_ibu2').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1951 $('#hop_flavour').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1952 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1953 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1954 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1955 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1956 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1957 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1958 { stop: 20, color: '#004D00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1959 { stop: 40, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1960 { stop: 60, color: '#00BF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1961 { stop: 80, color: '#00FF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1962 { stop: 100, color: '#80FF80' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1963 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1964 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1965 var val = parseInt(text);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1966 if (val < 20)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1967 return 'Weinig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1968 else if (val < 40)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1969 return 'Matig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1970 else if (val < 60)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1971 return 'Redelijk';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1972 else if (val < 80)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1973 return 'Veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1974 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1975 return 'Zeer veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1976 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1977 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1978 $('#hop_aroma').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1979 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1980 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1981 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1982 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1983 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1984 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1985 { stop: 20, color: '#004D00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1986 { stop: 40, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1987 { stop: 60, color: '#00BF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1988 { stop: 80, color: '#00FF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1989 { stop: 100, color: '#80FF80' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1990 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1991 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1992 var val = parseInt(text);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1993 if (val < 20)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1994 return 'Weinig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1995 else if (val < 40)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1996 return 'Matig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1997 else if (val < 60)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1998 return 'Redelijk';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1999 else if (val < 80)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2000 return 'Veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2001 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2002 return 'Zeer veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2003 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2004 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2005
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2006 // Tab 4, Diversen
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2007
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2008 // Tab 5, Gist
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2009 $('#est_fg2').jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2010 $('#est_fg2').jqxNumberInput(Show3dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2011 $('#est_abv2').jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2012 $('#est_abv2').jqxNumberInput(Smal1dec);
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2013
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2014 // Tab 6, Maischen
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2015 $('#mash_name').jqxInput({ theme: theme, width: 320, height: 23 });
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2016
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2017 // Tab 7, Water
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2018 $('#tgt_bu').jqxNumberInput(Show2wat);
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2019 $('#tgt_so4_cl,#got_so4_cl').jqxNumberInput(Show1wat);
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2020 $('#preboil_ph').jqxNumberInput(Show2wat);
220
14e349ff2a10 Recipes import uses indexes instead of strings. Started rebuilding the recipes editor using indexes and standard formats. Rebuild the fermentable editor from grid editing to popup editing. Most calculations are using indexes for dropdown values.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
2021
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2022 // Water source 1
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2023 $('#w1_name').jqxInput({ theme: theme, width: 200, height: 23 });
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2024 $('#w1_button').jqxRadioButton({ theme: theme, width: 50, height: 23, disabled: true });
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2025 $('#w1_amount').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2026 $('#w1_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2027 $('#w1_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2028 $('#w1_sodium').jqxNumberInput(Show1wat);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2029 $('#w1_bicarbonate').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2030 $('#w1_total_alkalinity').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2031 $('#w1_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2032 $('#w1_sulfate').jqxNumberInput(Show1wat);
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2033 $('#w1_ph').jqxNumberInput(Show2wat);
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2034 $('#w1_hardness').jqxNumberInput(Show1wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2035 $('#w1_ra').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2036 // Water source 2
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2037 $('#w2_name').jqxInput({ theme: theme, width: 200, height: 23 });
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2038 $('#w2_button').jqxRadioButton({ theme: theme, width: 50, height: 23, disabled: true });
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2039 $('#w2_amount').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2040 $('#w2_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2041 $('#w2_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2042 $('#w2_sodium').jqxNumberInput(Show1wat);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2043 $('#w2_bicarbonate').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2044 $('#w2_total_alkalinity').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2045 $('#w2_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2046 $('#w2_sulfate').jqxNumberInput(Show1wat);
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2047 $('#w2_ph').jqxNumberInput(Show2wat);
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2048 $('#w2_hardness').jqxNumberInput(Show1wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2049 $('#w2_ra').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2050 // Water mixed
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2051 $('#wg_button').jqxRadioButton({ theme: theme, width: 50, height: 23, disabled: true });
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2052 $('#wg_amount').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2053 $('#wg_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2054 $('#wg_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2055 $('#wg_sodium').jqxNumberInput(Show1wat);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2056 $('#wg_bicarbonate').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2057 $('#wg_total_alkalinity').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2058 $('#wg_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2059 $('#wg_sulfate').jqxNumberInput(Show1wat);
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2060 $('#wg_ph').jqxNumberInput(Show2wat);
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2061 $('#wg_hardness').jqxNumberInput(Show1wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2062 $('#wg_ra').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2063 // Water treated
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2064 $('#wb_calcium').jqxTooltip({ content: 'De ideale hoeveelheid Calcium is tussen 40 en 150.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2065 $('#wb_calcium').jqxNumberInput(Show1wat);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2066 $('#wb_magnesium').jqxTooltip({ content: 'De ideale hoeveelheid Magnesium is tussen 5 en 40.'});
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2067 $('#wb_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2068 $('#wb_sodium').jqxTooltip({ content: 'De ideale hoeveelheid Natrium is lager dan 150.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2069 $('#wb_sodium').jqxNumberInput(Show1wat);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2070 $('#wb_chloride').jqxTooltip({ content: 'De ideale hoeveelheid Chloride is tussen 50 en 150. Samen met Sulfaat minder dan 500.'});
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2071 $('#wb_chloride').jqxNumberInput(Show1wat);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2072 $('#wb_sulfate').jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is tussen 50 en 400. Samen met Sulfaat minder dan 500.'});
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2073 $('#wb_sulfate').jqxNumberInput(Show1wat);
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2074 $('#wb_bicarbonate').jqxTooltip({ content: '0 tot 50 lichte bieren, 50 tot 150 amber bieren, 150 tot 250 donkere bieren.'});
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2075 $('#wb_bicarbonate').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2076 $('#wb_total_alkalinity').jqxNumberInput(Show1wat);
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2077 $('#wb_ph').jqxNumberInput(Show2wat);
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2078 $('#wb_hardness').jqxNumberInput(Show1wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2079 $('#wb_ra').jqxNumberInput(Show1wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2080 // Sparge water
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2081 $('#sw_amount').jqxNumberInput(Show1wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2082 $('#sw_calcium').jqxNumberInput(Show1wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2083 $('#sw_magnesium').jqxNumberInput(Show1wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2084 $('#sw_sodium').jqxNumberInput(Show1wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2085 $('#sw_bicarbonate').jqxNumberInput(Show1wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2086 $('#sw_total_alkalinity').jqxNumberInput(Show1wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2087 $('#sw_chloride').jqxNumberInput(Show1wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2088 $('#sw_sulfate').jqxNumberInput(Show1wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2089 $('#sw_ph').jqxNumberInput(Show2wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2090 $('#sw_hardness').jqxNumberInput(Show1wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2091 $('#sw_ra').jqxNumberInput(Show1wat);
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
2092
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2093 // Water agents
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2094 $('#wa_cacl2').jqxTooltip({ content: 'Voor het maken van een ander waterprofiel. Voegt calcium en chloride toe. Voor het verbeteren van zoetere bieren.'});
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2095 $('#wa_cacl2').jqxNumberInput(Show2wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2096 $('#ss_cacl2').jqxNumberInput(Show2wat);
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2097
524
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
2098 $('#wa_caso4').jqxTooltip({
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
2099 content: 'Gips. Voor het maken van een ander waterprofiel. Voegt calcium en sulfaat toe. Voor het verbeteren van bittere bieren.'
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
2100 });
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2101 $('#wa_caso4').jqxNumberInput(Show2wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2102 $('#ss_caso4').jqxNumberInput(Show2wat);
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2103
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2104 $('#wa_mgso4').jqxTooltip({ content: 'Epsom zout. Voor het maken van een ander waterprofiel. Voegt magnesium en sulfaat toe. Gebruik spaarzaam!'});
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2105 $('#wa_mgso4').jqxNumberInput(Show2wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2106 $('#ss_mgso4').jqxNumberInput(Show2wat);
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2107
524
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
2108 $('#wa_nacl').jqxTooltip({
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
2109 content: 'Keukenzout. Voor het maken van een ander waterprofiel. Voegt natrium en chloride toe. ' +
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
2110 'Voor het accentueren van zoetheid. Bij hoge dosering wordt het bier ziltig.'
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
2111 });
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2112 $('#wa_nacl').jqxNumberInput(Show2wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2113 $('#ss_nacl').jqxNumberInput(Show2wat);
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2114
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2115 $('#wa_mgcl2').jqxTooltip({ content: 'Magnesiumchloride'});
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2116 $('#wa_mgcl2').jqxNumberInput(Show2wat);
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2117 $('#ss_mgcl2').jqxNumberInput(Show2wat);
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2118
772
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2119 $('#wa_nahco3').jqxTooltip({ content: 'Baksoda'});
f9d266eb0ec6 In product editor calculate fermentables before the first IBU calculation. In recipe editor changed to the new water calculations like in the product editor.
Michiel Broek <mbroek@mbse.eu>
parents: 756
diff changeset
2120 $('#wa_caco3').jqxTooltip({ content: 'Kalk'});
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2121 $('#wa_nahco3,#wa_caco3').jqxNumberInput(Show2wat);
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2122
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2123 $('#mash_ph').jqxTooltip({ content: 'Maisch pH tussen 5.2 en 5.6. Gebruik 5.2 voor lichte en 5.5 voor donkere bieren.'});
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2124 $('#mash_ph').jqxNumberInput(Show2dec);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2125
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2126 $('#calc_acid').jqxCheckBox({ theme: theme, width: 120, height: 23, disabled: true });
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2127
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2128 $('#wa_acid_name').jqxInput({ theme: theme, width: 130, height: 23 });
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2129 $('#wa_acid').jqxNumberInput(Show2dec);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2130 $('#wa_acid').jqxNumberInput({ symbol: ' ml', symbolPosition: 'right' });
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2131 $('#wa_acid_perc').jqxNumberInput(Show0dec);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2132 $('#wa_acid_perc').jqxNumberInput({ symbol: '%', symbolPosition: 'right' });
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2133
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2134 // Sparge water
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2135 $('#sparge_ph').jqxNumberInput(Show2dec);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2136 $('#sparge_acid_amount').jqxNumberInput(Show2dec);
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2137 $('#sparge_acid_amount').jqxNumberInput({ symbol: ' ml', symbolPosition: 'right' });
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2138 $('#sparge_acid_type').jqxInput({ theme: theme, width: 130, height: 23 });
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2139 $('#sparge_acid_perc').jqxNumberInput(Show0dec);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2140 $('#sparge_acid_perc').jqxNumberInput({ symbol: '%', symbolPosition: 'right' });
147
e6e5d007eb54 Added several sparge_ fields in the recipes databases. Added basic water mix calculator. Added fields on the water tab for water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 146
diff changeset
2141
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2142 // Tabs inside the popup window.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2143 $('#jqxTabs').jqxTabs({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2144 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2145 width: 1280,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2146 height: 660,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2147 autoHeight: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2148 position: 'top'
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2149 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2150
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2151 // Buttons below
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2152
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2153 $('#Cancel').jqxButton({ template: 'primary', width: '80px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2154 $('#Cancel').bind('click', function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2155 window.location.href = my_return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2156 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2157
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2158 $('#Save').jqxButton({ template: 'success', width: '80px', theme: theme });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2159 $('#Save').bind('click', function() {
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
2160 window.location.href = my_return;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2161 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2162 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2163

mercurial