www/js/rec_view.js

Wed, 06 Dec 2023 20:26:00 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 06 Dec 2023 20:26:00 +0100
changeset 855
2d328a2a4025
parent 825
8b87ad5bd3c3
permissions
-rw-r--r--

Fixed init scripts names in Makefile. Update crontasks to use the database to check the log entries for products.

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 calcFermentables() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
101 console.log('calcFermentables()');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
102 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
103 sug, alc, cw, color, scolor, fig,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
104 sugarsf = 0, // fermentable sugars mash + boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
105 sugarsm = 0; // fermentable sugars in mash
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
106 vol = 0, // Volume sugars after boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
107 addedS = 0, // Added sugars after boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
108 addedmass = 0, // Added mass after boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
109 mvol = 0, // mash volume
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
110 colort = 0, // Colors srm * vol totals
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
111 colorh = 0, // Colors ebc * vol * kt
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
112 colorn = 0, // Colors ebc * pt * pct
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
113 my_100 = false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
114 mashtime = 0, // Total mash time
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
115 mashtemp = 0, // Average mash temperature
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
116 bv = 0.925, // Bierverlies rendement
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
117 sr = 0.95, // Mash en spoel rendement
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
118 lintner = 0; // Total recipe lintner
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
119 /* Init global variables */
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
120 psugar = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
121 pcara = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
122 mashkg = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
123
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
124 if ((rows = $('#mashGrid').jqxGrid('getrows'))) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
125 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
126 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
127 if (row.step_type == 0) // Infusion
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
128 mvol += parseFloat(row.step_infuse_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
129 if (row.step_temp <= 75) { // Ignore mashout
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
130 mashtime += row.step_time;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
131 mashtemp += row.step_time * row.step_temp;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
132 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
133 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
134 mashtemp = mashtemp / mashtime;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
135 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
136
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
137 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
138 return; // grid not yet loaded.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
139 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
140
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
141 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
142 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
143 if (row.f_adjust_to_total_100)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
144 my_100 = true;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
145 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
146 psugar += row.f_percentage;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
147 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
148 pcara += row.f_percentage;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
149 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
150 if (row.f_added == 0) { // Mash
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
151 if (mvol > 0) { // Only if mash already known
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
152 mvol += row.f_amount * row.f_moisture / 100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
153 s += d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
154 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
155 d = parseFloat(dataRecord.efficiency) / 100 * d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
156 sugarsm += d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
157 mashkg += row.f_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
158 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
159 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
160 sugarsf += d;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
161 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
162 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
163 addedS += row.f_amount * x;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
164 addedmass += row.f_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
165 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
166 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
167 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
168 lintner += row.f_diastatic_power * row.f_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
169 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
170 if (row.f_added < 4) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
171 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
172 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
173 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
174 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
175 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
176 $('#ferm_lintner').val(Math.round(parseFloat(lintner / mashkg)));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
177 to_100 = my_100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
178
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
179 // Estimate total recipe OG.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
180 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
181 $('#est_og').val(dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
182 $('#est_og2').val(dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
183 org = dataRecord.est_og;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
184
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
185 // Estimate SG in kettle before boil
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
186 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
187
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
188 // Color of the wort
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
189 if (dataRecord.color_method == 4) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
190 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
191 } else if (dataRecord.color_method == 3) { // Hans Halberstadt
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
192 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
193 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
194 cw = colort / parseFloat(dataRecord.batch_size) * 8.34436;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
195 color = kw_to_ebc(dataRecord.color_method, cw);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
196 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
197 dataRecord.est_color = color;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
198 $('#est_color').val(color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
199 $('#est_color2').val(color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
200 scolor = ebc_to_color(color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
201 document.getElementById('bcolor').style.background = scolor;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
202 document.getElementById('bcolor2').style.background = scolor;
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 // Progress bars
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
205 pmalts = mashkg / (dataRecord.boil_size / 3) * 100;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
206 $('#perc_malts').jqxProgressBar('val', pmalts);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
207 $('#perc_sugars').jqxProgressBar('val', psugar);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
208 $('#perc_cara').jqxProgressBar('val', pcara);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
209
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
210 // Calculate estimated svg.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
211 svg = 0; // default.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
212 rows = $('#yeastGrid').jqxGrid('getrows');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
213 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
214 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
215 if (row.y_use == 0) { // Primary
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
216 if (parseFloat(row.y_attenuation) > svg)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
217 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
218 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
219 // TODO: brett in secondary ??
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
220 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
221 if (svg == 0)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
222 svg = 77;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
223
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
224 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
225 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
226 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
227 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
228 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
229 $('#est_fg').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
230 $('#est_fg2').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
231 fig = dataRecord.est_fg;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
232
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
233 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
234 $('#est_abv').val(dataRecord.est_abv);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
235 $('#est_abv2').val(dataRecord.est_abv);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
236
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
237 // Calculate the calories in kcal/l (from brouwhulp)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
238 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
239 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
240 $('#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
241 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
242
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
243
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
244 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
245 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
246 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
247 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
248 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
249 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
250 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
251
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
252
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
253 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
254 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
255 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
256 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
257 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
258 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
259 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
260 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
261 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
262
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
263
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
264 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
265 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
266 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
267 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
268 var tuntemp = 18.0;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
269
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
270 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
271 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
272 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
273 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
274 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
275 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
276 // 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
277 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
278 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
279 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
280 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
281 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
282 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
283 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
284 } 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
285 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
286 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 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
288 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
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 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
291 } 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
292 // 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
293 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
294 //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
295 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 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
297 } 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
298 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
299 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
300 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
301 } 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
302 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
303 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
304 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product 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 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
306 //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
307 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
308 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
309 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
310 $('#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
311 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
312 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
313 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
314
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
315
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
316 function GetBUGU() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
317 var gu = (dataRecord.est_og - 1) * 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
318 if (gu > 0)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
319 return dataRecord.est_ibu / gu;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
320 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
321 return 0.5;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
322 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
323
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
324
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
325 function GetOptSO4Clratio() {
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
326 var BUGU = GetBUGU();
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
327 return (-1.2 * BUGU + 1.4);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
328 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
329
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
330
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
331
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
332 function setRangeIndicator(ion, rangeCode) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
333 if ((rangeCode == 'laag') || (rangeCode == 'hoog'))
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
334 $('#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
335 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
336 $('#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
337 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
338
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
339
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
340 function mix(v1, v2, c1, c2) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
341 if ((v1 + v2) > 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
342 return ((v1 * c1) + (v2 * c2)) / (v1 + v2);
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 return 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
345 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
346
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
347
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
348 // mg/l as CaCO3
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
349 function ResidualAlkalinity(total_alkalinity, calcium, magnesium) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
350 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
351 }
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
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
354 function PartCO3(pH) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
355 var H = Math.pow(10, -pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
356 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
357 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
358
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 function PartHCO3(pH) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
361 var H = Math.pow(10, -pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
362 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
363 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
364
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
365
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
366 function Charge(pH) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
367 return (-2 * PartCO3(pH) - PartHCO3(pH));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
368 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
369
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
370
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
371 //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
372 function ZAlkalinity(pHZ) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
373 var C43 = Charge(4.3),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
374 Cw = Charge(parseFloat($('#wg_ph').jqxNumberInput('decimal'))),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
375 Cz = Charge(pHZ),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
376 DeltaCNaught = -C43 + Cw,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
377 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
378 DeltaCZ = -Cz + Cw;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
379 return CT * DeltaCZ;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
380 }
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
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
383 //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
384 function ZRA(pHZ) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
385 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
386 Magn = parseFloat($('#wg_magnesium').jqxNumberInput('decimal')) / (MMMg / 2),
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
387 Z = ZAlkalinity(pHZ);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
388 return Z - (Calc / 3.5 + Magn / 7);
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
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
392 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
393 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
394 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
395 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
396 } 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
397 // 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
398 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
399 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
400 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
401 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
402 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
403 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
404 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
405 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
406 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
407 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
408 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
409 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
410 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
411 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
412 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
413
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
414
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
415 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
416 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
417 // 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
418 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
419 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
420 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
421 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
422 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
423 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
424 Result += x * row.f_amount;
474
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 }
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
427 } 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
428 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
429 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
430 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
431 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
432 return Result;
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
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
436 function MashpH() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
437 var n = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
438 pH = 5.4,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
439 deltapH = 0.001,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
440 deltapd = 0.1,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
441 pd = ProtonDeficit(pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
442 while (((pd < -deltapd) || (pd > deltapd)) && (n < 2000)) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
443 n++;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
444 if (pd < -deltapd)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
445 pH -= deltapH;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
446 else if (pd > deltapd)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
447 pH += deltapH;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
448 pd = ProtonDeficit(pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
449 }
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
450 pH = Round(pH, 6);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
451 //console.log('MashpH() n: ' + n + ' pH: ' + pH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
452 return pH;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
453 }
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
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
456
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
457
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
458 $(document).ready(function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
459
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
460 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
461
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
462 fermentableRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
463 fermentableData = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
464 hopRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
465 hopData = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
466 miscRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
467 miscData = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
468 yeastRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
469 yeastData = {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
470 mashRow = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
471 mashData = {},
261
8d55ca45c29e Backport changes from prod_edit in rec_edit
Michiel Broek <mbroek@mbse.eu>
parents: 254
diff changeset
472
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
473 url = 'includes/db_recipes.php',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
474 // prepare the data
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
475 source = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
476 datatype: 'json',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
477 cache: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
478 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
479 { name: 'record', type: 'number' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
480 { name: 'uuid', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
481 { name: 'locked', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
482 { name: 'st_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
483 { name: 'st_letter', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
484 { name: 'st_guide', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
485 { name: 'st_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
486 { 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
487 { name: 'st_category_number', type: 'int' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
488 { name: 'st_og_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
489 { name: 'st_og_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
490 { name: 'st_fg_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
491 { name: 'st_fg_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
492 { name: 'st_ibu_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
493 { name: 'st_ibu_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
494 { name: 'st_color_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
495 { name: 'st_color_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
496 { name: 'st_carb_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
497 { name: 'st_carb_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
498 { name: 'st_abv_min', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
499 { name: 'st_abv_max', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
500 { name: 'name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
501 { name: 'notes', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
502 { name: 'type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
503 { name: 'batch_size', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
504 { name: 'boil_size', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
505 { name: 'boil_time', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
506 { name: 'efficiency', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
507 { name: 'est_og', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
508 { name: 'est_fg', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
509 { name: 'est_abv', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
510 { name: 'est_color', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
511 { name: 'color_method', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
512 { name: 'est_ibu', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
513 { name: 'ibu_method', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
514 { name: 'est_carb', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
515 { name: 'sparge_temp', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
516 { name: 'sparge_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
517 { name: 'sparge_volume', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
518 { name: 'sparge_source', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
519 { name: 'sparge_acid_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
520 { name: 'sparge_acid_perc', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
521 { name: 'sparge_acid_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
522 { name: 'mash_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
523 { name: 'mash_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
524 { name: 'calc_acid', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
525 { name: 'w1_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
526 { name: 'w1_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
527 { name: 'w1_calcium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
528 { name: 'w1_sulfate', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
529 { name: 'w1_chloride', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
530 { name: 'w1_sodium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
531 { name: 'w1_magnesium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
532 { name: 'w1_total_alkalinity', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
533 { name: 'w1_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
534 { name: 'w1_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
535 { name: 'w2_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
536 { name: 'w2_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
537 { name: 'w2_calcium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
538 { name: 'w2_sulfate', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
539 { name: 'w2_chloride', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
540 { name: 'w2_sodium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
541 { name: 'w2_magnesium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
542 { name: 'w2_total_alkalinity', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
543 { name: 'w2_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
544 { name: 'w2_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
545 { name: 'wg_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
546 { name: 'wg_calcium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
547 { name: 'wg_sulfate', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
548 { name: 'wg_chloride', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
549 { name: 'wg_sodium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
550 { name: 'wg_magnesium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
551 { name: 'wg_total_alkalinity', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
552 { name: 'wg_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
553 { name: 'wb_calcium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
554 { name: 'wb_sulfate', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
555 { name: 'wb_chloride', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
556 { name: 'wb_sodium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
557 { name: 'wb_magnesium', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
558 { name: 'wb_total_alkalinity', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
559 { name: 'wb_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
560 { name: 'wa_acid_name', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
561 { name: 'wa_acid_perc', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
562 { name: 'wa_base_name', type: 'int' },
775
3f2f6e483a4e Same array fix for recipes
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
563 { name: 'fermentables', type: 'string' },
3f2f6e483a4e Same array fix for recipes
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
564 { name: 'hops', type: 'string' },
3f2f6e483a4e Same array fix for recipes
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
565 { name: 'miscs', type: 'string' },
3f2f6e483a4e Same array fix for recipes
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
566 { name: 'yeasts', type: 'string' },
3f2f6e483a4e Same array fix for recipes
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
567 { name: 'mashs', type: 'string' }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
568 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
569 id: 'record',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
570 url: url + '?record=' + my_record
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
571 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
572 // Load data and select one record.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
573 dataAdapter = new $.jqx.dataAdapter(source, {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
574 loadComplete: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
575 var records = dataAdapter.records;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
576 dataRecord = records[0];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
577 // Hidden record uuid
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
578 $('#name').val(dataRecord.name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
579 $('#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
580 // Hidden record locked
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
581 $('#st_name').val(dataRecord.st_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
582 $('#st_letter').val(dataRecord.st_letter);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
583 $('#st_guide').val(dataRecord.st_guide);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
584 $('#st_category').val(dataRecord.st_category);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
585 $('#st_category_number').val(dataRecord.st_category_number);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
586 $('#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
587 $('#type').val(RecipeTypeData[dataRecord.type].nl);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
588 $('#batch_size').val(dataRecord.batch_size);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
589 $('#boil_size').val(dataRecord.boil_size);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
590 $('#boil_time').val(dataRecord.boil_time);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
591 $('#efficiency').val(dataRecord.efficiency);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
592 $('#est_og').val(dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
593 $('#est_og2').val(dataRecord.est_og);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
594 $('#st_og_min').val(dataRecord.st_og_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
595 $('#st_og_max').val(dataRecord.st_og_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
596 $('#est_fg').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
597 $('#est_fg2').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
598 $('#st_fg_min').val(dataRecord.st_fg_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
599 $('#st_fg_max').val(dataRecord.st_fg_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
600 $('#est_fg').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
601 $('#est_fg2').val(dataRecord.est_fg);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
602 $('#st_fg_min').val(dataRecord.st_fg_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
603 $('#st_fg_max').val(dataRecord.st_fg_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
604 $('#est_color').val(dataRecord.est_color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
605 $('#est_color2').val(dataRecord.est_color);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
606 $('#est_abv').val(dataRecord.est_abv);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
607 $('#est_abv2').val(dataRecord.est_abv);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
608 $('#st_abv_min').val(dataRecord.st_abv_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
609 $('#st_abv_max').val(dataRecord.st_abv_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
610 $('#st_color_min').val(dataRecord.st_color_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
611 $('#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
612 $('#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
613 $('#est_ibu').val(dataRecord.est_ibu);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
614 $('#est_ibu2').val(dataRecord.est_ibu);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
615 $('#st_ibu_min').val(dataRecord.st_ibu_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
616 $('#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
617 $('#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
618 $('#est_carb').val(dataRecord.est_carb);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
619 $('#st_carb_min').val(dataRecord.st_carb_min);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
620 $('#st_carb_max').val(dataRecord.st_carb_max);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
621 $('#mash_name').val(dataRecord.mash_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
622 $('#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
623 // Hidden record sparge_temp
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
624 $('#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
625 $('#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
626 // 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
627 $('#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
628 $('#sparge_acid_perc').val(dataRecord.sparge_acid_perc);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
629 $('#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
630 $('#calc_acid').val(dataRecord.calc_acid);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
631 $('#w1_name').val(dataRecord.w1_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
632 $('#w1_amount').val(dataRecord.w1_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
633 $('#w1_calcium').val(dataRecord.w1_calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
634 $('#w1_sulfate').val(dataRecord.w1_sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
635 $('#w1_chloride').val(dataRecord.w1_chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
636 $('#w1_sodium').val(dataRecord.w1_sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
637 $('#w1_magnesium').val(dataRecord.w1_magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
638 $('#w1_total_alkalinity').val(dataRecord.w1_total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
639 $('#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
640 $('#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
641 $('#w1_cost').val(dataRecord.w1_cost);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
642 $('#w2_name').val(dataRecord.w2_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
643 $('#w2_amount').val(dataRecord.w2_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
644 $('#w2_calcium').val(dataRecord.w2_calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
645 $('#w2_sulfate').val(dataRecord.w2_sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
646 $('#w2_chloride').val(dataRecord.w2_chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
647 $('#w2_sodium').val(dataRecord.w2_sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
648 $('#w2_magnesium').val(dataRecord.w2_magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
649 $('#w2_total_alkalinity').val(dataRecord.w2_total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
650 $('#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
651 $('#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
652 $('#w2_cost').val(dataRecord.w2_cost);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
653 $('#wg_amount').val(dataRecord.wg_amount);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
654 $('#wg_calcium').val(dataRecord.wg_calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
655 $('#wg_sulfate').val(dataRecord.wg_sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
656 $('#wg_chloride').val(dataRecord.wg_chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
657 $('#wg_sodium').val(dataRecord.wg_sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
658 $('#wg_magnesium').val(dataRecord.wg_magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
659 $('#wg_total_alkalinity').val(dataRecord.wg_total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
660 $('#wg_ph').val(dataRecord.wg_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
661 $('#wb_calcium').val(dataRecord.wb_calcium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
662 $('#wb_sulfate').val(dataRecord.wb_sulfate);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
663 $('#wb_chloride').val(dataRecord.wb_chloride);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
664 $('#wb_sodium').val(dataRecord.wb_sodium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
665 $('#wb_magnesium').val(dataRecord.wb_magnesium);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
666 $('#wb_total_alkalinity').val(dataRecord.wb_total_alkalinity);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
667 $('#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
668 $('#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
669 $('#wa_acid_perc').val(dataRecord.wa_acid_perc);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
670 editFermentable(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
671 editHop(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
672 editMisc(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
673 editYeast(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
674 editMash(dataRecord);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
675 $('#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
676 data_loaded = 1;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
677 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
678 loadError: function(jqXHR, status, error) {},
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
679 beforeLoadComplete: function(records) { $('#jqxLoader').jqxLoader('open'); }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
680 }),
352
9d2a4703bdac Version 0.1.2 Calculate mash thickness.
Michiel Broek <mbroek@mbse.eu>
parents: 350
diff changeset
681
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
682 // Inline fermentables editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
683 editFermentable = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
684 var fermentableSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
685 localdata: data.fermentables,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
686 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
687 { name: 'f_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
688 { name: 'f_origin', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
689 { name: 'f_supplier', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
690 { name: 'f_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
691 { name: 'f_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
692 { name: 'f_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
693 { name: 'f_yield', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
694 { name: 'f_color', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
695 { name: 'f_coarse_fine_diff', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
696 { name: 'f_moisture', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
697 { name: 'f_diastatic_power', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
698 { name: 'f_protein', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
699 { name: 'f_max_in_batch', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
700 { name: 'f_graintype', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
701 { name: 'f_added', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
702 { name: 'f_dissolved_protein', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
703 { name: 'f_recommend_mash', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
704 { name: 'f_add_after_boil', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
705 { name: 'f_adjust_to_total_100', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
706 { name: 'f_percentage', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
707 { name: 'f_di_ph', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
708 { name: 'f_acid_to_ph_57', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
709 { name: 'f_inventory', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
710 { name: 'f_avail', type: 'int' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
711 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
712 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
713 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
714
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
715 $('#fermentableGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
716 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
717 height: 470,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
718 source: fermentableAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
719 theme: theme,
805
488613f30789 Phase 2, fermentables tab is a viewer only.
Michiel Broek <mbroek@mbse.eu>
parents: 804
diff changeset
720 editable: false,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
721 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
722 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
723 $('#jqxTabs').jqxTabs('next');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
724 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
725 columns: [
805
488613f30789 Phase 2, fermentables tab is a viewer only.
Michiel Broek <mbroek@mbse.eu>
parents: 804
diff changeset
726 { 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
727 { 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
728 { 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
729 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
730 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
731 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
732 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
733 { text: 'Type', width: 100, datafield: 'f_type',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
734 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
735 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
736 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
737 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
738 { text: 'Moment', width: 110, datafield: 'f_added',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
739 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
740 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
741 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
742 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
743 { 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
744 { 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
745 { 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
746 { 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
747 cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
748 var color = '#ffffff';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
749 if (value > rowdata.f_max_in_batch)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
750 color = '#ff4040';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
751 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
752 color + ';">' + fermentableAdapter.formatNumber(value, 'p1') + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
753 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
754 },
805
488613f30789 Phase 2, fermentables tab is a viewer only.
Michiel Broek <mbroek@mbse.eu>
parents: 804
diff changeset
755 { 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
756 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
757 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
758 };
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
759
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
760 // Inline hops editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
761 var editHop = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
762 var hopSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
763 localdata: data.hops,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
764 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
765 { name: 'h_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
766 { name: 'h_origin', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
767 { name: 'h_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
768 { name: 'h_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
769 { name: 'h_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
770 { name: 'h_form', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
771 { name: 'h_useat', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
772 { name: 'h_time', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
773 { name: 'h_alpha', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
774 { name: 'h_beta', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
775 { name: 'h_hsi', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
776 { name: 'h_humulene', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
777 { name: 'h_caryophyllene', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
778 { name: 'h_cohumulone', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
779 { name: 'h_myrcene', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
780 { name: 'h_total_oil', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
781 { name: 'h_inventory', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
782 { name: 'h_avail', type: 'int' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
783 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
784 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
785 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
786
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
787 $('#hopGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
788 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
789 height: 560,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
790 source: hopAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
791 theme: theme,
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
792 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
793 ready: function() { $('#jqxTabs').jqxTabs('next'); },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
794 columns: [
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
795 { text: 'Hop', datafield: 'h_name' },
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
796 { text: 'Origin', width: 180, datafield: 'h_origin' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
797 { text: 'Type', width: 90, datafield: 'h_type',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
798 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
799 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
800 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
801 },
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
802 { text: 'Vorm', width: 110, datafield: 'h_form',
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
803 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
804 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
805 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
806 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
807 { 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
808 { text: 'Gebruik', width: 110, datafield: 'h_useat',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
809 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
810 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
811 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
812 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
813 { 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
814 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
815 var duration = '';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
816 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
817 duration = dataAdapter.formatNumber(value, 'f0') + ' min.';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
818 else if (rowdata.h_useat == 5) // Dry hop
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
819 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
820 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
821 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
822 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
823 { text: 'IBU', datafield: 'ibu', width: 80, align: 'right',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
824 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
825 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
826 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
827 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
828 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
829 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
830 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
831 { 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
832 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
833 var amount = dataAdapter.formatNumber(value, 'f1') + ' kg';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
834 if (value < 1)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
835 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
836 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
837 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
838 }
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 };
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
842
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
843 // Inline miscs editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
844 var editMisc = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
845 var miscSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
846 localdata: data.miscs,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
847 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
848 { name: 'm_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
849 { name: 'm_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
850 { name: 'm_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
851 { name: 'm_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
852 { name: 'm_use_use', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
853 { name: 'm_time', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
854 { name: 'm_amount_is_weight', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
855 { name: 'm_inventory', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
856 { name: 'm_avail', type: 'int' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
857 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
858 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
859 miscAdapter = new $.jqx.dataAdapter(miscSource, {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
860 beforeLoadComplete: function(records) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
861 var i, row, data = new Array();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
862 for (i = 0; i < records.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
863 row = records[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
864 data.push(row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
865 // 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
866 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
867 switch (row.m_name) {
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
868 case 'CaCl2':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
869 $('#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
870 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
871 case 'CaSO4':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
872 $('#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
873 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
874 case 'MgSO4':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
875 $('#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
876 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
877 case 'NaCl':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
878 $('#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
879 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
880 case 'MgCl2':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
881 $('#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
882 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
883 case 'NaHCO3':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
884 $('#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
885 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
886 case 'CaCO3':
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
887 $('#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
888 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
889 case 'Melkzuur':
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
890 $('#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
891 $('#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
892 $('#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
893 last_acid = 'Melkzuur';
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
894 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
895 case 'Zoutzuur':
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
896 $('#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
897 $('#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
898 $('#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
899 last_acid = 'Zoutzuur';
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
900 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
901 case 'Fosforzuur':
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
902 $('#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
903 $('#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
904 $('#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
905 last_acid = 'Fosforzuur';
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
906 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
907 case 'Zwavelzuur':
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
908 $('#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
909 $('#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
910 $('#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
911 last_acid = 'Zwavelzuur';
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
912 break;
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
913 }
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
914 }
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
915 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
916 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
917 case 'CaCl2':
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
918 $('#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
919 break;
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
920 case 'CaSO4':
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
921 $('#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
922 break;
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
923 case 'MgSO4':
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
924 $('#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
925 break;
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
926 case 'NaCl':
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
927 $('#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
928 break;
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
929 case 'MgCl2':
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
930 $('#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
931 break;
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
932 case 'Melkzuur':
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
933 // $('#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
934 // $('#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
935 // $('#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
936 // last_acid = 'Melkzuur';
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
937 break;
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
938 case 'Zoutzuur':
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
939 // $('#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
940 // $('#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
941 // $('#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
942 // last_acid = 'Zoutzuur';
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
943 break;
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
944 case 'Fosforzuur':
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
945 // $('#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
946 // $('#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
947 // $('#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
948 // last_acid = 'Fosforzuur';
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
949 break;
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
950 case 'Zwavelzuur':
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
951 // $('#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
952 // $('#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
953 // $('#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
954 // last_acid = 'Zwavelzuur';
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
955 break;
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
956 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
957 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
958 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
959 return data;
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 loadError: function(jqXHR, status, error) {}
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
962 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
963 $('#miscGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
964 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
965 height: 575,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
966 source: miscAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
967 theme: theme,
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
968 editable: false,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
969 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
970 $('#jqxTabs').jqxTabs('next');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
971 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
972 columns: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
973 { text: 'Ingredient', datafield: 'm_name' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
974 { text: 'Type', width: 140, datafield: 'm_type',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
975 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
976 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
977 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
978 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
979 { text: 'Gebruik', width: 140, datafield: 'm_use_use',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
980 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
981 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
982 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
983 },
806
09f29253cc7e Phase 3, hops and misc ingredients as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 805
diff changeset
984 { 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
985 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
986 var duration = '';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
987 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
988 duration = dataAdapter.formatNumber(value, 'f0') + ' minuten';
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
989 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
990 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
991 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
992 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
993 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
994 { 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
995 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
996 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
997 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
998 dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr + '</span>';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
999 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1000 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1001 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1002 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1003 };
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
1004
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1005 // Inline yeasts editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1006 var editYeast = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1007 var yeastSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1008 localdata: data.yeasts,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1009 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1010 { name: 'y_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1011 { name: 'y_laboratory', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1012 { name: 'y_product_id', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1013 { name: 'y_amount', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1014 { name: 'y_cost', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1015 { name: 'y_type', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1016 { name: 'y_form', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1017 { name: 'y_flocculation', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1018 { name: 'y_min_temperature', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1019 { name: 'y_max_temperature', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1020 { name: 'y_attenuation', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1021 { name: 'y_use', type: 'int' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1022 { name: 'y_cells', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1023 { name: 'y_tolerance', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1024 { 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
1025 { 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
1026 { 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
1027 { 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
1028 { 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
1029 { 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
1030 { 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
1031 { 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
1032 { 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
1033 { 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
1034 { 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
1035 { name: 'y_sg_hi', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1036 { name: 'y_avail', type: 'int' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1037 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1038 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1039 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
1040
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1041 $('#yeastGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1042 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1043 height: 350,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1044 source: yeastAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1045 theme: theme,
807
ffb16dafbc93 Phase 4, yeasts as a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 806
diff changeset
1046 editable: false,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1047 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1048 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1049 $('#jqxTabs').jqxTabs('next');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1050 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1051 columns: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1052 { text: 'Gist', datafield: 'y_name' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1053 { text: 'Laboratorium', width: 150, datafield: 'y_laboratory' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1054 { text: 'Code', width: 90, datafield: 'y_product_id' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1055 { text: 'Soort', width: 100, datafield: 'y_form',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1056 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1057 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
1058 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1059 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1060 { 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
1061 { 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
1062 { 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
1063 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1064 var amount = '', color = '#ffffff';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1065 if (value > 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1066 amount = dataAdapter.formatNumber(value, 'f1');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1067 if (dataRecord.est_abv > value)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1068 color = '#ff4040';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1069 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1070 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
1071 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1072 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1073 { 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
1074 { text: 'Voor', width: 120, datafield: 'y_use',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1075 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1076 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
1077 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1078 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1079 { 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
1080 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1081 var amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1082 if (rowdata.y_form == 0) // Liquid
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1083 amount = dataAdapter.formatNumber(value, 'f0') + ' pk';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1084 else if (rowdata.y_form == 1) // Dry
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1085 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1086 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
1087 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1088 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1089 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1090 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1091 };
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
1092
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1093 // inline mash editor
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1094 var editMash = function(data) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1095 var mashSource = {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1096 localdata: data.mashs,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1097 datafields: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1098 { name: 'step_name', type: 'string' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1099 { 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
1100 { name: 'step_volume', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1101 { 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
1102 { name: 'step_infuse_temp', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1103 { name: 'step_temp', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1104 { 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
1105 { name: 'step_wg_ratio', type: 'float' },
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1106 { name: 'ramp_time', type: 'float' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1107 { name: 'end_temp', type: 'float' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1108 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1109 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1110 mashAdapter = new $.jqx.dataAdapter(mashSource, {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1111 beforeLoadComplete: function(records) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1112 mash_infuse = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1113 var row, i, data = new Array();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1114 for (i = 0; i < records.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1115 row = records[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1116 if (row.step_type == 0) // Infusion
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1117 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
1118 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
1119 data.push(row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1120 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1121 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1122 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1123 $('#mashGrid').jqxGrid({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1124 width: 1240,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1125 height: 400,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1126 source: mashAdapter,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1127 theme: theme,
808
f6dcde592a7b Phase 5, ,ash tab is a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 807
diff changeset
1128 editable: false,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1129 ready: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1130 calcFermentables();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1131 calcInit();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1132 calcMash();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1133 $('#jqxLoader').jqxLoader('close');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1134 $('#jqxTabs').jqxTabs('first');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1135 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1136 columns: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1137 { text: 'Stap naam', datafield: 'step_name' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1138 { text: 'Stap type', datafield: 'step_type', width: 175,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1139 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1140 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
1141 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1142 },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1143 { 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
1144 { 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
1145 { 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
1146 { 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
1147 { 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
1148 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
1149 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
1150 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
1151 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
1152 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1153 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1154 { 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
1155 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
1156 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
1157 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
1158 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
1159 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1160 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1161 { 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
1162 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
1163 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
1164 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
1165 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
1166 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
1167 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1168 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1169 ]
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1170 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1171 };
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
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 * 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
1176 */
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1177 $('#jqxMenu').jqxMenu('destroy');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1178
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1179 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
1180 $('#jqxLoader').jqxLoader({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1181 width: 250,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1182 height: 150,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1183 isModal: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1184 text: 'Laden recept ...',
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1185 theme: theme
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1186 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1187
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1188 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
1189
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1190 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
1191 if (amount == 0) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1192 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1193 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1194 if (row.m_name == name) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1195 id = $('#miscGrid').jqxGrid('getrowid', i);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1196 $('#miscGrid').jqxGrid('deleterow', id);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1197 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1198 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1199 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1200 for (i = 0; i < rows.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1201 row = rows[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1202 if (row.m_name == name) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1203 found = true;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1204 $('#miscGrid').jqxGrid('setcellvalue', i, 'm_amount', amount / 1000);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1205 break;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1206 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1207 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1208 if (! found) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1209 miscs = new $.jqx.dataAdapter(miscInvSource, {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1210 loadComplete: function() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1211 records = miscs.records;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1212 for (i = 0; i < records.length; i++) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1213 record = records[i];
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1214 if (record.name == name) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1215 row = {};
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1216 row['m_name'] = record.name;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1217 row['m_amount'] = amount / 1000;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1218 row['m_cost'] = record.cost;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1219 row['m_type'] = record.type;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1220 row['m_use_use'] = record.use_use;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1221 row['m_time'] = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1222 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
1223 row['m_inventory'] = record.inventory;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1224 row['m_avail'] = 1;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1225 $('#miscGrid').jqxGrid('addrow', null, row);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1226 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1227 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1228 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1229 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1230 miscs.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1231 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1232 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1233 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1234 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1235
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1236
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1237 // Procedure TFrmWaterAdjustment.CalcWater2;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1238 function calcWater() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1239
643
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
1240 if (! data_loaded) {
648
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
1241 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
1242 return;
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
1243 }
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
1244
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1245 var liters = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1246 calcium = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1247 magnesium = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1248 sodium = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1249 total_alkalinity = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1250 bicarbonate = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1251 chloride = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1252 sulfate = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1253 ph = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1254 RA = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1255 frac = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1256 TpH = 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1257 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
1258 AT, BT,
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1259 r1d, r2d, f1d, f2d, f3d,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1260 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
1261 Res;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1262
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1263 if (dataRecord.w1_name == '') {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1264 return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1265 }
271
af0270694d1e Save data before printing or export to beerxml
Michiel Broek <mbroek@mbse.eu>
parents: 267
diff changeset
1266
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1267 $('#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
1268 $('#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
1269
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1270 // 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
1271 if (dataRecord.w2_name != '') {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1272 liters = dataRecord.w1_amount + dataRecord.w2_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1273 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
1274 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
1275 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
1276 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
1277 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
1278 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
1279 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
1280 $('#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
1281 $('#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
1282 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1283 liters = dataRecord.w1_amount;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1284 calcium = dataRecord.w1_calcium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1285 magnesium = dataRecord.w1_magnesium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1286 sodium = dataRecord.w1_sodium;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1287 chloride = dataRecord.w1_chloride;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1288 sulfate = dataRecord.w1_sulfate;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1289 total_alkalinity = dataRecord.w1_total_alkalinity;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1290 ph = dataRecord.w1_ph;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1291 }
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1292 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
1293
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1294 /* 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
1295 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
1296 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
1297 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
1298 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
1299 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
1300 var wg_bicarbonate = bicarbonate;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1301
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1302 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
1303 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
1304
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
1305 $('#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
1306 $('#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
1307 $('#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
1308 $('#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
1309 $('#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
1310 $('#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
1311 $('#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
1312 $('#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
1313 $('#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
1314 $('#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
1315 $('#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
1316
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
1317 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
1318 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
1319
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
1320 /* 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
1321 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
1322 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
1323 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
1324 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
1325 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
1326 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
1327 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
1328 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
1329 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
1330 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
1331 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
1332 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
1333 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
1334 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
1335 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
1336 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1337
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
1338 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
1339 $('#wa_acid_name').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1340 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
1341 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
1342 $('#wa_acid_perc').val(AcidTypeData[0].AcidPrc);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1343 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1344 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
1345 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
1346
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
1347 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
1348 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
1349 $('#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
1350 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
1351
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1352 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
1353
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
1354 /* 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
1355 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
1356
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1357 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
1358 $('.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
1359 /* Auto calculate pH */
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1360 TpH = parseFloat(dataRecord.mash_ph);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1361 protonDeficit = ProtonDeficit(TpH);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1362 console.log('calc_acid tgt: ' + TpH + ' protonDeficit: ' + protonDeficit);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1363 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
1364 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
1365 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
1366 Acid *= AcidTypeData[AT].MolWt; // mg
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1367 Acidmg = Acid;
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1368 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
1369 Acid /= RealSG;
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1370 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
1371 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
1372 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
1373 $('#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
1374 setWaterAgent(AcidTypeData[AT].nl, Acid);
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1375
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1376 bicarbonate = bicarbonate - protonDeficit * frac / liters;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1377 total_alkalinity = bicarbonate * 50 / 61;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1378 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1379 ph = TpH;
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1380 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
1381 $('#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
1382 $('#est_mash_ph').val(Round(ph, 2));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1383 } 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
1384 /* 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
1385 $('.c_mashph').hide();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1386 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
1387 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
1388 // 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
1389 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
1390 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
1391 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
1392 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
1393 Acidmg = Acid;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1394
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
1395 //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
1396 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
1397 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
1398 //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
1399
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
1400 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
1401 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
1402 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
1403 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
1404 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
1405 n++;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1406 if (pd < (protonDeficit - deltapd))
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1407 pHa -= deltapH;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1408 else if (pd > (protonDeficit + deltapd))
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1409 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
1410 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
1411 protonDeficit = Acid * frac;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1412 pd = ProtonDeficit(pHa);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1413 }
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
1414 //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
1415 bicarbonate = wg_bicarbonate - protonDeficit * frac / liters;
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 815
diff changeset
1416 total_alkalinity = bicarbonate * 50 / 61;
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
1417 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
1418 $('#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
1419 $('#est_mash_ph').val(Round(ph, 2));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1420 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1421
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1422 if ((AT == 3) && (liters > 0)) { // Sulfuctic / Zwavelzuur
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1423 RA = parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1424 parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1425 Acidmg / 1000 * MMSO4 / (MMSO4 + 2);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1426 RA = 1000 * RA / liters;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1427 sulfate = wg_sulfate + RA; // Not add to sulfate??
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1428 } else if ((AT == 1) && (liters > 0)) { // Hydrochloric, Zoutzuur
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1429 RA = parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1430 parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl +
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1431 Acidmg / 1000 * MMCl / (MMCl + 1);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1432 RA = 1000 * RA / liters;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1433 chloride = wg_chloride + RA;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1434 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1435
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
1436 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
1437 $('#tgt_bu').val(Round(BUGU, 2));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1438 // 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
1439 if (BUGU < 0.32)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1440 $('#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
1441 else if (BUGU < 0.43)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1442 $('#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
1443 else if (BUGU < 0.52)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1444 $('#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
1445 else if (BUGU < 0.63)
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1446 $('#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
1447 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1448 $('#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
1449
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 549
diff changeset
1450 // 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
1451 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
1452 $('#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
1453 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
1454 $('#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
1455 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
1456 $('#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
1457 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
1458 $('#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
1459 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
1460 $('#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
1461 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
1462 $('#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
1463 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
1464 $('#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
1465 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
1466 $('#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
1467 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
1468 $('#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
1469 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
1470 RA = sulfate / chloride;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1471 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1472 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
1473 $('#got_so4_cl').val(Round(RA, 1));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1474 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
1475 if (RA < (0.8 * OptSO4Clratio))
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1476 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
1477 else if (RA > (1.2 * OptSO4Clratio))
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1478 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
1479 setRangeIndicator('so4_cl', Res);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1480
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1481 $('#wb_calcium').val(Round(calcium, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1482 $('#wb_magnesium').val(Round(magnesium, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1483 $('#wb_sodium').val(Round(sodium, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1484 $('#wb_sulfate').val(Round(sulfate, 1));
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1485 $('#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
1486 $('#wb_bicarbonate').val(Round(bicarbonate, 1));
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1487 $('#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
1488 $('#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
1489 $('#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
1490
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1491 if (calcium < 40) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1492 setRangeIndicator('calcium', 'laag');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1493 } else if (calcium > 150) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1494 setRangeIndicator('calcium', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1495 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1496 setRangeIndicator('calcium', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1497 }
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
1498 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
1499 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
1500 } 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
1501 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
1502 } else {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1503 setRangeIndicator('magnesium', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1504 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1505 if (sodium <= 150) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1506 setRangeIndicator('sodium', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1507 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1508 setRangeIndicator('sodium', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1509 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1510 // 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
1511 // 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
1512 if (chloride <= 50) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1513 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
1514 } else if (chloride <= 150) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1515 setRangeIndicator('chloride', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1516 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1517 setRangeIndicator('chloride', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1518 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1519 if (sulfate <= 50) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1520 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
1521 } else if (sulfate <= 400) {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1522 setRangeIndicator('sulfate', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1523 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1524 setRangeIndicator('sulfate', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1525 }
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
1526 // (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
1527 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
1528 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
1529 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
1530 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1531 if (ph < 5.2) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1532 setRangeIndicator('ph', 'laag');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1533 } else if (ph > 5.6) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1534 setRangeIndicator('ph', 'hoog');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1535 } else {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1536 setRangeIndicator('ph', 'normaal');
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1537 }
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
1538 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
1539 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
1540 } 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
1541 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
1542 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1543 calcSparge();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1544 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1545
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
1546
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1547 function calcSparge() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1548
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
1549 /* 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
1550 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
1551 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
1552 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
1553 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
1554
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1555 // 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
1556 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
1557 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
1558 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
1559 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
1560 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
1561 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
1562 ws_sulfate = dataRecord.w2_sulfate;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1563 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
1564 $('#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
1565 } 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
1566 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
1567 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
1568 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
1569 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
1570 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
1571 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
1572 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
1573 $('#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
1574 } else {
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1575 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
1576 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
1577 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
1578 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
1579 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
1580 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
1581 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
1582 $('#w1_button').jqxRadioButton({ checked: true });
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
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1585 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
1586 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
1587 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
1588 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
1589 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
1590 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
1591 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
1592 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
1593 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
1594 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
1595 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
1596 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1597
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1598 /* 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
1599 $('#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
1600 $('#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
1601 $('#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
1602 $('#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
1603 $('#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
1604 $('#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
1605 $('#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
1606 $('#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
1607 $('#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
1608 $('#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
1609
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1610 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
1611 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
1612 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
1613 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
1614 $('#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
1615 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
1616 $('#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
1617 }
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1618
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1619 /*
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1620 * 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
1621 */
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1622 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
1623 // 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
1624 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
1625 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
1626 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
1627 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
1628 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
1629
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1630 //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
1631 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
1632 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
1633 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
1634 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
1635 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
1636
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1637 //Step 4. Solve
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1638 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
1639
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1640 //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
1641 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
1642 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
1643 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
1644 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
1645 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
1646
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1647 //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
1648 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
1649 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
1650
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1651 //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
1652 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
1653
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1654 //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
1655 Acid /= fract;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1656
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1657 //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
1658 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
1659
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1660 //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
1661 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
1662 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
1663 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
1664 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
1665 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
1666 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
1667 $('#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
1668 }
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1669
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1670 // 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
1671 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
1672 (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
1673 $('#preboil_ph').val(ph);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1674 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1675
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1676 function calcInit() {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1677 console.log('calc.init()');
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1678
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
1679 calcWater();
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1680 $('#w1_name').jqxDropDownList('selectItem', dataRecord.w1_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1681 $('#w2_name').jqxDropDownList('selectItem', dataRecord.w2_name);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1682 // 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
1683 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
1684 $('#w1_amount').val(mash_infuse);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1685 dataRecord.w1_amount = mash_infuse;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1686 $('#wg_amount').val(mash_infuse);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1687 $('#w2_amount').val(0);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1688 dataRecord.w2_amount = 0;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1689 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1690 calcWater();
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1691
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1692 };
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1693
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 474
diff changeset
1694 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
1695 window.location.href = my_return;
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1696 };
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1697
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1698 dataAdapter.dataBind();
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1699
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1700 // initialize the input fields.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1701 // Tab 1, Algemeen
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1702 $('#name').jqxTooltip({ content: 'De naam voor dit recept.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1703 $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1704 $('#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
1705 $('#notes').jqxInput({ theme: theme, width: 960, height: 200 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1706 $('#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
1707 $('#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
1708 $('#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
1709 $('#efficiency').jqxNumberInput(Show1dec);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1710 $('#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
1711 $('#batch_size').jqxNumberInput(Show1dec);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1712 $('#batch_size').jqxNumberInput({ min: 4 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1713 $('#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
1714 $('#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
1715 $('#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
1716 $('#boil_time').jqxNumberInput(Show0dec);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1717 $('#boil_time').jqxNumberInput({ min: 4, max: 360 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1718
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1719 $('#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
1720 $('#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
1721 $('#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
1722 $('#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
1723 $('#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
1724 $('#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
1725 $('#st_category').jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1726 $('#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
1727 $('#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
1728 $('#st_category_number').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1729 $('#st_type').jqxTooltip({ content: 'Het bierstijl type.'});
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1730 $('#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
1731
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1732 $('#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
1733 $('#est_og').jqxNumberInput(Show3dec);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1734 $('#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
1735 $('#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
1736 $('#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
1737 $('#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
1738
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1739 $('#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
1740 $('#est_fg').jqxNumberInput(Show3dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1741 $('#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
1742 $('#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
1743 $('#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
1744 $('#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
1745
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1746 $('#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
1747 $('#est_abv').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1748 $('#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
1749 $('#st_abv_min').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1750 $('#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
1751 $('#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
1752
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1753 $('#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
1754 $('#est_color').jqxNumberInput(Show0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1755 $('#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
1756 $('#st_color_min').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1757 $('#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
1758 $('#st_color_max').jqxNumberInput(Smal0dec);
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
1759 $('#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
1760 $('#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
1761 $('#est_ibu').jqxNumberInput(Show0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1762 $('#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
1763 $('#st_ibu_min').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1764 $('#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
1765 $('#st_ibu_max').jqxNumberInput(Smal0dec);
804
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
1766
ac5c3e97fcf1 Phase 1, rebuild recipe editor to a vieuwer.
Michiel Broek <mbroek@mbse.eu>
parents: 777
diff changeset
1767 $('#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
1768 $('#kcal').jqxTooltip({ content: 'Energie-inhoud in kcal/liter.' });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1769 $('#kcal').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1770 $('#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
1771 $('#est_carb').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1772 $('#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
1773 $('#st_carb_min').jqxNumberInput(Smal1dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1774 $('#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
1775 $('#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
1776
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1777 // Tab 2, Vergistbaar
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1778 $('#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
1779 $('#est_color2').jqxNumberInput(Show0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1780 $('#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
1781 $('#est_og2').jqxNumberInput(Show3dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1782 $('#perc_malts').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1783 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1784 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1785 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1786 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1787 max: 120,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1788 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1789 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1790 { stop: 90, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1791 { stop: 100, color: '#EB7331' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1792 { stop: 120, color: '#FF0000' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1793 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1794 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1795 return (Math.round(parseInt(text) * 1.2)) + '%';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1796 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1797 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1798 $('#perc_sugars').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1799 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1800 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1801 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1802 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1803 max: 50,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1804 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1805 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1806 { stop: 20, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1807 { stop: 50, color: '#FF0000' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1808 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1809 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1810 return (Math.round(parseInt(text) * 5) / 10) + '%';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1811 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1812 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1813 $('#perc_cara').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1814 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1815 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1816 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1817 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1818 max: 50,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1819 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1820 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1821 { stop: 25, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1822 { stop: 50, color: '#FF0000' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1823 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1824 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1825 return (Math.round(parseInt(text) * 5) / 10) + '%';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1826 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1827 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1828 $('#ferm_lintner').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1829 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1830 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1831 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1832 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1833 max: 200,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1834 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1835 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1836 { stop: 30, color: '#FF0000' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1837 { stop: 40, color: '#EB7331' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1838 { stop: 200, color: '#008C00' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1839 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1840 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1841 return (parseInt(text) * 2) + ' lintner';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1842 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1843 });
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
1844
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1845 // Tab 3, Hoppen
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1846 $('#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
1847 $('#est_ibu2').jqxNumberInput(Smal0dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1848 $('#hop_flavour').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1849 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1850 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1851 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1852 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1853 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1854 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1855 { stop: 20, color: '#004D00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1856 { stop: 40, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1857 { stop: 60, color: '#00BF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1858 { stop: 80, color: '#00FF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1859 { stop: 100, color: '#80FF80' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1860 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1861 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1862 var val = parseInt(text);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1863 if (val < 20)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1864 return 'Weinig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1865 else if (val < 40)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1866 return 'Matig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1867 else if (val < 60)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1868 return 'Redelijk';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1869 else if (val < 80)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1870 return 'Veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1871 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1872 return 'Zeer veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1873 }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1874 });
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1875 $('#hop_aroma').jqxProgressBar({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1876 width: 300,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1877 height: 23,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1878 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1879 showText: true,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1880 animationDuration: 0,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1881 colorRanges: [
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1882 { stop: 20, color: '#004D00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1883 { stop: 40, color: '#008C00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1884 { stop: 60, color: '#00BF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1885 { stop: 80, color: '#00FF00' },
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1886 { stop: 100, color: '#80FF80' }
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1887 ],
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1888 renderText: function(text) {
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1889 var val = parseInt(text);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1890 if (val < 20)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1891 return 'Weinig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1892 else if (val < 40)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1893 return 'Matig';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1894 else if (val < 60)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1895 return 'Redelijk';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1896 else if (val < 80)
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1897 return 'Veel';
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1898 else
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1899 return 'Zeer veel';
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 });
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
1902
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1903 // 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
1904
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1905 // Tab 5, Gist
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1906 $('#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
1907 $('#est_fg2').jqxNumberInput(Show3dec);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1908 $('#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
1909 $('#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
1910
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1911 // Tab 6, Maischen
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1912 $('#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
1913
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1914 // Tab 7, Water
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1915 $('#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
1916 $('#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
1917 $('#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
1918
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1919 // 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
1920 $('#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
1921 $('#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
1922 $('#w1_amount').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1923 $('#w1_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1924 $('#w1_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1925 $('#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
1926 $('#w1_bicarbonate').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1927 $('#w1_total_alkalinity').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1928 $('#w1_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1929 $('#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
1930 $('#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
1931 $('#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
1932 $('#w1_ra').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1933 // 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
1934 $('#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
1935 $('#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
1936 $('#w2_amount').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1937 $('#w2_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1938 $('#w2_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1939 $('#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
1940 $('#w2_bicarbonate').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1941 $('#w2_total_alkalinity').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1942 $('#w2_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1943 $('#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
1944 $('#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
1945 $('#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
1946 $('#w2_ra').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1947 // Water mixed
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1948 $('#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
1949 $('#wg_amount').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1950 $('#wg_calcium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1951 $('#wg_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1952 $('#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
1953 $('#wg_bicarbonate').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1954 $('#wg_total_alkalinity').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1955 $('#wg_chloride').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1956 $('#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
1957 $('#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
1958 $('#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
1959 $('#wg_ra').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1960 // Water treated
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1961 $('#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
1962 $('#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
1963 $('#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
1964 $('#wb_magnesium').jqxNumberInput(Show1wat);
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1965 $('#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
1966 $('#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
1967 $('#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
1968 $('#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
1969 $('#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
1970 $('#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
1971 $('#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
1972 $('#wb_bicarbonate').jqxNumberInput(Show1wat);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1973 $('#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
1974 $('#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
1975 $('#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
1976 $('#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
1977 // Sparge water
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1978 $('#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
1979 $('#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
1980 $('#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
1981 $('#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
1982 $('#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
1983 $('#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
1984 $('#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
1985 $('#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
1986 $('#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
1987 $('#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
1988 $('#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
1989
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1990 // Water agents
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
1991 $('#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
1992 $('#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
1993 $('#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
1994
524
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
1995 $('#wa_caso4').jqxTooltip({
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
1996 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
1997 });
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
1998 $('#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
1999 $('#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
2000
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2001 $('#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
2002 $('#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
2003 $('#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
2004
524
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
2005 $('#wa_nacl').jqxTooltip({
55a246085522 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
2006 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
2007 '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
2008 });
810
1f2ca835fe9d The last part to make a vieuwer from the recipe editor.
Michiel Broek <mbroek@mbse.eu>
parents: 809
diff changeset
2009 $('#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
2010 $('#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
2011
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
2012 $('#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
2013 $('#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
2014 $('#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
2015
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
2016 $('#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
2017 $('#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
2018 $('#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
2019
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2020 $('#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
2021 $('#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
2022
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2023 $('#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
2024
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2025 $('#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
2026 $('#wa_acid').jqxNumberInput(Show2dec);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2027 $('#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
2028 $('#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
2029 $('#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
2030
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2031 // Sparge water
809
8b30068497a9 Phase 6, most of the water tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 808
diff changeset
2032 $('#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
2033 $('#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
2034 $('#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
2035 $('#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
2036 $('#sparge_acid_perc').jqxNumberInput(Show0dec);
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2037 $('#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
2038
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2039 // Tabs inside the popup window.
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2040 $('#jqxTabs').jqxTabs({
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2041 theme: theme,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2042 width: 1280,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2043 height: 660,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2044 autoHeight: false,
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2045 position: 'top'
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2046 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2047
814
de4a74899969 Just one button to close the viewer
Michiel Broek <mbroek@mbse.eu>
parents: 811
diff changeset
2048 // Button below
de4a74899969 Just one button to close the viewer
Michiel Broek <mbroek@mbse.eu>
parents: 811
diff changeset
2049 $('#Terug').jqxButton({ template: 'primary', width: '80px', theme: theme });
de4a74899969 Just one button to close the viewer
Michiel Broek <mbroek@mbse.eu>
parents: 811
diff changeset
2050 $('#Terug').bind('click', function() {
474
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2051 window.location.href = my_return;
7b7df475e67d Code check and cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 428
diff changeset
2052 });
68
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2053
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2054 });
2ff83855d574 Added recipe editor screen
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2055

mercurial