www/js/prod_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 842
897bf2a43253
permissions
-rw-r--r--

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

741
4ec5de404bc1 Screwed the script
Michiel Broek <mbroek@mbse.eu>
parents: 740
diff changeset
1 /*****************************************************************************
842
897bf2a43253 Renamed trub_chiller_loss to trub_loss fields.
Michiel Broek <mbroek@mbse.eu>
parents: 841
diff changeset
2 * Copyright (C) 2018-2023
111
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of BMS
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * BrewCloud is distributed in the hope that it will be useful, but
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
752
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
24 function block_fermentable(stage, added) {
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
25 if (stage > 5 && added < 4) // After fermentation and added before packaging
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
26 return true;
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
27 if (stage > 3 && added < 3) // After primary and added before sec/tert
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
28 return true;
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
29 if (stage > 2 && added < 2) // After boil and added during mash or boil
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
30 return true;
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
31 return false;
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
32 }
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
33
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
34 function block_hop(stage, useat)
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
35 {
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
36 if (stage > 2 && useat < 5)
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
37 return true;
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
38 return false;
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
39 }
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
40
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
41 function block_misc(stage, use_use) {
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
42 if (stage > 5 && use_use < 5)
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
43 return true;
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
44 if (stage > 3 && use_use < 4)
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
45 return true;
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
46 if (stage > 2 && use_use < 3)
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
47 return true;
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
48 if (stage > 1 && use_use < 1)
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
49 return true;
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
50 return false;
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
51 }
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
52
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
53 function block_yeast(stage, use) {
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
54 if (stage > 3 && use < 1)
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
55 return true;
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
56 if (stage > 4 && use < 2)
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
57 return true;
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
58 if (stage > 5 && use < 3)
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
59 return true;
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
60 if (stage > 6 && use < 4)
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
61 return true;
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
62 return false;
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
63 }
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
64
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
65
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
66 $(document).ready(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
67
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
68 var i,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
69 to_100 = false, // Fermentables adjust to 100%
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
70 preboil_sg = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
71 aboil_sg = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
72 est_mash_sg = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
73 psugar = 0, // Percentage real sugars
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
74 pcara = 0, // Percentage cara/crystal malts
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
75 svg = 77, // Default attenuation
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
76 mashkg = 0, // Malt in mash weight
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
77 initcells = 0, // Initial yeast cell count
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
78
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
79 ok_fermentables = 1, // Fermentables are in stock
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
80 ok_hops = 1, // Hops are in stock
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
81 ok_miscs = 1, // Miscs are in stock
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
82 ok_yeasts = 1, // Yeasts are in stock
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
83 ok_waters = 1, // Waters are in stock
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
84
643
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
85 data_loaded = 0;
642
9d1af81b20ef Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 641
diff changeset
86 error_count = 0;
646
2246d830a42a Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents: 644
diff changeset
87 k_cm = 0;
2246d830a42a Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents: 644
diff changeset
88 k_vol = 0;
2246d830a42a Fixed some html errors. Added volume calculations for the brewday tab using a popup tool.
Michiel Broek <mbroek@mbse.eu>
parents: 644
diff changeset
89 k_what = 0;
642
9d1af81b20ef Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 641
diff changeset
90
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
91 hop_flavour = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
92 hop_aroma = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
93 mash_infuse = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
94 last_acid = '',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
95
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
96 MMCa = 40.048,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
97 MMMg = 24.305,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
98 MMNa = 22.98976928,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
99 MMCl = 35.453,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
100 MMSO4 = 96.0626,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
101 MMHCO3 = 61.01684,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
102 MMCaSO4 = 172.171,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
103 MMCaCl2 = 147.015,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
104 MMCaCO3 = 100.087,
759
89bcab49284a Added MgCl2 brewing salt
Michiel Broek <mbroek@mbse.eu>
parents: 758
diff changeset
105 MMMgCl2 = 95.211, /* Since 27-06-2021 */
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
106 MMMgSO4 = 246.475,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
107 MMNaHCO3 = 84.007,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
108 MMNa2CO3 = 105.996,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
109 MMNaCl = 58.443,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
110 MMCaOH2 = 74.06268,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
111
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
112 fermentableRow = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
113 fermentableData = {},
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
114 fermentableInit = 1,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
115 hopRow = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
116 hopData = {},
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
117 miscRow = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
118 miscData = {},
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
119 yeastRow = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
120 yeastData = {},
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
121 mashRow = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
122 mashData = {},
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
123 Ka1 = 0.0000004445,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
124 Ka2 = 0.0000000000468,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
125 dataRecord = {},
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
126 url = 'includes/db_product.php',
484
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
127 MaltVolume = 0.87, // l/kg 0.688 volgens internetbronnen, gemeten 0.874 l/kg, na enige tijd maischen 0,715 l/kg (A3 Otten).
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
128 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
129 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
130 SlakingHeat = 10.318, //cal/g.°C
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
131
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
132 // Prepare the data
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
133 source = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
134 datatype: 'json',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
135 cache: false,
638
736c8d29bc87 Binding the data earlier to try to prevent a race condition.
Michiel Broek <mbroek@mbse.eu>
parents: 637
diff changeset
136 async: true,
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
137 datafields: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
138 // From prod_main
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
139 { name: 'record', type: 'number' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
140 { name: 'uuid', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
141 { name: 'name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
142 { name: 'code', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
143 { name: 'birth', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
144 { name: 'stage', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
145 { name: 'notes', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
146 { name: 'log_brew', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
147 { name: 'log_fermentation', type: 'int' },
602
10b61aacb1c1 New products field log_ispindel. Add check for ispindel log to crontasks.php Added log_ispindel to prod_edit, pprod_divide, prod_new and prod_duplicate. Renamed some log_fermentation vergisting names into klimaatkast.
Michiel Broek <mbroek@mbse.eu>
parents: 586
diff changeset
148 { name: 'log_ispindel', type: 'int' },
615
9034e65b0d7a Added CO2 carbonation log to the products database. Added button in the packaging tab.
Michiel Broek <mbroek@mbse.eu>
parents: 613
diff changeset
149 { name: 'log_co2pressure', type: 'int' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
150 { name: 'inventory_reduced', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
151 { name: 'locked', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
152 { name: 'eq_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
153 { name: 'eq_boil_size', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
154 { name: 'eq_batch_size', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
155 { name: 'eq_tun_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
156 { name: 'eq_tun_weight', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
157 { name: 'eq_tun_specific_heat', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
158 { name: 'eq_tun_material', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
159 { name: 'eq_tun_height', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
160 { name: 'eq_top_up_water', type: 'float' },
842
897bf2a43253 Renamed trub_chiller_loss to trub_loss fields.
Michiel Broek <mbroek@mbse.eu>
parents: 841
diff changeset
161 { name: 'eq_trub_loss', type: 'float' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
162 { name: 'eq_evap_rate', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
163 { name: 'eq_boil_time', type: 'float' },
841
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
164 { name: 'xeq_calc_boil_volume', type: 'int' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
165 { name: 'eq_top_up_kettle', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
166 { name: 'eq_notes', type: 'string' },
841
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
167 { name: 'xeq_lauter_volume', type: 'float' },
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
168 { name: 'xeq_lauter_height', type: 'float' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
169 { name: 'eq_lauter_deadspace', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
170 { name: 'eq_kettle_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
171 { name: 'eq_kettle_height', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
172 { name: 'eq_mash_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
173 { name: 'eq_mash_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
174 { name: 'eq_efficiency', type: 'float' },
841
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
175 { name: 'eq_chiller_type', type: 'int' },
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
176 { name: 'eq_chiller_to79', type: 'float' },
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
177 { name: 'eq_chiller_volume', type: 'float' },
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
178 { name: 'eq_chiller_lpm', type: 'float' },
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
179 { name: 'eq_chiller_loss', type: 'float' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
180 { name: 'brew_date_start', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
181 { name: 'brew_mash_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
182 { name: 'brew_mash_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
183 { name: 'brew_mash_efficiency', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
184 { name: 'brew_sparge_est', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
185 { name: 'brew_sparge_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
186 { name: 'brew_preboil_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
187 { name: 'brew_preboil_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
188 { name: 'brew_preboil_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
189 { name: 'brew_preboil_efficiency', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
190 { name: 'brew_aboil_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
191 { name: 'brew_aboil_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
192 { name: 'brew_aboil_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
193 { name: 'brew_aboil_efficiency', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
194 { name: 'brew_cooling_method', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
195 { name: 'brew_cooling_time', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
196 { name: 'brew_cooling_to', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
197 { name: 'brew_whirlpool9', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
198 { name: 'brew_whirlpool7', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
199 { name: 'brew_whirlpool6', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
200 { name: 'brew_whirlpool2', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
201 { name: 'brew_fermenter_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
202 { name: 'brew_fermenter_extrawater', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
203 { name: 'brew_fermenter_tcloss', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
204 { name: 'brew_aeration_time', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
205 { name: 'brew_aeration_speed', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
206 { name: 'brew_aeration_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
207 { name: 'brew_fermenter_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
208 { name: 'brew_fermenter_ibu', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
209 { name: 'brew_fermenter_color', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
210 { name: 'brew_date_end', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
211 { name: 'og', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
212 { name: 'fg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
213 { name: 'primary_start_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
214 { name: 'primary_max_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
215 { name: 'primary_end_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
216 { name: 'primary_end_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
217 { name: 'primary_end_date', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
218 { name: 'secondary_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
219 { name: 'secondary_end_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
220 { name: 'secondary_end_date', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
221 { name: 'tertiary_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
222 { name: 'package_date', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
223 { name: 'package_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
224 { name: 'package_infuse_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
225 { name: 'package_infuse_abv', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
226 { name: 'package_infuse_notes', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
227 { name: 'package_abv', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
228 { name: 'package_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
229 { name: 'bottle_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
230 { name: 'bottle_carbonation', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
231 { name: 'bottle_priming_water', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
232 { name: 'bottle_priming_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
233 { name: 'bottle_carbonation_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
234 { name: 'keg_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
235 { name: 'keg_carbonation', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
236 { name: 'keg_priming_water', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
237 { name: 'keg_priming_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
238 { name: 'keg_carbonation_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
239 { name: 'keg_forced_carb', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
240 { name: 'keg_pressure', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
241 { name: 'taste_notes', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
242 { name: 'taste_rate', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
243 { name: 'taste_date', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
244 { name: 'taste_color', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
245 { name: 'taste_transparency', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
246 { name: 'taste_head', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
247 { name: 'taste_aroma', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
248 { name: 'taste_taste', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
249 { name: 'taste_mouthfeel', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
250 { name: 'taste_aftertaste', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
251 { name: 'st_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
252 { name: 'st_letter', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
253 { name: 'st_guide', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
254 { name: 'st_category', type: 'string' },
706
12f9316de113 Less logging in the db_product interface. Fixed some empty default values that bugged the newer php and mariadb versions.
Michiel Broek <mbroek@mbse.eu>
parents: 697
diff changeset
255 { name: 'st_category_number', type: 'int' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
256 { name: 'st_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
257 { name: 'st_og_min', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
258 { name: 'st_og_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
259 { name: 'st_fg_min', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
260 { name: 'st_fg_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
261 { name: 'st_ibu_min', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
262 { name: 'st_ibu_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
263 { name: 'st_color_min', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
264 { name: 'st_color_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
265 { name: 'st_carb_min', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
266 { name: 'st_carb_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
267 { name: 'st_abv_min', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
268 { name: 'st_abv_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
269 { name: 'type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
270 { name: 'batch_size', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
271 { name: 'boil_size', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
272 { name: 'boil_time', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
273 { name: 'efficiency', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
274 { name: 'est_og', type: 'float' },
616
2cbf21bb9bdc Added est_og3 field in the products database so that the checklist can use it.
Michiel Broek <mbroek@mbse.eu>
parents: 615
diff changeset
275 { name: 'est_og3', type: 'float' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
276 { name: 'est_fg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
277 { name: 'est_abv', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
278 { name: 'est_color', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
279 { name: 'color_method', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
280 { name: 'est_ibu', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
281 { name: 'ibu_method', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
282 { name: 'est_carb', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
283 { name: 'sparge_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
284 { name: 'sparge_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
285 { name: 'sparge_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
286 { name: 'sparge_source', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
287 { name: 'sparge_acid_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
288 { name: 'sparge_acid_perc', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
289 { name: 'sparge_acid_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
290 { name: 'mash_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
291 { name: 'mash_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
292 { name: 'calc_acid', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
293 { name: 'w1_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
294 { name: 'w1_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
295 { name: 'w1_calcium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
296 { name: 'w1_sulfate', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
297 { name: 'w1_chloride', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
298 { name: 'w1_sodium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
299 { name: 'w1_magnesium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
300 { name: 'w1_total_alkalinity', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
301 { name: 'w1_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
302 { name: 'w1_cost', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
303 { name: 'w2_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
304 { name: 'w2_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
305 { name: 'w2_calcium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
306 { name: 'w2_sulfate', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
307 { name: 'w2_chloride', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
308 { name: 'w2_sodium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
309 { name: 'w2_magnesium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
310 { name: 'w2_total_alkalinity', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
311 { name: 'w2_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
312 { name: 'w2_cost', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
313 { name: 'wg_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
314 { name: 'wg_calcium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
315 { name: 'wg_sulfate', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
316 { name: 'wg_chloride', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
317 { name: 'wg_sodium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
318 { name: 'wg_magnesium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
319 { name: 'wg_total_alkalinity', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
320 { name: 'wg_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
321 { name: 'wb_calcium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
322 { name: 'wb_sulfate', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
323 { name: 'wb_chloride', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
324 { name: 'wb_sodium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
325 { name: 'wb_magnesium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
326 { name: 'wb_total_alkalinity', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
327 { name: 'wb_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
328 { name: 'wa_acid_name', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
329 { name: 'wa_acid_perc', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
330 { name: 'wa_base_name', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
331 { name: 'starter_enable', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
332 { name: 'starter_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
333 { name: 'starter_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
334 { name: 'starter_viability', type: 'int' },
617
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
335 { name: 'yeast_prod_date', type: 'string' },
697
367ae7ff52f0 Version 0.3.34 Changed log messages in the daemon. Added yeast_pitchrate field to the product database. Added yeast pitchrate edit field to the yeast tab. Initial value is guessed. There is also a popup window for predefined values. An finally the value can be edited by the user. All popup windows are initialized together.
Michiel Broek <mbroek@mbse.eu>
parents: 669
diff changeset
336 { name: 'yeast_pitchrate', type: 'float' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
337 { name: 'prop1_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
338 { name: 'prop1_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
339 { name: 'prop2_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
340 { name: 'prop2_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
341 { name: 'prop3_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
342 { name: 'prop3_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
343 { name: 'prop4_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
344 { name: 'prop4_volume', type: 'float' },
497
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
345 { name: 'divide_type', type: 'int' },
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
346 { name: 'divide_size', type: 'float' },
533
be8691b7d634 Added the product divide scripts. All parts have all the volumes and weights divided, including the master record. Splitted batches have their own records with the product code formatted as code-n. From this design, we can rebuild the print and checklist.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
347 { name: 'divide_factor', type: 'float' },
497
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
348 { name: 'divide_parts', type: 'int' },
533
be8691b7d634 Added the product divide scripts. All parts have all the volumes and weights divided, including the master record. Splitted batches have their own records with the product code formatted as code-n. From this design, we can rebuild the print and checklist.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
349 { name: 'divide_part', type: 'int' },
774
92e1e8f175a2 Split batch, adjust mash step volume. In the duplicated log_brew handle the missing values. In save product, round the mash step sg to 4 decimals. In prod_edit, ingredients are stored as strings, not arrays. This triggered a memory corruption that only happened in rare circumstances. Don't fix mash step fields in the javascript, it is already done during load from the database. Calculation of the mash volume is rounded to 6 decimals. Enter mash step Brix/Plato value, the SG result is rounded to 4 decimals.
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
350 { name: 'fermentables', type: 'string' },
92e1e8f175a2 Split batch, adjust mash step volume. In the duplicated log_brew handle the missing values. In save product, round the mash step sg to 4 decimals. In prod_edit, ingredients are stored as strings, not arrays. This triggered a memory corruption that only happened in rare circumstances. Don't fix mash step fields in the javascript, it is already done during load from the database. Calculation of the mash volume is rounded to 6 decimals. Enter mash step Brix/Plato value, the SG result is rounded to 4 decimals.
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
351 { name: 'hops', type: 'string' },
92e1e8f175a2 Split batch, adjust mash step volume. In the duplicated log_brew handle the missing values. In save product, round the mash step sg to 4 decimals. In prod_edit, ingredients are stored as strings, not arrays. This triggered a memory corruption that only happened in rare circumstances. Don't fix mash step fields in the javascript, it is already done during load from the database. Calculation of the mash volume is rounded to 6 decimals. Enter mash step Brix/Plato value, the SG result is rounded to 4 decimals.
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
352 { name: 'miscs', type: 'string' },
92e1e8f175a2 Split batch, adjust mash step volume. In the duplicated log_brew handle the missing values. In save product, round the mash step sg to 4 decimals. In prod_edit, ingredients are stored as strings, not arrays. This triggered a memory corruption that only happened in rare circumstances. Don't fix mash step fields in the javascript, it is already done during load from the database. Calculation of the mash volume is rounded to 6 decimals. Enter mash step Brix/Plato value, the SG result is rounded to 4 decimals.
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
353 { name: 'yeasts', type: 'string' },
92e1e8f175a2 Split batch, adjust mash step volume. In the duplicated log_brew handle the missing values. In save product, round the mash step sg to 4 decimals. In prod_edit, ingredients are stored as strings, not arrays. This triggered a memory corruption that only happened in rare circumstances. Don't fix mash step fields in the javascript, it is already done during load from the database. Calculation of the mash volume is rounded to 6 decimals. Enter mash step Brix/Plato value, the SG result is rounded to 4 decimals.
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
354 { name: 'mashs', type: 'string' }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
355 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
356 id: 'record',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
357 url: url + '?record=' + my_record
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
358 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
359
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
360 // Load data and select one record.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
361 dataAdapter = new $.jqx.dataAdapter(source, {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
362 loadComplete: function() {
758
e6814bed4cb1 Moved NaHCO3 and CaCO3 from the base additions to the water agent salts.
Michiel Broek <mbroek@mbse.eu>
parents: 757
diff changeset
363 dataRecord = dataAdapter.records[0];
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
364 // Hidden record uuid
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
365 $('#name').val(dataRecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
366 $('#code').val(dataRecord.code);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
367 $('#birth').val(dataRecord.birth);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
368 $('#stage').val(StageData[dataRecord.stage].nl);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
369 $('#notes').val(dataRecord.notes);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
370 $('#locked').val(dataRecord.locked);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
371 $('#eq_name').val(dataRecord.eq_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
372 $('#eq_notes').val(dataRecord.eq_notes);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
373 $('#eq_boil_size').val(dataRecord.eq_boil_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
374 $('#eq_batch_size').val(dataRecord.eq_batch_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
375 $('#eq_tun_volume').val(dataRecord.eq_tun_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
376 $('#eq_top_up_water').val(dataRecord.eq_top_up_water);
842
897bf2a43253 Renamed trub_chiller_loss to trub_loss fields.
Michiel Broek <mbroek@mbse.eu>
parents: 841
diff changeset
377 $('#eq_trub_loss').val(dataRecord.eq_trub_loss);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
378 $('#eq_evap_rate').val(dataRecord.eq_evap_rate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
379 $('#eq_boil_time').val(dataRecord.eq_boil_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
380 $('#eq_top_up_kettle').val(dataRecord.eq_top_up_kettle);
841
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
381 // $('#eq_lauter_volume').val(dataRecord.eq_lauter_volume);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
382 $('#eq_lauter_deadspace').val(dataRecord.eq_lauter_deadspace);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
383 $('#eq_kettle_volume').val(dataRecord.eq_kettle_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
384 $('#eq_mash_volume').val(dataRecord.eq_mash_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
385 $('#eq_mash_max').val(dataRecord.eq_mash_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
386 $('#eq_efficiency').val(dataRecord.eq_efficiency);
841
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
387 $('#eq_chiller_type').val(CoolingTypeData[dataRecord.eq_chiller_type].nl);
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
388 $('#eq_chiller_to79').val(dataRecord.eq_chiller_to79);
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
389 $('#eq_chiller_volume').val(dataRecord.eq_chiller_volume);
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
390 $('#eq_chiller_lpm').val(dataRecord.eq_chiller_lpm);
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
391 $('#eq_chiller_loss').val(dataRecord.eq_chiller_loss);
842
897bf2a43253 Renamed trub_chiller_loss to trub_loss fields.
Michiel Broek <mbroek@mbse.eu>
parents: 841
diff changeset
392 $('#eq_fermenter_volume').val((dataRecord.eq_batch_size / 1.04) - dataRecord.eq_trub_loss - dataRecord.eq_chiller_loss );
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
393 // Brewdate
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
394 $('#brew_date_start').val(dataRecord.brew_date_start);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
395 $('#brew_mash_ph').val(dataRecord.brew_mash_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
396 $('#brew_mash_sg').val(dataRecord.brew_mash_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
397 $('#brew_mash_efficiency').val(dataRecord.brew_mash_efficiency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
398 // Header Spoelen en filteren
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
399 $('#brew_sparge_temperature').val(dataRecord.sparge_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
400 $('#brew_sparge_volume').val(dataRecord.sparge_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
401 $('#brew_sparge_est').val(dataRecord.brew_sparge_est);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
402 $('#brew_sparge_ph').val(dataRecord.brew_sparge_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
403 // Header Beluchten
826
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
404 $('#brew_aeration_type').val(AerationTypeData[dataRecord.brew_aeration_type].nl);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
405 $('#brew_aeration_time').val(dataRecord.brew_aeration_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
406 $('#brew_aeration_speed').val(dataRecord.brew_aeration_speed);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
407
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
408 $('#brew_preboil_ph').val(dataRecord.brew_preboil_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
409 $('#brew_preboil_sg').val(dataRecord.brew_preboil_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
410 $('#brew_preboil_volume').val(dataRecord.brew_preboil_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
411 $('#brew_preboil_efficiency').val(dataRecord.brew_preboil_efficiency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
412 // Header Koelen en whirlpoolen
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
413 $('#brew_whirlpool9').val(dataRecord.brew_whirlpool9);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
414 $('#brew_whirlpool7').val(dataRecord.brew_whirlpool7);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
415 $('#brew_whirlpool6').val(dataRecord.brew_whirlpool6);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
416 $('#brew_whirlpool2').val(dataRecord.brew_whirlpool2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
417 // Header Naar gistvat
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
418 $('#brew_fermenter_volume').val(dataRecord.brew_fermenter_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
419 $('#brew_fermenter_sg').val(dataRecord.brew_fermenter_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
420 $('#brew_fermenter_sg2').val(dataRecord.brew_fermenter_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
421 $('#brew_fermenter_ibu').val(dataRecord.brew_fermenter_ibu);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
422 $('#brew_fermenter_color').val(dataRecord.brew_fermenter_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
423 $('#brew_fermenter_extrawater').val(dataRecord.brew_fermenter_extrawater);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
424 $('#brew_fermenter_tcloss').val(dataRecord.brew_fermenter_tcloss);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
425
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
426 $('#brew_aboil_ph').val(dataRecord.brew_aboil_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
427 $('#brew_aboil_sg').val(dataRecord.brew_aboil_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
428 $('#brew_aboil_volume').val(dataRecord.brew_aboil_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
429 $('#brew_aboil_efficiency').val(dataRecord.brew_aboil_efficiency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
430 // Header Koelen en whirlpoolen
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
431 $('#brew_cooling_to').val(dataRecord.brew_cooling_to);
826
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
432 $('#brew_cooling_method').val(CoolingTypeData[dataRecord.brew_cooling_method].nl);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
433 $('#brew_cooling_time').val(dataRecord.brew_cooling_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
434 // Niks
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
435 $('#brew_date_end').val(dataRecord.brew_date_end);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
436 $('#og').val(dataRecord.og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
437 $('#fg').val(dataRecord.fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
438 $('#primary_start_temp').val(dataRecord.primary_start_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
439 $('#primary_max_temp').val(dataRecord.primary_max_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
440 $('#primary_end_temp').val(dataRecord.primary_end_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
441 $('#primary_end_sg').val(dataRecord.primary_end_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
442 $('#primary_end_date').val(dataRecord.primary_end_date);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
443 $('#secondary_temp').val(dataRecord.secondary_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
444 $('#secondary_end_sg').val(dataRecord.secondary_end_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
445 $('#secondary_end_date').val(dataRecord.secondary_end_date);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
446 $('#tertiary_temp').val(dataRecord.tertiary_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
447 $('#package_date').val(dataRecord.package_date);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
448 $('#package_volume').val(dataRecord.package_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
449 $('#package_infuse_amount').val(dataRecord.package_infuse_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
450 $('#package_infuse_abv').val(dataRecord.package_infuse_abv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
451 $('#package_infuse_notes').val(dataRecord.package_infuse_notes);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
452 $('#package_abv').val(dataRecord.package_abv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
453 $('#package_ph').val(dataRecord.package_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
454 $('#bottle_amount').val(dataRecord.bottle_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
455 $('#bottle_carbonation').val(dataRecord.bottle_carbonation);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
456 $('#bottle_priming_water').val(dataRecord.bottle_priming_water);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
457 $('#bottle_priming_amount').val(dataRecord.bottle_priming_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
458 $('#bottle_carbonation_temp').val(dataRecord.bottle_carbonation_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
459 $('#keg_amount').val(dataRecord.keg_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
460 $('#keg_carbonation').val(dataRecord.keg_carbonation);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
461 $('#keg_priming_water').val(dataRecord.keg_priming_water);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
462 $('#keg_priming_amount').val(dataRecord.keg_priming_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
463 $('#keg_carbonation_temp').val(dataRecord.keg_carbonation_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
464 $('#keg_forced_carb').val(dataRecord.keg_forced_carb);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
465 $('#keg_pressure').val(dataRecord.keg_pressure);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
466 $('#taste_notes').val(dataRecord.taste_notes);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
467 $('#taste_rate').val(dataRecord.taste_rate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
468 $('#taste_date').val(dataRecord.taste_date);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
469 $('#taste_color').val(dataRecord.taste_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
470 $('#taste_transparency').val(dataRecord.taste_transparency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
471 $('#taste_head').val(dataRecord.taste_head);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
472 $('#taste_aroma').val(dataRecord.taste_aroma);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
473 $('#taste_taste').val(dataRecord.taste_taste);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
474 $('#taste_mouthfeel').val(dataRecord.taste_mouthfeel);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
475 $('#taste_aftertaste').val(dataRecord.taste_aftertaste);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
476
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
477 // Recipe
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
478 $('#st_name').val(dataRecord.st_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
479 $('#st_letter').val(dataRecord.st_letter);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
480 $('#st_guide').val(dataRecord.st_guide);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
481 $('#st_category').val(dataRecord.st_category);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
482 $('#st_category_number').val(dataRecord.st_category_number);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
483 $('#st_type').val(StyleTypeData[dataRecord.st_type].nl);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
484 $('#st_og_min').val(dataRecord.st_og_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
485 $('#st_og_max').val(dataRecord.st_og_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
486 $('#st_fg_min').val(dataRecord.st_fg_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
487 $('#st_fg_max').val(dataRecord.st_fg_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
488 $('#st_abv_min').val(dataRecord.st_abv_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
489 $('#st_abv_max').val(dataRecord.st_abv_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
490 $('#st_color_min').val(dataRecord.st_color_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
491 $('#st_color_max').val(dataRecord.st_color_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
492 $('#st_ibu_min').val(dataRecord.st_ibu_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
493 $('#st_ibu_max').val(dataRecord.st_ibu_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
494 $('#st_carb_min').val(dataRecord.st_carb_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
495 $('#st_carb_min2').val(dataRecord.st_carb_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
496 $('#st_carb_max').val(dataRecord.st_carb_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
497 $('#st_carb_max2').val(dataRecord.st_carb_max);
818
f9c071906643 Removed obsolete scripts. Product editor tab 1 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 817
diff changeset
498 $('#type').val(RecipeTypeData[dataRecord.type].nl);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
499 $('#batch_size').val(dataRecord.batch_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
500 $('#est_a_vol').val(dataRecord.batch_size * 1.04);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
501 $('#boil_size').val(dataRecord.boil_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
502 $('#est_pre_vol').val(dataRecord.boil_size * 1.04);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
503 $('#boil_time').val(dataRecord.boil_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
504 $('#efficiency').val(dataRecord.efficiency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
505 $('#est_og').val(dataRecord.est_og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
506 $('#est_og2').val(dataRecord.est_og);
616
2cbf21bb9bdc Added est_og3 field in the products database so that the checklist can use it.
Michiel Broek <mbroek@mbse.eu>
parents: 615
diff changeset
507 $('#est_og3').val(dataRecord.est_og3);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
508 $('#est_fg').val(dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
509 $('#est_fg2').val(dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
510 $('#est_fg3').val(dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
511 $('#est_color').val(dataRecord.est_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
512 $('#est_color2').val(dataRecord.est_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
513 $('#est_abv').val(dataRecord.est_abv);
818
f9c071906643 Removed obsolete scripts. Product editor tab 1 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 817
diff changeset
514 $('#color_method').val(ColorMethodData[dataRecord.color_method].nl);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
515 $('#est_ibu').val(dataRecord.est_ibu);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
516 $('#est_ibu2').val(dataRecord.est_ibu);
818
f9c071906643 Removed obsolete scripts. Product editor tab 1 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 817
diff changeset
517 $('#ibu_method').val(IBUmethodData[dataRecord.ibu_method].nl);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
518 $('#est_carb').val(dataRecord.est_carb);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
519 $('#mash_name').val(dataRecord.mash_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
520 $('#mash_ph').val(dataRecord.mash_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
521 $('#sparge_temp').val(dataRecord.sparge_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
522 $('#sparge_ph').val(dataRecord.sparge_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
523 $('#sparge_volume').val(dataRecord.sparge_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
524 $('#sparge_source').val(dataRecord.sparge_source);
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
525 $('#sparge_acid_type').val(AcidTypeData[dataRecord.sparge_acid_type].nl);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
526 $('#sparge_acid_perc').val(dataRecord.sparge_acid_perc);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
527 $('#sparge_acid_amount').val(dataRecord.sparge_acid_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
528 $('#calc_acid').val(dataRecord.calc_acid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
529 $('#w1_name').val(dataRecord.w1_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
530 $('#w1_amount').val(dataRecord.w1_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
531 $('#w1_calcium').val(dataRecord.w1_calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
532 $('#w1_sulfate').val(dataRecord.w1_sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
533 $('#w1_chloride').val(dataRecord.w1_chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
534 $('#w1_sodium').val(dataRecord.w1_sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
535 $('#w1_magnesium').val(dataRecord.w1_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
536 $('#w1_total_alkalinity').val(dataRecord.w1_total_alkalinity);
764
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
537 $('#w1_bicarbonate').val(dataRecord.w1_total_alkalinity * 1.22);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
538 $('#w1_ph').val(dataRecord.w1_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
539 $('#w1_cost').val(dataRecord.w1_cost);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
540 $('#w2_name').val(dataRecord.w2_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
541 $('#w2_amount').val(dataRecord.w2_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
542 $('#w2_calcium').val(dataRecord.w2_calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
543 $('#w2_sulfate').val(dataRecord.w2_sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
544 $('#w2_chloride').val(dataRecord.w2_chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
545 $('#w2_sodium').val(dataRecord.w2_sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
546 $('#w2_magnesium').val(dataRecord.w2_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
547 $('#w2_total_alkalinity').val(dataRecord.w2_total_alkalinity);
764
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
548 $('#w2_bicarbonate').val(dataRecord.w2_total_alkalinity * 1.22);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
549 $('#w2_ph').val(dataRecord.w2_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
550 $('#w2_cost').val(dataRecord.w2_cost);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
551 $('#wg_amount').val(dataRecord.wg_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
552 $('#wg_calcium').val(dataRecord.wg_calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
553 $('#wg_sulfate').val(dataRecord.wg_sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
554 $('#wg_chloride').val(dataRecord.wg_chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
555 $('#wg_sodium').val(dataRecord.wg_sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
556 $('#wg_magnesium').val(dataRecord.wg_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
557 $('#wg_total_alkalinity').val(dataRecord.wg_total_alkalinity);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
558 $('#wg_ph').val(dataRecord.wg_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
559 $('#wb_calcium').val(dataRecord.wb_calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
560 $('#wb_sulfate').val(dataRecord.wb_sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
561 $('#wb_chloride').val(dataRecord.wb_chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
562 $('#wb_sodium').val(dataRecord.wb_sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
563 $('#wb_magnesium').val(dataRecord.wb_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
564 $('#wb_total_alkalinity').val(dataRecord.wb_total_alkalinity);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
565 $('#wb_ph').val(dataRecord.wb_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
566 $('#wa_acid_name').val(dataRecord.wa_acid_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
567 $('#wa_acid_perc').val(dataRecord.wa_acid_perc);
823
506246d65043 Tab 6 is a viewer
Michiel Broek <mbroek@mbse.eu>
parents: 822
diff changeset
568 $('#starter_type').val(StarterTypeData[dataRecord.starter_type].nl);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
569 $('#starter_sg').val(dataRecord.starter_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
570 $('#starter_viability').val(dataRecord.starter_viability);
617
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
571 $('#yeast_prod_date').val(dataRecord.yeast_prod_date);
697
367ae7ff52f0 Version 0.3.34 Changed log messages in the daemon. Added yeast_pitchrate field to the product database. Added yeast pitchrate edit field to the yeast tab. Initial value is guessed. There is also a popup window for predefined values. An finally the value can be edited by the user. All popup windows are initialized together.
Michiel Broek <mbroek@mbse.eu>
parents: 669
diff changeset
572 $('#yeast_pitchrate').val(dataRecord.yeast_pitchrate);
823
506246d65043 Tab 6 is a viewer
Michiel Broek <mbroek@mbse.eu>
parents: 822
diff changeset
573 $('#prop1_type').val(StarterTypeData[dataRecord.prop1_type].nl);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
574 $('#prop1_volume').val(dataRecord.prop1_volume);
823
506246d65043 Tab 6 is a viewer
Michiel Broek <mbroek@mbse.eu>
parents: 822
diff changeset
575 $('#prop2_type').val(StarterTypeData[dataRecord.prop2_type].nl);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
576 $('#prop2_volume').val(dataRecord.prop2_volume);
823
506246d65043 Tab 6 is a viewer
Michiel Broek <mbroek@mbse.eu>
parents: 822
diff changeset
577 $('#prop3_type').val(StarterTypeData[dataRecord.prop3_type].nl);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
578 $('#prop3_volume').val(dataRecord.prop3_volume);
823
506246d65043 Tab 6 is a viewer
Michiel Broek <mbroek@mbse.eu>
parents: 822
diff changeset
579 $('#prop4_type').val(StarterTypeData[dataRecord.prop4_type].nl);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
580 $('#prop4_volume').val(dataRecord.prop4_volume);
500
8d53ad389204 Reworked the splitted batches, the data is now in a separate table and there is only one product record.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
581 $('#divide_type').val(SplitData[dataRecord.divide_type].nl);
545
f71079a45f5c More screen improvements. Updated the design README.
Michiel Broek <mbroek@mbse.eu>
parents: 544
diff changeset
582 if (dataRecord.divide_type > 0)
f71079a45f5c More screen improvements. Updated the design README.
Michiel Broek <mbroek@mbse.eu>
parents: 544
diff changeset
583 $('#divide_batch').val((dataRecord.divide_part + 1) + ' van ' + (dataRecord.divide_parts + 1));
f71079a45f5c More screen improvements. Updated the design README.
Michiel Broek <mbroek@mbse.eu>
parents: 544
diff changeset
584 else
f71079a45f5c More screen improvements. Updated the design README.
Michiel Broek <mbroek@mbse.eu>
parents: 544
diff changeset
585 $('#divide_batch').val('n.v.t.');
497
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
586 // hidden divide_size
533
be8691b7d634 Added the product divide scripts. All parts have all the volumes and weights divided, including the master record. Splitted batches have their own records with the product code formatted as code-n. From this design, we can rebuild the print and checklist.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
587 // hidden divide_factor
544
f3faa54581ff Better way to show splitted batches. Added flameout calculations to the php scripts.
Michiel Broek <mbroek@mbse.eu>
parents: 542
diff changeset
588 // hidden divide_parts
533
be8691b7d634 Added the product divide scripts. All parts have all the volumes and weights divided, including the master record. Splitted batches have their own records with the product code formatted as code-n. From this design, we can rebuild the print and checklist.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
589 // hidden divide_part
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
590 editFermentable(dataRecord);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
591 editHop(dataRecord);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
592 editMisc(dataRecord);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
593 editYeast(dataRecord);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
594 editMash(dataRecord);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
595 calcStage();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
596 $('#jqxTabs').jqxTabs('select', 2);
643
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
597 data_loaded = 1;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
598 },
640
048932246071 Loading changes
Michiel Broek <mbroek@mbse.eu>
parents: 639
diff changeset
599 loadError: function(jqXHR, status, error) {
639
71c6bbd7d4e6 Yet another debug trick
Michiel Broek <mbroek@mbse.eu>
parents: 638
diff changeset
600 console.log('main data load error: ' + status + ' ' + error);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
601 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
602 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
603
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
604 // Inline fermentables editor
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
605 var editFermentable = function(data) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
606 var fermentableSource = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
607 localdata: data.fermentables,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
608 datafields: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
609 { name: 'f_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
610 { name: 'f_origin', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
611 { name: 'f_supplier', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
612 { name: 'f_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
613 { name: 'f_cost', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
614 { name: 'f_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
615 { name: 'f_yield', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
616 { name: 'f_color', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
617 { name: 'f_coarse_fine_diff', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
618 { name: 'f_moisture', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
619 { name: 'f_diastatic_power', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
620 { name: 'f_protein', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
621 { name: 'f_max_in_batch', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
622 { name: 'f_graintype', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
623 { name: 'f_added', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
624 { name: 'f_dissolved_protein', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
625 { name: 'f_recommend_mash', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
626 { name: 'f_add_after_boil', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
627 { name: 'f_adjust_to_total_100', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
628 { name: 'f_percentage', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
629 { name: 'f_di_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
630 { name: 'f_acid_to_ph_57', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
631 { name: 'f_inventory', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
632 { name: 'f_avail', type: 'int' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
633 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
634 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
635 fermentableAdapter = new $.jqx.dataAdapter(fermentableSource);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
636
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
637 $('#fermentableGrid').jqxGrid({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
638 width: 1240,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
639 height: 470,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
640 source: fermentableAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
641 theme: theme,
820
16ae12aa872e Tab 3 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 819
diff changeset
642 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: 769
diff changeset
643 ready: function() { calcFermentables(); $('#jqxTabs').jqxTabs('next'); },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
644 columns: [
820
16ae12aa872e Tab 3 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 819
diff changeset
645 { text: 'Vergistbaar ingredi&euml;nt', datafield: 'f_name' },
16ae12aa872e Tab 3 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 819
diff changeset
646 { text: 'Leverancier', datafield: 'f_supplier', width: 180 },
16ae12aa872e Tab 3 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 819
diff changeset
647 { text: 'Kleur', datafield: 'f_color', width: 90, align: 'right',
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
648 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
820
16ae12aa872e Tab 3 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 819
diff changeset
649 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(value, 'f0') + ' EBC</span>';
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
650 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
651 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
652 { text: 'Type', width: 100, datafield: 'f_type',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
653 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
654 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + FermentableTypeData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
655 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
656 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
657 { text: 'Moment', width: 110, datafield: 'f_added',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
658 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
659 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + AddedData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
660 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
661 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
662 { text: 'Maxinbatch', datafield: 'f_max_in_batch', hidden: true },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
663 { text: 'Opbrengst', datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
820
16ae12aa872e Tab 3 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 819
diff changeset
664 { text: 'Gewicht Kg', datafield: 'f_amount', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
16ae12aa872e Tab 3 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 819
diff changeset
665 { text: 'Voorraad Kg', datafield: 'f_inventory', width: 110, align: 'right',
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
666 cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
667 var color = (value < rowdata.f_amount) ? '#ff4040':'#ffffff';
752
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
668 if (block_fermentable(dataRecord.inventory_reduced, rowdata.f_added) == false) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
669 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + fermentableAdapter.formatNumber(value, 'f3') + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
670 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
671 return '<span></span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
672 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
673 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
674 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
675 { text: 'Procent', datafield: 'f_percentage', width: 90, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
676 cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
677 if (rowdata.f_added >= 4)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
678 return '<span></span>';
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
679 var color = (value > rowdata.f_max_in_batch) ? '#ff4040':'#ffffff';
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
680 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + fermentableAdapter.formatNumber(value, 'p1') + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
681 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
682 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
683 { text: '100%', datafield: 'f_adjust_to_total_100', width: 70, align: 'center', cellsalign: 'center',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
684 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
685 if (value == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
686 return '<span></span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
687 return '<span><img style="float:left; margin-left:25px; margin-top:4px;" src="images/dialog-ok-apply.png"></span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
688 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
689 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
690 ]
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
691 });
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
692 };
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
693
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
694 // Inline hops editor
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
695 var editHop = function(data) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
696 var hopSource = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
697 localdata: data.hops,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
698 datafields: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
699 { name: 'h_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
700 { name: 'h_origin', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
701 { name: 'h_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
702 { name: 'h_cost', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
703 { name: 'h_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
704 { name: 'h_form', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
705 { name: 'h_useat', type: 'int' },
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
706 { name: 'h_time', type: 'int' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
707 { name: 'h_alpha', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
708 { name: 'h_beta', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
709 { name: 'h_hsi', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
710 { name: 'h_humulene', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
711 { name: 'h_caryophyllene', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
712 { name: 'h_cohumulone', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
713 { name: 'h_myrcene', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
714 { name: 'h_total_oil', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
715 { name: 'h_inventory', type: 'float' },
821
293ec25995db Tab 4 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 820
diff changeset
716 { name: 'h_avail', type: 'int' },
293ec25995db Tab 4 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 820
diff changeset
717 { name: 'h_utilisation', type: 'float' },
293ec25995db Tab 4 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 820
diff changeset
718 { name: 'h_bu_factor', type: 'float' }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
719 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
720 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
721 hopAdapter = new $.jqx.dataAdapter(hopSource);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
722
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
723 $('#hopGrid').jqxGrid({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
724 width: 1240,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
725 height: 560,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
726 source: hopAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
727 theme: theme,
821
293ec25995db Tab 4 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 820
diff changeset
728 editable: false,
648
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 647
diff changeset
729 ready: function() { $('#jqxTabs').jqxTabs('next'); },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
730 columns: [
821
293ec25995db Tab 4 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 820
diff changeset
731 { text: 'Hop', datafield: 'h_name' },
293ec25995db Tab 4 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 820
diff changeset
732 { text: 'Origin', width: 180, datafield: 'h_origin' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
733 { text: 'Type', width: 90, datafield: 'h_type',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
734 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
735 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopTypeData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
736 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
737 },
821
293ec25995db Tab 4 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 820
diff changeset
738 { text: 'Vorm', width: 110, datafield: 'h_form',
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
739 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
740 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopFormData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
741 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
742 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
743 { text: 'Alpha', datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
744 { text: 'Gebruik', width: 110, datafield: 'h_useat',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
745 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
746 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopUseData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
747 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
748 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
749 { text: 'Tijdsduur', datafield: 'h_time', width: 90, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
750 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
751 var duration = '';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
752 if ((rowdata.h_useat == 2) || (rowdata.h_useat == 4)) // Boil, Whirlpool
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
753 duration = dataAdapter.formatNumber(value, 'f0') + ' min.';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
754 else if (rowdata.h_useat == 5) // Dry hop
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
755 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
756 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
757 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
758 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
759 { text: 'IBU', datafield: 'ibu', width: 80, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
760 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
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: 769
diff changeset
761 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat(dataRecord.batch_size),
821
293ec25995db Tab 4 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 820
diff changeset
762 parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time), parseFloat(rowdata.h_alpha), dataRecord.ibu_method,
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
763 dataRecord.brew_whirlpool9, dataRecord.brew_whirlpool7, dataRecord.brew_whirlpool6);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
764 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(ibu, 'f1') + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
765 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
766 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
767 { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
768 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
769 var amount = dataAdapter.formatNumber(value, 'f1') + ' kg';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
770 if (value < 1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
771 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
772 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
773 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
774 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
775 { text: 'Voorraad', datafield: 'h_inventory', width: 110, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
776 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
752
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
777 if (block_hop(dataRecord.inventory_reduced, rowdata.h_useat) == false) {
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
778 var amount = dataAdapter.formatNumber(value, 'f1') + ' kg',
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
779 color = (value < rowdata.h_amount) ? '#ff4040':'#ffffff';
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
780 if (value < 1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
781 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
782 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
783 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
784 return '<span></span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
785 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
786 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
787 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
788 ]
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
789 });
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
790 };
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
791
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
792 // Inline miscs editor
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
793 var editMisc = function(data) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
794 var miscSource = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
795 localdata: data.miscs,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
796 datafields: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
797 { name: 'm_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
798 { name: 'm_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
799 { name: 'm_cost', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
800 { name: 'm_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
801 { name: 'm_use_use', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
802 { name: 'm_time', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
803 { name: 'm_amount_is_weight', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
804 { name: 'm_inventory', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
805 { name: 'm_avail', type: 'int' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
806 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
807 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
808 miscAdapter = new $.jqx.dataAdapter(miscSource, {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
809 beforeLoadComplete: function(records) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
810 var row, i, data = new Array();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
811 for (i = 0; i < records.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
812 row = records[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
813 data.push(row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
814 // Initial set water agent values.
822
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
815 if (row.m_use_use == 1) { // Mash
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
816 switch (row.m_name) {
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
817 case 'CaCl2':
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
818 $('#wa_cacl2').val(row.m_amount * 1000);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
819 break;
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
820 case 'CaSO4':
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
821 $('#wa_caso4').val(row.m_amount * 1000);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
822 break;
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
823 case 'MgSO4':
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
824 $('#wa_mgso4').val(row.m_amount * 1000);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
825 break;
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
826 case 'NaCl':
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
827 $('#wa_nacl').val(row.m_amount * 1000);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
828 break;
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
829 case 'MgCl2':
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
830 $('#wa_mgcl2').val(row.m_amount * 1000);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
831 break;
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
832 case 'NaHCO3':
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
833 $('#wa_nahco3').val(row.m_amount * 1000);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
834 break;
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
835 case 'CaCO3':
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
836 $('#wa_caco3').val(row.m_amount * 1000);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
837 break;
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
838 case 'Melkzuur':
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
839 $('#wa_acid_name').val(AcidTypeData[0].nl);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
840 $('#wa_acid').val(row.m_amount * 1000);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
841 $('#wa_acid_perc').val(AcidTypeData[0].AcidPrc);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
842 last_acid = 'Melkzuur';
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
843 break;
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
844 case 'Zoutzuur':
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
845 $('#wa_acid_name').val(AcidTypeData[1].nl);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
846 $('#wa_acid').val(row.m_amount * 1000);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
847 $('#wa_acid_perc').val(AcidTypeData[1].AcidPrc);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
848 last_acid = 'Zoutzuur';
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
849 break;
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
850 case 'Fosforzuur':
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
851 $('#wa_acid_name').val(AcidTypeData[2].nl);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
852 $('#wa_acid').val(row.m_amount * 1000);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
853 $('#wa_acid_perc').val(AcidTypeData[2].AcidPrc);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
854 last_acid = 'Fosforzuur';
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
855 break;
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
856 case 'Zwavelzuur':
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
857 $('#wa_acid_name').val(AcidTypeData[3].nl);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
858 $('#wa_acid').val(row.m_amount * 1000);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
859 $('#wa_acid_perc').val(AcidTypeData[3].AcidPrc);
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
860 last_acid = 'Zwavelzuur';
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
861 break;
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
862 }
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
863 }
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
864 if (row.m_use_use == 6) { // Sparge
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
865 switch (row.m_name) {
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
866 case 'CaCl2':
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
867 $('#ss_cacl2').val(row.m_amount * 1000);
822
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
868 break;
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
869 case 'CaSO4':
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
870 $('#ss_caso4').val(row.m_amount * 1000);
822
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
871 break;
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
872 case 'MgSO4':
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
873 $('#ss_mgso4').val(row.m_amount * 1000);
822
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
874 break;
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
875 case 'NaCl':
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
876 $('#ss_nacl').val(row.m_amount * 1000);
822
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
877 break;
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
878 case 'MgCl2':
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
879 $('#ss_mgcl2').val(row.m_amount * 1000);
822
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
880 break;
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
881 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
882 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
883 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
884 return data;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
885 },
641
ab6423be2a1e A lot more debug messages
Michiel Broek <mbroek@mbse.eu>
parents: 640
diff changeset
886 loadError: function(jqXHR, status, error) { console.log('miscs load error ' + status + ' ' + error); },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
887 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
888 $('#miscGrid').jqxGrid({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
889 width: 1240,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
890 height: 575,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
891 source: miscAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
892 theme: theme,
822
bd20a8329b1b Tab 5 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 821
diff changeset
893 editable: false,
648
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 647
diff changeset
894 ready: function() { $('#jqxTabs').jqxTabs('next'); },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
895 columns: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
896 { text: 'Ingredient', datafield: 'm_name' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
897 { text: 'Type', width: 140, datafield: 'm_type',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
898 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
899 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + MiscTypeData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
900 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
901 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
902 { text: 'Gebruik', width: 140, datafield: 'm_use_use',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
903 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
904 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + MiscUseData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
905 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
906 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
907 { text: 'Tijd', datafield: 'm_time', width: 90, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
908 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
909 var duration = '';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
910 if (rowdata.m_use_use == 2) // Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
911 duration = dataAdapter.formatNumber(value, 'f0') + ' min.';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
912 else if ((rowdata.m_use_use == 3) || (rowdata.m_use_use == 4)) // Primary or Secondary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
913 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
914 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
915 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
916 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
917 { text: 'Hoeveel', datafield: 'm_amount', width: 110, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
918 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
919 var vstr = rowdata.m_amount_is_weight ? 'gr' : 'ml';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
920 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
921 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
922 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
923 { text: 'Voorraad', datafield: 'm_inventory', width: 110, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
924 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
752
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
925 if (block_misc(dataRecord.inventory_reduced, rowdata.m_use_use) == false) {
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
926 var vstr = rowdata.m_amount_is_weight ? 'gr' : 'ml',
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
927 color = (value < rowdata.m_amount) ? '#ff4040':'#ffffff',
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
928 amount = dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
929 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
930 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
931 return '<span></span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
932 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
933 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
934 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
935 ]
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
936 });
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
937 };
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
938
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
939 // Inline yeasts editor
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
940 var editYeast = function(data) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
941 var yeastSource = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
942 localdata: data.yeasts,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
943 datafields: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
944 { name: 'y_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
945 { name: 'y_laboratory', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
946 { name: 'y_product_id', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
947 { name: 'y_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
948 { name: 'y_cost', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
949 { name: 'y_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
950 { name: 'y_form', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
951 { name: 'y_flocculation', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
952 { name: 'y_min_temperature', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
953 { name: 'y_max_temperature', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
954 { name: 'y_attenuation', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
955 { name: 'y_use', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
956 { name: 'y_cells', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
957 { name: 'y_tolerance', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
958 { name: 'y_inventory', type: 'float' },
554
c62ff53cfc3d Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents: 552
diff changeset
959 { name: 'y_sta1', type: 'int' },
c62ff53cfc3d Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents: 552
diff changeset
960 { name: 'y_bacteria', type: 'int' },
c62ff53cfc3d Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents: 552
diff changeset
961 { name: 'y_harvest_top', type: 'int' },
c62ff53cfc3d Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents: 552
diff changeset
962 { name: 'y_harvest_time', type: 'int' },
c62ff53cfc3d Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents: 552
diff changeset
963 { name: 'y_pitch_temperature', type: 'float' },
c62ff53cfc3d Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents: 552
diff changeset
964 { name: 'y_pofpos', type: 'int' },
c62ff53cfc3d Added the new Kveik yeast fields to the product editor. Added auto update when a product is loaded. Added extra lines to the checklist about harvest yeast and pitch temperature.
Michiel Broek <mbroek@mbse.eu>
parents: 552
diff changeset
965 { name: 'y_zymocide', type: 'int' },
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
966 { name: 'y_gr_hl_lo', type: 'int' },
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
967 { name: 'y_sg_lo', type: 'float' },
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
968 { name: 'y_gr_hl_hi', type: 'int' },
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
969 { name: 'y_sg_hi', type: 'float' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
970 { name: 'y_avail', type: 'int' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
971 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
972 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
973 yeastAdapter = new $.jqx.dataAdapter(yeastSource);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
974
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
975 $('#yeastGrid').jqxGrid({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
976 width: 1240,
617
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
977 height: 325,
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
978 source: yeastAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
979 theme: theme,
823
506246d65043 Tab 6 is a viewer
Michiel Broek <mbroek@mbse.eu>
parents: 822
diff changeset
980 editable: false,
648
ee69b01fcb0e Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 647
diff changeset
981 ready: function() { $('#jqxTabs').jqxTabs('next'); },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
982 columns: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
983 { text: 'Gist', datafield: 'y_name' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
984 { text: 'Laboratorium', width: 150, datafield: 'y_laboratory' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
985 { text: 'Code', width: 90, datafield: 'y_product_id' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
986 { text: 'Soort', width: 100, datafield: 'y_form',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
987 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
988 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + YeastFormData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
989 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
990 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
991 { text: 'Min. &deg;C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_min_temperature' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
992 { text: 'Max. &deg;C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_max_temperature' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
993 { text: 'Tol. %', width: 60, align: 'right', cellsalign: 'right', datafield: 'y_tolerance',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
994 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
995 var amount = '', color = (dataRecord.est_abv > value) ? '#ff4040':'#ffffff';
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
996 if (value > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
997 amount = dataAdapter.formatNumber(value, 'f1');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
998 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
999 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1000 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1001 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1002 { text: 'Attn. %', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_attenuation', cellsformat: 'f1' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1003 { text: 'Voor', width: 120, datafield: 'y_use',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1004 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1005 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + YeastUseData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1006 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1007 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1008 { text: 'Hoeveel', datafield: 'y_amount', width: 90, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1009 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1010 var amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1011 if (rowdata.y_form == 0) // Liquid
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1012 amount = dataAdapter.formatNumber(value, 'f0') + ' pk';
515
9d771385a8a0 Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.
Michiel Broek <mbroek@mbse.eu>
parents: 500
diff changeset
1013 else if (rowdata.y_form == 1 || rowdata.y_form == 6) // Dry
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1014 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1015 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1016 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1017 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1018 { text: 'Voorraad', datafield: 'y_inventory', width: 90, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1019 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1020 var color, amount;
752
f68e3bbc1ada Fermentables, hops, miscs and yeast now have tests against the added moment with the brewing stage. Added to inventory edit rows, delete rows, and pick choices for the moment to add or edit. Some more popups to explain certain blocks.
Michiel Broek <mbroek@mbse.eu>
parents: 751
diff changeset
1021 if (block_yeast(dataRecord.inventory_reduced, rowdata.y_use) == false) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1022 color = '#ffffff';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1023 if (value < rowdata.y_amount)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1024 color = '#ff4040';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1025 amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1026 if (rowdata.y_form == 0) // Liquid
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1027 amount = dataAdapter.formatNumber(value, 'f0') + ' pk';
515
9d771385a8a0 Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.
Michiel Broek <mbroek@mbse.eu>
parents: 500
diff changeset
1028 else if (rowdata.y_form == 1 || rowdata.y_form == 6) // Dry
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1029 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1030 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1031 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1032 return '<span></span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1033 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1034 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1035 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1036 ]
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1037 });
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
1038 };
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1039
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1040 // inline mash editor
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
1041 var editMash = function(data) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1042 var mashSource = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1043 localdata: data.mashs,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1044 datafields: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1045 { name: 'step_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1046 { 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
1047 { name: 'step_volume', type: 'float' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1048 { 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
1049 { name: 'step_infuse_temp', type: 'float' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1050 { name: 'step_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1051 { 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
1052 { name: 'step_wg_ratio', type: 'float' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1053 { name: 'ramp_time', type: 'float' },
738
11e6bd8d8107 Added mash SG and pH fields. Fixed default Yeast update. Added mash step SG and pH input datafields. Added a Brix input too. The print report shows the mash measurements too. Other brewing results now show expected and measured values and the difference.
Michiel Broek <mbroek@mbse.eu>
parents: 726
diff changeset
1054 { name: 'end_temp', type: 'float' },
11e6bd8d8107 Added mash SG and pH fields. Fixed default Yeast update. Added mash step SG and pH input datafields. Added a Brix input too. The print report shows the mash measurements too. Other brewing results now show expected and measured values and the difference.
Michiel Broek <mbroek@mbse.eu>
parents: 726
diff changeset
1055 { name: 'step_ph', type: 'float' },
11e6bd8d8107 Added mash SG and pH fields. Fixed default Yeast update. Added mash step SG and pH input datafields. Added a Brix input too. The print report shows the mash measurements too. Other brewing results now show expected and measured values and the difference.
Michiel Broek <mbroek@mbse.eu>
parents: 726
diff changeset
1056 { name: 'step_sg', type: 'float' }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1057 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1058 },
774
92e1e8f175a2 Split batch, adjust mash step volume. In the duplicated log_brew handle the missing values. In save product, round the mash step sg to 4 decimals. In prod_edit, ingredients are stored as strings, not arrays. This triggered a memory corruption that only happened in rare circumstances. Don't fix mash step fields in the javascript, it is already done during load from the database. Calculation of the mash volume is rounded to 6 decimals. Enter mash step Brix/Plato value, the SG result is rounded to 4 decimals.
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
1059 mashAdapter = new $.jqx.dataAdapter(mashSource);
92e1e8f175a2 Split batch, adjust mash step volume. In the duplicated log_brew handle the missing values. In save product, round the mash step sg to 4 decimals. In prod_edit, ingredients are stored as strings, not arrays. This triggered a memory corruption that only happened in rare circumstances. Don't fix mash step fields in the javascript, it is already done during load from the database. Calculation of the mash volume is rounded to 6 decimals. Enter mash step Brix/Plato value, the SG result is rounded to 4 decimals.
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
1060
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1061 $('#mashGrid').jqxGrid({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1062 width: 1240,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1063 height: 400,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1064 source: mashAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1065 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1066 selectionmode: 'singlerow',
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
1067 editable: false,
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1068 ready: function() {
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1069 /* Calculate the whole recipe */
641
ab6423be2a1e A lot more debug messages
Michiel Broek <mbroek@mbse.eu>
parents: 640
diff changeset
1070 console.log('ready mashs, start calculations');
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
1071 /* calcFermentables() must be first and is done by the grid load. Here it is too late. */
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1072 calcMash();
789
e6e696add0b3 Fixed some mess in water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 784
diff changeset
1073 calcWater();
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
1074 calcIBUs();
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
1075 whirlpoolHops();
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
1076 calcMiscs();
826
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
1077 calcViability();
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
1078 calcYeast();
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
1079 kookTijd();
828
aa0a9b1a2dd7 The fermentation tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 827
diff changeset
1080 calcFermentation();
829
35207369e7ce Packagig is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 828
diff changeset
1081 calcCarbonation();
827
5df0d11ca02b Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 826
diff changeset
1082 $('#FLog').jqxButton({ disabled: (dataRecord.log_fermentation) ? false : true});
5df0d11ca02b Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 826
diff changeset
1083 $('#ILog').jqxButton({ disabled: (dataRecord.log_ispindel) ? false : true});
5df0d11ca02b Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 826
diff changeset
1084 $('#CLog').jqxButton({ disabled: (dataRecord.log_co2pressure) ? false : true});
641
ab6423be2a1e A lot more debug messages
Michiel Broek <mbroek@mbse.eu>
parents: 640
diff changeset
1085 console.log('calculations ready');
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1086 $('#jqxLoader').jqxLoader('close');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1087 $('#jqxTabs').jqxTabs('first');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1088 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1089 columns: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1090 { text: 'Stap naam', datafield: 'step_name' },
738
11e6bd8d8107 Added mash SG and pH fields. Fixed default Yeast update. Added mash step SG and pH input datafields. Added a Brix input too. The print report shows the mash measurements too. Other brewing results now show expected and measured values and the difference.
Michiel Broek <mbroek@mbse.eu>
parents: 726
diff changeset
1091 { text: 'Stap type', datafield: 'step_type', width: 150,
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1092 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1093 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + MashStepTypeData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1094 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1095 },
738
11e6bd8d8107 Added mash SG and pH fields. Fixed default Yeast update. Added mash step SG and pH input datafields. Added a Brix input too. The print report shows the mash measurements too. Other brewing results now show expected and measured values and the difference.
Michiel Broek <mbroek@mbse.eu>
parents: 726
diff changeset
1096 { text: 'Start &deg;C', datafield: 'step_temp', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
11e6bd8d8107 Added mash SG and pH fields. Fixed default Yeast update. Added mash step SG and pH input datafields. Added a Brix input too. The print report shows the mash measurements too. Other brewing results now show expected and measured values and the difference.
Michiel Broek <mbroek@mbse.eu>
parents: 726
diff changeset
1097 { text: 'Eind &deg;C', datafield: 'end_temp', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
11e6bd8d8107 Added mash SG and pH fields. Fixed default Yeast update. Added mash step SG and pH input datafields. Added a Brix input too. The print report shows the mash measurements too. Other brewing results now show expected and measured values and the difference.
Michiel Broek <mbroek@mbse.eu>
parents: 726
diff changeset
1098 { text: 'Rust min.', datafield: 'step_time', width: 80, align: 'right', cellsalign: 'right' },
11e6bd8d8107 Added mash SG and pH fields. Fixed default Yeast update. Added mash step SG and pH input datafields. Added a Brix input too. The print report shows the mash measurements too. Other brewing results now show expected and measured values and the difference.
Michiel Broek <mbroek@mbse.eu>
parents: 726
diff changeset
1099 { text: 'Stap min.', datafield: 'ramp_time', width: 80, align: 'right', cellsalign: 'right' },
11e6bd8d8107 Added mash SG and pH fields. Fixed default Yeast update. Added mash step SG and pH input datafields. Added a Brix input too. The print report shows the mash measurements too. Other brewing results now show expected and measured values and the difference.
Michiel Broek <mbroek@mbse.eu>
parents: 726
diff changeset
1100 { text: 'Inf/dec L.', datafield: 'step_infuse_amount', width: 80, align: '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
1101 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
1102 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
1103 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
1104 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
1105 var mvol = mashkg * MaltVolume;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1106 if ((rowdata.step_wg_ratio * mashkg + mvol) > dataRecord.eq_tun_volume)
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1107 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
1108 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + dataAdapter.formatNumber(value, 'f1') + '</span>';
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1109 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1110 },
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1111 { 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
1112 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
1113 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
1114 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
1115 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
1116 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1117 },
738
11e6bd8d8107 Added mash SG and pH fields. Fixed default Yeast update. Added mash step SG and pH input datafields. Added a Brix input too. The print report shows the mash measurements too. Other brewing results now show expected and measured values and the difference.
Michiel Broek <mbroek@mbse.eu>
parents: 726
diff changeset
1118 { text: 'L/Kg.', datafield: 'step_wg_ratio', width: 80, align: '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
1119 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
1120 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
1121 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
1122 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
1123 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
1124 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1125 },
738
11e6bd8d8107 Added mash SG and pH fields. Fixed default Yeast update. Added mash step SG and pH input datafields. Added a Brix input too. The print report shows the mash measurements too. Other brewing results now show expected and measured values and the difference.
Michiel Broek <mbroek@mbse.eu>
parents: 726
diff changeset
1126 { text: 'pH', datafield: 'step_ph', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f2' },
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
1127 { text: 'SG', datafield: 'step_sg', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f3' }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1128 ]
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1129 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1130 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1131
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1132 /*
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
1133 * Remove the top menu so that we MUST use the button to leave the editor.
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1134 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1135 $('#jqxMenu').jqxMenu('destroy');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1136 console.log('record:' + my_record + ' return:' + my_return + ' theme:' + theme);
557
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
1137 $('#jqxLoader').jqxLoader({ width: 250, height: 150, isModal: true, text: 'Laden product ...', theme: theme });
640
048932246071 Loading changes
Michiel Broek <mbroek@mbse.eu>
parents: 639
diff changeset
1138 $('#jqxLoader').jqxLoader('open');
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1139
638
736c8d29bc87 Binding the data earlier to try to prevent a race condition.
Michiel Broek <mbroek@mbse.eu>
parents: 637
diff changeset
1140 /* Moved to before all functions */
736c8d29bc87 Binding the data earlier to try to prevent a race condition.
Michiel Broek <mbroek@mbse.eu>
parents: 637
diff changeset
1141 dataAdapter.dataBind();
736c8d29bc87 Binding the data earlier to try to prevent a race condition.
Michiel Broek <mbroek@mbse.eu>
parents: 637
diff changeset
1142
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1143 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1144 * Generic functions
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1145 */
658
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
1146 function kookTijd() {
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
1147 if (dataRecord.boil_time) {
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
1148 $('#brew_pmpt_koken').html('Koken ' + dataRecord.boil_time + ' minuten');
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
1149 } else {
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
1150 $('#brew_pmpt_koken').html('Koken "no-boil"');
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
1151 }
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
1152 }
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
1153
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
1154 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
1155 var a = last_temp * (dataRecord.eq_tun_weight * dataRecord.eq_tun_specific_heat + step_infused * SpecificHeatWater + step_mashkg * SpecificHeatMalt);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1156 var b = step_temp * (dataRecord.eq_tun_weight * dataRecord.eq_tun_specific_heat + step_infused * SpecificHeatWater + step_mashkg * SpecificHeatMalt);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1157 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
1158 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
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 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
1162 var a = (dataRecord.eq_tun_weight * dataRecord.eq_tun_specific_heat + step_volume * SpecificHeatWater) * (step_temp - prev_temp);
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1163 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
1164 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
1165 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
1166 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
1167 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
1168 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1169
617
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1170 function calcViability() {
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1171 var vpm = 1.00;
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1172 var max = 100;
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1173 var rowscount = dataRecord.yeasts.length;
617
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1174 if (rowscount) {
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1175 for (i = 0; i < rowscount; i++) {
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1176 row = dataRecord.yeasts[i];
617
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1177 if (row.y_use == 0) {
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1178 if (row.y_form == 0) { // Liquid
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1179 vpm = 0.80;
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1180 max = 97;
623
4aee10bcb94e Better yeast viability for PurePitch yeast.
Michiel Broek <mbroek@mbse.eu>
parents: 622
diff changeset
1181 if (row.y_laboratory == 'White Labs') { // PurePitch
617
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1182 vpm = 0.95;
623
4aee10bcb94e Better yeast viability for PurePitch yeast.
Michiel Broek <mbroek@mbse.eu>
parents: 622
diff changeset
1183 max = 100;
4aee10bcb94e Better yeast viability for PurePitch yeast.
Michiel Broek <mbroek@mbse.eu>
parents: 622
diff changeset
1184 }
617
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1185 } else if (row.y_form == 1) { // dry yeast
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1186 vpm = 0.998;
617
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1187 max = 100;
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1188 } else if (row.y_form == 6) { // Dried kveik
618
2712082437b0 Setting the dried Kveik viability to 8% per month.
Michiel Broek <mbroek@mbse.eu>
parents: 617
diff changeset
1189 vpm = 0.92;
617
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1190 max = 100;
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1191 } else { // Slant, Culture, Frozen, Bottle
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1192 vpm = 0.99;
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1193 max = 97;
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1194 }
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1195 }
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1196 }
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1197 }
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1198 var base = max;
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1199 var days = 0;
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1200
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1201 if (parseFloat($('#yeast_prod_date').val()) > 2000) {
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1202 console.log('calculate viability');
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1203 var d = new Date();
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1204 var date2 = $('#yeast_prod_date').val();
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1205 date2 = date2.split('-');
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1206 // Now we convert the array to a Date object
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1207 var date1 = new Date(d.getFullYear(), d.getMonth(), d.getDate());
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1208 date2 = new Date(date2[0], date2[1] - 1, date2[2]);
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1209 var diff = parseInt(date1.getTime()) - parseInt(date2.getTime());
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1210 days = Math.floor(diff/1000/60/60/24);
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1211
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1212 var degrade = 1 - ((1 - vpm) / 30.41); // viability degradation per day.
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1213 for (i = 0; i < days; i++) {
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1214 base = base * degrade;
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1215 }
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1216 if (base > max) {
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1217 base = max;
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1218 }
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1219 base = Math.round(base);
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1220 }
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1221 console.log('age:' + days + ' max:' + max + ' vpm:' + vpm + ' base:' + base);
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1222
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1223 if (dataRecord.starter_viability != base) {
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1224 dataRecord.starter_viability = base;
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1225 $('#starter_viability').val(dataRecord.starter_viability);
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1226 }
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1227 }
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1228
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1229 function calcSupplies() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1230 if (dataRecord.inventory_reduced > 6) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1231 $('#ok_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1232 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1233 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1234 if (ok_fermentables && ok_hops && ok_miscs && ok_yeasts && ok_waters)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1235 $('#ok_supplies').html("<img src='images/dialog-ok-apply.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1236 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1237 $('#ok_supplies').html("<img src='images/dialog-error.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1238 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1239
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1240 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1241 * All calculations that depend on changes in the fermentables,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1242 * volumes and equipments.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1243 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1244 function calcFermentables() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1245
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1246 var sugarsf = 0, // fermentable sugars mash + boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1247 sugarsm = 0, // fermentable sugars in mash
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1248 vol = 0, // Volume sugars after boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1249 addedS = 0, // Added sugars after boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1250 addedmass = 0, // Added mass after boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1251 mvol = 0, // mash volume
824
26ffc2fb0eaf Fixed calculation of estimated fg and use the same method as in bmsapp.
Michiel Broek <mbroek@mbse.eu>
parents: 823
diff changeset
1252 infuse = 0, // mash infuse volume
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1253 colort = 0, // Colors srm * vol totals
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1254 colorh = 0, // Colors ebc * vol * kt
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1255 colorn = 0, // Colors ebc * pt * pct
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1256 my_100 = false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1257 mashtime = 0, // Total mash time
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1258 mashtemp = 0, // Average mash temperature
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1259 bv = 0.925, // Bierverlies rendement
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1260 sr = 0.95, // Mash en spoel rendement
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1261 lintner = 0, // Total recipe lintner
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1262 i, row, rows, org, timem, aboil_volume, spoelw, ogx, topw, s = 0, d, v, x,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1263 sug, alc, pt, cw, color, scolor, fig;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1264
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1265 /* Init global variables */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1266 psugar = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1267 pcara = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1268 mashkg = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1269 ok_fermentables = 1; // All is in stock.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1270 ok_yeasts = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1271
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1272 if (dataRecord.mashs.length) {
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1273 for (i = 0; i < dataRecord.mashs.length; i++) {
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1274 row = dataRecord.mashs[i];
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1275 if (parseFloat(row.step_type) == 0) // Infusion
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1276 mvol += parseFloat(row.step_infuse_amount);
824
26ffc2fb0eaf Fixed calculation of estimated fg and use the same method as in bmsapp.
Michiel Broek <mbroek@mbse.eu>
parents: 823
diff changeset
1277 if (row.step_temp <= 75 && row.step_temp >= 60) { // Ignore mashout
26ffc2fb0eaf Fixed calculation of estimated fg and use the same method as in bmsapp.
Michiel Broek <mbroek@mbse.eu>
parents: 823
diff changeset
1278 timem = row.step_time;
26ffc2fb0eaf Fixed calculation of estimated fg and use the same method as in bmsapp.
Michiel Broek <mbroek@mbse.eu>
parents: 823
diff changeset
1279 if (i > 0)
26ffc2fb0eaf Fixed calculation of estimated fg and use the same method as in bmsapp.
Michiel Broek <mbroek@mbse.eu>
parents: 823
diff changeset
1280 timem += row.ramp_time;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1281 mashtime += timem;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1282 mashtemp += timem * row.step_temp;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1283 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1284 }
824
26ffc2fb0eaf Fixed calculation of estimated fg and use the same method as in bmsapp.
Michiel Broek <mbroek@mbse.eu>
parents: 823
diff changeset
1285 infuse = mvol;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1286 mashtemp = Round(mashtemp / mashtime, 2);
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1287 } else {
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1288 console.log("calcFermentables() no mash steps");
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1289 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1290
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1291 if (! dataRecord.fermentables.length) {
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1292 console.log("calcFermentables() no fermentables");
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1293 return; // grid not yet loaded.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1294 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1295
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1296 for (i = 0; i < dataRecord.fermentables.length; i++) {
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1297 row = dataRecord.fermentables[i];
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1298 if (row.f_adjust_to_total_100)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1299 my_100 = true;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1300 if (row.f_type == 1 && row.f_added < 4) // Sugar
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1301 psugar += row.f_percentage;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1302 if (row.f_graintype == 2 && row.f_added < 4) // Crystal
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1303 pcara += row.f_percentage;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1304 d = row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1305 if (row.f_added == 0) { // Mash
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1306 if (mvol > 0) { // Only if mash already known.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1307 mvol += row.f_amount * row.f_moisture / 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1308 s += d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1309 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1310 d = parseFloat(dataRecord.efficiency) / 100 * d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1311 sugarsm += d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1312 mashkg += parseFloat(row.f_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1313 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1314 if (row.f_added == 0 || row.f_added == 1) // Mash or Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1315 sugarsf += d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1316 if (row.f_added == 2 || row.f_added == 3) { // Fermentation or lagering
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1317 x = (row.f_yield / 100) * (1 - row.f_moisture / 100);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1318 addedS += row.f_amount * x;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1319 addedmass += row.f_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1320 vol += (x * sugardensity + (1 - x) * 1) * row.f_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1321 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1322 if (row.f_added < 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1323 colort += row.f_amount * ebc_to_srm(row.f_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1324 colorh += row.f_amount * row.f_color * get_kt(row.f_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1325 colorn += (row.f_percentage / 100) * row.f_color; // For 8.6 Pt wort.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1326 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1327 if (fermentableInit) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1328 if (row.f_added == 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1329 $('#bottle_priming_total').val(row.f_amount * 1000); // Prevent clearing
829
35207369e7ce Packagig is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 828
diff changeset
1330 $('#bottle_priming_sugar').val(row.f_name);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1331 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1332 if (row.f_added == 5) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1333 $('#keg_priming_total').val(row.f_amount * 1000);
829
35207369e7ce Packagig is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 828
diff changeset
1334 $('#keg_priming_sugar').val(row.f_name);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1335 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1336 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1337 // Check supplies.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1338 if ((((dataRecord.inventory_reduced <= 2) && (row.f_added <= 1)) || // Mash or boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1339 ((dataRecord.inventory_reduced <= 3) && (row.f_added == 2)) || // Primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1340 ((dataRecord.inventory_reduced <= 5) && (row.f_added == 3)) || // Secondary or Tertiary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1341 ((dataRecord.inventory_reduced <= 6) && (row.f_added == 4)) || // Bottle
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1342 ((dataRecord.inventory_reduced <= 6) && (row.f_added == 5))) && row.f_inventory < row.f_amount) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1343 ok_fermentables = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1344 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1345 if (row.f_added == 0 && (row.f_type == 0 || row.f_type == 4) && row.f_color < 50) { // Mash and Grain/Adjunct and Color < 50
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1346 lintner += row.f_diastatic_power * row.f_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1347 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1348 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1349 fermentableInit = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1350 $('#ferm_lintner').val(Math.round(parseFloat(lintner / mashkg)));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1351 $('#mash_kg').val(mashkg);
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1352 console.log('calcFermentables() supplies:' + ok_fermentables + ' moutsuiker:' + Round(sugarsm, 3) + '/' + Round(sugarsf, 3));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1353 to_100 = my_100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1354
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1355 if (mvol > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1356 v = s / sugardensity + mvol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1357 s = 1000 * s / (v * 10); //deg. Plato
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1358 est_mash_sg = Round(plato_to_sg(s), 5);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1359 $('#est_mash_sg').val(est_mash_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1360 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1361
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1362 // Estimate total recipe OG.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1363 dataRecord.est_og = estimate_sg(sugarsf + addedS, parseFloat(dataRecord.batch_size));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1364 $('#est_og').val(dataRecord.est_og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1365 $('#est_og2').val(dataRecord.est_og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1366 org = dataRecord.est_og;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1367
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1368 // Estimate SG in kettle after boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1369 aboil_sg = estimate_sg(sugarsf, parseFloat(dataRecord.batch_size));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1370 $('#est_og3').val(aboil_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1371
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1372 // Estimate SG in kettle before boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1373 preboil_sg = estimate_sg(sugarsm, parseFloat(dataRecord.boil_size));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1374 $('#est_pre_sg').val(preboil_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1375
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1376 // Recalculate volumes.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1377 aboil_volume = parseFloat(dataRecord.batch_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1378 if (dataRecord.brew_aboil_volume > 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1379 aboil_volume = dataRecord.brew_aboil_volume / 1.04; // volume @ 20 degrees
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1380 if (dataRecord.brew_fermenter_tcloss == 0) {
842
897bf2a43253 Renamed trub_chiller_loss to trub_loss fields.
Michiel Broek <mbroek@mbse.eu>
parents: 841
diff changeset
1381 dataRecord.brew_fermenter_tcloss = dataRecord.eq_trub_loss;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1382 $('#brew_fermenter_tcloss').val(dataRecord.brew_fermenter_tcloss);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1383 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1384 dataRecord.brew_fermenter_volume = aboil_volume - dataRecord.brew_fermenter_tcloss + dataRecord.brew_fermenter_extrawater;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1385 $('#brew_fermenter_volume').val(dataRecord.brew_fermenter_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1386 // Calculate SG in fermenter
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1387 ogx = dataRecord.brew_aboil_sg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1388 if (ogx < 1.002)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1389 ogx = aboil_sg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1390 topw = dataRecord.brew_fermenter_extrawater;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1391
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1392 if (dataRecord.brew_fermenter_volume > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1393 sug = sg_to_plato(ogx) * dataRecord.brew_fermenter_volume * ogx / 100; //kg of sugar in
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1394 sug += addedS; //kg
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1395
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1396 if ((dataRecord.brew_fermenter_volume * ogx + addedmass) > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1397 pt = 100 * sug / (dataRecord.brew_fermenter_volume * ogx + addedmass + topw);
577
b4bfed3684d0 In production archive lists show always the OG from the brew fermenter SG. Possible fix for the not used og field in the database.
Michiel Broek <mbroek@mbse.eu>
parents: 564
diff changeset
1398 dataRecord.og = dataRecord.brew_fermenter_sg = Round(plato_to_sg(pt), 4);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1399 $('#brew_fermenter_sg').val(dataRecord.brew_fermenter_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1400 // color
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1401 if (dataRecord.color_method == 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1402 dataRecord.brew_fermenter_color = Math.round(((pt / 8.6) * colorn) + (dataRecord.boil_time / 60));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1403 } else if (dataRecord.color_method == 3) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1404 dataRecord.brew_fermenter_color = Math.round((4.46 * bv * sr) / (aboil_volume + topw) * colorh);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1405 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1406 cw = colort / (aboil_volume + topw) * 8.34436;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1407 dataRecord.brew_fermenter_color = kw_to_ebc(dataRecord.color_method, cw);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1408 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1409 $('#brew_fermenter_color').val(dataRecord.brew_fermenter_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1410 scolor = ebc_to_color(dataRecord.brew_fermenter_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1411 $('#bcolorf').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1412 document.getElementById('bcolorf').style.background = scolor;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1413 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1414 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1415 // Negative volume
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1416 dataRecord.brew_fermenter_sg = dataRecord.brew_fermenter_color = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1417 $('#brew_fermenter_sg').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1418 $('#brew_fermenter_color').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1419 $('#bcolorf').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1420 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1421
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1422 // Color of the wort
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1423 if (dataRecord.color_method == 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1424 color = Math.round(((sg_to_plato(dataRecord.est_og) / 8.6) * colorn) + (dataRecord.boil_time / 60));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1425 } else if (dataRecord.color_method == 3) { // Hans Halberstadt
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1426 color = Math.round((4.46 * bv * sr) / parseFloat(dataRecord.batch_size) * colorh);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1427 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1428 cw = colort / parseFloat(dataRecord.batch_size) * 8.34436;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1429 color = kw_to_ebc(dataRecord.color_method, cw);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1430 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1431 dataRecord.est_color = color;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1432 $('#est_color').val(color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1433 $('#est_color2').val(color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1434 scolor = ebc_to_color(color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1435 document.getElementById('bcolor').style.background = scolor;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1436 document.getElementById('bcolor2').style.background = scolor;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1437
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1438 // Progress bars
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1439 pmalts = mashkg / dataRecord.eq_mash_max * 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1440 $('#perc_malts').jqxProgressBar('val', pmalts);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1441 $('#perc_sugars').jqxProgressBar('val', psugar);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1442 $('#perc_cara').jqxProgressBar('val', pcara);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1443 calcStage();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1444
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1445 // Calculate estimated svg.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1446 svg = 0; // default.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1447 initcells = 0;
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1448 for (i = 0; i < dataRecord.yeasts.length; i++) {
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1449 row = dataRecord.yeasts[i];
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1450 if (row.y_use == 0) { // Primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1451 if (parseFloat(row.y_attenuation) > svg)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1452 svg = parseFloat(row.y_attenuation); // Take the highest if multiple yeasts.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1453 if (row.y_form == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1454 initcells += (parseFloat(row.y_cells) / 1000000000) * parseFloat(row.y_amount) * (dataRecord.starter_viability / 100);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1455 else
617
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1456 initcells += (parseFloat(row.y_cells) / 1000000) * parseFloat(row.y_amount) * (dataRecord.starter_viability / 100);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1457 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1458 // TODO: brett in secondary ??
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1459 if ((((dataRecord.inventory_reduced <= 3) && (row.y_use == 0)) || // Primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1460 ((dataRecord.inventory_reduced <= 4) && (row.y_use == 1)) || // Secondary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1461 ((dataRecord.inventory_reduced <= 5) && (row.y_use == 2)) || // Tertiary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1462 ((dataRecord.inventory_reduced <= 6) && (row.y_use == 3))) && // Bottle
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1463 (row.y_inventory < row.y_amount)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1464 ok_yeasts = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1465 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1466 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1467 calcSupplies();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1468 if (svg == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1469 svg = 77;
824
26ffc2fb0eaf Fixed calculation of estimated fg and use the same method as in bmsapp.
Michiel Broek <mbroek@mbse.eu>
parents: 823
diff changeset
1470 if ((mashkg > 0) && (infuse > 0) && (mashtime > 0) && (mashtemp > 0)) {
26ffc2fb0eaf Fixed calculation of estimated fg and use the same method as in bmsapp.
Michiel Broek <mbroek@mbse.eu>
parents: 823
diff changeset
1471 dataRecord.est_fg = estimate_fg(psugar, pcara, infuse / mashkg, mashtime, mashtemp, svg, dataRecord.est_og);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1472 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1473 dataRecord.est_fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, dataRecord.est_og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1474 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1475 $('#est_fg').val(dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1476 $('#est_fg2').val(dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1477 $('#est_fg3').val(dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1478 fig = dataRecord.est_fg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1479
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1480 dataRecord.est_abv = abvol(dataRecord.est_og, dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1481 $('#est_abv').val(dataRecord.est_abv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1482 $('#est_abv2').val(dataRecord.est_abv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1483
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1484 // Calculate the final svg if available use the real value.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1485 if ((dataRecord.stage >= 6) && (dataRecord.fg > 0.990) && (dataRecord.fg < dataRecord.brew_fermenter_sg)) {
655
f4e00869f39f Calculate the svg using Brew by the Numbers, Micahel L. Hall.
Michiel Broek <mbroek@mbse.eu>
parents: 651
diff changeset
1486 svg = calc_svg(dataRecord.brew_fermenter_sg, dataRecord.fg);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1487 org = dataRecord.brew_fermenter_sg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1488 fig = dataRecord.fg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1489 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1490
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1491 $('#yeast_cells').val(initcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1492 $('#need_cells').val(getNeededYeastCells());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1493
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1494 // Calculate the calories in kcal/l (from brouwhulp)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1495 alc = 1881.22 * fig * (org - fig) / (1.775 - org);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1496 sug = 3550 * fig * (0.1808 * org + 0.8192 * fig - 1.0004);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1497 $('#kcal').val(Math.round((alc + sug) / (12 * 0.0295735296)));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1498 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1499
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1500 function calcMash() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1501
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
1502 var h, m, infused = 0, mashtime = 0, mashvol = 0, vol, i, j, n, a, b, row, temp;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1503 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
1504 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
1505 var tuntemp = 18.0;
484
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1506
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1507 if (dataRecord.mashs.length && (mashkg > 0)) {
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1508 console.log('calcMash()');
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1509 for (i = 0; i < dataRecord.mashs.length; i++) {
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1510 row = dataRecord.mashs[i];
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1511 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
1512 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
1513 // 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
1514 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
1515 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
1516 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
1517 a = mashkg * graintemp * SpecificHeatMalt + dataRecord.eq_tun_weight * tuntemp * dataRecord.eq_tun_specific_heat;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1518 b = row.step_temp * (dataRecord.eq_tun_weight * dataRecord.eq_tun_specific_heat + row.step_infuse_amount * SpecificHeatWater + mashkg * SpecificHeatMalt) - SlakingHeat * mashkg;
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1519 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
1520 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
1521 } 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
1522 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
1523 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1524 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
1525 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
1526 }
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1527 //console.log('init infuse temp: ' + row.step_infuse_temp);
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
1528 } 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
1529 // 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
1530 row.step_infuse_amount = infusionVol(infused, mashkg, row.step_infuse_temp, row.step_temp, lasttemp);
774
92e1e8f175a2 Split batch, adjust mash step volume. In the duplicated log_brew handle the missing values. In save product, round the mash step sg to 4 decimals. In prod_edit, ingredients are stored as strings, not arrays. This triggered a memory corruption that only happened in rare circumstances. Don't fix mash step fields in the javascript, it is already done during load from the database. Calculation of the mash volume is rounded to 6 decimals. Enter mash step Brix/Plato value, the SG result is rounded to 4 decimals.
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
1531 //console.log('vol: ' + row.step_infuse_amount + ' temp: ' + row.step_infuse_temp);
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1532 }
774
92e1e8f175a2 Split batch, adjust mash step volume. In the duplicated log_brew handle the missing values. In save product, round the mash step sg to 4 decimals. In prod_edit, ingredients are stored as strings, not arrays. This triggered a memory corruption that only happened in rare circumstances. Don't fix mash step fields in the javascript, it is already done during load from the database. Calculation of the mash volume is rounded to 6 decimals. Enter mash step Brix/Plato value, the SG result is rounded to 4 decimals.
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
1533 infused += 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
1534 } 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
1535 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
1536 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
1537 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
1538 } 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
1539 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
1540 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
1541 }
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1542 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
1543 //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
1544 lasttemp = row.step_temp;
484
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1545 mashtime += row.step_time + row.ramp_time;
667
1246550451ca Removed the last compressed css file. Reworked all mash steps, implemented deconction steps. Added calculations for infuse amounts and decoctions amounts. The mash steps are now manually sorted in the editor grids to have full control over the steps order. Display errors in red in the grid. Updated beerxml export, the product checklist and print output of the products and recipes for all these mash steps changes.
Michiel Broek <mbroek@mbse.eu>
parents: 662
diff changeset
1546 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
1547 $('#mashGrid').jqxGrid('updaterow', i, row);
484
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1548 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1549 }
789
e6e696add0b3 Fixed some mess in water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 784
diff changeset
1550 if ((dataRecord.w1_amount + dataRecord.w2_amount) == 0) {
e6e696add0b3 Fixed some mess in water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 784
diff changeset
1551 dataRecord.w1_amount = infused;
e6e696add0b3 Fixed some mess in water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 784
diff changeset
1552 $('#w1_amount').val(infused);
e6e696add0b3 Fixed some mess in water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 784
diff changeset
1553 console.log("calcMash() fixed water 1 to " + infused);
e6e696add0b3 Fixed some mess in water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 784
diff changeset
1554 }
774
92e1e8f175a2 Split batch, adjust mash step volume. In the duplicated log_brew handle the missing values. In save product, round the mash step sg to 4 decimals. In prod_edit, ingredients are stored as strings, not arrays. This triggered a memory corruption that only happened in rare circumstances. Don't fix mash step fields in the javascript, it is already done during load from the database. Calculation of the mash volume is rounded to 6 decimals. Enter mash step Brix/Plato value, the SG result is rounded to 4 decimals.
Michiel Broek <mbroek@mbse.eu>
parents: 772
diff changeset
1555 mashvol = Round(mashkg * MaltVolume + infused, 6);
484
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1556 $('#est_mashvol').val(mashvol);
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1557 h = Math.floor(mashtime / 60);
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1558 m = Math.floor(mashtime - (h * 60));
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1559 if (h < 10)
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1560 h = '0' + h;
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1561 if (m < 10)
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1562 m = '0' + m;
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1563 $('#est_mashtime').val(h + ':' + m);
783
006078146107 Moved the sparge water estimate formula to the calcMash() function.
Michiel Broek <mbroek@mbse.eu>
parents: 774
diff changeset
1564 // Estimated needed sparge water corrected for the temperature.
006078146107 Moved the sparge water estimate formula to the calcMash() function.
Michiel Broek <mbroek@mbse.eu>
parents: 774
diff changeset
1565 spoelw = Round((dataRecord.boil_size - infused + (mashkg * my_grain_absorbtion) + dataRecord.eq_lauter_deadspace) * 1.03, 6);
006078146107 Moved the sparge water estimate formula to the calcMash() function.
Michiel Broek <mbroek@mbse.eu>
parents: 774
diff changeset
1566 $('#brew_sparge_est').val(spoelw);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1567 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1568
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1569 function getNeededYeastCells() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1570
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1571 var plato, volume, sg = dataRecord.brew_fermenter_sg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1572 if (sg <= 1.0001 && dataRecord.fg > 1.000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1573 sg = dataRecord.fg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1574 else if (sg <= 1.0001)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1575 sg = dataRecord.est_og;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1576 plato = sg_to_plato(sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1577
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1578 volume = dataRecord.brew_fermenter_volume;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1579 if (volume <= 0)
842
897bf2a43253 Renamed trub_chiller_loss to trub_loss fields.
Michiel Broek <mbroek@mbse.eu>
parents: 841
diff changeset
1580 volume = dataRecord.batch_size - dataRecord.eq_trub_loss;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1581
697
367ae7ff52f0 Version 0.3.34 Changed log messages in the daemon. Added yeast_pitchrate field to the product database. Added yeast pitchrate edit field to the yeast tab. Initial value is guessed. There is also a popup window for predefined values. An finally the value can be edited by the user. All popup windows are initialized together.
Michiel Broek <mbroek@mbse.eu>
parents: 669
diff changeset
1582 return dataRecord.yeast_pitchrate * volume * plato;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1583 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1584
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1585 function hopFlavourContribution(bt, vol, use, amount) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1586 var result;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1587
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
1588 if (use == 4 || use == 5) // Whirlpool or Dry-hop
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
1589 return 0;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1590 if (use == 1) { // First wort
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1591 result = 0.15; // assume 15% flavourcontribution for fwh
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1592 } else if (bt > 50) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1593 result = 0.10; // assume 10% flavourcontribution as a minimum
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1594 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1595 result = 15.25 / (6 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 21) / 6, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1596 if (result < 0.10)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1597 result = 0.10; // assume 10% flavourcontribution as a minimum
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1598 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1599 return (result * amount * 1000) / vol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1600 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1601
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1602 function hopAromaContribution(bt, vol, use, amount) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1603 var result = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1604
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
1605 if (use == 5) { // Dry hop
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1606 result = 1.33;
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
1607 } else if (use == 4) { // Whirlpool
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
1608 if (bt > 30)
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
1609 bt = 30; // Max 30 minutes
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
1610 result = 0.62 * bt / 30;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1611 } else if (bt > 20) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1612 result = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1613 } else if (bt > 7.5) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1614 result = 10.03 / (4 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 7.5) / 4, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1615 } else if (use == 2) { // Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1616 result = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1617 } else if (use == 3) { // Aroma
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1618 result = 1.2;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1619 }
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
1620 return (result * amount * 1000) / vol;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1621 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1622
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1623 function calcIBUs() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1624 var total_ibus = 0, ferm_ibus = 0, rows = {}, i, row;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1625 hop_aroma = hop_flavour = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1626 if (!(rows = $('#hopGrid').jqxGrid('getrows'))) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1627 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1628 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1629 ok_hops = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1630 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1631 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1632 total_ibus += toIBU(row.h_useat, row.h_form, preboil_sg, parseFloat(dataRecord.batch_size),
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 557
diff changeset
1633 parseFloat(row.h_amount), parseFloat(row.h_time), parseFloat(row.h_alpha), dataRecord.ibu_method,
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 557
diff changeset
1634 dataRecord.brew_whirlpool9, dataRecord.brew_whirlpool7, dataRecord.brew_whirlpool6);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1635 ferm_ibus += toIBU(row.h_useat, row.h_form, preboil_sg,
559
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 557
diff changeset
1636 parseFloat(dataRecord.brew_fermenter_volume) + parseFloat(dataRecord.brew_fermenter_tcloss),
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 557
diff changeset
1637 parseFloat(row.h_amount), parseFloat(row.h_time), parseFloat(row.h_alpha), dataRecord.ibu_method,
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 557
diff changeset
1638 dataRecord.brew_whirlpool9, dataRecord.brew_whirlpool7, dataRecord.brew_whirlpool6);
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 557
diff changeset
1639 hop_flavour += hopFlavourContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size), row.h_useat, parseFloat(row.h_amount));
10cc2400b5d5 Backported extra yeast fields and the SO4:Cl ratio changes into the recipes editor.
Michiel Broek <mbroek@mbse.eu>
parents: 557
diff changeset
1640 hop_aroma += hopAromaContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size), row.h_useat, parseFloat(row.h_amount));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1641 if ((((dataRecord.inventory_reduced <= 2) && (row.h_useat <= 4)) || // Mash, FW, Boil, Aroma, Whirlpool
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1642 ((dataRecord.inventory_reduced <= 6) && (row.h_useat == 5))) && // Dry-hop
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1643 (row.h_inventory < row.h_amount))
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1644 ok_hops = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1645 }
557
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
1646 total_ibus = Round(total_ibus, 1);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
1647 ferm_ibus = Round(ferm_ibus, 1);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
1648 hop_flavour = Round(hop_flavour * 100 / 5, 1);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
1649 hop_aroma = Round(hop_aroma * 100 / 6, 1);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1650 if (hop_flavour > 100)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1651 hop_flavour = 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1652 if (hop_aroma > 100)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1653 hop_aroma = 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1654 console.log('calcIBUs(): ' + total_ibus + ' flavour: ' + hop_flavour + ' aroma: ' + hop_aroma +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1655 ' fermenter:' + ferm_ibus + ' supplies:' + ok_hops);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1656 dataRecord.est_ibu = total_ibus;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1657 $('#est_ibu').val(total_ibus);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1658 $('#est_ibu2').val(total_ibus);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1659 $('#hop_flavour').jqxProgressBar('val', hop_flavour);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1660 $('#hop_aroma').jqxProgressBar('val', hop_aroma);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1661 $('#brew_fermenter_ibu').val(ferm_ibus);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1662 calcStage();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1663 calcSupplies();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1664 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1665
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1666 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1667 * http://braukaiser.com/blog/blog/2012/11/03/estimating-yeast-growth/
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1668 *
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1669 * stype: 0=stirred, 1=shaken, 2=simple
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1670 * totcells: initial cells
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1671 * egrams: gram extract
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1672 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1673 function getGrowthRate(stype, totcells, egrams) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1674
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1675 /* Cells per grams extract (B/g) */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1676 var cpe = totcells / egrams;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1677
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1678 if (cpe > 3.5)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1679 return 0; // no growth
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1680 if (stype == 2)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1681 return 0.4; // simple starter
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1682 if (stype == 1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1683 return 0.62; // shaken starter
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1684 if (cpe <= 1.4) // stirred starter
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1685 return 1.4;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1686 return 2.33 - (.67 * cpe);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1687 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1688
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1689 function calcStep(svol, stype, start) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1690
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1691 var gperpoint = 2.72715, //number of grams of extract per point of starter gravity per liter
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1692 prate = start / svol * 1000,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1693 irate = Round(prate, 1),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1694 egrams = (dataRecord.starter_sg - 1) * svol * gperpoint,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1695 grate = getGrowthRate(stype, start, egrams),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1696 ncells = Round(egrams * grate, 1),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1697 totcells = parseFloat(ncells) + start;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1698
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1699 return {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1700 svol: svol,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1701 irate: irate,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1702 prate: Round(prate, 1),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1703 ncells: ncells,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1704 totcells: totcells,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1705 growf: Round(ncells / start, 2)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1706 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1707 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1708
649
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1709 function killstep2() {
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1710
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1711 dataRecord.prop2_volume = 0;
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1712 $('#prop2_volume').val(0);
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1713 $('#prop2_tcells').val(0);
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1714 $('#prop2_type,#prop2_volume,#prop2_irate,#prop2_ncells,#prop2_tcells,#prop2_growf').hide();
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1715 $('#r2_pmpt').show();
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1716 }
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1717
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1718 function killstep3() {
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1719
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1720 dataRecord.prop3_volume = 0;
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1721 $('#prop3_volume').val(0);
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1722 $('#prop3_tcells').val(0);
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1723 $('#prop3_type,#prop3_volume,#prop3_irate,#prop3_ncells,#prop3_tcells,#prop3_growf').hide();
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1724 $('#r3_pmpt').show();
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1725 }
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1726
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1727 function killstep4() {
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1728
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1729 dataRecord.prop4_volume = 0;
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1730 $('#prop4_volume').val(0);
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1731 $('#prop4_tcells').val(0);
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1732 $('#prop4_type,#prop4_volume,#prop4_irate,#prop4_ncells,#prop4_tcells,#prop4_growf').hide();
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1733 $('#r4_pmpt').show();
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1734 }
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1735
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1736 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1737 * Calculate all starter steps.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1738 * stype: final starter type: 0 = stirred, 1 = shaked, 2 = simple.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1739 * start: initial cells in billions
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1740 * needed: needed cells in billions
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1741 *
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1742 * result: all values updated.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1743 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1744 function calcSteps(stype, start, needed) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1745
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1746 var uvols = [20, 40, 60, 80, 100, 150, 200, 250, 375, 500, 625, 750, 875, 1000, 1250, 1500, 2000, 2500, 3000, 4000, 5000],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1747 mvols = uvols.length, svol = 0, lasti = 0, result = {}, i;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1748
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1749 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1750 * If no values are set, auto calculate the starter.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1751 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1752 if ((parseFloat($('#prop1_volume').jqxNumberInput('decimal')) + parseFloat($('#prop2_volume').jqxNumberInput('decimal')) +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1753 parseFloat($('#prop3_volume').jqxNumberInput('decimal')) + parseFloat($('#prop4_volume').jqxNumberInput('decimal'))) == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1754 // clear by default
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1755 for (i = 1; i < 5; i++) {
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1756 $('#prop' + i + '_type,#prop' + i + '_volume,#prop' + i + '_irate,#prop' + i + '_ncells,#prop' + i + '_tcells,#prop' + i + '_growf').hide();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1757 $('#r' + i + '_pmpt').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1758 $('#prop' + i + '_type').val(stype);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1759 $('#prop' + i + '_volume').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1760 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1761 if (start > needed) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1762 return; // no starter needed
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1763 }
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1764 $('#prop1_type,#prop1_volume,#prop1_irate,#prop1_ncells,#prop1_tcells,#prop1_growf').show();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1765 $('#r1_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1766 for (i = lasti; i <= mvols; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1767 lasti = i;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1768 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1769 result = calcStep(svol, stype, start);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1770 if (result.irate < 25) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1771 // inocculation rate too low, backup one step and break out.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1772 lasti = i - 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1773 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1774 result = calcStep(svol, stype, start);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1775 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1776 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1777 if (result.totcells > needed || i == mvols) { // hit the target or loops done
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1778 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1779 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1780 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1781 $('#prop1_volume').val(result.svol / 1000); // to liters
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1782 $('#prop1_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1783 $('#prop1_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1784 $('#prop1_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1785 $('#prop1_growf').val(result.growf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1786 if (result.totcells > needed)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1787 return; // hit the target
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1788
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1789 // second stage
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1790 $('#r2_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1791 $('#prop2_type').val(stype);
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1792 $('#prop2_type,#prop2_volume,#prop2_irate,#prop2_ncells,#prop2_tcells,#prop2_growf').show();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1793 for (i = lasti; i <= mvols; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1794 lasti = i;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1795 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1796 result = calcStep(svol, stype, $('#prop1_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1797 if (result.irate < 25) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1798 lasti = i - 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1799 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1800 result = calcStep(svol, stype, $('#prop1_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1801 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1802 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1803 if (result.totcells > needed || i == mvols) { // hit the target or loops done
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1804 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1805 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1806 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1807 $('#prop2_volume').val(result.svol / 1000); // to liters
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1808 $('#prop2_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1809 $('#prop2_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1810 $('#prop2_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1811 $('#prop2_growf').val(result.growf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1812 if (result.totcells > needed)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1813 return; // hit the target
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1814
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1815 // third stage
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1816 $('#r3_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1817 $('#prop3_type').val(stype);
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1818 $('#prop3_type,#prop3_volume,#prop3_irate,#prop3_ncells,#prop3_tcells,#prop3_growf').show();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1819 for (i = lasti; i <= mvols; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1820 lasti = i;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1821 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1822 result = calcStep(svol, stype, $('#prop2_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1823 if (result.irate < 25) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1824 lasti = i - 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1825 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1826 result = calcStep(svol, stype, $('#prop2_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1827 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1828 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1829 if (result.totcells > needed || i == mvols) { // hit the target or loops done
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1830 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1831 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1832 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1833 $('#prop3_volume').val(result.svol / 1000); // to liters
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1834 $('#prop3_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1835 $('#prop3_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1836 $('#prop3_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1837 $('#prop3_growf').val(result.growf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1838 if (result.totcells > needed)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1839 return; // hit the target
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1840
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1841 // fourth stage
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1842 $('#r4_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1843 $('#prop4_type').val(stype);
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1844 $('#prop4_type,#prop4_volume,#prop4_irate,#prop4_ncells,#prop4_tcells,#prop4_growf').show();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1845 for (i = lasti; i <= mvols; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1846 lasti = i;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1847 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1848 result = calcStep(svol, stype, $('#prop3_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1849 if (result.totcells > needed || i == mvols) { // hit the target or loops done
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1850 $('#prop4_volume').val(result.svol / 1000); // to liters
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1851 $('#prop4_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1852 $('#prop4_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1853 $('#prop4_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1854 $('#prop4_growf').val(result.growf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1855 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1856 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1857 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1858 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1859 // recalculate
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1860 if (dataRecord.prop1_volume > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1861 $('#r1_pmpt').hide();
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1862 $('#prop1_type,#prop1_volume,#prop1_irate,#prop1_ncells,#prop1_tcells,#prop1_growf').show();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1863 result = calcStep($('#prop1_volume').val() * 1000, dataRecord.prop1_type, start);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1864 $('#prop1_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1865 $('#prop1_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1866 $('#prop1_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1867 $('#prop1_growf').val(result.growf);
649
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1868 if (result.totcells > needed) {
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1869 killstep2();
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1870 killstep3();
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1871 killstep4();
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1872 } else if (dataRecord.prop2_volume == 0) {
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1873 dataRecord.prop2_volume = dataRecord.prop1_volume; /* Extra step needed, start with the same size */
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1874 dataRecord.prop2_type = dataRecord.prop1_type;
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1875 $('#prop2_volume').val(dataRecord.prop2_volume);
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1876 $('#prop2_type').val(dataRecord.prop2_type);
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1877 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1878 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1879 if (dataRecord.prop2_volume > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1880 $('#r2_pmpt').hide();
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1881 $('#prop2_type,#prop2_volume,#prop2_irate,#prop2_ncells,#prop2_tcells,#prop2_growf').show();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1882 result = calcStep($('#prop2_volume').val() * 1000, dataRecord.prop2_type, $('#prop1_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1883 $('#prop2_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1884 $('#prop2_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1885 $('#prop2_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1886 $('#prop2_growf').val(result.growf);
649
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1887 if (result.totcells > needed) {
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1888 killstep3();
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1889 killstep4();
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1890 } else if (dataRecord.prop3_volume == 0) {
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1891 dataRecord.prop3_volume = dataRecord.prop2_volume; /* Extra step needed, start with the same size */
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1892 dataRecord.prop3_type = dataRecord.prop2_type;
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1893 $('#prop3_volume').val(dataRecord.prop3_volume);
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1894 $('#prop3_type').val(dataRecord.prop3_type);
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1895 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1896 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1897 if (dataRecord.prop3_volume > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1898 $('#r3_pmpt').hide();
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1899 $('#prop3_type,#prop3_volume,#prop3_irate,#prop3_ncells,#prop3_tcells,#prop3_growf').show();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1900 result = calcStep($('#prop3_volume').val() * 1000, dataRecord.prop3_type, $('#prop2_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1901 $('#prop3_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1902 $('#prop3_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1903 $('#prop3_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1904 $('#prop3_growf').val(result.growf);
649
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1905 if (result.totcells > needed) {
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1906 killstep4();
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1907 } else if (dataRecord.prop4_volume == 0) {
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1908 dataRecord.prop4_volume = dataRecord.prop3_volume; /* Extra step needed, start with the same size */
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1909 dataRecord.prop4_type = dataRecord.prop3_type;
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1910 $('#prop4_volume').val(dataRecord.prop4_volume);
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1911 $('#prop4_type').val(dataRecord.prop4_type);
52053730f6e1 Yeast starter now automatic adds or removes step lines as they are needed.
Michiel Broek <mbroek@mbse.eu>
parents: 648
diff changeset
1912 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1913 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1914 if (dataRecord.prop4_volume > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1915 $('#r4_pmpt').hide();
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
1916 $('#prop4_type,#prop4_volume,#prop4_irate,#prop4_ncells,#prop4_tcells,#prop4_growf').show();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1917 result = calcStep($('#prop4_volume').val() * 1000, dataRecord.prop4_type, $('#prop3_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1918 $('#prop4_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1919 $('#prop4_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1920 $('#prop4_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1921 $('#prop4_growf').val(result.growf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1922 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1923 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1924 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1925
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1926 function calcYeast() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1927
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1928 // Calculate needed cells.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1929 var plato, volume, rows, rowscount, row, i, needed, use_cells, sg = dataRecord.brew_fermenter_sg;
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1930
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1931 if (sg <= 1.0001 && dataRecord.fg > 1.000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1932 sg = dataRecord.fg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1933 else if (sg <= 1.0001)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1934 sg = dataRecord.est_og;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1935 plato = sg_to_plato(sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1936
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1937 volume = dataRecord.brew_fermenter_volume;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1938 if (volume > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1939 if (dataRecord.brew_fermenter_extrawater > 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1940 volume += dataRecord.brew_fermenter_extrawater;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1941 } else {
842
897bf2a43253 Renamed trub_chiller_loss to trub_loss fields.
Michiel Broek <mbroek@mbse.eu>
parents: 841
diff changeset
1942 volume = dataRecord.batch_size - dataRecord.eq_trub_loss;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1943 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1944
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1945 // Also in calcFermentables()
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1946 $('#yeast_cells').val(initcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1947
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1948 if (!(rows = $('#yeastGrid').jqxGrid('getrows'))) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1949 return; // grid not yet loaded.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1950 }
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1951 rowscount = dataRecord.yeasts.length;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1952 if (rowscount == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1953 return; // no yeast in recipe
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1954
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1955 $('.primary_dry').hide();
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1956 $('.primary_liquid').hide();
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1957
620
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
1958 var maybe_starter = 0;
697
367ae7ff52f0 Version 0.3.34 Changed log messages in the daemon. Added yeast_pitchrate field to the product database. Added yeast pitchrate edit field to the yeast tab. Initial value is guessed. There is also a popup window for predefined values. An finally the value can be edited by the user. All popup windows are initialized together.
Michiel Broek <mbroek@mbse.eu>
parents: 669
diff changeset
1959 var pitchrate = 0.75; // Yeast pitch rate default
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1960 for (i = 0; i < rowscount; i++) {
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1961 row = dataRecord.yeasts[i];
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1962 if (row.y_use == 0) { // primary
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1963 if (row.y_form == 1) {
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1964 // Dry yeast
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1965 $('.primary_dry').show();
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1966 console.log('dry yeast: ' + row.y_gr_hl_lo + '@' + row.y_sg_lo + ' ' + row.y_gr_hl_hi + '@' + row.y_sg_hi);
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1967 // Build the formule with the yeast parameters.
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1968 // Based on https://www.lallemandbrewing.com/en/canada/brewers-corner/brewing-tools/pitching-rate-calculator/
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1969 var og = row.y_sg_lo;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1970 var f1 = row.y_gr_hl_lo / 100;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1971 var f2 = Round(f1 / 5, 6);
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1972 // After a lot of try and error, study, the best thing to increase the pitch amount is actually
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1973 // use this simple formula by Lallemand. This is about the same as sugar weight increment in the wort.
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1974 var multiplier = (sg <= og) ? f1 : (f1 + f2 * (sg - og) / 0.008);
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1975 console.log('sg: ' + sg + ' og: ' + og + ' f1: ' + f1 + ' f2: ' + f2 + ' multiplier: ' + multiplier);
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1976 // dataRecord.starter_viability
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1977 var yeast_grams = Round(volume * multiplier * (100 / dataRecord.starter_viability), 2);
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1978 $('#yeast_grams').val(yeast_grams);
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1979 var yeast_gr_hl = Round(yeast_grams / (volume * 0.01), 2);
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1980 $('#yeast_gr_hl').val(yeast_gr_hl);
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
1981 //console.log('need ' + yeast_grams + ' grams, gr/hl: ' + yeast_gr_hl);
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1982
617
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
1983 } else {
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1984 // Liquid yeast
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1985 $('.primary_liquid').show();
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1986 // pitchrate see https://www.brewersfriend.com/yeast-pitch-rate-and-starter-calculator/
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1987 // and http://braukaiser.com/blog/blog/2012/11/03/estimating-yeast-growth/
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1988 if (row.y_type == 0) { // lager yeast
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1989 pitchrate = 1.5;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1990 if (dataRecord.est_og > 1.060)
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1991 pitchrate = 2.0;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1992 } else if (row.y_type == 6) { // Kveik
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1993 pitchrate = 0.075;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1994 } else {
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1995 pitchrate = 0.75;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1996 if (dataRecord.est_og > 1.060)
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1997 pitchrate = 1.0;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1998 }
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
1999 if (dataRecord.yeast_pitchrate < 0.01) {
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2000 dataRecord.yeast_pitchrate = pitchrate;
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2001 $('#yeast_pitchrate').val(pitchrate);
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
2002 }
620
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
2003 maybe_starter = 1;
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
2004 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2005 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2006 }
620
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
2007
697
367ae7ff52f0 Version 0.3.34 Changed log messages in the daemon. Added yeast_pitchrate field to the product database. Added yeast pitchrate edit field to the yeast tab. Initial value is guessed. There is also a popup window for predefined values. An finally the value can be edited by the user. All popup windows are initialized together.
Michiel Broek <mbroek@mbse.eu>
parents: 669
diff changeset
2008 needed = Round(dataRecord.yeast_pitchrate * volume * plato, 1);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2009 $('#need_cells').val(needed);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2010 use_cells = initcells;
620
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
2011 if (needed <= initcells)
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
2012 maybe_starter = 0;
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2013 //console.log('calcYeast() pitchrate:' + dataRecord.yeast_pitchrate + ' start:' + initcells + ' needed:' + needed + ' volume:' + volume + ' maybe_starter:' + maybe_starter);
620
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
2014
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
2015 if (maybe_starter != dataRecord.starter_enable) {
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
2016 dataRecord.starter_enable = maybe_starter;
5dae36a2d5be Automatic starter enable/disable
Michiel Broek <mbroek@mbse.eu>
parents: 619
diff changeset
2017 }
826
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
2018 if (maybe_starter)
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
2019 $('#propagator').show();
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
2020 else
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
2021 $('#propagator').hide();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2022
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2023 if (dataRecord.starter_enable) {
823
506246d65043 Tab 6 is a viewer
Michiel Broek <mbroek@mbse.eu>
parents: 822
diff changeset
2024
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2025 calcSteps(dataRecord.starter_type, initcells, needed);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2026
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2027 for (i = 1; i < 5; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2028 $('#r' + i + '_irate').html('');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2029 $('#r' + i + '_growf').html('');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2030 $('#r' + i + '_tcells').html('');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2031 if (parseFloat($('#prop' + i + '_volume').val()) > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2032 if ((parseFloat($('#prop' + i + '_irate').val()) < 25) || (parseFloat($('#prop' + i + '_irate').val()) > 100)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2033 $('#r' + i + '_irate').html("<img src='images/dialog-error.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2034 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2035 $('#r' + i + '_irate').html("<img src='images/dialog-ok-apply.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2036 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2037 if (parseFloat($('#prop' + i + '_growf').val()) < 1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2038 $('#r' + i + '_growf').html("<img src='images/dialog-error.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2039 if (($('#prop' + i + '_type').val() > 0) && (parseFloat($('#prop' + i + '_growf').val()) > 3))
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2040 $('#r' + i + '_growf').html("<img src='images/dialog-error.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2041 if (parseFloat($('#prop' + i + '_tcells').val()) > needed)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2042 $('#r' + i + '_tcells').html("<img src='images/dialog-ok-apply.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2043 use_cells = parseFloat($('#prop' + i + '_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2044 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2045 $('#r' + i + '_irate').html('');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2046 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2047 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2048 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2049 $('#plato_cells').val(parseFloat(use_cells / (volume * plato)));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2050 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2051
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2052 function whirlpoolHops() {
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2053 var row, i, time, rowscount = dataRecord.hops.length;
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2054 if (rowscount == 0)
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2055 return;
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2056 for (i = 0; i < rowscount; i++) {
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2057 row = dataRecord.hops[i];
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2058 if (row.h_useat == 4) {
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2059 time = parseFloat(dataRecord.brew_whirlpool9) + parseFloat(dataRecord.brew_whirlpool7) + parseFloat(dataRecord.brew_whirlpool6);
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2060 dataRecord.hops[i].h_time = time;
538
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2061 $('#hopGrid').jqxGrid('setcellvalue', i, 'h_time', time);
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2062 }
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2063 }
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2064 };
41d21817608e Added the IBU contribution for whirlpool hops.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
2065
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2066 function calcMiscs() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2067
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2068 ok_miscs = 1;
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2069 var row, i, rowscount = dataRecord.miscs.length;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2070 if (rowscount == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2071 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2072 for (i = 0; i < rowscount; i++) {
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2073 row = dataRecord.miscs[i];
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2074 if ((((dataRecord.inventory_reduced <= 2) && (row.m_use_use <= 2)) || // Starter, Mash, Boil
826
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
2075 ((dataRecord.inventory_reduced <= 2) && (row.m_use_use == 6)) || // Sparge
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2076 ((dataRecord.inventory_reduced <= 3) && (row.m_use_use == 3)) || // Primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2077 ((dataRecord.inventory_reduced <= 5) && (row.m_use_use == 4)) || // Secondary, Teriary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2078 ((dataRecord.inventory_reduced <= 6) && (row.m_use_use == 5))) && // Bottle
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2079 (row.m_inventory < row.m_amount)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2080 ok_miscs = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2081 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2082 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2083 calcSupplies();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2084 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2085
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2086 function GetBUGU() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2087 var gu = (dataRecord.est_og - 1) * 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2088 if (gu > 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2089 return dataRecord.est_ibu / gu;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2090 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2091 return 0.5;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2092 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2093
552
ee0db754111e In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents: 545
diff changeset
2094 function GetOptSO4Clratio() {
ee0db754111e In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents: 545
diff changeset
2095 var BUGU = GetBUGU();
ee0db754111e In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents: 545
diff changeset
2096 return (1.0 / (-1.2 * BUGU + 1.4));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2097 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2098
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2099 function setWaterAgent(name, amount, use) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2100 var row, i, id, found = false, miscs, rows = $('#miscGrid').jqxGrid('getrows');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2101 if (amount == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2102 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2103 row = rows[i];
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2104 if (row.m_name == name && row.m_use_use == use) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2105 id = $('#miscGrid').jqxGrid('getrowid', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2106 $('#miscGrid').jqxGrid('deleterow', id);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2107 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2108 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2109 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2110 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2111 row = rows[i];
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2112 if (row.m_name == name && row.m_use_use == use) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2113 found = true;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2114 $('#miscGrid').jqxGrid('setcellvalue', i, 'm_amount', amount / 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2115 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2116 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2117 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2118 if (! found) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2119 miscs = new $.jqx.dataAdapter(miscInvSource, {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2120 loadComplete: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2121 var record, i, row = {}, records = miscs.records;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2122 for (i = 0; i < records.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2123 record = records[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2124 if (record.name == name) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2125 row['m_name'] = record.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2126 row['m_amount'] = amount / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2127 row['m_cost'] = record.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2128 row['m_type'] = record.type;
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2129 row['m_use_use'] = use;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2130 row['m_time'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2131 row['m_amount_is_weight'] = record.amount_is_weight;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2132 row['m_inventory'] = record.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2133 row['m_avail'] = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2134 $('#miscGrid').jqxGrid('addrow', null, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2135 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2136 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2137 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2138 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2139 miscs.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2140 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2141 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2142 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2143 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2144
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2145 function setRangeIndicator(ion, rangeCode) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2146 if ((rangeCode == 'laag') || (rangeCode == 'hoog'))
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2147 $('#wr_' + ion).html("<img src='images/dialog-error.png'><span style='vertical-align: top; font-size: 10px; font-style: italic;'>" + rangeCode + '</span>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2148 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2149 $('#wr_' + ion).html("<img src='images/dialog-ok-apply.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2150 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2151
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2152 function mix(v1, v2, c1, c2) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2153 if ((v1 + v2) > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2154 return ((v1 * c1) + (v2 * c2)) / (v1 + v2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2155 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2156 return 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2157 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2158
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2159 function PartCO3(pH) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2160 var H = Math.pow(10, -pH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2161 return 100 * Ka1 * Ka2 / (H * H + H * Ka1 + Ka1 * Ka2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2162 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2163
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2164 function PartHCO3(pH) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2165 var H = Math.pow(10, -pH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2166 return 100 * Ka1 * H / (H * H + H * Ka1 + Ka1 * Ka2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2167 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2168
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2169 function Charge(pH) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2170 return (-2 * PartCO3(pH) - PartHCO3(pH));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2171 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2172
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2173 //Z alkalinity is the amount of acid (in mEq/l) needed to bring water to the target pH (Z pH)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2174 function ZAlkalinity(pHZ) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2175 var C43 = Charge(4.3),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2176 Cw = Charge(parseFloat($('#wg_ph').jqxNumberInput('decimal'))),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2177 Cz = Charge(pHZ),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2178 DeltaCNaught = -C43 + Cw,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2179 CT = parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal')) / 50 / DeltaCNaught,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2180 DeltaCZ = -Cz + Cw;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2181 return CT * DeltaCZ;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2182 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2183
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2184 //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)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2185 function ZRA(pHZ) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2186
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2187 var Magn, Z, Calc = parseFloat($('#wg_calcium').jqxNumberInput('decimal')) / (MMCa / 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2188 Magn = parseFloat($('#wg_magnesium').jqxNumberInput('decimal')) / (MMMg / 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2189 Z = ZAlkalinity(pHZ);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2190 return Z - (Calc / 3.5 + Magn / 7);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2191 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2192
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
2193 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
2194 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
2195 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
2196 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
2197 } else {
622
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
2198 // If the acid_to_ph_5.7 is unknown from the maltster, guess the required acid.
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2199 switch (graintype) {
622
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
2200 case 0: // Base, Special, Kilned
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
2201 case 3:
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
2202 case 5: C1 = 0.014 * ebc - 34.192;
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
2203 break;
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
2204 case 2: C1 = -0.0597 * ebc - 32.457; // Crystal
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
2205 break;
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
2206 case 1: C1 = 0.0107 * ebc - 54.768; // Roast
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
2207 break;
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
2208 case 4: C1 = -149; // Sour malt
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
2209 break;
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
2210 }
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
2211 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2212 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
2213 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2214
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2215 function ProtonDeficit(pHZ) {
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2216
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2217 var i, C1, x, Result = ZRA(pHZ) * parseFloat($('#wg_amount').jqxNumberInput('decimal'));
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
2218 // proton deficit for the grist
756
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2219 if (( $('#fermentableGrid').jqxGrid('getrows'))) {
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2220 for (i = 0; i < dataRecord.fermentables.length; i++) {
b702c25661e7 Removed unnecesary code. Use existing array data instead of grid calls where possible.
Michiel Broek <mbroek@mbse.eu>
parents: 755
diff changeset
2221 row = dataRecord.fermentables[i];
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
2222 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
2223 C1 = BufferCapacity(row.f_di_ph, row.f_acid_to_ph_57, row.f_color, row.f_graintype);
622
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
2224 x = C1 * (pHZ - row.f_di_ph); // AcidRequired(ZpH)
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
2225 Result += x * row.f_amount;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2226 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2227 }
622
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
2228 } else {
642
9d1af81b20ef Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 641
diff changeset
2229 error_count++;
9d1af81b20ef Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 641
diff changeset
2230 if (error_count < 5)
9d1af81b20ef Limit debug ProtoDeficit error messages. If the need for a yeast starter changes, make sure the screen is updated. Another set of extra debug logs. Fixed try yeast starter. Several dropdown lists changed the action from change to select. This should fix te too early calculations while the data was not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 641
diff changeset
2231 console.log('ProtonDeficit(' + pHZ + ') invalid grist, return ' + Result);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2232 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2233 return Result;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2234 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2235
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2236 function MashpH() {
643
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
2237
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2238 var n = 0, pH = 5.4, deltapH = 0.001, deltapd = 0.1, pd = ProtonDeficit(pH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2239 while (((pd < -deltapd) || (pd > deltapd)) && (n < 2000)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2240 n++;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2241 if (pd < -deltapd)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2242 pH -= deltapH;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2243 else if (pd > deltapd)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2244 pH += deltapH;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2245 pd = ProtonDeficit(pH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2246 }
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
2247 pH = Round(pH, 6);
644
4654b8ee4690 Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
2248 //console.log('MashpH() n: ' + n + ' pH: ' + pH);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2249 return pH;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2250 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2251
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2252 function calcWater() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2253
644
4654b8ee4690 Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
2254 /* Can be called during loading and building the screens */
643
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
2255 if (! data_loaded) {
644
4654b8ee4690 Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
2256 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
2257 return;
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
2258 }
9ac2fb6b1311 Added failsave starting calcWater() when the main data is not yet loaded.
Michiel Broek <mbroek@mbse.eu>
parents: 642
diff changeset
2259
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2260 var liters = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2261 calcium = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2262 magnesium = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2263 sodium = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2264 total_alkalinity = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2265 chloride = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2266 sulfate = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2267 ph = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2268 RA = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2269 frac = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2270 TpH = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2271 protonDeficit = 0,
760
fce78f57a44d Removed water base additions for pH
Michiel Broek <mbroek@mbse.eu>
parents: 759
diff changeset
2272 AT, /*BT,*/
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2273 r1d, r2d, f1d, f2d, f3d,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2274 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
2275 Res;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2276
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2277 if (dataRecord.w1_name == '') {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2278 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2279 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2280
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2281 $('#w1_hardness').val(Hardness(dataRecord.w1_calcium, dataRecord.w1_magnesium));
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2282 $('#w1_ra').val(ResidualAlkalinity(dataRecord.w1_total_alkalinity, dataRecord.w1_calcium, dataRecord.w1_magnesium));
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2283
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2284 // If there is a dillute water source, mix the waters.
789
e6e696add0b3 Fixed some mess in water calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 784
diff changeset
2285 if ((dataRecord.w2_name != '') && (dataRecord.w2_name != 'Geen mengwater')) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2286 liters = dataRecord.w1_amount + dataRecord.w2_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2287 calcium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_calcium, dataRecord.w2_calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2288 magnesium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_magnesium, dataRecord.w2_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2289 sodium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_sodium, dataRecord.w2_sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2290 chloride = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_chloride, dataRecord.w2_chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2291 sulfate = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_sulfate, dataRecord.w2_sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2292 total_alkalinity = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_total_alkalinity, dataRecord.w2_total_alkalinity);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2293 ph = -Math.log10(((Math.pow(10, -dataRecord.w1_ph) * dataRecord.w1_amount) + (Math.pow(10, -dataRecord.w2_ph) * dataRecord.w2_amount)) / liters);
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2294 $('#w2_hardness').val(Hardness(dataRecord.w2_calcium, dataRecord.w2_magnesium));
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2295 $('#w2_ra').val(ResidualAlkalinity(dataRecord.w2_total_alkalinity, dataRecord.w2_calcium, dataRecord.w2_magnesium));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2296 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2297 liters = dataRecord.w1_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2298 calcium = dataRecord.w1_calcium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2299 magnesium = dataRecord.w1_magnesium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2300 sodium = dataRecord.w1_sodium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2301 chloride = dataRecord.w1_chloride;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2302 sulfate = dataRecord.w1_sulfate;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2303 total_alkalinity = dataRecord.w1_total_alkalinity;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2304 ph = dataRecord.w1_ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2305 }
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2306 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
2307
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2308 /* 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
2309 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
2310 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
2311 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
2312 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
2313 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
2314 var wg_bicarbonate = bicarbonate;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2315
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2316 dataRecord.wg_amount = liters;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2317 dataRecord.wg_ph = ph;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2318
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2319 $('#wg_amount').val(liters);
662
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2320 $('#wg_calcium').val(Round(calcium, 1));
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2321 $('#wg_magnesium').val(Round(magnesium, 1));
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2322 $('#wg_sodium').val(Round(sodium, 1));
764
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
2323 $('#wg_bicarbonate').val(Round(bicarbonate, 1));
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
2324 $('#wg_total_alkalinity').val(Round(total_alkalinity, 1));
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2325 $('#wg_chloride').val(Round(chloride, 1));
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2326 $('#wg_sulfate').val(Round(sulfate, 1));
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2327 $('#wg_ph').val(Round(ph, 2));
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2328 $('#wg_hardness').val(Round(Hardness(calcium, magnesium), 1));
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2329 $('#wg_ra').val(Round(ResidualAlkalinity(total_alkalinity, calcium, magnesium), 1));
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
2330
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2331 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
2332 console.log('Distilled water mash pH: ' + mash_ph);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2333
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2334 /* 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
2335 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
2336 calcium += (parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 * 1000 +
758
e6814bed4cb1 Moved NaHCO3 and CaCO3 from the base additions to the water agent salts.
Michiel Broek <mbroek@mbse.eu>
parents: 757
diff changeset
2337 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4 * 1000 +
e6814bed4cb1 Moved NaHCO3 and CaCO3 from the base additions to the water agent salts.
Michiel Broek <mbroek@mbse.eu>
parents: 757
diff changeset
2338 parseFloat($('#wa_caco3').jqxNumberInput('decimal')) * MMCa / MMCaCO3 * 1000) / liters;
759
89bcab49284a Added MgCl2 brewing salt
Michiel Broek <mbroek@mbse.eu>
parents: 758
diff changeset
2339 magnesium += (parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMMg / MMMgSO4 * 1000 +
89bcab49284a Added MgCl2 brewing salt
Michiel Broek <mbroek@mbse.eu>
parents: 758
diff changeset
2340 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
2341 sodium += (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 1000 +
758
e6814bed4cb1 Moved NaHCO3 and CaCO3 from the base additions to the water agent salts.
Michiel Broek <mbroek@mbse.eu>
parents: 757
diff changeset
2342 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
2343 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
2344 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
2345 chloride += (2 * parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 * 1000 +
759
89bcab49284a Added MgCl2 brewing salt
Michiel Broek <mbroek@mbse.eu>
parents: 758
diff changeset
2346 parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl * 1000 +
89bcab49284a Added MgCl2 brewing salt
Michiel Broek <mbroek@mbse.eu>
parents: 758
diff changeset
2347 parseFloat($('#wa_mgcl2').jqxNumberInput('decimal')) * MMCl / MMMgCl2 * 1000) / liters;
758
e6814bed4cb1 Moved NaHCO3 and CaCO3 from the base additions to the water agent salts.
Michiel Broek <mbroek@mbse.eu>
parents: 757
diff changeset
2348 bicarbonate += (parseFloat($('#wa_nahco3').jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3 * 1000 +
e6814bed4cb1 Moved NaHCO3 and CaCO3 from the base additions to the water agent salts.
Michiel Broek <mbroek@mbse.eu>
parents: 757
diff changeset
2349 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
2350 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2351
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2352 if (dataRecord.wa_acid_name < 0 || dataRecord,wa_acid_name >= AcidTypeData.length) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2353 $('#wa_acid_name').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2354 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
2355 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
2356 $('#wa_acid_perc').val(AcidTypeData[0].AcidPrc);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2357 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2358 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
2359 last_acid = AcidTypeData[dataRecord.wa_acid_name].nl;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2360
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2361 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
2362 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
2363 $('#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
2364 }
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2365
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2366 AT = dataRecord.wa_acid_name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2367
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
2368 /* 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
2369 This pH change is at most 0.1 pH and is a minor difference in Acid amount. */
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2370
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2371 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
2372 /* Auto calculate pH */
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2373 $('.c_mashph').show();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2374 TpH = parseFloat(dataRecord.mash_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2375 protonDeficit = ProtonDeficit(TpH);
644
4654b8ee4690 Version 0.3.30 Code and logging cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 643
diff changeset
2376 //console.log('calc_acid tgt: ' + TpH + ' protonDeficit: ' + protonDeficit);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2377 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
2378 frac = CalcFrac(TpH, AcidTypeData[AT].pK1, AcidTypeData[AT].pK2, AcidTypeData[AT].pK3);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2379 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
2380 Acid *= AcidTypeData[AT].MolWt; // mg
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2381 Acidmg = Acid;
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2382 var RealSG = Round(((AcidTypeData[AT].AcidSG - 1000) * (parseFloat(dataRecord.wa_acid_perc) / 100)) + 1000, 2);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2383 Acid /= RealSG;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2384 Acid /= AcidTypeData[AT].AcidPrc / 100;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2385 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
2386 console.log('Mash auto Acid final ml: ' + Acid);
495
fdbb6bfae569 Disabled some console.log items.
Michiel Broek <mbroek@mbse.eu>
parents: 490
diff changeset
2387 $('#wa_acid').val(Acid);
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2388 setWaterAgent(AcidTypeData[AT].nl, Acid, 1);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2389
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2390 bicarbonate = bicarbonate - protonDeficit * frac / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2391 total_alkalinity = bicarbonate * 50 / 61;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2392 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2393 ph = TpH;
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2394 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
2395 $('#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
2396 $('#est_mash_ph').val(Round(ph, 2));
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2397 } 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
2398 /* 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
2399 $('.c_mashph').hide();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2400 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
2401 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
2402 // 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
2403 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
2404 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
2405 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
2406 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
2407 Acidmg = Acid;
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2408
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2409 //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
2410 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
2411 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
2412 //console.log('protonDeficit Acid: ' + protonDeficit + ' frac: ' + frac + ' pH: ' + pHa);
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2413
4bb005694ce7 Version 0.3.32 Inventory water and profile water edit screens updated and added ion balance fields. Moved acid specs to global.js. In prod_edit and rec_edit changed the water calculations, eliminated the double percentage calculation. The pH values in the water tab have now 2 decimal digits. The mash pH field is only shown in auto calculate mode. The calculated acid addition results are now a bit better and compare with several famous spreadsheets.
Michiel Broek <mbroek@mbse.eu>
parents: 660
diff changeset
2414 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
2415 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
2416 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
2417 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
2418 while (((pd < (protonDeficit - deltapd)) || (pd > (protonDeficit + deltapd))) && (n < 4000)) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2419 n++;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2420 if (pd < (protonDeficit - deltapd))
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2421 pHa -= deltapH;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2422 else if (pd > (protonDeficit + deltapd))
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2423 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
2424 frac = CalcFrac(pHa, AcidTypeData[AT].pK1, AcidTypeData[AT].pK2, AcidTypeData[AT].pK3);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2425 protonDeficit = Acid * frac;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2426 pd = ProtonDeficit(pHa);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2427 }
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
2428 //console.log('n: ' + n + ' pd: ' + pd + ' protonDeficit: ' + protonDeficit + ' frac: ' + frac + ' pHa: ' + pHa);
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2429 bicarbonate = wg_bicarbonate - protonDeficit * frac / liters;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2430 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
2431 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
2432 $('#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
2433 $('#est_mash_ph').val(Round(ph, 2));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2434 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2435
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
2436 if ((AT == 3) && (liters > 0)) { // Sulfuric / Zwavelzuur
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2437 RA = parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2438 parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2439 Acidmg / 1000 * MMSO4 / (MMSO4 + 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2440 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2441 sulfate = wg_sulfate + RA; // Not add to sulfate??
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2442 } else if ((AT == 1) && (liters > 0)) { // Hydrochloric, Zoutzuur
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2443 RA = parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2444 parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2445 Acidmg / 1000 * MMCl / (MMCl + 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2446 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2447 chloride = wg_chloride + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2448 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2449
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2450 var BUGU = GetBUGU();
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2451 $('#tgt_bu').val(Round(BUGU, 2));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2452 // From brouwhulp.
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2453 if (BUGU < 0.32)
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2454 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer moutig en zoet</span>");
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2455 else if (BUGU < 0.43)
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2456 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Moutig, zoet</span>");
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2457 else if (BUGU < 0.52)
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2458 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Evenwichtig</span>");
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2459 else if (BUGU < 0.63)
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2460 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Licht hoppig, bitter</span>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2461 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2462 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Extra hoppig, zeer bitter</span>");
552
ee0db754111e In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents: 545
diff changeset
2463
ee0db754111e In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents: 545
diff changeset
2464 // Sulfate to Chloride ratio (Palmer).
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2465 var OptSO4Clratio = GetOptSO4Clratio();
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2466 $('#tgt_so4_cl').val(Round(OptSO4Clratio, 1));
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2467 if (OptSO4Clratio < 0.4)
552
ee0db754111e In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents: 545
diff changeset
2468 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Te moutig</span>");
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2469 else if (OptSO4Clratio < 0.6)
552
ee0db754111e In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents: 545
diff changeset
2470 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer moutig</span>");
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2471 else if (OptSO4Clratio < 0.8)
552
ee0db754111e In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents: 545
diff changeset
2472 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Moutig</span>");
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2473 else if (OptSO4Clratio < 1.5)
552
ee0db754111e In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents: 545
diff changeset
2474 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Gebalanceerd</span>");
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2475 else if (OptSO4Clratio < 2.0)
552
ee0db754111e In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents: 545
diff changeset
2476 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Licht bitter</span>");
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2477 else if (OptSO4Clratio < 4.0)
552
ee0db754111e In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents: 545
diff changeset
2478 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Bitter</span>");
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2479 else if (OptSO4Clratio < 9.0)
552
ee0db754111e In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents: 545
diff changeset
2480 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer bitter</span>");
ee0db754111e In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents: 545
diff changeset
2481 else
ee0db754111e In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents: 545
diff changeset
2482 $('#wrt_so4_cl').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Te bitter</span>");
ee0db754111e In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents: 545
diff changeset
2483 if (chloride > 0)
ee0db754111e In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents: 545
diff changeset
2484 RA = sulfate / chloride;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2485 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2486 RA = 10;
552
ee0db754111e In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents: 545
diff changeset
2487 $('#got_so4_cl').val(Round(RA, 1));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2488 Res = 'normaal';
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2489 if (RA < (0.8 * OptSO4Clratio))
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2490 Res = 'laag';
555
7c4f34b7e16f A bit of code optimization in calcWater()
Michiel Broek <mbroek@mbse.eu>
parents: 554
diff changeset
2491 else if (RA > (1.2 * OptSO4Clratio))
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2492 Res = 'hoog';
552
ee0db754111e In calcWater() the optimum SO4:Cl ratio is taken from the target profile if set, else it's calculated from the BUGU value. Swapped Cl:SO4 to SO4:Cl ratio presentation. Added remark text next to the Optimal SO4:Cl ratio.
Michiel Broek <mbroek@mbse.eu>
parents: 545
diff changeset
2493 setRangeIndicator('so4_cl', Res);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2494
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2495 $('#wb_calcium').val(Round(calcium, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2496 $('#wb_magnesium').val(Round(magnesium, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2497 $('#wb_sodium').val(Round(sodium, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2498 $('#wb_sulfate').val(Round(sulfate, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2499 $('#wb_chloride').val(Round(chloride, 1));
764
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
2500 $('#wb_bicarbonate').val(Round(bicarbonate, 1));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2501 $('#wb_total_alkalinity').val(Round(total_alkalinity, 1));
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2502 $('#wb_hardness').val(Hardness(calcium, magnesium));
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2503 $('#wb_ra').val(ResidualAlkalinity(total_alkalinity, calcium, magnesium));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2504
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2505 if (calcium < 40) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2506 setRangeIndicator('calcium', 'laag');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2507 } else if (calcium > 150) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2508 setRangeIndicator('calcium', 'hoog');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2509 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2510 setRangeIndicator('calcium', 'normaal');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2511 }
764
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
2512 if (magnesium < 5) {
607
0efba09a694c Added low limit for magnesium of 10 ppm
Michiel Broek <mbroek@mbse.eu>
parents: 602
diff changeset
2513 setRangeIndicator('magnesium', 'laag');
764
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
2514 } else if (magnesium > 40) {
607
0efba09a694c Added low limit for magnesium of 10 ppm
Michiel Broek <mbroek@mbse.eu>
parents: 602
diff changeset
2515 setRangeIndicator('magnesium', 'hoog');
0efba09a694c Added low limit for magnesium of 10 ppm
Michiel Broek <mbroek@mbse.eu>
parents: 602
diff changeset
2516 } else {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2517 setRangeIndicator('magnesium', 'normaal');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2518 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2519 if (sodium <= 150) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2520 setRangeIndicator('sodium', 'normaal');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2521 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2522 setRangeIndicator('sodium', 'hoog');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2523 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2524 // Both chloride and sulfate should be above 50 according to
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2525 // John Palmer. So the Cl/SO4 ratio calculation will work.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2526 if (chloride <= 50) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2527 setRangeIndicator('chloride', 'laag');
764
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
2528 } else if (chloride <= 150) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2529 setRangeIndicator('chloride', 'normaal');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2530 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2531 setRangeIndicator('chloride', 'hoog');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2532 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2533 if (sulfate <= 50) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2534 setRangeIndicator('sulfate', 'laag');
764
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
2535 } else if (sulfate <= 400) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2536 setRangeIndicator('sulfate', 'normaal');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2537 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2538 setRangeIndicator('sulfate', 'hoog');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2539 }
764
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
2540 // (cloride + sulfate) > 500 is too high
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
2541 if ((chloride + sulfate) > 500) {
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
2542 setRangeIndicator('chloride', 'hoog');
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
2543 setRangeIndicator('sulfate', 'hoog');
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
2544 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2545 if (ph < 5.2) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2546 setRangeIndicator('ph', 'laag');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2547 } else if (ph > 5.6) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2548 setRangeIndicator('ph', 'hoog');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2549 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2550 setRangeIndicator('ph', 'normaal');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2551 }
764
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
2552 if (bicarbonate > 250) {
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
2553 setRangeIndicator('bicarbonate', 'hoog');
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
2554 } else {
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
2555 setRangeIndicator('bicarbonate', 'normaal');
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
2556 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2557 calcSparge();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2558 calcMiscs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2559 calcSupplies();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2560 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2561
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2562 function calcSparge() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2563
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
2564 /* Based on the work of ajDeLange. */
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2565 var ws_calcium, ws_magnesium, ws_total_alkalinity, ws_sodium, ws_chloride;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2566 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
2567 var TargetpH = dataRecord.sparge_ph;
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2568 var Source_pH = 7.0;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2569
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2570 // Select watersource or fallback to the first source.
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2571 if ((dataRecord.sparge_source == 1) && (dataRecord.w2_ph > 0.0)) { // Source 2
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2572 ws_calcium = dataRecord.w2_calcium;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2573 ws_magnesium = dataRecord.w2_magnesium;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2574 ws_total_alkalinity = dataRecord.w2_total_alkalinity;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2575 ws_sodium = dataRecord.w2_sodium;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2576 ws_chloride = dataRecord.w2_chloride;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2577 ws_sulfate = dataRecord.w2_sulfate;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2578 Source_pH = dataRecord.w2_ph;
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2579 $('#w2_button').jqxRadioButton({ checked: true });
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2580 } else if ((dataRecord.sparge_source == 2) && (dataRecord.w2_ph > 0.0)) { // Mixed
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2581 ws_calcium = dataRecord.wg_calcium;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2582 ws_magnesium = dataRecord.wg_magnesium;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2583 ws_total_alkalinity = dataRecord.wg_total_alkalinity;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2584 ws_sodium = dataRecord.wg_sodium;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2585 ws_chloride = dataRecord.wg_chloride;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2586 ws_sulfate = dataRecord.wg_sulfate;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2587 Source_pH = dataRecord.wg_ph;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2588 $('#wg_button').jqxRadioButton({ checked: true });
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2589 } else {
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2590 ws_calcium = dataRecord.w1_calcium;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2591 ws_magnesium = dataRecord.w1_magnesium;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2592 ws_total_alkalinity = dataRecord.w1_total_alkalinity;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2593 ws_sodium = dataRecord.w1_sodium;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2594 ws_chloride = dataRecord.w1_chloride;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2595 ws_sulfate = dataRecord.w1_sulfate;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2596 Source_pH = dataRecord.w1_ph;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2597 $('#w1_button').jqxRadioButton({ checked: true });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2598 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2599
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2600 if (dataRecord.sparge_volume > 0) {
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2601 ws_calcium += (parseFloat($('#ss_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 * 1000 +
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2602 parseFloat($('#ss_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4 * 1000) / dataRecord.sparge_volume;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2603 ws_magnesium += (parseFloat($('#ss_mgso4').jqxNumberInput('decimal')) * MMMg / MMMgSO4 * 1000 +
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2604 parseFloat($('#ss_mgcl2').jqxNumberInput('decimal')) * MMMg / MMMgCl2 * 1000) / dataRecord.sparge_volume;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2605 ws_sodium += (parseFloat($('#ss_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 1000) / dataRecord.sparge_volume;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2606 ws_sulfate += (parseFloat($('#ss_caso4').jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 * 1000 +
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2607 parseFloat($('#ss_mgso4').jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 * 1000) / dataRecord.sparge_volume;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2608 ws_chloride += (2 * parseFloat($('#ss_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 * 1000 +
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2609 parseFloat($('#ss_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl * 1000 +
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2610 parseFloat($('#ss_mgcl2').jqxNumberInput('decimal')) * MMCl / MMMgCl2 * 1000) / dataRecord.sparge_volume;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2611 }
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2612
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2613 /* Show the spargewate with salt additions */
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2614 $('#sw_calcium').val(Round(ws_calcium, 1));
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2615 $('#sw_magnesium').val(Round(ws_magnesium, 1));
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2616 $('#sw_sodium').val(Round(ws_sodium, 1));
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2617 $('#sw_sulfate').val(Round(ws_sulfate, 1));
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2618 $('#sw_chloride').val(Round(ws_chloride, 1));
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2619 $('#sw_bicarbonate').val(Round(Bicarbonate(ws_total_alkalinity, Source_pH), 1));
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2620 $('#sw_total_alkalinity').val(Round(ws_total_alkalinity, 1));
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2621 $('#sw_ph').val(dataRecord.sparge_ph);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2622 $('#sw_hardness').val(Hardness(ws_calcium, ws_magnesium));
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2623 $('#sw_ra').val(ResidualAlkalinity(ws_total_alkalinity, ws_calcium, ws_magnesium));
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2624
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2625 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
2626 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
2627 AT = 0;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2628 dataRecord.sparge_acid_type = 0;
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2629 $('#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
2630 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
2631 $('#sparge_acid_perc').val(dataRecord.sparge_acid_perc);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2632 }
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2633
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2634 /*
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2635 * Auto calculate the required acid
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2636 */
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2637 if (dataRecord.calc_acid) {
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2638 // Step 1: Compute the mole fractions of carbonic (f1) and carbonate(f3) at the source water pH
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2639 var r1 = Math.pow(10, Source_pH - 6.35);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2640 var r2 = Math.pow(10, Source_pH - 10.33);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2641 var d = 1 + r1 + r1 * r2;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2642 var f1 = 1 / d;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2643 var f3 = r1 * r2 / d;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2644
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2645 //Step 2. Compute the mole fractions at pH = 4.3 (the pH which defines alkalinity)
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2646 var r143 = Math.pow(10, 4.3 - 6.35);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2647 var r243 = Math.pow(10, 4.3 - 10.33);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2648 var d43 = 1 + r143 + r143 * r243;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2649 var f143 = 1 / d43;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2650 var f343 = r143 * r243 / d43;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2651
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2652 //Step 4. Solve
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2653 var Ct = ws_total_alkalinity / 50 / ((f143 - f1) + (f3 - f343));
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2654
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2655 //Step 5. Compute mole fractions at desired pH
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2656 var r1g = Math.pow(10, TargetpH - 6.35);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2657 var r2g = Math.pow(10, TargetpH - 10.33);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2658 var dg = 1 + r1g + r1g * r2g;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2659 var f1g = 1 / dg;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2660 var f3g = r1g * r2g / dg;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2661
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2662 //Step 6. Use these to compute the milliequivalents acid required per liter (mEq/L)
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2663 var Acid = Ct * ((f1g - f1) + (f3 - f3g)) + Math.pow(10, -TargetpH) - Math.pow(10, -Source_pH); //mEq/l
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2664 Acid += 0.01; // Add acid that would be required for distilled water.
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2665
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2666 //Step 8. Get the acid data.
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2667 var fract = CalcFrac(TargetpH, AcidTypeData[AT].pK1, AcidTypeData[AT].pK2, AcidTypeData[AT].pK3);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2668
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2669 //Step 9. Now divide the mEq required by the "fraction". This is the required number of moles of acid.
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2670 Acid /= fract;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2671
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2672 //Step 10. Multiply by molecular weight of the acid
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2673 Acid *= AcidTypeData[AT].MolWt; //mg
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2674
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2675 //Step 11. Divide by Specific Gravity and Percentage to get the final ml.
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2676 var RealSG = Round(((AcidTypeData[AT].AcidSG - 1000) * (dataRecord.sparge_acid_perc / 100)) + 1000, 2);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2677 Acid = Acid / RealSG; //ml
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2678 Acid *= dataRecord.sparge_volume; //ml acid total at 100%
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2679 Acid /= AcidTypeData[AT].AcidPrc / 100; //ml acid at supplied strength
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2680 Acid = Round(Acid, 2);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2681 dataRecord.sparge_acid_amount = Acid / 1000;
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2682 $('#sparge_acid_amount').val(Acid);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2683 }
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2684
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2685 // Finally calculate the estimate preboil pH
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2686 var ph = -Math.log10(((Math.pow(10, -dataRecord.wb_ph) * dataRecord.wg_amount) + (Math.pow(10, -dataRecord.sparge_ph) * dataRecord.sparge_volume)) /
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2687 (dataRecord.wg_amount + dataRecord.sparge_volume));
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2688 $('#preboil_ph').val(ph);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2689 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2690
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2691 function calcFermentation() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2692 var primary_svg, secondary_svg, final_svg, ABV;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2693 if (dataRecord.brew_fermenter_sg < 1.020)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2694 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2695 if ((dataRecord.primary_end_sg > 0.990) && (dataRecord.primary_end_sg < dataRecord.brew_fermenter_sg)) {
655
f4e00869f39f Calculate the svg using Brew by the Numbers, Micahel L. Hall.
Michiel Broek <mbroek@mbse.eu>
parents: 651
diff changeset
2696 primary_svg = Round(calc_svg(dataRecord.brew_fermenter_sg, dataRecord.primary_end_sg), 1);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2697 $('#primary_svg').val(primary_svg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2698 if ((dataRecord.secondary_end_sg > 0.990) && (dataRecord.secondary_end_sg < dataRecord.brew_fermenter_sg)) {
655
f4e00869f39f Calculate the svg using Brew by the Numbers, Micahel L. Hall.
Michiel Broek <mbroek@mbse.eu>
parents: 651
diff changeset
2699 secondary_svg = Round(calc_svg(dataRecord.brew_fermenter_sg, dataRecord.secondary_end_sg), 1);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2700 $('#secondary_svg').val(secondary_svg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2701 if ((dataRecord.fg > 0.990) && (dataRecord.fg < dataRecord.brew_fermenter_sg)) {
655
f4e00869f39f Calculate the svg using Brew by the Numbers, Micahel L. Hall.
Michiel Broek <mbroek@mbse.eu>
parents: 651
diff changeset
2702 final_svg = Round(calc_svg(dataRecord.brew_fermenter_sg, dataRecord.fg), 1);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2703 $('#final_svg').val(final_svg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2704 ABV = Round(abvol(dataRecord.brew_fermenter_sg, dataRecord.fg), 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2705 $('#final_abv').val(ABV);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2706 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2707 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2708 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2709 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2710
651
6e89cb158153 Changed priming sugar calculation to Brew by the Numbers by Michael L. Hall. This gives a bit higher and better amount of sugar to use. Removed dead parameter from the ResCO2 function.
Michiel Broek <mbroek@mbse.eu>
parents: 649
diff changeset
2711 function ResCO2(T) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2712 var F = T * 1.8 + 32;
651
6e89cb158153 Changed priming sugar calculation to Brew by the Numbers by Michael L. Hall. This gives a bit higher and better amount of sugar to use. Removed dead parameter from the ResCO2 function.
Michiel Broek <mbroek@mbse.eu>
parents: 649
diff changeset
2713 return Round(3.0378 - 0.050062 * F + 0.00026555 * F * F, 6);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2714 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2715
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2716 function CarbCO2toS(CO2, T, SFactor) {
651
6e89cb158153 Changed priming sugar calculation to Brew by the Numbers by Michael L. Hall. This gives a bit higher and better amount of sugar to use. Removed dead parameter from the ResCO2 function.
Michiel Broek <mbroek@mbse.eu>
parents: 649
diff changeset
2717 //var sugar = SFactor * (CO2 - ResCO2(CO2, T)) / 0.286;
6e89cb158153 Changed priming sugar calculation to Brew by the Numbers by Michael L. Hall. This gives a bit higher and better amount of sugar to use. Removed dead parameter from the ResCO2 function.
Michiel Broek <mbroek@mbse.eu>
parents: 649
diff changeset
2718 var sugar = Round(SFactor * (CO2 - ResCO2(T)) * 4.014094, 6);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2719 if (sugar < 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2720 sugar = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2721 return Round(sugar, 3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2722 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2723
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2724 function GetPressure(CO2, T1, T2) {
651
6e89cb158153 Changed priming sugar calculation to Brew by the Numbers by Michael L. Hall. This gives a bit higher and better amount of sugar to use. Removed dead parameter from the ResCO2 function.
Michiel Broek <mbroek@mbse.eu>
parents: 649
diff changeset
2725 var P, V = CO2 - ResCO2(T1);
609
e9b108569818 Testing, bottle carbonation pressure display without residential pressure
Michiel Broek <mbroek@mbse.eu>
parents: 607
diff changeset
2726 V = CO2; // TODO: temp only total pressure, testing
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2727 if (V < 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2728 return 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2729 P = -1.09145427669121 + 0.00800006989646477 * T2 + 0.000260276315484684 * T2 * T2 + 0.0215142075945119 * T2 * V +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2730 0.674996600795854 * V + -0.00471757220150754 * V * V;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2731 if (P < 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2732 P = 0;
609
e9b108569818 Testing, bottle carbonation pressure display without residential pressure
Michiel Broek <mbroek@mbse.eu>
parents: 607
diff changeset
2733 P = Round(P * 1.01325, 2); // atm to bar
651
6e89cb158153 Changed priming sugar calculation to Brew by the Numbers by Michael L. Hall. This gives a bit higher and better amount of sugar to use. Removed dead parameter from the ResCO2 function.
Michiel Broek <mbroek@mbse.eu>
parents: 649
diff changeset
2734 console.log("GetPressure(" + CO2 + ", " + T1 + ", " + T2 + ") V:" + V + " Bar: " + P + " ignored ResCO2: " + ResCO2(T1));
609
e9b108569818 Testing, bottle carbonation pressure display without residential pressure
Michiel Broek <mbroek@mbse.eu>
parents: 607
diff changeset
2735 return P;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2736 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2737
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2738 function CarbCO2ToPressure(CO2, T) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2739 return (CO2 - (-0.000005594056 * Math.pow(T, 4) + 0.000144357886 * Math.pow(T, 3) +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2740 0.000362999168 * T * T - 0.064872987645 * T + 1.641145175049)) /
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2741 (0.00000498031 * Math.pow(T, 4) - 0.00024358267 * Math.pow(T, 3) + 0.00385867329 * T * T - 0.05671206825 * T + 1.53801423376);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2742 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2743
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2744 function calcCarbonation() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2745
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2746 var TSec, ABV, bvol, balc, babv, mvol, malc, tvol, talc, i, row, SFactor, pvol, pabv, Pressure, kabv;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2747
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2748 console.log('calcCarbonation()');
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
2749
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2750 TSec = dataRecord.secondary_temp;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2751 if (TSec < 1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2752 TSec = dataRecord.primary_end_temp;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2753 if (TSec < 1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2754 TSec = 18;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2755
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2756 if (dataRecord.fg == 0.000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2757 ABV = abvol(dataRecord.brew_fermenter_sg, parseFloat($('#est_fg').jqxNumberInput('decimal')));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2758 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2759 ABV = abvol(dataRecord.brew_fermenter_sg, dataRecord.fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2760
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2761 /* Calculate new volume and alcohol. */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2762 bvol = dataRecord.package_volume - (ABV * dataRecord.package_volume) / 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2763 balc = dataRecord.package_volume - bvol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2764 mvol = dataRecord.package_infuse_amount - (dataRecord.package_infuse_abv * dataRecord.package_infuse_amount) / 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2765 malc = dataRecord.package_infuse_amount - mvol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2766 talc = balc + malc;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2767 tvol = bvol + mvol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2768 ABV = Round(talc / (tvol + talc) * 100, 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2769 dataRecord.package_abv = ABV;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2770 $('#package_abv').val(ABV);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2771
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2772 //console.log("calcCarbonation() TSec:"+TSec+" ABV:"+ABV);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2773 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2774 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2775 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2776
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2777 // Bottles
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2778 dataRecord.bottle_priming_amount = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2779 dataRecord.bottle_priming_total = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2780 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2781 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2782 if (row.f_added == 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2783 SFactor = 1 / ((row.f_yield / 100) * (1 - row.f_moisture / 100));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2784 dataRecord.bottle_priming_amount = CarbCO2toS(dataRecord.bottle_carbonation, TSec, SFactor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2785 dataRecord.bottle_priming_total = Round(dataRecord.bottle_amount * dataRecord.bottle_priming_amount, 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2786 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', dataRecord.bottle_priming_total / 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2787 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2788 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2789 $('#bottle_priming_amount').val(Round(dataRecord.bottle_priming_amount, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2790 $('#bottle_priming_total').val(dataRecord.bottle_priming_total);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2791 pabv = ABV + dataRecord.bottle_priming_amount * 0.47 / 7.907;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2792 pvol = dataRecord.bottle_amount - (pabv * dataRecord.bottle_amount) / 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2793 talc = dataRecord.bottle_amount - pvol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2794 tvol = pvol + dataRecord.bottle_priming_water;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2795 babv = Round(talc / (tvol + talc) * 100, 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2796 //console.log("bottle pabv:"+pabv+" pvol:"+pvol+" wvol:"+dataRecord.bottle_priming_water+" tvol:"+tvol+" talc:"+talc+" abv:"+babv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2797 $('#bottle_abv').val(babv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2798 $('#bottle_pressure').val(GetPressure(dataRecord.bottle_carbonation, TSec, dataRecord.bottle_carbonation_temp));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2799
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2800 // Kegs
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2801 Pressure = CarbCO2ToPressure(dataRecord.keg_carbonation, dataRecord.keg_carbonation_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2802 if (Pressure < 0)
557
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2803 Pressure = 0;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2804 dataRecord.keg_pressure = Pressure;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2805 $('#keg_pressure').val(Round(Pressure, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2806
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2807 dataRecord.keg_priming_amount = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2808 dataRecord.keg_priming_total = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2809 if (!dataRecord.keg_forced_carb) {
557
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2810 for (i = 0; i < rows.length; i++) {
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2811 row = rows[i];
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2812 if (row.f_added == 5) {
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2813 SFactor = 1 / ((row.f_yield / 100) * (1 - row.f_moisture / 100));
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2814 dataRecord.keg_priming_amount = CarbCO2toS(dataRecord.keg_carbonation, TSec, SFactor);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2815 dataRecord.keg_priming_total = Round(dataRecord.keg_amount * dataRecord.keg_priming_amount, 2);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2816 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', dataRecord.keg_priming_total / 1000);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2817 }
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2818 }
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2819 $('#keg_priming_amount').val(Round(dataRecord.keg_priming_amount, 1));
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2820 $('#keg_priming_total').val(dataRecord.keg_priming_total);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2821 pabv = ABV + dataRecord.keg_priming_amount * 0.47 / 7.907;
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2822 pvol = dataRecord.keg_amount - (pabv * dataRecord.keg_amount) / 100;
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2823 talc = dataRecord.keg_amount - pvol;
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2824 tvol = pvol + dataRecord.keg_priming_water;
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2825 kabv = Round(talc / (tvol + talc) * 100, 2);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2826 //console.log("kegs pabv:"+pabv+" pvol:"+pvol+" wvol:"+dataRecord.keg_priming_water+" tvol:"+tvol+" talc:"+talc+" abv:"+kabv);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2827 $('#keg_abv').val(kabv);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2828 } else {
557
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2829 $('#keg_priming_amount').val(0);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2830 $('#keg_priming_total').val(0);
ee76d0bfcdaf Some code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 555
diff changeset
2831 $('#keg_abv').val(ABV);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2832 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2833 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2834
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2835 function calcStage() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2836 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2837 * Set stage and enable or disable parts of the screens.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2838 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2839 $('#stage').val(StageData[dataRecord.stage].nl);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2840
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2841 /*
723
3a837905bbce Prepared the edit fields for dynamic enable/disable during split batches.
Michiel Broek <mbroek@mbse.eu>
parents: 721
diff changeset
2842 * Enable or disable parts of the screens.
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2843 */
827
5df0d11ca02b Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 826
diff changeset
2844 $('#jqxTabs').jqxTabs((dataRecord.stage < 1) ? 'disableAt':'enableAt', 8); // Brewday tab
5df0d11ca02b Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 826
diff changeset
2845 $('#jqxTabs').jqxTabs((dataRecord.stage > 2) ? 'enableAt':'disableAt', 9); // Fermentation tab
5df0d11ca02b Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 826
diff changeset
2846 $('#jqxTabs').jqxTabs((dataRecord.stage < 9) ? 'disableAt':'enableAt', 11); // Tasting tab
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2847 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2848
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2849
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2850 // initialize the input fields.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2851 // Tab 1, Algemeen
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2852 $('#name').jqxTooltip({ content: 'De naam voor dit product.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2853 $('#code').jqxTooltip({ content: 'Product code nummer.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2854 $('#birth').jqxTooltip({ content: 'De ontwerp datum van dit product.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2855 $('#stage').jqxTooltip({ content: 'De productie fase van dit product.' });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2856 $('#divide_batch').jqxTooltip({ content: 'Het aantal extra gesplitste batches.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2857 $('#divide_type').jqxTooltip({ content: 'Het splitsing moment in het productie proces.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2858 $('#notes').jqxTooltip({ content: 'De uitgebreide opmerkingen over dit product.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2859 $('#type').jqxTooltip({ content: 'Het brouw type van dit recept.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2860 $('#efficiency').jqxTooltip({ content: 'Het rendement van maischen en koken.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2861 $('#batch_size').jqxTooltip({ content: 'Het volume van het gekoelde wort na het koken.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2862 $('#boil_time').jqxTooltip({ content: 'De kooktijd in minuten.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2863 $('#boil_size').jqxTooltip({ content: 'Het volume van het wort voor het koken.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2864 $('#st_guide').jqxTooltip({ content: 'De bierstijl gids voor dit recept.'});
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2865 $('#st_name').jqxTooltip({ content: 'De bierstijl naam voor dit recept.'});
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2866 $('#st_letter').jqxTooltip({ content: 'De bierstijl letter voor dit recept.'});
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2867 $('#st_letter').jqxInput({ theme: theme, width: 90, height: 23 });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2868 $('#st_type').jqxTooltip({ content: 'Het bierstijl type.'});
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2869 $('#st_category').jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'});
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2870 $('#st_category_number').jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'});
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2871 $('#est_og').jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2872 $('#st_og_min').jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'});
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2873 $('#st_og_max').jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'});
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2874 $('#est_fg').jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2875 $('#st_fg_min').jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'});
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2876 $('#st_fg_max').jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'});
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2877 $('#est_abv').jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2878 $('#st_abv_min').jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'});
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2879 $('#st_abv_max').jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'});
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2880 $('#est_color').jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2881 $('#st_color_min').jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'});
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2882 $('#st_color_max').jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'});
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2883 $('#est_ibu').jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2884 $('#st_ibu_min').jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'});
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2885 $('#st_ibu_max').jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'});
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2886 $('#kcal').jqxTooltip({ content: 'Energie-inhoud in kcal/liter.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2887 $('#est_carb').jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2888 $('#st_carb_min').jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'});
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2889 $('#st_carb_max').jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'});
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2890
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2891 $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2892 $('#code, #stage').jqxInput({ theme: theme, width: 100, height: 23 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2893 $('#locked').jqxCheckBox({ theme: theme, width: 120, height: 23, disabled: true });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2894 $('#birth,#divide_batch,#divide_type').jqxInput({ theme: theme, width: 120, height: 23 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2895 $('#notes').jqxInput({ theme: theme, width: 960, height: 100 });
818
f9c071906643 Removed obsolete scripts. Product editor tab 1 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 817
diff changeset
2896 $('#type').jqxInput({ theme: theme, width: 180, height: 23 });
f9c071906643 Removed obsolete scripts. Product editor tab 1 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 817
diff changeset
2897 $('#efficiency').jqxNumberInput(Show1dec);
f9c071906643 Removed obsolete scripts. Product editor tab 1 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 817
diff changeset
2898 $('#batch_size').jqxNumberInput(Show1dec);
f9c071906643 Removed obsolete scripts. Product editor tab 1 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 817
diff changeset
2899 $('#boil_time').jqxNumberInput(Show0dec);
f9c071906643 Removed obsolete scripts. Product editor tab 1 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 817
diff changeset
2900 $('#boil_size').jqxNumberInput(Show2dec);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
2901 $('#st_guide,#st_name,#st_type,#st_category').jqxInput({ theme: theme, width: 250, height: 23 });
818
f9c071906643 Removed obsolete scripts. Product editor tab 1 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 817
diff changeset
2902 $('#est_og').jqxNumberInput(Show3dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2903 $('#est_fg').jqxNumberInput(Show3dec);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
2904 $('#st_og_min,#st_og_max,#st_fg_min,#st_fg_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2905 $('#est_ibu,#est_color').jqxNumberInput(Show0dec);
818
f9c071906643 Removed obsolete scripts. Product editor tab 1 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 817
diff changeset
2906 $('#color_method').jqxInput({ theme: theme, width: 180, height: 23 });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2907 $('#st_color_min,#st_color_max,#st_category_number,#st_ibu_min,#st_ibu_max,#kcal').jqxNumberInput(Smal0dec);
818
f9c071906643 Removed obsolete scripts. Product editor tab 1 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 817
diff changeset
2908 $('#ibu_method').jqxInput({ theme: theme, width: 180, height: 23 });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2909 $('#est_abv,#st_abv_min,#st_abv_max,#est_carb,#st_carb_min,#st_carb_max').jqxNumberInput(Smal1dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2910
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2911 // Tab 2, Equipment
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2912 $('#eq_name').jqxTooltip({ content: 'De naam van deze brouw apparatuur.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2913 $('#eq_boil_size').jqxTooltip({ content: 'Normaal kook volume in liters' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2914 $('#eq_batch_size').jqxTooltip({ content: 'Berekende batch grootte in liters aan het eind van de kook.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2915 $('#eq_tun_volume').jqxTooltip({ content: 'Maisch ketel volume.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2916 $('#eq_top_up_water').jqxTooltip({ content: 'Extra water in het gistvat.' });
842
897bf2a43253 Renamed trub_chiller_loss to trub_loss fields.
Michiel Broek <mbroek@mbse.eu>
parents: 841
diff changeset
2917 $('#eq_trub_loss').jqxTooltip({ content: 'Standaard verlies bij het overbrengen naar het gistvat.' });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2918 $('#eq_evap_rate').jqxTooltip({ content: 'Verdamping in liters per uur.' });
658
945d5eba869a Implemented no-boil products.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
2919 $('#eq_boil_time').jqxTooltip({ content: 'Normale kooktijd in minuten, 0 voor no-boil recepten.' });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2920 $('#eq_top_up_kettle').jqxTooltip({ content: 'Extra water toevoegen tijdens de kook.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2921 $('#eq_notes').jqxTooltip({ content: 'Opmerkingen over deze apparatuur.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2922 $('#eq_lauter_deadspace').jqxTooltip({ content: 'Filterkuip verlies in liters.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2923 $('#eq_kettle_volume').jqxTooltip({ content: 'Kook ketel volume in liters.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2924 $('#eq_mash_volume').jqxTooltip({ content: 'Maisch water voor de eerste stap.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2925 $('#eq_mash_max').jqxTooltip({ content: 'De maximale moutstort in Kg.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2926 $('#eq_efficiency').jqxTooltip({ content: 'Gemiddeld brouwzaal rendement.' });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2927
841
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
2928 $('#eq_fermenter_volume').jqxNumberInput(Show1dec);
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2929 $('#eq_name').jqxInput({ theme: theme, width: 250, height: 23 });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2930 $('#eq_evap_rate').jqxNumberInput(Show2dec);
840
ba607babc468 Removed hop_utilization from products and equipments.
Michiel Broek <mbroek@mbse.eu>
parents: 832
diff changeset
2931 $('#eq_boil_time').jqxNumberInput(Show0dec);
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2932 $('#eq_notes').jqxInput({ theme: theme, width: 960, height: 200 });
842
897bf2a43253 Renamed trub_chiller_loss to trub_loss fields.
Michiel Broek <mbroek@mbse.eu>
parents: 841
diff changeset
2933 $('#eq_boil_size,#eq_batch_size,#eq_tun_volume,#eq_top_up_water,#eq_trub_loss,#eq_top_up_kettle').jqxNumberInput(Show1dec);
841
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
2934 $('#eq_lauter_deadspace,#eq_kettle_volume,#eq_mash_volume,#eq_mash_max,#eq_efficiency').jqxNumberInput(Show1dec);
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
2935 $('#eq_chiller_type').jqxInput({ theme: theme, width: 180, height: 23 });
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
2936 $('#eq_chiller_to79').jqxNumberInput(Show0dec);
60bb365fb48d Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.
Michiel Broek <mbroek@mbse.eu>
parents: 840
diff changeset
2937 $('#eq_chiller_volume,#eq_chiller_lpm,#eq_chiller_loss').jqxNumberInput(Show2dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2938
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2939 // Tab 3, Fermentables
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2940 $('#est_color2').jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2941 $('#est_og2').jqxTooltip({ content: 'Het geschatte begin SG van dit product.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2942 $('#mash_kg').jqxTooltip({ content: 'Het gewicht van alle mouten in de maisch.' });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2943
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2944 $('#est_color2').jqxNumberInput(Show0dec);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
2945 $('#est_og2,#mash_kg').jqxNumberInput(Show3dec);
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2946
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2947 $('#perc_malts').jqxProgressBar({
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2948 width: 300, height: 23, theme: theme, showText: true, max: 120, animationDuration: 0,
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2949 colorRanges: [{ stop: 90, color: '#008C00' },{ stop: 100, color: '#EB7331' },{ stop: 120, color: '#FF0000' }],
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2950 renderText: function(text) { return (Math.round(parseInt(text) * 1.2)) + '%'; }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2951 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2952 $('#perc_sugars').jqxProgressBar({
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2953 width: 300, height: 23, theme: theme, showText: true, max: 50, animationDuration: 0,
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2954 colorRanges: [{ stop: 20, color: '#008C00' },{ stop: 50, color: '#FF0000' }],
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2955 renderText: function(text) { return (Math.round(parseInt(text) * 5) / 10) + '%'; }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2956 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2957 $('#perc_cara').jqxProgressBar({
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2958 width: 300, height: 23, theme: theme, showText: true, max: 50, animationDuration: 0,
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2959 colorRanges: [{ stop: 25, color: '#008C00' },{ stop: 50, color: '#FF0000' }],
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2960 renderText: function(text) { return (Math.round(parseInt(text) * 5) / 10) + '%'; }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2961 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2962 $('#ferm_lintner').jqxProgressBar({
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2963 width: 300, height: 23, theme: theme, showText: true, max: 200, animationDuration: 0,
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2964 colorRanges: [{ stop: 30, color: '#FF0000' },{ stop: 40, color: '#EB7331' },{ stop: 200, color: '#008C00' }],
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2965 renderText: function(text) { return (parseInt(text) * 2) + ' lintner'; }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2966 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2967
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2968 // Tab 4, Hops
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2969 $('#est_ibu2').jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2970 $('#est_ibu2').jqxNumberInput(Smal0dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2971 $('#hop_flavour').jqxProgressBar({
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2972 width: 300, height: 23, theme: theme, showText: true, animationDuration: 0,
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2973 colorRanges: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2974 { stop: 20, color: '#004D00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2975 { stop: 40, color: '#008C00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2976 { stop: 60, color: '#00BF00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2977 { stop: 80, color: '#00FF00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2978 { stop: 100, color: '#80FF80' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2979 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2980 renderText: function(text) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2981 var val = parseInt(text);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2982 if (val < 20)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2983 return 'Weinig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2984 else if (val < 40)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2985 return 'Matig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2986 else if (val < 60)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2987 return 'Redelijk';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2988 else if (val < 80)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2989 return 'Veel';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2990 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2991 return 'Zeer veel';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2992 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2993 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2994 $('#hop_aroma').jqxProgressBar({
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
2995 width: 300, height: 23, theme: theme, showText: true, animationDuration: 0,
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2996 colorRanges: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2997 { stop: 20, color: '#004D00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2998 { stop: 40, color: '#008C00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2999 { stop: 60, color: '#00BF00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3000 { stop: 80, color: '#00FF00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3001 { stop: 100, color: '#80FF80' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3002 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3003 renderText: function(text) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3004 var val = parseInt(text);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3005 if (val < 20)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3006 return 'Weinig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3007 else if (val < 40)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3008 return 'Matig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3009 else if (val < 60)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3010 return 'Redelijk';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3011 else if (val < 80)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3012 return 'Veel';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3013 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3014 return 'Zeer veel';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3015 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3016 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3017
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3018 // Tab 5, Miscs
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3019
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3020 // Tab 6, Yeasts
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3021 $('#est_fg2').jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' });
622
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
3022 $('#est_abv2').jqxTooltip({ content: 'Verwacht alcohol volume %. Dit wordt automatisch berekend.' });
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
3023 $('#yeast_grams').jqxTooltip({ content: 'De gewenste totale hoeveelheid droge gist voor dit bier.' });
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
3024 $('#yeast_gr_hl').jqxTooltip({ content: 'De werkelijke hoeveelheid gist per hectoliter.' });
622
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
3025 $('#yeast_cells').jqxTooltip({ content: 'Het aantal miljard beschikbare gistcellen zonder eventuele starter.' });
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
3026 $('#need_cells').jqxTooltip({ content: 'Het aantal miljard nodige cellen is afhankelijk van het begin SG, biertype en volume.' });
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
3027 $('#plato_cells').jqxTooltip({ content: 'De berekende pitchrate in miljard cellen per ml per graad Plato.' });
617
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
3028 $('#yeast_prod_date').jqxTooltip({ content: 'Bij korrelgisten is meestal "best voor" datum op het zakje gedrukt.<br>Gebruik die datum maar dan twee jaar eerder als productie datum.<br>Bij White Labs is de productie datum vier maanden voor de "Best by" datum die geprint op het buisje.<br>Bij Wyeast is dit de "manufacture date" die op het pak geprint is.<br>Voor schuine buis, slurry, opkweek en gedroogd is dit de datum dat je de gist geoogst hebt.' });
697
367ae7ff52f0 Version 0.3.34 Changed log messages in the daemon. Added yeast_pitchrate field to the product database. Added yeast pitchrate edit field to the yeast tab. Initial value is guessed. There is also a popup window for predefined values. An finally the value can be edited by the user. All popup windows are initialized together.
Michiel Broek <mbroek@mbse.eu>
parents: 669
diff changeset
3029 $('#yeast_pitchrate').jqxTooltip({ content: 'De gewenste pitchrate in miljard cellen per ml per graad Plato voor de vergisting van dit bier.' });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3030
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3031 $('#est_fg2,#plato_cells').jqxNumberInput(Show3dec);
697
367ae7ff52f0 Version 0.3.34 Changed log messages in the daemon. Added yeast_pitchrate field to the product database. Added yeast pitchrate edit field to the yeast tab. Initial value is guessed. There is also a popup window for predefined values. An finally the value can be edited by the user. All popup windows are initialized together.
Michiel Broek <mbroek@mbse.eu>
parents: 669
diff changeset
3032 $('#est_fg2').jqxNumberInput({ width: 70 });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3033 $('#est_abv2').jqxNumberInput(Show2dec);
697
367ae7ff52f0 Version 0.3.34 Changed log messages in the daemon. Added yeast_pitchrate field to the product database. Added yeast pitchrate edit field to the yeast tab. Initial value is guessed. There is also a popup window for predefined values. An finally the value can be edited by the user. All popup windows are initialized together.
Michiel Broek <mbroek@mbse.eu>
parents: 669
diff changeset
3034 $('#est_abv2').jqxNumberInput({ width: 70, symbol: '%', symbolPosition: 'right' });
726
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
3035 $('#yeast_grams').jqxNumberInput(Show1dec);
872a3635e4ef Changed dry-yeast calculation.
Michiel Broek <mbroek@mbse.eu>
parents: 723
diff changeset
3036 $('#yeast_gr_hl').jqxNumberInput(Show1dec);
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3037 $('#yeast_cells,#need_cells').jqxNumberInput(Show1dec);
617
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
3038 $('#yeast_prod_date').jqxDateTimeInput(Dateopts);
823
506246d65043 Tab 6 is a viewer
Michiel Broek <mbroek@mbse.eu>
parents: 822
diff changeset
3039 $('#yeast_prod_date').jqxDateTimeInput({ disabled: true });
506246d65043 Tab 6 is a viewer
Michiel Broek <mbroek@mbse.eu>
parents: 822
diff changeset
3040 $('#yeast_pitchrate').jqxNumberInput(Show3dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3041 for (i = 1; i < 5; i++) {
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3042 $('#prop' + i + '_volume').jqxTooltip({ content: 'Het volume van deze starter stap.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3043 $('#prop' + i + '_irate').jqxTooltip({ content: 'Voor de beste gistgroei, houd de injectie factor tussen de 25 en 100 miljoen cellen per ml.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3044 $('#prop' + i + '_ncells').jqxTooltip({ content: 'Het aantal miljard nieuwe gistcellen in deze stap.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3045 $('#prop' + i + '_tcells').jqxTooltip({ content: 'Het totaal aantal miljard gistcellen na deze stap.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3046 $('#prop' + i + '_growf').jqxTooltip({ content: 'De groeifactor, minstens 1. Ongeroerde starters komen meestal niet boven de 3.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3047
823
506246d65043 Tab 6 is a viewer
Michiel Broek <mbroek@mbse.eu>
parents: 822
diff changeset
3048 $('#prop' + i + '_type').jqxInput({ theme: theme, width: 120, height: 23 });
506246d65043 Tab 6 is a viewer
Michiel Broek <mbroek@mbse.eu>
parents: 822
diff changeset
3049 $('#prop' + i + '_volume').jqxNumberInput(Show3dec);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
3050 $('#prop' + i + '_irate,#prop' + i + '_ncells,#prop' + i + '_tcells').jqxNumberInput(Show1dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3051 $('#prop' + i + '_growf').jqxNumberInput(Show2dec);
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3052 $('#prop' + i + '_type,#prop' + i + '_volume,#prop' + i + '_irate,#prop' + i + '_ncells,#prop' + i + '_tcells,#prop' + i + '_growf').hide();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3053 }
823
506246d65043 Tab 6 is a viewer
Michiel Broek <mbroek@mbse.eu>
parents: 822
diff changeset
3054 $('#starter_type').jqxInput({ theme: theme, width: 120, height: 23 });
518
00e110567fee The default starter SG changed to 1.037. Added several tooltips on the yeast tab.
Michiel Broek <mbroek@mbse.eu>
parents: 515
diff changeset
3055 $('#starter_sg').jqxTooltip({ content: 'Het ideale starter SG moet tussen de 1.030 en 1.040 zijn. Optimaal is 1.037.' });
823
506246d65043 Tab 6 is a viewer
Michiel Broek <mbroek@mbse.eu>
parents: 822
diff changeset
3056 $('#starter_sg').jqxNumberInput(Show3dec);
617
f962f1e5936e Implemented yeast viability calculation from the yeast production date. Changed the pitchrate logic and added Ale above 1.076 rate of 1.25.
Michiel Broek <mbroek@mbse.eu>
parents: 616
diff changeset
3057 $('#starter_viability').jqxTooltip({ content: 'De gist conditie.' });
622
39902353b159 Workaround for hang during startup. Changed order of displayed fields on the yeast tab. Tooltip text changes. More decimals on the checklist for misc ingredients. More decimals for the starter on product print.
Michiel Broek <mbroek@mbse.eu>
parents: 621
diff changeset
3058 $('#starter_viability').jqxNumberInput(Show0dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3059
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3060 // Tab 7, Mashing
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3061 $('#mash_name').jqxTooltip({ content: 'De omschrijving van dit maisch profiel.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3062 $('#mash_name').jqxInput({ theme: theme, width: 320, height: 23 });
484
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
3063 $('#est_mashvol').jqxTooltip({ content: 'Het totale volume van het maishwater en de mout in de maish pan.' });
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
3064 $('#est_mashvol').jqxNumberInput(Show1dec);
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
3065 $('#est_mashtime').jqxTooltip({ content: 'De totale tijdsduur van het maischen.' });
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
3066 $('#est_mashtime').jqxInput({ theme: theme, width: 70, height: 23 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3067
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3068 // Tab 8, Water
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3069 $('#tgt_bu').jqxNumberInput(Show2wat);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
3070 $('#tgt_so4_cl,#got_so4_cl').jqxNumberInput(Show1wat);
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3071 $('#preboil_ph').jqxNumberInput(Show2wat);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3072
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3073 // Water source 1
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3074 $('#w1_name').jqxInput({ theme: theme, width: 200, height: 23 });
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3075 $('#w1_button').jqxRadioButton({ theme: theme, width: 50, height: 23, disabled: true });
764
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
3076 $('#w1_amount,#w1_calcium,#w1_magnesium,#w1_sodium,#w1_bicarbonate,#w1_total_alkalinity,#w1_chloride,#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
3077 $('#w1_ph').jqxNumberInput(Show2wat);
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3078 $('#w1_hardness').jqxNumberInput(Show1wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3079 $('#w1_ra').jqxNumberInput(Show1wat);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3080 // Water source 2
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3081 $('#w2_name').jqxInput({ theme: theme, width: 200, height: 23 });
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3082 $('#w2_button').jqxRadioButton({ theme: theme, width: 50, height: 23, disabled: true });
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3083 $('#w2_amount').jqxNumberInput(Show1wat);
764
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
3084 $('#w2_calcium,#w2_magnesium,#w2_sodium,#w2_bicarbonate,#w2_total_alkalinity,#w2_chloride,#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
3085 $('#w2_ph').jqxNumberInput(Show2wat);
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3086 $('#w2_hardness').jqxNumberInput(Show1wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3087 $('#w2_ra').jqxNumberInput(Show1wat);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3088 // Water mixed
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3089 $('#wg_button').jqxRadioButton({ theme: theme, width: 50, height: 23, disabled: true });
764
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
3090 $('#wg_amount,#wg_calcium,#wg_magnesium,#wg_sodium,#wg_bicarbonate,#wg_total_alkalinity,#wg_chloride,#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
3091 $('#wg_ph').jqxNumberInput(Show2wat);
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3092 $('#wg_hardness').jqxNumberInput(Show1wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3093 $('#wg_ra').jqxNumberInput(Show1wat);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3094 // Water treated
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3095 $('#wb_calcium').jqxTooltip({ content: 'De ideale hoeveelheid Calcium is tussen 40 en 150.'});
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3096 $('#wb_calcium').jqxNumberInput(Show1wat);
764
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
3097 $('#wb_magnesium').jqxTooltip({ content: 'De ideale hoeveelheid Magnesium is tussen 5 en 40.'});
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3098 $('#wb_magnesium').jqxNumberInput(Show1wat);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3099 $('#wb_sodium').jqxTooltip({ content: 'De ideale hoeveelheid Natrium is lager dan 150.'});
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3100 $('#wb_sodium').jqxNumberInput(Show1wat);
764
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
3101 $('#wb_chloride').jqxTooltip({ content: 'De ideale hoeveelheid Chloride is tussen 50 en 150. Samen met Sulfaat minder dan 500.'});
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3102 $('#wb_chloride').jqxNumberInput(Show1wat);
764
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
3103 $('#wb_sulfate').jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is tussen 50 en 400. Samen met Chloride minder dan 500.'});
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3104 $('#wb_sulfate').jqxNumberInput(Show1wat);
764
e95744b6b31d Added HCO3 to the water summary. Changed some water chemicals limits to new insights.
Michiel Broek <mbroek@mbse.eu>
parents: 760
diff changeset
3105 $('#wb_bicarbonate').jqxTooltip({ content: '0 tot 50 lichte bieren, 50 tot 150 amber bieren, 150 tot 250 donkere bieren.'});
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3106 $('#wb_bicarbonate').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
3107 $('#wb_ph').jqxNumberInput(Show2wat);
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3108 $('#wb_hardness').jqxNumberInput(Show1wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3109 $('#wb_ra').jqxNumberInput(Show1wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3110 // Sparge water
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3111 $('#sw_amount').jqxNumberInput(Show1wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3112 $('#sw_calcium').jqxNumberInput(Show1wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3113 $('#sw_magnesium').jqxNumberInput(Show1wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3114 $('#sw_sodium').jqxNumberInput(Show1wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3115 $('#sw_bicarbonate').jqxNumberInput(Show1wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3116 $('#sw_total_alkalinity').jqxNumberInput(Show1wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3117 $('#sw_chloride').jqxNumberInput(Show1wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3118 $('#sw_sulfate').jqxNumberInput(Show1wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3119 $('#sw_ph').jqxNumberInput(Show2wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3120 $('#sw_hardness').jqxNumberInput(Show1wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3121 $('#sw_ra').jqxNumberInput(Show1wat);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3122
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3123 // Water agents
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3124 $('#wa_cacl2').jqxTooltip({ content: 'Voor het maken van een ander waterprofiel. Voegt calcium en chloride toe. Voor het verbeteren van zoetere bieren.' });
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3125 $('#wa_cacl2').jqxNumberInput(Show2wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3126 $('#ss_cacl2').jqxNumberInput(Show2wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3127
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3128 $('#wa_caso4').jqxTooltip({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3129 content: 'Gips. Voor het maken van een ander waterprofiel. Voegt calcium en sulfaat toe. Voor het verbeteren van bittere bieren.'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3130 });
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3131 $('#wa_caso4').jqxNumberInput(Show2wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3132 $('#ss_caso4').jqxNumberInput(Show2wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3133
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3134 $('#wa_mgso4').jqxTooltip({ content: 'Epsom zout. Voor het maken van een ander waterprofiel. Voegt magnesium en sulfaat toe. Gebruik spaarzaam!' });
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3135 $('#wa_mgso4').jqxNumberInput(Show2wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3136 $('#ss_mgso4').jqxNumberInput(Show2wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3137
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3138 $('#wa_nacl').jqxTooltip({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3139 content: 'Keukenzout. Voor het maken van een ander waterprofiel. Voegt natrium en chloride toe. ' +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3140 'Voor het accentueren van zoetheid. Bij hoge dosering wordt het bier ziltig.'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3141 });
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3142 $('#wa_nacl').jqxNumberInput(Show2wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3143 $('#ss_nacl').jqxNumberInput(Show2wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3144
759
89bcab49284a Added MgCl2 brewing salt
Michiel Broek <mbroek@mbse.eu>
parents: 758
diff changeset
3145 $('#wa_mgcl2').jqxTooltip({ content: 'Magnesiumchloride'});
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3146 $('#wa_mgcl2').jqxNumberInput(Show2wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3147 $('#ss_mgcl2').jqxNumberInput(Show2wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3148
758
e6814bed4cb1 Moved NaHCO3 and CaCO3 from the base additions to the water agent salts.
Michiel Broek <mbroek@mbse.eu>
parents: 757
diff changeset
3149 $('#wa_nahco3').jqxTooltip({ content: 'Baksoda'});
e6814bed4cb1 Moved NaHCO3 and CaCO3 from the base additions to the water agent salts.
Michiel Broek <mbroek@mbse.eu>
parents: 757
diff changeset
3150 $('#wa_caco3').jqxTooltip({ content: 'Kalk'});
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3151 $('#wa_nahco3,#wa_caco3').jqxNumberInput(Show2wat);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3152
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3153 $('#mash_ph').jqxTooltip({ content: 'Maisch pH tussen 5.2 en 5.6. Gebruik 5.2 voor lichte en 5.5 voor donkere bieren.'});
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3154 $('#mash_ph').jqxNumberInput(Show2dec);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3155
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3156 $('#calc_acid').jqxCheckBox({ theme: theme, width: 120, height: 23, disabled: true });
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3157
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3158 $('#wa_acid_name').jqxInput({ theme: theme, width: 130, height: 23 });
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3159 $('#wa_acid').jqxNumberInput(Show2dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3160 $('#wa_acid').jqxNumberInput({ symbol: ' ml', symbolPosition: 'right' });
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3161 $('#wa_acid_perc').jqxNumberInput(Show0dec);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3162 $('#wa_acid_perc').jqxNumberInput({ symbol: '%', symbolPosition: 'right' });
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3163
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3164 // Sparge water
825
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3165 $('#sparge_ph').jqxNumberInput(Show2dec);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3166 $('#sparge_acid_amount').jqxNumberInput(Show2dec);
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3167 $('#sparge_acid_amount').jqxNumberInput({ symbol: ' ml', symbolPosition: 'right' });
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3168 $('#sparge_acid_type').jqxInput({ theme: theme, width: 130, height: 23 });
8b87ad5bd3c3 Correction for Phosforic SG. Water treatment is a viewer. Start reordering and optimizing the calculations.
Michiel Broek <mbroek@mbse.eu>
parents: 824
diff changeset
3169 $('#sparge_acid_perc').jqxNumberInput(Show0dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3170 $('#sparge_acid_perc').jqxNumberInput({ symbol: '%', symbolPosition: 'right' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3171
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3172 // Tab 9, Brewday
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3173 $('#brew_date_start').jqxTooltip({ content: 'Brouw datum en tijd. Voor planning laat de tijd op 00:00:00 staan.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3174 $('#brew_date_end').jqxTooltip({ content: 'End datum en tijd van de brouw. Leeg laten als er nog niet gebrouwen is.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3175 $('#brew_mash_ph').jqxTooltip({ content: 'De gemeten pH tijdens het maischen eventueel na correctie.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3176 $('#est_mash_ph').jqxTooltip({ content: 'De gewenste pH tijdens het maischen.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3177 $('#brew_preboil_ph').jqxTooltip({ content: 'De gemeten pH in de kookketel na het spoelen en voor de kook.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3178 $('#brew_aboil_ph').jqxTooltip({ content: 'De gemeten pH na het koken.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3179 $('#brew_mash_sg').jqxTooltip({ content: 'Het bereikte SG na het maischen.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3180 $('#est_mash_sg').jqxTooltip({ content: 'Het berekende verwachte SG na het maischen.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3181 $('#brew_preboil_sg').jqxTooltip({ content: 'Het gemeten SG in de kookketel na het spoelen en voor het koken.' });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3182 $('#est_pre_sg').jqxTooltip({ content: 'Het berekende SG in de kookketel na het spoelen en voor het koken.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3183 $('#brew_aboil_sg').jqxTooltip({ content: 'Het gemeten SG in de kookketel na het koken.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3184 $('#est_og3').jqxTooltip({ content: 'Het gewenste SG in de kookketel na het koken zonder eventuele suikers die tijdens de vergisting toegevoegd worden.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3185 $('#brew_mash_efficiency').jqxTooltip({ content: 'Het behaalde maisch rendement.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3186 $('#brew_preboil_volume').jqxTooltip({ content: 'Het gemeten volume van het wort voor het koken.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3187 $('#est_pre_vol').jqxTooltip({ content: 'Het berekende volume van het wort voor het koken.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3188 $('#brew_aboil_volume').jqxTooltip({ content: 'Het gemeten volume van het wort na het koken.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3189 $('#est_a_vol').jqxTooltip({ content: 'Het gewenste volume na het koken.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3190 $('#brew_preboil_efficiency').jqxTooltip({ content: 'Het berekende rendement voor het koken.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3191 $('#brew_aboil_efficiency').jqxTooltip({ content: 'Het bereikte rendement na het koken.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3192 $('#brew_sparge_temperature').jqxTooltip({ content: 'De spoelwater temperatuur, in te stellen in de Water tab.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3193 $('#brew_sparge_volume').jqxTooltip({ content: 'Het spoelwater voorraad volume, in te stellen in de Water tab.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3194 $('#brew_date_start,#brew_date_end').jqxDateTimeInput(DateTimeopts);
826
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
3195 $('#brew_date_start,#brew_date_end').jqxDateTimeInput({ disabled: true });
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
3196 $('#est_mash_ph').jqxNumberInput(Show2wat);
826
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
3197 $('#brew_mash_ph,#brew_preboil_ph,#brew_aboil_ph').jqxNumberInput(Show2dec);
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
3198 $('#brew_mash_sg,#brew_preboil_sg,#brew_aboil_sg').jqxNumberInput(Show3dec);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
3199 $('#est_mash_sg,#est_pre_sg,#est_og3').jqxNumberInput(Show3wat);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3200 $('#brew_mash_efficiency').jqxNumberInput(Show1dec);
826
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
3201 $('#brew_preboil_volume,#brew_aboil_volume').jqxNumberInput(Show1dec);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
3202 $('#est_pre_vol,#est_a_vol').jqxNumberInput(Show1wat);
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
3203 $('#brew_preboil_efficiency,#brew_aboil_efficiency,#brew_sparge_temperature,#brew_sparge_volume,#brew_sparge_est').jqxNumberInput(Show1dec);
826
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
3204 $('#brew_cooling_to').jqxNumberInput(Show1dec);
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
3205 $('#brew_sparge_ph').jqxNumberInput(Show2dec);
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
3206 $('#brew_cooling_method').jqxInput({ theme: theme, width: 180, height: 23 });
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
3207 $('#brew_cooling_time,#brew_whirlpool9,#brew_whirlpool7,#brew_whirlpool6,#brew_whirlpool2,#brew_aeration_time,#brew_aeration_speed').jqxNumberInput(Show0dec);
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
3208 $('#brew_aeration_type').jqxInput({ theme: theme, width: 180, height: 23 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3209 $('#brew_fermenter_volume').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3210 $('#brew_fermenter_sg').jqxNumberInput(Show3dec);
826
4e681bc073bd The brewday tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 825
diff changeset
3211 $('#brew_fermenter_extrawater,#brew_fermenter_tcloss').jqxNumberInput(Show1dec);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
3212 $('#brew_fermenter_ibu,#brew_fermenter_color').jqxNumberInput(Show0dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3213
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3214 // Tab 10, Fermentation
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3215 $('#brew_fermenter_sg2').jqxTooltip({ content: 'Het behaalde SG in het gistvat, overgenomen van de brouwdag.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3216 $('#primary_start_temp').jqxTooltip({ content: 'De begintemperatuur van de hoofdvergisting.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3217 $('#primary_max_temp').jqxTooltip({ content: 'De hoogst bereikte piek temperatuur tijdens de hoofgvergisting.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3218 $('#primary_end_temp').jqxTooltip({ content: 'De eind temperatuur van de hoofdvergisting.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3219 $('#primary_end_sg').jqxTooltip({ content: 'Het gemeten SG aan het eind van de hoofdvergisting.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3220 $('#primary_svg').jqxTooltip({ content: 'De schijnbare vergisting graad behaald na de hoofdgisting.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3221 $('#primary_end_date').jqxTooltip({ content: 'De eind datum van de hoofdvergisting en eventueel overhevelen.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3222 $('#secondary_end_sg').jqxTooltip({ content: 'Het gemeten SG aan het eind van de navergisting.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3223 $('#secondary_svg').jqxTooltip({ content: 'De schijnbare vergisting graad behaald na de nagisting.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3224 $('#secondary_end_date').jqxTooltip({ content: 'De eind datum van de navergisting en het begin van het lageren.' });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3225 $('#est_fg3').jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3226
828
aa0a9b1a2dd7 The fermentation tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 827
diff changeset
3227 $('#primary_end_sg,#secondary_end_sg').jqxNumberInput(Show3dec);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
3228 $('#primary_end_date,#secondary_end_date').jqxDateTimeInput(Dateopts);
828
aa0a9b1a2dd7 The fermentation tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 827
diff changeset
3229 $('#primary_end_date,#secondary_end_date').jqxDateTimeInput({ disabled: true });
aa0a9b1a2dd7 The fermentation tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 827
diff changeset
3230 $('#primary_start_temp,#primary_max_temp,#primary_end_temp,#secondary_temp,#tertiary_temp').jqxNumberInput(Show1dec);
aa0a9b1a2dd7 The fermentation tab is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 827
diff changeset
3231 $('#fg').jqxNumberInput(Show3dec);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
3232 $('#brew_fermenter_sg2,#est_fg3').jqxNumberInput(Show3dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3233 $('#final_abv').jqxNumberInput(Show2dec);
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
3234 $('#primary_svg,#secondary_svg,#final_svg').jqxNumberInput(Show1dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3235 $('#FLog').jqxButton({ template: 'info', width: '150px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3236 $('#FLog').click(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3237 // Open log in a new tab.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3238 window.open('log_fermentation.php?code=' + dataRecord.code + '&name=' + dataRecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3239 });
602
10b61aacb1c1 New products field log_ispindel. Add check for ispindel log to crontasks.php Added log_ispindel to prod_edit, pprod_divide, prod_new and prod_duplicate. Renamed some log_fermentation vergisting names into klimaatkast.
Michiel Broek <mbroek@mbse.eu>
parents: 586
diff changeset
3240 $('#ILog').jqxButton({ template: 'info', width: '150px', theme: theme });
10b61aacb1c1 New products field log_ispindel. Add check for ispindel log to crontasks.php Added log_ispindel to prod_edit, pprod_divide, prod_new and prod_duplicate. Renamed some log_fermentation vergisting names into klimaatkast.
Michiel Broek <mbroek@mbse.eu>
parents: 586
diff changeset
3241 $('#ILog').click(function() {
10b61aacb1c1 New products field log_ispindel. Add check for ispindel log to crontasks.php Added log_ispindel to prod_edit, pprod_divide, prod_new and prod_duplicate. Renamed some log_fermentation vergisting names into klimaatkast.
Michiel Broek <mbroek@mbse.eu>
parents: 586
diff changeset
3242 // Open log in a new tab.
10b61aacb1c1 New products field log_ispindel. Add check for ispindel log to crontasks.php Added log_ispindel to prod_edit, pprod_divide, prod_new and prod_duplicate. Renamed some log_fermentation vergisting names into klimaatkast.
Michiel Broek <mbroek@mbse.eu>
parents: 586
diff changeset
3243 window.open('log_ispindel.php?code=' + dataRecord.code + '&name=' + dataRecord.name);
10b61aacb1c1 New products field log_ispindel. Add check for ispindel log to crontasks.php Added log_ispindel to prod_edit, pprod_divide, prod_new and prod_duplicate. Renamed some log_fermentation vergisting names into klimaatkast.
Michiel Broek <mbroek@mbse.eu>
parents: 586
diff changeset
3244 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3245
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3246 // Tab 11, Packaging
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3247 // TODO: high gravity packaging, extra water and recalc abv, color and ibu.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3248 $('#package_date').jqxTooltip({ content: 'De verpakkings datum van dit bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3249 $('#package_volume').jqxTooltip({ content: 'Het beschikbare volume om te bottelen of op fust te zetten.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3250 $('#package_infuse_amount').jqxTooltip({ content: 'De hoeveelheid water of drank extra toe te voegen.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3251 $('#package_infuse_abv').jqxTooltip({ content: 'De hoeveelheid alcohol in de drank, of 0.0 als het water is.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3252 $('#package_infuse_notes').jqxTooltip({ content: 'Omschrijving van de extra toevoeging.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3253 $('#package_abv').jqxTooltip({ content: 'De uiteindelijke hoeveelheid alcohol volume %.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3254 $('#package_ph').jqxTooltip({ content: 'De gemeten pH vlak voor het verpakken.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3255 $('#st_carb_min2').jqxTooltip({ content: 'Het minimum aanbevolen koolzuur volume voor deze bierstijl.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3256 $('#st_carb_max2').jqxTooltip({ content: 'Het maximum aamnevolen koolzuur volume voor deze bierstijl.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3257 $('#bottle_amount').jqxTooltip({ content: 'De totale hoeveelheid te bottelen bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3258 $('#keg_amount').jqxTooltip({ content: 'De totale hoeveelheid op fust te zetten bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3259 $('#bottle_carbonation').jqxTooltip({ content: 'Het gewenste CO2 volume in de flessen.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3260 $('#keg_carbonation').jqxTooltip({ content: 'Het gewenste CO2 volume door de suiker in de fusten.' });
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3261 $('#bottle_priming_water,#keg_priming_water').jqxTooltip({ content: 'De hoeveelheid water om de suiker op te lossen.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3262 $('#bottle_pressure').jqxTooltip({ content: 'De maximaal te verwachten druk tijdens het hergisten.' });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3263 $('#package_date').jqxDateTimeInput(Dateopts);
829
35207369e7ce Packagig is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 828
diff changeset
3264 $('#package_date').jqxDateTimeInput({ disabled: true });
35207369e7ce Packagig is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 828
diff changeset
3265 $('#package_infuse_amount').jqxNumberInput(Show3dec);
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3266 $('#package_infuse_notes').jqxInput({ theme: theme, width: 640, height: 23 });
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3267 $('#package_abv').jqxNumberInput(Show2dec);
829
35207369e7ce Packagig is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 828
diff changeset
3268 $('#package_ph').jqxNumberInput(Show2dec);
633
ec4601ab3ed2 Fixed loading of the product edit page. A bit faster loading.
Michiel Broek <mbroek@mbse.eu>
parents: 623
diff changeset
3269 $('#st_carb_min2,#st_carb_max2').jqxNumberInput(Smal1dec);
829
35207369e7ce Packagig is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 828
diff changeset
3270 $('#package_volume,#package_infuse_abv,#bottle_amount,#keg_amount').jqxNumberInput(Show1dec);
35207369e7ce Packagig is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 828
diff changeset
3271 $('#bottle_carbonation,#keg_carbonation').jqxNumberInput(Show2dec);
35207369e7ce Packagig is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 828
diff changeset
3272 $('#bottle_priming_sugar').jqxInput({ theme: theme, width: 200, height: 23 });
35207369e7ce Packagig is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 828
diff changeset
3273 $('#keg_priming_sugar').jqxInput({ theme: theme, width: 200, height: 23 });
35207369e7ce Packagig is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 828
diff changeset
3274 $('#bottle_priming_water,#keg_priming_water').jqxNumberInput(Show3dec);
35207369e7ce Packagig is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 828
diff changeset
3275 $('#keg_forced_carb').jqxCheckBox({ theme: theme, width: 120, height: 23, disabled: true });
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
3276 $('#bottle_priming_amount,#keg_priming_amount,#bottle_priming_total,#bottle_pressure,#keg_priming_total,#keg_pressure').jqxNumberInput(Show1dec);
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
3277 $('#bottle_abv,#keg_abv').jqxNumberInput(Show2dec);
829
35207369e7ce Packagig is now a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 828
diff changeset
3278 $('#bottle_carbonation_temp,#keg_carbonation_temp').jqxNumberInput(Show1dec);
615
9034e65b0d7a Added CO2 carbonation log to the products database. Added button in the packaging tab.
Michiel Broek <mbroek@mbse.eu>
parents: 613
diff changeset
3279 $('#CLog').jqxButton({ template: 'info', width: '150px', theme: theme });
9034e65b0d7a Added CO2 carbonation log to the products database. Added button in the packaging tab.
Michiel Broek <mbroek@mbse.eu>
parents: 613
diff changeset
3280 $('#CLog').click(function() {
9034e65b0d7a Added CO2 carbonation log to the products database. Added button in the packaging tab.
Michiel Broek <mbroek@mbse.eu>
parents: 613
diff changeset
3281 // Open log in a new tab.
9034e65b0d7a Added CO2 carbonation log to the products database. Added button in the packaging tab.
Michiel Broek <mbroek@mbse.eu>
parents: 613
diff changeset
3282 window.open('log_co2pressure.php?code=' + dataRecord.code + '&name=' + dataRecord.name);
9034e65b0d7a Added CO2 carbonation log to the products database. Added button in the packaging tab.
Michiel Broek <mbroek@mbse.eu>
parents: 613
diff changeset
3283 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3284
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3285 // Tab 12, Tasting
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3286 $('#taste_date').jqxTooltip({ content: 'De proef datum van dit bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3287 $('#taste_date').jqxDateTimeInput(Dateopts);
830
8f3936eef739 The taste tab is now a viwer.
Michiel Broek <mbroek@mbse.eu>
parents: 829
diff changeset
3288 $('#taste_date').jqxDateTimeInput({ disabled: true });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3289 $('#taste_rate').jqxTooltip({ content: 'Het cijfer voor dit bier van 1 tot 10.' });
830
8f3936eef739 The taste tab is now a viwer.
Michiel Broek <mbroek@mbse.eu>
parents: 829
diff changeset
3290 $('#taste_rate').jqxNumberInput(Show1dec);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3291 $('#taste_color').jqxTooltip({ content: 'De kleur van het bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3292 $('#taste_transparency').jqxTooltip({ content: 'De helderheid van het bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3293 $('#taste_head').jqxTooltip({ content: 'Het schuim op het bier.' });
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
3294 $('#taste_color,#taste_transparency,#taste_head').jqxInput({ theme: theme, width: 320, height: 23 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3295 $('#taste_aroma').jqxTooltip({ content: 'Het aroma van het bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3296 $('#taste_taste').jqxTooltip({ content: 'De smaak van het bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3297 $('#taste_aftertaste').jqxTooltip({ content: 'De nasmaak van het bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3298 $('#taste_mouthfeel').jqxTooltip({ content: 'Het mondgevoelvan het bier.' });
610
38b22ccb2bf8 Combined a lot of selectors
Michiel Broek <mbroek@mbse.eu>
parents: 609
diff changeset
3299 $('#taste_aroma,#taste_taste,#taste_aftertaste,#taste_mouthfeel').jqxInput({ theme: theme, width: 960, height: 23 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3300 $('#taste_notes').jqxTooltip({ content: 'Het oordeel en opmerkingen over dit bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3301 $('#taste_notes').jqxInput({ theme: theme, width: 960, height: 100 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3302
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3303 $('#jqxTabs').jqxTabs({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3304 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3305 width: 1280,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3306 height: 660,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3307 autoHeight: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3308 position: 'top'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3309 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3310
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3311 // Buttons below
818
f9c071906643 Removed obsolete scripts. Product editor tab 1 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 817
diff changeset
3312 $('#Terug').jqxButton({ template: 'primary', width: '80px', theme: theme });
f9c071906643 Removed obsolete scripts. Product editor tab 1 is a viewer.
Michiel Broek <mbroek@mbse.eu>
parents: 817
diff changeset
3313 $('#Terug').bind('click', function() {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3314 window.location.href = my_return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3315 });
111
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3316 });
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3317

mercurial